Skip to main content

matter_kit/clusters/generated/
closure_control.rs

1// Generated by `cargo xtask` from the CSA data model 1.6. Do not edit.
2//
3// Closure Control — cluster 0x0104.
4//
5// Regenerate with `cargo xtask clusters --dm <checkout>/data_model/1.6`; `cargo xtask check`
6// is the CI gate that keeps this file honest. The XML itself is not vendored here — it
7// carries the CSA's own copyright notice and is not redistributable.
8
9//! Closure Control (cluster `0x0104`, revision 1).
10//!
11//! 13 identifiers, 9 feature bits, and the specification's own conformance for
12//! every element. `CLUSTER` is the whole table.
13
14#![allow(unused_imports)]
15
16use crate::dm::conformance::{Clause, Condition, Conform, Conformance};
17use crate::dm::meta::{EventPriority, Reporting};
18use crate::dm::spec::{Attribute, Cluster, Command, Event, Feature};
19use crate::dm::{Access, AccessQualities, AttributeQualities, Privilege};
20use crate::error::Result;
21use crate::im::{AttributeId, ClusterId, CommandId, EventId};
22use crate::tlv::{
23    ContainerKind, Element, FromTlv, Nullable, Tag, TlvList, TlvReader, TlvWriter, ToTlv, Value,
24};
25
26/// The cluster id.
27pub const ID: ClusterId = 0x0104;
28
29/// The highest revision the specification's history defines — what `ClusterRevision`
30/// must report (Core §7.13.1).
31pub const REVISION: u16 = 1;
32
33/// The PICS code, which a certification declaration names the cluster by.
34pub const PICS: &str = "CLCTRL";
35
36/// The `FeatureMap` bits (Core §7.13.2).
37///
38/// A feature has conformance of its own: a device may not claim one the
39/// specification forbids it alongside another.
40pub mod feature {
41    /// Supports Positioning with at least Fully Opened (0%) and Fully Closed (100%) discrete positions
42    ///
43    /// Code `PS`, bit 0.
44    pub const POSITIONING: u32 = 1 << 0;
45    /// Supports a latch (securing a position, or a state)
46    ///
47    /// Code `LT`, bit 1.
48    pub const MOTION_LATCHING: u32 = 1 << 1;
49    /// Supports the Instantaneous feature
50    ///
51    /// Code `IS`, bit 2.
52    pub const INSTANTANEOUS: u32 = 1 << 2;
53    /// Supports Speed motion throttling
54    ///
55    /// Code `SP`, bit 3.
56    pub const SPEED: u32 = 1 << 3;
57    /// Supports Ventilation discrete state
58    ///
59    /// Code `VT`, bit 4.
60    pub const VENTILATION: u32 = 1 << 4;
61    /// Supports Pedestrian discrete state
62    ///
63    /// Code `PD`, bit 5.
64    pub const PEDESTRIAN: u32 = 1 << 5;
65    /// Supports the Calibration feature
66    ///
67    /// Code `CL`, bit 6.
68    pub const CALIBRATION: u32 = 1 << 6;
69    /// Supports the Protection feature
70    ///
71    /// Code `PT`, bit 7.
72    pub const PROTECTION: u32 = 1 << 7;
73    /// Supports the manual operation feature
74    ///
75    /// Code `MO`, bit 8.
76    pub const MANUALLY_OPERABLE: u32 = 1 << 8;
77}
78
79/// Every feature bit, with its conformance.
80pub const FEATURES: &[Feature] = &[
81    Feature {
82        bit: 0,
83        code: "PS",
84        name: "Positioning",
85        conform: Conform::OPTIONAL,
86    },
87    Feature {
88        bit: 1,
89        code: "LT",
90        name: "MotionLatching",
91        conform: Conform::OPTIONAL,
92    },
93    Feature {
94        bit: 2,
95        code: "IS",
96        name: "Instantaneous",
97        conform: Conform::OPTIONAL,
98    },
99    Feature {
100        bit: 3,
101        code: "SP",
102        name: "Speed",
103        conform: Conform {
104            clauses: &[Clause {
105                verdict: Conformance::Optional,
106                when: Condition::All(&[
107                    Condition::Feature(0),
108                    Condition::Not(&Condition::Feature(2)),
109                ]),
110            }],
111        },
112    },
113    Feature {
114        bit: 4,
115        code: "VT",
116        name: "Ventilation",
117        conform: Conform {
118            clauses: &[Clause {
119                verdict: Conformance::Optional,
120                when: Condition::Feature(0),
121            }],
122        },
123    },
124    Feature {
125        bit: 5,
126        code: "PD",
127        name: "Pedestrian",
128        conform: Conform {
129            clauses: &[Clause {
130                verdict: Conformance::Optional,
131                when: Condition::Feature(0),
132            }],
133        },
134    },
135    Feature {
136        bit: 6,
137        code: "CL",
138        name: "Calibration",
139        conform: Conform {
140            clauses: &[Clause {
141                verdict: Conformance::Optional,
142                when: Condition::Feature(0),
143            }],
144        },
145    },
146    Feature {
147        bit: 7,
148        code: "PT",
149        name: "Protection",
150        conform: Conform::OPTIONAL,
151    },
152    Feature {
153        bit: 8,
154        code: "MO",
155        name: "ManuallyOperable",
156        conform: Conform::OPTIONAL,
157    },
158];
159
160/// The attribute ids.
161pub mod attribute {
162    use crate::im::AttributeId;
163
164    /// `CountdownTime`.
165    pub const COUNTDOWN_TIME: AttributeId = 0x00;
166    /// `MainState`.
167    pub const MAIN_STATE: AttributeId = 0x01;
168    /// `CurrentErrorList`.
169    pub const CURRENT_ERROR_LIST: AttributeId = 0x02;
170    /// `OverallCurrentState`.
171    pub const OVERALL_CURRENT_STATE: AttributeId = 0x03;
172    /// `OverallTargetState`.
173    pub const OVERALL_TARGET_STATE: AttributeId = 0x04;
174    /// `LatchControlModes`.
175    pub const LATCH_CONTROL_MODES: AttributeId = 0x05;
176}
177
178/// The command ids.
179pub mod command {
180    use crate::im::CommandId;
181
182    /// `Stop`.
183    pub const STOP: CommandId = 0x00;
184    /// `MoveTo`.
185    pub const MOVE_TO: CommandId = 0x01;
186    /// `Calibrate`.
187    pub const CALIBRATE: CommandId = 0x02;
188}
189
190/// The event ids.
191pub mod event {
192    use crate::im::EventId;
193
194    /// `OperationalError`.
195    pub const OPERATIONAL_ERROR: EventId = 0x00;
196    /// `MovementCompleted`.
197    pub const MOVEMENT_COMPLETED: EventId = 0x01;
198    /// `EngageStateChanged`.
199    pub const ENGAGE_STATE_CHANGED: EventId = 0x02;
200    /// `SecureStateChanged`.
201    pub const SECURE_STATE_CHANGED: EventId = 0x03;
202}
203
204/// `ClosureErrorEnum`.
205#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
206#[repr(u8)]
207pub enum ClosureErrorEnum {
208    /// An obstacle is blocking the closure movement
209    PhysicallyBlocked = 0,
210    /// The closure is unsafe to move, as determined by a sensor (e.g. photoelectric sensor) before attempting movement
211    BlockedBySensor = 1,
212    /// A warning raised by the closure that indicates an over-temperature, e.g. due to excessive drive or stall current
213    TemperatureLimited = 2,
214    /// Some malfunctions that are not easily recoverable are detected, or urgent servicing is needed
215    MaintenanceRequired = 3,
216    /// An internal element is prohibiting motion, e.g. an integrated door within a bigger garage door is open and prevents motion
217    InternalInterference = 4,
218}
219
220impl ClosureErrorEnum {
221    /// Reads a wire value, or `None` for one this revision does not define.
222    #[must_use]
223    pub const fn from_value(value: u8) -> Option<Self> {
224        match value {
225            0 => Some(Self::PhysicallyBlocked),
226            1 => Some(Self::BlockedBySensor),
227            2 => Some(Self::TemperatureLimited),
228            3 => Some(Self::MaintenanceRequired),
229            4 => Some(Self::InternalInterference),
230            _ => None,
231        }
232    }
233
234    /// Its wire value.
235    #[must_use]
236    pub const fn value(self) -> u8 {
237        self as u8
238    }
239}
240
241impl ToTlv for ClosureErrorEnum {
242    fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
243        self.value().to_tlv(w, tag)
244    }
245}
246
247impl<'a> FromTlv<'a> for ClosureErrorEnum {
248    fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
249        let value = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
250        Self::from_value(value).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
251    }
252}
253
254/// `CurrentPositionEnum`.
255#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
256#[repr(u8)]
257pub enum CurrentPositionEnum {
258    /// Fully closed state
259    FullyClosed = 0,
260    /// Fully opened state
261    FullyOpened = 1,
262    /// Partially opened state (closure is not fully opened or fully closed)
263    PartiallyOpened = 2,
264    /// Closure is in the Pedestrian position
265    OpenedForPedestrian = 3,
266    /// Closure is in the Ventilation position
267    OpenedForVentilation = 4,
268    /// Closure is in its "Signature position"
269    OpenedAtSignature = 5,
270}
271
272impl CurrentPositionEnum {
273    /// Reads a wire value, or `None` for one this revision does not define.
274    #[must_use]
275    pub const fn from_value(value: u8) -> Option<Self> {
276        match value {
277            0 => Some(Self::FullyClosed),
278            1 => Some(Self::FullyOpened),
279            2 => Some(Self::PartiallyOpened),
280            3 => Some(Self::OpenedForPedestrian),
281            4 => Some(Self::OpenedForVentilation),
282            5 => Some(Self::OpenedAtSignature),
283            _ => None,
284        }
285    }
286
287    /// Its wire value.
288    #[must_use]
289    pub const fn value(self) -> u8 {
290        self as u8
291    }
292}
293
294impl ToTlv for CurrentPositionEnum {
295    fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
296        self.value().to_tlv(w, tag)
297    }
298}
299
300impl<'a> FromTlv<'a> for CurrentPositionEnum {
301    fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
302        let value = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
303        Self::from_value(value).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
304    }
305}
306
307/// `MainStateEnum`.
308#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
309#[repr(u8)]
310pub enum MainStateEnum {
311    /// Closure is stopped
312    Stopped = 0,
313    /// Closure is actively moving
314    Moving = 1,
315    /// Closure is waiting before a motion (e.g. pre-heat, pre-check)
316    WaitingForMotion = 2,
317    /// Closure is in an error state
318    Error = 3,
319    /// Closure is currently calibrating its Opened and Closed limits to determine effective physical range
320    Calibrating = 4,
321    /// Some protective measures are activated to prevent damage to the closure. Commands MAY be rejected.
322    Protected = 5,
323    /// Closure has a disengaged element preventing any actuator movements
324    Disengaged = 6,
325    /// Movement commands are ignored since the closure is not operational and requires further setup and/or calibration
326    SetupRequired = 7,
327}
328
329impl MainStateEnum {
330    /// Reads a wire value, or `None` for one this revision does not define.
331    #[must_use]
332    pub const fn from_value(value: u8) -> Option<Self> {
333        match value {
334            0 => Some(Self::Stopped),
335            1 => Some(Self::Moving),
336            2 => Some(Self::WaitingForMotion),
337            3 => Some(Self::Error),
338            4 => Some(Self::Calibrating),
339            5 => Some(Self::Protected),
340            6 => Some(Self::Disengaged),
341            7 => Some(Self::SetupRequired),
342            _ => None,
343        }
344    }
345
346    /// Its wire value.
347    #[must_use]
348    pub const fn value(self) -> u8 {
349        self as u8
350    }
351}
352
353impl ToTlv for MainStateEnum {
354    fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
355        self.value().to_tlv(w, tag)
356    }
357}
358
359impl<'a> FromTlv<'a> for MainStateEnum {
360    fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
361        let value = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
362        Self::from_value(value).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
363    }
364}
365
366/// `TargetPositionEnum`.
367#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
368#[repr(u8)]
369pub enum TargetPositionEnum {
370    /// Move to a fully closed state
371    MoveToFullyClosed = 0,
372    /// Move to a fully open state
373    MoveToFullyOpen = 1,
374    /// Move to the Pedestrian position
375    MoveToPedestrianPosition = 2,
376    /// Move to the Ventilation position
377    MoveToVentilationPosition = 3,
378    /// Move to the Signature position
379    MoveToSignaturePosition = 4,
380}
381
382impl TargetPositionEnum {
383    /// Reads a wire value, or `None` for one this revision does not define.
384    #[must_use]
385    pub const fn from_value(value: u8) -> Option<Self> {
386        match value {
387            0 => Some(Self::MoveToFullyClosed),
388            1 => Some(Self::MoveToFullyOpen),
389            2 => Some(Self::MoveToPedestrianPosition),
390            3 => Some(Self::MoveToVentilationPosition),
391            4 => Some(Self::MoveToSignaturePosition),
392            _ => None,
393        }
394    }
395
396    /// Its wire value.
397    #[must_use]
398    pub const fn value(self) -> u8 {
399        self as u8
400    }
401}
402
403impl ToTlv for TargetPositionEnum {
404    fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
405        self.value().to_tlv(w, tag)
406    }
407}
408
409impl<'a> FromTlv<'a> for TargetPositionEnum {
410    fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
411        let value = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
412        Self::from_value(value).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
413    }
414}
415
416bitflags::bitflags! {
417    /// `LatchControlModesBitmap`.
418    #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default)]
419    pub struct LatchControlModesBitmap: u8 {
420        /// Remote latching capability
421        const REMOTE_LATCHING = 1 << 0;
422        /// Remote unlatching capability
423        const REMOTE_UNLATCHING = 1 << 1;
424    }
425}
426
427impl ToTlv for LatchControlModesBitmap {
428    fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
429        self.bits().to_tlv(w, tag)
430    }
431}
432
433impl<'a> FromTlv<'a> for LatchControlModesBitmap {
434    fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
435        let bits = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
436        Self::from_bits(bits).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
437    }
438}
439
440/// `OverallCurrentStateStruct`.
441#[derive(Debug, Clone, Copy, PartialEq)]
442pub struct OverallCurrentStateStruct {
443    /// `Position`, field 0.
444    pub position: Option<Nullable<CurrentPositionEnum>>,
445    /// `Latch`, field 1.
446    pub latch: Option<Nullable<bool>>,
447    /// `Speed`, field 2.
448    pub speed: Option<crate::clusters::generated::globals::ThreeLevelAutoEnum>,
449    /// `SecureState`, field 3.
450    pub secure_state: Nullable<bool>,
451}
452
453impl ToTlv for OverallCurrentStateStruct {
454    fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
455        w.start_structure(tag)?;
456        if let Some(value) = &self.position {
457            value.to_tlv(w, Tag::Context(0))?;
458        }
459        if let Some(value) = &self.latch {
460            value.to_tlv(w, Tag::Context(1))?;
461        }
462        if let Some(value) = &self.speed {
463            value.to_tlv(w, Tag::Context(2))?;
464        }
465        self.secure_state.to_tlv(w, Tag::Context(3))?;
466        w.end_container()
467    }
468}
469
470impl<'a> FromTlv<'a> for OverallCurrentStateStruct {
471    fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
472        if element.value.container() != Some(ContainerKind::Structure) {
473            return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
474        }
475        let mut position = None;
476        let mut latch = None;
477        let mut speed = None;
478        let mut secure_state = None;
479        loop {
480            let Some(field) = reader.next_element()? else {
481                return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
482            };
483            if field.value == Value::EndOfContainer {
484                break;
485            }
486            match field.tag.context() {
487                Some(0) => {
488                    position = Some(<Nullable<CurrentPositionEnum>>::from_tlv(reader, &field)?)
489                }
490                Some(1) => latch = Some(<Nullable<bool>>::from_tlv(reader, &field)?),
491                Some(2) => {
492                    speed = Some(
493                        <crate::clusters::generated::globals::ThreeLevelAutoEnum>::from_tlv(
494                            reader, &field,
495                        )?,
496                    )
497                }
498                Some(3) => secure_state = Some(<Nullable<bool>>::from_tlv(reader, &field)?),
499                // A field this revision does not define. §7.19.2: a receiver
500                // ignores what it does not know rather than refusing the whole
501                // structure, which is what lets a newer peer talk to an older one.
502                _ => reader.skip_value(&field)?,
503            }
504        }
505        Ok(Self {
506            position,
507            latch,
508            speed,
509            secure_state: secure_state.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
510        })
511    }
512}
513
514/// `OverallTargetStateStruct`.
515#[derive(Debug, Clone, Copy, PartialEq)]
516pub struct OverallTargetStateStruct {
517    /// `Position`, field 0.
518    pub position: Option<Nullable<TargetPositionEnum>>,
519    /// `Latch`, field 1.
520    pub latch: Option<Nullable<bool>>,
521    /// `Speed`, field 2.
522    pub speed: Option<crate::clusters::generated::globals::ThreeLevelAutoEnum>,
523}
524
525impl ToTlv for OverallTargetStateStruct {
526    fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
527        w.start_structure(tag)?;
528        if let Some(value) = &self.position {
529            value.to_tlv(w, Tag::Context(0))?;
530        }
531        if let Some(value) = &self.latch {
532            value.to_tlv(w, Tag::Context(1))?;
533        }
534        if let Some(value) = &self.speed {
535            value.to_tlv(w, Tag::Context(2))?;
536        }
537        w.end_container()
538    }
539}
540
541impl<'a> FromTlv<'a> for OverallTargetStateStruct {
542    fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
543        if element.value.container() != Some(ContainerKind::Structure) {
544            return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
545        }
546        let mut position = None;
547        let mut latch = None;
548        let mut speed = None;
549        loop {
550            let Some(field) = reader.next_element()? else {
551                return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
552            };
553            if field.value == Value::EndOfContainer {
554                break;
555            }
556            match field.tag.context() {
557                Some(0) => {
558                    position = Some(<Nullable<TargetPositionEnum>>::from_tlv(reader, &field)?)
559                }
560                Some(1) => latch = Some(<Nullable<bool>>::from_tlv(reader, &field)?),
561                Some(2) => {
562                    speed = Some(
563                        <crate::clusters::generated::globals::ThreeLevelAutoEnum>::from_tlv(
564                            reader, &field,
565                        )?,
566                    )
567                }
568                // A field this revision does not define. §7.19.2: a receiver
569                // ignores what it does not know rather than refusing the whole
570                // structure, which is what lets a newer peer talk to an older one.
571                _ => reader.skip_value(&field)?,
572            }
573        }
574        Ok(Self {
575            position,
576            latch,
577            speed,
578        })
579    }
580}
581
582/// The fields of `MoveTo` (command `0x01`).
583#[derive(Debug, Clone, Copy, PartialEq)]
584pub struct MoveToFields {
585    /// `Position`, field 0.
586    pub position: Option<TargetPositionEnum>,
587    /// `Latch`, field 1.
588    pub latch: Option<bool>,
589    /// `Speed`, field 2.
590    pub speed: Option<crate::clusters::generated::globals::ThreeLevelAutoEnum>,
591}
592
593impl ToTlv for MoveToFields {
594    fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
595        w.start_structure(tag)?;
596        if let Some(value) = &self.position {
597            value.to_tlv(w, Tag::Context(0))?;
598        }
599        if let Some(value) = &self.latch {
600            value.to_tlv(w, Tag::Context(1))?;
601        }
602        if let Some(value) = &self.speed {
603            value.to_tlv(w, Tag::Context(2))?;
604        }
605        w.end_container()
606    }
607}
608
609impl<'a> FromTlv<'a> for MoveToFields {
610    fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
611        if element.value.container() != Some(ContainerKind::Structure) {
612            return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
613        }
614        let mut position = None;
615        let mut latch = None;
616        let mut speed = None;
617        loop {
618            let Some(field) = reader.next_element()? else {
619                return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
620            };
621            if field.value == Value::EndOfContainer {
622                break;
623            }
624            match field.tag.context() {
625                Some(0) => position = Some(<TargetPositionEnum>::from_tlv(reader, &field)?),
626                Some(1) => latch = Some(<bool>::from_tlv(reader, &field)?),
627                Some(2) => {
628                    speed = Some(
629                        <crate::clusters::generated::globals::ThreeLevelAutoEnum>::from_tlv(
630                            reader, &field,
631                        )?,
632                    )
633                }
634                // A field this revision does not define. §7.19.2: a receiver
635                // ignores what it does not know rather than refusing the whole
636                // structure, which is what lets a newer peer talk to an older one.
637                _ => reader.skip_value(&field)?,
638            }
639        }
640        Ok(Self {
641            position,
642            latch,
643            speed,
644        })
645    }
646}
647
648/// Every attribute the specification defines, with its conformance.
649pub const ATTRIBUTES: &[Attribute] = &[
650    Attribute {
651        id: 0x0000,
652        name: "CountdownTime",
653        kind: "elapsed-s",
654        access: Access::read_only(Privilege::View),
655        qualities: AttributeQualities::NULLABLE,
656        reporting: Reporting::Quieter,
657        conform: Conform {
658            clauses: &[Clause {
659                verdict: Conformance::Optional,
660                when: Condition::All(&[
661                    Condition::Feature(0),
662                    Condition::Not(&Condition::Feature(2)),
663                ]),
664            }],
665        },
666    },
667    Attribute {
668        id: 0x0001,
669        name: "MainState",
670        kind: "MainStateEnum",
671        access: Access::read_only(Privilege::View),
672        qualities: AttributeQualities::empty(),
673        reporting: Reporting::OnChange,
674        conform: Conform::MANDATORY,
675    },
676    Attribute {
677        id: 0x0002,
678        name: "CurrentErrorList",
679        kind: "list[ClosureErrorEnum]",
680        access: Access::read_only(Privilege::View),
681        qualities: AttributeQualities::empty(),
682        reporting: Reporting::OnChange,
683        conform: Conform::MANDATORY,
684    },
685    Attribute {
686        id: 0x0003,
687        name: "OverallCurrentState",
688        kind: "OverallCurrentStateStruct",
689        access: Access::read_only(Privilege::View),
690        qualities: AttributeQualities::NULLABLE,
691        reporting: Reporting::OnChange,
692        conform: Conform::MANDATORY,
693    },
694    Attribute {
695        id: 0x0004,
696        name: "OverallTargetState",
697        kind: "OverallTargetStateStruct",
698        access: Access::read_only(Privilege::View),
699        qualities: AttributeQualities::NULLABLE,
700        reporting: Reporting::OnChange,
701        conform: Conform::MANDATORY,
702    },
703    Attribute {
704        id: 0x0005,
705        name: "LatchControlModes",
706        kind: "LatchControlModesBitmap",
707        access: Access::read_only(Privilege::View),
708        qualities: AttributeQualities::FIXED,
709        reporting: Reporting::OnChange,
710        conform: Conform {
711            clauses: &[Clause {
712                verdict: Conformance::Mandatory,
713                when: Condition::Feature(1),
714            }],
715        },
716    },
717];
718
719/// Every command, with its conformance.
720pub const COMMANDS: &[Command] = &[
721    Command {
722        id: 0x00,
723        name: "Stop",
724        to_server: true,
725        response: None,
726        access: Access::invoke(Privilege::Operate),
727        conform: Conform {
728            clauses: &[Clause {
729                verdict: Conformance::Mandatory,
730                when: Condition::Not(&Condition::Feature(2)),
731            }],
732        },
733    },
734    Command {
735        id: 0x01,
736        name: "MoveTo",
737        to_server: true,
738        response: None,
739        access: Access::invoke(Privilege::Operate).with_qualities(AccessQualities::TIMED),
740        conform: Conform::MANDATORY,
741    },
742    Command {
743        id: 0x02,
744        name: "Calibrate",
745        to_server: true,
746        response: None,
747        access: Access::invoke(Privilege::Manage).with_qualities(AccessQualities::TIMED),
748        conform: Conform {
749            clauses: &[Clause {
750                verdict: Conformance::Mandatory,
751                when: Condition::Feature(6),
752            }],
753        },
754    },
755];
756
757/// Every event, with its conformance.
758pub const EVENTS: &[Event] = &[
759    Event {
760        id: 0x00,
761        name: "OperationalError",
762        priority: EventPriority::Critical,
763        access: Access::read_only(Privilege::View),
764        conform: Conform::MANDATORY,
765    },
766    Event {
767        id: 0x01,
768        name: "MovementCompleted",
769        priority: EventPriority::Info,
770        access: Access::read_only(Privilege::View),
771        conform: Conform {
772            clauses: &[Clause {
773                verdict: Conformance::Mandatory,
774                when: Condition::Not(&Condition::Feature(2)),
775            }],
776        },
777    },
778    Event {
779        id: 0x02,
780        name: "EngageStateChanged",
781        priority: EventPriority::Info,
782        access: Access::read_only(Privilege::View),
783        conform: Conform {
784            clauses: &[Clause {
785                verdict: Conformance::Mandatory,
786                when: Condition::Feature(8),
787            }],
788        },
789    },
790    Event {
791        id: 0x03,
792        name: "SecureStateChanged",
793        priority: EventPriority::Info,
794        access: Access::read_only(Privilege::View),
795        conform: Conform::MANDATORY,
796    },
797];
798
799/// The whole cluster, as the specification defines it.
800pub const CLUSTER: Cluster = Cluster {
801    id: ID,
802    name: "Closure Control",
803    revision: REVISION,
804    pics: "CLCTRL",
805    derived_from: None,
806    features: FEATURES,
807    attributes: ATTRIBUTES,
808    commands: COMMANDS,
809    events: EVENTS,
810};