-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Update MatterIDL codegen to not take into account enabled
for client attributes
#25737
Conversation
PR #25737: Size comparison from bbb8e93 to 568fd26 Full report (1 build for cc32xx)
|
{{~/if~}} | ||
{{#if (is_client side)}} | ||
{{#zcl_attributes_server}} | ||
{{~#if clusterRef}}{{!Using `ClusterRef` to detect global attributes~}} |
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.
This works but if needed I am wondering if global attributes belong to a certain range. In that case you can also use if_compare if needed.
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.
Using a numeric range seems even more hard-coded. Ideally I would have the helper, however isGlobalAttribute does not work.
{{~/chip_access_elements~}} | ||
{{~#if isNullable~}} | ||
nullable {{!marker to place a space even with whitespace removal~}} | ||
{{~/if~}} {{#if entryType}}{{entryType}}{{else}}{{type}}{{/if}} |
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.
You can use {{#if isArray}}
if under zcl_attributes_server block helper
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.
It did not work for me. isArray was always false (notice that isArray was already used in this method)
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.
It should work with today's ZAP release.
readonly {{!marker to place a space even with whitespace removal~}} | ||
{{~/unless~}} | ||
{{~!TODO: write only attributes should also be supported~}} | ||
{{~!TODO: non-reportable (nosubscribe) attributes should also be supported ~}} |
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.
This is supported using isReportable
and isReportableAttribute
under zcl_attributes_server
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.
isReportable
does not mean the same thing as Matter's nosubscribe
. Most importantly, isReportable
is a ZAP setting, while nosubscribe
needs to be an XML thing attached to the attribute independent of config.
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.
isReportable stopped working when I was using zcl_attributes_server. It was only working for the chip_* version.
{{/zcl_attributes_server~}} | ||
{{else}} | ||
{{#chip_server_cluster_attributes}} | ||
{{~#unless isGlobalAttribute~}} |
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.
Why do you need to switch to chip_server_cluster_attributes
here?
Are you looking for if_basic_attribute
by any chance?
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.
chip_server_cluster_attributes was used before already before. I only switched the client-side currently. This piece of code is unchanged from what was before (except I moved the attribute generation into a common file to re-use it)
readonly attribute int16u primary1X = 17; | ||
readonly attribute int16u primary1Y = 18; |
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.
The light switch app most definitely does not do this.
What is this part of the .matter file used for in the light switch app, if anything? What is the goal of listing this at all, if it's just going to be a list of everything in the cluster? Why not just have a list of clusters at that point?
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.
This is the client-side cluster version.
It looks to me like the zap file says that the light app has the client-side cluster enabled for light switch. I am not sure why it does that ... but it does.
We do have an oddity in codegen here: our client side always only uses src/controller/data_model/controller-clusters.matter
however our codegen client and server side.
I believe ideally we should separate client and server IDLs, however that is likely a different change.
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.
Light switches are required by spec to support certain client clusters: On/Off, and depending on the switch Level Control, etc.
our client side always only uses src/controller/data_model/controller-clusters.matter
Some of our clients use that. Not all. Light-switch does not.
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.
Again, I think we need to clearly decide what "client side" means in .matter files.
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.
Client-side in matter files represents what client side shows up as zap (i.e. side == client).
It was meant to be a representation of what zap contains as configuration.
The issue seems to also be that our usage of "side == client" under zap is unusual ... we seem to care about cluster enabling but not about underlying attributes/commands enabling (is this true?). I am not familiar enough with zap logic to understand this. Logic-wise it seems to me like client-side should be able to use whatever it wants where as server side has granular opinionated control about what it wants to support (i.e. we cannot just codegen everything)
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.
The issue seems to also be that our usage of "side == client" under zap is unusual
Our usage in some specific clients.
We seem to care about cluster enabling but not about underlying attributes/commands enabling
That is the current state of things. Ideally, we would move to not caring about any of the ZAP state in those clients at all, since they are meant to be "everything" clients and should ideally just generate based on the XML. Ideally they would not reference a .zap or .matter file at all.
I am pretty sure Darwin could make that switch now; I can't speak for the other clients. We would need to think a bit about whether chip-tool should expose some of the clusters that are currently disabled in the client ZAP config (like the proxy bits)....
Logic-wise it seems to me like client-side should be able to use whatever it wants
For some of our APIs there are strongly typed callback types, etc, and those get codegenned.
I think it would be worth looking at something like light-switch-app to see what, if anything, is actually codegenned there based on the client config. If the answer is "nothing", so the only things using the client config are the "everything" clients, that would be useful information.
PR #25737: Size comparison from bbb8e93 to 790b79a Increases (1 build for cc32xx)
Full report (1 build for cc32xx)
|
Closing as #25693 will fix this and makes sure java zap-codegen is in sync with matter IDL codegen. |
We expect to generate accessors for all client side attributes, so for client side this switches
code generation loops to use
zcl_attributes_server
.This also switches to workardouns for other settings because of different helper modes:
As a result,
.matter
files are now expected to have all attributes in client clusters, regardless of zap enabling/disabling on them.After project-chip/zap#899 usage, we may be able to simplify these back...
Fixes #25684