Skip to content

Commit 6d51857

Browse files
ifdefing scenes table and server to allow building without the scenes cluster (#33641)
1 parent 194d918 commit 6d51857

File tree

7 files changed

+36
-12
lines changed

7 files changed

+36
-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

+6-3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
* limitations under the License.
1616
*/
1717

18+
#include <app/util/config.h>
19+
1820
#include "on-off-server.h"
1921

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

304+
#ifdef MATTER_DM_PLUGIN_SCENES_MANAGEMENT
302305
chip::scenes::SceneHandler * OnOffServer::GetSceneHandler()
303306
{
304-
305-
#if defined(MATTER_DM_PLUGIN_SCENES_MANAGEMENT) && CHIP_CONFIG_SCENES_USE_DEFAULT_HANDLERS
307+
#if CHIP_CONFIG_SCENES_USE_DEFAULT_HANDLERS
306308
return &sOnOffSceneHandler;
307309
#else
308310
return nullptr;
309-
#endif // defined(MATTER_DM_PLUGIN_SCENES_MANAGEMENT) && CHIP_CONFIG_SCENES_USE_DEFAULT_HANDLERS
311+
#endif // CHIP_CONFIG_SCENES_USE_DEFAULT_HANDLERS
310312
}
313+
#endif // ifdef MATTER_DM_PLUGIN_SCENES_MANAGEMENT
311314

312315
bool OnOffServer::HasFeature(chip::EndpointId endpoint, Feature feature)
313316
{

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

+8-1
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,15 @@
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>
2625
#include <platform/CHIPDeviceConfig.h>
2726
#include <protocols/interaction_model/StatusCode.h>
2827

28+
#ifdef MATTER_DM_PLUGIN_SCENES_MANAGEMENT
29+
#include <app/clusters/scenes-server/SceneTable.h>
30+
#endif
31+
2932
/**********************************************************
3033
* Defines and Macros
3134
*********************************************************/
@@ -50,7 +53,9 @@ class OnOffServer
5053

5154
static OnOffServer & Instance();
5255

56+
#ifdef MATTER_DM_PLUGIN_SCENES_MANAGEMENT
5357
chip::scenes::SceneHandler * GetSceneHandler();
58+
#endif
5459

5560
bool offCommand(chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath);
5661
bool onCommand(chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath);
@@ -97,7 +102,9 @@ class OnOffServer
97102
static OnOffServer instance;
98103
chip::System::Clock::Timestamp nextDesiredOnWithTimedOffTimestamp;
99104

105+
#ifdef MATTER_DM_PLUGIN_SCENES_MANAGEMENT
100106
friend class DefaultOnOffSceneHandler;
107+
#endif
101108
};
102109

103110
struct OnOffEffect

0 commit comments

Comments
 (0)