mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-06-30 19:12:07 +08:00
Wifi correct ip (#19961)
old-commit-hash: 82b894c645471a409dbb5b76562edc59b0cb62b9
This commit is contained in:
@@ -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 "";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user