MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / is_interface_connected

Method is_interface_connected

display.py:739–750  ·  view source on GitHub ↗

Check if any device is connected to the specified interface.

(self, interface)

Source from the content-addressed store, hash-verified

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:

Callers

nothing calls this directly

Calls 1

errorMethod · 0.80

Tested by

no test coverage detected