diff --git a/selfdrive/ui/qt/offroad/wifiManager.cc b/selfdrive/ui/qt/offroad/wifiManager.cc index 9a5da5f372..4341c2babf 100644 --- a/selfdrive/ui/qt/offroad/wifiManager.cc +++ b/selfdrive/ui/qt/offroad/wifiManager.cc @@ -335,6 +335,7 @@ void WifiManager::stateChange(unsigned int new_state, unsigned int previous_stat void WifiManager::propertyChange(const QString &interface, const QVariantMap &props, const QStringList &invalidated_props) { if (interface == NM_DBUS_INTERFACE_DEVICE_WIRELESS && props.contains("LastScan")) { if (this->isVisible() || firstScan) { + activeAp = getActiveAp(); refreshNetworks(); emit refreshSignal(); firstScan = false; @@ -449,6 +450,16 @@ void WifiManager::setTetheringEnabled(bool enabled) { } } +QString WifiManager::getActiveAp() { + QDBusInterface device_props(NM_DBUS_SERVICE, adapter, NM_DBUS_INTERFACE_PROPERTIES, bus); + device_props.setTimeout(DBUS_TIMEOUT); + + QDBusMessage response = device_props.call("Get", NM_DBUS_INTERFACE_DEVICE_WIRELESS, "ActiveAccessPoint"); + QDBusObjectPath r = get_response(response); + return r.path(); +} + + bool WifiManager::isTetheringEnabled() { if (activeAp != "" && activeAp != "/") { return get_property(activeAp, "Ssid") == tethering_ssid; diff --git a/selfdrive/ui/qt/offroad/wifiManager.h b/selfdrive/ui/qt/offroad/wifiManager.h index 1136de7e67..d598406df2 100644 --- a/selfdrive/ui/qt/offroad/wifiManager.h +++ b/selfdrive/ui/qt/offroad/wifiManager.h @@ -70,6 +70,7 @@ private: QList get_networks(); void connect(const QByteArray &ssid, const QString &username, const QString &password, SecurityType security_type); QString activeAp; + QString getActiveAp(); void deactivateConnection(const QString &ssid); QVector get_active_connections(); uint get_wifi_device_state();