|
1 /* |
|
2 * Copyright (c) 2002-2007 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 the License "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: Active object to get notification of system time change. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef WLANSYSTEMTIMEHANDLER_H |
|
20 #define WLANSYSTEMTIMEHANDLER_H |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <e32std.h> |
|
24 |
|
25 |
|
26 /** |
|
27 * Callback interface |
|
28 */ |
|
29 class MWlanSystemTimeCallback |
|
30 { |
|
31 public: |
|
32 |
|
33 /** |
|
34 * User has changed the time and therefore WLAN region cache is not valid anymore. |
|
35 */ |
|
36 virtual void OnSystemTimeChange() = 0; |
|
37 |
|
38 /** |
|
39 * WLAN region cache needs to be always cleared after defined time. |
|
40 */ |
|
41 virtual void OnCacheClearTimerExpiration() = 0; |
|
42 }; |
|
43 |
|
44 /** |
|
45 * System time change handler. |
|
46 * Active object that waits for system time change |
|
47 * notification from Symbian side. |
|
48 * @since S60 v5.0 |
|
49 */ |
|
50 NONSHARABLE_CLASS( CWlanSystemTimeHandler ) : public CActive |
|
51 { |
|
52 public: // Constructors and destructor |
|
53 |
|
54 /** |
|
55 * Static constructor. |
|
56 * @param aClient Interfce to client. |
|
57 */ |
|
58 static CWlanSystemTimeHandler* NewL( |
|
59 MWlanSystemTimeCallback& aClient); |
|
60 |
|
61 /** |
|
62 * Destructor. |
|
63 */ |
|
64 virtual ~CWlanSystemTimeHandler(); |
|
65 |
|
66 public: // New functions |
|
67 |
|
68 /** |
|
69 * Start the timer |
|
70 * Handler starts to wait for system time change notifications |
|
71 * @since S60 v.5.0 |
|
72 * @return error code |
|
73 */ |
|
74 TInt StartTimer(); |
|
75 |
|
76 /** |
|
77 * Stop the timer |
|
78 * Handler stops to wait for system time change notifications |
|
79 * @since S60 v.5.0 |
|
80 * @return error code |
|
81 */ |
|
82 void StopTimer(); |
|
83 |
|
84 |
|
85 public: // Functions from base classes |
|
86 |
|
87 /** |
|
88 * From CActive Is executed when synchronous request is ready. |
|
89 */ |
|
90 void RunL(); |
|
91 |
|
92 /** |
|
93 * From CActive Cancel synchronous request. |
|
94 */ |
|
95 void DoCancel(); |
|
96 |
|
97 private: // Functions |
|
98 |
|
99 /** |
|
100 * C++ default constructor. |
|
101 * @param aClient Interfce to client. |
|
102 */ |
|
103 CWlanSystemTimeHandler( |
|
104 MWlanSystemTimeCallback& aClient ); |
|
105 |
|
106 /** |
|
107 * By default Symbian 2nd phase constructor is private. |
|
108 */ |
|
109 void ConstructL(); |
|
110 |
|
111 private: // Data |
|
112 |
|
113 /** |
|
114 * Asynchronous timer used to receive notification for system time change. |
|
115 */ |
|
116 RTimer iTimer; |
|
117 |
|
118 /** |
|
119 * Interface to forward packets. |
|
120 */ |
|
121 MWlanSystemTimeCallback& iClient; |
|
122 |
|
123 }; |
|
124 |
|
125 /** |
|
126 * Region cache clearing handler. |
|
127 * Active object that ensures that region cache is cleared after defined time. |
|
128 * @since S60 v5.0 |
|
129 */ |
|
130 NONSHARABLE_CLASS( CWlanPeriodicCacheClearingHandler ) : public CActive |
|
131 { |
|
132 public: // Constructors and destructor |
|
133 |
|
134 /** |
|
135 * Static constructor. |
|
136 * @param aClient Interfce to client. |
|
137 */ |
|
138 static CWlanPeriodicCacheClearingHandler* NewL( |
|
139 MWlanSystemTimeCallback& aClient); |
|
140 |
|
141 /** |
|
142 * Destructor. |
|
143 */ |
|
144 virtual ~CWlanPeriodicCacheClearingHandler(); |
|
145 |
|
146 public: // New functions |
|
147 |
|
148 /** |
|
149 * Start the timer |
|
150 * Handler starts to wait for region cache clearing timer expiration. |
|
151 * @since S60 v.5.0 |
|
152 * @return error code |
|
153 */ |
|
154 TInt StartTimer(); |
|
155 |
|
156 /** |
|
157 * Stop the timer |
|
158 * Handler stops to wait for region cache clearing timer expiration. |
|
159 * @since S60 v.5.0 |
|
160 * @return error code |
|
161 */ |
|
162 void StopTimer(); |
|
163 |
|
164 |
|
165 public: // Functions from base classes |
|
166 |
|
167 /** |
|
168 * From CActive Is executed when synchronous request is ready. |
|
169 */ |
|
170 void RunL(); |
|
171 |
|
172 /** |
|
173 * From CActive Cancel synchronous request. |
|
174 */ |
|
175 void DoCancel(); |
|
176 |
|
177 private: // Functions |
|
178 |
|
179 /** |
|
180 * C++ default constructor. |
|
181 * @param aClient Interfce to client. |
|
182 */ |
|
183 CWlanPeriodicCacheClearingHandler( |
|
184 MWlanSystemTimeCallback& aClient ); |
|
185 |
|
186 /** |
|
187 * By default Symbian 2nd phase constructor is private. |
|
188 */ |
|
189 void ConstructL(); |
|
190 |
|
191 private: // Data |
|
192 |
|
193 /** |
|
194 * Asynchronous timer used to ensure that WLAN region cache is cleared after |
|
195 * defined time. |
|
196 */ |
|
197 RTimer iClearTimer; |
|
198 |
|
199 /** |
|
200 * The amount of times that iClearTimer needs to be started before the |
|
201 * whole region cache expiration time has exceeded. |
|
202 */ |
|
203 TInt iClearTimerCounter; |
|
204 |
|
205 /** |
|
206 * Interface to forward the information that timer has expired. |
|
207 */ |
|
208 MWlanSystemTimeCallback& iClient; |
|
209 |
|
210 }; |
|
211 |
|
212 #endif // WLANSYSTEMTIMEHANDLER_H |