1 /* |
|
2 * Copyright (c) 2009 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: Timer for Starting and Stopping current Active Scheduler. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef C_ACCSRVRESETINACTIVITYTIMETIMER_H |
|
21 #define C_ACCSRVRESETINACTIVITYTIMETIMER_H |
|
22 |
|
23 |
|
24 |
|
25 #include <e32base.h> |
|
26 |
|
27 |
|
28 #include "mschedulerstartandstoptimerobserver.h" |
|
29 |
|
30 |
|
31 /** Timer's default value in micro seconds */ |
|
32 const TInt KTimerDefaultValue = 400; |
|
33 |
|
34 |
|
35 /** |
|
36 * Timer class for Starting and Stopping current Active Scheduler. |
|
37 * |
|
38 * |
|
39 * @code |
|
40 * ?good_class_usage_example(s) |
|
41 * @endcode |
|
42 * |
|
43 * @lib AccServer.exe |
|
44 * @since S60 10.1 |
|
45 */ |
|
46 NONSHARABLE_CLASS( CSchedulerStopAndStartTimer ): public CTimer |
|
47 { |
|
48 |
|
49 public: |
|
50 enum TTimerId{ |
|
51 ETimerIdRunMUT = 0, |
|
52 ETimerIdCreateMUT = 1, |
|
53 ETimerIdDeleteMUT = 2 |
|
54 }; |
|
55 |
|
56 |
|
57 /** |
|
58 * Two-phased constructor. |
|
59 * @param aSchedulerStartAndStopTimerObserver Observer callback interface. |
|
60 */ |
|
61 static CSchedulerStopAndStartTimer* NewL( |
|
62 MSchedulerStartAndStopTimerObserver& aSchedulerStartAndStopTimerObserver ); |
|
63 |
|
64 /** |
|
65 * Destructor. |
|
66 */ |
|
67 virtual ~CSchedulerStopAndStartTimer(); |
|
68 |
|
69 /** |
|
70 * Starts the timer. |
|
71 * @since S60 10.1 |
|
72 * @param aTime Time out value. |
|
73 * @param aTimeId Timer Id. |
|
74 * @return void |
|
75 */ |
|
76 void StartTimer( TInt aTime = KTimerDefaultValue, |
|
77 TUint aTimerId = ETimerIdRunMUT ); |
|
78 |
|
79 |
|
80 protected: |
|
81 |
|
82 /** |
|
83 * From CActive. |
|
84 * Handles an active object's request completion event. |
|
85 * |
|
86 * @since S60 10.1 |
|
87 * @param void |
|
88 */ |
|
89 void RunL(); |
|
90 |
|
91 /** |
|
92 * From CActive. |
|
93 * Handles RunL's leave cases |
|
94 * |
|
95 * @since S60 10.1 |
|
96 * @param aError Error code. |
|
97 */ |
|
98 TInt RunError( TInt aError ); |
|
99 |
|
100 |
|
101 private: |
|
102 |
|
103 /** |
|
104 * C++ default constructor. |
|
105 * @param aSchedulerStartAndStopTimerObserver Observer callback interface. |
|
106 */ |
|
107 CSchedulerStopAndStartTimer( |
|
108 MSchedulerStartAndStopTimerObserver& aSchedulerStartAndStopTimerObserver ); |
|
109 |
|
110 /** |
|
111 * By default Symbian OS constructor is private. |
|
112 * @param none. |
|
113 */ |
|
114 void ConstructL(); |
|
115 |
|
116 |
|
117 private: // data |
|
118 enum TTmerPhase |
|
119 { |
|
120 ETimerPhaseUndefined = 0, |
|
121 ETimerPhaseStarting = 1, |
|
122 ETimerPhaseStarted = 2 |
|
123 }; |
|
124 |
|
125 /** |
|
126 * TimeOut time |
|
127 */ |
|
128 TInt iTime; |
|
129 |
|
130 /** |
|
131 * Timer id. Client specific i.e same value is returned to observer. |
|
132 */ |
|
133 TUint iTimerId; |
|
134 |
|
135 /** |
|
136 * ResetInactivityTimeTimerObserver object. |
|
137 */ |
|
138 MSchedulerStartAndStopTimerObserver& iSchedulerStartAndStopTimerObserver; |
|
139 |
|
140 TTmerPhase iPhase; |
|
141 }; |
|
142 |
|
143 |
|
144 #endif // C_ACCSRVRESETINACTIVITYTIMETIMER_H |
|