|
1 /* |
|
2 * Copyright (c) 2006-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: Class encapsulating core engine settings and statuses. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "core_settings.h" |
|
20 #include "core_settings_default.h" |
|
21 #include "core_scan_channels.h" |
|
22 #include "core_tools.h" |
|
23 #include "am_debug.h" |
|
24 |
|
25 // ======== MEMBER FUNCTIONS ======== |
|
26 |
|
27 // --------------------------------------------------------------------------- |
|
28 // --------------------------------------------------------------------------- |
|
29 // |
|
30 core_settings_c::core_settings_c( |
|
31 u32_t features ) : |
|
32 is_wlan_enabled_m( true_t ), |
|
33 is_driver_loaded_m( false_t ), |
|
34 connection_state_m( core_connection_state_notconnected ), |
|
35 power_mode_m( CORE_POWER_MODE_CAM ), |
|
36 preferred_power_save_m( CORE_POWER_SAVE_MODE_AUTOMATIC ), |
|
37 perm_whitelist_m( ), |
|
38 perm_blacklist_m( ), |
|
39 rcp_decline_boundary_m( 0 ), |
|
40 rcp_improve_boundary_m( 0 ), |
|
41 region_m( core_wlan_region_fcc ), |
|
42 mcc_known_m( false_t ), |
|
43 is_bt_connection_established_m( false_t ), |
|
44 roam_metrics_m( ), |
|
45 uapsd_settings_m( DEFAULT_UAPSD_SETTINGS ), |
|
46 power_save_settings_m( DEFAULT_POWER_SAVE_SETTINGS ), |
|
47 block_ack_usage_m( DEFAULT_BLOCK_ACK_USAGE ), |
|
48 weak_iap_list_m( ), |
|
49 features_m( features ) |
|
50 { |
|
51 DEBUG( "core_settings_c::core_settings_c()" ); |
|
52 |
|
53 clear_connection_statistics(); |
|
54 |
|
55 core_tools_c::fillz( |
|
56 &long_beacon_interval_channels_m.channel_scan_count[0], |
|
57 sizeof ( long_beacon_interval_channels_m ) ); |
|
58 } |
|
59 |
|
60 // --------------------------------------------------------------------------- |
|
61 // --------------------------------------------------------------------------- |
|
62 // |
|
63 core_settings_c::~core_settings_c() |
|
64 { |
|
65 DEBUG( "core_settings_c::~core_settings_c()" ); |
|
66 |
|
67 perm_whitelist_m.clear(); |
|
68 perm_blacklist_m.clear(); |
|
69 weak_iap_list_m.clear(); |
|
70 } |
|
71 |
|
72 // --------------------------------------------------------------------------- |
|
73 // --------------------------------------------------------------------------- |
|
74 // |
|
75 bool_t core_settings_c::is_driver_loaded() const |
|
76 { |
|
77 return is_driver_loaded_m; |
|
78 } |
|
79 |
|
80 // --------------------------------------------------------------------------- |
|
81 // --------------------------------------------------------------------------- |
|
82 // |
|
83 void core_settings_c::set_driver_state( |
|
84 bool_t is_driver_loaded ) |
|
85 { |
|
86 is_driver_loaded_m = is_driver_loaded; |
|
87 } |
|
88 |
|
89 // --------------------------------------------------------------------------- |
|
90 // --------------------------------------------------------------------------- |
|
91 // |
|
92 bool_t core_settings_c::is_wlan_enabled() const |
|
93 { |
|
94 return is_wlan_enabled_m; |
|
95 } |
|
96 |
|
97 // --------------------------------------------------------------------------- |
|
98 // --------------------------------------------------------------------------- |
|
99 // |
|
100 void core_settings_c::set_wlan_enabled( |
|
101 bool_t is_wlan_enabled ) |
|
102 { |
|
103 is_wlan_enabled_m = is_wlan_enabled; |
|
104 } |
|
105 |
|
106 // --------------------------------------------------------------------------- |
|
107 // --------------------------------------------------------------------------- |
|
108 // |
|
109 const core_power_mode_s& core_settings_c::power_mode() const |
|
110 { |
|
111 return power_mode_m; |
|
112 } |
|
113 |
|
114 // --------------------------------------------------------------------------- |
|
115 // --------------------------------------------------------------------------- |
|
116 // |
|
117 void core_settings_c::set_power_mode( |
|
118 const core_power_mode_s& mode ) |
|
119 { |
|
120 power_mode_m = mode; |
|
121 } |
|
122 |
|
123 // --------------------------------------------------------------------------- |
|
124 // --------------------------------------------------------------------------- |
|
125 // |
|
126 const core_power_save_mode_s& core_settings_c::preferred_power_save_mode() const |
|
127 { |
|
128 return preferred_power_save_m; |
|
129 } |
|
130 |
|
131 // --------------------------------------------------------------------------- |
|
132 // --------------------------------------------------------------------------- |
|
133 // |
|
134 void core_settings_c::set_preferred_power_save_mode( |
|
135 const core_power_save_mode_s& mode ) |
|
136 { |
|
137 preferred_power_save_m = mode; |
|
138 } |
|
139 |
|
140 // --------------------------------------------------------------------------- |
|
141 // --------------------------------------------------------------------------- |
|
142 // |
|
143 core_connection_state_e core_settings_c::connection_state() const |
|
144 { |
|
145 return connection_state_m; |
|
146 } |
|
147 |
|
148 // --------------------------------------------------------------------------- |
|
149 // --------------------------------------------------------------------------- |
|
150 // |
|
151 void core_settings_c::set_connection_state( |
|
152 core_connection_state_e state ) |
|
153 { |
|
154 connection_state_m = state; |
|
155 } |
|
156 |
|
157 // --------------------------------------------------------------------------- |
|
158 // --------------------------------------------------------------------------- |
|
159 // |
|
160 bool_t core_settings_c::is_connected() const |
|
161 { |
|
162 if( connection_state_m == core_connection_state_notconnected ) |
|
163 { |
|
164 return false_t; |
|
165 } |
|
166 |
|
167 return true_t; |
|
168 } |
|
169 |
|
170 // --------------------------------------------------------------------------- |
|
171 // --------------------------------------------------------------------------- |
|
172 // |
|
173 bool_t core_settings_c::is_permanent_whitelist_empty() const |
|
174 { |
|
175 return !perm_whitelist_m.count(); |
|
176 } |
|
177 |
|
178 // --------------------------------------------------------------------------- |
|
179 // --------------------------------------------------------------------------- |
|
180 // |
|
181 bool_t core_settings_c::is_mac_in_permanent_whitelist( |
|
182 const core_mac_address_s& mac ) |
|
183 { |
|
184 core_mac_address_s* addr = perm_whitelist_m.first(); |
|
185 while ( addr ) |
|
186 { |
|
187 if ( *addr == mac ) |
|
188 { |
|
189 return true_t; |
|
190 } |
|
191 |
|
192 addr = perm_whitelist_m.next(); |
|
193 } |
|
194 |
|
195 return false_t; |
|
196 } |
|
197 |
|
198 // --------------------------------------------------------------------------- |
|
199 // --------------------------------------------------------------------------- |
|
200 // |
|
201 bool_t core_settings_c::is_mac_in_permanent_blacklist( |
|
202 const core_mac_address_s& mac ) |
|
203 { |
|
204 core_ap_blacklist_entry_s* addr = perm_blacklist_m.first(); |
|
205 while ( addr ) |
|
206 { |
|
207 if ( addr->bssid == mac ) |
|
208 { |
|
209 return true_t; |
|
210 } |
|
211 |
|
212 addr = perm_blacklist_m.next(); |
|
213 } |
|
214 |
|
215 return false_t; |
|
216 } |
|
217 |
|
218 // --------------------------------------------------------------------------- |
|
219 // --------------------------------------------------------------------------- |
|
220 // |
|
221 void core_settings_c::add_mac_to_permanent_whitelist( |
|
222 const core_mac_address_s& mac ) |
|
223 { |
|
224 if ( !is_mac_in_permanent_whitelist( mac ) ) |
|
225 { |
|
226 core_mac_address_s* entry = new core_mac_address_s; |
|
227 if ( entry ) |
|
228 { |
|
229 *entry = mac; |
|
230 perm_whitelist_m.append( entry ); |
|
231 } |
|
232 } |
|
233 } |
|
234 |
|
235 // --------------------------------------------------------------------------- |
|
236 // --------------------------------------------------------------------------- |
|
237 // |
|
238 void core_settings_c::remove_mac_from_permanent_whitelist( |
|
239 const core_mac_address_s& mac ) |
|
240 { |
|
241 core_mac_address_s* addr = perm_whitelist_m.first(); |
|
242 while ( addr ) |
|
243 { |
|
244 if ( *addr == mac ) |
|
245 { |
|
246 perm_whitelist_m.remove( addr ); |
|
247 delete addr; |
|
248 |
|
249 return; |
|
250 } |
|
251 |
|
252 addr = perm_whitelist_m.next(); |
|
253 } |
|
254 } |
|
255 |
|
256 // --------------------------------------------------------------------------- |
|
257 // --------------------------------------------------------------------------- |
|
258 // |
|
259 void core_settings_c::add_mac_to_permanent_blacklist( |
|
260 const core_mac_address_s& mac, |
|
261 core_ap_blacklist_reason_e reason ) |
|
262 { |
|
263 if ( !is_mac_in_permanent_blacklist( mac ) ) |
|
264 { |
|
265 core_ap_blacklist_entry_s* entry = new core_ap_blacklist_entry_s; |
|
266 if ( entry ) |
|
267 { |
|
268 entry->bssid = mac; |
|
269 entry->reason = reason; |
|
270 perm_blacklist_m.append( entry ); |
|
271 } |
|
272 } |
|
273 } |
|
274 |
|
275 // --------------------------------------------------------------------------- |
|
276 // --------------------------------------------------------------------------- |
|
277 // |
|
278 void core_settings_c::remove_mac_from_permanent_blacklist( |
|
279 const core_mac_address_s& mac ) |
|
280 { |
|
281 core_ap_blacklist_entry_s* addr = perm_blacklist_m.first(); |
|
282 while ( addr ) |
|
283 { |
|
284 if ( addr->bssid == mac ) |
|
285 { |
|
286 perm_blacklist_m.remove( addr ); |
|
287 delete addr; |
|
288 |
|
289 return; |
|
290 } |
|
291 |
|
292 addr = perm_blacklist_m.next(); |
|
293 } |
|
294 } |
|
295 |
|
296 // --------------------------------------------------------------------------- |
|
297 // --------------------------------------------------------------------------- |
|
298 // |
|
299 core_type_list_c<core_ap_blacklist_entry_s>& core_settings_c::permanent_blacklist() |
|
300 { |
|
301 return perm_blacklist_m; |
|
302 } |
|
303 |
|
304 // --------------------------------------------------------------------------- |
|
305 // --------------------------------------------------------------------------- |
|
306 // |
|
307 void core_settings_c::set_rcpi_boundaries( |
|
308 u32_t rcp_decline_boundary, |
|
309 u32_t rcp_improve_boundary ) |
|
310 { |
|
311 rcp_decline_boundary_m = rcp_decline_boundary; |
|
312 rcp_improve_boundary_m = rcp_improve_boundary; |
|
313 } |
|
314 |
|
315 // --------------------------------------------------------------------------- |
|
316 // --------------------------------------------------------------------------- |
|
317 // |
|
318 u32_t core_settings_c::rcp_decline_boundary() const |
|
319 { |
|
320 return rcp_decline_boundary_m; |
|
321 } |
|
322 |
|
323 // --------------------------------------------------------------------------- |
|
324 // --------------------------------------------------------------------------- |
|
325 // |
|
326 u32_t core_settings_c::rcp_improve_boundary() const |
|
327 { |
|
328 return rcp_improve_boundary_m; |
|
329 } |
|
330 |
|
331 // --------------------------------------------------------------------------- |
|
332 // --------------------------------------------------------------------------- |
|
333 // |
|
334 core_wlan_region_e core_settings_c::regional_domain() const |
|
335 { |
|
336 return region_m; |
|
337 } |
|
338 |
|
339 // --------------------------------------------------------------------------- |
|
340 // --------------------------------------------------------------------------- |
|
341 // |
|
342 void core_settings_c::set_regional_domain( |
|
343 core_wlan_region_e region ) |
|
344 { |
|
345 region_m = region; |
|
346 } |
|
347 |
|
348 // --------------------------------------------------------------------------- |
|
349 // --------------------------------------------------------------------------- |
|
350 // |
|
351 bool_t core_settings_c::mcc_known() const |
|
352 { |
|
353 return mcc_known_m; |
|
354 } |
|
355 |
|
356 // --------------------------------------------------------------------------- |
|
357 // --------------------------------------------------------------------------- |
|
358 // |
|
359 void core_settings_c::set_mcc_known( |
|
360 bool_t mcc_known ) |
|
361 { |
|
362 mcc_known_m = mcc_known; |
|
363 } |
|
364 |
|
365 |
|
366 // --------------------------------------------------------------------------- |
|
367 // --------------------------------------------------------------------------- |
|
368 // |
|
369 bool_t core_settings_c::is_valid_channel( |
|
370 u8_t band, |
|
371 u8_t channel ) const |
|
372 { |
|
373 if ( band & SCAN_BAND_2DOT4GHZ ) |
|
374 { |
|
375 if( !channel ) |
|
376 { |
|
377 return false_t; |
|
378 } |
|
379 |
|
380 if( region_m == core_wlan_region_fcc && |
|
381 channel > SCAN_BAND_2DOT4GHZ_MAX_CHANNEL_FCC ) |
|
382 { |
|
383 return false_t; |
|
384 } |
|
385 else if ( channel > SCAN_BAND_2DOT4GHZ_MAX_CHANNEL_EURO ) |
|
386 { |
|
387 return false_t; |
|
388 } |
|
389 |
|
390 return true_t; |
|
391 } |
|
392 |
|
393 return false_t; |
|
394 } |
|
395 |
|
396 // --------------------------------------------------------------------------- |
|
397 // --------------------------------------------------------------------------- |
|
398 // |
|
399 core_scan_channels_s core_settings_c::all_valid_scan_channels() const |
|
400 { |
|
401 if( region_m == core_wlan_region_fcc ) |
|
402 { |
|
403 return SCAN_CHANNELS_2DOT4GHZ_US; |
|
404 } |
|
405 |
|
406 return SCAN_CHANNELS_2DOT4GHZ_ETSI; |
|
407 } |
|
408 |
|
409 // --------------------------------------------------------------------------- |
|
410 // --------------------------------------------------------------------------- |
|
411 // |
|
412 core_scan_channels_s core_settings_c::valid_scan_channels( |
|
413 const core_scan_channels_s& channels ) |
|
414 { |
|
415 core_scan_channels_c filtered_channels; |
|
416 |
|
417 if ( channels.band & SCAN_BAND_2DOT4GHZ ) |
|
418 { |
|
419 u16_t mask( 0 ); |
|
420 core_tools_c::copy( |
|
421 reinterpret_cast<u8_t*>( &mask ), |
|
422 &channels.channels2dot4ghz[0], |
|
423 sizeof( mask ) ); |
|
424 |
|
425 for ( u8_t channel( 0 ); channel < SCAN_BAND_2DOT4GHZ_MAX_CHANNEL_EURO; ++channel ) |
|
426 { |
|
427 if ( mask & ( 1 << channel ) && |
|
428 is_valid_channel( |
|
429 SCAN_BAND_2DOT4GHZ, |
|
430 channel + 1 ) ) |
|
431 { |
|
432 filtered_channels.add( |
|
433 SCAN_BAND_2DOT4GHZ, |
|
434 channel + 1 ); |
|
435 } |
|
436 } |
|
437 } |
|
438 |
|
439 return filtered_channels.channels(); |
|
440 } |
|
441 |
|
442 // --------------------------------------------------------------------------- |
|
443 // --------------------------------------------------------------------------- |
|
444 // |
|
445 core_scan_channels_s core_settings_c::invalid_scan_channels( |
|
446 const core_scan_channels_s& channels ) |
|
447 { |
|
448 core_scan_channels_c filtered_channels; |
|
449 |
|
450 if ( channels.band & SCAN_BAND_2DOT4GHZ ) |
|
451 { |
|
452 u16_t mask( 0 ); |
|
453 core_tools_c::copy( |
|
454 reinterpret_cast<u8_t*>( &mask ), |
|
455 &channels.channels2dot4ghz[0], |
|
456 sizeof( mask ) ); |
|
457 |
|
458 for ( u8_t channel( 0 ); channel < SCAN_BAND_2DOT4GHZ_MAX_CHANNEL_EURO; ++channel ) |
|
459 { |
|
460 if ( !( mask & ( 1 << channel ) && |
|
461 is_valid_channel( |
|
462 SCAN_BAND_2DOT4GHZ, |
|
463 channel + 1 ) ) ) |
|
464 { |
|
465 filtered_channels.add( |
|
466 SCAN_BAND_2DOT4GHZ, |
|
467 channel + 1 ); |
|
468 } |
|
469 } |
|
470 } |
|
471 |
|
472 return filtered_channels.channels(); |
|
473 } |
|
474 |
|
475 |
|
476 // --------------------------------------------------------------------------- |
|
477 // --------------------------------------------------------------------------- |
|
478 // |
|
479 bool_t core_settings_c::is_bt_connection_established() const |
|
480 { |
|
481 return is_bt_connection_established_m; |
|
482 } |
|
483 |
|
484 // --------------------------------------------------------------------------- |
|
485 // --------------------------------------------------------------------------- |
|
486 // |
|
487 void core_settings_c::set_bt_connection_established( |
|
488 bool_t established ) |
|
489 { |
|
490 is_bt_connection_established_m = established; |
|
491 } |
|
492 |
|
493 // --------------------------------------------------------------------------- |
|
494 // --------------------------------------------------------------------------- |
|
495 // |
|
496 const core_packet_statistics_by_access_category_s& core_settings_c::connection_statistics_by_access_category() |
|
497 { |
|
498 return current_statistics_m; |
|
499 } |
|
500 |
|
501 // --------------------------------------------------------------------------- |
|
502 // --------------------------------------------------------------------------- |
|
503 // |
|
504 core_packet_statistics_s core_settings_c::connection_statistics() |
|
505 { |
|
506 core_packet_statistics_s statistics; |
|
507 core_tools_c::fillz( |
|
508 &statistics, |
|
509 sizeof( statistics ) ); |
|
510 |
|
511 for ( u8_t idx( 0 ); idx < MAX_QOS_ACCESS_CLASS; ++idx ) |
|
512 { |
|
513 statistics.rx_frames += current_statistics_m.ac[idx].rx_frames; |
|
514 statistics.tx_frames += current_statistics_m.ac[idx].tx_frames; |
|
515 statistics.rx_multicast_frames += current_statistics_m.ac[idx].rx_multicast_frames; |
|
516 statistics.tx_multicast_frames += current_statistics_m.ac[idx].tx_multicast_frames; |
|
517 statistics.tx_retries += current_statistics_m.ac[idx].tx_retries; |
|
518 statistics.tx_errors += current_statistics_m.ac[idx].tx_errors; |
|
519 } |
|
520 statistics.fcs_errors = current_statistics_m.fcs_errors; |
|
521 |
|
522 return statistics; |
|
523 } |
|
524 |
|
525 // --------------------------------------------------------------------------- |
|
526 // --------------------------------------------------------------------------- |
|
527 // |
|
528 void core_settings_c::update_connection_statistics( |
|
529 const core_packet_statistics_by_access_category_s& statistics ) |
|
530 { |
|
531 DEBUG( "core_settings_c::update_connection_statistics()" ); |
|
532 |
|
533 for ( u8_t idx( 0 ); idx < MAX_QOS_ACCESS_CLASS; ++idx ) |
|
534 { |
|
535 DEBUG1( "core_settings_c::update_connection_statistics() - delta statistics for AC %u:", |
|
536 idx ); |
|
537 DEBUG1( "core_settings_c::update_connection_statistics() - rx_frames: %u", |
|
538 statistics.ac[idx].rx_frames ); |
|
539 DEBUG1( "core_settings_c::update_connection_statistics() - tx_frames: %u", |
|
540 statistics.ac[idx].tx_frames ); |
|
541 DEBUG1( "core_settings_c::update_connection_statistics() - rx_multicast_frames: %u", |
|
542 statistics.ac[idx].rx_multicast_frames ); |
|
543 DEBUG1( "core_settings_c::update_connection_statistics() - tx_multicast_frames: %u", |
|
544 statistics.ac[idx].tx_multicast_frames ); |
|
545 DEBUG1( "core_settings_c::update_connection_statistics() - tx_retries: %u", |
|
546 statistics.ac[idx].tx_retries ); |
|
547 DEBUG1( "core_settings_c::update_connection_statistics() - tx_errors: %u", |
|
548 statistics.ac[idx].tx_errors ); |
|
549 DEBUG1( "core_settings_c::update_connection_statistics() - tx_media_delay: %u", |
|
550 statistics.ac[idx].tx_media_delay ); |
|
551 DEBUG1( "core_settings_c::update_connection_statistics() - tx_total_delay: %u", |
|
552 statistics.ac[idx].tx_total_delay ); |
|
553 DEBUG1( "core_settings_c::update_connection_statistics() - tx_total_delay_bin0: %u", |
|
554 statistics.ac[idx].tx_total_delay_bin0 ); |
|
555 DEBUG1( "core_settings_c::update_connection_statistics() - tx_total_delay_bin1: %u", |
|
556 statistics.ac[idx].tx_total_delay_bin1 ); |
|
557 DEBUG1( "core_settings_c::update_connection_statistics() - tx_total_delay_bin2: %u", |
|
558 statistics.ac[idx].tx_total_delay_bin2 ); |
|
559 DEBUG1( "core_settings_c::update_connection_statistics() - tx_total_delay_bin3: %u", |
|
560 statistics.ac[idx].tx_total_delay_bin3 ); |
|
561 |
|
562 current_statistics_m.ac[idx].rx_frames += statistics.ac[idx].rx_frames; |
|
563 current_statistics_m.ac[idx].tx_frames += statistics.ac[idx].tx_frames; |
|
564 current_statistics_m.ac[idx].rx_multicast_frames += statistics.ac[idx].rx_multicast_frames; |
|
565 current_statistics_m.ac[idx].tx_multicast_frames += statistics.ac[idx].tx_multicast_frames; |
|
566 current_statistics_m.ac[idx].tx_retries += statistics.ac[idx].tx_retries; |
|
567 current_statistics_m.ac[idx].tx_errors += statistics.ac[idx].tx_errors; |
|
568 |
|
569 current_statistics_m.ac[idx].tx_media_delay = statistics.ac[idx].tx_media_delay; |
|
570 current_statistics_m.ac[idx].tx_total_delay = statistics.ac[idx].tx_total_delay; |
|
571 |
|
572 current_statistics_m.ac[idx].tx_total_delay_bin0 += statistics.ac[idx].tx_total_delay_bin0; |
|
573 current_statistics_m.ac[idx].tx_total_delay_bin1 += statistics.ac[idx].tx_total_delay_bin1; |
|
574 current_statistics_m.ac[idx].tx_total_delay_bin2 += statistics.ac[idx].tx_total_delay_bin2; |
|
575 current_statistics_m.ac[idx].tx_total_delay_bin3 += statistics.ac[idx].tx_total_delay_bin3; |
|
576 } |
|
577 |
|
578 DEBUG1( "core_settings_c::update_connection_statistics() - delta fcs_errors: %u", |
|
579 statistics.fcs_errors ); |
|
580 current_statistics_m.fcs_errors += statistics.fcs_errors; |
|
581 } |
|
582 |
|
583 // --------------------------------------------------------------------------- |
|
584 // --------------------------------------------------------------------------- |
|
585 // |
|
586 void core_settings_c::clear_connection_statistics() |
|
587 { |
|
588 core_tools_c::fillz( |
|
589 ¤t_statistics_m, |
|
590 sizeof( current_statistics_m ) ); |
|
591 } |
|
592 |
|
593 // --------------------------------------------------------------------------- |
|
594 // --------------------------------------------------------------------------- |
|
595 // |
|
596 core_roam_metrics_c& core_settings_c::roam_metrics() |
|
597 { |
|
598 return roam_metrics_m; |
|
599 } |
|
600 |
|
601 // --------------------------------------------------------------------------- |
|
602 // --------------------------------------------------------------------------- |
|
603 // |
|
604 core_long_beacon_interval_channels_s& core_settings_c::long_beacon_interval_channels() |
|
605 { |
|
606 return long_beacon_interval_channels_m; |
|
607 } |
|
608 |
|
609 // --------------------------------------------------------------------------- |
|
610 // --------------------------------------------------------------------------- |
|
611 // |
|
612 const core_uapsd_settings_s& core_settings_c::uapsd_settings() |
|
613 { |
|
614 return uapsd_settings_m; |
|
615 } |
|
616 |
|
617 // --------------------------------------------------------------------------- |
|
618 // --------------------------------------------------------------------------- |
|
619 // |
|
620 bool_t core_settings_c::is_uapsd_enable_for_access_class( |
|
621 core_access_class_e access_class ) |
|
622 { |
|
623 if ( access_class == core_access_class_voice && |
|
624 uapsd_settings_m.uapsd_enabled_for_voice ) |
|
625 { |
|
626 return true_t; |
|
627 } |
|
628 else if ( access_class == core_access_class_video && |
|
629 uapsd_settings_m.uapsd_enabled_for_video ) |
|
630 { |
|
631 return true_t; |
|
632 } |
|
633 else if ( access_class == core_access_class_best_effort && |
|
634 uapsd_settings_m.uapsd_enabled_for_best_effort ) |
|
635 { |
|
636 return true_t; |
|
637 } |
|
638 else if ( access_class == core_access_class_background && |
|
639 uapsd_settings_m.uapsd_enabled_for_background ) |
|
640 { |
|
641 return true_t; |
|
642 } |
|
643 |
|
644 return false_t; |
|
645 } |
|
646 |
|
647 // --------------------------------------------------------------------------- |
|
648 // --------------------------------------------------------------------------- |
|
649 // |
|
650 void core_settings_c::set_uapsd_settings( |
|
651 const core_uapsd_settings_s& settings ) |
|
652 { |
|
653 uapsd_settings_m = settings; |
|
654 } |
|
655 |
|
656 // --------------------------------------------------------------------------- |
|
657 // --------------------------------------------------------------------------- |
|
658 // |
|
659 const core_power_save_settings_s& core_settings_c::power_save_settings() |
|
660 { |
|
661 return power_save_settings_m; |
|
662 } |
|
663 |
|
664 // --------------------------------------------------------------------------- |
|
665 // --------------------------------------------------------------------------- |
|
666 // |
|
667 void core_settings_c::set_power_save_settings( |
|
668 const core_power_save_settings_s& settings ) |
|
669 { |
|
670 power_save_settings_m = settings; |
|
671 } |
|
672 |
|
673 // --------------------------------------------------------------------------- |
|
674 // --------------------------------------------------------------------------- |
|
675 // |
|
676 const core_block_ack_usage_s& core_settings_c::block_ack_usage() |
|
677 { |
|
678 return block_ack_usage_m; |
|
679 } |
|
680 |
|
681 // --------------------------------------------------------------------------- |
|
682 // --------------------------------------------------------------------------- |
|
683 // |
|
684 void core_settings_c::set_block_ack_usage( |
|
685 const core_block_ack_usage_s& usage ) |
|
686 { |
|
687 block_ack_usage_m = usage; |
|
688 } |
|
689 |
|
690 // --------------------------------------------------------------------------- |
|
691 // --------------------------------------------------------------------------- |
|
692 // |
|
693 void core_settings_c::add_iap_id_to_weak_iap_list( u32_t iap_id ) |
|
694 { |
|
695 if ( !is_iap_id_in_weak_list( iap_id ) ) |
|
696 { |
|
697 u32_t* weak_iap_id = new u32_t; |
|
698 if ( weak_iap_id ) |
|
699 { |
|
700 *weak_iap_id = iap_id; |
|
701 weak_iap_list_m.append( weak_iap_id ); |
|
702 } |
|
703 } |
|
704 } |
|
705 |
|
706 // --------------------------------------------------------------------------- |
|
707 // --------------------------------------------------------------------------- |
|
708 // |
|
709 bool_t core_settings_c::is_iap_id_in_weak_list( u32_t iap_id ) |
|
710 { |
|
711 u32_t* iap_id_p = weak_iap_list_m.first(); |
|
712 while ( iap_id_p ) |
|
713 { |
|
714 if ( *iap_id_p == iap_id ) |
|
715 { |
|
716 return true_t; |
|
717 } |
|
718 |
|
719 iap_id_p = weak_iap_list_m.next(); |
|
720 } |
|
721 |
|
722 return false_t; |
|
723 } |
|
724 |
|
725 // --------------------------------------------------------------------------- |
|
726 // --------------------------------------------------------------------------- |
|
727 // |
|
728 void core_settings_c::remove_iap_id_from_weak_list( u32_t iap_id ) |
|
729 { |
|
730 u32_t* iap_id_p = weak_iap_list_m.first(); |
|
731 while ( iap_id_p ) |
|
732 { |
|
733 if ( *iap_id_p == iap_id ) |
|
734 { |
|
735 weak_iap_list_m.remove( iap_id_p ); |
|
736 delete iap_id_p; |
|
737 |
|
738 return; |
|
739 } |
|
740 |
|
741 iap_id_p = weak_iap_list_m.next(); |
|
742 } |
|
743 } |
|
744 |
|
745 // --------------------------------------------------------------------------- |
|
746 // --------------------------------------------------------------------------- |
|
747 // |
|
748 bool_t core_settings_c::is_feature_enabled( |
|
749 core_feature_e feature ) const |
|
750 { |
|
751 if( features_m & feature ) |
|
752 { |
|
753 return true_t; |
|
754 } |
|
755 |
|
756 return false_t; |
|
757 } |