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

Document the timedInteractionTimeoutMs argument in chip-tool. #18703

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
33 changes: 17 additions & 16 deletions examples/chip-tool-darwin/commands/clusters/ClusterCommandBridge.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,7 @@ class ClusterCommand : public ModelCommand {
AddArgument("cluster-id", 0, UINT32_MAX, &mClusterId);
AddArgument("command-id", 0, UINT32_MAX, &mCommandId);
AddArgument("payload", &mPayload);
AddArgument("timedInteractionTimeoutMs", 0, UINT16_MAX, &mTimedInteractionTimeoutMs);
AddArgument("repeat-count", 1, UINT16_MAX, &mRepeatCount);
AddArgument("repeat-delay-ms", 0, UINT16_MAX, &mRepeatDelayInMs);
ModelCommand::AddArguments();
AddArguments();
}

ClusterCommand(chip::ClusterId clusterId)
Expand All @@ -44,18 +41,7 @@ class ClusterCommand : public ModelCommand {
{
AddArgument("command-id", 0, UINT32_MAX, &mCommandId);
AddArgument("payload", &mPayload);
AddArgument("timedInteractionTimeoutMs", 0, UINT16_MAX, &mTimedInteractionTimeoutMs);
AddArgument("repeat-count", 1, UINT16_MAX, &mRepeatCount);
AddArgument("repeat-delay-ms", 0, UINT16_MAX, &mRepeatDelayInMs);
ModelCommand::AddArguments();
}

ClusterCommand(const char * _Nonnull commandName)
: ModelCommand(commandName)
{
AddArgument("timedInteractionTimeoutMs", 0, UINT16_MAX, &mTimedInteractionTimeoutMs);
AddArgument("repeat-count", 1, UINT16_MAX, &mRepeatCount);
AddArgument("repeat-delay-ms", 0, UINT16_MAX, &mRepeatDelayInMs);
AddArguments();
}

~ClusterCommand() {}
Expand Down Expand Up @@ -117,6 +103,21 @@ class ClusterCommand : public ModelCommand {
}

protected:
ClusterCommand(const char * _Nonnull commandName)
: ModelCommand(commandName)
{
// Subclasses are responsible for calling AddArguments.
}

void AddArguments()
{
AddArgument("timedInteractionTimeoutMs", 0, UINT16_MAX, &mTimedInteractionTimeoutMs,
"If provided, do a timed invoke with the given timed interaction timeout.");
AddArgument("repeat-count", 1, UINT16_MAX, &mRepeatCount);
AddArgument("repeat-delay-ms", 0, UINT16_MAX, &mRepeatDelayInMs);
ModelCommand::AddArguments();
}

chip::Optional<uint16_t> mTimedInteractionTimeoutMs;
chip::Optional<uint16_t> mRepeatCount;
chip::Optional<uint16_t> mRepeatDelayInMs;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ class WriteAttribute : public ModelCommand {
AddArgument("cluster-id", 0, UINT32_MAX, &mClusterId);
AddArgument("attribute-id", 0, UINT32_MAX, &mAttributeId);
AddArgument("attribute-value", &mAttributeValue);
AddArgument("timedInteractionTimeoutMs", 0, UINT16_MAX, &mTimedInteractionTimeoutMs);
ModelCommand::AddArguments();
AddArguments();
}

WriteAttribute(chip::ClusterId clusterId)
Expand All @@ -40,15 +39,7 @@ class WriteAttribute : public ModelCommand {
{
AddArgument("attribute-id", 0, UINT32_MAX, &mAttributeId);
AddArgument("attribute-value", &mAttributeValue);
AddArgument("timedInteractionTimeoutMs", 0, UINT16_MAX, &mTimedInteractionTimeoutMs);
ModelCommand::AddArguments();
}

WriteAttribute(const char * _Nonnull attributeName)
: ModelCommand("write")
{
AddArgument("data-version", 0, UINT32_MAX, &mDataVersion);
AddArgument("timedInteractionTimeoutMs", 0, UINT16_MAX, &mTimedInteractionTimeoutMs);
AddArguments();
}

~WriteAttribute() {}
Expand Down Expand Up @@ -103,6 +94,20 @@ class WriteAttribute : public ModelCommand {
}

protected:
WriteAttribute(const char * _Nonnull attributeName)
: ModelCommand("write")
{
AddArgument("data-version", 0, UINT32_MAX, &mDataVersion);
// Subclasses are responsible for calling AddArguments.
}

void AddArguments()
{
AddArgument("timedInteractionTimeoutMs", 0, UINT16_MAX, &mTimedInteractionTimeoutMs,
"If provided, do a timed write with the given timed interaction timeout.");
ModelCommand::AddArguments();
}

chip::Optional<uint16_t> mTimedInteractionTimeoutMs;
chip::Optional<uint32_t> mDataVersion;

Expand Down
38 changes: 19 additions & 19 deletions examples/chip-tool/commands/clusters/ClusterCommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,32 +32,15 @@ class ClusterCommand : public InteractionModelCommands, public ModelCommand, pub
AddArgument("cluster-id", 0, UINT32_MAX, &mClusterId);
AddArgument("command-id", 0, UINT32_MAX, &mCommandId);
AddArgument("payload", &mPayload);
AddArgument("timedInteractionTimeoutMs", 0, UINT16_MAX, &mTimedInteractionTimeoutMs);
AddArgument("suppressResponse", 0, 1, &mSuppressResponse);
AddArgument("repeat-count", 1, UINT16_MAX, &mRepeatCount);
AddArgument("repeat-delay-ms", 0, UINT16_MAX, &mRepeatDelayInMs);
ModelCommand::AddArguments();
AddArguments();
}

ClusterCommand(chip::ClusterId clusterId, CredentialIssuerCommands * credsIssuerConfig) :
InteractionModelCommands(this), ModelCommand("command-by-id", credsIssuerConfig), mClusterId(clusterId)
{
AddArgument("command-id", 0, UINT32_MAX, &mCommandId);
AddArgument("payload", &mPayload);
AddArgument("timedInteractionTimeoutMs", 0, UINT16_MAX, &mTimedInteractionTimeoutMs);
AddArgument("suppressResponse", 0, 1, &mSuppressResponse);
AddArgument("repeat-count", 1, UINT16_MAX, &mRepeatCount);
AddArgument("repeat-delay-ms", 0, UINT16_MAX, &mRepeatDelayInMs);
ModelCommand::AddArguments();
}

ClusterCommand(const char * commandName, CredentialIssuerCommands * credsIssuerConfig) :
InteractionModelCommands(this), ModelCommand(commandName, credsIssuerConfig)
{
AddArgument("timedInteractionTimeoutMs", 0, UINT16_MAX, &mTimedInteractionTimeoutMs);
AddArgument("suppressResponse", 0, 1, &mSuppressResponse);
AddArgument("repeat-count", 1, UINT16_MAX, &mRepeatCount);
AddArgument("repeat-delay-ms", 0, UINT16_MAX, &mRepeatDelayInMs);
AddArguments();
}

~ClusterCommand() {}
Expand Down Expand Up @@ -141,6 +124,23 @@ class ClusterCommand : public InteractionModelCommands, public ModelCommand, pub
}
}

protected:
ClusterCommand(const char * commandName, CredentialIssuerCommands * credsIssuerConfig) :
InteractionModelCommands(this), ModelCommand(commandName, credsIssuerConfig)
{
// Subclasses are responsible for calling AddArguments.
}

void AddArguments()
bzbarsky-apple marked this conversation as resolved.
Show resolved Hide resolved
{
AddArgument("timedInteractionTimeoutMs", 0, UINT16_MAX, &mTimedInteractionTimeoutMs,
"If provided, do a timed invoke with the given timed interaction timeout.");
AddArgument("suppressResponse", 0, 1, &mSuppressResponse);
AddArgument("repeat-count", 1, UINT16_MAX, &mRepeatCount);
AddArgument("repeat-delay-ms", 0, UINT16_MAX, &mRepeatDelayInMs);
ModelCommand::AddArguments();
}

private:
chip::ClusterId mClusterId;
chip::CommandId mCommandId;
Expand Down
34 changes: 18 additions & 16 deletions examples/chip-tool/commands/clusters/WriteAttributeCommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,29 +32,15 @@ class WriteAttribute : public InteractionModelWriter, public ModelCommand, publi
AddArgument("cluster-id", 0, UINT32_MAX, &mClusterId);
AddArgument("attribute-id", 0, UINT32_MAX, &mAttributeId);
AddArgument("attribute-value", &mAttributeValue);
AddArgument("timedInteractionTimeoutMs", 0, UINT16_MAX, &mTimedInteractionTimeoutMs);
AddArgument("data-version", 0, UINT32_MAX, &mDataVersion);
AddArgument("suppressResponse", 0, 1, &mSuppressResponse);
ModelCommand::AddArguments();
AddArguments();
}

WriteAttribute(chip::ClusterId clusterId, CredentialIssuerCommands * credsIssuerConfig) :
InteractionModelWriter(this), ModelCommand("write-by-id", credsIssuerConfig), mClusterId(clusterId)
{
AddArgument("attribute-id", 0, UINT32_MAX, &mAttributeId);
AddArgument("attribute-value", &mAttributeValue);
AddArgument("timedInteractionTimeoutMs", 0, UINT16_MAX, &mTimedInteractionTimeoutMs);
AddArgument("data-version", 0, UINT32_MAX, &mDataVersion);
AddArgument("suppressResponse", 0, 1, &mSuppressResponse);
ModelCommand::AddArguments();
}

WriteAttribute(const char * attributeName, CredentialIssuerCommands * credsIssuerConfig) :
InteractionModelWriter(this), ModelCommand("write", credsIssuerConfig)
{
AddArgument("timedInteractionTimeoutMs", 0, UINT16_MAX, &mTimedInteractionTimeoutMs);
AddArgument("data-version", 0, UINT32_MAX, &mDataVersion);
AddArgument("suppressResponse", 0, 1, &mSuppressResponse);
AddArguments();
}

~WriteAttribute() {}
Expand Down Expand Up @@ -112,6 +98,22 @@ class WriteAttribute : public InteractionModelWriter, public ModelCommand, publi
return InteractionModelWriter::WriteGroupAttribute(groupId, fabricIndex, clusterId, attributeId, value, mDataVersion);
}

protected:
WriteAttribute(const char * attributeName, CredentialIssuerCommands * credsIssuerConfig) :
InteractionModelWriter(this), ModelCommand("write", credsIssuerConfig)
{
// Subclasses are responsible for calling AddArguments.
}

void AddArguments()
{
AddArgument("timedInteractionTimeoutMs", 0, UINT16_MAX, &mTimedInteractionTimeoutMs,
"If provided, do a timed write with the given timed interaction timeout.");
AddArgument("data-version", 0, UINT32_MAX, &mDataVersion);
AddArgument("suppressResponse", 0, 1, &mSuppressResponse);
ModelCommand::AddArguments();
}

private:
chip::ClusterId mClusterId;
chip::AttributeId mAttributeId;
Expand Down