phonecmdhandler/phonecmdhnlr/src/PhoneHandlerActive.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:  Active object used to call asynchronous requests. 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include "phonehandleractive.h" 
       
    21 #include "phonehandlerobserver.h" 
       
    22 #include "phonehandlerdebug.h" 
       
    23 
       
    24 // EXTERNAL DATA STRUCTURES
       
    25 
       
    26 // EXTERNAL FUNCTION PROTOTYPES  
       
    27 
       
    28 // CONSTANTS
       
    29 
       
    30 // MACROS
       
    31 
       
    32 // LOCAL CONSTANTS AND MACROS
       
    33 
       
    34 // MODULE DATA STRUCTURES
       
    35 
       
    36 // LOCAL FUNCTION PROTOTYPES
       
    37 
       
    38 // FORWARD DECLARATIONS
       
    39 
       
    40 // ============================= LOCAL FUNCTIONS ===============================
       
    41 
       
    42 
       
    43 // ============================ MEMBER FUNCTIONS ===============================
       
    44  
       
    45 CPhoneHandlerActive* CPhoneHandlerActive::NewL( MPhoneHandlerObserver& aObserver )
       
    46     {
       
    47     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerActive::NewL() start" );
       
    48     CPhoneHandlerActive* self = new(ELeave) CPhoneHandlerActive( aObserver );
       
    49     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerActive::NewL() end" );
       
    50     return self;
       
    51     }
       
    52 
       
    53 CPhoneHandlerActive::~CPhoneHandlerActive()
       
    54     {
       
    55     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerActive::~CPhoneHandlerActive() start" );
       
    56     
       
    57     Cancel();
       
    58     
       
    59     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerActive::~CPhoneHandlerActive() end" );
       
    60     }
       
    61 
       
    62 CPhoneHandlerActive::CPhoneHandlerActive( MPhoneHandlerObserver& aObserver )
       
    63 :   CActive(CActive::EPriorityStandard),
       
    64     iObserver(aObserver)
       
    65     {
       
    66     CActiveScheduler::Add(this);
       
    67     }
       
    68 
       
    69 // -----------------------------------------------------------------------------
       
    70 // CPhoneHandlerActive::SetActive()
       
    71 // (other items were commented in a header).
       
    72 // -----------------------------------------------------------------------------
       
    73 //
       
    74 void CPhoneHandlerActive::SetActive()
       
    75     {
       
    76     CActive::SetActive();
       
    77     }
       
    78 
       
    79 // -----------------------------------------------------------------------------
       
    80 // CPhoneHandlerActive::RunL()
       
    81 // Informs caller of an asynchronous request that it has been completed.
       
    82 // (other items were commented in a header).
       
    83 // -----------------------------------------------------------------------------
       
    84 //
       
    85 void CPhoneHandlerActive::RunL()
       
    86     {
       
    87     COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerActive::RunL() iStatus.Int()=%d", iStatus.Int() );
       
    88     
       
    89     TInt error( iStatus.Int() );
       
    90     iStatus =  KErrNone;
       
    91     iObserver.RequestCompleted( error );
       
    92     }
       
    93 
       
    94 // -----------------------------------------------------------------------------
       
    95 // CPhoneHandlerActive::RunError
       
    96 // (other items were commented in a header).
       
    97 // -----------------------------------------------------------------------------
       
    98 //
       
    99 TInt CPhoneHandlerActive::RunError( TInt aError )
       
   100     {
       
   101     COM_TRACE_1( "[PHONECMDHANDLER] CPhoneHandlerActive::RunError(%d)", aError );
       
   102 
       
   103     // Avoid Panic in CActiveScheduler
       
   104     aError = KErrNone;
       
   105 
       
   106     COM_TRACE_( "[AccFW:PHONECMDHANDLER] CPhoneHandlerActive::RunError() - return KErrNone" );
       
   107             
       
   108     return aError; 
       
   109     }
       
   110 
       
   111 // -----------------------------------------------------------------------------
       
   112 // CPhoneHandlerActive::DoCancel
       
   113 // No need to cancel an asynchronous request.
       
   114 // (other items were commented in a header).
       
   115 // -----------------------------------------------------------------------------
       
   116 //
       
   117 void CPhoneHandlerActive::DoCancel()
       
   118     {
       
   119     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerActive::DoCancel() start" );
       
   120         
       
   121     COM_TRACE_( "[PHONECMDHANDLER] CPhoneHandlerActive::DoCancel() end" );
       
   122     }
       
   123 
       
   124 //
       
   125 // End of file