From 95ba8a477929ce65c08be4d54ffa3bdf35016375 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Fri, 31 Jan 2025 20:13:48 -0500 Subject: [PATCH] Add some descriptions to chip-tool read/subscribe-by-id commands. (#37323) --- .../commands/clusters/ModelCommand.h | 6 ++- .../commands/clusters/ReportCommand.h | 48 ++++++++++++------- 2 files changed, 36 insertions(+), 18 deletions(-) diff --git a/examples/chip-tool/commands/clusters/ModelCommand.h b/examples/chip-tool/commands/clusters/ModelCommand.h index f9ae83aed79f0a..d3e45101b5b830 100644 --- a/examples/chip-tool/commands/clusters/ModelCommand.h +++ b/examples/chip-tool/commands/clusters/ModelCommand.h @@ -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) {} diff --git a/examples/chip-tool/commands/clusters/ReportCommand.h b/examples/chip-tool/commands/clusters/ReportCommand.h index e2c0f1db785900..f9d1d1e9ba33ac 100644 --- a/examples/chip-tool/commands/clusters/ReportCommand.h +++ b/examples/chip-tool/commands/clusters/ReportCommand.h @@ -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 ///////// @@ -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 @@ -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 @@ -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 " @@ -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(); @@ -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 " @@ -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(); @@ -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); @@ -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); @@ -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); @@ -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(); @@ -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 " @@ -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 "