matc/clusters/codec/
refrigerator_alarm.rs

1//! Matter TLV encoders and decoders for Refrigerator Alarm Cluster
2//! Cluster ID: 0x0057
3//!
4//! This file is automatically generated from RefrigeratorAlarm.xml
5
6#![allow(clippy::too_many_arguments)]
7
8use anyhow;
9use serde_json;
10
11
12// Bitmap definitions
13
14/// Alarm bitmap type
15pub type Alarm = u8;
16
17/// Constants for Alarm
18pub mod alarm {
19    /// The cabinet's door has been open for a vendor defined amount of time.
20    pub const DOOR_OPEN: u8 = 0x01;
21}
22
23// Command encoders
24
25// Command listing
26
27pub fn get_command_list() -> Vec<(u32, &'static str)> {
28    vec![
29        (0x01, "ModifyEnabledAlarms"),
30    ]
31}
32
33pub fn get_command_name(cmd_id: u32) -> Option<&'static str> {
34    match cmd_id {
35        0x01 => Some("ModifyEnabledAlarms"),
36        _ => None,
37    }
38}
39
40pub fn get_command_schema(cmd_id: u32) -> Option<Vec<crate::clusters::codec::CommandField>> {
41    match cmd_id {
42        0x01 => Some(vec![]),
43        _ => None,
44    }
45}
46
47pub fn encode_command_json(cmd_id: u32, _args: &serde_json::Value) -> anyhow::Result<Vec<u8>> {
48    match cmd_id {
49        0x01 => Ok(vec![]),
50        _ => Err(anyhow::anyhow!("unknown command ID: 0x{:02X}", cmd_id)),
51    }
52}
53
54// Typed facade (invokes + reads)
55
56/// Invoke `ModifyEnabledAlarms` command on cluster `Refrigerator Alarm`.
57pub async fn modify_enabled_alarms(conn: &crate::controller::Connection, endpoint: u16) -> anyhow::Result<()> {
58    conn.invoke_request(endpoint, crate::clusters::defs::CLUSTER_ID_REFRIGERATOR_ALARM, crate::clusters::defs::CLUSTER_REFRIGERATOR_ALARM_CMD_ID_MODIFYENABLEDALARMS, &[]).await?;
59    Ok(())
60}
61