|
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: Implementation of WlanNullSendController inline |
|
15 * methods. |
|
16 * |
|
17 */ |
|
18 |
|
19 /* |
|
20 * %version: 10 % |
|
21 */ |
|
22 |
|
23 // Default Voice Call Entry timeout |
|
24 // This value is used if no other value has been provided |
|
25 const TUint32 KDefaultVoiceCallEntryTimeout = 300000; // 300 ms |
|
26 |
|
27 // Default Voice Call Entry Threshold |
|
28 // This value is used if no other value has been provided |
|
29 const TUint32 KDefaultVoiceCallEntryThreshold = 5; |
|
30 |
|
31 // Default Null timeout |
|
32 // This value is used if no other value has been provided |
|
33 const TUint32 KDefaultNullTimeout = 20000; // 20 ms |
|
34 |
|
35 // Default No Voice timeout |
|
36 // This value is used if no other value has been provided |
|
37 const TUint32 KDefaultNoVoiceTimeout = 1000000; // 1 s |
|
38 |
|
39 // Default Keep Alive timeout |
|
40 // This value is used if no other value has been provided |
|
41 const TUint32 KDefaultKeepAliveTimeout = 200000000; // 200 s |
|
42 |
|
43 // Default value for frame payload length threashold of a potential |
|
44 // carrier of downlink Voice over WLAN Call data, which is erroneously |
|
45 // tagged as Best Effort |
|
46 const TUint KDefaultBestEffortVoiceRxLengthThreshold = 400; // bytes |
|
47 |
|
48 // Default value for the length of the time window within which we |
|
49 // study the potential carriers of downlink Voice over WLAN Call data, |
|
50 // which are erroneously tagged as Best Effort |
|
51 const TUint KDefaultBestEffortVoiceRxTimeWindow = 375000; // 375 ms |
|
52 |
|
53 // --------------------------------------------------------------------------- |
|
54 // |
|
55 // --------------------------------------------------------------------------- |
|
56 // |
|
57 inline WlanNullSendController::WlanNullSendController( |
|
58 WlanContextImpl& aWlanCtxImpl, |
|
59 MWlanNullSender& aNullSender ) : |
|
60 iFlags( 0 ), |
|
61 iVoiceCallEntryTimeout( KDefaultVoiceCallEntryTimeout ), |
|
62 iVoiceCallEntryThreshold( KDefaultVoiceCallEntryThreshold ), |
|
63 iNullTimeout( KDefaultNullTimeout ), |
|
64 iNoVoiceTimeout( KDefaultNoVoiceTimeout ), |
|
65 iLatestVoiceRxOrTxInVoiceCallState( 0 ), |
|
66 iBestEffortVoiceRxLengthThreshold( |
|
67 KDefaultBestEffortVoiceRxLengthThreshold ), |
|
68 iBestEffortVoiceRxInd( 0 ), |
|
69 iBestEffortVoiceRxTimeWindow( KDefaultBestEffortVoiceRxTimeWindow ), |
|
70 iKeepAliveTimeout( KDefaultKeepAliveTimeout ), |
|
71 iLatestTx( 0 ), |
|
72 iVoiceCallEntryTxCount( 0 ), |
|
73 iVoiceCallEntryRxCount( 0 ), |
|
74 iWlanContextImpl( aWlanCtxImpl ), |
|
75 iNullSender( aNullSender ) |
|
76 { |
|
77 OsTracePrint( KUmacDetails, (TUint8*) |
|
78 ("UMAC: WlanNullSendController::WlanNullSendController") ); |
|
79 os_memset( |
|
80 iBestEffortVoiceRxTimeStamp, |
|
81 0, |
|
82 sizeof( iBestEffortVoiceRxTimeStamp ) ); |
|
83 } |
|
84 |
|
85 // --------------------------------------------------------------------------- |
|
86 // |
|
87 // --------------------------------------------------------------------------- |
|
88 // |
|
89 inline WlanNullSendController::~WlanNullSendController() |
|
90 { |
|
91 OsTracePrint( KUmacDetails, (TUint8*) |
|
92 ("UMAC: WlanNullSendController::~WlanNullSendController") ); |
|
93 |
|
94 // cancel any possibly running timers |
|
95 CancelVoiceCallEntryTimeout(); |
|
96 CancelNullTimeout(); |
|
97 CancelNoVoiceTimeout(); |
|
98 CancelKeepAliveTimeout(); |
|
99 } |
|
100 |
|
101 // --------------------------------------------------------------------------- |
|
102 // |
|
103 // --------------------------------------------------------------------------- |
|
104 // |
|
105 inline void WlanNullSendController::SetParameters( |
|
106 TUint32 aVoiceCallEntryTimeout, |
|
107 TUint32 aVoiceCallEntryThreshold, |
|
108 TUint32 aNullTimeout, |
|
109 TUint32 aNoVoiceTimeout, |
|
110 TUint32 aKeepAliveTimeout ) |
|
111 { |
|
112 OsTracePrint( KUmacDetails, (TUint8*) |
|
113 ("UMAC: WlanNullSendController::SetParameters: aVoiceCallEntryTimeout: %d"), |
|
114 aVoiceCallEntryTimeout ); |
|
115 OsTracePrint( KUmacDetails, (TUint8*) |
|
116 ("UMAC: WlanNullSendController::SetParameters: aVoiceCallEntryThreshold: %d"), |
|
117 aVoiceCallEntryThreshold ); |
|
118 OsTracePrint( KUmacDetails, (TUint8*) |
|
119 ("UMAC: WlanNullSendController::SetParameters: aNullTimeout: %d"), |
|
120 aNullTimeout ); |
|
121 OsTracePrint( KUmacDetails, (TUint8*) |
|
122 ("UMAC: WlanNullSendController::SetParameters: aNoVoiceTimeout: %d"), |
|
123 aNoVoiceTimeout ); |
|
124 OsTracePrint( KUmacDetails, (TUint8*) |
|
125 ("UMAC: WlanNullSendController::SetParameters: aKeepAliveTimeout: %d"), |
|
126 aKeepAliveTimeout ); |
|
127 |
|
128 iVoiceCallEntryTimeout = aVoiceCallEntryTimeout; |
|
129 iVoiceCallEntryThreshold = aVoiceCallEntryThreshold; |
|
130 iNullTimeout = aNullTimeout; |
|
131 iNoVoiceTimeout = aNoVoiceTimeout; |
|
132 iKeepAliveTimeout = aKeepAliveTimeout; |
|
133 iBestEffortVoiceRxTimeWindow = |
|
134 ( aVoiceCallEntryTimeout / ( aVoiceCallEntryThreshold - 1 ) ) |
|
135 * KBestEffortVoiceRxTimeStampCnt; |
|
136 |
|
137 OsTracePrint( KUmacDetails, (TUint8*) |
|
138 ("UMAC: WlanNullSendController::SetParameters: " |
|
139 "iBestEffortVoiceRxTimeWindow: %d"), |
|
140 iBestEffortVoiceRxTimeWindow ); |
|
141 } |
|
142 |
|
143 // --------------------------------------------------------------------------- |
|
144 // |
|
145 // --------------------------------------------------------------------------- |
|
146 // |
|
147 inline void WlanNullSendController::StopVoiceOverWlanCallMaintenance() |
|
148 { |
|
149 OsTracePrint( KUmacDetails, (TUint8*) |
|
150 ("UMAC: WlanNullSendController::StopVoiceOverWlanCallMaintenance") ); |
|
151 |
|
152 iFlags &= ~KVoiceOverWlanCallMaintenanceStarted; |
|
153 |
|
154 // cancel relevant possibly running timers |
|
155 CancelVoiceCallEntryTimeout(); |
|
156 CancelNullTimeout(); |
|
157 CancelNoVoiceTimeout(); |
|
158 } |
|
159 |
|
160 // --------------------------------------------------------------------------- |
|
161 // |
|
162 // --------------------------------------------------------------------------- |
|
163 // |
|
164 inline void WlanNullSendController::TerminateVoiceOverWlanCallMaintenance() |
|
165 { |
|
166 OsTracePrint( KUmacDetails, (TUint8*) |
|
167 ("UMAC: WlanNullSendController::TerminateVoiceOverWlanCallMaintenance") ); |
|
168 |
|
169 StopVoiceOverWlanCallMaintenance(); |
|
170 iFlags &= ~KInVoiceCallState; |
|
171 } |
|
172 |
|
173 // --------------------------------------------------------------------------- |
|
174 // |
|
175 // --------------------------------------------------------------------------- |
|
176 // |
|
177 inline void WlanNullSendController::StartKeepAlive() |
|
178 { |
|
179 OsTracePrint( KUmacDetails, (TUint8*) |
|
180 ("UMAC: WlanNullSendController::StartKeepAlive") ); |
|
181 |
|
182 iFlags |= KKeepAliveStarted; |
|
183 RegisterKeepAliveTimeout( iKeepAliveTimeout ); |
|
184 } |
|
185 |
|
186 // --------------------------------------------------------------------------- |
|
187 // |
|
188 // --------------------------------------------------------------------------- |
|
189 // |
|
190 inline void WlanNullSendController::StopKeepAlive() |
|
191 { |
|
192 OsTracePrint( KUmacDetails, (TUint8*) |
|
193 ("UMAC: WlanNullSendController::StopKeepAlive") ); |
|
194 |
|
195 iFlags &= ~KKeepAliveStarted; |
|
196 // cancel possibly running timer |
|
197 CancelKeepAliveTimeout(); |
|
198 } |
|
199 |
|
200 // --------------------------------------------------------------------------- |
|
201 // |
|
202 // --------------------------------------------------------------------------- |
|
203 // |
|
204 inline void WlanNullSendController::OnNullDataTxCompleted() |
|
205 { |
|
206 OsTracePrint( KUmacDetails, (TUint8*) |
|
207 ("UMAC: WlanNullSendController::OnNullDataTxCompleted") ); |
|
208 |
|
209 if ( iFlags & KKeepAliveStarted ) |
|
210 { |
|
211 // we are still doing Keep Alive and as the previous Null Data, i.e. |
|
212 // Keep Alive, Frame has been transmitted, we re-arm the timer for |
|
213 // the next round |
|
214 RegisterKeepAliveTimeout( iKeepAliveTimeout ); |
|
215 |
|
216 // There's no need to check for the need to re-arm the NullTimer, because |
|
217 // it won't happen in practice that a Keep Alive (Null Data) frame |
|
218 // transmit would complete when the NullTimer is armed, as we won't need |
|
219 // to send any Keep Alive frames during a Voice Call, i.e. when the |
|
220 // NullTimer is running, because there's frequent frame Tx activity |
|
221 // during a Voice Call |
|
222 } |
|
223 } |