Skip to content

Commit 321f895

Browse files
Fix the icd registerClient (#33738)
* Fix the icd registerClient * address comments * Update ClusterCommand.h * Update ClusterCommand.h
1 parent 8b8dadd commit 321f895

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

examples/chip-tool/commands/clusters/ClusterCommand.h

+9-5
Original file line numberDiff line numberDiff line change
@@ -118,18 +118,23 @@ class ClusterCommand : public InteractionModelCommands, public ModelCommand, pub
118118

119119
if (data != nullptr)
120120
{
121-
LogErrorOnFailure(RemoteDataModelLogger::LogCommandAsJSON(path, data));
122-
123-
error = DataModelLogger::LogCommand(path, data);
121+
{
122+
// log a snapshot to not advance the data reader.
123+
chip::TLV::TLVReader logTlvReader;
124+
logTlvReader.Init(*data);
125+
LogErrorOnFailure(RemoteDataModelLogger::LogCommandAsJSON(path, &logTlvReader));
126+
error = DataModelLogger::LogCommand(path, &logTlvReader);
127+
}
124128
if (CHIP_NO_ERROR != error)
125129
{
126130
ChipLogError(chipTool, "Response Failure: Can not decode Data");
127131
mError = error;
128132
return;
129133
}
130134
if ((path.mEndpointId == chip::kRootEndpointId) && (path.mClusterId == chip::app::Clusters::IcdManagement::Id) &&
131-
(path.mCommandId == chip::app::Clusters::IcdManagement::Commands::RegisterClient::Id))
135+
(path.mCommandId == chip::app::Clusters::IcdManagement::Commands::RegisterClientResponse::Id))
132136
{
137+
// log a snapshot to not advance the data reader.
133138
chip::TLV::TLVReader counterTlvReader;
134139
counterTlvReader.Init(*data);
135140
chip::app::Clusters::IcdManagement::Commands::RegisterClientResponse::DecodableType value;
@@ -139,7 +144,6 @@ class ClusterCommand : public InteractionModelCommands, public ModelCommand, pub
139144
ChipLogError(chipTool, "Failed to decode ICD counter: %" CHIP_ERROR_FORMAT, err.Format());
140145
return;
141146
}
142-
143147
chip::app::ICDClientInfo clientInfo;
144148
clientInfo.peer_node = mScopedNodeId;
145149
clientInfo.monitored_subject = mMonitoredSubject;

0 commit comments

Comments
 (0)