网络连接状态改变异常情况处理

This commit is contained in:
zhangyuanyuan1 2023-03-06 10:54:49 +08:00
parent bfeb0c2218
commit 56f9c2e4c9
2 changed files with 12 additions and 4 deletions

View File

@ -681,12 +681,19 @@ void KyNetworkResourceManager::wiredActiveStateChange(QString connectPath,
void KyNetworkResourceManager::connectActiveStateChange(NetworkManager::Connection::Ptr connectPtr,
QString deviceName,
KyConnectState state)
KyConnectState state, QString activeConnectUuid)
{
QString uuid = connectPtr->uuid();
NetworkManager::ConnectionSettings::Ptr connectSettingsPtr = connectPtr->settings();
KyConnectionType connectionType = (KyConnectionType)connectSettingsPtr->connectionType();
if (uuid.isEmpty()) {
//异常情况处理
Q_EMIT wirelessConnectStateChange(deviceName, "", activeConnectUuid, state);
Q_EMIT wirelessApConnectStateChange(deviceName, "", activeConnectUuid, state);
Q_EMIT wiredConnectStateChange(deviceName, activeConnectUuid, state);
return;
}
KyConnectionType connectionType = (KyConnectionType)connectSettingsPtr->connectionType();
if (connectionType == CONNECT_TYPE_WIRELESS) {
wirelessActiveStateChange(connectSettingsPtr, deviceName, uuid, state);
NetworkManager::WirelessSetting::Ptr wirelessSetting
@ -716,9 +723,10 @@ void KyNetworkResourceManager::onActiveConnectionChanged(
NetworkManager::Device:: Ptr devicePtr = findDeviceByUni(ifaceUni);
deviceName = devicePtr->interfaceName();
}
qDebug() << "KyNetworkResourceManager onActiveConnectionChanged" << activeConnect->uuid();
NetworkManager::Connection::Ptr connectPtr = activeConnect->connection();
connectActiveStateChange(connectPtr, deviceName, (KyConnectState)state);
connectActiveStateChange(connectPtr, deviceName, (KyConnectState)state, activeConnect->uuid());
} else {
qWarning() << LOG_FLAG << "onActiveConnectionChanged failed, the connection is invalid.";
}

View File

@ -122,7 +122,7 @@ private:
void wiredActiveStateChange(QString connectPath, QString deviceName,
QString uuid, KyConnectState state);
void connectActiveStateChange(NetworkManager::Connection::Ptr connectPtr,
QString deviceName, KyConnectState state);
QString deviceName, KyConnectState state, QString activeConnectUuid);
private Q_SLOTS:
void onServiceAppear(QString, QString, QString);