bearermanagement/mpm/src/mpmserversession.cpp
changeset 66 ed07dcc72692
parent 60 a9c709db68db
--- a/bearermanagement/mpm/src/mpmserversession.cpp	Fri Sep 17 08:32:43 2010 +0300
+++ b/bearermanagement/mpm/src/mpmserversession.cpp	Mon Oct 04 00:43:42 2010 +0300
@@ -885,6 +885,23 @@
                                   ERoaming,
                                   *this );
 
+    TWlanIapType iapType = MyServer().CommsDatAccess()->CheckWlanL( iMigrateIap );
+
+    // If this is a cellular IAP, we must check the current cellular data usage setting in case it
+    // has changed to disabled mode while MPM was waiting for a migrate confirmation. If cellular
+    // data usage has been disabled, terminate the connection attempt with KErrPermissionDenied.
+    if ( iapType == ENotWlanIap )
+        {
+        TInt cellularUsage = MyServer().DataUsageWatcher()->CellularDataUsage();
+        if ( cellularUsage == ECmCellularDataUsageDisabled )
+            {
+            MPMLOGSTRING( "Trying to migrate to cellular IAP, but cellular data usage is disabled, stopping" )
+            iMigrateState = EMigrateNone;
+            RoamingConfirmationCompletedL( KErrPermissionDenied, EMsgQueryThisTime, EFalse );
+            return;
+            }
+        }
+
     iMigrateState = EMigrateUserConfirmation;
 
     // Confirm only if this IAP is not already in use
@@ -910,13 +927,13 @@
                     reconnect = ETrue;
                     }
 
-        //Display confirm dialog only if we are moving to cellular IAP
-        if ( MyServer().CommsDatAccess()->CheckWlanL( iMigrateIap ) == ENotWlanIap )
+        // Display confirm dialog only if we are moving to cellular IAP
+        if ( iapType == ENotWlanIap )
             {
             // Check that connection preferences don't deny queries, and
             // enough time has elapsed from the last query cancelled by the user.
             if ( !( iIapSelection->MpmConnPref().NoteBehaviour() & TExtendedConnPref::ENoteBehaviourConnDisableQueries ) &&
-                 !MyServer().IsConnPermQueryTimerOn() )
+                    !MyServer().IsConnPermQueryTimerOn() )
                 {
                 if ( MyServer().RoamingWatcher()->RoamingStatus() == EMPMInternationalRoaming )
                     {
@@ -1719,7 +1736,7 @@
     availableIAPs = GetAvailableIAPs();
 
     MPMLOGSTRING2( "CMPMServerSession::HandleServerRegisterPrefIAPNotifL \
-- IAPs count: %d", availableIAPs.iCount)
+- available IAPs count: %d", availableIAPs.iCount)
 
 #ifdef _DEBUG
     for (TUint i = 0; i < availableIAPs.Count(); i++)
@@ -1739,12 +1756,6 @@
         PrefIAPNotificationL( availableIAPs, EBearerMan );
         }
 
-    // In case the mobility application register to preferred IAP notification
-    // we have to make sure we get availability every once in a while.
-    // 
-    RArray<TUint> iapPath;
-    CleanupClosePushL( iapPath );
-    CleanupStack::PopAndDestroy( &iapPath );
     aMessage.Complete( KErrNone );
     }