Skip to content

Commit

Permalink
Add documentation for the model command destination id. (#18704)
Browse files Browse the repository at this point in the history
Since the documentation explains what it is, rename from the unwieldy
"node-id/group-id" to "destination-id".
  • Loading branch information
bzbarsky-apple authored and pull[bot] committed Jul 18, 2022
1 parent 561f92f commit b8338dd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
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

0 comments on commit b8338dd

Please sign in to comment.