should be working

pull/21750/head
ShaneSmiskol 4 years ago
parent 8985ab1fa3
commit 3b8c65f133
  1. 21
      selfdrive/ui/qt/offroad/wifiManager.cc

@ -368,7 +368,11 @@ QString WifiManager::getConnectionSsid(const QDBusObjectPath &path) {
QDBusInterface nm(NM_DBUS_SERVICE, path.path(), NM_DBUS_INTERFACE_SETTINGS_CONNECTION, bus); QDBusInterface nm(NM_DBUS_SERVICE, path.path(), NM_DBUS_INTERFACE_SETTINGS_CONNECTION, bus);
nm.setTimeout(DBUS_TIMEOUT); nm.setTimeout(DBUS_TIMEOUT);
const QDBusReply<Connection> result = nm.call("GetSettings"); const QDBusReply<Connection> result = nm.call("GetSettings");
return result.value().value("802-11-wireless").value("ssid").toString(); const QString &ssid = result.value().value("802-11-wireless").value("ssid").toString();
if (!ssid.isEmpty()) {
return ssid;
}
return result.value().value("connection").value("id").toString();
} }
void WifiManager::initConnections() { void WifiManager::initConnections() {
@ -421,18 +425,15 @@ NetworkType WifiManager::currentNetworkType() {
void WifiManager::setRoaming(bool roaming) { void WifiManager::setRoaming(bool roaming) {
const QDBusObjectPath &path = getConnectionPath("lte"); const QDBusObjectPath &path = getConnectionPath("lte");
if (!path.path().isEmpty()) { if (!path.path().isEmpty()) {
ElapsedTimer timer; QDBusInterface nm(NM_DBUS_SERVICE, path.path(), NM_DBUS_INTERFACE_SETTINGS_CONNECTION, bus);
timer.start();
QDBusInterface nm(NM_DBUS_INTERFACE, path.path(), NM_DBUS_INTERFACE_SETTINGS_CONNECTION, bus);
nm.setTimeout(DBUS_TIMEOUT); nm.setTimeout(DBUS_TIMEOUT);
Connection settings = QDBusReply<Connection>(nm.call("GetSettings")).value(); Connection settings = QDBusReply<Connection>(nm.call("GetSettings")).value();
qDebug() << "Getting settings took:" << timer.nsecsElapsed() / 1e6 << "ms"; bool prevRoaming = !settings.value("gsm").value("home-only").toBool();
qDebug() << "home only:" << settings["gsm"]["home-only"]; if (!settings.value("gsm").contains("home-only") || prevRoaming != roaming) {
timer.start(); settings["gsm"]["home-only"] = roaming ? "no" : "yes";
settings["gsm"]["home-only"] = roaming ? "no" : "yes"; nm.call("Update", QVariant::fromValue(settings));
nm.call("Update", QVariant::fromValue(settings)); }
qDebug() << "Saving settings took:" << timer.nsecsElapsed() / 1e6 << "ms";
} }
} }

Loading…
Cancel
Save