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

properly tagging storage option based on zcl.json #1140

Merged
merged 5 commits into from
Sep 15, 2023
Merged
Show file tree
Hide file tree
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
10 changes: 9 additions & 1 deletion src-electron/db/query-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,14 @@ async function insertOrUpdateAttributeState(
attributeId,
clusterRef
)
if (
staticAttribute.storagePolicy ==
dbEnum.storagePolicy.attributeAccessInterface
) {
staticAttribute.storagePolicy = dbEnum.storageOption.external
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is mixing up storage policy (which can be "any" or "attributeAccessInterface") and storage option, which can be "external", "ram", "nvm". See also #367

So what I would suggest is that instead of storing "storage option" values in a field that stores storage policy, instead we just use a local variable for the storage option to use for our db insert.

Incidentally, when I was looking over this setup, the resolve method on storagePolicy in db-enum.js is broken: it has storagePolicy.attributeAccess where it should have storagePolicy.attributeAccessInterface, no? Not directly relevant to this PR, but we should fix it here or in a followup.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree, I will make a follow up PR. Thank you.

} else {
staticAttribute.storagePolicy = dbEnum.storageOption.ram
}

if (staticAttribute == null) {
throw new Error(`COULD NOT LOCATE ATTRIBUTE: ${attributeId} `)
Expand Down Expand Up @@ -245,7 +253,7 @@ INTO ENDPOINT_TYPE_ATTRIBUTE (
cluster.endpointTypeClusterId,
attributeId,
staticAttribute.defaultValue ? staticAttribute.defaultValue : '',
dbEnum.storageOption.ram,
staticAttribute.storagePolicy,
clusterRef,
reportMinInterval,
reportMaxInterval,
Expand Down
1 change: 1 addition & 0 deletions src-electron/zcl/zcl-loader-silabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,7 @@ function prepareCluster(cluster, context, isExtension = false) {
if (context.listsUseAttributeAccessInterface && attribute.$.entryType) {
storagePolicy = dbEnum.storagePolicy.attributeAccessInterface
} else if (
context.listsUseAttributeAccessInterface &&
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this change? The attributeAccessInterfaceAttributes bit is not dependent on what lists do, is it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually thought this was a boolean that indicated whether or not the attributeAccessInterface was to be referenced or not but now I understand that attribute lists should ALSO be external. Will fix in a follow up. Thank you.

context.attributeAccessInterfaceAttributes &&
context.attributeAccessInterfaceAttributes[cluster.name] &&
context.attributeAccessInterfaceAttributes[cluster.name].includes(name)
Expand Down