matter-kit 0.3.0

Matter (CSA smart-home standard) protocol implementation in Rust: no_std, no-alloc, executor-agnostic
Documentation
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
458
459
460
461
462
// Generated by `cargo xtask` from the CSA data model 1.6. Do not edit.
//
// Every cluster the specification defines.
//
// Regenerate with `cargo xtask clusters --dm <checkout>/data_model/1.6`; `cargo xtask check`
// is the CI gate that keeps this file honest. The XML itself is not vendored here — it
// carries the CSA's own copyright notice and is not redistributable.

//! The Matter cluster library, generated from the CSA data model.
//!
//! One module per cluster. Each holds the cluster's identifiers, its feature bits,
//! its enumerations and bitmaps as Rust types, and a [`Cluster`](crate::dm::spec::Cluster)
//! carrying every element the specification defines with its conformance, access and
//! qualities.
//!
//! These are the specification's tables, not a device's configuration. What a device
//! serves is a [`ClusterDescriptor`](crate::dm::ClusterDescriptor), and
//! [`Cluster::validate`](crate::dm::spec::Cluster::validate) is what checks one
//! against the other — the drift that certification finds, found at home instead.

/// Access Control — cluster `0x001F`.
pub mod access_control;
/// Account Login — cluster `0x050E`.
pub mod account_login;
/// Actions — cluster `0x0025`.
pub mod actions;
/// Activated Carbon Filter Monitoring — cluster `0x0072`.
pub mod activated_carbon_filter_monitoring;
/// Administrator Commissioning — cluster `0x003C`.
pub mod administrator_commissioning;
/// Air Quality — cluster `0x005B`.
pub mod air_quality;
/// Alarm Base — an abstract base: the types the clusters derived from it share,
/// with no cluster id of its own.
pub mod alarm_base;
/// Ambient Context Sensing — cluster `0x0431`.
pub mod ambient_context_sensing;
/// Application Basic — cluster `0x050D`.
pub mod application_basic;
/// Application Launcher — cluster `0x050C`.
pub mod application_launcher;
/// Audio Output — cluster `0x050B`.
pub mod audio_output;
/// Basic Information — cluster `0x0028`.
pub mod basic_information;
/// Binding — cluster `0x001E`.
pub mod binding;
/// Boolean State — cluster `0x0045`.
pub mod boolean_state;
/// Boolean State Configuration — cluster `0x0080`.
pub mod boolean_state_configuration;
/// Bridged Device Basic Information — cluster `0x0039`.
pub mod bridged_device_basic_information;
/// Camera AV Settings User Level Management — cluster `0x0552`.
pub mod camera_av_settings_user_level_management;
/// Camera AV Stream Management — cluster `0x0551`.
pub mod camera_av_stream_management;
/// Carbon Dioxide Concentration Measurement — cluster `0x040D`.
pub mod carbon_dioxide_concentration_measurement;
/// Carbon Monoxide Concentration Measurement — cluster `0x040C`.
pub mod carbon_monoxide_concentration_measurement;
/// Channel — cluster `0x0504`.
pub mod channel;
/// Chime — cluster `0x0556`.
pub mod chime;
/// Closure Control — cluster `0x0104`.
pub mod closure_control;
/// Closure Dimension — cluster `0x0105`.
pub mod closure_dimension;
/// Color Control — cluster `0x0300`.
pub mod color_control;
/// Commissioner Control — cluster `0x0751`.
pub mod commissioner_control;
/// Commodity Metering — cluster `0x0B07`.
pub mod commodity_metering;
/// Commodity Price — cluster `0x0095`.
pub mod commodity_price;
/// Commodity Tariff — cluster `0x0700`.
pub mod commodity_tariff;
/// Content App Observer — cluster `0x0510`.
pub mod content_app_observer;
/// Content Control — cluster `0x050F`.
pub mod content_control;
/// Content Launcher — cluster `0x050A`.
pub mod content_launcher;
/// Descriptor — cluster `0x001D`.
pub mod descriptor;
/// Device Energy Management — cluster `0x0098`.
pub mod device_energy_management;
/// Device Energy Management Mode — cluster `0x009F`.
pub mod device_energy_management_mode;
/// Diagnostic Logs — cluster `0x0032`.
pub mod diagnostic_logs;
/// Dishwasher Alarm — cluster `0x005D`.
pub mod dishwasher_alarm;
/// Dishwasher Mode — cluster `0x0059`.
pub mod dishwasher_mode;
/// Door Lock — cluster `0x0101`.
pub mod door_lock;
/// Ecosystem Information — cluster `0x0750`.
pub mod ecosystem_information;
/// Electrical Energy Measurement — cluster `0x0091`.
pub mod electrical_energy_measurement;
/// Electrical Grid Conditions — cluster `0x00A0`.
pub mod electrical_grid_conditions;
/// Electrical Power Measurement — cluster `0x0090`.
pub mod electrical_power_measurement;
/// Energy EVSE — cluster `0x0099`.
pub mod energy_evse;
/// Energy EVSE Mode — cluster `0x009D`.
pub mod energy_evse_mode;
/// Energy Preference — cluster `0x009B`.
pub mod energy_preference;
/// Ethernet Network Diagnostics — cluster `0x0037`.
pub mod ethernet_network_diagnostics;
/// Fan Control — cluster `0x0202`.
pub mod fan_control;
/// Fixed Label — cluster `0x0040`.
pub mod fixed_label;
/// Flow Measurement — cluster `0x0404`.
pub mod flow_measurement;
/// Formaldehyde Concentration Measurement — cluster `0x042B`.
pub mod formaldehyde_concentration_measurement;
/// General Commissioning — cluster `0x0030`.
pub mod general_commissioning;
/// General Diagnostics — cluster `0x0033`.
pub mod general_diagnostics;
/// Globals — an abstract base: the types the clusters derived from it share,
/// with no cluster id of its own.
pub mod globals;
/// Group Key Management — cluster `0x003F`.
pub mod group_key_management;
/// Groupcast — cluster `0x0065`.
pub mod groupcast;
/// Groups — cluster `0x0004`.
pub mod groups;
/// HEPA Filter Monitoring — cluster `0x0071`.
pub mod hepa_filter_monitoring;
/// ICD Management — cluster `0x0046`.
pub mod icd_management;
/// Identify — cluster `0x0003`.
pub mod identify;
/// Illuminance Measurement — cluster `0x0400`.
pub mod illuminance_measurement;
/// Joint Fabric Administrator — cluster `0x0753`.
pub mod joint_fabric_administrator;
/// Joint Fabric Datastore — cluster `0x0752`.
pub mod joint_fabric_datastore;
/// Keypad Input — cluster `0x0509`.
pub mod keypad_input;
/// Label — an abstract base: the types the clusters derived from it share,
/// with no cluster id of its own.
pub mod label;
/// Laundry Dryer Controls — cluster `0x004A`.
pub mod laundry_dryer_controls;
/// Laundry Washer Controls — cluster `0x0053`.
pub mod laundry_washer_controls;
/// Laundry Washer Mode — cluster `0x0051`.
pub mod laundry_washer_mode;
/// Level Control — cluster `0x0008`.
pub mod level_control;
/// Localization Configuration — cluster `0x002B`.
pub mod localization_configuration;
/// Low Power — cluster `0x0508`.
pub mod low_power;
/// Media Input — cluster `0x0507`.
pub mod media_input;
/// Media Playback — cluster `0x0506`.
pub mod media_playback;
/// Messages — cluster `0x0097`.
pub mod messages;
/// Meter Identification — cluster `0x0B06`.
pub mod meter_identification;
/// Microwave Oven Control — cluster `0x005F`.
pub mod microwave_oven_control;
/// Microwave Oven Mode — cluster `0x005E`.
pub mod microwave_oven_mode;
/// Mode Base — an abstract base: the types the clusters derived from it share,
/// with no cluster id of its own.
pub mod mode_base;
/// Mode Select — cluster `0x0050`.
pub mod mode_select;
/// Network Commissioning — cluster `0x0031`.
pub mod network_commissioning;
/// Nitrogen Dioxide Concentration Measurement — cluster `0x0413`.
pub mod nitrogen_dioxide_concentration_measurement;
/// Occupancy Sensing — cluster `0x0406`.
pub mod occupancy_sensing;
/// On/Off — cluster `0x0006`.
pub mod on_off;
/// Operational Credentials — cluster `0x003E`.
pub mod operational_credentials;
/// Operational State — cluster `0x0060`.
pub mod operational_state;
/// OTA Software Update Provider — cluster `0x0029`.
pub mod ota_software_update_provider;
/// OTA Software Update Requestor — cluster `0x002A`.
pub mod ota_software_update_requestor;
/// Oven Cavity Operational State — cluster `0x0048`.
pub mod oven_cavity_operational_state;
/// Oven Mode — cluster `0x0049`.
pub mod oven_mode;
/// Ozone Concentration Measurement — cluster `0x0415`.
pub mod ozone_concentration_measurement;
/// PM10 Concentration Measurement — cluster `0x042D`.
pub mod pm10_concentration_measurement;
/// PM1 Concentration Measurement — cluster `0x042C`.
pub mod pm1_concentration_measurement;
/// PM2.5 Concentration Measurement — cluster `0x042A`.
pub mod pm2_5_concentration_measurement;
/// Power Source — cluster `0x002F`.
pub mod power_source;
/// Power Source Configuration — cluster `0x002E`.
pub mod power_source_configuration;
/// Power Topology — cluster `0x009C`.
pub mod power_topology;
/// Pressure Measurement — cluster `0x0403`.
pub mod pressure_measurement;
/// Pump Configuration and Control — cluster `0x0200`.
pub mod pump_configuration_and_control;
/// Push AV Stream Transport — cluster `0x0555`.
pub mod push_av_stream_transport;
/// Radon Concentration Measurement — cluster `0x042F`.
pub mod radon_concentration_measurement;
/// Refrigerator Alarm — cluster `0x0057`.
pub mod refrigerator_alarm;
/// Refrigerator And Temperature Controlled Cabinet Mode — cluster `0x0052`.
pub mod refrigerator_and_temperature_controlled_cabinet_mode;
/// Relative Humidity Measurement — cluster `0x0405`.
pub mod relative_humidity_measurement;
/// RVC Clean Mode — cluster `0x0055`.
pub mod rvc_clean_mode;
/// RVC Operational State — cluster `0x0061`.
pub mod rvc_operational_state;
/// RVC Run Mode — cluster `0x0054`.
pub mod rvc_run_mode;
/// Scenes Management — cluster `0x0062`.
pub mod scenes_management;
/// Service Area — cluster `0x0150`.
pub mod service_area;
/// Smoke CO Alarm — cluster `0x005C`.
pub mod smoke_co_alarm;
/// Software Diagnostics — cluster `0x0034`.
pub mod software_diagnostics;
/// Soil Measurement — cluster `0x0430`.
pub mod soil_measurement;
/// Switch — cluster `0x003B`.
pub mod switch;
/// Target Navigator — cluster `0x0505`.
pub mod target_navigator;
/// Temperature Alarm — cluster `0x0064`.
pub mod temperature_alarm;
/// Temperature Control — cluster `0x0056`.
pub mod temperature_control;
/// Temperature Measurement — cluster `0x0402`.
pub mod temperature_measurement;
/// Thermostat — cluster `0x0201`.
pub mod thermostat;
/// Thermostat User Interface Configuration — cluster `0x0204`.
pub mod thermostat_user_interface_configuration;
/// Thread Border Router Management — cluster `0x0452`.
pub mod thread_border_router_management;
/// Thread Network Diagnostics — cluster `0x0035`.
pub mod thread_network_diagnostics;
/// Thread Network Directory — cluster `0x0453`.
pub mod thread_network_directory;
/// Time Format Localization — cluster `0x002C`.
pub mod time_format_localization;
/// Time Synchronization — cluster `0x0038`.
pub mod time_synchronization;
/// TLS Certificate Management — cluster `0x0801`.
pub mod tls_certificate_management;
/// TLS Client Management — cluster `0x0802`.
pub mod tls_client_management;
/// Total Volatile Organic Compounds Concentration Measurement — cluster `0x042E`.
pub mod total_volatile_organic_compounds_concentration_measurement;
/// Unit Localization — cluster `0x002D`.
pub mod unit_localization;
/// User Label — cluster `0x0041`.
pub mod user_label;
/// Valve Configuration and Control — cluster `0x0081`.
pub mod valve_configuration_and_control;
/// Wake On LAN — cluster `0x0503`.
pub mod wake_on_lan;
/// Water Heater Management — cluster `0x0094`.
pub mod water_heater_management;
/// Water Heater Mode — cluster `0x009E`.
pub mod water_heater_mode;
/// Water Tank Level Monitoring — cluster `0x0079`.
pub mod water_tank_level_monitoring;
/// WebRTC Transport Provider — cluster `0x0553`.
pub mod web_rtc_transport_provider;
/// WebRTC Transport Requestor — cluster `0x0554`.
pub mod web_rtc_transport_requestor;
/// Wi-Fi Network Diagnostics — cluster `0x0036`.
pub mod wi_fi_network_diagnostics;
/// Wi-Fi Network Management — cluster `0x0451`.
pub mod wi_fi_network_management;
/// Window Covering — cluster `0x0102`.
pub mod window_covering;
/// Zone Management — cluster `0x0550`.
pub mod zone_management;

pub mod device_types;

/// Every cluster in the library, sorted by id.
///
/// **Referencing this links all of them.** Each table on its own is `const` data the
/// linker drops when nothing names it — one cluster costs about 8 KB of read-only
/// data, the whole library about 131 KB, measured on a release build. So a
/// controller or a conformance tool uses `ALL` and pays for it happily, and a device
/// names the handful of clusters it serves and pays for those.
///
/// [`crate::clusters::validate_endpoint`] reaches `ALL` through [`find`], which is
/// why it belongs in a device's *tests* rather than its start-up path.
pub const ALL: &[&crate::dm::spec::Cluster] = &[
    &identify::CLUSTER,
    &groups::CLUSTER,
    &on_off::CLUSTER,
    &level_control::CLUSTER,
    &descriptor::CLUSTER,
    &binding::CLUSTER,
    &access_control::CLUSTER,
    &actions::CLUSTER,
    &basic_information::CLUSTER,
    &ota_software_update_provider::CLUSTER,
    &ota_software_update_requestor::CLUSTER,
    &localization_configuration::CLUSTER,
    &time_format_localization::CLUSTER,
    &unit_localization::CLUSTER,
    &power_source_configuration::CLUSTER,
    &power_source::CLUSTER,
    &general_commissioning::CLUSTER,
    &network_commissioning::CLUSTER,
    &diagnostic_logs::CLUSTER,
    &general_diagnostics::CLUSTER,
    &software_diagnostics::CLUSTER,
    &thread_network_diagnostics::CLUSTER,
    &wi_fi_network_diagnostics::CLUSTER,
    &ethernet_network_diagnostics::CLUSTER,
    &time_synchronization::CLUSTER,
    &bridged_device_basic_information::CLUSTER,
    &switch::CLUSTER,
    &administrator_commissioning::CLUSTER,
    &operational_credentials::CLUSTER,
    &group_key_management::CLUSTER,
    &fixed_label::CLUSTER,
    &user_label::CLUSTER,
    &boolean_state::CLUSTER,
    &icd_management::CLUSTER,
    &oven_cavity_operational_state::CLUSTER,
    &oven_mode::CLUSTER,
    &laundry_dryer_controls::CLUSTER,
    &mode_select::CLUSTER,
    &laundry_washer_mode::CLUSTER,
    &refrigerator_and_temperature_controlled_cabinet_mode::CLUSTER,
    &laundry_washer_controls::CLUSTER,
    &rvc_run_mode::CLUSTER,
    &rvc_clean_mode::CLUSTER,
    &temperature_control::CLUSTER,
    &refrigerator_alarm::CLUSTER,
    &dishwasher_mode::CLUSTER,
    &air_quality::CLUSTER,
    &smoke_co_alarm::CLUSTER,
    &dishwasher_alarm::CLUSTER,
    &microwave_oven_mode::CLUSTER,
    &microwave_oven_control::CLUSTER,
    &operational_state::CLUSTER,
    &rvc_operational_state::CLUSTER,
    &scenes_management::CLUSTER,
    &temperature_alarm::CLUSTER,
    &groupcast::CLUSTER,
    &hepa_filter_monitoring::CLUSTER,
    &activated_carbon_filter_monitoring::CLUSTER,
    &water_tank_level_monitoring::CLUSTER,
    &boolean_state_configuration::CLUSTER,
    &valve_configuration_and_control::CLUSTER,
    &electrical_power_measurement::CLUSTER,
    &electrical_energy_measurement::CLUSTER,
    &water_heater_management::CLUSTER,
    &commodity_price::CLUSTER,
    &messages::CLUSTER,
    &device_energy_management::CLUSTER,
    &energy_evse::CLUSTER,
    &energy_preference::CLUSTER,
    &power_topology::CLUSTER,
    &energy_evse_mode::CLUSTER,
    &water_heater_mode::CLUSTER,
    &device_energy_management_mode::CLUSTER,
    &electrical_grid_conditions::CLUSTER,
    &door_lock::CLUSTER,
    &window_covering::CLUSTER,
    &closure_control::CLUSTER,
    &closure_dimension::CLUSTER,
    &service_area::CLUSTER,
    &pump_configuration_and_control::CLUSTER,
    &thermostat::CLUSTER,
    &fan_control::CLUSTER,
    &thermostat_user_interface_configuration::CLUSTER,
    &color_control::CLUSTER,
    &illuminance_measurement::CLUSTER,
    &temperature_measurement::CLUSTER,
    &pressure_measurement::CLUSTER,
    &flow_measurement::CLUSTER,
    &relative_humidity_measurement::CLUSTER,
    &occupancy_sensing::CLUSTER,
    &carbon_monoxide_concentration_measurement::CLUSTER,
    &carbon_dioxide_concentration_measurement::CLUSTER,
    &nitrogen_dioxide_concentration_measurement::CLUSTER,
    &ozone_concentration_measurement::CLUSTER,
    &pm2_5_concentration_measurement::CLUSTER,
    &formaldehyde_concentration_measurement::CLUSTER,
    &pm1_concentration_measurement::CLUSTER,
    &pm10_concentration_measurement::CLUSTER,
    &total_volatile_organic_compounds_concentration_measurement::CLUSTER,
    &radon_concentration_measurement::CLUSTER,
    &soil_measurement::CLUSTER,
    &ambient_context_sensing::CLUSTER,
    &wi_fi_network_management::CLUSTER,
    &thread_border_router_management::CLUSTER,
    &thread_network_directory::CLUSTER,
    &wake_on_lan::CLUSTER,
    &channel::CLUSTER,
    &target_navigator::CLUSTER,
    &media_playback::CLUSTER,
    &media_input::CLUSTER,
    &low_power::CLUSTER,
    &keypad_input::CLUSTER,
    &content_launcher::CLUSTER,
    &audio_output::CLUSTER,
    &application_launcher::CLUSTER,
    &application_basic::CLUSTER,
    &account_login::CLUSTER,
    &content_control::CLUSTER,
    &content_app_observer::CLUSTER,
    &zone_management::CLUSTER,
    &camera_av_stream_management::CLUSTER,
    &camera_av_settings_user_level_management::CLUSTER,
    &web_rtc_transport_provider::CLUSTER,
    &web_rtc_transport_requestor::CLUSTER,
    &push_av_stream_transport::CLUSTER,
    &chime::CLUSTER,
    &commodity_tariff::CLUSTER,
    &ecosystem_information::CLUSTER,
    &commissioner_control::CLUSTER,
    &joint_fabric_datastore::CLUSTER,
    &joint_fabric_administrator::CLUSTER,
    &tls_certificate_management::CLUSTER,
    &tls_client_management::CLUSTER,
    &meter_identification::CLUSTER,
    &commodity_metering::CLUSTER,
];

/// The specification's definition of a cluster, by id.
///
/// Linear over 135 entries, which is nothing next to what a caller does with
/// the answer — and a sorted binary search would be one `unsafe`-free `expect` away
/// from a table that is sorted by construction anyway.
#[must_use]
pub fn find(id: crate::im::ClusterId) -> Option<&'static crate::dm::spec::Cluster> {
    ALL.iter().copied().find(|cluster| cluster.id == id)
}