1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
// Generated by `cargo xtask` from the CSA data model 1.6. Do not edit.
//
// RVC Operational State — cluster 0x0061.
//
// Regenerate with `cargo xtask clusters --dm <checkout>/data_model/1.6`; `cargo xtask check`
// is the CI gate that keeps this file honest. The XML itself is not vendored here — it
// carries the CSA's own copyright notice and is not redistributable.
//! RVC Operational State (cluster `0x0061`, revision 3).
//!
//! 6 identifiers, 0 feature bits, and the specification's own conformance for
//! every element. `CLUSTER` is the whole table.
#![allow(unused_imports)]
use crate::dm::conformance::{Clause, Condition, Conform, Conformance};
use crate::dm::meta::{EventPriority, Reporting};
use crate::dm::spec::{Attribute, Cluster, Command, Event, Feature};
use crate::dm::{Access, AccessQualities, AttributeQualities, Privilege};
use crate::error::Result;
use crate::im::{AttributeId, ClusterId, CommandId, EventId};
use crate::tlv::{
ContainerKind, Element, FromTlv, Nullable, Tag, TlvList, TlvReader, TlvWriter, ToTlv, Value,
};
/// The cluster id.
pub const ID: ClusterId = 0x0061;
/// The highest revision the specification's history defines — what `ClusterRevision`
/// must report (Core §7.13.1).
pub const REVISION: u16 = 3;
/// The PICS code, which a certification declaration names the cluster by.
pub const PICS: &str = "RVCOPSTATE";
/// This cluster defines no features, so its `FeatureMap` is always zero.
pub const FEATURES: &[Feature] = &[];
/// The command ids.
pub mod command {
use crate::im::CommandId;
/// `Pause`.
pub const PAUSE: CommandId = 0x00;
/// `Stop`.
pub const STOP: CommandId = 0x01;
/// `Start`.
pub const START: CommandId = 0x02;
/// `Resume`.
pub const RESUME: CommandId = 0x03;
/// `OperationalCommandResponse`.
pub const OPERATIONAL_COMMAND_RESPONSE: CommandId = 0x04;
/// `GoHome`.
pub const GO_HOME: CommandId = 0x80;
}
/// `ErrorStateEnum`.
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[repr(u8)]
pub enum ErrorStateEnum {
/// The device is not in an error state
NoError = 0,
/// The device is unable to start or resume operation
UnableToStartOrResume = 1,
/// The device was unable to complete the current operation
UnableToCompleteOperation = 2,
/// The device cannot process the command in its current state
CommandInvalidInState = 3,
/// The device has failed to find or reach the charging dock
FailedToFindChargingDock = 64,
/// The device is stuck and requires manual intervention
Stuck = 65,
/// The device has detected that its dust bin is missing
DustBinMissing = 66,
/// The device has detected that its dust bin is full
DustBinFull = 67,
/// The device has detected that its clean water tank is empty
WaterTankEmpty = 68,
/// The device has detected that its clean water tank is missing
WaterTankMissing = 69,
/// The device has detected that its water tank lid is open
WaterTankLidOpen = 70,
/// The device has detected that its cleaning pad is missing
MopCleaningPadMissing = 71,
/// The device is unable to start or to continue operating due to a low battery
LowBattery = 72,
/// 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.
CannotReachTargetArea = 73,
/// The device has detected that its dirty water tank is full
DirtyWaterTankFull = 74,
/// The device has detected that its dirty water tank is missing
DirtyWaterTankMissing = 75,
/// The device has detected that one or more wheels are jammed by an object
WheelsJammed = 76,
/// The device has detected that its brush is jammed by an object
BrushJammed = 77,
/// The device has detected that one of its sensors, such as LiDAR, infrared, or camera is obscured and needs to be cleaned
NavigationSensorObscured = 78,
}
impl ErrorStateEnum {
/// Reads a wire value, or `None` for one this revision does not define.
#[must_use]
pub const fn from_value(value: u8) -> Option<Self> {
match value {
0 => Some(Self::NoError),
1 => Some(Self::UnableToStartOrResume),
2 => Some(Self::UnableToCompleteOperation),
3 => Some(Self::CommandInvalidInState),
64 => Some(Self::FailedToFindChargingDock),
65 => Some(Self::Stuck),
66 => Some(Self::DustBinMissing),
67 => Some(Self::DustBinFull),
68 => Some(Self::WaterTankEmpty),
69 => Some(Self::WaterTankMissing),
70 => Some(Self::WaterTankLidOpen),
71 => Some(Self::MopCleaningPadMissing),
72 => Some(Self::LowBattery),
73 => Some(Self::CannotReachTargetArea),
74 => Some(Self::DirtyWaterTankFull),
75 => Some(Self::DirtyWaterTankMissing),
76 => Some(Self::WheelsJammed),
77 => Some(Self::BrushJammed),
78 => Some(Self::NavigationSensorObscured),
_ => None,
}
}
/// Its wire value.
#[must_use]
pub const fn value(self) -> u8 {
self as u8
}
}
impl ToTlv for ErrorStateEnum {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
self.value().to_tlv(w, tag)
}
}
impl<'a> FromTlv<'a> for ErrorStateEnum {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
let value = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
Self::from_value(value).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
}
}
/// `OperationalStateEnum`.
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[repr(u8)]
pub enum OperationalStateEnum {
/// The device is stopped
Stopped = 0,
/// The device is operating
Running = 1,
/// The device is paused during an operation
Paused = 2,
/// The device is in an error state
Error = 3,
/// The device is en route to the charging dock
SeekingCharger = 64,
/// The device is charging
Charging = 65,
/// The device is on the dock, not charging
Docked = 66,
/// The device is automatically emptying its own dust bin, such as to a dock
EmptyingDustBin = 67,
/// The device is automatically cleaning its own mopping device, such as on a dock
CleaningMop = 68,
/// The device is automatically filling its own clean water tank for use when mopping, such as from a dock
FillingWaterTank = 69,
/// The device is processing acquired data to update its maps
UpdatingMaps = 70,
}
impl OperationalStateEnum {
/// Reads a wire value, or `None` for one this revision does not define.
#[must_use]
pub const fn from_value(value: u8) -> Option<Self> {
match value {
0 => Some(Self::Stopped),
1 => Some(Self::Running),
2 => Some(Self::Paused),
3 => Some(Self::Error),
64 => Some(Self::SeekingCharger),
65 => Some(Self::Charging),
66 => Some(Self::Docked),
67 => Some(Self::EmptyingDustBin),
68 => Some(Self::CleaningMop),
69 => Some(Self::FillingWaterTank),
70 => Some(Self::UpdatingMaps),
_ => None,
}
}
/// Its wire value.
#[must_use]
pub const fn value(self) -> u8 {
self as u8
}
}
impl ToTlv for OperationalStateEnum {
fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
self.value().to_tlv(w, tag)
}
}
impl<'a> FromTlv<'a> for OperationalStateEnum {
fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
let value = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
Self::from_value(value).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
}
}
/// Every attribute the specification defines, with its conformance.
pub const ATTRIBUTES: &[Attribute] = &[];
/// Every command, with its conformance.
pub const COMMANDS: &[Command] = &[
Command {
id: 0x00,
name: "Pause",
to_server: true,
response: None,
access: Access::invoke(Privilege::Operate),
conform: Conform::MANDATORY,
},
Command {
id: 0x01,
name: "Stop",
to_server: true,
response: None,
access: Access::invoke(Privilege::Operate),
conform: Conform::DISALLOWED,
},
Command {
id: 0x02,
name: "Start",
to_server: true,
response: None,
access: Access::invoke(Privilege::Operate),
conform: Conform::DISALLOWED,
},
Command {
id: 0x03,
name: "Resume",
to_server: true,
response: None,
access: Access::invoke(Privilege::Operate),
conform: Conform::MANDATORY,
},
Command {
id: 0x04,
name: "OperationalCommandResponse",
to_server: true,
response: None,
access: Access::invoke(Privilege::Operate),
conform: Conform::MANDATORY,
},
Command {
id: 0x80,
name: "GoHome",
to_server: true,
response: Some(0x04),
access: Access::invoke(Privilege::Operate),
conform: Conform::OPTIONAL,
},
];
/// Every event, with its conformance.
pub const EVENTS: &[Event] = &[];
/// The whole cluster, as the specification defines it.
pub const CLUSTER: Cluster = Cluster {
id: ID,
name: "RVC Operational State",
revision: REVISION,
pics: "RVCOPSTATE",
derived_from: Some("Operational State"),
features: FEATURES,
attributes: ATTRIBUTES,
commands: COMMANDS,
events: EVENTS,
};