gssettingsuis/Gs/GSNetworkPlugin/Src/PSMNetworkPlugin.cpp
branchRCL_3
changeset 12 bdac6c462392
parent 0 8c5d936e5675
equal deleted inserted replaced
11:23553eb4e470 12:bdac6c462392
    51 void CPSMNetworkPlugin::ConstructL()
    51 void CPSMNetworkPlugin::ConstructL()
    52     {
    52     {
    53     __GSLOGSTRING( "[GS]-->[CPSMNetworkPlugin::ConstructL]" );
    53     __GSLOGSTRING( "[GS]-->[CPSMNetworkPlugin::ConstructL]" );
    54     
    54     
    55     iModel = CGSNetworkPluginModel::NewL( NULL,NULL );
    55     iModel = CGSNetworkPluginModel::NewL( NULL,NULL );
       
    56     iPsmRepository = CRepository::NewL( KCRUidPowerSaveMode );
       
    57     // Read from CenRep so iPsmMode gets correct init value
       
    58     TInt psmMode;
       
    59     iPsmRepository->Get( KPsmCurrentMode, psmMode );
       
    60     iPsmMode = ( TPsmsrvMode )psmMode;
    56     
    61     
    57     __GSLOGSTRING( "[GS]<--[CPSMNetworkPlugin::ConstructL]" );
    62     __GSLOGSTRING( "[GS]<--[CPSMNetworkPlugin::ConstructL]" );
    58     }
    63     }
    59 
    64 
    60 //
    65 //
    82 CPSMNetworkPlugin::~CPSMNetworkPlugin()
    87 CPSMNetworkPlugin::~CPSMNetworkPlugin()
    83 	{
    88 	{
    84     __GSLOGSTRING( "[CPSMNetworkPlugin::~CPSMNetworkPlugin]" );
    89     __GSLOGSTRING( "[CPSMNetworkPlugin::~CPSMNetworkPlugin]" );
    85     delete iModel;
    90     delete iModel;
    86     iModel = NULL;
    91     iModel = NULL;
       
    92     delete iPsmRepository;
       
    93     iPsmRepository = NULL;
    87 	}
    94 	}
    88 
    95 
    89 // ---------------------------------------------------------
    96 // ---------------------------------------------------------
    90 // CPSMNetworkPlugin::IsPhoneOfflineL
    97 // CPSMNetworkPlugin::IsPhoneOfflineL
    91 //
    98 //
   128 // CPSMNetworkPlugin::NotifyModeChange()
   135 // CPSMNetworkPlugin::NotifyModeChange()
   129 // ----------------------------------------------------------------------------------
   136 // ----------------------------------------------------------------------------------
   130 //
   137 //
   131 void CPSMNetworkPlugin::DoModeChangeL( const TInt aMode )
   138 void CPSMNetworkPlugin::DoModeChangeL( const TInt aMode )
   132     {
   139     {
       
   140 	TPsmsrvMode newMode = ( TPsmsrvMode )aMode;
   133     if ( !IsPhoneOfflineL() && 
   141     if ( !IsPhoneOfflineL() && 
   134          FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma ) &&
   142          FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma ) &&
   135          iModel->IsNetworkModeVisible() )
   143          iModel->IsNetworkModeVisible() && IsChangeNetworkMode ( iPsmMode, newMode ) )
   136         {
   144         {
   137         RConfigInfoArray infoArray;
   145         RConfigInfoArray infoArray;
   138     
   146     
   139         TPsmsrvConfigInfo info1;
   147         TPsmsrvConfigInfo info1;
   140         info1.iConfigId = ENetworkMode;
   148         info1.iConfigId = ENetworkMode;
   141         info1.iConfigType = EConfigTypeInt;
   149         info1.iConfigType = EConfigTypeInt;
   142         info1.iIntValue = iModel->GetNetworkMode();
   150         info1.iIntValue = iModel->GetNetworkMode();
   143         infoArray.Append( info1 );
   151         infoArray.Append( info1 );
   144     
   152         
   145         __GSLOGSTRING1( "[CPSMNetworkPlugin::NotifyModeChangeL] Switching to mode:%d", aMode );
   153         __GSLOGSTRING1( "[CPSMNetworkPlugin::NotifyModeChangeL] Switching to mode:%d", aMode );
   146     
   154     
   147         __GSLOGSTRING1( "[CPSMNetworkPlugin::NotifyModeChangeL]: oldValue info1: %d", infoArray[0].iIntValue );
   155         __GSLOGSTRING1( "[CPSMNetworkPlugin::NotifyModeChangeL]: oldValue info1: %d", infoArray[0].iIntValue );
   148     
   156     
   149         iSettingsProvider.BackupAndGetSettingsL( infoArray, KPSMNetworkPluginStorageId );
   157         iSettingsProvider.BackupAndGetSettingsL( infoArray, KPSMNetworkPluginStorageId );
   159         
   167         
   160         infoArray.Reset();       
   168         infoArray.Reset();       
   161         }
   169         }
   162     }
   170     }
   163 
   171 
       
   172 // ----------------------------------------------------------------------------------
       
   173 // CPSMNetworkPlugin::IsChangeNetworkMode
       
   174 // ----------------------------------------------------------------------------------
       
   175 //
       
   176 TBool CPSMNetworkPlugin::IsChangeNetworkMode( TPsmsrvMode& aOldMode, TPsmsrvMode aNewMode )
       
   177 	{
       
   178 	TPsmsrvMode oldMode = aOldMode;
       
   179 	aOldMode = aNewMode;
       
   180 	if ( ( oldMode == EPsmsrvModeNormal && aNewMode == EPsmsrvPartialMode )
       
   181 			|| ( oldMode == EPsmsrvModePowerSave && aNewMode
       
   182 					== EPsmsrvPartialMode ) )
       
   183 		{
       
   184 		return EFalse;
       
   185 		}
       
   186 	else
       
   187 		{
       
   188 		return ETrue;
       
   189 		}
       
   190 	}
       
   191 
   164 //End of File
   192 //End of File
   165 
   193 
   166 
   194