Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add documentation for the model command destination id. #18704

Merged
merged 1 commit into from
May 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions examples/chip-tool/commands/clusters/ModelCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,24 +26,25 @@ using namespace ::chip;
CHIP_ERROR ModelCommand::RunCommand()
{

if (IsGroupId(mNodeId))
if (IsGroupId(mDestinationId))
{
FabricIndex fabricIndex;
ReturnErrorOnFailure(CurrentCommissioner().GetFabricIndex(&fabricIndex));
ChipLogProgress(chipTool, "Sending command to group 0x%x", GroupIdFromNodeId(mNodeId));
ChipLogProgress(chipTool, "Sending command to group 0x%x", GroupIdFromNodeId(mDestinationId));

return SendGroupCommand(GroupIdFromNodeId(mNodeId), fabricIndex);
return SendGroupCommand(GroupIdFromNodeId(mDestinationId), fabricIndex);
}

ChipLogProgress(chipTool, "Sending command to node 0x%" PRIx64, mNodeId);
ChipLogProgress(chipTool, "Sending command to node 0x%" PRIx64, mDestinationId);

CommissioneeDeviceProxy * commissioneeDeviceProxy = nullptr;
if (CHIP_NO_ERROR == CurrentCommissioner().GetDeviceBeingCommissioned(mNodeId, &commissioneeDeviceProxy))
if (CHIP_NO_ERROR == CurrentCommissioner().GetDeviceBeingCommissioned(mDestinationId, &commissioneeDeviceProxy))
{
return SendCommand(commissioneeDeviceProxy, mEndPointId);
}

return CurrentCommissioner().GetConnectedDevice(mNodeId, &mOnDeviceConnectedCallback, &mOnDeviceConnectionFailureCallback);
return CurrentCommissioner().GetConnectedDevice(mDestinationId, &mOnDeviceConnectedCallback,
&mOnDeviceConnectionFailureCallback);
}

void ModelCommand::OnDeviceConnectedFn(void * context, chip::OperationalDeviceProxy * device)
Expand Down
6 changes: 4 additions & 2 deletions examples/chip-tool/commands/clusters/ModelCommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ class ModelCommand : public CHIPCommand

void AddArguments()
{
AddArgument("node-id/group-id", 0, UINT64_MAX, &mNodeId);
AddArgument(
"destination-id", 0, UINT64_MAX, &mDestinationId,
"64-bit node or group identifier.\n Group identifiers are detected by being in the 0xFFFF'FFFF'FFFF'xxxx range.");
AddArgument("endpoint-id-ignored-for-group-commands", 0, UINT16_MAX, &mEndPointId);
AddArgument("timeout", 0, UINT16_MAX, &mTimeout);
}
Expand All @@ -51,7 +53,7 @@ class ModelCommand : public CHIPCommand
chip::Optional<uint16_t> mTimeout;

private:
chip::NodeId mNodeId;
chip::NodeId mDestinationId;
std::vector<chip::EndpointId> mEndPointId;

static void OnDeviceConnectedFn(void * context, chip::OperationalDeviceProxy * device);
Expand Down