bearermanagement/mpm/src/mpmserver.cpp
changeset 71 9f263f780e41
parent 59 2709c04a4af5
child 72 0c32cf868819
--- a/bearermanagement/mpm/src/mpmserver.cpp	Wed Oct 27 17:43:56 2010 +0300
+++ b/bearermanagement/mpm/src/mpmserver.cpp	Wed Oct 27 17:51:11 2010 +0300
@@ -905,6 +905,7 @@
     MPMLOGSTRING2( "CMPMServer::NotifyBMPrefIapL - IAPs count: %d", 
         aIapInfo.iCount)
     TConnMonIapInfo iapInfo = aIapInfo;
+    iCaller = aCaller;
     
 #ifdef _DEBUG
     for (TUint i = 0; i < iapInfo.Count(); i++)
@@ -947,15 +948,8 @@
         StartForcedRoamingFromWlanL( iapInfo );
         }
     
-    MPMLOGSTRING2(
-    "CMPMServer::NotifyBMPrefIapL - Send notifications for %d sessions", 
-        iSessions.Count() )
-
-    for ( TInt i = 0; i < iSessions.Count(); i++ )
-        {
-        iapInfo = iSessions[i]->GetAvailableIAPs( );
-        iSessions[i]->PrefIAPNotificationL( iapInfo, aCaller );
-        }
+    // Send notifications for all sessions
+      SendPrefIAPNotificationL();
     }
 
 
@@ -1554,8 +1548,21 @@
 TInt CMPMServer::StartForcedRoamingToConnectedWlanL( TAny* aUpdater )
     {
     MPMLOGSTRING( "CMPMServer::StartForcedRoamingToConnectedWlanL" );
-    TRAPD( error, static_cast<CMPMServer*>( aUpdater )->StartForcedRoamingToWlanL( 
-           static_cast<CMPMServer*>( aUpdater )->iConnMonIapInfo ) )
+    CMPMServer* self = static_cast<CMPMServer*>( aUpdater );
+    
+    // If IAP availability change was received when connection
+    // was in starting state, then roaming to WLAN didnot happen
+    // at that stage. So, send preferred IAP notification again 
+    // after WLAN is connected. 
+    //
+    TRAPD( err, self->SendPrefIAPNotificationL() );
+    if ( err )
+        {           
+        MPMLOGSTRING2("CMPMServer::StartForcedRoamingToConnectedWlan error = %d, ", err )
+        return 0;
+        }
+    
+    TRAPD( error, self->StartForcedRoamingToWlanL( self->iConnMonIapInfo ) )
     if ( error )
         {        	
         MPMLOGSTRING2("CMPMServer::StartForcedRoamingToConnectedWlan error1 = %d, ", error )
@@ -1565,8 +1572,7 @@
     // Added also execution of policy based roaming logic because
     // connections that are in EStarting state, when WLAN signal
     // gets weak, would remain in WLAN as long as signal is weak. 
-    TRAP( error, static_cast<CMPMServer*>( aUpdater )->StartForcedRoamingFromWlanL(
-          static_cast<CMPMServer*>( aUpdater )->iConnMonIapInfo ) )
+    TRAP( error, self->StartForcedRoamingFromWlanL( self->iConnMonIapInfo ) )
     if ( error )
         {        	
         MPMLOGSTRING2("CMPMServer::StartForcedRoamingToConnectedWlan error2 = %d, ", error )
@@ -1575,6 +1581,25 @@
     return 0;
     }
 
+// ---------------------------------------------------------------------------
+// CMPMServer::SendPrefIAPNotificationL
+// ---------------------------------------------------------------------------
+//    
+
+void CMPMServer::SendPrefIAPNotificationL()
+    {
+    MPMLOGSTRING( "CMPMServer::SendPrefIAPNotificationL" )
+            
+    MPMLOGSTRING2(
+     "CMPMServer::SendPrefIAPNotificationL - Send notifications for %d sessions", 
+         iSessions.Count() )
+    
+     for ( TInt i = 0; i < iSessions.Count(); i++ )
+         {
+         TConnMonIapInfo iapInfo = iSessions[i]->GetAvailableIAPs( );
+         iSessions[i]->PrefIAPNotificationL( iapInfo, iCaller );
+         }
+    }
 
 // -----------------------------------------------------------------------------
 // CMPMServer::StartForcedRoamingFromWlanL