|
|
@ -441,20 +441,19 @@ class WifiManager: |
|
|
|
settings_iface.on_connection_removed(self._on_connection_removed) |
|
|
|
settings_iface.on_connection_removed(self._on_connection_removed) |
|
|
|
|
|
|
|
|
|
|
|
def _on_properties_changed(self, interface: str, changed: dict, invalidated: list): |
|
|
|
def _on_properties_changed(self, interface: str, changed: dict, invalidated: list): |
|
|
|
if 'LastScan' in changed: |
|
|
|
if interface == NM_WIRELESS_IFACE and 'LastScan' in changed: |
|
|
|
asyncio.create_task(self._refresh_networks()) |
|
|
|
asyncio.create_task(self._refresh_networks()) |
|
|
|
elif interface == NM_WIRELESS_IFACE and "ActiveAccessPoint" in changed: |
|
|
|
elif interface == NM_WIRELESS_IFACE and "ActiveAccessPoint" in changed: |
|
|
|
new_ap_path = changed["ActiveAccessPoint"].value |
|
|
|
new_ap_path = changed["ActiveAccessPoint"].value |
|
|
|
if self.active_ap_path != new_ap_path: |
|
|
|
if self.active_ap_path != new_ap_path: |
|
|
|
self.active_ap_path = new_ap_path |
|
|
|
self.active_ap_path = new_ap_path |
|
|
|
asyncio.create_task(self._refresh_networks()) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _on_state_changed(self, new_state: int, old_state: int, reason: int): |
|
|
|
def _on_state_changed(self, new_state: int, old_state: int, reason: int): |
|
|
|
if new_state == NMDeviceState.ACTIVATED: |
|
|
|
if new_state == NMDeviceState.ACTIVATED: |
|
|
|
if self.callbacks.activated: |
|
|
|
if self.callbacks.activated: |
|
|
|
self.callbacks.activated() |
|
|
|
self.callbacks.activated() |
|
|
|
asyncio.create_task(self._refresh_networks()) |
|
|
|
|
|
|
|
self._current_connection_ssid = None |
|
|
|
self._current_connection_ssid = None |
|
|
|
|
|
|
|
asyncio.create_task(self._refresh_networks()) |
|
|
|
elif new_state in (NMDeviceState.DISCONNECTED, NMDeviceState.NEED_AUTH): |
|
|
|
elif new_state in (NMDeviceState.DISCONNECTED, NMDeviceState.NEED_AUTH): |
|
|
|
for network in self.networks: |
|
|
|
for network in self.networks: |
|
|
|
network.is_connected = False |
|
|
|
network.is_connected = False |
|
|
@ -487,9 +486,6 @@ class WifiManager: |
|
|
|
|
|
|
|
|
|
|
|
if self.callbacks.forgotten: |
|
|
|
if self.callbacks.forgotten: |
|
|
|
self.callbacks.forgotten(ssid) |
|
|
|
self.callbacks.forgotten(ssid) |
|
|
|
|
|
|
|
|
|
|
|
# Update network list to reflect the removed saved connection |
|
|
|
|
|
|
|
asyncio.create_task(self._refresh_networks()) |
|
|
|
|
|
|
|
break |
|
|
|
break |
|
|
|
|
|
|
|
|
|
|
|
async def _add_saved_connection(self, path: str) -> None: |
|
|
|
async def _add_saved_connection(self, path: str) -> None: |
|
|
@ -498,7 +494,6 @@ class WifiManager: |
|
|
|
settings = await self._get_connection_settings(path) |
|
|
|
settings = await self._get_connection_settings(path) |
|
|
|
if ssid := self._extract_ssid(settings): |
|
|
|
if ssid := self._extract_ssid(settings): |
|
|
|
self.saved_connections[ssid] = path |
|
|
|
self.saved_connections[ssid] = path |
|
|
|
await self._refresh_networks() |
|
|
|
|
|
|
|
except DBusError as e: |
|
|
|
except DBusError as e: |
|
|
|
cloudlog.error(f"Failed to add connection {path}: {e}") |
|
|
|
cloudlog.error(f"Failed to add connection {path}: {e}") |
|
|
|
|
|
|
|
|
|
|
|