|
1 /* |
|
2 * Copyright (c) 2007-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 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: Declaration of the WlanNullSendController class |
|
15 * |
|
16 */ |
|
17 |
|
18 /* |
|
19 * %version: 14 % |
|
20 */ |
|
21 |
|
22 #ifndef WLAN_NULL_SEND_CONTROLLER |
|
23 #define WLAN_NULL_SEND_CONTROLLER |
|
24 |
|
25 #ifndef RD_WLAN_DDK |
|
26 #include <wha_types.h> |
|
27 #else |
|
28 #include <wlanwha_types.h> |
|
29 #endif |
|
30 |
|
31 class WlanContextImpl; |
|
32 class MWlanNullSender; |
|
33 |
|
34 /* |
|
35 * Encapsulates periodic NULL or QoS NULL frame sending functionality |
|
36 */ |
|
37 class WlanNullSendController |
|
38 { |
|
39 |
|
40 public: |
|
41 |
|
42 /** Ctor */ |
|
43 explicit inline WlanNullSendController( |
|
44 WlanContextImpl& aWlanCtxImpl, |
|
45 MWlanNullSender& aNullSender ); |
|
46 |
|
47 /** Dtor */ |
|
48 inline ~WlanNullSendController(); |
|
49 |
|
50 /** |
|
51 * Sets the null frame sending parameters |
|
52 * |
|
53 * @since S60 3.2 |
|
54 * @param aVoiceCallEntryTimeout when we are not in Voice over WLAN Call |
|
55 * state and we transmit at least aVoiceCallEntryTxThreshold |
|
56 * Voice priority frames during the time period (microseconds) |
|
57 * denoted by this parameter, we enter Voice over WLAN Call state |
|
58 * @param aVoiceCallEntryThreshold Threshold value for the number of |
|
59 * Voice priority frames to enter Voice over WLAN Call state |
|
60 * @param aNullTimeout NULL frame sending interval |
|
61 * @param aNoVoiceTimeout after this long time of no Voice priority data |
|
62 * Tx, exit voice call state |
|
63 * @param aKeepAliveTimeout Keep Alive frame sending interval |
|
64 */ |
|
65 inline void SetParameters( |
|
66 TUint32 aVoiceCallEntryTimeout, |
|
67 TUint32 aVoiceCallEntryThreshold, |
|
68 TUint32 aNullTimeout, |
|
69 TUint32 aNoVoiceTimeout, |
|
70 TUint32 aKeepAliveTimeout ); |
|
71 |
|
72 /** |
|
73 * Starts Voice over WLAN Call maintenance |
|
74 * |
|
75 * @since S60 3.2 |
|
76 */ |
|
77 void StartVoiceOverWlanCallMaintenance(); |
|
78 |
|
79 /** |
|
80 * Stops Voice over WLAN Call maintenance |
|
81 * Note! Does not reset the Voice over WLAN Call state! |
|
82 * |
|
83 * @since S60 3.2 |
|
84 */ |
|
85 inline void StopVoiceOverWlanCallMaintenance(); |
|
86 |
|
87 /** |
|
88 * Terminates Voice over WLAN Call maintenance |
|
89 */ |
|
90 inline void TerminateVoiceOverWlanCallMaintenance(); |
|
91 |
|
92 /** |
|
93 * Resumes QoS Null Data frame sending when necessary. |
|
94 * Doesn't change the Voice Call state |
|
95 * |
|
96 * @since S60 3.2 |
|
97 */ |
|
98 void ResumeQosNullSending(); |
|
99 |
|
100 /** |
|
101 * Starts Keep Alive frame sending |
|
102 * |
|
103 * @since S60 3.2 |
|
104 */ |
|
105 inline void StartKeepAlive(); |
|
106 |
|
107 /** |
|
108 * Stops Keep Alive frame sending |
|
109 * |
|
110 * @since S60 3.2 |
|
111 */ |
|
112 inline void StopKeepAlive(); |
|
113 |
|
114 /** |
|
115 * To be called upon every Data frame Rx (other than Null and QoS Null Data) |
|
116 * |
|
117 * @since S60 3.2 |
|
118 * @param aQueueId Id of the queue/AC via which the frame was transmitted |
|
119 * @param aPayloadLength length of the ethernet frame payload |
|
120 */ |
|
121 void OnFrameRx( |
|
122 WHA::TQueueId aQueueId, |
|
123 TUint aPayloadLength ); |
|
124 |
|
125 /** |
|
126 * To be called upon every Data frame (other than Null and QoS Null Data) |
|
127 * send completion |
|
128 * |
|
129 * @since S60 3.2 |
|
130 * @param aQueueId Id of the queue/AC via which the frame was transmitted |
|
131 */ |
|
132 void OnFrameTx( WHA::TQueueId aQueueId ); |
|
133 |
|
134 /** |
|
135 * To be called upon Voice Call Entry Timer timeout |
|
136 * |
|
137 * @since S60 3.2 |
|
138 */ |
|
139 void OnVoiceCallEntryTimerTimeout(); |
|
140 |
|
141 /** |
|
142 * To be called upon Null Timer timeout |
|
143 * |
|
144 * @since S60 3.2 |
|
145 */ |
|
146 void OnNullTimerTimeout(); |
|
147 |
|
148 /** |
|
149 * To be called upon every QoS Null Data frame send completion |
|
150 * |
|
151 * @since S60 3.2 |
|
152 */ |
|
153 void OnQosNullDataTxCompleted(); |
|
154 |
|
155 /** |
|
156 * To be called upon every Null Data frame send completion |
|
157 * |
|
158 * @since S60 3.2 |
|
159 */ |
|
160 inline void OnNullDataTxCompleted(); |
|
161 |
|
162 /** |
|
163 * To be called upon Voice Timer timeout |
|
164 * |
|
165 * @since S60 3.2 |
|
166 */ |
|
167 void OnNoVoiceTimerTimeout(); |
|
168 |
|
169 /** |
|
170 * To be called upon Keep Alive Timer timeout |
|
171 * |
|
172 * @since S60 3.2 |
|
173 */ |
|
174 void OnKeepAliveTimerTimeout(); |
|
175 |
|
176 private: |
|
177 |
|
178 /** |
|
179 * Arms the Voice Call Entry timer |
|
180 * |
|
181 * @since S60 3.2 |
|
182 */ |
|
183 void RegisterVoiceCallEntryTimeout(); |
|
184 |
|
185 /** |
|
186 * Arms the Null timer |
|
187 * |
|
188 * @since S60 3.2 |
|
189 * @param aTimeoutInMicroSeconds Timeout in microseconds |
|
190 */ |
|
191 void RegisterNullTimeout( TUint32 aTimeoutInMicroSeconds ); |
|
192 |
|
193 /** |
|
194 * Arms the No Voice timer |
|
195 * |
|
196 * @since S60 3.2 |
|
197 * @param aTimeoutInMicroSeconds Timeout in microseconds |
|
198 */ |
|
199 void RegisterNoVoiceTimeout( TUint32 aTimeoutInMicroSeconds ); |
|
200 |
|
201 /** |
|
202 * Arms the Keep Alive timer |
|
203 * |
|
204 * @since S60 3.2 |
|
205 * @param aTimeoutInMicroSeconds Timeout in microseconds |
|
206 */ |
|
207 void RegisterKeepAliveTimeout( TUint32 aTimeoutInMicroSeconds ); |
|
208 |
|
209 /** |
|
210 * Cancels the Voice Call Entry Timer |
|
211 * |
|
212 * @since S60 3.2 |
|
213 */ |
|
214 void CancelVoiceCallEntryTimeout(); |
|
215 |
|
216 /** |
|
217 * Cancels the Null Timer |
|
218 * |
|
219 * @since S60 3.2 |
|
220 */ |
|
221 void CancelNullTimeout(); |
|
222 |
|
223 /** |
|
224 * Cancels the No Voice Timer |
|
225 * |
|
226 * @since S60 3.2 |
|
227 */ |
|
228 void CancelNoVoiceTimeout(); |
|
229 |
|
230 /** |
|
231 * Cancels the Keep Alive Timer |
|
232 * |
|
233 * @since S60 3.2 |
|
234 */ |
|
235 void CancelKeepAliveTimeout(); |
|
236 |
|
237 /** |
|
238 * Enters the Voice Call state |
|
239 */ |
|
240 void EnterVoiceCallState(); |
|
241 |
|
242 // Prohibit copy constructor |
|
243 WlanNullSendController( |
|
244 const WlanNullSendController& ); |
|
245 // Prohibit assigment operator |
|
246 WlanNullSendController& operator= |
|
247 ( const WlanNullSendController& ); |
|
248 |
|
249 private: // Data |
|
250 |
|
251 /** stores the flags defined below */ |
|
252 TUint32 iFlags; |
|
253 /** |
|
254 * this flag is set when Voice over WLAN Call maintenance has been started |
|
255 */ |
|
256 static const TUint32 KVoiceOverWlanCallMaintenanceStarted = ( 1 << 0 ); |
|
257 /** |
|
258 * this flag is set when we are in voice call state |
|
259 */ |
|
260 static const TUint32 KVoiceCallEntryPending = ( 1 << 1 ); |
|
261 /** |
|
262 * this flag is set when we are in voice call state |
|
263 */ |
|
264 static const TUint32 KInVoiceCallState = ( 1 << 2 ); |
|
265 /** |
|
266 * this flag is set when the Null Timer has been armed |
|
267 */ |
|
268 static const TUint32 KNullTimerArmed = ( 1 << 3 ); |
|
269 /** |
|
270 * this flag is set when the No Voice Timer has been armed |
|
271 */ |
|
272 static const TUint32 KNoVoiceTimerArmed = ( 1 << 4 ); |
|
273 /** |
|
274 * this flag is set when the Keep Alive Timer has been armed |
|
275 */ |
|
276 static const TUint32 KKeepAliveStarted = ( 1 << 5 ); |
|
277 /** |
|
278 * this flag is set when the Keep Alive Timer has been armed |
|
279 */ |
|
280 static const TUint32 KKeepAliveTimerArmed = ( 1 << 6 ); |
|
281 /** |
|
282 * how many time stamps of potential Voice over WLAN downlink frames |
|
283 * we will store and investigate when determining if we should continue |
|
284 * in Voice over WLAN call state based on them - in the absence of actual |
|
285 * Voice priority traffic |
|
286 */ |
|
287 static const TUint KBestEffortVoiceRxTimeStampCnt = 5; |
|
288 /** |
|
289 * when we are not in Voice over WLAN Call |
|
290 * state and we transmit at least iVoiceCallEntryTxThreshold |
|
291 * Voice priority frames during the time period (microseconds) |
|
292 * denoted by this attribute, we enter Voice over WLAN Call state |
|
293 */ |
|
294 TUint32 iVoiceCallEntryTimeout; |
|
295 /* |
|
296 * threshold value for the number of Voice priority Tx/Rx frames to enter |
|
297 * Voice over WLAN Call state |
|
298 */ |
|
299 TUint32 iVoiceCallEntryThreshold; |
|
300 /** |
|
301 * after this long time (microseconds) of no transmitted frames, |
|
302 * a NULL frame needs to be transmitted |
|
303 */ |
|
304 TUint32 iNullTimeout; |
|
305 /** |
|
306 * after this long time (microseconds) of no transmitted Voice priority |
|
307 * frames, exit voice call state |
|
308 */ |
|
309 TUint32 iNoVoiceTimeout; |
|
310 /* |
|
311 * time stamp (microseconds) of the latest Voice priority frame Rx or Tx |
|
312 * in Voice Call state |
|
313 */ |
|
314 TInt64 iLatestVoiceRxOrTxInVoiceCallState; |
|
315 /** |
|
316 * if the Ethernet payload length (in bytes) of a Best Effort frame |
|
317 * received during Voice over WLAN call state in WMM nw is shorter |
|
318 * than this threshold, it's a potential carrier of downlink Voice |
|
319 * over WLAN Call data, which is erroneously tagged as Best Effort |
|
320 */ |
|
321 TUint iBestEffortVoiceRxLengthThreshold; |
|
322 /* |
|
323 * time stamps of the latest potential Voice over WLAN downlink frames |
|
324 * erroneously taggead as Best Effort. |
|
325 * Stored as a ring buffer. |
|
326 */ |
|
327 TInt64 iBestEffortVoiceRxTimeStamp[KBestEffortVoiceRxTimeStampCnt]; |
|
328 /** |
|
329 * index where to store the time stamp of the next potential Voice over |
|
330 * WLAN downlink frame. |
|
331 * Note that as the time stamps are stored as a ring buffer, this is |
|
332 * also the location of the oldest stored time stamp. |
|
333 */ |
|
334 TUint iBestEffortVoiceRxInd; |
|
335 /** |
|
336 * size of the time window (in microseconds) during which we need |
|
337 * to receive KBestEffortVoiceRxTimeStampCnt potential Voice over WLAN |
|
338 * frames in order to continue in Voice over WLAN call state even if |
|
339 * there's no actual Voice priority traffic |
|
340 */ |
|
341 TUint iBestEffortVoiceRxTimeWindow; |
|
342 /** |
|
343 * after this long time (microseconds) of no transmitted frames, |
|
344 * a keep alive frame needs to be transmitted |
|
345 */ |
|
346 TUint32 iKeepAliveTimeout; |
|
347 /* time stamp of the latest frame Tx */ |
|
348 TInt64 iLatestTx; |
|
349 /** |
|
350 * counter for our Voice priority Tx frames in Voice Call State Entry |
|
351 * pending state |
|
352 */ |
|
353 TUint iVoiceCallEntryTxCount; |
|
354 /** |
|
355 * counter for Voice priority Rx frames in Voice Call State Entry |
|
356 * pending state |
|
357 */ |
|
358 TUint iVoiceCallEntryRxCount; |
|
359 /** global state machine context reference */ |
|
360 WlanContextImpl& iWlanContextImpl; |
|
361 /** Null Data Frame Sender reference */ |
|
362 MWlanNullSender& iNullSender; |
|
363 }; |
|
364 |
|
365 #include "umacnullsendcontroller.inl" |
|
366 |
|
367 #endif // WLAN_NULL_SEND_CONTROLLER |