17 |
17 |
18 |
18 |
19 // INCLUDE FILES |
19 // INCLUDE FILES |
20 #include <bldvariant.hrh> // for feature definitions |
20 #include <bldvariant.hrh> // for feature definitions |
21 #include <etel.h> |
21 #include <etel.h> |
22 #include <SSSettingsPrivatePSKeys.h> |
22 #include <sssettingsprivatepskeys.h> |
23 #include <centralrepository.h> |
23 #include <centralrepository.h> |
24 #include <mmtsy_names.h> |
24 #include <mmtsy_names.h> |
25 #include <featmgr.h> |
25 #include <featmgr.h> |
26 |
26 |
27 #include "RCustomerServiceProfileCache.h" |
27 #include "rcustomerserviceprofilecache.h" |
28 #include "SSSettingsLogger.h" |
28 #include "sssettingslogger.h" |
29 |
29 |
30 // CONSTANTS |
30 // CONSTANTS |
31 #define KSSSettingsTSYName KMmTsyModuleName |
31 #define KSSSettingsTSYName KMmTsyModuleName |
32 const TInt KCspCacheTSYNameMaxLength( 80 ); |
32 const TInt KCspCacheTSYNameMaxLength( 80 ); |
33 const TInt KCspCacheETelRetryCount(8); |
33 const TInt KCspCacheETelRetryCount(8); |
78 |
78 |
79 // ----------------------------------------------------------------------------- |
79 // ----------------------------------------------------------------------------- |
80 // Constructor |
80 // Constructor |
81 // ----------------------------------------------------------------------------- |
81 // ----------------------------------------------------------------------------- |
82 EXPORT_C RCustomerServiceProfileCache::RCustomerServiceProfileCache() |
82 EXPORT_C RCustomerServiceProfileCache::RCustomerServiceProfileCache() |
83 :iData( NULL ),iOldCspFile(NULL) |
83 { |
84 { |
84 iData = NULL; |
85 } |
85 } |
86 |
86 |
87 // ----------------------------------------------------------------------------- |
87 // ----------------------------------------------------------------------------- |
88 // Destructor |
88 // Destructor |
89 // ----------------------------------------------------------------------------- |
89 // ----------------------------------------------------------------------------- |
460 { |
458 { |
461 User::Leave( error ); |
459 User::Leave( error ); |
462 } |
460 } |
463 User::LeaveIfError( |
461 User::LeaveIfError( |
464 CspCacheDoOpenEtelConnection( iData->iEtel, iData->iPhone ) ); |
462 CspCacheDoOpenEtelConnection( iData->iEtel, iData->iPhone ) ); |
465 |
463 |
466 if( iOldCspFile ) |
|
467 { |
|
468 delete iOldCspFile; |
|
469 iOldCspFile = NULL; |
|
470 } |
|
471 // Create and reset old CSP file variable. |
464 // Create and reset old CSP file variable. |
472 iOldCspFile = new ( ELeave ) RMobilePhone::TMobilePhoneCspFileV1; |
465 iOldCspFile = new ( ELeave ) RMobilePhone::TMobilePhoneCspFileV1; |
473 DoResetOldCspFile(); |
466 DoResetOldCspFile(); |
474 __SSSLOGSTRING("[SSS] <-- RCustomerServiceProfileCache::DoOpenL"); |
467 __SSSLOGSTRING("[SSS] <-- RCustomerServiceProfileCache::DoOpenL"); |
475 } |
468 } |
500 if ( error == KErrNotFound && aGroup == ESsCspGroup1 ) |
493 if ( error == KErrNotFound && aGroup == ESsCspGroup1 ) |
501 { |
494 { |
502 error = DefineAndSetValue( KPSUidSSConfig, KSettingsCspCache1, value ); |
495 error = DefineAndSetValue( KPSUidSSConfig, KSettingsCspCache1, value ); |
503 } |
496 } |
504 else if ( error == KErrNotFound && aGroup == ESsCspGroup2 ) |
497 else if ( error == KErrNotFound && aGroup == ESsCspGroup2 ) |
505 { |
498 { |
506 error = DefineAndSetValue( KPSUidSSConfig, KSettingsCspCache2, value ); |
499 error = DefineAndSetValue( KPSUidSSConfig, KSettingsCspCache2, value ); |
507 } |
500 } |
508 |
501 |
509 if ( error == KErrNone ) |
502 if ( error == KErrNone ) |
510 { |
503 { |
511 if ( value != KCspCacheNoFile ) |
504 if ( value != KCspCacheNoFile ) |
512 { |
505 { |
513 __SSSLOGSTRING("[SSS] ---> GetCustomerServiceProfile"); |
506 __SSSLOGSTRING("[SSS] ---> GetCustomerServiceProfile"); |
514 TRequestStatus status; |
507 TRequestStatus status; |
515 // GetCustomerServiceProfile status returns KErrNotFound if CSP product profile is OFF. |
508 // GetCustomerServiceProfile status returns KErrNotFound if CSP product profile is OFF. |
516 iData->iPhone.GetCustomerServiceProfile( |
509 iData->iPhone.GetCustomerServiceProfile( |
517 status , |
510 status , |
518 iData->iCspFilePckg ); |
511 iData->iCspFilePckg ); |
519 User::WaitForRequest( status ); |
512 User::WaitForRequest( status ); |
520 error = status.Int(); |
513 error = status.Int(); |
521 __SSSLOGSTRING1("[SSS] <--- GetCustomerServiceProfile: error: %d", error); |
514 __SSSLOGSTRING1("[SSS] <--- GetCustomerServiceProfile: error: %d", error); |
522 |
515 |
523 if (( error == KErrNotReady ) || ( error == KErrServerBusy )) |
516 if (( error == KErrNotReady ) || ( error == KErrServerBusy )) |
524 { |
517 { |
525 return error; |
518 return error; |
526 } |
519 } |
527 } |
520 } |
528 else // CSP has been read return value, if value is KCspCacheNoFile then return KErrNotSupported. |
521 else // CSP has been read return value, if value is KCspCacheNoFile then return KErrNotSupported. |
529 { |
522 { |
530 __SSSLOGSTRING("[SSS] CSP file cannot be found from SIM"); |
523 __SSSLOGSTRING("[SSS] CSP file cannot be found from SIM"); |
531 return KErrNotSupported; |
524 return KErrNotSupported; |
532 } |
525 } |
533 |
526 |
534 if ( error == KErrNone ) |
527 if ( error == KErrNone ) |
535 { |
528 { |
536 if ( aGroup == ESsCspGroup1 ) |
529 if ( aGroup == ESsCspGroup1 ) |
537 { |
530 { |
583 __SSSLOGSTRING("[SSS] DefineAndSetValue -> KSettingsCspCache2"); |
576 __SSSLOGSTRING("[SSS] DefineAndSetValue -> KSettingsCspCache2"); |
584 defError = DefineAndSetValue( KPSUidSSConfig, KSettingsCspCache2, value ); |
577 defError = DefineAndSetValue( KPSUidSSConfig, KSettingsCspCache2, value ); |
585 } |
578 } |
586 |
579 |
587 // Do not set error if defError is KErrNone. If Define/Set failed then error value is set. |
580 // Do not set error if defError is KErrNone. If Define/Set failed then error value is set. |
588 if ( defError != KErrNone ) |
581 if ( defError != KErrNone ) |
589 { |
582 { |
590 error = defError; |
583 error = defError; |
591 } |
584 } |
592 } |
585 } |
593 |
586 |
594 __SSSLOGSTRING1("[SSS] RCustomerServiceProfileCache::DoGetValues: error: %d", error); |
587 __SSSLOGSTRING1("[SSS] RCustomerServiceProfileCache::DoGetValues: error: %d", error); |
595 __SSSLOGSTRING("[SSS] <-- RCustomerServiceProfileCache::DoGetValues"); |
588 __SSSLOGSTRING("[SSS] <-- RCustomerServiceProfileCache::DoGetValues"); |
596 return error; |
589 return error; |