resourcemgmt/hwresourcesmgr/server/src/HWRMFmTxPowersaveTimer.cpp
changeset 0 4e1aa6a622a0
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 
       
    17 
       
    18 #include "HWRMtrace.h"
       
    19 #include "HWRMFmTxPowersaveTimer.h"
       
    20 
       
    21 
       
    22 // -----------------------------------------------------------------------------
       
    23 // C++ default constructor
       
    24 // -----------------------------------------------------------------------------
       
    25 //
       
    26 CHWRMFmTxPowerSaveTimer::CHWRMFmTxPowerSaveTimer( MHWRMFmTxPowerSaveTimerObserver& aTimerObserver ):
       
    27     CTimer( CActive::EPriorityStandard ),
       
    28     iTimerObserver( aTimerObserver )
       
    29     {
       
    30     COMPONENT_TRACE1( ( _L( "HWRM Server - CHWRMFmTxPowerSaveTimer::CHWRMFmTxPowerSaveTimer" ) ) );
       
    31     }
       
    32 
       
    33 // -----------------------------------------------------------------------------
       
    34 // CHWRMFmTxPowerSaveTimer::~CHWRMFmTxPowerSaveTimer
       
    35 // Destructor
       
    36 // -----------------------------------------------------------------------------
       
    37 //
       
    38 CHWRMFmTxPowerSaveTimer::~CHWRMFmTxPowerSaveTimer()
       
    39     {
       
    40     COMPONENT_TRACE1( ( _L( "HWRM Server - CHWRMFmTxPowerSaveTimer::~CHWRMFmTxPowerSaveTimer" ) ) );
       
    41     
       
    42     Cancel();
       
    43     
       
    44     COMPONENT_TRACE1( ( _L( "HWRM Server - CHWRMFmTxPowerSaveTimer::~CHWRMFmTxPowerSaveTimer - return" ) ) );
       
    45     }
       
    46 
       
    47 // -----------------------------------------------------------------------------
       
    48 // PowerSaveTimer::NewL
       
    49 // Two-phased constructor.
       
    50 // -----------------------------------------------------------------------------
       
    51 //	
       
    52 CHWRMFmTxPowerSaveTimer* CHWRMFmTxPowerSaveTimer::NewL( MHWRMFmTxPowerSaveTimerObserver& aTimerObserver )
       
    53     {
       
    54     COMPONENT_TRACE1( ( _L( "HWRM Server - CHWRMFmTxPowerSaveTimer::NewL" ) ) );
       
    55    
       
    56     CHWRMFmTxPowerSaveTimer* self = new ( ELeave ) CHWRMFmTxPowerSaveTimer( aTimerObserver );
       
    57     CleanupStack::PushL( self );
       
    58     self->ConstructL();
       
    59     CleanupStack::Pop( self );
       
    60     
       
    61     COMPONENT_TRACE2( _L( "HWRM Server - CHWRMFmTxPowerSaveTimer::NewL - return 0x%x" ), self );
       
    62     return self;
       
    63     }
       
    64 
       
    65 // -----------------------------------------------------------------------------
       
    66 // CHWRMFmTxPowerSaveTimer::ConstructL
       
    67 // Two-phased constructor.
       
    68 // -----------------------------------------------------------------------------
       
    69 //
       
    70 void CHWRMFmTxPowerSaveTimer::ConstructL()
       
    71     {
       
    72     COMPONENT_TRACE1( _L( "HWRM Server - CHWRMFmTxPowerSaveTimer::ConstructL" ) );
       
    73 
       
    74     CTimer::ConstructL();
       
    75     CActiveScheduler::Add( this );
       
    76     
       
    77     COMPONENT_TRACE1( _L( "HWRM Server - CHWRMFmTxPowerSaveTimer::ConstructL - return" ) );
       
    78     }
       
    79 	
       
    80 // -----------------------------------------------------------------------------
       
    81 // CHWRMFmTxPowerSaveTimer::Start
       
    82 // Starts timer, timeout value given as a parameter.
       
    83 // -----------------------------------------------------------------------------
       
    84 //
       
    85 void CHWRMFmTxPowerSaveTimer::Start( const TTimeIntervalMicroSeconds32 aTimeout )
       
    86     {
       
    87     COMPONENT_TRACE1( _L( "HWRM Server - CHWRMFmTxPowerSaveTimer::Start" ) );
       
    88     
       
    89     Cancel();
       
    90     CTimer::After( aTimeout );
       
    91     
       
    92     COMPONENT_TRACE1( _L( "HWRM Server - CHWRMFmTxPowerSaveTimer::Start - return" ) );
       
    93     }
       
    94 
       
    95 // -----------------------------------------------------------------------------
       
    96 // CHWRMFmTxPowerSaveTimer::Stop
       
    97 // Stops timer
       
    98 // -----------------------------------------------------------------------------
       
    99 void CHWRMFmTxPowerSaveTimer::Stop()	
       
   100     {
       
   101     COMPONENT_TRACE1( _L( "HWRM Server - CHWRMFmTxPowerSaveTimer::Stop" ) );
       
   102     
       
   103     Cancel();
       
   104     
       
   105     COMPONENT_TRACE1( _L( "HWRM Server - CHWRMFmTxPowerSaveTimer::Stop - return" ) );
       
   106     }
       
   107 
       
   108 // -----------------------------------------------------------------------------
       
   109 // CHWRMFmTxPowerSaveTimer::RunL
       
   110 // Handles an active object's request completion event.
       
   111 // -----------------------------------------------------------------------------
       
   112 //
       
   113 void CHWRMFmTxPowerSaveTimer::RunL()
       
   114     {
       
   115     COMPONENT_TRACE1( _L( "HWRM Server - CHWRMFmTxPowerSaveTimer::RunL" ) );
       
   116 
       
   117     if ( iStatus == KErrNone )
       
   118         {
       
   119         iTimerObserver.TimerExpired();
       
   120         }
       
   121         
       
   122     COMPONENT_TRACE1( _L( "HWRM Server - CHWRMFmTxPowerSaveTimer::RunL - return" ) );
       
   123     }
       
   124 
       
   125 // End of file