[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 <commits@restyled.io>
Co-authored-by: Andrei Litvin <andy314@gmail.com>
diff --git a/examples/chef/common/clusters/switch/SwitchEventHandler.cpp b/examples/chef/common/clusters/switch/SwitchEventHandler.cpp
index 55fae2a..691b0f4 100644
--- a/examples/chef/common/clusters/switch/SwitchEventHandler.cpp
+++ b/examples/chef/common/clusters/switch/SwitchEventHandler.cpp
@@ -17,13 +17,15 @@
*/
#include <app-common/zap-generated/attributes/Accessors.h>
-#ifdef MATTER_DM_PLUGIN_SWITCH_SERVER
#include <app/clusters/switch-server/switch-server.h>
#include <app/server/Server.h>
#include <platform/PlatformManager.h>
#include "SwitchEventHandler.h"
+#include <app/util/config.h>
+
+#if MATTER_DM_SWITCH_CLUSTER_SERVER_ENDPOINT_COUNT > 0
using namespace chip;
using namespace chip::app;
using namespace chip::app::Clusters;
@@ -78,4 +80,4 @@
Clusters::SwitchServer::Instance().OnMultiPressComplete(endpointId, previousPosition, count);
}
-#endif // MATTER_DM_PLUGIN_SWITCH_SERVER
+#endif // MATTER_DM_SWITCH_CLUSTER_SERVER_ENDPOINT_COUNT > 0
diff --git a/examples/chef/common/clusters/switch/SwitchManager.cpp b/examples/chef/common/clusters/switch/SwitchManager.cpp
index c308cb1..36f3984 100644
--- a/examples/chef/common/clusters/switch/SwitchManager.cpp
+++ b/examples/chef/common/clusters/switch/SwitchManager.cpp
@@ -16,7 +16,6 @@
* limitations under the License.
*/
-#ifdef MATTER_DM_PLUGIN_SWITCH_SERVER
#include "SwitchEventHandler.h"
#include <app-common/zap-generated/attributes/Accessors.h>
#include <app/clusters/switch-server/switch-server.h>
@@ -26,6 +25,9 @@
#include "chef-descriptor-namespace.h"
#include "chef-rpc-actions-worker.h"
+#include <app/util/config.h>
+
+#if MATTER_DM_SWITCH_CLUSTER_SERVER_ENDPOINT_COUNT > 0
using namespace chip;
using namespace chip::app;
@@ -168,4 +170,4 @@
ChefRpcActionsWorker::Instance().RegisterRpcActionsDelegate(Clusters::Switch::Id, gSwitchActionsDelegate);
SetTagList(/* endpoint= */ 1, Span<const Clusters::Descriptor::Structs::SemanticTagStruct::Type>(gLatchingSwitch));
}
-#endif // MATTER_DM_PLUGIN_SWITCH_SERVER
+#endif // MATTER_DM_SWITCH_CLUSTER_SERVER_ENDPOINT_COUNT > 0