Skip to content
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

Fix zcl_struct_items_by_struct_and_cluster_name to work for global structs. #1373

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion src-electron/generator/helper-zcl.js
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,10 @@ async function zcl_struct_items_by_struct_name(name, options) {

/**
* Block helper iterating over all struct items given the struct name and
* cluster name.
* cluster name. The items iterated will be those that correspond to that
* struct name being used within the given cluster. That means the struct name
* must be either a global struct (in which case the cluster name is just
* ignored), or a struct associated with the given cluster.
*
* @param name
* @param clusterName
Expand All @@ -323,6 +326,17 @@ async function zcl_struct_items_by_struct_and_cluster_name(
options
) {
let packageIds = await templateUtil.ensureZclPackageIds(this)
bzbarsky-apple marked this conversation as resolved.
Show resolved Hide resolved
// Check for a global struct first.
const structObj = await queryZcl.selectStructByName(
this.global.db,
name,
packageIds
)
if (structObj.structClusterCount == 0) {
// Just ignore the cluster name.
return zcl_struct_items_by_struct_name.call(this, name, options)
}

let promise = queryZcl
.selectAllStructItemsByStructName(
this.global.db,
Expand Down
Loading