bearermanagement/mpm/src/mpmserver.cpp
branchRCL_3
changeset 15 4dc3bb0099b0
parent 12 ea6e024ea6f9
child 17 c14618f9de99
equal deleted inserted replaced
13:68f0c7cd80ec 15:4dc3bb0099b0
   108 
   108 
   109     // Connect to ETel server
   109     // Connect to ETel server
   110     // The RTelServer::Connect() might not always work with the first trial,
   110     // The RTelServer::Connect() might not always work with the first trial,
   111     // because of a coding error related to using semaphores in the method.
   111     // because of a coding error related to using semaphores in the method.
   112     TInt err( KErrNotReady );
   112     TInt err( KErrNotReady );
       
   113     err = iTelServer.Connect();
   113     TInt a = 0;
   114     TInt a = 0;
   114     while( a < KPhoneRetryCount && err != KErrNone )
   115     while( a < KPhoneRetryCount && err != KErrNone )
   115         {
   116         {
   116         User::After( KPhoneRetryTimeout );
   117         User::After( KPhoneRetryTimeout );
   117         err = iTelServer.Connect();
   118         err = iTelServer.Connect();
   701 
   702 
   702 // -----------------------------------------------------------------------------
   703 // -----------------------------------------------------------------------------
   703 // CMPMServer::CheckIfStarted
   704 // CMPMServer::CheckIfStarted
   704 // -----------------------------------------------------------------------------
   705 // -----------------------------------------------------------------------------
   705 //
   706 //
   706 TBool CMPMServer::CheckIfStarted( const TUint32 aIapId )
   707 TBool CMPMServer::CheckIfStarted( const TUint32 aIapId , 
   707     {
   708                                   const TConnectionId aConnId )
   708     MPMLOGSTRING2( "CMPMServer::CheckIfStarted - aIapId = %i", aIapId )
   709     {
       
   710     MPMLOGSTRING3( "CMPMServer::CheckIfStarted - aIapId = %i, aConnId = 0x%x", 
       
   711                   aIapId, aConnId )
   709 
   712 
   710     TConnectionState state( EIdle );
   713     TConnectionState state( EIdle );
   711     TBool stopLoop( EFalse );
   714     TBool stopLoop( EFalse );
   712 
   715 
   713     // Loop all connections until EStarted is found or no more connections
   716     // Loop all connections until EStarted is found or no more connections
   714     // 
   717     // 
   715     for ( TInt i = 0; ( ( i < iActiveBMConns.Count() ) && !stopLoop ); i++ )
   718     for ( TInt i = 0; ( ( i < iActiveBMConns.Count() ) && !stopLoop ); i++ )
   716         {
   719         {
   717         // Check if IAP Id matches
   720         // Check if IAP Id matches; exclude matching with own connection
   718         // 
   721         // 
   719         if ( iActiveBMConns[i].iConnInfo.iIapId == aIapId )
   722         if ( iActiveBMConns[i].iConnInfo.iIapId == aIapId && 
       
   723              iActiveBMConns[i].iConnInfo.iConnId != aConnId)
   720             {
   724             {
   721             state = iActiveBMConns[i].iConnInfo.iState;  
   725             state = iActiveBMConns[i].iConnInfo.iState;  
   722 
   726 
   723             // Stop looping if EStarted found
   727             // Stop looping if EStarted found
   724             // 
   728             // 
   757             MPMLOGSTRING( "CMPMServer::CheckIfStarted - Unknown" )
   761             MPMLOGSTRING( "CMPMServer::CheckIfStarted - Unknown" )
   758             break;
   762             break;
   759             }
   763             }
   760         }
   764         }
   761 #endif // _DEBUG
   765 #endif // _DEBUG
   762 
   766         
   763     if ( state == EStarted )
   767     //Return true incase the matching connection is in EStarting state also because
       
   768     //sometimes when connections are started simultaneously (for same iapID) 
       
   769     //the first connection may still be in EStarting state. 
       
   770     //
       
   771     if ( state == EStarted || state == EStarting )
   764         {
   772         {
   765         return ETrue;
   773         return ETrue;
   766         }
   774         }
   767     else
   775     else
   768         {
   776         {
   972 
   980 
   973 // -----------------------------------------------------------------------------
   981 // -----------------------------------------------------------------------------
   974 // CMPMServer::NotifyBMPrefIapL
   982 // CMPMServer::NotifyBMPrefIapL
   975 // -----------------------------------------------------------------------------
   983 // -----------------------------------------------------------------------------
   976 //
   984 //
   977 void CMPMServer::NotifyBMPrefIapL( const TConnMonIapInfo& aIapInfo )
   985 void CMPMServer::NotifyBMPrefIapL( const TConnMonIapInfo& aIapInfo, 
       
   986                                    const TPrefIAPNotifCaller aCaller )
   978     {
   987     {
   979     MPMLOGSTRING2( "CMPMServer::NotifyBMPrefIapL - IAPs count: %d", 
   988     MPMLOGSTRING2( "CMPMServer::NotifyBMPrefIapL - IAPs count: %d", 
   980         aIapInfo.iCount)
   989         aIapInfo.iCount)
   981     TConnMonIapInfo iapInfo = aIapInfo;
   990     TConnMonIapInfo iapInfo = aIapInfo;
   982     
   991     
  1001         iSessions.Count() )
  1010         iSessions.Count() )
  1002 
  1011 
  1003     for ( TInt i = 0; i < iSessions.Count(); i++ )
  1012     for ( TInt i = 0; i < iSessions.Count(); i++ )
  1004         {
  1013         {
  1005         iapInfo = iSessions[i]->GetAvailableIAPs( );
  1014         iapInfo = iSessions[i]->GetAvailableIAPs( );
  1006         iSessions[i]->PrefIAPNotificationL( iapInfo, EConnMon );
  1015         iSessions[i]->PrefIAPNotificationL( iapInfo, aCaller );
  1007         }
  1016         }
  1008 
  1017 
  1009     // If a session is displaying connection selection dialog 
  1018     // If a session is displaying connection selection dialog 
  1010     // the contents of the dialog should be updated according to the 
  1019     // the contents of the dialog should be updated according to the 
  1011     // current iap availability
  1020     // current iap availability
  1150     else
  1159     else
  1151         {
  1160         {
  1152         return KErrNotFound;
  1161         return KErrNotFound;
  1153         }
  1162         }
  1154     }
  1163     }
  1155 
       
  1156 
       
  1157 // -----------------------------------------------------------------------------
       
  1158 // CMPMServer::HandleServerUnblackListIap
       
  1159 // -----------------------------------------------------------------------------
       
  1160 //
       
  1161 TInt CMPMServer::HandleServerUnblackListIap( 
       
  1162     const TConnectionId aConnId,
       
  1163     TBlacklistCategory  aCategory )
       
  1164     {
       
  1165     MPMLOGSTRING3( "CMPMServer::HandleServerUnblackListIap -\
       
  1166  aConnId = 0x%x, aCategory = %i", aConnId, aCategory )
       
  1167 
       
  1168     TInt i;
       
  1169     TBool found = EFalse;
       
  1170 
       
  1171     found = FindBlacklistedConnIndex( aConnId, i );
       
  1172     if ( found )
       
  1173         {
       
  1174         // found blacklisted Connection Id
       
  1175         TMPMBlackListConnId connIdInfo = iBlackListIdList[i];
       
  1176         iBlackListIdList.Remove( i ); // remove from the list 
       
  1177 
       
  1178         found = EFalse;
       
  1179         for (TInt j = 0; j < connIdInfo.Count(); j++)
       
  1180             {
       
  1181             if ( connIdInfo.Category( j ) == aCategory ) 
       
  1182                 {
       
  1183                 // found and remove blacklisted iap
       
  1184                 connIdInfo.Remove( j ); 
       
  1185                 if ( connIdInfo.Count() == 0 )
       
  1186                     {
       
  1187                     return KErrNone;
       
  1188                     }
       
  1189 
       
  1190                 // reinsert connIdInfo at the beginning to reflect activeness
       
  1191                 iBlackListIdList.Insert( connIdInfo, 0 ); 
       
  1192                 return KErrNone;
       
  1193                 }
       
  1194             }
       
  1195         // nothing found and reinsert at the beginning 
       
  1196         // connIdInfo to reflect activeness
       
  1197         iBlackListIdList.Insert( connIdInfo, 0 ); 
       
  1198         return KErrNotFound;
       
  1199         }
       
  1200     else
       
  1201         {
       
  1202         return KErrNotFound;
       
  1203         }
       
  1204     }
       
  1205 
       
  1206 
  1164 
  1207 // -----------------------------------------------------------------------------
  1165 // -----------------------------------------------------------------------------
  1208 // CMPMServer::HandleServerUnblackListIap
  1166 // CMPMServer::HandleServerUnblackListIap
  1209 // -----------------------------------------------------------------------------
  1167 // -----------------------------------------------------------------------------
  1210 //
  1168 //