Skip to content

Commit

Permalink
Stop generating attribute accessors for AttributeAccessInterface-only…
Browse files Browse the repository at this point in the history
… attributes.

Those accessors can't work correctly and are just a bug waiting to happen if
someone tries to use them.
  • Loading branch information
bzbarsky-apple committed Apr 27, 2023
1 parent cc6c414 commit e62787c
Show file tree
Hide file tree
Showing 6 changed files with 1,602 additions and 6,658 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ namespace {{asUpperCamelCase parent.label}} {
namespace Attributes {

{{/first}}
{{#unless (isStrEqual storagePolicy "attributeAccessInterface")}}
{{#if_is_struct type}}
{{else if (canHaveSimpleAccessors this)}}
#error Attribute "{{name}}" in cluster "{{../name}}" is struct-typed and must be added to the attributeAccessInterfaceAttributes object in src/app/zap-templates/zcl/zcl.json and src/app/zap-templates/zcl/zcl-with-test-extensions.json
{{/if_is_struct}}
namespace {{asUpperCamelCase label}} {

{{#*inline "clusterId"}}Clusters::{{asUpperCamelCase parent.label}}::Id{{/inline}}
Expand Down Expand Up @@ -133,7 +135,7 @@ EmberAfStatus Set(chip::EndpointId endpoint, {{zapTypeToEncodableClusterObjectTy

} // namespace {{asUpperCamelCase label}}

{{/if_is_struct}}
{{/unless}}
{{#last}}
} // namespace Attributes
} // {{asUpperCamelCase parent.label}}
Expand Down
5 changes: 2 additions & 3 deletions src/app/zap-templates/templates/app/attributes/Accessors.zapt
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ namespace {{asUpperCamelCase parent.label}} {
namespace Attributes {

{{/first}}
{{#if_is_struct type}}
{{else if (canHaveSimpleAccessors this)}}
{{#unless (isStrEqual storagePolicy "attributeAccessInterface")}}
namespace {{asUpperCamelCase label}} {
EmberAfStatus Get(chip::EndpointId endpoint, {{accessorGetterType this}} value); // {{type}}
EmberAfStatus Set(chip::EndpointId endpoint, {{zapTypeToEncodableClusterObjectType type ns=parent.name forceNotNullable=true forceNotOptional=true}} value);
Expand All @@ -34,7 +33,7 @@ EmberAfStatus Set(chip::EndpointId endpoint, {{zapTypeToEncodableClusterObjectTy
{{/if}}
} // namespace {{asUpperCamelCase label}}

{{/if_is_struct}}
{{/unless}}
{{#last}}
} // namespace Attributes
} // {{asUpperCamelCase parent.label}}
Expand Down
6 changes: 5 additions & 1 deletion src/app/zap-templates/zcl/zcl-with-test-extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,11 @@
"PacketUnicastTxCount",
"CurrentMaxRate",
"OverrunCount"
]
],
"Channel": ["Lineup", "CurrentChannel"],
"Media Playback": ["SampledPosition"],
"Application Launcher": ["CurrentApp"],
"Application Basic": ["Application"]
},
"defaultReportingPolicy": "mandatory",
"ZCLDataTypes": ["ARRAY", "BITMAP", "ENUM", "NUMBER", "STRING", "STRUCT"],
Expand Down
6 changes: 5 additions & 1 deletion src/app/zap-templates/zcl/zcl.json
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,11 @@
"PacketUnicastTxCount",
"CurrentMaxRate",
"OverrunCount"
]
],
"Channel": ["Lineup", "CurrentChannel"],
"Media Playback": ["SampledPosition"],
"Application Launcher": ["CurrentApp"],
"Application Basic": ["Application"]
},
"defaultReportingPolicy": "mandatory",
"ZCLDataTypes": ["ARRAY", "BITMAP", "ENUM", "NUMBER", "STRING", "STRUCT"],
Expand Down
Loading

0 comments on commit e62787c

Please sign in to comment.