Skip to content

Commit

Permalink
Modified the datat type and the removed the callback
Browse files Browse the repository at this point in the history
  • Loading branch information
shgutte committed Sep 12, 2024
1 parent e1738d0 commit 9be01e2
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ class RefrigeratorManager
private:
friend RefrigeratorManager & RefrigeratorMgr();

uint8_t mCurrentMode;
uint8_t mStartUpMode;
uint8_t mOnMode;
int16_t mCurrentMode;
int16_t mStartUpMode;
int16_t mOnMode;

int16_t mTemperatureSetpoint;
int16_t mMinTemperature;
Expand Down
19 changes: 10 additions & 9 deletions examples/refrigerator-app/silabs/src/RefrigeratorManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "AppEvent.h"
#include "AppTask.h"
#include <app-common/zap-generated/attributes/Accessors.h>
#include <lib/support/logging/CHIPLogging.h>


/**********************************************************
Expand Down Expand Up @@ -100,19 +101,19 @@ void RefrigeratorManager::RefAndTempCtrlAttributeChangeHandler(EndpointId endpoi
switch (attributeId)
{
case RefAndTempAttr::CurrentMode::Id: {
int8_t currentMode = static_cast<int16_t>(*value);
int16_t currentMode = static_cast<int16_t>(*value);
mCurrentMode = currentMode;
}
break;

case RefAndTempAttr::StartUpMode::Id: {
int8_t startUpMode = static_cast<int16_t>(*value);
int16_t startUpMode = static_cast<int16_t>(*value);
mStartUpMode = startUpMode;
}
break;

case RefAndTempAttr::OnMode::Id: {
int8_t onMode = static_cast<int16_t>(*value);
int16_t onMode = static_cast<int16_t>(*value);
mOnMode = onMode;
}
break;
Expand Down Expand Up @@ -176,22 +177,22 @@ void RefrigeratorManager::RefAlaramAttributeChangeHandler(EndpointId endpointId,
switch (attributeId)
{
case RefAlarmAttr::Mask::Id: {
int8_t mask = static_cast<uint32_t>(*value);
mMask = mask;
auto mask = static_cast<uint32_t>(*value);
mState = static_cast<chip::app::Clusters::RefrigeratorAlarm::AlarmBitmap>(mask);
RefAlarmAttr::Mask::Set(endpointId, mMask);
}
break;

case RefAlarmAttr::State::Id: {
int8_t state = static_cast<uint32_t>(*value);
mState = state;
auto state = static_cast<uint32_t>(*value);
mState = static_cast<chip::app::Clusters::RefrigeratorAlarm::AlarmBitmap>(state);
RefAlarmAttr::State::Set(endpointId, mState);
}
break;

case RefAlarmAttr::Supported::Id: {
int8_t supported = static_cast<uint32_t>(*value);
mSupported = supported;
auto supported = static_cast<uint32_t>(*value);
mSupported = static_cast<chip::app::Clusters::RefrigeratorAlarm::AlarmBitmap>(supported);
RefAlarmAttr::Supported::Set(endpointId, mSupported);
}
break;
Expand Down
41 changes: 21 additions & 20 deletions examples/refrigerator-app/silabs/src/ZclCallbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,23 +105,24 @@ void emberAfRefrigeratorAlarmClusterInitCallback(EndpointId endpoint) {}
*/
void emberAfTemperatureControlClusterInitCallback(EndpointId endpoint) {}

/**
* @brief Handles the SetTemperature command for the Temperature Control Cluster.
*
* This function is called when the SetTemperature command is received from a client.
* It is responsible for setting the temperature for the cabinet as per the command data.
*
* @param CommandHandler commandObj Pointer to the command handler object.
* @param const ConcreteCommandPath commandPath The path of the command received.
* @param const DecodableType & commandData
* The data decoded from the SetTemperature command, which includes the desired temperature.
*
* @return bool Returns true if the command was handled successfully, false otherwise.
*
* @note The actual implementation to set the temperature is yet to be added.
*/
bool emberAfTemperatureControlClusterSetTemperatureCallback(
chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath,
const chip::app::Clusters::TemperatureControl::Commands::SetTemperature::DecodableType & commandData) {
// TODO: Add implementation to set the temperature for the cabinet
}
// /**
// * @brief Handles the SetTemperature command for the Temperature Control Cluster.
// *
// * This function is called when the SetTemperature command is received from a client.
// * It is responsible for setting the temperature for the cabinet as per the command data.
// *
// * @param CommandHandler commandObj Pointer to the command handler object.
// * @param const ConcreteCommandPath commandPath The path of the command received.
// * @param const DecodableType & commandData
// * The data decoded from the SetTemperature command, which includes the desired temperature.
// *
// * @return bool Returns true if the command was handled successfully, false otherwise.
// *
// * @note The actual implementation to set the temperature is yet to be added.
// */
// bool emberAfTemperatureControlClusterSetTemperatureCallback(
// chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath,
// const chip::app::Clusters::TemperatureControl::Commands::SetTemperature::DecodableType & commandData) {
// // TODO: Add implementation to set the temperature for the cabinet
// return true;
// }

0 comments on commit 9be01e2

Please sign in to comment.