accessoryservices/accessoryserver/src/ChargerContext/AccSrvResetInactivityTimeTimer.cpp
changeset 0 4e1aa6a622a0
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     1 /*
       
     2 * Copyright (c) 2008-2008 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:  Implementation of a timer interface.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #include "AccSrvResetInactivityTimeTimer.h"
       
    21 #include "acc_debug.h"
       
    22 
       
    23 
       
    24 // ======== LOCAL FUNCTIONS ========
       
    25 
       
    26 
       
    27 // ======== MEMBER FUNCTIONS ========
       
    28 
       
    29 
       
    30 // -----------------------------------------------------------------------------
       
    31 // CAccSrvResetInactivityTimeTimer::NewL
       
    32 // Two-phased constructor.
       
    33 // -----------------------------------------------------------------------------
       
    34 //
       
    35 CAccSrvResetInactivityTimeTimer* CAccSrvResetInactivityTimeTimer::NewL(
       
    36         MResetActivityTimeTimerObserver* aResetInactivityTimeTimerObserver )
       
    37     {
       
    38     COM_TRACE_( "[AccFW:AccServer] CAccSrvResetInactivityTimeTimer::NewL()" );
       
    39 
       
    40     CAccSrvResetInactivityTimeTimer* self = new ( ELeave ) CAccSrvResetInactivityTimeTimer(
       
    41             aResetInactivityTimeTimerObserver );
       
    42     CleanupStack::PushL( self );
       
    43     self->ConstructL();
       
    44     CleanupStack::Pop( self );
       
    45 
       
    46     COM_TRACE_1( "[AccFW:AccServer] CAccSrvResetInactivityTimeTimer::NewL - return %p", self );
       
    47 
       
    48     return self;
       
    49     }
       
    50 
       
    51 
       
    52 // Destructor
       
    53 CAccSrvResetInactivityTimeTimer::~CAccSrvResetInactivityTimeTimer()
       
    54     {
       
    55     COM_TRACE_( "[AccFW:AccServer] CAccSrvResetInactivityTimeTimer::~CAccSrvResetInactivityTimeTimer()" );
       
    56 
       
    57     Cancel();
       
    58 
       
    59     COM_TRACE_( "[AccFW:AccServer] CAccSrvResetInactivityTimeTimer::~CAccSrvResetInactivityTimeTimer- return" );
       
    60     }
       
    61 
       
    62 // -----------------------------------------------------------------------------
       
    63 // CAccSrvResetInactivityTimeTimer::StartTimer
       
    64 // .
       
    65 // -----------------------------------------------------------------------------
       
    66 //
       
    67 void CAccSrvResetInactivityTimeTimer::StartTimer(
       
    68         TInt aTime )
       
    69     {
       
    70     COM_TRACE_( "[AccFW:AccServer] CAccSrvResetInactivityTimeTimer::StartTimer()" );
       
    71 
       
    72     iTime = aTime;
       
    73     After( ( TTimeIntervalMicroSeconds32 ) iTime );
       
    74 
       
    75     COM_TRACE_( "[AccFW:AccServer] CAccSrvResetInactivityTimeTimer::StartTimer - return void" );
       
    76 
       
    77     return;
       
    78     }
       
    79 
       
    80 // -----------------------------------------------------------------------------
       
    81 // CAccSrvResetInactivityTimeTimer::RunL
       
    82 // 
       
    83 // (other items were commented in a header).
       
    84 // -----------------------------------------------------------------------------
       
    85 //
       
    86 void CAccSrvResetInactivityTimeTimer::RunL()
       
    87     {
       
    88     COM_TRACE_( "[AccFW:AccServer] CAccSrvResetInactivityTimeTimer::RunL()" );
       
    89     
       
    90     iResetInactivityTimeTimerObserver->InactivityTimerTimeout();
       
    91 
       
    92     COM_TRACE_( "[AccFW:AccServer] CAccSrvResetInactivityTimeTimer::RunL - return void" );
       
    93     }
       
    94 
       
    95 
       
    96 // -----------------------------------------------------------------------------
       
    97 // CAccSrvResetInactivityTimeTimer::RunError
       
    98 // Returns KErrNone
       
    99 // (other items were commented in a header).
       
   100 // -----------------------------------------------------------------------------
       
   101 //
       
   102 TInt CAccSrvResetInactivityTimeTimer::RunError( TInt aError )
       
   103     {
       
   104     COM_TRACE_1( "[AccFW:AsyProxy] CAccSrvResetInactivityTimeTimer::RunError(%d)", aError );
       
   105 
       
   106      // Avoid Panic in CActiveScheduler
       
   107     aError = KErrNone;
       
   108 
       
   109     COM_TRACE_( "[AccFW:AsyProxy] CAccSrvResetInactivityTimeTimer::RunError - return KErrNone" );
       
   110 
       
   111     return aError;
       
   112     }
       
   113 
       
   114 
       
   115 // -----------------------------------------------------------------------------
       
   116 // CAccSrvResetInactivityTimeTimer::CAccSrvResetInactivityTimeTimer
       
   117 // C++ default constructor can NOT contain any code, that
       
   118 // might leave.
       
   119 // -----------------------------------------------------------------------------
       
   120 //
       
   121 CAccSrvResetInactivityTimeTimer::CAccSrvResetInactivityTimeTimer(
       
   122         MResetActivityTimeTimerObserver* aResetInactivityTimeTimerObserver ) : 
       
   123     CTimer( CActive::EPriorityStandard ),
       
   124     iTime( NULL ),
       
   125     iResetInactivityTimeTimerObserver( aResetInactivityTimeTimerObserver )
       
   126     {
       
   127     COM_TRACE_( "[AccFW:AccServer] CAccSrvResetInactivityTimeTimer::CAccSrvResetInactivityTimeTimer()" );
       
   128 
       
   129     COM_TRACE_( "[AccFW:AccServer] CAccSrvResetInactivityTimeTimer::CAccSrvResetInactivityTimeTimer - return" );
       
   130     }
       
   131 
       
   132 // -----------------------------------------------------------------------------
       
   133 // CAccSrvProcessCommandTimer::ConstructL
       
   134 // Symbian 2nd phase constructor can leave.
       
   135 // -----------------------------------------------------------------------------
       
   136 //
       
   137 void CAccSrvResetInactivityTimeTimer::ConstructL()
       
   138     {
       
   139     COM_TRACE_( "[AccFW:AccServer] CAccSrvResetInactivityTimeTimer::ConstructL()" );
       
   140 
       
   141     CTimer::ConstructL();
       
   142     CActiveScheduler::Add( this );
       
   143 
       
   144     COM_TRACE_( "[AccFW:AccServer] CAccSrvResetInactivityTimeTimer::ConstructL - return void" );
       
   145     }
       
   146 
       
   147 
       
   148 
       
   149 // ======== GLOBAL FUNCTIONS ========
       
   150