Wifi correct ip (#19961)

pull/19965/head
grekiki 2021-01-29 16:22:35 +01:00 committed by GitHub
parent dd3a260676
commit 82b894c645
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 9 deletions

View File

@ -110,17 +110,21 @@ QString WifiManager::get_ipv4_address(){
QDBusObjectPath pth = get_response<QDBusObjectPath>(nm.call("Get", connection_iface, "Ip4Config"));
QString ip4config = pth.path();
QDBusInterface nm2(nm_service, ip4config, props_iface, bus);
const QDBusArgument &arr = get_response<QDBusArgument>(nm2.call("Get", ipv4config_iface, "AddressData"));
QMap<QString, QVariant> pth2;
arr.beginArray();
while (!arr.atEnd()){
arr >> pth2;
QString ipv4 = pth2.value("address").value<QString>();
QString type = get_response<QString>(nm.call("Get", connection_iface, "Type"));
if (type == "802-11-wireless") {
QDBusInterface nm2(nm_service, ip4config, props_iface, bus);
const QDBusArgument &arr = get_response<QDBusArgument>(nm2.call("Get", ipv4config_iface, "AddressData"));
QMap<QString, QVariant> pth2;
arr.beginArray();
while (!arr.atEnd()){
arr >> pth2;
QString ipv4 = pth2.value("address").value<QString>();
arr.endArray();
return ipv4;
}
arr.endArray();
return ipv4;
}
arr.endArray();
}
return "";
}