(self)
| 351 | return jobs |
| 352 | |
| 353 | def get_state_payload(self) -> Dict: |
| 354 | with self._lock: |
| 355 | focus_name = self.get_focus_interface() |
| 356 | focus_entry = self.interfaces.get(focus_name) if focus_name else None |
| 357 | |
| 358 | # Combine WiFi and Ethernet interfaces for the UI |
| 359 | all_interfaces = list(self.interfaces.values()) |
| 360 | for eth in self.ethernet_interfaces.values(): |
| 361 | if eth.get('connected') and eth.get('ip_address') and not eth.get('is_link_local'): |
| 362 | all_interfaces.append({ |
| 363 | 'name': eth['name'], |
| 364 | 'role': 'ethernet', |
| 365 | 'state': eth.get('state', 'UP'), |
| 366 | 'connected': True, |
| 367 | 'connected_ssid': 'LAN', |
| 368 | 'ip_address': eth.get('ip_address'), |
| 369 | 'cidr': eth.get('cidr'), |
| 370 | 'network_cidr': eth.get('network_cidr'), |
| 371 | 'mac_address': eth.get('mac_address'), |
| 372 | 'scan_enabled': self.shared_data.config.get('ethernet_scan_enabled', True), |
| 373 | 'interface_type': 'ethernet', |
| 374 | 'last_refresh': eth.get('last_refresh', self.ethernet_last_refresh), |
| 375 | }) |
| 376 | |
| 377 | payload = { |
| 378 | 'global_enabled': self.is_multi_mode_enabled(), |
| 379 | 'max_parallel': max(1, int(self.shared_data.config.get('wifi_multi_scan_max_parallel', 1))), |
| 380 | 'max_interfaces': max(1, int(self.shared_data.config.get('wifi_multi_scan_max_interfaces', 2))), |
| 381 | 'last_refresh': self.last_refresh, |
| 382 | 'interfaces': all_interfaces, |
| 383 | 'scan_mode': self.get_scan_mode(), |
| 384 | 'focus_interface': focus_name, |
| 385 | 'focus_interface_connected': bool(focus_entry and focus_entry.get('connected')), |
| 386 | 'focus_interface_ssid': focus_entry.get('connected_ssid') if focus_entry else None, |
| 387 | } |
| 388 | return payload |
| 389 | |
| 390 | def set_scan_enabled(self, interface_name: str, enabled: bool) -> Dict: |
| 391 | """Override scan enable flag for a specific interface.""" |
no test coverage detected