Skip to content

Commit 475828c

Browse files
Applied renaming, replaced the public api and added note for global attribute list
Co-authored-by: Boris Zbarsky <bzbarsky@apple.com>
1 parent 6c88309 commit 475828c

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/app/clusters/scenes-server/SceneHandlerImpl.cpp

+6-4
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,15 @@ namespace {
2727
/// @param[in] clusterID Cluster ID
2828
/// @param[in] attID Attribute ID
2929
/// @return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE if the attribute does not exist for a given cluster or is not scenable
30+
/// @note This will allways fail for global list attributes. If we do want to make them scenable someday, we will need to
31+
/// use a different validation method.
3032
// TODO: Assess if we also want to throw an error if the attribute value is out of range
3133
// TODO: Add check for "S" quality to determine if the attribute is scenable once suported :
3234
// https://github.com/project-chip/connectedhomeip/issues/24177
33-
CHIP_ERROR ValideAttribute(EndpointId endpoint, ClusterId cluster, AttributeId attributeId)
35+
CHIP_ERROR ValidateAttributePath(EndpointId endpoint, ClusterId cluster, AttributeId attributeId)
3436
{
35-
uint16_t attIndex = emberAfGetServerAttributeIndexByAttributeId(endpoint, cluster, attributeId);
36-
if (attIndex == UINT16_MAX)
37+
bool attIndex = emberAfContainsAttribute(endpoint, cluster, attributeId);
38+
if (!attIndex)
3739
{
3840
return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE;
3941
}
@@ -79,7 +81,7 @@ DefaultSceneHandlerImpl::SerializeAdd(EndpointId endpoint, const ExtensionFieldS
7981
auto pair_iterator = extensionFieldSet.attributeValueList.begin();
8082
while (pair_iterator.Next())
8183
{
82-
ReturnErrorOnFailure(ValideAttribute(endpoint, extensionFieldSet.clusterID, pair_iterator.GetValue().attributeID));
84+
ReturnErrorOnFailure(ValidateAttributePath(endpoint, extensionFieldSet.clusterID, pair_iterator.GetValue().attributeID));
8385
aVPairs[pairCount] = pair_iterator.GetValue();
8486
pairCount++;
8587
}

0 commit comments

Comments
 (0)