From 56f9c2e4c9f63b2ecff7fb6dd98f6263df9bd158 Mon Sep 17 00:00:00 2001 From: zhangyuanyuan1 Date: Mon, 6 Mar 2023 10:54:49 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BD=91=E7=BB=9C=E8=BF=9E=E6=8E=A5=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E6=94=B9=E5=8F=98=E5=BC=82=E5=B8=B8=E6=83=85=E5=86=B5?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../depend/kylinnetworkresourcemanager.cpp | 14 +++++++++++--- .../depend/kylinnetworkresourcemanager.h | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/libnm-kylin/libnm-base-kylin/depend/kylinnetworkresourcemanager.cpp b/libnm-kylin/libnm-base-kylin/depend/kylinnetworkresourcemanager.cpp index 3f25236f..922f3c87 100644 --- a/libnm-kylin/libnm-base-kylin/depend/kylinnetworkresourcemanager.cpp +++ b/libnm-kylin/libnm-base-kylin/depend/kylinnetworkresourcemanager.cpp @@ -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."; } diff --git a/libnm-kylin/libnm-base-kylin/depend/kylinnetworkresourcemanager.h b/libnm-kylin/libnm-base-kylin/depend/kylinnetworkresourcemanager.h index a02c01ef..228aad75 100644 --- a/libnm-kylin/libnm-base-kylin/depend/kylinnetworkresourcemanager.h +++ b/libnm-kylin/libnm-base-kylin/depend/kylinnetworkresourcemanager.h @@ -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);