serialserver/packetloopbackcsy/inc/LoopbackTimer.h
changeset 0 dfb7c4ff071f
equal deleted inserted replaced
-1:000000000000 0:dfb7c4ff071f
       
     1 // Copyright (c) 2004-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 // Header for timer class
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file
       
    20 */
       
    21 
       
    22 #ifndef __LOOPBACKTIMER_H__
       
    23 #define __LOOPBACKTIMER_H__
       
    24 
       
    25 #include <e32base.h>
       
    26 
       
    27 class MTimerCallBack;
       
    28 NONSHARABLE_CLASS(CLoopbackTimer) : public CActive
       
    29 	{
       
    30 public:
       
    31 	static CLoopbackTimer* NewL(TInt aDuration, MTimerCallBack* aCallback);
       
    32 	~CLoopbackTimer();
       
    33 	void Start();
       
    34 	TBool Running() const;
       
    35 
       
    36 private:
       
    37 	CLoopbackTimer(TInt aDuration, MTimerCallBack* aCallback);
       
    38 	void DoCancel();
       
    39 	void RunL();
       
    40 
       
    41 private:
       
    42     /** Timer used to control when RunL is called */
       
    43 	RTimer iTimer;
       
    44     /** Timer's duration */
       
    45 	TInt iDuration;
       
    46     /** Class with implementation of MTimerCallBack::TimerCallBack that is called when the timer expires */
       
    47 	MTimerCallBack* iCallback;
       
    48     /** True when the timer is running */
       
    49 	TBool iRunning;
       
    50 	};
       
    51 
       
    52 class MTimerCallBack
       
    53 	{
       
    54 public:
       
    55 	virtual void TimerCallBack() = 0;
       
    56 	};
       
    57 
       
    58 #endif // __LOOPBACKTIMER_H__
       
    59