Skip to content

Commit

Permalink
Iterate over parent endpoints chain to fill Aggregator PartsList prop…
Browse files Browse the repository at this point in the history
…erly. (#19721)
  • Loading branch information
AntonGrey authored and pull[bot] committed Jun 28, 2022
1 parent 07acbf6 commit 1057186
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions src/app/clusters/descriptor/descriptor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,23 @@ CHIP_ERROR DescriptorAttrAccess::ReadPartsAttribute(EndpointId endpoint, Attribu
err = aEncoder.EncodeList([endpoint](const auto & encoder) -> CHIP_ERROR {
for (uint16_t index = 0; index < emberAfEndpointCount(); index++)
{
if (emberAfEndpointIndexIsEnabled(index))
if (!emberAfEndpointIndexIsEnabled(index))
continue;

uint16_t childIndex = index;
while (childIndex != chip::kInvalidListIndex)
{
EndpointId composedEndpointId = emberAfParentEndpointFromIndex(index);
if (composedEndpointId == chip::kInvalidEndpointId || composedEndpointId != endpoint)
continue;
EndpointId parentEndpointId = emberAfParentEndpointFromIndex(childIndex);
if (parentEndpointId == chip::kInvalidEndpointId)
break;

if (parentEndpointId == endpoint)
{
ReturnErrorOnFailure(encoder.Encode(emberAfEndpointFromIndex(index)));
break;
}

ReturnErrorOnFailure(encoder.Encode(emberAfEndpointFromIndex(index)));
childIndex = emberAfIndexFromEndpoint(parentEndpointId);
}
}

Expand Down

0 comments on commit 1057186

Please sign in to comment.