-
Notifications
You must be signed in to change notification settings - Fork 92
Load a few more attribute qualities from ZCL XML #1720
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
12e17e2
54a45ad
95c5621
c128bdc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1010,10 +1010,13 @@ function zcl_global_commands(options) { | |
| * - entryTypeElseType | ||
| * - id | ||
| * - isArray | ||
| * - isAtomic | ||
| * - isChangeOmitted | ||
| * - isFabricSensitive | ||
| * - isNullable | ||
| * - isOptional | ||
| * - isQuieterReporting | ||
| * - isSourceAttribution | ||
| * - isReadable | ||
| * - isReadableAttribute | ||
| * - isReportable | ||
|
|
@@ -1943,6 +1946,72 @@ async function if_is_atomic(type, options) { | |
| } | ||
| } | ||
|
|
||
| /** | ||
| * Block helper that renders its body when the current attribute carries a | ||
| * given quality (Matter spec section 7.7), and the inverse (`{{else}}`) block | ||
| * otherwise. Meant to be used inside an attribute iteration context (e.g. | ||
| * `{{#zcl_attributes}}`) where `this` is an attribute object. | ||
| * | ||
| * Supported quality names: | ||
| * - 'fixed' : attribute value is fixed (persistence === 'fixed') | ||
| * - 'nonVolatile' : attribute is stored in non-volatile memory | ||
| * - 'changeOmitted' : attribute omits change reporting (C) | ||
| * - 'quieterReporting' : attribute uses quieter reporting (Q) | ||
| * - 'sourceAttribution' : attribute carries source attribution (A) | ||
| * - 'atomic' : attribute must be written atomically (T) | ||
| * - 'nullable' : attribute is nullable (X) | ||
| * - 'scene' : attribute is scene required (S) | ||
| * | ||
| * example: | ||
| * {{#zcl_attributes}} | ||
| * {{#if_attribute_quality "quieterReporting"}} | ||
| * {{label}} uses quieter reporting | ||
| * {{else}} | ||
| * {{label}} does not use quieter reporting | ||
| * {{/if_attribute_quality}} | ||
| * {{/zcl_attributes}} | ||
| * | ||
| * @param {*} quality name of the quality to check for | ||
| * @param {*} options | ||
| * @returns rendered block content. | ||
| */ | ||
| function if_attribute_quality(quality, options) { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't believe a helper like this is needed. wondering if existing attribute helpers having these properties would be good enough. |
||
| let hasQuality = false | ||
| if (this != null) { | ||
| switch (quality) { | ||
| case 'fixed': | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove all hardcoded strings and extend existing enums or create a new one if necessary. |
||
| hasQuality = this.persistence === dbEnum.persistence.fixed | ||
| break | ||
| case 'nonVolatile': | ||
| hasQuality = this.persistence === dbEnum.persistence.nonVolatile | ||
| break | ||
| case 'changeOmitted': | ||
| hasQuality = !!this.isChangeOmitted | ||
| break | ||
| case 'quieterReporting': | ||
| hasQuality = !!this.isQuieterReporting | ||
| break | ||
| case 'sourceAttribution': | ||
| hasQuality = !!this.isSourceAttribution | ||
| break | ||
| case 'atomic': | ||
| case 'atomicWrite': | ||
| hasQuality = !!this.isAtomic | ||
| break | ||
| case 'nullable': | ||
| hasQuality = !!this.isNullable | ||
| break | ||
| case 'scene': | ||
| hasQuality = !!this.isSceneRequired | ||
| break | ||
| default: | ||
| hasQuality = false | ||
| break | ||
| } | ||
| } | ||
| return hasQuality ? options.fn(this) : options.inverse(this) | ||
| } | ||
|
paulr34 marked this conversation as resolved.
|
||
|
|
||
| /** | ||
| * If helper that checks if a type is a bitmap | ||
| * | ||
|
|
@@ -3374,6 +3443,7 @@ exports.asUnderlyingZclType = dep(asUnderlyingZclType, { | |
| to: 'as_underlying_zcl_type' | ||
| }) | ||
|
|
||
| exports.if_attribute_quality = if_attribute_quality | ||
| exports.if_is_bitmap = if_is_bitmap | ||
|
|
||
| exports.if_is_enum = if_is_enum | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add these for endpointTypeAttributeExtended as well