Skip to content

Commit d57d9e4

Browse files
Update ModelCommand.cpp
1 parent 067a372 commit d57d9e4

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

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

+11-5
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,19 @@ class ClusterCommand : public InteractionModelCommands, public ModelCommand, pub
5555
return InteractionModelCommands::SendCommand(device, endpointId, clusterId, commandId, value);
5656
}
5757

58+
CHIP_ERROR SendCommand(chip::DeviceProxy * device, chip::EndpointId endpointId, chip::ClusterId clusterId,
59+
chip::CommandId commandId,
60+
const chip::app::Clusters::IcdManagement::Commands::UnregisterClient::Type & value)
61+
{
62+
ReturnErrorOnFailure(InteractionModelCommands::SendCommand(device, endpointId, clusterId, commandId, value));
63+
mScopedNodeId = chip::ScopedNodeId(value.checkInNodeID,device->GetSecureSession().Value()->GetFabricIndex());
64+
return CHIP_NO_ERROR;
65+
}
66+
5867
CHIP_ERROR SendCommand(chip::DeviceProxy * device, chip::EndpointId endpointId, chip::ClusterId clusterId,
5968
chip::CommandId commandId,
6069
const chip::app::Clusters::DiagnosticLogs::Commands::RetrieveLogsRequest::Type & value)
6170
{
62-
mPeerNodeId = device->GetDeviceId();
63-
mFabricIndex = device->GetSecureSession().Value()->GetFabricIndex();
6471
ReturnErrorOnFailure(InteractionModelCommands::SendCommand(device, endpointId, clusterId, commandId, value));
6572

6673
if (value.transferFileDesignator.HasValue() &&
@@ -114,7 +121,7 @@ class ClusterCommand : public InteractionModelCommands, public ModelCommand, pub
114121
if ((path.mEndpointId == chip::kRootEndpointId) && (path.mClusterId == chip::app::Clusters::IcdManagement::Id) &&
115122
(path.mCommandId == chip::app::Clusters::IcdManagement::Commands::UnregisterClient::Id))
116123
{
117-
ModelCommand::ClearICDEntry(chip::ScopedNodeId(mPeerNodeId, mFabricIndex));
124+
ModelCommand::ClearICDEntry(mScopedNodeId);
118125
}
119126
}
120127

@@ -215,8 +222,7 @@ class ClusterCommand : public InteractionModelCommands, public ModelCommand, pub
215222
private:
216223
chip::ClusterId mClusterId;
217224
chip::CommandId mCommandId;
218-
chip::FabricIndex mFabricIndex = 0;
219-
chip::NodeId mPeerNodeId = 0;
225+
chip::ScopedNodeId mScopedNodeId;
220226
CHIP_ERROR mError = CHIP_NO_ERROR;
221227
CustomArgument mPayload;
222228
};

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class ModelCommand : public CHIPCommand
6767

6868
virtual CHIP_ERROR SendGroupCommand(chip::GroupId groupId, chip::FabricIndex fabricIndex) { return CHIP_ERROR_BAD_REQUEST; };
6969

70-
void ClearICDEntry(const chip::ScopedNodeId & nodeId) override;
70+
virtual void ClearICDEntry(const chip::ScopedNodeId & nodeId);
7171

7272
void Shutdown() override;
7373

examples/tv-casting-app/tv-casting-common/commands/clusters/ModelCommand.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ void ModelCommand::OnDeviceConnectedFn(void * context, Messaging::ExchangeManage
6161
VerifyOrReturn(command != nullptr, ChipLogError(chipTool, "OnDeviceConnectedFn: context is null"));
6262

6363
OperationalDeviceProxy device(&exchangeMgr, sessionHandle);
64-
CHIP_ERROR err = command->SendCommand(&device, command->minEndPointId);
64+
CHIP_ERROR err = command->SendCommand(&device, command->mEndPointId);
6565
VerifyOrReturn(CHIP_NO_ERROR == err, command->SetCommandExitStatus(err));
6666
}
6767

@@ -82,7 +82,7 @@ void ModelCommand::Shutdown()
8282
mOnDeviceConnectionFailureCallback.Cancel();
8383
}
8484

85-
void ClearICDEntry(const chip::ScopedNodeId & nodeId);
85+
void ModelCommand::ClearICDEntry(const chip::ScopedNodeId & nodeId)
8686
{
8787
ChipLogError(chipTool, "ClearICDEntry is not implemented in tv-casting-app");
8888
}

0 commit comments

Comments
 (0)