|
1 /* |
|
2 * Copyright (c) 2002 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: Timers assemble for imps engine base function |
|
15 * |
|
16 * CImpsIdleTimer |
|
17 * Idle timer to lauch Poll requests in CSP protocol. |
|
18 * CImpsPDPIdleTimer |
|
19 * Idle timer to close idle PDP-context (IAP). |
|
20 * CImpsPDPOpenTimer |
|
21 * Timer to open idle PDP-context. |
|
22 * CImpsShutdownTimer |
|
23 * Idle timer to lauch keep-alive and Poll requests in CSP protocol. |
|
24 * |
|
25 */ |
|
26 |
|
27 |
|
28 #ifndef IDLETIMER_H |
|
29 #define IDLETIMER_H |
|
30 |
|
31 // INCLUDES |
|
32 #include "impssendreceive.h" |
|
33 |
|
34 // FORWARD DECLARATIONS |
|
35 class CImpsServer; |
|
36 class MImpsCSPSession; |
|
37 |
|
38 // CLASS DECLARATION |
|
39 |
|
40 |
|
41 /** |
|
42 * CImpsBaseTimer |
|
43 * Base timer class for different timers |
|
44 */ |
|
45 class CImpsBaseTimer : public CActive |
|
46 { |
|
47 public: |
|
48 /** |
|
49 * Constructor |
|
50 * @param aServer WV engine server |
|
51 * @param aPriority Active objects priority |
|
52 */ |
|
53 CImpsBaseTimer( TInt aPriority ); |
|
54 |
|
55 /** |
|
56 * Destructor |
|
57 */ |
|
58 virtual ~CImpsBaseTimer(); |
|
59 |
|
60 /** |
|
61 * Start waiting. |
|
62 * Use CActive::Cancel() to cancel the request. |
|
63 * @param aWaitSeconds wait time in seconds |
|
64 */ |
|
65 virtual void Start( TInt aWaitSeconds ); |
|
66 |
|
67 /** |
|
68 * Stop the timer |
|
69 */ |
|
70 virtual void Stop( ); |
|
71 |
|
72 /** |
|
73 * Reset the timer after message is sent |
|
74 */ |
|
75 virtual void Reset(); |
|
76 |
|
77 protected: |
|
78 // From base class |
|
79 void DoCancel(); |
|
80 |
|
81 protected: |
|
82 RTimer iTimer; |
|
83 TBool iReset; |
|
84 TInt iSeconds; |
|
85 }; |
|
86 |
|
87 /** |
|
88 * CImpsIdleTimer |
|
89 * Idle timer to lauch Poll requests in CSP protocol. |
|
90 */ |
|
91 class CImpsIdleTimer: public CImpsBaseTimer |
|
92 { |
|
93 public: |
|
94 /** |
|
95 * Constructor |
|
96 * @param aServer WV engine server |
|
97 */ |
|
98 CImpsIdleTimer( MImpsCSPSession& aServer, TInt aPriority ); |
|
99 |
|
100 /** |
|
101 * Destructor |
|
102 */ |
|
103 virtual ~CImpsIdleTimer(); |
|
104 |
|
105 /** |
|
106 * Start waiting. |
|
107 * Use CActive::Cancel() to cancel the request. |
|
108 * @param aWaitSeconds wait time in seconds |
|
109 */ |
|
110 void Start( TInt aWaitSeconds ); |
|
111 |
|
112 /** |
|
113 * Stop the timer |
|
114 */ |
|
115 void Stop( ); |
|
116 |
|
117 protected: |
|
118 // From base class |
|
119 void RunL(); |
|
120 protected: // data |
|
121 MImpsCSPSession& iServer; |
|
122 }; |
|
123 |
|
124 /** |
|
125 * CImpsPDPIdleTimer |
|
126 * Idle timer to close idle PDP-context (IAP) |
|
127 */ |
|
128 class CImpsPDPIdleTimer: public CImpsBaseTimer |
|
129 { |
|
130 public: |
|
131 /** |
|
132 * Constructor |
|
133 * @param aServer WV engine server |
|
134 */ |
|
135 CImpsPDPIdleTimer( MImpsCSPSession& aServer, TInt aPriority ); |
|
136 |
|
137 /** |
|
138 * Destructor |
|
139 */ |
|
140 virtual ~CImpsPDPIdleTimer(); |
|
141 |
|
142 /** |
|
143 * Start waiting. |
|
144 * Use CActive::Cancel() to cancel the request. |
|
145 * @param aWaitSeconds wait time in seconds |
|
146 */ |
|
147 void Start( TInt aWaitSeconds ); |
|
148 |
|
149 /** |
|
150 * Stop the timer |
|
151 */ |
|
152 void Stop( ); |
|
153 |
|
154 /** |
|
155 * Reset the timer after message is sent |
|
156 */ |
|
157 void Reset(); |
|
158 |
|
159 protected: |
|
160 // From base class |
|
161 void RunL(); |
|
162 protected: // data |
|
163 MImpsCSPSession& iServer; |
|
164 }; |
|
165 |
|
166 /** |
|
167 * CImpsPDPOpenTimer |
|
168 * Timer to open idle PDP-context |
|
169 */ |
|
170 class CImpsPDPOpenTimer: public CImpsBaseTimer |
|
171 { |
|
172 public: |
|
173 /** |
|
174 * Constructor |
|
175 * @param aServer WV engine server |
|
176 */ |
|
177 CImpsPDPOpenTimer( MImpsCSPSession& aServer, TInt aPriority ); |
|
178 |
|
179 /** |
|
180 * Destructor |
|
181 */ |
|
182 virtual ~CImpsPDPOpenTimer(); |
|
183 |
|
184 /** |
|
185 * Start waiting. |
|
186 * Use CActive::Cancel() to cancel the request. |
|
187 * @param aWaitSeconds wait time in seconds |
|
188 */ |
|
189 void Start( TInt aWaitSeconds ); |
|
190 |
|
191 /** |
|
192 * Stop the timer |
|
193 */ |
|
194 void Stop( ); |
|
195 |
|
196 protected: |
|
197 // From base class |
|
198 void RunL(); |
|
199 protected: // data |
|
200 MImpsCSPSession& iServer; |
|
201 }; |
|
202 |
|
203 |
|
204 /** |
|
205 * CImpsShutdownTimer |
|
206 * Idle timer to lauch keep-alive and Poll requests in CSP protocol. |
|
207 */ |
|
208 class CImpsShutdownTimer: public CImpsBaseTimer |
|
209 { |
|
210 public: |
|
211 /** |
|
212 * Constructor |
|
213 * @param aServer WV engine server |
|
214 */ |
|
215 CImpsShutdownTimer( CImpsServer& aServer, TInt aPriority ); |
|
216 |
|
217 /** |
|
218 * Destructor |
|
219 */ |
|
220 virtual ~CImpsShutdownTimer(); |
|
221 |
|
222 /** |
|
223 * Start waiting. |
|
224 * Use this instead of base class Start(TTnt) |
|
225 * Use CActive::Cancel() to cancel the request. |
|
226 * @param aWaitSeconds wait time in seconds |
|
227 */ |
|
228 void Start( TInt aWaitSeconds ); //lint !e1411 |
|
229 |
|
230 /** |
|
231 * Stop the timer |
|
232 */ |
|
233 void Stop( ); |
|
234 |
|
235 protected: |
|
236 // From base class |
|
237 void RunL(); |
|
238 protected: // data |
|
239 CImpsServer& iServer; |
|
240 private: |
|
241 MImpsCSPSession* iSess; |
|
242 }; |
|
243 |
|
244 /** |
|
245 * CImpsExpiryTimer |
|
246 * Timer to discard expired CSP requests |
|
247 */ |
|
248 class CImpsExpiryTimer: public CImpsBaseTimer |
|
249 { |
|
250 public: |
|
251 /** |
|
252 * Constructor |
|
253 * @param aServer WV engine server |
|
254 */ |
|
255 CImpsExpiryTimer( |
|
256 CImpsServer& aServer, |
|
257 TImpsEventType aType, |
|
258 TInt aPriority ); |
|
259 |
|
260 /** |
|
261 * Destructor |
|
262 */ |
|
263 virtual ~CImpsExpiryTimer(); |
|
264 |
|
265 /** |
|
266 * Start waiting. |
|
267 * Use CActive::Cancel() to cancel the request. |
|
268 * @param aWaitSeconds wait time in seconds |
|
269 */ |
|
270 void Start( TInt aWaitSeconds ); |
|
271 |
|
272 /** |
|
273 * Stop the timer |
|
274 */ |
|
275 void Stop( ); |
|
276 |
|
277 protected: |
|
278 // From base class |
|
279 void RunL(); |
|
280 protected: // data |
|
281 CImpsServer& iServer; |
|
282 private: |
|
283 TImpsEventType iType; |
|
284 |
|
285 }; |
|
286 |
|
287 |
|
288 /** |
|
289 * CImpsSendQueued |
|
290 * This sends so many queued messages to trasnport as possible. |
|
291 */ |
|
292 class CImpsSendQueued: public CActive |
|
293 { |
|
294 public: |
|
295 /** |
|
296 * Constructor |
|
297 * @param aServer WV engine server |
|
298 */ |
|
299 CImpsSendQueued( MImpsCSPSession& aServer, TInt aPriority ); |
|
300 |
|
301 /** |
|
302 * Destructor |
|
303 */ |
|
304 virtual ~CImpsSendQueued(); |
|
305 |
|
306 /** |
|
307 * Start request for sending |
|
308 */ |
|
309 void Send( ); |
|
310 |
|
311 |
|
312 protected: |
|
313 // From base class |
|
314 void RunL(); |
|
315 void DoCancel(); |
|
316 private: |
|
317 MImpsCSPSession& iServer; |
|
318 TBool iCanceled; |
|
319 |
|
320 }; |
|
321 |
|
322 |
|
323 #endif // IDLETIMER_H |
|
324 |
|
325 // End of File |