cellular/SSSettings/src/RCustomerServiceProfileCache.cpp
branchRCL_3
changeset 20 987c9837762f
parent 19 7d48bed6ce0c
equal deleted inserted replaced
19:7d48bed6ce0c 20:987c9837762f
    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     {
    83 	:iData( NULL ),iOldCspFile(NULL)
    84     iData = NULL;
    84     {
    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;
   122         return;
   124         return;
   123         }
   125         }
   124 
   126 
   125     iData->iPhone.Close();
   127     iData->iPhone.Close();
   126     iData->iEtel.Close();
   128     iData->iEtel.Close();
   458         {
   460         {
   459         User::Leave( error );
   461         User::Leave( error );
   460         }
   462         }
   461     User::LeaveIfError( 
   463     User::LeaveIfError( 
   462         CspCacheDoOpenEtelConnection( iData->iEtel, iData->iPhone ) );
   464         CspCacheDoOpenEtelConnection( iData->iEtel, iData->iPhone ) );
   463 
   465     
       
   466     if( iOldCspFile )
       
   467     	{    	
       
   468     	delete iOldCspFile;
       
   469     	iOldCspFile = NULL;
       
   470     	}
   464     // Create and reset old CSP file variable.
   471     // Create and reset old CSP file variable.
   465     iOldCspFile = new ( ELeave ) RMobilePhone::TMobilePhoneCspFileV1;
   472     iOldCspFile = new ( ELeave ) RMobilePhone::TMobilePhoneCspFileV1;
   466     DoResetOldCspFile();
   473     DoResetOldCspFile();
   467     __SSSLOGSTRING("[SSS] <-- RCustomerServiceProfileCache::DoOpenL");
   474     __SSSLOGSTRING("[SSS] <-- RCustomerServiceProfileCache::DoOpenL");
   468     }
   475     }
   493     if ( error == KErrNotFound && aGroup == ESsCspGroup1 )
   500     if ( error == KErrNotFound && aGroup == ESsCspGroup1 )
   494         {
   501         {
   495         error = DefineAndSetValue( KPSUidSSConfig, KSettingsCspCache1, value );
   502         error = DefineAndSetValue( KPSUidSSConfig, KSettingsCspCache1, value );
   496         }
   503         }
   497     else if ( error == KErrNotFound && aGroup == ESsCspGroup2 )
   504     else if ( error == KErrNotFound && aGroup == ESsCspGroup2 )
   498         {
   505     	{
   499         error = DefineAndSetValue( KPSUidSSConfig, KSettingsCspCache2, value ); 
   506     	error = DefineAndSetValue( KPSUidSSConfig, KSettingsCspCache2, value );	
   500         }
   507     	}
   501 
   508 
   502     if ( error == KErrNone )
   509     if ( error == KErrNone )
   503         {
   510         {
   504         if ( value != KCspCacheNoFile ) 
   511         if ( value != KCspCacheNoFile ) 
   505             {   
   512          	{	
   506             __SSSLOGSTRING("[SSS] ---> GetCustomerServiceProfile");             
   513          	__SSSLOGSTRING("[SSS] ---> GetCustomerServiceProfile");         	
   507             TRequestStatus status;
   514 	        TRequestStatus status;
   508             // GetCustomerServiceProfile status returns KErrNotFound if CSP product profile is OFF.
   515 	        // GetCustomerServiceProfile status returns KErrNotFound if CSP product profile is OFF.
   509             iData->iPhone.GetCustomerServiceProfile(
   516 	        iData->iPhone.GetCustomerServiceProfile(
   510                status ,
   517 	           status ,
   511                iData->iCspFilePckg );
   518 	           iData->iCspFilePckg );
   512             User::WaitForRequest( status );
   519 	        User::WaitForRequest( status );
   513             error = status.Int();
   520 	        error = status.Int();
   514             __SSSLOGSTRING1("[SSS] <--- GetCustomerServiceProfile: error: %d", error); 
   521 	        __SSSLOGSTRING1("[SSS] <--- GetCustomerServiceProfile: error: %d", error); 
   515              
   522 	         
   516             if (( error == KErrNotReady ) || ( error == KErrServerBusy ))
   523 	        if (( error == KErrNotReady ) || ( error == KErrServerBusy ))
   517                 {
   524 		        {
   518                 return error;
   525 		        return error;
   519                 }  
   526 		        }  
   520             }
   527          	}
   521         else // CSP has been read return value, if value is KCspCacheNoFile then return KErrNotSupported.
   528         else // CSP has been read return value, if value is KCspCacheNoFile then return KErrNotSupported.
   522             {
   529         	{
   523             __SSSLOGSTRING("[SSS] CSP file cannot be found from SIM"); 
   530         	__SSSLOGSTRING("[SSS] CSP file cannot be found from SIM"); 
   524             return KErrNotSupported;    
   531 			return KErrNotSupported;	
   525             }
   532         	}
   526 
   533 
   527         if ( error == KErrNone )
   534         if ( error == KErrNone )
   528             {
   535             {
   529             if ( aGroup == ESsCspGroup1 )
   536             if ( aGroup == ESsCspGroup1 )
   530                 {
   537                 {
   556                 }
   563                 }
   557             aValue = value;
   564             aValue = value;
   558             }
   565             }
   559         else
   566         else
   560             {
   567             {
   561             value = KCspCacheNoFile;
   568            	value = KCspCacheNoFile;
   562             error = KErrNotSupported;
   569             error = KErrNotSupported;
   563             }                        
   570             }                        
   564         }
   571         }
   565         
   572         
   566         if (( error == KErrNone ) || ( error == KErrNotSupported ))
   573         if (( error == KErrNone ) || ( error == KErrNotSupported ))
   576                 __SSSLOGSTRING("[SSS]   DefineAndSetValue -> KSettingsCspCache2");
   583                 __SSSLOGSTRING("[SSS]   DefineAndSetValue -> KSettingsCspCache2");
   577                 defError = DefineAndSetValue( KPSUidSSConfig, KSettingsCspCache2, value );
   584                 defError = DefineAndSetValue( KPSUidSSConfig, KSettingsCspCache2, value );
   578                 }
   585                 }
   579                 
   586                 
   580             // Do not set error if defError is KErrNone. If Define/Set failed then error value is set.
   587             // Do not set error if defError is KErrNone. If Define/Set failed then error value is set.
   581             if  ( defError != KErrNone )
   588             if	( defError != KErrNone )
   582                 {
   589             	{
   583                 error = defError;
   590             	error = defError;
   584                 }
   591             	}
   585             }
   592             }
   586         
   593         
   587     __SSSLOGSTRING1("[SSS]    RCustomerServiceProfileCache::DoGetValues: error: %d", error);
   594     __SSSLOGSTRING1("[SSS]    RCustomerServiceProfileCache::DoGetValues: error: %d", error);
   588     __SSSLOGSTRING("[SSS] <-- RCustomerServiceProfileCache::DoGetValues");
   595     __SSSLOGSTRING("[SSS] <-- RCustomerServiceProfileCache::DoGetValues");
   589     return error;
   596     return error;