phonebookengines/VirtualPhonebook/VPbkSimStoreImpl/src/CGet3GPBInfoCmd.cpp
branchRCL_3
changeset 20 f4a778e096c2
parent 0 e686773b3f54
equal deleted inserted replaced
19:5b6f26637ad3 20:f4a778e096c2
       
     1 /*
       
     2 * Copyright (c) 2002-2007 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:  A command that queries 3G ADN store information from ETel 
       
    15 *                custom API
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 // INCLUDE FILES
       
    22 #include "CGet3GPBInfoCmd.h"
       
    23 
       
    24 #include "CUsimAdnStore.h"
       
    25 #include "VPbkSimStoreImplError.h"
       
    26 
       
    27 // From VPbkEng
       
    28 #include <VPbkDebug.h>
       
    29 
       
    30 namespace VPbkSimStoreImpl {
       
    31 
       
    32 // ============================ MEMBER FUNCTIONS ===============================
       
    33 
       
    34 // -----------------------------------------------------------------------------
       
    35 // CGet3GPBInfoCmd::CGet3GPBInfoCmd
       
    36 // C++ default constructor can NOT contain any code, that
       
    37 // might leave.
       
    38 // -----------------------------------------------------------------------------
       
    39 //
       
    40 CGet3GPBInfoCmd::CGet3GPBInfoCmd( CUsimAdnStore& aStore )
       
    41     :   CActive( EPriorityStandard ),
       
    42         iStore( aStore )
       
    43     {
       
    44     CActiveScheduler::Add( this );
       
    45     }
       
    46 
       
    47 // -----------------------------------------------------------------------------
       
    48 // CGet3GPBInfoCmd::NewLC
       
    49 // Two-phased constructor.
       
    50 // -----------------------------------------------------------------------------
       
    51 //
       
    52 CGet3GPBInfoCmd* CGet3GPBInfoCmd::NewLC( CUsimAdnStore& aStore )
       
    53     {
       
    54     CGet3GPBInfoCmd* self = 
       
    55         new( ELeave ) CGet3GPBInfoCmd( aStore );
       
    56     CleanupStack::PushL( self );
       
    57     return self;
       
    58     }
       
    59 
       
    60     
       
    61 // Destructor
       
    62 CGet3GPBInfoCmd::~CGet3GPBInfoCmd()
       
    63     {
       
    64     CancelCmd();
       
    65     }
       
    66 
       
    67 // -----------------------------------------------------------------------------
       
    68 // CGet3GPBInfoCmd::Execute
       
    69 // -----------------------------------------------------------------------------
       
    70 //
       
    71 void CGet3GPBInfoCmd::Execute()
       
    72     {
       
    73     __ASSERT_DEBUG( iObserver,
       
    74         VPbkSimStoreImpl::Panic( EPreCondCGet3GPBInfoCmdExecute ) );
       
    75         
       
    76     VPBK_DEBUG_PRINT(VPBK_DEBUG_STRING(
       
    77         "VPbkSimStoreImpl: RMmCustomAPI::Get3GPBInfo h%d request"),
       
    78         iStore.CustomAPI().SubSessionHandle());
       
    79     iStore.CustomAPI().Get3GPBInfo( iStatus, iStore.Get3GPBInfo() );
       
    80     SetActive();
       
    81     }
       
    82 
       
    83 // -----------------------------------------------------------------------------
       
    84 // CGet3GPBInfoCmd::AddObserverL
       
    85 // -----------------------------------------------------------------------------
       
    86 //
       
    87 void CGet3GPBInfoCmd::AddObserverL( MVPbkSimCommandObserver& aObserver )
       
    88     {
       
    89     __ASSERT_DEBUG( !iObserver,
       
    90         VPbkSimStoreImpl::Panic( EPreCondCGet3GPBInfoCmdAddObserverL ) );
       
    91     iObserver = &aObserver;
       
    92     }
       
    93 
       
    94 // -----------------------------------------------------------------------------
       
    95 // CGet3GPBInfoCmd::CancelCmd
       
    96 // -----------------------------------------------------------------------------
       
    97 //
       
    98 void CGet3GPBInfoCmd::CancelCmd()
       
    99     {
       
   100     CActive::Cancel();
       
   101     }
       
   102 
       
   103 // -----------------------------------------------------------------------------
       
   104 // CGet3GPBInfoCmd::RunL
       
   105 // -----------------------------------------------------------------------------
       
   106 //
       
   107 void CGet3GPBInfoCmd::RunL()
       
   108     {
       
   109     VPBK_DEBUG_PRINT(VPBK_DEBUG_STRING(
       
   110         "VPbkSimStoreImpl: RMmCustomAPI::Get3GPBInfo h%d completed %d"),
       
   111         iStore.CustomAPI().SubSessionHandle(), iStatus.Int() );
       
   112             
       
   113     VPBK_DEBUG_PRINT(VPBK_DEBUG_STRING(
       
   114         "VPbkSimStoreImpl: T3GPBInfo: iMaxLenEmail %d, iMaxLenSne %d,\
       
   115         iMaxLenAnr %d, iMaxLenGroupName %d, iMaxNumEmail %d, iMaxNumSne %d,\
       
   116         iMaxNumAnr %d, iMaxNumGroupName %d"),
       
   117         iStore.Get3GPBInfo().iMaxLenEmail,
       
   118         iStore.Get3GPBInfo().iMaxLenSne,
       
   119         iStore.Get3GPBInfo().iMaxLenAnr,
       
   120         iStore.Get3GPBInfo().iMaxLenGroupName,
       
   121         iStore.Get3GPBInfo().iMaxNumEmail,
       
   122         iStore.Get3GPBInfo().iMaxNumSne,
       
   123         iStore.Get3GPBInfo().iMaxNumAnr,
       
   124         iStore.Get3GPBInfo().iMaxNumGroupName );
       
   125     
       
   126     if ( iStatus.Int() == KErrNone )
       
   127         {
       
   128         iObserver->CommandDone( *this );
       
   129         }
       
   130     else
       
   131         {
       
   132         iObserver->CommandError( *this, iStatus.Int() );
       
   133         }
       
   134     }
       
   135 
       
   136 // -----------------------------------------------------------------------------
       
   137 // CGet3GPBInfoCmd::DoCancel
       
   138 // -----------------------------------------------------------------------------
       
   139 //
       
   140 void CGet3GPBInfoCmd::DoCancel()
       
   141     {
       
   142     VPBK_DEBUG_PRINT(VPBK_DEBUG_STRING(
       
   143         "VPbkSimStoreImpl: RMmCustomAPI::Get3GPBInfo h%d Cancel"),
       
   144         iStore.CustomAPI().SubSessionHandle());
       
   145     iStore.CustomAPI().CancelAsyncRequest( EGet3GPBInfoIPC );
       
   146     }
       
   147 } // namespace VPbkSimStoreImpl
       
   148 
       
   149 //  End of File