matc/clusters/codec/
operational_state_oven.rs

1//! Matter TLV encoders and decoders for Oven Cavity Operational State Cluster
2//! Cluster ID: 0x0048
3//!
4//! This file is automatically generated from OperationalState_Oven.xml
5
6#![allow(clippy::too_many_arguments)]
7
8use anyhow;
9use serde_json;
10
11
12// Command encoders
13
14// Command listing
15
16pub fn get_command_list() -> Vec<(u32, &'static str)> {
17    vec![
18        (0x00, "Pause"),
19        (0x01, "Stop"),
20        (0x02, "Start"),
21        (0x03, "Resume"),
22        (0x04, "OperationalCommandResponse"),
23    ]
24}
25
26pub fn get_command_name(cmd_id: u32) -> Option<&'static str> {
27    match cmd_id {
28        0x00 => Some("Pause"),
29        0x01 => Some("Stop"),
30        0x02 => Some("Start"),
31        0x03 => Some("Resume"),
32        0x04 => Some("OperationalCommandResponse"),
33        _ => None,
34    }
35}
36
37pub fn get_command_schema(cmd_id: u32) -> Option<Vec<crate::clusters::codec::CommandField>> {
38    match cmd_id {
39        0x00 => Some(vec![]),
40        0x01 => Some(vec![]),
41        0x02 => Some(vec![]),
42        0x03 => Some(vec![]),
43        0x04 => Some(vec![]),
44        _ => None,
45    }
46}
47
48pub fn encode_command_json(cmd_id: u32, _args: &serde_json::Value) -> anyhow::Result<Vec<u8>> {
49    match cmd_id {
50        0x00 => Ok(vec![]),
51        0x01 => Ok(vec![]),
52        0x02 => Ok(vec![]),
53        0x03 => Ok(vec![]),
54        0x04 => Ok(vec![]),
55        _ => Err(anyhow::anyhow!("unknown command ID: 0x{:02X}", cmd_id)),
56    }
57}
58
59// Typed facade (invokes + reads)
60
61/// Invoke `Pause` command on cluster `Oven Cavity Operational State`.
62pub async fn pause(conn: &crate::controller::Connection, endpoint: u16) -> anyhow::Result<()> {
63    conn.invoke_request(endpoint, crate::clusters::defs::CLUSTER_ID_OVEN_CAVITY_OPERATIONAL_STATE, crate::clusters::defs::CLUSTER_OVEN_CAVITY_OPERATIONAL_STATE_CMD_ID_PAUSE, &[]).await?;
64    Ok(())
65}
66
67/// Invoke `Stop` command on cluster `Oven Cavity Operational State`.
68pub async fn stop(conn: &crate::controller::Connection, endpoint: u16) -> anyhow::Result<()> {
69    conn.invoke_request(endpoint, crate::clusters::defs::CLUSTER_ID_OVEN_CAVITY_OPERATIONAL_STATE, crate::clusters::defs::CLUSTER_OVEN_CAVITY_OPERATIONAL_STATE_CMD_ID_STOP, &[]).await?;
70    Ok(())
71}
72
73/// Invoke `Start` command on cluster `Oven Cavity Operational State`.
74pub async fn start(conn: &crate::controller::Connection, endpoint: u16) -> anyhow::Result<()> {
75    conn.invoke_request(endpoint, crate::clusters::defs::CLUSTER_ID_OVEN_CAVITY_OPERATIONAL_STATE, crate::clusters::defs::CLUSTER_OVEN_CAVITY_OPERATIONAL_STATE_CMD_ID_START, &[]).await?;
76    Ok(())
77}
78
79/// Invoke `Resume` command on cluster `Oven Cavity Operational State`.
80pub async fn resume(conn: &crate::controller::Connection, endpoint: u16) -> anyhow::Result<()> {
81    conn.invoke_request(endpoint, crate::clusters::defs::CLUSTER_ID_OVEN_CAVITY_OPERATIONAL_STATE, crate::clusters::defs::CLUSTER_OVEN_CAVITY_OPERATIONAL_STATE_CMD_ID_RESUME, &[]).await?;
82    Ok(())
83}
84
85/// Invoke `OperationalCommandResponse` command on cluster `Oven Cavity Operational State`.
86pub async fn operational_command_response(conn: &crate::controller::Connection, endpoint: u16) -> anyhow::Result<()> {
87    conn.invoke_request(endpoint, crate::clusters::defs::CLUSTER_ID_OVEN_CAVITY_OPERATIONAL_STATE, crate::clusters::defs::CLUSTER_OVEN_CAVITY_OPERATIONAL_STATE_CMD_ID_OPERATIONALCOMMANDRESPONSE, &[]).await?;
88    Ok(())
89}
90