From 9830c79229605185a4fd1eae07e9f68db23cd50e Mon Sep 17 00:00:00 2001 From: lpbeliveau-silabs Date: Tue, 28 May 2024 13:50:59 -0400 Subject: [PATCH] ifdefing scenes table and server to allow building without the scenes cluster --- examples/lighting-app/silabs/src/AppTask.cpp | 1 - .../clusters/color-control-server/color-control-server.cpp | 7 ++++--- .../clusters/color-control-server/color-control-server.h | 7 ++++++- src/app/clusters/level-control/level-control.cpp | 6 ++++-- src/app/clusters/level-control/level-control.h | 7 ++++++- src/app/clusters/on-off-server/on-off-server.cpp | 7 ++++--- src/app/clusters/on-off-server/on-off-server.h | 7 ++++++- 7 files changed, 30 insertions(+), 12 deletions(-) diff --git a/examples/lighting-app/silabs/src/AppTask.cpp b/examples/lighting-app/silabs/src/AppTask.cpp index 338d6d85e2ef51..4f74ca7f348e78 100644 --- a/examples/lighting-app/silabs/src/AppTask.cpp +++ b/examples/lighting-app/silabs/src/AppTask.cpp @@ -24,7 +24,6 @@ #include "LEDWidget.h" #include -#include #include #include #include diff --git a/src/app/clusters/color-control-server/color-control-server.cpp b/src/app/clusters/color-control-server/color-control-server.cpp index 508f4b691bb0d1..741c868f8a195c 100644 --- a/src/app/clusters/color-control-server/color-control-server.cpp +++ b/src/app/clusters/color-control-server/color-control-server.cpp @@ -431,15 +431,16 @@ ColorControlServer & ColorControlServer::Instance() return instance; } +#if defined(MATTER_DM_PLUGIN_SCENES_MANAGEMENT) chip::scenes::SceneHandler * ColorControlServer::GetSceneHandler() { - -#if defined(MATTER_DM_PLUGIN_SCENES_MANAGEMENT) && CHIP_CONFIG_SCENES_USE_DEFAULT_HANDLERS +#if CHIP_CONFIG_SCENES_USE_DEFAULT_HANDLERS return &sColorControlSceneHandler; #else return nullptr; -#endif // defined(MATTER_DM_PLUGIN_SCENES_MANAGEMENT) && CHIP_CONFIG_SCENES_USE_DEFAULT_HANDLERS +#endif // CHIP_CONFIG_SCENES_USE_DEFAULT_HANDLERS } +#endif // defined(MATTER_DM_PLUGIN_SCENES_MANAGEMENT) bool ColorControlServer::HasFeature(chip::EndpointId endpoint, Feature feature) { diff --git a/src/app/clusters/color-control-server/color-control-server.h b/src/app/clusters/color-control-server/color-control-server.h index 72dabb5600ff33..470d4e0b991ed7 100644 --- a/src/app/clusters/color-control-server/color-control-server.h +++ b/src/app/clusters/color-control-server/color-control-server.h @@ -20,7 +20,6 @@ #include #include #include -#include #include #include #include @@ -28,6 +27,10 @@ #include #include +#ifdef MATTER_DM_PLUGIN_SCENES_MANAGEMENT +#include +#endif + /********************************************************** * Defines and Macros *********************************************************/ @@ -134,7 +137,9 @@ class ColorControlServer *********************************************************/ static ColorControlServer & Instance(); +#ifdef MATTER_DM_PLUGIN_SCENES_MANAGEMENT chip::scenes::SceneHandler * GetSceneHandler(); +#endif bool HasFeature(chip::EndpointId endpoint, Feature feature); chip::Protocols::InteractionModel::Status stopAllColorTransitions(chip::EndpointId endpoint); diff --git a/src/app/clusters/level-control/level-control.cpp b/src/app/clusters/level-control/level-control.cpp index b93bf50927c5eb..9113144a7a4dda 100644 --- a/src/app/clusters/level-control/level-control.cpp +++ b/src/app/clusters/level-control/level-control.cpp @@ -608,14 +608,16 @@ Status MoveToLevel(EndpointId endpointId, const Commands::MoveToLevel::Decodable INVALID_STORED_LEVEL); // Don't revert to the stored level } +#if defined(MATTER_DM_PLUGIN_SCENES_MANAGEMENT) chip::scenes::SceneHandler * GetSceneHandler() { -#if defined(MATTER_DM_PLUGIN_SCENES_MANAGEMENT) && CHIP_CONFIG_SCENES_USE_DEFAULT_HANDLERS +#if CHIP_CONFIG_SCENES_USE_DEFAULT_HANDLERS return &sLevelControlSceneHandler; #else return nullptr; -#endif // defined(MATTER_DM_PLUGIN_SCENES_MANAGEMENT) && CHIP_CONFIG_SCENES_USE_DEFAULT_HANDLERS +#endif // CHIP_CONFIG_SCENES_USE_DEFAULT_HANDLERS } +#endif // defined(MATTER_DM_PLUGIN_SCENES_MANAGEMENT) } // namespace LevelControlServer diff --git a/src/app/clusters/level-control/level-control.h b/src/app/clusters/level-control/level-control.h index 95497cc117e6d2..0240c921acd8b4 100644 --- a/src/app/clusters/level-control/level-control.h +++ b/src/app/clusters/level-control/level-control.h @@ -28,9 +28,12 @@ #include #include -#include #include +#ifdef MATTER_DM_PLUGIN_SCENES_MANAGEMENT +#include +#endif + /** @brief Level Control Cluster Server Post Init * * Following resolution of the Level Control state at startup for this endpoint, perform any @@ -53,6 +56,8 @@ chip::Protocols::InteractionModel::Status MoveToLevel(chip::EndpointId endpointId, const chip::app::Clusters::LevelControl::Commands::MoveToLevel::DecodableType & commandData); +#ifdef MATTER_DM_PLUGIN_SCENES_MANAGEMENT chip::scenes::SceneHandler * GetSceneHandler(); +#endif } // namespace LevelControlServer diff --git a/src/app/clusters/on-off-server/on-off-server.cpp b/src/app/clusters/on-off-server/on-off-server.cpp index bc71044ae44075..e3065ecd573324 100644 --- a/src/app/clusters/on-off-server/on-off-server.cpp +++ b/src/app/clusters/on-off-server/on-off-server.cpp @@ -299,15 +299,16 @@ OnOffServer & OnOffServer::Instance() return instance; } +#if defined(MATTER_DM_PLUGIN_SCENES_MANAGEMENT) chip::scenes::SceneHandler * OnOffServer::GetSceneHandler() { - -#if defined(MATTER_DM_PLUGIN_SCENES_MANAGEMENT) && CHIP_CONFIG_SCENES_USE_DEFAULT_HANDLERS +#if CHIP_CONFIG_SCENES_USE_DEFAULT_HANDLERS return &sOnOffSceneHandler; #else return nullptr; -#endif // defined(MATTER_DM_PLUGIN_SCENES_MANAGEMENT) && CHIP_CONFIG_SCENES_USE_DEFAULT_HANDLERS +#endif // CHIP_CONFIG_SCENES_USE_DEFAULT_HANDLERS } +#endif // defined(MATTER_DM_PLUGIN_SCENES_MANAGEMENT) bool OnOffServer::HasFeature(chip::EndpointId endpoint, Feature feature) { diff --git a/src/app/clusters/on-off-server/on-off-server.h b/src/app/clusters/on-off-server/on-off-server.h index 2cb5b62958a6c7..5b1432beda6506 100644 --- a/src/app/clusters/on-off-server/on-off-server.h +++ b/src/app/clusters/on-off-server/on-off-server.h @@ -20,12 +20,15 @@ #include #include #include -#include #include #include #include #include +#ifdef MATTER_DM_PLUGIN_SCENES_MANAGEMENT +#include +#endif + /********************************************************** * Defines and Macros *********************************************************/ @@ -50,7 +53,9 @@ class OnOffServer static OnOffServer & Instance(); +#ifdef MATTER_DM_PLUGIN_SCENES_MANAGEMENT chip::scenes::SceneHandler * GetSceneHandler(); +#endif bool offCommand(chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath); bool onCommand(chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath);