convergedconnectionhandler/cchserver/src/cchservicehandler.cpp
branchRCL_3
changeset 15 43658d24f35d
parent 12 876a3df1f464
equal deleted inserted replaced
14:be41ab7b952f 15:43658d24f35d
   351         if( ECCHVoIPSub == aType )
   351         if( ECCHVoIPSub == aType )
   352             {
   352             {
   353             iCchUIHandler->UpdateUI( );
   353             iCchUIHandler->UpdateUI( );
   354             }
   354             }
   355         
   355         
   356         // Check for possible first usage of GPRS (roaming cost warning)
   356         if ( ECCHEnabled == aState && !iCchUIHandler->IsCostWarningSeen() )
   357         TServiceConnectionInfo serviceConnInfo( aServiceId, aType, 0, 0 );
   357             {
   358         GetConnectionInfo( serviceConnInfo );
   358             // Check for possible first usage of GPRS (roaming cost warning)
   359         
   359             TServiceConnectionInfo serviceConnInfo( aServiceId, aType, 0, 0 );
   360         if ( serviceConnInfo.iIapId && ECCHEnabled == aState )
   360             GetConnectionInfo( serviceConnInfo );
   361             {
   361             
   362             if( !iCommDbWatcher->IsWlanApL( serviceConnInfo.iIapId ) )
   362             if ( serviceConnInfo.iIapId )
   363                 {                
   363                 {
   364                 iCchUIHandler->CheckGprsFirstUsageL();
   364                 // Stop monitoring connectivity changes and take new connections
       
   365                 RArray<TUint> iaps;
       
   366                 CleanupClosePushL( iaps );
       
   367                 TBool gprs( EFalse );
       
   368                 iServer.ConnMonHandler().StopMonitoringConnectionChanges( iaps );
       
   369                 
       
   370                 // Are we connected via VPN
       
   371                 if ( iCommDbWatcher->IsVpnApL( serviceConnInfo.iIapId ) )
       
   372                     {
       
   373                     // Remove iaps whom are not linked to vpn(snap or iap)
       
   374                     TRAP_IGNORE( iCommDbWatcher->RemoveOtherThanVpnIapsL( 
       
   375                         iaps, serviceConnInfo.iIapId ) );
       
   376                                 
       
   377                     for ( TInt i( 0 ); i < iaps.Count(); i++ )
       
   378                         {
       
   379                         CCHLOGSTRING2( "CCCHServiceHandler::StateChanged: new connections: %d",iaps[ i ] );
       
   380                         
       
   381                         // if any new connection is gprs connection show note if not showed already
       
   382                         if( !iCommDbWatcher->IsVpnApL( iaps[ i ] ) && !iCommDbWatcher->IsWlanApL( iaps[ i ] ) )
       
   383                             {
       
   384                             gprs = ETrue;
       
   385                             break;
       
   386                             }
       
   387                         }
       
   388                     }
       
   389                 else if( !iCommDbWatcher->IsWlanApL( serviceConnInfo.iIapId ) )
       
   390                     {      
       
   391                     gprs = ETrue;
       
   392                     }
       
   393                 CleanupStack::PopAndDestroy( &iaps );
       
   394                 
       
   395                 if ( gprs )
       
   396                     {
       
   397                     iCchUIHandler->CheckGprsFirstUsageL();
       
   398                     }
   365                 }
   399                 }
   366             }
   400             }
   367         
   401         
   368         //unload useless plugins    
   402         //unload useless plugins    
   369         if( ECCHDisabled == aState )
   403         if( ECCHDisabled == aState )
   830         TRAP( error, connectionOk = IsServiceConnectivityDefinedL( aServiceSelection ) );
   864         TRAP( error, connectionOk = IsServiceConnectivityDefinedL( aServiceSelection ) );
   831         if( KErrNone == error )
   865         if( KErrNone == error )
   832             {
   866             {
   833             if( connectionOk )
   867             if( connectionOk )
   834                 {
   868                 {
       
   869                 // Start monitoring connectivity changes
       
   870                 iServer.ConnMonHandler().StartMonitoringConnectionChanges();
       
   871                 
   835                 if( iCancelNotify )
   872                 if( iCancelNotify )
   836                     {
   873                     {
   837                     DisableNotifyChange();
   874                     DisableNotifyChange();
   838                     }
   875                     }
   839          
   876          
   876                 if( HasWlanIap( aServiceSelection ) && KErrNone == error )
   913                 if( HasWlanIap( aServiceSelection ) && KErrNone == error )
   877                     {
   914                     {
   878                     CCHLOGSTRING( "CCCHServiceHandler::EnableService: Launching WLAN scan..." );
   915                     CCHLOGSTRING( "CCCHServiceHandler::EnableService: Launching WLAN scan..." );
   879                     TRAP_IGNORE( iWlanExtension->EnableWlanScanL() );
   916                     TRAP_IGNORE( iWlanExtension->EnableWlanScanL() );
   880                     }
   917                     }
   881                 // There could be new Plug-ins after EnableL, so we must set
   918                 if ( error )
       
   919                     {
       
   920                     RArray<TUint> iaps;
       
   921                     iServer.ConnMonHandler().StopMonitoringConnectionChanges( iaps );
       
   922                     iaps.Close();
       
   923                     }
       
   924                 // There could be new Plug-ins after EnableL, so we must set 
   882                 // notifier to loaded Plug-ins
   925                 // notifier to loaded Plug-ins
   883                 iServer.PluginHandler().SetServiceNotifier( this );
   926                 iServer.PluginHandler().SetServiceNotifier( this );
   884                 }
   927                 }
   885             else
   928             else
   886                 {
   929                 {
  1141             aServiceSelection.iServiceId, aServiceSelection.iType );
  1184             aServiceSelection.iServiceId, aServiceSelection.iType );
  1142     
  1185     
  1143     TInt error = GetConnectionInfo( serviceConnInfo );
  1186     TInt error = GetConnectionInfo( serviceConnInfo );
  1144     User::LeaveIfError( error );
  1187     User::LeaveIfError( error );
  1145     
  1188     
  1146     CCHLOGSTRING3( "CCCHServiceHandler::IsConnectionDefined: snap:%d, snap:%d",
  1189     CCHLOGSTRING3( "CCCHServiceHandler::IsConnectionDefined: snap:%d, iap:%d",
  1147             serviceConnInfo.iSNAPId, serviceConnInfo.iIapId );
  1190             serviceConnInfo.iSNAPId, serviceConnInfo.iIapId );
  1148     if( 0 != serviceConnInfo.iSNAPId )
  1191     if( 0 != serviceConnInfo.iSNAPId )
  1149         {
  1192         {
  1150         TInt count( 0 );
  1193         TInt count( 0 );
  1151         count = iCommDbWatcher->GetIapCountFromSnap( serviceConnInfo.iSNAPId, EFalse, ETrue );
  1194         count = iCommDbWatcher->GetIapCountFromSnap( serviceConnInfo.iSNAPId, EFalse, ETrue );
  1278 // ---------------------------------------------------------------------------
  1321 // ---------------------------------------------------------------------------
  1279 // CCCHServiceHandler::GetServicesL
  1322 // CCCHServiceHandler::GetServicesL
  1280 // (other items were commented in a header).
  1323 // (other items were commented in a header).
  1281 // ---------------------------------------------------------------------------
  1324 // ---------------------------------------------------------------------------
  1282 //
  1325 //
  1283 void CCCHServiceHandler::GetServicesL( RMessage2 aMessage ) const
  1326 void CCCHServiceHandler::GetServicesL( RMessage2 aMessage )
  1284     {
  1327     {
  1285     CCHLOGSTRING( "CCCHServiceHandler::GetServicesL: IN" );
  1328     CCHLOGSTRING( "CCCHServiceHandler::GetServicesL: IN" );
       
  1329     // outstanding request for service, but SpSettings notify timer still running
       
  1330     if( iHandleNotifyDelayTimer->IsActive() )
       
  1331         {
       
  1332         CCHLOGSTRING( "CCCHServiceHandler::GetServicesL - Forced handling of notify" );
       
  1333         iHandleNotifyDelayTimer->Cancel();
       
  1334         HandleDelayedNotifyEvent();
       
  1335         }
  1286     TInt count =  iServices.Count();
  1336     TInt count =  iServices.Count();
  1287     TInt index( KErrNotFound );
  1337     TInt index( KErrNotFound );
  1288     if ( count )
  1338     if ( count )
  1289         {
  1339         {
       
  1340         CCHLOGSTRING2( "CCCHServiceHandler::GetServicesL service count:%d ", count );
  1290         TUint32 serviceId = aMessage.Int0();
  1341         TUint32 serviceId = aMessage.Int0();
  1291         TCCHSubserviceType type ( ECCHUnknown );
  1342         TCCHSubserviceType type ( ECCHUnknown );
  1292         type = static_cast<TCCHSubserviceType>( aMessage.Int1() );
  1343         type = static_cast<TCCHSubserviceType>( aMessage.Int1() );
  1293         
  1344         
  1294         if ( KErrNotFound == aMessage.Int0() )
  1345         if ( KErrNotFound == aMessage.Int0() )
  1297             }
  1348             }
  1298         else if ( serviceId != KErrNone )
  1349         else if ( serviceId != KErrNone )
  1299             {
  1350             {
  1300             count = 1;
  1351             count = 1;
  1301             }
  1352             }
  1302                     
  1353         
       
  1354         
  1303         CArrayFixFlat<TCCHService>* serviceArray = 
  1355         CArrayFixFlat<TCCHService>* serviceArray = 
  1304             new( ELeave )CArrayFixFlat<TCCHService>( count );
  1356             new( ELeave )CArrayFixFlat<TCCHService>( count );
  1305         CleanupStack::PushL( serviceArray );
  1357         CleanupStack::PushL( serviceArray );
  1306         
  1358         
  1307         TCCHService service;
  1359         TCCHService service;
  1308         // Get all services
  1360         // Get all services
  1309         if ( KErrNone == serviceId )
  1361         if ( KErrNone == serviceId )
  1310             {
  1362             {
       
  1363             CCHLOGSTRING( "CCCHServiceHandler::GetServicesL KErrNone == serviceId" );
  1311             if ( type == ECCHUnknown )
  1364             if ( type == ECCHUnknown )
  1312                 {
  1365                 {
  1313                 for ( TInt i( 0 ); i < count; i++ )
  1366                 for ( TInt i( 0 ); i < count; i++ )
  1314                     {
  1367                     {
  1315                     iServices[ i ]->FillServiceInfo( service );
  1368                     iServices[ i ]->FillServiceInfo( service );
  1332         else 
  1385         else 
  1333             {
  1386             {
  1334             if ( type == ECCHUnknown )
  1387             if ( type == ECCHUnknown )
  1335                 {
  1388                 {
  1336                 index = FindService( serviceId );
  1389                 index = FindService( serviceId );
       
  1390                 CCHLOGSTRING2( "CCCHServiceHandler::GetServicesL index:%d", index );
       
  1391 
  1337                 if ( KErrNotFound != index )
  1392                 if ( KErrNotFound != index )
  1338                     {
  1393                     {
  1339                     iServices[ index ]->FillServiceInfo( service );
  1394                     iServices[ index ]->FillServiceInfo( service );
  1340                     serviceArray->AppendL( service );
  1395                     serviceArray->AppendL( service );
  1341                     }
  1396                     }
  1342                 }
  1397                 }
  1343             else
  1398             else
  1344                 {
  1399                 {
       
  1400             CCHLOGSTRING( "CCCHServiceHandler::GetServicesL Else" );
  1345                 TServiceSelection selection( serviceId, type ); 
  1401                 TServiceSelection selection( serviceId, type ); 
  1346                 index = ServiceExist( selection );
  1402                 index = ServiceExist( selection );
  1347                 if ( KErrNotFound != index )
  1403                 if ( KErrNotFound != index )
  1348                     {
  1404                     {
  1349                     iServices[ index ]->FillServiceInfo( service );
  1405                     iServices[ index ]->FillServiceInfo( service );