matc/clusters/codec/
mod.rs

1//! Matter cluster TLV encoders and decoders
2//! 
3//! This file is automatically generated.
4
5pub mod account_login;
6pub mod acl_cluster;
7pub mod actions_cluster;
8pub mod admin_commissioning_cluster;
9pub mod air_quality;
10pub mod alarm_base;
11pub mod application_basic;
12pub mod application_launcher;
13pub mod audio_output;
14pub mod basic_information_cluster;
15pub mod binding_cluster;
16pub mod boolean_state;
17pub mod boolean_state_configuration;
18pub mod bridged_device_basic_information_cluster;
19pub mod camera_av_settings_user_level_management;
20pub mod camera_av_stream_management;
21pub mod channel;
22pub mod chime;
23pub mod closure_control;
24pub mod closure_dimension;
25pub mod color_control;
26pub mod commissioner_control_cluster;
27pub mod commodity_metering;
28pub mod commodity_price;
29pub mod commodity_tariff;
30pub mod concentration_measurement;
31pub mod content_app_observer;
32pub mod content_control;
33pub mod content_launcher;
34pub mod descriptor_cluster;
35pub mod device_energy_management;
36pub mod diagnostic_logs_cluster;
37pub mod diagnostics_ethernet;
38pub mod diagnostics_general;
39pub mod diagnostics_software;
40pub mod diagnostics_thread;
41pub mod diagnostics_wifi;
42pub mod dishwasher_alarm;
43pub mod door_lock;
44pub mod ecosystem_information_cluster;
45pub mod electrical_energy_measurement;
46pub mod electrical_grid_conditions;
47pub mod electrical_power_measurement;
48pub mod energy_evse;
49pub mod energy_preference;
50pub mod fan_control;
51pub mod fixed_label_cluster;
52pub mod flow_measurement;
53pub mod general_commissioning_cluster;
54pub mod group_key_management_cluster;
55pub mod groups;
56pub mod icd_management;
57pub mod identify;
58pub mod illuminance_measurement;
59pub mod joint_fabric_administrator_cluster;
60pub mod joint_fabric_datastore_cluster;
61pub mod keypad_input;
62pub mod label_cluster;
63pub mod laundry_dryer_controls;
64pub mod laundry_washer_controls;
65pub mod level_control;
66pub mod localization_configuration;
67pub mod localization_time_format;
68pub mod localization_unit;
69pub mod low_power;
70pub mod media_input;
71pub mod media_playback;
72pub mod messages;
73pub mod meter_identification;
74pub mod microwave_oven_control;
75pub mod mode_base;
76pub mod mode_device_energy_management;
77pub mod mode_dishwasher;
78pub mod mode_evse;
79pub mod mode_laundry_washer;
80pub mod mode_microwave_oven;
81pub mod mode_oven;
82pub mod mode_refrigerator;
83pub mod mode_rvc_clean;
84pub mod mode_rvc_run;
85pub mod mode_select;
86pub mod mode_water_heater;
87pub mod network_commissioning_cluster;
88pub mod occupancy_sensing;
89pub mod on_off;
90pub mod operational_credential_cluster;
91pub mod operational_state;
92pub mod operational_state_oven;
93pub mod operational_state_rvc;
94pub mod ota_provider;
95pub mod ota_requestor;
96pub mod power_source_cluster;
97pub mod power_source_configuration_cluster;
98pub mod power_topology;
99pub mod pressure_measurement;
100pub mod pump_configuration_control;
101pub mod push_av_stream_transport;
102pub mod refrigerator_alarm;
103pub mod resource_monitoring;
104pub mod scenes;
105pub mod service_area;
106pub mod smoke_co_alarm;
107pub mod soil_measurement;
108pub mod switch;
109pub mod target_navigator;
110pub mod temperature_control;
111pub mod temperature_measurement;
112pub mod thermostat;
113pub mod thermostat_user_interface_configuration;
114pub mod thread_border_router_management;
115pub mod thread_network_directory;
116pub mod time_sync;
117pub mod tls_certificate_management;
118pub mod tls_client_management;
119pub mod user_label_cluster;
120pub mod valve_configuration_control;
121pub mod wake_on_lan;
122pub mod water_content_measurement;
123pub mod water_heater_management;
124pub mod web_rtc_provider;
125pub mod web_rtc_requestor;
126pub mod wifi_network_management;
127pub mod window_covering;
128pub mod zone_management;
129
130
131/// Main dispatcher function for decoding attributes to JSON
132///
133/// This function routes to the appropriate cluster-specific decoder based on cluster ID.
134///
135/// # Parameters
136/// * `cluster_id` - The cluster identifier
137/// * `attribute_id` - The attribute identifier
138/// * `tlv_value` - The TLV value to decode
139///
140/// # Returns
141/// JSON string representation of the decoded value or error message
142pub fn decode_attribute_json(cluster_id: u32, attribute_id: u32, tlv_value: &crate::tlv::TlvItemValue) -> String {
143    match cluster_id {
144        0x0000 => alarm_base::decode_attribute_json(cluster_id, attribute_id, tlv_value),
145        0x0003 => identify::decode_attribute_json(cluster_id, attribute_id, tlv_value),
146        0x0004 => groups::decode_attribute_json(cluster_id, attribute_id, tlv_value),
147        0x0006 => on_off::decode_attribute_json(cluster_id, attribute_id, tlv_value),
148        0x0008 => level_control::decode_attribute_json(cluster_id, attribute_id, tlv_value),
149        0x001D => descriptor_cluster::decode_attribute_json(cluster_id, attribute_id, tlv_value),
150        0x001E => binding_cluster::decode_attribute_json(cluster_id, attribute_id, tlv_value),
151        0x001F => acl_cluster::decode_attribute_json(cluster_id, attribute_id, tlv_value),
152        0x0025 => actions_cluster::decode_attribute_json(cluster_id, attribute_id, tlv_value),
153        0x0028 => basic_information_cluster::decode_attribute_json(cluster_id, attribute_id, tlv_value),
154        0x002A => ota_requestor::decode_attribute_json(cluster_id, attribute_id, tlv_value),
155        0x002B => localization_configuration::decode_attribute_json(cluster_id, attribute_id, tlv_value),
156        0x002C => localization_time_format::decode_attribute_json(cluster_id, attribute_id, tlv_value),
157        0x002D => localization_unit::decode_attribute_json(cluster_id, attribute_id, tlv_value),
158        0x002E => power_source_configuration_cluster::decode_attribute_json(cluster_id, attribute_id, tlv_value),
159        0x002F => power_source_cluster::decode_attribute_json(cluster_id, attribute_id, tlv_value),
160        0x0030 => general_commissioning_cluster::decode_attribute_json(cluster_id, attribute_id, tlv_value),
161        0x0031 => network_commissioning_cluster::decode_attribute_json(cluster_id, attribute_id, tlv_value),
162        0x0033 => diagnostics_general::decode_attribute_json(cluster_id, attribute_id, tlv_value),
163        0x0034 => diagnostics_software::decode_attribute_json(cluster_id, attribute_id, tlv_value),
164        0x0035 => diagnostics_thread::decode_attribute_json(cluster_id, attribute_id, tlv_value),
165        0x0036 => diagnostics_wifi::decode_attribute_json(cluster_id, attribute_id, tlv_value),
166        0x0037 => diagnostics_ethernet::decode_attribute_json(cluster_id, attribute_id, tlv_value),
167        0x0038 => time_sync::decode_attribute_json(cluster_id, attribute_id, tlv_value),
168        0x0039 => bridged_device_basic_information_cluster::decode_attribute_json(cluster_id, attribute_id, tlv_value),
169        0x003B => switch::decode_attribute_json(cluster_id, attribute_id, tlv_value),
170        0x003C => admin_commissioning_cluster::decode_attribute_json(cluster_id, attribute_id, tlv_value),
171        0x003E => operational_credential_cluster::decode_attribute_json(cluster_id, attribute_id, tlv_value),
172        0x003F => group_key_management_cluster::decode_attribute_json(cluster_id, attribute_id, tlv_value),
173        0x0040 => fixed_label_cluster::decode_attribute_json(cluster_id, attribute_id, tlv_value),
174        0x0041 => user_label_cluster::decode_attribute_json(cluster_id, attribute_id, tlv_value),
175        0x0045 => boolean_state::decode_attribute_json(cluster_id, attribute_id, tlv_value),
176        0x0046 => icd_management::decode_attribute_json(cluster_id, attribute_id, tlv_value),
177        0x0049 => mode_oven::decode_attribute_json(cluster_id, attribute_id, tlv_value),
178        0x004A => laundry_dryer_controls::decode_attribute_json(cluster_id, attribute_id, tlv_value),
179        0x0050 => mode_select::decode_attribute_json(cluster_id, attribute_id, tlv_value),
180        0x0051 => mode_laundry_washer::decode_attribute_json(cluster_id, attribute_id, tlv_value),
181        0x0052 => mode_refrigerator::decode_attribute_json(cluster_id, attribute_id, tlv_value),
182        0x0053 => laundry_washer_controls::decode_attribute_json(cluster_id, attribute_id, tlv_value),
183        0x0054 => mode_rvc_run::decode_attribute_json(cluster_id, attribute_id, tlv_value),
184        0x0055 => mode_rvc_clean::decode_attribute_json(cluster_id, attribute_id, tlv_value),
185        0x0056 => temperature_control::decode_attribute_json(cluster_id, attribute_id, tlv_value),
186        0x0059 => mode_dishwasher::decode_attribute_json(cluster_id, attribute_id, tlv_value),
187        0x005B => air_quality::decode_attribute_json(cluster_id, attribute_id, tlv_value),
188        0x005C => smoke_co_alarm::decode_attribute_json(cluster_id, attribute_id, tlv_value),
189        0x005E => mode_microwave_oven::decode_attribute_json(cluster_id, attribute_id, tlv_value),
190        0x005F => microwave_oven_control::decode_attribute_json(cluster_id, attribute_id, tlv_value),
191        0x0060 => operational_state::decode_attribute_json(cluster_id, attribute_id, tlv_value),
192        0x0062 => scenes::decode_attribute_json(cluster_id, attribute_id, tlv_value),
193        0x0080 => boolean_state_configuration::decode_attribute_json(cluster_id, attribute_id, tlv_value),
194        0x0081 => valve_configuration_control::decode_attribute_json(cluster_id, attribute_id, tlv_value),
195        0x0090 => electrical_power_measurement::decode_attribute_json(cluster_id, attribute_id, tlv_value),
196        0x0091 => electrical_energy_measurement::decode_attribute_json(cluster_id, attribute_id, tlv_value),
197        0x0094 => water_heater_management::decode_attribute_json(cluster_id, attribute_id, tlv_value),
198        0x0095 => commodity_price::decode_attribute_json(cluster_id, attribute_id, tlv_value),
199        0x0097 => messages::decode_attribute_json(cluster_id, attribute_id, tlv_value),
200        0x0098 => device_energy_management::decode_attribute_json(cluster_id, attribute_id, tlv_value),
201        0x0099 => energy_evse::decode_attribute_json(cluster_id, attribute_id, tlv_value),
202        0x009B => energy_preference::decode_attribute_json(cluster_id, attribute_id, tlv_value),
203        0x009C => power_topology::decode_attribute_json(cluster_id, attribute_id, tlv_value),
204        0x009D => mode_evse::decode_attribute_json(cluster_id, attribute_id, tlv_value),
205        0x009E => mode_water_heater::decode_attribute_json(cluster_id, attribute_id, tlv_value),
206        0x009F => mode_device_energy_management::decode_attribute_json(cluster_id, attribute_id, tlv_value),
207        0x00A0 => electrical_grid_conditions::decode_attribute_json(cluster_id, attribute_id, tlv_value),
208        0x0101 => door_lock::decode_attribute_json(cluster_id, attribute_id, tlv_value),
209        0x0102 => window_covering::decode_attribute_json(cluster_id, attribute_id, tlv_value),
210        0x0104 => closure_control::decode_attribute_json(cluster_id, attribute_id, tlv_value),
211        0x0105 => closure_dimension::decode_attribute_json(cluster_id, attribute_id, tlv_value),
212        0x0150 => service_area::decode_attribute_json(cluster_id, attribute_id, tlv_value),
213        0x0200 => pump_configuration_control::decode_attribute_json(cluster_id, attribute_id, tlv_value),
214        0x0201 => thermostat::decode_attribute_json(cluster_id, attribute_id, tlv_value),
215        0x0202 => fan_control::decode_attribute_json(cluster_id, attribute_id, tlv_value),
216        0x0204 => thermostat_user_interface_configuration::decode_attribute_json(cluster_id, attribute_id, tlv_value),
217        0x0300 => color_control::decode_attribute_json(cluster_id, attribute_id, tlv_value),
218        0x0400 => illuminance_measurement::decode_attribute_json(cluster_id, attribute_id, tlv_value),
219        0x0402 => temperature_measurement::decode_attribute_json(cluster_id, attribute_id, tlv_value),
220        0x0403 => pressure_measurement::decode_attribute_json(cluster_id, attribute_id, tlv_value),
221        0x0404 => flow_measurement::decode_attribute_json(cluster_id, attribute_id, tlv_value),
222        0x0406 => occupancy_sensing::decode_attribute_json(cluster_id, attribute_id, tlv_value),
223        0x0430 => soil_measurement::decode_attribute_json(cluster_id, attribute_id, tlv_value),
224        0x0451 => wifi_network_management::decode_attribute_json(cluster_id, attribute_id, tlv_value),
225        0x0452 => thread_border_router_management::decode_attribute_json(cluster_id, attribute_id, tlv_value),
226        0x0453 => thread_network_directory::decode_attribute_json(cluster_id, attribute_id, tlv_value),
227        0x0503 => wake_on_lan::decode_attribute_json(cluster_id, attribute_id, tlv_value),
228        0x0504 => channel::decode_attribute_json(cluster_id, attribute_id, tlv_value),
229        0x0505 => target_navigator::decode_attribute_json(cluster_id, attribute_id, tlv_value),
230        0x0506 => media_playback::decode_attribute_json(cluster_id, attribute_id, tlv_value),
231        0x0507 => media_input::decode_attribute_json(cluster_id, attribute_id, tlv_value),
232        0x050A => content_launcher::decode_attribute_json(cluster_id, attribute_id, tlv_value),
233        0x050B => audio_output::decode_attribute_json(cluster_id, attribute_id, tlv_value),
234        0x050C => application_launcher::decode_attribute_json(cluster_id, attribute_id, tlv_value),
235        0x050D => application_basic::decode_attribute_json(cluster_id, attribute_id, tlv_value),
236        0x050F => content_control::decode_attribute_json(cluster_id, attribute_id, tlv_value),
237        0x0550 => zone_management::decode_attribute_json(cluster_id, attribute_id, tlv_value),
238        0x0551 => camera_av_stream_management::decode_attribute_json(cluster_id, attribute_id, tlv_value),
239        0x0552 => camera_av_settings_user_level_management::decode_attribute_json(cluster_id, attribute_id, tlv_value),
240        0x0553 => web_rtc_provider::decode_attribute_json(cluster_id, attribute_id, tlv_value),
241        0x0554 => web_rtc_requestor::decode_attribute_json(cluster_id, attribute_id, tlv_value),
242        0x0555 => push_av_stream_transport::decode_attribute_json(cluster_id, attribute_id, tlv_value),
243        0x0556 => chime::decode_attribute_json(cluster_id, attribute_id, tlv_value),
244        0x0700 => commodity_tariff::decode_attribute_json(cluster_id, attribute_id, tlv_value),
245        0x0750 => ecosystem_information_cluster::decode_attribute_json(cluster_id, attribute_id, tlv_value),
246        0x0751 => commissioner_control_cluster::decode_attribute_json(cluster_id, attribute_id, tlv_value),
247        0x0752 => joint_fabric_datastore_cluster::decode_attribute_json(cluster_id, attribute_id, tlv_value),
248        0x0753 => joint_fabric_administrator_cluster::decode_attribute_json(cluster_id, attribute_id, tlv_value),
249        0x0801 => tls_certificate_management::decode_attribute_json(cluster_id, attribute_id, tlv_value),
250        0x0802 => tls_client_management::decode_attribute_json(cluster_id, attribute_id, tlv_value),
251        0x0B06 => meter_identification::decode_attribute_json(cluster_id, attribute_id, tlv_value),
252        0x0B07 => commodity_metering::decode_attribute_json(cluster_id, attribute_id, tlv_value),
253        _ => format!("{{\"error\": \"Unsupported cluster ID: {}\"}}", cluster_id),
254    }
255}
256
257
258/// Main dispatcher function for getting attribute lists
259///
260/// This function routes to the appropriate cluster-specific attribute list based on cluster ID.
261///
262/// # Parameters
263/// * `cluster_id` - The cluster identifier
264///
265/// # Returns
266/// Vector of tuples containing (attribute_id, attribute_name) or empty vector if unsupported
267pub fn get_attribute_list(cluster_id: u32) -> Vec<(u32, &'static str)> {
268    match cluster_id {
269        0x0000 => alarm_base::get_attribute_list(),
270        0x0003 => identify::get_attribute_list(),
271        0x0004 => groups::get_attribute_list(),
272        0x0006 => on_off::get_attribute_list(),
273        0x0008 => level_control::get_attribute_list(),
274        0x001D => descriptor_cluster::get_attribute_list(),
275        0x001E => binding_cluster::get_attribute_list(),
276        0x001F => acl_cluster::get_attribute_list(),
277        0x0025 => actions_cluster::get_attribute_list(),
278        0x0028 => basic_information_cluster::get_attribute_list(),
279        0x002A => ota_requestor::get_attribute_list(),
280        0x002B => localization_configuration::get_attribute_list(),
281        0x002C => localization_time_format::get_attribute_list(),
282        0x002D => localization_unit::get_attribute_list(),
283        0x002E => power_source_configuration_cluster::get_attribute_list(),
284        0x002F => power_source_cluster::get_attribute_list(),
285        0x0030 => general_commissioning_cluster::get_attribute_list(),
286        0x0031 => network_commissioning_cluster::get_attribute_list(),
287        0x0033 => diagnostics_general::get_attribute_list(),
288        0x0034 => diagnostics_software::get_attribute_list(),
289        0x0035 => diagnostics_thread::get_attribute_list(),
290        0x0036 => diagnostics_wifi::get_attribute_list(),
291        0x0037 => diagnostics_ethernet::get_attribute_list(),
292        0x0038 => time_sync::get_attribute_list(),
293        0x0039 => bridged_device_basic_information_cluster::get_attribute_list(),
294        0x003B => switch::get_attribute_list(),
295        0x003C => admin_commissioning_cluster::get_attribute_list(),
296        0x003E => operational_credential_cluster::get_attribute_list(),
297        0x003F => group_key_management_cluster::get_attribute_list(),
298        0x0040 => fixed_label_cluster::get_attribute_list(),
299        0x0041 => user_label_cluster::get_attribute_list(),
300        0x0045 => boolean_state::get_attribute_list(),
301        0x0046 => icd_management::get_attribute_list(),
302        0x0049 => mode_oven::get_attribute_list(),
303        0x004A => laundry_dryer_controls::get_attribute_list(),
304        0x0050 => mode_select::get_attribute_list(),
305        0x0051 => mode_laundry_washer::get_attribute_list(),
306        0x0052 => mode_refrigerator::get_attribute_list(),
307        0x0053 => laundry_washer_controls::get_attribute_list(),
308        0x0054 => mode_rvc_run::get_attribute_list(),
309        0x0055 => mode_rvc_clean::get_attribute_list(),
310        0x0056 => temperature_control::get_attribute_list(),
311        0x0059 => mode_dishwasher::get_attribute_list(),
312        0x005B => air_quality::get_attribute_list(),
313        0x005C => smoke_co_alarm::get_attribute_list(),
314        0x005E => mode_microwave_oven::get_attribute_list(),
315        0x005F => microwave_oven_control::get_attribute_list(),
316        0x0060 => operational_state::get_attribute_list(),
317        0x0062 => scenes::get_attribute_list(),
318        0x0080 => boolean_state_configuration::get_attribute_list(),
319        0x0081 => valve_configuration_control::get_attribute_list(),
320        0x0090 => electrical_power_measurement::get_attribute_list(),
321        0x0091 => electrical_energy_measurement::get_attribute_list(),
322        0x0094 => water_heater_management::get_attribute_list(),
323        0x0095 => commodity_price::get_attribute_list(),
324        0x0097 => messages::get_attribute_list(),
325        0x0098 => device_energy_management::get_attribute_list(),
326        0x0099 => energy_evse::get_attribute_list(),
327        0x009B => energy_preference::get_attribute_list(),
328        0x009C => power_topology::get_attribute_list(),
329        0x009D => mode_evse::get_attribute_list(),
330        0x009E => mode_water_heater::get_attribute_list(),
331        0x009F => mode_device_energy_management::get_attribute_list(),
332        0x00A0 => electrical_grid_conditions::get_attribute_list(),
333        0x0101 => door_lock::get_attribute_list(),
334        0x0102 => window_covering::get_attribute_list(),
335        0x0104 => closure_control::get_attribute_list(),
336        0x0105 => closure_dimension::get_attribute_list(),
337        0x0150 => service_area::get_attribute_list(),
338        0x0200 => pump_configuration_control::get_attribute_list(),
339        0x0201 => thermostat::get_attribute_list(),
340        0x0202 => fan_control::get_attribute_list(),
341        0x0204 => thermostat_user_interface_configuration::get_attribute_list(),
342        0x0300 => color_control::get_attribute_list(),
343        0x0400 => illuminance_measurement::get_attribute_list(),
344        0x0402 => temperature_measurement::get_attribute_list(),
345        0x0403 => pressure_measurement::get_attribute_list(),
346        0x0404 => flow_measurement::get_attribute_list(),
347        0x0406 => occupancy_sensing::get_attribute_list(),
348        0x0430 => soil_measurement::get_attribute_list(),
349        0x0451 => wifi_network_management::get_attribute_list(),
350        0x0452 => thread_border_router_management::get_attribute_list(),
351        0x0453 => thread_network_directory::get_attribute_list(),
352        0x0503 => wake_on_lan::get_attribute_list(),
353        0x0504 => channel::get_attribute_list(),
354        0x0505 => target_navigator::get_attribute_list(),
355        0x0506 => media_playback::get_attribute_list(),
356        0x0507 => media_input::get_attribute_list(),
357        0x050A => content_launcher::get_attribute_list(),
358        0x050B => audio_output::get_attribute_list(),
359        0x050C => application_launcher::get_attribute_list(),
360        0x050D => application_basic::get_attribute_list(),
361        0x050F => content_control::get_attribute_list(),
362        0x0550 => zone_management::get_attribute_list(),
363        0x0551 => camera_av_stream_management::get_attribute_list(),
364        0x0552 => camera_av_settings_user_level_management::get_attribute_list(),
365        0x0553 => web_rtc_provider::get_attribute_list(),
366        0x0554 => web_rtc_requestor::get_attribute_list(),
367        0x0555 => push_av_stream_transport::get_attribute_list(),
368        0x0556 => chime::get_attribute_list(),
369        0x0700 => commodity_tariff::get_attribute_list(),
370        0x0750 => ecosystem_information_cluster::get_attribute_list(),
371        0x0751 => commissioner_control_cluster::get_attribute_list(),
372        0x0752 => joint_fabric_datastore_cluster::get_attribute_list(),
373        0x0753 => joint_fabric_administrator_cluster::get_attribute_list(),
374        0x0801 => tls_certificate_management::get_attribute_list(),
375        0x0802 => tls_client_management::get_attribute_list(),
376        0x0B06 => meter_identification::get_attribute_list(),
377        0x0B07 => commodity_metering::get_attribute_list(),
378        _ => vec![],
379    }
380}