bearermanagement/mpm/src/mpmdatausagewatcher.cpp
branchRCL_3
changeset 55 fc7b30ed2058
parent 17 c14618f9de99
child 57 05bc53fe583b
equal deleted inserted replaced
54:984e13af52c4 55:fc7b30ed2058
   116         iErrorCounter = 0;
   116         iErrorCounter = 0;
   117 
   117 
   118         // Get the new Cellular data usage setting value from central repository.
   118         // Get the new Cellular data usage setting value from central repository.
   119         TInt oldCellularDataUsage = iCellularDataUsage;
   119         TInt oldCellularDataUsage = iCellularDataUsage;
   120 
   120 
   121         if ( GetCurrentDataUsageValue() == KErrNone )
   121         if ( GetCurrentDataUsageValue() == KErrNone // Updates iCellularDataUsage
       
   122              && oldCellularDataUsage != iCellularDataUsage
       
   123              && iServer->RoamingWatcher()->RoamingStatus() != EMPMRoamingStatusUnknown )
   122             {
   124             {
   123             // Stop cellular connections if the setting changes into Disabled.
   125             // Setting changed while cellular is in use
   124             if ( oldCellularDataUsage != ECmCellularDataUsageDisabled &&
   126 
   125                     iCellularDataUsage == ECmCellularDataUsageDisabled &&
   127             if ( iCellularDataUsage == ECmCellularDataUsageDisabled )
   126                     iServer->RoamingWatcher()->RoamingStatus() != EMPMRoamingStatusUnknown )
       
   127                 {
   128                 {
       
   129                 // Cellular data usage disabled -> disconnect cellular
   128                 iServer->StopCellularConns();
   130                 iServer->StopCellularConns();
   129                 }
   131                 }
       
   132             else if ( iCellularDataUsage == ECmCellularDataUsageConfirm )
       
   133                 {
       
   134                 // Cellular data usage needs to be confirmed -> disconnect if 
       
   135                 // there are only silent cellular connections left.
       
   136                 iServer->StopCellularConns( ETrue );
       
   137                 }
       
   138 
   130             }
   139             }
   131         }
   140         }
   132     
   141     
   133     RequestNotifications();
   142     RequestNotifications();
   134     }
   143     }
   180         {
   189         {
   181         MPMLOGSTRING2( "CMpmDataUsageWatcher::GetCurrentDataUsageValue, ERROR: %d", err )
   190         MPMLOGSTRING2( "CMpmDataUsageWatcher::GetCurrentDataUsageValue, ERROR: %d", err )
   182         }
   191         }
   183     return err;
   192     return err;
   184     }
   193     }
       
   194 
       
   195 // -----------------------------------------------------------------------------
       
   196 // CMpmDataUsageWatcher::CellularDataUsage
       
   197 // -----------------------------------------------------------------------------
       
   198 //
       
   199 TInt CMpmDataUsageWatcher::CellularDataUsage() const
       
   200     {
       
   201     return iCellularDataUsage;
       
   202     }