Skip to content

Commit

Permalink
Add timedInteractionTimeoutMs optional argument to chip-tool commands
Browse files Browse the repository at this point in the history
  • Loading branch information
vivien-apple authored and bzbarsky-apple committed Dec 2, 2021
1 parent a28f2be commit 4711edd
Show file tree
Hide file tree
Showing 3 changed files with 280 additions and 187 deletions.
4 changes: 4 additions & 0 deletions examples/chip-tool/commands/clusters/ModelCommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class ModelCommand : public CHIPCommand
{
AddArgument("node-id", 0, UINT64_MAX, &mNodeId);
AddArgument("endpoint-id", CHIP_ZCL_ENDPOINT_MIN, CHIP_ZCL_ENDPOINT_MAX, &mEndPointId);
AddArgument("timedInteractionTimeoutMs", 0, UINT16_MAX, &mTimedInteractionTimeoutMs);
}

/////////// CHIPCommand Interface /////////
Expand All @@ -46,6 +47,9 @@ class ModelCommand : public CHIPCommand

virtual CHIP_ERROR SendCommand(ChipDevice * device, uint8_t endPointId) = 0;

protected:
chip::Optional<uint16_t> mTimedInteractionTimeoutMs;

private:
chip::NodeId mNodeId;
uint8_t mEndPointId;
Expand Down
8 changes: 1 addition & 7 deletions examples/chip-tool/templates/commands.zapt
Original file line number Diff line number Diff line change
Expand Up @@ -445,13 +445,7 @@ public:
{{/if}}
{{/chip_cluster_command_non_expanded_arguments}}

return chip::Controller::InvokeCommand(device, this, {{#if hasSpecificResponse}}On{{asUpperCamelCase parent.name}}{{asUpperCamelCase response.name}}Success{{else}}OnDefaultSuccess{{/if}}, OnDefaultFailure, endpointId, mRequest
{{#if mustUseTimedInvoke}}
{{!TODO figure out where to get useful timeout values here. For
now, pick 10 seconds.}}
, 10000
{{/if}}
);
return chip::Controller::InvokeCommand(device, this, {{#if hasSpecificResponse}}On{{asUpperCamelCase parent.name}}{{asUpperCamelCase response.name}}Success{{else}}OnDefaultSuccess{{/if}}, OnDefaultFailure, endpointId, mRequest, mTimedInteractionTimeoutMs);
}

private:
Expand Down
Loading

0 comments on commit 4711edd

Please sign in to comment.