bearermanagement/mpm/src/mpmserver.cpp
branchRCL_3
changeset 8 2e6c4614c58e
parent 3 f7816ffc66ed
child 12 ea6e024ea6f9
equal deleted inserted replaced
4:77415202bfc8 8:2e6c4614c58e
    39 #include "mpmcommsdataccess.h"
    39 #include "mpmcommsdataccess.h"
    40 #include "mpmwlanquerydialog.h"
    40 #include "mpmwlanquerydialog.h"
    41 #include "mpmdialog.h"
    41 #include "mpmdialog.h"
    42 #include "mpmprivatecrkeys.h"
    42 #include "mpmprivatecrkeys.h"
    43 #include "mpmcsidwatcher.h"
    43 #include "mpmcsidwatcher.h"
       
    44 #include "mpmdatausagewatcher.h"
       
    45 #include "mpmpropertydef.h"
    44 
    46 
    45 // ============================= LOCAL FUNCTIONS ===============================
    47 // ============================= LOCAL FUNCTIONS ===============================
    46 
    48 
    47 // -----------------------------------------------------------------------------
    49 // -----------------------------------------------------------------------------
    48 // PanicServer 
    50 // PanicServer 
   168 
   170 
   169     // Create central repository watcher and start it
   171     // Create central repository watcher and start it
   170     iMpmCsIdWatcher = CMpmCsIdWatcher::NewL();
   172     iMpmCsIdWatcher = CMpmCsIdWatcher::NewL();
   171     iMpmCsIdWatcher->StartL();
   173     iMpmCsIdWatcher->StartL();
   172 
   174 
       
   175     // Create another central repository watcher and start it
       
   176     // TODO: Trapped, because currently it may fatally leave in HW.
       
   177     // (Possibly because of the capability updates of data usage watcher's CR-keys.)
       
   178     TRAPD( duwErr, iMpmDataUsageWatcher = CMpmDataUsageWatcher::NewL( this ) );
       
   179     if (duwErr == KErrNone)
       
   180         {
       
   181         iMpmDataUsageWatcher->StartL();
       
   182         }
       
   183     else
       
   184         {
       
   185         iMpmDataUsageWatcher = NULL;
       
   186         MPMLOGSTRING( "CMPMServer::ConstructL: CMpmDataUsageWatcher::NewL() failed!" )
       
   187         }
       
   188 
   173     // Define P&S keys (snap & iap) for the user connection
   189     // Define P&S keys (snap & iap) for the user connection
   174     TInt ret = RProperty::Define( KMPMUserConnectionCategory,
   190     TInt ret = RProperty::Define( KMPMUserConnectionCategory,
   175                                   KMPMPSKeyUserConnectionSnap,
   191                                   KMPMPSKeyUserConnectionSnap,
   176                                   KMPMUserConnectionSnapType,
   192                                   KMPMUserConnectionSnapType,
   177                                   KMPMUserConnectionReadPolicy,
   193                                   KMPMUserConnectionReadPolicy,
   323     iTelServer.Close();
   339     iTelServer.Close();
   324     
   340     
   325     delete iDefaultConnection;
   341     delete iDefaultConnection;
   326     
   342     
   327     delete iMpmCsIdWatcher;    
   343     delete iMpmCsIdWatcher;    
       
   344     
       
   345     delete iMpmDataUsageWatcher;    
   328     
   346     
   329     iDedicatedClients.Close();
   347     iDedicatedClients.Close();
   330 
   348 
   331     delete iCommsDatAccess;    
   349     delete iCommsDatAccess;    
   332     }
   350     }
  1782     RArray<TUint32> wlanIapIds;
  1800     RArray<TUint32> wlanIapIds;
  1783     CleanupClosePushL( wlanIapIds );
  1801     CleanupClosePushL( wlanIapIds );
  1784     RAvailableIAPList iapList;
  1802     RAvailableIAPList iapList;
  1785     CleanupClosePushL( iapList );
  1803     CleanupClosePushL( iapList );
  1786 
  1804 
  1787     for ( TInt index = 0; index < aIapInfo.iCount; index++ )
  1805     for ( TUint index = 0; index < aIapInfo.iCount; index++ )
  1788         {
  1806         {
  1789         if ( CommsDatAccess()->CheckWlanL( aIapInfo.iIap[index].iIapId ) != ENotWlanIap )
  1807         if ( CommsDatAccess()->CheckWlanL( aIapInfo.iIap[index].iIapId ) != ENotWlanIap )
  1790             {
  1808             {
  1791             // Accept only wlan iaps in internet snap
  1809             // Accept only wlan iaps in internet snap
  1792             if ( iCommsDatAccess->IsInternetSnapL( aIapInfo.iIap[index].iIapId, 0 ) )
  1810             if ( iCommsDatAccess->IsInternetSnapL( aIapInfo.iIap[index].iIapId, 0 ) )
  1845 
  1863 
  1846     // Copy all available packet data iap ids to own array
  1864     // Copy all available packet data iap ids to own array
  1847     RArray<TUint32> packetDataIapIds;
  1865     RArray<TUint32> packetDataIapIds;
  1848     CleanupClosePushL( packetDataIapIds );
  1866     CleanupClosePushL( packetDataIapIds );
  1849 
  1867 
  1850     for ( TInt index = 0; index < aIapInfo.iCount; index++ )
  1868     for ( TUint index = 0; index < aIapInfo.iCount; index++ )
  1851         {
  1869         {
  1852         if ( CommsDatAccess()->GetBearerTypeL( aIapInfo.iIap[index].iIapId ) ==
  1870         if ( CommsDatAccess()->GetBearerTypeL( aIapInfo.iIap[index].iIapId ) ==
  1853             EMPMBearerTypePacketData )
  1871             EMPMBearerTypePacketData )
  1854             {
  1872             {
  1855             // Accept only packet data iaps in internet snap
  1873             // Accept only packet data iaps in internet snap
  1874         if ( iCommsDatAccess->CheckWlanL( iActiveBMConns[index].iConnInfo.iIapId )
  1892         if ( iCommsDatAccess->CheckWlanL( iActiveBMConns[index].iConnInfo.iIapId )
  1875             == EWlanIap )
  1893             == EWlanIap )
  1876             {
  1894             {
  1877             // Check if used WLAN is still available
  1895             // Check if used WLAN is still available
  1878             TBool currentWlanIapAvailable = EFalse;
  1896             TBool currentWlanIapAvailable = EFalse;
  1879             for ( TInt iapIndex = 0; iapIndex < aIapInfo.iCount; iapIndex++ )
  1897             for ( TUint iapIndex = 0; iapIndex < aIapInfo.iCount; iapIndex++ )
  1880                 {
  1898                 {
  1881                 if ( aIapInfo.iIap[iapIndex].iIapId ==
  1899                 if ( aIapInfo.iIap[iapIndex].iIapId ==
  1882                     iActiveBMConns[index].iConnInfo.iIapId )
  1900                     iActiveBMConns[index].iConnInfo.iIapId )
  1883                     {
  1901                     {
  1884                     // Current WLAN IAP found from list of available IAPs
  1902                     // Current WLAN IAP found from list of available IAPs
  2061     ASSERT( serverSession != NULL );
  2079     ASSERT( serverSession != NULL );
  2062 
  2080 
  2063     return serverSession;
  2081     return serverSession;
  2064     }
  2082     }
  2065 
  2083 
       
  2084 // ---------------------------------------------------------------------------
       
  2085 // CMPMServer::StopCellularConns
       
  2086 // Stop all cellular connections except MMS
       
  2087 // ---------------------------------------------------------------------------
       
  2088 //
       
  2089 void CMPMServer::StopCellularConns()
       
  2090     {
       
  2091     MPMLOGSTRING( "CMPMServer::StopCellularConns" )
       
  2092 
       
  2093     TUint32 iapId;
       
  2094 	TMPMBearerType bearerType = EMPMBearerTypeNone;
       
  2095 
       
  2096 	// No cleanup stack used cause this function doesn't leave.
       
  2097     RArray<TUint32> stoppedIaps;
       
  2098 
       
  2099     // Check through active connections
       
  2100     for (TInt i = 0; i < iActiveBMConns.Count(); i++)
       
  2101         {
       
  2102         iapId = iActiveBMConns[i].iConnInfo.iIapId;
       
  2103 
       
  2104         // Don't stop the same IAP twice.
       
  2105         if (stoppedIaps.Find( iapId ) == KErrNotFound)
       
  2106             {
       
  2107             TRAPD( err, bearerType = CommsDatAccess()->GetBearerTypeL( iapId ) );
       
  2108             if (err == KErrNone &&
       
  2109                     iapId != 0 &&
       
  2110                     bearerType == EMPMBearerTypePacketData)
       
  2111                 {
       
  2112                 TInt mmsIap( 0 );
       
  2113                 err = RProperty::Get( KMPMCathegory, KMPMPropertyKeyMMS, mmsIap );
       
  2114                 // Check that it's not MMS IAP.
       
  2115                 if (!(err == KErrNone && iapId == mmsIap))
       
  2116                     {
       
  2117                     // Stop the conn / IAP.
       
  2118                     StopConnections( iapId );
       
  2119                     stoppedIaps.Append( iapId );
       
  2120                     }
       
  2121                 }
       
  2122             }
       
  2123         }
       
  2124     stoppedIaps.Close();
       
  2125     }
       
  2126 
  2066 // -----------------------------------------------------------------------------
  2127 // -----------------------------------------------------------------------------
  2067 // TMPMBlackListConnId::Append
  2128 // TMPMBlackListConnId::Append
  2068 // -----------------------------------------------------------------------------
  2129 // -----------------------------------------------------------------------------
  2069 //
  2130 //
  2070 void TMPMBlackListConnId::Append( TUint32 aIap, TBlacklistCategory aCategory )
  2131 void TMPMBlackListConnId::Append( TUint32 aIap, TBlacklistCategory aCategory )