-
Notifications
You must be signed in to change notification settings - Fork 82
/
zap-config-version-2.zapt
251 lines (219 loc) · 11.3 KB
/
zap-config-version-2.zapt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
{{zap_header}}
#if BIGENDIAN_CPU
{{#all_user_cluster_attributes_for_generated_defaults}}
{{~#first}}#define GENERATED_DEFAULTS_COUNT ({{count}}) {{new_line 1}}{{/first}}
{{~#first}}#define GENERATED_DEFAULTS { \ {{new_line 1}}{{/first}}{{as_generated_default_macro defaultValue attributeSize endian="big"}} /* {{arrayIndex}}{{#first}}0{{/first}},{{attributeValueType}} value for cluster: {{clusterName}}, attribute: {{name}}, side: {{side}} */ \ {{#last}}{{new_line 1}} } {{/last}}
{{/all_user_cluster_attributes_for_generated_defaults}}
#else //!BIGENDIAN_CPU
{{#all_user_cluster_attributes_for_generated_defaults}}
{{~#first}}#define GENERATED_DEFAULTS_COUNT ({{count}}) {{new_line 1}}{{/first}}
{{~#first}}#define GENERATED_DEFAULTS { \ {{new_line 1}}{{/first}}{{as_generated_default_macro defaultValue attributeSize endian="little"}} /* {{arrayIndex}}{{#first}}0{{/first}},{{attributeValueType}} value for cluster: {{clusterName}}, attribute: {{name}}, side: {{side~}} */ \ {{#last}}{{new_line 1}} } {{/last}}
{{/all_user_cluster_attributes_for_generated_defaults}}
#endif
// This is an array of EmberAfAttributeMinMaxValue structures.
{{#all_user_cluster_attributes_min_max_defaults}}
{{~#first}}#define GENERATED_MIN_MAX_DEFAULT_COUNT {{count}}{{new_line 1}}{{/first}}
{{~#first}}#define GENERATED_MIN_MAX_DEFAULTS { {{/first~}}
{ \
{{generated_defaults_index ./clusterName ./name 'DEFAULT' ./defaultValue '(uint8_t*)&(generatedDefaults[' '])'}}, /* Cluster: {{clusterName}}, Attribute Default Value: {{name}} interval */ \
{{generated_defaults_index ./clusterName ./name 'MINIMUM' ./attributeMinValue '(uint8_t*)&(generatedDefaults[' '])'}}, /* Cluster: {{clusterName}}, Attribute Minimum Value: {{name}} interval */ \
{{generated_defaults_index ./clusterName ./name 'MAXIMUM' ./attributeMaxValue '(uint8_t*)&(generatedDefaults[' '])'}} /* Cluster: {{clusterName}}, Attribute Maximum Value: {{name}} interval */ \
}{{~#not_last~}}, \ {{/not_last}}{{#last}} } {{/last}}
{{/all_user_cluster_attributes_min_max_defaults}}
{{#all_user_cluster_generated_attributes}}
{{~#first}}#define GENERATED_ATTRIBUTE_COUNT {{count}}{{new_line 1}}{{/first}}
{{/all_user_cluster_generated_attributes}}
// This is an array of EmberAfAttributeMetadata structures.
#define GENERATED_ATTRIBUTES { \
{{#all_user_cluster_generated_attributes}}
{{#if isAttributeBounded}}
{ {{as_hex code 4}}, ZCL_{{as_delimited_macro type}}_ATTRIBUTE_TYPE, {{attributeSize}}, ({{attribute_mask isWritable storageOption isAttributeBounded mfgCode clusterCode side isSingleton 'ATTRIBUTE_MASK_' ''}}), { (uint8_t*)&(minMaxDefaults[{{generated_attributes_min_max_index clusterName name}}]) } }{{#not_last}},{{/not_last}} /* {{index}} Cluster: {{clusterName}}, Attribute: {{name}}, Side: {{side}}*/ \
{{else if (is_number_greater_than attributeSize 2)}}
{ {{as_hex code 4}}, ZCL_{{as_delimited_macro type}}_ATTRIBUTE_TYPE, {{attributeSize}}, ({{attribute_mask isWritable storageOption isAttributeBounded mfgCode clusterCode side isSingleton 'ATTRIBUTE_MASK_' ''}}), { {{generated_defaults_index ./clusterName ./name 'DEFAULT' ./defaultValue '(uint8_t*)&(generatedDefaults[' '])'}} } }{{#not_last}},{{/not_last}} /* {{index}} Cluster: {{clusterName}}, Attribute: {{name}}, Side: {{side}}*/ \
{{else}}
{ {{as_hex code 4}}, ZCL_{{as_delimited_macro type}}_ATTRIBUTE_TYPE, {{attributeSize}}, ({{attribute_mask isWritable storageOption isAttributeBounded mfgCode clusterCode side isSingleton 'ATTRIBUTE_MASK_' ''}}), { (uint8_t*){{#if defaultValue}}{{defaultValue}}{{else}}0x00{{/if}} } }{{#not_last}},{{/not_last}} /* {{index}} Cluster: {{clusterName}}, Attribute: {{name}}, Side: {{side}}*/ \
{{/if}}
{{/all_user_cluster_generated_attributes}}
}
{{#generated_clustes_details}}
{{~#first}}#define GENERATED_CLUSTER_COUNT {{count}}{{new_line 1}}{{/first}}
{{/generated_clustes_details}}
// This is an array of EmberAfCluster structures.
#define GENERATED_CLUSTERS { \
{{#generated_clustes_details}}
{ {{as_hex clusterCode 4}}, (EmberAfAttributeMetadata*)&(generatedAttributes[{{#all_user_cluster_generated_attributes}}{{#if (is_lowercase_equal ./clusterName ../clusterName)}}{{#if (is_num_equal ./clusterIndex 1)}}{{#if (is_lowercase_equal ./clusterSide ../clusterSide)}}{{index}}{{/if}}{{/if}}{{/if}}{{/all_user_cluster_generated_attributes}}]), {{attributeCount}}, {{attributesSize}}, CLUSTER_MASK_{{as_delimited_macro side}}, NULL }{{#not_last}},{{/not_last}} /* {{index}}, Endpoint Id: {{endpointIdentifier}}, Cluster: {{clusterName}}, Side: {{side}}*/ \
{{/generated_clustes_details}}
}
{{#generated_endpoint_type_details}}
{{#first}}
#define GENERATED_ENDPOINT_TYPE_COUNT ({{count}})
{{/first}}
{{else}}
#define GENERATED_ENDPOINT_TYPE_COUNT (0)
{{/generated_endpoint_type_details}}
// This is an array of EmberAfEndpointType structures.
#define GENERATED_ENDPOINT_TYPES { \
{{#generated_endpoint_type_details}}
{ ((EmberAfCluster*)&(generatedClusters[{{#generated_clustes_details}}{{#if (is_num_equal ./endpointIndex 1)}}{{#if (is_num_equal ./endpointTypeId ../endpointTypeId)}}{{./index}}{{/if}}{{/if}}{{/generated_clustes_details}}])), {{clusterCount}}, {{attributesSize}} }, \
{{/generated_endpoint_type_details}}
}
// Largest attribute size is needed for various buffers
{{#all_user_cluster_generated_attributes}}
{{#first}}
#define ATTRIBUTE_LARGEST ({{maxAttributeSize}})
{{/first}}
{{else}}
#define ATTRIBUTE_LARGEST (1)
{{/all_user_cluster_generated_attributes}}
// Total size of singleton attributes
{{#all_user_cluster_generated_attributes}}
{{~#first}}
#define ATTRIBUTE_SINGLETONS_SIZE ({{singletonAttributeSize}})
{{/first}}
{{else}}
#define ATTRIBUTE_SINGLETONS_SIZE (0)
{{/all_user_cluster_generated_attributes}}
// Total size of attribute storage
{{#generated_endpoint_type_details}}
{{#first}}
#define ATTRIBUTE_MAX_SIZE ({{totalAttributeSizeAcrossEndpoints}})
{{/first}}
{{else}}
#define ATTRIBUTE_MAX_SIZE (0)
{{/generated_endpoint_type_details}}
// Number of fixed endpoints
{{#generated_endpoint_type_details}}
{{#first}}
#define FIXED_ENDPOINT_COUNT ({{count}})
{{/first}}
{{else}}
#define FIXED_ENDPOINT_COUNT (0)
{{/generated_endpoint_type_details}}
// Array of endpoints that are supported, the data inside
// the array is the endpoint number.
#define FIXED_ENDPOINT_ARRAY { \
{{#generated_endpoint_type_details}}
{{endpointIdentifier}}{{#not_last}},{{/not_last}} \
{{/generated_endpoint_type_details}}
}
// Array of profile ids
#define FIXED_PROFILE_IDS { \
{{#generated_endpoint_type_details}}
{{profileId}}{{#not_last}},{{/not_last}} \
{{/generated_endpoint_type_details}}
}
// Array of device ids
#define FIXED_DEVICE_IDS { \
{{#generated_endpoint_type_details}}
{{#if deviceId}}{{deviceId}}{{else}}0{{/if}}{{#not_last}},{{/not_last}} \
{{/generated_endpoint_type_details}}
}
// Array of device versions
#define FIXED_DEVICE_VERSIONS { \
{{#generated_endpoint_type_details}}
{{#if deviceId}}{{deviceVersion}}{{else}}0{{/if}}{{#not_last}},{{/not_last}} \
{{/generated_endpoint_type_details}}
}
// Array of endpoint types supported on each endpoint
#define FIXED_ENDPOINT_TYPES { \
{{#generated_endpoint_type_details}}
{{index}}{{#not_last}},{{/not_last}} \
{{/generated_endpoint_type_details}}
}
// Array of networks supported on each endpoint
#define FIXED_NETWORKS { \
{{#generated_endpoint_type_details}}
{{networkId}}{{#not_last}},{{/not_last}} \
{{/generated_endpoint_type_details}}
}
// Array of EmberAfCommandMetadata structs.
#define ZAP_COMMAND_MASK(mask) COMMAND_MASK_ ## mask
{{#all_user_cluster_generated_commands}}
{{~#first~}}#define EMBER_AF_GENERATED_COMMAND_COUNT ({{count}}){{/first}}
{{else}}
#define EMBER_AF_GENERATED_COMMAND_COUNT (0)
{{/all_user_cluster_generated_commands}}
#define GENERATED_COMMANDS { \
{{#all_user_cluster_generated_commands}}
{{~#if (is_num_equal 2 numberOfClusterSidesEnabled)}}
{ {{as_hex clusterCode 4}}, {{as_hex commandCode 2}}, {{command_mask commandSource "either" incoming outgoing commandMfgCode "COMMAND_MASK_"}} }, /* {{index}}, Cluster: {{clusterName}}, Command: {{commandName}}*/ \
{{else}}
{ {{as_hex clusterCode 4}}, {{as_hex commandCode 2}}, {{command_mask commandSource clusterSide incoming outgoing commandMfgCode "COMMAND_MASK_"}} }, /* {{index}}, Cluster: {{clusterName}}, Command: {{commandName}}*/ \
{{/if}}
{{/all_user_cluster_generated_commands}}
}
// Array of EmberAfManufacturerCodeEntry structures for commands.
{{#all_user_cluster_generated_commands}}
{{#first}}
#define GENERATED_COMMAND_MANUFACTURER_CODE_COUNT ({{mfgCommandCount}})
{{/first}}
{{else}}
#define GENERATED_COMMAND_MANUFACTURER_CODE_COUNT (0)
{{/all_user_cluster_generated_commands}}
#define GENERATED_COMMAND_MANUFACTURER_CODES { \
{{#all_user_cluster_generated_commands}}
{{#if (is_defined commandMfgCode)}}
{ {{index}}, {{as_hex commandMfgCode}} }, \
{{/if}}
{{/all_user_cluster_generated_commands}}
}
// This is an array of EmberAfManufacturerCodeEntry structures for clusters.
{{#generated_clustes_details}}
{{#first}}
#define GENERATED_CLUSTER_MANUFACTURER_CODE_COUNT ({{mfgClusterCount}})
{{/first}}
{{else}}
#define GENERATED_CLUSTER_MANUFACTURER_CODE_COUNT (0)
{{/generated_clustes_details}}
#define GENERATED_CLUSTER_MANUFACTURER_CODES { \
{{#generated_clustes_details}}
{{#if (is_defined mfgCode)}}
{ {{index}}, {{as_hex mfgCode}} }, \
{{/if}}
{{/generated_clustes_details}}
}
// This is an array of EmberAfManufacturerCodeEntry structures for attributes.
{{#all_user_cluster_generated_attributes}}
{{#first}}
#define GENERATED_ATTRIBUTE_MANUFACTURER_CODE_COUNT ({{mfgAttributeCount}})
{{/first}}
{{else}}
#define GENERATED_ATTRIBUTE_MANUFACTURER_CODE_COUNT (0)
{{/all_user_cluster_generated_attributes}}
#define GENERATED_ATTRIBUTE_MANUFACTURER_CODES { \
{{#all_user_cluster_generated_attributes}}
{{#if (is_defined mfgCode)}}
{ {{index}}, {{as_hex mfgCode}} }, \
{{/if}}
{{/all_user_cluster_generated_attributes}}
}
// Array of EmberAfPluginReportingEntry structures.
{{#all_user_reportable_attributes}}
{{#first}}
#define EMBER_AF_GENERATED_REPORTING_CONFIG_DEFAULTS_TABLE_SIZE ({{count}})
{{/first}}
{{else}}
#define EMBER_AF_GENERATED_REPORTING_CONFIG_DEFAULTS_TABLE_SIZE (0)
{{/all_user_reportable_attributes}}
#define EMBER_AF_GENERATED_REPORTING_CONFIG_DEFAULTS { \
{{#all_user_reportable_attributes}}
{ EMBER_ZCL_REPORTING_DIRECTION_REPORTED, {{as_hex endpointIdentifier 4}}, {{as_hex clusterCode 4}}, {{as_hex code 4}}, CLUSTER_MASK_{{asDelimitedMacro side}}, {{as_hex mfgCode 4}}, {{attributeReportableMinValue}}, {{attributeReportableMaxValue}}, {{attributeReportableChange}} }, /* Endpoint Id: {{endpointIdentifier}}, Cluster: {{clusterName}}, Attribute: {{name}} */ \
{{/all_user_reportable_attributes}}
}
#define EMBER_AF_MANUFACTURER_CODE {{user_manufacturer_code}}
#define EMBER_AF_DEFAULT_RESPONSE_POLICY_{{user_default_response_policy toupper="true"}}
// All Enabled Clusters
{{#all_user_clusters}}
#define ZCL_USING_{{asDelimitedMacro define}}_{{asDelimitedMacro side}}
{{/all_user_clusters}}
// Cluster Counts
{{#all_user_clusters}}
#define EMBER_AF_{{define}}_{{as_delimited_macro side}}_ENDPOINT_COUNT ({{endpointCount}})
{{/all_user_clusters}}
// All Enabled Cluster Attributes
{{#all_user_cluster_generated_attributes}}
#define ZCL_USING_{{asDelimitedMacro clusterDefine}}_{{asDelimitedMacro define}}_ATTRIBUTE
{{/all_user_cluster_generated_attributes}}
// !! Temporary, until it's generated by ZAP from user input. See ZAPP-434 !!
#define EMBER_AF_SUPPORT_COMMAND_DISCOVERY
#endif // SILABS_AF_ENDPOINT_CONFIG