Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add documentation for the model command destination id.
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".
bzbarsky-apple committed May 21, 2022
1 parent 55ef609 commit 5c9b150
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
@@ -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)
6 changes: 4 additions & 2 deletions examples/chip-tool/commands/clusters/ModelCommand.h
Original file line number Diff line number Diff line change
@@ -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);
}
@@ -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);

0 comments on commit 5c9b150

Please sign in to comment.