From d54405c3d09573b5abc5969eff76d29fdae8c6fa Mon Sep 17 00:00:00 2001 From: thirupathi Date: Wed, 6 Sep 2023 22:36:45 +0530 Subject: [PATCH] addressed review comments --- examples/thermostat/silabs/include/AppTask.h | 9 --- examples/thermostat/silabs/src/AppTask.cpp | 74 ------------------- .../thermostat/silabs/src/ZclCallbacks.cpp | 4 +- 3 files changed, 2 insertions(+), 85 deletions(-) diff --git a/examples/thermostat/silabs/include/AppTask.h b/examples/thermostat/silabs/include/AppTask.h index 946b936a8e2172..695b7d5b8ed751 100644 --- a/examples/thermostat/silabs/include/AppTask.h +++ b/examples/thermostat/silabs/include/AppTask.h @@ -88,15 +88,6 @@ class AppTask : public BaseApplication */ static void ButtonEventHandler(uint8_t button, uint8_t btnAction); - /** - * @brief share the status to cloud using DIC - * - * @param attributeId attribute id for the attribute - */ -#ifdef DIC_ENABLE - void DIC_AttrubiteHandler(AttributeId attributeId); -#endif // DIC_ENABLE - private: static AppTask sAppTask; diff --git a/examples/thermostat/silabs/src/AppTask.cpp b/examples/thermostat/silabs/src/AppTask.cpp index 252850cf03663a..22d0bb3010b9ab 100644 --- a/examples/thermostat/silabs/src/AppTask.cpp +++ b/examples/thermostat/silabs/src/AppTask.cpp @@ -50,12 +50,6 @@ #include #include -#ifdef DIC_ENABLE -#define DECIMAL 10 -#define BYTE 5 -#include "dic.h" -#endif // DIC_ENABLE - /********************************************************** * Defines and Constants *********************************************************/ @@ -70,10 +64,6 @@ using namespace chip::app; using namespace chip::TLV; using namespace ::chip::DeviceLayer; -#ifdef DIC_ENABLE -namespace ThermAttr = chip::app::Clusters::Thermostat::Attributes; -#endif // DIC_ENABLE - /********************************************************** * Variable declarations *********************************************************/ @@ -183,67 +173,3 @@ void AppTask::ButtonEventHandler(uint8_t button, uint8_t btnAction) sAppTask.PostEvent(&aEvent); } } - -#ifdef DIC_ENABLE -void AppTask::DIC_AttrubiteHandler(AttributeId attributeId) -{ - switch (attributeId) - { - case ThermAttr::LocalTemperature::Id: { - int8_t CurrentTemp = TempMgr().GetCurrentTemp(); - char buffer[BYTE]; - itoa(CurrentTemp, buffer, DECIMAL); - dic_sendmsg("LocalTemperature/Temp", (const char *) (buffer)); - } - break; - case ThermAttr::OccupiedCoolingSetpoint::Id: { - int8_t coolingTemp = TempMgr().GetCoolingSetPoint(); - char buffer[BYTE]; - itoa(coolingTemp, buffer, DECIMAL); - dic_sendmsg("OccupiedCoolingSetpoint/coolingTemp", (const char *) (buffer)); - } - break; - case ThermAttr::OccupiedHeatingSetpoint::Id: { - int8_t heatingTemp = TempMgr().GetHeatingSetPoint(); - char buffer[BYTE]; - itoa(heatingTemp, buffer, DECIMAL); - dic_sendmsg("OccupiedHeatingSetpoint/heatingTemp", (const char *) (buffer)); - } - break; - case ThermAttr::SystemMode::Id: { - int8_t mode = TempMgr().GetMode(); - char buffer[BYTE]; - const char * Mode; - switch (mode) - { - case 0: - Mode = "OFF"; - break; - case 1: - Mode = "HEAT&COOL"; - break; - case 3: - Mode = "COOL"; - break; - case 4: - Mode = "HEAT"; - break; - default: - Mode = "INVALID MODE"; - break; - } - uint16_t current_temp = TempMgr().GetCurrentTemp(); - itoa(current_temp, buffer, DECIMAL); - dic_sendmsg("thermostat/systemMode", Mode); - dic_sendmsg("thermostat/currentTemp", (const char *) (buffer)); - } - break; - - default: { - SILABS_LOG("Unhandled thermostat attribute %x", attributeId); - return; - } - break; - } -} -#endif // DIC_ENABLE diff --git a/examples/thermostat/silabs/src/ZclCallbacks.cpp b/examples/thermostat/silabs/src/ZclCallbacks.cpp index 06f6417cdf80a1..4bac6080100006 100644 --- a/examples/thermostat/silabs/src/ZclCallbacks.cpp +++ b/examples/thermostat/silabs/src/ZclCallbacks.cpp @@ -29,7 +29,7 @@ #include #ifdef DIC_ENABLE -#include "AppTask.h" +#include "dic_control.h" #endif // DIC_ENABLE using namespace ::chip; @@ -51,7 +51,7 @@ void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & { TempMgr().AttributeChangeHandler(attributePath.mEndpointId, attributeId, value, size); #ifdef DIC_ENABLE - AppTask().DIC_AttrubiteHandler(attributeId); + dic::control::AttributeHandler(attributePath.mEndpointId,attributeId); #endif // DIC_ENABLE } }