-
Notifications
You must be signed in to change notification settings - Fork 148
/
esp_matter_cluster.h
457 lines (377 loc) · 14.2 KB
/
esp_matter_cluster.h
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
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
// Copyright 2021 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma once
#include <esp_matter_core.h>
#include <esp_matter_feature.h>
#include <stdint.h>
namespace esp_matter {
namespace cluster {
/** Common cluster plugin init callback
*
* This is the common plugin init callback which calls the plugin init callbacks in the clusters.
*
* This common API has been added so that the specific APIs in zap-generated/PluginApplicationCallbacks.h can be
* removed.
*/
void plugin_init_callback_common();
/** Specific cluster create APIs
*
* These APIs also create the mandatory attributes and commands for the cluster. If the mandatory attribute is not
* managed internally, then a config is present for that attribute. The constructor for the config will set the
* attribute to the default value from the spec.
*
* If some standard cluster is not present here, it can be added.
* If a custom cluster needs to be created, the low level esp_matter::cluster::create() API can be used.
*/
namespace descriptor {
cluster_t *create(endpoint_t *endpoint, uint8_t flags);
} /* descriptor */
namespace actions {
cluster_t *create(endpoint_t *endpoint, uint8_t flags);
} /* actions */
namespace access_control {
cluster_t *create(endpoint_t *endpoint, uint8_t flags);
} /* access_control */
namespace basic_information {
typedef struct config {
uint16_t cluster_revision;
char node_label[32];
config() : cluster_revision(1), node_label{0} {}
} config_t;
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
} /* basic_information */
namespace binding {
typedef struct config {
uint16_t cluster_revision;
config() : cluster_revision(1) {}
} config_t;
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
} /* binding */
namespace ota_provider {
typedef struct config {
uint16_t cluster_revision;
config() : cluster_revision(1) {}
} config_t;
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
} /* ota_provider */
namespace ota_requestor {
typedef struct config {
uint16_t cluster_revision;
bool update_possible;
uint8_t update_state;
nullable<uint8_t> update_state_progress;
config() : cluster_revision(1), update_possible(1), update_state(0), update_state_progress(0) {}
} config_t;
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
} /* ota_requestor */
namespace general_commissioning {
typedef struct config {
uint16_t cluster_revision;
uint64_t breadcrumb;
config() : cluster_revision(1), breadcrumb(0) {}
} config_t;
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
} /* general_commissioning */
namespace network_commissioning {
typedef struct config {
uint16_t cluster_revision;
config() : cluster_revision(1) {}
} config_t;
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
} /* network_commissioning */
namespace general_diagnostics {
typedef struct config {
uint16_t cluster_revision;
config() : cluster_revision(1) {}
} config_t;
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
} /* general_diagnostics */
namespace administrator_commissioning {
typedef struct config {
uint16_t cluster_revision;
config() : cluster_revision(1) {}
} config_t;
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
} /* administrator_commissioning */
namespace operational_credentials {
typedef struct config {
uint16_t cluster_revision;
config() : cluster_revision(1) {}
} config_t;
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
} /* operational_credentials */
namespace group_key_management {
cluster_t *create(endpoint_t *endpoint, uint8_t flags);
} /* group_key_management */
namespace diagnostics_network_wifi {
typedef struct config {
uint16_t cluster_revision;
config() : cluster_revision(1) {}
} config_t;
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
} /* diagnostics_network_wifi */
namespace diagnostics_network_thread {
typedef struct config {
uint16_t cluster_revision;
config() : cluster_revision(1) {}
} config_t;
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
} /* diagnostics_network_thread */
namespace time_synchronization {
typedef struct config {
uint16_t cluster_revision;
config() : cluster_revision(1) {}
} config_t;
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
} /* time_synchronization */
namespace bridged_device_basic {
typedef struct config {
uint16_t cluster_revision;
bool reachable;
config() : cluster_revision(1), reachable(true) {}
} config_t;
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
} /* bridged_device_basic */
namespace user_label {
typedef struct config {
uint16_t cluster_revision;
config() : cluster_revision(1) {}
} config_t;
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
} /* user_label */
namespace fixed_label {
typedef struct config {
uint16_t cluster_revision;
config() : cluster_revision(1) {}
} config_t;
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
} /* fixed_label */
namespace identify {
typedef struct config {
uint16_t cluster_revision;
uint16_t identify_time;
uint8_t identify_type;
config() : cluster_revision(4), identify_time(0), identify_type(0) {}
} config_t;
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
} /* identify */
namespace groups {
typedef struct config {
uint16_t cluster_revision;
uint8_t group_name_support;
config() : cluster_revision(4), group_name_support(0) {}
} config_t;
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
} /* groups */
namespace scenes {
typedef struct config {
uint16_t cluster_revision;
uint8_t scene_count;
uint8_t current_scene;
uint16_t current_group;
bool scene_valid;
uint8_t scene_name_support;
config() : cluster_revision(4), scene_count(0), current_scene(0), current_group(0), scene_valid(false),
scene_name_support(0) {}
} config_t;
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
} /* scenes */
namespace on_off {
typedef struct config {
uint16_t cluster_revision;
bool on_off;
feature::lighting::config_t lighting;
config() : cluster_revision(4), on_off(false) {}
} config_t;
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags, uint32_t features);
} /* on_off */
namespace level_control {
typedef struct config {
uint16_t cluster_revision;
nullable<uint8_t> current_level;
nullable<uint8_t> on_level;
uint8_t options;
feature::lighting::config_t lighting;
config() : cluster_revision(5), current_level(0xFE), on_level(0xFE), options(0) {}
} config_t;
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags, uint32_t features);
} /* level_control */
namespace color_control {
typedef struct config {
uint16_t cluster_revision;
uint8_t color_mode;
uint8_t color_control_options;
uint8_t enhanced_color_mode;
uint16_t color_capabilities;
nullable<uint8_t> number_of_primaries;
feature::hue_saturation::config_t hue_saturation;
feature::color_temperature::config_t color_temperature;
feature::xy::config_t xy;
feature::enhanced_hue::config_t enhanced_hue;
feature::color_loop::config_t color_loop;
config() : cluster_revision(5), color_mode(1), color_control_options(0), enhanced_color_mode(1),
color_capabilities(0), number_of_primaries(0) {}
} config_t;
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags, uint32_t features);
} /* color_control */
namespace fan_control {
typedef struct config {
uint16_t cluster_revision;
uint8_t fan_mode;
uint8_t fan_mode_sequence;
nullable<uint8_t> percent_setting;
uint8_t percent_current;
config() : cluster_revision(2), fan_mode(0), fan_mode_sequence(2), percent_setting(0), percent_current(0) {}
} config_t;
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
} /* fan_control */
namespace thermostat {
typedef struct config {
uint16_t cluster_revision;
nullable<int16_t> local_temperature;
uint8_t control_sequence_of_operation;
uint8_t system_mode;
config() : cluster_revision(5), local_temperature(), control_sequence_of_operation(4), system_mode(1) {}
} config_t;
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
} /* thermostat */
namespace door_lock {
typedef struct config {
uint16_t cluster_revision;
nullable<uint8_t> lock_state;
uint8_t lock_type;
bool actuator_enabled;
uint8_t operating_mode;
uint16_t supported_operating_modes;
config() : cluster_revision(6), lock_state(0), lock_type(0), actuator_enabled(0), operating_mode(0), supported_operating_modes(0xFFF6) {}
} config_t;
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
} /* door_lock */
namespace window_covering {
typedef struct config {
uint16_t cluster_revision;
uint8_t type;
uint8_t config_status;
uint8_t operational_status;
const uint8_t end_product_type;
uint8_t mode;
feature::lift::config_t lift;
config() : cluster_revision(5), type(0), config_status(0), operational_status(0), end_product_type(0), mode(0) {}
} config_t;
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags, uint32_t features);
} /* window_covering */
namespace switch_cluster {
typedef struct config {
uint16_t cluster_revision;
uint8_t number_of_positions;
uint8_t current_position;
config() : cluster_revision(1), number_of_positions(2), current_position(0) {}
} config_t;
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
} /* switch_cluster */
namespace temperature_measurement {
typedef struct config {
uint16_t cluster_revision;
nullable<int16_t> measured_value;
nullable<int16_t> min_measured_value;
nullable<int16_t> max_measured_value;
config() : cluster_revision(4), measured_value(), min_measured_value(), max_measured_value() {}
} config_t;
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
} /* temperature_measurement */
namespace occupancy_sensing {
typedef struct config {
uint16_t cluster_revision;
uint8_t occupancy;
uint8_t occupancy_sensor_type;
uint8_t occupancy_sensor_type_bitmap;
config() : cluster_revision(3), occupancy(0), occupancy_sensor_type(0),
occupancy_sensor_type_bitmap(0) {}
} config_t;
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
} /* occupancy_sensing */
namespace boolean_state {
typedef struct config {
uint16_t cluster_revision;
bool state_value;
config() : cluster_revision(1), state_value(0) {}
} config_t;
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
} /* boolean_state */
namespace localization_configuration {
typedef struct config {
uint16_t cluster_revision;
char active_locale[35];
config() : cluster_revision(4), active_locale{0} {}
} config_t;
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
} /* localization_configuration_cluster */
namespace time_format_localization {
typedef struct config {
uint16_t cluster_revision;
nullable<uint8_t> hour_format;
feature::calendar_format::config_t calendar_format;
config() : cluster_revision(4), hour_format(0) {}
} config_t;
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags, uint32_t features);
} /* time_format_localization */
namespace illuminance_measurement {
typedef struct config {
uint16_t cluster_revision;
nullable<uint16_t> illuminance_measured_value;
nullable<uint16_t> illuminance_min_measured_value;
nullable<uint16_t> illuminance_max_measured_value;
config() : cluster_revision(3), illuminance_measured_value(0), illuminance_min_measured_value(1), illuminance_max_measured_value(2) {}
} config_t;
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
} /* illuminance_measurement */
namespace pressure_measurement {
typedef struct config {
uint16_t cluster_revision;
nullable<int16_t> pressure_measured_value;
nullable<int16_t> pressure_min_measured_value;
nullable<int16_t> pressure_max_measured_value;
config() : cluster_revision(3), pressure_measured_value(), pressure_min_measured_value(), pressure_max_measured_value() {}
} config_t;
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
} /* pressure_measurement */
namespace flow_measurement {
typedef struct config {
uint16_t cluster_revision;
nullable<uint16_t> flow_measured_value;
nullable<uint16_t> flow_min_measured_value;
nullable<uint16_t> flow_max_measured_value;
config() : cluster_revision(3), flow_measured_value(), flow_min_measured_value(), flow_max_measured_value() {}
} config_t;
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
} /* flow_measurement */
namespace pump_configuration_and_control {
typedef struct config {
uint16_t cluster_revision;
// Pump Information Attributes
const nullable<int16_t> max_pressure;
const nullable<uint16_t> max_speed;
const nullable<uint16_t> max_flow;
// Pump Dynamic Information Attributes
uint8_t effective_operation_mode;
uint8_t effective_control_mode;
nullable<int16_t> capacity;
// Pump Settings Attributes
uint8_t operation_mode;
config() : cluster_revision(3), max_pressure(), max_speed(), max_flow(), effective_operation_mode(0), effective_control_mode(0), capacity(), operation_mode(0) {}
} config_t;
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
} /* pump_configuration_and_control */
} /* cluster */
} /* esp_matter */