Skip to content

Commit

Permalink
Remove WriteRemainingDuration as it violates spec by allowing writes …
Browse files Browse the repository at this point in the history
…to a read-only atribute
  • Loading branch information
sxb427 committed Jan 30, 2025
1 parent 57e936d commit a020d68
Showing 1 changed file with 0 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,9 @@ class ValveConfigAndControlAttrAccess : public AttributeAccessInterface
{}

CHIP_ERROR Read(const ConcreteReadAttributePath & aPath, AttributeValueEncoder & aEncoder) override;
CHIP_ERROR Write(const ConcreteDataAttributePath & aPath, AttributeValueDecoder & aDecoder);

private:
CHIP_ERROR ReadRemainingDuration(EndpointId endpoint, AttributeValueEncoder & aEncoder);
CHIP_ERROR WriteRemainingDuration(EndpointId endpoint, AttributeValueDecoder & aDecoder);
};

ValveConfigAndControlAttrAccess gAttrAccess;
Expand Down Expand Up @@ -140,39 +138,6 @@ CHIP_ERROR ValveConfigAndControlAttrAccess::Read(const ConcreteReadAttributePath

return err;
}

CHIP_ERROR ValveConfigAndControlAttrAccess::WriteRemainingDuration(EndpointId endpoint, AttributeValueDecoder & aDecoder)
{
DataModel::Nullable<uint32_t> rDuration;
CHIP_ERROR res = aDecoder.Decode(rDuration);
if (res != CHIP_NO_ERROR)
return res;
if (rDuration.IsNull() || NumericAttributeTraits<uint32_t>::IsNullValue(rDuration.Value()))
return ValveConfigurationAndControl::SetRemainingDurationNull(endpoint);
else
return ValveConfigurationAndControl::SetRemainingDuration(endpoint, rDuration);
}

CHIP_ERROR ValveConfigAndControlAttrAccess::Write(const ConcreteDataAttributePath & aPath, AttributeValueDecoder & aDecoder)
{
if (aPath.mClusterId != ValveConfigurationAndControl::Id)
{
return CHIP_ERROR_INVALID_PATH_LIST;
}

switch (aPath.mAttributeId)
{
case RemainingDuration::Id: {
return WriteRemainingDuration(aPath.mEndpointId, aDecoder);
}
default: {
break;
}
}

return CHIP_NO_ERROR;
}

} // namespace

static void startRemainingDurationTick(EndpointId ep);
Expand Down

0 comments on commit a020d68

Please sign in to comment.