diff --git a/src/app/clusters/network-commissioning/network-commissioning.cpp b/src/app/clusters/network-commissioning/network-commissioning.cpp index 41741c70d266a4..323fa404301c2e 100644 --- a/src/app/clusters/network-commissioning/network-commissioning.cpp +++ b/src/app/clusters/network-commissioning/network-commissioning.cpp @@ -57,7 +57,9 @@ using namespace DeviceLayer::NetworkCommissioning; namespace { // For WiFi and Thread scan results, each item will cost ~60 bytes in TLV, thus 15 is a safe upper bound of scan results. +#if CHIP_DEVICE_CONFIG_ENABLE_WIFI_STATION || CHIP_DEVICE_CONFIG_ENABLE_WIFI_AP || CHIP_DEVICE_CONFIG_ENABLE_THREAD constexpr size_t kMaxNetworksInScanResponse = 15; +#endif constexpr uint16_t kCurrentClusterRevision = 2; @@ -545,6 +547,7 @@ bool CheckFailSafeArmed(CommandHandlerInterface::HandlerContext & ctx) void Instance::HandleAddOrUpdateWiFiNetwork(HandlerContext & ctx, const Commands::AddOrUpdateWiFiNetwork::DecodableType & req) { +#if CHIP_DEVICE_CONFIG_ENABLE_WIFI_STATION || CHIP_DEVICE_CONFIG_ENABLE_WIFI_AP MATTER_TRACE_SCOPE("HandleAddOrUpdateWiFiNetwork", "NetworkCommissioning"); VerifyOrReturn(CheckFailSafeArmed(ctx)); @@ -617,8 +620,10 @@ void Instance::HandleAddOrUpdateWiFiNetwork(HandlerContext & ctx, const Commands UpdateBreadcrumb(req.breadcrumb); ReportNetworksListChanged(); } +#endif } + #if CHIP_DEVICE_CONFIG_ENABLE_WIFI_PDC void Instance::HandleAddOrUpdateWiFiNetworkWithPDC(HandlerContext & ctx, const Commands::AddOrUpdateWiFiNetwork::DecodableType & req) @@ -727,6 +732,8 @@ void Instance::HandleAddOrUpdateWiFiNetworkWithPDC(HandlerContext & ctx, void Instance::HandleAddOrUpdateThreadNetwork(HandlerContext & ctx, const Commands::AddOrUpdateThreadNetwork::DecodableType & req) { +#if CHIP_DEVICE_CONFIG_ENABLE_THREAD + MATTER_TRACE_SCOPE("HandleAddOrUpdateThreadNetwork", "NetworkCommissioning"); VerifyOrReturn(CheckFailSafeArmed(ctx)); @@ -744,8 +751,10 @@ void Instance::HandleAddOrUpdateThreadNetwork(HandlerContext & ctx, const Comman ReportNetworksListChanged(); UpdateBreadcrumb(req.breadcrumb); } +#endif } + void Instance::UpdateBreadcrumb(const Optional & breadcrumb) { VerifyOrReturn(breadcrumb.HasValue()); @@ -979,6 +988,7 @@ void Instance::OnResult(Status commissioningError, CharSpan debugText, int32_t i void Instance::OnFinished(Status status, CharSpan debugText, ThreadScanResponseIterator * networks) { +#if CHIP_DEVICE_CONFIG_ENABLE_THREAD CHIP_ERROR err = CHIP_NO_ERROR; auto commandHandleRef = std::move(mAsyncCommandHandle); auto commandHandle = commandHandleRef.Get(); @@ -1089,10 +1099,12 @@ void Instance::OnFinished(Status status, CharSpan debugText, ThreadScanResponseI CommitSavedBreadcrumb(); } networks->Release(); +#endif } void Instance::OnFinished(Status status, CharSpan debugText, WiFiScanResponseIterator * networks) { +#if CHIP_DEVICE_CONFIG_ENABLE_WIFI_STATION || CHIP_DEVICE_CONFIG_ENABLE_WIFI_AP CHIP_ERROR err = CHIP_NO_ERROR; auto commandHandleRef = std::move(mAsyncCommandHandle); auto commandHandle = commandHandleRef.Get(); @@ -1169,8 +1181,10 @@ void Instance::OnFinished(Status status, CharSpan debugText, WiFiScanResponseIte { networks->Release(); } +#endif } + void Instance::OnPlatformEventHandler(const DeviceLayer::ChipDeviceEvent * event, intptr_t arg) { Instance * this_ = reinterpret_cast(arg); diff --git a/src/app/clusters/network-commissioning/network-commissioning.h b/src/app/clusters/network-commissioning/network-commissioning.h index cd2d5909c566d1..f0c766b41d3156 100644 --- a/src/app/clusters/network-commissioning/network-commissioning.h +++ b/src/app/clusters/network-commissioning/network-commissioning.h @@ -120,9 +120,13 @@ class Instance : public CommandHandlerInterface, // Actual handlers of the commands void HandleScanNetworks(HandlerContext & ctx, const Commands::ScanNetworks::DecodableType & req); + void HandleAddOrUpdateWiFiNetwork(HandlerContext & ctx, const Commands::AddOrUpdateWiFiNetwork::DecodableType & req); + void HandleAddOrUpdateWiFiNetworkWithPDC(HandlerContext & ctx, const Commands::AddOrUpdateWiFiNetwork::DecodableType & req); + void HandleAddOrUpdateThreadNetwork(HandlerContext & ctx, const Commands::AddOrUpdateThreadNetwork::DecodableType & req); + void HandleRemoveNetwork(HandlerContext & ctx, const Commands::RemoveNetwork::DecodableType & req); void HandleConnectNetwork(HandlerContext & ctx, const Commands::ConnectNetwork::DecodableType & req); void HandleReorderNetwork(HandlerContext & ctx, const Commands::ReorderNetwork::DecodableType & req); diff --git a/src/include/platform/NetworkCommissioning.h b/src/include/platform/NetworkCommissioning.h index 472ef6d6874d2c..c02bfe42a5f6be 100644 --- a/src/include/platform/NetworkCommissioning.h +++ b/src/include/platform/NetworkCommissioning.h @@ -265,7 +265,6 @@ class WiFiDriver : public Internal::WirelessDriver * message.) */ virtual void OnFinished(Status status, CharSpan debugText, WiFiScanResponseIterator * networks) = 0; - virtual ~ScanCallback() = default; }; @@ -399,7 +398,6 @@ class ThreadDriver : public Internal::WirelessDriver * message.) */ virtual void OnFinished(Status err, CharSpan debugText, ThreadScanResponseIterator * networks) = 0; - virtual ~ScanCallback() = default; };