phonecmdhandler/phonecmdhnlr/src/PhoneHandlerCallBase.cpp
changeset 46 2fa1fa551b0b
parent 42 35488577e233
child 48 78df25012fda
equal deleted inserted replaced
42:35488577e233 46:2fa1fa551b0b
     1 /*
       
     2 * Copyright (c) 2002-2005 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:  Base class for services. 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include "phonehandlercallbase.h" 
       
    22 #include "phonehandleractive.h" 
       
    23 #include "phonehandlerdebug.h" 
       
    24 
       
    25 #include <cphcltcommandhandler.h> 
       
    26 
       
    27 // EXTERNAL DATA STRUCTURES
       
    28 
       
    29 // EXTERNAL FUNCTION PROTOTYPES  
       
    30 
       
    31 // CONSTANTS
       
    32 
       
    33 // MACROS
       
    34 
       
    35 // LOCAL CONSTANTS AND MACROS
       
    36 
       
    37 // MODULE DATA STRUCTURES
       
    38 
       
    39 // LOCAL FUNCTION PROTOTYPES
       
    40 
       
    41 // FORWARD DECLARATIONS
       
    42 
       
    43 // ============================= LOCAL FUNCTIONS ===============================
       
    44 
       
    45 // ============================ MEMBER FUNCTIONS ===============================
       
    46 
       
    47 // -----------------------------------------------------------------------------
       
    48 // CPhoneHandlerCallBase::CPhoneHandlerCallBase
       
    49 // C++ default constructor can NOT contain any code, that
       
    50 // might leave.
       
    51 // -----------------------------------------------------------------------------
       
    52 //
       
    53 CPhoneHandlerCallBase::CPhoneHandlerCallBase()
       
    54     : iState( EPhoneHandlerState1 )
       
    55     {
       
    56     }
       
    57 
       
    58 // Destructor
       
    59 CPhoneHandlerCallBase::~CPhoneHandlerCallBase()
       
    60     {
       
    61     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerCallBase::~CPhoneHandlerCallBase()" );
       
    62             
       
    63     iServer.Close();
       
    64     delete iCommandHandler;
       
    65     delete iActive;
       
    66     }
       
    67 
       
    68 // -----------------------------------------------------------------------------
       
    69 // CPhoneHandlerCallBase::LoadServiceL
       
    70 // Initializes API that is used to request call handling related services.
       
    71 // (other items were commented in a header).
       
    72 // -----------------------------------------------------------------------------
       
    73 //
       
    74 void CPhoneHandlerCallBase::LoadServiceL()
       
    75     {
       
    76     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerCallBase::LoadServiceL() start" );
       
    77     
       
    78     
       
    79     
       
    80     iCommandHandler = CPhCltCommandHandler::NewL();
       
    81     
       
    82     User::LeaveIfError( iServer.Connect() ); // create session
       
    83     
       
    84     // Create active object
       
    85     iActive = CPhoneHandlerActive::NewL( *this );
       
    86     
       
    87     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerCallBase::LoadServiceL() end" );
       
    88     }
       
    89 
       
    90 // -----------------------------------------------------------------------------
       
    91 // CPhoneHandlerCallBase::NextState
       
    92 // Increments state used to control service.
       
    93 // (other items were commented in a header).
       
    94 // -----------------------------------------------------------------------------
       
    95 //
       
    96 void CPhoneHandlerCallBase::NextState()
       
    97     {
       
    98     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerCallBase::NextState() start" );
       
    99         
       
   100     TInt temp = static_cast<TInt>( iState );
       
   101     ++temp;
       
   102     iState = static_cast<TPhoneHandlerServiceState>( temp );
       
   103     
       
   104     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerCallBase::NextState() end" );
       
   105     }
       
   106     
       
   107 // -----------------------------------------------------------------------------
       
   108 // CPhoneHandlerCallBase::IdleState
       
   109 // Sets a specific state when service has been completed.
       
   110 // (other items were commented in a header).
       
   111 // -----------------------------------------------------------------------------
       
   112 //
       
   113 void CPhoneHandlerCallBase::IdleState()
       
   114     {
       
   115     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerCallBase::IdleState() start" );
       
   116     
       
   117     iState = EPhoneHandlerStateIdle;
       
   118     
       
   119     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerCallBase::IdleState() end" );
       
   120     }
       
   121 
       
   122 // -----------------------------------------------------------------------------
       
   123 // CPhoneHandlerCallBase::GetStatus
       
   124 // Returns active object's TRequestStatus for asynchronous calls.
       
   125 // (other items were commented in a header).
       
   126 // -----------------------------------------------------------------------------
       
   127 //
       
   128 TRequestStatus& CPhoneHandlerCallBase::GetStatus()
       
   129     {
       
   130     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerCallBase::GetStatus() start" );
       
   131     
       
   132     return iActive->iStatus;
       
   133     }
       
   134     
       
   135 // -----------------------------------------------------------------------------
       
   136 // CPhoneHandlerCallBase::Activate
       
   137 // Activates an active object for asynchronous calls.
       
   138 // (other items were commented in a header).
       
   139 // -----------------------------------------------------------------------------
       
   140 //  
       
   141 void CPhoneHandlerCallBase::Activate()
       
   142     {
       
   143     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerCallBase::Activate() start" );
       
   144     
       
   145     iActive->SetActive();                       
       
   146         
       
   147     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerCallBase::Activate() end" );
       
   148     }
       
   149 
       
   150 // ========================== OTHER EXPORTED FUNCTIONS =========================
       
   151 
       
   152 //  End of File