bearermanagement/mpm/src/mpmiapselection.cpp
changeset 3 f7816ffc66ed
parent 2 086aae6fc07e
child 8 2e6c4614c58e
child 18 fcbbe021d614
equal deleted inserted replaced
2:086aae6fc07e 3:f7816ffc66ed
   115         }
   115         }
   116 #endif // _DEBUG
   116 #endif // _DEBUG
   117     
   117     
   118     iChooseIapPref = aChooseIapPref;
   118     iChooseIapPref = aChooseIapPref;
   119 
   119 
   120     if ( iSession->IsWlanOnlyL( iNewWlansAllowed ) )
   120     // Update iNewWlansAllowed information.
   121         {
   121     // No need to filter away cellular iaps here based on UI's Allow Cellular Usage
   122         if ( iChooseIapPref.BearerSet() ==
   122     // setting, since ConnMon checks the setting and reports only correct IAPs
   123              TExtendedConnPref::EExtendedConnBearerUnknown )
   123     // available for MPM.
   124             {
   124     iSession->IsWlanOnlyL( iNewWlansAllowed );
   125             // Force bearerset to WLAN if received bearerset was empty
   125 
   126             iChooseIapPref.SetBearerSet(
       
   127                 TExtendedConnPref::EExtendedConnBearerWLAN );
       
   128             }
       
   129         else if ( iChooseIapPref.BearerSet() &
       
   130                   TExtendedConnPref::EExtendedConnBearerWLAN )
       
   131             {
       
   132             // Force bearerset to WLAN only in case where wlan was included
       
   133             // in the received bearerset.
       
   134             iChooseIapPref.SetBearerSet(
       
   135                 TExtendedConnPref::EExtendedConnBearerWLAN );          
       
   136             }
       
   137         else
       
   138             {
       
   139             // If wlan was not included in received bearerset,
       
   140             // complete selection with error code
       
   141             ChooseIapComplete( KErrPermissionDenied,
       
   142                                iSession->MyServer().UserConnPref() );
       
   143             return; 
       
   144             }
       
   145         }
       
   146     
       
   147     // Always use stored connection info.
   126     // Always use stored connection info.
   148     // If stored information doesn't exist, a normal sequence is used.
   127     // If stored information doesn't exist, a normal sequence is used.
   149     TUint32 snap( 0 );
   128     TUint32 snap( 0 );
   150     TUint32 iap ( 0 );
   129     TUint32 iap ( 0 );
   151     
   130     
   380                 return;                
   359                 return;                
   381                 }
   360                 }
   382 
   361 
   383             // Check whether confirmation from user is needed for allowing cellular usage.
   362             // Check whether confirmation from user is needed for allowing cellular usage.
   384             // When application is starting an IAP confirmation is asked only when roaming.
   363             // When application is starting an IAP confirmation is asked only when roaming.
   385             if ( iSession->IsConfirmFirstL( validateIapId ) )
   364             // This is skipped for VPN (= virtual) IAPs
   386                 {
   365             if ( iSession->IsConfirmFirstL( validateIapId ) &&
   387                 // Check whether queries are disabled
   366                  !( iSession->MyServer().CommsDatAccess()->IsVirtualIapL( validateIapId ) ))
   388                 if ( !( iChooseIapPref.NoteBehaviour() & TExtendedConnPref::ENoteBehaviourConnDisableQueries ) )
   367                 {
       
   368                 // Check if we are roaming and cellular data usage query has not yet been presented
       
   369                 // to the user in this country
       
   370                 if ( iSession->MyServer().RoamingWatcher()->RoamingStatus() == EMPMInternationalRoaming
       
   371                     && iSession->MyServer().RoamingWatcher()->AskCellularDataUsageAbroad() == true )
   389                     {
   372                     {
   390                     if ( iSession->MyServer().RoamingWatcher()->RoamingStatus() == EMPMInternationalRoaming )
   373                     // Check whether queries are enabled
       
   374                     if ( !( iChooseIapPref.NoteBehaviour() & TExtendedConnPref::ENoteBehaviourConnDisableQueries ) )
   391                         {
   375                         {
   392                         // Check if cellular data usage query has already been presented to the user in this country
   376                         TConnectionId connId = iSession->ConnectionId();
   393                        if ( iSession->MyServer().RoamingWatcher()->AskCellularDataUsageAbroad() == true )
       
   394                             {
       
   395                             TConnectionId connId = iSession->ConnectionId();
       
   396                                                             
   377                                                             
   397                             // International roaming
   378                         // International roaming
   398                             iConfirmDlgStarting = CMPMConfirmDlgStarting::NewL( 
   379                         iConfirmDlgStarting = CMPMConfirmDlgStarting::NewL( 
   399                                                   *this, 
   380                             *this, 
   400                                                   connId,
   381                             connId,
   401                                                   snap, 
   382                             snap, 
   402                                                   validateIapId, 
   383                             validateIapId, 
   403                                                   CMPMConfirmDlg::EConfirmDlgVisitorNetwork,
   384                             CMPMConfirmDlg::EConfirmDlgVisitorNetwork,
   404                                                   iChooseIapPref,
   385                             iChooseIapPref,
   405                                                   iSession->MyServer(),
   386                             iSession->MyServer(),
   406                                                   *iSession,
   387                             *iSession,
   407                                                   EExplicitConnection );
   388                             EExplicitConnection );
   408                             return;    
   389                         return;    
   409                             }
   390                         }
       
   391                     else
       
   392                         {
       
   393                         // Queries disabled, connection must fail
       
   394                         ChooseIapComplete( KErrPermissionDenied, &iChooseIapPref );
       
   395                         return;
   410                         }
   396                         }
   411                     }
   397                     }
   412                 }
   398                 }
   413                            
   399                            
   414             // Add info into the BM connections
   400             // Add info into the BM connections
   545         ChooseIapComplete( KErrGprsOfflineMode, &iChooseIapPref );
   531         ChooseIapComplete( KErrGprsOfflineMode, &iChooseIapPref );
   546         }
   532         }
   547     else
   533     else
   548         {
   534         {
   549         // Check whether confirmation from user is needed for allowing cellular usage
   535         // Check whether confirmation from user is needed for allowing cellular usage
       
   536 		// This is skipped for VPN (= virtual) IAPs
   550         if ( ( iSession->IsConfirmFirstL( validateIapId ) ) && 
   537         if ( ( iSession->IsConfirmFirstL( validateIapId ) ) && 
   551              ( iSession->MyServer().CommsDatAccess()->CheckWlanL( validateIapId ) == ENotWlanIap ) )
   538              ( iSession->MyServer().CommsDatAccess()->CheckWlanL( validateIapId ) == ENotWlanIap ) &&
       
   539              !( iSession->MyServer().CommsDatAccess()->IsVirtualIapL( validateIapId ) ) )
   552             {
   540             {
   553             // Check whether queries are disabled
   541             // Check whether queries are disabled
   554             if ( !( iChooseIapPref.NoteBehaviour() & TExtendedConnPref::ENoteBehaviourConnDisableQueries ) )
   542             if ( !( iChooseIapPref.NoteBehaviour() & TExtendedConnPref::ENoteBehaviourConnDisableQueries ) )
   555                 {
   543                 {
   556                 if ( iSession->MyServer().RoamingWatcher()->RoamingStatus() == EMPMInternationalRoaming )
   544                 if ( iSession->MyServer().RoamingWatcher()->RoamingStatus() == EMPMInternationalRoaming )
   955         }
   943         }
   956     else
   944     else
   957         {
   945         {
   958         // Check whether confirmation from user is needed for allowing cellular usage.
   946         // Check whether confirmation from user is needed for allowing cellular usage.
   959         // When user is starting implicit IAP/SNAP confirmation is asked only when roaming.
   947         // When user is starting implicit IAP/SNAP confirmation is asked only when roaming.
   960         if ( iSession->IsConfirmFirstL( iUserSelectionIapId ) )
   948 		// This is skipped for VPN (= virtual) IAPs
   961             {
   949         if ( iSession->IsConfirmFirstL( iUserSelectionIapId ) &&
   962             // Check whether queries are disabled
   950              !( iSession->MyServer().CommsDatAccess()->IsVirtualIapL( iUserSelectionIapId ) ) )
   963             if ( !( iChooseIapPref.NoteBehaviour() & TExtendedConnPref::ENoteBehaviourConnDisableQueries ) )
   951             {
   964                 {
   952             // Check if we are roaming and cellular data usage query has not yet been presented
   965                 if ( iSession->MyServer().RoamingWatcher()->RoamingStatus() == EMPMInternationalRoaming )
   953             // to the user in this country
       
   954             if ( iSession->MyServer().RoamingWatcher()->RoamingStatus() == EMPMInternationalRoaming
       
   955                 && iSession->MyServer().RoamingWatcher()->AskCellularDataUsageAbroad() == true )
       
   956                 {
       
   957                 // Check whether queries are enabled
       
   958                 if ( !( iChooseIapPref.NoteBehaviour() & TExtendedConnPref::ENoteBehaviourConnDisableQueries ) )
   966                     {
   959                     {
   967                     // Check if cellular data usage query has already been presented to the user in this country
   960                     TConnectionId connId = iSession->ConnectionId();
   968                     if ( iSession->MyServer().RoamingWatcher()->AskCellularDataUsageAbroad() == true )
       
   969                         {
       
   970                         TConnectionId connId = iSession->ConnectionId();
       
   971                                                                     
   961                                                                     
   972                         // International roaming
   962                     // International roaming
   973                         iConfirmDlgStarting = CMPMConfirmDlgStarting::NewL( 
   963                     iConfirmDlgStarting = CMPMConfirmDlgStarting::NewL( 
   974                                               *this, 
   964                         *this, 
   975                                               connId,
   965                         connId,
   976                                               iUserSelectionSnapId, 
   966                         iUserSelectionSnapId, 
   977                                               iUserSelectionIapId, 
   967                         iUserSelectionIapId, 
   978                                               CMPMConfirmDlg::EConfirmDlgVisitorNetwork,
   968                         CMPMConfirmDlg::EConfirmDlgVisitorNetwork,
   979                                               iChooseIapPref,
   969                         iChooseIapPref,
   980                                               iSession->MyServer(),
   970                         iSession->MyServer(),
   981                                               *iSession,
   971                         *iSession,
   982                                               EImplicitConnection );
   972                         EImplicitConnection );
   983                         return;    
   973                     return;    
   984                         }
   974                     }
       
   975                 else
       
   976                     {
       
   977                     // Queries disabled, connection must fail
       
   978                     ChooseIapComplete( KErrPermissionDenied, &iChooseIapPref );
       
   979                     return;
   985                     }
   980                     }
   986                 }
   981                 }
   987             }
   982             }
   988 
   983 
   989         CompleteImplicitConnectionL();
   984         CompleteImplicitConnectionL();