Use ssid to get uuid then use uuid to connect wifi

This commit is contained in:
chenlelin 2021-04-15 10:57:29 +08:00
parent 7142c60b36
commit 406af20026
2 changed files with 5 additions and 5 deletions

View File

@ -405,12 +405,11 @@ void BackThread::execConnWifi(QString connName, QString connIfName)
QString wifiUuid = objBackThreadDBus.checkHasWifiConfigFile(connName);
if (!wifiUuid.isEmpty()) {
//有配置文件
qDebug() << "-------------------------> 000000002 " << wifiUuid;
//qDebug() << "-------------------------> wifiUuid = " << wifiUuid;
cmdStr = "export LANG='en_US.UTF-8';export LANGUAGE='en_US';nmcli connection up '" + wifiUuid + "'\n";
//cmdStr = "export LANG='en_US.UTF-8';export LANGUAGE='en_US';nmcli connection up '" + wifiUuid + "' ifname '" + connIfName + "'\n";
} else {
//没有配置文件
qDebug() << "-------------------------> 000000003" << connName;
//qDebug() << "-------------------------> connName = " << connName;
cmdStr = "export LANG='en_US.UTF-8';export LANGUAGE='en_US';nmcli connection up '" + connName + "' ifname '" + connIfName + "'\n";
}

View File

@ -859,8 +859,9 @@ QString KylinDBus::checkHasWifiConfigFile(QString wifiName)
dbusArg1st >> map;
if (map.value("connection").value("type").toString() == "802-11-wireless") {
if (map.value("connection").value("id").toString().indexOf(wifiName) != -1) {
qDebug() << "-------------------------> wifi id : " <<map.value("connection").value("id").toString();
if (map.value("802-11-wireless").value("ssid").toString() == wifiName) {
//qDebug() << "-------------------------> wifi ssid : " <<map.value("802-11-wireless").value("ssid").toString();
//qDebug() << "-------------------------> wifi id : " <<map.value("connection").value("id").toString();
wifiUuid = map.value("connection").value("uuid").toString();
}
}