判断激活信号需要设备匹配

This commit is contained in:
jzxc95 2021-09-16 14:13:49 +08:00
parent 879835e547
commit 4936fa953e
4 changed files with 11 additions and 8 deletions

View File

@ -159,9 +159,10 @@ QString KyWirelessNetResource::getDeviceIFace(NetworkManager::ActiveConnection::
return sett->interfaceName();
}
void KyWirelessNetResource::getSsidByUuid(const QString uuid, QString &ssid)
void KyWirelessNetResource::getSsidByUuid(const QString uuid, QString &ssid, QString &devName)
{
ssid.clear();
devName.clear();
NetworkManager::Connection::Ptr connectPtr = m_networkResourceInstance->getConnect(uuid);
if (connectPtr.isNull()) {
return;
@ -173,6 +174,7 @@ void KyWirelessNetResource::getSsidByUuid(const QString uuid, QString &ssid)
return;
}
ssid = wireless_sett->ssid();
devName = connectPtr->settings()->interfaceName();
qDebug() << "getSsidByUuid success " << ssid;
return;
}

View File

@ -29,7 +29,7 @@ public:
void getWirelessActiveConnection(NetworkManager::ActiveConnection::State state, QMap<QString, QStringList> &map);
void getSsidByUuid(const QString uuid, QString &ssid);
void getSsidByUuid(const QString uuid, QString &ssid, QString &devName);
private:

View File

@ -382,13 +382,14 @@ void WlanListItem::onConnectionRemove(QString deviceName, QString ssid)
void WlanListItem::onWlanStatusChange(QString uuid, NetworkManager::ActiveConnection::State state, NetworkManager::ActiveConnection::Reason reason)
{
QString ssid;
m_resource->getSsidByUuid(uuid,ssid);
QString ssid, devName;
m_resource->getSsidByUuid(uuid, ssid, devName);
if (m_data->m_NetSsid == ssid) {
qDebug() << "[WlanPage] State changed to :" << state << Q_FUNC_INFO <<__LINE__;
if (state == NetworkManager::ActiveConnection::State::Activating) {
if ((state == NetworkManager::ActiveConnection::State::Activating || state == NetworkManager::ActiveConnection::State::Deactivating)
&& devName == m_wlanDevice) {
m_netButton->startLoading();
} else {
} else if (){
m_netButton->stopLoading();
}
}

View File

@ -430,7 +430,7 @@ void WlanPage::onActivatedWlanChanged(QString uuid, NetworkManager::ActiveConnec
qDebug() << "[WlanPage] onActivatedWlanChanged but uuid is invalid";
}
m_resource->getSsidByUuid(uuid, ssid);
m_resource->getSsidByUuid(uuid, ssid, devName);
qDebug() << "emit wlanActiveConnectionStateChanged" << devName << ssid << state;
emit wlanActiveConnectionStateChanged(devName, ssid, state);
@ -463,7 +463,7 @@ void WlanPage::onActivatedWlanChanged(QString uuid, NetworkManager::ActiveConnec
}
}
if (state == NetworkManager::ActiveConnection::State::Activated) {
if (state == NetworkManager::ActiveConnection::State::Activated && defaultDevice == devName) {
//onWlanRemoved(m_wlanDevice, ssid);
m_activatedNetListWidget->clear();
int height = 0;