bearermanagement/mpm/src/mpmiapselection.cpp
changeset 53 4af712113915
parent 46 95d45f234cf3
child 60 a9c709db68db
--- a/bearermanagement/mpm/src/mpmiapselection.cpp	Tue Jul 06 14:42:41 2010 +0300
+++ b/bearermanagement/mpm/src/mpmiapselection.cpp	Wed Aug 18 10:10:23 2010 +0300
@@ -151,10 +151,13 @@
         MPMLOGSTRING2( "CMPMIapSelection::ChooseIapL: bearerType: %i", bearerType )
 
         // Complete selection with error code if wlan only was set and cellular IAP other 
-        // than MMS IAP was tried to access  
-        if ( wlanOnly && 
-                ( bearerType == EMPMBearerTypePacketData ) && 
-                ( iSession->IsMMSIap( iChooseIapPref.IapId() ) == EFalse ) ) 
+        // than MMS IAP was tried to access
+        // Note that CurrentCellularDataUsage()tells if internal cellular connections are 
+        // temporarily disabled because dial-up connection is prioritized over internal connections.
+        // 
+        if ( ( wlanOnly || CurrentCellularDataUsage() == ECmCellularDataUsageDisabled ) && 
+             ( bearerType == EMPMBearerTypePacketData ) && 
+             ( iSession->IsMMSIap( iChooseIapPref.IapId() ) == EFalse ) ) 
             {            
             ChooseIapComplete( KErrPermissionDenied, NULL );
             return;
@@ -1142,3 +1145,11 @@
     return iChooseIapPref;
     }
 
+// ---------------------------------------------------------------------------
+// Get current cellular data usage setting
+// ---------------------------------------------------------------------------
+//
+TInt CMPMIapSelection::CurrentCellularDataUsage() const
+    {
+    return iSession->MyServer().DataUsageWatcher()->CellularDataUsage();
+    }