diff --git a/src/app/clusters/network-commissioning/network-commissioning.cpp b/src/app/clusters/network-commissioning/network-commissioning.cpp index 88ebc126031b1c..6d4f3118875440 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; +IntrusiveList Instance::sInstances; #endif Instance::Instance(EndpointId aEndpointId, WiFiDriver * apDelegate) : @@ -1050,7 +1050,11 @@ void Instance::HandleConnectNetwork(HandlerContext & ctx, const Commands::Connec instance->DisconnectLingeringConnection(); } } - + ChipLogError(DeviceLayer, "%s:%d network id", __FILE__, __LINE__); + for (size_t i = 0; i < mConnectingNetworkIDLen; ++i) { + printf("%02x", mConnectingNetworkID[i]); + } + ChipLogError(DeviceLayer, "%s:%d network id", __FILE__, __LINE__); mpWirelessDriver->ConnectNetwork(req.networkID, this); #else // In Non-concurrent mode postpone the final execution of ConnectNetwork until the operational diff --git a/src/app/clusters/network-commissioning/network-commissioning.h b/src/app/clusters/network-commissioning/network-commissioning.h index 5e3d6d7698ff35..4bad925fd7a0f7 100644 --- a/src/app/clusters/network-commissioning/network-commissioning.h +++ b/src/app/clusters/network-commissioning/network-commissioning.h @@ -34,16 +34,11 @@ namespace app { namespace Clusters { namespace NetworkCommissioning { -// Instance inherits privately from this class to participate in Instance::sInstances -class InstanceListNode : public IntrusiveListNodeBase<> -{ -}; - // TODO: Use macro to disable some wifi or thread class Instance : public CommandHandlerInterface, public AttributeAccessInterface, #if CHIP_DEVICE_CONFIG_SUPPORTS_CONCURRENT_CONNECTION - private InstanceListNode, + public IntrusiveListNodeBase<>, #endif public DeviceLayer::NetworkCommissioning::Internal::BaseDriver::NetworkStatusChangeCallback, public DeviceLayer::NetworkCommissioning::Internal::WirelessDriver::ConnectCallback, @@ -92,7 +87,7 @@ 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; + static IntrusiveList sInstances; #endif EndpointId mEndpointId = kInvalidEndpointId; @@ -150,7 +145,15 @@ class Instance : public CommandHandlerInterface, Instance(EndpointId aEndpointId, DeviceLayer::NetworkCommissioning::WiFiDriver * apDelegate); Instance(EndpointId aEndpointId, DeviceLayer::NetworkCommissioning::ThreadDriver * apDelegate); Instance(EndpointId aEndpointId, DeviceLayer::NetworkCommissioning::EthernetDriver * apDelegate); - virtual ~Instance() = default; + virtual ~Instance() + { +#if CHIP_DEVICE_CONFIG_SUPPORTS_CONCURRENT_CONNECTION + if (sInstances.Contains(this)) + { + sInstances.Remove(this); + } +#endif + }; }; // namespace NetworkCommissioning // NetworkDriver for the devices that don't have / don't need a real network driver.