realtimenetprots/sipfw/ProfileAgent/ApnManager/src/sipapnconfigurationhandler.cpp
changeset 34 3c8db403127f
parent 27 740ceea8e153
child 42 69df6ed78a6a
equal deleted inserted replaced
27:740ceea8e153 34:3c8db403127f
   124 
   124 
   125 // -----------------------------------------------------------------------------
   125 // -----------------------------------------------------------------------------
   126 // CSIPApnConfigurationHandler::ReadCurrentApnL
   126 // CSIPApnConfigurationHandler::ReadCurrentApnL
   127 // -----------------------------------------------------------------------------
   127 // -----------------------------------------------------------------------------
   128 //
   128 //
   129 HBufC8* CSIPApnConfigurationHandler::ReadCurrentApnL()
   129 void CSIPApnConfigurationHandler::ReadCurrentApnL()
   130 	{
   130 	{
   131 	HBufC8* apn(NULL);
   131 	HBufC8* apn(NULL);
   132 		
   132 		
   133 	using namespace CommsDat;
   133 	using namespace CommsDat;
   134 	
   134 	
   191 		apn = HBufC8::NewL( currApn.Length() );
   191 		apn = HBufC8::NewL( currApn.Length() );
   192 		apn->Des().Copy( currApn );
   192 		apn->Des().Copy( currApn );
   193 		
   193 		
   194 		delete iCurrentApn;
   194 		delete iCurrentApn;
   195 		iCurrentApn = NULL;
   195 		iCurrentApn = NULL;
   196 		iCurrentApn = apn->AllocL();
   196 		iCurrentApn = apn;
   197         }
   197         }
   198     
   198     
   199     db->ClearAttributeMask( ECDHidden );
   199     db->ClearAttributeMask( ECDHidden );
   200     
   200     
   201     CleanupStack::PopAndDestroy( iapRecord );
   201     CleanupStack::PopAndDestroy( iapRecord );
   202     CleanupStack::PopAndDestroy( db );
   202     CleanupStack::PopAndDestroy( db );
   203     
       
   204     return apn;
       
   205 	}
   203 	}
   206 
   204 
   207 // -----------------------------------------------------------------------------
   205 // -----------------------------------------------------------------------------
   208 // CSIPApnConfigurationHandler::HasPendingTasks
   206 // CSIPApnConfigurationHandler::HasPendingTasks
   209 // -----------------------------------------------------------------------------
   207 // -----------------------------------------------------------------------------
   325 	PROFILE_DEBUG1( 
   323 	PROFILE_DEBUG1( 
   326 	        "CSIPApnConfigurationHandler::ConstructL()" )
   324 	        "CSIPApnConfigurationHandler::ConstructL()" )
   327 	
   325 	
   328 	User::LeaveIfError( iSocketSrv.Connect() );
   326 	User::LeaveIfError( iSocketSrv.Connect() );
   329 	iRepository = CRepository::NewL( KCRUidCmManager );
   327 	iRepository = CRepository::NewL( KCRUidCmManager );
       
   328 	ReadCurrentApnL();
   330 	PROFILE_DEBUG1( 
   329 	PROFILE_DEBUG1( 
   331 	        "CSIPApnConfigurationHandler::ConstructL() exit" )
   330 	        "CSIPApnConfigurationHandler::ConstructL() exit" )
   332 	}
   331 	}
   333 
   332 
   334 // -----------------------------------------------------------------------------
   333 // -----------------------------------------------------------------------------
   476     {
   475     {
   477     PROFILE_DEBUG1( 
   476     PROFILE_DEBUG1( 
   478             "CSIPApnConfigurationHandler::ApnChangeNeededL()" )
   477             "CSIPApnConfigurationHandler::ApnChangeNeededL()" )
   479 
   478 
   480  	TBool apnChangeNeeded( EFalse );
   479  	TBool apnChangeNeeded( EFalse );
   481  	HBufC8* currentApn = ReadCurrentApnL();
   480 	if ( iCurrentApn && iCurrentApn->Compare( aApn ) != 0 )
   482 
       
   483 	if ( currentApn && currentApn->Compare( aApn ) != 0 )
       
   484         {
   481         {
   485         // Apn is not the same as wanted
   482         // Apn is not the same as wanted
   486         apnChangeNeeded = ETrue;
   483         apnChangeNeeded = ETrue;
   487         }
   484         }
   488 
       
   489 	delete currentApn;
       
   490 
   485 
   491 	PROFILE_DEBUG3( 
   486 	PROFILE_DEBUG3( 
   492 	        "CSIPApnConfigurationHandler::ApnChangeNeededL(), apnChangeNeeded",
   487 	        "CSIPApnConfigurationHandler::ApnChangeNeededL(), apnChangeNeeded",
   493 	        apnChangeNeeded )
   488 	        apnChangeNeeded )
   494     return apnChangeNeeded;
   489     return apnChangeNeeded;
   794 //
   789 //
   795 void CSIPApnConfigurationHandler::SendApnChangedNotificationL( 
   790 void CSIPApnConfigurationHandler::SendApnChangedNotificationL( 
   796     const TDesC8& aNewApn, 
   791     const TDesC8& aNewApn, 
   797     TInt aError )
   792     TInt aError )
   798     {
   793     {
   799     if ( !IsPrimaryApnUsed() )
   794     HBufC8* currentApn = aNewApn.AllocL();
   800         {
   795     delete iCurrentApn;
   801         HBufC8* currentApn = aNewApn.AllocL();
   796     iCurrentApn = NULL;
   802         delete iCurrentApn;
   797     iCurrentApn = currentApn;
   803         iCurrentApn = NULL;
   798     if ( IsPrimaryApnUsed() )
   804         iCurrentApn = currentApn;
   799         {
   805         
       
   806         iObserver.ApnChanged( *iCurrentApn, iIapId, aError );
   800         iObserver.ApnChanged( *iCurrentApn, iIapId, aError );
   807         }
   801         }
   808     }
   802     }
   809 
   803 
   810 // -----------------------------------------------------------------------------
   804 // -----------------------------------------------------------------------------