|
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 // Delay after screensaver is stopped and hided. |
|
34 const TInt KDefaultScreenSaverTimeout = 2 * 60 * 1000000; // 2 mins |
|
35 |
|
36 // FORWARD DECLARATIONS |
|
37 class CUserActivityManager; |
|
38 class CScreensaverSharedDataI; |
|
39 class CScreensaverSharedDataMonitor; |
|
40 class CScreensaverAppUi; |
|
41 class CScreensaverView; |
|
42 class CScreensaverActivityManager; |
|
43 class CPowerSaveDisplayMode; |
|
44 |
|
45 /** |
|
46 * CScreensaverModel |
|
47 */ |
|
48 class CScreensaverEngine : public CBase |
|
49 { |
|
50 public: |
|
51 |
|
52 /** |
|
53 * Two-phased constructor |
|
54 * |
|
55 * @param aAppUi the AppUi of the application |
|
56 */ |
|
57 static CScreensaverEngine* NewL(); |
|
58 |
|
59 /** |
|
60 * Destructor |
|
61 */ |
|
62 ~CScreensaverEngine(); |
|
63 |
|
64 /** |
|
65 * Return the pointer to the CScreensaverSharedDataI |
|
66 * |
|
67 * @return CScreensaverSharedDataI* |
|
68 */ |
|
69 CScreensaverSharedDataI* SharedDataInterface() const; |
|
70 |
|
71 /** |
|
72 * Reset the time during which the user did not do anything |
|
73 */ |
|
74 void ResetInactivityTimeout(); |
|
75 |
|
76 /** |
|
77 * Returns if the screensaver is on or not |
|
78 */ |
|
79 TBool ScreenSaverIsOn() const; |
|
80 |
|
81 /** |
|
82 * Returns if the screensaver is previewing or not |
|
83 */ |
|
84 TBool ScreenSaverIsPreviewing() const; |
|
85 |
|
86 /** |
|
87 * Starts screensaver |
|
88 */ |
|
89 void StartScreenSaver(); |
|
90 |
|
91 /** |
|
92 * Stops the screensaver |
|
93 */ |
|
94 void StopScreenSaver(); |
|
95 |
|
96 /** |
|
97 * Starts the preview model |
|
98 */ |
|
99 void StartPreviewModeL(); |
|
100 |
|
101 /* |
|
102 * Display the Object(); |
|
103 */ |
|
104 void DisplayObject(); |
|
105 |
|
106 /** |
|
107 * Start the suspend timer |
|
108 */ |
|
109 void StartSuspendTimer( TInt aSec ); |
|
110 |
|
111 /** |
|
112 * Returns the indicator array |
|
113 */ |
|
114 CScreensaverIndicatorArray& IndicatorArray() const; |
|
115 |
|
116 /** |
|
117 * Returns the color model |
|
118 */ |
|
119 const TScreensaverColorModel& GetColorModel( ) const; |
|
120 |
|
121 /** |
|
122 * Adds the partial model |
|
123 * |
|
124 * @param aBpp the bits per pixels of the partial model |
|
125 * @param aType the type of the partial type |
|
126 */ |
|
127 void AddPartialModeLevel( TInt aBpp, TScreensaverPartialModeType aType ); |
|
128 |
|
129 /** |
|
130 * Updates the indicator attributes. |
|
131 */ |
|
132 void UpdateIndicatorAttributes( ); |
|
133 |
|
134 /* |
|
135 * Start screensaver expiry timer. When the timer expires the screensaver |
|
136 * will be stopped and hided. |
|
137 * |
|
138 * @param aTimeout Timeout after the screensaver stops and hides itself in |
|
139 * microseconds. 0 or negative value will disable the timer. |
|
140 */ |
|
141 void SetExpiryTimerTimeout( TInt aTimeout ); |
|
142 |
|
143 /** |
|
144 * Informs the engine about changes in keyguard state |
|
145 * @param aEnabled whether the keyguard is now on or off |
|
146 */ |
|
147 void HandleKeyguardStateChanged( TBool aEnabled ); |
|
148 |
|
149 private: |
|
150 |
|
151 /** |
|
152 * C++ default constructor |
|
153 * |
|
154 * @param aAppUi the AppUi of the application |
|
155 */ |
|
156 CScreensaverEngine(); |
|
157 |
|
158 private: |
|
159 |
|
160 /** |
|
161 * Two-phased constructor |
|
162 */ |
|
163 void ConstructL(); |
|
164 |
|
165 /** |
|
166 * Constructs the shared data member |
|
167 */ |
|
168 void EnableSharedDataAndMonitorL(); |
|
169 |
|
170 /** |
|
171 * Destruct the shared data member |
|
172 */ |
|
173 void DisableSharedDataAndMonitor(); |
|
174 |
|
175 /** |
|
176 * Starts to monitor the user activity |
|
177 */ |
|
178 void StartActivityMonitoringL(); |
|
179 |
|
180 /** |
|
181 * Stops monitoring the user activity |
|
182 */ |
|
183 void StopActivityMonitoring( CScreensaverActivityManager*& aActivityManager ); |
|
184 |
|
185 /** |
|
186 * Gets the color model from the resource |
|
187 */ |
|
188 void SetupColorModelL(); |
|
189 |
|
190 /** |
|
191 * Start the preview timer |
|
192 */ |
|
193 void StartPreviewTimer(); |
|
194 |
|
195 /** |
|
196 * Starts pause timer |
|
197 */ |
|
198 void StartPauseTimer(); |
|
199 |
|
200 /** |
|
201 * Kill the timer |
|
202 * |
|
203 * @param aTimer the timer you want stop |
|
204 */ |
|
205 void KillTimer( CPeriodic*& aTimer ); |
|
206 |
|
207 |
|
208 /** |
|
209 * Callback fuction. Called when the preivew tiemr time out |
|
210 */ |
|
211 static TInt HandlePreviewTimerExpiry( TAny* aPtr ); |
|
212 |
|
213 /** |
|
214 * Called when the time that the user did activity is out. |
|
215 */ |
|
216 static TInt HandleActiveEventL(TAny* aPtr); |
|
217 |
|
218 /** |
|
219 * Called when the time that the user did no activity is out. |
|
220 */ |
|
221 static TInt HandleInactiveEventL(TAny* aPtr); |
|
222 |
|
223 /** |
|
224 * Callback fuction. Called when the suspension tiemr time out |
|
225 */ |
|
226 static TInt HandleSuspendTimerExpiry( TAny* aPtr ); |
|
227 |
|
228 /** |
|
229 * Callback function. Called when the pause timer expires |
|
230 */ |
|
231 static TInt HandlePauseTimerExpiry( TAny* aPtr ); |
|
232 |
|
233 /** |
|
234 * Returns the CScreensaverView |
|
235 */ |
|
236 CScreensaverView* View() const; |
|
237 |
|
238 /** |
|
239 * Returns the timeout. |
|
240 */ |
|
241 TInt Timeout(); |
|
242 |
|
243 /** |
|
244 * Returns the display flag. |
|
245 */ |
|
246 TInt DisplayFlag(); |
|
247 |
|
248 /** |
|
249 * Callback fuction. Called when the screensaver expiry timer time out. |
|
250 */ |
|
251 static TInt HandleExpiryTimerExpiry( TAny* aPtr ); |
|
252 |
|
253 /** |
|
254 * Callback to do the screensaver starting. |
|
255 */ |
|
256 static TInt StartSaverCb( TAny* aPtr ); |
|
257 |
|
258 private: |
|
259 |
|
260 /** |
|
261 * The flag if append alert type indicator |
|
262 */ |
|
263 TBool iShowExtendedProfileInd; |
|
264 |
|
265 /** |
|
266 * The flag if the screensaver is on or not |
|
267 */ |
|
268 TBool iScreenSaverIsOn; |
|
269 |
|
270 /** |
|
271 * The flag if the screensaver is previewing or not |
|
272 */ |
|
273 TBool iScreenSaverIsPreviewing; |
|
274 |
|
275 /** |
|
276 * The trigger for screensaver activation |
|
277 */ |
|
278 CScreensaverActivityManager* iActivityManagerScreensaver; |
|
279 |
|
280 |
|
281 /** |
|
282 * The pointer to CScreensaverSharedDataI |
|
283 * |
|
284 * Owned |
|
285 */ |
|
286 CScreensaverSharedDataI* iSharedDataI; |
|
287 |
|
288 /* |
|
289 * The pointer to the CScreensaverSharedDataMonitor |
|
290 */ |
|
291 CScreensaverSharedDataMonitor* iSharedDataMonitor; |
|
292 |
|
293 /** |
|
294 * The pointer to the indicator array |
|
295 * |
|
296 * Owned |
|
297 */ |
|
298 CScreensaverIndicatorArray* iIndicatorArray; |
|
299 |
|
300 /** |
|
301 * moved from view class |
|
302 */ |
|
303 TScreensaverColorModel iColorModel; |
|
304 |
|
305 |
|
306 /** |
|
307 * The preview timer |
|
308 */ |
|
309 CPeriodic* iPreviewTimer; |
|
310 |
|
311 /** |
|
312 * The suspend timer |
|
313 */ |
|
314 CPeriodic* iSuspendTimer; |
|
315 |
|
316 /** |
|
317 * used to intercept and capture application key event. |
|
318 */ |
|
319 RAknUiServer iAknUiServer; |
|
320 |
|
321 /** |
|
322 * The screensaver expiry timer. Screensaver will be stoped when this timer |
|
323 * expires. |
|
324 * |
|
325 * Owned. |
|
326 */ |
|
327 CPeriodic* iExpiryTimer; |
|
328 |
|
329 /** |
|
330 * Pause timer. Used to reactivate screensaver after 5s when being |
|
331 * interrupted and keys are locked |
|
332 */ |
|
333 CPeriodic* iPauseTimer; |
|
334 |
|
335 /** |
|
336 * Set if the pause timer was started when preview was stopped |
|
337 */ |
|
338 TBool iPauseTimerStartedAfterPreview; |
|
339 |
|
340 /** |
|
341 * Asynchronous callback to start screensaver. |
|
342 */ |
|
343 CAsyncCallBack iAsyncCb; |
|
344 |
|
345 }; |
|
346 |
|
347 |
|
348 |
|
349 #endif // C_SCREENSAVERENGINE_H |
|
350 |
|
351 // End of file |