1 /* |
|
2 * Copyright (c) 2003 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 * Contributors: |
|
13 * |
|
14 * Description: Screensaver engine class definition. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef C_SCREENSAVERENGINE_H |
|
21 #define C_SCREENSAVERENGINE_H |
|
22 |
|
23 #include <e32base.h> |
|
24 #include <AknCapServerClient.h> |
|
25 |
|
26 #include "screensaverindicator.h" |
|
27 #include "screensaverindicatorarray.h" |
|
28 #include "screensaverplugin.h" |
|
29 |
|
30 //delay before wserv timer is turned off |
|
31 #define KWSERVHEARTBEATTIMEOUT 15 |
|
32 |
|
33 // FORWARD DECLARATIONS |
|
34 class CUserActivityManager; |
|
35 class CScreensaverSharedDataI; |
|
36 class CScreensaverSharedDataMonitor; |
|
37 class CScreensaverAppUi; |
|
38 class CScreensaverView; |
|
39 class CPowerSaveDisplayMode; |
|
40 |
|
41 /** |
|
42 * CScreensaverModel |
|
43 */ |
|
44 class CScreensaverEngine : public CBase |
|
45 { |
|
46 public: |
|
47 |
|
48 /** |
|
49 * Two-phased constructor |
|
50 * |
|
51 * @param aAppUi the AppUi of the application |
|
52 */ |
|
53 static CScreensaverEngine* NewL(); |
|
54 |
|
55 /** |
|
56 * Destructor |
|
57 */ |
|
58 ~CScreensaverEngine(); |
|
59 |
|
60 /** |
|
61 * Return the pointer to the CScreensaverSharedDataI |
|
62 * |
|
63 * @return CScreensaverSharedDataI* |
|
64 */ |
|
65 CScreensaverSharedDataI* SharedDataInterface() const; |
|
66 |
|
67 /** |
|
68 * Reset the time during which the user did not do anything |
|
69 */ |
|
70 void ResetInactivityTimeout(); |
|
71 |
|
72 /** |
|
73 * Returns if the screensaver is on or not |
|
74 */ |
|
75 TBool ScreenSaverIsOn() const; |
|
76 |
|
77 /** |
|
78 * Returns if the screensaver is previewing or not |
|
79 */ |
|
80 TBool ScreenSaverIsPreviewing() const; |
|
81 |
|
82 /** |
|
83 * Starts screensaver |
|
84 */ |
|
85 void StartScreenSaver(); |
|
86 |
|
87 /** |
|
88 * Stops the screensaver |
|
89 */ |
|
90 void StopScreenSaver(); |
|
91 |
|
92 /** |
|
93 * Starts the preview model |
|
94 */ |
|
95 void StartPreviewModeL(); |
|
96 |
|
97 /* |
|
98 * Display the Object(); |
|
99 */ |
|
100 void DisplayObject(); |
|
101 |
|
102 /** |
|
103 * Start the suspend timer |
|
104 */ |
|
105 void StartSuspendTimer( TInt aSec ); |
|
106 |
|
107 /** |
|
108 * Returns the indicator array |
|
109 */ |
|
110 CScreensaverIndicatorArray& IndicatorArray() const; |
|
111 |
|
112 /** |
|
113 * Returns the color model |
|
114 */ |
|
115 const TScreensaverColorModel& GetColorModel( ) const; |
|
116 |
|
117 /** |
|
118 * Adds the partial model |
|
119 * |
|
120 * @param aBpp the bits per pixels of the partial model |
|
121 * @param aType the type of the partial type |
|
122 */ |
|
123 void AddPartialModeLevel( TInt aBpp, TScreensaverPartialModeType aType ); |
|
124 |
|
125 /** |
|
126 * Updates the indicator attributes. |
|
127 */ |
|
128 void UpdateIndicatorAttributes( ); |
|
129 |
|
130 private: |
|
131 |
|
132 /** |
|
133 * C++ default constructor |
|
134 * |
|
135 * @param aAppUi the AppUi of the application |
|
136 */ |
|
137 CScreensaverEngine(); |
|
138 |
|
139 private: |
|
140 |
|
141 /** |
|
142 * Two-phased constructor |
|
143 */ |
|
144 void ConstructL(); |
|
145 |
|
146 /** |
|
147 * Constructs the shared data member |
|
148 */ |
|
149 void EnableSharedDataAndMonitorL(); |
|
150 |
|
151 /** |
|
152 * Destruct the shared data member |
|
153 */ |
|
154 void DisableSharedDataAndMonitor(); |
|
155 |
|
156 /** |
|
157 * Starts to monitor the user activity |
|
158 */ |
|
159 void StartActivityMonitoringL(); |
|
160 |
|
161 /** |
|
162 * Stops monitoring the user activity |
|
163 */ |
|
164 void StopActivityMonitoring( CUserActivityManager*& aActivityManager ); |
|
165 |
|
166 /** |
|
167 * Gets the color model from the resource |
|
168 */ |
|
169 void SetupColorModelL(); |
|
170 |
|
171 /** |
|
172 * Start the preview timer |
|
173 */ |
|
174 void StartPreviewTimer(); |
|
175 |
|
176 /** |
|
177 * Kill the timer |
|
178 * |
|
179 * @param aTimer the timer you want stop |
|
180 */ |
|
181 void KillTimer( CPeriodic*& aTimer ); |
|
182 |
|
183 |
|
184 /** |
|
185 * Callback fuction. Called when the preivew tiemr time out |
|
186 */ |
|
187 static TInt HandlePreviewTimerExpiry( TAny* aPtr ); |
|
188 |
|
189 /** |
|
190 * Called when the time that the user did activity is out. |
|
191 */ |
|
192 static TInt HandleActiveEventL(TAny* aPtr); |
|
193 |
|
194 /** |
|
195 * Called when the time that the user did no activity is out. |
|
196 */ |
|
197 static TInt HandleInactiveEventL(TAny* aPtr); |
|
198 |
|
199 /** |
|
200 * Called when the time that the user did activity is out. |
|
201 */ |
|
202 static TInt HandleActiveEventShortL(TAny* aPtr); |
|
203 |
|
204 /** |
|
205 * Called when the time that the user did no activity is out. |
|
206 */ |
|
207 static TInt HandleInactiveEventShortL(TAny* aPtr); |
|
208 |
|
209 /** |
|
210 * Callback fuction. Called when the suspension tiemr time out |
|
211 */ |
|
212 static TInt HandleSuspendTimerExpiry( TAny* aPtr ); |
|
213 |
|
214 |
|
215 /** |
|
216 * Returns the CScreensaverView |
|
217 */ |
|
218 CScreensaverView* View() const; |
|
219 |
|
220 /** |
|
221 * Returns the timeout. |
|
222 */ |
|
223 TInt Timeout(); |
|
224 |
|
225 /** |
|
226 * Returns the display flag. |
|
227 */ |
|
228 TInt DisplayFlag(); |
|
229 |
|
230 |
|
231 private: |
|
232 |
|
233 /** |
|
234 * The flag if append alert type indicator |
|
235 */ |
|
236 TBool iShowExtendedProfileInd; |
|
237 |
|
238 /** |
|
239 * The flag if the screensaver is on or not |
|
240 */ |
|
241 TBool iScreenSaverIsOn; |
|
242 |
|
243 /** |
|
244 * The flag if the screensaver is previewing or not |
|
245 */ |
|
246 TBool iScreenSaverIsPreviewing; |
|
247 |
|
248 /** |
|
249 * The trigger for screensaver activation |
|
250 */ |
|
251 CUserActivityManager* iActivityManagerScreensaver; |
|
252 |
|
253 |
|
254 /** |
|
255 * The pointer to CScreensaverSharedDataI |
|
256 * |
|
257 * Owned |
|
258 */ |
|
259 CScreensaverSharedDataI* iSharedDataI; |
|
260 |
|
261 /* |
|
262 * The pointer to the CScreensaverSharedDataMonitor |
|
263 */ |
|
264 CScreensaverSharedDataMonitor* iSharedDataMonitor; |
|
265 |
|
266 /** |
|
267 * The pointer to the indicator array |
|
268 * |
|
269 * Owned |
|
270 */ |
|
271 CScreensaverIndicatorArray* iIndicatorArray; |
|
272 |
|
273 /** |
|
274 * The trigger for screensaver activation, short timeout |
|
275 */ |
|
276 CUserActivityManager* iActivityManagerScreensaverShort; |
|
277 |
|
278 /** |
|
279 * moved from view class |
|
280 */ |
|
281 TScreensaverColorModel iColorModel; |
|
282 |
|
283 |
|
284 /** |
|
285 * The preview timer |
|
286 */ |
|
287 CPeriodic* iPreviewTimer; |
|
288 |
|
289 /** |
|
290 * The suspend timer |
|
291 */ |
|
292 CPeriodic* iSuspendTimer; |
|
293 |
|
294 /** |
|
295 * used to intercept and capture application key event. |
|
296 */ |
|
297 RAknUiServer iAknUiServer; |
|
298 }; |
|
299 |
|
300 |
|
301 |
|
302 #endif // C_SCREENSAVERENGINE_H |
|
303 |
|
304 // End of file |
|