From 1c64d131f3a1e48716f027ab2ab7c0491d04c07c Mon Sep 17 00:00:00 2001 From: Thirupathi S <108743108+Thirsrin@users.noreply.github.com> Date: Tue, 12 Sep 2023 20:24:43 +0530 Subject: [PATCH] [Silabs] feature/DIC feature support for thermostat app and window app (#29084) * feature/DIC feature support for thermostat app and window app * Restyled by whitespace * Restyled by clang-format * addressed review comments * Restyled by clang-format * addressed review comments * addressed review comments --------- Co-authored-by: Restyled.io --- .../thermostat/silabs/src/ZclCallbacks.cpp | 7 ++++++ .../window-app/silabs/src/WindowManager.cpp | 23 ++++++++++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/examples/thermostat/silabs/src/ZclCallbacks.cpp b/examples/thermostat/silabs/src/ZclCallbacks.cpp index 734637d91be401..641f4c7698c27d 100644 --- a/examples/thermostat/silabs/src/ZclCallbacks.cpp +++ b/examples/thermostat/silabs/src/ZclCallbacks.cpp @@ -28,6 +28,10 @@ #include #include +#ifdef DIC_ENABLE +#include "dic_control.h" +#endif // DIC_ENABLE + using namespace ::chip; using namespace ::chip::app::Clusters; @@ -46,5 +50,8 @@ void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & else if (clusterId == Thermostat::Id) { TempMgr().AttributeChangeHandler(attributePath.mEndpointId, attributeId, value, size); +#ifdef DIC_ENABLE + dic::control::AttributeHandler(attributePath.mEndpointId, attributeId); +#endif // DIC_ENABLE } } diff --git a/examples/window-app/silabs/src/WindowManager.cpp b/examples/window-app/silabs/src/WindowManager.cpp index c6687ab2ba512e..851a818e9ec485 100644 --- a/examples/window-app/silabs/src/WindowManager.cpp +++ b/examples/window-app/silabs/src/WindowManager.cpp @@ -56,6 +56,12 @@ using namespace ::chip::DeviceLayer::Silabs; #define APP_STATE_LED 0 #define APP_ACTION_LED 1 +#ifdef DIC_ENABLE +#define DECIMAL 10 +#define MSG_SIZE 6 +#include "dic.h" +#endif // DIC_ENABLE + using namespace ::chip::Credentials; using namespace ::chip::DeviceLayer; using namespace chip::app::Clusters::WindowCovering; @@ -502,10 +508,25 @@ void WindowManager::Cover::CallbackPositionSet(intptr_t arg) position.SetNonNull(data->percent100ths); if (data->isTilt) + { TiltPositionSet(data->mEndpointId, position); +#ifdef DIC_ENABLE + uint16_t value = data->percent100ths; + char buffer[MSG_SIZE]; + itoa(value, buffer, DECIMAL); + dic_sendmsg("tilt/position set", (const char *) (buffer)); +#endif // DIC_ENABLE + } else + { LiftPositionSet(data->mEndpointId, position); - +#ifdef DIC_ENABLE + uint16_t value = data->percent100ths; + char buffer[MSG_SIZE]; + itoa(value, buffer, DECIMAL); + dic_sendmsg("lift/position set", (const char *) (buffer)); +#endif // DIC_ENABLE + } chip::Platform::Delete(data); }