-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use ZAP to generate a more minimal code/reviewable IDL of what is ena…
…bled. (#13544) * Start building a 'matter IDL' generator. I would like to see what data is being generated WITHOUT trying to parse code. This would make it easier on code reviews and generally understanding what xml + zap actually mean. * Some initial example: can generate clusters and attributes and a lot of data types * make fabric scoped by show up * Add listing of commands * make commands take arguments * Only add cluster enums to the IDL * Ran zap-all generate to get a lot of matter IDL files * Support full command request/response and start describing endpoints * Much better display: only used structs and group by cluster and global as well * regen all and this time the content seems smaller and focused * Update FIXME to actual doc ... fixme was done * ZAP regen all again * Restyle fixes * Split longer line ifs onto separate lines * Code review noticed readonly and readwrite were switched. Fix that * Add support for flagging list attributes with [] * Add detection of array types, optionallity and nullability in struct items * Optionality, nullability and list in request/response structs * regen all * Propper support for events, fix namings for structs * Add indices to request and response parameters. Do not include empty requests (they serve no purpose) * re-ran zap, made some things non-reportable
- Loading branch information
Showing
24 changed files
with
22,164 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{{#if struct_is_fabric_scoped}} | ||
{{indent extraIndent~}} [fabric_scoped_by={{asUpperCamelCase struct_fabric_idx_field}}] | ||
{{/if}} | ||
{{indent extraIndent~}} struct {{name}} { | ||
{{#zcl_struct_items}} | ||
{{indent extraIndent~}} {{> idl_structure_member}} | ||
{{/zcl_struct_items}} | ||
{{indent extraIndent~}} } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{{~#if isOptional~}} optional {{/if~}} | ||
{{~#if isNullable~}} nullable {{/if~}} | ||
|
||
{{type}} {{asLowerCamelCase label~}} | ||
|
||
{{~#if isArray~}} | ||
[] | ||
{{~/if}} = {{fieldIdentifier}}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
// This IDL was generated automatically by ZAP. | ||
// It is for view/code review purposes only. | ||
|
||
{{#chip_shared_structs}} | ||
{{>idl_structure_definition extraIndent=0}} | ||
|
||
{{/chip_shared_structs}} | ||
{{!TODO: consider #chip_clusters as iteration point as well. | ||
{{! Unsure about the differences}} | ||
{{#all_user_clusters}} | ||
{{side}} cluster {{asUpperCamelCase name}} = {{code}} { | ||
{{#zcl_enums}} | ||
enum {{asUpperCamelCase name}} : {{type}} { | ||
{{#zcl_enum_items}} | ||
k{{asUpperCamelCase label}} = {{value}}; | ||
{{/zcl_enum_items}} | ||
} | ||
|
||
{{/zcl_enums}} | ||
{{#chip_cluster_specific_structs}} | ||
{{>idl_structure_definition extraIndent=1}} | ||
|
||
{{/chip_cluster_specific_structs}} | ||
{{#zcl_events}} | ||
{{priority}} event {{asUpperCamelCase name}} = {{code}} { | ||
{{#zcl_event_fields}} | ||
{{>idl_structure_member label=name}} | ||
|
||
{{/zcl_event_fields}} | ||
} | ||
|
||
{{/zcl_events}} | ||
{{#chip_cluster_attributes}} | ||
attribute( | ||
{{~#if isWritableAttribute~}} | ||
writable | ||
{{~else~}} | ||
readonly | ||
{{~/if~}} | ||
{{~#if isReportableAttribute~}} | ||
, reportable | ||
{{~/if~}} | ||
) {{type}} {{asLowerCamelCase name~}} | ||
{{~#if isList~}} | ||
[] | ||
{{~/if}} = {{code}}; | ||
{{/chip_cluster_attributes}} | ||
{{#chip_cluster_commands}} | ||
{{#if arguments}} | ||
|
||
request struct {{asUpperCamelCase name}}Request { | ||
{{#chip_cluster_command_arguments}} | ||
{{> idl_structure_member}} | ||
|
||
{{/chip_cluster_command_arguments}} | ||
} | ||
{{/if}} | ||
{{/chip_cluster_commands}} | ||
{{#chip_cluster_responses}} | ||
|
||
response struct {{asUpperCamelCase name}} { | ||
{{#chip_cluster_response_arguments}} | ||
{{> idl_structure_member}} | ||
|
||
{{/chip_cluster_response_arguments}} | ||
} | ||
{{/chip_cluster_responses}} | ||
{{#chip_cluster_commands}} | ||
{{#first}} | ||
|
||
{{/first}} | ||
command {{asUpperCamelCase name}}( | ||
{{~#if arguments~}} | ||
{{asUpperCamelCase name}}Request | ||
{{~/if~}} | ||
): {{asUpperCamelCase responseName}} = {{code}}; | ||
{{/chip_cluster_commands}} | ||
} | ||
|
||
{{/all_user_clusters}} | ||
|
||
{{#user_endpoints}} | ||
endpoint {{endpointId}} { | ||
{{!TODO: report device types and cluster instantionation. }} | ||
} | ||
|
||
{{/user_endpoints}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.