diff --git a/src/app/clusters/network-commissioning/network-commissioning.cpp b/src/app/clusters/network-commissioning/network-commissioning.cpp index 41741c70d266a4..a2a6e691209730 100644 --- a/src/app/clusters/network-commissioning/network-commissioning.cpp +++ b/src/app/clusters/network-commissioning/network-commissioning.cpp @@ -230,17 +230,21 @@ void Instance::InvokeCommand(HandlerContext & ctxt) ctxt, [this](HandlerContext & ctx, const auto & req) { HandleScanNetworks(ctx, req); }); return; +#if CHIP_DEVICE_CONFIG_ENABLE_WIFI_STATION || CHIP_DEVICE_CONFIG_ENABLE_WIFI_AP case Commands::AddOrUpdateWiFiNetwork::Id: VerifyOrReturn(mFeatureFlags.Has(Feature::kWiFiNetworkInterface)); HandleCommand( ctxt, [this](HandlerContext & ctx, const auto & req) { HandleAddOrUpdateWiFiNetwork(ctx, req); }); return; +#endif +#if CHIP_DEVICE_CONFIG_ENABLE_THREAD case Commands::AddOrUpdateThreadNetwork::Id: VerifyOrReturn(mFeatureFlags.Has(Feature::kThreadNetworkInterface)); HandleCommand( ctxt, [this](HandlerContext & ctx, const auto & req) { HandleAddOrUpdateThreadNetwork(ctx, req); }); return; +#endif case Commands::RemoveNetwork::Id: VerifyOrReturn(mFeatureFlags.Has(Feature::kWiFiNetworkInterface) || mFeatureFlags.Has(Feature::kThreadNetworkInterface)); @@ -543,6 +547,7 @@ bool CheckFailSafeArmed(CommandHandlerInterface::HandlerContext & ctx) } // namespace +#if CHIP_DEVICE_CONFIG_ENABLE_WIFI_STATION || CHIP_DEVICE_CONFIG_ENABLE_WIFI_AP void Instance::HandleAddOrUpdateWiFiNetwork(HandlerContext & ctx, const Commands::AddOrUpdateWiFiNetwork::DecodableType & req) { MATTER_TRACE_SCOPE("HandleAddOrUpdateWiFiNetwork", "NetworkCommissioning"); @@ -618,6 +623,7 @@ void Instance::HandleAddOrUpdateWiFiNetwork(HandlerContext & ctx, const Commands ReportNetworksListChanged(); } } +#endif #if CHIP_DEVICE_CONFIG_ENABLE_WIFI_PDC void Instance::HandleAddOrUpdateWiFiNetworkWithPDC(HandlerContext & ctx, @@ -725,6 +731,7 @@ void Instance::HandleAddOrUpdateWiFiNetworkWithPDC(HandlerContext & ctx, } #endif // CHIP_DEVICE_CONFIG_ENABLE_WIFI_PDC +#if CHIP_DEVICE_CONFIG_ENABLE_THREAD void Instance::HandleAddOrUpdateThreadNetwork(HandlerContext & ctx, const Commands::AddOrUpdateThreadNetwork::DecodableType & req) { MATTER_TRACE_SCOPE("HandleAddOrUpdateThreadNetwork", "NetworkCommissioning"); @@ -745,6 +752,7 @@ void Instance::HandleAddOrUpdateThreadNetwork(HandlerContext & ctx, const Comman UpdateBreadcrumb(req.breadcrumb); } } +#endif void Instance::UpdateBreadcrumb(const Optional & breadcrumb) { @@ -977,6 +985,7 @@ void Instance::OnResult(Status commissioningError, CharSpan debugText, int32_t i } } +#if CHIP_DEVICE_CONFIG_ENABLE_THREAD void Instance::OnFinished(Status status, CharSpan debugText, ThreadScanResponseIterator * networks) { CHIP_ERROR err = CHIP_NO_ERROR; @@ -1090,7 +1099,9 @@ void Instance::OnFinished(Status status, CharSpan debugText, ThreadScanResponseI } networks->Release(); } +#endif +#if CHIP_DEVICE_CONFIG_ENABLE_WIFI_STATION || CHIP_DEVICE_CONFIG_ENABLE_WIFI_AP void Instance::OnFinished(Status status, CharSpan debugText, WiFiScanResponseIterator * networks) { CHIP_ERROR err = CHIP_NO_ERROR; @@ -1170,6 +1181,7 @@ void Instance::OnFinished(Status status, CharSpan debugText, WiFiScanResponseIte networks->Release(); } } +#endif void Instance::OnPlatformEventHandler(const DeviceLayer::ChipDeviceEvent * event, intptr_t arg) { diff --git a/src/app/clusters/network-commissioning/network-commissioning.h b/src/app/clusters/network-commissioning/network-commissioning.h index cd2d5909c566d1..134addf44b1822 100644 --- a/src/app/clusters/network-commissioning/network-commissioning.h +++ b/src/app/clusters/network-commissioning/network-commissioning.h @@ -65,13 +65,17 @@ class Instance : public CommandHandlerInterface, void OnResult(DeviceLayer::NetworkCommissioning::Status commissioningError, CharSpan errorText, int32_t interfaceStatus) override; +#if CHIP_DEVICE_CONFIG_ENABLE_WIFI_STATION || CHIP_DEVICE_CONFIG_ENABLE_WIFI_AP // WiFiDriver::ScanCallback void OnFinished(DeviceLayer::NetworkCommissioning::Status err, CharSpan debugText, DeviceLayer::NetworkCommissioning::WiFiScanResponseIterator * networks) override; +#endif +#if CHIP_DEVICE_CONFIG_ENABLE_THREAD // ThreadDriver::ScanCallback void OnFinished(DeviceLayer::NetworkCommissioning::Status err, CharSpan debugText, DeviceLayer::NetworkCommissioning::ThreadScanResponseIterator * networks) override; +#endif private: static void OnPlatformEventHandler(const DeviceLayer::ChipDeviceEvent * event, intptr_t arg); @@ -120,9 +124,17 @@ class Instance : public CommandHandlerInterface, // Actual handlers of the commands void HandleScanNetworks(HandlerContext & ctx, const Commands::ScanNetworks::DecodableType & req); + +#if CHIP_DEVICE_CONFIG_ENABLE_WIFI_STATION || CHIP_DEVICE_CONFIG_ENABLE_WIFI_AP void HandleAddOrUpdateWiFiNetwork(HandlerContext & ctx, const Commands::AddOrUpdateWiFiNetwork::DecodableType & req); +#endif + void HandleAddOrUpdateWiFiNetworkWithPDC(HandlerContext & ctx, const Commands::AddOrUpdateWiFiNetwork::DecodableType & req); + +#if CHIP_DEVICE_CONFIG_ENABLE_THREAD void HandleAddOrUpdateThreadNetwork(HandlerContext & ctx, const Commands::AddOrUpdateThreadNetwork::DecodableType & req); +#endif + 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..3e28059b0189d1 100644 --- a/src/include/platform/NetworkCommissioning.h +++ b/src/include/platform/NetworkCommissioning.h @@ -264,7 +264,9 @@ class WiFiDriver : public Internal::WirelessDriver * iterator might be not fully consumed (i.e. There are too many networks scanned to fit in the buffer for scan response * message.) */ +#if CHIP_DEVICE_CONFIG_ENABLE_WIFI_STATION || CHIP_DEVICE_CONFIG_ENABLE_WIFI_AP virtual void OnFinished(Status status, CharSpan debugText, WiFiScanResponseIterator * networks) = 0; +#endif virtual ~ScanCallback() = default; }; @@ -398,7 +400,9 @@ class ThreadDriver : public Internal::WirelessDriver * iterator might be not fully consumed (i.e. There are too many networks scanned to fit in the buffer for scan response * message.) */ +#if CHIP_DEVICE_CONFIG_ENABLE_THREAD virtual void OnFinished(Status err, CharSpan debugText, ThreadScanResponseIterator * networks) = 0; +#endif virtual ~ScanCallback() = default; };