phonecmdhandler/phonecmdhnlr/src/PhoneHandlerEndCall.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:  Handles end call and reject call key presses. 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include    "phonehandlerendcall.h" 
       
    21 #include    "phonehandlercontrol.h" 
       
    22 #include    "phonehandlerdebug.h" 
       
    23 #include    <RemConCallHandlingTarget.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 // CPhoneHandlerEndCall::CPhoneHandlerEndCall
       
    49 // C++ default constructor can NOT contain any code, that
       
    50 // might leave.
       
    51 // -----------------------------------------------------------------------------
       
    52 //
       
    53 CPhoneHandlerEndCall::CPhoneHandlerEndCall(  
       
    54                             CPhoneHandlerControl& aControl, 
       
    55                             TRemConExtCallHandlingApiOperationId aOperation )
       
    56 : iControl( aControl ),
       
    57   iOperation( aOperation )
       
    58     {
       
    59     }
       
    60 
       
    61 // -----------------------------------------------------------------------------
       
    62 // CPhoneHandlerEndCall::ConstructL
       
    63 // Symbian 2nd phase constructor can leave.
       
    64 // -----------------------------------------------------------------------------
       
    65 //
       
    66 void CPhoneHandlerEndCall::ConstructL()
       
    67     {
       
    68     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerEndCall::ConstructL() start" );
       
    69         
       
    70     LoadServiceL();
       
    71     
       
    72     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerEndCall::ConstructL() end" );
       
    73     }
       
    74 
       
    75 // -----------------------------------------------------------------------------
       
    76 // CPhoneHandlerEndCall::NewL
       
    77 // Two-phased constructor.
       
    78 // -----------------------------------------------------------------------------
       
    79 //
       
    80 CPhoneHandlerEndCall* CPhoneHandlerEndCall::NewL( 
       
    81                         CPhoneHandlerControl& aControl,
       
    82                         TRemConExtCallHandlingApiOperationId aOperation )
       
    83     {
       
    84     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerEndCall::NewL()" );
       
    85         
       
    86     CPhoneHandlerEndCall* self = new( ELeave ) CPhoneHandlerEndCall( 
       
    87                                                     aControl,
       
    88                                                     aOperation );
       
    89     
       
    90     CleanupStack::PushL( self );
       
    91     self->ConstructL();
       
    92     CleanupStack::Pop( self );
       
    93 
       
    94     return self;
       
    95     }
       
    96 
       
    97     
       
    98 // Destructor
       
    99 CPhoneHandlerEndCall::~CPhoneHandlerEndCall()
       
   100     {
       
   101     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerEndCall::~CPhoneHandlerEndCall()" );
       
   102     
       
   103     }
       
   104 
       
   105 // -----------------------------------------------------------------------------
       
   106 // CPhoneHandlerEndCall::Process
       
   107 // Starts to process service.
       
   108 // (other items were commented in a header).
       
   109 // -----------------------------------------------------------------------------
       
   110 //
       
   111 void CPhoneHandlerEndCall::Process()
       
   112     {
       
   113     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerEndCall::Process()" );
       
   114     
       
   115     iCommandHandler->Chup( GetStatus() );    
       
   116     Activate();                         
       
   117     }
       
   118 
       
   119 // -----------------------------------------------------------------------------
       
   120 // CPhoneHandlerEndCall::Delete
       
   121 // (other items were commented in a header).
       
   122 // -----------------------------------------------------------------------------
       
   123 //
       
   124 void CPhoneHandlerEndCall::Delete()
       
   125     {
       
   126     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerEndCall::Delete()" );
       
   127         
       
   128     delete this;
       
   129     }
       
   130 
       
   131 // -----------------------------------------------------------------------------
       
   132 // CPhoneHandlerEndCall::RequestCompleted
       
   133 // Handler for completed asynchronous calls.
       
   134 // (other items were commented in a header).
       
   135 // -----------------------------------------------------------------------------
       
   136 //
       
   137 void CPhoneHandlerEndCall::RequestCompleted( const TInt aError )
       
   138     {
       
   139     COM_TRACE_2( "[PHONECMDHANDLER] CPhoneHandlerEndCall::RequestCompleted() aError=%d, iState=%d", aError, iState );
       
   140         
       
   141     switch( iState )
       
   142         {
       
   143         case EPhoneHandlerState1:
       
   144             {
       
   145             NextState();
       
   146             iControl.CommandInitiator().SendResponse( GetStatus(), 
       
   147                                                       iOperation,
       
   148                                                       aError );
       
   149             Activate();
       
   150             break;
       
   151             }
       
   152             
       
   153         case EPhoneHandlerState2:
       
   154             {
       
   155             IdleState();
       
   156             delete this;  
       
   157             break;
       
   158             }
       
   159             
       
   160         default:
       
   161             {
       
   162             COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerEndCall::RequestCompleted() Unspecified state" );
       
   163             break;
       
   164             }
       
   165         };
       
   166     }
       
   167     
       
   168 // ========================== OTHER EXPORTED FUNCTIONS =========================
       
   169 
       
   170 //  End of File