bearermanagement/mpm/src/mpmserver.cpp
changeset 27 489cf6208544
parent 20 9c97ad6591ae
child 32 5c4486441ae6
child 46 95d45f234cf3
equal deleted inserted replaced
23:7ec726f93df1 27:489cf6208544
   228 // CMPMServer::~CMPMServer
   228 // CMPMServer::~CMPMServer
   229 // -----------------------------------------------------------------------------
   229 // -----------------------------------------------------------------------------
   230 //
   230 //
   231 CMPMServer::~CMPMServer()
   231 CMPMServer::~CMPMServer()
   232     {
   232     {
       
   233 	if ( iRoamingToWlanPeriodic )
       
   234         {
       
   235         iRoamingToWlanPeriodic->Cancel();
       
   236 		delete iRoamingToWlanPeriodic;
       
   237         }
   233     if ( iDisconnectQueue )
   238     if ( iDisconnectQueue )
   234         {
   239         {
   235         iDisconnectQueue->ResetAndDestroy();
   240         iDisconnectQueue->ResetAndDestroy();
   236         }
   241         }
   237     delete iDisconnectQueue;
   242     delete iDisconnectQueue;
   879 
   884 
   880     // Start possible forced roaming
   885     // Start possible forced roaming
   881     TCmUsageOfWlan usageOfWlan = CommsDatAccess()->ForcedRoamingL();
   886     TCmUsageOfWlan usageOfWlan = CommsDatAccess()->ForcedRoamingL();
   882     if ( usageOfWlan == ECmUsageOfWlanKnown || usageOfWlan == ECmUsageOfWlanKnownAndNew )
   887     if ( usageOfWlan == ECmUsageOfWlanKnown || usageOfWlan == ECmUsageOfWlanKnownAndNew )
   883         {
   888         {
   884         StartForcedRoamingToWlanL( iapInfo );
   889         if ( IsWlanConnectionStartedL( CommsDatAccess() ) )
       
   890             {
       
   891             iConnMonIapInfo = aIapInfo;
       
   892                 
       
   893             if ( iRoamingToWlanPeriodic )
       
   894                 {
       
   895                 iRoamingToWlanPeriodic->Cancel();
       
   896                 }
       
   897             else
       
   898                 {
       
   899                 iRoamingToWlanPeriodic = CPeriodic::NewL( 
       
   900                                                    CActive::EPriorityStandard );
       
   901                 }
       
   902             // start periodic object that calls StartForcedRoamingToWlanL after 10s. 
       
   903             // this handles the case when new wlan connection is 
       
   904             // started from e.g. wlan sniffer but IAP is not yet in Internet SNAP 
       
   905             iRoamingToWlanPeriodic->Start( 
       
   906                    TTimeIntervalMicroSeconds32( KRoamingToWlanUpdateInterval ), 
       
   907                    TTimeIntervalMicroSeconds32( KRoamingToWlanUpdateInterval ), 
       
   908                    TCallBack( StartForcedRoamingToConnectedWlanL, this ) );
       
   909             }
       
   910         else
       
   911             {
       
   912             StartForcedRoamingToWlanL( iapInfo );
       
   913             }
       
   914 
   885         StartForcedRoamingFromWlanL( iapInfo );
   915         StartForcedRoamingFromWlanL( iapInfo );
   886         }
   916         }
   887     
   917     
   888     MPMLOGSTRING2(
   918     MPMLOGSTRING2(
   889     "CMPMServer::NotifyBMPrefIapL - Send notifications for %d sessions", 
   919     "CMPMServer::NotifyBMPrefIapL - Send notifications for %d sessions", 
  1444 // -----------------------------------------------------------------------------
  1474 // -----------------------------------------------------------------------------
  1445 //
  1475 //
  1446 void CMPMServer::StartForcedRoamingToWlanL( const TConnMonIapInfo& aIapInfo )
  1476 void CMPMServer::StartForcedRoamingToWlanL( const TConnMonIapInfo& aIapInfo )
  1447     {
  1477     {
  1448     MPMLOGSTRING( "CMPMServer::StartForcedRoamingToWlan" )
  1478     MPMLOGSTRING( "CMPMServer::StartForcedRoamingToWlan" )
  1449 
  1479     
  1450     // First check that there is no active wlan connection
  1480     // cancel the periodic object
  1451     if ( IsWlanConnectionStartedL( CommsDatAccess() ) )
  1481     if ( iRoamingToWlanPeriodic != NULL )
  1452         {
  1482         {
  1453         // Wlan already active can't roam to it
  1483         iRoamingToWlanPeriodic->Cancel();
  1454         return;
       
  1455         }
  1484         }
  1456 
  1485 
  1457     // Copy all available wlan iap ids to own array
  1486     // Copy all available wlan iap ids to own array
  1458     RArray<TUint32> wlanIapIds;
  1487     RArray<TUint32> wlanIapIds;
  1459     CleanupClosePushL( wlanIapIds );
  1488     CleanupClosePushL( wlanIapIds );
  1508             }
  1537             }
  1509         }
  1538         }
  1510     CleanupStack::PopAndDestroy( &iapList );
  1539     CleanupStack::PopAndDestroy( &iapList );
  1511     CleanupStack::PopAndDestroy( &wlanIapIds );
  1540     CleanupStack::PopAndDestroy( &wlanIapIds );
  1512     }
  1541     }
       
  1542 
       
  1543 
       
  1544 // ---------------------------------------------------------------------------
       
  1545 // CMPMServer::StartForcedRoamingToConnectedWlanL
       
  1546 // ---------------------------------------------------------------------------
       
  1547 //    
       
  1548 TInt CMPMServer::StartForcedRoamingToConnectedWlanL( TAny* aUpdater )
       
  1549     {
       
  1550     MPMLOGSTRING( "CMPMServer::StartForcedRoamingToConnectedWlanL" );
       
  1551     static_cast<CMPMServer*>( aUpdater )->StartForcedRoamingToWlanL( 
       
  1552             static_cast<CMPMServer*>( aUpdater )->iConnMonIapInfo );
       
  1553     return 0;
       
  1554     }
       
  1555 
  1513 
  1556 
  1514 // -----------------------------------------------------------------------------
  1557 // -----------------------------------------------------------------------------
  1515 // CMPMServer::StartForcedRoamingFromWlanL
  1558 // CMPMServer::StartForcedRoamingFromWlanL
  1516 // -----------------------------------------------------------------------------
  1559 // -----------------------------------------------------------------------------
  1517 //
  1560 //