pull/36039/head
Shane Smiskol 3 days ago
parent 85c0eed42b
commit ce50a87047
  1. 2
      pyproject.toml
  2. 22
      system/ui/lib/wifi_manager.py

@ -101,7 +101,7 @@ dev = [
"av",
"azure-identity",
"azure-storage-blob",
"dbus-next",
"dbus-next", # TODO: remove this
"dictdiffer",
"matplotlib",
"opencv-python-headless",

@ -1,3 +1,4 @@
import sys
import atexit
import dbus
import threading
@ -146,6 +147,8 @@ class WifiManager:
self._lock = threading.Lock()
self._tmp_init()
self._scan_thread = threading.Thread(target=self._network_scanner, daemon=True)
self._scan_thread.start()
@ -154,6 +157,21 @@ class WifiManager:
atexit.register(self.stop)
sys.exit()
def _tmp_init(self):
t = time.monotonic()
a = self._get_connections()
print(time.monotonic() - t)
time.sleep(1)
t = time.monotonic()
b = self._get_connections_jeepney()
print(time.monotonic() - t)
print(a == b)
def set_callbacks(self, need_auth: Callable[[str], None],
activated: Callable[[], None] | None,
forgotten: Callable[[str], None],
@ -274,6 +292,10 @@ class WifiManager:
settings_iface = dbus.Interface(self._main_bus.get_object(NM, NM_SETTINGS_PATH), NM_SETTINGS_IFACE)
return settings_iface.ListConnections()
def _get_connections_jeepney(self) -> list[str]:
settings_addr = DBusAddress(NM_SETTINGS_PATH, bus_name=NM, interface=NM_SETTINGS_IFACE)
return self._conn_main.send_and_get_reply(new_method_call(settings_addr, 'ListConnections')).body[0]
def _connection_by_ssid(self, ssid: str, known_connections: list[dbus.ObjectPath] | None = None) -> dbus.ObjectPath | None:
for conn_path in known_connections or self._get_connections():
try:

Loading…
Cancel
Save