gssettingsuis/Gs/GSNetworkPlugin/Src/GSNetworkPluginModel.cpp
changeset 0 8c5d936e5675
child 11 23553eb4e470
equal deleted inserted replaced
-1:000000000000 0:8c5d936e5675
       
     1 /*
       
     2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *        Model/Engine for Network Settings Plugin
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include "GSNetworkPluginModel.h"
       
    22 #include "GSNetworkPlugin.h"
       
    23 #include "GsNetworkPlugin.hrh"
       
    24 #include "GsLogger.h"      //for logging traces
       
    25 #include <featmgr.h>
       
    26 #include <barsc.h>
       
    27 #include <barsread.h>
       
    28 #include <coecntrl.h>
       
    29 #include <f32file.h>
       
    30 #include <AknQueryDialog.h>
       
    31 #include <s32file.h>
       
    32 #include <featmgr.h>
       
    33 #include <PsetCSP.h>
       
    34 #include <generalsettingsvariant.hrh>
       
    35 #include <PSVariables.h>  //PubSub
       
    36 #include <settingsinternalcrkeys.h>
       
    37 #include "SettingsPrivateCRKeys.h"
       
    38 #include <LogsDomainCRKeys.h>
       
    39 #include <PsetContainer.h>
       
    40 #include <PsetSAObserver.h>  //ongoing call check
       
    41 #include "GSNetworkDebugHelper.h"
       
    42 #include <GsNetworkPluginRsc.rsg>           //for resource IDs
       
    43 
       
    44 //CONSTANTS
       
    45 // default value for autolock period
       
    46 // default value for Sat operations
       
    47 
       
    48 
       
    49 _LIT( KGSNameOfClass, "CGSNetworkPluginModel" );
       
    50 
       
    51 // Warning disabled as this constant is used inside __ASSERT_DEBUG
       
    52 #pragma diag_suppress 177
       
    53 _LIT( KGSNetworkPluginModelAssertName, "CGSNetworkPluginModel::CheckState" );
       
    54 
       
    55 
       
    56 // ================= MEMBER FUNCTIONS =======================
       
    57 
       
    58 // ----------------------------------------------------------------------------
       
    59 // CGSNetworkPluginModel::NewL
       
    60 //
       
    61 // Symbian OS two-phased constructor, overloaded version
       
    62 // ----------------------------------------------------------------------------
       
    63 //
       
    64 CGSNetworkPluginModel* CGSNetworkPluginModel::NewL(
       
    65         CGSNetworkPluginContainer* aContainer,
       
    66         CGSNetworkPlugin* aPlugin )
       
    67     {
       
    68     CGSNetworkPluginModel* self = new( ELeave ) CGSNetworkPluginModel(
       
    69             aContainer,
       
    70             aPlugin );
       
    71     CleanupStack::PushL( self );
       
    72     self->ConstructL();
       
    73     CleanupStack::Pop( self );
       
    74     return self;
       
    75     }
       
    76 
       
    77 
       
    78 // ----------------------------------------------------------------------------
       
    79 // CGSNetworkPluginModel::CGSNetworkPluginModel
       
    80 //
       
    81 // C++ default constructor can NOT contain any code, that
       
    82 // might leave.
       
    83 // ----------------------------------------------------------------------------
       
    84 //
       
    85 CGSNetworkPluginModel::CGSNetworkPluginModel(
       
    86         CGSNetworkPluginContainer* aContainer,
       
    87         CGSNetworkPlugin* aPlugin )
       
    88     : iNetworkMode( KGSNetworkModeCapsNotUpdated ),
       
    89       iContainer( aContainer ), 
       
    90       iPlugin( aPlugin ) 
       
    91     {
       
    92     }
       
    93 
       
    94 
       
    95 // ----------------------------------------------------------------------------
       
    96 // CGSNetworkPluginModel::ConstructL
       
    97 //
       
    98 // EPOC default constructor can leave.
       
    99 // ----------------------------------------------------------------------------
       
   100 //
       
   101 void CGSNetworkPluginModel::ConstructL()
       
   102     {
       
   103     ConstructBaseItemsL();
       
   104     }
       
   105 
       
   106 // ----------------------------------------------------------------------------
       
   107 // CGSNetworkPluginModel::ConstructBaseItemsL
       
   108 //
       
   109 // Constructing base items
       
   110 // ----------------------------------------------------------------------------
       
   111 //
       
   112 void CGSNetworkPluginModel::ConstructBaseItemsL()
       
   113     {
       
   114     FeatureManager::InitializeLibL();
       
   115     InitializeCentralRepositoryL();
       
   116     SetCSPActiveL( ETrue );
       
   117     iSettingsContainer = CPsetContainer::NewL();
       
   118     User::LeaveIfError( iGSVariationRepository->Get(
       
   119             KSettingsVariationFlags, iLocalVariationValues ) );
       
   120 #ifndef __WINS__
       
   121     //This is currently not supported by emulator
       
   122     CreatePhoneSettingsEngineL();
       
   123 #endif //__WINS__
       
   124     }
       
   125 
       
   126 
       
   127 // ----------------------------------------------------------------------------
       
   128 // CGSNetworkPluginModel::~CGSNetworkPluginModel
       
   129 //
       
   130 // Destructor
       
   131 // ----------------------------------------------------------------------------
       
   132 //
       
   133 CGSNetworkPluginModel::~CGSNetworkPluginModel()
       
   134     {
       
   135     UninitializeCentralRepository();
       
   136 
       
   137     if ( GetCSPStatus() )
       
   138         {
       
   139         TRAP_IGNORE( SetCSPActiveL( EFalse ) );
       
   140         }
       
   141 
       
   142     if ( iPhoneSettingsEngine )
       
   143         {
       
   144         delete iPhoneSettingsEngine;
       
   145         }
       
   146 
       
   147     if( iSettingsContainer )
       
   148         {
       
   149         delete iSettingsContainer;
       
   150         }
       
   151 
       
   152     FeatureManager::UnInitializeLib();
       
   153 
       
   154     if ( iContainer )
       
   155         {
       
   156         iContainer = NULL;
       
   157         }
       
   158     }
       
   159 
       
   160 // ----------------------------------------------------------------------------
       
   161 // CGSNetworkPluginModel::InitializeCentralRepositoryL
       
   162 //
       
   163 // Creating and setting keys for the Central Repository
       
   164 // ----------------------------------------------------------------------------
       
   165 //
       
   166 void CGSNetworkPluginModel::InitializeCentralRepositoryL()
       
   167     {
       
   168     iNetworkRepository = CRepository::NewL( KCRUidNetworkSettings );
       
   169     iGSVariationRepository = CRepository::NewL( KCRUidSettingsVariation );
       
   170     }
       
   171 
       
   172 // ----------------------------------------------------------------------------
       
   173 // CGSNetworkPluginModel::UninitializeCentralRepositoryL
       
   174 //
       
   175 // Removes Central Repository objects
       
   176 // ----------------------------------------------------------------------------
       
   177 //
       
   178 void CGSNetworkPluginModel::UninitializeCentralRepository()
       
   179     {
       
   180     if ( iNetworkRepository )
       
   181         {
       
   182         delete iNetworkRepository;
       
   183         iNetworkRepository = NULL;
       
   184         }
       
   185     if ( iGSVariationRepository )
       
   186         {
       
   187         delete iGSVariationRepository;
       
   188         iGSVariationRepository = NULL;
       
   189         }
       
   190     }
       
   191 
       
   192 // ----------------------------------------------------------------------------
       
   193 // CGSNetworkPluginModel::GetCSPStatus
       
   194 //
       
   195 // Get Customer Service Profile status
       
   196 // ----------------------------------------------------------------------------
       
   197 //
       
   198 TBool CGSNetworkPluginModel::GetCSPStatus()
       
   199     {
       
   200     if ( iCSP )
       
   201         {
       
   202         return ETrue;
       
   203         }
       
   204     else
       
   205         {
       
   206         return EFalse;
       
   207         }
       
   208     }
       
   209 
       
   210 // ----------------------------------------------------------------------------
       
   211 // CGSNetworkPluginModel::SetCSPActiveL
       
   212 //
       
   213 // Set Customer Service Profile active
       
   214 // ----------------------------------------------------------------------------
       
   215 //
       
   216 void CGSNetworkPluginModel::SetCSPActiveL( TBool aValue )
       
   217     {
       
   218     if ( aValue )
       
   219         {
       
   220         iCSP = CPsetCustomerServiceProfile::NewL();
       
   221         User::LeaveIfError( iCSP->OpenCSProfileL() );
       
   222         }
       
   223     else
       
   224         {
       
   225         delete iCSP;
       
   226         iCSP = NULL;
       
   227         }
       
   228     }
       
   229 
       
   230 // ----------------------------------------------------------------------------
       
   231 // CGSNetworkPluginModel::IsNetworkModeVisible
       
   232 //
       
   233 // Get network mode status value from shared data.
       
   234 // ----------------------------------------------------------------------------
       
   235 //
       
   236 TBool CGSNetworkPluginModel::IsNetworkModeVisible()
       
   237     {
       
   238     TBool nwModeAvailable = EFalse;
       
   239     TInt value;
       
   240 
       
   241     iNetworkRepository->Get( KSettingsNetworkMode, value );
       
   242 
       
   243     switch ( value )
       
   244         {
       
   245         case 1:
       
   246             nwModeAvailable = ETrue;
       
   247             break;
       
   248         case 0:
       
   249             nwModeAvailable = EFalse;
       
   250             break;
       
   251         default:
       
   252             break;
       
   253         }
       
   254 
       
   255     return nwModeAvailable;
       
   256 
       
   257     }
       
   258 
       
   259 // ----------------------------------------------------------------------------
       
   260 // CGSNetworkPluginModel::IsSettingSupported
       
   261 //
       
   262 // Check if a given setting is supported
       
   263 // ----------------------------------------------------------------------------
       
   264 //
       
   265 TBool CGSNetworkPluginModel::IsSettingSupported( TInt aSettingNumber )
       
   266     {
       
   267     __ASSERT_ALWAYS( iCSP != NULL, User::Panic( KGSNameOfClass,
       
   268                                    EGSTelPluinModelPanicNullPtr ) );
       
   269     TBool settingSupported = EFalse;
       
   270     TInt retVal = KErrNone;
       
   271     switch ( aSettingNumber )
       
   272         {
       
   273         case EGSCSPCallForward:
       
   274             retVal = iCSP->IsCFSupported( settingSupported );
       
   275             break;
       
   276         case EGSCSPCallBarring:
       
   277             retVal = iCSP->IsCBSupported( settingSupported );
       
   278             break;
       
   279         case EGSCSPCallWaiting:
       
   280             retVal = iCSP->IsCWSupported( settingSupported );
       
   281             break;
       
   282         case EGSCSPAlternateLine:
       
   283             retVal = iCSP->IsALSSupported( settingSupported );
       
   284             break;
       
   285         case EGSCSPManualNetworkSelection:
       
   286             retVal = iCSP->IsNetworkSelectionSupported( settingSupported );
       
   287             break;
       
   288         default:
       
   289             break;
       
   290         }
       
   291 
       
   292     if ( retVal != KErrNone )
       
   293         {
       
   294         //if a CSP error occurs, by default service is available
       
   295         settingSupported = ETrue;
       
   296         }
       
   297 
       
   298     return settingSupported;
       
   299     }
       
   300 
       
   301 // ----------------------------------------------------------------------------
       
   302 // CGSNetworkPluginModel::GetMCNSettingValue
       
   303 // Gets MCN setting value
       
   304 //
       
   305 // ----------------------------------------------------------------------------
       
   306 //
       
   307 TBool CGSNetworkPluginModel::GetMCNSettingValue( TInt& aId )
       
   308     {
       
   309     TInt ret = KErrNone;
       
   310     ret = iNetworkRepository->Get( KSettingsMcnDisplay, aId );
       
   311     return ret;
       
   312     }
       
   313 
       
   314 // ----------------------------------------------------------------------------
       
   315 // CGSNetworkPluginModel::SetMCNSettingValue
       
   316 // Sets MCN setting value
       
   317 //
       
   318 // ----------------------------------------------------------------------------
       
   319 //
       
   320 TBool CGSNetworkPluginModel::SetMCNSettingValue( TInt& aId )
       
   321     {
       
   322     TInt ret = KErrNone;
       
   323     ret = iNetworkRepository->Set( KSettingsMcnDisplay, aId );
       
   324     return ret;
       
   325     }
       
   326 
       
   327 // ----------------------------------------------------------------------------
       
   328 // CGSNetworkPluginModel::GetSupportedNetworksL
       
   329 //
       
   330 // Get supported network mode list
       
   331 // ----------------------------------------------------------------------------
       
   332 //
       
   333 TInt CGSNetworkPluginModel::GetSupportedNetworksL()
       
   334     {
       
   335     TInt supportedNetworks = KGSSettingOff;
       
   336     User::LeaveIfError( iNetworkRepository->
       
   337                 Get( KSettingsNetworkModeList, supportedNetworks ) );
       
   338 
       
   339     return supportedNetworks;
       
   340     }
       
   341 
       
   342 // ---------------------------------------------------------
       
   343 // CGSNetworkPluginModel::GraphicalNetworkListSupportedL
       
   344 //
       
   345 // Check if graphical network list is supported.
       
   346 // ---------------------------------------------------------
       
   347 //
       
   348 TBool CGSNetworkPluginModel::GraphicalNetworkListSupportedL()
       
   349     {
       
   350     TBool supported = EFalse;
       
   351 
       
   352     if ( iLocalVariationValues & EGSConfig2G3GNetworkIcon )
       
   353         {
       
   354         supported = ETrue;
       
   355         }
       
   356 
       
   357     return supported;
       
   358     }
       
   359 
       
   360 // ---------------------------------------------------------
       
   361 // CGSTelPluginModel::AutomaticNetworkSearchSupportedL
       
   362 //
       
   363 // Check if automatic to automatic network search is supported.
       
   364 // ---------------------------------------------------------
       
   365 //
       
   366 TBool CGSNetworkPluginModel::AutomaticNetworkSearchSupportedL()
       
   367     {
       
   368     TBool supported = EFalse;
       
   369 
       
   370     if ( iLocalVariationValues & EGSConfigNoAutoToAutoNetworkSearch )
       
   371         {
       
   372         supported = ETrue;
       
   373         }
       
   374     return supported;
       
   375     }
       
   376 
       
   377 
       
   378 // ---------------------------------------------------------------------------
       
   379 //
       
   380 // Sets network mode to member variable.
       
   381 //
       
   382 // ---------------------------------------------------------------------------
       
   383 //
       
   384 void CGSNetworkPluginModel::CreatePhoneSettingsEngineL()
       
   385     {
       
   386     __GSLOGSTRING("[GS]--> CGSNetworkPluginModel::CreatePhoneSettingsEngineL");
       
   387     //initialize the phone settings object for network mode
       
   388     if ( !iPhoneSettingsEngine )
       
   389         {
       
   390         iPhoneSettingsEngine = iSettingsContainer->CreateNetworkModeObjectL( *this );
       
   391         }
       
   392     iPhoneSettingsEngine->SetNetworkModeObserver( *this );
       
   393     // get the current net mode asynchronously
       
   394     StartAsynGetCurrentNetworkModeSelectionL();
       
   395     
       
   396     __GSLOGSTRING("[GS] <--CGSNetworkPluginModel::CreatePhoneSettingsEngineL");
       
   397     }
       
   398 
       
   399 
       
   400 // ---------------------------------------------------------------------------
       
   401 // CGSNetworkPluginModel::HandleNetworkSystemModeEventsL
       
   402 //
       
   403 // Handles Network system mode list fetching from CustomAPI.
       
   404 // Handles Network system mode setting to CustomAPI.
       
   405 // Handles current network system mode fetching from CustomAPI.
       
   406 //
       
   407 // ---------------------------------------------------------------------------
       
   408 //
       
   409 void CGSNetworkPluginModel::HandleNetworkSystemModeEventsL(
       
   410             const MPsetNetworkModeObserver::TServiceRequest aRequest,
       
   411             const TUint32 aNetworkModeCaps )
       
   412     {
       
   413 #ifdef _DEBUG
       
   414     TBuf<KGSNetworkModeDebugStrLen> requestBuf;
       
   415     GSNetworkDebugHelper::NetworkModeRequestToDes( aRequest, requestBuf );
       
   416     __GSLOGSTRING1( "[CGSNetworkPluginModel::HandleNetworkSystemModeEventsL] %S ",
       
   417                     &requestBuf );
       
   418 #endif // _DEBUG
       
   419 
       
   420     PrintState();
       
   421 
       
   422     switch ( aRequest )
       
   423         {
       
   424         case MPsetNetworkModeObserver::EServiceRequestGetCurrentNetworkMode:
       
   425             {
       
   426             TBool networkModeChanged = EFalse;
       
   427             if( iNetworkMode != aNetworkModeCaps )
       
   428                 {
       
   429                 networkModeChanged = ETrue;
       
   430                 iNetworkMode = aNetworkModeCaps;
       
   431                 }
       
   432             if( networkModeChanged )
       
   433                 {
       
   434                 if ( iContainer )
       
   435                     {
       
   436                     iContainer->UpdateListBoxL( EGSNetworkModeItemId, 0 );
       
   437                     }
       
   438                 // Will update nw setting page in case it is open.
       
   439                 if ( iPlugin )
       
   440                     {
       
   441                     iPlugin->UpdateNetworkSettingPageL();
       
   442                     }
       
   443                 }
       
   444             }
       
   445             break;
       
   446         case MPsetNetworkModeObserver::EServiceRequestSetSelectedNetworkMode:
       
   447             {
       
   448 
       
   449             /**
       
   450              * Setting network mode succeeded: update actual mode:
       
   451              */
       
   452             iNetworkMode = iRequestedNetworkMode;
       
   453             
       
   454             /**
       
   455              * iNetworkMode should not be updated in case of error.
       
   456              * ->update only in this success case.
       
   457              *
       
   458              * Problem: Currently unclear if aNetworkModeCaps contains 
       
   459              * valid cata in this EServiceRequestSetSelectedNetworkMode case.
       
   460              * So, cannot update iNetworkMode from aNetworkModeCaps here.
       
   461              * Instead use iRequestedNetworkMode manually.
       
   462              */
       
   463 
       
   464             if( iContainer )
       
   465                 {
       
   466                 iContainer->HandleNetworkModeChangeL();
       
   467                 }
       
   468             break;
       
   469             }
       
   470         default:
       
   471             break;
       
   472         }
       
   473     PrintState();
       
   474     }
       
   475 
       
   476 
       
   477 // ---------------------------------------------------------------------------
       
   478 // CGSNetworkPluginModel::HandleNetworkErrorL
       
   479 //
       
   480 // From MPsetNetworkModeObserver. This is called if 
       
   481 // EServiceRequestSetSelectedNetworkMode fails. No need to handle other cases.
       
   482 // ---------------------------------------------------------------------------
       
   483 //
       
   484 void CGSNetworkPluginModel::HandleNetworkErrorL(
       
   485             const MPsetNetworkModeObserver::TServiceRequest aRequest,
       
   486             const TInt aError )
       
   487     {
       
   488 #ifdef _DEBUG
       
   489     TBuf<KGSNetworkModeDebugStrLen> requestBuf;
       
   490     GSNetworkDebugHelper::NetworkModeRequestToDes( aRequest, requestBuf );
       
   491     __GSLOGSTRING2( "[CGSNetworkPluginModel::HandleNetworkErrorL] %S error:%d",
       
   492                     &requestBuf, aError );
       
   493 #endif // _DEBUG
       
   494 
       
   495     /**
       
   496      * Handles failing when setting network mode.
       
   497      * Requested mode is stored into a member and actual network mode is updated only
       
   498      * when success is reported in HandleNetworkSystemModeEventsL/
       
   499      * EServiceRequestSetSelectedNetworkMode.
       
   500      */
       
   501     switch( aRequest )
       
   502         {
       
   503         case MPsetNetworkModeObserver::EServiceRequestGetCurrentNetworkMode:
       
   504             break;
       
   505         case MPsetNetworkModeObserver::EServiceRequestSetSelectedNetworkMode:
       
   506             // Hould display error note, iNetworkMode value is still correct as
       
   507             // it is not updated in case request failed.
       
   508             if ( iPlugin )
       
   509                 {
       
   510                 iPlugin->ShowNoteL( R_NO_NETWORK_ACCESS, KGSErrorNote );   
       
   511                 }
       
   512             break;
       
   513         default:
       
   514             break;
       
   515         }
       
   516     }
       
   517 
       
   518 // ---------------------------------------------------------------------------
       
   519 // CGSNetworkPluginModel::GetNetworkSelectionMode
       
   520 //
       
   521 // Gets network selection mode (automatic/manual)
       
   522 // ---------------------------------------------------------------------------
       
   523 //
       
   524 MPsetNetworkSelect::TSelectMode CGSNetworkPluginModel::GetNetworkSelectionMode()
       
   525     {
       
   526     MPsetNetworkSelect::TSelectMode mode =
       
   527             MPsetNetworkSelect::ENetSelectModeAutomatic;
       
   528 #ifndef __WINS__
       
   529     iPhoneSettingsEngine->GetNetworkSelectMode( mode );
       
   530 #endif //__WINS__
       
   531 
       
   532     return mode;
       
   533     }
       
   534 
       
   535 // ---------------------------------------------------------------------------
       
   536 // CGSNetworkPluginModel::StartAsynGetCurrentNetworkModeSelectionL
       
   537 //
       
   538 // ---------------------------------------------------------------------------
       
   539 //
       
   540 void CGSNetworkPluginModel::StartAsynGetCurrentNetworkModeSelectionL()
       
   541     {
       
   542     if ( iPhoneSettingsEngine )
       
   543         {
       
   544         iPhoneSettingsEngine->GetCurrentNetworkModeSelectionL();   
       
   545         }
       
   546     }
       
   547 
       
   548 // ---------------------------------------------------------------------------
       
   549 // CGSNetworkPluginModel::GetNetworkMode
       
   550 //
       
   551 // ---------------------------------------------------------------------------
       
   552 //
       
   553 TUint32 CGSNetworkPluginModel::GetNetworkMode()
       
   554     {
       
   555     /*
       
   556      * This does not actually ask for the mode from phone engine as
       
   557      * iPhoneSettingsEngine->GetCurrentNetworkModeSelectionL();
       
   558      * Has allready been called in constructor and afterwards we will receive
       
   559      * notifications if mode changes.
       
   560      */
       
   561     return iNetworkMode;
       
   562     }
       
   563 
       
   564 
       
   565 void CGSNetworkPluginModel::SetNetworkModeL( TUint32 aNetworkMode )
       
   566     {
       
   567     __GSLOGSTRING1( "[GS]--> [CGSNetworkPluginModel::SetNetworkModeL]:%d", aNetworkMode );
       
   568     
       
   569     // Store requested mode but iNetworkMode should not updated unless request
       
   570     // succeeds.
       
   571     iRequestedNetworkMode = aNetworkMode;
       
   572     if( iPhoneSettingsEngine )
       
   573         {
       
   574         // Cancel the ongoing operation, otherwise, the set network mode operation will
       
   575         // leave with error code: KErrInUse. 
       
   576         if ( iPhoneSettingsEngine->IsActive() )
       
   577             {
       
   578             iPhoneSettingsEngine->Cancel();
       
   579             }
       
   580         iPhoneSettingsEngine->SetNetworkModeSelectionL( aNetworkMode );
       
   581         }
       
   582     
       
   583     __GSLOGSTRING1( "[GS]<-- [CGSNetworkPluginModel::SetNetworkModeL]:%d", aNetworkMode );
       
   584     }
       
   585 
       
   586 
       
   587 // ---------------------------------------------------------------------------
       
   588 // CGSNetworkPluginModel::PrintState
       
   589 //
       
   590 // ---------------------------------------------------------------------------
       
   591 void CGSNetworkPluginModel::PrintState()
       
   592     {
       
   593 #ifdef _DEBUG
       
   594     TBuf<KGSNetworkModeDebugStrLen> networkModeCaps;
       
   595     GSNetworkDebugHelper::NwCapsToDes( iNetworkMode, networkModeCaps );
       
   596     __GSLOGSTRING1( "[CGSNetworkPluginModel::PrintState] iNetworkMode:  %S ",
       
   597                     &networkModeCaps );
       
   598 #endif // _DEBUG
       
   599     }
       
   600 
       
   601 // ---------------------------------------------------------------------------
       
   602 // CGSNetworkPluginModel::CheckState
       
   603 // For debugging
       
   604 // ---------------------------------------------------------------------------
       
   605 void CGSNetworkPluginModel::CheckState( TGSNetworkModeItems aMode )
       
   606     {
       
   607 #ifdef _DEBUG
       
   608     TBuf<KGSNetworkModeDebugStrLen> networkModeCaps;
       
   609     GSNetworkDebugHelper::NwCapsToDes( iNetworkMode, networkModeCaps );
       
   610     TBuf<KGSNetworkModeDebugStrLen> networkMode;
       
   611     GSNetworkDebugHelper::NwToDes( aMode, networkMode );
       
   612 
       
   613     __GSLOGSTRING2( "[CGSNetworkPluginModel::CheckState] %S <-> %S",
       
   614                     &networkModeCaps, &networkMode );
       
   615 
       
   616     switch ( iNetworkMode )
       
   617         {
       
   618         case RMmCustomAPI::KCapsNetworkModeDual:
       
   619             __ASSERT_DEBUG(
       
   620                 aMode == EGSNetworkModeDualmode,
       
   621                 User::Panic( KGSNetworkPluginModelAssertName, KErrArgument ) );
       
   622             break;
       
   623         case RMmCustomAPI::KCapsNetworkModeUmts:
       
   624             __ASSERT_DEBUG(
       
   625                 aMode == EGSNetworkModeUMTS,
       
   626                 User::Panic( KGSNetworkPluginModelAssertName, KErrArgument ) );
       
   627             break;
       
   628         case RMmCustomAPI::KCapsNetworkModeGsm:
       
   629             __ASSERT_DEBUG(
       
   630                 aMode == EGSNetworkModeGSM,
       
   631                 User::Panic( KGSNetworkPluginModelAssertName, KErrArgument ) );
       
   632             break;
       
   633         case KGSNetworkModeCapsNotUpdated:
       
   634             // Not updated yet so cannot check state.
       
   635             break;
       
   636         default:
       
   637             __ASSERT_DEBUG(
       
   638                 EFalse,
       
   639                 User::Panic( KGSNetworkPluginModelAssertName, KErrArgument ) );
       
   640             break;
       
   641         }
       
   642 
       
   643 #endif // _DEBUG
       
   644     }
       
   645 
       
   646 
       
   647 
       
   648 TBool CGSNetworkPluginModel::IsCallActive()
       
   649     {
       
   650     TBool callActive = EFalse;
       
   651 
       
   652 #ifndef __WINS__
       
   653 //This is currently not supported by emulator
       
   654     
       
   655     if ( iPhoneSettingsEngine->IsCallActive() != CPsetSAObserver::EPSetNoCallsActive )
       
   656         {
       
   657         callActive = ETrue;
       
   658         }
       
   659     
       
   660 #endif //__WINS__
       
   661     
       
   662     return callActive;
       
   663     }
       
   664 
       
   665 
       
   666 
       
   667 //  End of File