1 /* |
|
2 * Copyright (c) 2009 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 the License "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: |
|
15 * |
|
16 */ |
|
17 #ifndef __EPOC32TIMER_H |
|
18 #define __EPOC32TIMER_H |
|
19 |
|
20 #include <e32base.h> |
|
21 |
|
22 class CEpoc32Timer : public CTimer |
|
23 { |
|
24 public: |
|
25 static CEpoc32Timer* New( const TUint32 aPeriodInMicroseconds, |
|
26 const TBool aRepeatingTimer, |
|
27 TCallBack& aCallBackFunc ); |
|
28 ~CEpoc32Timer(); |
|
29 |
|
30 TUint32 MicrosecondsLeftUntilNextTick() const; |
|
31 void Stop(); |
|
32 void Resume(); |
|
33 |
|
34 protected: |
|
35 CEpoc32Timer( const TUint32 aPeriodInMicroseconds, |
|
36 const TBool aRepeatingTimer, |
|
37 TCallBack& aCallBackFunc ); |
|
38 void ConstructL(); |
|
39 void RunL(); |
|
40 void Start(); |
|
41 |
|
42 virtual void After( TUint32 aPeriodInMicroseconds ); |
|
43 |
|
44 private: |
|
45 TTime iResumeTime; |
|
46 TCallBack iCallBackFunc; |
|
47 TUint32 iTimeOutInMicroseconds; |
|
48 // How many microseconds was left until next tick when we were stopped |
|
49 TUint32 iTimeLeftInMicroseconds; |
|
50 // If the timer period is > MaxTTimeInMicroseconds32, then the extra |
|
51 // milliseconds are stored here. |
|
52 TUint32 iPeriodInMicrosecondsExceedingRangeOfTInt; |
|
53 TBool iIsRepeating; |
|
54 }; |
|
55 |
|
56 #endif |
|