Skip to content

Commit a86ec95

Browse files
sxb427restyled-commitsandy31415
authored
[Chef] Switch - Add missing include for ifdef (#39044)
* include app/util/config.h * Restyled by clang-format * safer to #if MATTER_DM_SWITCH_SERVER_ENDPOINT_COUNT > 0, in which case the compiler will catch the config headers not being there * Fix incorrect macro name --------- Co-authored-by: Restyled.io <[email protected]> Co-authored-by: Andrei Litvin <[email protected]>
1 parent 750ecf7 commit a86ec95

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

examples/chef/common/clusters/switch/SwitchEventHandler.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,15 @@
1717
*/
1818

1919
#include <app-common/zap-generated/attributes/Accessors.h>
20-
#ifdef MATTER_DM_PLUGIN_SWITCH_SERVER
2120
#include <app/clusters/switch-server/switch-server.h>
2221
#include <app/server/Server.h>
2322
#include <platform/PlatformManager.h>
2423

2524
#include "SwitchEventHandler.h"
2625

26+
#include <app/util/config.h>
27+
28+
#if MATTER_DM_SWITCH_CLUSTER_SERVER_ENDPOINT_COUNT > 0
2729
using namespace chip;
2830
using namespace chip::app;
2931
using namespace chip::app::Clusters;
@@ -78,4 +80,4 @@ void SwitchEventHandler::OnMultiPressComplete(EndpointId endpointId, uint8_t pre
7880

7981
Clusters::SwitchServer::Instance().OnMultiPressComplete(endpointId, previousPosition, count);
8082
}
81-
#endif // MATTER_DM_PLUGIN_SWITCH_SERVER
83+
#endif // MATTER_DM_SWITCH_CLUSTER_SERVER_ENDPOINT_COUNT > 0

examples/chef/common/clusters/switch/SwitchManager.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
* limitations under the License.
1717
*/
1818

19-
#ifdef MATTER_DM_PLUGIN_SWITCH_SERVER
2019
#include "SwitchEventHandler.h"
2120
#include <app-common/zap-generated/attributes/Accessors.h>
2221
#include <app/clusters/switch-server/switch-server.h>
@@ -26,6 +25,9 @@
2625

2726
#include "chef-descriptor-namespace.h"
2827
#include "chef-rpc-actions-worker.h"
28+
#include <app/util/config.h>
29+
30+
#if MATTER_DM_SWITCH_CLUSTER_SERVER_ENDPOINT_COUNT > 0
2931

3032
using namespace chip;
3133
using namespace chip::app;
@@ -168,4 +170,4 @@ void emberAfSwitchClusterInitCallback(EndpointId endpointId)
168170
ChefRpcActionsWorker::Instance().RegisterRpcActionsDelegate(Clusters::Switch::Id, gSwitchActionsDelegate);
169171
SetTagList(/* endpoint= */ 1, Span<const Clusters::Descriptor::Structs::SemanticTagStruct::Type>(gLatchingSwitch));
170172
}
171-
#endif // MATTER_DM_PLUGIN_SWITCH_SERVER
173+
#endif // MATTER_DM_SWITCH_CLUSTER_SERVER_ENDPOINT_COUNT > 0

0 commit comments

Comments
 (0)