cellular/SSSettings/src/RCustomerServiceProfileCache.cpp
branchRCL_3
changeset 19 7d48bed6ce0c
parent 0 ff3b6d0fd310
child 20 987c9837762f
equal deleted inserted replaced
18:594d59766373 19:7d48bed6ce0c
    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 // -----------------------------------------------------------------------------
   117 EXPORT_C void RCustomerServiceProfileCache::Close()
   117 EXPORT_C void RCustomerServiceProfileCache::Close()
   118     {
   118     {
   119     __SSSLOGSTRING("[SSS]--> RCustomerServiceProfileCache::Close");
   119     __SSSLOGSTRING("[SSS]--> RCustomerServiceProfileCache::Close");
   120     if ( iData == NULL )
   120     if ( iData == NULL )
   121         {
   121         {
   122         delete iOldCspFile;
       
   123         iOldCspFile = NULL;
       
   124         return;
   122         return;
   125         }
   123         }
   126 
   124 
   127     iData->iPhone.Close();
   125     iData->iPhone.Close();
   128     iData->iEtel.Close();
   126     iData->iEtel.Close();
   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                 {
   563                 }
   556                 }
   564             aValue = value;
   557             aValue = value;
   565             }
   558             }
   566         else
   559         else
   567             {
   560             {
   568            	value = KCspCacheNoFile;
   561             value = KCspCacheNoFile;
   569             error = KErrNotSupported;
   562             error = KErrNotSupported;
   570             }                        
   563             }                        
   571         }
   564         }
   572         
   565         
   573         if (( error == KErrNone ) || ( error == KErrNotSupported ))
   566         if (( error == KErrNone ) || ( error == KErrNotSupported ))
   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;