Skip to main content

matter_kit/clusters/generated/
level_control.rs

1// Generated by `cargo xtask` from the CSA data model 1.6. Do not edit.
2//
3// Level Control — cluster 0x0008.
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//! Level Control (cluster `0x0008`, revision 7).
10//!
11//! 23 identifiers, 3 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 = 0x0008;
28
29/// The highest revision the specification's history defines — what `ClusterRevision`
30/// must report (Core §7.13.1).
31pub const REVISION: u16 = 7;
32
33/// The PICS code, which a certification declaration names the cluster by.
34pub const PICS: &str = "LVL";
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    /// Dependency with the On/Off cluster
42    ///
43    /// Code `OO`, bit 0.
44    pub const ON_OFF: u32 = 1 << 0;
45    /// Behavior that supports lighting applications
46    ///
47    /// Code `LT`, bit 1.
48    pub const LIGHTING: u32 = 1 << 1;
49    /// Supports frequency attributes and behavior.
50    ///
51    /// Code `FQ`, bit 2.
52    pub const FREQUENCY: u32 = 1 << 2;
53}
54
55/// Every feature bit, with its conformance.
56pub const FEATURES: &[Feature] = &[
57    Feature {
58        bit: 0,
59        code: "OO",
60        name: "OnOff",
61        conform: Conform::OPTIONAL,
62    },
63    Feature {
64        bit: 1,
65        code: "LT",
66        name: "Lighting",
67        conform: Conform::OPTIONAL,
68    },
69    Feature {
70        bit: 2,
71        code: "FQ",
72        name: "Frequency",
73        conform: Conform {
74            clauses: &[Clause::always(Conformance::Provisional)],
75        },
76    },
77];
78
79/// The attribute ids.
80pub mod attribute {
81    use crate::im::AttributeId;
82
83    /// `CurrentLevel`.
84    pub const CURRENT_LEVEL: AttributeId = 0x00;
85    /// `RemainingTime`.
86    pub const REMAINING_TIME: AttributeId = 0x01;
87    /// `MinLevel`.
88    pub const MIN_LEVEL: AttributeId = 0x02;
89    /// `MaxLevel`.
90    pub const MAX_LEVEL: AttributeId = 0x03;
91    /// `CurrentFrequency`.
92    pub const CURRENT_FREQUENCY: AttributeId = 0x04;
93    /// `MinFrequency`.
94    pub const MIN_FREQUENCY: AttributeId = 0x05;
95    /// `MaxFrequency`.
96    pub const MAX_FREQUENCY: AttributeId = 0x06;
97    /// `Options`.
98    pub const OPTIONS: AttributeId = 0x0F;
99    /// `OnOffTransitionTime`.
100    pub const ON_OFF_TRANSITION_TIME: AttributeId = 0x10;
101    /// `OnLevel`.
102    pub const ON_LEVEL: AttributeId = 0x11;
103    /// `OnTransitionTime`.
104    pub const ON_TRANSITION_TIME: AttributeId = 0x12;
105    /// `OffTransitionTime`.
106    pub const OFF_TRANSITION_TIME: AttributeId = 0x13;
107    /// `DefaultMoveRate`.
108    pub const DEFAULT_MOVE_RATE: AttributeId = 0x14;
109    /// `StartUpCurrentLevel`.
110    pub const START_UP_CURRENT_LEVEL: AttributeId = 0x4000;
111}
112
113/// The command ids.
114pub mod command {
115    use crate::im::CommandId;
116
117    /// `MoveToLevel`.
118    pub const MOVE_TO_LEVEL: CommandId = 0x00;
119    /// `Move`.
120    pub const MOVE: CommandId = 0x01;
121    /// `Step`.
122    pub const STEP: CommandId = 0x02;
123    /// `Stop`.
124    pub const STOP: CommandId = 0x03;
125    /// `MoveToLevelWithOnOff`.
126    pub const MOVE_TO_LEVEL_WITH_ON_OFF: CommandId = 0x04;
127    /// `MoveWithOnOff`.
128    pub const MOVE_WITH_ON_OFF: CommandId = 0x05;
129    /// `StepWithOnOff`.
130    pub const STEP_WITH_ON_OFF: CommandId = 0x06;
131    /// `StopWithOnOff`.
132    pub const STOP_WITH_ON_OFF: CommandId = 0x07;
133    /// `MoveToClosestFrequency`.
134    pub const MOVE_TO_CLOSEST_FREQUENCY: CommandId = 0x08;
135}
136
137/// `MoveModeEnum`.
138#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
139#[repr(u8)]
140pub enum MoveModeEnum {
141    /// Increase the level
142    Up = 0,
143    /// Decrease the level
144    Down = 1,
145}
146
147impl MoveModeEnum {
148    /// Reads a wire value, or `None` for one this revision does not define.
149    #[must_use]
150    pub const fn from_value(value: u8) -> Option<Self> {
151        match value {
152            0 => Some(Self::Up),
153            1 => Some(Self::Down),
154            _ => None,
155        }
156    }
157
158    /// Its wire value.
159    #[must_use]
160    pub const fn value(self) -> u8 {
161        self as u8
162    }
163}
164
165impl ToTlv for MoveModeEnum {
166    fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
167        self.value().to_tlv(w, tag)
168    }
169}
170
171impl<'a> FromTlv<'a> for MoveModeEnum {
172    fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
173        let value = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
174        Self::from_value(value).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
175    }
176}
177
178/// `StepModeEnum`.
179#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
180#[repr(u8)]
181pub enum StepModeEnum {
182    /// Step upwards
183    Up = 0,
184    /// Step downwards
185    Down = 1,
186}
187
188impl StepModeEnum {
189    /// Reads a wire value, or `None` for one this revision does not define.
190    #[must_use]
191    pub const fn from_value(value: u8) -> Option<Self> {
192        match value {
193            0 => Some(Self::Up),
194            1 => Some(Self::Down),
195            _ => None,
196        }
197    }
198
199    /// Its wire value.
200    #[must_use]
201    pub const fn value(self) -> u8 {
202        self as u8
203    }
204}
205
206impl ToTlv for StepModeEnum {
207    fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
208        self.value().to_tlv(w, tag)
209    }
210}
211
212impl<'a> FromTlv<'a> for StepModeEnum {
213    fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
214        let value = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
215        Self::from_value(value).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
216    }
217}
218
219bitflags::bitflags! {
220    /// `OptionsBitmap`.
221    #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default)]
222    pub struct OptionsBitmap: u8 {
223        /// Dependency on On/Off cluster
224        const EXECUTE_IF_OFF = 1 << 0;
225        /// Dependency on Color Control cluster
226        const COUPLE_COLOR_TEMP_TO_LEVEL = 1 << 1;
227    }
228}
229
230impl ToTlv for OptionsBitmap {
231    fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
232        self.bits().to_tlv(w, tag)
233    }
234}
235
236impl<'a> FromTlv<'a> for OptionsBitmap {
237    fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
238        let bits = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
239        Self::from_bits(bits).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
240    }
241}
242
243/// The fields of `MoveToLevel` (command `0x00`).
244#[derive(Debug, Clone, Copy, PartialEq)]
245pub struct MoveToLevelFields {
246    /// `Level`, field 0.
247    pub level: u8,
248    /// `TransitionTime`, field 1.
249    pub transition_time: Nullable<u16>,
250    /// `OptionsMask`, field 2.
251    pub options_mask: OptionsBitmap,
252    /// `OptionsOverride`, field 3.
253    pub options_override: OptionsBitmap,
254}
255
256impl ToTlv for MoveToLevelFields {
257    fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
258        w.start_structure(tag)?;
259        self.level.to_tlv(w, Tag::Context(0))?;
260        self.transition_time.to_tlv(w, Tag::Context(1))?;
261        self.options_mask.to_tlv(w, Tag::Context(2))?;
262        self.options_override.to_tlv(w, Tag::Context(3))?;
263        w.end_container()
264    }
265}
266
267impl<'a> FromTlv<'a> for MoveToLevelFields {
268    fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
269        if element.value.container() != Some(ContainerKind::Structure) {
270            return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
271        }
272        let mut level = None;
273        let mut transition_time = None;
274        let mut options_mask = None;
275        let mut options_override = None;
276        loop {
277            let Some(field) = reader.next_element()? else {
278                return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
279            };
280            if field.value == Value::EndOfContainer {
281                break;
282            }
283            match field.tag.context() {
284                Some(0) => level = Some(<u8>::from_tlv(reader, &field)?),
285                Some(1) => transition_time = Some(<Nullable<u16>>::from_tlv(reader, &field)?),
286                Some(2) => options_mask = Some(<OptionsBitmap>::from_tlv(reader, &field)?),
287                Some(3) => options_override = Some(<OptionsBitmap>::from_tlv(reader, &field)?),
288                // A field this revision does not define. §7.19.2: a receiver
289                // ignores what it does not know rather than refusing the whole
290                // structure, which is what lets a newer peer talk to an older one.
291                _ => reader.skip_value(&field)?,
292            }
293        }
294        Ok(Self {
295            level: level.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
296            transition_time: transition_time
297                .ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
298            options_mask: options_mask.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
299            options_override: options_override
300                .ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
301        })
302    }
303}
304
305/// The fields of `Move` (command `0x01`).
306#[derive(Debug, Clone, Copy, PartialEq)]
307pub struct MoveFields {
308    /// `MoveMode`, field 0.
309    pub move_mode: MoveModeEnum,
310    /// `Rate`, field 1.
311    pub rate: Nullable<u8>,
312    /// `OptionsMask`, field 2.
313    pub options_mask: OptionsBitmap,
314    /// `OptionsOverride`, field 3.
315    pub options_override: OptionsBitmap,
316}
317
318impl ToTlv for MoveFields {
319    fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
320        w.start_structure(tag)?;
321        self.move_mode.to_tlv(w, Tag::Context(0))?;
322        self.rate.to_tlv(w, Tag::Context(1))?;
323        self.options_mask.to_tlv(w, Tag::Context(2))?;
324        self.options_override.to_tlv(w, Tag::Context(3))?;
325        w.end_container()
326    }
327}
328
329impl<'a> FromTlv<'a> for MoveFields {
330    fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
331        if element.value.container() != Some(ContainerKind::Structure) {
332            return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
333        }
334        let mut move_mode = None;
335        let mut rate = None;
336        let mut options_mask = None;
337        let mut options_override = None;
338        loop {
339            let Some(field) = reader.next_element()? else {
340                return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
341            };
342            if field.value == Value::EndOfContainer {
343                break;
344            }
345            match field.tag.context() {
346                Some(0) => move_mode = Some(<MoveModeEnum>::from_tlv(reader, &field)?),
347                Some(1) => rate = Some(<Nullable<u8>>::from_tlv(reader, &field)?),
348                Some(2) => options_mask = Some(<OptionsBitmap>::from_tlv(reader, &field)?),
349                Some(3) => options_override = Some(<OptionsBitmap>::from_tlv(reader, &field)?),
350                // A field this revision does not define. §7.19.2: a receiver
351                // ignores what it does not know rather than refusing the whole
352                // structure, which is what lets a newer peer talk to an older one.
353                _ => reader.skip_value(&field)?,
354            }
355        }
356        Ok(Self {
357            move_mode: move_mode.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
358            rate: rate.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
359            options_mask: options_mask.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
360            options_override: options_override
361                .ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
362        })
363    }
364}
365
366/// The fields of `Step` (command `0x02`).
367#[derive(Debug, Clone, Copy, PartialEq)]
368pub struct StepFields {
369    /// `StepMode`, field 0.
370    pub step_mode: StepModeEnum,
371    /// `StepSize`, field 1.
372    pub step_size: u8,
373    /// `TransitionTime`, field 2.
374    pub transition_time: Nullable<u16>,
375    /// `OptionsMask`, field 3.
376    pub options_mask: OptionsBitmap,
377    /// `OptionsOverride`, field 4.
378    pub options_override: OptionsBitmap,
379}
380
381impl ToTlv for StepFields {
382    fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
383        w.start_structure(tag)?;
384        self.step_mode.to_tlv(w, Tag::Context(0))?;
385        self.step_size.to_tlv(w, Tag::Context(1))?;
386        self.transition_time.to_tlv(w, Tag::Context(2))?;
387        self.options_mask.to_tlv(w, Tag::Context(3))?;
388        self.options_override.to_tlv(w, Tag::Context(4))?;
389        w.end_container()
390    }
391}
392
393impl<'a> FromTlv<'a> for StepFields {
394    fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
395        if element.value.container() != Some(ContainerKind::Structure) {
396            return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
397        }
398        let mut step_mode = None;
399        let mut step_size = None;
400        let mut transition_time = None;
401        let mut options_mask = None;
402        let mut options_override = None;
403        loop {
404            let Some(field) = reader.next_element()? else {
405                return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
406            };
407            if field.value == Value::EndOfContainer {
408                break;
409            }
410            match field.tag.context() {
411                Some(0) => step_mode = Some(<StepModeEnum>::from_tlv(reader, &field)?),
412                Some(1) => step_size = Some(<u8>::from_tlv(reader, &field)?),
413                Some(2) => transition_time = Some(<Nullable<u16>>::from_tlv(reader, &field)?),
414                Some(3) => options_mask = Some(<OptionsBitmap>::from_tlv(reader, &field)?),
415                Some(4) => options_override = Some(<OptionsBitmap>::from_tlv(reader, &field)?),
416                // A field this revision does not define. §7.19.2: a receiver
417                // ignores what it does not know rather than refusing the whole
418                // structure, which is what lets a newer peer talk to an older one.
419                _ => reader.skip_value(&field)?,
420            }
421        }
422        Ok(Self {
423            step_mode: step_mode.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
424            step_size: step_size.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
425            transition_time: transition_time
426                .ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
427            options_mask: options_mask.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
428            options_override: options_override
429                .ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
430        })
431    }
432}
433
434/// The fields of `Stop` (command `0x03`).
435#[derive(Debug, Clone, Copy, PartialEq)]
436pub struct StopFields {
437    /// `OptionsMask`, field 0.
438    pub options_mask: OptionsBitmap,
439    /// `OptionsOverride`, field 1.
440    pub options_override: OptionsBitmap,
441}
442
443impl ToTlv for StopFields {
444    fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
445        w.start_structure(tag)?;
446        self.options_mask.to_tlv(w, Tag::Context(0))?;
447        self.options_override.to_tlv(w, Tag::Context(1))?;
448        w.end_container()
449    }
450}
451
452impl<'a> FromTlv<'a> for StopFields {
453    fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
454        if element.value.container() != Some(ContainerKind::Structure) {
455            return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
456        }
457        let mut options_mask = None;
458        let mut options_override = None;
459        loop {
460            let Some(field) = reader.next_element()? else {
461                return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
462            };
463            if field.value == Value::EndOfContainer {
464                break;
465            }
466            match field.tag.context() {
467                Some(0) => options_mask = Some(<OptionsBitmap>::from_tlv(reader, &field)?),
468                Some(1) => options_override = Some(<OptionsBitmap>::from_tlv(reader, &field)?),
469                // A field this revision does not define. §7.19.2: a receiver
470                // ignores what it does not know rather than refusing the whole
471                // structure, which is what lets a newer peer talk to an older one.
472                _ => reader.skip_value(&field)?,
473            }
474        }
475        Ok(Self {
476            options_mask: options_mask.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
477            options_override: options_override
478                .ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
479        })
480    }
481}
482
483/// The fields of `MoveToClosestFrequency` (command `0x08`).
484#[derive(Debug, Clone, Copy, PartialEq)]
485pub struct MoveToClosestFrequencyFields {
486    /// `Frequency`, field 0.
487    pub frequency: u16,
488}
489
490impl ToTlv for MoveToClosestFrequencyFields {
491    fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
492        w.start_structure(tag)?;
493        self.frequency.to_tlv(w, Tag::Context(0))?;
494        w.end_container()
495    }
496}
497
498impl<'a> FromTlv<'a> for MoveToClosestFrequencyFields {
499    fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
500        if element.value.container() != Some(ContainerKind::Structure) {
501            return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
502        }
503        let mut frequency = None;
504        loop {
505            let Some(field) = reader.next_element()? else {
506                return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
507            };
508            if field.value == Value::EndOfContainer {
509                break;
510            }
511            match field.tag.context() {
512                Some(0) => frequency = Some(<u16>::from_tlv(reader, &field)?),
513                // A field this revision does not define. §7.19.2: a receiver
514                // ignores what it does not know rather than refusing the whole
515                // structure, which is what lets a newer peer talk to an older one.
516                _ => reader.skip_value(&field)?,
517            }
518        }
519        Ok(Self {
520            frequency: frequency.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
521        })
522    }
523}
524
525/// Every attribute the specification defines, with its conformance.
526pub const ATTRIBUTES: &[Attribute] = &[
527    Attribute {
528        id: 0x0000,
529        name: "CurrentLevel",
530        kind: "uint8",
531        access: Access::read_only(Privilege::View),
532        qualities: AttributeQualities::NULLABLE
533            .union(AttributeQualities::NON_VOLATILE.union(AttributeQualities::SCENE)),
534        reporting: Reporting::Quieter,
535        conform: Conform::MANDATORY,
536    },
537    Attribute {
538        id: 0x0001,
539        name: "RemainingTime",
540        kind: "uint16",
541        access: Access::read_only(Privilege::View),
542        qualities: AttributeQualities::empty(),
543        reporting: Reporting::Quieter,
544        conform: Conform {
545            clauses: &[Clause {
546                verdict: Conformance::Mandatory,
547                when: Condition::Feature(1),
548            }],
549        },
550    },
551    Attribute {
552        id: 0x0002,
553        name: "MinLevel",
554        kind: "uint8",
555        access: Access::read_only(Privilege::View),
556        qualities: AttributeQualities::FIXED,
557        reporting: Reporting::OnChange,
558        conform: Conform {
559            clauses: &[
560                Clause {
561                    verdict: Conformance::Described,
562                    when: Condition::Named("comparison"),
563                },
564                Clause {
565                    verdict: Conformance::Optional,
566                    when: Condition::Always,
567                },
568            ],
569        },
570    },
571    Attribute {
572        id: 0x0003,
573        name: "MaxLevel",
574        kind: "uint8",
575        access: Access::read_only(Privilege::View),
576        qualities: AttributeQualities::FIXED,
577        reporting: Reporting::OnChange,
578        conform: Conform {
579            clauses: &[
580                Clause {
581                    verdict: Conformance::Described,
582                    when: Condition::Named("comparison"),
583                },
584                Clause {
585                    verdict: Conformance::Optional,
586                    when: Condition::Always,
587                },
588            ],
589        },
590    },
591    Attribute {
592        id: 0x0004,
593        name: "CurrentFrequency",
594        kind: "uint16",
595        access: Access::read_only(Privilege::View),
596        qualities: AttributeQualities::SCENE,
597        reporting: Reporting::Quieter,
598        conform: Conform {
599            clauses: &[Clause {
600                verdict: Conformance::Mandatory,
601                when: Condition::Feature(2),
602            }],
603        },
604    },
605    Attribute {
606        id: 0x0005,
607        name: "MinFrequency",
608        kind: "uint16",
609        access: Access::read_only(Privilege::View),
610        qualities: AttributeQualities::empty(),
611        reporting: Reporting::OnChange,
612        conform: Conform {
613            clauses: &[Clause {
614                verdict: Conformance::Mandatory,
615                when: Condition::Feature(2),
616            }],
617        },
618    },
619    Attribute {
620        id: 0x0006,
621        name: "MaxFrequency",
622        kind: "uint16",
623        access: Access::read_only(Privilege::View),
624        qualities: AttributeQualities::empty(),
625        reporting: Reporting::OnChange,
626        conform: Conform {
627            clauses: &[Clause {
628                verdict: Conformance::Mandatory,
629                when: Condition::Feature(2),
630            }],
631        },
632    },
633    Attribute {
634        id: 0x000F,
635        name: "Options",
636        kind: "OptionsBitmap",
637        access: Access::read_write_with(Privilege::View, Privilege::Operate),
638        qualities: AttributeQualities::empty(),
639        reporting: Reporting::OnChange,
640        conform: Conform::MANDATORY,
641    },
642    Attribute {
643        id: 0x0010,
644        name: "OnOffTransitionTime",
645        kind: "uint16",
646        access: Access::read_write_with(Privilege::View, Privilege::Operate),
647        qualities: AttributeQualities::empty(),
648        reporting: Reporting::OnChange,
649        conform: Conform::OPTIONAL,
650    },
651    Attribute {
652        id: 0x0011,
653        name: "OnLevel",
654        kind: "uint8",
655        access: Access::read_write_with(Privilege::View, Privilege::Operate),
656        qualities: AttributeQualities::NULLABLE,
657        reporting: Reporting::OnChange,
658        conform: Conform::MANDATORY,
659    },
660    Attribute {
661        id: 0x0012,
662        name: "OnTransitionTime",
663        kind: "uint16",
664        access: Access::read_write_with(Privilege::View, Privilege::Operate),
665        qualities: AttributeQualities::NULLABLE,
666        reporting: Reporting::OnChange,
667        conform: Conform::OPTIONAL,
668    },
669    Attribute {
670        id: 0x0013,
671        name: "OffTransitionTime",
672        kind: "uint16",
673        access: Access::read_write_with(Privilege::View, Privilege::Operate),
674        qualities: AttributeQualities::NULLABLE,
675        reporting: Reporting::OnChange,
676        conform: Conform::OPTIONAL,
677    },
678    Attribute {
679        id: 0x0014,
680        name: "DefaultMoveRate",
681        kind: "uint8",
682        access: Access::read_write_with(Privilege::View, Privilege::Operate),
683        qualities: AttributeQualities::NULLABLE,
684        reporting: Reporting::OnChange,
685        conform: Conform::OPTIONAL,
686    },
687    Attribute {
688        id: 0x4000,
689        name: "StartUpCurrentLevel",
690        kind: "uint8",
691        access: Access::read_write_with(Privilege::View, Privilege::Manage),
692        qualities: AttributeQualities::NULLABLE.union(AttributeQualities::NON_VOLATILE),
693        reporting: Reporting::OnChange,
694        conform: Conform {
695            clauses: &[Clause {
696                verdict: Conformance::Mandatory,
697                when: Condition::Feature(1),
698            }],
699        },
700    },
701];
702
703/// Every command, with its conformance.
704pub const COMMANDS: &[Command] = &[
705    Command {
706        id: 0x00,
707        name: "MoveToLevel",
708        to_server: true,
709        response: None,
710        access: Access::invoke(Privilege::Operate),
711        conform: Conform::MANDATORY,
712    },
713    Command {
714        id: 0x01,
715        name: "Move",
716        to_server: true,
717        response: None,
718        access: Access::invoke(Privilege::Operate),
719        conform: Conform::MANDATORY,
720    },
721    Command {
722        id: 0x02,
723        name: "Step",
724        to_server: true,
725        response: None,
726        access: Access::invoke(Privilege::Operate),
727        conform: Conform::MANDATORY,
728    },
729    Command {
730        id: 0x03,
731        name: "Stop",
732        to_server: true,
733        response: None,
734        access: Access::invoke(Privilege::Operate),
735        conform: Conform::MANDATORY,
736    },
737    Command {
738        id: 0x04,
739        name: "MoveToLevelWithOnOff",
740        to_server: true,
741        response: None,
742        access: Access::invoke(Privilege::Operate),
743        conform: Conform::MANDATORY,
744    },
745    Command {
746        id: 0x05,
747        name: "MoveWithOnOff",
748        to_server: true,
749        response: None,
750        access: Access::invoke(Privilege::Operate),
751        conform: Conform::MANDATORY,
752    },
753    Command {
754        id: 0x06,
755        name: "StepWithOnOff",
756        to_server: true,
757        response: None,
758        access: Access::invoke(Privilege::Operate),
759        conform: Conform::MANDATORY,
760    },
761    Command {
762        id: 0x07,
763        name: "StopWithOnOff",
764        to_server: true,
765        response: None,
766        access: Access::invoke(Privilege::Operate),
767        conform: Conform::MANDATORY,
768    },
769    Command {
770        id: 0x08,
771        name: "MoveToClosestFrequency",
772        to_server: true,
773        response: None,
774        access: Access::invoke(Privilege::Operate),
775        conform: Conform {
776            clauses: &[Clause {
777                verdict: Conformance::Mandatory,
778                when: Condition::Feature(2),
779            }],
780        },
781    },
782];
783
784/// Every event, with its conformance.
785pub const EVENTS: &[Event] = &[];
786
787/// The whole cluster, as the specification defines it.
788pub const CLUSTER: Cluster = Cluster {
789    id: ID,
790    name: "Level Control",
791    revision: REVISION,
792    pics: "LVL",
793    derived_from: None,
794    features: FEATURES,
795    attributes: ATTRIBUTES,
796    commands: COMMANDS,
797    events: EVENTS,
798};