IQ.Pilot Release Commit @ 9fe0487
This commit is contained in:
@@ -26,7 +26,7 @@ from openpilot.system.hardware import HARDWARE, PC
|
||||
from openpilot.system.ui.lib.multilang import multilang
|
||||
from openpilot.common.realtime import Ratekeeper
|
||||
|
||||
from openpilot.system.ui.iqpilot.lib.application import IQAppHooks
|
||||
from openpilot.system.ui.iqwidgets.lib.application import IQAppHooks
|
||||
from openpilot.system.ui.lib.screen_recorder import ScreenRecorder
|
||||
|
||||
_DEFAULT_FPS = int(os.getenv("FPS", {'tizi': 20, 'tici': 20}.get(HARDWARE.get_device_type(), 60)))
|
||||
|
||||
@@ -636,6 +636,7 @@ class WifiManager:
|
||||
cloudlog.warning("No WiFi device found")
|
||||
return
|
||||
|
||||
self._set_device_autoconnect(True)
|
||||
self._connecting_to_ssid = ssid
|
||||
self._router_main.send(new_method_call(self._nm, 'ActivateConnection', 'ooo',
|
||||
(conn_path, self._wifi_device, "/")))
|
||||
@@ -645,6 +646,37 @@ class WifiManager:
|
||||
else:
|
||||
threading.Thread(target=worker, daemon=True).start()
|
||||
|
||||
def disconnect_connection(self, ssid: str, block: bool = False):
|
||||
def worker():
|
||||
if self._router_main is None:
|
||||
cloudlog.warning(f"WiFi not ready while disconnecting {ssid}")
|
||||
return
|
||||
|
||||
if ssid not in self._get_connections():
|
||||
return
|
||||
|
||||
# the profile stays saved and untouched; without clearing autoconnect on the device
|
||||
# NetworkManager re-associates within seconds
|
||||
self._set_device_autoconnect(False)
|
||||
self._connecting_to_ssid = ""
|
||||
self._deactivate_connection(ssid)
|
||||
self._update_networks()
|
||||
self._enqueue_callbacks(self._disconnected)
|
||||
|
||||
if block:
|
||||
worker()
|
||||
else:
|
||||
threading.Thread(target=worker, daemon=True).start()
|
||||
|
||||
def _set_device_autoconnect(self, enabled: bool) -> None:
|
||||
if self._router_main is None or self._wifi_device is None:
|
||||
return
|
||||
|
||||
dev_addr = DBusAddress(self._wifi_device, bus_name=NM, interface=NM_DEVICE_IFACE)
|
||||
reply = self._router_main.send_and_get_reply(Properties(dev_addr).set('Autoconnect', 'b', enabled))
|
||||
if reply.header.message_type == MessageType.error:
|
||||
cloudlog.warning(f'Failed to set device autoconnect={enabled}: {reply}')
|
||||
|
||||
def _deactivate_connection(self, ssid: str):
|
||||
target_conn_path = self._get_connections().get(ssid, None)
|
||||
if target_conn_path is None:
|
||||
|
||||
Reference in New Issue
Block a user