Skip to content

Commit 2322440

Browse files
vivien-applepull[bot]
authored andcommitted
[chiptool.py] Carry over the data version for attribute reads returned by chip-tool (#27042)
1 parent fb832d8 commit 2322440

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

examples/chip-tool/commands/common/RemoteDataModelLogger.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include <lib/support/SafeInt.h>
2222
#include <lib/support/jsontlv/TlvJson.h>
2323

24+
constexpr const char * kDataVersionKey = "dataVersion";
2425
constexpr const char * kClusterIdKey = "clusterId";
2526
constexpr const char * kEndpointIdKey = "endpointId";
2627
constexpr const char * kAttributeIdKey = "attributeId";
@@ -69,6 +70,10 @@ CHIP_ERROR LogAttributeAsJSON(const chip::app::ConcreteDataAttributePath & path,
6970
value[kClusterIdKey] = path.mClusterId;
7071
value[kEndpointIdKey] = path.mEndpointId;
7172
value[kAttributeIdKey] = path.mAttributeId;
73+
if (path.mDataVersion.HasValue())
74+
{
75+
value[kDataVersionKey] = path.mDataVersion.Value();
76+
}
7277

7378
chip::TLV::TLVReader reader;
7479
reader.Init(*data);

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
_ERROR = 'error'
3535
_CLUSTER_ERROR = 'clusterError'
3636
_VALUE = 'value'
37+
_DATA_VERSION = 'dataVersion'
3738

3839
# FabricIndex is a special case where the field is added as a struct field by the SDK
3940
# if needed but is not part of the XML definition of the struct.
@@ -88,7 +89,7 @@ def __translate_names(self, payloads):
8889
elif key == _EVENT_ID:
8990
key = _EVENT
9091
value = specs.get_event_name(payload[_CLUSTER_ID], value)
91-
elif key == _VALUE or key == _ERROR or key == _CLUSTER_ERROR:
92+
elif key == _VALUE or key == _ERROR or key == _CLUSTER_ERROR or key == _DATA_VERSION:
9293
pass
9394
else:
9495
# Raise an error since the other fields probably needs to be translated too.

0 commit comments

Comments
 (0)