realtimenetprots/sipfw/ProfileAgent/Server/Src/SipProfileServerCore.cpp
changeset 17 bfe1f539b721
parent 15 8248b03a2669
child 21 9565022eef45
equal deleted inserted replaced
15:8248b03a2669 17:bfe1f539b721
   758 
   758 
   759 	if ( aProfile->IsDefault() )
   759 	if ( aProfile->IsDefault() )
   760         {
   760         {
   761         CSIPConcreteProfile* defaultProfile = FindDefaultProfile();
   761         CSIPConcreteProfile* defaultProfile = FindDefaultProfile();
   762         
   762         
   763         if ( defaultProfile && defaultProfile != aProfile )
   763         if ( defaultProfile && defaultProfile->Id() != aProfile->Id() )
   764         	{
   764         	{
   765         	defaultProfile->SetDefault( EFalse );
   765         	defaultProfile->SetDefault( EFalse );
   766         	}
   766         	}
   767         }
   767         }
   768 	
   768 	
   783         {
   783         {
   784         return &item->Profile();
   784         return &item->Profile();
   785         }
   785         }
   786     return NULL;
   786     return NULL;
   787     }
   787     }
       
   788 
       
   789 // ----------------------------------------------------------------------------------
       
   790 // CSIPProfileServerCore::Profile. Returns modifiable ConcreteProfile object pointer
       
   791 // ----------------------------------------------------------------------------------
       
   792 //
       
   793 CSIPConcreteProfile*
       
   794 CSIPProfileServerCore::Profile(TUint32 aProfileId)
       
   795     {
       
   796     CSIPProfileCacheItem* item = ProfileCacheItem(aProfileId);
       
   797     if (item)
       
   798         {
       
   799         return &item->Profile();
       
   800         }
       
   801     return NULL;
       
   802     }
       
   803 
   788 
   804 
   789 // -----------------------------------------------------------------------------
   805 // -----------------------------------------------------------------------------
   790 // CSIPProfileServerCore::ProfileDefaultL
   806 // CSIPProfileServerCore::ProfileDefaultL
   791 // -----------------------------------------------------------------------------
   807 // -----------------------------------------------------------------------------
   792 //
   808 //
  1074 	CSIPProfileCacheItem* item = ProfileCacheItemL(aProfileId);
  1090 	CSIPProfileCacheItem* item = ProfileCacheItemL(aProfileId);
  1075     TBool isVpnInUse = (FeatureManager::FeatureSupported( KFeatureIdFfImsDeregistrationInVpn )
  1091     TBool isVpnInUse = (FeatureManager::FeatureSupported( KFeatureIdFfImsDeregistrationInVpn )
  1076                              && item->IsVpnInUse());
  1092                              && item->IsVpnInUse());
  1077     
  1093     
  1078     const CSIPConcreteProfile* profile = Profile(aProfileId);
  1094     const CSIPConcreteProfile* profile = Profile(aProfileId);
  1079     if(FeatureManager::FeatureSupported( KFeatureIdFfSipApnSwitching ) 
  1095     if(profile && FeatureManager::FeatureSupported( KFeatureIdFfSipApnSwitching ) 
  1080         && CheckApnSwitchEnabledL( *profile ) && !item->IsRfsInprogress() && !isVpnInUse )
  1096         && CheckApnSwitchEnabledL( *profile ) && !item->IsRfsInprogress() && !isVpnInUse )
  1081         {
  1097         {
  1082         PROFILE_DEBUG1("CSIPProfileServerCore::EnableProfileL, SwichEnabled")
  1098         PROFILE_DEBUG1("CSIPProfileServerCore::EnableProfileL, SwichEnabled")
  1083         if(CheckIapSettings( aProfileId ))
  1099         if(CheckIapSettings( aProfileId ))
  1084             {
  1100             {
  1138     //perform cleanup and send event notification
  1154     //perform cleanup and send event notification
  1139     
  1155     
  1140     if(CSIPConcreteProfile::EUnregistered != item->UsedProfile().Status())
  1156     if(CSIPConcreteProfile::EUnregistered != item->UsedProfile().Status())
  1141     	{
  1157     	{
  1142     	PROFILE_DEBUG3("CSIPProfileServerCore::ForceDisableProfileL, Forcibly disabling profile", aProfileId);
  1158     	PROFILE_DEBUG3("CSIPProfileServerCore::ForceDisableProfileL, Forcibly disabling profile", aProfileId);
  1143     	item->SwitchToUnregisteredState();
  1159     	item->SwitchToUnregisteredState(EFalse);
  1144     	iPluginDirector->TerminateHandling(item->UsedProfile());
  1160     	iPluginDirector->TerminateHandling(item->UsedProfile());
  1145     	item->ClearMigrationProfiles();
  1161     	item->ClearMigrationProfiles();
  1146     	iPluginDirector->StartTimerForCleanup();
  1162     	iPluginDirector->StartTimerForCleanup();
  1147     	item->ClearOldProfile();
  1163     	item->ClearOldProfile();
  1148     	SendProfileForciblyDisabledEvent(*item);
  1164     	SendProfileForciblyDisabledEvent(*item);
  2165                 
  2181                 
  2166                 TInt err( aError );
  2182                 TInt err( aError );
  2167                 TInt error(KErrNone);
  2183                 TInt error(KErrNone);
  2168                 PROFILE_DEBUG3("CSIPProfileServerCore::ApnChanged, Profile Id", profile->Id())
  2184                 PROFILE_DEBUG3("CSIPProfileServerCore::ApnChanged, Profile Id", profile->Id())
  2169                 CSIPProfileCacheItem* item = ProfileCacheItem(profile->Id());
  2185                 CSIPProfileCacheItem* item = ProfileCacheItem(profile->Id());
  2170                 TBool isVpnInUse = (FeatureManager::FeatureSupported( KFeatureIdFfImsDeregistrationInVpn )
  2186                 if(item)
  2171                                              && item->IsVpnInUse());
       
  2172                 if ( err == KErrNone && CheckIapSettings(profile->Id()))
       
  2173                     {
  2187                     {
  2174                     if(switchEnabledProfile.operation == TStoreSwitchEnabledProfile::Update)
  2188 	                TBool isVpnInUse = (FeatureManager::FeatureSupported( KFeatureIdFfImsDeregistrationInVpn )
  2175                         {
  2189 	                                             && item->IsVpnInUse());
  2176                         TRAP(error, item->UpdateRegistrationL(*(switchEnabledProfile.iObserver)));
  2190 	                if ( err == KErrNone && CheckIapSettings(profile->Id()))
  2177                         }
  2191 	                    {
  2178                     else if(switchEnabledProfile.operation == TStoreSwitchEnabledProfile::Enable && !item->IsRfsInprogress() && !isVpnInUse)                    
  2192 	                    if(switchEnabledProfile.operation == TStoreSwitchEnabledProfile::Update)
  2179                         {
  2193 	                        {
  2180                         TRAP(error, iAlrHandler->EnableProfileL(*item, *(switchEnabledProfile.iObserver)));
  2194 	                        TRAP(error, item->UpdateRegistrationL(*(switchEnabledProfile.iObserver)));
  2181                         }
  2195 	                        }
  2182                     else if(switchEnabledProfile.operation == TStoreSwitchEnabledProfile::Register)
  2196 	                    else if(switchEnabledProfile.operation == TStoreSwitchEnabledProfile::Enable && !item->IsRfsInprogress() && !isVpnInUse)                    
  2183                         {
  2197 	                        {
  2184                         TRAP(error, item->StartRegisterL(*iWaitForIAP, *iRegInProg, ETrue));
  2198 	                        TRAP(error, iAlrHandler->EnableProfileL(*item, *(switchEnabledProfile.iObserver)));
  2185                         }
  2199 	                        }
  2186                     }
  2200 	                    else if(switchEnabledProfile.operation == TStoreSwitchEnabledProfile::Register)
  2187                 if ( err != KErrNone || error)
  2201 	                        {
  2188                     {
  2202 	                        TRAP(error, item->StartRegisterL(*iWaitForIAP, *iRegInProg, ETrue));
  2189                      PROFILE_DEBUG1("CSIPProfileServerCore::ApnChanged, error handling")
  2203 	                        }
  2190                      HandleAsyncError(*item, profile->Status(), err);
  2204 	                    }
       
  2205 	                if ( err != KErrNone || error)
       
  2206 	                    {
       
  2207 	                     PROFILE_DEBUG1("CSIPProfileServerCore::ApnChanged, error handling")
       
  2208 	                     HandleAsyncError(*item, profile->Status(), err);
       
  2209 	                    }
  2191                     }
  2210                     }
  2192                 }
  2211                 }
  2193             }
  2212             }
  2194         }
  2213         }
  2195     PROFILE_DEBUG1("CSIPProfileServerCore::ApnChanged, exit")    
  2214     PROFILE_DEBUG1("CSIPProfileServerCore::ApnChanged, exit")