Skip to content

Commit

Permalink
Add a max length to cluster-objects typeinfo for string attributes. (#…
Browse files Browse the repository at this point in the history
…14256)

This lets consumers size buffers based on the spec-defined max length.
  • Loading branch information
bzbarsky-apple authored Jan 25, 2022
1 parent 151a5f1 commit 3c043ec
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/app/zap-templates/templates/app/cluster-objects.zapt
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,13 @@ namespace {{asUpperCamelCase label}} {
static constexpr ClusterId GetClusterId() { return Clusters::{{asUpperCamelCase parent.name}}::Id; }
static constexpr AttributeId GetAttributeId() { return Attributes::{{asUpperCamelCase label}}::Id; }
static constexpr bool MustUseTimedWrite() { return {{mustUseTimedWrite}}; }
{{#unless isArray}}
{{#if (isString type)}}
{{#if maxLength}}
static constexpr size_t MaxLength() { return {{maxLength}}; }
{{/if}}
{{/if}}
{{/unless}}
};
} // namespace {{asUpperCamelCase label}}
{{/zcl_attributes_server}}
Expand Down
Loading

0 comments on commit 3c043ec

Please sign in to comment.