mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-07-02 12:02:09 +08:00
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: b8b1e17a21390d9a80b1b0643c0001129292576c
This commit is contained in:
@@ -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;
|
||||
|
||||
SecurityType security = getSecurityType(properties);
|
||||
ConnectedType ctype = ConnectedType::DISCONNECTED;
|
||||
if (path.path() == activeAp) {
|
||||
ctype = (ssid == connecting_to_network) ? ConnectedType::CONNECTING : ConnectedType::CONNECTED;
|
||||
// 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)};
|
||||
}
|
||||
|
||||
if (path.path() == activeAp) {
|
||||
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();
|
||||
|
||||
Reference in New Issue
Block a user