author | mikaruus <mika.a.ruuskanen@nokia.com> |
Wed, 21 Apr 2010 14:29:55 +0300 | |
changeset 8 | 6295dc2169f3 |
parent 5 | 8ccc39f9d787 |
child 9 | 8486d82aef45 |
permissions | -rw-r--r-- |
0 | 1 |
/* |
2 |
* Copyright (c) 2007-2008 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: |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
// INCLUDE FILES |
|
19 |
#include "cmmsecuritymesshandler.h" |
|
20 |
#include "cmmphonetsender.h" |
|
21 |
#include "cmmstaticutility.h" |
|
22 |
#include "cmmmessagerouter.h" |
|
23 |
#include "cmmnetmesshandler.h" |
|
24 |
#include "cmmcallmesshandler.h" |
|
25 |
#include "tsylogger.h" // logging |
|
5
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
26 |
#include "OstTraceDefinitions.h" |
0 | 27 |
#ifdef OST_TRACE_COMPILER_IN_USE |
5
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
28 |
#include "cmmsecuritymesshandlerTraces.h" |
0 | 29 |
#endif |
30 |
||
31 |
#include <etelmm.h> |
|
32 |
#include <tisi.h> |
|
33 |
#ifdef INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING |
|
34 |
#include <mtcisi.h> |
|
35 |
#else /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */ |
|
36 |
#include <mceisi.h> |
|
37 |
#endif /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */ |
|
38 |
#include <ctsy/pluginapi/cmmdatapackage.h> |
|
39 |
#include <ctsy/serviceapi/gsmerror.h> |
|
40 |
#include <ctsy/serviceapi/mmtsy_ipcdefs.h> |
|
41 |
#include <uiccisi.h> |
|
42 |
||
43 |
// EXTERNAL DATA STRUCTURES |
|
44 |
//None |
|
45 |
||
46 |
// EXTERNAL FUNCTION PROTOTYPES |
|
47 |
//None |
|
48 |
||
49 |
// CONSTANTS |
|
50 |
// hard-coded transaction id for ISA messages |
|
51 |
const TUint8 KSecurityTransId = 7; |
|
52 |
||
53 |
// Maximum size of UICC_SB_PIN and UICC_SB_PUK |
|
54 |
const TUint8 KMaxSizeUiccSbPin = 16; |
|
55 |
const TUint8 KMaxSizeUiccSbPuk = 16; |
|
56 |
||
57 |
// Key reference for universal PIN |
|
58 |
const TUint8 KUniversalPinKeyReference = 0x11; |
|
59 |
||
60 |
// constants for getting/setting FDN state |
|
61 |
const TUint8 KUiccServiceFdn = 0x02; // service in EFust |
|
62 |
const TUint8 KIccServiceFdn = 0x03; // service in EFsst |
|
63 |
const TUint8 KIccServiceAdn = 0x02; // service in EFsst |
|
64 |
const TUint8 KFdnStateMask = 0x01; |
|
65 |
const TUint8 KServiceActivated = 0x01; |
|
66 |
const TUint8 KServiceNotActivated = 0x00; |
|
67 |
const TUint8 KInvalidated = 0x00; |
|
68 |
const TUint8 KNotInvalidated = 0x01; |
|
69 |
const TUint8 KInvalidateFlagMask = 0x01; |
|
70 |
||
71 |
const TUint8 KSw1Position = 0x02; |
|
72 |
const TUint8 KSw2Position = 0x01; |
|
73 |
||
74 |
const TUint16 KElemAdnIcc = 0x6F3A; |
|
75 |
||
76 |
// MACROS |
|
77 |
//None |
|
78 |
||
79 |
// LOCAL CONSTANTS AND MACROS |
|
80 |
const TUint8 KSecPadding = 0x00; // Filler byte for ISI messages |
|
81 |
||
82 |
//TICCType enumerates the SIM card types |
|
83 |
enum TICCType |
|
84 |
{ |
|
85 |
EICCTypeSim2GGsm = 0, |
|
86 |
EICCTypeSim3G, |
|
87 |
EICCTypeSimUnknown |
|
88 |
}; |
|
89 |
||
90 |
// MODULE DATA STRUCTURES |
|
91 |
//None |
|
92 |
||
93 |
// LOCAL FUNCTION PROTOTYPES |
|
94 |
//None |
|
95 |
||
96 |
||
97 |
// ----------------------------------------------------------------------------- |
|
98 |
// CMmSecurityMessHandler::CMmSecurityMessHandler |
|
99 |
// C++ default constructor |
|
100 |
// ----------------------------------------------------------------------------- |
|
101 |
// |
|
102 |
CMmSecurityMessHandler::CMmSecurityMessHandler() |
|
103 |
{ |
|
104 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::CMmSecurityMessHandler"); |
|
105 |
OstTrace0( TRACE_NORMAL, CMMSECURITYMESSHANDLER_CMMSECURITYMESSHANDLER, "CMmSecurityMessHandler::CMmSecurityMessHandler" ); |
|
106 |
//none |
|
107 |
} |
|
108 |
||
109 |
// ----------------------------------------------------------------------------- |
|
110 |
// CMmSecurityMessHandler::NewL |
|
111 |
// Two-phased constructor. |
|
112 |
// ----------------------------------------------------------------------------- |
|
113 |
// |
|
114 |
CMmSecurityMessHandler* CMmSecurityMessHandler::NewL( |
|
115 |
CMmPhoNetSender* aPhoNetSender, //pointer to the phonet sender |
|
116 |
CMmPhoNetReceiver* aPhoNetReceiver, //pointer to the phonet sender |
|
117 |
CMmNetMessHandler* aNetMessHandler, //pointer to the net mess handler |
|
118 |
CMmCallMessHandler* aCallMessHandler, //pointer to the call mess handler |
|
119 |
CMmMessageRouter* aMessageRouter, |
|
120 |
CMmUiccMessHandler* aUiccMessHandler ) |
|
121 |
{ |
|
122 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::NewL"); |
|
123 |
OstTrace0( TRACE_NORMAL, CMMSECURITYMESSHANDLER_NEWL, "CMmSecurityMessHandler::NewL" ); |
|
124 |
CMmSecurityMessHandler* const securityMessHandler = |
|
125 |
new ( ELeave ) CMmSecurityMessHandler(); |
|
126 |
||
127 |
CleanupStack::PushL( securityMessHandler ); |
|
128 |
securityMessHandler->iPhoNetSender = aPhoNetSender; |
|
129 |
securityMessHandler->iNetMessHandler = aNetMessHandler; |
|
130 |
securityMessHandler->iCallMessHandler = aCallMessHandler; |
|
131 |
securityMessHandler->iMessageRouter = aMessageRouter; |
|
132 |
securityMessHandler->iMmUiccMessHandler = aUiccMessHandler; |
|
133 |
||
134 |
securityMessHandler->ConstructL(); |
|
135 |
||
136 |
// UICC |
|
137 |
aPhoNetReceiver->RegisterL( securityMessHandler, PN_UICC, UICC_IND ); |
|
138 |
aPhoNetReceiver->RegisterL( securityMessHandler, PN_UICC, UICC_RESP ); |
|
139 |
aPhoNetReceiver->RegisterL( securityMessHandler, PN_UICC, UICC_CARD_IND ); |
|
140 |
aPhoNetReceiver->RegisterL( securityMessHandler, PN_UICC, UICC_PIN_IND ); |
|
141 |
aPhoNetReceiver->RegisterL( securityMessHandler, PN_UICC, UICC_PIN_RESP ); |
|
142 |
||
143 |
#ifdef INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING |
|
144 |
//MTC |
|
145 |
aPhoNetReceiver->RegisterL( |
|
146 |
securityMessHandler, PN_MTC, MTC_STATE_INFO_IND ); |
|
147 |
aPhoNetReceiver->RegisterL( |
|
148 |
securityMessHandler, PN_MTC, MTC_RF_STATUS_QUERY_RESP ); |
|
149 |
aPhoNetReceiver->RegisterL( |
|
150 |
securityMessHandler, PN_MTC, MTC_STATE_QUERY_RESP ); |
|
151 |
#else /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */ |
|
152 |
// MCE |
|
153 |
aPhoNetReceiver->RegisterL( |
|
154 |
securityMessHandler, PN_MODEM_MCE, MCE_MODEM_STATE_IND ); |
|
155 |
aPhoNetReceiver->RegisterL( |
|
156 |
securityMessHandler, PN_MODEM_MCE, MCE_MODEM_STATE_QUERY_RESP ); |
|
157 |
aPhoNetReceiver->RegisterL( |
|
158 |
securityMessHandler, PN_MODEM_MCE, MCE_RF_STATE_QUERY_RESP ); |
|
159 |
#endif /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */ |
|
160 |
||
161 |
CleanupStack::Pop( securityMessHandler ); |
|
162 |
return securityMessHandler; |
|
163 |
} |
|
164 |
||
165 |
// ----------------------------------------------------------------------------- |
|
166 |
// CMmSecurityMessHandler::ConstructL |
|
167 |
// Symbian 2nd phase constructor. Initialises internal attributes. |
|
168 |
// ----------------------------------------------------------------------------- |
|
169 |
// |
|
170 |
void CMmSecurityMessHandler::ConstructL() |
|
171 |
{ |
|
172 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::ConstructL"); |
|
173 |
OstTrace0( TRACE_NORMAL, CMMSECURITYMESSHANDLER_CONSTRUCTL, "CMmSecurityMessHandler::ConstructL" ); |
|
174 |
||
175 |
#ifdef INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING |
|
176 |
// Initialize the current MTC state to poweroff, and do the first state query |
|
177 |
iBootState.iMtcCurrentState = MTC_POWER_OFF; |
|
178 |
MtcStateQueryReq( KSecurityTransId ); |
|
179 |
#else /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */ |
|
180 |
// Initialize the current modem state to poweroff |
|
181 |
iBootState.iMceCurrentState = MCE_POWER_OFF; |
|
182 |
||
183 |
// Query modem state and RF state |
|
184 |
MceModemStateQueryReq(); |
|
185 |
MceRfStateQueryReq(); |
|
186 |
#endif /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */ |
|
187 |
||
188 |
iPukCodeRequired = EFalse; |
|
189 |
||
190 |
iApplicationId = 0; |
|
191 |
iPinId = 0; |
|
192 |
// This flags indicates if PIN attempts left query in case |
|
193 |
iPinAttemptsLeftQuery = EFalse; |
|
194 |
// This flags indicates if lock state query in case |
|
195 |
iLockStateQuery = EFalse; |
|
196 |
iCodeType = RMobilePhone::ESecurityCodePin1; |
|
197 |
||
198 |
iFdnSetting = RMobilePhone::EFdnSetOff; |
|
199 |
} |
|
200 |
||
201 |
// ----------------------------------------------------------------------------- |
|
202 |
// CMmSecurityMessHandler::~CMmSecurityMessHandler |
|
203 |
// Destructor |
|
204 |
// ----------------------------------------------------------------------------- |
|
205 |
// |
|
206 |
CMmSecurityMessHandler::~CMmSecurityMessHandler() |
|
207 |
{ |
|
208 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::~CMmSecurityMessHandler"); |
|
209 |
OstTrace0( TRACE_NORMAL, DUP1_CMMSECURITYMESSHANDLER_CMMSECURITYMESSHANDLER, "CMmSecurityMessHandler::~CMmSecurityMessHandler" ); |
|
210 |
} |
|
211 |
||
212 |
// ----------------------------------------------------------------------------- |
|
213 |
// CMmSecurityMessHandler::ExtFuncL |
|
214 |
// Dispatches Etel requests to DOS level handlers |
|
215 |
// ----------------------------------------------------------------------------- |
|
216 |
// |
|
217 |
TInt CMmSecurityMessHandler::ExtFuncL( |
|
218 |
TInt aIpc, |
|
219 |
const CMmDataPackage* aDataPackage ) |
|
220 |
{ |
|
221 |
TFLOGSTRING2("TSY: CMmSecurityMessHandler::ExtFuncL, aIpc: %d", aIpc); |
|
222 |
OstTrace1( TRACE_NORMAL, DUP1_CMMSECURITYMESSHANDLER_EXTFUNCL, "CMmSecurityMessHandler::ExtFuncL;aIpc=%d", aIpc ); |
|
223 |
||
224 |
TInt ret( KErrNone ); |
|
225 |
||
226 |
TUint8 transId( KSecurityTransId ); |
|
227 |
||
228 |
switch ( aIpc ) |
|
229 |
{ |
|
230 |
case EMobilePhoneGetLockInfo: |
|
231 |
{ |
|
232 |
// Unpack data |
|
233 |
RMobilePhone::TMobilePhoneLock* aLock( NULL ); |
|
234 |
RMobilePhone::TMobilePhoneLockInfoV1* aLockInfo( NULL ); |
|
235 |
aDataPackage->UnPackData( &aLock, &aLockInfo); |
|
236 |
// Set flag to indicate that this is lock state query |
|
237 |
iLockStateQuery = ETrue; |
|
238 |
switch( *aLock ) |
|
239 |
{ |
|
240 |
case RMobilePhone::ELockPhoneDevice: // Device lock |
|
241 |
{ |
|
242 |
// Not yet supported in modemadaptation |
|
243 |
ret = KErrNotSupported; |
|
244 |
break; |
|
245 |
} |
|
246 |
case RMobilePhone::ELockPhoneToICC: // Lock to current (U)SIM |
|
247 |
{ |
|
248 |
// Not yet supported in modemadaptation |
|
249 |
ret = KErrNotSupported; |
|
250 |
break; |
|
251 |
} |
|
252 |
case RMobilePhone::ELockICC: // PIN |
|
253 |
case RMobilePhone::ELockPin2: // PIN2 |
|
254 |
{ |
|
255 |
UiccPinReqStateQuery( *aLock ); |
|
256 |
break; |
|
257 |
} |
|
258 |
case RMobilePhone::ELockUniversalPin: |
|
259 |
{ |
|
260 |
// UPIN is supported only in 3G |
|
261 |
if ( UICC_CARD_TYPE_UICC == |
|
262 |
iMmUiccMessHandler->GetCardType() ) |
|
263 |
{ |
|
264 |
UiccPinReqStateQuery( *aLock ); |
|
265 |
} |
|
266 |
else |
|
267 |
{ |
|
268 |
ret = KErrNotSupported; |
|
269 |
} |
|
270 |
break; |
|
271 |
} |
|
272 |
default: |
|
273 |
{ |
|
274 |
ret = KErrNotSupported; |
|
275 |
break; |
|
276 |
} |
|
277 |
} // End of switch( *aLock ) |
|
278 |
break; |
|
279 |
} |
|
280 |
case EMobilePhoneChangeSecurityCode: |
|
281 |
{ |
|
282 |
//unpack data |
|
283 |
RMobilePhone::TMobilePhoneSecurityCode* type( NULL ); |
|
284 |
RMobilePhone::TMobilePhonePasswordChangeV1* change( NULL ); |
|
285 |
aDataPackage->UnPackData( &type, &change ); |
|
286 |
ret = SecCodeChangeReq( transId, type, change ); |
|
287 |
break; |
|
288 |
} |
|
289 |
case EMobilePhoneAbortSecurityCode: |
|
290 |
{ |
|
291 |
// Just complete the cancelling to client |
|
292 |
// UICC server doesn't support cancelling process. |
|
293 |
iMessageRouter->Complete( |
|
294 |
EMobilePhoneAbortSecurityCode, |
|
295 |
KErrNone ); |
|
296 |
break; |
|
297 |
} |
|
298 |
case EMobilePhoneVerifySecurityCode: |
|
299 |
{ |
|
300 |
//unpack data |
|
301 |
RMobilePhone::TMobilePhoneSecurityCode* type( NULL ); |
|
302 |
RMobilePhone::TCodeAndUnblockCode* codes( NULL ); |
|
303 |
aDataPackage->UnPackData( &type, &codes ); |
|
304 |
ret = VerifySecurityCode( type, codes ); |
|
305 |
break; |
|
306 |
} |
|
307 |
case EMobilePhoneGetSecurityCodeInfo: |
|
308 |
{ |
|
309 |
// Set flag to indicate that this is PIN attempts left query |
|
310 |
iPinAttemptsLeftQuery = ETrue; |
|
311 |
//unpack data |
|
312 |
RMobilePhone::TMobilePhoneSecurityCode* type( NULL ); |
|
313 |
aDataPackage->UnPackData( &type ); |
|
314 |
// Save code type for completing |
|
315 |
iCodeType = *type; |
|
316 |
TUint8 cardType( iMmUiccMessHandler->GetCardType() ); |
|
317 |
||
318 |
// Initialize lock type to PIN1 |
|
319 |
RMobilePhone::TMobilePhoneLock lock( RMobilePhone::ELockICC ); |
|
320 |
if ( RMobilePhone::ESecurityCodePin2 == *type ) |
|
321 |
{ |
|
322 |
if ( UICC_CARD_TYPE_UICC != cardType ) |
|
323 |
{ |
|
324 |
ret = KErrNotSupported; |
|
325 |
} |
|
326 |
lock = RMobilePhone::ELockPin2; |
|
327 |
} |
|
328 |
else if ( RMobilePhone::ESecurityUniversalPin == *type ) |
|
329 |
{ |
|
330 |
if ( UICC_CARD_TYPE_UICC != cardType ) |
|
331 |
{ |
|
332 |
ret = KErrNotSupported; |
|
333 |
} |
|
334 |
lock = RMobilePhone::ELockUniversalPin; |
|
335 |
} |
|
336 |
if ( KErrNone == ret ) |
|
337 |
{ |
|
338 |
ret = UiccPinReqStateQuery( lock ); |
|
339 |
} |
|
340 |
break; |
|
341 |
} |
|
342 |
case EMobilePhoneSetLockSetting: |
|
343 |
{ |
|
344 |
//unpack data |
|
345 |
TLockAndSetting* lockAndSetting( NULL ); |
|
346 |
RMobilePhone::TMobilePassword* password( NULL ); |
|
347 |
aDataPackage->UnPackData( &lockAndSetting, &password ); |
|
348 |
||
349 |
RMobilePhone::TMobilePhoneLock lock( *(lockAndSetting->iLock ) ); |
|
350 |
RMobilePhone::TMobilePhoneLockSetting setting( |
|
351 |
*(lockAndSetting->iSetting ) ); |
|
352 |
||
353 |
// PIN code disabling/enabling is don in UICC server |
|
354 |
if ( lock == RMobilePhone::ELockICC || |
|
355 |
lock == RMobilePhone::ELockPin2 || |
|
356 |
lock == RMobilePhone::ELockUniversalPin ) |
|
357 |
{ |
|
358 |
ret = UiccPinReqChangeState( lock, setting, *password ); |
|
359 |
} |
|
360 |
else |
|
361 |
{ |
|
362 |
// Not yet supported in modemadaptation |
|
363 |
ret = KErrNotSupported; |
|
364 |
} |
|
365 |
break; |
|
366 |
} |
|
367 |
case EMmTsySecurityGetSimActivePinStateIPC: |
|
368 |
{ |
|
369 |
GetActivePin(); |
|
370 |
break; |
|
371 |
} |
|
372 |
case EMmTsyBootNotifySimStatusReadyIPC: |
|
373 |
{ |
|
374 |
UiccReq(); |
|
375 |
break; |
|
376 |
} |
|
377 |
case EMmTsySimGetICCType: |
|
378 |
{ |
|
379 |
GetIccType(); |
|
380 |
#ifdef INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING |
|
381 |
//NOTE: |
|
382 |
// It is possible that the query below is not needed anymore, because always |
|
383 |
// in CMmSecurityMessHandler::ConstructL(), the MtcStateQueryReq() is called, which |
|
384 |
// eventually in its response calls also MtcRfStatusQueryReq() |
|
385 |
ret = MtcRfStatusQueryReq( transId ); |
|
386 |
#endif /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */ |
|
387 |
break; |
|
388 |
} |
|
389 |
case EMobilePhoneSetFdnSetting: |
|
390 |
{ |
|
391 |
TUint8 cardType( iMmUiccMessHandler->GetCardType() ); |
|
392 |
RMobilePhone::TMobilePhoneFdnSetting* fdnSetting( NULL ); |
|
393 |
aDataPackage->UnPackData( &fdnSetting ); |
|
394 |
iFdnSetting = *fdnSetting; |
|
395 |
||
396 |
if( UICC_CARD_TYPE_UICC == cardType ) |
|
397 |
{ |
|
398 |
ret = ReadEfEst( ETrIdSetFdnStateReadEst ); |
|
399 |
} |
|
400 |
else if( UICC_CARD_TYPE_ICC == cardType ) |
|
401 |
{ |
|
402 |
ret = ReadEfAdnFileInfo( ETrIdSetFdnStateReadFileInfo ); |
|
403 |
} |
|
404 |
else |
|
405 |
{ |
|
406 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::ExtFuncL: unknown card type, FDN state not set"); |
|
407 |
OstTrace0( TRACE_NORMAL, DUP3_CMMSECURITYMESSHANDLER_EXTFUNCL, "CMmSecurityMessHandler::ExtFuncL: unknown card type, FDN state not set" ); |
|
408 |
ret = KErrGeneral; |
|
409 |
} |
|
410 |
break; |
|
411 |
} |
|
412 |
case EMobilePhoneGetFdnStatus: |
|
413 |
{ |
|
414 |
TUint8 cardType( iMmUiccMessHandler->GetCardType() ); |
|
415 |
if( UICC_CARD_TYPE_UICC == cardType ) |
|
416 |
{ |
|
417 |
// read EFest |
|
418 |
ret = ReadEfEst( ETrIdGetFdnStateReadEst ); |
|
419 |
} |
|
420 |
else if( UICC_CARD_TYPE_ICC == cardType ) |
|
421 |
{ |
|
422 |
// read file info for EFadn |
|
423 |
ret = ReadEfAdnFileInfo( ETrIdGetFdnStateReadFileInfo ); |
|
424 |
} |
|
425 |
else |
|
426 |
{ |
|
427 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::ExtFuncL: unknown card type, FDN state cannot be solved"); |
|
428 |
OstTrace0( TRACE_NORMAL, CMMSECURITYMESSHANDLER_EXTFUNCL, "CMmSecurityMessHandler::ExtFuncL: unknown card type, FDN state cannot be solved" ); |
|
429 |
ret = KErrGeneral; |
|
430 |
} |
|
431 |
break; |
|
432 |
} |
|
433 |
case EMobilePhoneGetCurrentActiveUSimApplication: |
|
434 |
{ |
|
435 |
GetActiveUsimApplication(); |
|
436 |
break; |
|
437 |
} |
|
438 |
#ifdef INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING |
|
439 |
case EMmTsyBootGetRFStatusIPC: |
|
440 |
{ |
|
441 |
//This should not be in any use at the moment |
|
442 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::ExtFuncL - EMmTsyBootGetRFStatusIPC (NOT IN USE!!!)"); |
|
443 |
OstTrace0( TRACE_NORMAL, DUP5_CMMSECURITYMESSHANDLER_EXTFUNCL, "CMmSecurityMessHandler::ExtFuncL, EMmTsyBootGetRFStatusIPC (NOT IN USE!!!)" ); |
|
444 |
ret = MtcRfStatusQueryReq( transId ); |
|
445 |
break; |
|
446 |
} |
|
447 |
#endif /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */ |
|
448 |
default: |
|
449 |
{ |
|
450 |
TFLOGSTRING2("TSY: CMmSecurityMessHandler::ExtFuncL - Unknown IPC: %d", aIpc); |
|
451 |
OstTrace1( TRACE_NORMAL, DUP6_CMMSECURITYMESSHANDLER_EXTFUNCL, "CMmSecurityMessHandler::ExtFuncL;Unknown aIpc=%d", aIpc ); |
|
452 |
ret = KErrNotSupported; |
|
453 |
break; |
|
454 |
} |
|
455 |
} |
|
456 |
||
457 |
return ret; |
|
458 |
} |
|
459 |
||
460 |
||
461 |
// ----------------------------------------------------------------------------- |
|
462 |
// CMmSecurityMessHandler::ReceiveMessageL |
|
463 |
// Called when an ISI message has been received. |
|
464 |
// ----------------------------------------------------------------------------- |
|
465 |
// |
|
466 |
void CMmSecurityMessHandler::ReceiveMessageL( |
|
467 |
const TIsiReceiveC &aIsiMessage ) // received ISI message |
|
468 |
{ |
|
469 |
TInt resource (aIsiMessage.Get8bit(ISI_HEADER_OFFSET_RESOURCEID)); |
|
470 |
TInt messageId(aIsiMessage.Get8bit(ISI_HEADER_OFFSET_MESSAGEID)); |
|
471 |
||
472 |
TFLOGSTRING3("TSY: CMmSecurityMessHandler::ReceiveMessageL - resource: %d, msgId: %d", resource, messageId); |
|
473 |
OstTraceExt2( TRACE_NORMAL, DUP1_CMMSECURITYMESSHANDLER_RECEIVEMESSAGEL, "CMmSecurityMessHandler::ReceiveMessageL;resource=%d;messageId=%d", resource, messageId ); |
|
474 |
||
475 |
switch ( resource ) |
|
476 |
{ |
|
477 |
#ifdef INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING |
|
478 |
case PN_MTC: |
|
479 |
{ |
|
480 |
switch( messageId ) |
|
481 |
{ |
|
482 |
case MTC_STATE_INFO_IND: |
|
483 |
{ |
|
484 |
MtcStateInfoIndL( aIsiMessage ); |
|
485 |
break; |
|
486 |
} |
|
487 |
case MTC_STATE_QUERY_RESP: |
|
488 |
{ |
|
489 |
MtcStateQueryRespL( aIsiMessage ); |
|
490 |
break; |
|
491 |
} |
|
492 |
case MTC_RF_STATUS_QUERY_RESP: |
|
493 |
{ |
|
494 |
MtcRfStatusQueryResp( aIsiMessage ); |
|
495 |
break; |
|
496 |
} |
|
497 |
default: |
|
498 |
{ |
|
499 |
TFLOGSTRING2("TSY: CMmSecurityMessHandler::ReceiveMessageL - PN_MTC - unknown msgId: %d", messageId); |
|
500 |
//OstTrace1( TRACE_NORMAL, DUP3_CMMSECURITYMESSHANDLER_RECEIVEMESSAGEL, "CMmSecurityMessHandler::ReceiveMessageL;PN_MTC - unknown messageId=%d", messageId ); |
|
501 |
break; |
|
502 |
} |
|
503 |
} // end switch ( messageId ) |
|
504 |
break; // end case PN_MTC |
|
505 |
} |
|
506 |
#else /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */ |
|
507 |
case PN_MODEM_MCE: |
|
508 |
{ |
|
509 |
switch( messageId ) |
|
510 |
{ |
|
511 |
case MCE_MODEM_STATE_IND: |
|
512 |
{ |
|
513 |
MceModemStateInd( aIsiMessage ); |
|
514 |
break; |
|
515 |
} |
|
516 |
case MCE_MODEM_STATE_QUERY_RESP: |
|
517 |
{ |
|
518 |
MceModemStateQueryResp( aIsiMessage ); |
|
519 |
break; |
|
520 |
} |
|
521 |
case MCE_RF_STATE_QUERY_RESP: |
|
522 |
{ |
|
523 |
MceRfStateQueryResp( aIsiMessage ); |
|
524 |
break; |
|
525 |
} |
|
526 |
default: |
|
527 |
{ |
|
528 |
TFLOGSTRING2("TSY: CMmSecurityMessHandler::ReceiveMessageL - PN_MTC - unknown msgId: %d", messageId); |
|
529 |
OstTrace1( TRACE_NORMAL, DUP3_CMMSECURITYMESSHANDLER_RECEIVEMESSAGEL, "CMmSecurityMessHandler::ReceiveMessageL;PN_MTC - unknown messageId=%d", messageId ); |
|
530 |
break; |
|
531 |
} |
|
532 |
} // end switch ( messageId ) |
|
533 |
break; // end case PN_MODEM_MCE |
|
534 |
} |
|
535 |
#endif /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */ |
|
536 |
case PN_UICC: |
|
537 |
{ |
|
538 |
switch( messageId ) |
|
539 |
{ |
|
540 |
case UICC_RESP: |
|
541 |
{ |
|
542 |
UiccResp( aIsiMessage ); |
|
543 |
break; |
|
544 |
} |
|
545 |
case UICC_IND: |
|
546 |
{ |
|
547 |
UiccInd( aIsiMessage ); |
|
548 |
break; |
|
549 |
} |
|
550 |
case UICC_CARD_IND: |
|
551 |
{ |
|
552 |
UiccCardInd( aIsiMessage ); |
|
553 |
break; |
|
554 |
} |
|
555 |
case UICC_PIN_IND: |
|
556 |
{ |
|
557 |
UiccPinInd( aIsiMessage ); |
|
558 |
break; |
|
559 |
} |
|
560 |
case UICC_PIN_RESP: |
|
561 |
{ |
|
562 |
UiccPinResp( aIsiMessage ); |
|
563 |
break; |
|
564 |
} |
|
565 |
default: |
|
566 |
{ |
|
567 |
break; |
|
568 |
} |
|
569 |
} |
|
570 |
break; |
|
571 |
} |
|
572 |
default: |
|
573 |
{ |
|
574 |
TFLOGSTRING2("TSY: CMmSecurityMessHandler::ReceiveMessageL - unknown resource: %d", resource); |
|
575 |
OstTrace1( TRACE_NORMAL, DUP5_CMMSECURITYMESSHANDLER_RECEIVEMESSAGEL, "CMmSecurityMessHandler::ReceiveMessageL;resource=%d", resource ); |
|
576 |
break; // server not known |
|
577 |
} |
|
578 |
} // end of switch |
|
579 |
} |
|
580 |
||
581 |
||
582 |
// ----------------------------------------------------------------------------- |
|
583 |
// CMmSecurityMessHandler::VerifySecurityCode |
|
584 |
// ----------------------------------------------------------------------------- |
|
585 |
// |
|
586 |
TInt CMmSecurityMessHandler::VerifySecurityCode( |
|
587 |
RMobilePhone::TMobilePhoneSecurityCode* aType, |
|
588 |
RMobilePhone::TCodeAndUnblockCode* aCodes ) |
|
589 |
{ |
|
590 |
TInt ret( KErrNotReady ); |
|
591 |
RMobilePhone::TMobilePassword code( aCodes->iCode ); |
|
592 |
RMobilePhone::TMobilePassword unblockCode( aCodes->iUnblockCode ); |
|
593 |
||
594 |
TFLOGSTRING4("TSY: CMmSecurityMessHandler::VerifySecurityCode - code type: %d, code: %S, unblock code: %S",*aType, &code, &unblockCode); |
|
595 |
OstTraceExt3( TRACE_NORMAL, DUP1_CMMSECURITYMESSHANDLER_SECCODEVERIFYREQ, "CMmSecurityMessHandler::VerifySecurityCode;code=%S;unblockCode=%S;aType=%hhu", code, unblockCode, *aType ); |
|
596 |
||
597 |
switch( *aType ) |
|
598 |
{ |
|
599 |
// PIN codes are verified in UICC server |
|
600 |
case RMobilePhone::ESecurityCodePin1: |
|
601 |
case RMobilePhone::ESecurityCodePin2: |
|
602 |
case RMobilePhone::ESecurityUniversalPin: |
|
603 |
{ |
|
604 |
ret = UiccPinReqVerify( UICC_PIN_VERIFY, code, unblockCode ); |
|
605 |
break; |
|
606 |
} |
|
607 |
// PUK codes are verified in UICC server |
|
608 |
case RMobilePhone::ESecurityCodePuk1: |
|
609 |
case RMobilePhone::ESecurityCodePuk2: |
|
610 |
case RMobilePhone::ESecurityUniversalPuk: |
|
611 |
{ |
|
612 |
if ( *aType == RMobilePhone::ESecurityCodePuk1 ) |
|
613 |
{ |
|
614 |
iPukCodeRequired = EFalse; |
|
615 |
} |
|
616 |
ret = UiccPinReqVerify( UICC_PIN_UNBLOCK, code, unblockCode ); |
|
617 |
break; |
|
618 |
} |
|
619 |
default: |
|
620 |
{ |
|
621 |
break; |
|
622 |
} |
|
623 |
} |
|
624 |
return ret; |
|
625 |
} |
|
626 |
||
627 |
||
628 |
// ----------------------------------------------------------------------------- |
|
629 |
// CMmSecurityMessHandler::SecCodeChangeReq |
|
630 |
// |
|
631 |
// ----------------------------------------------------------------------------- |
|
632 |
// |
|
633 |
TInt CMmSecurityMessHandler::SecCodeChangeReq( |
|
634 |
TUint8 aTransactionId, |
|
635 |
RMobilePhone::TMobilePhoneSecurityCode* aType, |
|
636 |
RMobilePhone::TMobilePhonePasswordChangeV1* aChange ) // Old&new password |
|
637 |
{ |
|
638 |
TFLOGSTRING3("TSY: CMmSecurityMessHandler::SecCodeChangeReq - traId: %d, type: %d", aTransactionId, *aType); |
|
639 |
OstTraceExt2( TRACE_NORMAL, CMMSECURITYMESSHANDLER_SECCODECHANGEREQ, "CMmSecurityMessHandler::SecCodeChangeReq;aTransactionId=%hhu;aType=%d", aTransactionId, *aType ); |
|
640 |
TFLOGSTRING2("TSY: CMmSecurityMessHandler::SecCodeChangeReq - old password: %S", &(aChange->iOldPassword)); |
|
641 |
OstTraceExt1( TRACE_NORMAL, DUP1_CMMSECURITYMESSHANDLER_SECCODECHANGEREQ, "CMmSecurityMessHandler::SecCodeChangeReq;aChange->iOldPassword=%S", aChange->iOldPassword ); |
|
642 |
TFLOGSTRING2("TSY: CMmSecurityMessHandler::SecCodeChangeReq - new password: %S", &(aChange->iNewPassword)); |
|
643 |
OstTraceExt1( TRACE_NORMAL, DUP2_CMMSECURITYMESSHANDLER_SECCODECHANGEREQ, "CMmSecurityMessHandler::SecCodeChangeReq;aChange->iNewPassword=%S", aChange->iNewPassword ); |
|
644 |
||
645 |
TInt ret( KErrNone ); |
|
646 |
||
647 |
if ( RMobilePhone::ESecurityCodePin1 == *aType || |
|
648 |
RMobilePhone::ESecurityCodePin2 == *aType || |
|
649 |
RMobilePhone::ESecurityUniversalPin == *aType ) |
|
650 |
{ |
|
651 |
ret = UiccPinReqChange( |
|
652 |
*aType, |
|
653 |
aChange->iOldPassword, |
|
654 |
aChange->iNewPassword ); |
|
655 |
} |
|
656 |
else |
|
657 |
{ |
|
658 |
ret = KErrNotSupported; |
|
659 |
} |
|
660 |
return ret; |
|
661 |
} |
|
662 |
||
663 |
// ----------------------------------------------------------------------------- |
|
664 |
// CMmSecurityMessHandler::UiccReq |
|
665 |
// Builds UICC_REQ ISI message and sends it via phonet |
|
666 |
// ----------------------------------------------------------------------------- |
|
667 |
// |
|
668 |
TInt CMmSecurityMessHandler::UiccReq() const |
|
669 |
{ |
|
670 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::UiccReq"); |
|
671 |
OstTrace0( TRACE_NORMAL, CMMSECURITYMESSHANDLER_UICCREQ, "CMmSecurityMessHandler::UiccReq" ); |
|
672 |
||
673 |
// Create UICC_REQ message for querying card status |
|
674 |
TIsiSend isiMsg( iPhoNetSender->SendBufferDes() ); |
|
675 |
isiMsg.Set8bit( ISI_HEADER_OFFSET_RESOURCEID, PN_UICC ); |
|
676 |
isiMsg.Set8bit( ISI_HEADER_OFFSET_TRANSID, KSecurityTransId ); |
|
677 |
isiMsg.Set8bit( ISI_HEADER_OFFSET_MESSAGEID, UICC_REQ ); |
|
678 |
isiMsg.Set8bit( ISI_HEADER_SIZE + UICC_REQ_OFFSET_SERVICETYPE, |
|
679 |
UICC_STATUS_GET ); |
|
680 |
||
681 |
return iPhoNetSender->Send( isiMsg.Complete() ); |
|
682 |
} |
|
683 |
||
684 |
// ----------------------------------------------------------------------------- |
|
685 |
// CMmSecurityMessHandler::UiccResp |
|
686 |
// Breaks UICC_RESP ISI-message and completes "notify SIM ready" |
|
687 |
// to CommonTSY. |
|
688 |
// ----------------------------------------------------------------------------- |
|
689 |
// |
|
690 |
void CMmSecurityMessHandler::UiccResp( const TIsiReceiveC& aIsiMessage ) |
|
691 |
{ |
|
692 |
// Get service type |
|
693 |
TUint8 serviceType( aIsiMessage.Get8bit( |
|
694 |
ISI_HEADER_SIZE + UICC_RESP_OFFSET_SERVICETYPE ) ); |
|
695 |
||
696 |
// Get status |
|
697 |
TUint8 status( aIsiMessage.Get8bit( |
|
698 |
ISI_HEADER_SIZE + UICC_RESP_OFFSET_STATUS ) ); |
|
699 |
||
700 |
TFLOGSTRING3("TSY: CMmSecurityMessHandler::UiccResp, service type: %d, status: %d", serviceType, status ); |
|
701 |
OstTraceExt2( TRACE_NORMAL, CMMSECURITYMESSHANDLER_UICCRESP, "CMmSecurityMessHandler::UiccResp;serviceType=%d;status=%d", serviceType, status ); |
|
702 |
||
703 |
if ( UICC_STATUS_GET == serviceType && UICC_STATUS_OK == status ) |
|
704 |
{ |
|
705 |
if ( !iBootState.iSIMReady ) |
|
706 |
{ |
|
707 |
// Set UICC as ready so that initialization can start |
|
708 |
iBootState.iSIMReady = ETrue; |
|
709 |
||
710 |
// let's cache service table and CPHS information table |
|
711 |
iMmUiccMessHandler->InitializeSimServiceTableCache(); |
|
712 |
iMmUiccMessHandler->InitializeCphsInformationCache(); |
|
713 |
} |
|
714 |
} |
|
715 |
} |
|
716 |
||
717 |
// ----------------------------------------------------------------------------- |
|
718 |
// CMmSecurityMessHandler::UiccInd |
|
719 |
// Breaks UICC_IND ISI-message and completes "notify SIM ready" |
|
720 |
// to CommonTSY. |
|
721 |
// ----------------------------------------------------------------------------- |
|
722 |
// |
|
723 |
void CMmSecurityMessHandler::UiccInd( const TIsiReceiveC& aIsiMessage ) |
|
724 |
{ |
|
725 |
// Get service type |
|
726 |
TUint8 serviceType( aIsiMessage.Get8bit( |
|
727 |
ISI_HEADER_SIZE + UICC_IND_OFFSET_SERVICETYPE ) ); |
|
728 |
||
729 |
TFLOGSTRING2("TSY: CMmCustomMessHandler::UiccInd, service type: %d", serviceType ); |
|
730 |
OstTraceExt1( TRACE_NORMAL, CMMSECURITYMESSHANDLER_UICCIND, "CMmSecurityMessHandler::UiccInd;serviceType=%hhu", serviceType ); |
|
731 |
||
732 |
if ( UICC_START_UP_COMPLETE == serviceType ) |
|
733 |
{ |
|
734 |
// Set UICC state to ready |
|
735 |
iBootState.iSIMReady = ETrue; |
|
736 |
||
737 |
// let's cache service table and CPHS information table |
|
738 |
iMmUiccMessHandler->InitializeSimServiceTableCache(); |
|
739 |
iMmUiccMessHandler->InitializeCphsInformationCache(); |
|
740 |
} |
|
741 |
} |
|
742 |
||
743 |
// ----------------------------------------------------------------------------- |
|
744 |
// CMmSecurityMessHandler::UiccCardInd |
|
745 |
// Breaks UICC_CARD_IND ISI-message |
|
746 |
// ----------------------------------------------------------------------------- |
|
747 |
// |
|
748 |
void CMmSecurityMessHandler::UiccCardInd( const TIsiReceiveC& aIsiMessage ) |
|
749 |
{ |
|
750 |
// Get service type |
|
751 |
TUint8 serviceType( aIsiMessage.Get8bit( |
|
752 |
ISI_HEADER_SIZE + UICC_CARD_IND_OFFSET_SERVICETYPE ) ); |
|
753 |
||
754 |
TFLOGSTRING2("TSY: CMmCustomMessHandler::UiccCardInd, service type: %d", serviceType ); |
|
755 |
OstTraceExt1( TRACE_NORMAL, CMMSECURITYMESSHANDLER_UICCCARDIND, "CMmSecurityMessHandler::UiccCardInd;serviceType=%hhu", serviceType ); |
|
756 |
||
757 |
if ( UICC_CARD_REMOVED == serviceType ) |
|
758 |
{ |
|
759 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::UiccCardInd - SIM Removed!"); |
|
760 |
OstTrace0( TRACE_NORMAL, DUP1_CMMSECURITYMESSHANDLER_UICCCARDIND, "CMmSecurityMessHandler::UiccCardInd - SIM Removed!" ); |
|
761 |
// Change old boot state from TSY to not ready |
|
762 |
iBootState.iSecReady = EFalse; |
|
763 |
iBootState.iPinRequired = EFalse; |
|
764 |
iBootState.iPinVerified = EFalse; |
|
765 |
} |
|
766 |
} |
|
767 |
#ifdef INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING |
|
768 |
// ----------------------------------------------------------------------------- |
|
769 |
// CMmSecurityMessHandler::MtcStateInfoIndL |
|
770 |
// Breaks a SIM_IND MTC_STATE_INFO_IND-message ISI-message and completes |
|
771 |
// EMmTsyBootNotifyModemStatusReadyIPC to client |
|
772 |
// ----------------------------------------------------------------------------- |
|
773 |
// |
|
774 |
void CMmSecurityMessHandler::MtcStateInfoIndL( |
|
775 |
const TIsiReceiveC& aIsiMessage ) |
|
776 |
{ |
|
777 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::MtcStateInfoIndL"); |
|
778 |
OstTrace0( TRACE_NORMAL, CMMSECURITYMESSHANDLER_MTCSTATEINFOINDL, "CMmSecurityMessHandler::MtcStateInfoIndL" ); |
|
779 |
||
780 |
TUint8 state( aIsiMessage.Get8bit( ISI_HEADER_SIZE + MTC_STATE_INFO_IND_OFFSET_STATE ) ); |
|
781 |
TUint8 action( aIsiMessage.Get8bit( ISI_HEADER_SIZE + MTC_STATE_INFO_IND_OFFSET_ACTION ) ); |
|
782 |
||
783 |
TFLOGSTRING3("TSY: CMmSecurityMessHandler::MtcStateInfoIndL action: 0x%02x, state: 0x%02x", action, state); |
|
784 |
OstTraceExt2( TRACE_NORMAL, DUP1_CMMSECURITYMESSHANDLER_MTCSTATEINFOINDL, "CMmSecurityMessHandler::MtcStateInfoIndL;action=%hhx;state=%hhx", action, state ); |
|
785 |
||
786 |
//1. CMT_STATE_READY _AND_ CURRENT_STATE_NEW |
|
787 |
if ( ( MTC_NOS_READY == action || MTC_READY == action ) && |
|
788 |
iBootState.iMtcCurrentState != state ) |
|
789 |
{ |
|
790 |
iBootState.iMtcCurrentState = state; |
|
791 |
||
792 |
TFLOGSTRING("NTSY: CMmSecurityMessHandler::MtcStateInfoIndL - CMT state transition occurred"); |
|
793 |
OstTrace0( TRACE_NORMAL, DUP2_CMMSECURITYMESSHANDLER_MTCSTATEINFOINDL, "CMmSecurityMessHandler::MtcStateInfoIndL, CMT state transition occurred" ); |
|
794 |
if ( MTC_NORMAL == state ) |
|
795 |
{ |
|
796 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::MtcStateInfoIndL - MTC_NORMAL"); |
|
797 |
OstTrace0( TRACE_NORMAL, DUP3_CMMSECURITYMESSHANDLER_MTCSTATEINFOINDL, "CMmSecurityMessHandler::MtcStateInfoIndL, MTC_NORMAL" ); |
|
798 |
iMessageRouter->Complete( EMmTsyBootNotifyModemStatusReadyIPC, |
|
799 |
KErrNone ); |
|
800 |
} |
|
801 |
//no else |
|
802 |
||
803 |
//to complete EMmTsyBootGetRFStatusIPC |
|
804 |
MtcRfStatusQueryReq( KSecurityTransId ); |
|
805 |
||
806 |
if ( MTC_NORMAL == state || MTC_RF_INACTIVE == state ) |
|
807 |
{ |
|
808 |
//Dataport opening must be delayed to here instead of |
|
809 |
//CallMessHandler::ConstructL() to make sure CommonTSY is ready. |
|
810 |
//Either dataport should not be opened before CSD server |
|
811 |
//is started (not started in MTC_ALARM or MTC_CHARGING states). |
|
812 |
iCallMessHandler->InitializeDataportL(); |
|
813 |
} |
|
814 |
//no else |
|
815 |
} |
|
816 |
//2. CMT_STATE_READY ( _AND_ CURRENT_STATE_OLD ) |
|
817 |
else if( ( MTC_NOS_READY == action || MTC_READY == action ) ) |
|
818 |
{ |
|
819 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::MtcStateInfoIndL - CMT state already active"); |
|
820 |
OstTrace0( TRACE_NORMAL, DUP4_CMMSECURITYMESSHANDLER_MTCSTATEINFOINDL, "CMmSecurityMessHandler::MtcStateInfoIndL, CMT state already active" ); |
|
821 |
} |
|
822 |
//no else //3. CMT_STATE_NOT_READY - no action done in between state transition |
|
823 |
} |
|
824 |
||
825 |
// ----------------------------------------------------------------------------- |
|
826 |
// CMmSecurityMessHandler::MtcRfStatusQueryReq |
|
827 |
// Creates MTC_RF_STATUS_QUERY_REQ-message ISI-message and sends it via |
|
828 |
// phonet |
|
829 |
// ----------------------------------------------------------------------------- |
|
830 |
// |
|
831 |
TInt CMmSecurityMessHandler::MtcRfStatusQueryReq( |
|
832 |
TUint8 aTransactionId ) const |
|
833 |
{ |
|
834 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::MtcRfStatusQueryReq"); |
|
835 |
OstTrace0( TRACE_NORMAL, CMMSECURITYMESSHANDLER_MTCRFSTATUSQUERYREQ, "CMmSecurityMessHandler::MtcRfStatusQueryReq" ); |
|
836 |
||
837 |
TBuf8<2> fillerData; |
|
838 |
fillerData.AppendFill( KSecPadding, 2 ); // Padding bytes |
|
839 |
||
840 |
TInt ret = iPhoNetSender->Send( PN_MTC, |
|
841 |
aTransactionId, |
|
842 |
MTC_RF_STATUS_QUERY_REQ, fillerData ); |
|
843 |
return ret; |
|
844 |
} |
|
845 |
||
846 |
// ----------------------------------------------------------------------------- |
|
847 |
// CMmSecurityMessHandler::MtcRfStatusQueryResp |
|
848 |
// Breaks a MTC_RF_STATUS_QUERY_RESP-message ISI-message and completes |
|
849 |
// to client |
|
850 |
// ----------------------------------------------------------------------------- |
|
851 |
// |
|
852 |
void CMmSecurityMessHandler::MtcRfStatusQueryResp( |
|
853 |
const TIsiReceiveC& aIsiMessage ) const |
|
854 |
{ |
|
855 |
TFLOGSTRING("NTSY: CMmSecurityMessHandler::MtcRfStatusQueryResp" ); |
|
856 |
OstTrace0( TRACE_NORMAL, CMMSECURITYMESSHANDLER_MTCRFSTATUSQUERYRESP, "CMmSecurityMessHandler::MtcRfStatusQueryResp" ); |
|
857 |
||
858 |
TUint8 currentRfState = aIsiMessage.Get8bit( ISI_HEADER_SIZE + |
|
859 |
MTC_RF_STATUS_QUERY_RESP_OFFSET_CURRENT ); |
|
860 |
||
861 |
//Defaults to RF ON |
|
862 |
TRfStateInfo statusInfo ( ERfsStateInfoNormal ); |
|
863 |
||
864 |
//RF IS OFF ( this state is not updated when MTC_NORMAL ) |
|
865 |
if( MTC_RF_OFF == currentRfState ) |
|
866 |
{ |
|
867 |
TFLOGSTRING("NTSY: CMmSecurityMessHandler::MtcRfStatusQueryResp - RF OFF" ); |
|
868 |
OstTrace0( TRACE_NORMAL, DUP1_CMMSECURITYMESSHANDLER_MTCRFSTATUSQUERYRESP, "CMmSecurityMessHandler::MtcRfStatusQueryResp, RF OFF" ); |
|
869 |
statusInfo = ERfsStateInfoInactive; |
|
870 |
} |
|
871 |
TFLOGSTRING2("TSY: OFFLINE MODE IS: %d", statusInfo ); |
|
872 |
OstTrace1( TRACE_NORMAL, DUP4_CMMSECURITYMESSHANDLER_MTCRFSTATUSQUERYRESP, "CMmSecurityMessHandler::MtcRfStatusQueryResp;statusInfo=%d", statusInfo ); |
|
873 |
||
874 |
CMmDataPackage dataPackage; |
|
875 |
dataPackage.PackData ( &statusInfo ); |
|
876 |
||
877 |
//inform the upper layer about the new status of the rf |
|
878 |
iMessageRouter->Complete( EMmTsyBootGetRFStatusIPC, &dataPackage, KErrNone ); |
|
879 |
} |
|
880 |
||
881 |
// ----------------------------------------------------------------------------- |
|
882 |
// CMmSecurityMessHandler::MtcStateQueryReq |
|
883 |
// Creates a MTC_STATE_QUERY_REQ-message ISI-message and sends it via |
|
884 |
// phonet |
|
885 |
// ----------------------------------------------------------------------------- |
|
886 |
// |
|
887 |
TInt CMmSecurityMessHandler::MtcStateQueryReq( |
|
888 |
TUint8 aTransactionId |
|
889 |
) const |
|
890 |
{ |
|
891 |
||
892 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::MtcStateQueryReq called" ); |
|
893 |
OstTrace0( TRACE_NORMAL, CMMSECURITYMESSHANDLER_MTCSTATEQUERYREQ, "CMmSecurityMessHandler::MtcStateQueryReq" ); |
|
894 |
||
895 |
TBuf8<2> fillerData; |
|
896 |
fillerData.AppendFill( KSecPadding, 2 ); // Padding bytes |
|
897 |
||
898 |
TInt ret = iPhoNetSender->Send( PN_MTC, aTransactionId, MTC_STATE_QUERY_REQ, fillerData ); |
|
899 |
return ret; |
|
900 |
} |
|
901 |
||
902 |
// ----------------------------------------------------------------------------- |
|
903 |
// CMmSecurityMessHandler::MtcStateQueryRespL |
|
904 |
// Breaks a SIM_IND MTC_STATE_QUERY_RESP-message ISI-message and completes |
|
905 |
// EMmTsyBootNotifyModemStatusReadyIPC to client. If the CMT is not ready with |
|
906 |
// its transition, renews MTC_STATE_QUERY_REQ |
|
907 |
// ----------------------------------------------------------------------------- |
|
908 |
// |
|
909 |
void CMmSecurityMessHandler::MtcStateQueryRespL( |
|
910 |
const TIsiReceiveC& aIsiMessage ) |
|
911 |
{ |
|
912 |
TFLOGSTRING("NTSY: CMmSecurityMessHandler::MtcStateQueryRespL"); |
|
913 |
OstTrace0( TRACE_NORMAL, CMMSECURITYMESSHANDLER_MTCSTATEQUERYRESPL, "CMmSecurityMessHandler::MtcStateQueryRespL" ); |
|
914 |
||
915 |
TUint8 currentState = aIsiMessage.Get8bit(ISI_HEADER_SIZE + MTC_STATE_QUERY_RESP_OFFSET_CURRENT); |
|
916 |
TUint8 nextState = aIsiMessage.Get8bit(ISI_HEADER_SIZE + MTC_STATE_QUERY_RESP_OFFSET_TARGET); |
|
917 |
||
918 |
TFLOGSTRING3("NTSY: CMmSecurityMessHandler::MtcStateQueryRespL - (current: 0x%02x, next: 0x%02x)",currentState, nextState ); |
|
919 |
OstTraceExt2( TRACE_NORMAL, DUP1_CMMSECURITYMESSHANDLER_MTCSTATEQUERYRESPL, "CMmSecurityMessHandler::MtcStateQueryRespL;currentState=%hhx;nextState=%hhx", currentState, nextState ); |
|
920 |
||
921 |
//CMT side is ready when state transistion is completed (in all normal cases this should be the case) |
|
922 |
||
923 |
//1. CMT_STATE_READY _AND_ CURRENT_STATE_NEW |
|
924 |
if( currentState == nextState && iBootState.iMtcCurrentState != currentState ) |
|
925 |
{ |
|
926 |
TFLOGSTRING("NTSY: CMmSecurityMessHandler::MtcStateQueryRespL - CMT ready." ); |
|
927 |
OstTrace0( TRACE_NORMAL, DUP2_CMMSECURITYMESSHANDLER_MTCSTATEQUERYRESPL, "CMmSecurityMessHandler::MtcStateQueryRespL, CMT ready" ); |
|
928 |
iBootState.iMtcCurrentState = currentState; |
|
929 |
||
930 |
if( MTC_NORMAL == currentState ) |
|
931 |
{ |
|
932 |
TFLOGSTRING("NTSY: CMmSecurityMessHandler::MtcStateQueryRespL - EMmTsyBootNotifyModemStatusReadyIPC"); |
|
933 |
OstTrace0( TRACE_NORMAL, DUP3_CMMSECURITYMESSHANDLER_MTCSTATEQUERYRESPL, "CMmSecurityMessHandler::MtcStateQueryRespL, EMmTsyBootNotifyModemStatusReadyIPC" ); |
|
934 |
iMessageRouter->Complete( EMmTsyBootNotifyModemStatusReadyIPC, KErrNone ); |
|
935 |
} |
|
936 |
//to complete EMmTsyBootGetRFStatusIPC |
|
937 |
MtcRfStatusQueryReq( KSecurityTransId ); |
|
938 |
} |
|
939 |
//2. CMT_STATE_NOT_READY - renew state query, if transition is not yet ready |
|
940 |
else if ( currentState != nextState ) |
|
941 |
{ |
|
942 |
TFLOGSTRING("NTSY: CMmSecurityMessHandler::MtcStateQueryRespL - CMT state transition not ready."); |
|
943 |
OstTrace0( TRACE_NORMAL, DUP4_CMMSECURITYMESSHANDLER_MTCSTATEQUERYRESPL, "CMmSecurityMessHandler::MtcStateQueryRespL, CMT state transition not ready" ); |
|
944 |
MtcStateQueryReq( KSecurityTransId ); |
|
945 |
} |
|
946 |
//no else //3. CMT_STATE_READY _AND_ CURRENT_STATE_OLD - no action needed if state already active |
|
947 |
||
948 |
if ( nextState == currentState && |
|
949 |
( MTC_NORMAL == currentState || MTC_RF_INACTIVE == currentState ) ) |
|
950 |
{ |
|
951 |
//Dataport opening must be delayed to here instead of |
|
952 |
//CallMessHandler::ConstructL() to make sure CommonTSY is ready. |
|
953 |
//Either dataport should not be opened before CSD server |
|
954 |
//is started (not started in MTC_ALARM or MTC_CHARGING states). |
|
955 |
iCallMessHandler->InitializeDataportL(); |
|
956 |
} |
|
957 |
//no else |
|
958 |
} |
|
959 |
#else /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */ |
|
960 |
// ----------------------------------------------------------------------------- |
|
961 |
// CMmSecurityMessHandler::MceModemStateInd |
|
962 |
// Breaks a MCE_MODEM_STATE_IND ISI-message and completes |
|
963 |
// EMmTsyBootNotifyModemStatusReadyIPC to client |
|
964 |
// ----------------------------------------------------------------------------- |
|
965 |
// |
|
966 |
void CMmSecurityMessHandler::MceModemStateInd( const TIsiReceiveC& aIsiMessage ) |
|
967 |
{ |
|
968 |
TUint8 state( aIsiMessage.Get8bit( |
|
969 |
ISI_HEADER_SIZE + MCE_MODEM_STATE_IND_OFFSET_STATE ) ); |
|
970 |
TUint8 action( aIsiMessage.Get8bit( |
|
971 |
ISI_HEADER_SIZE + MCE_MODEM_STATE_IND_OFFSET_ACTION ) ); |
|
972 |
||
973 |
TFLOGSTRING3("TSY: CMmSecurityMessHandler::MceModemStateInd action: 0x%02x, state: 0x%02x", action, state); |
|
974 |
OstTraceExt2( TRACE_NORMAL, DUP1_CMMSECURITYMESSHANDLER_MCEMODEMSTATEIND, "CMmSecurityMessHandler::MceModemStateInd;state=%hhx;action=%hhx", state, action ); |
|
975 |
||
976 |
// Modem is ready and CMT status has been changed |
|
977 |
if ( MCE_READY == action && iBootState.iMceCurrentState != state ) |
|
978 |
{ |
|
979 |
iBootState.iMceCurrentState = state; |
|
980 |
||
981 |
TFLOGSTRING("NTSY: CMmSecurityMessHandler::MceModemStateInd - CMT state transition occurred - MCE_NORMAL"); |
|
982 |
OstTrace0( TRACE_NORMAL, CMMSECURITYMESSHANDLER_MCEMODEMSTATEIND, "CMmSecurityMessHandler::MceModemStateInd - CMT state transition occurred - MCE_NORMAL" ); |
|
983 |
||
984 |
iMessageRouter->Complete( |
|
985 |
EMmTsyBootNotifyModemStatusReadyIPC, |
|
986 |
KErrNone ); |
|
987 |
||
988 |
// Dataport opening must be delayed to here instead of |
|
989 |
// CallMessHandler::ConstructL() to make sure CommonTSY is ready. |
|
990 |
iCallMessHandler->InitializeDataportL(); |
|
991 |
||
992 |
// To complete EMmTsyBootGetRFStatusIPC |
|
993 |
MceRfStateQueryReq(); |
|
994 |
} |
|
995 |
// Modem is ready but CMT status has not been changed |
|
996 |
else if( MCE_READY == action && iBootState.iMceCurrentState == state ) |
|
997 |
{ |
|
998 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::MceModemStateInd - CMT state mot changed"); |
|
999 |
OstTrace0( TRACE_NORMAL, DUP2_CMMSECURITYMESSHANDLER_MCEMODEMSTATEIND, "CMmSecurityMessHandler::MceModemStateInd - CMT state not changed" ); |
|
1000 |
} |
|
1001 |
// No else, modem state not ready - no action needed |
|
1002 |
} |
|
1003 |
||
1004 |
// ----------------------------------------------------------------------------- |
|
1005 |
// CMmSecurityMessHandler::MceRfStateQueryReq |
|
1006 |
// Creates MCE_RF_STATE_QUERY_REQ ISI-message and sends it via phonet |
|
1007 |
// ----------------------------------------------------------------------------- |
|
1008 |
// |
|
1009 |
TInt CMmSecurityMessHandler::MceRfStateQueryReq() const |
|
1010 |
{ |
|
1011 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::MceRfStateQueryReq"); |
|
1012 |
OstTrace0( TRACE_NORMAL, CMMSECURITYMESSHANDLER_MCERFSTATEQUERYREQ, "CMmSecurityMessHandler::MceRfStateQueryReq" ); |
|
1013 |
||
1014 |
// Create MCE_RF_STATE_QUERY_REQ message for querying modem state |
|
1015 |
TIsiSend isiMsg( iPhoNetSender->SendBufferDes() ); |
|
1016 |
isiMsg.Set8bit( ISI_HEADER_OFFSET_RESOURCEID, PN_MODEM_MCE ); |
|
1017 |
isiMsg.Set8bit( ISI_HEADER_OFFSET_TRANSID, KSecurityTransId ); |
|
1018 |
isiMsg.Set8bit( ISI_HEADER_OFFSET_MESSAGEID, MCE_RF_STATE_QUERY_REQ ); |
|
1019 |
isiMsg.Set16bit( |
|
1020 |
ISI_HEADER_SIZE + MCE_RF_STATE_QUERY_REQ_OFFSET_FILLERBYTE1, |
|
1021 |
KSecPadding ); |
|
1022 |
||
1023 |
return iPhoNetSender->Send( isiMsg.Complete() ); |
|
1024 |
} |
|
1025 |
||
1026 |
// ----------------------------------------------------------------------------- |
|
1027 |
// CMmSecurityMessHandler::MceRfStateQueryResp |
|
1028 |
// Breaks a MCE_RF_STATE_QUERY_RESP ISI-message and completes to client |
|
1029 |
// ----------------------------------------------------------------------------- |
|
1030 |
// |
|
1031 |
void CMmSecurityMessHandler::MceRfStateQueryResp( |
|
1032 |
const TIsiReceiveC& aIsiMessage ) const |
|
1033 |
{ |
|
1034 |
TFLOGSTRING("NTSY: CMmSecurityMessHandler::MceRfStateQueryResp" ); |
|
1035 |
OstTrace0( TRACE_NORMAL, CMMSECURITYMESSHANDLER_MCERFSTATEQUERYRESP, "CMmSecurityMessHandler::MceRfStateQueryResp" ); |
|
1036 |
||
1037 |
TUint8 currentRfState( aIsiMessage.Get8bit( |
|
1038 |
ISI_HEADER_SIZE + MCE_RF_STATE_QUERY_RESP_OFFSET_CURRENT ) ); |
|
1039 |
||
1040 |
// Default is RF OFF |
|
1041 |
TRfStateInfo statusInfo( ERfsStateInfoInactive ); |
|
1042 |
||
1043 |
if( MCE_RF_ON == currentRfState ) |
|
1044 |
{ |
|
1045 |
statusInfo = ERfsStateInfoNormal; |
|
1046 |
} |
|
1047 |
||
1048 |
TFLOGSTRING2("NTSY: CMmSecurityMessHandler::MceRfStateQueryResp: RF State is: %d", statusInfo ); |
|
1049 |
OstTrace1( TRACE_NORMAL, DUP1_CMMSECURITYMESSHANDLER_MCERFSTATEQUERYRESP, "CMmSecurityMessHandler::MceRfStateQueryResp;statusInfo=%d", statusInfo ); |
|
1050 |
||
1051 |
CMmDataPackage dataPackage; |
|
1052 |
dataPackage.PackData ( &statusInfo ); |
|
1053 |
// Complete RF state |
|
1054 |
iMessageRouter->Complete( |
|
1055 |
EMmTsyBootGetRFStatusIPC, |
|
1056 |
&dataPackage, |
|
1057 |
KErrNone ); |
|
1058 |
} |
|
1059 |
||
1060 |
// ----------------------------------------------------------------------------- |
|
1061 |
// CMmSecurityMessHandler::MceModemStateQueryReq |
|
1062 |
// Creates a MCE_MODEM_STATE_QUERY_REQ ISI-message and sends it via |
|
1063 |
// phonet |
|
1064 |
// ----------------------------------------------------------------------------- |
|
1065 |
// |
|
1066 |
TInt CMmSecurityMessHandler::MceModemStateQueryReq() const |
|
1067 |
{ |
|
1068 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::MceModemStateQueryReq" ); |
|
1069 |
OstTrace0( TRACE_NORMAL, CMMSECURITYMESSHANDLER_MCEMODEMSTATEQUERYREQ, "CMmSecurityMessHandler::MceModemStateQueryReq" ); |
|
1070 |
||
1071 |
// Create MCE_MODEM_STATE_QUERY_REQ message for querying modem state |
|
1072 |
TIsiSend isiMsg( iPhoNetSender->SendBufferDes() ); |
|
1073 |
isiMsg.Set8bit( ISI_HEADER_OFFSET_RESOURCEID, PN_MODEM_MCE ); |
|
1074 |
isiMsg.Set8bit( ISI_HEADER_OFFSET_TRANSID, KSecurityTransId ); |
|
1075 |
isiMsg.Set8bit( ISI_HEADER_OFFSET_MESSAGEID, MCE_MODEM_STATE_QUERY_REQ ); |
|
1076 |
isiMsg.Set16bit( |
|
1077 |
ISI_HEADER_SIZE + |
|
1078 |
MCE_MODEM_STATE_QUERY_REQ_OFFSET_FILLERBYTE1, KSecPadding ); |
|
1079 |
||
1080 |
return iPhoNetSender->Send( isiMsg.Complete() ); |
|
1081 |
} |
|
1082 |
||
1083 |
// ----------------------------------------------------------------------------- |
|
1084 |
// CMmSecurityMessHandler::MceStateQueryRespL |
|
1085 |
// Breaks a MCE_MODEM_STATE_QUERY_RESP message ISI-message and completes |
|
1086 |
// EMmTsyBootNotifyModemStatusReadyIPC to client. If the CMT is not ready with |
|
1087 |
// its transition, renews MTC_STATE_QUERY_REQ |
|
1088 |
// ----------------------------------------------------------------------------- |
|
1089 |
// |
|
1090 |
void CMmSecurityMessHandler::MceModemStateQueryResp( |
|
1091 |
const TIsiReceiveC& aIsiMessage ) |
|
1092 |
{ |
|
1093 |
TFLOGSTRING("NTSY: CMmSecurityMessHandler::MceModemStateQueryResp"); |
|
1094 |
OstTrace0( TRACE_NORMAL, CMMSECURITYMESSHANDLER_MCEMODEMSTATEQUERYRESP, "CMmSecurityMessHandler::MceModemStateQueryResp" ); |
|
1095 |
||
1096 |
TUint8 currentState( aIsiMessage.Get8bit( |
|
1097 |
ISI_HEADER_SIZE + MCE_MODEM_STATE_QUERY_RESP_OFFSET_CURRENT ) ); |
|
1098 |
TUint8 nextState( aIsiMessage.Get8bit( |
|
1099 |
ISI_HEADER_SIZE + MCE_MODEM_STATE_QUERY_RESP_OFFSET_TARGET ) ); |
|
1100 |
||
1101 |
TFLOGSTRING3("NTSY: CMmSecurityMessHandler::MceModemStateQueryResp - (current: 0x%02x, next: 0x%02x)",currentState, nextState ); |
|
1102 |
OstTraceExt2( TRACE_NORMAL, DUP1_CMMSECURITYMESSHANDLER_MCEMODEMSTATEQUERYRESP, "CMmSecurityMessHandler::MceModemStateQueryResp;currentState=%hhx;nextState=%hhx", currentState, nextState ); |
|
1103 |
||
1104 |
// CMT side is ready when state transistion is completed |
|
1105 |
// (in all normal cases this should be the case) |
|
1106 |
||
1107 |
// Modem is ready and CMT status has been changed |
|
1108 |
if( currentState == nextState && |
|
1109 |
iBootState.iMceCurrentState != currentState ) |
|
1110 |
{ |
|
1111 |
TFLOGSTRING("NTSY: CMmSecurityMessHandler::MceModemStateQueryResp - CMT ready." ); |
|
1112 |
OstTrace0( TRACE_NORMAL, DUP2_CMMSECURITYMESSHANDLER_MCEMODEMSTATEQUERYRESP, "CMmSecurityMessHandler::MceModemStateQueryResp - CMT ready" ); |
|
1113 |
||
1114 |
iBootState.iMceCurrentState = currentState; |
|
1115 |
||
1116 |
if( MCE_NORMAL == currentState ) |
|
1117 |
{ |
|
1118 |
TFLOGSTRING("NTSY: CMmSecurityMessHandler::MceModemStateQueryResp - EMmTsyBootNotifyModemStatusReadyIPC"); |
|
1119 |
OstTrace0( TRACE_NORMAL, DUP3_CMMSECURITYMESSHANDLER_MCEMODEMSTATEQUERYRESP, "CMmSecurityMessHandler::MceModemStateQueryResp- EMmTsyBootNotifyModemStatusReadyIPC" ); |
|
1120 |
iMessageRouter->Complete( |
|
1121 |
EMmTsyBootNotifyModemStatusReadyIPC, |
|
1122 |
KErrNone ); |
|
1123 |
||
1124 |
// Dataport opening must be delayed to here instead of |
|
1125 |
// CallMessHandler::ConstructL() to make sure CommonTSY is ready. |
|
1126 |
iCallMessHandler->InitializeDataportL(); |
|
1127 |
} |
|
1128 |
} |
|
1129 |
// Renew state query, if transition is not yet ready |
|
1130 |
else if ( currentState != nextState ) |
|
1131 |
{ |
|
1132 |
TFLOGSTRING("NTSY: CMmSecurityMessHandler::MceModemStateQueryResp - CMT state transition not ready."); |
|
1133 |
OstTrace0( TRACE_NORMAL, DUP4_CMMSECURITYMESSHANDLER_MCEMODEMSTATEQUERYRESP, "CMmSecurityMessHandler::MceModemStateQueryResp -- CMT state transition not ready" ); |
|
1134 |
MceModemStateQueryReq(); |
|
1135 |
} |
|
1136 |
} |
|
1137 |
#endif /* INTERNAL_TESTING_OLD_IMPLEMENTATION_FOR_UICC_TESTING */ |
|
1138 |
||
1139 |
// ----------------------------------------------------------------------------- |
|
1140 |
// CMmSecurityMessHandler::UiccPinInd |
|
1141 |
// Breaks a UICC_PIN_IND ISI-message. |
|
1142 |
// ----------------------------------------------------------------------------- |
|
1143 |
// |
|
1144 |
void CMmSecurityMessHandler::UiccPinInd( const TIsiReceiveC& aIsiMessage ) |
|
1145 |
{ |
|
1146 |
OstTrace0( TRACE_NORMAL, CMMSECURITYMESSHANDLER_UICCPININD, "CMmSecurityMessHandler::UiccPinInd" ); |
|
1147 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::UiccPinInd"); |
|
1148 |
||
1149 |
// Event to be completed |
|
1150 |
RMobilePhone::TMobilePhoneSecurityEvent event( RMobilePhone::ENoICCFound ); |
|
1151 |
||
1152 |
// Save application ID, needed in UICC_PIN_VERIFY_REQ |
|
1153 |
iApplicationId = aIsiMessage.Get8bit( |
|
1154 |
ISI_HEADER_SIZE + UICC_PIN_IND_OFFSET_APPLID ); |
|
1155 |
||
1156 |
// Get service type |
|
1157 |
TUint8 serviceType( aIsiMessage.Get8bit( |
|
1158 |
ISI_HEADER_SIZE + UICC_PIN_IND_OFFSET_SERVICETYPE ) ); |
|
1159 |
// Get PIN ID |
|
1160 |
// TS 102.221 Table 9.3: PIN mapping into key references |
|
1161 |
// PIN1: '01','02','03','04','05','06','07','08' |
|
1162 |
// PIN2: '81','82','83','84', '85','86','87','88' |
|
1163 |
// UPIN: '11' |
|
1164 |
// PIN ID is needed when verifying PIN/PUK code |
|
1165 |
iPinId = aIsiMessage.Get8bit( |
|
1166 |
ISI_HEADER_SIZE + UICC_PIN_IND_OFFSET_PINID ); |
|
1167 |
||
1168 |
if ( UICC_PIN_VERIFY_NEEDED == serviceType ) |
|
1169 |
{ |
|
1170 |
// PIN1 |
|
1171 |
if ( 0x01 <= iPinId && 0x08 >= iPinId ) |
|
1172 |
{ |
|
1173 |
event = RMobilePhone::EPin1Required; |
|
1174 |
} |
|
1175 |
// PIN2 |
|
1176 |
else if ( 0x81 <= iPinId && 0x88 >= iPinId ) |
|
1177 |
{ |
|
1178 |
event = RMobilePhone::EPin2Required; |
|
1179 |
} |
|
1180 |
// UPIN |
|
1181 |
else if ( 0x11 == iPinId ) |
|
1182 |
{ |
|
1183 |
event = RMobilePhone::EUniversalPinRequired; |
|
1184 |
} |
|
1185 |
// No else |
|
1186 |
} |
|
1187 |
else if ( UICC_PIN_UNBLOCK_NEEDED == serviceType ) |
|
1188 |
{ |
|
1189 |
// PIN1 |
|
1190 |
if ( 0x01 <= iPinId && 0x08 >= iPinId ) |
|
1191 |
{ |
|
1192 |
event = RMobilePhone::EPuk1Required; |
|
1193 |
iPukCodeRequired = ETrue; |
|
1194 |
} |
|
1195 |
// PIN2 |
|
1196 |
else if ( 0x81 <= iPinId && 0x88 >= iPinId ) |
|
1197 |
{ |
|
1198 |
event = RMobilePhone::EPuk2Required; |
|
1199 |
} |
|
1200 |
// UPIN |
|
1201 |
else if ( 0x11 == iPinId ) |
|
1202 |
{ |
|
1203 |
event = RMobilePhone::EUniversalPukRequired; |
|
1204 |
} |
|
1205 |
// No else |
|
1206 |
} |
|
1207 |
// Complete notify security event |
|
1208 |
CMmDataPackage dataPackage; |
|
1209 |
dataPackage.PackData( &event ); |
|
1210 |
iMessageRouter->Complete( |
|
1211 |
EMobilePhoneNotifySecurityEvent, |
|
1212 |
&dataPackage, |
|
1213 |
KErrNone ); |
|
1214 |
} |
|
1215 |
||
1216 |
// ----------------------------------------------------------------------------- |
|
1217 |
// CMmSecurityMessHandler::UiccPinReqVerify |
|
1218 |
// Creates and sends UICC_PIN_REQ ISI message. |
|
1219 |
// ----------------------------------------------------------------------------- |
|
1220 |
// |
|
1221 |
TInt CMmSecurityMessHandler::UiccPinReqVerify( |
|
1222 |
const TUint8 aServiceType, |
|
1223 |
const RMobilePhone::TMobilePassword& aCode, |
|
1224 |
const RMobilePhone::TMobilePassword& aUnblockCode ) |
|
1225 |
{ |
|
1226 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::UiccPinReqVerify"); |
|
1227 |
OstTrace0( TRACE_NORMAL, CMMSECURITYMESSHANDLER_UICCPINREQ, "CMmSecurityMessHandler::UiccPinReqVerify" ); |
|
1228 |
||
1229 |
TUint8 numOfSubblocks( 1 ); // in case of PIN verify |
|
1230 |
TUint8 pinQualifier( UICC_PIN_OLD ); // in case of PIN verify |
|
1231 |
TUint messageOffset( ISI_HEADER_SIZE + SIZE_UICC_PIN_REQ ); |
|
1232 |
||
1233 |
if ( UICC_PIN_UNBLOCK == aServiceType ) |
|
1234 |
{ |
|
1235 |
numOfSubblocks = 2; |
|
1236 |
pinQualifier = UICC_PIN_NEW; |
|
1237 |
} |
|
1238 |
||
1239 |
// Create UICC_REQ message for querying card status |
|
1240 |
TIsiSend isiMsg( iPhoNetSender->SendBufferDes() ); |
|
1241 |
isiMsg.Set8bit( ISI_HEADER_OFFSET_RESOURCEID, PN_UICC ); |
|
1242 |
isiMsg.Set8bit( ISI_HEADER_OFFSET_TRANSID, KSecurityTransId ); |
|
1243 |
isiMsg.Set8bit( ISI_HEADER_OFFSET_MESSAGEID, UICC_PIN_REQ ); |
|
1244 |
isiMsg.Set8bit( |
|
1245 |
ISI_HEADER_SIZE + UICC_PIN_REQ_OFFSET_SERVICETYPE, |
|
1246 |
aServiceType ); |
|
1247 |
isiMsg.Set8bit( |
|
1248 |
ISI_HEADER_SIZE + UICC_PIN_REQ_OFFSET_APPLID, |
|
1249 |
iApplicationId ); |
|
1250 |
// 3x filler |
|
1251 |
isiMsg.Set8bit( |
|
1252 |
ISI_HEADER_SIZE + UICC_PIN_REQ_OFFSET_FILLERBYTE1, |
|
1253 |
KSecPadding ); |
|
1254 |
isiMsg.Set8bit( |
|
1255 |
ISI_HEADER_SIZE + UICC_PIN_REQ_OFFSET_FILLERBYTE1 + 1, |
|
1256 |
KSecPadding ); |
|
1257 |
isiMsg.Set8bit( |
|
1258 |
ISI_HEADER_SIZE + UICC_PIN_REQ_OFFSET_FILLERBYTE1 + 2, |
|
1259 |
KSecPadding ); |
|
1260 |
isiMsg.Set8bit( |
|
1261 |
ISI_HEADER_SIZE + UICC_PIN_REQ_OFFSET_NSB, |
|
1262 |
numOfSubblocks ); |
|
1263 |
||
1264 |
// In case unblocking request, create UICC_SB_PUK |
|
1265 |
if ( UICC_PIN_UNBLOCK == aServiceType ) |
|
1266 |
{ |
|
1267 |
TBuf8<KMaxSizeUiccSbPuk> uiccSbPukBuf( 0 ); |
|
1268 |
TIsiSubBlock uiccSbPuk( |
|
1269 |
uiccSbPukBuf, |
|
1270 |
UICC_SB_PUK, |
|
1271 |
EIsiSubBlockTypeId16Len16 ); |
|
1272 |
||
1273 |
uiccSbPukBuf.Append( iPinId ); // PIN ID |
|
1274 |
uiccSbPukBuf.Append( aUnblockCode.Length() ); // Length of PUK code |
|
1275 |
uiccSbPukBuf.Append( aUnblockCode ); // PUK code |
|
1276 |
||
1277 |
// Append subblock to ISI message |
|
1278 |
isiMsg.CopyData( |
|
1279 |
messageOffset, |
|
1280 |
uiccSbPuk.CompleteSubBlock() ); |
|
1281 |
||
1282 |
messageOffset += uiccSbPukBuf.Length(); |
|
1283 |
} |
|
1284 |
||
1285 |
// Create succlock UICC_SB_PIN |
|
1286 |
TBuf8<KMaxSizeUiccSbPin> uiccSbPinBuf( 0 ); |
|
1287 |
TIsiSubBlock uiccSbPin( |
|
1288 |
uiccSbPinBuf, |
|
1289 |
UICC_SB_PIN, |
|
1290 |
EIsiSubBlockTypeId16Len16 ); |
|
1291 |
||
1292 |
// PIN ID |
|
1293 |
uiccSbPinBuf.Append( iPinId ); |
|
1294 |
uiccSbPinBuf.Append( pinQualifier ); // PIN qualifier |
|
1295 |
uiccSbPinBuf.Append( aCode.Length() ); // Length of PIN code |
|
1296 |
uiccSbPinBuf.Append( aCode ); // PIN code |
|
1297 |
||
1298 |
// Append subblock to ISI message |
|
1299 |
isiMsg.CopyData( |
|
1300 |
messageOffset, |
|
1301 |
uiccSbPin.CompleteSubBlock() ); |
|
1302 |
||
1303 |
return iPhoNetSender->Send( isiMsg.Complete() ); |
|
1304 |
} |
|
1305 |
||
1306 |
// ----------------------------------------------------------------------------- |
|
1307 |
// CMmSecurityMessHandler::UiccPinResp |
|
1308 |
// Breaks a UICC_PIN_IND ISI-message. |
|
1309 |
// ----------------------------------------------------------------------------- |
|
1310 |
// |
|
1311 |
void CMmSecurityMessHandler::UiccPinResp( const TIsiReceiveC& aIsiMessage ) |
|
1312 |
{ |
|
1313 |
OstTrace0( TRACE_NORMAL, CMMSECURITYMESSHANDLER_UICCPINRESP, "CMmSecurityMessHandler::UiccPinResp" ); |
|
1314 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::UiccPinResp"); |
|
1315 |
||
1316 |
// Get service type and status |
|
1317 |
TUint8 serviceType( aIsiMessage.Get8bit( |
|
1318 |
ISI_HEADER_SIZE + UICC_PIN_RESP_OFFSET_SERVICETYPE ) ); |
|
1319 |
TUint8 status( aIsiMessage.Get8bit( |
|
1320 |
ISI_HEADER_SIZE + UICC_PIN_RESP_OFFSET_STATUS ) ); |
|
1321 |
||
1322 |
switch( serviceType ) |
|
1323 |
{ |
|
1324 |
case UICC_PIN_VERIFY: |
|
1325 |
case UICC_PIN_UNBLOCK: |
|
1326 |
{ |
|
1327 |
HandleUiccPinVerifyResp( status, aIsiMessage ); |
|
1328 |
break; |
|
1329 |
} |
|
1330 |
case UICC_PIN_INFO: |
|
1331 |
{ |
|
1332 |
HandleUiccPinInfoResp( status, aIsiMessage ); |
|
1333 |
break; |
|
1334 |
} |
|
1335 |
case UICC_PIN_CHANGE: |
|
1336 |
{ |
|
1337 |
HandleUiccPinChangeResp( status, aIsiMessage ); |
|
1338 |
break; |
|
1339 |
} |
|
1340 |
case UICC_PIN_ENABLE: |
|
1341 |
case UICC_PIN_DISABLE: |
|
1342 |
case UICC_PIN_SUBSTITUTE: |
|
1343 |
{ |
|
1344 |
HandleUiccPinStateChangeResp( status, aIsiMessage ); |
|
1345 |
break; |
|
1346 |
} |
|
1347 |
default: |
|
1348 |
{ |
|
1349 |
break; |
|
1350 |
} |
|
1351 |
} |
|
1352 |
} |
|
1353 |
||
1354 |
// ----------------------------------------------------------------------------- |
|
1355 |
// CMmSecurityMessHandler::UiccPinReqStateQuery |
|
1356 |
// Creates and sends UICC_PIN_REQ ISI message. |
|
1357 |
// ----------------------------------------------------------------------------- |
|
1358 |
// |
|
1359 |
TInt CMmSecurityMessHandler::UiccPinReqStateQuery( |
|
1360 |
const RMobilePhone::TMobilePhoneLock aLock ) |
|
1361 |
{ |
|
1362 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::UiccPinReqStateQuery"); |
|
1363 |
OstTrace0( TRACE_NORMAL, CMMSECURITYMESSHANDLER_UICCPINREQSTATEQUERY, "CMmSecurityMessHandler::UiccPinReqStateQuery" ); |
|
1364 |
||
1365 |
TUint8 pinId( 0 ); |
|
1366 |
||
1367 |
if ( RMobilePhone::ELockICC == aLock ) |
|
1368 |
{ |
|
1369 |
pinId = iMmUiccMessHandler->GetPin1KeyReference(); |
|
1370 |
} |
|
1371 |
else if ( RMobilePhone::ELockPin2 == aLock ) |
|
1372 |
{ |
|
1373 |
pinId = iMmUiccMessHandler->GetPin2KeyReference(); |
|
1374 |
} |
|
1375 |
else |
|
1376 |
{ |
|
1377 |
pinId = 0x11; // UPIN |
|
1378 |
} |
|
1379 |
// Create UICC_REQ message for querying card status |
|
1380 |
TIsiSend isiMsg( iPhoNetSender->SendBufferDes() ); |
|
1381 |
isiMsg.Set8bit( ISI_HEADER_OFFSET_RESOURCEID, PN_UICC ); |
|
1382 |
isiMsg.Set8bit( ISI_HEADER_OFFSET_TRANSID, KSecurityTransId ); |
|
1383 |
isiMsg.Set8bit( ISI_HEADER_OFFSET_MESSAGEID, UICC_PIN_REQ ); |
|
1384 |
isiMsg.Set8bit( |
|
1385 |
ISI_HEADER_SIZE + UICC_PIN_REQ_OFFSET_SERVICETYPE, |
|
1386 |
UICC_PIN_INFO ); |
|
1387 |
isiMsg.Set8bit( |
|
1388 |
ISI_HEADER_SIZE + UICC_PIN_REQ_OFFSET_APPLID, |
|
1389 |
iApplicationId ); |
|
1390 |
// 3x filler |
|
1391 |
isiMsg.Set8bit( |
|
1392 |
ISI_HEADER_SIZE + UICC_PIN_REQ_OFFSET_FILLERBYTE1, |
|
1393 |
KSecPadding ); |
|
1394 |
isiMsg.Set8bit( |
|
1395 |
ISI_HEADER_SIZE + UICC_PIN_REQ_OFFSET_FILLERBYTE1 + 1, |
|
1396 |
KSecPadding ); |
|
1397 |
isiMsg.Set8bit( |
|
1398 |
ISI_HEADER_SIZE + UICC_PIN_REQ_OFFSET_FILLERBYTE1 + 2, |
|
1399 |
KSecPadding ); |
|
1400 |
isiMsg.Set8bit( |
|
1401 |
ISI_HEADER_SIZE + UICC_PIN_REQ_OFFSET_NSB, |
|
1402 |
1 ); // One subblock, UICC_SB_PIN_REF |
|
1403 |
||
1404 |
// Create succlock UICC_SB_PIN_REF |
|
1405 |
TBuf8<KMaxSizeUiccSbPin> uiccSbPinRefBuf( 0 ); |
|
1406 |
TIsiSubBlock uiccSbPinRef( |
|
1407 |
uiccSbPinRefBuf, |
|
1408 |
UICC_SB_PIN_REF, |
|
1409 |
EIsiSubBlockTypeId16Len16 ); |
|
1410 |
||
1411 |
// PIN ID |
|
1412 |
uiccSbPinRefBuf.Append( pinId ); |
|
1413 |
uiccSbPinRefBuf.Append( KSecPadding ); // PIN qualifier |
|
1414 |
uiccSbPinRefBuf.Append( KSecPadding ); // Length of PIN code |
|
1415 |
uiccSbPinRefBuf.Append( KSecPadding ); // PIN code |
|
1416 |
||
1417 |
// Append subblock to ISI message |
|
1418 |
isiMsg.CopyData( |
|
1419 |
ISI_HEADER_SIZE + SIZE_UICC_PIN_REQ, |
|
1420 |
uiccSbPinRef.CompleteSubBlock() ); |
|
1421 |
||
1422 |
return iPhoNetSender->Send( isiMsg.Complete() ); |
|
1423 |
} |
|
1424 |
||
1425 |
// ----------------------------------------------------------------------------- |
|
1426 |
// CMmSecurityMessHandler::UiccPinReqChange |
|
1427 |
// Creates and sends UICC_PIN_REQ ISI message. |
|
1428 |
// ----------------------------------------------------------------------------- |
|
1429 |
// |
|
1430 |
TInt CMmSecurityMessHandler::UiccPinReqChange( |
|
1431 |
RMobilePhone::TMobilePhoneSecurityCode& aType, |
|
1432 |
const RMobilePhone::TMobilePassword& aOldCode, |
|
1433 |
const RMobilePhone::TMobilePassword& aNewCode ) |
|
1434 |
{ |
|
1435 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::UiccPinReqChange"); |
|
1436 |
OstTrace0( TRACE_NORMAL, CMMSECURITYMESSHANDLER_UICCPINREQCHANGE, "CMmSecurityMessHandler::UiccPinReqChange" ); |
|
1437 |
||
1438 |
TUint8 pinId( 0 ); |
|
1439 |
if ( RMobilePhone::ESecurityCodePin1 == aType ) |
|
1440 |
{ |
|
1441 |
pinId = iMmUiccMessHandler->GetPin1KeyReference(); |
|
1442 |
} |
|
1443 |
else if ( RMobilePhone::ESecurityCodePin2 == aType ) |
|
1444 |
{ |
|
1445 |
pinId = iMmUiccMessHandler->GetPin2KeyReference(); |
|
1446 |
} |
|
1447 |
else |
|
1448 |
{ |
|
1449 |
pinId = KUniversalPinKeyReference; |
|
1450 |
} |
|
1451 |
||
1452 |
// Create UICC_REQ message for changing PIN code |
|
1453 |
TIsiSend isiMsg( iPhoNetSender->SendBufferDes() ); |
|
1454 |
isiMsg.Set8bit( ISI_HEADER_OFFSET_RESOURCEID, PN_UICC ); |
|
1455 |
isiMsg.Set8bit( ISI_HEADER_OFFSET_TRANSID, KSecurityTransId ); |
|
1456 |
isiMsg.Set8bit( ISI_HEADER_OFFSET_MESSAGEID, UICC_PIN_REQ ); |
|
1457 |
isiMsg.Set8bit( |
|
1458 |
ISI_HEADER_SIZE + UICC_PIN_REQ_OFFSET_SERVICETYPE, |
|
1459 |
UICC_PIN_CHANGE ); |
|
1460 |
isiMsg.Set8bit( |
|
1461 |
ISI_HEADER_SIZE + UICC_PIN_REQ_OFFSET_APPLID, |
|
1462 |
iApplicationId ); |
|
1463 |
// 3x filler |
|
1464 |
isiMsg.Set8bit( |
|
1465 |
ISI_HEADER_SIZE + UICC_PIN_REQ_OFFSET_FILLERBYTE1, |
|
1466 |
KSecPadding ); |
|
1467 |
isiMsg.Set8bit( |
|
1468 |
ISI_HEADER_SIZE + UICC_PIN_REQ_OFFSET_FILLERBYTE1 + 1, |
|
1469 |
KSecPadding ); |
|
1470 |
isiMsg.Set8bit( |
|
1471 |
ISI_HEADER_SIZE + UICC_PIN_REQ_OFFSET_FILLERBYTE1 + 2, |
|
1472 |
KSecPadding ); |
|
1473 |
isiMsg.Set8bit( |
|
1474 |
ISI_HEADER_SIZE + UICC_PIN_REQ_OFFSET_NSB, |
|
1475 |
2 ); // Two UICC_SB_PIN subblocks |
|
1476 |
||
1477 |
// Create succlock UICC_SB_PIN for new PIN code |
|
1478 |
TBuf8<KMaxSizeUiccSbPin> uiccSbPinBuf( 0 ); |
|
1479 |
TIsiSubBlock uiccSbPinOld( |
|
1480 |
uiccSbPinBuf, |
|
1481 |
UICC_SB_PIN, |
|
1482 |
EIsiSubBlockTypeId16Len16 ); |
|
1483 |
||
1484 |
// PIN ID |
|
1485 |
uiccSbPinBuf.Append( pinId ); |
|
1486 |
uiccSbPinBuf.Append( UICC_PIN_OLD ); // PIN qualifier |
|
1487 |
uiccSbPinBuf.Append( aOldCode.Length() ); // Length of PIN code |
|
1488 |
uiccSbPinBuf.Append( aOldCode ); // PIN code |
|
1489 |
||
1490 |
// Append subblock to ISI message |
|
1491 |
isiMsg.CopyData( |
|
1492 |
ISI_HEADER_SIZE + SIZE_UICC_PIN_REQ, |
|
1493 |
uiccSbPinOld.CompleteSubBlock() ); |
|
1494 |
||
1495 |
TUint sbLength( uiccSbPinBuf.Length() ); |
|
1496 |
||
1497 |
// Create succlock UICC_SB_PIN for old PIN code |
|
1498 |
uiccSbPinBuf.Zero(); |
|
1499 |
TIsiSubBlock uiccSbPinNew( |
|
1500 |
uiccSbPinBuf, |
|
1501 |
UICC_SB_PIN, |
|
1502 |
EIsiSubBlockTypeId16Len16 ); |
|
1503 |
||
1504 |
// PIN ID |
|
1505 |
uiccSbPinBuf.Append( pinId ); |
|
1506 |
uiccSbPinBuf.Append( UICC_PIN_NEW ); // PIN qualifier |
|
1507 |
uiccSbPinBuf.Append( aNewCode.Length() ); // Length of PIN code |
|
1508 |
uiccSbPinBuf.Append( aNewCode ); // PIN code |
|
1509 |
||
1510 |
// Append subblock to ISI message |
|
1511 |
isiMsg.CopyData( |
|
1512 |
ISI_HEADER_SIZE + SIZE_UICC_PIN_REQ + sbLength, |
|
1513 |
uiccSbPinNew.CompleteSubBlock() ); |
|
1514 |
||
1515 |
return iPhoNetSender->Send( isiMsg.Complete() ); |
|
1516 |
} |
|
1517 |
||
1518 |
||
1519 |
// ----------------------------------------------------------------------------- |
|
1520 |
// CMmSecurityMessHandler::UiccPinReqChangeState |
|
1521 |
// Creates and sends UICC_PIN_REQ ISI message. |
|
1522 |
// ----------------------------------------------------------------------------- |
|
1523 |
// |
|
1524 |
TInt CMmSecurityMessHandler::UiccPinReqChangeState( |
|
1525 |
const RMobilePhone::TMobilePhoneLock aLock, |
|
1526 |
const RMobilePhone::TMobilePhoneLockSetting& aSetting, |
|
1527 |
const RMobilePhone::TMobilePassword& aCode ) |
|
1528 |
{ |
|
1529 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::UiccPinReqChangeState"); |
|
1530 |
OstTrace0( TRACE_NORMAL, CMMSECURITYMESSHANDLER_UICCPINREQCHANGESTATE, "CMmSecurityMessHandler::UiccPinReqChangeState" ); |
|
1531 |
||
1532 |
TInt ret( KErrNone ); |
|
1533 |
TUint8 pinId( KUniversalPinKeyReference ); |
|
1534 |
TUint8 pinIdToBeSubstituted( KUniversalPinKeyReference ); |
|
1535 |
TUint8 pinIdSubstitution( KUniversalPinKeyReference ); |
|
1536 |
TUint8 setting( UICC_PIN_SUBSTITUTE ); |
|
1537 |
// Set PIN ID |
|
1538 |
if ( RMobilePhone::ELockICC == aLock ) |
|
1539 |
{ |
|
1540 |
pinId = iMmUiccMessHandler->GetPin1KeyReference(); |
|
1541 |
pinIdSubstitution = pinId; // Replace UPIN by PIN |
|
1542 |
} |
|
1543 |
else if ( RMobilePhone::ELockPin2 == aLock ) |
|
1544 |
{ |
|
1545 |
pinId = iMmUiccMessHandler->GetPin2KeyReference(); |
|
1546 |
} |
|
1547 |
else |
|
1548 |
{ |
|
1549 |
pinIdToBeSubstituted = iMmUiccMessHandler->GetPin1KeyReference(); |
|
1550 |
} |
|
1551 |
||
1552 |
// Set new state to be changed |
|
1553 |
if ( RMobilePhone::ELockSetEnabled == aSetting ) |
|
1554 |
{ |
|
1555 |
setting = UICC_PIN_ENABLE; |
|
1556 |
} |
|
1557 |
else if ( RMobilePhone::ELockSetDisabled == aSetting ) |
|
1558 |
{ |
|
1559 |
setting = UICC_PIN_DISABLE; |
|
1560 |
} |
|
1561 |
else if ( RMobilePhone::ELockReplaced == aSetting ) |
|
1562 |
{ |
|
1563 |
// PIN 1 ID is always used in case of substitute |
|
1564 |
pinId = iMmUiccMessHandler->GetPin1KeyReference(); |
|
1565 |
} |
|
1566 |
else |
|
1567 |
{ |
|
1568 |
ret = KErrNotSupported; |
|
1569 |
} |
|
1570 |
||
1571 |
if ( KErrNone == ret ) |
|
1572 |
{ |
|
1573 |
// Create UICC_REQ message for changing PIN code state |
|
1574 |
TIsiSend isiMsg( iPhoNetSender->SendBufferDes() ); |
|
1575 |
isiMsg.Set8bit( ISI_HEADER_OFFSET_RESOURCEID, PN_UICC ); |
|
1576 |
isiMsg.Set8bit( ISI_HEADER_OFFSET_TRANSID, KSecurityTransId ); |
|
1577 |
isiMsg.Set8bit( ISI_HEADER_OFFSET_MESSAGEID, UICC_PIN_REQ ); |
|
1578 |
isiMsg.Set8bit( |
|
1579 |
ISI_HEADER_SIZE + UICC_PIN_REQ_OFFSET_SERVICETYPE, |
|
1580 |
setting ); |
|
1581 |
isiMsg.Set8bit( |
|
1582 |
ISI_HEADER_SIZE + UICC_PIN_REQ_OFFSET_APPLID, |
|
1583 |
iApplicationId ); |
|
1584 |
// 3x filler |
|
1585 |
isiMsg.Set8bit( |
|
1586 |
ISI_HEADER_SIZE + UICC_PIN_REQ_OFFSET_FILLERBYTE1, |
|
1587 |
KSecPadding ); |
|
1588 |
isiMsg.Set8bit( |
|
1589 |
ISI_HEADER_SIZE + UICC_PIN_REQ_OFFSET_FILLERBYTE1 + 1, |
|
1590 |
KSecPadding ); |
|
1591 |
isiMsg.Set8bit( |
|
1592 |
ISI_HEADER_SIZE + UICC_PIN_REQ_OFFSET_FILLERBYTE1 + 2, |
|
1593 |
KSecPadding ); |
|
1594 |
isiMsg.Set8bit( |
|
1595 |
ISI_HEADER_SIZE + UICC_PIN_REQ_OFFSET_NSB, |
|
1596 |
1 ); // UICC_SB_PIN |
|
1597 |
||
1598 |
// Create succlock UICC_SB_PIN for PIN code |
|
1599 |
TBuf8<KMaxSizeUiccSbPin> uiccSbPinBuf( 0 ); |
|
1600 |
TIsiSubBlock uiccSbPin( |
|
1601 |
uiccSbPinBuf, |
|
1602 |
UICC_SB_PIN, |
|
1603 |
EIsiSubBlockTypeId16Len16 ); |
|
1604 |
uiccSbPinBuf.Append( pinId ); // PIN ID |
|
1605 |
uiccSbPinBuf.Append( UICC_PIN_OLD ); // PIN qualifier |
|
1606 |
uiccSbPinBuf.Append( aCode.Length() ); // Length of PIN code |
|
1607 |
uiccSbPinBuf.Append( aCode ); // PIN code |
|
1608 |
// Append subblock to ISI message |
|
1609 |
isiMsg.CopyData( |
|
1610 |
ISI_HEADER_SIZE + SIZE_UICC_PIN_REQ, |
|
1611 |
uiccSbPin.CompleteSubBlock() ); |
|
1612 |
||
1613 |
// If request was to replace PIN by UPIN or vice versa |
|
1614 |
// subblock UICC_SB_PIN_SUBST is also added |
|
1615 |
if ( UICC_PIN_SUBSTITUTE == setting ) |
|
1616 |
{ |
|
1617 |
TBuf8<SIZE_UICC_SB_PIN_SUBST> uiccSbPinSubstBuf( 0 ); |
|
1618 |
TIsiSubBlock uiccSbPinSubst( |
|
1619 |
uiccSbPinSubstBuf, |
|
1620 |
UICC_SB_PIN_SUBST, |
|
1621 |
EIsiSubBlockTypeId16Len16 ); |
|
1622 |
uiccSbPinSubstBuf.Append( pinIdToBeSubstituted ); |
|
1623 |
uiccSbPinSubstBuf.Append( pinIdSubstitution ); |
|
1624 |
uiccSbPinSubstBuf.Append( KSecPadding ); |
|
1625 |
uiccSbPinSubstBuf.Append( KSecPadding ); |
|
1626 |
// Append subblock to ISI message |
|
1627 |
isiMsg.CopyData( |
|
1628 |
ISI_HEADER_SIZE + SIZE_UICC_PIN_REQ + uiccSbPinBuf.Length(), |
|
1629 |
uiccSbPinSubst.CompleteSubBlock() ); |
|
1630 |
} |
|
1631 |
||
1632 |
ret = iPhoNetSender->Send( isiMsg.Complete() ); |
|
1633 |
} |
|
1634 |
return ret; |
|
1635 |
} |
|
1636 |
||
1637 |
||
1638 |
// ----------------------------------------------------------------------------- |
|
1639 |
// CMmSecurityMessHandler::HandleUiccPinVerifyResp |
|
1640 |
// ----------------------------------------------------------------------------- |
|
1641 |
// |
|
1642 |
void CMmSecurityMessHandler::HandleUiccPinVerifyResp( |
|
1643 |
const TUint8 aStatus, |
|
1644 |
const TIsiReceiveC& aIsiMessage ) |
|
1645 |
{ |
|
1646 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::HandleUiccPinVerifyResp"); |
|
1647 |
OstTrace0( TRACE_NORMAL, CMMSECURITYMESSHANDLER_HANDLEUICCPINVERIFYRESP, "CMmSecurityMessHandler::HandleUiccPinVerifyResp" ); |
|
1648 |
||
1649 |
TInt ret( KErrNone ); |
|
1650 |
||
1651 |
if ( UICC_STATUS_OK != aStatus ) |
|
1652 |
{ |
|
1653 |
ret = KErrGeneral; |
|
1654 |
// Subblock UICC_SB_STATUS_WORD contains cause information |
|
1655 |
TUint uiccSbStatusWordOffset( 0 ); |
|
1656 |
if ( KErrNone == aIsiMessage.FindSubBlockOffsetById( |
|
1657 |
ISI_HEADER_SIZE + SIZE_UICC_PIN_RESP, |
|
1658 |
UICC_SB_STATUS_WORD, |
|
1659 |
EIsiSubBlockTypeId16Len16, |
|
1660 |
uiccSbStatusWordOffset ) ) |
|
1661 |
{ |
|
1662 |
TUint8 sw1( aIsiMessage.Get8bit( |
|
1663 |
uiccSbStatusWordOffset + |
|
1664 |
UICC_SB_STATUS_WORD_OFFSET_SW1 ) ); |
|
1665 |
TUint8 sw2( aIsiMessage.Get8bit( |
|
1666 |
uiccSbStatusWordOffset + |
|
1667 |
UICC_SB_STATUS_WORD_OFFSET_SW2 ) ); |
|
1668 |
||
1669 |
// Get status words and map to symbian error codes |
|
1670 |
TUint16 statusWord( sw1 << 8 | sw2 ); |
|
1671 |
||
1672 |
// Map status word to symbian error codes. See status word coding from |
|
1673 |
// TS 102.221 V7.11.0 Chapter 10.2.1 |
|
1674 |
||
1675 |
// 0x63CX: PIN was not correct and there are 'X' retries left |
|
1676 |
if ( 0x63 == sw1 && 0x0C == ( sw2 >> 4 ) ) |
|
1677 |
{ |
|
1678 |
ret = CMmStaticUtility::EpocErrorCode( |
|
1679 |
KErrAccessDenied, |
|
1680 |
KErrGsm0707IncorrectPassword ); |
|
1681 |
} |
|
1682 |
else if ( 0x6983 == statusWord ) // Authentication/PIN method blocked |
|
1683 |
{ |
|
1684 |
ret = CMmStaticUtility::EpocErrorCode( |
|
1685 |
KErrAccessDenied, |
|
1686 |
KErrGsmSSPasswordAttemptsViolation ); |
|
1687 |
} |
|
1688 |
// No else, KErrGeneral is returned |
|
1689 |
} |
|
1690 |
} // End of if ( UICC_STATUS_OK != status ) |
|
1691 |
||
1692 |
iMessageRouter->Complete( EMobilePhoneVerifySecurityCode, ret ); |
|
1693 |
} |
|
1694 |
||
1695 |
||
1696 |
// ----------------------------------------------------------------------------- |
|
1697 |
// CMmSecurityMessHandler::HandleUiccPinInfoResp |
|
1698 |
// ----------------------------------------------------------------------------- |
|
1699 |
// |
|
1700 |
void CMmSecurityMessHandler::HandleUiccPinInfoResp( |
|
1701 |
const TUint8 aStatus, |
|
1702 |
const TIsiReceiveC& aIsiMessage ) |
|
1703 |
{ |
|
1704 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::HandleUiccPinInfoResp"); |
|
1705 |
OstTrace0( TRACE_NORMAL, CMMSECURITYMESSHANDLER_HANDLEUICCPININFORESP, "CMmSecurityMessHandler::HandleUiccPinInfoResp" ); |
|
1706 |
||
1707 |
TInt ret( KErrNone ); |
|
1708 |
CMmDataPackage dataPackage; |
|
1709 |
RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; |
|
1710 |
lockInfo.iStatus = RMobilePhone::EStatusLockUnknown; |
|
1711 |
lockInfo.iSetting = RMobilePhone::ELockSetUnknown; |
|
1712 |
RMobilePhone::TMobilePhoneSecurityCodeInfoV5 securityInfo; |
|
1713 |
TUint8 pinStatus( UICC_STATUS_UNKNOWN ); |
|
1714 |
TUint8 pinAttemptsLeft( 0 ); |
|
1715 |
TUint8 pukAttemptsLeft( 0 ); |
|
1716 |
||
1717 |
// Subblock UICC_SB_PIN_INFO |
|
1718 |
TUint uiccSbPinInfoOffset( 0 ); |
|
1719 |
if ( UICC_STATUS_OK == aStatus && |
|
1720 |
KErrNone == aIsiMessage.FindSubBlockOffsetById( |
|
1721 |
ISI_HEADER_SIZE + SIZE_UICC_PIN_RESP, |
|
1722 |
UICC_SB_PIN_INFO, |
|
1723 |
EIsiSubBlockTypeId16Len16, |
|
1724 |
uiccSbPinInfoOffset ) ) |
|
1725 |
{ |
|
1726 |
pinStatus = aIsiMessage.Get8bit( |
|
1727 |
uiccSbPinInfoOffset + |
|
1728 |
UICC_SB_PIN_INFO_OFFSET_PINSTATUS ); |
|
1729 |
pinAttemptsLeft = aIsiMessage.Get8bit( |
|
1730 |
uiccSbPinInfoOffset + |
|
1731 |
UICC_SB_PIN_INFO_OFFSET_PINATT ); |
|
1732 |
pukAttemptsLeft = aIsiMessage.Get8bit( |
|
1733 |
uiccSbPinInfoOffset + |
|
1734 |
UICC_SB_PIN_INFO_OFFSET_PUKATT ); |
|
1735 |
||
1736 |
// This is PIN attempts left query |
|
1737 |
if ( iPinAttemptsLeftQuery ) |
|
1738 |
{ |
|
1739 |
// PIN codes |
|
1740 |
if ( RMobilePhone::ESecurityCodePin1 == iCodeType || |
|
1741 |
RMobilePhone::ESecurityCodePin2 == iCodeType || |
|
1742 |
RMobilePhone::ESecurityUniversalPin == iCodeType ) |
|
1743 |
{ |
|
1744 |
securityInfo.iRemainingEntryAttempts = pinAttemptsLeft; |
|
1745 |
} |
|
1746 |
else // PUK codes |
|
1747 |
{ |
|
1748 |
securityInfo.iRemainingEntryAttempts = pukAttemptsLeft; |
|
1749 |
} |
|
1750 |
} |
|
1751 |
if ( iLockStateQuery ) // This is lock state query |
|
1752 |
{ |
|
1753 |
// Set PIN setting |
|
1754 |
if ( UICC_STATUS_PIN_ENABLED == pinStatus) |
|
1755 |
{ |
|
1756 |
lockInfo.iSetting = RMobilePhone::ELockSetEnabled; |
|
1757 |
} |
|
1758 |
else if ( UICC_STATUS_PIN_DISABLED == pinStatus ) |
|
1759 |
{ |
|
1760 |
lockInfo.iSetting = RMobilePhone::ELockSetDisabled; |
|
1761 |
} |
|
1762 |
// Set PIN status |
|
1763 |
if ( 0 != pinAttemptsLeft ) |
|
1764 |
{ |
|
1765 |
lockInfo.iStatus = RMobilePhone::EStatusUnlocked; |
|
1766 |
} |
|
1767 |
else |
|
1768 |
{ |
|
1769 |
lockInfo.iStatus = RMobilePhone::EStatusBlocked; |
|
1770 |
} |
|
1771 |
dataPackage.PackData( &lockInfo.iStatus, & lockInfo.iSetting ); |
|
1772 |
} |
|
1773 |
} |
|
1774 |
else // UICC status was not OK or subblock was not found |
|
1775 |
{ |
|
1776 |
ret = KErrNotFound; |
|
1777 |
} |
|
1778 |
||
1779 |
// Complete PIN attempts left query |
|
1780 |
if ( iPinAttemptsLeftQuery ) |
|
1781 |
{ |
|
1782 |
iPinAttemptsLeftQuery = EFalse; |
|
1783 |
dataPackage.PackData( &iCodeType, &securityInfo ); |
|
1784 |
iMessageRouter->Complete( |
|
1785 |
EMobilePhoneGetSecurityCodeInfo, |
|
1786 |
&dataPackage, |
|
1787 |
ret ); |
|
1788 |
iPinAttemptsLeftQuery = EFalse; |
|
1789 |
} |
|
1790 |
if ( iLockStateQuery ) // Complete PIN state query |
|
1791 |
{ |
|
1792 |
dataPackage.PackData( &lockInfo.iStatus, & lockInfo.iSetting ); |
|
1793 |
// Complete PIN info |
|
1794 |
iMessageRouter->Complete( |
|
1795 |
EMobilePhoneGetLockInfo, |
|
1796 |
&dataPackage, |
|
1797 |
ret ); |
|
1798 |
iLockStateQuery = EFalse; |
|
1799 |
} |
|
1800 |
} |
|
1801 |
||
1802 |
||
1803 |
// ----------------------------------------------------------------------------- |
|
1804 |
// CMmSecurityMessHandler::HandleUiccPinChangeResp |
|
1805 |
// ----------------------------------------------------------------------------- |
|
1806 |
// |
|
1807 |
void CMmSecurityMessHandler::HandleUiccPinChangeResp( |
|
1808 |
const TUint8 aStatus, |
|
1809 |
const TIsiReceiveC& aIsiMessage ) |
|
1810 |
{ |
|
1811 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::HandleUiccPinChangeResp"); |
|
1812 |
OstTrace0( TRACE_NORMAL, CMMSECURITYMESSHANDLER_HANDLEUICCPINCHANGERESP, "CMmSecurityMessHandler::HandleUiccPinChangeResp" ); |
|
1813 |
||
1814 |
TInt ret( KErrNone ); |
|
1815 |
if ( UICC_STATUS_OK != aStatus ) |
|
1816 |
{ |
|
1817 |
ret = KErrNotSupported; |
|
1818 |
// Subblock UICC_SB_STATUS_WORD contains cause information |
|
1819 |
TUint uiccSbStatusWordOffset( 0 ); |
|
1820 |
if ( KErrNone == aIsiMessage.FindSubBlockOffsetById( |
|
1821 |
ISI_HEADER_SIZE + SIZE_UICC_PIN_RESP, |
|
1822 |
UICC_SB_STATUS_WORD, |
|
1823 |
EIsiSubBlockTypeId16Len16, |
|
1824 |
uiccSbStatusWordOffset ) ) |
|
1825 |
{ |
|
1826 |
TUint8 sw1( aIsiMessage.Get8bit( |
|
1827 |
uiccSbStatusWordOffset + |
|
1828 |
UICC_SB_STATUS_WORD_OFFSET_SW1 ) ); |
|
1829 |
TUint8 sw2( aIsiMessage.Get8bit( |
|
1830 |
uiccSbStatusWordOffset + |
|
1831 |
UICC_SB_STATUS_WORD_OFFSET_SW2 ) ); |
|
1832 |
||
1833 |
// Get status words and map to symbian error codes |
|
1834 |
TUint16 statusWord( sw1 << 8 | sw2 ); |
|
1835 |
||
1836 |
// Map status word to symbian error codes. See status word coding |
|
1837 |
// from TS 102.221 V7.11.0 Chapter 10.2.1 |
|
1838 |
||
1839 |
// 0x63CX: PIN was not correct and there are 'X' retries left |
|
1840 |
if ( 0x63 == sw1 && 0x0C == ( sw2 >> 4 ) ) |
|
1841 |
{ |
|
1842 |
ret = CMmStaticUtility::EpocErrorCode( |
|
1843 |
KErrAccessDenied, |
|
1844 |
KErrGsm0707IncorrectPassword ); |
|
1845 |
} |
|
1846 |
else if ( 0x6983 == statusWord ) // Authent./PIN method blocked |
|
1847 |
{ |
|
1848 |
ret = CMmStaticUtility::EpocErrorCode( |
|
1849 |
KErrLocked, |
|
1850 |
KErrGsmSSPasswordAttemptsViolation ); |
|
1851 |
} |
|
1852 |
else if ( 0x6A81 == statusWord ) // Wrong parameters |
|
1853 |
{ |
|
1854 |
ret = CMmStaticUtility::EpocErrorCode( |
|
1855 |
KErrArgument, |
|
1856 |
KErrGsmInvalidParameter ); |
|
1857 |
} |
|
1858 |
// No else, KErrNotSupported is returned |
|
1859 |
} |
|
1860 |
} |
|
1861 |
iMessageRouter->Complete ( EMobilePhoneChangeSecurityCode, ret ); |
|
1862 |
} |
|
1863 |
||
1864 |
||
1865 |
// ----------------------------------------------------------------------------- |
|
1866 |
// CMmSecurityMessHandler::HandleUiccPinStateChangeResp |
|
1867 |
// ----------------------------------------------------------------------------- |
|
1868 |
// |
|
1869 |
void CMmSecurityMessHandler::HandleUiccPinStateChangeResp( |
|
1870 |
const TUint8 aStatus, |
|
1871 |
const TIsiReceiveC& aIsiMessage ) |
|
1872 |
{ |
|
1873 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::HandleUiccPinStateChangeResp"); |
|
1874 |
OstTrace0( TRACE_NORMAL, CMMSECURITYMESSHANDLER_HANDLEUICCPINSTATECHANGERESP, "CMmSecurityMessHandler::HandleUiccPinStateChangeResp" ); |
|
1875 |
||
1876 |
TInt ret( KErrNone ); |
|
1877 |
// Status and setting values are not used in CTSY, set to 'unknown' |
|
1878 |
RMobilePhone::TMobilePhoneLockStatus status( |
|
1879 |
RMobilePhone::EStatusLockUnknown ); |
|
1880 |
RMobilePhone::TMobilePhoneLockSetting setting( |
|
1881 |
RMobilePhone::ELockSetUnknown ); |
|
1882 |
||
1883 |
TUint8 serviceType( aIsiMessage.Get8bit( |
|
1884 |
ISI_HEADER_SIZE + UICC_PIN_RESP_OFFSET_SERVICETYPE ) ); |
|
1885 |
||
1886 |
if ( UICC_STATUS_OK != aStatus ) |
|
1887 |
{ |
|
1888 |
ret = KErrNotSupported; |
|
1889 |
// Subblock UICC_SB_STATUS_WORD contains cause information |
|
1890 |
TUint uiccSbStatusWordOffset( 0 ); |
|
1891 |
if ( KErrNone == aIsiMessage.FindSubBlockOffsetById( |
|
1892 |
ISI_HEADER_SIZE + SIZE_UICC_PIN_RESP, |
|
1893 |
UICC_SB_STATUS_WORD, |
|
1894 |
EIsiSubBlockTypeId16Len16, |
|
1895 |
uiccSbStatusWordOffset ) ) |
|
1896 |
{ |
|
1897 |
TUint8 sw1( aIsiMessage.Get8bit( |
|
1898 |
uiccSbStatusWordOffset + |
|
1899 |
UICC_SB_STATUS_WORD_OFFSET_SW1 ) ); |
|
1900 |
TUint8 sw2( aIsiMessage.Get8bit( |
|
1901 |
uiccSbStatusWordOffset + |
|
1902 |
UICC_SB_STATUS_WORD_OFFSET_SW2 ) ); |
|
1903 |
||
1904 |
// Get status words and map to symbian error codes |
|
1905 |
TUint16 statusWord( sw1 << 8 | sw2 ); |
|
1906 |
||
1907 |
// Map status word to symbian error codes. See status word coding from |
|
1908 |
// TS 102.221 V7.11.0 Chapter 10.2.1 |
|
1909 |
||
1910 |
// 0x63CX: PIN was not correct and there are 'X' retries left |
|
1911 |
if ( 0x63 == sw1 && 0x0C == ( sw2 >> 4 ) ) |
|
1912 |
{ |
|
1913 |
ret = CMmStaticUtility::EpocErrorCode( |
|
1914 |
KErrAccessDenied, |
|
1915 |
KErrGsm0707IncorrectPassword ); |
|
1916 |
} |
|
1917 |
else if ( 0x6983 == statusWord ) // Authentication/PIN method blocked |
|
1918 |
{ |
|
1919 |
ret = CMmStaticUtility::EpocErrorCode( |
|
1920 |
KErrAccessDenied, |
|
1921 |
KErrGsmSSPasswordAttemptsViolation ); |
|
1922 |
} |
|
1923 |
// No else, KErrNotSupported is returned |
|
1924 |
} |
|
1925 |
} |
|
1926 |
else if ( UICC_PIN_SUBSTITUTE == serviceType ) |
|
1927 |
{ |
|
1928 |
// If response status is OK PIN/UPIN was substituted. |
|
1929 |
// Update active pin |
|
1930 |
iMmUiccMessHandler->ChangeActivePin(); |
|
1931 |
} |
|
1932 |
||
1933 |
CMmDataPackage dataPackage; |
|
1934 |
dataPackage.PackData( &status, &setting ); |
|
1935 |
iMessageRouter->Complete( |
|
1936 |
EMobilePhoneSetLockSetting, |
|
1937 |
&dataPackage, |
|
1938 |
ret ); |
|
1939 |
} |
|
1940 |
||
1941 |
// ----------------------------------------------------------------------------- |
|
1942 |
// CMmSecurityMessHandler::GetIccType |
|
1943 |
// Read ICC type and completes it |
|
1944 |
// ----------------------------------------------------------------------------- |
|
1945 |
// |
|
1946 |
void CMmSecurityMessHandler::GetIccType() |
|
1947 |
{ |
|
1948 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::GetIccType"); |
|
1949 |
OstTrace0( TRACE_NORMAL, CMMSECURITYMESSHANDLER_GETICCTYPE, "CMmSecurityMessHandler::GetIccType" ); |
|
1950 |
||
1951 |
TInt ret( KErrNone ); |
|
1952 |
TICCType type ( EICCTypeSimUnknown ); |
|
1953 |
TUint8 applicationType( iMmUiccMessHandler->GetApplicationType() ); |
|
1954 |
||
1955 |
if ( UICC_APPL_TYPE_UICC_USIM == applicationType ) |
|
1956 |
{ |
|
1957 |
type = EICCTypeSim3G; |
|
1958 |
} |
|
1959 |
else if ( UICC_APPL_TYPE_ICC_SIM == applicationType ) |
|
1960 |
{ |
|
1961 |
type = EICCTypeSim2GGsm; |
|
1962 |
} |
|
1963 |
else |
|
1964 |
{ |
|
1965 |
ret = KErrGeneral; |
|
1966 |
} |
|
1967 |
||
1968 |
// Complete the request |
|
1969 |
CMmDataPackage dataPackage; |
|
1970 |
dataPackage.PackData( &type ); |
|
1971 |
||
1972 |
iMessageRouter->Complete( EMmTsySimGetICCType, &dataPackage, ret ); |
|
1973 |
} |
|
1974 |
||
1975 |
// ----------------------------------------------------------------------------- |
|
1976 |
// CMmSecurityMessHandler::GetActivePin |
|
1977 |
// Reads active PIN and completes it |
|
1978 |
// ----------------------------------------------------------------------------- |
|
1979 |
// |
|
1980 |
void CMmSecurityMessHandler::GetActivePin() |
|
1981 |
{ |
|
1982 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::GetActivePin"); |
|
1983 |
OstTrace0( TRACE_NORMAL, CMMSECURITYMESSHANDLER_GETACTIVEPIN, "CMmSecurityMessHandler::GetActivePin" ); |
|
1984 |
RMobilePhone::TMobilePhoneSecurityCode activePin( |
|
1985 |
iMmUiccMessHandler->GetActivePin()); |
|
1986 |
CMmDataPackage dataPackage; |
|
1987 |
dataPackage.PackData( &activePin ); |
|
1988 |
iMessageRouter->Complete( |
|
1989 |
EMmTsySecurityGetSimActivePinStateIPC, |
|
1990 |
&dataPackage, |
|
1991 |
KErrNone ); |
|
1992 |
} |
|
1993 |
||
1994 |
// ----------------------------------------------------------------------------- |
|
1995 |
// CMmSecurityMessHandler::GetActiveUsimApplication |
|
1996 |
// Read AID of active USIM application and complete |
|
1997 |
// ----------------------------------------------------------------------------- |
|
1998 |
// |
|
1999 |
void CMmSecurityMessHandler::GetActiveUsimApplication() |
|
2000 |
{ |
|
2001 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::GetActiveUsimApplication"); |
|
2002 |
OstTrace0( TRACE_NORMAL, CMMSECURITYMESSHANDLER_GETACTIVEUSIMAPPLICATION, "CMmSecurityMessHandler::GetActiveUsimApplication" ); |
|
2003 |
||
2004 |
RMobilePhone::TAID aid( iMmUiccMessHandler->GetAid() ); |
|
2005 |
CMmDataPackage dataPackage; |
|
2006 |
dataPackage.PackData( &aid ); |
|
2007 |
iMessageRouter->Complete( |
|
2008 |
EMobilePhoneGetCurrentActiveUSimApplication, |
|
2009 |
&dataPackage, |
|
2010 |
KErrNone ); |
|
2011 |
} |
|
2012 |
||
2013 |
// ----------------------------------------------------------------------------- |
|
2014 |
// CMmSecurityMessHandler::GetPukCodeReq |
|
2015 |
// Returns iPukCodeRequired |
|
2016 |
// ----------------------------------------------------------------------------- |
|
2017 |
// |
|
2018 |
TInt CMmSecurityMessHandler::GetPukCodeReq() |
|
2019 |
{ |
|
2020 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::GetPukCodeReq"); |
|
2021 |
OstTrace0( TRACE_NORMAL, DUP1_CMMSECURITYMESSHANDLER_GETPUKCODEREQ, "CMmSecurityMessHandler::GetPukCodeReq" ); |
|
2022 |
return iPukCodeRequired; |
|
2023 |
} |
|
2024 |
||
2025 |
// ----------------------------------------------------------------------------- |
|
2026 |
// CMmSecurityMessHandler::SetFdnStateUicc |
|
2027 |
// sets FDN state in case of UICC card |
|
2028 |
// ----------------------------------------------------------------------------- |
|
2029 |
// |
|
2030 |
TInt CMmSecurityMessHandler::ReadEfEst( TUiccTrId aTraId ) |
|
2031 |
{ |
|
2032 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::ReadEfEst"); |
|
2033 |
OstTrace0( TRACE_NORMAL, CMMSECURITYMESSHANDLER_READEFEST, "CMmSecurityMessHandler::ReadEfEst" ); |
|
2034 |
||
2035 |
// Set parameters for UICC_APPL_CMD_REQ message |
|
2036 |
TUiccReadTransparent params; |
|
2037 |
params.messHandlerPtr = static_cast<MUiccOperationBase*>( this ); |
|
2038 |
params.trId = aTraId; |
|
2039 |
params.dataAmount = 0; |
|
2040 |
params.dataOffset = 0; |
|
2041 |
params.fileId = KElemEst; |
|
2042 |
params.fileIdSfi = 0x05; |
|
2043 |
params.serviceType = UICC_APPL_READ_TRANSPARENT; |
|
2044 |
||
2045 |
// File id path |
|
2046 |
params.filePath.Append( KMasterFileId >> 8 ); |
|
2047 |
params.filePath.Append( KMasterFileId ); |
|
2048 |
params.filePath.Append( iMmUiccMessHandler->GetApplicationFileId() ); |
|
2049 |
||
2050 |
return iMmUiccMessHandler->CreateUiccApplCmdReq( params ); |
|
2051 |
} |
|
2052 |
||
2053 |
// ----------------------------------------------------------------------------- |
|
2054 |
// CMmSecurityMessHandler::ProcessUiccMsg |
|
2055 |
// Handles data received from UICC server |
|
2056 |
// ----------------------------------------------------------------------------- |
|
2057 |
// |
|
2058 |
TInt CMmSecurityMessHandler::ProcessUiccMsg( |
|
2059 |
TInt aTraId, |
|
2060 |
TInt aStatus, |
|
5
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
2061 |
TUint8 /*aDetails*/, |
0 | 2062 |
const TDesC8& aFileData ) |
2063 |
{ |
|
2064 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::ProcessUiccMsg"); |
|
2065 |
OstTrace0( TRACE_NORMAL, CMMSECURITYMESSHANDLER_PROCESSUICCMSG, "CMmSecurityMessHandler::ProcessUiccMsg" ); |
|
2066 |
||
2067 |
TInt ret( KErrNone ); |
|
2068 |
||
2069 |
switch( aTraId ) |
|
2070 |
{ |
|
2071 |
case ETrIdSetFdnStateReadEst: |
|
2072 |
{ |
|
2073 |
FdnSetReadEfEstResp( aStatus, aFileData ); |
|
2074 |
break; |
|
2075 |
} |
|
2076 |
case ETrIdGetFdnStateReadEst: |
|
2077 |
{ |
|
2078 |
FdnGetReadEfEstResp( aStatus, aFileData ); |
|
2079 |
break; |
|
2080 |
} |
|
2081 |
case ETrIdSetFdnStateWriteEst: |
|
2082 |
{ |
|
2083 |
WriteEfEstResp( aStatus ); |
|
2084 |
break; |
|
2085 |
} |
|
2086 |
case ETrIdSetFdnIcc: |
|
2087 |
{ |
|
2088 |
FdnStateCommandResp( aStatus, aFileData ); |
|
2089 |
break; |
|
2090 |
} |
|
2091 |
case ETrIdSetFdnStateReadFileInfo: |
|
2092 |
{ |
|
2093 |
FdnSetReadEfAdnFileInfoResp( aStatus, aFileData ); |
|
2094 |
break; |
|
2095 |
} |
|
2096 |
case ETrIdGetFdnStateReadFileInfo: |
|
2097 |
{ |
|
2098 |
FdnGetReadEfAdnFileInfoResp( aStatus, aFileData ); |
|
2099 |
break; |
|
2100 |
} |
|
2101 |
default: |
|
2102 |
{ |
|
2103 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::ProcessUiccMsg - unknown transaction ID" ); |
|
2104 |
OstTrace0( TRACE_NORMAL, DUP1_CMMSECURITYMESSHANDLER_PROCESSUICCMSG, "CMmSecurityMessHandler::ProcessUiccMsg - unknown transaction ID" ); |
|
2105 |
break; |
|
2106 |
} |
|
2107 |
} |
|
2108 |
return ret; |
|
2109 |
} |
|
2110 |
||
2111 |
// ----------------------------------------------------------------------------- |
|
2112 |
// CMmSecurityMessHandler::FdnSetReadEfEstResp |
|
2113 |
// Handles response for EFest reading in case of setting FDN state |
|
2114 |
// ----------------------------------------------------------------------------- |
|
2115 |
// |
|
2116 |
void CMmSecurityMessHandler::FdnSetReadEfEstResp( |
|
2117 |
TInt aStatus, |
|
2118 |
const TDesC8& aFileData ) |
|
2119 |
{ |
|
2120 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::FdnSetReadEfEstResp"); |
|
2121 |
OstTrace0( TRACE_NORMAL, CMMSECURITYMESSHANDLER_FDNSETREADEFESTRESP, "CMmSecurityMessHandler::FdnSetReadEfEstResp" ); |
|
2122 |
||
2123 |
if( UICC_STATUS_OK == aStatus ) |
|
2124 |
{ |
|
2125 |
TUint8 fdnState( aFileData[0] & KFdnStateMask ); |
|
2126 |
TUint8 fdnStateToBeSet( 0 ); |
|
2127 |
||
2128 |
if( iMmUiccMessHandler->GetServiceStatus( KUiccServiceFdn ) ) |
|
2129 |
{ |
|
2130 |
if( RMobilePhone::EFdnSetOn == iFdnSetting ) |
|
2131 |
{ |
|
2132 |
fdnStateToBeSet = KServiceActivated; |
|
2133 |
} |
|
2134 |
else |
|
2135 |
{ |
|
2136 |
fdnStateToBeSet = KServiceNotActivated; |
|
2137 |
} |
|
2138 |
||
2139 |
if( fdnState != fdnStateToBeSet ) |
|
2140 |
{ |
|
2141 |
// update the EFest |
|
2142 |
TUiccWriteTransparent params; |
|
2143 |
params.messHandlerPtr = static_cast<MUiccOperationBase*>( this ); |
|
2144 |
params.trId = ETrIdSetFdnStateWriteEst; |
|
2145 |
params.dataOffset = 0; |
|
2146 |
params.dataAmount = 1; // only one byte is update |
|
2147 |
params.fileId = KElemEst; |
|
2148 |
params.fileIdSfi = 0x05; |
|
2149 |
params.serviceType = UICC_APPL_UPDATE_TRANSPARENT; |
|
2150 |
// File id path |
|
2151 |
params.filePath.Append( KMasterFileId >> 8 ); |
|
2152 |
params.filePath.Append( KMasterFileId ); |
|
2153 |
params.filePath.Append( iMmUiccMessHandler->GetApplicationFileId() ); |
|
2154 |
||
2155 |
// File data to be updated. |
|
2156 |
TUint8 data = aFileData[0] & 0xFE; |
|
2157 |
data += fdnStateToBeSet; |
|
2158 |
params.fileData.Append( data ); |
|
2159 |
||
2160 |
iMmUiccMessHandler->CreateUiccApplCmdReq( params ); |
|
2161 |
} |
|
2162 |
else |
|
2163 |
{ |
|
2164 |
// state is already correct, let's just complete the request |
|
2165 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::FdnSetReadEfEstResp: FDN state already correct, let's complete"); |
|
2166 |
OstTrace0( TRACE_NORMAL, DUP1_CMMSECURITYMESSHANDLER_FDNSETREADEFESTRESP, "CMmSecurityMessHandler::FdnSetReadEfEstResp: FDN state already correct, let's complete" ); |
|
2167 |
iMessageRouter->Complete( EMobilePhoneSetFdnSetting, KErrNone ); |
|
2168 |
} |
|
2169 |
} |
|
2170 |
else |
|
2171 |
{ |
|
2172 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::FdnSetReadEfEstResp: FDN state not supported in EFust"); |
|
2173 |
OstTrace0( TRACE_NORMAL, DUP2_CMMSECURITYMESSHANDLER_FDNSETREADEFESTRESP, "CMmSecurityMessHandler::FdnSetReadEfEstResp: FDN state not supported in EFust" ); |
|
2174 |
iMessageRouter->Complete( EMobilePhoneSetFdnSetting, KErrNotSupported ); |
|
2175 |
} |
|
2176 |
} |
|
2177 |
else |
|
2178 |
{ |
|
2179 |
// error in reading EFest, let's complete the request |
|
2180 |
TFLOGSTRING2("TSY: CMmSecurityMessHandler::FdnSetReadEfEstResp: reading failed, 0x%x", aStatus); |
|
2181 |
OstTrace1( TRACE_NORMAL, DUP3_CMMSECURITYMESSHANDLER_FDNSETREADEFESTRESP, "CMmSecurityMessHandler::FdnSetReadEfEstResp: reading failed, 0x%x", aStatus ); |
|
2182 |
||
2183 |
// compete setting of FDN state |
|
2184 |
iMessageRouter->Complete( EMobilePhoneSetFdnSetting, KErrGeneral ); |
|
2185 |
} |
|
2186 |
} |
|
2187 |
||
2188 |
// ----------------------------------------------------------------------------- |
|
2189 |
// CMmSecurityMessHandler::FdnGetReadEfEstResp |
|
2190 |
// Handles response for EFest reading in case of getting FDN state |
|
2191 |
// ----------------------------------------------------------------------------- |
|
2192 |
// |
|
2193 |
void CMmSecurityMessHandler::FdnGetReadEfEstResp( |
|
2194 |
TInt aStatus, |
|
2195 |
const TDesC8& aFileData ) |
|
2196 |
{ |
|
2197 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::FdnGetReadEfEstResp"); |
|
2198 |
OstTrace0( TRACE_NORMAL, CMMSECURITYMESSHANDLER_FDNGETREADEFESTRESP, "CMmSecurityMessHandler::FdnGetReadEfEstResp" ); |
|
2199 |
||
2200 |
RMobilePhone::TMobilePhoneFdnStatus fdnSetting( RMobilePhone::EFdnNotActive ); |
|
2201 |
||
2202 |
if( UICC_STATUS_OK == aStatus ) |
|
2203 |
{ |
|
2204 |
TUint8 fdnState( aFileData[0] & KFdnStateMask ); |
|
2205 |
||
2206 |
// let's check that FDN is supported in EFust |
|
2207 |
if( iMmUiccMessHandler->GetServiceStatus( KUiccServiceFdn ) ) |
|
2208 |
{ |
|
2209 |
if( KServiceActivated == fdnState ) |
|
2210 |
{ |
|
2211 |
fdnSetting = RMobilePhone::EFdnActive; |
|
2212 |
} |
|
2213 |
// no else because of in this case FDN is not active |
|
2214 |
// and fdnSetting is already set to state not active. |
|
2215 |
} |
|
2216 |
else |
|
2217 |
{ |
|
2218 |
// FDN not supported in EFust |
|
2219 |
fdnSetting = RMobilePhone::EFdnNotSupported; |
|
2220 |
} |
|
2221 |
CMmDataPackage dataPackage; |
|
2222 |
dataPackage.PackData ( &fdnSetting ); |
|
2223 |
// Complete the status to the client |
|
2224 |
iMessageRouter->Complete( EMobilePhoneGetFdnStatus, &dataPackage, KErrNone ); |
|
2225 |
} |
|
2226 |
else |
|
2227 |
{ |
|
2228 |
// error in reading EFest, let's complete the request |
|
2229 |
TFLOGSTRING2("TSY: CMmSecurityMessHandler::FdnGetReadEfEstResp: reading failed, 0x%x", aStatus); |
|
2230 |
OstTrace1( TRACE_NORMAL, DUP1_CMMSECURITYMESSHANDLER_FDNGETREADEFESTRESP, "CMmSecurityMessHandler::FdnGetReadEfEstResp: reading failed, 0x%x", aStatus ); |
|
2231 |
||
2232 |
fdnSetting = RMobilePhone::EFdnNotSupported; |
|
2233 |
CMmDataPackage dataPackage; |
|
2234 |
dataPackage.PackData ( &fdnSetting ); |
|
2235 |
iMessageRouter->Complete( EMobilePhoneGetFdnStatus, &dataPackage, KErrGeneral ); |
|
2236 |
} |
|
2237 |
} |
|
2238 |
||
2239 |
||
2240 |
// ----------------------------------------------------------------------------- |
|
2241 |
// CMmSecurityMessHandler::HandleWriteEfEstResp |
|
2242 |
// Handles response for EFest update |
|
2243 |
// ----------------------------------------------------------------------------- |
|
2244 |
// |
|
2245 |
void CMmSecurityMessHandler::WriteEfEstResp( const TInt aStatus ) |
|
2246 |
{ |
|
2247 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::WriteEfEstResp"); |
|
2248 |
OstTrace0( TRACE_NORMAL, CMMSECURITYMESSHANDLER_WRITEEFESTRESP, "CMmSecurityMessHandler::WriteEfEstResp" ); |
|
2249 |
||
2250 |
if( UICC_STATUS_OK == aStatus ) |
|
2251 |
{ |
|
2252 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::WriteEfEstResp: FDN state set succesfully"); |
|
2253 |
OstTrace0( TRACE_NORMAL, DUP1_CMMSECURITYMESSHANDLER_WRITEEFESTRESP, "CMmSecurityMessHandler::WriteEfEstResp: FDN state set succesfully" ); |
|
2254 |
iMessageRouter->Complete( EMobilePhoneSetFdnSetting, KErrNone ); |
|
2255 |
} |
|
2256 |
else |
|
2257 |
{ |
|
2258 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::WriteEfEstResp: FDN state set failed"); |
|
2259 |
OstTrace0( TRACE_NORMAL, DUP2_CMMSECURITYMESSHANDLER_WRITEEFESTRESP, "CMmSecurityMessHandler::WriteEfEstResp: FDN state set failed" ); |
|
2260 |
iMessageRouter->Complete( EMobilePhoneSetFdnSetting, KErrGeneral ); |
|
2261 |
} |
|
2262 |
} |
|
2263 |
||
2264 |
// ----------------------------------------------------------------------------- |
|
2265 |
// CMmSecurityMessHandler::SendFdnStateCommand |
|
2266 |
// sends INVALIDATE/REHABILITATE command for setting FDN state |
|
2267 |
// in case of ICC card |
|
2268 |
// ----------------------------------------------------------------------------- |
|
2269 |
// |
|
2270 |
TInt CMmSecurityMessHandler::SendFdnStateCommand() |
|
2271 |
{ |
|
2272 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::SendFdnStateCommand"); |
|
2273 |
OstTrace0( TRACE_NORMAL, CMMSECURITYMESSHANDLER_SENDFDNSTATECOMMAND, "CMmSecurityMessHandler::SendFdnStateCommand" ); |
|
2274 |
||
2275 |
TInt ret( 0 ); |
|
2276 |
TUiccSendApdu params; |
|
2277 |
params.messHandlerPtr = static_cast<MUiccOperationBase*>( this ); |
|
2278 |
params.serviceType = UICC_APPL_APDU_SEND; |
|
2279 |
params.fileId = UICC_EF_ID_NOT_PRESENT; |
|
2280 |
params.fileIdSfi = UICC_SFI_NOT_PRESENT; |
|
2281 |
params.filePath.Append( KMasterFileId >> 8 ); |
|
2282 |
params.filePath.Append( KMasterFileId ); |
|
2283 |
params.filePath.Append( iMmUiccMessHandler->GetApplicationFileId() ); |
|
2284 |
params.trId = ETrIdSetFdnIcc; |
|
2285 |
params.apdu.Append( 0xA0 ); // CLA |
|
2286 |
||
2287 |
if( RMobilePhone::EFdnSetOn == iFdnSetting ) |
|
2288 |
{ |
|
2289 |
//INVALIDATE |
|
2290 |
params.apdu.Append( 0x04 ); // INS |
|
2291 |
params.apdu.Append( 0 ); // P1 |
|
2292 |
params.apdu.Append( 0 ); // P2 |
|
2293 |
params.apdu.Append( 2 ); // Lc |
|
2294 |
params.apdu.Append( KElemAdnIcc >> 8 ); // File id |
|
2295 |
params.apdu.Append( KElemAdnIcc ); // File id |
|
2296 |
ret = iMmUiccMessHandler->CreateUiccApplCmdReq( params ); |
|
2297 |
} |
|
2298 |
else if( RMobilePhone::EFdnSetOff == iFdnSetting ) |
|
2299 |
{ |
|
2300 |
// REHABILITATE |
|
2301 |
params.apdu.Append( 0x44 ); // INS |
|
2302 |
params.apdu.Append( 0 ); // P1 |
|
2303 |
params.apdu.Append( 0 ); // P2 |
|
2304 |
params.apdu.Append( 2 ); // Lc |
|
2305 |
params.apdu.Append( KElemAdnIcc >> 8 ); // File id |
|
2306 |
params.apdu.Append( KElemAdnIcc ); // File id |
|
2307 |
ret = iMmUiccMessHandler->CreateUiccApplCmdReq( params ); |
|
2308 |
} |
|
2309 |
else |
|
2310 |
{ |
|
2311 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::SendFdnStateCommand: unknown FDN state"); |
|
2312 |
OstTrace0( TRACE_NORMAL, DUP1_CMMSECURITYMESSHANDLER_SENDFDNSTATECOMMAND, "CMmSecurityMessHandler::SendFdnStateCommand: unknown FDN state" ); |
|
2313 |
ret = KErrArgument; |
|
2314 |
} |
|
2315 |
||
2316 |
return ret; |
|
2317 |
} |
|
2318 |
||
2319 |
// ----------------------------------------------------------------------------- |
|
2320 |
// CMmSecurityMessHandler::FdnStateCommandResp |
|
2321 |
// handles response to the INVALIDATE/REHABILITATE command in case of ICC card |
|
2322 |
// ----------------------------------------------------------------------------- |
|
2323 |
// |
|
2324 |
void CMmSecurityMessHandler::FdnStateCommandResp( |
|
2325 |
TInt aStatus, |
|
2326 |
const TDesC8& aFileData ) |
|
2327 |
{ |
|
2328 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::SendFdnStateCommand"); |
|
2329 |
OstTrace0( TRACE_NORMAL, CMMSECURITYMESSHANDLER_FDNSTATECOMMANDRESP, "CMmSecurityMessHandler::FdnStateCommandResp" ); |
|
2330 |
||
2331 |
if( UICC_STATUS_OK == aStatus ) |
|
2332 |
{ |
|
2333 |
// get the status word |
|
2334 |
TUint8 sw1( aFileData[aFileData.Length() - KSw1Position] ); |
|
2335 |
TUint8 sw2( aFileData[aFileData.Length() - KSw2Position] ); |
|
2336 |
||
2337 |
TFLOGSTRING3("TSY: CMmSecurityMessHandler::SendFdnStateCommand: sw1: 0x%x, sw2: 0x%x", sw1, sw2); |
|
2338 |
OstTraceExt2( TRACE_NORMAL, DUP1_CMMSECURITYMESSHANDLER_FDNSTATECOMMANDRESP, "CMmSecurityMessHandler::FdnStateCommandResp: sw1: 0x%x, sw2: 0x%x", sw1, sw2 ); |
|
2339 |
||
2340 |
TInt ret( KErrGeneral ); |
|
2341 |
||
2342 |
if( ( 0x90 == sw1 && 0x00 == sw2 ) || |
|
2343 |
( 0x91 == sw1 ) ) |
|
2344 |
{ |
|
2345 |
ret = KErrNone; |
|
2346 |
} |
|
2347 |
else if( 0x69 == sw1 ) |
|
2348 |
{ |
|
2349 |
ret = KErrAccessDenied; |
|
2350 |
} |
|
2351 |
iMessageRouter->Complete( EMobilePhoneSetFdnSetting, ret ); |
|
2352 |
} |
|
2353 |
else |
|
2354 |
{ |
|
2355 |
TFLOGSTRING2("TSY: CMmSecurityMessHandler::SendFdnStateCommand, Fdn state set failed: 0x%x", aStatus); |
|
2356 |
OstTrace1( TRACE_NORMAL, DUP2_CMMSECURITYMESSHANDLER_FDNSTATECOMMANDRESP, "CMmSecurityMessHandler::FdnStateCommandResp, Fdn state set failed: 0x%x", aStatus ); |
|
2357 |
iMessageRouter->Complete( EMobilePhoneSetFdnSetting, KErrGeneral ); |
|
2358 |
} |
|
2359 |
} |
|
2360 |
||
2361 |
// ----------------------------------------------------------------------------- |
|
2362 |
// CMmSecurityMessHandler::ReadEfAdnFileInfo |
|
2363 |
// Sends file info request for EFadn in case of ICC card |
|
2364 |
// ----------------------------------------------------------------------------- |
|
2365 |
// |
|
2366 |
TInt CMmSecurityMessHandler::ReadEfAdnFileInfo( TUiccTrId aTraId ) |
|
2367 |
{ |
|
2368 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::ReadEfAdnFileInfo"); |
|
2369 |
OstTrace0( TRACE_NORMAL, CMMSECURITYMESSHANDLER_READEFADNFILEINFO, "CMmSecurityMessHandler::ReadEfAdnFileInfo" ); |
|
2370 |
||
2371 |
TUiccApplFileInfo params; |
|
2372 |
params.messHandlerPtr = static_cast<MUiccOperationBase*>( this ); |
|
2373 |
params.serviceType = UICC_APPL_FILE_INFO; |
|
2374 |
params.fileId = KElemAdnIcc; |
|
2375 |
params.fileIdSfi = UICC_SFI_NOT_PRESENT; |
|
2376 |
params.filePath.Append( KMasterFileId >> 8 ); |
|
2377 |
params.filePath.Append( KMasterFileId ); |
|
2378 |
params.filePath.Append( iMmUiccMessHandler->GetApplicationFileId() ); |
|
2379 |
params.trId = aTraId; |
|
2380 |
||
2381 |
return iMmUiccMessHandler->CreateUiccApplCmdReq( params ); |
|
2382 |
} |
|
2383 |
||
2384 |
// ----------------------------------------------------------------------------- |
|
2385 |
// CMmSecurityMessHandler::FdnSetReadEfAdnFileInfoResp |
|
2386 |
// Handles response for file info reading for EFadn in case of ICC card |
|
2387 |
// when FDN state is set |
|
2388 |
// ----------------------------------------------------------------------------- |
|
2389 |
// |
|
2390 |
void CMmSecurityMessHandler::FdnSetReadEfAdnFileInfoResp( |
|
2391 |
TInt aStatus, |
|
2392 |
const TDesC8& aFileData ) |
|
2393 |
{ |
|
2394 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::FdnSetReadEfAdnFileInfoResp"); |
|
2395 |
OstTrace0( TRACE_NORMAL, CMMSECURITYMESSHANDLER_FDNSETREADEFADNFILEINFORESP, "CMmSecurityMessHandler::FdnSetReadEfAdnFileInfoResp" ); |
|
2396 |
||
2397 |
if( UICC_STATUS_OK == aStatus ) |
|
2398 |
{ |
|
2399 |
// let's check is ADN and FDN supported in EFest |
|
2400 |
if( iMmUiccMessHandler->GetServiceStatus( KIccServiceFdn ) && |
|
2401 |
iMmUiccMessHandler->GetServiceStatus( KIccServiceAdn ) ) |
|
2402 |
{ |
|
2403 |
// let's check the current FDN status. |
|
2404 |
// If EFadn is invalidated, FDN is enabled, otherwise FDN |
|
2405 |
// is disabled |
|
5
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
2406 |
TFci fci( aFileData ); |
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
2407 |
TUint8 invalidationFlag( fci.GetFileStatus() & KInvalidateFlagMask ); |
0 | 2408 |
|
2409 |
if( ( KInvalidated == invalidationFlag && |
|
2410 |
RMobilePhone::EFdnSetOn == iFdnSetting ) || |
|
2411 |
( KNotInvalidated == invalidationFlag && |
|
2412 |
RMobilePhone::EFdnSetOff == iFdnSetting ) ) |
|
2413 |
{ |
|
2414 |
// Current FDN state is already correct, so we can |
|
2415 |
// complete the request |
|
2416 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::FdnSetReadEfAdnFileInfoResp: FDN state already correct, let's complete"); |
|
2417 |
OstTrace0( TRACE_NORMAL, DUP2_CMMSECURITYMESSHANDLER_FDNSETREADEFADNFILEINFORESP, "CMmSecurityMessHandler::FdnSetReadEfAdnFileInfoResp: FDN state already correct, let's complete" ); |
|
2418 |
iMessageRouter->Complete( EMobilePhoneSetFdnSetting, KErrNone ); |
|
2419 |
} |
|
2420 |
else |
|
2421 |
{ |
|
2422 |
// Current FDN state is not correct, we need to change it |
|
2423 |
SendFdnStateCommand(); |
|
2424 |
} |
|
2425 |
} |
|
2426 |
else |
|
2427 |
{ |
|
2428 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::FdnSetReadEfAdnFileInfoResp: FDN or ADN not supported in EFsst"); |
|
2429 |
OstTrace0( TRACE_NORMAL, DUP3_CMMSECURITYMESSHANDLER_FDNSETREADEFADNFILEINFORESP, "CMmSecurityMessHandler::FdnSetReadEfAdnFileInfoResp: FDN or ADN not supported in EFsst" ); |
|
2430 |
||
2431 |
iMessageRouter->Complete( EMobilePhoneSetFdnSetting, KErrNotSupported ); |
|
2432 |
} |
|
2433 |
} |
|
2434 |
else |
|
2435 |
{ |
|
2436 |
TFLOGSTRING2("TSY: CMmSecurityMessHandler::FdnSetReadEfAdnFileInfoResp: reading failed: 0x%x", aStatus); |
|
2437 |
OstTrace1( TRACE_NORMAL, DUP1_CMMSECURITYMESSHANDLER_FDNSETREADEFADNFILEINFORESP, "CMmSecurityMessHandler::FdnSetReadEfAdnFileInfoResp: reading failed: 0x%x", aStatus ); |
|
2438 |
||
2439 |
iMessageRouter->Complete( EMobilePhoneSetFdnSetting, KErrNotSupported ); |
|
2440 |
} |
|
2441 |
} |
|
2442 |
||
2443 |
// ----------------------------------------------------------------------------- |
|
2444 |
// CMmSecurityMessHandler::FdnGetReadEfAdnFileInfoResp |
|
2445 |
// Handles response for file info reading for EFadn in case of ICC card |
|
2446 |
// when FDN state is get |
|
2447 |
// ----------------------------------------------------------------------------- |
|
2448 |
// |
|
2449 |
void CMmSecurityMessHandler::FdnGetReadEfAdnFileInfoResp( |
|
2450 |
TInt aStatus, |
|
2451 |
const TDesC8& aFileData ) |
|
2452 |
{ |
|
2453 |
TFLOGSTRING("TSY: CMmSecurityMessHandler::FdnGetReadEfAdnFileInfoResp"); |
|
2454 |
OstTrace0( TRACE_NORMAL, CMMSECURITYMESSHANDLER_FDNGETREADEFADNFILEINFORESP, "CMmSecurityMessHandler::FdnGetReadEfAdnFileInfoResp" ); |
|
2455 |
||
2456 |
RMobilePhone::TMobilePhoneFdnStatus fdnSetting( RMobilePhone::EFdnNotActive ); |
|
2457 |
||
2458 |
if( UICC_STATUS_OK == aStatus ) |
|
2459 |
{ |
|
2460 |
if( iMmUiccMessHandler->GetServiceStatus( KIccServiceFdn ) && |
|
2461 |
iMmUiccMessHandler->GetServiceStatus( KIccServiceAdn ) ) |
|
2462 |
{ |
|
5
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
2463 |
TFci fci( aFileData ); |
8ccc39f9d787
New release based on our 2010wk02 release
mikaruus <mika.a.ruuskanen@nokia.com>
parents:
0
diff
changeset
|
2464 |
TUint8 invalidationFlag( fci.GetFileStatus() & KInvalidateFlagMask ); |
0 | 2465 |
|
2466 |
if( KInvalidated == invalidationFlag ) |
|
2467 |
{ |
|
2468 |
fdnSetting = RMobilePhone::EFdnActive; |
|
2469 |
} |
|
2470 |
// no else because of FDN is not active and fdnSetting is |
|
2471 |
// already set to this value. |
|
2472 |
} |
|
2473 |
else |
|
2474 |
{ |
|
2475 |
fdnSetting = RMobilePhone::EFdnNotSupported; |
|
2476 |
} |
|
2477 |
||
2478 |
CMmDataPackage dataPackage; |
|
2479 |
dataPackage.PackData ( &fdnSetting ); |
|
2480 |
// Complete the status to the client |
|
2481 |
iMessageRouter->Complete( EMobilePhoneGetFdnStatus, &dataPackage, KErrNone ); |
|
2482 |
} |
|
2483 |
else |
|
2484 |
{ |
|
2485 |
TFLOGSTRING2("TSY: CMmSecurityMessHandler::FdnGetReadEfAdnFileInfoResp: reading failed: 0x%x", aStatus); |
|
2486 |
OstTrace1( TRACE_NORMAL, DUP1_CMMSECURITYMESSHANDLER_FDNGETREADEFADNFILEINFORESP, "CMmSecurityMessHandler::FdnGetReadEfAdnFileInfoResp: reading failed: 0x%x", aStatus ); |
|
2487 |
||
2488 |
fdnSetting = RMobilePhone::EFdnNotSupported; |
|
2489 |
CMmDataPackage dataPackage; |
|
2490 |
dataPackage.PackData ( &fdnSetting ); |
|
2491 |
iMessageRouter->Complete( EMobilePhoneGetFdnStatus, &dataPackage, KErrNotSupported ); |
|
2492 |
} |
|
2493 |
} |
|
2494 |
||
2495 |
// End of File |