accessoryservices/accessoryserver/src/Server/AccSrvProcessCommandTimer.cpp
changeset 0 4e1aa6a622a0
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     1 /*
       
     2 * Copyright (c) 2002-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:  Timer for ProcessCommand handling
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include "AccSrvProcessCommandObserver.h"
       
    21 #include "AccSrvProcessCommandTimer.h"
       
    22 #include "AccSrvConnectionController.h"
       
    23 #include "AccSrvServerModel.h"
       
    24 
       
    25 // EXTERNAL DATA STRUCTURES
       
    26 
       
    27 // EXTERNAL FUNCTION PROTOTYPES
       
    28 
       
    29 // CONSTANTS
       
    30 
       
    31 // MACROS
       
    32 
       
    33 // LOCAL CONSTANTS AND MACROS
       
    34 
       
    35 // MODULE DATA STRUCTURES
       
    36 
       
    37 // LOCAL FUNCTION PROTOTYPES
       
    38 
       
    39 // FORWARD DECLARATIONS
       
    40 
       
    41 // ============================= LOCAL FUNCTIONS ===============================
       
    42 
       
    43 // ============================ MEMBER FUNCTIONS ===============================
       
    44 
       
    45 // -----------------------------------------------------------------------------
       
    46 // CAccSrvProcessCommandTimer::CAccSrvProcessCommandTimer
       
    47 // C++ default constructor can NOT contain any code, that
       
    48 // might leave.
       
    49 // -----------------------------------------------------------------------------
       
    50 //
       
    51 CAccSrvProcessCommandTimer::CAccSrvProcessCommandTimer(
       
    52     MAccSrvProcessCommandObserver* aProcessCommandObserver,
       
    53     TInt aTime ) : 
       
    54     CTimer( CActive::EPriorityStandard ),
       
    55     iTime( aTime ),
       
    56     iProcessCommandObserver( aProcessCommandObserver )
       
    57     {
       
    58     COM_TRACE_( "[AccFW:AccServer] CAccSrvProcessCommandTimer::CAccSrvProcessCommandTimer()" );
       
    59 
       
    60     COM_TRACE_( "[AccFW:AccServer] CAccSrvProcessCommandTimer::CAccSrvProcessCommandTimer - return void" );
       
    61     }
       
    62 
       
    63 // -----------------------------------------------------------------------------
       
    64 // CAccSrvProcessCommandTimer::ConstructL
       
    65 // Symbian 2nd phase constructor can leave.
       
    66 // -----------------------------------------------------------------------------
       
    67 //
       
    68 void CAccSrvProcessCommandTimer::ConstructL()
       
    69     {
       
    70     COM_TRACE_( "[AccFW:AccServer] CAccSrvProcessCommandTimer::ConstructL()" );
       
    71 
       
    72     CTimer::ConstructL();
       
    73     CActiveScheduler::Add( this );
       
    74 
       
    75     COM_TRACE_( "[AccFW:AccServer] CAccSrvProcessCommandTimer::ConstructL - return void" );
       
    76     }
       
    77     
       
    78 // -----------------------------------------------------------------------------
       
    79 // CAccSrvProcessCommandTimer::NewL
       
    80 // Two-phased constructor.
       
    81 // -----------------------------------------------------------------------------
       
    82 //
       
    83 CAccSrvProcessCommandTimer* CAccSrvProcessCommandTimer::NewL(
       
    84                             MAccSrvProcessCommandObserver* aProcessCommandObserver,
       
    85                             TInt aTime )
       
    86     {
       
    87     COM_TRACE_( "[AccFW:AccServer] CAccSrvProcessCommandTimer::NewL()" );
       
    88 
       
    89     CAccSrvProcessCommandTimer* self = new ( ELeave ) CAccSrvProcessCommandTimer(
       
    90                                                         aProcessCommandObserver,
       
    91                                                         aTime );
       
    92     CleanupStack::PushL( self );
       
    93     self->ConstructL();
       
    94     CleanupStack::Pop( self );
       
    95 
       
    96     COM_TRACE_1( "[AccFW:AccServer] CAccSrvProcessCommandTimer::NewL - return 0x%x", self );
       
    97 
       
    98     return self;
       
    99     }
       
   100 
       
   101 // Destructor
       
   102 CAccSrvProcessCommandTimer::~CAccSrvProcessCommandTimer()
       
   103     {
       
   104     COM_TRACE_( "[AccFW:AccServer] CAccSrvProcessCommandTimer::~CAccSrvProcessCommandTimer()" );
       
   105 
       
   106     Cancel();
       
   107 
       
   108     COM_TRACE_( "[AccFW:AccServer] CAccSrvProcessCommandTimer::~CAccSrvProcessCommandTimer" );
       
   109     }
       
   110 
       
   111 // -----------------------------------------------------------------------------
       
   112 // CAccSrvProcessCommandTimer::RunL
       
   113 // 
       
   114 // (other items were commented in a header).
       
   115 // -----------------------------------------------------------------------------
       
   116 //
       
   117 void CAccSrvProcessCommandTimer::RunL()
       
   118     {
       
   119     COM_TRACE_( "[AccFW:AccServer] CAccSrvProcessCommandTimer::RunL()" );
       
   120     
       
   121     if ( iTime == KInitCmdTimeOut )
       
   122         {
       
   123         iProcessCommandObserver->CompleteProcessCommandInitL();
       
   124         }
       
   125 
       
   126     else
       
   127         {
       
   128         iProcessCommandObserver->ProcessCommandTimeOutCompleteL();
       
   129         }
       
   130 
       
   131     COM_TRACE_( "[AccFW:AccServer] CAccSrvProcessCommandTimer::RunL - return void" );
       
   132     }
       
   133 
       
   134 // -----------------------------------------------------------------------------
       
   135 // CAccSrvProcessCommandTimer::RunError
       
   136 // Returns KErrNone
       
   137 // (other items were commented in a header).
       
   138 // -----------------------------------------------------------------------------
       
   139 //
       
   140 TInt CAccSrvProcessCommandTimer::RunError( TInt aError )
       
   141     {
       
   142     COM_TRACE_1( "[AccFW:AsyProxy] CAccSrvProcessCommandTimer::RunError(%d)", aError );
       
   143 
       
   144      // Avoid Panic in CActiveScheduler
       
   145     aError = KErrNone;
       
   146 
       
   147     COM_TRACE_( "[AccFW:AsyProxy] CAccSrvProcessCommandTimer::RunError - return KErrNone" );
       
   148 
       
   149     return aError;
       
   150     }
       
   151 
       
   152 // -----------------------------------------------------------------------------
       
   153 // CAccSrvProcessCommandTimer::StartTimer
       
   154 // 
       
   155 // (other items were commented in a header).
       
   156 // -----------------------------------------------------------------------------
       
   157 //
       
   158 void CAccSrvProcessCommandTimer::StartTimer()
       
   159     {
       
   160     COM_TRACE_( "[AccFW:AccServer] CAccSrvProcessCommandTimer::StartTimer()" );
       
   161 
       
   162     After( ( TTimeIntervalMicroSeconds32 ) iTime );
       
   163 
       
   164     COM_TRACE_( "[AccFW:AccServer] CAccSrvProcessCommandTimer::StartTimer - return void" );
       
   165     }
       
   166 
       
   167 // ========================== OTHER EXPORTED FUNCTIONS =========================
       
   168 
       
   169 // End of File