matc/clusters/codec/operational_state_rvc.rs
1//! Matter TLV encoders and decoders for RVC Operational State Cluster
2//! Cluster ID: 0x0061
3//!
4//! This file is automatically generated from OperationalState_RVC.xml
5
6
7
8// Enum definitions
9
10#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
11#[repr(u8)]
12pub enum ErrorState {
13 /// The device is not in an error state
14 Noerror = 0,
15 /// The device is unable to start or resume operation
16 Unabletostartorresume = 1,
17 /// The device was unable to complete the current operation
18 Unabletocompleteoperation = 2,
19 /// The device cannot process the command in its current state
20 Commandinvalidinstate = 3,
21 /// The device has failed to find or reach the charging dock
22 Failedtofindchargingdock = 64,
23 /// The device is stuck and requires manual intervention
24 Stuck = 65,
25 /// The device has detected that its dust bin is missing
26 Dustbinmissing = 66,
27 /// The device has detected that its dust bin is full
28 Dustbinfull = 67,
29 /// The device has detected that its clean water tank is empty
30 Watertankempty = 68,
31 /// The device has detected that its clean water tank is missing
32 Watertankmissing = 69,
33 /// The device has detected that its water tank lid is open
34 Watertanklidopen = 70,
35 /// The device has detected that its cleaning pad is missing
36 Mopcleaningpadmissing = 71,
37 /// The device is unable to start or to continue operating due to a low battery
38 Lowbattery = 72,
39 /// The device is unable to move to an area where it was asked to operate, such as by setting the ServiceArea cluster's SelectedAreas attribute, due to an obstruction. For example, the obstruction might be a closed door or objects blocking the mapped path.
40 Cannotreachtargetarea = 73,
41 /// The device has detected that its dirty water tank is full
42 Dirtywatertankfull = 74,
43 /// The device has detected that its dirty water tank is missing
44 Dirtywatertankmissing = 75,
45 /// The device has detected that one or more wheels are jammed by an object
46 Wheelsjammed = 76,
47 /// The device has detected that its brush is jammed by an object
48 Brushjammed = 77,
49 /// The device has detected that one of its sensors, such as LiDAR, infrared, or camera is obscured and needs to be cleaned
50 Navigationsensorobscured = 78,
51}
52
53impl ErrorState {
54 /// Convert from u8 value
55 pub fn from_u8(value: u8) -> Option<Self> {
56 match value {
57 0 => Some(ErrorState::Noerror),
58 1 => Some(ErrorState::Unabletostartorresume),
59 2 => Some(ErrorState::Unabletocompleteoperation),
60 3 => Some(ErrorState::Commandinvalidinstate),
61 64 => Some(ErrorState::Failedtofindchargingdock),
62 65 => Some(ErrorState::Stuck),
63 66 => Some(ErrorState::Dustbinmissing),
64 67 => Some(ErrorState::Dustbinfull),
65 68 => Some(ErrorState::Watertankempty),
66 69 => Some(ErrorState::Watertankmissing),
67 70 => Some(ErrorState::Watertanklidopen),
68 71 => Some(ErrorState::Mopcleaningpadmissing),
69 72 => Some(ErrorState::Lowbattery),
70 73 => Some(ErrorState::Cannotreachtargetarea),
71 74 => Some(ErrorState::Dirtywatertankfull),
72 75 => Some(ErrorState::Dirtywatertankmissing),
73 76 => Some(ErrorState::Wheelsjammed),
74 77 => Some(ErrorState::Brushjammed),
75 78 => Some(ErrorState::Navigationsensorobscured),
76 _ => None,
77 }
78 }
79
80 /// Convert to u8 value
81 pub fn to_u8(self) -> u8 {
82 self as u8
83 }
84}
85
86impl From<ErrorState> for u8 {
87 fn from(val: ErrorState) -> Self {
88 val as u8
89 }
90}
91
92#[derive(Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
93#[repr(u8)]
94pub enum OperationalState {
95 /// The device is stopped
96 Stopped = 0,
97 /// The device is operating
98 Running = 1,
99 /// The device is paused during an operation
100 Paused = 2,
101 /// The device is in an error state
102 Error = 3,
103 /// The device is en route to the charging dock
104 Seekingcharger = 64,
105 /// The device is charging
106 Charging = 65,
107 /// The device is on the dock, not charging
108 Docked = 66,
109 /// The device is automatically emptying its own dust bin, such as to a dock
110 Emptyingdustbin = 67,
111 /// The device is automatically cleaning its own mopping device, such as on a dock
112 Cleaningmop = 68,
113 /// The device is automatically filling its own clean water tank for use when mopping, such as from a dock
114 Fillingwatertank = 69,
115 /// The device is processing acquired data to update its maps
116 Updatingmaps = 70,
117}
118
119impl OperationalState {
120 /// Convert from u8 value
121 pub fn from_u8(value: u8) -> Option<Self> {
122 match value {
123 0 => Some(OperationalState::Stopped),
124 1 => Some(OperationalState::Running),
125 2 => Some(OperationalState::Paused),
126 3 => Some(OperationalState::Error),
127 64 => Some(OperationalState::Seekingcharger),
128 65 => Some(OperationalState::Charging),
129 66 => Some(OperationalState::Docked),
130 67 => Some(OperationalState::Emptyingdustbin),
131 68 => Some(OperationalState::Cleaningmop),
132 69 => Some(OperationalState::Fillingwatertank),
133 70 => Some(OperationalState::Updatingmaps),
134 _ => None,
135 }
136 }
137
138 /// Convert to u8 value
139 pub fn to_u8(self) -> u8 {
140 self as u8
141 }
142}
143
144impl From<OperationalState> for u8 {
145 fn from(val: OperationalState) -> Self {
146 val as u8
147 }
148}
149
150// Command encoders
151