Skip to content

Commit

Permalink
Take into account manufacturerCode when generating .matter files (pro…
Browse files Browse the repository at this point in the history
…ject-chip#28805)

* Use asMEI for matter file codegen

* Ensure backwards compatible format for MEI

---------

Co-authored-by: Andrei Litvin <andreilitvin@google.com>
  • Loading branch information
andy31415 and andreilitvin authored Aug 23, 2023
1 parent 4e5cf29 commit bd8c01f
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 5 deletions.
7 changes: 6 additions & 1 deletion src/app/zap-templates/partials/idl/attribute_definition.zapt
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,10 @@
{{~/if~}}
{{~/if~}}
{{/unless}} {{asLowerCamelCase name~}}
{{~#if isArray~}} [] {{~/if}} = {{code~}}
{{~#if isArray~}} [] {{~/if}} = {{!}}
{{~#if manufacturerCode}}
{{~asMEI manufacturerCode code~}}
{{else}}
{{~code~}}
{{/if~}}
;
14 changes: 12 additions & 2 deletions src/app/zap-templates/partials/idl/cluster_definition.zapt
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
/** {{description}} */
{{#if generateClientCluster}}client {{else}}server {{/if~}}
cluster {{asUpperCamelCase name}} = {{code}} {
cluster {{asUpperCamelCase name}} = {{!}}
{{~#if manufacturerCode}}
{{~asMEI manufacturerCode code~}}
{{else}}
{{~code~}}
{{/if}} {
{{#zcl_enums}}
enum {{asUpperCamelCase name preserveAcronyms=true}} : ENUM{{multiply size 8}} {
{{#zcl_enum_items}}
Expand Down Expand Up @@ -29,7 +34,12 @@ cluster {{asUpperCamelCase name}} = {{code}} {
{{operation}}: {{role}}
{{~#last}}) {{/last~}}
{{~/chip_access_elements~}}
{{asUpperCamelCase name preserveAcronyms=true}} = {{code}} {
{{asUpperCamelCase name preserveAcronyms=true}} = {{!}}
{{~#if manufacturerCode}}
{{~asMEI manufacturerCode code~}}
{{else}}
{{~code~}}
{{/if}} {
{{#zcl_event_fields}}
{{>idl_structure_member label=name}}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
{{#zcl_command_arguments}}
{{#first}}
{{~new_line 1~}}{{~indent 1~}}response struct {{asUpperCamelCase parent.commandName}} = {{parent.code}} {
{{/first}}
{{~new_line 1~}}{{~indent 1~}}response struct {{asUpperCamelCase parent.commandName}} = {{!}}
{{~#if parent.manufacturerCode}}
{{~asMEI parent.manufacturerCode parent.code~}}
{{else}}
{{~parent.code~}}
{{/if}} {
{{/first}}
{{~indent 2~}}{{> idl_structure_member}}
{{#last}}

Expand Down

0 comments on commit bd8c01f

Please sign in to comment.