Skip to content

Commit 8bf8f4f

Browse files
ifdefing scenes table and server to allow building without the scenes cluster
1 parent 533df0c commit 8bf8f4f

File tree

7 files changed

+35
-12
lines changed

7 files changed

+35
-12
lines changed

examples/lighting-app/silabs/src/AppTask.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
#include "LEDWidget.h"
2525

2626
#include <app/clusters/on-off-server/on-off-server.h>
27-
#include <app/clusters/scenes-server/scenes-server.h>
2827
#include <app/server/OnboardingCodesUtil.h>
2928
#include <app/server/Server.h>
3029
#include <app/util/attribute-storage.h>

src/app/clusters/color-control-server/color-control-server.cpp

+4-3
Original file line numberDiff line numberDiff line change
@@ -431,15 +431,16 @@ ColorControlServer & ColorControlServer::Instance()
431431
return instance;
432432
}
433433

434+
#ifdef MATTER_DM_PLUGIN_SCENES_MANAGEMENT
434435
chip::scenes::SceneHandler * ColorControlServer::GetSceneHandler()
435436
{
436-
437-
#if defined(MATTER_DM_PLUGIN_SCENES_MANAGEMENT) && CHIP_CONFIG_SCENES_USE_DEFAULT_HANDLERS
437+
#if CHIP_CONFIG_SCENES_USE_DEFAULT_HANDLERS
438438
return &sColorControlSceneHandler;
439439
#else
440440
return nullptr;
441-
#endif // defined(MATTER_DM_PLUGIN_SCENES_MANAGEMENT) && CHIP_CONFIG_SCENES_USE_DEFAULT_HANDLERS
441+
#endif // CHIP_CONFIG_SCENES_USE_DEFAULT_HANDLERS
442442
}
443+
#endif // ifdef MATTER_DM_PLUGIN_SCENES_MANAGEMENT
443444

444445
bool ColorControlServer::HasFeature(chip::EndpointId endpoint, Feature feature)
445446
{

src/app/clusters/color-control-server/color-control-server.h

+8-1
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,17 @@
2020
#include <app-common/zap-generated/cluster-objects.h>
2121
#include <app/CommandHandler.h>
2222
#include <app/ConcreteCommandPath.h>
23-
#include <app/clusters/scenes-server/SceneTable.h>
2423
#include <app/util/af-types.h>
2524
#include <app/util/attribute-storage.h>
2625
#include <app/util/basic-types.h>
2726
#include <app/util/config.h>
2827
#include <platform/CHIPDeviceConfig.h>
2928
#include <protocols/interaction_model/StatusCode.h>
3029

30+
#ifdef MATTER_DM_PLUGIN_SCENES_MANAGEMENT
31+
#include <app/clusters/scenes-server/SceneTable.h>
32+
#endif
33+
3134
/**********************************************************
3235
* Defines and Macros
3336
*********************************************************/
@@ -134,7 +137,9 @@ class ColorControlServer
134137
*********************************************************/
135138
static ColorControlServer & Instance();
136139

140+
#ifdef MATTER_DM_PLUGIN_SCENES_MANAGEMENT
137141
chip::scenes::SceneHandler * GetSceneHandler();
142+
#endif
138143

139144
bool HasFeature(chip::EndpointId endpoint, Feature feature);
140145
chip::Protocols::InteractionModel::Status stopAllColorTransitions(chip::EndpointId endpoint);
@@ -272,7 +277,9 @@ class ColorControlServer
272277

273278
EmberEventControl eventControls[kColorControlClusterServerMaxEndpointCount];
274279

280+
#ifdef MATTER_DM_PLUGIN_SCENES_MANAGEMENT
275281
friend class DefaultColorControlSceneHandler;
282+
#endif
276283
};
277284

278285
/**********************************************************

src/app/clusters/level-control/level-control.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -608,14 +608,16 @@ Status MoveToLevel(EndpointId endpointId, const Commands::MoveToLevel::Decodable
608608
INVALID_STORED_LEVEL); // Don't revert to the stored level
609609
}
610610

611+
#ifdef MATTER_DM_PLUGIN_SCENES_MANAGEMENT
611612
chip::scenes::SceneHandler * GetSceneHandler()
612613
{
613-
#if defined(MATTER_DM_PLUGIN_SCENES_MANAGEMENT) && CHIP_CONFIG_SCENES_USE_DEFAULT_HANDLERS
614+
#if CHIP_CONFIG_SCENES_USE_DEFAULT_HANDLERS
614615
return &sLevelControlSceneHandler;
615616
#else
616617
return nullptr;
617-
#endif // defined(MATTER_DM_PLUGIN_SCENES_MANAGEMENT) && CHIP_CONFIG_SCENES_USE_DEFAULT_HANDLERS
618+
#endif // CHIP_CONFIG_SCENES_USE_DEFAULT_HANDLERS
618619
}
620+
#endif // ifdef MATTER_DM_PLUGIN_SCENES_MANAGEMENT
619621

620622
} // namespace LevelControlServer
621623

src/app/clusters/level-control/level-control.h

+6-1
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,12 @@
2828

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

33+
#ifdef MATTER_DM_PLUGIN_SCENES_MANAGEMENT
34+
#include <app/clusters/scenes-server/SceneTable.h>
35+
#endif
36+
3437
/** @brief Level Control Cluster Server Post Init
3538
*
3639
* Following resolution of the Level Control state at startup for this endpoint, perform any
@@ -53,6 +56,8 @@ chip::Protocols::InteractionModel::Status
5356
MoveToLevel(chip::EndpointId endpointId,
5457
const chip::app::Clusters::LevelControl::Commands::MoveToLevel::DecodableType & commandData);
5558

59+
#ifdef MATTER_DM_PLUGIN_SCENES_MANAGEMENT
5660
chip::scenes::SceneHandler * GetSceneHandler();
61+
#endif
5762

5863
} // namespace LevelControlServer

src/app/clusters/on-off-server/on-off-server.cpp

+4-3
Original file line numberDiff line numberDiff line change
@@ -299,15 +299,16 @@ OnOffServer & OnOffServer::Instance()
299299
return instance;
300300
}
301301

302+
#ifdef MATTER_DM_PLUGIN_SCENES_MANAGEMENT
302303
chip::scenes::SceneHandler * OnOffServer::GetSceneHandler()
303304
{
304-
305-
#if defined(MATTER_DM_PLUGIN_SCENES_MANAGEMENT) && CHIP_CONFIG_SCENES_USE_DEFAULT_HANDLERS
305+
#if CHIP_CONFIG_SCENES_USE_DEFAULT_HANDLERS
306306
return &sOnOffSceneHandler;
307307
#else
308308
return nullptr;
309-
#endif // defined(MATTER_DM_PLUGIN_SCENES_MANAGEMENT) && CHIP_CONFIG_SCENES_USE_DEFAULT_HANDLERS
309+
#endif // CHIP_CONFIG_SCENES_USE_DEFAULT_HANDLERS
310310
}
311+
#endif // ifdef MATTER_DM_PLUGIN_SCENES_MANAGEMENT
311312

312313
bool OnOffServer::HasFeature(chip::EndpointId endpoint, Feature feature)
313314
{

src/app/clusters/on-off-server/on-off-server.h

+9-1
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,16 @@
2020
#include <app-common/zap-generated/cluster-objects.h>
2121
#include <app/CommandHandler.h>
2222
#include <app/ConcreteCommandPath.h>
23-
#include <app/clusters/scenes-server/SceneTable.h>
2423
#include <app/util/af-types.h>
2524
#include <app/util/basic-types.h>
25+
#include <app/util/config.h>
2626
#include <platform/CHIPDeviceConfig.h>
2727
#include <protocols/interaction_model/StatusCode.h>
2828

29+
#ifdef MATTER_DM_PLUGIN_SCENES_MANAGEMENT
30+
#include <app/clusters/scenes-server/SceneTable.h>
31+
#endif
32+
2933
/**********************************************************
3034
* Defines and Macros
3135
*********************************************************/
@@ -50,7 +54,9 @@ class OnOffServer
5054

5155
static OnOffServer & Instance();
5256

57+
#ifdef MATTER_DM_PLUGIN_SCENES_MANAGEMENT
5358
chip::scenes::SceneHandler * GetSceneHandler();
59+
#endif
5460

5561
bool offCommand(chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath);
5662
bool onCommand(chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath);
@@ -97,7 +103,9 @@ class OnOffServer
97103
static OnOffServer instance;
98104
chip::System::Clock::Timestamp nextDesiredOnWithTimedOffTimestamp;
99105

106+
#ifdef MATTER_DM_PLUGIN_SCENES_MANAGEMENT
100107
friend class DefaultOnOffSceneHandler;
108+
#endif
101109
};
102110

103111
struct OnOffEffect

0 commit comments

Comments
 (0)