From a059abba4d014e2e7a0e91dbff679f587810a5b8 Mon Sep 17 00:00:00 2001 From: chendejin Date: Thu, 5 Sep 2024 19:52:00 +0800 Subject: [PATCH] fix CI --- .../network-commissioning/network-commissioning.cpp | 4 +++- .../network-commissioning/network-commissioning.h | 12 ++++++++++-- src/platform/ESP32/NetworkCommissioningDriver.cpp | 2 ++ src/platform/ESP32/NetworkCommissioningDriver.h | 2 ++ .../GenericNetworkCommissioningThreadDriver.cpp | 2 ++ .../GenericNetworkCommissioningThreadDriver.h | 2 ++ 6 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/app/clusters/network-commissioning/network-commissioning.cpp b/src/app/clusters/network-commissioning/network-commissioning.cpp index 88ebc126031b1c..c53ebd84c7641e 100644 --- a/src/app/clusters/network-commissioning/network-commissioning.cpp +++ b/src/app/clusters/network-commissioning/network-commissioning.cpp @@ -337,7 +337,7 @@ CHIP_ERROR ThreadScanResponseToTLV::EncodeTo(TLV::TLVWriter & writer, TLV::Tag t } // namespace #if CHIP_DEVICE_CONFIG_SUPPORTS_CONCURRENT_CONNECTION -IntrusiveList Instance::sInstances; +Instance::NetworkInstanceList Instance::sInstances; #endif Instance::Instance(EndpointId aEndpointId, WiFiDriver * apDelegate) : @@ -1170,6 +1170,7 @@ void Instance::HandleQueryIdentity(HandlerContext & ctx, const Commands::QueryId } #endif // CHIP_DEVICE_CONFIG_ENABLE_WIFI_PDC +#if CHIP_DEVICE_CONFIG_SUPPORTS_CONCURRENT_CONNECTION void Instance::DisconnectLingeringConnection() { bool haveConnectedNetwork = false; @@ -1190,6 +1191,7 @@ void Instance::DisconnectLingeringConnection() LogErrorOnFailure(mpWirelessDriver->DisconnectFromNetwork()); } } +#endif void Instance::OnResult(Status commissioningError, CharSpan debugText, int32_t interfaceStatus) { diff --git a/src/app/clusters/network-commissioning/network-commissioning.h b/src/app/clusters/network-commissioning/network-commissioning.h index 5e3d6d7698ff35..18aa3127fab570 100644 --- a/src/app/clusters/network-commissioning/network-commissioning.h +++ b/src/app/clusters/network-commissioning/network-commissioning.h @@ -92,7 +92,13 @@ class Instance : public CommandHandlerInterface, // TODO: This could be guarded by a separate multi-interface condition instead #if CHIP_DEVICE_CONFIG_SUPPORTS_CONCURRENT_CONNECTION - static IntrusiveList sInstances; + class NetworkInstanceList : public IntrusiveList + { + public: + ~NetworkInstanceList() { this->Clear(); } + }; + + static NetworkInstanceList sInstances; #endif EndpointId mEndpointId = kInvalidEndpointId; @@ -125,8 +131,10 @@ class Instance : public CommandHandlerInterface, void SetLastNetworkId(ByteSpan lastNetworkId); void ReportNetworksListChanged() const; +#if CHIP_DEVICE_CONFIG_SUPPORTS_CONCURRENT_CONNECTION // Disconnect if the current connection is not in the Networks list void DisconnectLingeringConnection(); +#endif // Commits the breadcrumb value saved in mCurrentOperationBreadcrumb to the breadcrumb attribute in GeneralCommissioning // cluster. Will set mCurrentOperationBreadcrumb to NullOptional. @@ -151,7 +159,7 @@ class Instance : public CommandHandlerInterface, Instance(EndpointId aEndpointId, DeviceLayer::NetworkCommissioning::ThreadDriver * apDelegate); Instance(EndpointId aEndpointId, DeviceLayer::NetworkCommissioning::EthernetDriver * apDelegate); virtual ~Instance() = default; -}; // namespace NetworkCommissioning +}; // NetworkDriver for the devices that don't have / don't need a real network driver. class NullNetworkDriver : public DeviceLayer::NetworkCommissioning::EthernetDriver diff --git a/src/platform/ESP32/NetworkCommissioningDriver.cpp b/src/platform/ESP32/NetworkCommissioningDriver.cpp index ae911588452c8a..aa680b3e2bd50f 100644 --- a/src/platform/ESP32/NetworkCommissioningDriver.cpp +++ b/src/platform/ESP32/NetworkCommissioningDriver.cpp @@ -236,6 +236,7 @@ CHIP_ERROR ESPWiFiDriver::ConnectWiFiNetwork(const char * ssid, uint8_t ssidLen, return ConnectivityMgr().SetWiFiStationMode(ConnectivityManager::kWiFiStationMode_Enabled); } +#if CHIP_DEVICE_CONFIG_SUPPORTS_CONCURRENT_CONNECTION CHIP_ERROR ESPWiFiDriver::DisconnectFromNetwork() { if (chip::DeviceLayer::Internal::ESP32Utils::IsStationProvisioned()) @@ -245,6 +246,7 @@ CHIP_ERROR ESPWiFiDriver::DisconnectFromNetwork() } return CHIP_NO_ERROR; } +#endif void ESPWiFiDriver::OnConnectWiFiNetwork() { diff --git a/src/platform/ESP32/NetworkCommissioningDriver.h b/src/platform/ESP32/NetworkCommissioningDriver.h index 5dd1865c46a814..66dba918888b0d 100644 --- a/src/platform/ESP32/NetworkCommissioningDriver.h +++ b/src/platform/ESP32/NetworkCommissioningDriver.h @@ -107,7 +107,9 @@ class ESPWiFiDriver final : public WiFiDriver Status RemoveNetwork(ByteSpan networkId, MutableCharSpan & outDebugText, uint8_t & outNetworkIndex) override; Status ReorderNetwork(ByteSpan networkId, uint8_t index, MutableCharSpan & outDebugText) override; void ConnectNetwork(ByteSpan networkId, ConnectCallback * callback) override; +#if CHIP_DEVICE_CONFIG_SUPPORTS_CONCURRENT_CONNECTION CHIP_ERROR DisconnectFromNetwork() override; +#endif // WiFiDriver Status AddOrUpdateNetwork(ByteSpan ssid, ByteSpan credentials, MutableCharSpan & outDebugText, diff --git a/src/platform/OpenThread/GenericNetworkCommissioningThreadDriver.cpp b/src/platform/OpenThread/GenericNetworkCommissioningThreadDriver.cpp index f7a0f9656bdbf5..dfec9a74230e79 100644 --- a/src/platform/OpenThread/GenericNetworkCommissioningThreadDriver.cpp +++ b/src/platform/OpenThread/GenericNetworkCommissioningThreadDriver.cpp @@ -277,6 +277,7 @@ void GenericThreadDriver::CheckInterfaceEnabled() #endif } +#if CHIP_DEVICE_CONFIG_SUPPORTS_CONCURRENT_CONNECTION CHIP_ERROR GenericThreadDriver::DisconnectFromNetwork() { if (ThreadStackMgrImpl().IsThreadProvisioned()) @@ -287,6 +288,7 @@ CHIP_ERROR GenericThreadDriver::DisconnectFromNetwork() } return CHIP_NO_ERROR; } +#endif size_t GenericThreadDriver::ThreadNetworkIterator::Count() { diff --git a/src/platform/OpenThread/GenericNetworkCommissioningThreadDriver.h b/src/platform/OpenThread/GenericNetworkCommissioningThreadDriver.h index 9a715b7c889690..f570a85fef0211 100644 --- a/src/platform/OpenThread/GenericNetworkCommissioningThreadDriver.h +++ b/src/platform/OpenThread/GenericNetworkCommissioningThreadDriver.h @@ -110,7 +110,9 @@ class GenericThreadDriver final : public ThreadDriver Status RemoveNetwork(ByteSpan networkId, MutableCharSpan & outDebugText, uint8_t & outNetworkIndex) override; Status ReorderNetwork(ByteSpan networkId, uint8_t index, MutableCharSpan & outDebugText) override; void ConnectNetwork(ByteSpan networkId, ConnectCallback * callback) override; +#if CHIP_DEVICE_CONFIG_SUPPORTS_CONCURRENT_CONNECTION CHIP_ERROR DisconnectFromNetwork() override; +#endif // ThreadDriver Status AddOrUpdateNetwork(ByteSpan operationalDataset, MutableCharSpan & outDebugText, uint8_t & outNetworkIndex) override;