|
1 /* |
|
2 * Copyright (c) 2010 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 "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 * Description: |
|
13 * This class contains definition of CFlexTimerEngine. |
|
14 * |
|
15 */ |
|
16 |
|
17 // Protection against nested includes |
|
18 #ifndef FLEXTIMERENGINE_H |
|
19 #define FLEXTIMERENGINE_H |
|
20 |
|
21 // System includes |
|
22 #include <e32base.h> |
|
23 |
|
24 // User includes |
|
25 #include "mflextimerservice.h" |
|
26 #include "mflextimerwakeuptimercb.h" |
|
27 |
|
28 // Forward declarations |
|
29 class MFlexTimerServiceCB; |
|
30 class CFlexTimerContainer; |
|
31 class CFlexTimerWakeUpTimer; |
|
32 |
|
33 // Class declaration |
|
34 /** |
|
35 * Flexible timer engine that acts as service point towards session. |
|
36 * Handles timer wakeups and system time changes. |
|
37 */ |
|
38 class CFlexTimerEngine : public CBase, |
|
39 public MFlexTimerService, |
|
40 public MFlexTimerWakeUpTimerCB |
|
41 { |
|
42 public: |
|
43 |
|
44 /** |
|
45 * Constructs new timer engine. |
|
46 */ |
|
47 IMPORT_C static CFlexTimerEngine* NewL(); |
|
48 |
|
49 /** |
|
50 * Destructs timer item. |
|
51 */ |
|
52 virtual ~CFlexTimerEngine(); |
|
53 |
|
54 public: |
|
55 /** |
|
56 * Inherited from MFlexTimerService |
|
57 */ |
|
58 |
|
59 /** |
|
60 * Implementation of inherited pure virtual function |
|
61 * |
|
62 * @see MFlexTimerService::AddTimer |
|
63 */ |
|
64 IMPORT_C TInt AddTimer( |
|
65 const TTimeIntervalMicroSeconds& aWinStartInterval, |
|
66 const TTimeIntervalMicroSeconds& aWinEndInterval, |
|
67 TBool aCancelAtSystemTimeChange, |
|
68 const MFlexTimerServiceCB* aFlexTimerServiceCB ); |
|
69 |
|
70 /** |
|
71 * Implementation of inherited pure virtual function |
|
72 * |
|
73 * @see MFlexTimerService::CancelTimer |
|
74 */ |
|
75 IMPORT_C TInt CancelTimer( |
|
76 const MFlexTimerServiceCB* aFlexTimerServiceCB ); |
|
77 |
|
78 /** |
|
79 * Inherited from MFlexTimerWakeUpTimerCB |
|
80 */ |
|
81 |
|
82 /** |
|
83 * Implementation of inherited pure virtual function |
|
84 * |
|
85 * @see MFlexTimerWakeUpTimerCB::WakeUp |
|
86 */ |
|
87 void WakeUp(); |
|
88 |
|
89 /** |
|
90 * Implementation of inherited pure virtual function |
|
91 * |
|
92 * @see MFlexTimerWakeUpTimerCB::SystemTimeChanged |
|
93 */ |
|
94 void SystemTimeChanged(); |
|
95 |
|
96 private: |
|
97 /** |
|
98 * Private constructor. |
|
99 * |
|
100 */ |
|
101 CFlexTimerEngine(); |
|
102 |
|
103 /** |
|
104 * Private 2nd pahse constructor. |
|
105 * |
|
106 */ |
|
107 void ConstructL(); |
|
108 |
|
109 /** |
|
110 * Finds out what is the next time we have to wake up to fire some |
|
111 * FlexTimers and starts CTimer accordingly. |
|
112 * |
|
113 */ |
|
114 void StartTimer(); |
|
115 |
|
116 private: |
|
117 // Data |
|
118 /** |
|
119 * Container for all timers. Lives and dies with engine. |
|
120 */ |
|
121 CFlexTimerContainer* iFlexTimerContainer; |
|
122 |
|
123 /** |
|
124 * Wake up timer to watch flextimer firings and system time change |
|
125 */ |
|
126 CFlexTimerWakeUpTimer* iWakeUpTimer; |
|
127 |
|
128 }; |
|
129 |
|
130 #endif //FLEXTIMERENGINE_H |