bearermanagement/mpm/src/mpmserversession.cpp
changeset 71 9f263f780e41
parent 61 8b0c979bbe8c
child 72 0c32cf868819
equal deleted inserted replaced
70:ac5daea24fb0 71:9f263f780e41
     1 /*
     1 /*
     2 * Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies). 
     2 * Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    22 
    22 
    23 // INCLUDE FILES
    23 // INCLUDE FILES
    24 #include <e32svr.h>
    24 #include <e32svr.h>
    25 #include <gsmerror.h>     // KErrPacketDataTsyMaxPdpContextsReached 
    25 #include <gsmerror.h>     // KErrPacketDataTsyMaxPdpContextsReached 
    26 #include <etelpckt.h>     // KErrUmtsMaxNumOfContextExceededByNetwork
    26 #include <etelpckt.h>     // KErrUmtsMaxNumOfContextExceededByNetwork
    27 #include <bldvariant.hrh>                // For feature flags
       
    28 #include <centralrepository.h>           // CRepository 
    27 #include <centralrepository.h>           // CRepository 
    29 #include <CoreApplicationUIsSDKCRKeys.h> // KCRUidCoreApplicationUIs, 
    28 #include <CoreApplicationUIsSDKCRKeys.h> // KCRUidCoreApplicationUIs, 
    30                                          // KCoreAppUIsNetworkConnectionAllowed
    29                                          // KCoreAppUIsNetworkConnectionAllowed
    31 #include <es_sock.h>
    30 #include <es_sock.h>
    32 #include <commdb.h>
    31 #include <commdb.h>
    94 void CMPMServerSession::ConstructL()
    93 void CMPMServerSession::ConstructL()
    95     {
    94     {
    96     MPMLOGSTRING( "CMPMServerSession::ConstructL" )
    95     MPMLOGSTRING( "CMPMServerSession::ConstructL" )
    97     if ( !iMyServer.Events() )
    96     if ( !iMyServer.Events() )
    98         {
    97         {
    99         iMyServer.SetEvents(CMPMConnMonEvents::NewL(
    98         iMyServer.SetEvents( CMPMConnMonEvents::NewL(
   100             *const_cast<CMPMServer*>( &iMyServer ) ) );
    99             *const_cast<CMPMServer*>( &iMyServer ) ) );
   101         }
   100         }
   102 
   101 
   103     // Append session pointer to server
   102     // Append session pointer to server
   104     // 
   103     // 
   545             if ( !iServerSortSNAPMessage.IsNull() )
   544             if ( !iServerSortSNAPMessage.IsNull() )
   546                 {
   545                 {
   547                 // TODO Change CancelScanL to non-leaving.
   546                 // TODO Change CancelScanL to non-leaving.
   548                 // Otherwise, nothing clever can be done here.
   547                 // Otherwise, nothing clever can be done here.
   549                 // And OOM may risk MPM stability.
   548                 // And OOM may risk MPM stability.
   550                 TRAP_IGNORE( iMyServer.Events()->CancelScanL( this ))
   549                 TRAP_IGNORE( iMyServer.Events()->CancelScanL( this ) )
   551                 iServerSortSNAPMessage.Complete( KErrCancel );
   550                 iServerSortSNAPMessage.Complete( KErrCancel );
   552                 }
   551                 }
   553             break;
   552             break;
   554             }
   553             }
   555         default:
   554         default:
  3255     TInt                aError,
  3254     TInt                aError,
  3256     const TMpmConnPref* aPolicyPref )
  3255     const TMpmConnPref* aPolicyPref )
  3257     {
  3256     {
  3258     MPMLOGSTRING2( "CMPMServerSession::ChooseIapComplete aError = %d", aError )
  3257     MPMLOGSTRING2( "CMPMServerSession::ChooseIapComplete aError = %d", aError )
  3259 
  3258 
  3260     
       
  3261     // Try to write back arguments and complete message.
  3259     // Try to write back arguments and complete message.
  3262     // 
  3260     // 
  3263     if ( !iChooseIapMessage.IsNull() )
  3261     if ( !iChooseIapMessage.IsNull() )
  3264         {
  3262         {
  3265         if ( aError == KErrNone && aPolicyPref )
  3263         if ( aError == KErrNone && aPolicyPref )
  3355     MPMLOGSTRING2( "CMPMServerSession::ProcessErrorComplete aError = %d", aError )
  3353     MPMLOGSTRING2( "CMPMServerSession::ProcessErrorComplete aError = %d", aError )
  3356     
  3354     
  3357     if ( !iProcessErrorMessage.IsNull() )
  3355     if ( !iProcessErrorMessage.IsNull() )
  3358         {
  3356         {
  3359         // Try to write back arguments and complete message.
  3357         // Try to write back arguments and complete message.
  3360         // Traps are not necesary here. If WriteL functions leave the
       
  3361         // message is still completed in ServiceError
       
  3362         //
       
  3363         if( aErrorReturned )
  3358         if( aErrorReturned )
  3364             {
  3359             {
  3365             MPMLOGSTRING2( "CMPMServerSession::ProcessErrorComplete returned error = %d", 
  3360             MPMLOGSTRING2( "CMPMServerSession::ProcessErrorComplete returned error = %d", 
  3366                            *aErrorReturned )
  3361                            *aErrorReturned )
  3367 
  3362 
  3446 // CMPMServerSession::UseUserConnPref
  3441 // CMPMServerSession::UseUserConnPref
  3447 // -----------------------------------------------------------------------------
  3442 // -----------------------------------------------------------------------------
  3448 //
  3443 //
  3449 TBool CMPMServerSession::UseUserConnPref()
  3444 TBool CMPMServerSession::UseUserConnPref()
  3450     {
  3445     {
  3451     if ((iAppUid != iMyServer.CsIdWatcher()->ConnectScreenId()) &&
  3446     if ( ( iAppUid != iMyServer.CsIdWatcher()->ConnectScreenId() ) &&
  3452         iMyServer.UserConnection())
  3447          iMyServer.UserConnection() )
  3453         {
  3448         {
  3454         MPMLOGSTRING( "CMPMServerSession::UseUserConnPref - User connection active" );
  3449         MPMLOGSTRING( "CMPMServerSession::UseUserConnPref - User connection active" );
  3455         
  3450         
  3456         // Check whether default connection will be used
  3451         // Check whether default connection will be used
  3457         if ( iIapSelection->MpmConnPref().ConnType() == TMpmConnPref::EConnTypeDefault )
  3452         if ( iIapSelection->MpmConnPref().ConnType() == TMpmConnPref::EConnTypeDefault )