fix(wlan): modify onConnectionUpdate method and add signal(bug#190099)
This commit is contained in:
parent
b3c74a6d1b
commit
5190d5e838
|
@ -605,7 +605,6 @@ void WlanConnect::onActiveConnectionChanged(QString deviceName, QString ssid, QS
|
||||||
if (!deviceFrameMap.contains(deviceName)) {
|
if (!deviceFrameMap.contains(deviceName)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (int i = 0; i < deviceFrameMap[deviceName]->itemMap.size(); ++i) {
|
|
||||||
if (deviceFrameMap[deviceName]->itemMap.contains(ssid)) {
|
if (deviceFrameMap[deviceName]->itemMap.contains(ssid)) {
|
||||||
item = deviceFrameMap[deviceName]->itemMap[ssid];
|
item = deviceFrameMap[deviceName]->itemMap[ssid];
|
||||||
if (status == ACTIVATED || status == ACTIVATING) {
|
if (status == ACTIVATED || status == ACTIVATING) {
|
||||||
|
@ -621,9 +620,20 @@ void WlanConnect::onActiveConnectionChanged(QString deviceName, QString ssid, QS
|
||||||
deviceFrameMap[deviceName]->uuid.clear();
|
deviceFrameMap[deviceName]->uuid.clear();
|
||||||
//todo 断开后排序 现在等下次更新列表 自动排序
|
//todo 断开后排序 现在等下次更新列表 自动排序
|
||||||
}
|
}
|
||||||
break;
|
} else {
|
||||||
|
if (uuid == deviceFrameMap[deviceName]->uuid) {
|
||||||
|
QMap<QString, WlanItem*>::iterator itemIter;
|
||||||
|
for (itemIter = deviceFrameMap[deviceName]->itemMap.begin(); itemIter != deviceFrameMap[deviceName]->itemMap.end(); itemIter++) {
|
||||||
|
if (itemIter.value()->uuid == uuid ) {
|
||||||
|
item = itemIter.value();
|
||||||
|
if (status == DEACTIVATED) {
|
||||||
|
itemIter.value()->uuid.clear();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nullptr != item) {
|
if (nullptr != item) {
|
||||||
|
|
|
@ -863,25 +863,44 @@ void KyWirelessNetResource::onConnectionUpdate(QString uuid)
|
||||||
getSsidByUuid(uuid, ssid);
|
getSsidByUuid(uuid, ssid);
|
||||||
getDeviceByUuid(uuid, dev);
|
getDeviceByUuid(uuid, dev);
|
||||||
|
|
||||||
NetworkManager::Device::Ptr devicePtr = m_networkResourceInstance->findDeviceInterface(dev);
|
if (!dev.isEmpty()) {
|
||||||
if (devicePtr.isNull() || !m_WifiNetworkList.contains(dev)) {
|
NetworkManager::Device::Ptr devicePtr = m_networkResourceInstance->findDeviceInterface(dev);
|
||||||
return;
|
if (devicePtr.isNull() || !m_WifiNetworkList.contains(dev)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NetworkManager::WirelessNetwork::Ptr netPtr = m_networkResourceInstance->findWifiNetwork(ssid, devicePtr->uni());
|
QMap<QString, QList<KyWirelessNetItem> >::iterator iter;
|
||||||
if (netPtr.isNull()) {
|
for (iter = m_WifiNetworkList.begin(); iter != m_WifiNetworkList.end(); ++iter) {
|
||||||
return;
|
QList<KyWirelessNetItem>::iterator itemIter;
|
||||||
}
|
for (itemIter = iter.value().begin(); itemIter != iter.value().end(); ++itemIter) {
|
||||||
|
//判断是否有其他wifi配置 更新WIFI-bd 的connect相关变量 emit update
|
||||||
|
if (uuid == itemIter->m_connectUuid) {
|
||||||
|
if (itemIter->m_NetSsid != ssid ||
|
||||||
|
(iter.key() != dev && !dev.isEmpty())) {
|
||||||
|
updatewirelessItemConnectInfo(*itemIter);
|
||||||
|
Q_EMIT connectionUpdate(iter.key(), itemIter->m_NetSsid);
|
||||||
|
|
||||||
QList<KyWirelessNetItem> list = m_WifiNetworkList.value(dev);
|
//判断netptr是否为空 空返回
|
||||||
for (int i = 0; i < list.count(); ++i) {
|
//否则 更新ssid 的connect相关变量 emit update ssid
|
||||||
if (uuid == list.at(i).m_connectUuid) {
|
NetworkManager::Device::Ptr devicePtr = m_networkResourceInstance->findDeviceInterface(dev);
|
||||||
list.removeAt(i);
|
NetworkManager::WirelessNetwork::Ptr netPtr = m_networkResourceInstance->findWifiNetwork(ssid, devicePtr->uni());
|
||||||
|
if (netPtr.isNull()) {
|
||||||
|
qDebug() << LOG_FLAG << ssid << "netPtr is Null";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//更新WIFI 的connect相关变量 emit update to ui
|
||||||
|
if (ssid == itemIter->m_NetSsid) {
|
||||||
|
if (iter.key() == dev || dev.isEmpty()) {
|
||||||
|
updatewirelessItemConnectInfo(*itemIter);
|
||||||
|
Q_EMIT connectionUpdate(dev, itemIter->m_NetSsid);
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
list.append(KyWirelessNetItem(netPtr));
|
|
||||||
m_WifiNetworkList.insert(dev, list);
|
|
||||||
|
|
||||||
Q_EMIT wifiNetworkUpdate();
|
Q_EMIT wifiNetworkUpdate();
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,6 +84,7 @@ Q_SIGNALS:
|
||||||
void secuTypeChange(QString, QString, QString);
|
void secuTypeChange(QString, QString, QString);
|
||||||
void connectionRemove(QString, QString, QString);
|
void connectionRemove(QString, QString, QString);
|
||||||
void connectionAdd(QString, QString);
|
void connectionAdd(QString, QString);
|
||||||
|
void connectionUpdate(QString, QString);
|
||||||
void wifiNetworkUpdate();
|
void wifiNetworkUpdate();
|
||||||
void wifiNetworkAdd(QString, KyWirelessNetItem&);
|
void wifiNetworkAdd(QString, KyWirelessNetItem&);
|
||||||
void wifiNetworkRemove(QString, QString);
|
void wifiNetworkRemove(QString, QString);
|
||||||
|
|
|
@ -62,6 +62,7 @@ WlanPage::WlanPage(QWidget *parent) : TabPage(parent)
|
||||||
|
|
||||||
connect(m_wirelessNetResource, &KyWirelessNetResource::connectionAdd, this, &WlanPage::onConnectionAdd);
|
connect(m_wirelessNetResource, &KyWirelessNetResource::connectionAdd, this, &WlanPage::onConnectionAdd);
|
||||||
connect(m_wirelessNetResource, &KyWirelessNetResource::connectionRemove, this, &WlanPage::onConnectionRemove);
|
connect(m_wirelessNetResource, &KyWirelessNetResource::connectionRemove, this, &WlanPage::onConnectionRemove);
|
||||||
|
connect(m_wirelessNetResource, &KyWirelessNetResource::connectionUpdate, this, &WlanPage::onConnectionUpdate);
|
||||||
|
|
||||||
connect(m_activatedConnectResource, &KyActiveConnectResourse::stateChangeReason,
|
connect(m_activatedConnectResource, &KyActiveConnectResourse::stateChangeReason,
|
||||||
this, &WlanPage::onConnectionStateChanged);
|
this, &WlanPage::onConnectionStateChanged);
|
||||||
|
@ -687,6 +688,13 @@ void WlanPage::onConnectionRemove(QString deviceName, QString ssid, QString path
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WlanPage::onConnectionUpdate(QString deviceName, QString ssid)
|
||||||
|
{
|
||||||
|
if (deviceName == m_currentDevice || deviceName.isEmpty()) {
|
||||||
|
updateWlanListItem(ssid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void WlanPage::onSecurityTypeChange(QString devName, QString ssid, QString secuType)
|
void WlanPage::onSecurityTypeChange(QString devName, QString ssid, QString secuType)
|
||||||
{
|
{
|
||||||
QListWidgetItem *p_listWidgetItem = nullptr;
|
QListWidgetItem *p_listWidgetItem = nullptr;
|
||||||
|
|
|
@ -119,6 +119,7 @@ private Q_SLOTS:
|
||||||
|
|
||||||
void onConnectionAdd(QString deviceName, QString ssid);
|
void onConnectionAdd(QString deviceName, QString ssid);
|
||||||
void onConnectionRemove(QString deviceName, QString ssid, QString path);
|
void onConnectionRemove(QString deviceName, QString ssid, QString path);
|
||||||
|
void onConnectionUpdate(QString deviceName, QString ssid);
|
||||||
|
|
||||||
void onDeviceAdd(QString deviceName, NetworkManager::Device::Type deviceType);
|
void onDeviceAdd(QString deviceName, NetworkManager::Device::Type deviceType);
|
||||||
void onDeviceRemove(QString deviceName);
|
void onDeviceRemove(QString deviceName);
|
||||||
|
|
Loading…
Reference in New Issue