Skip to content

Commit

Permalink
Add some descriptions to chip-tool read/subscribe-by-id commands. (pr…
Browse files Browse the repository at this point in the history
  • Loading branch information
bzbarsky-apple authored Feb 1, 2025
1 parent c56eb2b commit 95ba8a4
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 18 deletions.
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 @@ -28,8 +28,10 @@
class ModelCommand : public CHIPCommand
{
public:
ModelCommand(const char * commandName, CredentialIssuerCommands * credsIssuerConfig, bool supportsMultipleEndpoints = false) :
CHIPCommand(commandName, credsIssuerConfig), mOnDeviceConnectedCallback(OnDeviceConnectedFn, this),
ModelCommand(const char * commandName, CredentialIssuerCommands * credsIssuerConfig, bool supportsMultipleEndpoints = false,
const char * helpText = nullptr) :
CHIPCommand(commandName, credsIssuerConfig, helpText),
mOnDeviceConnectedCallback(OnDeviceConnectedFn, this),
mOnDeviceConnectionFailureCallback(OnDeviceConnectionFailureFn, this), mSupportsMultipleEndpoints(supportsMultipleEndpoints)
{}

Expand Down
48 changes: 32 additions & 16 deletions examples/chip-tool/commands/clusters/ReportCommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@
class ReportCommand : public InteractionModelReports, public ModelCommand, public chip::app::ReadClient::Callback
{
public:
ReportCommand(const char * commandName, CredentialIssuerCommands * credsIssuerConfig) :
InteractionModelReports(this), ModelCommand(commandName, credsIssuerConfig, /* supportsMultipleEndpoints = */ true)
ReportCommand(const char * commandName, CredentialIssuerCommands * credsIssuerConfig, const char * helpText = nullptr) :
InteractionModelReports(this),
ModelCommand(commandName, credsIssuerConfig, /* supportsMultipleEndpoints = */ true, helpText)
{}

/////////// ReadClient Callback Interface /////////
Expand Down Expand Up @@ -133,8 +134,8 @@ class ReportCommand : public InteractionModelReports, public ModelCommand, publi
class ReadCommand : public ReportCommand
{
protected:
ReadCommand(const char * commandName, CredentialIssuerCommands * credsIssuerConfig) :
ReportCommand(commandName, credsIssuerConfig)
ReadCommand(const char * commandName, CredentialIssuerCommands * credsIssuerConfig, const char * helpText = nullptr) :
ReportCommand(commandName, credsIssuerConfig, helpText)
{}

void OnDone(chip::app::ReadClient * aReadClient) override
Expand All @@ -147,8 +148,8 @@ class ReadCommand : public ReportCommand
class SubscribeCommand : public ReportCommand
{
protected:
SubscribeCommand(const char * commandName, CredentialIssuerCommands * credsIssuerConfig) :
ReportCommand(commandName, credsIssuerConfig)
SubscribeCommand(const char * commandName, CredentialIssuerCommands * credsIssuerConfig, const char * helpText = nullptr) :
ReportCommand(commandName, credsIssuerConfig, helpText)
{}

void OnSubscriptionEstablished(chip::SubscriptionId subscriptionId) override
Expand Down Expand Up @@ -187,7 +188,8 @@ class SubscribeCommand : public ReportCommand
class ReadAttribute : public ReadCommand
{
public:
ReadAttribute(CredentialIssuerCommands * credsIssuerConfig) : ReadCommand("read-by-id", credsIssuerConfig)
ReadAttribute(CredentialIssuerCommands * credsIssuerConfig) :
ReadCommand("read-by-id", credsIssuerConfig, "Read attributes for the given attribute path (which may include wildcards).")
{
AddArgument("cluster-ids", 0, UINT32_MAX, &mClusterIds,
"Comma-separated list of cluster ids to read from (e.g. \"6\" or \"8,0x201\").\n Allowed to be 0xFFFFFFFF to "
Expand All @@ -198,7 +200,8 @@ class ReadAttribute : public ReadCommand
}

ReadAttribute(chip::ClusterId clusterId, CredentialIssuerCommands * credsIssuerConfig) :
ReadCommand("read-by-id", credsIssuerConfig), mClusterIds(1, clusterId)
ReadCommand("read-by-id", credsIssuerConfig, "Read attributes from this cluster; allows wildcard endpoint and attribute."),
mClusterIds(1, clusterId)
{
AddAttributeIdArgument();
AddCommonArguments();
Expand Down Expand Up @@ -245,7 +248,9 @@ class ReadAttribute : public ReadCommand
class SubscribeAttribute : public SubscribeCommand
{
public:
SubscribeAttribute(CredentialIssuerCommands * credsIssuerConfig) : SubscribeCommand("subscribe-by-id", credsIssuerConfig)
SubscribeAttribute(CredentialIssuerCommands * credsIssuerConfig) :
SubscribeCommand("subscribe-by-id", credsIssuerConfig,
"Subscribe to attributes for the given attribute path (which may include wildcards).")
{
AddArgument("cluster-ids", 0, UINT32_MAX, &mClusterIds,
"Comma-separated list of cluster ids to subscribe to (e.g. \"6\" or \"8,0x201\").\n Allowed to be 0xFFFFFFFF "
Expand All @@ -256,7 +261,9 @@ class SubscribeAttribute : public SubscribeCommand
}

SubscribeAttribute(chip::ClusterId clusterId, CredentialIssuerCommands * credsIssuerConfig) :
SubscribeCommand("subscribe-by-id", credsIssuerConfig), mClusterIds(1, clusterId)
SubscribeCommand("subscribe-by-id", credsIssuerConfig,
"Subscribe to attributes from this cluster; allows wildcard endpoint and attribute."),
mClusterIds(1, clusterId)
{
AddAttributeIdArgument();
AddCommonArguments();
Expand Down Expand Up @@ -312,7 +319,8 @@ class SubscribeAttribute : public SubscribeCommand
class ReadEvent : public ReadCommand
{
public:
ReadEvent(CredentialIssuerCommands * credsIssuerConfig) : ReadCommand("read-event-by-id", credsIssuerConfig)
ReadEvent(CredentialIssuerCommands * credsIssuerConfig) :
ReadCommand("read-event-by-id", credsIssuerConfig, "Read events for the given event path (which may include wildcards).")
{
AddArgument("cluster-id", 0, UINT32_MAX, &mClusterIds);
AddArgument("event-id", 0, UINT32_MAX, &mEventIds);
Expand All @@ -322,7 +330,8 @@ class ReadEvent : public ReadCommand
}

ReadEvent(chip::ClusterId clusterId, CredentialIssuerCommands * credsIssuerConfig) :
ReadCommand("read-event-by-id", credsIssuerConfig), mClusterIds(1, clusterId)
ReadCommand("read-event-by-id", credsIssuerConfig, "Read events from this cluster; allows wildcard endpoint and event."),
mClusterIds(1, clusterId)
{
AddArgument("event-id", 0, UINT32_MAX, &mEventIds);
AddArgument("fabric-filtered", 0, 1, &mFabricFiltered);
Expand Down Expand Up @@ -356,7 +365,9 @@ class ReadEvent : public ReadCommand
class SubscribeEvent : public SubscribeCommand
{
public:
SubscribeEvent(CredentialIssuerCommands * credsIssuerConfig) : SubscribeCommand("subscribe-event-by-id", credsIssuerConfig)
SubscribeEvent(CredentialIssuerCommands * credsIssuerConfig) :
SubscribeCommand("subscribe-event-by-id", credsIssuerConfig,
"Subscribe to events for the given event path (which may include wildcards).")
{
AddArgument("cluster-id", 0, UINT32_MAX, &mClusterIds);
AddArgument("event-id", 0, UINT32_MAX, &mEventIds);
Expand All @@ -365,7 +376,9 @@ class SubscribeEvent : public SubscribeCommand
}

SubscribeEvent(chip::ClusterId clusterId, CredentialIssuerCommands * credsIssuerConfig) :
SubscribeCommand("subscribe-event-by-id", credsIssuerConfig), mClusterIds(1, clusterId)
SubscribeCommand("subscribe-event-by-id", credsIssuerConfig,
"Subscribe to events from this cluster; allows wildcard endpoint and event."),
mClusterIds(1, clusterId)
{
AddArgument("event-id", 0, UINT32_MAX, &mEventIds);
AddCommonArguments();
Expand Down Expand Up @@ -447,7 +460,8 @@ class ReadNone : public ReadCommand
class ReadAll : public ReadCommand
{
public:
ReadAll(CredentialIssuerCommands * credsIssuerConfig) : ReadCommand("read-all", credsIssuerConfig)
ReadAll(CredentialIssuerCommands * credsIssuerConfig) :
ReadCommand("read-all", credsIssuerConfig, "Read attributes and events for the given paths (which may include wildcards).")
{
AddArgument("cluster-ids", 0, UINT32_MAX, &mClusterIds,
"Comma-separated list of cluster ids to read from (e.g. \"6\" or \"8,0x201\").\n Allowed to be 0xFFFFFFFF to "
Expand Down Expand Up @@ -513,7 +527,9 @@ class SubscribeNone : public SubscribeCommand
class SubscribeAll : public SubscribeCommand
{
public:
SubscribeAll(CredentialIssuerCommands * credsIssuerConfig) : SubscribeCommand("subscribe-all", credsIssuerConfig)
SubscribeAll(CredentialIssuerCommands * credsIssuerConfig) :
SubscribeCommand("subscribe-all", credsIssuerConfig,
"Subscribe to attributes and events for the given paths (which may include wildcards).")
{
AddArgument("cluster-ids", 0, UINT32_MAX, &mClusterIds,
"Comma-separated list of cluster ids to read from (e.g. \"6\" or \"8,0x201\").\n Allowed to be 0xFFFFFFFF to "
Expand Down

0 comments on commit 95ba8a4

Please sign in to comment.