|
1 /* |
|
2 * Copyright (c) 2002-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 the WlanDot11MacError class. |
|
15 * |
|
16 */ |
|
17 |
|
18 /* |
|
19 * %version: 22 % |
|
20 */ |
|
21 |
|
22 #include "config.h" |
|
23 #include "UmacDot11MacError.h" |
|
24 #include "UmacContextImpl.h" |
|
25 #include "umacwharelease.h" |
|
26 |
|
27 #ifndef NDEBUG |
|
28 const TInt8 WlanDot11MacError::iName[] = "dot11-macerror"; |
|
29 #endif // !NDEBUG |
|
30 |
|
31 // ============================ MEMBER FUNCTIONS =============================== |
|
32 |
|
33 // ----------------------------------------------------------------------------- |
|
34 // |
|
35 // ----------------------------------------------------------------------------- |
|
36 // |
|
37 void WlanDot11MacError::Entry( |
|
38 WlanContextImpl& aCtxImpl ) |
|
39 { |
|
40 if ( !(iFlags & KEntryExecuted) ) |
|
41 { |
|
42 iFlags |= KEntryExecuted; |
|
43 |
|
44 // cancel posssible pending timeouts... |
|
45 aCtxImpl.CancelTimer(); |
|
46 aCtxImpl.iUmac.CancelTimeout( EWlanVoiceCallEntryTimer ); |
|
47 aCtxImpl.iUmac.CancelTimeout( EWlanNullTimer ); |
|
48 aCtxImpl.iUmac.CancelTimeout( EWlanNoVoiceTimer ); |
|
49 aCtxImpl.iUmac.CancelTimeout( EWlanKeepAliveTimer ); |
|
50 aCtxImpl.iUmac.CancelTimeout( EWlanActiveToLightPsTimer ); |
|
51 aCtxImpl.iUmac.CancelTimeout( EWlanLightPsToActiveTimer ); |
|
52 aCtxImpl.iUmac.CancelTimeout( EWlanLightPsToDeepPsTimer ); |
|
53 |
|
54 // ... and indicate mac error |
|
55 OnInDicationEvent( aCtxImpl, EHWFailed ); |
|
56 |
|
57 // we also |
|
58 // mark WHA cmd inactive |
|
59 aCtxImpl.DeActivateWsaCmd(); |
|
60 // ... and enable oid requests |
|
61 aCtxImpl.Enable( WlanEventDispatcher::KOidChannel ); |
|
62 // ... to give some slack to the mgmt client to try to complete |
|
63 // whatever it was doing when the error occurred, and then finally |
|
64 // reset the system |
|
65 |
|
66 // complete possibly pending request with an error code |
|
67 OnOidComplete( aCtxImpl, KErrGeneral ); |
|
68 // complete possibly pending mgmt client Tx request |
|
69 OnMgmtPathWriteComplete( aCtxImpl ); |
|
70 } |
|
71 else if ( iFlags & KCompleteOid ) |
|
72 { |
|
73 iFlags &= ~KCompleteOid; |
|
74 OnOidComplete( aCtxImpl ); |
|
75 } |
|
76 } |
|
77 |
|
78 // ----------------------------------------------------------------------------- |
|
79 // |
|
80 // ----------------------------------------------------------------------------- |
|
81 // |
|
82 void WlanDot11MacError::Exit( |
|
83 WlanContextImpl& /*aCtxImpl*/ ) |
|
84 { |
|
85 // nothing to do here |
|
86 } |
|
87 |
|
88 // ----------------------------------------------------------------------------- |
|
89 // |
|
90 // ----------------------------------------------------------------------------- |
|
91 // |
|
92 void WlanDot11MacError::FinitSystem( |
|
93 WlanContextImpl& aCtxImpl ) |
|
94 { |
|
95 // mark oid completion |
|
96 iFlags |= KCompleteOid; |
|
97 // execute transition |
|
98 ChangeState( aCtxImpl, |
|
99 *this, // prev state |
|
100 aCtxImpl.WlanWhaRelease() // next state |
|
101 ); |
|
102 } |
|
103 |
|
104 // ----------------------------------------------------------------------------- |
|
105 // |
|
106 // ----------------------------------------------------------------------------- |
|
107 // |
|
108 void WlanDot11MacError::Indication( |
|
109 WlanContextImpl& /*aCtxImpl*/, |
|
110 WHA::TIndicationId /*aIndicationId*/, |
|
111 const WHA::UIndicationParams& /*aIndicationParams*/ ) |
|
112 { |
|
113 // silently discard WHA indications as we are in error state |
|
114 // there is no point of forwarding them to the layer above |
|
115 } |
|
116 |
|
117 // we have defined handlers for the methods below as it is possible that they |
|
118 // still get called after we have sent the HW Failure indication |
|
119 |
|
120 // ----------------------------------------------------------------------------- |
|
121 // |
|
122 // ----------------------------------------------------------------------------- |
|
123 // |
|
124 TBool WlanDot11MacError::Configure( |
|
125 WlanContextImpl& aCtxImpl, |
|
126 TUint32 /*aRTSThreshold*/, |
|
127 TUint32 /*aMaxTxMSDULifetime*/, |
|
128 TUint32 /*aVoiceCallEntryTimeout*/, |
|
129 TUint32 /*aVoiceCallEntryTxThreshold*/, |
|
130 TUint32 /*aVoiceNullTimeout*/, |
|
131 TUint32 /*aNoVoiceTimeout*/, |
|
132 TUint32 /*aKeepAliveTimeout*/, |
|
133 TUint32 /*aSpRcpiIndicationLevel*/, |
|
134 TUint32 /*aSpTimeToCountPrediction*/, |
|
135 TUint32 /*aSpMinIndicationInterval*/ ) |
|
136 { |
|
137 return CompleteMgmtCommand( aCtxImpl, KErrGeneral ); |
|
138 } |
|
139 |
|
140 // ----------------------------------------------------------------------------- |
|
141 // |
|
142 // ----------------------------------------------------------------------------- |
|
143 // |
|
144 TBool WlanDot11MacError::Connect( |
|
145 WlanContextImpl& aCtxImpl, |
|
146 const TSSID& /*aSSID*/, |
|
147 const TMacAddress& /*aBSSID*/, |
|
148 TUint16 /*aAuthAlgorithmNbr*/, |
|
149 TEncryptionStatus /*aEncryptionStatus*/, |
|
150 TBool /*aIsInfra*/, |
|
151 TUint16 /*aScanResponseFrameBodyLength*/, |
|
152 const TUint8* /*aScanResponseFrameBody*/, |
|
153 const TUint8* /*aIeData*/, |
|
154 TUint16 /*aIeDataLength*/ ) |
|
155 { |
|
156 return CompleteMgmtCommand( aCtxImpl, KErrGeneral ); |
|
157 } |
|
158 |
|
159 // ----------------------------------------------------------------------------- |
|
160 // |
|
161 // ----------------------------------------------------------------------------- |
|
162 // |
|
163 TBool WlanDot11MacError::StartIBSS( |
|
164 WlanContextImpl& aCtxImpl, |
|
165 const TSSID& /*aSSID*/, |
|
166 TUint32 /*aBeaconInterval*/, |
|
167 TUint32 /*aAtim*/, |
|
168 TUint32 /*aChannel*/, |
|
169 TEncryptionStatus /*aEncryptionStatus*/ ) |
|
170 { |
|
171 return CompleteMgmtCommand( aCtxImpl, KErrGeneral ); |
|
172 } |
|
173 |
|
174 // ----------------------------------------------------------------------------- |
|
175 // |
|
176 // ----------------------------------------------------------------------------- |
|
177 // |
|
178 TBool WlanDot11MacError::Scan( |
|
179 WlanContextImpl& aCtxImpl, |
|
180 TScanMode /*aMode*/, |
|
181 const TSSID& /*aSSID*/, |
|
182 TRate /*aScanRate*/, |
|
183 SChannels& /*aChannels*/, |
|
184 TUint32 /*aMinChannelTime*/, |
|
185 TUint32 /*aMaxChannelTime*/, |
|
186 TBool /*aSplitScan*/ ) |
|
187 { |
|
188 return CompleteMgmtCommand( aCtxImpl, KErrGeneral ); |
|
189 } |
|
190 |
|
191 // ----------------------------------------------------------------------------- |
|
192 // |
|
193 // ----------------------------------------------------------------------------- |
|
194 // |
|
195 TBool WlanDot11MacError::StopScan( WlanContextImpl& aCtxImpl ) |
|
196 { |
|
197 return CompleteMgmtCommand( aCtxImpl, KErrNone ); |
|
198 } |
|
199 |
|
200 // ----------------------------------------------------------------------------- |
|
201 // |
|
202 // ----------------------------------------------------------------------------- |
|
203 // |
|
204 TBool WlanDot11MacError::Disconnect( WlanContextImpl& aCtxImpl ) |
|
205 { |
|
206 return CompleteMgmtCommand( aCtxImpl, KErrNone ); |
|
207 } |
|
208 |
|
209 // ----------------------------------------------------------------------------- |
|
210 // |
|
211 // ----------------------------------------------------------------------------- |
|
212 // |
|
213 TBool WlanDot11MacError::SetPowerMode( |
|
214 WlanContextImpl& aCtxImpl, |
|
215 TPowerMode /*aPowerMode*/, |
|
216 TBool /*aDisableDynamicPowerModeManagement*/, |
|
217 TWlanWakeUpInterval /*aWakeupModeInLightPs*/, |
|
218 TUint8 /*aListenIntervalInLightPs*/, |
|
219 TWlanWakeUpInterval /*aWakeupModeInDeepPs*/, |
|
220 TUint8 /*aListenIntervalInDeepPs*/ ) |
|
221 { |
|
222 return CompleteMgmtCommand( aCtxImpl, KErrNone ); |
|
223 } |
|
224 |
|
225 // ----------------------------------------------------------------------------- |
|
226 // |
|
227 // ----------------------------------------------------------------------------- |
|
228 // |
|
229 TBool WlanDot11MacError::SetRcpiTriggerLevel( |
|
230 WlanContextImpl& aCtxImpl, |
|
231 TUint32 /*aRcpiTrigger*/ ) |
|
232 { |
|
233 return CompleteMgmtCommand( aCtxImpl, KErrNone ); |
|
234 } |
|
235 |
|
236 // ----------------------------------------------------------------------------- |
|
237 // |
|
238 // ----------------------------------------------------------------------------- |
|
239 // |
|
240 TBool WlanDot11MacError::GetLastRcpi( |
|
241 WlanContextImpl& aCtxImpl ) |
|
242 { |
|
243 return CompleteMgmtCommand( aCtxImpl, KErrGeneral ); |
|
244 } |
|
245 |
|
246 // ----------------------------------------------------------------------------- |
|
247 // |
|
248 // ----------------------------------------------------------------------------- |
|
249 // |
|
250 TBool WlanDot11MacError::AddTkIPKey( |
|
251 WlanContextImpl& aCtxImpl, |
|
252 const TUint8* /*aData*/, |
|
253 TUint32 /*aLength*/, |
|
254 T802Dot11WepKeyId /*aKeyIndex*/, |
|
255 const TMacAddress& /*aMacAddr*/ ) |
|
256 { |
|
257 return CompleteMgmtCommand( aCtxImpl, KErrNone ); |
|
258 } |
|
259 |
|
260 // ----------------------------------------------------------------------------- |
|
261 // |
|
262 // ----------------------------------------------------------------------------- |
|
263 // |
|
264 TBool WlanDot11MacError::AddMulticastTKIPKey( |
|
265 WlanContextImpl& aCtxImpl, |
|
266 T802Dot11WepKeyId /*aKeyIndex*/, |
|
267 TUint32 /*aLength*/, |
|
268 const TUint8* /*aData*/ ) |
|
269 { |
|
270 return CompleteMgmtCommand( aCtxImpl, KErrNone ); |
|
271 } |
|
272 |
|
273 // ----------------------------------------------------------------------------- |
|
274 // |
|
275 // ----------------------------------------------------------------------------- |
|
276 // |
|
277 TBool WlanDot11MacError::AddAesKey( |
|
278 WlanContextImpl& aCtxImpl, |
|
279 const TUint8* /*aData*/, |
|
280 TUint32 /*aLength*/, |
|
281 const TMacAddress& /*aMacAddr*/ ) |
|
282 { |
|
283 return CompleteMgmtCommand( aCtxImpl, KErrNone ); |
|
284 } |
|
285 |
|
286 // ----------------------------------------------------------------------------- |
|
287 // |
|
288 // ----------------------------------------------------------------------------- |
|
289 // |
|
290 TBool WlanDot11MacError::AddMulticastAesKey( |
|
291 WlanContextImpl& aCtxImpl, |
|
292 T802Dot11WepKeyId /*aKeyIndex*/, |
|
293 TUint32 /*aLength*/, |
|
294 const TUint8* /*aData*/ ) |
|
295 { |
|
296 return CompleteMgmtCommand( aCtxImpl, KErrNone ); |
|
297 } |
|
298 |
|
299 // ----------------------------------------------------------------------------- |
|
300 // |
|
301 // ----------------------------------------------------------------------------- |
|
302 // |
|
303 TBool WlanDot11MacError::AddBroadcastWepKey( |
|
304 WlanContextImpl& aCtxImpl, |
|
305 TUint32 /*aKeyIndex*/, |
|
306 TBool /*aUseAsDefaulKey*/, |
|
307 TUint32 /*aKeyLength*/, |
|
308 const TUint8 /*aKey*/[KMaxWEPKeyLength], |
|
309 const TMacAddress& /*aMac*/ ) |
|
310 { |
|
311 return CompleteMgmtCommand( aCtxImpl, KErrNone ); |
|
312 } |
|
313 |
|
314 // ----------------------------------------------------------------------------- |
|
315 // |
|
316 // ----------------------------------------------------------------------------- |
|
317 // |
|
318 TBool WlanDot11MacError::AddUnicastWepKey( |
|
319 WlanContextImpl& aCtxImpl, |
|
320 const TMacAddress& /*aMacAddr*/, |
|
321 TUint32 /*aKeyLength*/, |
|
322 const TUint8 /*aKey*/[KMaxWEPKeyLength] ) |
|
323 { |
|
324 return CompleteMgmtCommand( aCtxImpl, KErrNone ); |
|
325 } |
|
326 |
|
327 // ----------------------------------------------------------------------------- |
|
328 // |
|
329 // ----------------------------------------------------------------------------- |
|
330 // |
|
331 TBool WlanDot11MacError::AddMulticastWapiKey( |
|
332 WlanContextImpl& aCtxImpl, |
|
333 T802Dot11WepKeyId /*aKeyIndex*/, |
|
334 TUint32 /*aLength*/, |
|
335 const TUint8* /*aData*/ ) |
|
336 { |
|
337 return CompleteMgmtCommand( aCtxImpl, KErrNone ); |
|
338 } |
|
339 |
|
340 // ----------------------------------------------------------------------------- |
|
341 // |
|
342 // ----------------------------------------------------------------------------- |
|
343 // |
|
344 TBool WlanDot11MacError::AddUnicastWapiKey( |
|
345 WlanContextImpl& aCtxImpl, |
|
346 const TUint8* /*aData*/, |
|
347 TUint32 /*aLength*/, |
|
348 T802Dot11WepKeyId /*aKeyIndex*/, |
|
349 const TMacAddress& /*aMacAddr*/ ) |
|
350 { |
|
351 return CompleteMgmtCommand( aCtxImpl, KErrNone ); |
|
352 } |
|
353 |
|
354 // ----------------------------------------------------------------------------- |
|
355 // |
|
356 // ----------------------------------------------------------------------------- |
|
357 // |
|
358 TBool WlanDot11MacError::SetTxPowerLevel( |
|
359 WlanContextImpl& aCtxImpl, |
|
360 TUint32 /*aLevel*/ ) |
|
361 { |
|
362 return CompleteMgmtCommand( aCtxImpl, KErrNone ); |
|
363 } |
|
364 |
|
365 // ----------------------------------------------------------------------------- |
|
366 // |
|
367 // ----------------------------------------------------------------------------- |
|
368 // |
|
369 TBool WlanDot11MacError::AddMulticastAddr( |
|
370 WlanContextImpl& aCtxImpl, |
|
371 const TMacAddress& /*aMacAddr*/ ) |
|
372 { |
|
373 return CompleteMgmtCommand( aCtxImpl, KErrNone ); |
|
374 } |
|
375 |
|
376 // ----------------------------------------------------------------------------- |
|
377 // |
|
378 // ----------------------------------------------------------------------------- |
|
379 // |
|
380 TBool WlanDot11MacError::RemoveMulticastAddr( |
|
381 WlanContextImpl& aCtxImpl, |
|
382 TBool /*aRemoveAll*/, |
|
383 const TMacAddress& /*aMacAddr*/ ) |
|
384 { |
|
385 return CompleteMgmtCommand( aCtxImpl, KErrNone ); |
|
386 } |
|
387 |
|
388 // ----------------------------------------------------------------------------- |
|
389 // |
|
390 // ----------------------------------------------------------------------------- |
|
391 // |
|
392 TBool WlanDot11MacError::ConfigureBssLost( |
|
393 WlanContextImpl& aCtxImpl, |
|
394 TUint32 /*aBeaconLostCount*/, |
|
395 TUint8 /*aFailedTxPacketCount*/ ) |
|
396 { |
|
397 return CompleteMgmtCommand( aCtxImpl, KErrNone ); |
|
398 } |
|
399 |
|
400 // ----------------------------------------------------------------------------- |
|
401 // |
|
402 // ----------------------------------------------------------------------------- |
|
403 // |
|
404 TBool WlanDot11MacError::SetTxRateAdaptParams( |
|
405 WlanContextImpl& aCtxImpl, |
|
406 TUint8 /*aMinStepUpCheckpoint*/, |
|
407 TUint8 /*aMaxStepUpCheckpoint*/, |
|
408 TUint8 /*aStepUpCheckpointFactor*/, |
|
409 TUint8 /*aStepDownCheckpoint*/, |
|
410 TUint8 /*aMinStepUpThreshold*/, |
|
411 TUint8 /*aMaxStepUpThreshold*/, |
|
412 TUint8 /*aStepUpThresholdIncrement*/, |
|
413 TUint8 /*aStepDownThreshold*/, |
|
414 TBool /*aDisableProbeHandling*/ ) |
|
415 { |
|
416 return CompleteMgmtCommand( aCtxImpl, KErrNone ); |
|
417 } |
|
418 |
|
419 // ----------------------------------------------------------------------------- |
|
420 // |
|
421 // ----------------------------------------------------------------------------- |
|
422 // |
|
423 TBool WlanDot11MacError::ConfigureTxRatePolicies( |
|
424 WlanContextImpl& aCtxImpl, |
|
425 const TTxRatePolicy& /*aRatePolicy*/, |
|
426 const TQueue2RateClass& /*aQueue2RateClass*/, |
|
427 const TInitialMaxTxRate4RateClass& /*aInitialMaxTxRate4RateClass*/, |
|
428 const TTxAutoRatePolicy& /*aAutoRatePolicy*/, |
|
429 const THtMcsPolicy& /*aHtMcsPolicy*/ ) |
|
430 { |
|
431 return CompleteMgmtCommand( aCtxImpl, KErrNone ); |
|
432 } |
|
433 |
|
434 // ----------------------------------------------------------------------------- |
|
435 // |
|
436 // ----------------------------------------------------------------------------- |
|
437 // |
|
438 TBool WlanDot11MacError::GetFrameStatistics( WlanContextImpl& aCtxImpl ) |
|
439 { |
|
440 return CompleteMgmtCommand( aCtxImpl, KErrGeneral ); |
|
441 } |
|
442 |
|
443 // ----------------------------------------------------------------------------- |
|
444 // |
|
445 // ----------------------------------------------------------------------------- |
|
446 // |
|
447 TBool WlanDot11MacError::ConfigureTxQueueIfNecessary( |
|
448 WlanContextImpl& aCtxImpl, |
|
449 TQueueId /*aQueueId*/, |
|
450 TUint16 /*aMediumTime*/, |
|
451 TUint32 /*aMaxTxMSDULifetime*/ ) |
|
452 { |
|
453 return CompleteMgmtCommand( aCtxImpl, KErrNone ); |
|
454 } |
|
455 |
|
456 // ----------------------------------------------------------------------------- |
|
457 // |
|
458 // ----------------------------------------------------------------------------- |
|
459 // |
|
460 TBool WlanDot11MacError::GetMacAddress( WlanContextImpl& aCtxImpl ) |
|
461 { |
|
462 return CompleteMgmtCommand( aCtxImpl, KErrGeneral ); |
|
463 } |
|
464 |
|
465 // ----------------------------------------------------------------------------- |
|
466 // |
|
467 // ----------------------------------------------------------------------------- |
|
468 // |
|
469 TBool WlanDot11MacError::ConfigureArpIpAddressFiltering( |
|
470 WlanContextImpl& aCtxImpl, |
|
471 TBool /*aEnableFiltering*/, |
|
472 TIpv4Address /*aIpv4Address*/ ) |
|
473 { |
|
474 return CompleteMgmtCommand( aCtxImpl, KErrNone ); |
|
475 } |
|
476 |
|
477 // ----------------------------------------------------------------------------- |
|
478 // |
|
479 // ----------------------------------------------------------------------------- |
|
480 // |
|
481 TBool WlanDot11MacError::ConfigureHtBlockAck( |
|
482 WlanContextImpl& aCtxImpl, |
|
483 TUint8 /*aTxBlockAckUsage*/, |
|
484 TUint8 /*aRxBlockAckUsage*/ ) |
|
485 { |
|
486 return CompleteMgmtCommand( aCtxImpl, KErrNone ); |
|
487 } |
|
488 |
|
489 #ifndef NDEBUG |
|
490 // ----------------------------------------------------------------------------- |
|
491 // |
|
492 // ----------------------------------------------------------------------------- |
|
493 // |
|
494 const TInt8* WlanDot11MacError::GetStateName( |
|
495 TUint8& aLength ) const |
|
496 { |
|
497 aLength = sizeof( iName ); |
|
498 return iName; |
|
499 } |
|
500 #endif |
|
501 |
|
502 // ----------------------------------------------------------------------------- |
|
503 // |
|
504 // ----------------------------------------------------------------------------- |
|
505 // |
|
506 TBool WlanDot11MacError::CompleteMgmtCommand( |
|
507 WlanContextImpl& aCtxImpl, |
|
508 TInt aStatus ) |
|
509 { |
|
510 OnOidComplete( aCtxImpl, aStatus ); |
|
511 // signal caller that no state transition ocurred |
|
512 return EFalse; |
|
513 } |