3 * Copyright (c) 2021 Project CHIP Authors
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
18 // THIS FILE IS GENERATED BY ZAP
20 // Prevent multiple inclusion
23 // Default values for the attributes longer than a pointer,
24 // in a form of a binary blob
25 // Separate block is generated for big-endian and little-endian cases.
27 #define GENERATED_DEFAULTS \
29 /* 0 - Default for cluster: "Basic", attribute: "VendorName". side: server, big-endian */ \
30 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
31 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
33 /* 32 - Default for cluster: "Basic", attribute: "ProductName". side: server, big-endian */ \
34 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
35 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
37 /* 64 - Default for cluster: "Basic", attribute: "UserLabel". side: server, big-endian */ \
38 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
39 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
41 /* 96 - Default for cluster: "Basic", attribute: "Location". side: server, big-endian */ \
42 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
44 /* 112 - Default for cluster: "Basic", attribute: "HardwareVersionString". side: server, big-endian */ \
45 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
46 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
47 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
48 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
50 /* 176 - Default for cluster: "Basic", attribute: "SoftwareVersion". side: server, big-endian */ \
51 0x00, 0x00, 0x00, 0x00, \
53 /* 180 - Default for cluster: "Basic", attribute: "SoftwareVersionString". side: server, big-endian */ \
54 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
55 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
56 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
57 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
60 #else // !BIGENDIAN_CPU
61 #define GENERATED_DEFAULTS \
63 /* 0 - Default for cluster: "Basic", attribute: "VendorName". side: server, little-endian */ \
64 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
65 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
67 /* 32 - Default for cluster: "Basic", attribute: "ProductName". side: server, little-endian */ \
68 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
69 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
71 /* 64 - Default for cluster: "Basic", attribute: "UserLabel". side: server, little-endian */ \
72 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
73 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
75 /* 96 - Default for cluster: "Basic", attribute: "Location". side: server, little-endian */ \
76 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
78 /* 112 - Default for cluster: "Basic", attribute: "HardwareVersionString". side: server, little-endian */ \
79 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
80 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
81 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
82 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
84 /* 176 - Default for cluster: "Basic", attribute: "SoftwareVersion". side: server, little-endian */ \
85 0x00, 0x00, 0x00, 0x00, \
87 /* 180 - Default for cluster: "Basic", attribute: "SoftwareVersionString". side: server, little-endian */ \
88 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
89 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
90 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
91 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
94 #endif // BIGENDIAN_CPU
96 #define GENERATED_DEFAULTS_COUNT (7)
98 #define ZAP_TYPE(type) ZCL_##type##_ATTRIBUTE_TYPE
99 #define ZAP_LONG_DEFAULTS_INDEX(index) \
101 (uint8_t *) (&generatedDefaults[index]) \
103 #define ZAP_MIN_MAX_DEFAULTS_INDEX(index) \
105 (uint8_t *) (&minMaxDefault[index]) \
107 #define ZAP_EMPTY_DEFAULT() \
111 #define ZAP_SIMPLE_DEFAULT(x) \
116 // This is an array of EmberAfAttributeMinMaxValue structures.
117 #define GENERATED_MIN_MAX_DEFAULT_COUNT 0
118 #define GENERATED_MIN_MAX_DEFAULTS \
122 #define ZAP_ATTRIBUTE_MASK(mask) ATTRIBUTE_MASK_##mask
123 // This is an array of EmberAfAttributeMetadata structures.
124 #define GENERATED_ATTRIBUTE_COUNT 17
125 #define GENERATED_ATTRIBUTES \
127 { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(2) }, /* On/off (server): cluster revision */ \
128 { 0x0000, ZAP_TYPE(BOOLEAN), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* On/off (server): on/off */ \
129 { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(3) }, /* Level Control (server): cluster revision */ \
130 { 0x0000, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* Level Control (server): current level */ \
131 { 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), \
132 ZAP_SIMPLE_DEFAULT(3) }, /* Basic (server): cluster revision */ \
133 { 0x0000, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), \
134 ZAP_EMPTY_DEFAULT() }, /* Basic (server): InteractionModelVersion */ \
135 { 0x0001, ZAP_TYPE(CHAR_STRING), 32, ZAP_ATTRIBUTE_MASK(SINGLETON), \
136 ZAP_LONG_DEFAULTS_INDEX(0) }, /* Basic (server): VendorName */ \
137 { 0x0002, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_EMPTY_DEFAULT() }, /* Basic (server): VendorID */ \
138 { 0x0003, ZAP_TYPE(CHAR_STRING), 32, ZAP_ATTRIBUTE_MASK(SINGLETON), \
139 ZAP_LONG_DEFAULTS_INDEX(32) }, /* Basic (server): ProductName */ \
140 { 0x0004, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_EMPTY_DEFAULT() }, /* Basic (server): ProductID */ \
141 { 0x0005, ZAP_TYPE(CHAR_STRING), 32, ZAP_ATTRIBUTE_MASK(SINGLETON) | ZAP_ATTRIBUTE_MASK(WRITABLE), \
142 ZAP_LONG_DEFAULTS_INDEX(64) }, /* Basic (server): UserLabel */ \
143 { 0x0006, ZAP_TYPE(CHAR_STRING), 16, ZAP_ATTRIBUTE_MASK(SINGLETON) | ZAP_ATTRIBUTE_MASK(WRITABLE), \
144 ZAP_LONG_DEFAULTS_INDEX(96) }, /* Basic (server): Location */ \
145 { 0x0007, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), \
146 ZAP_SIMPLE_DEFAULT(0x00) }, /* Basic (server): HardwareVersion */ \
147 { 0x0008, ZAP_TYPE(CHAR_STRING), 64, ZAP_ATTRIBUTE_MASK(SINGLETON), \
148 ZAP_LONG_DEFAULTS_INDEX(112) }, /* Basic (server): HardwareVersionString */ \
149 { 0x0009, ZAP_TYPE(INT32U), 4, ZAP_ATTRIBUTE_MASK(SINGLETON), \
150 ZAP_LONG_DEFAULTS_INDEX(176) }, /* Basic (server): SoftwareVersion */ \
151 { 0x000A, ZAP_TYPE(CHAR_STRING), 64, ZAP_ATTRIBUTE_MASK(SINGLETON), \
152 ZAP_LONG_DEFAULTS_INDEX(180) }, /* Basic (server): SoftwareVersionString */ \
153 { 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* Network Commissioning (server): cluster revision */ \
156 // This is an array of EmberAfCluster structures.
157 #define ZAP_ATTRIBUTE_INDEX(index) ((EmberAfAttributeMetadata *) (&generatedAttributes[index]))
159 // Cluster function static arrays
160 #define GENERATED_FUNCTION_ARRAYS \
161 const EmberAfGenericClusterFunction chipFuncArrayOnOffServer[] = { \
162 (EmberAfGenericClusterFunction) emberAfOnOffClusterServerInitCallback, \
164 const EmberAfGenericClusterFunction chipFuncArrayLevelControlServer[] = { \
165 (EmberAfGenericClusterFunction) emberAfLevelControlClusterServerInitCallback, \
168 #define ZAP_CLUSTER_MASK(mask) CLUSTER_MASK_##mask
169 #define GENERATED_CLUSTER_COUNT 4
170 #define GENERATED_CLUSTERS \
174 ZAP_ATTRIBUTE_INDEX(0), \
177 ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \
178 chipFuncArrayOnOffServer \
179 }, /* Endpoint: 1, Cluster: On/off (server) */ \
181 ZAP_ATTRIBUTE_INDEX(2), \
184 ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \
185 chipFuncArrayLevelControlServer }, /* Endpoint: 1, Cluster: Level Control (server) */ \
187 0x0028, ZAP_ATTRIBUTE_INDEX(4), 12, 254, ZAP_CLUSTER_MASK(SERVER), NULL \
188 }, /* Endpoint: 1, Cluster: Basic (server) */ \
190 0x0031, ZAP_ATTRIBUTE_INDEX(16), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \
191 }, /* Endpoint: 1, Cluster: Network Commissioning (server) */ \
194 #define ZAP_CLUSTER_INDEX(index) ((EmberAfCluster *) (&generatedClusters[index]))
196 // This is an array of EmberAfEndpointType structures.
197 #define GENERATED_ENDPOINT_TYPES \
199 { ZAP_CLUSTER_INDEX(0), 4, 262 }, \
202 // Largest attribute size is needed for various buffers
203 #define ATTRIBUTE_LARGEST (65)
205 // Total size of singleton attributes
206 #define ATTRIBUTE_SINGLETONS_SIZE (254)
208 // Total size of attribute storage
209 #define ATTRIBUTE_MAX_SIZE (262)
211 // Number of fixed endpoints
212 #define FIXED_ENDPOINT_COUNT (1)
214 // Array of endpoints that are supported, the data inside
215 // the array is the endpoint number.
216 #define FIXED_ENDPOINT_ARRAY \
221 // Array of profile ids
222 #define FIXED_PROFILE_IDS \
227 // Array of device ids
228 #define FIXED_DEVICE_IDS \
233 // Array of device versions
234 #define FIXED_DEVICE_VERSIONS \
239 // Array of endpoint types supported on each endpoint
240 #define FIXED_ENDPOINT_TYPES \
245 // Array of networks supported on each endpoint
246 #define FIXED_NETWORKS \
251 // Array of EmberAfCommandMetadata structs.
252 #define ZAP_COMMAND_MASK(mask) COMMAND_MASK_##mask
253 #define EMBER_AF_GENERATED_COMMAND_COUNT (31)
254 #define GENERATED_COMMANDS \
256 { 0x0006, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* On/off (server): Off */ \
257 { 0x0006, 0x01, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* On/off (server): On */ \
258 { 0x0006, 0x02, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* On/off (server): Toggle */ \
259 { 0x0008, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Level Control (server): MoveToLevel */ \
260 { 0x0008, 0x01, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Level Control (server): Move */ \
261 { 0x0008, 0x02, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Level Control (server): Step */ \
262 { 0x0008, 0x03, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Level Control (server): Stop */ \
263 { 0x0008, 0x04, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Level Control (server): MoveToLevelWithOnOff */ \
264 { 0x0008, 0x05, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Level Control (server): MoveWithOnOff */ \
265 { 0x0008, 0x06, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Level Control (server): StepWithOnOff */ \
266 { 0x0008, 0x07, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Level Control (server): StopWithOnOff */ \
267 { 0x0028, 0x00, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* Basic (server): StartUp */ \
268 { 0x0028, 0x01, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* Basic (server): ShutDown */ \
269 { 0x0028, 0x02, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* Basic (server): Leave */ \
270 { 0x0031, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Network Commissioning (server): ScanNetworks */ \
271 { 0x0031, 0x01, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* Network Commissioning (server): ScanNetworksResponse */ \
272 { 0x0031, 0x02, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Network Commissioning (server): AddWiFiNetwork */ \
273 { 0x0031, 0x03, ZAP_COMMAND_MASK(OUTGOING_SERVER) }, /* Network Commissioning (server): AddWiFiNetworkResponse */ \
274 { 0x0031, 0x04, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Network Commissioning (server): UpdateWiFiNetwork */ \
275 { 0x0031, 0x05, ZAP_COMMAND_MASK(OUTGOING_SERVER) }, /* Network Commissioning (server): UpdateWiFiNetworkResponse */ \
276 { 0x0031, 0x06, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Network Commissioning (server): AddThreadNetwork */ \
277 { 0x0031, 0x07, ZAP_COMMAND_MASK(OUTGOING_SERVER) }, /* Network Commissioning (server): AddThreadNetworkResponse */ \
278 { 0x0031, 0x08, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Network Commissioning (server): UpdateThreadNetwork */ \
279 { 0x0031, 0x09, ZAP_COMMAND_MASK(OUTGOING_SERVER) }, /* Network Commissioning (server): UpdateThreadNetworkResponse */ \
280 { 0x0031, 0x0A, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Network Commissioning (server): RemoveNetwork */ \
281 { 0x0031, 0x0B, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* Network Commissioning (server): RemoveNetworkResponse */ \
282 { 0x0031, 0x0C, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Network Commissioning (server): EnableNetwork */ \
283 { 0x0031, 0x0D, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* Network Commissioning (server): EnableNetworkResponse */ \
284 { 0x0031, 0x0E, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Network Commissioning (server): DisableNetwork */ \
285 { 0x0031, 0x0F, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* Network Commissioning (server): DisableNetworkResponse */ \
287 ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Network Commissioning (server): GetLastNetworkCommissioningResult */ \
290 // Array of EmberAfManufacturerCodeEntry structures for commands.
291 #define GENERATED_COMMAND_MANUFACTURER_CODE_COUNT (0)
292 #define GENERATED_COMMAND_MANUFACTURER_CODES \
299 // This is an array of EmberAfManufacturerCodeEntry structures for clusters.
300 #define GENERATED_CLUSTER_MANUFACTURER_CODE_COUNT (0)
301 #define GENERATED_CLUSTER_MANUFACTURER_CODES \
308 // This is an array of EmberAfManufacturerCodeEntry structures for attributes.
309 #define GENERATED_ATTRIBUTE_MANUFACTURER_CODE_COUNT (0)
310 #define GENERATED_ATTRIBUTE_MANUFACTURER_CODES \
317 // Array of EmberAfPluginReportingEntry structures.
318 #define ZRD(x) EMBER_ZCL_REPORTING_DIRECTION_##x
319 #define ZAP_REPORT_DIRECTION(x) ZRD(x)
321 // User options for plugin Reporting
322 #define EMBER_AF_PLUGIN_REPORTING_TABLE_SIZE (2)
323 #define EMBER_AF_PLUGIN_REPORTING_ENABLE_GROUP_BOUND_REPORTS
325 #define EMBER_AF_GENERATED_REPORTING_CONFIG_DEFAULTS_TABLE_SIZE (2)
326 #define EMBER_AF_GENERATED_REPORTING_CONFIG_DEFAULTS \
329 ZAP_REPORT_DIRECTION(REPORTED), 0x0001, 0x0006, 0x0000, ZAP_CLUSTER_MASK(SERVER), 0x0000, { { 0, 65344, 0 } } \
330 }, /* Reporting for cluster: "On/off", attribute: "on/off". side: server */ \
332 ZAP_REPORT_DIRECTION(REPORTED), 0x0001, 0x0008, 0x0000, ZAP_CLUSTER_MASK(SERVER), 0x0000, { { 0, 65344, 0 } } \
333 }, /* Reporting for cluster: "Level Control", attribute: "current level". side: server */ \