Check if any device is connected to the specified interface.
(self, interface)
| 737 | |
| 738 | def get_ap_client_count(self): |
| 739 | """Get the number of clients connected to AP mode.""" |
| 740 | try: |
| 741 | # Try to get from WiFi manager first |
| 742 | if (hasattr(self.shared_data, 'ragnar_instance') and |
| 743 | self.shared_data.ragnar_instance and |
| 744 | hasattr(self.shared_data.ragnar_instance, 'wifi_manager')): |
| 745 | |
| 746 | wifi_mgr = self.shared_data.ragnar_instance.wifi_manager |
| 747 | if hasattr(wifi_mgr, 'ap_clients_count'): |
| 748 | return wifi_mgr.ap_clients_count |
| 749 | |
| 750 | # Fallback to hostapd_cli |
| 751 | result = subprocess.run(['hostapd_cli', '-i', self._wifi_iface, 'list_sta'], |
| 752 | capture_output=True, text=True, timeout=2) |
| 753 | if result.returncode == 0: |