Skip to content

Commit

Permalink
Restyled by clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
restyled-commits authored and huangzh142 committed May 20, 2023
1 parent 44ee5fc commit 957095a
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/app/clusters/thermostat-server/thermostat-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,22 +85,24 @@ CHIP_ERROR ThermostatAttrAccess::Read(const ConcreteReadAttributePath & aPath, A
bool LTNESupported = false;
uint32_t OurFeatureMap;

if (FeatureMap::Get(aPath.mEndpointId, &OurFeatureMap) == EMBER_ZCL_STATUS_SUCCESS && OurFeatureMap & 1 << 6) // Bit 6 is LTNE supported
if (FeatureMap::Get(aPath.mEndpointId, &OurFeatureMap) == EMBER_ZCL_STATUS_SUCCESS &&
OurFeatureMap & 1 << 6) // Bit 6 is LTNE supported
LTNESupported = true;

switch (aPath.mAttributeId)
{
case LocalTemperature::Id: {
if(LTNESupported)
if (LTNESupported)
return aEncoder.EncodeNull();
break;
}
case RemoteSensing::Id: {
if(LTNESupported)
if (LTNESupported)
{
uint8_t valueRemoteSensing;
VerifyOrReturnValue(RemoteSensing::Get(aPath.mEndpointId, &valueRemoteSensing) == EMBER_ZCL_STATUS_SUCCESS, CHIP_NO_ERROR);
valueRemoteSensing &= 0xFE; // clear bit 1 (LocalTemperature RemoteSensing bit)
VerifyOrReturnValue(RemoteSensing::Get(aPath.mEndpointId, &valueRemoteSensing) == EMBER_ZCL_STATUS_SUCCESS,
CHIP_NO_ERROR);
valueRemoteSensing &= 0xFE; // clear bit 1 (LocalTemperature RemoteSensing bit)
return aEncoder.Encode(valueRemoteSensing);
}
break;
Expand All @@ -119,17 +121,18 @@ CHIP_ERROR ThermostatAttrAccess::Write(const ConcreteDataAttributePath & aPath,
bool LTNESupported = false;
uint32_t OurFeatureMap;

if (FeatureMap::Get(aPath.mEndpointId, &OurFeatureMap) == EMBER_ZCL_STATUS_SUCCESS && OurFeatureMap & 1 << 6) // Bit 6 is LTNE supported
if (FeatureMap::Get(aPath.mEndpointId, &OurFeatureMap) == EMBER_ZCL_STATUS_SUCCESS &&
OurFeatureMap & 1 << 6) // Bit 6 is LTNE supported
LTNESupported = true;

switch (aPath.mAttributeId)
{
case RemoteSensing::Id: {
if(LTNESupported)
if (LTNESupported)
{
uint8_t valueRemoteSensing;
ReturnErrorOnFailure(aDecoder.Decode(valueRemoteSensing));
if(valueRemoteSensing & 0x01) // If setting bit 1 (LocalTemperature RemoteSensing bit)
if (valueRemoteSensing & 0x01) // If setting bit 1 (LocalTemperature RemoteSensing bit)
{
return StatusIB(imcode::ConstraintError).ToChipError();
}
Expand Down

0 comments on commit 957095a

Please sign in to comment.