bearermanagement/mpm/src/mpmserversession.cpp
branchRCL_3
changeset 55 fc7b30ed2058
parent 54 984e13af52c4
child 57 05bc53fe583b
equal deleted inserted replaced
54:984e13af52c4 55:fc7b30ed2058
    74       iDisconnectDlg( NULL ),
    74       iDisconnectDlg( NULL ),
    75       iConfirmDlgRoaming( NULL ),
    75       iConfirmDlgRoaming( NULL ),
    76       iStoredIapInfo(),
    76       iStoredIapInfo(),
    77       iIapSelection( NULL ),
    77       iIapSelection( NULL ),
    78       iMigrateState( EMigrateNone ),
    78       iMigrateState( EMigrateNone ),
    79       iDisconnectDialogShown( EFalse )
    79       iDisconnectDialogShown( EFalse ),
       
    80       iErrorDiscreetPopupShown( EFalse )
    80     {
    81     {
    81     }
    82     }
    82 
    83 
    83 
    84 
    84 // -----------------------------------------------------------------------------
    85 // -----------------------------------------------------------------------------
   104 // CMPMServerSession::~CMPMServerSession
   105 // CMPMServerSession::~CMPMServerSession
   105 // -----------------------------------------------------------------------------
   106 // -----------------------------------------------------------------------------
   106 //
   107 //
   107 CMPMServerSession::~CMPMServerSession()
   108 CMPMServerSession::~CMPMServerSession()
   108     {
   109     {
   109     delete iDisconnectDlg;
   110 
   110     delete iConfirmDlgRoaming;
       
   111     delete iIapSelection;
       
   112 
   111 
   113     // Remove serverside objects for notification session.
   112     // Remove serverside objects for notification session.
   114     // 
   113     // 
   115     iMyServer.RemoveSession( this );
   114     iMyServer.RemoveSession( this );
   116 
   115 
   135     // Clean up the blacklist table 
   134     // Clean up the blacklist table 
   136     iMyServer.HandleServerUnblackListIap( iConnId, 0 );
   135     iMyServer.HandleServerUnblackListIap( iConnId, 0 );
   137     
   136     
   138     // Make sure the connection is removed from server's information array.
   137     // Make sure the connection is removed from server's information array.
   139     iMyServer.RemoveBMConnection( iConnId, *this );
   138     iMyServer.RemoveBMConnection( iConnId, *this );
       
   139 
       
   140     delete iDisconnectDlg;
       
   141     delete iConfirmDlgRoaming;
       
   142     delete iIapSelection;
       
   143 
   140     }
   144     }
   141 
   145 
   142 
   146 
   143 // -----------------------------------------------------------------------------
   147 // -----------------------------------------------------------------------------
   144 // CMPMServerSession::ServiceL
   148 // CMPMServerSession::ServiceL
   934                     }
   938                     }
   935 
   939 
   936         //Display confirm dialog only if we are moving to cellular IAP
   940         //Display confirm dialog only if we are moving to cellular IAP
   937         if ( MyServer().CommsDatAccess()->CheckWlanL( iMigrateIap ) == ENotWlanIap )
   941         if ( MyServer().CommsDatAccess()->CheckWlanL( iMigrateIap ) == ENotWlanIap )
   938             {
   942             {
   939             if ( !( iIapSelection->MpmConnPref().NoteBehaviour() & TExtendedConnPref::ENoteBehaviourConnDisableQueries ) )
   943             // Check that connection preferences don't deny queries, and
       
   944             // enough time has elapsed from the last query cancelled by the user.
       
   945             if ( !( iIapSelection->MpmConnPref().NoteBehaviour() & TExtendedConnPref::ENoteBehaviourConnDisableQueries ) &&
       
   946                     !MyServer().IsConnPermQueryTimerOn() )
   940                 {
   947                 {
   941                 if ( MyServer().RoamingWatcher()->RoamingStatus() == EMPMInternationalRoaming )
   948                 if ( MyServer().RoamingWatcher()->RoamingStatus() == EMPMInternationalRoaming )
   942                     {
   949                     {
   943                     //International roaming
   950                     //International roaming
   944                     iConfirmDlgRoaming = CMPMConfirmDlgRoaming::NewL( 
   951                     iConfirmDlgRoaming = CMPMConfirmDlgRoaming::NewL( 
  1040 
  1047 
  1041     if( aError == KErrNone )
  1048     if( aError == KErrNone )
  1042         {
  1049         {
  1043         if( aResponse == EMsgQueryCancelled )
  1050         if( aResponse == EMsgQueryCancelled )
  1044             {
  1051             {
       
  1052             // User cancelled the connection permission query,
       
  1053             // don't try again until the timer expires.
       
  1054             MyServer().StartConnPermQueryTimer();
       
  1055             
  1045             if( !aReconnect )
  1056             if( !aReconnect )
  1046                 {
  1057                 {
  1047                 // Send a preferred IAP notification
  1058                 // Send a preferred IAP notification
  1048                 // 
  1059                 // 
  1049                 TConnMonIapInfo availableIAPs;
  1060                 TConnMonIapInfo availableIAPs;
  1414         {
  1425         {
  1415         iMyServer.PanicClient( KErrBadDescriptor );
  1426         iMyServer.PanicClient( KErrBadDescriptor );
  1416         return;
  1427         return;
  1417         }
  1428         }
  1418 
  1429 
       
  1430     // Read the Connection Id of the application
       
  1431     // 
       
  1432     TConnectionId connId = iProcessErrorMessage.Int1();
       
  1433     
       
  1434     MPMLOGSTRING3( "CMPMServerSession::HandleServerProcessErrorL \
       
  1435 - error code = %i, Connection Id = 0x%x", error, connId )
       
  1436 
  1419     if ( !ChooseBestIapCalled() )
  1437     if ( !ChooseBestIapCalled() )
  1420         {
  1438         {
  1421         MPMLOGSTRING( "CMPMServerSession::HandleServerProcessErrorL - \
  1439         MPMLOGSTRING( "CMPMServerSession::HandleServerProcessErrorL - \
  1422 Warning: ChooseBestIap has not been called yet" )
  1440 ChooseBestIap has not been called yet" )
  1423         TBMNeededAction neededAction( EPropagateError );
  1441 
  1424         ProcessErrorComplete( KErrNone, &error, &neededAction );
  1442         // If it is not disconnect dialog error then complete message. 
       
  1443         // If it is then leave message pending and it will be completed when 
       
  1444         // disconnect dialog completes in other session.
       
  1445         if ( !DisconnectDlgErrorCode( error ) )
       
  1446             {
       
  1447             TBMNeededAction neededAction( EPropagateError );
       
  1448             ProcessErrorComplete( KErrNone, &error, &neededAction );
       
  1449             }
       
  1450         else
       
  1451             {
       
  1452             MPMLOGSTRING( "Disconnect dlg error - leave msg pending" );
       
  1453             }
  1425         return;
  1454         return;
  1426         }
  1455         }
  1427 
  1456 
  1428     // Show error popup if it's allowed per client request
  1457     // Show error popup if it's allowed per client request
  1429     // Don't show the pop up if error code is for disconnect dialog
  1458     // Don't show the pop up if error code is for disconnect dialog
  1440             // belongs to the set of errors that are shown to the user.
  1469             // belongs to the set of errors that are shown to the user.
  1441             // Otherwise the popup is not shown.
  1470             // Otherwise the popup is not shown.
  1442             connUiUtils->ConnectionErrorDiscreetPopup( error );
  1471             connUiUtils->ConnectionErrorDiscreetPopup( error );
  1443             delete connUiUtils;
  1472             delete connUiUtils;
  1444             connUiUtils = NULL;
  1473             connUiUtils = NULL;
  1445             }
  1474             
  1446         }
  1475             // Error discreet popup has been shown. This is needed so that we
  1447 
  1476             // dont show it again for SNAP.
  1448     // Read the Connection Id of the application
  1477             iErrorDiscreetPopupShown = ETrue;
  1449     // 
  1478             }
  1450     TConnectionId connId = iProcessErrorMessage.Int1();
  1479         }
  1451 
       
  1452     MPMLOGSTRING3( "CMPMServerSession::HandleServerProcessErrorL\
       
  1453  - error code = %i, Connection Id = 0x%x", error, connId )
       
  1454 
  1480 
  1455     // Get the current connection IapId for this connId 
  1481     // Get the current connection IapId for this connId 
  1456     //
  1482     //
  1457     TUint32 currentIap = iMyServer.GetBMIap( connId );
  1483     TUint32 currentIap = iMyServer.GetBMIap( connId );
  1458 
  1484 
  1603             // is no preferred IAP among the available IAPs.
  1629             // is no preferred IAP among the available IAPs.
  1604             // 
  1630             // 
  1605             ProcessErrorComplete( KErrNone,
  1631             ProcessErrorComplete( KErrNone,
  1606                                   returnError,
  1632                                   returnError,
  1607                                   &neededAction );
  1633                                   &neededAction );
       
  1634             
       
  1635             iMyServer.HandlePendingMsgs( currentIap,
       
  1636                                          KErrNone,
       
  1637                                          returnError,
       
  1638                                          &neededAction );
  1608             return;
  1639             return;
  1609             }
  1640             }
  1610         }
  1641         }
  1611     else if ( state == EStarted )
  1642     else if ( state == EStarted )
  1612         {
  1643         {
  1613         // Process error according to the fact that the connection 
  1644         // Process error according to the fact that the connection 
  1614         // has already been started.
  1645         // has already been started.
  1615         // KErrConnectionTerminated is received when user disconnects
  1646         // KErrConnectionTerminated is received when user disconnects
  1616         // connection from Settings/Connection mgr.
  1647         // connection from Settings/Connection mgr.
  1617         //       
  1648         //       
  1618         if ( ( error == KErrCancel ) || ( error == KErrTimedOut ) || ( error == KErrConnectionTerminated ) )
  1649         if ( ( error == KErrCancel ) || ( error == KErrTimedOut ) || ( error == KErrConnectionTerminated )
       
  1650                 || ( error == KErrDisconnected && iMyServer.IsPhoneOffline() ) )
  1619             {
  1651             {
  1620             neededAction = EPropagateError;
  1652             neededAction = EPropagateError;
  1621 
  1653 
  1622             MPMLOGSTRING(
  1654             MPMLOGSTRING(
  1623                 "CMPMServerSession::HandleServerProcessErrorL - \
  1655                 "CMPMServerSession::HandleServerProcessErrorL - \
  3323     const TMpmConnPref* aPolicyPref )
  3355     const TMpmConnPref* aPolicyPref )
  3324     {
  3356     {
  3325     MPMLOGSTRING2( "CMPMServerSession::ChooseIapComplete aError = %d", aError )
  3357     MPMLOGSTRING2( "CMPMServerSession::ChooseIapComplete aError = %d", aError )
  3326 
  3358 
  3327     // Show error popup if it's allowed per client request.
  3359     // Show error popup if it's allowed per client request.
  3328 	// No error popup shown to SNAP.
  3360 	// Error popup shown to SNAP only if error discreet has not been shown for IAP.
  3329     if ( ChooseBestIapCalled() && (!( iIapSelection->MpmConnPref().NoteBehaviour() &
  3361     if ( ChooseBestIapCalled() && (!( iIapSelection->MpmConnPref().NoteBehaviour() &
  3330             TExtendedConnPref::ENoteBehaviourConnDisableNotes ))
  3362             TExtendedConnPref::ENoteBehaviourConnDisableNotes ))
  3331             && ( aError != KErrNone ) 
  3363               && ( aError != KErrNone )
  3332             && ( iIapSelection->MpmConnPref().SnapId() == 0 ) )
  3364               && ( iErrorDiscreetPopupShown == EFalse ) )
  3333         {
  3365         {
  3334         CConnectionUiUtilities* connUiUtils = NULL;
  3366         CConnectionUiUtilities* connUiUtils = NULL;
  3335         TRAPD( error, connUiUtils = CConnectionUiUtilities::NewL() );
  3367         TRAPD( error, connUiUtils = CConnectionUiUtilities::NewL() );
  3336         if ( error == KErrNone && connUiUtils )
  3368         if ( error == KErrNone && connUiUtils )
  3337             {
  3369             {
  3396                 }
  3428                 }
  3397             }
  3429             }
  3398         MPMLOGSTRING( "CMPMServerSession::ChooseIapComplete Message completed" )
  3430         MPMLOGSTRING( "CMPMServerSession::ChooseIapComplete Message completed" )
  3399         iChooseIapMessage.Complete( aError );
  3431         iChooseIapMessage.Complete( aError );
  3400         }
  3432         }
       
  3433     
       
  3434     // Enable showing error discreet popup for SNAP again
       
  3435     iErrorDiscreetPopupShown = EFalse;
  3401     }
  3436     }
  3402 
  3437 
  3403 
  3438 
  3404 // -----------------------------------------------------------------------------
  3439 // -----------------------------------------------------------------------------
  3405 // CMPMServerSession::ProcessErrorComplete
  3440 // CMPMServerSession::ProcessErrorComplete