Skip to content

Commit

Permalink
addressed review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Thirsrin committed Sep 6, 2023
1 parent a9bcd58 commit 6f68f93
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 85 deletions.
9 changes: 0 additions & 9 deletions examples/thermostat/silabs/include/AppTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
74 changes: 0 additions & 74 deletions examples/thermostat/silabs/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,6 @@
#include <setup_payload/QRCodeSetupPayloadGenerator.h>
#include <setup_payload/SetupPayload.h>

#ifdef DIC_ENABLE
#define DECIMAL 10
#define BYTE 5
#include "dic.h"
#endif // DIC_ENABLE

/**********************************************************
* Defines and Constants
*********************************************************/
Expand All @@ -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
*********************************************************/
Expand Down Expand Up @@ -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
4 changes: 2 additions & 2 deletions examples/thermostat/silabs/src/ZclCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include <lib/support/logging/CHIPLogging.h>

#ifdef DIC_ENABLE
#include "AppTask.h"
#include "dic_control.h"
#endif // DIC_ENABLE

using namespace ::chip;
Expand All @@ -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
}
}

0 comments on commit 6f68f93

Please sign in to comment.