Skip to content

Commit 0474070

Browse files
authored
[YAML] Add _ById commands support for darwin-framework-tool - Followup: Add comment explaining the use of isinstance for list detection (project-chip#36063)
1 parent 9524ac9 commit 0474070

File tree

1 file changed

+7
-0
lines changed
  • examples/chip-tool/py_matter_chip_tool_adapter/matter_chip_tool_adapter

1 file changed

+7
-0
lines changed

examples/chip-tool/py_matter_chip_tool_adapter/matter_chip_tool_adapter/decoder.py

+7
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,13 @@ def run(self, specs, value, cluster_name: str, typename: str, array: bool):
386386
del value[key_name]
387387

388388
elif isinstance(value, list) and array:
389+
# Instead of using `False` for the last parameter (array), `isinstance(v, list)` is used.
390+
# While the data model specification does not include lists of lists, the format returned
391+
# by the Matter.framework for *ById APIs may contain them.
392+
# For example, the command:
393+
# darwin-framework-tool any read-by-id 29 0 0x12344321 65535
394+
# returns value such as:
395+
# [[{'DeviceType': 17, 'Revision': 1}, {'DeviceType': 22, 'Revision': 1}], ...]
389396
value = [self.run(specs, v, cluster_name, typename, isinstance(v, list))
390397
for v in value]
391398

0 commit comments

Comments
 (0)