Skip to content

Commit

Permalink
[chiptool.py] Carry over the data version for attribute reads returne…
Browse files Browse the repository at this point in the history
…d by chip-tool (#27042)
  • Loading branch information
vivien-apple authored and pull[bot] committed Dec 7, 2023
1 parent 20f2a94 commit 1209271
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions examples/chip-tool/commands/common/RemoteDataModelLogger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <lib/support/SafeInt.h>
#include <lib/support/jsontlv/TlvJson.h>

constexpr const char * kDataVersionKey = "dataVersion";
constexpr const char * kClusterIdKey = "clusterId";
constexpr const char * kEndpointIdKey = "endpointId";
constexpr const char * kAttributeIdKey = "attributeId";
Expand Down Expand Up @@ -69,6 +70,10 @@ CHIP_ERROR LogAttributeAsJSON(const chip::app::ConcreteDataAttributePath & path,
value[kClusterIdKey] = path.mClusterId;
value[kEndpointIdKey] = path.mEndpointId;
value[kAttributeIdKey] = path.mAttributeId;
if (path.mDataVersion.HasValue())
{
value[kDataVersionKey] = path.mDataVersion.Value();
}

chip::TLV::TLVReader reader;
reader.Init(*data);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
_ERROR = 'error'
_CLUSTER_ERROR = 'clusterError'
_VALUE = 'value'
_DATA_VERSION = 'dataVersion'

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

0 comments on commit 1209271

Please sign in to comment.