Skip to content

Commit 4c457a9

Browse files
committed
Fix emberAfIsTypeSigned not understanding temperature type
1 parent 9efed86 commit 4c457a9

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

src/app/clusters/thermostat-server/thermostat-server.cpp

+16-3
Original file line numberDiff line numberDiff line change
@@ -732,9 +732,6 @@ CHIP_ERROR ThermostatAttrAccess::Read(const ConcreteReadAttributePath & aPath, A
732732
Delegate * delegate = GetDelegate(aPath.mEndpointId);
733733
VerifyOrReturnError(delegate != nullptr, CHIP_ERROR_INCORRECT_STATE, ChipLogError(Zcl, "Delegate is null"));
734734

735-
if (InAtomicWrite(aPath.mEndpointId))
736-
{
737-
}
738735
return aEncoder.EncodeList([delegate](const auto & encoder) -> CHIP_ERROR {
739736
for (uint8_t i = 0; true; i++)
740737
{
@@ -761,6 +758,22 @@ CHIP_ERROR ThermostatAttrAccess::Read(const ConcreteReadAttributePath & aPath, A
761758
Delegate * delegate = GetDelegate(aPath.mEndpointId);
762759
VerifyOrReturnError(delegate != nullptr, CHIP_ERROR_INCORRECT_STATE, ChipLogError(Zcl, "Delegate is null"));
763760

761+
if (InAtomicWrite(aPath.mEndpointId))
762+
{
763+
return aEncoder.EncodeList([delegate](const auto & encoder) -> CHIP_ERROR {
764+
for (uint8_t i = 0; true; i++)
765+
{
766+
PresetStructWithOwnedMembers preset;
767+
auto err = delegate->GetPendingPresetAtIndex(i, preset);
768+
if (err == CHIP_ERROR_PROVIDER_LIST_EXHAUSTED)
769+
{
770+
return CHIP_NO_ERROR;
771+
}
772+
ReturnErrorOnFailure(err);
773+
ReturnErrorOnFailure(encoder.Encode(preset));
774+
}
775+
});
776+
}
764777
return aEncoder.EncodeList([delegate](const auto & encoder) -> CHIP_ERROR {
765778
for (uint8_t i = 0; true; i++)
766779
{

src/app/util/attribute-table.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ namespace {
4444
// Zigbee spec says types between signed 8 bit and signed 64 bit
4545
bool emberAfIsTypeSigned(EmberAfAttributeType dataType)
4646
{
47-
return (dataType >= ZCL_INT8S_ATTRIBUTE_TYPE && dataType <= ZCL_INT64S_ATTRIBUTE_TYPE);
47+
return (dataType >= ZCL_INT8S_ATTRIBUTE_TYPE && dataType <= ZCL_INT64S_ATTRIBUTE_TYPE) ||
48+
dataType == ZCL_TEMPERATURE_ATTRIBUTE_TYPE;
4849
}
4950

5051
/**

0 commit comments

Comments
 (0)