From 067004c266283095fdde95300e82737aedd18434 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Wed, 23 Aug 2023 07:54:10 -0400 Subject: [PATCH] Take into account manufacturerCode when generating .matter files (#28805) * Use asMEI for matter file codegen * Ensure backwards compatible format for MEI --------- Co-authored-by: Andrei Litvin --- .../partials/idl/attribute_definition.zapt | 7 ++++++- .../partials/idl/cluster_definition.zapt | 14 ++++++++++++-- .../partials/idl/command_response_struct.zapt | 9 +++++++-- 3 files changed, 25 insertions(+), 5 deletions(-) diff --git a/src/app/zap-templates/partials/idl/attribute_definition.zapt b/src/app/zap-templates/partials/idl/attribute_definition.zapt index 2fee7aa0e79320..25d60688265acf 100644 --- a/src/app/zap-templates/partials/idl/attribute_definition.zapt +++ b/src/app/zap-templates/partials/idl/attribute_definition.zapt @@ -28,5 +28,10 @@ {{~/if~}} {{~/if~}} {{/unless}} {{asLowerCamelCase name~}} - {{~#if isArray~}} [] {{~/if}} = {{code~}} + {{~#if isArray~}} [] {{~/if}} = {{!}} + {{~#if manufacturerCode}} + {{~asMEI manufacturerCode code~}} + {{else}} + {{~code~}} + {{/if~}} ; \ No newline at end of file diff --git a/src/app/zap-templates/partials/idl/cluster_definition.zapt b/src/app/zap-templates/partials/idl/cluster_definition.zapt index c42d1518e5a544..22550157b665f2 100644 --- a/src/app/zap-templates/partials/idl/cluster_definition.zapt +++ b/src/app/zap-templates/partials/idl/cluster_definition.zapt @@ -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}} @@ -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}} diff --git a/src/app/zap-templates/partials/idl/command_response_struct.zapt b/src/app/zap-templates/partials/idl/command_response_struct.zapt index 3e081ef3d2322d..4620e35b32ed5a 100644 --- a/src/app/zap-templates/partials/idl/command_response_struct.zapt +++ b/src/app/zap-templates/partials/idl/command_response_struct.zapt @@ -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}}