(self, interfaces: List[Dict])
| 524 | return global_enabled |
| 525 | |
| 526 | def _select_interfaces(self, interfaces: List[Dict]) -> List[Dict]: |
| 527 | max_interfaces = max(1, int(self.shared_data.config.get('wifi_multi_scan_max_interfaces', 2))) |
| 528 | default_iface = self._default_iface |
| 529 | hint = (self.shared_data.config.get('wifi_external_interface_hint') or '').strip() |
| 530 | |
| 531 | primary = next((iface for iface in interfaces if iface.get('name') == default_iface), None) |
| 532 | externals = [iface for iface in interfaces if iface.get('name') != default_iface] |
| 533 | externals.sort(key=lambda iface: (hint and iface.get('name') != hint, not iface.get('connected'), iface.get('name') or '')) |
| 534 | |
| 535 | selected: List[Dict] = [] |
| 536 | if primary: |
| 537 | selected.append(primary) |
| 538 | if externals: |
| 539 | selected.append(externals[0]) |
| 540 | |
| 541 | allowed = self.shared_data.config.get('wifi_allowed_scan_interfaces') or [] |
| 542 | if allowed: |
| 543 | whitelisted = [] |
| 544 | for iface in selected: |
| 545 | if iface.get('name') in allowed or iface.get('name') == default_iface: |
| 546 | whitelisted.append(iface) |
| 547 | selected = whitelisted |
| 548 | |
| 549 | return selected[:max_interfaces] |
no test coverage detected