|
1 // Copyright (c) 2007-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 // CScreensaverActivityManager class |
|
15 // |
|
16 // |
|
17 |
|
18 #ifndef SCREENSAVERACTIVITYMANAGER_H |
|
19 #define SCREENSAVERACTIVITYMANAGER_H |
|
20 |
|
21 #include <e32base.h> |
|
22 |
|
23 |
|
24 class CScreensaverActivityManager : public CTimer |
|
25 { |
|
26 public: |
|
27 static CScreensaverActivityManager* NewL(TInt aPriority); |
|
28 ~CScreensaverActivityManager(); |
|
29 void Start(TTimeIntervalSeconds aInterval, |
|
30 TCallBack aInactiveCallback, |
|
31 TCallBack aActiveCallback); |
|
32 void SetInactivityTimeout(TTimeIntervalSeconds aInterval); |
|
33 TBool IsMonitoringForActivity(); |
|
34 private: |
|
35 void RunL(); |
|
36 CScreensaverActivityManager(TInt aPriority); |
|
37 void MonitorInactivity(); |
|
38 private: |
|
39 |
|
40 enum TState { |
|
41 EStUndefined = 0, //< Never used, reserved |
|
42 EStNotActive, //< Constructed but not started |
|
43 EStMonForInactivity, //< Monitoring user inactivity mode |
|
44 EStMonForActivity //< Monitoring user activity mode |
|
45 }; |
|
46 |
|
47 /** Inactivity interval */ |
|
48 TTimeIntervalSeconds iInterval; |
|
49 |
|
50 /** Callback to be used in case that user inactivity is detected */ |
|
51 TCallBack iInactiveCallback; |
|
52 |
|
53 /** Callback to be used in case of user activity after inactivity period */ |
|
54 TCallBack iActiveCallback; |
|
55 |
|
56 /** State of object, what form of monitoring is active. */ |
|
57 TState iState; |
|
58 }; |
|
59 |
|
60 #endif // SCREENSAVERACTIVITYMANAGER_H |