bearermanagement/mpm/src/mpmserversession.cpp
changeset 18 fcbbe021d614
parent 3 f7816ffc66ed
child 20 9c97ad6591ae
equal deleted inserted replaced
4:77415202bfc8 18:fcbbe021d614
   136         
   136         
   137         MPMLOGSTRING( "CMPMServerSession::HandleServerApplicationConnectionEnds -\
   137         MPMLOGSTRING( "CMPMServerSession::HandleServerApplicationConnectionEnds -\
   138 User connection deactivated" )
   138 User connection deactivated" )
   139         }   
   139         }   
   140 
   140 
       
   141     // Clean up the blacklist table 
       
   142     iMyServer.HandleServerUnblackListIap( iConnId, 0 );
       
   143 
   141     // Make sure the connection is removed from server's information array.
   144     // Make sure the connection is removed from server's information array.
   142     iMyServer.RemoveBMConnection( iConnId, *this );
   145     iMyServer.RemoveBMConnection( iConnId, *this );
   143     }
   146     }
   144 
   147 
   145 
   148 
   442     // Store the Uid of the application to the member variable so 
   445     // Store the Uid of the application to the member variable so 
   443     // that it can be used to avoid DisconnectDialog popping up when 
   446     // that it can be used to avoid DisconnectDialog popping up when 
   444     // AlwaysOnline connection is being established.
   447     // AlwaysOnline connection is being established.
   445     // 
   448     // 
   446     iAppUid = aMessage.Int2();
   449     iAppUid = aMessage.Int2();
       
   450 
       
   451     MPMLOGSTRING2( "CMPMServerSession::HandleServerChooseIapL: \
       
   452 Client UID = 0x%x", iAppUid )
   447 
   453 
   448     if ( !iIapSelection )
   454     if ( !iIapSelection )
   449         {
   455         {
   450         iIapSelection = CMPMIapSelection::NewL( iMyServer.CommsDatAccess(),
   456         iIapSelection = CMPMIapSelection::NewL( iMyServer.CommsDatAccess(),
   451                                                 this ); 
   457                                                 this ); 
   701     MPMLOGSTRING3( "CMPMServerSession::HandleServerIapConnectionStarted\
   707     MPMLOGSTRING3( "CMPMServerSession::HandleServerIapConnectionStarted\
   702  - IAP Id = %i, Connection Id = 0x%x", startedIap, startedId )
   708  - IAP Id = %i, Connection Id = 0x%x", startedIap, startedId )
   703 
   709 
   704     iMyServer.AppendBMIAPConnectionL( startedIap, startedId, *this );
   710     iMyServer.AppendBMIAPConnectionL( startedIap, startedId, *this );
   705 
   711 
   706     // Unblacklist all IAPs related to the connection error 
       
   707     // when connection has started.
       
   708     // 
       
   709     iMyServer.HandleServerUnblackListIap( startedId, ETemporary );
       
   710 
       
   711     // Complete the message as soon as possible to avoid latency in BM
   712     // Complete the message as soon as possible to avoid latency in BM
   712     // 
   713     // 
   713     aMessage.Complete( KErrNone );
   714     aMessage.Complete( KErrNone );
   714     
   715     
   715     IapSelectionL()->ConnectionStarted();
   716     IapSelectionL()->ConnectionStarted();
   931             {
   932             {
   932             if ( !( iIapSelection->MpmConnPref().NoteBehaviour() & TExtendedConnPref::ENoteBehaviourConnDisableQueries ) )
   933             if ( !( iIapSelection->MpmConnPref().NoteBehaviour() & TExtendedConnPref::ENoteBehaviourConnDisableQueries ) )
   933                 {
   934                 {
   934                 if ( MyServer().RoamingWatcher()->RoamingStatus() == EMPMInternationalRoaming )
   935                 if ( MyServer().RoamingWatcher()->RoamingStatus() == EMPMInternationalRoaming )
   935                     {
   936                     {
   936                     //Check if cellular data usage query has already been presented to the user in this country
   937                     //International roaming
   937                     if ( MyServer().RoamingWatcher()->AskCellularDataUsageAbroad() == true )
   938                     iConfirmDlgRoaming = CMPMConfirmDlgRoaming::NewL( 
   938                         {
   939                             *this, 
   939                         //International roaming
   940                             snapId, 
   940                         iConfirmDlgRoaming = CMPMConfirmDlgRoaming::NewL( 
   941                             iMigrateIap, 
   941                                 *this, 
   942                             CMPMConfirmDlg::EConfirmDlgVisitorNetwork, 
   942                                 snapId, 
   943                             reconnect );
   943                                 iMigrateIap, 
       
   944                                 CMPMConfirmDlg::EConfirmDlgVisitorNetwork, 
       
   945                                 reconnect );
       
   946                         }
       
   947                     else
       
   948                         {
       
   949                         //Handle like user would have answered "Connect this time" to dialog
       
   950                         RoamingConfirmationCompletedL( KErrNone, EMsgQueryThisTime, reconnect );
       
   951                         }
       
   952                     }
   944                     }
   953                 else
   945                 else
   954                     {
   946                     {
   955                     //Home network
   947                     //Home network
   956                     iConfirmDlgRoaming = CMPMConfirmDlgRoaming::NewL( 
   948                     iConfirmDlgRoaming = CMPMConfirmDlgRoaming::NewL( 
  1103                     {
  1095                     {
  1104                     genConnSettings.iCellularDataUsageHome = ECmCellularDataUsageAutomatic;        
  1096                     genConnSettings.iCellularDataUsageHome = ECmCellularDataUsageAutomatic;        
  1105                     TRAP_IGNORE(MyServer().CommsDatAccess()->WriteGenConnSettingsL( genConnSettings )); 
  1097                     TRAP_IGNORE(MyServer().CommsDatAccess()->WriteGenConnSettingsL( genConnSettings )); 
  1106                     }
  1098                     }
  1107                 } 
  1099                 } 
  1108             else
       
  1109                 {
       
  1110                 //In foreign country connect automatically is not stored in commsdat
       
  1111                 //even user selected so. We just do not ask confirmation for the cellular
       
  1112                 //connection again in this country:
       
  1113                 MyServer().RoamingWatcher()->SetAskCellularDataUsageAbroad( false );            
       
  1114                 }
       
  1115             }
  1100             }
  1116         
  1101         
  1117         //user selected connect this time
  1102         //user selected connect this time
  1118         else
  1103         else
  1119             {
  1104             {
  2669         // If session is roaming, notification must be delayed.
  2654         // If session is roaming, notification must be delayed.
  2670         // But, only ConnMon initiated notifications need to be delayed.
  2655         // But, only ConnMon initiated notifications need to be delayed.
  2671         // Required notifications must go through whenever MPM decides
  2656         // Required notifications must go through whenever MPM decides
  2672         // to initiate them.
  2657         // to initiate them.
  2673         //
  2658         //
  2674         if( ( iStoredIapInfo.HoldPrefIapNotif() && aCaller == EConnMon )  ||
  2659         if( ( aCaller == EConnMon || aCaller == EConnMonEvent ) && 
  2675                 ( state == ERoaming && aCaller == EConnMon ) )
  2660                 ( iStoredIapInfo.HoldPrefIapNotif() || state == ERoaming) )
  2676             {
  2661             {
  2677             MPMLOGSTRING( "CMPMServerSession::PrefIAPNotificationL - \
  2662             MPMLOGSTRING( "CMPMServerSession::PrefIAPNotificationL - \
  2678 Mobility ongoing, notification will be handled later" )
  2663 Mobility ongoing, notification will be handled later" )
  2679             iStoredIapInfo.SetStoredIapInfo( aIapInfo );
  2664             iStoredIapInfo.SetStoredIapInfo( aIapInfo );
  2680             return;
  2665             return;
  2712         TMpmConnPref tempMpmConnPref;
  2697         TMpmConnPref tempMpmConnPref;
  2713         tempMpmConnPref.SetIapId( 0 );
  2698         tempMpmConnPref.SetIapId( 0 );
  2714         tempMpmConnPref.SetSnapId( snap );
  2699         tempMpmConnPref.SetSnapId( snap );
  2715         IapSelectionL()->ChooseBestIAPL( tempMpmConnPref, availableIAPList );
  2700         IapSelectionL()->ChooseBestIAPL( tempMpmConnPref, availableIAPList );
  2716         validateIapId = tempMpmConnPref.IapId();
  2701         validateIapId = tempMpmConnPref.IapId();
  2717         if ( ( validateIapId == 0 ) && ( aCaller == EConnMon ) )
  2702         if ( ( validateIapId == 0 ) 
       
  2703                 && ( aCaller == EConnMon || aCaller == EConnMonEvent ) )
  2718             {
  2704             {
  2719             // Since Connection Monitor is the only component which 
  2705             // Since Connection Monitor is the only component which 
  2720             // is unaware of Connection Id and SNAP, it can't send 
  2706             // is unaware of Connection Id and SNAP, it can't send 
  2721             // the error notification in case ChooseBestIAPL could 
  2707             // the error notification in case ChooseBestIAPL could 
  2722             // not find any available IAP for this SNAP. 
  2708             // not find any available IAP for this SNAP. 
  2723             // 
  2709             // 
  2724             // All the other components take responsibility of 
  2710             // All the other components take responsibility of 
  2725             // sending the error notification. 
  2711             // sending the error notification. 
  2726             // 
  2712             // 
  2727             TRAP_IGNORE( ErrorNotificationL( KErrNotFound,
  2713             // Do not send the error if this call came from ConnMon Event.
  2728                                              EMPMMobilityErrorNotification ) )
  2714             // This will prevent unnecessary mobility errors.
       
  2715             // For example if there is two WLAN networks in Internet destination
       
  2716             // and we get weak indication for the one to which we are connected.
       
  2717             // Then connmon signals us with IAPAvailabilityChange which results
       
  2718             // to no available IAPs. We should not report error in that case.
       
  2719             if ( aCaller == EConnMon )
       
  2720                 {
       
  2721                 TRAP_IGNORE( ErrorNotificationL( KErrNotFound,
       
  2722                                              EMPMMobilityErrorNotification ) );
       
  2723                 }
       
  2724             CleanupStack::PopAndDestroy( &availableIAPList );
       
  2725             return;                                                                   
  2729             }
  2726             }
  2730 
  2727 
  2731         TUint32 retNetId = 0;
  2728         TUint32 retNetId = 0;
  2732         iMyServer.CommsDatAccess()->ValidateIapL( iConnId, 
  2729         iMyServer.CommsDatAccess()->ValidateIapL( iConnId, 
  2733                                        validateIapId, 
  2730                                        validateIapId,