Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Scenes] Fixing Scenes Ifdef #33641

Merged
merged 1 commit into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion examples/lighting-app/silabs/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include "LEDWidget.h"

#include <app/clusters/on-off-server/on-off-server.h>
#include <app/clusters/scenes-server/scenes-server.h>
#include <app/server/OnboardingCodesUtil.h>
#include <app/server/Server.h>
#include <app/util/attribute-storage.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -431,15 +431,16 @@ ColorControlServer & ColorControlServer::Instance()
return instance;
}

#ifdef 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 // ifdef MATTER_DM_PLUGIN_SCENES_MANAGEMENT

bool ColorControlServer::HasFeature(chip::EndpointId endpoint, Feature feature)
{
Expand Down
9 changes: 8 additions & 1 deletion src/app/clusters/color-control-server/color-control-server.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,17 @@
#include <app-common/zap-generated/cluster-objects.h>
#include <app/CommandHandler.h>
#include <app/ConcreteCommandPath.h>
#include <app/clusters/scenes-server/SceneTable.h>
#include <app/util/af-types.h>
#include <app/util/attribute-storage.h>
#include <app/util/basic-types.h>
#include <app/util/config.h>
#include <platform/CHIPDeviceConfig.h>
#include <protocols/interaction_model/StatusCode.h>

#ifdef MATTER_DM_PLUGIN_SCENES_MANAGEMENT
lpbeliveau-silabs marked this conversation as resolved.
Show resolved Hide resolved
#include <app/clusters/scenes-server/SceneTable.h>
#endif

/**********************************************************
* Defines and Macros
*********************************************************/
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -272,7 +277,9 @@ class ColorControlServer

EmberEventControl eventControls[kColorControlClusterServerMaxEndpointCount];

#ifdef MATTER_DM_PLUGIN_SCENES_MANAGEMENT
friend class DefaultColorControlSceneHandler;
#endif
};

/**********************************************************
Expand Down
6 changes: 4 additions & 2 deletions src/app/clusters/level-control/level-control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -608,14 +608,16 @@ Status MoveToLevel(EndpointId endpointId, const Commands::MoveToLevel::Decodable
INVALID_STORED_LEVEL); // Don't revert to the stored level
}

#ifdef 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 // ifdef MATTER_DM_PLUGIN_SCENES_MANAGEMENT

} // namespace LevelControlServer

Expand Down
7 changes: 6 additions & 1 deletion src/app/clusters/level-control/level-control.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,12 @@

#include <app-common/zap-generated/cluster-enums.h>
#include <app-common/zap-generated/cluster-objects.h>
#include <app/clusters/scenes-server/SceneTable.h>
#include <app/util/basic-types.h>

#ifdef MATTER_DM_PLUGIN_SCENES_MANAGEMENT
#include <app/clusters/scenes-server/SceneTable.h>
#endif

/** @brief Level Control Cluster Server Post Init
*
* Following resolution of the Level Control state at startup for this endpoint, perform any
Expand All @@ -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
9 changes: 6 additions & 3 deletions src/app/clusters/on-off-server/on-off-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
* limitations under the License.
*/

#include <app/util/config.h>

#include "on-off-server.h"

#include <app-common/zap-generated/attributes/Accessors.h>
Expand Down Expand Up @@ -299,15 +301,16 @@ OnOffServer & OnOffServer::Instance()
return instance;
}

#ifdef 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 // ifdef MATTER_DM_PLUGIN_SCENES_MANAGEMENT

bool OnOffServer::HasFeature(chip::EndpointId endpoint, Feature feature)
{
Expand Down
9 changes: 8 additions & 1 deletion src/app/clusters/on-off-server/on-off-server.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,15 @@
#include <app-common/zap-generated/cluster-objects.h>
#include <app/CommandHandler.h>
#include <app/ConcreteCommandPath.h>
#include <app/clusters/scenes-server/SceneTable.h>
#include <app/util/af-types.h>
#include <app/util/basic-types.h>
#include <platform/CHIPDeviceConfig.h>
#include <protocols/interaction_model/StatusCode.h>

#ifdef MATTER_DM_PLUGIN_SCENES_MANAGEMENT
#include <app/clusters/scenes-server/SceneTable.h>
#endif

/**********************************************************
* Defines and Macros
*********************************************************/
Expand All @@ -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);
Expand Down Expand Up @@ -97,7 +102,9 @@ class OnOffServer
static OnOffServer instance;
chip::System::Clock::Timestamp nextDesiredOnWithTimedOffTimestamp;

#ifdef MATTER_DM_PLUGIN_SCENES_MANAGEMENT
friend class DefaultOnOffSceneHandler;
#endif
};

struct OnOffEffect
Expand Down
Loading