Skip to content

Commit

Permalink
Update chip-tool commands to use subscribe instead of report (#14231)
Browse files Browse the repository at this point in the history
  • Loading branch information
dhrishi authored and pull[bot] committed Dec 15, 2023
1 parent b4035f7 commit 1109068
Show file tree
Hide file tree
Showing 3 changed files with 675 additions and 675 deletions.
22 changes: 11 additions & 11 deletions examples/chip-tool/commands/common/Commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,12 +177,12 @@ Command * Commands::GetGlobalCommand(CommandsVector & commands, std::string comm

bool Commands::IsAttributeCommand(std::string commandName) const
{
return commandName.compare("read") == 0 || commandName.compare("write") == 0 || commandName.compare("report") == 0;
return commandName.compare("read") == 0 || commandName.compare("write") == 0 || commandName.compare("subscribe") == 0;
}

bool Commands::IsEventCommand(std::string commandName) const
{
return commandName.compare("read-event") == 0 || commandName.compare("report-event") == 0;
return commandName.compare("read-event") == 0 || commandName.compare("subscribe-event") == 0;
}

bool Commands::IsGlobalCommand(std::string commandName) const
Expand Down Expand Up @@ -216,11 +216,11 @@ void Commands::ShowCluster(std::string executable, std::string clusterName, Comm
fprintf(stderr, " +-------------------------------------------------------------------------------------+\n");
fprintf(stderr, " | Commands: |\n");
fprintf(stderr, " +-------------------------------------------------------------------------------------+\n");
bool readCommand = false;
bool writeCommand = false;
bool reportCommand = false;
bool readEventCommand = false;
bool reportEventCommand = false;
bool readCommand = false;
bool writeCommand = false;
bool subscribeCommand = false;
bool readEventCommand = false;
bool subscribeEventCommand = false;
for (auto & command : commands)
{
bool shouldPrint = true;
Expand All @@ -235,17 +235,17 @@ void Commands::ShowCluster(std::string executable, std::string clusterName, Comm
{
writeCommand = true;
}
else if (strcmp(command->GetName(), "report") == 0 && reportCommand == false)
else if (strcmp(command->GetName(), "subscribe") == 0 && subscribeCommand == false)
{
reportCommand = true;
subscribeCommand = true;
}
else if (strcmp(command->GetName(), "read-event") == 0 && readEventCommand == false)
{
readEventCommand = true;
}
else if (strcmp(command->GetName(), "report-event") == 0 && reportEventCommand == false)
else if (strcmp(command->GetName(), "subscribe-event") == 0 && subscribeEventCommand == false)
{
reportEventCommand = true;
subscribeEventCommand = true;
}
else
{
Expand Down
4 changes: 2 additions & 2 deletions examples/chip-tool/templates/commands.zapt
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ public:
class Report{{asUpperCamelCase parent.name}}{{asUpperCamelCase name}}: public ModelCommand
{
public:
Report{{asUpperCamelCase parent.name}}{{asUpperCamelCase name}}(): ModelCommand("report-event")
Report{{asUpperCamelCase parent.name}}{{asUpperCamelCase name}}(): ModelCommand("subscribe-event")
{
AddArgument("event-name", "{{asDelimitedCommand (asUpperCamelCase name)}}");
AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval);
Expand Down Expand Up @@ -462,7 +462,7 @@ private:
class Report{{asUpperCamelCase parent.name}}{{asUpperCamelCase name}}: public ModelCommand
{
public:
Report{{asUpperCamelCase parent.name}}{{asUpperCamelCase name}}(): ModelCommand("report")
Report{{asUpperCamelCase parent.name}}{{asUpperCamelCase name}}(): ModelCommand("subscribe")
{
AddArgument("attr-name", "{{asDelimitedCommand (asUpperCamelCase name)}}");
AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval);
Expand Down
Loading

0 comments on commit 1109068

Please sign in to comment.