|
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: Interface to drivers |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <wlanhwinit.h> |
|
20 #include "wlanlddcommon.h" |
|
21 |
|
22 #include "am_debug.h" |
|
23 #include "wlmdriverif.h" |
|
24 #include "wlanmgmtcommandhandler.h" |
|
25 #include "wlanmgmtframehandler.h" |
|
26 #include "wlannotificationhandler.h" |
|
27 #include "wlanconversionutil.h" |
|
28 #include "abs_core_driverif_callback.h" |
|
29 |
|
30 #define PDD_FILE_NAME _L("wlanpdd") |
|
31 #define PDD_NAME _L("wlan.phys") |
|
32 |
|
33 // ============================ MEMBER FUNCTIONS =============================== |
|
34 |
|
35 // ----------------------------------------------------------------------------- |
|
36 // CWlmDriverIf::CWlmDriverIf |
|
37 // C++ default constructor can NOT contain any code, that |
|
38 // might leave. |
|
39 // ----------------------------------------------------------------------------- |
|
40 // |
|
41 CWlmDriverIf::CWlmDriverIf() : |
|
42 iCoreServer( NULL ), |
|
43 iPendingRequestId( 0 ), |
|
44 iNotificationHandler( NULL ), |
|
45 iManagementCommandHandler( NULL ), |
|
46 iManagementFrameHandler( NULL ), |
|
47 iAsynchCallback( NULL ), |
|
48 iErrorStatus( core_error_ok ), |
|
49 iHwInit( NULL ), |
|
50 iIsPDDLoaded( EFalse ), |
|
51 iIsLDDLoaded( EFalse ), |
|
52 iManagementStatus( NULL ) |
|
53 { |
|
54 DEBUG( "CWlmDriverIf::CWlmDriverIf()" ); |
|
55 } |
|
56 |
|
57 // ----------------------------------------------------------------------------- |
|
58 // CWlmDriverIf::NewL |
|
59 // Two-phased constructor. |
|
60 // ----------------------------------------------------------------------------- |
|
61 // |
|
62 CWlmDriverIf* CWlmDriverIf::NewL() |
|
63 { |
|
64 DEBUG( "CWlmDriverIf::NewL()" ); |
|
65 CWlmDriverIf* self = new(ELeave) CWlmDriverIf(); |
|
66 CleanupStack::PushL( self ); |
|
67 self->ConstructL(); |
|
68 CleanupStack::Pop( self ); |
|
69 return self; |
|
70 } |
|
71 |
|
72 // ----------------------------------------------------------------------------- |
|
73 // CWlmDriverIf::ConstructL |
|
74 // Symbian 2nd phase constructor can leave. |
|
75 // ----------------------------------------------------------------------------- |
|
76 // |
|
77 void CWlmDriverIf::ConstructL() |
|
78 { |
|
79 DEBUG( "CWlmDriverIf::ConstructL()" ); |
|
80 |
|
81 // Instantiate handlers |
|
82 iManagementCommandHandler = CWlanMgmtCommandHandler::NewL( iChannel, *this ); |
|
83 iManagementFrameHandler = CWlanMgmtFrameHandler::NewL( iChannel, *this ); |
|
84 iNotificationHandler = CWlanNotificationHandler::NewL( iChannel, *this ); |
|
85 // Instantiate asynch callback provider |
|
86 // (mainly for error situations) |
|
87 TCallBack callback( AsynchCallbackFunction, this ); |
|
88 iAsynchCallback = new(ELeave) CAsyncCallBack( |
|
89 callback, CActive::EPriorityStandard ); |
|
90 iHwInit = CWlanHwInit::NewL(); |
|
91 } |
|
92 |
|
93 // Destructor |
|
94 CWlmDriverIf::~CWlmDriverIf() |
|
95 { |
|
96 DEBUG( "CWlmDriverIf::~CWlmDriverIf()" ); |
|
97 delete iAsynchCallback; |
|
98 delete iHwInit; |
|
99 delete iManagementCommandHandler; |
|
100 delete iManagementFrameHandler; |
|
101 delete iNotificationHandler; |
|
102 iCoreServer = NULL; |
|
103 iManagementStatus = NULL; |
|
104 } |
|
105 |
|
106 // ----------------------------------------------------------------------------- |
|
107 // CWlmDriverIf::init |
|
108 // ----------------------------------------------------------------------------- |
|
109 // |
|
110 void CWlmDriverIf::init( |
|
111 abs_core_driverif_callback_c* core_callback ) |
|
112 { |
|
113 iCoreServer = core_callback; |
|
114 } |
|
115 |
|
116 // ----------------------------------------------------------------------------- |
|
117 // CWlmDriverIf::load_drivers |
|
118 // ----------------------------------------------------------------------------- |
|
119 // |
|
120 void CWlmDriverIf::load_drivers( |
|
121 u32_t request_id, |
|
122 uint_t rts_threshold, |
|
123 u32_t max_tx_msdu_lifetime, |
|
124 u32_t qos_null_frame_entry_timeout, |
|
125 u32_t qos_null_frame_entry_tx_count, |
|
126 u32_t qos_null_frame_interval, |
|
127 u32_t qos_null_frame_exit_timeout, |
|
128 u32_t keep_alive_interval, |
|
129 u32_t sp_rcpi_target, |
|
130 u32_t sp_time_target, |
|
131 u32_t sp_min_indication_interval ) |
|
132 { |
|
133 DEBUG( "CWlmDriverIf::load_drivers()" ); |
|
134 |
|
135 // Set request id and ensure no prior requests are pending |
|
136 if( SetRequestId( request_id ) ) |
|
137 { |
|
138 ASSERT( false_t ); |
|
139 return; |
|
140 } |
|
141 |
|
142 // Buffer for initialization data |
|
143 const TUint8* pdaData = NULL; |
|
144 TUint pdaDataLength( 0 ); |
|
145 // Buffer for firmware data |
|
146 const TUint8* fwData = NULL; |
|
147 TUint fwDataLength( 0 ); |
|
148 // Get the data from CMT |
|
149 iHwInit->GetHwInitData( &pdaData, pdaDataLength, &fwData, fwDataLength ); |
|
150 |
|
151 // Load physical device |
|
152 DEBUG( "- loading PDD" ); |
|
153 TInt err = KErrNone; |
|
154 err = User::LoadPhysicalDevice( PDD_FILE_NAME ); |
|
155 if( ( err != KErrNone ) && ( err != KErrAlreadyExists ) ) |
|
156 { |
|
157 DEBUG1("ERROR: PDD loading failed with %d", err ); |
|
158 UnloadDrivers(); |
|
159 iErrorStatus = core_error_drivers_not_loaded; |
|
160 iAsynchCallback->CallBack(); |
|
161 return; |
|
162 } |
|
163 iIsPDDLoaded = ETrue; |
|
164 |
|
165 // Load logical device |
|
166 DEBUG( "- loading LDD" ); |
|
167 err = User::LoadLogicalDevice( LDD_FILE_NAME ); |
|
168 if( ( err != KErrNone ) && ( err != KErrAlreadyExists ) ) |
|
169 { |
|
170 DEBUG1("ERROR: LDD loading failed with %d", err ); |
|
171 UnloadDrivers(); |
|
172 iErrorStatus = core_error_drivers_not_loaded; |
|
173 iAsynchCallback->CallBack(); |
|
174 return; |
|
175 } |
|
176 iIsLDDLoaded = ETrue; |
|
177 |
|
178 // Open logical channel |
|
179 DEBUG( "- Open logical channel" ); |
|
180 TOpenParam openParam; |
|
181 openParam.iPda = const_cast<TUint8*>( pdaData ); |
|
182 openParam.iPdaLength = pdaDataLength; |
|
183 openParam.iFirmWare = const_cast<TUint8*>( fwData ); |
|
184 openParam.iFirmWareLength = fwDataLength; |
|
185 err = iChannel.Open( KUnitWlan, openParam ); |
|
186 if( err ) |
|
187 { |
|
188 DEBUG1("ERROR: Opening channel failed with %d", err ); |
|
189 UnloadDrivers(); |
|
190 iErrorStatus = core_error_drivers_not_loaded; |
|
191 iAsynchCallback->CallBack(); |
|
192 return; |
|
193 } |
|
194 |
|
195 // Activate handlers |
|
196 DEBUG( "- Activate handlers" ); |
|
197 if( iNotificationHandler->IsActive() || |
|
198 iNotificationHandler->Start() ) |
|
199 { |
|
200 DEBUG("ERROR starting notification handler"); |
|
201 UnloadDrivers(); |
|
202 iErrorStatus = core_error_drivers_not_loaded; |
|
203 iAsynchCallback->CallBack(); |
|
204 return; |
|
205 } |
|
206 if( iManagementFrameHandler->IsActive() || |
|
207 iManagementFrameHandler->Start() ) |
|
208 { |
|
209 DEBUG("ERROR starting management frame handler"); |
|
210 UnloadDrivers(); |
|
211 iErrorStatus = core_error_drivers_not_loaded; |
|
212 iAsynchCallback->CallBack(); |
|
213 return; |
|
214 } |
|
215 |
|
216 // Configure drivers |
|
217 iManagementCommandHandler->Configure( |
|
218 static_cast<u16_t>( rts_threshold ), |
|
219 max_tx_msdu_lifetime, |
|
220 qos_null_frame_entry_timeout, |
|
221 qos_null_frame_entry_tx_count, |
|
222 qos_null_frame_interval, |
|
223 qos_null_frame_exit_timeout, |
|
224 keep_alive_interval, |
|
225 sp_rcpi_target, |
|
226 sp_time_target, |
|
227 sp_min_indication_interval ); |
|
228 } |
|
229 |
|
230 // ----------------------------------------------------------------------------- |
|
231 // CWlmDriverIf::unload_drivers |
|
232 // ----------------------------------------------------------------------------- |
|
233 // |
|
234 void CWlmDriverIf::unload_drivers( u32_t request_id ) |
|
235 { |
|
236 DEBUG( "CWlmDriverIf::unload_drivers()" ); |
|
237 |
|
238 // Set request id and ensure no prior requests are pending |
|
239 if( SetRequestId( request_id ) ) |
|
240 { |
|
241 ASSERT( false_t ); |
|
242 return; |
|
243 } |
|
244 |
|
245 // Unloading is actually asynchronous |
|
246 UnloadDrivers(); |
|
247 |
|
248 // Order a callback |
|
249 iErrorStatus = core_error_ok; |
|
250 iAsynchCallback->CallBack(); |
|
251 } |
|
252 |
|
253 // ----------------------------------------------------------------------------- |
|
254 // CWlmDriverIf::UnloadDrivers |
|
255 // ----------------------------------------------------------------------------- |
|
256 // |
|
257 void CWlmDriverIf::UnloadDrivers() |
|
258 { |
|
259 DEBUG( "CWlmDriverIf::UnloadDrivers()" ); |
|
260 // Cancel notification and management frame observations |
|
261 if( iNotificationHandler->IsActive() ) |
|
262 { |
|
263 DEBUG( "- cancelling iNotificationHandler" ); |
|
264 iNotificationHandler->Stop(); |
|
265 } |
|
266 if( iManagementFrameHandler->IsActive() ) |
|
267 { |
|
268 DEBUG( "- cancelling iManagementFrameHandler" ); |
|
269 iManagementFrameHandler->Stop(); |
|
270 } |
|
271 |
|
272 TInt err( KErrNone ); |
|
273 if( iIsLDDLoaded ) |
|
274 { |
|
275 DEBUG( "- closing logical channel" ); |
|
276 iChannel.CloseChannel(); |
|
277 err = User::FreeLogicalDevice( LDD_NAME ); |
|
278 iIsLDDLoaded = EFalse; |
|
279 if ( err != KErrNone ) |
|
280 { |
|
281 DEBUG1( "ERROR: FreeLogicalDevice() failed with %d", err ); |
|
282 } |
|
283 } |
|
284 |
|
285 if( iIsPDDLoaded ) |
|
286 { |
|
287 err = User::FreePhysicalDevice( PDD_NAME ); |
|
288 iIsPDDLoaded = EFalse; |
|
289 if ( err != KErrNone ) |
|
290 { |
|
291 DEBUG1( "ERROR: FreePhysicalDevice() failed with %d", err ); |
|
292 } |
|
293 } |
|
294 DEBUG( "- UnloadDrivers DONE" ); |
|
295 } |
|
296 |
|
297 // ----------------------------------------------------------------------------- |
|
298 // CWlmDriverIf::start_ibss |
|
299 // ----------------------------------------------------------------------------- |
|
300 // |
|
301 void CWlmDriverIf::start_ibss( |
|
302 u32_t request_id, |
|
303 const core_ssid_s& ssid, |
|
304 u32_t beacon_interval, |
|
305 u32_t channel, |
|
306 core_encryption_mode_e encrypt_level ) |
|
307 { |
|
308 DEBUG( "CWlmDriverIf::start_ibss()" ); |
|
309 |
|
310 // Set request id and ensure no prior requests are pending |
|
311 if( SetRequestId( request_id ) ) |
|
312 { |
|
313 ASSERT( false_t ); |
|
314 return; |
|
315 } |
|
316 |
|
317 TSSID id; |
|
318 TWlanConversionUtil::ConvertSSID( id, ssid ); |
|
319 iManagementCommandHandler->StartIBSS( |
|
320 id, |
|
321 beacon_interval, |
|
322 channel, |
|
323 TWlanConversionUtil::ConvertEncryptionMode( encrypt_level ) ); |
|
324 } |
|
325 |
|
326 // ----------------------------------------------------------------------------- |
|
327 // CWlmDriverIf::scan |
|
328 // ----------------------------------------------------------------------------- |
|
329 // |
|
330 void CWlmDriverIf::scan( |
|
331 u32_t request_id, |
|
332 core_scan_mode_e scan_mode, |
|
333 const core_ssid_s& scan_ssid, |
|
334 int_t scan_rate, |
|
335 const core_scan_channels_s& scan_channels, |
|
336 u32_t scan_min_ch_time, |
|
337 u32_t scan_max_ch_time, |
|
338 bool_t is_split_scan ) |
|
339 { |
|
340 DEBUG( "CWlmDriverIf::scan()" ); |
|
341 |
|
342 // Set request id and ensure no prior requests are pending |
|
343 if( SetRequestId( request_id ) ) |
|
344 { |
|
345 ASSERT( false_t ); |
|
346 return; |
|
347 } |
|
348 |
|
349 // Convert needed parameters |
|
350 TSSID id; |
|
351 TWlanConversionUtil::ConvertSSID( id, scan_ssid ); |
|
352 TScanMode scanmode = TWlanConversionUtil::ConvertScanMode( scan_mode ); |
|
353 TRate rate = TWlanConversionUtil::ConvertScanRate( scan_rate ); |
|
354 SChannels channels; |
|
355 TWlanConversionUtil::ConvertScanChannels( channels, scan_channels ); |
|
356 |
|
357 // Send command to commandhandler |
|
358 iManagementCommandHandler->Scan( |
|
359 scanmode, |
|
360 id, |
|
361 rate, |
|
362 channels, |
|
363 scan_min_ch_time, |
|
364 scan_max_ch_time, |
|
365 is_split_scan ); |
|
366 } |
|
367 |
|
368 // ----------------------------------------------------------------------------- |
|
369 // CWlmDriverIf::stop_scan |
|
370 // ----------------------------------------------------------------------------- |
|
371 // |
|
372 void CWlmDriverIf::stop_scan( |
|
373 u32_t request_id ) |
|
374 { |
|
375 DEBUG( "CWlmDriverIf::stop_scan()" ); |
|
376 |
|
377 // Set request id and ensure no prior requests are pending |
|
378 if( SetRequestId( request_id ) ) |
|
379 { |
|
380 ASSERT( false_t ); |
|
381 return; |
|
382 } |
|
383 |
|
384 // Send command to commandhandler |
|
385 iManagementCommandHandler->StopScan(); |
|
386 } |
|
387 |
|
388 // ----------------------------------------------------------------------------- |
|
389 // CWlmDriverIf::disconnect |
|
390 // ----------------------------------------------------------------------------- |
|
391 // |
|
392 void CWlmDriverIf::disconnect( u32_t request_id ) |
|
393 { |
|
394 DEBUG( "CWlmDriverIf::disconnect()" ); |
|
395 |
|
396 // Set request id and ensure no prior requests are pending |
|
397 if( SetRequestId( request_id ) ) |
|
398 { |
|
399 ASSERT( false_t ); |
|
400 return; |
|
401 } |
|
402 |
|
403 iManagementCommandHandler->Disconnect(); |
|
404 } |
|
405 |
|
406 // ----------------------------------------------------------------------------- |
|
407 // CWlmDriverIf::set_power_mode |
|
408 // ----------------------------------------------------------------------------- |
|
409 // |
|
410 void CWlmDriverIf::set_power_mode( |
|
411 u32_t request_id, |
|
412 const core_power_mode_s& mode ) |
|
413 { |
|
414 DEBUG( "CWlmDriverIf::set_power_mode()" ); |
|
415 |
|
416 // Set request id and ensure no prior requests are pending |
|
417 if( SetRequestId( request_id ) ) |
|
418 { |
|
419 ASSERT( false_t ); |
|
420 return; |
|
421 } |
|
422 |
|
423 TPowerMode amMode( EPowerModeCam ); |
|
424 TWlanWakeUpInterval amWakeUpModeLight( EWakeUpIntervalAllBeacons ); |
|
425 TUint8 amWakeUpIntervalLight( 0 ); |
|
426 TWlanWakeUpInterval amWakeUpModeDeep( EWakeUpIntervalAllDtims ); |
|
427 TUint8 amWakeUpIntervalDeep( 0 ); |
|
428 |
|
429 amMode = TWlanConversionUtil::ConvertPowerMode( |
|
430 mode.mode ); |
|
431 TWlanConversionUtil::ConvertWakeUpInterval( |
|
432 amWakeUpModeLight, |
|
433 amWakeUpIntervalLight, |
|
434 mode.wakeup_mode_light, |
|
435 mode.wakeup_interval_light ); |
|
436 TWlanConversionUtil::ConvertWakeUpInterval( |
|
437 amWakeUpModeDeep, |
|
438 amWakeUpIntervalDeep, |
|
439 mode.wakeup_mode_deep, |
|
440 mode.wakeup_interval_deep ); |
|
441 |
|
442 iManagementCommandHandler->SetPowerMode( |
|
443 amMode, |
|
444 mode.disable_dynamic_ps, |
|
445 amWakeUpModeLight, |
|
446 amWakeUpIntervalLight, |
|
447 amWakeUpModeDeep, |
|
448 amWakeUpIntervalDeep ); |
|
449 } |
|
450 |
|
451 // ----------------------------------------------------------------------------- |
|
452 // CWlmDriverIf::set_tx_power_level |
|
453 // ----------------------------------------------------------------------------- |
|
454 // |
|
455 void CWlmDriverIf::set_tx_power_level( |
|
456 u32_t request_id, |
|
457 u32_t tx_level ) |
|
458 { |
|
459 DEBUG( "CWlmDriverIf::set_tx_power_level()" ); |
|
460 |
|
461 // Set request id and ensure no prior requests are pending |
|
462 if( SetRequestId( request_id ) ) |
|
463 { |
|
464 ASSERT( false_t ); |
|
465 return; |
|
466 } |
|
467 |
|
468 // Send command to commandhandler |
|
469 iManagementCommandHandler->SetTxPowerLevel( tx_level ); |
|
470 } |
|
471 |
|
472 // ----------------------------------------------------------------------------- |
|
473 // CWlmDriverIf::add_cipher_key |
|
474 // ----------------------------------------------------------------------------- |
|
475 // |
|
476 void CWlmDriverIf::add_cipher_key( |
|
477 core_cipher_key_type_e cipher_suite, |
|
478 u8_t key_index, |
|
479 u16_t key_length, |
|
480 const u8_t* key_data, |
|
481 const core_mac_address_s& mac, |
|
482 bool_t use_as_default ) |
|
483 { |
|
484 DEBUG( "CWlmDriverIf::add_cipher_key()" ); |
|
485 |
|
486 TMacAddress macAddr; |
|
487 TWlanConversionUtil::ConvertMacAddress( macAddr, mac ); |
|
488 |
|
489 iManagementCommandHandler->AddCipherKey( |
|
490 TWlanConversionUtil::ConvertCipherKeyType( cipher_suite ), |
|
491 key_index, // no conversion needed |
|
492 static_cast<TUint32>( key_length ), // u16_t -> TUint32 |
|
493 key_data, // no conversion needed |
|
494 macAddr, |
|
495 use_as_default ); |
|
496 } |
|
497 |
|
498 // ----------------------------------------------------------------------------- |
|
499 // CWlmDriverIf::get_current_rcpi |
|
500 // ----------------------------------------------------------------------------- |
|
501 // |
|
502 void CWlmDriverIf::get_current_rcpi( |
|
503 u32_t request_id, |
|
504 u32_t& rcpi ) |
|
505 { |
|
506 // Set request id and ensure no prior requests are pending |
|
507 if( SetRequestId( request_id ) ) |
|
508 { |
|
509 ASSERT( false_t ); |
|
510 return; |
|
511 } |
|
512 |
|
513 DEBUG( "CWlmDriverIf::get_last_rcpi()" ); |
|
514 iManagementCommandHandler->GetLastRCPI( |
|
515 rcpi ); // no conversion needed |
|
516 } |
|
517 |
|
518 // ----------------------------------------------------------------------------- |
|
519 // CWlmDriverIf::configure_multicast_group |
|
520 // ----------------------------------------------------------------------------- |
|
521 // |
|
522 void CWlmDriverIf::configure_multicast_group( |
|
523 u32_t request_id, |
|
524 bool_t join_group, |
|
525 const core_mac_address_s& multicast_addr ) |
|
526 { |
|
527 // Set request id and ensure no prior requests are pending |
|
528 if( SetRequestId( request_id ) ) |
|
529 { |
|
530 ASSERT( false_t ); |
|
531 return; |
|
532 } |
|
533 |
|
534 DEBUG( "CWlmDriverIf::configure_multicast_group()" ); |
|
535 TMacAddress mac; |
|
536 TWlanConversionUtil::ConvertMacAddress( mac, multicast_addr ); |
|
537 iManagementCommandHandler->ConfigureMulticastGroup( |
|
538 join_group, |
|
539 mac ); |
|
540 } |
|
541 |
|
542 // ----------------------------------------------------------------------------- |
|
543 // CWlmDriverIf::set_bss_lost_parameters |
|
544 // ----------------------------------------------------------------------------- |
|
545 // |
|
546 void CWlmDriverIf::set_bss_lost_parameters( |
|
547 u32_t request_id, |
|
548 const core_bss_lost_parameters_s& parameters ) |
|
549 { |
|
550 DEBUG( "CWlmDriverIf::set_bss_lost_parameters()" ); |
|
551 |
|
552 // Set request id and ensure no prior requests are pending |
|
553 if( SetRequestId( request_id ) ) |
|
554 { |
|
555 ASSERT( false_t ); |
|
556 return; |
|
557 } |
|
558 |
|
559 iManagementCommandHandler->SetBssLostParameters( |
|
560 parameters.beacon_lost_count, |
|
561 parameters.failed_tx_packet_count ); |
|
562 } |
|
563 |
|
564 // ----------------------------------------------------------------------------- |
|
565 // CWlmDriverIf::set_tx_rate_adaptation_parameters |
|
566 // ----------------------------------------------------------------------------- |
|
567 // |
|
568 void CWlmDriverIf::set_tx_rate_adaptation_parameters( |
|
569 u32_t request_id, |
|
570 const core_tx_rate_adaptation_parameters_s& parameters ) |
|
571 { |
|
572 DEBUG( "CWlmDriverIf::set_tx_rate_adaptation_parameters()" ); |
|
573 |
|
574 // Set request id and ensure no prior requests are pending |
|
575 if( SetRequestId( request_id ) ) |
|
576 { |
|
577 ASSERT( false_t ); |
|
578 return; |
|
579 } |
|
580 |
|
581 iManagementCommandHandler->SetTxRateAdaptationParameters( |
|
582 parameters.min_stepup_checkpoint, |
|
583 parameters.max_stepup_checkpoint, |
|
584 parameters.stepup_checkpoint_factor, |
|
585 parameters.stepdown_checkpoint, |
|
586 parameters.min_stepup_threshold, |
|
587 parameters.max_stepup_threshold, |
|
588 parameters.stepup_threshold_increment, |
|
589 parameters.stepdown_threshold, |
|
590 parameters.disable_probe_handling ); |
|
591 } |
|
592 |
|
593 // ----------------------------------------------------------------------------- |
|
594 // CWlmDriverIf::set_power_mode_mgmt_parameters |
|
595 // ----------------------------------------------------------------------------- |
|
596 // |
|
597 void CWlmDriverIf::set_power_mode_mgmt_parameters( |
|
598 u32_t request_id, |
|
599 const core_power_mode_mgmt_parameters_s& parameters ) |
|
600 { |
|
601 DEBUG( "CWlmDriverIf::set_power_mode_mgmt_parameters()" ); |
|
602 |
|
603 // Set request id and ensure no prior requests are pending |
|
604 if( SetRequestId( request_id ) ) |
|
605 { |
|
606 ASSERT( false_t ); |
|
607 return; |
|
608 } |
|
609 |
|
610 iManagementCommandHandler->SetPowerModeMgmtParameters( |
|
611 parameters.active_to_light_timeout, |
|
612 parameters.active_to_light_threshold, |
|
613 parameters.light_to_active_timeout, |
|
614 parameters.light_to_active_threshold, |
|
615 parameters.light_to_deep_timeout, |
|
616 parameters.light_to_deep_threshold, |
|
617 parameters.uapsd_rx_frame_length_threshold ); |
|
618 } |
|
619 |
|
620 // ----------------------------------------------------------------------------- |
|
621 // CWlmDriverIf::set_tx_rate_policies |
|
622 // ----------------------------------------------------------------------------- |
|
623 // |
|
624 void CWlmDriverIf::set_tx_rate_policies( |
|
625 u32_t request_id, |
|
626 const core_tx_rate_policies_s& policies, |
|
627 const core_tx_rate_policy_mappings_s& mappings ) |
|
628 { |
|
629 DEBUG( "CWlmDriverIf::set_tx_rate_policies()" ); |
|
630 |
|
631 // Set request id and ensure no prior requests are pending |
|
632 if( SetRequestId( request_id ) ) |
|
633 { |
|
634 ASSERT( false_t ); |
|
635 return; |
|
636 } |
|
637 |
|
638 TTxRatePolicy amPolicies; |
|
639 THtMcsPolicy amMcsPolicies; |
|
640 TTxAutoRatePolicy amAutoRatePolicies; |
|
641 TWlanConversionUtil::ConvertTxRatePolicies( amPolicies, amMcsPolicies, amAutoRatePolicies, policies ); |
|
642 TQueue2RateClass amMappings; |
|
643 TWlanConversionUtil::ConvertTxRatePolicyMappings( amMappings, mappings ); |
|
644 TInitialMaxTxRate4RateClass amInitialRates; |
|
645 TWlanConversionUtil::ConvertTxRatePolicyInitialRates( amInitialRates, policies ); |
|
646 |
|
647 iManagementCommandHandler->SetTxRatePolicies( |
|
648 amPolicies, |
|
649 amMcsPolicies, |
|
650 amMappings, |
|
651 amInitialRates, |
|
652 amAutoRatePolicies ); |
|
653 } |
|
654 |
|
655 // ----------------------------------------------------------------------------- |
|
656 // CWlmDriverIf::get_packet_statistics |
|
657 // ----------------------------------------------------------------------------- |
|
658 // |
|
659 void CWlmDriverIf::get_packet_statistics( |
|
660 u32_t request_id, |
|
661 core_packet_statistics_by_access_category_s& statistics ) |
|
662 { |
|
663 DEBUG( "CWlmDriverIf::get_packet_statistics()" ); |
|
664 |
|
665 // Set request id and ensure no prior requests are pending |
|
666 if( SetRequestId( request_id ) ) |
|
667 { |
|
668 ASSERT( false_t ); |
|
669 return; |
|
670 } |
|
671 |
|
672 iManagementCommandHandler->GetPacketStatistics( |
|
673 reinterpret_cast<TStatisticsResponse&>( statistics ) ); |
|
674 } |
|
675 |
|
676 // ----------------------------------------------------------------------------- |
|
677 // CWlmDriverIf::set_uapsd_settings |
|
678 // ----------------------------------------------------------------------------- |
|
679 // |
|
680 void CWlmDriverIf::set_uapsd_settings( |
|
681 u32_t request_id, |
|
682 const core_uapsd_settings_s& settings ) |
|
683 { |
|
684 DEBUG( "CWlmDriverIf::set_uapsd_settings()" ); |
|
685 |
|
686 // Set request id and ensure no prior requests are pending |
|
687 if( SetRequestId( request_id ) ) |
|
688 { |
|
689 ASSERT( false_t ); |
|
690 return; |
|
691 } |
|
692 |
|
693 iManagementCommandHandler->SetUapsdSettings( |
|
694 TWlanConversionUtil::ConvertUapsdMaxServicePeriod( settings.max_service_period ), |
|
695 settings.uapsd_enabled_for_voice, |
|
696 settings.uapsd_enabled_for_video, |
|
697 settings.uapsd_enabled_for_best_effort, |
|
698 settings.uapsd_enabled_for_background ); |
|
699 } |
|
700 |
|
701 // ----------------------------------------------------------------------------- |
|
702 // CWlmDriverIf::set_power_save_settings |
|
703 // ----------------------------------------------------------------------------- |
|
704 // |
|
705 void CWlmDriverIf::set_power_save_settings( |
|
706 u32_t request_id, |
|
707 const core_power_save_settings_s& settings ) |
|
708 { |
|
709 DEBUG( "CWlmDriverIf::set_power_save_settings()" ); |
|
710 |
|
711 // Set request id and ensure no prior requests are pending |
|
712 if( SetRequestId( request_id ) ) |
|
713 { |
|
714 ASSERT( false_t ); |
|
715 return; |
|
716 } |
|
717 |
|
718 iManagementCommandHandler->SetPowerSaveSettings( |
|
719 settings.stay_in_uapsd_power_save_for_voice, |
|
720 settings.stay_in_uapsd_power_save_for_video, |
|
721 settings.stay_in_uapsd_power_save_for_best_effort, |
|
722 settings.stay_in_uapsd_power_save_for_background, |
|
723 settings.stay_in_legacy_power_save_for_voice, |
|
724 settings.stay_in_legacy_power_save_for_video, |
|
725 settings.stay_in_legacy_power_save_for_best_effort, |
|
726 settings.stay_in_legacy_power_save_for_background ); |
|
727 } |
|
728 |
|
729 // ----------------------------------------------------------------------------- |
|
730 // CWlmDriverIf::set_tx_queue_parameters |
|
731 // ----------------------------------------------------------------------------- |
|
732 // |
|
733 void CWlmDriverIf::set_tx_queue_parameters( |
|
734 u32_t request_id, |
|
735 core_access_class_e queue_id, |
|
736 u16_t medium_time, |
|
737 u32_t max_tx_msdu_lifetime ) |
|
738 { |
|
739 DEBUG( "CWlmDriverIf::set_tx_queue_parameters()" ); |
|
740 |
|
741 // Set request id and ensure no prior requests are pending |
|
742 if( SetRequestId( request_id ) ) |
|
743 { |
|
744 ASSERT( false_t ); |
|
745 return; |
|
746 } |
|
747 |
|
748 iManagementCommandHandler->SetTxQueueParameters( |
|
749 TWlanConversionUtil::ConvertTxQueueId( queue_id ), |
|
750 medium_time, |
|
751 max_tx_msdu_lifetime ); |
|
752 } |
|
753 |
|
754 // ----------------------------------------------------------------------------- |
|
755 // CWlmDriverIf::set_rcpi_trigger_level |
|
756 // ----------------------------------------------------------------------------- |
|
757 // |
|
758 void CWlmDriverIf::set_rcpi_trigger_level( |
|
759 u32_t request_id, |
|
760 u8_t rcpi_trigger ) |
|
761 { |
|
762 // Set request id and ensure no prior requests are pending |
|
763 if( SetRequestId( request_id ) ) |
|
764 { |
|
765 ASSERT( false_t ); |
|
766 return; |
|
767 } |
|
768 |
|
769 iManagementCommandHandler->SetRcpiTriggerLevel( rcpi_trigger ); |
|
770 } |
|
771 |
|
772 // ----------------------------------------------------------------------------- |
|
773 // CWlmDriverIf::enable_user_data |
|
774 // ----------------------------------------------------------------------------- |
|
775 // |
|
776 void CWlmDriverIf::enable_user_data( u32_t request_id ) |
|
777 { |
|
778 DEBUG( "CWlmDriverIf::enable_user_data()" ); |
|
779 |
|
780 // Set request id and ensure no prior requests are pending |
|
781 if( SetRequestId( request_id ) ) |
|
782 { |
|
783 ASSERT( false_t ); |
|
784 return; |
|
785 } |
|
786 |
|
787 iManagementCommandHandler->EnableUserData(); |
|
788 } |
|
789 |
|
790 // ----------------------------------------------------------------------------- |
|
791 // CWlmDriverIf::disable_user_data |
|
792 // ----------------------------------------------------------------------------- |
|
793 // |
|
794 void CWlmDriverIf::disable_user_data( u32_t request_id ) |
|
795 { |
|
796 DEBUG( "CWlmDriverIf::disable_user_data()" ); |
|
797 |
|
798 // Set request id and ensure no prior requests are pending |
|
799 if( SetRequestId( request_id ) ) |
|
800 { |
|
801 ASSERT( false_t ); |
|
802 return; |
|
803 } |
|
804 |
|
805 iManagementCommandHandler->DisableUserData(); |
|
806 } |
|
807 |
|
808 // ----------------------------------------------------------------------------- |
|
809 // CWlmDriverIf::connect |
|
810 // ----------------------------------------------------------------------------- |
|
811 // |
|
812 void CWlmDriverIf::connect( |
|
813 u32_t request_id, |
|
814 core_management_status_e& status, |
|
815 const core_ssid_s& ssid, |
|
816 const core_mac_address_s& bssid, |
|
817 u16_t auth_algorithm, |
|
818 core_encryption_mode_e encryption_level, |
|
819 core_cipher_key_type_e pairwise_key_type, |
|
820 bool_t is_infra, |
|
821 u32_t ie_data_length, |
|
822 const u8_t* ie_data, |
|
823 u32_t scan_frame_length, |
|
824 const u8_t* scan_frame, |
|
825 bool_t is_pairwise_key_invalidated, |
|
826 bool_t is_group_key_invalidated, |
|
827 bool_t is_radio_measurement_supported ) |
|
828 { |
|
829 #ifdef _DEBUG |
|
830 if( is_infra == true_t ) |
|
831 { |
|
832 DEBUG( "CWlmDriverIf::connect() - infrastructure" ); |
|
833 } |
|
834 else |
|
835 { |
|
836 DEBUG( "CWlmDriverIf::connect() - adhoc" ); |
|
837 } |
|
838 #endif // _DEBUG |
|
839 |
|
840 // Set request id and ensure no prior requests are pending |
|
841 if( SetRequestId( request_id ) ) |
|
842 { |
|
843 ASSERT( false_t ); |
|
844 return; |
|
845 } |
|
846 |
|
847 iManagementStatus = &status; |
|
848 |
|
849 TSSID tmpSsid; |
|
850 TWlanConversionUtil::ConvertSSID( tmpSsid, ssid ); |
|
851 TMacAddress tmpBssid; |
|
852 TWlanConversionUtil::ConvertMacAddress( tmpBssid, bssid ); |
|
853 |
|
854 iManagementCommandHandler->Connect( |
|
855 tmpSsid, |
|
856 tmpBssid, |
|
857 auth_algorithm, |
|
858 TWlanConversionUtil::ConvertEncryptionMode( encryption_level ), |
|
859 TWlanConversionUtil::ConvertCipherKeyType( pairwise_key_type ), |
|
860 is_infra, |
|
861 ie_data_length, |
|
862 ie_data, |
|
863 scan_frame_length, |
|
864 scan_frame, |
|
865 is_pairwise_key_invalidated, |
|
866 is_group_key_invalidated, |
|
867 is_radio_measurement_supported ); |
|
868 |
|
869 } |
|
870 |
|
871 // ----------------------------------------------------------------------------- |
|
872 // CWlmDriverIf::cancel_request |
|
873 // ----------------------------------------------------------------------------- |
|
874 // |
|
875 void CWlmDriverIf::cancel_request( |
|
876 u32_t /* request_id */ ) |
|
877 { |
|
878 iManagementCommandHandler->Cancel(); |
|
879 } |
|
880 |
|
881 // ----------------------------------------------------------------------------- |
|
882 // CWlmDriverIf::send_frame |
|
883 // ----------------------------------------------------------------------------- |
|
884 // |
|
885 void CWlmDriverIf::send_frame( |
|
886 core_frame_type_e frame_type, |
|
887 const u16_t frame_length, |
|
888 const u8_t* const frame_data, |
|
889 u8_t frame_priority, |
|
890 const core_mac_address_s& destination, |
|
891 bool_t send_encrypted ) |
|
892 { |
|
893 DEBUG( "CWlmDriverIf::send_frame()" ); |
|
894 |
|
895 TMacAddress macAddr; |
|
896 TWlanConversionUtil::ConvertMacAddress( macAddr, destination ); |
|
897 |
|
898 iManagementFrameHandler->SendFrame( |
|
899 TWlanConversionUtil::ConvertFrameType( frame_type ), |
|
900 static_cast<u16_t>( frame_length ), |
|
901 frame_data, |
|
902 frame_priority, |
|
903 macAddr, |
|
904 send_encrypted ); |
|
905 } |
|
906 |
|
907 // ----------------------------------------------------------------------------- |
|
908 // CWlmDriverIf::set_arp_filter |
|
909 // ----------------------------------------------------------------------------- |
|
910 // |
|
911 void CWlmDriverIf::set_arp_filter( |
|
912 u32_t /* request_id */, |
|
913 const core_arp_filter_s& /* filter */ ) |
|
914 { |
|
915 // Not supported currently |
|
916 ASSERT( false_t ); |
|
917 return; |
|
918 } |
|
919 |
|
920 // ----------------------------------------------------------------------------- |
|
921 // CWlmDriverIf::set_block_ack_usage |
|
922 // ----------------------------------------------------------------------------- |
|
923 // |
|
924 void CWlmDriverIf::set_block_ack_usage( |
|
925 u32_t request_id, |
|
926 const core_block_ack_usage_s& usage ) |
|
927 { |
|
928 // Set request id and ensure no prior requests are pending |
|
929 if( SetRequestId( request_id ) ) |
|
930 { |
|
931 ASSERT( false_t ); |
|
932 return; |
|
933 } |
|
934 |
|
935 iManagementCommandHandler->SetBlockAckUsage( |
|
936 usage.tx_usage, |
|
937 usage.rx_usage ); |
|
938 } |
|
939 |
|
940 // ----------------------------------------------------------------------------- |
|
941 // CWlmDriverIf::set_snap_header_filter |
|
942 // ----------------------------------------------------------------------------- |
|
943 // |
|
944 void CWlmDriverIf::set_snap_header_filter( |
|
945 u32_t request_id, |
|
946 const core_snap_header_s& header ) |
|
947 { |
|
948 DEBUG( "CWlmDriverIf::set_snap_header_filter()" ); |
|
949 |
|
950 // Set request id and ensure no prior requests are pending |
|
951 if( SetRequestId( request_id ) ) |
|
952 { |
|
953 ASSERT( false_t ); |
|
954 return; |
|
955 } |
|
956 |
|
957 TSnapHeader amHeader; |
|
958 TWlanConversionUtil::ConvertSnapHeader( amHeader, header ); |
|
959 |
|
960 iManagementCommandHandler->SetSnapHeaderFilter( |
|
961 amHeader ); |
|
962 } |
|
963 |
|
964 // ----------------------------------------------------------------------------- |
|
965 // CWlmDriverIf::OnNotify |
|
966 // ----------------------------------------------------------------------------- |
|
967 // |
|
968 void CWlmDriverIf::OnNotify( const TIndication& aIndication ) |
|
969 { |
|
970 DEBUG( "CWlmDriverIf::OnNotify" ); |
|
971 iCoreServer->notify( TWlanConversionUtil::ConvertIndication( aIndication ) ); |
|
972 } |
|
973 |
|
974 // ----------------------------------------------------------------------------- |
|
975 // CWlmDriverIf::OnFrameReceive |
|
976 // ----------------------------------------------------------------------------- |
|
977 // |
|
978 void CWlmDriverIf::OnFrameReceive( |
|
979 const TDataBuffer::TFrameType aFrameType, |
|
980 const TUint aLength, |
|
981 const TUint8* const aData, |
|
982 TUint8 aRcpi ) |
|
983 { |
|
984 DEBUG( "CWlmDriverIf::ReceivePacket" ); |
|
985 ASSERT( iCoreServer ); |
|
986 iCoreServer->receive_frame( |
|
987 TWlanConversionUtil::ConvertFrameType( aFrameType ), |
|
988 static_cast<u16_t>( aLength ), |
|
989 aData, |
|
990 aRcpi ); |
|
991 } |
|
992 |
|
993 // ----------------------------------------------------------------------------- |
|
994 // CWlmDriverIf::OnRequestComplete |
|
995 // ----------------------------------------------------------------------------- |
|
996 // |
|
997 void CWlmDriverIf::OnRequestComplete( TInt status ) |
|
998 { |
|
999 DEBUG1( "CWlmDriverIf::OnRequestComplete (status == %d)", status ); |
|
1000 // Save pending reqId to a local stack variable, |
|
1001 // and reset the corresponding member variable in order to guarantee |
|
1002 // that driverIf is capable to accept new request |
|
1003 TUint32 tmp = iPendingRequestId; |
|
1004 iPendingRequestId = 0; |
|
1005 if ( iManagementStatus && |
|
1006 status > KErrNone ) |
|
1007 { |
|
1008 *iManagementStatus = static_cast<core_management_status_e>( status ); |
|
1009 iManagementStatus = NULL; |
|
1010 } |
|
1011 |
|
1012 iCoreServer->request_complete( |
|
1013 tmp, |
|
1014 TWlanConversionUtil::ConvertErrorCode( status ) ); |
|
1015 } |
|
1016 |
|
1017 // ----------------------------------------------------------------------------- |
|
1018 // CWlmDriverIf::AsynchCallbackFunction |
|
1019 // ----------------------------------------------------------------------------- |
|
1020 // |
|
1021 TInt CWlmDriverIf::AsynchCallbackFunction( TAny* aThisPtr ) |
|
1022 { |
|
1023 CWlmDriverIf* self = static_cast<CWlmDriverIf*>( aThisPtr ); |
|
1024 DEBUG2( "CWlmDriverIf::AsynchCallbackFunction (reqId == %d, status == %d)", |
|
1025 self->iPendingRequestId, |
|
1026 self->iErrorStatus ); |
|
1027 |
|
1028 // Save pending reqId/errorStatus to a local stack variable, |
|
1029 // and reset the corresponding member variables in order to guarantee |
|
1030 // that driverIf is capable to accept new request |
|
1031 TUint32 tmpReqId = self->iPendingRequestId; |
|
1032 self->iPendingRequestId = 0; |
|
1033 core_error_e tmpError = self->iErrorStatus; |
|
1034 self->iErrorStatus = core_error_ok; |
|
1035 |
|
1036 self->iCoreServer->request_complete( tmpReqId, tmpError ); |
|
1037 return KErrNone; |
|
1038 } |
|
1039 |
|
1040 // ----------------------------------------------------------------------------- |
|
1041 // CWlmDriverIf::SetRequestId |
|
1042 // ----------------------------------------------------------------------------- |
|
1043 // |
|
1044 TInt CWlmDriverIf::SetRequestId( TUint32 aRequestId ) |
|
1045 { |
|
1046 // Save the request_id |
|
1047 if( iPendingRequestId != 0 ) |
|
1048 { |
|
1049 DEBUG("ERROR: command already pending"); |
|
1050 ASSERT( EFalse ); |
|
1051 iErrorStatus = core_error_drivers_not_loaded; |
|
1052 iAsynchCallback->CallBack(); |
|
1053 return KErrInUse; |
|
1054 } |
|
1055 else |
|
1056 { |
|
1057 iPendingRequestId = aRequestId; |
|
1058 iManagementStatus = NULL; |
|
1059 return KErrNone; |
|
1060 } |
|
1061 } |
|
1062 |
|
1063 // ----------------------------------------------------------------------------- |
|
1064 // CWlmDriverIf::GetMacAddress |
|
1065 // ----------------------------------------------------------------------------- |
|
1066 // |
|
1067 TInt CWlmDriverIf::GetMacAddress( TMacAddress& aMac ) |
|
1068 { |
|
1069 TMacAddr tmp; |
|
1070 TInt ret = iHwInit->GetMacAddress( tmp ); |
|
1071 |
|
1072 TWlanConversionUtil::ConvertMacAddress( aMac, tmp ); |
|
1073 |
|
1074 return ret; |
|
1075 } |
|
1076 |
|
1077 // ----------------------------------------------------------------------------- |
|
1078 // CWlmDriverIf::Notify |
|
1079 // ----------------------------------------------------------------------------- |
|
1080 // |
|
1081 void CWlmDriverIf::Notify( core_am_indication_e aIndication ) |
|
1082 { |
|
1083 iCoreServer->notify( aIndication ); |
|
1084 } |