|
1 // Copyright (c) 2008-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 // timer header file |
|
15 // |
|
16 // |
|
17 |
|
18 |
|
19 #ifndef __TIMER__H |
|
20 #define __TIMER__H |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <time.h> |
|
24 #include <signal.h> |
|
25 |
|
26 #define MAXTIMERLIMIT 512 |
|
27 #define DELAYTIMER_MAX 32 |
|
28 |
|
29 class CTimerReqHandler; |
|
30 class CRtTimer; |
|
31 class CTimerServer; |
|
32 NONSHARABLE_CLASS(CLibRtTimer): public CTimer |
|
33 { |
|
34 public: |
|
35 CLibRtTimer():CTimer(EPriorityHigh) |
|
36 { |
|
37 } |
|
38 void ConstructL() |
|
39 { |
|
40 CTimer::ConstructL(); |
|
41 } |
|
42 void At(TTime aSetTime) |
|
43 { |
|
44 CTimer::At(aSetTime); |
|
45 } |
|
46 inline void Set(CRtTimer* CRtPtr) |
|
47 { |
|
48 ptr = CRtPtr; |
|
49 } |
|
50 inline CRtTimer* GetRtPtr() |
|
51 { |
|
52 return ptr; |
|
53 } |
|
54 void AddToAS(); |
|
55 private: |
|
56 void RunL(); |
|
57 CRtTimer* ptr; |
|
58 }; |
|
59 |
|
60 class CRtTimer:public CBase |
|
61 { |
|
62 public: |
|
63 friend class CTimerReqHandler; |
|
64 friend class CTimerServer; |
|
65 friend class CLibRtTimer; |
|
66 static CRtTimer* New(struct sigevent *aSig); |
|
67 TInt SetTime(TInt aFlag, const struct itimerspec *aIpTime, |
|
68 struct itimerspec *aOpTime); |
|
69 TInt Time(struct itimerspec *aTime) const; |
|
70 TInt OverrunCount(TInt& aOverrunCount) const; |
|
71 virtual ~CRtTimer(); |
|
72 protected: |
|
73 |
|
74 CRtTimer(struct sigevent *aSig); |
|
75 private: |
|
76 CLibRtTimer iTimer; |
|
77 |
|
78 TInt iTimerId; |
|
79 TBool iIsArmed; |
|
80 TBool iIsTimerReset; |
|
81 |
|
82 struct sigevent iSigEvent; |
|
83 struct itimerspec iStartTime; |
|
84 struct timespec iEndTime; |
|
85 }; |
|
86 #endif //__TIMER__H |
|
87 |