matc/clusters/codec/
mod.rs

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