ui/networking: do not skip the connected network (#29396)

* do not skip connected network

* simplify

* revert

* revert

* no implicit

* ifwt

* fix missing ssid

* makes more sense to only update security_type once (first vs. last)

* better comment

---------

Co-authored-by: Shane Smiskol <shane@smiskol.com>
old-commit-hash: b8b1e17a21
beeps
Dean Lee 2 years ago committed by GitHub
parent 1988b4805e
commit 023cd0492f
  1. 19
      selfdrive/ui/qt/offroad/wifiManager.cc

@ -99,15 +99,22 @@ void WifiManager::refreshFinished(QDBusPendingCallWatcher *watcher) {
auto properties = replay.value();
const QByteArray ssid = properties["Ssid"].toByteArray();
uint32_t strength = properties["Strength"].toUInt();
if (ssid.isEmpty() || (seenNetworks.contains(ssid) && strength <= seenNetworks[ssid].strength)) continue;
if (ssid.isEmpty()) continue;
// May be multiple access points for each SSID.
// Use first for ssid and security type, then update connected status and strength using all
if (!seenNetworks.contains(ssid)) {
seenNetworks[ssid] = {ssid, 0U, ConnectedType::DISCONNECTED, getSecurityType(properties)};
}
SecurityType security = getSecurityType(properties);
ConnectedType ctype = ConnectedType::DISCONNECTED;
if (path.path() == activeAp) {
ctype = (ssid == connecting_to_network) ? ConnectedType::CONNECTING : ConnectedType::CONNECTED;
seenNetworks[ssid].connected = (ssid == connecting_to_network) ? ConnectedType::CONNECTING : ConnectedType::CONNECTED;
}
uint32_t strength = properties["Strength"].toUInt();
if (seenNetworks[ssid].strength < strength) {
seenNetworks[ssid].strength = strength;
}
seenNetworks[ssid] = {ssid, strength, ctype, security};
}
emit refreshSignal();

Loading…
Cancel
Save