-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enhance chip-tool's formatting for some IDs (#35088)
* Added logging functions * Modify ZAP template file generation * Updated files for CommandId support * Updated manual tests for the new formatting * Fixed variable name shadowing * Fixed typo * Added logging functions to fabric admin * Restyled by whitespace * Restyled by clang-format * Fixed linking * Fixed typo * Fixed CommandId logging * Updated ZAP generated files * Restyled by clang-format --------- Co-authored-by: Restyled.io <[email protected]>
- Loading branch information
Showing
15 changed files
with
7,765 additions
and
713 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
{{> header}} | ||
|
||
#include <app-common/zap-generated/ids/Attributes.h> | ||
#include <app-common/zap-generated/ids/Clusters.h> | ||
#include <app-common/zap-generated/ids/Commands.h> | ||
|
||
char const * ClusterIdToText(chip::ClusterId id) { | ||
switch(id) | ||
{ | ||
{{#zcl_clusters}} | ||
case chip::app::Clusters::{{asUpperCamelCase name}}::Id: return "{{asUpperCamelCase name}}"; | ||
{{/zcl_clusters}} | ||
default: return "Unknown"; | ||
} | ||
} | ||
|
||
char const * AttributeIdToText(chip::ClusterId cluster, chip::AttributeId id) { | ||
switch(cluster) | ||
{ | ||
{{#zcl_clusters}} | ||
{{#zcl_attributes_server}} | ||
{{#first}} | ||
case chip::app::Clusters::{{asUpperCamelCase parent.name}}::Id: | ||
{ | ||
switch(id) | ||
{ | ||
{{/first}} | ||
case chip::app::Clusters::{{asUpperCamelCase parent.name}}::Attributes::{{asUpperCamelCase name}}::Id: return "{{asUpperCamelCase name}}"; | ||
{{#last}} | ||
default: return "Unknown"; | ||
} | ||
} | ||
{{/last}} | ||
{{/zcl_attributes_server}} | ||
{{/zcl_clusters}} | ||
default: return "Unknown"; | ||
} | ||
} | ||
|
||
char const * AcceptedCommandIdToText(chip::ClusterId cluster, chip::CommandId id) { | ||
switch(cluster) | ||
{ | ||
{{#zcl_clusters}} | ||
{{#zcl_commands_source_client}} | ||
{{#first}} | ||
case chip::app::Clusters::{{asUpperCamelCase parent.name}}::Id: | ||
{ | ||
switch(id) | ||
{ | ||
{{/first}} | ||
case chip::app::Clusters::{{asUpperCamelCase parent.name}}::Commands::{{asUpperCamelCase name}}::Id: return "{{asUpperCamelCase name}}"; | ||
{{#last}} | ||
default: return "Unknown"; | ||
} | ||
} | ||
{{/last}} | ||
{{/zcl_commands_source_client}} | ||
{{/zcl_clusters}} | ||
default: return "Unknown"; | ||
} | ||
} | ||
|
||
char const * GeneratedCommandIdToText(chip::ClusterId cluster, chip::CommandId id) { | ||
switch(cluster) | ||
{ | ||
{{#zcl_clusters}} | ||
{{#zcl_commands_source_server}} | ||
{{#first}} | ||
case chip::app::Clusters::{{asUpperCamelCase parent.name}}::Id: | ||
{ | ||
switch(id) | ||
{ | ||
{{/first}} | ||
case chip::app::Clusters::{{asUpperCamelCase parent.name}}::Commands::{{asUpperCamelCase name}}::Id: return "{{asUpperCamelCase name}}"; | ||
{{#last}} | ||
default: return "Unknown"; | ||
} | ||
} | ||
{{/last}} | ||
{{/zcl_commands_source_server}} | ||
{{/zcl_clusters}} | ||
default: return "Unknown"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{{> header}} | ||
|
||
#include <app-common/zap-generated/ids/Attributes.h> | ||
#include <app-common/zap-generated/ids/Clusters.h> | ||
#include <app-common/zap-generated/ids/Commands.h> | ||
|
||
char const * ClusterIdToText(chip::ClusterId id); | ||
|
||
char const * AttributeIdToText(chip::ClusterId cluster, chip::AttributeId id); | ||
|
||
char const * AcceptedCommandIdToText(chip::ClusterId cluster, chip::CommandId id); | ||
|
||
char const * GeneratedCommandIdToText(chip::ClusterId cluster, chip::CommandId id); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.