Skip to content

Commit

Permalink
Fix handling of optional struct-typed command arguments in chip-tool. (
Browse files Browse the repository at this point in the history
…#31658)

AddArgument documents that for "complex" (i.e. list and struct) arguments there
is no automatic type-based handling of optionality and the "kOptional" flag
needs to be passed in explicitly.  But the generated code was not doing that.
  • Loading branch information
bzbarsky-apple authored and pull[bot] committed Feb 22, 2024
1 parent ec7ba55 commit 2061218
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion examples/chip-tool/templates/commands.zapt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public:
{
{{#zcl_command_arguments}}
{{#if_chip_complex}}
AddArgument("{{asUpperCamelCase label}}", &mComplex_{{asUpperCamelCase label}});
AddArgument("{{asUpperCamelCase label}}", &mComplex_{{asUpperCamelCase label}}{{#if isOptional}}, "", Argument::kOptional{{/if}});
{{else if (isString type)}}
AddArgument("{{asUpperCamelCase label}}", &mRequest.{{asLowerCamelCase label}});
{{else}}
Expand Down
24 changes: 12 additions & 12 deletions zzz_generated/chip-tool/zap-generated/cluster/Commands.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2061218

Please sign in to comment.