0
|
1 |
/*
|
|
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of the License "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description: ?Description
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
// INCLUDE FILES
|
|
21 |
#include "cmmuiccmesshandler.h"
|
|
22 |
#include "cmmphonetsender.h"
|
|
23 |
#include "tsylogger.h"
|
|
24 |
#include "cmmmessagerouter.h"
|
|
25 |
|
|
26 |
#include <ctsy/serviceapi/mmtsy_ipcdefs.h>
|
|
27 |
#include <e32cmn.h>
|
|
28 |
#include <pn_const.h>
|
|
29 |
#include <uiccisi.h>
|
|
30 |
#include "OstTraceDefinitions.h"
|
|
31 |
#ifdef OST_TRACE_COMPILER_IN_USE
|
|
32 |
#include "cmmuiccmesshandlerTraces.h"
|
|
33 |
#endif
|
|
34 |
|
|
35 |
|
|
36 |
// LOCAL CONSTANTS AND MACROS
|
|
37 |
const TUint8 KUiccPadding( 0 );
|
|
38 |
const TUint8 KUiccSbApplPathSize( SIZE_UICC_SB_APPL_PATH + KFilePathLength );
|
|
39 |
const TUint8 KUiccSbFileDataSize( SIZE_UICC_SB_FILE_DATA + KFileDataLength );
|
|
40 |
const TUint8 KUiccApplCmdReqOffset( ISI_HEADER_SIZE + SIZE_UICC_APPL_CMD_REQ );
|
|
41 |
const TUint8 KUiccRecordNotDefined( 0 );
|
|
42 |
const TUint16 KUiccFileIdNotDefined( 0 );
|
|
43 |
const TUint8 KUiccServiceTypeNotDefined( 0 );
|
|
44 |
const TUint8 KUiccApduReqSubblockOffset(ISI_HEADER_SIZE + SIZE_UICC_APDU_REQ);
|
|
45 |
const TUint8 KUiccSbApduLengthOffset( 6 );
|
|
46 |
const TUint8 KUiccSbApduDataOffset( 8 );
|
|
47 |
const TUint16 KUiccSbApduSize( SIZE_UICC_SB_APDU + KApduDataLength );
|
|
48 |
|
|
49 |
|
|
50 |
// ============================= LOCAL FUNCTIONS ===============================
|
|
51 |
|
|
52 |
void CMmUiccMessHandler::SendTerminalProfile()
|
|
53 |
{
|
|
54 |
// Temporary for testing purposes, terminal profile sending will be moved
|
|
55 |
// to SAT TSY
|
|
56 |
TFLOGSTRING("TSY: CMmUiccMessHandler::SendTerminalProfile TEMPORARY SOLUTION FOR TESTING");
|
|
57 |
OstTrace0( TRACE_NORMAL, CMMUICCMESSHANDLER_SENDTERMINALPROFILE, "CMmUiccMessHandler::SendTerminalProfile TEMPORARY SOLUTION FOR TESTING" );
|
|
58 |
|
|
59 |
// Create UICC_CAT_TERMINAL_PROFILE message
|
|
60 |
TIsiSend isiMsg( iPhoNetSender->SendBufferDes() );
|
|
61 |
isiMsg.Set8bit( ISI_HEADER_OFFSET_RESOURCEID, PN_UICC );
|
|
62 |
isiMsg.Set8bit( ISI_HEADER_SIZE, UICC_CAT_REQ_OFFSET_TRANSID ); // transaction id
|
|
63 |
isiMsg.Set8bit( ISI_HEADER_SIZE + UICC_CAT_REQ_OFFSET_MESSAGEID, UICC_CAT_REQ );
|
|
64 |
isiMsg.Set8bit( ISI_HEADER_SIZE + UICC_CAT_REQ_OFFSET_SERVICETYPE, UICC_CAT_TERMINAL_PROFILE );
|
|
65 |
isiMsg.Set8bit( ISI_HEADER_SIZE + UICC_CAT_REQ_OFFSET_NSB, 1 ); // num of subblocks
|
|
66 |
|
|
67 |
// Create subblock
|
|
68 |
TBuf8<30> terminalProfileBuf( 0 );
|
|
69 |
TIsiSubBlock uiccSbTerminalProfile(
|
|
70 |
terminalProfileBuf,
|
|
71 |
UICC_SB_TERMINAL_PROFILE,
|
|
72 |
EIsiSubBlockTypeId16Len16 );
|
|
73 |
|
|
74 |
// 2x filler
|
|
75 |
terminalProfileBuf.Append( KUiccPadding );
|
|
76 |
terminalProfileBuf.Append( KUiccPadding );
|
|
77 |
|
|
78 |
// Terminal profile length (16-bit)
|
|
79 |
terminalProfileBuf.Append( KUiccPadding );
|
|
80 |
terminalProfileBuf.Append( 1 );
|
|
81 |
terminalProfileBuf.Append( 0 );
|
|
82 |
|
|
83 |
// Append subblock to ISI message
|
|
84 |
isiMsg.CopyData(
|
|
85 |
ISI_HEADER_SIZE + 4,
|
|
86 |
uiccSbTerminalProfile.CompleteSubBlock() );
|
|
87 |
|
|
88 |
iPhoNetSender->Send( isiMsg.Complete() );
|
|
89 |
}
|
|
90 |
|
|
91 |
// ============================ MEMBER FUNCTIONS ===============================
|
|
92 |
|
|
93 |
// -----------------------------------------------------------------------------
|
|
94 |
// TUiccParamsBase::TUiccParamsBase
|
|
95 |
// Constructor
|
|
96 |
// -----------------------------------------------------------------------------
|
|
97 |
//
|
|
98 |
TUiccParamsBase::TUiccParamsBase()
|
|
99 |
{
|
|
100 |
// Initialize data
|
|
101 |
messHandlerPtr = NULL;
|
|
102 |
trId = ETrIdNotDefined;
|
|
103 |
fileId = KUiccFileIdNotDefined;
|
|
104 |
fileIdSfi = UICC_SFI_NOT_PRESENT;
|
|
105 |
serviceType = KUiccServiceTypeNotDefined;
|
|
106 |
filePath.Append( KNullDesC8 );
|
|
107 |
}
|
|
108 |
|
|
109 |
// -----------------------------------------------------------------------------
|
|
110 |
// TUiccApplFileInfo::TUiccApplFileInfo
|
|
111 |
// Constructor
|
|
112 |
// -----------------------------------------------------------------------------
|
|
113 |
//
|
|
114 |
TUiccApplFileInfo::TUiccApplFileInfo()
|
|
115 |
{
|
|
116 |
// None
|
|
117 |
}
|
|
118 |
|
|
119 |
// -----------------------------------------------------------------------------
|
|
120 |
// TUiccReadTransparent::TUiccReadTransparent
|
|
121 |
// Constructor
|
|
122 |
// -----------------------------------------------------------------------------
|
|
123 |
//
|
|
124 |
TUiccReadTransparent::TUiccReadTransparent()
|
|
125 |
{
|
|
126 |
dataOffset = 0;
|
|
127 |
dataAmount = 0;
|
|
128 |
}
|
|
129 |
|
|
130 |
// -----------------------------------------------------------------------------
|
|
131 |
// TUiccWriteTransparent::TUiccWriteTransparent
|
|
132 |
// Constructor
|
|
133 |
// -----------------------------------------------------------------------------
|
|
134 |
//
|
|
135 |
TUiccWriteTransparent::TUiccWriteTransparent()
|
|
136 |
{
|
|
137 |
fileData.Append( KNullDesC8 );
|
|
138 |
}
|
|
139 |
|
|
140 |
// -----------------------------------------------------------------------------
|
|
141 |
// TUiccReadLinearFixed::TUiccReadLinearFixed
|
|
142 |
// Constructor
|
|
143 |
// -----------------------------------------------------------------------------
|
|
144 |
//
|
|
145 |
TUiccReadLinearFixed::TUiccReadLinearFixed()
|
|
146 |
{
|
|
147 |
record = KUiccRecordNotDefined;
|
|
148 |
}
|
|
149 |
|
|
150 |
// -----------------------------------------------------------------------------
|
|
151 |
// TUiccWriteLinearFixed::TUiccWriteLinearFixed
|
|
152 |
// Constructor
|
|
153 |
// -----------------------------------------------------------------------------
|
|
154 |
//
|
|
155 |
TUiccWriteLinearFixed::TUiccWriteLinearFixed()
|
|
156 |
{
|
|
157 |
fileData.Append( KNullDesC8 );
|
|
158 |
}
|
|
159 |
|
|
160 |
// -----------------------------------------------------------------------------
|
|
161 |
// TUiccSendApdu::TUiccSendApdu
|
|
162 |
// Constructor
|
|
163 |
// -----------------------------------------------------------------------------
|
|
164 |
//
|
|
165 |
TUiccSendApdu::TUiccSendApdu():TUiccParamsBase()
|
|
166 |
{
|
|
167 |
apdu.Append( KNullDesC8 );
|
|
168 |
}
|
|
169 |
|
|
170 |
// -----------------------------------------------------------------------------
|
|
171 |
// TUiccParamsApduReq::TUiccParamsApduReq
|
|
172 |
// Constructor
|
|
173 |
// -----------------------------------------------------------------------------
|
|
174 |
//
|
|
175 |
TUiccParamsApduReq::TUiccParamsApduReq():TUiccParamsBase()
|
|
176 |
{
|
|
177 |
action = KUiccRecordNotDefined;
|
|
178 |
apduData.Append( KNullDesC8 );
|
|
179 |
}
|
|
180 |
|
|
181 |
// -----------------------------------------------------------------------------
|
|
182 |
// CMmUiccMessHandler::CMmUiccMessHandler
|
|
183 |
// C++ default constructor can NOT contain any code, that
|
|
184 |
// might leave.
|
|
185 |
// -----------------------------------------------------------------------------
|
|
186 |
//
|
|
187 |
CMmUiccMessHandler::CMmUiccMessHandler()
|
|
188 |
{
|
|
189 |
}
|
|
190 |
|
|
191 |
// -----------------------------------------------------------------------------
|
|
192 |
// CMmUiccMessHandler::ConstructL
|
|
193 |
// Symbian 2nd phase constructor can leave.
|
|
194 |
// -----------------------------------------------------------------------------
|
|
195 |
//
|
|
196 |
void CMmUiccMessHandler::ConstructL(
|
|
197 |
CMmPhoNetSender* aPhoNetSender,
|
|
198 |
CMmPhoNetReceiver* aPhoNetReceiver)
|
|
199 |
{
|
|
200 |
TFLOGSTRING("TSY: CMmUiccMessHandler::ConstructL");
|
|
201 |
OstTrace0( TRACE_NORMAL, CMMUICCMESSHANDLER_CONSTRUCTL, "CMmUiccMessHandler::ConstructL" );
|
|
202 |
|
|
203 |
// Reset the pointer array
|
|
204 |
iMessHandlerPrtList.Reset();
|
|
205 |
iPhoNetSender = aPhoNetSender;
|
|
206 |
aPhoNetReceiver->RegisterL( this, PN_UICC );
|
|
207 |
|
|
208 |
iCardType = UICC_CARD_TYPE_UNKNOWN;
|
|
209 |
iApplicationId = UICC_APPL_ID_UNKNOWN;
|
|
210 |
iApplicationType = UICC_APPL_TYPE_UNKNOWN;
|
|
211 |
iApplicationStatus = UICC_STATUS_APPL_NOT_ACTIVE;
|
|
212 |
iUiccServerStatus = UICC_STATUS_NOT_READY;
|
|
213 |
iUiccClientId = 0;
|
|
214 |
iUiccIsimClientId = 0;
|
|
215 |
iIsimApplicationId = UICC_APPL_ID_UNKNOWN;
|
|
216 |
iIsimApplicationStatus = UICC_STATUS_APPL_NOT_ACTIVE;
|
|
217 |
iIsimApplicationFound = EFalse;
|
|
218 |
iPin1Id = 0;
|
|
219 |
iPin2Id = 0;
|
|
220 |
iActivePin = RMobilePhone::ESecurityCodePin1;
|
|
221 |
iAid.Zero();
|
|
222 |
|
|
223 |
// Initialized for USIM application
|
|
224 |
iApplFileId.Append( 0x7F );
|
|
225 |
iApplFileId.Append( 0xFF );
|
|
226 |
}
|
|
227 |
|
|
228 |
// -----------------------------------------------------------------------------
|
|
229 |
// CMmUiccMessHandler::NewL
|
|
230 |
// Two-phased constructor.
|
|
231 |
// -----------------------------------------------------------------------------
|
|
232 |
//
|
|
233 |
CMmUiccMessHandler* CMmUiccMessHandler::NewL(
|
|
234 |
CMmPhoNetSender* aPhoNetSender,
|
|
235 |
CMmPhoNetReceiver* aPhoNetReceiver,
|
|
236 |
CMmMessageRouter* aMessageRouter )
|
|
237 |
{
|
|
238 |
TFLOGSTRING("TSY: CMmUiccMessHandler::NewL");
|
|
239 |
OstTrace0( TRACE_NORMAL, CMMUICCMESSHANDLER_NEWL, "CMmUiccMessHandler::NewL" );
|
|
240 |
|
|
241 |
CMmUiccMessHandler* uiccMessHandler( new ( ELeave ) CMmUiccMessHandler() );
|
|
242 |
CleanupStack::PushL( uiccMessHandler );
|
|
243 |
uiccMessHandler->iMessageRouter = aMessageRouter;
|
|
244 |
uiccMessHandler->ConstructL( aPhoNetSender, aPhoNetReceiver );
|
|
245 |
CleanupStack::Pop( uiccMessHandler );
|
|
246 |
return uiccMessHandler;
|
|
247 |
}
|
|
248 |
|
|
249 |
// -----------------------------------------------------------------------------
|
|
250 |
// CMmUiccMessHandler::~CMmUiccMessHandler()
|
|
251 |
// Destructor
|
|
252 |
// -----------------------------------------------------------------------------
|
|
253 |
//
|
|
254 |
CMmUiccMessHandler::~CMmUiccMessHandler()
|
|
255 |
{
|
|
256 |
TFLOGSTRING("TSY: CMmUiccMessHandler::~CMmUiccMessHandler");
|
|
257 |
OstTrace0( TRACE_NORMAL, CMMUICCMESSHANDLER_CMMUICCMESSHANDLER, "CMmUiccMessHandler::~CMmUiccMessHandler" );
|
|
258 |
}
|
|
259 |
|
|
260 |
// -----------------------------------------------------------------------------
|
|
261 |
// CMmUiccMessHandler::ReceiveMessageL
|
|
262 |
// Receive ISI messages from phonet
|
|
263 |
// (other items were commented in a header).
|
|
264 |
// -----------------------------------------------------------------------------
|
|
265 |
//
|
|
266 |
void CMmUiccMessHandler::ReceiveMessageL( const TIsiReceiveC& aIsiMsg )
|
|
267 |
{
|
|
268 |
TInt status( KErrNone );
|
|
269 |
TUint8 messageId( aIsiMsg.Get8bit( ISI_HEADER_OFFSET_MESSAGEID ) );
|
|
270 |
TUint8 trId( aIsiMsg.Get8bit( ISI_HEADER_OFFSET_TRANSID ) );
|
|
271 |
TUint8 serviceType( 0 );
|
|
272 |
TPtrC8 fileData;
|
|
273 |
|
|
274 |
TFLOGSTRING3("TSY: CMmUiccMessHandler::ReceiveMessageL, message ID :0x%x, transaction ID: %d", messageId, trId );
|
|
275 |
OstTraceExt2( TRACE_NORMAL, CMMUICCMESSHANDLER_RECEIVEMESSAGEL, "CMmUiccMessHandler::ReceiveMessageL;messageId=%hhx;trId=%hhu", messageId, trId );
|
|
276 |
|
|
277 |
// Get the correct message handler for this operation
|
|
278 |
MUiccOperationBase* messHandler( iMessHandlerPrtList.At( trId ) );
|
|
279 |
|
|
280 |
switch( messageId )
|
|
281 |
{
|
|
282 |
case UICC_CAT_IND:
|
|
283 |
{
|
|
284 |
// Send terminal profile ( to be moved to SAT TSY later )
|
|
285 |
SendTerminalProfile();
|
|
286 |
break;
|
|
287 |
}
|
|
288 |
case UICC_CAT_RESP:
|
|
289 |
{
|
|
290 |
// To be moved to SAT TSY later
|
|
291 |
break;
|
|
292 |
}
|
|
293 |
case UICC_CARD_IND:
|
|
294 |
{
|
|
295 |
serviceType = aIsiMsg.Get8bit(
|
|
296 |
ISI_HEADER_SIZE + UICC_CARD_IND_OFFSET_SERVICETYPE );
|
|
297 |
// Start application activation procedure if the card is ready and
|
|
298 |
// the application is not active yet
|
|
299 |
if ( UICC_CARD_READY == serviceType &&
|
|
300 |
UICC_STATUS_APPL_ACTIVE != iApplicationStatus )
|
|
301 |
{
|
|
302 |
TUiccParamsBase params;
|
|
303 |
params.messHandlerPtr = static_cast<MUiccOperationBase*>( this );
|
|
304 |
params.trId = ETrIdGetUiccApplication;
|
|
305 |
CreateUiccApplicationReq( params, UICC_APPL_LIST );
|
|
306 |
}
|
|
307 |
// No else. Application was active already
|
|
308 |
break;
|
|
309 |
}
|
|
310 |
case UICC_RESP:
|
|
311 |
{
|
|
312 |
iUiccServerStatus = HandleUiccResp( aIsiMsg );
|
|
313 |
// Start application activation procedure if the card is ready and
|
|
314 |
// the application is not active yet
|
|
315 |
if ( UICC_STATUS_START_UP_COMPLETED == iUiccServerStatus &&
|
|
316 |
UICC_STATUS_APPL_ACTIVE != iApplicationStatus)
|
|
317 |
{
|
|
318 |
// Read the application ID
|
|
319 |
TUiccParamsBase params;
|
|
320 |
params.messHandlerPtr = static_cast<MUiccOperationBase*>( this );
|
|
321 |
params.trId = ETrIdGetUiccApplication;
|
|
322 |
CreateUiccApplicationReq( params, UICC_APPL_LIST );
|
|
323 |
}
|
|
324 |
break;
|
|
325 |
}
|
|
326 |
case UICC_APPLICATION_RESP:
|
|
327 |
{
|
|
328 |
status = HandleUiccApplicationResp( aIsiMsg );
|
|
329 |
break;
|
|
330 |
}
|
|
331 |
case UICC_APPLICATION_IND:
|
|
332 |
{
|
|
333 |
TInt8 serviceType( aIsiMsg.Get8bit(
|
|
334 |
ISI_HEADER_SIZE + UICC_APPLICATION_IND_OFFSET_SERVICETYPE ) );
|
|
335 |
|
|
336 |
iApplicationStatus = UICC_STATUS_APPL_ACTIVE;
|
|
337 |
// Application activation indication with service type
|
|
338 |
// UICC_APPL_ACTIVATED, as part of PowerOnSim sequence.
|
|
339 |
// Transaction id is set to ETrIdSimPowerOn and operation
|
|
340 |
// is added to list and flag is disabled.
|
|
341 |
if( UICC_APPL_ACTIVATED == serviceType )
|
|
342 |
{
|
|
343 |
iDoNotRemoveTransactionID = EFalse;
|
|
344 |
status = KErrNone;
|
|
345 |
trId = ETrIdSimPowerOn;
|
|
346 |
messHandler = iMessHandlerPrtList.At( trId );
|
|
347 |
}
|
|
348 |
break;
|
|
349 |
}
|
|
350 |
case UICC_APPL_CMD_RESP:
|
|
351 |
{
|
|
352 |
status = aIsiMsg.Get8bit(
|
|
353 |
ISI_HEADER_SIZE + UICC_APPL_CMD_RESP_OFFSET_STATUS );
|
|
354 |
TInt8 serviceType( aIsiMsg.Get8bit(
|
|
355 |
ISI_HEADER_SIZE + UICC_APPL_CMD_RESP_OFFSET_SERVICETYPE ) );
|
|
356 |
|
|
357 |
if ( UICC_STATUS_OK == status )
|
|
358 |
{
|
|
359 |
// If READ operation was required, read data from subblock
|
|
360 |
if ( UICC_APPL_READ_TRANSPARENT == serviceType ||
|
|
361 |
UICC_APPL_READ_LINEAR_FIXED == serviceType )
|
|
362 |
{
|
|
363 |
fileData.Set( GetFileData( aIsiMsg ) );
|
|
364 |
}
|
|
365 |
if ( UICC_APPL_FILE_INFO == serviceType )
|
|
366 |
{
|
|
367 |
fileData.Set( GetFileFCI( aIsiMsg ) );
|
|
368 |
}
|
|
369 |
if ( UICC_APPL_APDU_SEND == serviceType )
|
|
370 |
{
|
|
371 |
fileData.Set( GetApduData( aIsiMsg ) );
|
|
372 |
}
|
|
373 |
}
|
|
374 |
else
|
|
375 |
{
|
|
376 |
TFLOGSTRING2("TSY: CMmUiccMessHandler::ReceiveMessageL, case UICC_APPL_CMD_RESP, status: %d", status );
|
|
377 |
OstTraceExt1( TRACE_NORMAL, DUP1_CMMUICCMESSHANDLER_RECEIVEMESSAGEL, "CMmUiccMessHandler::ReceiveMessageL, case UICC_APPL_CMD_RESP;status=%hhu", status );
|
|
378 |
}
|
|
379 |
break;
|
|
380 |
}
|
|
381 |
case UICC_APDU_RESP:
|
|
382 |
{
|
|
383 |
status = aIsiMsg.Get8bit(
|
|
384 |
ISI_HEADER_SIZE + UICC_APDU_RESP_OFFSET_STATUS );
|
|
385 |
TInt8 serviceType( aIsiMsg.Get8bit(
|
|
386 |
ISI_HEADER_SIZE + UICC_APDU_RESP_OFFSET_SERVICETYPE ) );
|
|
387 |
|
|
388 |
// Extract actual APDU from SB_APDU
|
|
389 |
if( UICC_STATUS_OK == status )
|
|
390 |
{
|
|
391 |
if( UICC_APDU_ATR_GET == serviceType
|
|
392 |
|| UICC_APDU_SEND == serviceType )
|
|
393 |
{
|
|
394 |
fileData.Set( GetApduData( aIsiMsg ) );
|
|
395 |
}
|
|
396 |
}
|
|
397 |
break;
|
|
398 |
}
|
|
399 |
case UICC_APDU_RESET_IND:
|
|
400 |
{
|
|
401 |
TInt8 serviceType( aIsiMsg.Get8bit(
|
|
402 |
ISI_HEADER_SIZE + UICC_APDU_RESET_IND_OFFSET_SERVICETYPE ) );
|
|
403 |
|
|
404 |
// Indication that SAP APDU interface is activated
|
|
405 |
if( UICC_READY == serviceType )
|
|
406 |
{
|
|
407 |
// Disable flag
|
|
408 |
iDoNotRemoveTransactionID = EFalse;
|
|
409 |
status = KErrNone;
|
|
410 |
}
|
|
411 |
break;
|
|
412 |
}
|
|
413 |
case UICC_CONNECTOR_RESP:
|
|
414 |
{
|
|
415 |
status = aIsiMsg.Get8bit(
|
|
416 |
ISI_HEADER_SIZE + UICC_CONNECTOR_RESP_OFFSET_STATUS );
|
|
417 |
}
|
|
418 |
break;
|
|
419 |
case UICC_CARD_RESP:
|
|
420 |
{
|
|
421 |
status = aIsiMsg.Get8bit(
|
|
422 |
ISI_HEADER_SIZE + UICC_CARD_RESP_OFFSET_STATUS );
|
|
423 |
TUint8 serviceType( aIsiMsg.Get8bit(
|
|
424 |
ISI_HEADER_SIZE + UICC_CARD_RESP_OFFSET_SERVICETYPE ) );
|
|
425 |
|
|
426 |
if( UICC_STATUS_OK == status
|
|
427 |
&& UICC_CARD_STATUS_GET == serviceType )
|
|
428 |
{
|
|
429 |
// File data from SIZE_UICC_SB_CARD_STATUS
|
|
430 |
TUint uiccSbFileDataOffset( 0 );
|
|
431 |
TInt cardStatusFieldLength( 1 );
|
|
432 |
|
|
433 |
if ( KErrNone == aIsiMsg.FindSubBlockOffsetById(
|
|
434 |
ISI_HEADER_SIZE + SIZE_UICC_CARD_RESP,
|
|
435 |
UICC_SB_CARD_STATUS,
|
|
436 |
EIsiSubBlockTypeId16Len16,
|
|
437 |
uiccSbFileDataOffset ) )
|
|
438 |
{
|
|
439 |
fileData.Set(aIsiMsg.GetData(
|
|
440 |
uiccSbFileDataOffset +
|
|
441 |
UICC_SB_CARD_STATUS_OFFSET_CARDSTATUS,
|
|
442 |
cardStatusFieldLength) );
|
|
443 |
}
|
|
444 |
}
|
|
445 |
}
|
|
446 |
break;
|
|
447 |
default:
|
|
448 |
{
|
|
449 |
TFLOGSTRING("TSY: CMmUiccMessHandler::ReceiveMessageL, default" );
|
|
450 |
OstTrace0( TRACE_NORMAL, DUP2_CMMUICCMESSHANDLER_RECEIVEMESSAGEL, "CMmUiccMessHandler::ReceiveMessageL, default" );
|
|
451 |
break;
|
|
452 |
}
|
|
453 |
}
|
|
454 |
|
|
455 |
if ( NULL != messHandler )
|
|
456 |
{
|
|
457 |
if( !iDoNotRemoveTransactionID )
|
|
458 |
{
|
|
459 |
iMessHandlerPrtList[trId] = NULL;
|
|
460 |
}
|
|
461 |
messHandler->ProcessUiccMsg( trId, status, fileData );
|
|
462 |
}
|
|
463 |
else
|
|
464 |
{
|
|
465 |
TFLOGSTRING("TSY: CMmUiccMessHandler::ReceiveMessageL, message handler not found -> no further handling of this message" );
|
|
466 |
OstTrace0( TRACE_NORMAL, DUP3_CMMUICCMESSHANDLER_RECEIVEMESSAGEL, "CMmUiccMessHandler::ReceiveMessageL, message handler not found -> no further handling of this message" );
|
|
467 |
}
|
|
468 |
}
|
|
469 |
|
|
470 |
// -----------------------------------------------------------------------------
|
|
471 |
// CMmUiccMessHandler::CreateUiccApplCmdReq
|
|
472 |
// (other items were commented in a header).
|
|
473 |
// -----------------------------------------------------------------------------
|
|
474 |
//
|
|
475 |
TInt CMmUiccMessHandler::CreateUiccApplCmdReq(
|
|
476 |
const TUiccParamsBase& aParams,
|
|
477 |
const TUint8 aApplType )
|
|
478 |
{
|
|
479 |
TInt ret( KErrNone );
|
|
480 |
TInt trId( aParams.trId );
|
|
481 |
TInt8 serviceType( aParams.serviceType );
|
|
482 |
TUint8 numOfSubblocks( 0 );
|
|
483 |
TUint8 sizeOfApplPathSubblock( 0 );
|
|
484 |
|
|
485 |
TFLOGSTRING2("TSY: CMmUiccMessHandler::CreateUiccApplCmdReq, transaction ID: %d", trId );
|
|
486 |
OstTrace1( TRACE_NORMAL, CMMUICCMESSHANDLER_CREATEUICCAPPLCMDREQ, "CMmUiccMessHandler::CreateUiccApplCmdReq;trId=%d", trId );
|
|
487 |
|
|
488 |
TUint8 applId( aApplType == UICC_APPL_TYPE_UICC_ISIM ?
|
|
489 |
iIsimApplicationId : iApplicationId );
|
|
490 |
|
|
491 |
// If there is the previous request ongoing (pointer was already set for
|
|
492 |
// this operation) we can't handle this request.
|
|
493 |
if ( NULL == iMessHandlerPrtList.At( trId ) )
|
|
494 |
{
|
|
495 |
// Save pointer to message handler, it is needed when receiving
|
|
496 |
// respone for this operation
|
|
497 |
iMessHandlerPrtList[trId] = aParams.messHandlerPtr;
|
|
498 |
// Create UICC_APPL_CMD_REQ message
|
|
499 |
TIsiSend isiMsg( iPhoNetSender->SendBufferDes() );
|
|
500 |
isiMsg.Set8bit( ISI_HEADER_OFFSET_RESOURCEID, PN_UICC );
|
|
501 |
isiMsg.Set8bit(
|
|
502 |
ISI_HEADER_SIZE + UICC_APPL_CMD_REQ_OFFSET_TRANSID,
|
|
503 |
trId );
|
|
504 |
isiMsg.Set8bit(
|
|
505 |
ISI_HEADER_SIZE + UICC_APPL_CMD_REQ_OFFSET_MESSAGEID,
|
|
506 |
UICC_APPL_CMD_REQ );
|
|
507 |
isiMsg.Set8bit(
|
|
508 |
ISI_HEADER_SIZE + UICC_APPL_CMD_REQ_OFFSET_SERVICETYPE,
|
|
509 |
serviceType );
|
|
510 |
isiMsg.Set8bit(
|
|
511 |
ISI_HEADER_SIZE + UICC_APPL_CMD_REQ_OFFSET_APPLID,
|
|
512 |
applId );
|
|
513 |
isiMsg.Set8bit(
|
|
514 |
ISI_HEADER_SIZE + UICC_APPL_CMD_REQ_OFFSET_SESSIONID,
|
|
515 |
UICC_SESSION_ID_NOT_USED );
|
|
516 |
isiMsg.Set16bit(
|
|
517 |
ISI_HEADER_SIZE + UICC_APPL_CMD_REQ_OFFSET_FILLERBYTE1,
|
|
518 |
KUiccPadding );
|
|
519 |
|
|
520 |
switch ( serviceType )
|
|
521 |
{
|
|
522 |
case UICC_APPL_READ_TRANSPARENT:
|
|
523 |
{
|
|
524 |
numOfSubblocks = 3;
|
|
525 |
// Create and append UICC_SB_CLIENT
|
|
526 |
CreateUiccSbClient( isiMsg, KUiccApplCmdReqOffset );
|
|
527 |
// Create and append UICC_SB_TRANSPARENT
|
|
528 |
CreateUiccSbTransparent(
|
|
529 |
static_cast <const TUiccReadTransparent&>( aParams ),
|
|
530 |
isiMsg,
|
|
531 |
KUiccApplCmdReqOffset + SIZE_UICC_SB_CLIENT );
|
|
532 |
// Create and append UICC_SB_APPL_PATH
|
|
533 |
CreateUiccSbApplPath(
|
|
534 |
aParams,
|
|
535 |
isiMsg,
|
|
536 |
KUiccApplCmdReqOffset + SIZE_UICC_SB_CLIENT +
|
|
537 |
SIZE_UICC_SB_TRANSPARENT,
|
|
538 |
sizeOfApplPathSubblock );
|
|
539 |
break;
|
|
540 |
}
|
|
541 |
case UICC_APPL_UPDATE_TRANSPARENT:
|
|
542 |
{
|
|
543 |
numOfSubblocks = 4;
|
|
544 |
// Create and append UICC_SB_CLIENT
|
|
545 |
CreateUiccSbClient( isiMsg, KUiccApplCmdReqOffset );
|
|
546 |
// Create and append UICC_SB_TRANSPARENT
|
|
547 |
CreateUiccSbTransparent(
|
|
548 |
static_cast <const TUiccWriteTransparent&>( aParams ),
|
|
549 |
isiMsg,
|
|
550 |
KUiccApplCmdReqOffset + SIZE_UICC_SB_CLIENT );
|
|
551 |
// Create and append UICC_SB_APPL_PATH
|
|
552 |
CreateUiccSbApplPath(
|
|
553 |
static_cast <const TUiccWriteTransparent&>( aParams ),
|
|
554 |
isiMsg,
|
|
555 |
KUiccApplCmdReqOffset + SIZE_UICC_SB_CLIENT +
|
|
556 |
SIZE_UICC_SB_TRANSPARENT,
|
|
557 |
sizeOfApplPathSubblock );
|
|
558 |
// Create and append UICC_SB_FILE_DATA
|
|
559 |
CreateUiccSbFileData(
|
|
560 |
isiMsg,
|
|
561 |
KUiccApplCmdReqOffset + SIZE_UICC_SB_CLIENT +
|
|
562 |
SIZE_UICC_SB_TRANSPARENT + sizeOfApplPathSubblock,
|
|
563 |
static_cast
|
|
564 |
<const TUiccWriteTransparent&>( aParams ).fileData );
|
|
565 |
break;
|
|
566 |
}
|
|
567 |
case UICC_APPL_READ_LINEAR_FIXED:
|
|
568 |
{
|
|
569 |
numOfSubblocks = 3;
|
|
570 |
// Create and append UICC_SB_CLIENT
|
|
571 |
CreateUiccSbClient( isiMsg, KUiccApplCmdReqOffset );
|
|
572 |
// Create and append UICC_SB_LINEAR_FIXED
|
|
573 |
CreateUiccSbLinearFixed(
|
|
574 |
static_cast <const TUiccReadLinearFixed&>( aParams ),
|
|
575 |
isiMsg,
|
|
576 |
KUiccApplCmdReqOffset + SIZE_UICC_SB_CLIENT );
|
|
577 |
// Create and append UICC_SB_APPL_PATH
|
|
578 |
CreateUiccSbApplPath(
|
|
579 |
static_cast <const TUiccReadLinearFixed&>( aParams ),
|
|
580 |
isiMsg,
|
|
581 |
KUiccApplCmdReqOffset + SIZE_UICC_SB_CLIENT +
|
|
582 |
SIZE_UICC_SB_LINEAR_FIXED,
|
|
583 |
sizeOfApplPathSubblock );
|
|
584 |
break;
|
|
585 |
}
|
|
586 |
case UICC_APPL_UPDATE_LINEAR_FIXED:
|
|
587 |
{
|
|
588 |
// UICC_SB_LINEAR_FIXED, UICC_SB_APPL_PATH, UICC_SB_FILE_DATA
|
|
589 |
numOfSubblocks = 4;
|
|
590 |
// Create and append UICC_SB_CLIENT
|
|
591 |
CreateUiccSbClient( isiMsg, KUiccApplCmdReqOffset );
|
|
592 |
// Create and append UICC_SB_LINEAR_FIXED
|
|
593 |
CreateUiccSbLinearFixed(
|
|
594 |
static_cast <const TUiccWriteLinearFixed&>( aParams ),
|
|
595 |
isiMsg,
|
|
596 |
KUiccApplCmdReqOffset + SIZE_UICC_SB_CLIENT );
|
|
597 |
// Create and append UICC_SB_APPL_PATH
|
|
598 |
CreateUiccSbApplPath(
|
|
599 |
static_cast <const TUiccWriteLinearFixed&>( aParams ),
|
|
600 |
isiMsg,
|
|
601 |
KUiccApplCmdReqOffset + SIZE_UICC_SB_CLIENT +
|
|
602 |
SIZE_UICC_SB_LINEAR_FIXED,
|
|
603 |
sizeOfApplPathSubblock );
|
|
604 |
// Create and append UICC_SB_FILE_DATA
|
|
605 |
CreateUiccSbFileData(
|
|
606 |
isiMsg,
|
|
607 |
KUiccApplCmdReqOffset + SIZE_UICC_SB_CLIENT +
|
|
608 |
SIZE_UICC_SB_TRANSPARENT + sizeOfApplPathSubblock,
|
|
609 |
static_cast
|
|
610 |
<const TUiccWriteLinearFixed&>( aParams ).fileData);
|
|
611 |
break;
|
|
612 |
}
|
|
613 |
case UICC_APPL_FILE_INFO:
|
|
614 |
{
|
|
615 |
numOfSubblocks = 1;
|
|
616 |
// Create and append UICC_SB_APPL_PATH
|
|
617 |
CreateUiccSbApplPath(
|
|
618 |
aParams,
|
|
619 |
isiMsg,
|
|
620 |
KUiccApplCmdReqOffset,
|
|
621 |
sizeOfApplPathSubblock );
|
|
622 |
break;
|
|
623 |
}
|
|
624 |
case UICC_APPL_APDU_SEND:
|
|
625 |
{
|
|
626 |
numOfSubblocks = 3;
|
|
627 |
// Create and append UICC_SB_CLIENT
|
|
628 |
CreateUiccSbClient( isiMsg, KUiccApplCmdReqOffset, aApplType );
|
|
629 |
// Create and append UICC_SB_APPL_PATH
|
|
630 |
CreateUiccSbApplPath(
|
|
631 |
aParams,
|
|
632 |
isiMsg,
|
|
633 |
KUiccApplCmdReqOffset + SIZE_UICC_SB_CLIENT,
|
|
634 |
sizeOfApplPathSubblock );
|
|
635 |
// Create and append UICC_SB_APDU
|
|
636 |
const TUiccSendApdu* tmpPtr = static_cast<const TUiccSendApdu*>( &aParams );
|
|
637 |
CreateUiccSbApdu(
|
|
638 |
isiMsg,
|
|
639 |
KUiccApplCmdReqOffset + SIZE_UICC_SB_CLIENT +
|
|
640 |
sizeOfApplPathSubblock,
|
|
641 |
tmpPtr->apdu );
|
|
642 |
break;
|
|
643 |
}
|
|
644 |
default:
|
|
645 |
{
|
|
646 |
ret = KErrArgument;
|
|
647 |
TFLOGSTRING("TSY: CMmUiccMessHandler::CreateUiccApplCmdReq, unknown service type!" );
|
|
648 |
OstTrace0( TRACE_NORMAL, DUP2_CMMUICCMESSHANDLER_CREATEUICCAPPLCMDREQ, "CMmUiccMessHandler::CreateUiccApplCmdReq, unknown service type!" );
|
|
649 |
break;
|
|
650 |
}
|
|
651 |
} // End of switch ( serviceType )
|
|
652 |
|
|
653 |
if ( KErrNone == ret )
|
|
654 |
{
|
|
655 |
// Set number of subblocks
|
|
656 |
isiMsg.Set8bit(
|
|
657 |
ISI_HEADER_SIZE + UICC_APPL_CMD_REQ_OFFSET_NSB,
|
|
658 |
numOfSubblocks );
|
|
659 |
return( iPhoNetSender->Send( isiMsg.Complete() ) );
|
|
660 |
}
|
|
661 |
} // End of if ( NULL == iMessHandlerPrtList.At( trId ) )
|
|
662 |
else
|
|
663 |
{
|
|
664 |
TFLOGSTRING("TSY: CMmUiccMessHandler::CreateUiccApplCmdReq, cannot handle the request, server busy!" );
|
|
665 |
OstTrace0( TRACE_NORMAL, DUP1_CMMUICCMESSHANDLER_CREATEUICCAPPLCMDREQ, "CMmUiccMessHandler::CreateUiccApplCmdReq, cannot handle the request, server busy!" );
|
|
666 |
ret = KErrServerBusy;
|
|
667 |
}
|
|
668 |
return ret;
|
|
669 |
}
|
|
670 |
|
|
671 |
// -----------------------------------------------------------------------------
|
|
672 |
// CMmUiccMessHandler::CreateUiccApplicationReq
|
|
673 |
// (other items were commented in a header).
|
|
674 |
// -----------------------------------------------------------------------------
|
|
675 |
//
|
|
676 |
TInt CMmUiccMessHandler::CreateUiccApplicationReq(
|
|
677 |
const TUiccParamsBase& aParams,
|
|
678 |
TUint8 aServiceType,
|
|
679 |
TUint8 aApplType )
|
|
680 |
{
|
|
681 |
TFLOGSTRING2("TSY: CMmUiccMessHandler::CreateUiccApplicationReq, service type: %d", aServiceType );
|
|
682 |
OstTraceExt1( TRACE_NORMAL, CMMUICCMESSHANDLER_CREATEUICCAPPLICATIONREQ, "CMmUiccMessHandler::CreateUiccApplicationReq;aServiceType=%hhu", aServiceType );
|
|
683 |
|
|
684 |
TInt ret (KErrGeneral);
|
|
685 |
TUiccTrId trId( aParams.trId );
|
|
686 |
TUint8 numOfSubblocks( 0 );
|
|
687 |
|
|
688 |
// If there is the previous request ongoing (pointer was already set for
|
|
689 |
// this operation) we can't handle this request.
|
|
690 |
if ( NULL == iMessHandlerPrtList.At( trId ) )
|
|
691 |
{
|
|
692 |
// Save pointer to message handler, it is needed when receiving
|
|
693 |
// response for this operation
|
|
694 |
iMessHandlerPrtList[trId] = aParams.messHandlerPtr;
|
|
695 |
|
|
696 |
// Create the ISI message
|
|
697 |
TIsiSend isiMsg( iPhoNetSender->SendBufferDes() );
|
|
698 |
isiMsg.Set8bit( ISI_HEADER_OFFSET_RESOURCEID, PN_UICC );
|
|
699 |
isiMsg.Set8bit(
|
|
700 |
ISI_HEADER_SIZE + UICC_APPLICATION_REQ_OFFSET_MESSAGEID,
|
|
701 |
UICC_APPLICATION_REQ );
|
|
702 |
isiMsg.Set8bit(
|
|
703 |
ISI_HEADER_SIZE + UICC_APPLICATION_REQ_OFFSET_SERVICETYPE,
|
|
704 |
aServiceType );
|
|
705 |
|
|
706 |
switch ( aServiceType )
|
|
707 |
{
|
|
708 |
case UICC_APPL_LIST:
|
|
709 |
{
|
|
710 |
// No subblocks in this case
|
|
711 |
break;
|
|
712 |
}
|
|
713 |
case UICC_APPL_HOST_ACTIVATE:
|
|
714 |
{
|
|
715 |
numOfSubblocks = 1;
|
|
716 |
CreateUiccSbApplication(
|
|
717 |
isiMsg,
|
|
718 |
ISI_HEADER_SIZE + SIZE_UICC_APPLICATION_REQ,
|
|
719 |
aApplType );
|
|
720 |
break;
|
|
721 |
}
|
|
722 |
default:
|
|
723 |
{
|
|
724 |
break;
|
|
725 |
}
|
|
726 |
}
|
|
727 |
|
|
728 |
// Set transaction ID and number of subblocks to ISI message
|
|
729 |
isiMsg.Set8bit(
|
|
730 |
ISI_HEADER_SIZE + UICC_APPLICATION_REQ_OFFSET_TRANSID,
|
|
731 |
trId );
|
|
732 |
isiMsg.Set8bit(
|
|
733 |
ISI_HEADER_SIZE + UICC_APPLICATION_REQ_OFFSET_NSB,
|
|
734 |
numOfSubblocks );
|
|
735 |
ret = iPhoNetSender->Send( isiMsg.Complete() );
|
|
736 |
}
|
|
737 |
else
|
|
738 |
{
|
|
739 |
TFLOGSTRING("TSY: CMmUiccMessHandler::CreateUiccApplicationReq, cannot handle the request, server busy!" );
|
|
740 |
OstTrace0( TRACE_NORMAL, DUP1_CMMUICCMESSHANDLER_CREATEUICCAPPLICATIONREQ, "CMmUiccMessHandler::CreateUiccApplicationReq, cannot handle the request, server busy!" );
|
|
741 |
ret = KErrServerBusy;
|
|
742 |
}
|
|
743 |
return ret;
|
|
744 |
}
|
|
745 |
|
|
746 |
// -----------------------------------------------------------------------------
|
|
747 |
// CMmUiccMessHandler::GetApplicationId
|
|
748 |
// (other items were commented in a header).
|
|
749 |
// -----------------------------------------------------------------------------
|
|
750 |
//
|
|
751 |
TUint8 CMmUiccMessHandler::GetApplicationId() const
|
|
752 |
{
|
|
753 |
TFLOGSTRING2("TSY: CMmUiccMessHandler::GetApplicationId, application ID: %d", iApplicationId );
|
|
754 |
OstTraceExt1( TRACE_NORMAL, CMMUICCMESSHANDLER_GETAPPLICATIONID, "CMmUiccMessHandler::GetApplicationId;aApplId=%hhu", iApplicationId );
|
|
755 |
return iApplicationId;
|
|
756 |
}
|
|
757 |
|
|
758 |
// -----------------------------------------------------------------------------
|
|
759 |
// CMmUiccMessHandler::GetApplicationType
|
|
760 |
// (other items were commented in a header).
|
|
761 |
// -----------------------------------------------------------------------------
|
|
762 |
//
|
|
763 |
TUint8 CMmUiccMessHandler::GetApplicationType() const
|
|
764 |
{
|
|
765 |
TFLOGSTRING2("TSY: CMmUiccMessHandler::GetApplicationType, application type: %d", iApplicationType );
|
|
766 |
OstTraceExt1( TRACE_NORMAL, CMMUICCMESSHANDLER_GETAPPLICATIONTYPE, "CMmUiccMessHandler::GetApplicationType;aApplType=%hhu", iApplicationType );
|
|
767 |
return iApplicationType;
|
|
768 |
}
|
|
769 |
|
|
770 |
// -----------------------------------------------------------------------------
|
|
771 |
// CMmUiccMessHandler::GetApplicationFileId
|
|
772 |
// (other items were commented in a header).
|
|
773 |
// -----------------------------------------------------------------------------
|
|
774 |
//
|
|
775 |
const TDesC8& CMmUiccMessHandler::GetApplicationFileId() const
|
|
776 |
{
|
|
777 |
TFLOGSTRING("TSY: CMmUiccMessHandler::GetApplicationFileId" );
|
|
778 |
OstTrace0( TRACE_NORMAL, CMMUICCMESSHANDLER_GETAPPLICATIONFILEID, "CMmUiccMessHandler::GetApplicationFileId" );
|
|
779 |
return iApplFileId;
|
|
780 |
}
|
|
781 |
|
|
782 |
// -----------------------------------------------------------------------------
|
|
783 |
// CMmUiccMessHandler::GetCardType
|
|
784 |
// (other items were commented in a header).
|
|
785 |
// -----------------------------------------------------------------------------
|
|
786 |
//
|
|
787 |
TUint8 CMmUiccMessHandler::GetCardType() const
|
|
788 |
{
|
|
789 |
TFLOGSTRING("TSY: CMmUiccMessHandler::GetCardType" );
|
|
790 |
OstTrace0( TRACE_NORMAL, CMMUICCMESSHANDLER_GETCARDTYPE, "CMmUiccMessHandler::GetCardType" );
|
|
791 |
return iCardType;
|
|
792 |
}
|
|
793 |
|
|
794 |
// -----------------------------------------------------------------------------
|
|
795 |
// CMmUiccMessHandler::GetIsimApplicationStatus
|
|
796 |
// (other items were commented in a header).
|
|
797 |
// -----------------------------------------------------------------------------
|
|
798 |
//
|
|
799 |
TUint8 CMmUiccMessHandler::GetIsimApplicationStatus() const
|
|
800 |
{
|
|
801 |
TFLOGSTRING("TSY: CMmUiccMessHandler::GetIsimApplicationStatus" );
|
|
802 |
OstTrace0( TRACE_NORMAL, CMMUICCMESSHANDLER_GETISIMAPPLICATIONSTATUS, "CMmUiccMessHandler::GetIsimApplicationStatus" );
|
|
803 |
return iIsimApplicationStatus;
|
|
804 |
}
|
|
805 |
|
|
806 |
// -----------------------------------------------------------------------------
|
|
807 |
// CMmUiccMessHandler::IsIsimApplicationFound
|
|
808 |
// (other items were commented in a header).
|
|
809 |
// -----------------------------------------------------------------------------
|
|
810 |
//
|
|
811 |
TBool CMmUiccMessHandler::IsIsimApplicationFound() const
|
|
812 |
{
|
|
813 |
TFLOGSTRING("TSY: CMmUiccMessHandler::IsIsimApplicationFound" );
|
|
814 |
OstTrace0( TRACE_NORMAL, CMMUICCMESSHANDLER_ISISIMAPPLICATIONFOUND, "CMmUiccMessHandler::IsIsimApplicationFound" );
|
|
815 |
return iIsimApplicationFound;
|
|
816 |
}
|
|
817 |
|
|
818 |
// -----------------------------------------------------------------------------
|
|
819 |
// CMmUiccMessHandler::GetAid
|
|
820 |
// (other items were commented in a header).
|
|
821 |
// -----------------------------------------------------------------------------
|
|
822 |
//
|
|
823 |
const RMobilePhone::TAID& CMmUiccMessHandler::GetAid() const
|
|
824 |
{
|
|
825 |
TFLOGSTRING("TSY: CMmUiccMessHandler::GetAid" );
|
|
826 |
OstTrace0( TRACE_NORMAL, DUP1_CMMUICCMESSHANDLER_GETAPPLICATIONFILEID, "CMmUiccMessHandler::GetApplicationFileId" );
|
|
827 |
return iAid;
|
|
828 |
}
|
|
829 |
// -----------------------------------------------------------------------------
|
|
830 |
// CMmUiccMessHandler::CreateUiccSbApplPath
|
|
831 |
// (other items were commented in a header).
|
|
832 |
// -----------------------------------------------------------------------------
|
|
833 |
//
|
|
834 |
void CMmUiccMessHandler::CreateUiccSbApplPath(
|
|
835 |
const TUiccParamsBase& aParams,
|
|
836 |
TIsiSend& aIsiMsg,
|
|
837 |
TUint8 aMsgOffset,
|
|
838 |
TUint8& aSizeOfSubblock )
|
|
839 |
{
|
|
840 |
TFLOGSTRING("TSY: CMmUiccMessHandler::CreateUiccSbApplPath" );
|
|
841 |
OstTrace0( TRACE_NORMAL, CMMUICCMESSHANDLER_CREATEUICCSBAPPLPATH, "CMmUiccMessHandler::CreateUiccSbApplPath" );
|
|
842 |
|
|
843 |
// UICC_SB_APPL_PATH subblock
|
|
844 |
TBuf8<KUiccSbApplPathSize> uiccSbApplPathBuf( 0 );
|
|
845 |
TIsiSubBlock uiccSbApplPath(
|
|
846 |
uiccSbApplPathBuf,
|
|
847 |
UICC_SB_APPL_PATH,
|
|
848 |
EIsiSubBlockTypeId16Len16 );
|
|
849 |
|
|
850 |
// File ID, 16-bit
|
|
851 |
uiccSbApplPathBuf.Append( static_cast<TUint8>( aParams.fileId >> 8 ) );
|
|
852 |
uiccSbApplPathBuf.Append( static_cast<TUint8>( aParams.fileId ) );
|
|
853 |
// File ID SFI, 8-bit
|
|
854 |
uiccSbApplPathBuf.Append( aParams.fileIdSfi );
|
|
855 |
// Filler, 8-bit
|
|
856 |
uiccSbApplPathBuf.Append( KUiccPadding );
|
|
857 |
// Length of the DF path, 8-bit
|
|
858 |
uiccSbApplPathBuf.Append( aParams.filePath.Length() );
|
|
859 |
// Filler, 8-bit
|
|
860 |
uiccSbApplPathBuf.Append( KUiccPadding );
|
|
861 |
// Application file ID depends on card type, USIM or SIM
|
|
862 |
uiccSbApplPathBuf.Append( aParams.filePath );
|
|
863 |
// Append subblock to ISI message
|
|
864 |
aIsiMsg.CopyData( aMsgOffset, uiccSbApplPath.CompleteSubBlock() );
|
|
865 |
|
|
866 |
aSizeOfSubblock = uiccSbApplPathBuf.Length();
|
|
867 |
}
|
|
868 |
|
|
869 |
// -----------------------------------------------------------------------------
|
|
870 |
// CMmUiccMessHandler::CreateUiccSbClient
|
|
871 |
// (other items were commented in a header).
|
|
872 |
// -----------------------------------------------------------------------------
|
|
873 |
//
|
|
874 |
void CMmUiccMessHandler::CreateUiccSbClient(
|
|
875 |
TIsiSend& aIsiMsg,
|
|
876 |
TUint8 aMsgOffset,
|
|
877 |
const TUint8 aApplType )
|
|
878 |
{
|
|
879 |
TFLOGSTRING("TSY: CMmUiccMessHandler::CreateUiccSbClient" );
|
|
880 |
OstTrace0( TRACE_NORMAL, CMMUICCMESSHANDLER_CREATEUICCSBCLIENT, "CMmUiccMessHandler::CreateUiccSbClient" );
|
|
881 |
|
|
882 |
// UICC_SB_CLIENT subblock
|
|
883 |
TBuf8<SIZE_UICC_SB_CLIENT> uiccSbClientBuf( 0 );
|
|
884 |
TIsiSubBlock uiccSbClient(
|
|
885 |
uiccSbClientBuf,
|
|
886 |
UICC_SB_CLIENT,
|
|
887 |
EIsiSubBlockTypeId16Len16 );
|
|
888 |
|
|
889 |
// 3x filler
|
|
890 |
uiccSbClientBuf.Append( KUiccPadding );
|
|
891 |
uiccSbClientBuf.Append( KUiccPadding );
|
|
892 |
uiccSbClientBuf.Append( KUiccPadding );
|
|
893 |
|
|
894 |
if( UICC_APPL_TYPE_UICC_USIM == aApplType ||
|
|
895 |
UICC_APPL_TYPE_ICC_SIM == aApplType )
|
|
896 |
{
|
|
897 |
// Client ID
|
|
898 |
uiccSbClientBuf.Append( iUiccClientId );
|
|
899 |
|
|
900 |
// Append subblock to ISI message
|
|
901 |
aIsiMsg.CopyData( aMsgOffset, uiccSbClient.CompleteSubBlock() );
|
|
902 |
}
|
|
903 |
else if( UICC_APPL_TYPE_UICC_ISIM == aApplType )
|
|
904 |
{
|
|
905 |
// Client ID
|
|
906 |
uiccSbClientBuf.Append( iUiccIsimClientId );
|
|
907 |
|
|
908 |
// Append subblock to ISI message
|
|
909 |
aIsiMsg.CopyData( aMsgOffset, uiccSbClient.CompleteSubBlock() );
|
|
910 |
}
|
|
911 |
else
|
|
912 |
{
|
|
913 |
TFLOGSTRING2("TSY: CMmUiccMessHandler::CreateUiccSbClient: unknown appl type: 0x%x", aApplType );
|
|
914 |
OstTrace1( TRACE_NORMAL, DUP1_CMMUICCMESSHANDLER_CREATEUICCSBCLIENT, "CMmUiccMessHandler::CreateUiccSbClient: unknown appl type: 0x%x", aApplType );
|
|
915 |
}
|
|
916 |
}
|
|
917 |
|
|
918 |
// -----------------------------------------------------------------------------
|
|
919 |
// CMmUiccMessHandler::CreateUiccSbTransparent
|
|
920 |
// (other items were commented in a header).
|
|
921 |
// -----------------------------------------------------------------------------
|
|
922 |
//
|
|
923 |
void CMmUiccMessHandler::CreateUiccSbTransparent(
|
|
924 |
const TUiccReadTransparent& aParams,
|
|
925 |
TIsiSend& aIsiMsg,
|
|
926 |
TUint8 aMsgOffset )
|
|
927 |
{
|
|
928 |
TFLOGSTRING("TSY: CMmUiccMessHandler::CreateUiccSbTransparent" );
|
|
929 |
OstTrace0( TRACE_NORMAL, CMMUICCMESSHANDLER_CREATEUICCSBTRANSPARENT, "CMmUiccMessHandler::CreateUiccSbTransparent" );
|
|
930 |
|
|
931 |
// UICC_SB_TRANSPARENT subblock
|
|
932 |
TBuf8<SIZE_UICC_SB_TRANSPARENT> uiccSbTransparentBuf( 0 );
|
|
933 |
TIsiSubBlock uiccSbTransparent(
|
|
934 |
uiccSbTransparentBuf,
|
|
935 |
UICC_SB_TRANSPARENT,
|
|
936 |
EIsiSubBlockTypeId16Len16 );
|
|
937 |
|
|
938 |
// File offset, 16-bit
|
|
939 |
uiccSbTransparentBuf.Append(
|
|
940 |
static_cast<TInt8>( aParams.dataOffset >> 8 ) );
|
|
941 |
uiccSbTransparentBuf.Append( static_cast<TInt8>( aParams.dataOffset ) );
|
|
942 |
// Data amount, 16-bit, only used in read case
|
|
943 |
uiccSbTransparentBuf.Append(
|
|
944 |
static_cast<TInt8>( aParams.dataAmount >> 8 ) );
|
|
945 |
uiccSbTransparentBuf.Append( static_cast<TInt8>( aParams.dataAmount ) );
|
|
946 |
|
|
947 |
// Append subblock to ISI message
|
|
948 |
aIsiMsg.CopyData( aMsgOffset, uiccSbTransparent.CompleteSubBlock() );
|
|
949 |
}
|
|
950 |
|
|
951 |
// -----------------------------------------------------------------------------
|
|
952 |
// CMmUiccMessHandler::CreateUiccSbLinearFixed
|
|
953 |
// (other items were commented in a header).
|
|
954 |
// -----------------------------------------------------------------------------
|
|
955 |
//
|
|
956 |
void CMmUiccMessHandler::CreateUiccSbLinearFixed(
|
|
957 |
const TUiccReadLinearFixed& aParams,
|
|
958 |
TIsiSend& aIsiMsg,
|
|
959 |
TUint8 aMsgOffset )
|
|
960 |
{
|
|
961 |
TFLOGSTRING("TSY: CMmUiccMessHandler::CreateUiccSbLinearFixed" );
|
|
962 |
OstTrace0( TRACE_NORMAL, CMMUICCMESSHANDLER_CREATEUICCSBLINEARFIXED, "CMmUiccMessHandler::CreateUiccSbLinearFixed" );
|
|
963 |
|
|
964 |
// UICC_SB_LINEAR_FIXED subblock
|
|
965 |
TBuf8<SIZE_UICC_SB_LINEAR_FIXED> uiccSbLinearFixedBuf( 0 );
|
|
966 |
TIsiSubBlock uiccSbLinearFixed(
|
|
967 |
uiccSbLinearFixedBuf,
|
|
968 |
UICC_SB_LINEAR_FIXED,
|
|
969 |
EIsiSubBlockTypeId16Len16 );
|
|
970 |
|
|
971 |
// File record, 8-bit
|
|
972 |
uiccSbLinearFixedBuf.Append( aParams.record );
|
|
973 |
// Record offset in bytes, 8-bit
|
|
974 |
uiccSbLinearFixedBuf.Append( static_cast<TInt8>( aParams.dataOffset ) );
|
|
975 |
// Data amount, 8-bit
|
|
976 |
uiccSbLinearFixedBuf.Append( static_cast<TInt8>( aParams.dataAmount ) );
|
|
977 |
|
|
978 |
// Append subblock to ISI message
|
|
979 |
aIsiMsg.CopyData( aMsgOffset, uiccSbLinearFixed.CompleteSubBlock() );
|
|
980 |
}
|
|
981 |
|
|
982 |
// -----------------------------------------------------------------------------
|
|
983 |
// CMmUiccMessHandler::CreateUiccSbFileData
|
|
984 |
// (other items were commented in a header).
|
|
985 |
// -----------------------------------------------------------------------------
|
|
986 |
//
|
|
987 |
void CMmUiccMessHandler::CreateUiccSbFileData(
|
|
988 |
TIsiSend& aIsiMsg,
|
|
989 |
TUint8 aMsgOffset,
|
|
990 |
const TDesC8& aUpdateData
|
|
991 |
)
|
|
992 |
{
|
|
993 |
TFLOGSTRING("TSY: CMmUiccMessHandler::CreateUiccSbFileData" );
|
|
994 |
OstTrace0( TRACE_NORMAL, CMMUICCMESSHANDLER_CREATEUICCSBFILEDATA, "CMmUiccMessHandler::CreateUiccSbFileData" );
|
|
995 |
|
|
996 |
// UICC_SB_FILE_DATA subblock
|
|
997 |
TBuf8<KUiccSbFileDataSize> uiccSbFileDataBuf( 0 );
|
|
998 |
TIsiSubBlock uiccSbFileData(
|
|
999 |
uiccSbFileDataBuf,
|
|
1000 |
UICC_SB_FILE_DATA,
|
|
1001 |
EIsiSubBlockTypeId16Len16 );
|
|
1002 |
|
|
1003 |
// Length of file data, 32-bit
|
|
1004 |
TInt length( aUpdateData.Length() );
|
|
1005 |
uiccSbFileDataBuf.Append( static_cast<TInt8>( length >> 24 ) );
|
|
1006 |
uiccSbFileDataBuf.Append( static_cast<TInt8>( length >> 16 ) );
|
|
1007 |
uiccSbFileDataBuf.Append( static_cast<TInt8>( length >> 8 ) );
|
|
1008 |
uiccSbFileDataBuf.Append( static_cast<TInt8>( length ) );
|
|
1009 |
|
|
1010 |
// Data
|
|
1011 |
uiccSbFileDataBuf.Append( aUpdateData );
|
|
1012 |
|
|
1013 |
// Append subblock to ISI message
|
|
1014 |
aIsiMsg.CopyData( aMsgOffset, uiccSbFileData.CompleteSubBlock() );
|
|
1015 |
}
|
|
1016 |
|
|
1017 |
// -----------------------------------------------------------------------------
|
|
1018 |
// CMmUiccMessHandler::CreateUiccSbApplication
|
|
1019 |
// (other items were commented in a header).
|
|
1020 |
// -----------------------------------------------------------------------------
|
|
1021 |
//
|
|
1022 |
void CMmUiccMessHandler::CreateUiccSbApplication(
|
|
1023 |
TIsiSend& aIsiMsg,
|
|
1024 |
TUint8 aMsgOffset,
|
|
1025 |
TUint8 aApplType )
|
|
1026 |
{
|
|
1027 |
TFLOGSTRING("TSY: CMmUiccMessHandler::CreateUiccSbApplication" );
|
|
1028 |
OstTrace0( TRACE_NORMAL, CMMUICCMESSHANDLER_CREATEUICCSBAPPLICATION, "CMmUiccMessHandler::CreateUiccSbApplication" );
|
|
1029 |
|
|
1030 |
// SIZE_UICC_SB_APPLICATION_STR
|
|
1031 |
TBuf8<SIZE_UICC_SB_APPLICATION> uiccSbApplicationBuf( 0 );
|
|
1032 |
TIsiSubBlock uiccSbApplication(
|
|
1033 |
uiccSbApplicationBuf,
|
|
1034 |
UICC_SB_APPLICATION,
|
|
1035 |
EIsiSubBlockTypeId16Len16 );
|
|
1036 |
|
|
1037 |
// 2x filler
|
|
1038 |
uiccSbApplicationBuf.Append( KUiccPadding );
|
|
1039 |
uiccSbApplicationBuf.Append( KUiccPadding );
|
|
1040 |
|
|
1041 |
if( UICC_APPL_TYPE_UICC_USIM == aApplType ||
|
|
1042 |
UICC_APPL_TYPE_ICC_SIM == aApplType )
|
|
1043 |
{
|
|
1044 |
// Application type (8-bit)
|
|
1045 |
uiccSbApplicationBuf.Append( iApplicationType );
|
|
1046 |
|
|
1047 |
// Application ID (8-bit)
|
|
1048 |
uiccSbApplicationBuf.Append( iApplicationId );
|
|
1049 |
|
|
1050 |
// Append subblock to ISI message
|
|
1051 |
aIsiMsg.CopyData( aMsgOffset, uiccSbApplication.CompleteSubBlock() );
|
|
1052 |
}
|
|
1053 |
else if( UICC_APPL_TYPE_UICC_ISIM == aApplType )
|
|
1054 |
{
|
|
1055 |
// Application type (8-bit)
|
|
1056 |
uiccSbApplicationBuf.Append( aApplType );
|
|
1057 |
|
|
1058 |
// Application ID (8-bit)
|
|
1059 |
uiccSbApplicationBuf.Append( iIsimApplicationId );
|
|
1060 |
|
|
1061 |
// Append subblock to ISI message
|
|
1062 |
aIsiMsg.CopyData( aMsgOffset, uiccSbApplication.CompleteSubBlock() );
|
|
1063 |
}
|
|
1064 |
else
|
|
1065 |
{
|
|
1066 |
TFLOGSTRING2("TSY: CMmUiccMessHandler::CreateUiccSbApplication: unknown application type: 0x%x", aApplType );
|
|
1067 |
OstTrace1( TRACE_NORMAL, DUP1_CMMUICCMESSHANDLER_CREATEUICCSBAPPLICATION, "CMmUiccMessHandler::CreateUiccSbApplication: unknown application type: 0x%x", aApplType );
|
|
1068 |
}
|
|
1069 |
}
|
|
1070 |
|
|
1071 |
// -----------------------------------------------------------------------------
|
|
1072 |
// CMmUiccMessHandler::GetFileData
|
|
1073 |
// (other items were commented in a header).
|
|
1074 |
// -----------------------------------------------------------------------------
|
|
1075 |
//
|
|
1076 |
const TPtrC8 CMmUiccMessHandler::GetFileData( const TIsiReceiveC& aIsiMsg )
|
|
1077 |
{
|
|
1078 |
TFLOGSTRING("TSY: CMmUiccMessHandler::GetFileData" );
|
|
1079 |
OstTrace0( TRACE_NORMAL, CMMUICCMESSHANDLER_GETFILEDATA, "CMmUiccMessHandler::GetFileData" );
|
|
1080 |
|
|
1081 |
TPtrC8 data( KNullDesC8 );
|
|
1082 |
|
|
1083 |
// File data from UICC_SB_FILE_DATA
|
|
1084 |
TUint uiccSbFileDataOffset( 0 );
|
|
1085 |
if ( KErrNone == aIsiMsg.FindSubBlockOffsetById(
|
|
1086 |
ISI_HEADER_SIZE + SIZE_UICC_APPL_CMD_RESP,
|
|
1087 |
UICC_SB_FILE_DATA,
|
|
1088 |
EIsiSubBlockTypeId16Len16,
|
|
1089 |
uiccSbFileDataOffset ) )
|
|
1090 |
{
|
|
1091 |
TInt fileDataLength( aIsiMsg.Get32bit(
|
|
1092 |
uiccSbFileDataOffset + UICC_SB_FILE_DATA_OFFSET_DATALENGTH ) );
|
|
1093 |
data.Set( aIsiMsg.GetData(
|
|
1094 |
uiccSbFileDataOffset + UICC_SB_FILE_DATA_OFFSET_DATA,
|
|
1095 |
fileDataLength ) );
|
|
1096 |
}
|
|
1097 |
return data;
|
|
1098 |
}
|
|
1099 |
|
|
1100 |
// -----------------------------------------------------------------------------
|
|
1101 |
// CMmUiccMessHandler::HandleUiccResp
|
|
1102 |
// (other items were commented in a header).
|
|
1103 |
// -----------------------------------------------------------------------------
|
|
1104 |
//
|
|
1105 |
TUint8 CMmUiccMessHandler::HandleUiccResp( const TIsiReceiveC& aIsiMsg )
|
|
1106 |
{
|
|
1107 |
TFLOGSTRING("TSY: CMmUiccMessHandler::HandleUiccResp" );
|
|
1108 |
OstTrace0( TRACE_NORMAL, CMMUICCMESSHANDLER_HANDLEUICCRESP, "CMmUiccMessHandler::HandleUiccResp" );
|
|
1109 |
|
|
1110 |
TUint8 serverStatus( UICC_STATUS_NOT_READY );
|
|
1111 |
// Check the service type
|
|
1112 |
TUint8 serviceType( aIsiMsg.Get8bit(
|
|
1113 |
ISI_HEADER_SIZE + UICC_RESP_OFFSET_SERVICETYPE ) );
|
|
1114 |
if ( UICC_STATUS_GET == serviceType )
|
|
1115 |
{
|
|
1116 |
// Get the status
|
|
1117 |
TUint8 status(
|
|
1118 |
aIsiMsg.Get8bit( ISI_HEADER_SIZE + UICC_RESP_OFFSET_STATUS ) );
|
|
1119 |
if ( UICC_STATUS_OK == status )
|
|
1120 |
{
|
|
1121 |
// Get the UICC server status
|
|
1122 |
serverStatus = aIsiMsg.Get8bit(
|
|
1123 |
ISI_HEADER_SIZE + UICC_RESP_OFFSET_SERVERSTATUS );
|
|
1124 |
}
|
|
1125 |
}
|
|
1126 |
return serverStatus;
|
|
1127 |
}
|
|
1128 |
|
|
1129 |
// -----------------------------------------------------------------------------
|
|
1130 |
// CMmUiccMessHandler::HandleUiccApplicationResp
|
|
1131 |
// (other items were commented in a header).
|
|
1132 |
// -----------------------------------------------------------------------------
|
|
1133 |
//
|
|
1134 |
TInt CMmUiccMessHandler::HandleUiccApplicationResp(
|
|
1135 |
const TIsiReceiveC& aIsiMsg )
|
|
1136 |
{
|
|
1137 |
TFLOGSTRING("TSY: CMmUiccMessHandler::HandleUiccApplicationResp" );
|
|
1138 |
OstTrace0( TRACE_NORMAL, CMMUICCMESSHANDLER_HANDLEUICCAPPLICATIONRESP, "CMmUiccMessHandler::HandleUiccApplicationResp" );
|
|
1139 |
|
|
1140 |
TInt ret( KErrNone );
|
|
1141 |
// Get service type and status
|
|
1142 |
TUint8 serviceType( aIsiMsg.Get8bit(
|
|
1143 |
ISI_HEADER_SIZE + UICC_APPLICATION_RESP_OFFSET_SERVICETYPE ) );
|
|
1144 |
TUint8 status( aIsiMsg.Get8bit(
|
|
1145 |
ISI_HEADER_SIZE + UICC_APPLICATION_RESP_OFFSET_STATUS ) );
|
|
1146 |
iCardType = aIsiMsg.Get8bit(
|
|
1147 |
ISI_HEADER_SIZE + UICC_APPLICATION_RESP_OFFSET_CARDTYPE );
|
|
1148 |
TUint8 trId( aIsiMsg.Get8bit(
|
|
1149 |
ISI_HEADER_SIZE + UICC_APPLICATION_RESP_OFFSET_TRANSID ) );
|
|
1150 |
TUint16 startIndex( ISI_HEADER_SIZE + SIZE_UICC_APPLICATION_RESP );
|
|
1151 |
|
|
1152 |
if ( UICC_STATUS_OK == status )
|
|
1153 |
{
|
|
1154 |
switch( serviceType )
|
|
1155 |
{
|
|
1156 |
case UICC_APPL_LIST:
|
|
1157 |
{
|
|
1158 |
// Check if UICC_SB_APPL_DATA_OBJECT is included => UICC application
|
|
1159 |
TUint uiccSbApplDataObjectOffset( 0 );
|
|
1160 |
TUint8 applicationType( 0 );
|
|
1161 |
TUint16 sbLen( 0 );
|
|
1162 |
|
|
1163 |
TBool usimApplFound( EFalse );
|
|
1164 |
|
|
1165 |
while ( KErrNone == aIsiMsg.FindSubBlockOffsetById(
|
|
1166 |
startIndex,
|
|
1167 |
UICC_SB_APPL_DATA_OBJECT,
|
|
1168 |
EIsiSubBlockTypeId16Len16,
|
|
1169 |
uiccSbApplDataObjectOffset ) )
|
|
1170 |
{
|
|
1171 |
applicationType = aIsiMsg.Get8bit(
|
|
1172 |
uiccSbApplDataObjectOffset +
|
|
1173 |
UICC_SB_APPL_DATA_OBJECT_OFFSET_APPLICATIONTYPE );
|
|
1174 |
|
|
1175 |
sbLen = aIsiMsg.Get16bit(
|
|
1176 |
uiccSbApplDataObjectOffset +
|
|
1177 |
UICC_SB_APPL_DATA_OBJECT_OFFSET_SBLEN );
|
|
1178 |
|
|
1179 |
if ( UICC_APPL_TYPE_UICC_USIM == applicationType &&
|
|
1180 |
EFalse == usimApplFound )
|
|
1181 |
{
|
|
1182 |
iApplicationType = applicationType;
|
|
1183 |
|
|
1184 |
iApplicationId = aIsiMsg.Get8bit(
|
|
1185 |
uiccSbApplDataObjectOffset +
|
|
1186 |
UICC_SB_APPL_DATA_OBJECT_OFFSET_APPLID );
|
|
1187 |
iApplicationStatus = aIsiMsg.Get8bit(
|
|
1188 |
uiccSbApplDataObjectOffset +
|
|
1189 |
UICC_SB_APPL_DATA_OBJECT_OFFSET_APPLSTATUS );
|
|
1190 |
|
|
1191 |
TUint8 length( aIsiMsg.Get8bit(
|
|
1192 |
uiccSbApplDataObjectOffset +
|
|
1193 |
UICC_SB_APPL_DATA_OBJECT_OFFSET_APPLDOLEN ) );
|
|
1194 |
|
|
1195 |
// Application data object contains EF dir data,
|
|
1196 |
// 5 bytes are mandatory. See TS 102.221 V7.11.0 table 13.2
|
|
1197 |
if ( 5 <= length )
|
|
1198 |
{
|
|
1199 |
TPtrC8 applDataObject( aIsiMsg.GetData(
|
|
1200 |
uiccSbApplDataObjectOffset +
|
|
1201 |
UICC_SB_APPL_DATA_OBJECT_OFFSET_APPLDO,
|
|
1202 |
length ) );
|
|
1203 |
// Length of AID is located in index 3
|
|
1204 |
TUint8 aidLength( applDataObject[3] );
|
|
1205 |
// Copy actual AID
|
|
1206 |
iAid.Copy( applDataObject.Mid( 4, aidLength ) );
|
|
1207 |
}
|
|
1208 |
|
|
1209 |
usimApplFound = ETrue;
|
|
1210 |
}
|
|
1211 |
else if( UICC_APPL_TYPE_UICC_ISIM == applicationType &&
|
|
1212 |
EFalse == iIsimApplicationFound )
|
|
1213 |
{
|
|
1214 |
iIsimApplicationFound = ETrue;
|
|
1215 |
|
|
1216 |
iIsimApplicationId = aIsiMsg.Get8bit(
|
|
1217 |
uiccSbApplDataObjectOffset +
|
|
1218 |
UICC_SB_APPL_DATA_OBJECT_OFFSET_APPLID );
|
|
1219 |
iIsimApplicationStatus = aIsiMsg.Get8bit(
|
|
1220 |
uiccSbApplDataObjectOffset +
|
|
1221 |
UICC_SB_APPL_DATA_OBJECT_OFFSET_APPLSTATUS );
|
|
1222 |
}
|
|
1223 |
startIndex = uiccSbApplDataObjectOffset + sbLen;
|
|
1224 |
}
|
|
1225 |
if ( EFalse == usimApplFound ) // ICC application
|
|
1226 |
{
|
|
1227 |
iApplicationType = UICC_APPL_TYPE_ICC_SIM;
|
|
1228 |
iApplicationId = UICC_APPL_ID_UNKNOWN;
|
|
1229 |
// Application file ID for GSM
|
|
1230 |
TBuf8<2> gsmFileId;
|
|
1231 |
gsmFileId.Append( 0x7F );
|
|
1232 |
gsmFileId.Append( 0x20 );
|
|
1233 |
iApplFileId.Copy( gsmFileId );
|
|
1234 |
}
|
|
1235 |
// Activate the application
|
|
1236 |
if ( UICC_STATUS_APPL_ACTIVE != iApplicationStatus )
|
|
1237 |
{
|
|
1238 |
TUiccParamsBase params;
|
|
1239 |
params.messHandlerPtr = static_cast<MUiccOperationBase*>( this );
|
|
1240 |
params.trId = ETrIdActivateUiccApplication;
|
|
1241 |
ret = CreateUiccApplicationReq( params, UICC_APPL_HOST_ACTIVATE );
|
|
1242 |
}
|
|
1243 |
break;
|
|
1244 |
}
|
|
1245 |
case UICC_APPL_HOST_ACTIVATE:
|
|
1246 |
{
|
|
1247 |
TUint uiccSbClientOffset( 0 );
|
|
1248 |
if ( KErrNone == aIsiMsg.FindSubBlockOffsetById(
|
|
1249 |
startIndex,
|
|
1250 |
UICC_SB_CLIENT,
|
|
1251 |
EIsiSubBlockTypeId16Len16,
|
|
1252 |
uiccSbClientOffset ) )
|
|
1253 |
{
|
|
1254 |
if( ETrIdActivateUiccApplication == trId )
|
|
1255 |
{
|
|
1256 |
iUiccClientId = aIsiMsg.Get8bit(
|
|
1257 |
uiccSbClientOffset +
|
|
1258 |
UICC_SB_CLIENT_OFFSET_CLIENTID );
|
|
1259 |
}
|
|
1260 |
else if( ETrIdActivateIsimApplication == trId )
|
|
1261 |
{
|
|
1262 |
iUiccIsimClientId = aIsiMsg.Get8bit(
|
|
1263 |
uiccSbClientOffset +
|
|
1264 |
UICC_SB_CLIENT_OFFSET_CLIENTID );
|
|
1265 |
}
|
|
1266 |
}
|
|
1267 |
// UICC_SB_FCI contains PIN key references
|
|
1268 |
TUint uiccSbFciOffset( 0 );
|
|
1269 |
if ( KErrNone == aIsiMsg.FindSubBlockOffsetById(
|
|
1270 |
ISI_HEADER_SIZE + SIZE_UICC_APPLICATION_RESP,
|
|
1271 |
UICC_SB_FCI,
|
|
1272 |
EIsiSubBlockTypeId16Len16,
|
|
1273 |
uiccSbFciOffset ) )
|
|
1274 |
{
|
|
1275 |
TInt fileDataLength( aIsiMsg.Get16bit(
|
|
1276 |
uiccSbFciOffset + UICC_SB_FCI_OFFSET_FCILENGTH ) );
|
|
1277 |
if ( 0 < fileDataLength )
|
|
1278 |
{
|
|
1279 |
StorePinKeyReferences( aIsiMsg.GetData(
|
|
1280 |
uiccSbFciOffset + UICC_SB_FCI_OFFSET_FCI,
|
|
1281 |
fileDataLength ) );
|
|
1282 |
}
|
|
1283 |
}
|
|
1284 |
// In case of ICC there is two UICC_SB_CHV subblocks
|
|
1285 |
// that contain PIN IDs for ICC application
|
|
1286 |
TUint uiccSbChvOffset( 0 );
|
|
1287 |
while ( KErrNone == aIsiMsg.FindSubBlockOffsetById(
|
|
1288 |
startIndex,
|
|
1289 |
UICC_SB_CHV,
|
|
1290 |
EIsiSubBlockTypeId16Len16,
|
|
1291 |
uiccSbChvOffset ) )
|
|
1292 |
{
|
|
1293 |
TUint8 chvQualifier( aIsiMsg.Get8bit(
|
|
1294 |
uiccSbChvOffset +
|
|
1295 |
UICC_SB_CHV_OFFSET_CHVQUALIFIER ) );
|
|
1296 |
if ( UICC_CHV1 == chvQualifier ) // PIN1
|
|
1297 |
{
|
|
1298 |
iPin1Id = aIsiMsg.Get8bit(
|
|
1299 |
uiccSbChvOffset + UICC_SB_CHV_OFFSET_PINID );
|
|
1300 |
}
|
|
1301 |
else // PIN2
|
|
1302 |
{
|
|
1303 |
iPin2Id = aIsiMsg.Get8bit(
|
|
1304 |
uiccSbChvOffset + UICC_SB_CHV_OFFSET_PINID );
|
|
1305 |
}
|
|
1306 |
startIndex = uiccSbChvOffset + SIZE_UICC_SB_CHV;
|
|
1307 |
}
|
|
1308 |
break;
|
|
1309 |
}
|
|
1310 |
default:
|
|
1311 |
{
|
|
1312 |
break;
|
|
1313 |
}
|
|
1314 |
}
|
|
1315 |
}
|
|
1316 |
else // if ( UICC_STATUS_OK == status )
|
|
1317 |
{
|
|
1318 |
ret = KErrGeneral;
|
|
1319 |
TUint8 details( aIsiMsg.Get8bit(
|
|
1320 |
ISI_HEADER_SIZE + UICC_APPLICATION_RESP_OFFSET_DETAILS ) );
|
|
1321 |
}
|
|
1322 |
return ret;
|
|
1323 |
}
|
|
1324 |
|
|
1325 |
// -----------------------------------------------------------------------------
|
|
1326 |
// CMmUiccMessHandler::GetFileFCI
|
|
1327 |
// (other items were commented in a header).
|
|
1328 |
// -----------------------------------------------------------------------------
|
|
1329 |
//
|
|
1330 |
const TPtrC8 CMmUiccMessHandler::GetFileFCI( const TIsiReceiveC& aIsiMsg )
|
|
1331 |
{
|
|
1332 |
TFLOGSTRING("TSY: CMmUiccMessHandler::GetFileFCI");
|
|
1333 |
OstTrace0( TRACE_NORMAL, CMMUICCMESSHANDLER_GETFILEFCI, "CMmUiccMessHandler::GetFileFCI" );
|
|
1334 |
|
|
1335 |
TPtrC8 data( KNullDesC8 );
|
|
1336 |
TUint uiccSbFileDataOffset( 0 );
|
|
1337 |
|
|
1338 |
if ( KErrNone == aIsiMsg.FindSubBlockOffsetById(
|
|
1339 |
ISI_HEADER_SIZE + SIZE_UICC_APPL_CMD_RESP,
|
|
1340 |
UICC_SB_FCI,
|
|
1341 |
EIsiSubBlockTypeId16Len16,
|
|
1342 |
uiccSbFileDataOffset ) )
|
|
1343 |
{
|
|
1344 |
TInt fileDataLength( aIsiMsg.Get16bit(
|
|
1345 |
uiccSbFileDataOffset + UICC_SB_FCI_OFFSET_FCILENGTH ) );
|
|
1346 |
data.Set( aIsiMsg.GetData(
|
|
1347 |
uiccSbFileDataOffset + UICC_SB_FCI_OFFSET_FCI,
|
|
1348 |
fileDataLength ) );
|
|
1349 |
}
|
|
1350 |
return data;
|
|
1351 |
}
|
|
1352 |
|
|
1353 |
// -----------------------------------------------------------------------------
|
|
1354 |
// CMmUiccMessHandler::CreateUiccConnectorReq
|
|
1355 |
// (other items were commented in a header).
|
|
1356 |
// -----------------------------------------------------------------------------
|
|
1357 |
//
|
|
1358 |
TInt CMmUiccMessHandler::CreateUiccConnectorReq(
|
|
1359 |
const TUiccParamsBase& aParams )
|
|
1360 |
{
|
|
1361 |
TFLOGSTRING("TSY: CMmUiccMessHandler::CreateUiccConnectorReq");
|
|
1362 |
OstTrace0( TRACE_NORMAL, CMMUICCMESSHANDLER_CREATEUICCCONNREQ, "CMmUiccMessHandler::CreateUiccConnectorReq" );
|
|
1363 |
|
|
1364 |
TInt ret (KErrGeneral);
|
|
1365 |
TInt trId( aParams.trId );
|
|
1366 |
TInt8 serviceType( aParams.serviceType );
|
|
1367 |
TUint8 numOfSubblocks( 0 );
|
|
1368 |
|
|
1369 |
// If there is the previous request ongoing (pointer was already set for
|
|
1370 |
// this operation) we can't handle this request.
|
|
1371 |
if ( NULL == iMessHandlerPrtList.At( trId ) )
|
|
1372 |
{
|
|
1373 |
// Save pointer to message handler, it is needed when receiving
|
|
1374 |
// response for this operation
|
|
1375 |
iMessHandlerPrtList[trId] = aParams.messHandlerPtr;
|
|
1376 |
|
|
1377 |
// Create UICC_CONNECTOR_REQ message
|
|
1378 |
TIsiSend isiMsg( iPhoNetSender->SendBufferDes() );
|
|
1379 |
isiMsg.Set8bit( ISI_HEADER_OFFSET_RESOURCEID, PN_UICC );
|
|
1380 |
isiMsg.Set8bit(
|
|
1381 |
ISI_HEADER_SIZE + UICC_CONNECTOR_REQ_OFFSET_TRANSID, trId );
|
|
1382 |
isiMsg.Set8bit(
|
|
1383 |
ISI_HEADER_SIZE + UICC_CONNECTOR_REQ_OFFSET_MESSAGEID,
|
|
1384 |
UICC_CONNECTOR_REQ );
|
|
1385 |
isiMsg.Set8bit(
|
|
1386 |
ISI_HEADER_SIZE + UICC_CONNECTOR_REQ_OFFSET_SERVICETYPE,
|
|
1387 |
serviceType );
|
|
1388 |
|
|
1389 |
switch( serviceType )
|
|
1390 |
{
|
|
1391 |
case UICC_CONNECT:
|
|
1392 |
{
|
|
1393 |
// Set status to not active, since UICC connect request
|
|
1394 |
// resets smartcard.
|
|
1395 |
iApplicationStatus = UICC_STATUS_APPL_NOT_ACTIVE;
|
|
1396 |
|
|
1397 |
// Sets flag, that when the response for this request is
|
|
1398 |
// received traid is not removed from the list, until
|
|
1399 |
// UICC_APPLICATION_IND is received.
|
|
1400 |
iDoNotRemoveTransactionID = ETrue;
|
|
1401 |
break;
|
|
1402 |
}
|
|
1403 |
default:
|
|
1404 |
break;
|
|
1405 |
}
|
|
1406 |
|
|
1407 |
isiMsg.Set8bit(
|
|
1408 |
ISI_HEADER_SIZE + UICC_CONNECTOR_REQ_OFFSET_NSB,
|
|
1409 |
numOfSubblocks );
|
|
1410 |
|
|
1411 |
return( iPhoNetSender->Send( isiMsg.Complete() ) );
|
|
1412 |
}
|
|
1413 |
else
|
|
1414 |
{
|
|
1415 |
ret = KErrServerBusy;
|
|
1416 |
}
|
|
1417 |
return ret;
|
|
1418 |
}
|
|
1419 |
|
|
1420 |
// -----------------------------------------------------------------------------
|
|
1421 |
// CMmUiccMessHandler::CreateUiccApduReq
|
|
1422 |
// (other items were commented in a header).
|
|
1423 |
// -----------------------------------------------------------------------------
|
|
1424 |
//
|
|
1425 |
TInt CMmUiccMessHandler::CreateUiccApduReq( const TUiccParamsApduReq& aParams )
|
|
1426 |
{
|
|
1427 |
TFLOGSTRING("TSY: CMmUiccMessHandler::CreateUiccApduReq");
|
|
1428 |
OstTrace0( TRACE_NORMAL, CMMUICCMESSHANDLER_CREATEUICCAPDUREQ, "CMmUiccMessHandler::CreateUiccApduReq" );
|
|
1429 |
|
|
1430 |
TInt ret (KErrGeneral);
|
|
1431 |
TInt trId( aParams.trId );
|
|
1432 |
TInt8 serviceType( aParams.serviceType );
|
|
1433 |
TUint8 numOfSubblocks( 0 );
|
|
1434 |
TUint8 action( aParams.action );
|
|
1435 |
|
|
1436 |
// If there is the previous request ongoing (pointer was already set for
|
|
1437 |
// this operation) we can't handle this request.
|
|
1438 |
if ( NULL == iMessHandlerPrtList.At( trId ) )
|
|
1439 |
{
|
|
1440 |
// Save pointer to message handler, it is needed when receiving
|
|
1441 |
// response for this operation
|
|
1442 |
iMessHandlerPrtList[trId] = aParams.messHandlerPtr;
|
|
1443 |
// Create UICC_APDU_REQ
|
|
1444 |
TIsiSend isiMsg( iPhoNetSender->SendBufferDes() );
|
|
1445 |
isiMsg.Set8bit( ISI_HEADER_OFFSET_RESOURCEID, PN_UICC );
|
|
1446 |
isiMsg.Set8bit( ISI_HEADER_SIZE + UICC_APDU_REQ_OFFSET_TRANSID, trId );
|
|
1447 |
isiMsg.Set8bit(
|
|
1448 |
ISI_HEADER_SIZE + UICC_APDU_REQ_OFFSET_MESSAGEID,
|
|
1449 |
UICC_APDU_REQ );
|
|
1450 |
isiMsg.Set8bit(
|
|
1451 |
ISI_HEADER_SIZE + UICC_APDU_REQ_OFFSET_SERVICETYPE,
|
|
1452 |
serviceType );
|
|
1453 |
|
|
1454 |
switch( serviceType )
|
|
1455 |
{
|
|
1456 |
case UICC_APDU_CONTROL:
|
|
1457 |
{
|
|
1458 |
if( UICC_CONTROL_CARD_ACTIVATE == action )
|
|
1459 |
{
|
|
1460 |
// Sets flag, that when the response for this request is
|
|
1461 |
// received traid is not removed from the list, until
|
|
1462 |
// UICC_APDU_RESET_IND is received.
|
|
1463 |
iDoNotRemoveTransactionID = ETrue;
|
|
1464 |
}
|
|
1465 |
// Create subblock UICC_SB_APDU_ACTIONS.
|
|
1466 |
CreateUiccSbApduActions(
|
|
1467 |
isiMsg,
|
|
1468 |
action );
|
|
1469 |
numOfSubblocks = 1;
|
|
1470 |
break;
|
|
1471 |
}
|
|
1472 |
case UICC_APDU_SEND:
|
|
1473 |
{
|
|
1474 |
// create SB UICC_SB_APDU.
|
|
1475 |
CreateUiccSbApdu(
|
|
1476 |
isiMsg,
|
|
1477 |
KUiccApduReqSubblockOffset,
|
|
1478 |
aParams .apduData );
|
|
1479 |
numOfSubblocks = 1;
|
|
1480 |
break;
|
|
1481 |
}
|
|
1482 |
default:
|
|
1483 |
{
|
|
1484 |
break;
|
|
1485 |
}
|
|
1486 |
}
|
|
1487 |
|
|
1488 |
isiMsg.Set8bit(
|
|
1489 |
ISI_HEADER_SIZE + UICC_APDU_REQ_OFFSET_NSB,
|
|
1490 |
numOfSubblocks );
|
|
1491 |
|
|
1492 |
ret = iPhoNetSender->Send( isiMsg.Complete() );
|
|
1493 |
}
|
|
1494 |
else
|
|
1495 |
{
|
|
1496 |
ret = KErrServerBusy;
|
|
1497 |
}
|
|
1498 |
return ret;
|
|
1499 |
}
|
|
1500 |
|
|
1501 |
// -----------------------------------------------------------------------------
|
|
1502 |
// CMmUiccMessHandler::CreateUiccSbApduActions
|
|
1503 |
// (other items were commented in a header).
|
|
1504 |
// -----------------------------------------------------------------------------
|
|
1505 |
//
|
|
1506 |
void CMmUiccMessHandler::CreateUiccSbApduActions(
|
|
1507 |
TIsiSend& aIsiMsg,
|
|
1508 |
TUint8 aAction )
|
|
1509 |
{
|
|
1510 |
TFLOGSTRING("TSY: CMmUiccMessHandler::CreateUiccSbApduActions");
|
|
1511 |
OstTrace0( TRACE_NORMAL, CMMUICCMESSHANDLER_CREATEUICCASBPDUACTION, "CMmUiccMessHandler::CreateUiccSbApduActions" );
|
|
1512 |
|
|
1513 |
// SIZE_UICC_SB_APPLICATION_STR
|
|
1514 |
TBuf8<SIZE_UICC_SB_APDU_ACTIONS> uiccSbApduActionBuf( 0 );
|
|
1515 |
TIsiSubBlock uiccSbApduAction(
|
|
1516 |
uiccSbApduActionBuf,
|
|
1517 |
UICC_SB_APDU_ACTIONS,
|
|
1518 |
EIsiSubBlockTypeId16Len16 );
|
|
1519 |
|
|
1520 |
// Action
|
|
1521 |
uiccSbApduActionBuf.Append( aAction );
|
|
1522 |
// 3x filler
|
|
1523 |
uiccSbApduActionBuf.Append( KUiccPadding );
|
|
1524 |
uiccSbApduActionBuf.Append( KUiccPadding );
|
|
1525 |
uiccSbApduActionBuf.Append( KUiccPadding );
|
|
1526 |
|
|
1527 |
// Append subblock to ISI message
|
|
1528 |
aIsiMsg.CopyData(
|
|
1529 |
KUiccApduReqSubblockOffset,
|
|
1530 |
uiccSbApduAction.CompleteSubBlock() );
|
|
1531 |
}
|
|
1532 |
|
|
1533 |
// -----------------------------------------------------------------------------
|
|
1534 |
// CMmUiccMessHandler::GetAPduData
|
|
1535 |
// (other items were commented in a header).
|
|
1536 |
// -----------------------------------------------------------------------------
|
|
1537 |
//
|
|
1538 |
const TPtrC8 CMmUiccMessHandler::GetApduData( const TIsiReceiveC& aIsiMsg )
|
|
1539 |
{
|
|
1540 |
TFLOGSTRING("TSY: CMmUiccMessHandler::GetApduData");
|
|
1541 |
OstTrace0( TRACE_NORMAL, CMMUICCMESSHANDLER_GETAPDUDATA, "CMmUiccMessHandler::GetApduData" );
|
|
1542 |
|
|
1543 |
TPtrC8 data( KNullDesC8 );
|
|
1544 |
|
|
1545 |
// File data from UICC_SB_APDU
|
|
1546 |
TUint uiccSbApduOffset( 0 );
|
|
1547 |
if ( KErrNone == aIsiMsg.FindSubBlockOffsetById(
|
|
1548 |
ISI_HEADER_SIZE + SIZE_UICC_APPL_CMD_REQ,
|
|
1549 |
UICC_SB_APDU,
|
|
1550 |
EIsiSubBlockTypeId16Len16,
|
|
1551 |
uiccSbApduOffset ) )
|
|
1552 |
{
|
|
1553 |
TInt apduDataLength( aIsiMsg.Get16bit(
|
|
1554 |
uiccSbApduOffset + KUiccSbApduLengthOffset ) );
|
|
1555 |
|
|
1556 |
data.Set( aIsiMsg.GetData(
|
|
1557 |
uiccSbApduOffset + KUiccSbApduDataOffset,
|
|
1558 |
apduDataLength ) );
|
|
1559 |
}
|
|
1560 |
return data;
|
|
1561 |
}
|
|
1562 |
|
|
1563 |
// -----------------------------------------------------------------------------
|
|
1564 |
// CMmUiccMessHandler::CreateUiccSbApdu
|
|
1565 |
// (other items were commented in a header).
|
|
1566 |
// -----------------------------------------------------------------------------
|
|
1567 |
//
|
|
1568 |
void CMmUiccMessHandler::CreateUiccSbApdu(
|
|
1569 |
TIsiSend& aIsiMsg,
|
|
1570 |
TUint8 aMsgOffset,
|
|
1571 |
const TDesC8& aAPDUData)
|
|
1572 |
{
|
|
1573 |
TFLOGSTRING("TSY: CMmUiccMessHandler::CreateUiccSbApdu" );
|
|
1574 |
OstTrace0( TRACE_NORMAL, CMMUICCMESSHANDLER_CREATESBAPDU, "CMmUiccMessHandler::CreateUiccSbApdu" );
|
|
1575 |
|
|
1576 |
// UICC_SB_APDU subblock
|
|
1577 |
TBuf8<KUiccSbApduSize> uiccSbApduBuf( 0 );
|
|
1578 |
TIsiSubBlock uiccSbApdu(
|
|
1579 |
uiccSbApduBuf,
|
|
1580 |
UICC_SB_APDU,
|
|
1581 |
EIsiSubBlockTypeId16Len16 );
|
|
1582 |
|
|
1583 |
// Force APDU command
|
|
1584 |
uiccSbApduBuf.Append( UICC_APDU_CMD_FORCE_NOT_USED );
|
|
1585 |
|
|
1586 |
// Filler KUiccPadding
|
|
1587 |
uiccSbApduBuf.Append( KUiccPadding );
|
|
1588 |
|
|
1589 |
// Length of APDU command data, 16-bit
|
|
1590 |
TInt length( aAPDUData.Length() );
|
|
1591 |
uiccSbApduBuf.Append( static_cast<TInt8>( length >> 8 ) );
|
|
1592 |
uiccSbApduBuf.Append( static_cast<TInt8>( length ) );
|
|
1593 |
|
|
1594 |
// Data
|
|
1595 |
uiccSbApduBuf.Append( aAPDUData );
|
|
1596 |
|
|
1597 |
// Append subblock to ISI message
|
|
1598 |
aIsiMsg.CopyData( aMsgOffset, uiccSbApdu.CompleteSubBlock() );
|
|
1599 |
}
|
|
1600 |
|
|
1601 |
// -----------------------------------------------------------------------------
|
|
1602 |
// CMmUiccMessHandler::CreateUiccCardReq
|
|
1603 |
// (other items were commented in a header).
|
|
1604 |
// -----------------------------------------------------------------------------
|
|
1605 |
//
|
|
1606 |
TInt CMmUiccMessHandler::CreateUiccCardReq( const TUiccParamsBase& aParams )
|
|
1607 |
{
|
|
1608 |
TFLOGSTRING("TSY: CMmUiccMessHandler::CreateUiccCardReq" );
|
|
1609 |
OstTrace0( TRACE_NORMAL, CMMUICCMESSHANDLER_CREATECARDREQ, "CMmUiccMessHandler::CreateUiccCardReq" );
|
|
1610 |
|
|
1611 |
TInt ret ( KErrGeneral );
|
|
1612 |
TInt trId( aParams.trId );
|
|
1613 |
TInt8 serviceType( aParams.serviceType );
|
|
1614 |
|
|
1615 |
// If there is the previous request ongoing (pointer was already set for
|
|
1616 |
// this operation) we can't handle this request.
|
|
1617 |
if ( NULL == iMessHandlerPrtList.At( trId ) )
|
|
1618 |
{
|
|
1619 |
// Save pointer to message handler, it is needed when receiving
|
|
1620 |
// respone for this operation
|
|
1621 |
iMessHandlerPrtList[trId] = aParams.messHandlerPtr;
|
|
1622 |
|
|
1623 |
// Create UICC_CARD_REQ message
|
|
1624 |
TIsiSend isiMsg( iPhoNetSender->SendBufferDes() );
|
|
1625 |
isiMsg.Set8bit( ISI_HEADER_OFFSET_RESOURCEID, PN_UICC );
|
|
1626 |
isiMsg.Set8bit(
|
|
1627 |
ISI_HEADER_SIZE + UICC_CARD_REQ_OFFSET_TRANSID,
|
|
1628 |
trId );
|
|
1629 |
isiMsg.Set8bit( ISI_HEADER_SIZE + UICC_CARD_REQ_OFFSET_MESSAGEID,
|
|
1630 |
UICC_CARD_REQ );
|
|
1631 |
isiMsg.Set8bit( ISI_HEADER_SIZE + UICC_CARD_REQ_OFFSET_SERVICETYPE,
|
|
1632 |
serviceType );
|
|
1633 |
isiMsg.Set8bit( ISI_HEADER_SIZE + UICC_CARD_REQ_OFFSET_CARDTYPE,
|
|
1634 |
iCardType );
|
|
1635 |
|
|
1636 |
return( iPhoNetSender->Send( isiMsg.Complete() ) );
|
|
1637 |
}
|
|
1638 |
else
|
|
1639 |
{
|
|
1640 |
ret = KErrServerBusy;
|
|
1641 |
}
|
|
1642 |
return ret;
|
|
1643 |
}
|
|
1644 |
|
|
1645 |
// -----------------------------------------------------------------------------
|
|
1646 |
// CMmUiccMessHandler::InitializeSimServiceTableCache
|
|
1647 |
// (other items were commented in a header).
|
|
1648 |
// -----------------------------------------------------------------------------
|
|
1649 |
//
|
|
1650 |
void CMmUiccMessHandler::InitializeSimServiceTableCache()
|
|
1651 |
{
|
|
1652 |
TFLOGSTRING("TSY: CMmUiccMessHandler::InitializeSimServiceTableCache" );
|
|
1653 |
OstTrace0( TRACE_NORMAL, CMMUICCMESSHANDLER_INITIALIZESIMSERVICETABLECACHE, "CMmUiccMessHandler::InitializeSimServiceTableCache" );
|
|
1654 |
|
|
1655 |
// Set parameters for UICC_APPL_CMD_REQ message
|
|
1656 |
TUiccReadTransparent params;
|
|
1657 |
params.messHandlerPtr = static_cast<MUiccOperationBase*>( this );
|
|
1658 |
params.trId = ETrIdSstCache;
|
|
1659 |
params.dataAmount = 0;
|
|
1660 |
params.dataOffset = 0;
|
|
1661 |
params.fileId = KElemSimServiceTable;
|
|
1662 |
|
|
1663 |
// If card type is UICC, we need to read EFust, otherwise EFsst
|
|
1664 |
// EFust contains SFI identifier (value is 4), but EFsst doesn't
|
|
1665 |
// contain SFI, so in that case we need to use UICC_SFI_NOT_PRESENT
|
|
1666 |
params.fileIdSfi = iCardType == UICC_CARD_TYPE_UICC ? 4 : UICC_SFI_NOT_PRESENT;
|
|
1667 |
params.serviceType = UICC_APPL_READ_TRANSPARENT;
|
|
1668 |
|
|
1669 |
// File id path
|
|
1670 |
params.filePath.Append( KMasterFileId >> 8 );
|
|
1671 |
params.filePath.Append( KMasterFileId );
|
|
1672 |
params.filePath.Append( GetApplicationFileId() );
|
|
1673 |
|
|
1674 |
CreateUiccApplCmdReq( params );
|
|
1675 |
}
|
|
1676 |
|
|
1677 |
// -----------------------------------------------------------------------------
|
|
1678 |
// CMmUiccMessHandler::SimServiceTableCacheResp
|
|
1679 |
// (other items were commented in a header).
|
|
1680 |
// -----------------------------------------------------------------------------
|
|
1681 |
//
|
|
1682 |
void CMmUiccMessHandler::SimServiceTableCacheResp(
|
|
1683 |
TInt aStatus,
|
|
1684 |
const TDesC8& aFileData )
|
|
1685 |
{
|
|
1686 |
TFLOGSTRING("TSY: CMmUiccMessHandler::SimServiceTableCacheResp" );
|
|
1687 |
OstTrace0( TRACE_NORMAL, CMMUICCMESSHANDLER_SIMSERVICETABLECACHERESP, "CMmUiccMessHandler::SimServiceTableCacheResp" );
|
|
1688 |
|
|
1689 |
if ( UICC_STATUS_OK == aStatus )
|
|
1690 |
{
|
|
1691 |
if ( UICC_CARD_TYPE_UICC == iCardType )
|
|
1692 |
{
|
|
1693 |
// fill iUstFile
|
|
1694 |
iUSTFile.Copy( aFileData );
|
|
1695 |
}
|
|
1696 |
else if ( UICC_CARD_TYPE_ICC == iCardType )
|
|
1697 |
{
|
|
1698 |
// fill iSstFile
|
|
1699 |
iSSTFile.Copy( aFileData );
|
|
1700 |
}
|
|
1701 |
else
|
|
1702 |
{
|
|
1703 |
TFLOGSTRING("TSY: CMmUiccMessHandler::SimServiceTableCacheResp unknown card type, cache not done" );
|
|
1704 |
OstTrace0( TRACE_NORMAL, DUP1_CMMUICCMESSHANDLER_SIMSERVICETABLECACHERESP, "CMmUiccMessHandler::SimServiceTableCacheResp unknown card type, cache not done" );
|
|
1705 |
}
|
|
1706 |
}
|
|
1707 |
else
|
|
1708 |
{
|
|
1709 |
TFLOGSTRING2("TSY: CMmUiccMessHandler::SimServiceTableCacheResp: reading failed (0x%x)", aStatus );
|
|
1710 |
OstTrace1( TRACE_NORMAL, DUP2_CMMUICCMESSHANDLER_SIMSERVICETABLECACHERESP, "CMmUiccMessHandler::SimServiceTableCacheResp: reading failed (%x)", aStatus );
|
|
1711 |
}
|
|
1712 |
|
|
1713 |
//Complete Notify SIM Ready
|
|
1714 |
iMessageRouter->Complete(
|
|
1715 |
EMmTsyBootNotifySimStatusReadyIPC,
|
|
1716 |
KErrNone );
|
|
1717 |
}
|
|
1718 |
|
|
1719 |
// -----------------------------------------------------------------------------
|
|
1720 |
// CMmUiccMessHandler::GetServiceStatus
|
|
1721 |
// (other items were commented in a header).
|
|
1722 |
//
|
|
1723 |
TBool CMmUiccMessHandler::GetServiceStatus( TUint8 aServiceNo )
|
|
1724 |
{
|
|
1725 |
TFLOGSTRING2("TSY: CMmUiccMessHandler::GetServiceStatus for card: ox%x", iCardType );
|
|
1726 |
OstTrace1( TRACE_NORMAL, CMMUICCMESSHANDLER_GETSERVICESTATUS, "CMmUiccMessHandler::GetServiceStatus for card: ox%x", iCardType );
|
|
1727 |
|
|
1728 |
TBool ret( EFalse );
|
|
1729 |
|
|
1730 |
if( UICC_CARD_TYPE_UICC == iCardType )
|
|
1731 |
{
|
|
1732 |
// card type UICC, so service status info is in
|
|
1733 |
// EFust. Service info is coded as one bit,
|
|
1734 |
// for example first byte contains services 1-8 as:
|
|
1735 |
// bit: b8 b7 b6 b5 b4 b3 b2 b1
|
|
1736 |
// service no: 08 07 06 05 04 03 02 01
|
|
1737 |
// If bit is 1, service is supported
|
|
1738 |
// For more info about EFust, see 3GPP spec 31.102
|
|
1739 |
|
|
1740 |
// let's calculate index to get correct byte
|
|
1741 |
// which contains info about service requested
|
|
1742 |
TUint8 index( ( aServiceNo - 1 ) / 8 );
|
|
1743 |
|
|
1744 |
//let's calculate the bit number which contains
|
|
1745 |
// service info
|
|
1746 |
TUint8 bit( ( aServiceNo - 1 ) % 8 );
|
|
1747 |
|
|
1748 |
// form mask to get is service supported or not
|
|
1749 |
TUint8 mask( 1<<bit );
|
|
1750 |
|
|
1751 |
if( iUSTFile.Length() > index )
|
|
1752 |
{
|
|
1753 |
// If result is > 0, service is supported
|
|
1754 |
if( iUSTFile[index] & mask )
|
|
1755 |
{
|
|
1756 |
TFLOGSTRING2("TSY: CMmUiccMessHandler::GetServiceStatus: UICC service (%d) supported", aServiceNo );
|
|
1757 |
OstTrace1( TRACE_NORMAL, DUP1_CMMUICCMESSHANDLER_GETSERVICESTATUS, "CMmUiccMessHandler::GetServiceStatus: UICC service (%d) supported", aServiceNo );
|
|
1758 |
ret = ETrue;
|
|
1759 |
}
|
|
1760 |
}
|
|
1761 |
}
|
|
1762 |
else if( UICC_CARD_TYPE_ICC == iCardType )
|
|
1763 |
{
|
|
1764 |
// card type ICC, so service status info is in
|
|
1765 |
// EFsst. Service info is coded as two bits,
|
|
1766 |
// for example first byte contains services 1-4 as:
|
|
1767 |
// bit: b8 b7 b6 b5 b4 b3 b2 b1
|
|
1768 |
// service no: 04 04 03 03 02 02 01 01
|
|
1769 |
|
|
1770 |
// first bit describes is service allocated
|
|
1771 |
// second bit describes is service activated
|
|
1772 |
// for example service no 4: first bit is b7
|
|
1773 |
// and second bit is b8. Both bits needs to be
|
|
1774 |
// 1 so that service is supported. For more
|
|
1775 |
// info about EFsst, see 3GPP spec 51.011
|
|
1776 |
|
|
1777 |
// let's calculate index to get correct byte
|
|
1778 |
// which contains info about service requested
|
|
1779 |
TUint8 index( ( aServiceNo - 1 ) / 4 );
|
|
1780 |
|
|
1781 |
//let's calculate the bit number which contains
|
|
1782 |
// service info
|
|
1783 |
TUint8 bit( ( aServiceNo - 1 ) % 4 );
|
|
1784 |
|
|
1785 |
// form mask to get is service supported or not.
|
|
1786 |
TUint8 mask( 3<<( bit * 2 ) );
|
|
1787 |
|
|
1788 |
if( iSSTFile.Length() > index )
|
|
1789 |
{
|
|
1790 |
// If both bits are 1, service is supported
|
|
1791 |
if( ( iSSTFile[index] & mask ) == mask )
|
|
1792 |
{
|
|
1793 |
TFLOGSTRING2("TSY: CMmUiccMessHandler::GetServiceStatus: ICC service (%d) supported", aServiceNo );
|
|
1794 |
OstTrace1( TRACE_NORMAL, DUP2_CMMUICCMESSHANDLER_GETSERVICESTATUS, "CMmUiccMessHandler::GetServiceStatus: ICC service (%d) supported", aServiceNo );
|
|
1795 |
ret = ETrue;
|
|
1796 |
}
|
|
1797 |
}
|
|
1798 |
}
|
|
1799 |
return ret;
|
|
1800 |
}
|
|
1801 |
|
|
1802 |
// -----------------------------------------------------------------------------
|
|
1803 |
// CMmUiccMessHandler::ProcessUiccMsg
|
|
1804 |
// Handles data received from UICC server
|
|
1805 |
// -----------------------------------------------------------------------------
|
|
1806 |
//
|
|
1807 |
TInt CMmUiccMessHandler::ProcessUiccMsg(
|
|
1808 |
TInt aTraId,
|
|
1809 |
TInt aStatus,
|
|
1810 |
const TDesC8& aFileData )
|
|
1811 |
{
|
|
1812 |
TFLOGSTRING3("TSY: CMmUiccMessHandler::ProcessUiccMsg, transaction ID: %d, status: %d", aTraId, aStatus );
|
|
1813 |
OstTrace1( TRACE_NORMAL, CMMUICCMESSHANDLER_PROCESSUICCMSG, "CMmUiccMessHandler::ProcessUiccMsg, transaction ID: %d", aTraId );
|
|
1814 |
OstTrace1( TRACE_NORMAL, DUP2_CMMUICCMESSHANDLER_PROCESSUICCMSG, "CMmUiccMessHandler::ProcessUiccMsg, status: %d", aStatus );
|
|
1815 |
|
|
1816 |
TInt ret( KErrNone );
|
|
1817 |
|
|
1818 |
switch( aTraId )
|
|
1819 |
{
|
|
1820 |
case ETrIdSstCache:
|
|
1821 |
{
|
|
1822 |
SimServiceTableCacheResp( aStatus, aFileData );
|
|
1823 |
break;
|
|
1824 |
}
|
|
1825 |
case ETrIdCphsCache:
|
|
1826 |
{
|
|
1827 |
CphsInformationCacheResp( aStatus, aFileData );
|
|
1828 |
break;
|
|
1829 |
}
|
|
1830 |
default:
|
|
1831 |
{
|
|
1832 |
TFLOGSTRING("TSY: CMmUiccMessHandler::ProcessUiccMsg, unknown transaction ID" );
|
|
1833 |
OstTrace0( TRACE_NORMAL, DUP1_CMMUICCMESSHANDLER_PROCESSUICCMSG, "CMmUiccMessHandler::ProcessUiccMsg, unknown transaction ID" );
|
|
1834 |
break;
|
|
1835 |
}
|
|
1836 |
}
|
|
1837 |
|
|
1838 |
return ret;
|
|
1839 |
}
|
|
1840 |
|
|
1841 |
// -----------------------------------------------------------------------------
|
|
1842 |
// CMmUiccMessHandler::StorePinKeyReferences
|
|
1843 |
// (other items were commented in a header).
|
|
1844 |
// -----------------------------------------------------------------------------
|
|
1845 |
//
|
|
1846 |
void CMmUiccMessHandler::StorePinKeyReferences( const TDesC8& aFileData )
|
|
1847 |
{
|
|
1848 |
TFLOGSTRING("TSY: CMmUiccMessHandler::StorePinKeyReferences" );
|
|
1849 |
OstTrace0( TRACE_NORMAL, CMMUICCMESSHANDLER_STOREPINKEYREFERENCES, "CMmUiccMessHandler::StorePinKeyReferences" );
|
|
1850 |
// See ETSI TS 102 221 V7.11.0 (2008-07)chapter 9.5.2
|
|
1851 |
// There is only one PIN1/PIN2/UPIN per application
|
|
1852 |
TUint8 lengthOfPs( aFileData[3] ); // Number of PS bytes is in index 3
|
|
1853 |
|
|
1854 |
// Get PS_DO for PIN statuses
|
|
1855 |
TPtrC8 psDo;
|
|
1856 |
psDo.Set( aFileData.Mid( 4, lengthOfPs ) );
|
|
1857 |
|
|
1858 |
// Update index to point the first PIN
|
|
1859 |
TUint8 index( 4 + lengthOfPs );
|
|
1860 |
// Copy PIN related data to new buffer
|
|
1861 |
TPtrC8 pinDataBuffer;
|
|
1862 |
pinDataBuffer.Set( aFileData.Mid( index ) );
|
|
1863 |
TInt length( pinDataBuffer.Length() );
|
|
1864 |
TUint8 pinId( 0 );
|
|
1865 |
TUint8 orderNum( 0 ); // Used for shifting PIN status byte
|
|
1866 |
TBool upinExists( EFalse );
|
|
1867 |
TBool pin1Active( EFalse );
|
|
1868 |
|
|
1869 |
index = 0; // Start of new buffer
|
|
1870 |
while( length )
|
|
1871 |
{
|
|
1872 |
// Check if usage qualifier exists ( tag '95'). In that case skip it
|
|
1873 |
if ( 0x95 == pinDataBuffer[index] )
|
|
1874 |
{
|
|
1875 |
index += 3;
|
|
1876 |
length -= 3;
|
|
1877 |
}
|
|
1878 |
// PIN key reference
|
|
1879 |
pinId = pinDataBuffer[index + 2];
|
|
1880 |
index += 3; // Skip PIN key reference data element
|
|
1881 |
length -= 3;
|
|
1882 |
|
|
1883 |
// Store PIN ID
|
|
1884 |
if ( 1 <= pinId && 8 >= pinId ) // It is PIN1
|
|
1885 |
{
|
|
1886 |
iPin1Id = pinId;
|
|
1887 |
// Check if PIN1 is enabled ( the active PIN )
|
|
1888 |
if ( 0x80 & ( psDo[0] << orderNum ) )
|
|
1889 |
{
|
|
1890 |
iActivePin = RMobilePhone::ESecurityCodePin1;
|
|
1891 |
pin1Active = ETrue;
|
|
1892 |
}
|
|
1893 |
}
|
|
1894 |
else if ( 0x81 <= pinId && 0x88 >= pinId ) // It is PIN2
|
|
1895 |
{
|
|
1896 |
iPin2Id = pinId;
|
|
1897 |
orderNum++;
|
|
1898 |
}
|
|
1899 |
else if ( 0x11 == pinId )
|
|
1900 |
{
|
|
1901 |
upinExists = ETrue;
|
|
1902 |
orderNum++;
|
|
1903 |
}
|
|
1904 |
// No else
|
|
1905 |
}
|
|
1906 |
|
|
1907 |
// If PIN1 is not set as active and UPIN exists, UPIN is the active PIN
|
|
1908 |
if ( upinExists && !pin1Active )
|
|
1909 |
{
|
|
1910 |
iActivePin = RMobilePhone::ESecurityUniversalPin;
|
|
1911 |
}
|
|
1912 |
}
|
|
1913 |
|
|
1914 |
// -----------------------------------------------------------------------------
|
|
1915 |
// CMmUiccMessHandler::GetPin1KeyReference
|
|
1916 |
// (other items were commented in a header).
|
|
1917 |
// -----------------------------------------------------------------------------
|
|
1918 |
//
|
|
1919 |
TUint8 CMmUiccMessHandler::GetPin1KeyReference()
|
|
1920 |
{
|
|
1921 |
TFLOGSTRING("TSY: CMmUiccMessHandler::GetPin1KeyReference" );
|
|
1922 |
OstTrace0( TRACE_NORMAL, CMMUICCMESSHANDLER_GETPIN1KEYREFERENCE, "CMmUiccMessHandler::GetPin1KeyReference" );
|
|
1923 |
return iPin1Id;
|
|
1924 |
}
|
|
1925 |
|
|
1926 |
// -----------------------------------------------------------------------------
|
|
1927 |
// CMmUiccMessHandler::GetPin1KeyReference
|
|
1928 |
// (other items were commented in a header).
|
|
1929 |
// -----------------------------------------------------------------------------
|
|
1930 |
//
|
|
1931 |
TUint8 CMmUiccMessHandler::GetPin2KeyReference()
|
|
1932 |
{
|
|
1933 |
TFLOGSTRING("TSY: CMmUiccMessHandler::GetPin2KeyReference" );
|
|
1934 |
OstTrace0( TRACE_NORMAL, CMMUICCMESSHANDLER_GETPIN2KEYREFERENCE, "CMmUiccMessHandler::GetPin2KeyReference" );
|
|
1935 |
return iPin2Id;
|
|
1936 |
}
|
|
1937 |
|
|
1938 |
// -----------------------------------------------------------------------------
|
|
1939 |
// CMmUiccMessHandler::GetActivePin
|
|
1940 |
// (other items were commented in a header).
|
|
1941 |
// -----------------------------------------------------------------------------
|
|
1942 |
//
|
|
1943 |
RMobilePhone::TMobilePhoneSecurityCode CMmUiccMessHandler::GetActivePin()
|
|
1944 |
{
|
|
1945 |
TFLOGSTRING("TSY: CMmUiccMessHandler::GetActivePin" );
|
|
1946 |
OstTrace0( TRACE_NORMAL, CMMUICCMESSHANDLER_GETACTIVEPIN, "CMmUiccMessHandler::GetActivePin" );
|
|
1947 |
return iActivePin;
|
|
1948 |
}
|
|
1949 |
|
|
1950 |
// -----------------------------------------------------------------------------
|
|
1951 |
// CMmUiccMessHandler::ChangeActivePin()
|
|
1952 |
// (other items were commented in a header).
|
|
1953 |
// -----------------------------------------------------------------------------
|
|
1954 |
//
|
|
1955 |
void CMmUiccMessHandler::ChangeActivePin()
|
|
1956 |
{
|
|
1957 |
TFLOGSTRING("TSY: CMmUiccMessHandler::ChangeActivePin" );
|
|
1958 |
OstTrace0( TRACE_NORMAL, CMMUICCMESSHANDLER_CHANGEACTIVEPIN, "CMmUiccMessHandler::ChangeActivePin" );
|
|
1959 |
// Change the internal flag indicating which PIN is active
|
|
1960 |
if ( RMobilePhone::ESecurityCodePin1 == iActivePin )
|
|
1961 |
{
|
|
1962 |
iActivePin = RMobilePhone::ESecurityUniversalPin;
|
|
1963 |
}
|
|
1964 |
else if ( RMobilePhone::ESecurityUniversalPin == iActivePin )
|
|
1965 |
{
|
|
1966 |
iActivePin = RMobilePhone::ESecurityCodePin1;
|
|
1967 |
}
|
|
1968 |
}
|
|
1969 |
|
|
1970 |
// -----------------------------------------------------------------------------
|
|
1971 |
// CMmUiccMessHandler::InitializeCphsInformationCache
|
|
1972 |
// (other items were commented in a header).
|
|
1973 |
// -----------------------------------------------------------------------------
|
|
1974 |
//
|
|
1975 |
void CMmUiccMessHandler::InitializeCphsInformationCache()
|
|
1976 |
{
|
|
1977 |
TFLOGSTRING("TSY: CMmUiccMessHandler::InitializeCphsInformationCache" );
|
|
1978 |
OstTrace0( TRACE_NORMAL, CMMUICCMESSHANDLER_INITIALIZECPHSINFORMATIONCACHE, "CMmUiccMessHandler::InitializeCphsInformationCache" );
|
|
1979 |
|
|
1980 |
// CPHS information is read only in case of ICC card
|
|
1981 |
if( UICC_CARD_TYPE_ICC == iCardType )
|
|
1982 |
{
|
|
1983 |
// Set parameters for UICC_APPL_CMD_REQ message
|
|
1984 |
TUiccReadTransparent params;
|
|
1985 |
params.messHandlerPtr = static_cast<MUiccOperationBase*>( this );
|
|
1986 |
params.trId = ETrIdCphsCache;
|
|
1987 |
params.dataAmount = 0;
|
|
1988 |
params.dataOffset = 0;
|
|
1989 |
params.fileId = KElemCphsInformation;
|
|
1990 |
params.fileIdSfi = UICC_SFI_NOT_PRESENT;
|
|
1991 |
params.serviceType = UICC_APPL_READ_TRANSPARENT;
|
|
1992 |
|
|
1993 |
// File id path
|
|
1994 |
params.filePath.Append( KMasterFileId >> 8 );
|
|
1995 |
params.filePath.Append( KMasterFileId );
|
|
1996 |
params.filePath.Append( GetApplicationFileId() );
|
|
1997 |
|
|
1998 |
CreateUiccApplCmdReq( params );
|
|
1999 |
}
|
|
2000 |
}
|
|
2001 |
|
|
2002 |
// -----------------------------------------------------------------------------
|
|
2003 |
// CMmUiccMessHandler::CphsInformationCacheResp
|
|
2004 |
// (other items were commented in a header).
|
|
2005 |
// -----------------------------------------------------------------------------
|
|
2006 |
//
|
|
2007 |
void CMmUiccMessHandler::CphsInformationCacheResp(
|
|
2008 |
TInt aStatus,
|
|
2009 |
const TDesC8& aFileData )
|
|
2010 |
{
|
|
2011 |
TFLOGSTRING("TSY: CMmUiccMessHandler::CphsInformationCacheResp" );
|
|
2012 |
OstTrace0( TRACE_NORMAL, CMMUICCMESSHANDLER_CPHSINFORMATIONCACHERESP, "CMmUiccMessHandler::CphsInformationCacheResp" );
|
|
2013 |
|
|
2014 |
if ( UICC_STATUS_OK == aStatus )
|
|
2015 |
{
|
|
2016 |
// First byte of CPHS information is for CPHS phase, lbut
|
|
2017 |
// we are interested in only CPHS table, so we skip the
|
|
2018 |
// first byte and we just copy the CPHS table data
|
|
2019 |
TUint8 dataSize( aFileData.Length() - 1 );
|
|
2020 |
if( KEfCphsInfoSize >= dataSize )
|
|
2021 |
{
|
|
2022 |
iCPHSInformation.Copy( aFileData.Mid( 1, dataSize ) );
|
|
2023 |
}
|
|
2024 |
else
|
|
2025 |
{
|
|
2026 |
TFLOGSTRING3("TSY: CMmUiccMessHandler::CphsInformationCacheResp: buffer too small (expected: %d, actual: %d), cannot store CPHS info", dataSize, iCPHSInformation.Length() );
|
|
2027 |
OstTrace0( TRACE_NORMAL, DUP3_CMMUICCMESSHANDLER_CPHSINFORMATIONCACHERESP, "CMmUiccMessHandler::CphsInformationCacheResp: buffer too small, cannot store CPHS info" );
|
|
2028 |
OstTrace1( TRACE_NORMAL, DUP2_CMMUICCMESSHANDLER_CPHSINFORMATIONCACHERESP, "CMmUiccMessHandler::CphsInformationCacheResp: expected size: %d", dataSize );
|
|
2029 |
OstTrace1( TRACE_NORMAL, DUP4_CMMUICCMESSHANDLER_CPHSINFORMATIONCACHERESP, "CMmUiccMessHandler::CphsInformationCacheResp: actual size: %d", iCPHSInformation.Length() );
|
|
2030 |
}
|
|
2031 |
}
|
|
2032 |
else
|
|
2033 |
{
|
|
2034 |
TFLOGSTRING2("TSY: CMmUiccMessHandler::CphsInformationCacheResp: reading failed (0x%x)", aStatus );
|
|
2035 |
OstTrace1( TRACE_NORMAL, DUP1_CMMUICCMESSHANDLER_CPHSINFORMATIONCACHERESP, "CMmUiccMessHandler::CphsInformationCacheResp: reading failed (0x%x)", aStatus );
|
|
2036 |
}
|
|
2037 |
}
|
|
2038 |
|
|
2039 |
// -----------------------------------------------------------------------------
|
|
2040 |
// CMmUiccMessHandler::GetCphsInformationStatus
|
|
2041 |
// (other items were commented in a header).
|
|
2042 |
// -----------------------------------------------------------------------------
|
|
2043 |
//
|
|
2044 |
TBool CMmUiccMessHandler::GetCphsInformationStatus( TUint8 aServiceNo )
|
|
2045 |
{
|
|
2046 |
TFLOGSTRING("TSY: CMmUiccMessHandler::GetCphsInformationStatus" );
|
|
2047 |
OstTrace0( TRACE_NORMAL, DUP1_CMMUICCMESSHANDLER_GETCPHSINFORMATIONSTATUS, "CMmUiccMessHandler::GetCphsInformationStatus" );
|
|
2048 |
|
|
2049 |
TBool ret( EFalse );
|
|
2050 |
|
|
2051 |
// CPHS info is coded as two bits,
|
|
2052 |
// for example first byte contains services 1-4 as:
|
|
2053 |
// bit: b8 b7 b6 b5 b4 b3 b2 b1
|
|
2054 |
// service no: 04 04 03 03 02 02 01 01
|
|
2055 |
|
|
2056 |
// first bit describes is service allocated
|
|
2057 |
// second bit describes is service activated
|
|
2058 |
// for example service no 4: first bit is b7
|
|
2059 |
// and second bit is b8. Both bits needs to be
|
|
2060 |
// 1 so that service is supported. For more
|
|
2061 |
// info about CPHS info, see CPHS Phase 2 specification
|
|
2062 |
|
|
2063 |
// let's calculate index to get correct byte
|
|
2064 |
// which contains info about service requested
|
|
2065 |
TUint8 index( ( aServiceNo - 1 ) / 4 );
|
|
2066 |
|
|
2067 |
// let's calculate the bit number which contains
|
|
2068 |
// service info
|
|
2069 |
TUint8 bit( ( aServiceNo - 1 ) % 4 );
|
|
2070 |
|
|
2071 |
// form mask to get is service supported or not.
|
|
2072 |
TUint8 mask( 3<<( bit * 2 ) );
|
|
2073 |
|
|
2074 |
if( iCPHSInformation.Length() > index )
|
|
2075 |
{
|
|
2076 |
// If both bits are 1, service is supported
|
|
2077 |
if( ( iCPHSInformation[index] & mask ) == mask )
|
|
2078 |
{
|
|
2079 |
TFLOGSTRING2("TSY: CMmUiccMessHandler::GetCphsInformationStatus: CPHS service (%d) supported", aServiceNo );
|
|
2080 |
OstTrace1( TRACE_NORMAL, CMMUICCMESSHANDLER_GETCPHSINFORMATIONSTATUS, "CMmUiccMessHandler::GetCphsInformationStatus: CPHS service (%d) supported", aServiceNo );
|
|
2081 |
ret = ETrue;
|
|
2082 |
}
|
|
2083 |
}
|
|
2084 |
return ret;
|
|
2085 |
}
|
|
2086 |
|
|
2087 |
|
|
2088 |
// End of File
|