resourcemgmt/hwresourcesmgr/test/utils/endstatetimer.cpp
changeset 0 4e1aa6a622a0
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     1 // Copyright (c) 2007-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 #include "endstatetimer.h"
       
    17 
       
    18 CEndStateTimer* CEndStateTimer::NewL(MTimerExpired& aObserver)
       
    19     {
       
    20     CEndStateTimer* self = new( ELeave )CEndStateTimer(aObserver);
       
    21     
       
    22     CleanupStack::PushL( self );
       
    23     self->ConstructL();
       
    24     CleanupStack::Pop( self );
       
    25 
       
    26     return self;
       
    27     }
       
    28 
       
    29 CEndStateTimer::~CEndStateTimer()    
       
    30     {
       
    31     Cancel();
       
    32     }
       
    33     
       
    34 CEndStateTimer::CEndStateTimer(MTimerExpired& aObserver)
       
    35     : CTimer(EPriorityStandard), iTimerObserver(aObserver)  
       
    36     {
       
    37     }
       
    38 
       
    39 void CEndStateTimer::ConstructL()
       
    40     {
       
    41     CTimer::ConstructL();
       
    42     CActiveScheduler::Add(this);
       
    43     }
       
    44     
       
    45 void CEndStateTimer::Start(TReal aTimeOutSecs)
       
    46 	{
       
    47 	After(aTimeOutSecs*1000000);
       
    48 	}
       
    49 	
       
    50 void CEndStateTimer::DoCancel()
       
    51 	{
       
    52 	CTimer::DoCancel();
       
    53 	}
       
    54 
       
    55     
       
    56 void CEndStateTimer::RunL()
       
    57     {
       
    58     iTimerObserver.EndStateTimerExpired(iStatus.Int());	
       
    59     }