1 /* |
|
2 * Copyright (c) 2002-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: Specific class for Security tests |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 // INCLUDE FILES |
|
22 #include <e32svr.h> |
|
23 #include <stifparser.h> |
|
24 #include <stiftestinterface.h> |
|
25 #include "security.h" |
|
26 #include <ctsy/serviceapi/cmmsmsutility.h> |
|
27 #include <ctsy/rmmcustomapi.h> |
|
28 |
|
29 // TICCType enumerates the SIM card types |
|
30 enum TICCType |
|
31 { |
|
32 EICCTypeSim2GGsm, |
|
33 EICCTypeSim3G, |
|
34 EICCTypeSimUnknown |
|
35 }; |
|
36 |
|
37 |
|
38 // CONSTANTS |
|
39 // copied from CMmCustomSecurityTsy.h |
|
40 const TUint8 KSecCodeNone = 0x00; |
|
41 const TUint8 KSecCodeSecurity = 0x01; |
|
42 const TUint8 KSecCodePin = 0x02; |
|
43 const TUint8 KSecCodePuk = 0x03; |
|
44 const TUint8 KSecCodePin2 = 0x04; |
|
45 const TUint8 KSecCodePuk2 = 0x05; |
|
46 const TUint8 KSecCodeLock = 0x06; |
|
47 const TUint8 KSecCodeUpin = 0x07; |
|
48 const TUint8 KSecCodeUpuk = 0x08; |
|
49 const TUint8 KSecCodeSubstitutePin = 0x09; |
|
50 const TUint8 KSecCodeSubstitutePinUniversal = 0x0A; |
|
51 const TUint8 KSecCodeNotApplicable = 0x63; |
|
52 |
|
53 // LOCAL FUNCTIONS |
|
54 |
|
55 // ----------------------------------------------------------------------------- |
|
56 // GetSecurityCode |
|
57 // ----------------------------------------------------------------------------- |
|
58 // |
|
59 static TInt GetSecurityCode( |
|
60 CStifItemParser& aItem, |
|
61 RMobilePhone::TMobilePhoneSecurityCode &aSecurityCode ) |
|
62 { |
|
63 // security code enum |
|
64 TPtrC string; |
|
65 TInt ret( aItem.GetNextString( string ) ); |
|
66 |
|
67 if ( KErrNone == ret ) |
|
68 { |
|
69 if ( string == _L("ESecurityCodePin1") ) |
|
70 { |
|
71 aSecurityCode = RMobilePhone::ESecurityCodePin1; |
|
72 } |
|
73 else if ( string == _L("ESecurityCodePin2") ) |
|
74 { |
|
75 aSecurityCode = RMobilePhone::ESecurityCodePin2; |
|
76 } |
|
77 else if ( string == _L("ESecurityCodePuk1") ) |
|
78 { |
|
79 aSecurityCode = RMobilePhone::ESecurityCodePuk1; |
|
80 } |
|
81 else if ( string == _L("ESecurityCodePuk2") ) |
|
82 { |
|
83 aSecurityCode = RMobilePhone::ESecurityCodePuk2; |
|
84 } |
|
85 else if ( string == _L("ESecurityCodePhonePassword") ) |
|
86 { |
|
87 aSecurityCode = RMobilePhone::ESecurityCodePhonePassword; |
|
88 } |
|
89 else if ( string == _L("ESecurityCodeSPC") ) |
|
90 { |
|
91 aSecurityCode = RMobilePhone::ESecurityCodeSPC; |
|
92 } |
|
93 else if ( string == _L("ESecurityHiddenKey") ) |
|
94 { |
|
95 aSecurityCode = RMobilePhone::ESecurityHiddenKey; |
|
96 } |
|
97 else if ( string == _L("ESecurityUSIMAppPin") ) |
|
98 { |
|
99 aSecurityCode = RMobilePhone::ESecurityUSIMAppPin; |
|
100 } |
|
101 else if ( string == _L("ESecuritySecondUSIMAppPin") ) |
|
102 { |
|
103 aSecurityCode = RMobilePhone::ESecuritySecondUSIMAppPin; |
|
104 } |
|
105 else if ( string == _L("ESecurityUniversalPin") ) |
|
106 { |
|
107 aSecurityCode = RMobilePhone::ESecurityUniversalPin; |
|
108 } |
|
109 else if ( string == _L("ESecurityUniversalPuk") ) |
|
110 { |
|
111 aSecurityCode = RMobilePhone::ESecurityUniversalPuk; |
|
112 } |
|
113 else |
|
114 { |
|
115 ret = KErrArgument; |
|
116 } |
|
117 } |
|
118 //no else |
|
119 |
|
120 return ret; |
|
121 } |
|
122 |
|
123 // ----------------------------------------------------------------------------- |
|
124 // GetCodeID |
|
125 // ----------------------------------------------------------------------------- |
|
126 // |
|
127 static TInt GetCodeID( |
|
128 CStifItemParser& aItem, |
|
129 TUint8 &aCode ) |
|
130 { |
|
131 TPtrC string; |
|
132 TInt ret( aItem.GetNextString( string ) ); |
|
133 |
|
134 if ( KErrNone == ret ) |
|
135 { |
|
136 if ( _L("KSecCodeNone") == string ) |
|
137 { |
|
138 aCode = KSecCodeNone; |
|
139 } |
|
140 else if ( _L("KSecCodeSecurity") == string ) |
|
141 { |
|
142 aCode = KSecCodeSecurity; |
|
143 } |
|
144 else if ( _L("KSecCodePin") == string ) |
|
145 { |
|
146 aCode = KSecCodePin; |
|
147 } |
|
148 else if ( _L("KSecCodePuk") == string ) |
|
149 { |
|
150 aCode = KSecCodePuk; |
|
151 } |
|
152 else if ( _L("KSecCodePin2") == string ) |
|
153 { |
|
154 aCode = KSecCodePin2; |
|
155 } |
|
156 else if ( _L("KSecCodePuk2") == string ) |
|
157 { |
|
158 aCode = KSecCodePuk2; |
|
159 } |
|
160 else if ( _L("KSecCodeLock") == string ) |
|
161 { |
|
162 aCode = KSecCodeLock; |
|
163 } |
|
164 else if ( _L("KSecCodeUpin") == string ) |
|
165 { |
|
166 aCode = KSecCodeUpin; |
|
167 } |
|
168 else if ( _L("KSecCodeUpuk") == string ) |
|
169 { |
|
170 aCode = KSecCodeUpuk; |
|
171 } |
|
172 else if ( _L("KSecCodeSubstitutePin") == string ) |
|
173 { |
|
174 aCode = KSecCodeSubstitutePin; |
|
175 } |
|
176 else if ( _L("KSecCodeSubstitutePinUniversal") == string ) |
|
177 { |
|
178 aCode = KSecCodeSubstitutePinUniversal; |
|
179 } |
|
180 else if ( _L("KSecCodeNotApplicable") == string ) |
|
181 { |
|
182 aCode = KSecCodeNotApplicable; |
|
183 } |
|
184 else |
|
185 { |
|
186 ret = KErrArgument; |
|
187 } |
|
188 } |
|
189 //no else |
|
190 |
|
191 return ret; |
|
192 } |
|
193 |
|
194 // ============================ MEMBER FUNCTIONS =============================== |
|
195 |
|
196 // ----------------------------------------------------------------------------- |
|
197 // CSecurity::Delete |
|
198 // Delete here all resources allocated and opened from test methods. |
|
199 // Called from destructor. |
|
200 // ----------------------------------------------------------------------------- |
|
201 // |
|
202 void CSecurity::Delete() |
|
203 { |
|
204 _LIT8( KLog, "CSecurity::Delete" ); |
|
205 iSecurityLog->Log( ( TDesC8 ) KLog ); |
|
206 } |
|
207 |
|
208 // ----------------------------------------------------------------------------- |
|
209 // CSecurity::RunMethodL |
|
210 // Run specified method. Contains also table of test mothods and their names. |
|
211 // ----------------------------------------------------------------------------- |
|
212 // |
|
213 TInt CSecurity::RunMethodL( |
|
214 CStifItemParser& aItem ) |
|
215 { |
|
216 _LIT8( KLog, "CSecurity::RunMethodL" ); |
|
217 iSecurityLog->Log( ( TDesC8 ) KLog ); |
|
218 |
|
219 static TStifFunctionInfo const KFunctions[] = |
|
220 { |
|
221 ENTRY( "RunIscTestCase", CCore::RunIscTestCase ), |
|
222 ENTRY( "SyncIscTestCase", CCore::SyncIscTestCase ), |
|
223 ENTRY( "HandleSpecifiedRequests", CCore::HandleSpecifiedRequests), |
|
224 ENTRY( "InitializeIPCRequestTable", CCore::InitializeIPCRequestTable), |
|
225 ENTRY( "SetExpectedCompleteIPC", CCore::SetExpectedCompleteIPC), |
|
226 ENTRY( "DeliverCode", CSecurity::DeliverCodeL ), |
|
227 ENTRY( "IsBlocked", CSecurity::IsBlockedL ), |
|
228 ENTRY( "CheckSecurityCode", CSecurity::CheckSecurityCodeL ), |
|
229 ENTRY( "CheckSecurityCodeCancel", CSecurity::CheckSecurityCodeCancelL ), |
|
230 ENTRY( "DisablePhoneLock", CSecurity::DisablePhoneLockL ), |
|
231 ENTRY( "SimGetICCType", CSecurity::SimGetICCTypeL ), |
|
232 ENTRY( "BootNotifyModemStatusReady", CSecurity::BootNotifyModemStatusReady ), |
|
233 ENTRY( "BootNotifySimStatusReady", CSecurity::BootNotifySimStatusReady ), |
|
234 ENTRY( "BootNotifySecurityReady", CSecurity::BootNotifySecurityReady ), |
|
235 ENTRY( "BootGetRFStatus", CSecurity::BootGetRFStatusL ), |
|
236 ENTRY( "PhoneGetPin1DisableSupported", CSecurity::PhoneGetPin1DisableSupportedL ), |
|
237 ENTRY( "SecurityGetSimActivePinState", CSecurity::SecurityGetSimActivePinStateL ), |
|
238 ENTRY( "GetLockInfo", CSecurity::GetLockInfoL ), |
|
239 ENTRY( "NotifyLockInfoChange", CSecurity::NotifyLockInfoChange ), |
|
240 ENTRY( "SetLockSetting", CSecurity::SetLockSettingL ), |
|
241 ENTRY( "ChangeSecurityCode", CSecurity::ChangeSecurityCodeL ), |
|
242 ENTRY( "NotifySecurityEvent", CSecurity::NotifySecurityEvent ), |
|
243 ENTRY( "VerifySecurityCode", CSecurity::VerifySecurityCodeL ), |
|
244 ENTRY( "AbortSecurityCode", CSecurity::AbortSecurityCodeL ), |
|
245 ENTRY( "SimGetFdnStatus", CSecurity::SimGetFdnStatusL ), |
|
246 ENTRY( "SimSetFdnStatus", CSecurity::SimSetFdnStatusL ), |
|
247 ENTRY( "SecurityInfo", CSecurity::SecurityInfoL ), |
|
248 ENTRY( "GetCurrentActiveUSIMApplication", CSecurity::GetCurrentActiveUSIMApplication), |
|
249 |
|
250 }; |
|
251 |
|
252 const TInt count = sizeof( KFunctions ) / sizeof( TStifFunctionInfo ); |
|
253 |
|
254 return RunInternalL( KFunctions, count, aItem ); |
|
255 } |
|
256 |
|
257 // ----------------------------------------------------------------------------- |
|
258 // CSecurity::DeliverCodeL |
|
259 // ----------------------------------------------------------------------------- |
|
260 // |
|
261 TInt CSecurity::DeliverCodeL( |
|
262 CStifItemParser& aItem ) |
|
263 { |
|
264 _LIT8( KLog, "CSecurity::DeliverCodeL" ); |
|
265 iSecurityLog->Log( ( TDesC8 ) KLog ); |
|
266 |
|
267 TPtrC string; |
|
268 // 1st parameter: code to deliver |
|
269 TInt ret( aItem.GetNextString( string ) ); |
|
270 |
|
271 if ( KErrNone == ret ) |
|
272 { |
|
273 CMmDataPackage package; |
|
274 iSecCode.Copy( string ); |
|
275 package.PackData( &iSecCode ); |
|
276 ret = HandleRequestL( ECustomSecurityDeliverCodeIPC, &package ); |
|
277 } |
|
278 //no else |
|
279 |
|
280 // Signal completion, because deliver doesn't have corresponding complete |
|
281 Signal( ret ); |
|
282 |
|
283 return ret; |
|
284 } |
|
285 |
|
286 // ----------------------------------------------------------------------------- |
|
287 // CSecurity::IsBlockedL |
|
288 // ----------------------------------------------------------------------------- |
|
289 // |
|
290 TInt CSecurity::IsBlockedL( |
|
291 CStifItemParser& aItem ) |
|
292 { |
|
293 _LIT8( KLog, "CSecurity::IsBlockedL" ); |
|
294 iSecurityLog->Log( ( TDesC8 ) KLog ); |
|
295 |
|
296 TInt ret( KErrNone ); |
|
297 |
|
298 // 1st parameter: codeID |
|
299 // commontsy can send (const TUint8): |
|
300 // KSecCodeSecurity = 0x01 |
|
301 // KSecCodePin = 0x02 |
|
302 // KSecCodePin2 = 0x04 |
|
303 // KSecCodeUpin = 0x07 |
|
304 ret = GetCodeID( aItem, iCodeID ); |
|
305 |
|
306 // 2nd parameter: expected result |
|
307 // NokiaTSY sends: ETrue or EFalse |
|
308 TPtrC string; |
|
309 ret = aItem.GetNextString( string ); |
|
310 if ( KErrNone == ret ) |
|
311 { |
|
312 if ( string == _L("ETrue") ) |
|
313 { |
|
314 iIsBlockedExpected = ETrue; |
|
315 } |
|
316 else if ( string == _L("EFalse") ) |
|
317 { |
|
318 iIsBlockedExpected = EFalse; |
|
319 } |
|
320 else |
|
321 { |
|
322 ret = KErrArgument; |
|
323 } |
|
324 } |
|
325 //no else |
|
326 |
|
327 if ( KErrNone == ret ) |
|
328 { |
|
329 CMmDataPackage package; |
|
330 package.PackData( &iCodeID ); |
|
331 ret = HandleRequestL( ECustomIsBlockedIPC, &package ); |
|
332 } |
|
333 //no else |
|
334 |
|
335 return ret; |
|
336 } |
|
337 |
|
338 // ----------------------------------------------------------------------------- |
|
339 // CSecurity::CompleteIsBlocked |
|
340 // ----------------------------------------------------------------------------- |
|
341 // |
|
342 void CSecurity::CompleteIsBlocked( |
|
343 TInt aErr, |
|
344 CMmDataPackage& aData ) |
|
345 { |
|
346 _LIT8( KLog, "CSecurity::CompleteIsBlocked, err = %d" ); |
|
347 iSecurityLog->Log( ( TDesC8 ) KLog, aErr ); |
|
348 |
|
349 if ( KErrNone == aErr ) |
|
350 { |
|
351 TBool isBlocked( EFalse ); |
|
352 aData.UnPackData ( isBlocked ); |
|
353 if ( iIsBlockedExpected != isBlocked ) |
|
354 { |
|
355 _LIT8( KFail, |
|
356 "CSecurity::CompleteIsBlocked, Failed, wrong result (%d), expected (%d)" ); |
|
357 iSecurityLog->Log( ( TDesC8 ) KFail, |
|
358 TInt( isBlocked ), TInt( iIsBlockedExpected ) ); |
|
359 |
|
360 aErr = KErrGeneral; |
|
361 } |
|
362 //no else |
|
363 } |
|
364 else |
|
365 { |
|
366 _LIT8( KLog, "CSecurity::CompleteIsBlocked, err = %d" ); |
|
367 iSecurityLog->Log( ( TDesC8 ) KLog, aErr ); |
|
368 } |
|
369 |
|
370 Signal( aErr ); |
|
371 } |
|
372 |
|
373 // ----------------------------------------------------------------------------- |
|
374 // CSecurity::CheckSecurityCodeL |
|
375 // ----------------------------------------------------------------------------- |
|
376 // |
|
377 TInt CSecurity::CheckSecurityCodeL( |
|
378 CStifItemParser& aItem ) |
|
379 { |
|
380 _LIT8( KLog, "CSecurity::CheckSecurityCodeL" ); |
|
381 iSecurityLog->Log( ( TDesC8 ) KLog ); |
|
382 |
|
383 TInt ret( KErrNone ); |
|
384 |
|
385 // 1st parameter: codeID |
|
386 // commontsy can send (const TUint8): |
|
387 // KSecCodeSecurity = 0x01 |
|
388 // KSecCodePin = 0x02 |
|
389 // KSecCodePin2 = 0x04 |
|
390 // KSecCodePuk = 0x03 |
|
391 // KSecCodePuk2 = 0x05 |
|
392 ret = GetCodeID( aItem, iCodeID ); |
|
393 |
|
394 // 2nd argument, expected result |
|
395 if ( KErrNone == ret ) |
|
396 { |
|
397 CMmDataPackage package; |
|
398 package.PackData( &iCodeID, &iSecCode ); |
|
399 ret = HandleRequestL( ECustomCheckSecurityCodeIPC, &package ); |
|
400 } |
|
401 //no else |
|
402 |
|
403 return ret; |
|
404 } |
|
405 |
|
406 // ----------------------------------------------------------------------------- |
|
407 // CSecurity::CompleteCheckSecurityCode |
|
408 // ----------------------------------------------------------------------------- |
|
409 // |
|
410 void CSecurity::CompleteCheckSecurityCode( |
|
411 TInt aErr, |
|
412 CMmDataPackage& /*aData*/ ) |
|
413 { |
|
414 _LIT8( KLog, "CSecurity::CompleteCheckSecurityCode, err = %d" ); |
|
415 iSecurityLog->Log( ( TDesC8 ) KLog, aErr ); |
|
416 |
|
417 // If error is not KErrNone, then security code verify has failed and |
|
418 // we need to cancel SEC_CODE_GET_REQ. |
|
419 // If error is KErrCancel, we have already cancelled SEC_CODE_GET_REQ. |
|
420 if ( ( KErrNone != aErr ) && ( KErrCancel != aErr ) && ( KErrAbort != aErr )) |
|
421 { |
|
422 _LIT8( KFailed, "CSecurity::CompleteCheckSecurityCode, Failed, call cancel" ); |
|
423 iSecurityLog->Log( ( TDesC8 ) KFailed ); |
|
424 |
|
425 TBool cancelFalse( EFalse ); |
|
426 CMmDataPackage package; |
|
427 package.PackData( &iCodeID, &cancelFalse ); |
|
428 TRAP_IGNORE( |
|
429 HandleRequestL( ECustomCheckSecurityCodeCancelIPC, &package ); |
|
430 ); |
|
431 } |
|
432 else |
|
433 { |
|
434 _LIT8( KComplete, "CSecurity::CompleteCheckSecurityCode, completed" ); |
|
435 iSecurityLog->Log( ( TDesC8 ) KComplete ); |
|
436 } |
|
437 |
|
438 Signal( aErr ); |
|
439 } |
|
440 |
|
441 // ----------------------------------------------------------------------------- |
|
442 // CSecurity::DisablePhoneLockL |
|
443 // ----------------------------------------------------------------------------- |
|
444 // |
|
445 TInt CSecurity::DisablePhoneLockL( |
|
446 CStifItemParser& aItem ) |
|
447 { |
|
448 _LIT8( KLog, "CSecurity::DisablePhoneLockL" ); |
|
449 iSecurityLog->Log( ( TDesC8 ) KLog ); |
|
450 |
|
451 TInt ret( KErrNone ); |
|
452 |
|
453 /** the standard password used by mobile phones for secure access |
|
454 to services (phone lock, SIM lock, call barring password). The password |
|
455 is coded as Unicode characters. */ |
|
456 TPtrC string; |
|
457 ret = aItem.GetNextString( string ); |
|
458 |
|
459 if ( KErrNone == ret ) |
|
460 { |
|
461 RMobilePhone::TMobilePassword verifyCode; |
|
462 verifyCode.Copy( string ); |
|
463 |
|
464 CMmDataPackage package; |
|
465 package.PackData( &verifyCode ); |
|
466 |
|
467 ret = HandleRequestL( ECustomDisablePhoneLockIPC, &package ); |
|
468 } |
|
469 //no else |
|
470 |
|
471 return ret; |
|
472 } |
|
473 |
|
474 // ----------------------------------------------------------------------------- |
|
475 // CSecurity::CompleteDisablePhoneLock |
|
476 // ----------------------------------------------------------------------------- |
|
477 // |
|
478 void CSecurity::CompleteDisablePhoneLock( |
|
479 TInt aErr, |
|
480 CMmDataPackage& /*aData*/ ) |
|
481 { |
|
482 _LIT8( KLog, "CSecurity::CompleteDisablePhoneLock, err = %d" ); |
|
483 iSecurityLog->Log( ( TDesC8 ) KLog, aErr ); |
|
484 |
|
485 Signal( aErr ); |
|
486 } |
|
487 |
|
488 // ----------------------------------------------------------------------------- |
|
489 // CSecurity::CheckSecurityCodeL |
|
490 // ----------------------------------------------------------------------------- |
|
491 // |
|
492 TInt CSecurity::CheckSecurityCodeCancelL( |
|
493 CStifItemParser& aItem ) |
|
494 { |
|
495 _LIT8( KLog, "CSecurity::CheckSecurityCodeCancelL" ); |
|
496 iSecurityLog->Log( ( TDesC8 ) KLog ); |
|
497 |
|
498 TInt ret( KErrNone ); |
|
499 |
|
500 // 1st parameter: codeID |
|
501 ret = GetCodeID( aItem, iCodeID ); |
|
502 |
|
503 if ( KErrNone == ret ) |
|
504 { |
|
505 // Send message to Security Server to check security code and |
|
506 // intialize ret value. This is cancel request, so 3rd parameter |
|
507 // is true to indicate that. |
|
508 CMmDataPackage package; |
|
509 TBool trueCancel( ETrue ); |
|
510 package.PackData( &iCodeID, &trueCancel ); |
|
511 HandleRequestL( ECustomCheckSecurityCodeCancelIPC, &package ); |
|
512 } |
|
513 //no else |
|
514 |
|
515 return ret; |
|
516 } |
|
517 |
|
518 // ----------------------------------------------------------------------------- |
|
519 // CSecurity::CompleteCheckSecurityCodeCancel |
|
520 // ----------------------------------------------------------------------------- |
|
521 // |
|
522 void CSecurity::CompleteCheckSecurityCodeCancel( |
|
523 TInt aErr, |
|
524 CMmDataPackage& /*aData*/ ) |
|
525 { |
|
526 _LIT8( KLog, "CSecurity::CompleteCheckSecurityCodeCancel, err = %d" ); |
|
527 iSecurityLog->Log( ( TDesC8 ) KLog, aErr ); |
|
528 |
|
529 Signal( aErr ); |
|
530 } |
|
531 |
|
532 // ----------------------------------------------------------------------------- |
|
533 // CSecurity::SimGetICCTypeL |
|
534 // ----------------------------------------------------------------------------- |
|
535 // |
|
536 TInt CSecurity::SimGetICCTypeL( |
|
537 CStifItemParser& /*aItem*/ ) |
|
538 { |
|
539 _LIT8( KLog, "CSecurity::SimGetICCTypeL" ); |
|
540 iSecurityLog->Log( ( TDesC8 ) KLog ); |
|
541 |
|
542 TInt ret( KErrNone ); |
|
543 |
|
544 ret = HandleRequestL( EMmTsySimGetICCType ); |
|
545 |
|
546 return ret; |
|
547 } |
|
548 |
|
549 // ----------------------------------------------------------------------------- |
|
550 // CSecurity::CompleteGetICCType |
|
551 // ----------------------------------------------------------------------------- |
|
552 // |
|
553 void CSecurity::CompleteSimGetICCType( |
|
554 TInt aErr, |
|
555 CMmDataPackage& aData ) |
|
556 { |
|
557 _LIT8( KLog, "CSecurity::CompleteGetSimICCType, err = %d" ); |
|
558 iSecurityLog->Log( ( TDesC8 ) KLog, aErr ); |
|
559 |
|
560 //unpack the data |
|
561 TICCType* simType = NULL; |
|
562 aData.UnPackData( &simType ); |
|
563 |
|
564 switch( *simType ) |
|
565 { |
|
566 case EICCTypeSim2GGsm: |
|
567 { |
|
568 _LIT8( KICCType, |
|
569 "CSecurity::CompleteGetSimICCType, type = EICCTypeSim2GGsm" ); |
|
570 iSecurityLog->Log( ( TDesC8 ) KICCType ); |
|
571 break; |
|
572 } |
|
573 case EICCTypeSim3G: |
|
574 { |
|
575 _LIT8( KICCType, |
|
576 "CSecurity::CompleteGetSimICCType, type = EICCTypeSim3G" ); |
|
577 iSecurityLog->Log( ( TDesC8 ) KICCType ); |
|
578 break; |
|
579 } |
|
580 case EICCTypeSimUnknown: |
|
581 { |
|
582 _LIT8( KICCType, |
|
583 "CSecurity::CompleteGetSimICCType, type = EICCTypeSimUnknown" ); |
|
584 iSecurityLog->Log( ( TDesC8 ) KICCType ); |
|
585 break; |
|
586 } |
|
587 default: |
|
588 { |
|
589 _LIT8( KICCType, |
|
590 "CSecurity::CompleteGetSimICCType, type unknown = %d" ); |
|
591 iSecurityLog->Log( ( TDesC8 ) KICCType, TInt( *simType ) ); |
|
592 aErr = KErrGeneral; |
|
593 break; |
|
594 } |
|
595 } |
|
596 |
|
597 Signal( aErr ); |
|
598 } |
|
599 |
|
600 // ----------------------------------------------------------------------------- |
|
601 // CSecurity::GetCurrentActiveUSIMApplication |
|
602 // Get current active USIM application |
|
603 // ----------------------------------------------------------------------------- |
|
604 // |
|
605 TInt CSecurity::GetCurrentActiveUSIMApplication( CStifItemParser& aItem ) |
|
606 { |
|
607 iSecurityLog->Log(_L8("CSecurity::GetCurrentActiveUSIMApplication")); |
|
608 TPtrC string; |
|
609 aItem.GetNextString( string ); |
|
610 |
|
611 TInt ret( KErrNone ); |
|
612 |
|
613 ret = HandleRequestL( EMobilePhoneGetCurrentActiveUSimApplication ); |
|
614 |
|
615 if ( KErrNone == ret ) |
|
616 { |
|
617 _LIT8( KSendOk, "GetCurrentActiveUSIMApplication request send ok" ); |
|
618 iSecurityLog->Log((TDesC8)KSendOk ); |
|
619 if ( _L("147377136") == string) |
|
620 { |
|
621 iAIDCheckOngoing = ETrue; |
|
622 iActiveID.Append(0xA0); |
|
623 iActiveID.Append(0x00); |
|
624 iActiveID.Append(0x00); |
|
625 iActiveID.Append(0x00); |
|
626 iActiveID.Append(0x87); |
|
627 iActiveID.Append(0x10); |
|
628 iActiveID.Append(0x02); |
|
629 iActiveID.Append(0xFF); |
|
630 iActiveID.Append(0xFF); |
|
631 iActiveID.Append(0xFF); |
|
632 iActiveID.Append(0xFF); |
|
633 iActiveID.Append(0x89); |
|
634 iActiveID.Append(0x04); |
|
635 iActiveID.Append(0x03); |
|
636 iActiveID.Append(0x00); |
|
637 iActiveID.Append(0xFF); |
|
638 } |
|
639 } |
|
640 else |
|
641 { |
|
642 _LIT8( KSendFailed, "GetCurrentActiveUSIMApplication request send failed: %d" ); |
|
643 iSecurityLog->Log((TDesC8)KSendFailed, ret ); |
|
644 |
|
645 } |
|
646 |
|
647 return ret; |
|
648 |
|
649 } |
|
650 // ----------------------------------------------------------------------------- |
|
651 // CSecurity::CompleteGetCurrentActiveUSIMApplication |
|
652 // Complete GetCurrentActiveUSIMApplication method function. |
|
653 // ----------------------------------------------------------------------------- |
|
654 // |
|
655 void CSecurity::CompleteGetCurrentActiveUSIMApplication |
|
656 ( |
|
657 TInt aResult, |
|
658 CMmDataPackage* aDataPackage |
|
659 ) |
|
660 { |
|
661 _LIT8( KResult, "CompleteGetCurrentActiveUSIMApplication result: %d" ); |
|
662 iSecurityLog->Log((TDesC8)KResult, aResult ); |
|
663 |
|
664 if( KErrNone == aResult && iAIDCheckOngoing ) |
|
665 { |
|
666 // Response information |
|
667 RMobilePhone::TAID* activeAID; |
|
668 //unpack data |
|
669 aDataPackage->UnPackData( &activeAID ); |
|
670 |
|
671 _LIT8( KActiveAID, "ActiveAID = %d" ); |
|
672 iSecurityLog->Log((TDesC8)KActiveAID, activeAID ); |
|
673 iAIDCheckOngoing = EFalse; |
|
674 if ( *activeAID != iActiveID) |
|
675 { |
|
676 aResult = KErrGeneral; |
|
677 } |
|
678 } |
|
679 else if( KErrNone != aResult ) |
|
680 { |
|
681 _LIT8( KFail, "CompleteGetCurrentActiveUSIMApplication Failed: %d" ); |
|
682 iSecurityLog->Log((TDesC8)KFail, aResult ); |
|
683 } |
|
684 |
|
685 Signal( aResult ); |
|
686 } |
|
687 |
|
688 // ----------------------------------------------------------------------------- |
|
689 // CSecurity::BootNotifyModemStatusReady |
|
690 // ----------------------------------------------------------------------------- |
|
691 // |
|
692 TInt CSecurity::BootNotifyModemStatusReady( |
|
693 CStifItemParser& /*aItem*/ ) |
|
694 { |
|
695 _LIT8( KLog, "CSecurity::BootNotifyModemStatusReady" ); |
|
696 iSecurityLog->Log( ( TDesC8 ) KLog ); |
|
697 |
|
698 iBootNotifyModemStatusReadyOngoing = ETrue; |
|
699 |
|
700 return KErrNone; |
|
701 } |
|
702 |
|
703 // ----------------------------------------------------------------------------- |
|
704 // CSecurity::CompleteBootNotifyModemStatusReady |
|
705 // ----------------------------------------------------------------------------- |
|
706 // |
|
707 void CSecurity::CompleteBootNotifyModemStatusReady( |
|
708 TInt aErr, |
|
709 CMmDataPackage& /*aData*/ ) |
|
710 { |
|
711 _LIT8( KLog, "CSecurity::CompleteBootNotifyModemStatusReady, err = %d" ); |
|
712 iSecurityLog->Log( ( TDesC8 ) KLog, aErr ); |
|
713 |
|
714 if ( iBootNotifyModemStatusReadyOngoing || |
|
715 iHandleSpecifiedRequests ) |
|
716 { |
|
717 iBootNotifyModemStatusReadyOngoing = EFalse; |
|
718 |
|
719 _LIT8( KComplete, "CSecurity::CompleteBootNotifyModemStatusReady, completed" ); |
|
720 iSecurityLog->Log( ( TDesC8 ) KComplete ); |
|
721 |
|
722 Signal( aErr ); |
|
723 } |
|
724 //no else |
|
725 } |
|
726 |
|
727 // ----------------------------------------------------------------------------- |
|
728 // CSecurity::BootNotifySimStatusReady |
|
729 // ----------------------------------------------------------------------------- |
|
730 // |
|
731 TInt CSecurity::BootNotifySimStatusReady( |
|
732 CStifItemParser& /*aItem*/ ) |
|
733 { |
|
734 _LIT8( KLog, "CSecurity::BootNotifySimStatusReady" ); |
|
735 iSecurityLog->Log( ( TDesC8 ) KLog ); |
|
736 |
|
737 iBootNotifySimStatusReadyOngoing = ETrue; |
|
738 |
|
739 return KErrNone; |
|
740 } |
|
741 |
|
742 // ----------------------------------------------------------------------------- |
|
743 // CSecurity::CompleteBootNotifySimStatusReady |
|
744 // ----------------------------------------------------------------------------- |
|
745 // |
|
746 void CSecurity::CompleteBootNotifySimStatusReady( |
|
747 TInt aErr, |
|
748 CMmDataPackage& /*aData*/ ) |
|
749 { |
|
750 _LIT8( KLog, "CSecurity::CompleteBootNotifySimStatusReady, err = %d" ); |
|
751 iSecurityLog->Log( ( TDesC8 ) KLog, aErr ); |
|
752 |
|
753 if ( iBootNotifySimStatusReadyOngoing || |
|
754 iHandleSpecifiedRequests ) |
|
755 { |
|
756 iBootNotifySimStatusReadyOngoing = EFalse; |
|
757 _LIT8( KComplete, "CSecurity::CompleteBootNotifySimStatusReady, completed" ); |
|
758 iSecurityLog->Log( ( TDesC8 ) KComplete ); |
|
759 |
|
760 Signal( aErr ); |
|
761 } |
|
762 //no else |
|
763 } |
|
764 |
|
765 // ----------------------------------------------------------------------------- |
|
766 // CSecurity::BootNotifySecurityReady |
|
767 // ----------------------------------------------------------------------------- |
|
768 // |
|
769 TInt CSecurity::BootNotifySecurityReady( |
|
770 CStifItemParser& /*aItem*/ ) |
|
771 { |
|
772 _LIT8( KLog, "CSecurity::BootNotifySecurityReady" ); |
|
773 iSecurityLog->Log( ( TDesC8 ) KLog ); |
|
774 |
|
775 iBootNotifySecurityReadyOngoing = ETrue; |
|
776 |
|
777 return KErrNone; |
|
778 } |
|
779 |
|
780 // ----------------------------------------------------------------------------- |
|
781 // CSecurity::CompleteBootSecurityReady |
|
782 // ----------------------------------------------------------------------------- |
|
783 // |
|
784 void CSecurity::CompleteBootNotifySecurityReady( |
|
785 TInt aErr, |
|
786 CMmDataPackage& /*aData*/ ) |
|
787 { |
|
788 _LIT8( KLog, "CSecurity::CompleteBootSecurityReady, err = %d" ); |
|
789 iSecurityLog->Log( ( TDesC8 ) KLog, aErr ); |
|
790 |
|
791 if ( iBootNotifySecurityReadyOngoing || |
|
792 iHandleSpecifiedRequests ) |
|
793 { |
|
794 iBootNotifySecurityReadyOngoing = EFalse; |
|
795 _LIT8( KComplete, "CSecurity::CompleteBootSecurityReady, completed" ); |
|
796 iSecurityLog->Log( ( TDesC8 ) KComplete ); |
|
797 |
|
798 Signal( aErr ); |
|
799 } |
|
800 //no else |
|
801 } |
|
802 |
|
803 // ----------------------------------------------------------------------------- |
|
804 // CSecurity::BootGetRFStatusL |
|
805 // ----------------------------------------------------------------------------- |
|
806 // |
|
807 TInt CSecurity::BootGetRFStatusL( |
|
808 CStifItemParser& /*aItem*/ ) |
|
809 { |
|
810 _LIT8( KLog, "CSecurity::BootGetRFStatus" ); |
|
811 iSecurityLog->Log( ( TDesC8 ) KLog ); |
|
812 |
|
813 iBootGetRFStatusOngoing = ETrue; |
|
814 |
|
815 TInt ret( HandleRequestL( EMmTsyBootGetRFStatusIPC ) ); |
|
816 |
|
817 return ret; |
|
818 } |
|
819 |
|
820 // ----------------------------------------------------------------------------- |
|
821 // CSecurity::CompleteBootGetRFStatus |
|
822 // ----------------------------------------------------------------------------- |
|
823 // |
|
824 void CSecurity::CompleteBootGetRFStatus( |
|
825 TInt aErr, |
|
826 CMmDataPackage& aData ) |
|
827 { |
|
828 _LIT8( KLog, "CSecurity::CompleteBootGetRFStatus, err = %d" ); |
|
829 iSecurityLog->Log( ( TDesC8 ) KLog, aErr ); |
|
830 |
|
831 if ( iBootGetRFStatusOngoing || |
|
832 iHandleSpecifiedRequests ) |
|
833 { |
|
834 iBootGetRFStatusOngoing = EFalse; |
|
835 TRfStateInfo* rfInfo = NULL; |
|
836 aData.UnPackData( &rfInfo ); |
|
837 |
|
838 if ( *rfInfo == ERfsStateInfoInactive ) |
|
839 { |
|
840 _LIT8( KState, |
|
841 "CSecurity::CompleteBootGetRFStatus, state = ERfsStateInfoInactive" ); |
|
842 iSecurityLog->Log( ( TDesC8 ) KState ); |
|
843 } |
|
844 else if ( *rfInfo == ERfsStateInfoNormal ) |
|
845 { |
|
846 _LIT8( KState, |
|
847 "CSecurity::CompleteBootGetRFStatus, state = ERfsStateInfoNormal" ); |
|
848 iSecurityLog->Log( ( TDesC8 ) KState ); |
|
849 } |
|
850 else |
|
851 { |
|
852 _LIT8( KState, |
|
853 "CSecurity::CompleteBootGetRFStatus, state = bad state (%d)" ); |
|
854 iSecurityLog->Log( ( TDesC8 ) KState, TInt( *rfInfo ) ); |
|
855 aErr = KErrGeneral; |
|
856 } |
|
857 |
|
858 Signal( aErr ); |
|
859 } |
|
860 //no else |
|
861 } |
|
862 |
|
863 // ----------------------------------------------------------------------------- |
|
864 // CSecurity::PhoneGetPin1DisableSupportedL |
|
865 // ----------------------------------------------------------------------------- |
|
866 // |
|
867 TInt CSecurity::PhoneGetPin1DisableSupportedL( |
|
868 CStifItemParser& /*aItem*/ ) |
|
869 { |
|
870 _LIT8( KLog, "CSecurity::PhoneGetPin1DisableSupportedL" ); |
|
871 iSecurityLog->Log( ( TDesC8 ) KLog ); |
|
872 |
|
873 TInt ret( KErrNone ); |
|
874 |
|
875 ret = HandleRequestL( EMmTsyPhoneGetPin1DisableSupportedIPC ); |
|
876 |
|
877 return ret; |
|
878 } |
|
879 |
|
880 // ----------------------------------------------------------------------------- |
|
881 // CSecurity::CompletePhoneGetPin1DisableSupported |
|
882 // ----------------------------------------------------------------------------- |
|
883 // |
|
884 void CSecurity::CompletePhoneGetPin1DisableSupported( |
|
885 TInt aErr, |
|
886 CMmDataPackage& aData ) |
|
887 { |
|
888 _LIT8( KLog, "CSecurity::CompletePhoneGetPin1DisableSupported, err = %d" ); |
|
889 iSecurityLog->Log( ( TDesC8 ) KLog, aErr ); |
|
890 |
|
891 // packed parameter: TBool (supported or not) |
|
892 TBool supported( EFalse ); |
|
893 aData.UnPackData( supported ); |
|
894 |
|
895 if ( supported ) |
|
896 { |
|
897 _LIT8( KSupport, |
|
898 "CSecurity::CompletePhoneGetPin1DisableSupported -- SUPPORTED" ); |
|
899 iSecurityLog->Log( ( TDesC8 ) KSupport ); |
|
900 } |
|
901 else |
|
902 { |
|
903 _LIT8( KSupport, |
|
904 "CSecurity::CompletePhoneGetPin1DisableSupported -- NOT SUPPORTED" ); |
|
905 iSecurityLog->Log( ( TDesC8 ) KSupport ); |
|
906 } |
|
907 |
|
908 Signal( aErr ); |
|
909 } |
|
910 |
|
911 // ----------------------------------------------------------------------------- |
|
912 // CSecurity::SecurityGetSimActivePinStateL |
|
913 // ----------------------------------------------------------------------------- |
|
914 // |
|
915 TInt CSecurity::SecurityGetSimActivePinStateL( |
|
916 CStifItemParser& /*aItem*/ ) |
|
917 { |
|
918 _LIT8( KLog, "CSecurity::SecurityGetSimActivePinStateL" ); |
|
919 iSecurityLog->Log( ( TDesC8 ) KLog ); |
|
920 |
|
921 TInt ret( KErrNone ); |
|
922 |
|
923 ret = HandleRequestL( EMmTsySecurityGetSimActivePinStateIPC ); |
|
924 |
|
925 return ret; |
|
926 } |
|
927 |
|
928 // ----------------------------------------------------------------------------- |
|
929 // CSecurity::CompleteSecurityGetSimActivePinState |
|
930 // ----------------------------------------------------------------------------- |
|
931 // |
|
932 void CSecurity::CompleteSecurityGetSimActivePinState( |
|
933 TInt aErr, |
|
934 CMmDataPackage& aData ) |
|
935 { |
|
936 _LIT8( KLog, "CSecurity::CompleteSecurityGetSimActivePinState, err = %d" ); |
|
937 iSecurityLog->Log( ( TDesC8 ) KLog, aErr ); |
|
938 |
|
939 RMobilePhone::TMobilePhoneSecurityCode* activePin = NULL; |
|
940 // Get the new data |
|
941 aData.UnPackData( &activePin ); |
|
942 |
|
943 switch ( *activePin ) |
|
944 { |
|
945 case RMobilePhone::ESecurityCodePin1: |
|
946 { |
|
947 _LIT8( KActive, |
|
948 "CSecurity::CompleteSecurityGetSimActivePinState -- active pin = ESecurityCodePin1" ); |
|
949 iSecurityLog->Log( ( TDesC8 ) KActive ); |
|
950 break; |
|
951 } |
|
952 case RMobilePhone::ESecurityUniversalPin: |
|
953 { |
|
954 _LIT8( KActive, |
|
955 "CSecurity::CompleteSecurityGetSimActivePinState -- active pin = ESecurityUniversalPin" ); |
|
956 iSecurityLog->Log( ( TDesC8 ) KActive ); |
|
957 break; |
|
958 } |
|
959 default: |
|
960 { |
|
961 _LIT8( KActive, |
|
962 "CSecurity::CompleteSecurityGetSimActivePinState, bad pin (%d)" ); |
|
963 iSecurityLog->Log( ( TDesC8 ) KActive, TInt( *activePin ) ); |
|
964 aErr = KErrGeneral; |
|
965 break; |
|
966 } |
|
967 } |
|
968 |
|
969 Signal( aErr ); |
|
970 } |
|
971 |
|
972 // ----------------------------------------------------------------------------- |
|
973 // CSecurity::GetLockInfoL |
|
974 // ----------------------------------------------------------------------------- |
|
975 // |
|
976 TInt CSecurity::GetLockInfoL( |
|
977 CStifItemParser& aItem ) |
|
978 { |
|
979 _LIT8( KLog, "CSecurity::GetLockInfoL" ); |
|
980 iSecurityLog->Log( ( TDesC8 ) KLog ); |
|
981 |
|
982 RMobilePhone::TMobilePhoneLock lock; |
|
983 RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; |
|
984 lockInfo.iStatus = RMobilePhone::EStatusLockUnknown; |
|
985 lockInfo.iSetting = RMobilePhone::ELockSetUnknown; |
|
986 |
|
987 TInt ret( KErrNone ); |
|
988 TPtrC string; |
|
989 |
|
990 ret = aItem.GetNextString( string ); |
|
991 |
|
992 if ( KErrNone == ret ) |
|
993 { |
|
994 if ( string == _L("ELockPhoneDevice") ) |
|
995 { |
|
996 lock = RMobilePhone::ELockPhoneDevice; |
|
997 } |
|
998 else if ( string == _L("ELockICC") ) |
|
999 { |
|
1000 lock = RMobilePhone::ELockICC; |
|
1001 } |
|
1002 else if ( string == _L("ELockPhoneToICC") ) |
|
1003 { |
|
1004 lock = RMobilePhone::ELockPhoneToICC; |
|
1005 } |
|
1006 else if ( string == _L("ELockPhoneToFirstICC") ) |
|
1007 { |
|
1008 lock = RMobilePhone::ELockPhoneToFirstICC; |
|
1009 } |
|
1010 else if ( string == _L("ELockPhoneToFirstICC") ) |
|
1011 { |
|
1012 lock = RMobilePhone::ELockPhoneToFirstICC; |
|
1013 } |
|
1014 else if ( string == _L("ELockOTA") ) |
|
1015 { |
|
1016 lock = RMobilePhone::ELockOTA; |
|
1017 } |
|
1018 else if ( string == _L("ELockPin2") ) |
|
1019 { |
|
1020 lock = RMobilePhone::ELockPin2; |
|
1021 } |
|
1022 else if ( string == _L("ELockHiddenKey") ) |
|
1023 { |
|
1024 lock = RMobilePhone::ELockHiddenKey; |
|
1025 } |
|
1026 else if ( string == _L("ELockUSimApp") ) |
|
1027 { |
|
1028 lock = RMobilePhone::ELockUSimApp; |
|
1029 } |
|
1030 else if ( string == _L("ELockSecondUSimApp") ) |
|
1031 { |
|
1032 lock = RMobilePhone::ELockSecondUSimApp; |
|
1033 } |
|
1034 else if ( string == _L("ELockUniversalPin") ) |
|
1035 { |
|
1036 lock = RMobilePhone::ELockUniversalPin; |
|
1037 } |
|
1038 else if ( string == _L("ELockNam") ) |
|
1039 { |
|
1040 lock = RMobilePhone::ELockNam; |
|
1041 } |
|
1042 else |
|
1043 { |
|
1044 ret = KErrArgument; |
|
1045 } |
|
1046 } |
|
1047 //no else |
|
1048 |
|
1049 aItem.GetNextString( string ); |
|
1050 if ( string == _L("SIMLockDisabled") ) |
|
1051 { |
|
1052 iLockInfo.iSetting = RMobilePhone::ELockSetDisabled; |
|
1053 } |
|
1054 |
|
1055 else if ( string == _L("SIMLockEnabled") ) |
|
1056 { |
|
1057 iLockInfo.iSetting = RMobilePhone::ELockSetEnabled; |
|
1058 } |
|
1059 |
|
1060 aItem.GetNextString( string ); |
|
1061 if ( string == _L("Unlocked") ) |
|
1062 { |
|
1063 iLockInfo.iStatus = RMobilePhone::EStatusUnlocked; |
|
1064 } |
|
1065 |
|
1066 else if ( string == _L("Locked") ) |
|
1067 { |
|
1068 iLockInfo.iStatus = RMobilePhone::EStatusLocked; |
|
1069 } |
|
1070 |
|
1071 if ( KErrNone == ret ) |
|
1072 { |
|
1073 iGetLockInfoOngoing = ETrue; |
|
1074 CMmDataPackage package; |
|
1075 package.PackData( &lock, &lockInfo ); |
|
1076 |
|
1077 ret = HandleRequestL( EMobilePhoneGetLockInfo, &package ); |
|
1078 } |
|
1079 //no else |
|
1080 |
|
1081 return ret; |
|
1082 } |
|
1083 |
|
1084 // ----------------------------------------------------------------------------- |
|
1085 // CSecurity::CompleteGetLockInfo |
|
1086 // ----------------------------------------------------------------------------- |
|
1087 // |
|
1088 void CSecurity::CompleteGetLockInfo( |
|
1089 TInt aErr, |
|
1090 CMmDataPackage& aData ) |
|
1091 { |
|
1092 _LIT8( KLog, "CSecurity::CompleteGetLockInfo, err = %d" ); |
|
1093 iSecurityLog->Log( ( TDesC8 ) KLog, aErr ); |
|
1094 |
|
1095 if ( iGetLockInfoOngoing || |
|
1096 iHandleSpecifiedRequests ) |
|
1097 { |
|
1098 iGetLockInfoOngoing = EFalse; |
|
1099 |
|
1100 //unpack the data |
|
1101 RMobilePhone::TMobilePhoneLockStatus* status = NULL; |
|
1102 RMobilePhone::TMobilePhoneLockSetting* setting = NULL; |
|
1103 |
|
1104 aData.UnPackData( &status, &setting ); |
|
1105 |
|
1106 switch( *status ) |
|
1107 { |
|
1108 case RMobilePhone::EStatusLockUnknown: |
|
1109 { |
|
1110 _LIT8( KStatus, |
|
1111 "CSecurity::CompleteGetLockInfo, status = EStatusLockUnknown" ); |
|
1112 iSecurityLog->Log( ( TDesC8 ) KStatus ); |
|
1113 break; |
|
1114 } |
|
1115 case RMobilePhone::EStatusLocked: |
|
1116 { |
|
1117 _LIT8( KStatus, |
|
1118 "CSecurity::CompleteGetLockInfo, status = EStatusLocked" ); |
|
1119 iSecurityLog->Log( ( TDesC8 ) KStatus ); |
|
1120 break; |
|
1121 } |
|
1122 case RMobilePhone::EStatusUnlocked: |
|
1123 { |
|
1124 _LIT8( KStatus, |
|
1125 "CSecurity::CompleteGetLockInfo, status = EStatusUnlocked" ); |
|
1126 iSecurityLog->Log( ( TDesC8 ) KStatus ); |
|
1127 break; |
|
1128 } |
|
1129 case RMobilePhone::EStatusBlocked: |
|
1130 { |
|
1131 _LIT8( KStatus, |
|
1132 "CSecurity::CompleteGetLockInfo, status = EStatusBlocked" ); |
|
1133 iSecurityLog->Log( ( TDesC8 ) KStatus ); |
|
1134 break; |
|
1135 } |
|
1136 default: |
|
1137 { |
|
1138 _LIT8( KStatus, |
|
1139 "CSecurity::CompleteGetLockInfo, bad status (%d)" ); |
|
1140 iSecurityLog->Log( ( TDesC8 ) KStatus, TInt( *status ) ); |
|
1141 aErr = KErrGeneral; |
|
1142 break; |
|
1143 } |
|
1144 } |
|
1145 |
|
1146 switch( *setting ) |
|
1147 { |
|
1148 case RMobilePhone::ELockSetUnknown: |
|
1149 { |
|
1150 _LIT8( KSetting, |
|
1151 "CSecurity::CompleteGetLockInfo, setting = ELockSetUnknown" ); |
|
1152 iSecurityLog->Log( ( TDesC8 ) KSetting ); |
|
1153 break; |
|
1154 } |
|
1155 case RMobilePhone::ELockSetEnabled: |
|
1156 { |
|
1157 _LIT8( KSetting, |
|
1158 "CSecurity::CompleteGetLockInfo, setting = ELockSetEnabled" ); |
|
1159 iSecurityLog->Log( ( TDesC8 ) KSetting ); |
|
1160 break; |
|
1161 } |
|
1162 case RMobilePhone::ELockSetDisabled: |
|
1163 { |
|
1164 _LIT8( KSetting, |
|
1165 "CSecurity::CompleteGetLockInfo, setting = ELockSetDisabled" ); |
|
1166 iSecurityLog->Log( ( TDesC8 ) KSetting ); |
|
1167 break; |
|
1168 } |
|
1169 case RMobilePhone::ELockReplaced: |
|
1170 { |
|
1171 _LIT8( KSetting, |
|
1172 "CSecurity::CompleteGetLockInfo, setting = ELockReplaced" ); |
|
1173 iSecurityLog->Log( ( TDesC8 ) KSetting ); |
|
1174 break; |
|
1175 } |
|
1176 default: |
|
1177 { |
|
1178 _LIT8( KSetting, |
|
1179 "CSecurity::CompleteGetLockInfo, bad setting (%d)" ); |
|
1180 iSecurityLog->Log( ( TDesC8 ) KSetting, TInt( *setting ) ); |
|
1181 aErr = KErrGeneral; |
|
1182 break; |
|
1183 } |
|
1184 } |
|
1185 if ( RMobilePhone::EStatusLockUnknown != iLockInfo.iStatus ) |
|
1186 { |
|
1187 if ( iLockInfo.iStatus != *status ) |
|
1188 { |
|
1189 aErr = KErrGeneral; |
|
1190 } |
|
1191 } |
|
1192 |
|
1193 if ( RMobilePhone::ELockSetUnknown != iLockInfo.iSetting ) |
|
1194 { |
|
1195 if ( iLockInfo.iSetting != *setting ) |
|
1196 { |
|
1197 aErr = KErrGeneral; |
|
1198 } |
|
1199 } |
|
1200 |
|
1201 Signal( aErr ); |
|
1202 } |
|
1203 //no else |
|
1204 } |
|
1205 |
|
1206 // ----------------------------------------------------------------------------- |
|
1207 // CSecurity::NotifyLockInfoChange |
|
1208 // ----------------------------------------------------------------------------- |
|
1209 // |
|
1210 TInt CSecurity::NotifyLockInfoChange( |
|
1211 CStifItemParser& aItem ) |
|
1212 { |
|
1213 _LIT8( KLog, "CSecurity::NotifyLockInfoChange" ); |
|
1214 iSecurityLog->Log( ( TDesC8 ) KLog ); |
|
1215 |
|
1216 TInt ret( KErrNone ); |
|
1217 |
|
1218 ret = GetCodeID( aItem, iCodeID ); |
|
1219 |
|
1220 if ( KErrNone == ret ) |
|
1221 { |
|
1222 iNotifyLockInfoChangeOngoing = ETrue; |
|
1223 } |
|
1224 |
|
1225 return ret; |
|
1226 } |
|
1227 |
|
1228 // ----------------------------------------------------------------------------- |
|
1229 // CSecurity::CompleteNotifyLockInfoChange |
|
1230 // ----------------------------------------------------------------------------- |
|
1231 // |
|
1232 void CSecurity::CompleteNotifyLockInfoChange( |
|
1233 TInt aErr, |
|
1234 CMmDataPackage& aData ) |
|
1235 { |
|
1236 RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; |
|
1237 RMobilePhone::TMobilePhoneLock lock; |
|
1238 aData.UnPackData( lockInfo, lock ); |
|
1239 |
|
1240 _LIT8( KLog, "CSecurity::CompleteNotifyLockInfoChange, err = %d" ); |
|
1241 iSecurityLog->Log( ( TDesC8 ) KLog, aErr ); |
|
1242 |
|
1243 _LIT8( KInfo, |
|
1244 " -- lockInfo.iStatus = %d, lockInfo.iSetting = %d, lock = %d" ); |
|
1245 iSecurityLog->Log( ( TDesC8 ) KInfo, |
|
1246 TInt( lockInfo.iStatus ), TInt( lockInfo.iSetting ), TInt( lock ) ); |
|
1247 |
|
1248 if ( iNotifyLockInfoChangeOngoing ) |
|
1249 { |
|
1250 iNotifyLockInfoChangeOngoing = EFalse; |
|
1251 if ( RMobilePhone::ELockICC != lock || |
|
1252 RMobilePhone::EStatusUnlocked != lockInfo.iStatus || |
|
1253 RMobilePhone::ELockSetEnabled != lockInfo.iSetting ) |
|
1254 { |
|
1255 _LIT8( KFailed, "CSecurity::CompleteNotifyLockInfoChange, Failed" ); |
|
1256 iSecurityLog->Log( ( TDesC8 ) KFailed ); |
|
1257 aErr = KErrGeneral; |
|
1258 } |
|
1259 else |
|
1260 { |
|
1261 _LIT8( KComplete, "CSecurity::CompleteNotifyLockInfoChange, completed" ); |
|
1262 iSecurityLog->Log( ( TDesC8 ) KComplete ); |
|
1263 } |
|
1264 } |
|
1265 |
|
1266 if ( iNotifyLockInfoChangeOngoing || |
|
1267 iHandleSpecifiedRequests ) |
|
1268 { |
|
1269 Signal( aErr ); |
|
1270 } |
|
1271 //no else |
|
1272 } |
|
1273 |
|
1274 // ----------------------------------------------------------------------------- |
|
1275 // CSecurity::SetLockSettingL |
|
1276 // ----------------------------------------------------------------------------- |
|
1277 // |
|
1278 TInt CSecurity::SetLockSettingL( |
|
1279 CStifItemParser& aItem ) |
|
1280 { |
|
1281 _LIT8( KLog, "CSecurity::SetLockSettingL" ); |
|
1282 iSecurityLog->Log( ( TDesC8 ) KLog ); |
|
1283 |
|
1284 RMobilePhone::TMobilePhoneLock lock; |
|
1285 RMobilePhone::TMobilePhoneLockSetting setting; |
|
1286 |
|
1287 TInt ret( KErrNone ); |
|
1288 TPtrC string; |
|
1289 |
|
1290 // 1st parameter: lock |
|
1291 ret = aItem.GetNextString( string ); |
|
1292 |
|
1293 if ( KErrNone == ret ) |
|
1294 { |
|
1295 if ( string == _L("ELockPhoneDevice") ) |
|
1296 { |
|
1297 lock = RMobilePhone::ELockPhoneDevice; |
|
1298 } |
|
1299 else if ( string == _L("ELockICC") ) |
|
1300 { |
|
1301 lock = RMobilePhone::ELockICC; |
|
1302 iCodeID = KSecCodePin; |
|
1303 } |
|
1304 else if ( string == _L("ELockPhoneToICC") ) |
|
1305 { |
|
1306 lock = RMobilePhone::ELockPhoneToICC; |
|
1307 } |
|
1308 else if ( string == _L("ELockPhoneToFirstICC") ) |
|
1309 { |
|
1310 lock = RMobilePhone::ELockPhoneToFirstICC; |
|
1311 } |
|
1312 else if ( string == _L("ELockPhoneToFirstICC") ) |
|
1313 { |
|
1314 lock = RMobilePhone::ELockPhoneToFirstICC; |
|
1315 } |
|
1316 else if ( string == _L("ELockOTA") ) |
|
1317 { |
|
1318 lock = RMobilePhone::ELockOTA; |
|
1319 } |
|
1320 else if ( string == _L("ELockPin2") ) |
|
1321 { |
|
1322 lock = RMobilePhone::ELockPin2; |
|
1323 } |
|
1324 else if ( string == _L("ELockHiddenKey") ) |
|
1325 { |
|
1326 lock = RMobilePhone::ELockHiddenKey; |
|
1327 } |
|
1328 else if ( string == _L("ELockUSimApp") ) |
|
1329 { |
|
1330 lock = RMobilePhone::ELockUSimApp; |
|
1331 } |
|
1332 else if ( string == _L("ELockSecondUSimApp") ) |
|
1333 { |
|
1334 lock = RMobilePhone::ELockSecondUSimApp; |
|
1335 } |
|
1336 else if ( string == _L("ELockUniversalPin") ) |
|
1337 { |
|
1338 lock = RMobilePhone::ELockUniversalPin; |
|
1339 } |
|
1340 else if ( string == _L("ELockNam") ) |
|
1341 { |
|
1342 lock = RMobilePhone::ELockNam; |
|
1343 } |
|
1344 else |
|
1345 { |
|
1346 ret = KErrArgument; |
|
1347 } |
|
1348 } |
|
1349 //no else |
|
1350 |
|
1351 // 2nd parameter: lock setting |
|
1352 ret = aItem.GetNextString( string ); |
|
1353 |
|
1354 if ( KErrNone == ret ) |
|
1355 { |
|
1356 if ( _L("ELockSetUnknown") == string ) |
|
1357 { |
|
1358 setting = RMobilePhone::ELockSetUnknown; |
|
1359 } |
|
1360 else if ( _L("ELockSetEnabled") == string ) |
|
1361 { |
|
1362 setting = RMobilePhone::ELockSetEnabled; |
|
1363 } |
|
1364 else if ( _L("ELockSetDisabled") == string ) |
|
1365 { |
|
1366 setting = RMobilePhone::ELockSetDisabled; |
|
1367 } |
|
1368 else if ( _L("ELockReplaced") == string ) |
|
1369 { |
|
1370 setting = RMobilePhone::ELockReplaced; |
|
1371 //made for checking right complete value in SEC_EVENT IND |
|
1372 if ( RMobilePhone::ELockICC == lock ) |
|
1373 { |
|
1374 iLockReplaceTestOngoing = ETrue; |
|
1375 iCodeID = KSecCodeSubstitutePin; |
|
1376 } |
|
1377 else if ( RMobilePhone::ELockUniversalPin == lock ) |
|
1378 { |
|
1379 iLockReplaceTestOngoing = ETrue; |
|
1380 iCodeID = KSecCodeSubstitutePinUniversal; |
|
1381 } |
|
1382 } |
|
1383 else |
|
1384 { |
|
1385 ret = KErrArgument; |
|
1386 } |
|
1387 } |
|
1388 //no else |
|
1389 |
|
1390 if ( KErrNone == ret ) |
|
1391 { |
|
1392 CMmDataPackage package; |
|
1393 TLockAndSetting lockAndSetting; |
|
1394 lockAndSetting.iLock = &lock; |
|
1395 lockAndSetting.iSetting = &setting; |
|
1396 |
|
1397 //check if there is a code available for this message |
|
1398 //some lock settings requires code |
|
1399 if ( iSecCode.Length() != 0 ) |
|
1400 { |
|
1401 //re-package the original package and |
|
1402 //include the code |
|
1403 _LIT16( KCode, "CSecurity::SetLockSettingL, security code = %S" ); |
|
1404 iSecurityLog->Log( ( TDesC16 ) KCode, &iSecCode ); |
|
1405 |
|
1406 package.PackData( &lockAndSetting, &iSecCode ); |
|
1407 } |
|
1408 else |
|
1409 { |
|
1410 //pack only the lock and the setting, the code will be null |
|
1411 package.PackData( &lockAndSetting ); |
|
1412 } |
|
1413 |
|
1414 iSetLockSettingOngoing = ETrue; |
|
1415 ret = HandleRequestL( EMobilePhoneSetLockSetting, &package ); |
|
1416 } |
|
1417 //no else |
|
1418 |
|
1419 return ret; |
|
1420 } |
|
1421 |
|
1422 // ----------------------------------------------------------------------------- |
|
1423 // CSecurity::CompleteSetLockSetting |
|
1424 // ----------------------------------------------------------------------------- |
|
1425 // |
|
1426 void CSecurity::CompleteSetLockSetting( |
|
1427 TInt aErr, CMmDataPackage& aData ) |
|
1428 { |
|
1429 _LIT8( KLog, "CSecurity::CompleteSetLockSetting, err = %d" ); |
|
1430 iSecurityLog->Log( ( TDesC8 ) KLog, aErr ); |
|
1431 |
|
1432 if ( iSetLockSettingOngoing || |
|
1433 iHandleSpecifiedRequests ) |
|
1434 { |
|
1435 iSetLockSettingOngoing = EFalse; |
|
1436 |
|
1437 RMobilePhone::TMobilePhoneLockStatus status; |
|
1438 RMobilePhone::TMobilePhoneLockSetting setting; |
|
1439 aData.UnPackData( status, setting ); |
|
1440 |
|
1441 _LIT8( KComplete, |
|
1442 "CSecurity::CompleteSetLockSetting, status = %d setting = %d"); |
|
1443 iSecurityLog->Log( ( TDesC8 ) KComplete, |
|
1444 TInt( status ), TInt( setting ) ); |
|
1445 |
|
1446 Signal( aErr ); |
|
1447 } |
|
1448 //no else |
|
1449 } |
|
1450 |
|
1451 // ----------------------------------------------------------------------------- |
|
1452 // CSecurity::ChangeSecurityCodeL |
|
1453 // ----------------------------------------------------------------------------- |
|
1454 // |
|
1455 TInt CSecurity::ChangeSecurityCodeL( |
|
1456 CStifItemParser& aItem ) |
|
1457 { |
|
1458 _LIT8( KLog, "CSecurity::ChangeSecurityCodeL" ); |
|
1459 iSecurityLog->Log( ( TDesC8 ) KLog ); |
|
1460 |
|
1461 TInt ret( KErrNone ); |
|
1462 TPtrC string; |
|
1463 |
|
1464 RMobilePhone::TMobilePhoneSecurityCode securityCode; |
|
1465 RMobilePhone::TMobilePhonePasswordChangeV1 passwordChange; |
|
1466 |
|
1467 // 1st parameter: security code enum |
|
1468 ret = GetSecurityCode( aItem, securityCode ); |
|
1469 |
|
1470 // 2nd parameter: old password |
|
1471 if ( KErrNone == ret ) |
|
1472 { |
|
1473 // get oldpassword |
|
1474 ret = aItem.GetNextString( string ); |
|
1475 |
|
1476 if ( KErrNone == ret ) |
|
1477 { |
|
1478 passwordChange.iOldPassword.Copy( string ); |
|
1479 } |
|
1480 //no else |
|
1481 } |
|
1482 //no else |
|
1483 |
|
1484 // 3rd parameter: newpassword |
|
1485 if ( KErrNone == ret ) |
|
1486 { |
|
1487 ret = aItem.GetNextString( string ); |
|
1488 |
|
1489 if ( KErrNone == ret ) |
|
1490 { |
|
1491 passwordChange.iNewPassword.Copy( string ); |
|
1492 } |
|
1493 //no else |
|
1494 } |
|
1495 //no else |
|
1496 |
|
1497 if ( KErrNone == ret ) |
|
1498 { |
|
1499 CMmDataPackage package; |
|
1500 package.PackData( &securityCode, &passwordChange ); |
|
1501 iChangeSecurityCodeOngoing = ETrue; |
|
1502 ret = HandleRequestL ( EMobilePhoneChangeSecurityCode, &package ); |
|
1503 } |
|
1504 //no else |
|
1505 |
|
1506 return ret; |
|
1507 } |
|
1508 |
|
1509 // ----------------------------------------------------------------------------- |
|
1510 // CSecurity::CompleteChangeSecurityCode |
|
1511 // ----------------------------------------------------------------------------- |
|
1512 // |
|
1513 void CSecurity::CompleteChangeSecurityCode( |
|
1514 TInt aErr, |
|
1515 CMmDataPackage& /*aData*/ ) |
|
1516 { |
|
1517 _LIT8( KLog, "CSecurity::CompleteChangeSecurityCode, err = %d" ); |
|
1518 iSecurityLog->Log( ( TDesC8 ) KLog, aErr ); |
|
1519 |
|
1520 if ( iChangeSecurityCodeOngoing || |
|
1521 iHandleSpecifiedRequests ) |
|
1522 { |
|
1523 iChangeSecurityCodeOngoing = EFalse; |
|
1524 |
|
1525 _LIT8( KComplete, "CSecurity::CompleteChangeSecurityCode, completed" ); |
|
1526 iSecurityLog->Log( ( TDesC8 ) KComplete ); |
|
1527 |
|
1528 Signal( aErr ); |
|
1529 } |
|
1530 //no else |
|
1531 } |
|
1532 |
|
1533 // ----------------------------------------------------------------------------- |
|
1534 // CSecurity::NotifySecurityEvent |
|
1535 // ----------------------------------------------------------------------------- |
|
1536 // |
|
1537 TInt CSecurity::NotifySecurityEvent( |
|
1538 CStifItemParser& aItem ) |
|
1539 { |
|
1540 _LIT8( KLog, "CSecurity::NotifySecurityEvent" ); |
|
1541 iSecurityLog->Log( ( TDesC8 ) KLog ); |
|
1542 |
|
1543 TInt ret( KErrNone ); |
|
1544 |
|
1545 // 1st parameter: codeID |
|
1546 ret = GetCodeID( aItem, iCodeID ); |
|
1547 |
|
1548 if ( KErrNone == ret ) |
|
1549 { |
|
1550 iNotifySecurityEventOngoing = ETrue; |
|
1551 } |
|
1552 |
|
1553 return ret; |
|
1554 } |
|
1555 |
|
1556 |
|
1557 // ----------------------------------------------------------------------------- |
|
1558 // CSecurity::CompleteNotifySecurityEvent |
|
1559 // ----------------------------------------------------------------------------- |
|
1560 // |
|
1561 void CSecurity::CompleteNotifySecurityEvent( |
|
1562 TInt aErr, |
|
1563 CMmDataPackage& aData ) |
|
1564 { |
|
1565 _LIT8( KLog, "CSecurity::CompleteNotifySecurityEvent, err = %d" ); |
|
1566 iSecurityLog->Log( ( TDesC8 ) KLog, aErr ); |
|
1567 |
|
1568 RMobilePhone::TMobilePhoneSecurityEvent* event = NULL; |
|
1569 //unpack the data |
|
1570 aData.UnPackData( &event ); |
|
1571 |
|
1572 switch( *event ) |
|
1573 { |
|
1574 case RMobilePhone::ENoICCFound: |
|
1575 { |
|
1576 _LIT8( KEvent, "CSecurity::CompleteNotifySecurityEvent, event = ENoICCFound" ); |
|
1577 iSecurityLog->Log( ( TDesC8 ) KEvent ); |
|
1578 break; |
|
1579 } |
|
1580 case RMobilePhone::EICCTerminated: |
|
1581 { |
|
1582 _LIT8( KEvent, "CSecurity::CompleteNotifySecurityEvent, event = EICCTerminated" ); |
|
1583 iSecurityLog->Log( ( TDesC8 ) KEvent ); |
|
1584 break; |
|
1585 } |
|
1586 case RMobilePhone::EPin1Required: |
|
1587 { |
|
1588 _LIT8( KEvent, "CSecurity::CompleteNotifySecurityEvent, event = EPin1Required" ); |
|
1589 iSecurityLog->Log( ( TDesC8 ) KEvent ); |
|
1590 |
|
1591 if ( KSecCodePin != iCodeID ) |
|
1592 { |
|
1593 aErr = KErrGeneral; |
|
1594 } |
|
1595 break; |
|
1596 } |
|
1597 case RMobilePhone::EPin2Required: |
|
1598 { |
|
1599 _LIT8( KEvent, "CSecurity::CompleteNotifySecurityEvent, event = EPin2Required" ); |
|
1600 iSecurityLog->Log( ( TDesC8 ) KEvent ); |
|
1601 break; |
|
1602 } |
|
1603 case RMobilePhone::EPuk2Required: |
|
1604 { |
|
1605 _LIT8( KEvent, "CSecurity::CompleteNotifySecurityEvent, event = EPuk2Required" ); |
|
1606 iSecurityLog->Log( ( TDesC8 ) KEvent ); |
|
1607 break; |
|
1608 } |
|
1609 case RMobilePhone::EPhonePasswordRequired: |
|
1610 { |
|
1611 _LIT8( KEvent, "CSecurity::CompleteNotifySecurityEvent, event = EPhonePasswordRequired" ); |
|
1612 iSecurityLog->Log( ( TDesC8 ) KEvent ); |
|
1613 break; |
|
1614 } |
|
1615 case RMobilePhone::ESPCRequired: |
|
1616 { |
|
1617 _LIT8( KEvent, "CSecurity::CompleteNotifySecurityEvent, event = ESPCRequired" ); |
|
1618 iSecurityLog->Log( ( TDesC8 ) KEvent ); |
|
1619 break; |
|
1620 } |
|
1621 case RMobilePhone::EPin1Verified: |
|
1622 { |
|
1623 _LIT8( KEvent, "CSecurity::CompleteNotifySecurityEvent, event = EPin1Verified" ); |
|
1624 iSecurityLog->Log( ( TDesC8 ) KEvent ); |
|
1625 |
|
1626 if ( iLockReplaceTestOngoing ) |
|
1627 { |
|
1628 if ( KSecCodeSubstitutePin != iCodeID ) |
|
1629 { |
|
1630 aErr = KErrGeneral; |
|
1631 } |
|
1632 iLockReplaceTestOngoing = EFalse; |
|
1633 } |
|
1634 else if ( KSecCodePin != iCodeID) |
|
1635 { |
|
1636 aErr = KErrGeneral; |
|
1637 } |
|
1638 break; |
|
1639 } |
|
1640 case RMobilePhone::EPin2Verified: |
|
1641 { |
|
1642 _LIT8( KEvent, "CSecurity::CompleteNotifySecurityEvent, event = EPin2Verified" ); |
|
1643 iSecurityLog->Log( ( TDesC8 ) KEvent ); |
|
1644 break; |
|
1645 } |
|
1646 case RMobilePhone::EPuk1Verified: |
|
1647 { |
|
1648 _LIT8( KEvent, "CSecurity::CompleteNotifySecurityEvent, event = EPuk1Verified" ); |
|
1649 iSecurityLog->Log( ( TDesC8 ) KEvent ); |
|
1650 break; |
|
1651 } |
|
1652 case RMobilePhone::EPuk2Verified: |
|
1653 { |
|
1654 _LIT8( KEvent, "CSecurity::CompleteNotifySecurityEvent, event = EPuk2Verified" ); |
|
1655 iSecurityLog->Log( ( TDesC8 ) KEvent ); |
|
1656 break; |
|
1657 } |
|
1658 case RMobilePhone::EPhonePasswordVerified: |
|
1659 { |
|
1660 _LIT8( KEvent, "CSecurity::CompleteNotifySecurityEvent, event = EPhonePasswordVerified" ); |
|
1661 iSecurityLog->Log( ( TDesC8 ) KEvent ); |
|
1662 break; |
|
1663 } |
|
1664 case RMobilePhone::ESPCVerified: |
|
1665 { |
|
1666 _LIT8( KEvent, "CSecurity::CompleteNotifySecurityEvent, event = ESPCVerified" ); |
|
1667 iSecurityLog->Log( ( TDesC8 ) KEvent ); |
|
1668 break; |
|
1669 } |
|
1670 case RMobilePhone::EHiddenKeyRequired: |
|
1671 { |
|
1672 _LIT8( KEvent, "CSecurity::CompleteNotifySecurityEvent, event = EHiddenKeyRequired" ); |
|
1673 iSecurityLog->Log( ( TDesC8 ) KEvent ); |
|
1674 break; |
|
1675 } |
|
1676 case RMobilePhone::EHiddenKeyVerified: |
|
1677 { |
|
1678 _LIT8( KEvent, "CSecurity::CompleteNotifySecurityEvent, event = EHiddenKeyVerified" ); |
|
1679 iSecurityLog->Log( ( TDesC8 ) KEvent ); |
|
1680 break; |
|
1681 } |
|
1682 case RMobilePhone::EUSIMAppPinRequired: |
|
1683 { |
|
1684 _LIT8( KEvent, "CSecurity::CompleteNotifySecurityEvent, event = EUSIMAppPinRequired" ); |
|
1685 iSecurityLog->Log( ( TDesC8 ) KEvent ); |
|
1686 break; |
|
1687 } |
|
1688 case RMobilePhone::EUSIMAppPinVerified: |
|
1689 { |
|
1690 _LIT8( KEvent, "CSecurity::CompleteNotifySecurityEvent, event = EUSIMAppPinVerified" ); |
|
1691 iSecurityLog->Log( ( TDesC8 ) KEvent ); |
|
1692 break; |
|
1693 } |
|
1694 case RMobilePhone::EUniversalPinRequired: |
|
1695 { |
|
1696 _LIT8( KEvent, "CSecurity::CompleteNotifySecurityEvent, event = EUniversalPinRequired" ); |
|
1697 iSecurityLog->Log( ( TDesC8 ) KEvent ); |
|
1698 break; |
|
1699 } |
|
1700 case RMobilePhone::ESPCChanged: |
|
1701 { |
|
1702 _LIT8( KEvent, "CSecurity::CompleteNotifySecurityEvent, event = ESPCChanged" ); |
|
1703 iSecurityLog->Log( ( TDesC8 ) KEvent ); |
|
1704 break; |
|
1705 } |
|
1706 case RMobilePhone::EUniversalPukRequired: |
|
1707 { |
|
1708 _LIT8( KEvent, "CSecurity::CompleteNotifySecurityEvent, event = EUniversalPukRequired" ); |
|
1709 iSecurityLog->Log( ( TDesC8 ) KEvent ); |
|
1710 break; |
|
1711 } |
|
1712 case RMobilePhone::EUniversalPukVerified: |
|
1713 { |
|
1714 _LIT8( KEvent, "CSecurity::CompleteNotifySecurityEvent, event = EUniversalPukVerified" ); |
|
1715 iSecurityLog->Log( ( TDesC8 ) KEvent ); |
|
1716 break; |
|
1717 } |
|
1718 case RMobilePhone::EUniversalPinVerified: |
|
1719 { |
|
1720 _LIT8( KEvent, "CSecurity::CompleteNotifySecurityEvent, event = EUniversalPinVerified" ); |
|
1721 iSecurityLog->Log( ( TDesC8 ) KEvent ); |
|
1722 if ( KSecCodeSubstitutePinUniversal != iCodeID) |
|
1723 { |
|
1724 aErr = KErrGeneral; |
|
1725 } |
|
1726 break; |
|
1727 } |
|
1728 default: |
|
1729 { |
|
1730 _LIT8( KEvent, "CSecurity::CompleteNotifySecurityEvent, bad event (%d)" ); |
|
1731 iSecurityLog->Log( ( TDesC8 ) KEvent, TInt( *event ) ); |
|
1732 aErr = KErrGeneral; |
|
1733 break; |
|
1734 } |
|
1735 } |
|
1736 |
|
1737 if ( iNotifySecurityEventOngoing || |
|
1738 iHandleSpecifiedRequests ) |
|
1739 { |
|
1740 iNotifySecurityEventOngoing = EFalse; |
|
1741 |
|
1742 _LIT8( KComplete, "CSecurity::CompleteNotifySecurityEvent, completed, err = %d" ); |
|
1743 iSecurityLog->Log( ( TDesC8 ) KComplete, aErr ); |
|
1744 |
|
1745 Signal( aErr ); |
|
1746 } |
|
1747 //no else |
|
1748 } |
|
1749 |
|
1750 // ----------------------------------------------------------------------------- |
|
1751 // CSecurity::VerifySecurityCodeL |
|
1752 // ----------------------------------------------------------------------------- |
|
1753 // |
|
1754 TInt CSecurity::VerifySecurityCodeL( |
|
1755 CStifItemParser& aItem ) |
|
1756 { |
|
1757 _LIT8( KLog, "CSecurity::VerifySecurityCodeL" ); |
|
1758 iSecurityLog->Log( ( TDesC8 ) KLog ); |
|
1759 |
|
1760 TInt ret( KErrNone ); |
|
1761 TPtrC string; |
|
1762 |
|
1763 RMobilePhone::TMobilePhoneSecurityCode type; |
|
1764 RMobilePhone::TCodeAndUnblockCode codes; |
|
1765 |
|
1766 // 1st parameter: security code type |
|
1767 ret = GetSecurityCode( aItem, type ); |
|
1768 |
|
1769 // 2nd parameter code |
|
1770 if ( KErrNone == ret ) |
|
1771 { |
|
1772 ret = aItem.GetNextString( string ); |
|
1773 if ( KErrNone == ret ) |
|
1774 { |
|
1775 codes.iCode.Copy( string ); |
|
1776 } |
|
1777 //no else |
|
1778 } |
|
1779 //no else |
|
1780 |
|
1781 // 3rd parameter: unblock code |
|
1782 if ( KErrNone == ret ) |
|
1783 { |
|
1784 ret = aItem.GetNextString( string ); |
|
1785 if ( KErrNone == ret ) |
|
1786 { |
|
1787 codes.iUnblockCode.Copy( string ); |
|
1788 } |
|
1789 //no else |
|
1790 } |
|
1791 //no else |
|
1792 |
|
1793 // if 3rd parameter has been left empty (no new code), ret == -1 |
|
1794 if ( KErrNone == ret || -1 == ret ) |
|
1795 { |
|
1796 if ( RMobilePhone::ESecurityCodePin1 == type ) |
|
1797 { |
|
1798 iCodeID = KSecCodePin; |
|
1799 } |
|
1800 |
|
1801 CMmDataPackage package; |
|
1802 package.PackData( &type, &codes ); |
|
1803 |
|
1804 ret = HandleRequestL( EMobilePhoneVerifySecurityCode, &package ); |
|
1805 iVerifySecurityCodeOngoing = ETrue; |
|
1806 } |
|
1807 //no else |
|
1808 |
|
1809 return ret; |
|
1810 } |
|
1811 |
|
1812 // ----------------------------------------------------------------------------- |
|
1813 // CSecurity::CompleteVerifySecurityCode |
|
1814 // ----------------------------------------------------------------------------- |
|
1815 // |
|
1816 void CSecurity::CompleteVerifySecurityCode( |
|
1817 TInt aErr, |
|
1818 CMmDataPackage& /*aData*/ ) |
|
1819 { |
|
1820 _LIT8( KLog, "CSecurity::CompleteVerifySecurityCode, err = %d" ); |
|
1821 iSecurityLog->Log( ( TDesC8 ) KLog, aErr ); |
|
1822 |
|
1823 if ( iVerifySecurityCodeOngoing || |
|
1824 iHandleSpecifiedRequests ) |
|
1825 { |
|
1826 iVerifySecurityCodeOngoing = EFalse; |
|
1827 _LIT8( KComplete, "CSecurity::CompleteVerifySecurityCode, completed" ); |
|
1828 iSecurityLog->Log( ( TDesC8 ) KComplete ); |
|
1829 |
|
1830 Signal( aErr ); |
|
1831 } |
|
1832 //no else |
|
1833 } |
|
1834 |
|
1835 // ----------------------------------------------------------------------------- |
|
1836 // CSecurity::AbortSecurityCodeL |
|
1837 // ----------------------------------------------------------------------------- |
|
1838 // |
|
1839 TInt CSecurity::AbortSecurityCodeL( |
|
1840 CStifItemParser& aItem ) |
|
1841 { |
|
1842 _LIT8( KLog, "CSecurity::AbortSecurityCodeL" ); |
|
1843 iSecurityLog->Log( ( TDesC8 ) KLog ); |
|
1844 |
|
1845 TInt ret( KErrNone ); |
|
1846 RMobilePhone::TMobilePhoneSecurityCode securityCode; |
|
1847 |
|
1848 // 1st parameter: security code type |
|
1849 ret = GetSecurityCode( aItem, securityCode ); |
|
1850 |
|
1851 if ( KErrNone == ret ) |
|
1852 { |
|
1853 CMmDataPackage package; |
|
1854 package.PackData( &securityCode ); |
|
1855 |
|
1856 ret = HandleRequestL( EMobilePhoneAbortSecurityCode, &package ); |
|
1857 iAbortSecurityCodeOngoing = ETrue; |
|
1858 } |
|
1859 //no else |
|
1860 |
|
1861 return ret; |
|
1862 } |
|
1863 |
|
1864 // ----------------------------------------------------------------------------- |
|
1865 // CSecurity::CompleteAbortSecurityCode |
|
1866 // ----------------------------------------------------------------------------- |
|
1867 // |
|
1868 void CSecurity::CompleteAbortSecurityCode( |
|
1869 TInt aErr, |
|
1870 CMmDataPackage& /*aData*/ ) |
|
1871 { |
|
1872 _LIT8( KLog, "CSecurity::CompleteAbortSecurityCode, err = %d" ); |
|
1873 iSecurityLog->Log( ( TDesC8 ) KLog, aErr ); |
|
1874 |
|
1875 if ( iAbortSecurityCodeOngoing || |
|
1876 iHandleSpecifiedRequests ) |
|
1877 { |
|
1878 iAbortSecurityCodeOngoing = EFalse; |
|
1879 |
|
1880 _LIT8( KComplete, "CSecurity::CompleteAbortSecurityCode, completed" ); |
|
1881 iSecurityLog->Log( ( TDesC8 ) KComplete ); |
|
1882 |
|
1883 Signal( aErr ); |
|
1884 } |
|
1885 //no else |
|
1886 } |
|
1887 |
|
1888 // ----------------------------------------------------------------------------- |
|
1889 // CSecurity::SimGetFdnStatusL |
|
1890 // ----------------------------------------------------------------------------- |
|
1891 // |
|
1892 TInt CSecurity::SimGetFdnStatusL( |
|
1893 CStifItemParser& /*aItem*/ ) |
|
1894 { |
|
1895 _LIT8( KLog, "CSecurity::SimGetFdnStatusL" ); |
|
1896 iSecurityLog->Log( ( TDesC8 ) KLog ); |
|
1897 |
|
1898 TInt ret( KErrNone ); |
|
1899 |
|
1900 iGetFdnStatusOngoing = ETrue; |
|
1901 ret = HandleRequestL( EMobilePhoneGetFdnStatus ); |
|
1902 |
|
1903 return ret; |
|
1904 } |
|
1905 |
|
1906 // ----------------------------------------------------------------------------- |
|
1907 // CSecurity::CompleteGetFdnStatus |
|
1908 // ----------------------------------------------------------------------------- |
|
1909 // |
|
1910 void CSecurity::CompleteGetFdnStatus( |
|
1911 TInt aErr, CMmDataPackage& aData ) |
|
1912 { |
|
1913 _LIT8( KLog, "CSecurity::CompleteGetFdnStatus, err = %d" ); |
|
1914 iSecurityLog->Log( ( TDesC8 ) KLog, aErr ); |
|
1915 |
|
1916 if ( iGetFdnStatusOngoing || |
|
1917 iHandleSpecifiedRequests ) |
|
1918 { |
|
1919 iGetFdnStatusOngoing = EFalse; |
|
1920 |
|
1921 //unpack and print status |
|
1922 RMobilePhone::TMobilePhoneFdnStatus fdnStatus = RMobilePhone::EFdnUnknown; |
|
1923 aData.UnPackData( fdnStatus ); |
|
1924 |
|
1925 switch ( fdnStatus ) |
|
1926 { |
|
1927 case RMobilePhone::EFdnNotActive: |
|
1928 { |
|
1929 _LIT8( KStatus, "CSecurity::CompleteGetFdnStatus, FDN Not Active." ); |
|
1930 iSecurityLog->Log( ( TDesC8 ) KStatus ); |
|
1931 break; |
|
1932 } |
|
1933 case RMobilePhone::EFdnActive: |
|
1934 { |
|
1935 _LIT8( KStatus, "CSecurity::CompleteGetFdnStatus, FDN Active." ); |
|
1936 iSecurityLog->Log( ( TDesC8 ) KStatus ); |
|
1937 break; |
|
1938 } |
|
1939 case RMobilePhone::EFdnPermanentlyActive: |
|
1940 { |
|
1941 _LIT8( KStatus, "CSecurity::CompleteGetFdnStatus, FDN Permanently Active." ); |
|
1942 iSecurityLog->Log( ( TDesC8 ) KStatus ); |
|
1943 break; |
|
1944 } |
|
1945 case RMobilePhone::EFdnNotSupported: |
|
1946 { |
|
1947 _LIT8( KStatus, "CSecurity::CompleteGetFdnStatus, FDN Not Supported." ); |
|
1948 iSecurityLog->Log( ( TDesC8 ) KStatus ); |
|
1949 break; |
|
1950 } |
|
1951 case RMobilePhone::EFdnUnknown: |
|
1952 default: |
|
1953 { |
|
1954 _LIT8( KStatus, "CSecurity::CompleteGetFdnStatus, FDN Status Unknown." ); |
|
1955 iSecurityLog->Log( ( TDesC8 ) KStatus ); |
|
1956 break; |
|
1957 } |
|
1958 } |
|
1959 |
|
1960 Signal( aErr ); |
|
1961 } |
|
1962 //no else |
|
1963 } |
|
1964 |
|
1965 // ----------------------------------------------------------------------------- |
|
1966 // CSecurity::SimSetFdnStatusL |
|
1967 // ----------------------------------------------------------------------------- |
|
1968 // |
|
1969 TInt CSecurity::SimSetFdnStatusL( |
|
1970 CStifItemParser& aItem ) |
|
1971 { |
|
1972 _LIT8( KLog, "CSecurity::SimSetFdnStatusL" ); |
|
1973 iSecurityLog->Log( ( TDesC8 ) KLog ); |
|
1974 |
|
1975 TInt fdnInt( 0 ); |
|
1976 TInt ret( aItem.GetNextInt( fdnInt ) ); |
|
1977 |
|
1978 if ( KErrNone == ret ) |
|
1979 { |
|
1980 RMobilePhone::TMobilePhoneFdnSetting fdnSetting = |
|
1981 static_cast< RMobilePhone::TMobilePhoneFdnSetting >( fdnInt ); |
|
1982 |
|
1983 if ( RMobilePhone::EFdnSetOn == fdnSetting ) |
|
1984 { |
|
1985 _LIT8( KSetting, "CSecurity::SimSetFdnStatusL: Setting FDN Active." ); |
|
1986 iSecurityLog->Log( ( TDesC8 ) KSetting ); |
|
1987 } |
|
1988 else |
|
1989 { |
|
1990 _LIT8( KSetting, "CSecurity::SimSetFdnStatusL: Setting FDN Inactive." ); |
|
1991 iSecurityLog->Log( ( TDesC8 ) KSetting ); |
|
1992 } |
|
1993 |
|
1994 iSetFdnStatusOngoing = ETrue; |
|
1995 |
|
1996 CMmDataPackage package; |
|
1997 package.PackData( &fdnSetting ); |
|
1998 |
|
1999 ret = HandleRequestL( EMobilePhoneSetFdnSetting, &package ); |
|
2000 } |
|
2001 |
|
2002 return ret; |
|
2003 } |
|
2004 |
|
2005 // ----------------------------------------------------------------------------- |
|
2006 // CSecurity::CompleteSetFdnStatus |
|
2007 // ----------------------------------------------------------------------------- |
|
2008 // |
|
2009 void CSecurity::CompleteSetFdnStatus( |
|
2010 TInt aErr, |
|
2011 CMmDataPackage& /*aData*/ ) |
|
2012 { |
|
2013 _LIT8( KLog, "CSecurity::CompleteSetFdnStatus, err = %d" ); |
|
2014 iSecurityLog->Log( ( TDesC8 ) KLog, aErr ); |
|
2015 |
|
2016 if ( iSetFdnStatusOngoing || |
|
2017 iHandleSpecifiedRequests ) |
|
2018 { |
|
2019 iSetFdnStatusOngoing = EFalse; |
|
2020 |
|
2021 Signal( aErr ); |
|
2022 } |
|
2023 //no else |
|
2024 } |
|
2025 |
|
2026 // ----------------------------------------------------------------------------- |
|
2027 // CSecurity::SecurityInfoL |
|
2028 // ----------------------------------------------------------------------------- |
|
2029 // |
|
2030 TInt CSecurity::SecurityInfoL( CStifItemParser& aItem ) |
|
2031 { |
|
2032 _LIT8( KLog, "CSecurity::SecurityInfoL" ); |
|
2033 iSecurityLog->Log( ( TDesC8 ) KLog ); |
|
2034 |
|
2035 RMobilePhone::TMobilePhoneSecurityCode securityCode; |
|
2036 |
|
2037 TInt ret( KErrNone ); |
|
2038 |
|
2039 // 1st parameter: security code enum |
|
2040 ret = GetSecurityCode( aItem, securityCode ); |
|
2041 |
|
2042 if ( ret == KErrNone ) |
|
2043 { |
|
2044 CMmDataPackage package; |
|
2045 package.PackData( &securityCode ); |
|
2046 iRemainingAttempsLeftOngoing = ETrue; |
|
2047 ret = HandleRequestL( EMobilePhoneGetSecurityCodeInfo, &package ); |
|
2048 } |
|
2049 |
|
2050 return ret; |
|
2051 } |
|
2052 |
|
2053 // ----------------------------------------------------------------------------- |
|
2054 // CSecurity::SecurityInfoComplete |
|
2055 // ----------------------------------------------------------------------------- |
|
2056 // |
|
2057 void CSecurity::SecurityInfoComplete( TInt aErr, CMmDataPackage& aData ) |
|
2058 { |
|
2059 _LIT8( KLog, "CSecurity::SecurityInfoComplete, err = %d" ); |
|
2060 iSecurityLog->Log( ( TDesC8 ) KLog, aErr ); |
|
2061 |
|
2062 if ( iRemainingAttempsLeftOngoing || |
|
2063 iHandleSpecifiedRequests ) |
|
2064 { |
|
2065 RMobilePhone::TMobilePhoneSecurityCodeInfoV5 securityInfo; |
|
2066 RMobilePhone::TMobilePhoneSecurityCode type; |
|
2067 |
|
2068 // unpack the data |
|
2069 aData.UnPackData( type, securityInfo ); |
|
2070 |
|
2071 iRemainingAttempsLeftOngoing = EFalse; |
|
2072 |
|
2073 _LIT8( KAttempts, "CSecurity::SecurityInfoComplete, value for attempts = %d" ); |
|
2074 iSecurityLog->Log( ( TDesC8 ) KAttempts, securityInfo.iRemainingEntryAttempts ); |
|
2075 |
|
2076 Signal( aErr ); |
|
2077 } |
|
2078 } |
|
2079 |
|
2080 // ----------------------------------------------------------------------------- |
|
2081 // CSecurity::CompleteSecurityCodeInfoChange |
|
2082 // ----------------------------------------------------------------------------- |
|
2083 // |
|
2084 void CSecurity::CompleteSecurityCodeInfoChange( |
|
2085 TInt aErr, |
|
2086 CMmDataPackage& aData ) |
|
2087 { |
|
2088 _LIT8( KLog, "CSecurity::CompleteSecurityCodeInfoChange, err = %d" ); |
|
2089 iSecurityLog->Log( ( TDesC8 ) KLog, aErr ); |
|
2090 |
|
2091 // This should be called after veriying/changing security code |
|
2092 |
|
2093 if ( iVerifySecurityCodeOngoing || |
|
2094 iHandleSpecifiedRequests ) |
|
2095 { |
|
2096 iVerifySecurityCodeOngoing = EFalse; |
|
2097 |
|
2098 RMobilePhone::TMobilePhoneSecurityCodeInfoV5 securityInfo; |
|
2099 RMobilePhone::TMobilePhoneSecurityCode type; |
|
2100 // unpack the data |
|
2101 aData.UnPackData( type, securityInfo ); |
|
2102 |
|
2103 _LIT8( KAttempts, "CSecurity::CompleteSecurityCodeInfoChange, value for attempts = %d" ); |
|
2104 iSecurityLog->Log( ( TDesC8 ) KAttempts, securityInfo.iRemainingEntryAttempts ); |
|
2105 |
|
2106 if ( 3 != securityInfo.iRemainingEntryAttempts ) |
|
2107 { |
|
2108 _LIT8( KComplete, "CSecurity::CompleteSecurityCodeInfoChange, Failed" ); |
|
2109 iSecurityLog->Log( ( TDesC8 ) KComplete ); |
|
2110 aErr = KErrGeneral; |
|
2111 } |
|
2112 else |
|
2113 { |
|
2114 _LIT8( KComplete, "CSecurity::CompleteSecurityCodeInfoChange, completed" ); |
|
2115 iSecurityLog->Log( ( TDesC8 ) KComplete ); |
|
2116 } |
|
2117 |
|
2118 Signal( aErr ); |
|
2119 } |
|
2120 } |
|
2121 |
|
2122 |
|
2123 // ========================== OTHER EXPORTED FUNCTIONS ========================= |
|
2124 // None |
|
2125 |
|
2126 // End of File |
|