1#![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
26pub const ID: ClusterId = 0x0300;
28
29pub const REVISION: u16 = 9;
32
33pub const PICS: &str = "CC";
35
36pub mod feature {
41 pub const HUE_SATURATION: u32 = 1 << 0;
45 pub const ENHANCED_HUE: u32 = 1 << 1;
49 pub const COLOR_LOOP: u32 = 1 << 2;
53 pub const XY: u32 = 1 << 3;
57 pub const COLOR_TEMPERATURE: u32 = 1 << 4;
61}
62
63pub const FEATURES: &[Feature] = &[
65 Feature {
66 bit: 0,
67 code: "HS",
68 name: "HueSaturation",
69 conform: Conform {
70 clauses: &[
71 Clause {
72 verdict: Conformance::Mandatory,
73 when: Condition::Feature(1),
74 },
75 Clause {
76 verdict: Conformance::Optional,
77 when: Condition::Always,
78 },
79 ],
80 },
81 },
82 Feature {
83 bit: 1,
84 code: "EHUE",
85 name: "EnhancedHue",
86 conform: Conform {
87 clauses: &[
88 Clause {
89 verdict: Conformance::Mandatory,
90 when: Condition::Feature(2),
91 },
92 Clause {
93 verdict: Conformance::Optional,
94 when: Condition::Always,
95 },
96 ],
97 },
98 },
99 Feature {
100 bit: 2,
101 code: "CL",
102 name: "ColorLoop",
103 conform: Conform::OPTIONAL,
104 },
105 Feature {
106 bit: 3,
107 code: "XY",
108 name: "XY",
109 conform: Conform::OPTIONAL,
110 },
111 Feature {
112 bit: 4,
113 code: "CT",
114 name: "ColorTemperature",
115 conform: Conform::OPTIONAL,
116 },
117];
118
119pub mod attribute {
121 use crate::im::AttributeId;
122
123 pub const CURRENT_HUE: AttributeId = 0x00;
125 pub const CURRENT_SATURATION: AttributeId = 0x01;
127 pub const REMAINING_TIME: AttributeId = 0x02;
129 pub const CURRENT_X: AttributeId = 0x03;
131 pub const CURRENT_Y: AttributeId = 0x04;
133 pub const DRIFT_COMPENSATION: AttributeId = 0x05;
135 pub const COMPENSATION_TEXT: AttributeId = 0x06;
137 pub const COLOR_TEMPERATURE_MIREDS: AttributeId = 0x07;
139 pub const COLOR_MODE: AttributeId = 0x08;
141 pub const OPTIONS: AttributeId = 0x0F;
143 pub const NUMBER_OF_PRIMARIES: AttributeId = 0x10;
145 pub const PRIMARY1_X: AttributeId = 0x11;
147 pub const PRIMARY1_Y: AttributeId = 0x12;
149 pub const PRIMARY1_INTENSITY: AttributeId = 0x13;
151 pub const PRIMARY2_X: AttributeId = 0x15;
153 pub const PRIMARY2_Y: AttributeId = 0x16;
155 pub const PRIMARY2_INTENSITY: AttributeId = 0x17;
157 pub const PRIMARY3_X: AttributeId = 0x19;
159 pub const PRIMARY3_Y: AttributeId = 0x1A;
161 pub const PRIMARY3_INTENSITY: AttributeId = 0x1B;
163 pub const PRIMARY4_X: AttributeId = 0x20;
165 pub const PRIMARY4_Y: AttributeId = 0x21;
167 pub const PRIMARY4_INTENSITY: AttributeId = 0x22;
169 pub const PRIMARY5_X: AttributeId = 0x24;
171 pub const PRIMARY5_Y: AttributeId = 0x25;
173 pub const PRIMARY5_INTENSITY: AttributeId = 0x26;
175 pub const PRIMARY6_X: AttributeId = 0x28;
177 pub const PRIMARY6_Y: AttributeId = 0x29;
179 pub const PRIMARY6_INTENSITY: AttributeId = 0x2A;
181 pub const WHITE_POINT_X: AttributeId = 0x30;
183 pub const WHITE_POINT_Y: AttributeId = 0x31;
185 pub const COLOR_POINT_RX: AttributeId = 0x32;
187 pub const COLOR_POINT_RY: AttributeId = 0x33;
189 pub const COLOR_POINT_R_INTENSITY: AttributeId = 0x34;
191 pub const COLOR_POINT_GX: AttributeId = 0x36;
193 pub const COLOR_POINT_GY: AttributeId = 0x37;
195 pub const COLOR_POINT_G_INTENSITY: AttributeId = 0x38;
197 pub const COLOR_POINT_BX: AttributeId = 0x3A;
199 pub const COLOR_POINT_BY: AttributeId = 0x3B;
201 pub const COLOR_POINT_B_INTENSITY: AttributeId = 0x3C;
203 pub const ENHANCED_CURRENT_HUE: AttributeId = 0x4000;
205 pub const ENHANCED_COLOR_MODE: AttributeId = 0x4001;
207 pub const COLOR_LOOP_ACTIVE: AttributeId = 0x4002;
209 pub const COLOR_LOOP_DIRECTION: AttributeId = 0x4003;
211 pub const COLOR_LOOP_TIME: AttributeId = 0x4004;
213 pub const COLOR_LOOP_START_ENHANCED_HUE: AttributeId = 0x4005;
215 pub const COLOR_LOOP_STORED_ENHANCED_HUE: AttributeId = 0x4006;
217 pub const COLOR_CAPABILITIES: AttributeId = 0x400A;
219 pub const COLOR_TEMP_PHYSICAL_MIN_MIREDS: AttributeId = 0x400B;
221 pub const COLOR_TEMP_PHYSICAL_MAX_MIREDS: AttributeId = 0x400C;
223 pub const COUPLE_COLOR_TEMP_TO_LEVEL_MIN_MIREDS: AttributeId = 0x400D;
225 pub const START_UP_COLOR_TEMPERATURE_MIREDS: AttributeId = 0x4010;
227}
228
229pub mod command {
231 use crate::im::CommandId;
232
233 pub const MOVE_TO_HUE: CommandId = 0x00;
235 pub const MOVE_HUE: CommandId = 0x01;
237 pub const STEP_HUE: CommandId = 0x02;
239 pub const MOVE_TO_SATURATION: CommandId = 0x03;
241 pub const MOVE_SATURATION: CommandId = 0x04;
243 pub const STEP_SATURATION: CommandId = 0x05;
245 pub const MOVE_TO_HUE_AND_SATURATION: CommandId = 0x06;
247 pub const MOVE_TO_COLOR: CommandId = 0x07;
249 pub const MOVE_COLOR: CommandId = 0x08;
251 pub const STEP_COLOR: CommandId = 0x09;
253 pub const MOVE_TO_COLOR_TEMPERATURE: CommandId = 0x0A;
255 pub const ENHANCED_MOVE_TO_HUE: CommandId = 0x40;
257 pub const ENHANCED_MOVE_HUE: CommandId = 0x41;
259 pub const ENHANCED_STEP_HUE: CommandId = 0x42;
261 pub const ENHANCED_MOVE_TO_HUE_AND_SATURATION: CommandId = 0x43;
263 pub const COLOR_LOOP_SET: CommandId = 0x44;
265 pub const STOP_MOVE_STEP: CommandId = 0x47;
267 pub const MOVE_COLOR_TEMPERATURE: CommandId = 0x4B;
269 pub const STEP_COLOR_TEMPERATURE: CommandId = 0x4C;
271}
272
273#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
275#[repr(u8)]
276pub enum ColorLoopActionEnum {
277 Deactivate = 0,
279 ActivateFromColorLoopStartEnhancedHue = 1,
281 ActivateFromEnhancedCurrentHue = 2,
283}
284
285impl ColorLoopActionEnum {
286 #[must_use]
288 pub const fn from_value(value: u8) -> Option<Self> {
289 match value {
290 0 => Some(Self::Deactivate),
291 1 => Some(Self::ActivateFromColorLoopStartEnhancedHue),
292 2 => Some(Self::ActivateFromEnhancedCurrentHue),
293 _ => None,
294 }
295 }
296
297 #[must_use]
299 pub const fn value(self) -> u8 {
300 self as u8
301 }
302}
303
304impl ToTlv for ColorLoopActionEnum {
305 fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
306 self.value().to_tlv(w, tag)
307 }
308}
309
310impl<'a> FromTlv<'a> for ColorLoopActionEnum {
311 fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
312 let value = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
313 Self::from_value(value).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
314 }
315}
316
317#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
319#[repr(u8)]
320pub enum ColorLoopDirectionEnum {
321 Decrement = 0,
323 Increment = 1,
325}
326
327impl ColorLoopDirectionEnum {
328 #[must_use]
330 pub const fn from_value(value: u8) -> Option<Self> {
331 match value {
332 0 => Some(Self::Decrement),
333 1 => Some(Self::Increment),
334 _ => None,
335 }
336 }
337
338 #[must_use]
340 pub const fn value(self) -> u8 {
341 self as u8
342 }
343}
344
345impl ToTlv for ColorLoopDirectionEnum {
346 fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
347 self.value().to_tlv(w, tag)
348 }
349}
350
351impl<'a> FromTlv<'a> for ColorLoopDirectionEnum {
352 fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
353 let value = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
354 Self::from_value(value).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
355 }
356}
357
358#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
360#[repr(u8)]
361pub enum ColorModeEnum {
362 CurrentHueAndCurrentSaturation = 0,
364 CurrentXAndCurrentY = 1,
366 ColorTemperatureMireds = 2,
368}
369
370impl ColorModeEnum {
371 #[must_use]
373 pub const fn from_value(value: u8) -> Option<Self> {
374 match value {
375 0 => Some(Self::CurrentHueAndCurrentSaturation),
376 1 => Some(Self::CurrentXAndCurrentY),
377 2 => Some(Self::ColorTemperatureMireds),
378 _ => None,
379 }
380 }
381
382 #[must_use]
384 pub const fn value(self) -> u8 {
385 self as u8
386 }
387}
388
389impl ToTlv for ColorModeEnum {
390 fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
391 self.value().to_tlv(w, tag)
392 }
393}
394
395impl<'a> FromTlv<'a> for ColorModeEnum {
396 fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
397 let value = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
398 Self::from_value(value).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
399 }
400}
401
402#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
404#[repr(u8)]
405pub enum DirectionEnum {
406 Shortest = 0,
408 Longest = 1,
410 Up = 2,
412 Down = 3,
414}
415
416impl DirectionEnum {
417 #[must_use]
419 pub const fn from_value(value: u8) -> Option<Self> {
420 match value {
421 0 => Some(Self::Shortest),
422 1 => Some(Self::Longest),
423 2 => Some(Self::Up),
424 3 => Some(Self::Down),
425 _ => None,
426 }
427 }
428
429 #[must_use]
431 pub const fn value(self) -> u8 {
432 self as u8
433 }
434}
435
436impl ToTlv for DirectionEnum {
437 fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
438 self.value().to_tlv(w, tag)
439 }
440}
441
442impl<'a> FromTlv<'a> for DirectionEnum {
443 fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
444 let value = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
445 Self::from_value(value).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
446 }
447}
448
449#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
451#[repr(u8)]
452pub enum DriftCompensationEnum {
453 None = 0,
455 OtherOrUnknown = 1,
457 TemperatureMonitoring = 2,
459 OpticalLuminanceMonitoringAndFeedback = 3,
461 OpticalColorMonitoringAndFeedback = 4,
463}
464
465impl DriftCompensationEnum {
466 #[must_use]
468 pub const fn from_value(value: u8) -> Option<Self> {
469 match value {
470 0 => Some(Self::None),
471 1 => Some(Self::OtherOrUnknown),
472 2 => Some(Self::TemperatureMonitoring),
473 3 => Some(Self::OpticalLuminanceMonitoringAndFeedback),
474 4 => Some(Self::OpticalColorMonitoringAndFeedback),
475 _ => None,
476 }
477 }
478
479 #[must_use]
481 pub const fn value(self) -> u8 {
482 self as u8
483 }
484}
485
486impl ToTlv for DriftCompensationEnum {
487 fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
488 self.value().to_tlv(w, tag)
489 }
490}
491
492impl<'a> FromTlv<'a> for DriftCompensationEnum {
493 fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
494 let value = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
495 Self::from_value(value).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
496 }
497}
498
499#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
501#[repr(u8)]
502pub enum EnhancedColorModeEnum {
503 CurrentHueAndCurrentSaturation = 0,
505 CurrentXAndCurrentY = 1,
507 ColorTemperatureMireds = 2,
509 EnhancedCurrentHueAndCurrentSaturation = 3,
511}
512
513impl EnhancedColorModeEnum {
514 #[must_use]
516 pub const fn from_value(value: u8) -> Option<Self> {
517 match value {
518 0 => Some(Self::CurrentHueAndCurrentSaturation),
519 1 => Some(Self::CurrentXAndCurrentY),
520 2 => Some(Self::ColorTemperatureMireds),
521 3 => Some(Self::EnhancedCurrentHueAndCurrentSaturation),
522 _ => None,
523 }
524 }
525
526 #[must_use]
528 pub const fn value(self) -> u8 {
529 self as u8
530 }
531}
532
533impl ToTlv for EnhancedColorModeEnum {
534 fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
535 self.value().to_tlv(w, tag)
536 }
537}
538
539impl<'a> FromTlv<'a> for EnhancedColorModeEnum {
540 fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
541 let value = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
542 Self::from_value(value).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
543 }
544}
545
546#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
548#[repr(u8)]
549pub enum MoveModeEnum {
550 Stop = 0,
552 Up = 1,
554 Down = 3,
556}
557
558impl MoveModeEnum {
559 #[must_use]
561 pub const fn from_value(value: u8) -> Option<Self> {
562 match value {
563 0 => Some(Self::Stop),
564 1 => Some(Self::Up),
565 3 => Some(Self::Down),
566 _ => None,
567 }
568 }
569
570 #[must_use]
572 pub const fn value(self) -> u8 {
573 self as u8
574 }
575}
576
577impl ToTlv for MoveModeEnum {
578 fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
579 self.value().to_tlv(w, tag)
580 }
581}
582
583impl<'a> FromTlv<'a> for MoveModeEnum {
584 fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
585 let value = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
586 Self::from_value(value).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
587 }
588}
589
590#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
592#[repr(u8)]
593pub enum StepModeEnum {
594 Up = 1,
596 Down = 3,
598}
599
600impl StepModeEnum {
601 #[must_use]
603 pub const fn from_value(value: u8) -> Option<Self> {
604 match value {
605 1 => Some(Self::Up),
606 3 => Some(Self::Down),
607 _ => None,
608 }
609 }
610
611 #[must_use]
613 pub const fn value(self) -> u8 {
614 self as u8
615 }
616}
617
618impl ToTlv for StepModeEnum {
619 fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
620 self.value().to_tlv(w, tag)
621 }
622}
623
624impl<'a> FromTlv<'a> for StepModeEnum {
625 fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
626 let value = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
627 Self::from_value(value).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
628 }
629}
630
631bitflags::bitflags! {
632 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default)]
634 pub struct ColorCapabilitiesBitmap: u8 {
635 const HUE_SATURATION = 1 << 0;
637 const ENHANCED_HUE = 1 << 1;
639 const COLOR_LOOP = 1 << 2;
641 const XY = 1 << 3;
643 const COLOR_TEMPERATURE = 1 << 4;
645 }
646}
647
648impl ToTlv for ColorCapabilitiesBitmap {
649 fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
650 self.bits().to_tlv(w, tag)
651 }
652}
653
654impl<'a> FromTlv<'a> for ColorCapabilitiesBitmap {
655 fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
656 let bits = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
657 Self::from_bits(bits).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
658 }
659}
660
661bitflags::bitflags! {
662 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default)]
664 pub struct OptionsBitmap: u8 {
665 const EXECUTE_IF_OFF = 1 << 0;
667 }
668}
669
670impl ToTlv for OptionsBitmap {
671 fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
672 self.bits().to_tlv(w, tag)
673 }
674}
675
676impl<'a> FromTlv<'a> for OptionsBitmap {
677 fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
678 let bits = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
679 Self::from_bits(bits).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
680 }
681}
682
683bitflags::bitflags! {
684 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default)]
686 pub struct UpdateFlagsBitmap: u8 {
687 const UPDATE_ACTION = 1 << 0;
689 const UPDATE_DIRECTION = 1 << 1;
691 const UPDATE_TIME = 1 << 2;
693 const UPDATE_START_HUE = 1 << 3;
695 }
696}
697
698impl ToTlv for UpdateFlagsBitmap {
699 fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
700 self.bits().to_tlv(w, tag)
701 }
702}
703
704impl<'a> FromTlv<'a> for UpdateFlagsBitmap {
705 fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
706 let bits = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
707 Self::from_bits(bits).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
708 }
709}
710
711#[derive(Debug, Clone, Copy, PartialEq)]
713pub struct MoveToHueFields {
714 pub hue: u8,
716 pub direction: DirectionEnum,
718 pub transition_time: u16,
720 pub options_mask: OptionsBitmap,
722 pub options_override: OptionsBitmap,
724}
725
726impl ToTlv for MoveToHueFields {
727 fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
728 w.start_structure(tag)?;
729 self.hue.to_tlv(w, Tag::Context(0))?;
730 self.direction.to_tlv(w, Tag::Context(1))?;
731 self.transition_time.to_tlv(w, Tag::Context(2))?;
732 self.options_mask.to_tlv(w, Tag::Context(3))?;
733 self.options_override.to_tlv(w, Tag::Context(4))?;
734 w.end_container()
735 }
736}
737
738impl<'a> FromTlv<'a> for MoveToHueFields {
739 fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
740 if element.value.container() != Some(ContainerKind::Structure) {
741 return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
742 }
743 let mut hue = None;
744 let mut direction = None;
745 let mut transition_time = None;
746 let mut options_mask = None;
747 let mut options_override = None;
748 loop {
749 let Some(field) = reader.next_element()? else {
750 return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
751 };
752 if field.value == Value::EndOfContainer {
753 break;
754 }
755 match field.tag.context() {
756 Some(0) => hue = Some(<u8>::from_tlv(reader, &field)?),
757 Some(1) => direction = Some(<DirectionEnum>::from_tlv(reader, &field)?),
758 Some(2) => transition_time = Some(<u16>::from_tlv(reader, &field)?),
759 Some(3) => options_mask = Some(<OptionsBitmap>::from_tlv(reader, &field)?),
760 Some(4) => options_override = Some(<OptionsBitmap>::from_tlv(reader, &field)?),
761 _ => reader.skip_value(&field)?,
765 }
766 }
767 Ok(Self {
768 hue: hue.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
769 direction: direction.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
770 transition_time: transition_time
771 .ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
772 options_mask: options_mask.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
773 options_override: options_override
774 .ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
775 })
776 }
777}
778
779#[derive(Debug, Clone, Copy, PartialEq)]
781pub struct MoveHueFields {
782 pub move_mode: MoveModeEnum,
784 pub rate: u8,
786 pub options_mask: OptionsBitmap,
788 pub options_override: OptionsBitmap,
790}
791
792impl ToTlv for MoveHueFields {
793 fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
794 w.start_structure(tag)?;
795 self.move_mode.to_tlv(w, Tag::Context(0))?;
796 self.rate.to_tlv(w, Tag::Context(1))?;
797 self.options_mask.to_tlv(w, Tag::Context(2))?;
798 self.options_override.to_tlv(w, Tag::Context(3))?;
799 w.end_container()
800 }
801}
802
803impl<'a> FromTlv<'a> for MoveHueFields {
804 fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
805 if element.value.container() != Some(ContainerKind::Structure) {
806 return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
807 }
808 let mut move_mode = None;
809 let mut rate = None;
810 let mut options_mask = None;
811 let mut options_override = None;
812 loop {
813 let Some(field) = reader.next_element()? else {
814 return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
815 };
816 if field.value == Value::EndOfContainer {
817 break;
818 }
819 match field.tag.context() {
820 Some(0) => move_mode = Some(<MoveModeEnum>::from_tlv(reader, &field)?),
821 Some(1) => rate = Some(<u8>::from_tlv(reader, &field)?),
822 Some(2) => options_mask = Some(<OptionsBitmap>::from_tlv(reader, &field)?),
823 Some(3) => options_override = Some(<OptionsBitmap>::from_tlv(reader, &field)?),
824 _ => reader.skip_value(&field)?,
828 }
829 }
830 Ok(Self {
831 move_mode: move_mode.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
832 rate: rate.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
833 options_mask: options_mask.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
834 options_override: options_override
835 .ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
836 })
837 }
838}
839
840#[derive(Debug, Clone, Copy, PartialEq)]
842pub struct StepHueFields {
843 pub step_mode: StepModeEnum,
845 pub step_size: u8,
847 pub transition_time: u8,
849 pub options_mask: OptionsBitmap,
851 pub options_override: OptionsBitmap,
853}
854
855impl ToTlv for StepHueFields {
856 fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
857 w.start_structure(tag)?;
858 self.step_mode.to_tlv(w, Tag::Context(0))?;
859 self.step_size.to_tlv(w, Tag::Context(1))?;
860 self.transition_time.to_tlv(w, Tag::Context(2))?;
861 self.options_mask.to_tlv(w, Tag::Context(3))?;
862 self.options_override.to_tlv(w, Tag::Context(4))?;
863 w.end_container()
864 }
865}
866
867impl<'a> FromTlv<'a> for StepHueFields {
868 fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
869 if element.value.container() != Some(ContainerKind::Structure) {
870 return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
871 }
872 let mut step_mode = None;
873 let mut step_size = None;
874 let mut transition_time = None;
875 let mut options_mask = None;
876 let mut options_override = None;
877 loop {
878 let Some(field) = reader.next_element()? else {
879 return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
880 };
881 if field.value == Value::EndOfContainer {
882 break;
883 }
884 match field.tag.context() {
885 Some(0) => step_mode = Some(<StepModeEnum>::from_tlv(reader, &field)?),
886 Some(1) => step_size = Some(<u8>::from_tlv(reader, &field)?),
887 Some(2) => transition_time = Some(<u8>::from_tlv(reader, &field)?),
888 Some(3) => options_mask = Some(<OptionsBitmap>::from_tlv(reader, &field)?),
889 Some(4) => options_override = Some(<OptionsBitmap>::from_tlv(reader, &field)?),
890 _ => reader.skip_value(&field)?,
894 }
895 }
896 Ok(Self {
897 step_mode: step_mode.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
898 step_size: step_size.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
899 transition_time: transition_time
900 .ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
901 options_mask: options_mask.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
902 options_override: options_override
903 .ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
904 })
905 }
906}
907
908#[derive(Debug, Clone, Copy, PartialEq)]
910pub struct MoveToSaturationFields {
911 pub saturation: u8,
913 pub transition_time: u16,
915 pub options_mask: OptionsBitmap,
917 pub options_override: OptionsBitmap,
919}
920
921impl ToTlv for MoveToSaturationFields {
922 fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
923 w.start_structure(tag)?;
924 self.saturation.to_tlv(w, Tag::Context(0))?;
925 self.transition_time.to_tlv(w, Tag::Context(1))?;
926 self.options_mask.to_tlv(w, Tag::Context(2))?;
927 self.options_override.to_tlv(w, Tag::Context(3))?;
928 w.end_container()
929 }
930}
931
932impl<'a> FromTlv<'a> for MoveToSaturationFields {
933 fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
934 if element.value.container() != Some(ContainerKind::Structure) {
935 return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
936 }
937 let mut saturation = None;
938 let mut transition_time = None;
939 let mut options_mask = None;
940 let mut options_override = None;
941 loop {
942 let Some(field) = reader.next_element()? else {
943 return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
944 };
945 if field.value == Value::EndOfContainer {
946 break;
947 }
948 match field.tag.context() {
949 Some(0) => saturation = Some(<u8>::from_tlv(reader, &field)?),
950 Some(1) => transition_time = Some(<u16>::from_tlv(reader, &field)?),
951 Some(2) => options_mask = Some(<OptionsBitmap>::from_tlv(reader, &field)?),
952 Some(3) => options_override = Some(<OptionsBitmap>::from_tlv(reader, &field)?),
953 _ => reader.skip_value(&field)?,
957 }
958 }
959 Ok(Self {
960 saturation: saturation.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
961 transition_time: transition_time
962 .ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
963 options_mask: options_mask.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
964 options_override: options_override
965 .ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
966 })
967 }
968}
969
970#[derive(Debug, Clone, Copy, PartialEq)]
972pub struct MoveSaturationFields {
973 pub move_mode: MoveModeEnum,
975 pub rate: u8,
977 pub options_mask: OptionsBitmap,
979 pub options_override: OptionsBitmap,
981}
982
983impl ToTlv for MoveSaturationFields {
984 fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
985 w.start_structure(tag)?;
986 self.move_mode.to_tlv(w, Tag::Context(0))?;
987 self.rate.to_tlv(w, Tag::Context(1))?;
988 self.options_mask.to_tlv(w, Tag::Context(2))?;
989 self.options_override.to_tlv(w, Tag::Context(3))?;
990 w.end_container()
991 }
992}
993
994impl<'a> FromTlv<'a> for MoveSaturationFields {
995 fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
996 if element.value.container() != Some(ContainerKind::Structure) {
997 return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
998 }
999 let mut move_mode = None;
1000 let mut rate = None;
1001 let mut options_mask = None;
1002 let mut options_override = None;
1003 loop {
1004 let Some(field) = reader.next_element()? else {
1005 return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
1006 };
1007 if field.value == Value::EndOfContainer {
1008 break;
1009 }
1010 match field.tag.context() {
1011 Some(0) => move_mode = Some(<MoveModeEnum>::from_tlv(reader, &field)?),
1012 Some(1) => rate = Some(<u8>::from_tlv(reader, &field)?),
1013 Some(2) => options_mask = Some(<OptionsBitmap>::from_tlv(reader, &field)?),
1014 Some(3) => options_override = Some(<OptionsBitmap>::from_tlv(reader, &field)?),
1015 _ => reader.skip_value(&field)?,
1019 }
1020 }
1021 Ok(Self {
1022 move_mode: move_mode.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1023 rate: rate.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1024 options_mask: options_mask.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1025 options_override: options_override
1026 .ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1027 })
1028 }
1029}
1030
1031#[derive(Debug, Clone, Copy, PartialEq)]
1033pub struct StepSaturationFields {
1034 pub step_mode: StepModeEnum,
1036 pub step_size: u8,
1038 pub transition_time: u8,
1040 pub options_mask: OptionsBitmap,
1042 pub options_override: OptionsBitmap,
1044}
1045
1046impl ToTlv for StepSaturationFields {
1047 fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
1048 w.start_structure(tag)?;
1049 self.step_mode.to_tlv(w, Tag::Context(0))?;
1050 self.step_size.to_tlv(w, Tag::Context(1))?;
1051 self.transition_time.to_tlv(w, Tag::Context(2))?;
1052 self.options_mask.to_tlv(w, Tag::Context(3))?;
1053 self.options_override.to_tlv(w, Tag::Context(4))?;
1054 w.end_container()
1055 }
1056}
1057
1058impl<'a> FromTlv<'a> for StepSaturationFields {
1059 fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
1060 if element.value.container() != Some(ContainerKind::Structure) {
1061 return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
1062 }
1063 let mut step_mode = None;
1064 let mut step_size = None;
1065 let mut transition_time = None;
1066 let mut options_mask = None;
1067 let mut options_override = None;
1068 loop {
1069 let Some(field) = reader.next_element()? else {
1070 return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
1071 };
1072 if field.value == Value::EndOfContainer {
1073 break;
1074 }
1075 match field.tag.context() {
1076 Some(0) => step_mode = Some(<StepModeEnum>::from_tlv(reader, &field)?),
1077 Some(1) => step_size = Some(<u8>::from_tlv(reader, &field)?),
1078 Some(2) => transition_time = Some(<u8>::from_tlv(reader, &field)?),
1079 Some(3) => options_mask = Some(<OptionsBitmap>::from_tlv(reader, &field)?),
1080 Some(4) => options_override = Some(<OptionsBitmap>::from_tlv(reader, &field)?),
1081 _ => reader.skip_value(&field)?,
1085 }
1086 }
1087 Ok(Self {
1088 step_mode: step_mode.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1089 step_size: step_size.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1090 transition_time: transition_time
1091 .ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1092 options_mask: options_mask.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1093 options_override: options_override
1094 .ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1095 })
1096 }
1097}
1098
1099#[derive(Debug, Clone, Copy, PartialEq)]
1101pub struct MoveToHueAndSaturationFields {
1102 pub hue: u8,
1104 pub saturation: u8,
1106 pub transition_time: u16,
1108 pub options_mask: OptionsBitmap,
1110 pub options_override: OptionsBitmap,
1112}
1113
1114impl ToTlv for MoveToHueAndSaturationFields {
1115 fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
1116 w.start_structure(tag)?;
1117 self.hue.to_tlv(w, Tag::Context(0))?;
1118 self.saturation.to_tlv(w, Tag::Context(1))?;
1119 self.transition_time.to_tlv(w, Tag::Context(2))?;
1120 self.options_mask.to_tlv(w, Tag::Context(3))?;
1121 self.options_override.to_tlv(w, Tag::Context(4))?;
1122 w.end_container()
1123 }
1124}
1125
1126impl<'a> FromTlv<'a> for MoveToHueAndSaturationFields {
1127 fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
1128 if element.value.container() != Some(ContainerKind::Structure) {
1129 return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
1130 }
1131 let mut hue = None;
1132 let mut saturation = None;
1133 let mut transition_time = None;
1134 let mut options_mask = None;
1135 let mut options_override = None;
1136 loop {
1137 let Some(field) = reader.next_element()? else {
1138 return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
1139 };
1140 if field.value == Value::EndOfContainer {
1141 break;
1142 }
1143 match field.tag.context() {
1144 Some(0) => hue = Some(<u8>::from_tlv(reader, &field)?),
1145 Some(1) => saturation = Some(<u8>::from_tlv(reader, &field)?),
1146 Some(2) => transition_time = Some(<u16>::from_tlv(reader, &field)?),
1147 Some(3) => options_mask = Some(<OptionsBitmap>::from_tlv(reader, &field)?),
1148 Some(4) => options_override = Some(<OptionsBitmap>::from_tlv(reader, &field)?),
1149 _ => reader.skip_value(&field)?,
1153 }
1154 }
1155 Ok(Self {
1156 hue: hue.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1157 saturation: saturation.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1158 transition_time: transition_time
1159 .ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1160 options_mask: options_mask.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1161 options_override: options_override
1162 .ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1163 })
1164 }
1165}
1166
1167#[derive(Debug, Clone, Copy, PartialEq)]
1169pub struct MoveToColorFields {
1170 pub color_x: u16,
1172 pub color_y: u16,
1174 pub transition_time: u16,
1176 pub options_mask: OptionsBitmap,
1178 pub options_override: OptionsBitmap,
1180}
1181
1182impl ToTlv for MoveToColorFields {
1183 fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
1184 w.start_structure(tag)?;
1185 self.color_x.to_tlv(w, Tag::Context(0))?;
1186 self.color_y.to_tlv(w, Tag::Context(1))?;
1187 self.transition_time.to_tlv(w, Tag::Context(2))?;
1188 self.options_mask.to_tlv(w, Tag::Context(3))?;
1189 self.options_override.to_tlv(w, Tag::Context(4))?;
1190 w.end_container()
1191 }
1192}
1193
1194impl<'a> FromTlv<'a> for MoveToColorFields {
1195 fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
1196 if element.value.container() != Some(ContainerKind::Structure) {
1197 return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
1198 }
1199 let mut color_x = None;
1200 let mut color_y = None;
1201 let mut transition_time = None;
1202 let mut options_mask = None;
1203 let mut options_override = None;
1204 loop {
1205 let Some(field) = reader.next_element()? else {
1206 return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
1207 };
1208 if field.value == Value::EndOfContainer {
1209 break;
1210 }
1211 match field.tag.context() {
1212 Some(0) => color_x = Some(<u16>::from_tlv(reader, &field)?),
1213 Some(1) => color_y = Some(<u16>::from_tlv(reader, &field)?),
1214 Some(2) => transition_time = Some(<u16>::from_tlv(reader, &field)?),
1215 Some(3) => options_mask = Some(<OptionsBitmap>::from_tlv(reader, &field)?),
1216 Some(4) => options_override = Some(<OptionsBitmap>::from_tlv(reader, &field)?),
1217 _ => reader.skip_value(&field)?,
1221 }
1222 }
1223 Ok(Self {
1224 color_x: color_x.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1225 color_y: color_y.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1226 transition_time: transition_time
1227 .ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1228 options_mask: options_mask.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1229 options_override: options_override
1230 .ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1231 })
1232 }
1233}
1234
1235#[derive(Debug, Clone, Copy, PartialEq)]
1237pub struct MoveColorFields {
1238 pub rate_x: i16,
1240 pub rate_y: i16,
1242 pub options_mask: OptionsBitmap,
1244 pub options_override: OptionsBitmap,
1246}
1247
1248impl ToTlv for MoveColorFields {
1249 fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
1250 w.start_structure(tag)?;
1251 self.rate_x.to_tlv(w, Tag::Context(0))?;
1252 self.rate_y.to_tlv(w, Tag::Context(1))?;
1253 self.options_mask.to_tlv(w, Tag::Context(2))?;
1254 self.options_override.to_tlv(w, Tag::Context(3))?;
1255 w.end_container()
1256 }
1257}
1258
1259impl<'a> FromTlv<'a> for MoveColorFields {
1260 fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
1261 if element.value.container() != Some(ContainerKind::Structure) {
1262 return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
1263 }
1264 let mut rate_x = None;
1265 let mut rate_y = None;
1266 let mut options_mask = None;
1267 let mut options_override = None;
1268 loop {
1269 let Some(field) = reader.next_element()? else {
1270 return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
1271 };
1272 if field.value == Value::EndOfContainer {
1273 break;
1274 }
1275 match field.tag.context() {
1276 Some(0) => rate_x = Some(<i16>::from_tlv(reader, &field)?),
1277 Some(1) => rate_y = Some(<i16>::from_tlv(reader, &field)?),
1278 Some(2) => options_mask = Some(<OptionsBitmap>::from_tlv(reader, &field)?),
1279 Some(3) => options_override = Some(<OptionsBitmap>::from_tlv(reader, &field)?),
1280 _ => reader.skip_value(&field)?,
1284 }
1285 }
1286 Ok(Self {
1287 rate_x: rate_x.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1288 rate_y: rate_y.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1289 options_mask: options_mask.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1290 options_override: options_override
1291 .ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1292 })
1293 }
1294}
1295
1296#[derive(Debug, Clone, Copy, PartialEq)]
1298pub struct StepColorFields {
1299 pub step_x: i16,
1301 pub step_y: i16,
1303 pub transition_time: u16,
1305 pub options_mask: OptionsBitmap,
1307 pub options_override: OptionsBitmap,
1309}
1310
1311impl ToTlv for StepColorFields {
1312 fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
1313 w.start_structure(tag)?;
1314 self.step_x.to_tlv(w, Tag::Context(0))?;
1315 self.step_y.to_tlv(w, Tag::Context(1))?;
1316 self.transition_time.to_tlv(w, Tag::Context(2))?;
1317 self.options_mask.to_tlv(w, Tag::Context(3))?;
1318 self.options_override.to_tlv(w, Tag::Context(4))?;
1319 w.end_container()
1320 }
1321}
1322
1323impl<'a> FromTlv<'a> for StepColorFields {
1324 fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
1325 if element.value.container() != Some(ContainerKind::Structure) {
1326 return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
1327 }
1328 let mut step_x = None;
1329 let mut step_y = None;
1330 let mut transition_time = None;
1331 let mut options_mask = None;
1332 let mut options_override = None;
1333 loop {
1334 let Some(field) = reader.next_element()? else {
1335 return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
1336 };
1337 if field.value == Value::EndOfContainer {
1338 break;
1339 }
1340 match field.tag.context() {
1341 Some(0) => step_x = Some(<i16>::from_tlv(reader, &field)?),
1342 Some(1) => step_y = Some(<i16>::from_tlv(reader, &field)?),
1343 Some(2) => transition_time = Some(<u16>::from_tlv(reader, &field)?),
1344 Some(3) => options_mask = Some(<OptionsBitmap>::from_tlv(reader, &field)?),
1345 Some(4) => options_override = Some(<OptionsBitmap>::from_tlv(reader, &field)?),
1346 _ => reader.skip_value(&field)?,
1350 }
1351 }
1352 Ok(Self {
1353 step_x: step_x.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1354 step_y: step_y.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1355 transition_time: transition_time
1356 .ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1357 options_mask: options_mask.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1358 options_override: options_override
1359 .ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1360 })
1361 }
1362}
1363
1364#[derive(Debug, Clone, Copy, PartialEq)]
1366pub struct MoveToColorTemperatureFields {
1367 pub color_temperature_mireds: u16,
1369 pub transition_time: u16,
1371 pub options_mask: OptionsBitmap,
1373 pub options_override: OptionsBitmap,
1375}
1376
1377impl ToTlv for MoveToColorTemperatureFields {
1378 fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
1379 w.start_structure(tag)?;
1380 self.color_temperature_mireds.to_tlv(w, Tag::Context(0))?;
1381 self.transition_time.to_tlv(w, Tag::Context(1))?;
1382 self.options_mask.to_tlv(w, Tag::Context(2))?;
1383 self.options_override.to_tlv(w, Tag::Context(3))?;
1384 w.end_container()
1385 }
1386}
1387
1388impl<'a> FromTlv<'a> for MoveToColorTemperatureFields {
1389 fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
1390 if element.value.container() != Some(ContainerKind::Structure) {
1391 return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
1392 }
1393 let mut color_temperature_mireds = None;
1394 let mut transition_time = None;
1395 let mut options_mask = None;
1396 let mut options_override = None;
1397 loop {
1398 let Some(field) = reader.next_element()? else {
1399 return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
1400 };
1401 if field.value == Value::EndOfContainer {
1402 break;
1403 }
1404 match field.tag.context() {
1405 Some(0) => color_temperature_mireds = Some(<u16>::from_tlv(reader, &field)?),
1406 Some(1) => transition_time = Some(<u16>::from_tlv(reader, &field)?),
1407 Some(2) => options_mask = Some(<OptionsBitmap>::from_tlv(reader, &field)?),
1408 Some(3) => options_override = Some(<OptionsBitmap>::from_tlv(reader, &field)?),
1409 _ => reader.skip_value(&field)?,
1413 }
1414 }
1415 Ok(Self {
1416 color_temperature_mireds: color_temperature_mireds
1417 .ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1418 transition_time: transition_time
1419 .ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1420 options_mask: options_mask.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1421 options_override: options_override
1422 .ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1423 })
1424 }
1425}
1426
1427#[derive(Debug, Clone, Copy, PartialEq)]
1429pub struct EnhancedMoveToHueFields {
1430 pub enhanced_hue: u16,
1432 pub direction: DirectionEnum,
1434 pub transition_time: u16,
1436 pub options_mask: OptionsBitmap,
1438 pub options_override: OptionsBitmap,
1440}
1441
1442impl ToTlv for EnhancedMoveToHueFields {
1443 fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
1444 w.start_structure(tag)?;
1445 self.enhanced_hue.to_tlv(w, Tag::Context(0))?;
1446 self.direction.to_tlv(w, Tag::Context(1))?;
1447 self.transition_time.to_tlv(w, Tag::Context(2))?;
1448 self.options_mask.to_tlv(w, Tag::Context(3))?;
1449 self.options_override.to_tlv(w, Tag::Context(4))?;
1450 w.end_container()
1451 }
1452}
1453
1454impl<'a> FromTlv<'a> for EnhancedMoveToHueFields {
1455 fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
1456 if element.value.container() != Some(ContainerKind::Structure) {
1457 return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
1458 }
1459 let mut enhanced_hue = None;
1460 let mut direction = None;
1461 let mut transition_time = None;
1462 let mut options_mask = None;
1463 let mut options_override = None;
1464 loop {
1465 let Some(field) = reader.next_element()? else {
1466 return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
1467 };
1468 if field.value == Value::EndOfContainer {
1469 break;
1470 }
1471 match field.tag.context() {
1472 Some(0) => enhanced_hue = Some(<u16>::from_tlv(reader, &field)?),
1473 Some(1) => direction = Some(<DirectionEnum>::from_tlv(reader, &field)?),
1474 Some(2) => transition_time = Some(<u16>::from_tlv(reader, &field)?),
1475 Some(3) => options_mask = Some(<OptionsBitmap>::from_tlv(reader, &field)?),
1476 Some(4) => options_override = Some(<OptionsBitmap>::from_tlv(reader, &field)?),
1477 _ => reader.skip_value(&field)?,
1481 }
1482 }
1483 Ok(Self {
1484 enhanced_hue: enhanced_hue.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1485 direction: direction.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1486 transition_time: transition_time
1487 .ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1488 options_mask: options_mask.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1489 options_override: options_override
1490 .ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1491 })
1492 }
1493}
1494
1495#[derive(Debug, Clone, Copy, PartialEq)]
1497pub struct EnhancedMoveHueFields {
1498 pub move_mode: MoveModeEnum,
1500 pub rate: u16,
1502 pub options_mask: OptionsBitmap,
1504 pub options_override: OptionsBitmap,
1506}
1507
1508impl ToTlv for EnhancedMoveHueFields {
1509 fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
1510 w.start_structure(tag)?;
1511 self.move_mode.to_tlv(w, Tag::Context(0))?;
1512 self.rate.to_tlv(w, Tag::Context(1))?;
1513 self.options_mask.to_tlv(w, Tag::Context(2))?;
1514 self.options_override.to_tlv(w, Tag::Context(3))?;
1515 w.end_container()
1516 }
1517}
1518
1519impl<'a> FromTlv<'a> for EnhancedMoveHueFields {
1520 fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
1521 if element.value.container() != Some(ContainerKind::Structure) {
1522 return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
1523 }
1524 let mut move_mode = None;
1525 let mut rate = None;
1526 let mut options_mask = None;
1527 let mut options_override = None;
1528 loop {
1529 let Some(field) = reader.next_element()? else {
1530 return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
1531 };
1532 if field.value == Value::EndOfContainer {
1533 break;
1534 }
1535 match field.tag.context() {
1536 Some(0) => move_mode = Some(<MoveModeEnum>::from_tlv(reader, &field)?),
1537 Some(1) => rate = Some(<u16>::from_tlv(reader, &field)?),
1538 Some(2) => options_mask = Some(<OptionsBitmap>::from_tlv(reader, &field)?),
1539 Some(3) => options_override = Some(<OptionsBitmap>::from_tlv(reader, &field)?),
1540 _ => reader.skip_value(&field)?,
1544 }
1545 }
1546 Ok(Self {
1547 move_mode: move_mode.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1548 rate: rate.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1549 options_mask: options_mask.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1550 options_override: options_override
1551 .ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1552 })
1553 }
1554}
1555
1556#[derive(Debug, Clone, Copy, PartialEq)]
1558pub struct EnhancedStepHueFields {
1559 pub step_mode: StepModeEnum,
1561 pub step_size: u16,
1563 pub transition_time: u16,
1565 pub options_mask: OptionsBitmap,
1567 pub options_override: OptionsBitmap,
1569}
1570
1571impl ToTlv for EnhancedStepHueFields {
1572 fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
1573 w.start_structure(tag)?;
1574 self.step_mode.to_tlv(w, Tag::Context(0))?;
1575 self.step_size.to_tlv(w, Tag::Context(1))?;
1576 self.transition_time.to_tlv(w, Tag::Context(2))?;
1577 self.options_mask.to_tlv(w, Tag::Context(3))?;
1578 self.options_override.to_tlv(w, Tag::Context(4))?;
1579 w.end_container()
1580 }
1581}
1582
1583impl<'a> FromTlv<'a> for EnhancedStepHueFields {
1584 fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
1585 if element.value.container() != Some(ContainerKind::Structure) {
1586 return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
1587 }
1588 let mut step_mode = None;
1589 let mut step_size = None;
1590 let mut transition_time = None;
1591 let mut options_mask = None;
1592 let mut options_override = None;
1593 loop {
1594 let Some(field) = reader.next_element()? else {
1595 return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
1596 };
1597 if field.value == Value::EndOfContainer {
1598 break;
1599 }
1600 match field.tag.context() {
1601 Some(0) => step_mode = Some(<StepModeEnum>::from_tlv(reader, &field)?),
1602 Some(1) => step_size = Some(<u16>::from_tlv(reader, &field)?),
1603 Some(2) => transition_time = Some(<u16>::from_tlv(reader, &field)?),
1604 Some(3) => options_mask = Some(<OptionsBitmap>::from_tlv(reader, &field)?),
1605 Some(4) => options_override = Some(<OptionsBitmap>::from_tlv(reader, &field)?),
1606 _ => reader.skip_value(&field)?,
1610 }
1611 }
1612 Ok(Self {
1613 step_mode: step_mode.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1614 step_size: step_size.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1615 transition_time: transition_time
1616 .ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1617 options_mask: options_mask.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1618 options_override: options_override
1619 .ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1620 })
1621 }
1622}
1623
1624#[derive(Debug, Clone, Copy, PartialEq)]
1626pub struct EnhancedMoveToHueAndSaturationFields {
1627 pub enhanced_hue: u16,
1629 pub saturation: u8,
1631 pub transition_time: u16,
1633 pub options_mask: OptionsBitmap,
1635 pub options_override: OptionsBitmap,
1637}
1638
1639impl ToTlv for EnhancedMoveToHueAndSaturationFields {
1640 fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
1641 w.start_structure(tag)?;
1642 self.enhanced_hue.to_tlv(w, Tag::Context(0))?;
1643 self.saturation.to_tlv(w, Tag::Context(1))?;
1644 self.transition_time.to_tlv(w, Tag::Context(2))?;
1645 self.options_mask.to_tlv(w, Tag::Context(3))?;
1646 self.options_override.to_tlv(w, Tag::Context(4))?;
1647 w.end_container()
1648 }
1649}
1650
1651impl<'a> FromTlv<'a> for EnhancedMoveToHueAndSaturationFields {
1652 fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
1653 if element.value.container() != Some(ContainerKind::Structure) {
1654 return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
1655 }
1656 let mut enhanced_hue = None;
1657 let mut saturation = None;
1658 let mut transition_time = None;
1659 let mut options_mask = None;
1660 let mut options_override = None;
1661 loop {
1662 let Some(field) = reader.next_element()? else {
1663 return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
1664 };
1665 if field.value == Value::EndOfContainer {
1666 break;
1667 }
1668 match field.tag.context() {
1669 Some(0) => enhanced_hue = Some(<u16>::from_tlv(reader, &field)?),
1670 Some(1) => saturation = Some(<u8>::from_tlv(reader, &field)?),
1671 Some(2) => transition_time = Some(<u16>::from_tlv(reader, &field)?),
1672 Some(3) => options_mask = Some(<OptionsBitmap>::from_tlv(reader, &field)?),
1673 Some(4) => options_override = Some(<OptionsBitmap>::from_tlv(reader, &field)?),
1674 _ => reader.skip_value(&field)?,
1678 }
1679 }
1680 Ok(Self {
1681 enhanced_hue: enhanced_hue.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1682 saturation: saturation.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1683 transition_time: transition_time
1684 .ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1685 options_mask: options_mask.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1686 options_override: options_override
1687 .ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1688 })
1689 }
1690}
1691
1692#[derive(Debug, Clone, Copy, PartialEq)]
1694pub struct ColorLoopSetFields {
1695 pub update_flags: UpdateFlagsBitmap,
1697 pub action: ColorLoopActionEnum,
1699 pub direction: ColorLoopDirectionEnum,
1701 pub time: u16,
1703 pub start_hue: u16,
1705 pub options_mask: OptionsBitmap,
1707 pub options_override: OptionsBitmap,
1709}
1710
1711impl ToTlv for ColorLoopSetFields {
1712 fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
1713 w.start_structure(tag)?;
1714 self.update_flags.to_tlv(w, Tag::Context(0))?;
1715 self.action.to_tlv(w, Tag::Context(1))?;
1716 self.direction.to_tlv(w, Tag::Context(2))?;
1717 self.time.to_tlv(w, Tag::Context(3))?;
1718 self.start_hue.to_tlv(w, Tag::Context(4))?;
1719 self.options_mask.to_tlv(w, Tag::Context(5))?;
1720 self.options_override.to_tlv(w, Tag::Context(6))?;
1721 w.end_container()
1722 }
1723}
1724
1725impl<'a> FromTlv<'a> for ColorLoopSetFields {
1726 fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
1727 if element.value.container() != Some(ContainerKind::Structure) {
1728 return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
1729 }
1730 let mut update_flags = None;
1731 let mut action = None;
1732 let mut direction = None;
1733 let mut time = None;
1734 let mut start_hue = None;
1735 let mut options_mask = None;
1736 let mut options_override = None;
1737 loop {
1738 let Some(field) = reader.next_element()? else {
1739 return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
1740 };
1741 if field.value == Value::EndOfContainer {
1742 break;
1743 }
1744 match field.tag.context() {
1745 Some(0) => update_flags = Some(<UpdateFlagsBitmap>::from_tlv(reader, &field)?),
1746 Some(1) => action = Some(<ColorLoopActionEnum>::from_tlv(reader, &field)?),
1747 Some(2) => direction = Some(<ColorLoopDirectionEnum>::from_tlv(reader, &field)?),
1748 Some(3) => time = Some(<u16>::from_tlv(reader, &field)?),
1749 Some(4) => start_hue = Some(<u16>::from_tlv(reader, &field)?),
1750 Some(5) => options_mask = Some(<OptionsBitmap>::from_tlv(reader, &field)?),
1751 Some(6) => options_override = Some(<OptionsBitmap>::from_tlv(reader, &field)?),
1752 _ => reader.skip_value(&field)?,
1756 }
1757 }
1758 Ok(Self {
1759 update_flags: update_flags.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1760 action: action.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1761 direction: direction.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1762 time: time.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1763 start_hue: start_hue.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1764 options_mask: options_mask.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1765 options_override: options_override
1766 .ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1767 })
1768 }
1769}
1770
1771#[derive(Debug, Clone, Copy, PartialEq)]
1773pub struct StopMoveStepFields {
1774 pub options_mask: OptionsBitmap,
1776 pub options_override: OptionsBitmap,
1778}
1779
1780impl ToTlv for StopMoveStepFields {
1781 fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
1782 w.start_structure(tag)?;
1783 self.options_mask.to_tlv(w, Tag::Context(0))?;
1784 self.options_override.to_tlv(w, Tag::Context(1))?;
1785 w.end_container()
1786 }
1787}
1788
1789impl<'a> FromTlv<'a> for StopMoveStepFields {
1790 fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
1791 if element.value.container() != Some(ContainerKind::Structure) {
1792 return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
1793 }
1794 let mut options_mask = None;
1795 let mut options_override = None;
1796 loop {
1797 let Some(field) = reader.next_element()? else {
1798 return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
1799 };
1800 if field.value == Value::EndOfContainer {
1801 break;
1802 }
1803 match field.tag.context() {
1804 Some(0) => options_mask = Some(<OptionsBitmap>::from_tlv(reader, &field)?),
1805 Some(1) => options_override = Some(<OptionsBitmap>::from_tlv(reader, &field)?),
1806 _ => reader.skip_value(&field)?,
1810 }
1811 }
1812 Ok(Self {
1813 options_mask: options_mask.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1814 options_override: options_override
1815 .ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1816 })
1817 }
1818}
1819
1820#[derive(Debug, Clone, Copy, PartialEq)]
1822pub struct MoveColorTemperatureFields {
1823 pub move_mode: MoveModeEnum,
1825 pub rate: u16,
1827 pub color_temperature_minimum_mireds: u16,
1829 pub color_temperature_maximum_mireds: u16,
1831 pub options_mask: OptionsBitmap,
1833 pub options_override: OptionsBitmap,
1835}
1836
1837impl ToTlv for MoveColorTemperatureFields {
1838 fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
1839 w.start_structure(tag)?;
1840 self.move_mode.to_tlv(w, Tag::Context(0))?;
1841 self.rate.to_tlv(w, Tag::Context(1))?;
1842 self.color_temperature_minimum_mireds
1843 .to_tlv(w, Tag::Context(2))?;
1844 self.color_temperature_maximum_mireds
1845 .to_tlv(w, Tag::Context(3))?;
1846 self.options_mask.to_tlv(w, Tag::Context(4))?;
1847 self.options_override.to_tlv(w, Tag::Context(5))?;
1848 w.end_container()
1849 }
1850}
1851
1852impl<'a> FromTlv<'a> for MoveColorTemperatureFields {
1853 fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
1854 if element.value.container() != Some(ContainerKind::Structure) {
1855 return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
1856 }
1857 let mut move_mode = None;
1858 let mut rate = None;
1859 let mut color_temperature_minimum_mireds = None;
1860 let mut color_temperature_maximum_mireds = None;
1861 let mut options_mask = None;
1862 let mut options_override = None;
1863 loop {
1864 let Some(field) = reader.next_element()? else {
1865 return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
1866 };
1867 if field.value == Value::EndOfContainer {
1868 break;
1869 }
1870 match field.tag.context() {
1871 Some(0) => move_mode = Some(<MoveModeEnum>::from_tlv(reader, &field)?),
1872 Some(1) => rate = Some(<u16>::from_tlv(reader, &field)?),
1873 Some(2) => {
1874 color_temperature_minimum_mireds = Some(<u16>::from_tlv(reader, &field)?)
1875 }
1876 Some(3) => {
1877 color_temperature_maximum_mireds = Some(<u16>::from_tlv(reader, &field)?)
1878 }
1879 Some(4) => options_mask = Some(<OptionsBitmap>::from_tlv(reader, &field)?),
1880 Some(5) => options_override = Some(<OptionsBitmap>::from_tlv(reader, &field)?),
1881 _ => reader.skip_value(&field)?,
1885 }
1886 }
1887 Ok(Self {
1888 move_mode: move_mode.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1889 rate: rate.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1890 color_temperature_minimum_mireds: color_temperature_minimum_mireds
1891 .ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1892 color_temperature_maximum_mireds: color_temperature_maximum_mireds
1893 .ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1894 options_mask: options_mask.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1895 options_override: options_override
1896 .ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1897 })
1898 }
1899}
1900
1901#[derive(Debug, Clone, Copy, PartialEq)]
1903pub struct StepColorTemperatureFields {
1904 pub step_mode: StepModeEnum,
1906 pub step_size: u16,
1908 pub transition_time: u16,
1910 pub color_temperature_minimum_mireds: u16,
1912 pub color_temperature_maximum_mireds: u16,
1914 pub options_mask: OptionsBitmap,
1916 pub options_override: OptionsBitmap,
1918}
1919
1920impl ToTlv for StepColorTemperatureFields {
1921 fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
1922 w.start_structure(tag)?;
1923 self.step_mode.to_tlv(w, Tag::Context(0))?;
1924 self.step_size.to_tlv(w, Tag::Context(1))?;
1925 self.transition_time.to_tlv(w, Tag::Context(2))?;
1926 self.color_temperature_minimum_mireds
1927 .to_tlv(w, Tag::Context(3))?;
1928 self.color_temperature_maximum_mireds
1929 .to_tlv(w, Tag::Context(4))?;
1930 self.options_mask.to_tlv(w, Tag::Context(5))?;
1931 self.options_override.to_tlv(w, Tag::Context(6))?;
1932 w.end_container()
1933 }
1934}
1935
1936impl<'a> FromTlv<'a> for StepColorTemperatureFields {
1937 fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
1938 if element.value.container() != Some(ContainerKind::Structure) {
1939 return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
1940 }
1941 let mut step_mode = None;
1942 let mut step_size = None;
1943 let mut transition_time = None;
1944 let mut color_temperature_minimum_mireds = None;
1945 let mut color_temperature_maximum_mireds = None;
1946 let mut options_mask = None;
1947 let mut options_override = None;
1948 loop {
1949 let Some(field) = reader.next_element()? else {
1950 return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
1951 };
1952 if field.value == Value::EndOfContainer {
1953 break;
1954 }
1955 match field.tag.context() {
1956 Some(0) => step_mode = Some(<StepModeEnum>::from_tlv(reader, &field)?),
1957 Some(1) => step_size = Some(<u16>::from_tlv(reader, &field)?),
1958 Some(2) => transition_time = Some(<u16>::from_tlv(reader, &field)?),
1959 Some(3) => {
1960 color_temperature_minimum_mireds = Some(<u16>::from_tlv(reader, &field)?)
1961 }
1962 Some(4) => {
1963 color_temperature_maximum_mireds = Some(<u16>::from_tlv(reader, &field)?)
1964 }
1965 Some(5) => options_mask = Some(<OptionsBitmap>::from_tlv(reader, &field)?),
1966 Some(6) => options_override = Some(<OptionsBitmap>::from_tlv(reader, &field)?),
1967 _ => reader.skip_value(&field)?,
1971 }
1972 }
1973 Ok(Self {
1974 step_mode: step_mode.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1975 step_size: step_size.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1976 transition_time: transition_time
1977 .ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1978 color_temperature_minimum_mireds: color_temperature_minimum_mireds
1979 .ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1980 color_temperature_maximum_mireds: color_temperature_maximum_mireds
1981 .ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1982 options_mask: options_mask.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1983 options_override: options_override
1984 .ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
1985 })
1986 }
1987}
1988
1989pub const ATTRIBUTES: &[Attribute] = &[
1991 Attribute {
1992 id: 0x0000,
1993 name: "CurrentHue",
1994 kind: "uint8",
1995 access: Access::read_only(Privilege::View),
1996 qualities: AttributeQualities::NON_VOLATILE,
1997 reporting: Reporting::Quieter,
1998 conform: Conform {
1999 clauses: &[Clause {
2000 verdict: Conformance::Mandatory,
2001 when: Condition::Feature(0),
2002 }],
2003 },
2004 },
2005 Attribute {
2006 id: 0x0001,
2007 name: "CurrentSaturation",
2008 kind: "uint8",
2009 access: Access::read_only(Privilege::View),
2010 qualities: AttributeQualities::NON_VOLATILE.union(AttributeQualities::SCENE),
2011 reporting: Reporting::Quieter,
2012 conform: Conform {
2013 clauses: &[Clause {
2014 verdict: Conformance::Mandatory,
2015 when: Condition::Feature(0),
2016 }],
2017 },
2018 },
2019 Attribute {
2020 id: 0x0002,
2021 name: "RemainingTime",
2022 kind: "uint16",
2023 access: Access::read_only(Privilege::View),
2024 qualities: AttributeQualities::empty(),
2025 reporting: Reporting::Quieter,
2026 conform: Conform::OPTIONAL,
2027 },
2028 Attribute {
2029 id: 0x0003,
2030 name: "CurrentX",
2031 kind: "uint16",
2032 access: Access::read_only(Privilege::View),
2033 qualities: AttributeQualities::NON_VOLATILE.union(AttributeQualities::SCENE),
2034 reporting: Reporting::Quieter,
2035 conform: Conform {
2036 clauses: &[Clause {
2037 verdict: Conformance::Mandatory,
2038 when: Condition::Feature(3),
2039 }],
2040 },
2041 },
2042 Attribute {
2043 id: 0x0004,
2044 name: "CurrentY",
2045 kind: "uint16",
2046 access: Access::read_only(Privilege::View),
2047 qualities: AttributeQualities::NON_VOLATILE.union(AttributeQualities::SCENE),
2048 reporting: Reporting::Quieter,
2049 conform: Conform {
2050 clauses: &[Clause {
2051 verdict: Conformance::Mandatory,
2052 when: Condition::Feature(3),
2053 }],
2054 },
2055 },
2056 Attribute {
2057 id: 0x0005,
2058 name: "DriftCompensation",
2059 kind: "DriftCompensationEnum",
2060 access: Access::read_only(Privilege::View),
2061 qualities: AttributeQualities::empty(),
2062 reporting: Reporting::OnChange,
2063 conform: Conform::OPTIONAL,
2064 },
2065 Attribute {
2066 id: 0x0006,
2067 name: "CompensationText",
2068 kind: "string",
2069 access: Access::read_only(Privilege::View),
2070 qualities: AttributeQualities::empty(),
2071 reporting: Reporting::OnChange,
2072 conform: Conform::OPTIONAL,
2073 },
2074 Attribute {
2075 id: 0x0007,
2076 name: "ColorTemperatureMireds",
2077 kind: "uint16",
2078 access: Access::read_only(Privilege::View),
2079 qualities: AttributeQualities::NON_VOLATILE.union(AttributeQualities::SCENE),
2080 reporting: Reporting::Quieter,
2081 conform: Conform {
2082 clauses: &[Clause {
2083 verdict: Conformance::Mandatory,
2084 when: Condition::Feature(4),
2085 }],
2086 },
2087 },
2088 Attribute {
2089 id: 0x0008,
2090 name: "ColorMode",
2091 kind: "ColorModeEnum",
2092 access: Access::read_only(Privilege::View),
2093 qualities: AttributeQualities::NON_VOLATILE,
2094 reporting: Reporting::OnChange,
2095 conform: Conform::MANDATORY,
2096 },
2097 Attribute {
2098 id: 0x000F,
2099 name: "Options",
2100 kind: "OptionsBitmap",
2101 access: Access::read_write_with(Privilege::View, Privilege::Operate),
2102 qualities: AttributeQualities::empty(),
2103 reporting: Reporting::OnChange,
2104 conform: Conform::MANDATORY,
2105 },
2106 Attribute {
2107 id: 0x0010,
2108 name: "NumberOfPrimaries",
2109 kind: "uint8",
2110 access: Access::read_only(Privilege::View),
2111 qualities: AttributeQualities::NULLABLE.union(AttributeQualities::FIXED),
2112 reporting: Reporting::OnChange,
2113 conform: Conform::MANDATORY,
2114 },
2115 Attribute {
2116 id: 0x0011,
2117 name: "Primary1X",
2118 kind: "uint16",
2119 access: Access::read_only(Privilege::View),
2120 qualities: AttributeQualities::FIXED,
2121 reporting: Reporting::OnChange,
2122 conform: Conform {
2123 clauses: &[
2124 Clause {
2125 verdict: Conformance::Described,
2126 when: Condition::Named("comparison"),
2127 },
2128 Clause {
2129 verdict: Conformance::Optional,
2130 when: Condition::Always,
2131 },
2132 ],
2133 },
2134 },
2135 Attribute {
2136 id: 0x0012,
2137 name: "Primary1Y",
2138 kind: "uint16",
2139 access: Access::read_only(Privilege::View),
2140 qualities: AttributeQualities::FIXED,
2141 reporting: Reporting::OnChange,
2142 conform: Conform {
2143 clauses: &[
2144 Clause {
2145 verdict: Conformance::Described,
2146 when: Condition::Named("comparison"),
2147 },
2148 Clause {
2149 verdict: Conformance::Optional,
2150 when: Condition::Always,
2151 },
2152 ],
2153 },
2154 },
2155 Attribute {
2156 id: 0x0013,
2157 name: "Primary1Intensity",
2158 kind: "uint8",
2159 access: Access::read_only(Privilege::View),
2160 qualities: AttributeQualities::NULLABLE.union(AttributeQualities::FIXED),
2161 reporting: Reporting::OnChange,
2162 conform: Conform {
2163 clauses: &[
2164 Clause {
2165 verdict: Conformance::Described,
2166 when: Condition::Named("comparison"),
2167 },
2168 Clause {
2169 verdict: Conformance::Optional,
2170 when: Condition::Always,
2171 },
2172 ],
2173 },
2174 },
2175 Attribute {
2176 id: 0x0015,
2177 name: "Primary2X",
2178 kind: "uint16",
2179 access: Access::read_only(Privilege::View),
2180 qualities: AttributeQualities::FIXED,
2181 reporting: Reporting::OnChange,
2182 conform: Conform {
2183 clauses: &[
2184 Clause {
2185 verdict: Conformance::Described,
2186 when: Condition::Named("comparison"),
2187 },
2188 Clause {
2189 verdict: Conformance::Optional,
2190 when: Condition::Always,
2191 },
2192 ],
2193 },
2194 },
2195 Attribute {
2196 id: 0x0016,
2197 name: "Primary2Y",
2198 kind: "uint16",
2199 access: Access::read_only(Privilege::View),
2200 qualities: AttributeQualities::FIXED,
2201 reporting: Reporting::OnChange,
2202 conform: Conform {
2203 clauses: &[
2204 Clause {
2205 verdict: Conformance::Described,
2206 when: Condition::Named("comparison"),
2207 },
2208 Clause {
2209 verdict: Conformance::Optional,
2210 when: Condition::Always,
2211 },
2212 ],
2213 },
2214 },
2215 Attribute {
2216 id: 0x0017,
2217 name: "Primary2Intensity",
2218 kind: "uint8",
2219 access: Access::read_only(Privilege::View),
2220 qualities: AttributeQualities::NULLABLE.union(AttributeQualities::FIXED),
2221 reporting: Reporting::OnChange,
2222 conform: Conform {
2223 clauses: &[
2224 Clause {
2225 verdict: Conformance::Described,
2226 when: Condition::Named("comparison"),
2227 },
2228 Clause {
2229 verdict: Conformance::Optional,
2230 when: Condition::Always,
2231 },
2232 ],
2233 },
2234 },
2235 Attribute {
2236 id: 0x0019,
2237 name: "Primary3X",
2238 kind: "uint16",
2239 access: Access::read_only(Privilege::View),
2240 qualities: AttributeQualities::FIXED,
2241 reporting: Reporting::OnChange,
2242 conform: Conform {
2243 clauses: &[
2244 Clause {
2245 verdict: Conformance::Described,
2246 when: Condition::Named("comparison"),
2247 },
2248 Clause {
2249 verdict: Conformance::Optional,
2250 when: Condition::Always,
2251 },
2252 ],
2253 },
2254 },
2255 Attribute {
2256 id: 0x001A,
2257 name: "Primary3Y",
2258 kind: "uint16",
2259 access: Access::read_only(Privilege::View),
2260 qualities: AttributeQualities::FIXED,
2261 reporting: Reporting::OnChange,
2262 conform: Conform {
2263 clauses: &[
2264 Clause {
2265 verdict: Conformance::Described,
2266 when: Condition::Named("comparison"),
2267 },
2268 Clause {
2269 verdict: Conformance::Optional,
2270 when: Condition::Always,
2271 },
2272 ],
2273 },
2274 },
2275 Attribute {
2276 id: 0x001B,
2277 name: "Primary3Intensity",
2278 kind: "uint8",
2279 access: Access::read_only(Privilege::View),
2280 qualities: AttributeQualities::NULLABLE.union(AttributeQualities::FIXED),
2281 reporting: Reporting::OnChange,
2282 conform: Conform {
2283 clauses: &[
2284 Clause {
2285 verdict: Conformance::Described,
2286 when: Condition::Named("comparison"),
2287 },
2288 Clause {
2289 verdict: Conformance::Optional,
2290 when: Condition::Always,
2291 },
2292 ],
2293 },
2294 },
2295 Attribute {
2296 id: 0x0020,
2297 name: "Primary4X",
2298 kind: "uint16",
2299 access: Access::read_only(Privilege::View),
2300 qualities: AttributeQualities::FIXED,
2301 reporting: Reporting::OnChange,
2302 conform: Conform {
2303 clauses: &[
2304 Clause {
2305 verdict: Conformance::Described,
2306 when: Condition::Named("comparison"),
2307 },
2308 Clause {
2309 verdict: Conformance::Optional,
2310 when: Condition::Always,
2311 },
2312 ],
2313 },
2314 },
2315 Attribute {
2316 id: 0x0021,
2317 name: "Primary4Y",
2318 kind: "uint16",
2319 access: Access::read_only(Privilege::View),
2320 qualities: AttributeQualities::FIXED,
2321 reporting: Reporting::OnChange,
2322 conform: Conform {
2323 clauses: &[
2324 Clause {
2325 verdict: Conformance::Described,
2326 when: Condition::Named("comparison"),
2327 },
2328 Clause {
2329 verdict: Conformance::Optional,
2330 when: Condition::Always,
2331 },
2332 ],
2333 },
2334 },
2335 Attribute {
2336 id: 0x0022,
2337 name: "Primary4Intensity",
2338 kind: "uint8",
2339 access: Access::read_only(Privilege::View),
2340 qualities: AttributeQualities::NULLABLE.union(AttributeQualities::FIXED),
2341 reporting: Reporting::OnChange,
2342 conform: Conform {
2343 clauses: &[
2344 Clause {
2345 verdict: Conformance::Described,
2346 when: Condition::Named("comparison"),
2347 },
2348 Clause {
2349 verdict: Conformance::Optional,
2350 when: Condition::Always,
2351 },
2352 ],
2353 },
2354 },
2355 Attribute {
2356 id: 0x0024,
2357 name: "Primary5X",
2358 kind: "uint16",
2359 access: Access::read_only(Privilege::View),
2360 qualities: AttributeQualities::FIXED,
2361 reporting: Reporting::OnChange,
2362 conform: Conform {
2363 clauses: &[
2364 Clause {
2365 verdict: Conformance::Described,
2366 when: Condition::Named("comparison"),
2367 },
2368 Clause {
2369 verdict: Conformance::Optional,
2370 when: Condition::Always,
2371 },
2372 ],
2373 },
2374 },
2375 Attribute {
2376 id: 0x0025,
2377 name: "Primary5Y",
2378 kind: "uint16",
2379 access: Access::read_only(Privilege::View),
2380 qualities: AttributeQualities::FIXED,
2381 reporting: Reporting::OnChange,
2382 conform: Conform {
2383 clauses: &[
2384 Clause {
2385 verdict: Conformance::Described,
2386 when: Condition::Named("comparison"),
2387 },
2388 Clause {
2389 verdict: Conformance::Optional,
2390 when: Condition::Always,
2391 },
2392 ],
2393 },
2394 },
2395 Attribute {
2396 id: 0x0026,
2397 name: "Primary5Intensity",
2398 kind: "uint8",
2399 access: Access::read_only(Privilege::View),
2400 qualities: AttributeQualities::NULLABLE.union(AttributeQualities::FIXED),
2401 reporting: Reporting::OnChange,
2402 conform: Conform {
2403 clauses: &[
2404 Clause {
2405 verdict: Conformance::Described,
2406 when: Condition::Named("comparison"),
2407 },
2408 Clause {
2409 verdict: Conformance::Optional,
2410 when: Condition::Always,
2411 },
2412 ],
2413 },
2414 },
2415 Attribute {
2416 id: 0x0028,
2417 name: "Primary6X",
2418 kind: "uint16",
2419 access: Access::read_only(Privilege::View),
2420 qualities: AttributeQualities::FIXED,
2421 reporting: Reporting::OnChange,
2422 conform: Conform {
2423 clauses: &[
2424 Clause {
2425 verdict: Conformance::Described,
2426 when: Condition::Named("comparison"),
2427 },
2428 Clause {
2429 verdict: Conformance::Optional,
2430 when: Condition::Always,
2431 },
2432 ],
2433 },
2434 },
2435 Attribute {
2436 id: 0x0029,
2437 name: "Primary6Y",
2438 kind: "uint16",
2439 access: Access::read_only(Privilege::View),
2440 qualities: AttributeQualities::FIXED,
2441 reporting: Reporting::OnChange,
2442 conform: Conform {
2443 clauses: &[
2444 Clause {
2445 verdict: Conformance::Described,
2446 when: Condition::Named("comparison"),
2447 },
2448 Clause {
2449 verdict: Conformance::Optional,
2450 when: Condition::Always,
2451 },
2452 ],
2453 },
2454 },
2455 Attribute {
2456 id: 0x002A,
2457 name: "Primary6Intensity",
2458 kind: "uint8",
2459 access: Access::read_only(Privilege::View),
2460 qualities: AttributeQualities::NULLABLE.union(AttributeQualities::FIXED),
2461 reporting: Reporting::OnChange,
2462 conform: Conform {
2463 clauses: &[
2464 Clause {
2465 verdict: Conformance::Described,
2466 when: Condition::Named("comparison"),
2467 },
2468 Clause {
2469 verdict: Conformance::Optional,
2470 when: Condition::Always,
2471 },
2472 ],
2473 },
2474 },
2475 Attribute {
2476 id: 0x0030,
2477 name: "WhitePointX",
2478 kind: "uint16",
2479 access: Access::read_only(Privilege::View),
2480 qualities: AttributeQualities::empty(),
2481 reporting: Reporting::OnChange,
2482 conform: Conform::OPTIONAL,
2483 },
2484 Attribute {
2485 id: 0x0031,
2486 name: "WhitePointY",
2487 kind: "uint16",
2488 access: Access::read_only(Privilege::View),
2489 qualities: AttributeQualities::empty(),
2490 reporting: Reporting::OnChange,
2491 conform: Conform::OPTIONAL,
2492 },
2493 Attribute {
2494 id: 0x0032,
2495 name: "ColorPointRX",
2496 kind: "uint16",
2497 access: Access::read_only(Privilege::View),
2498 qualities: AttributeQualities::empty(),
2499 reporting: Reporting::OnChange,
2500 conform: Conform::OPTIONAL,
2501 },
2502 Attribute {
2503 id: 0x0033,
2504 name: "ColorPointRY",
2505 kind: "uint16",
2506 access: Access::read_only(Privilege::View),
2507 qualities: AttributeQualities::empty(),
2508 reporting: Reporting::OnChange,
2509 conform: Conform::OPTIONAL,
2510 },
2511 Attribute {
2512 id: 0x0034,
2513 name: "ColorPointRIntensity",
2514 kind: "uint8",
2515 access: Access::read_only(Privilege::View),
2516 qualities: AttributeQualities::NULLABLE,
2517 reporting: Reporting::OnChange,
2518 conform: Conform::OPTIONAL,
2519 },
2520 Attribute {
2521 id: 0x0036,
2522 name: "ColorPointGX",
2523 kind: "uint16",
2524 access: Access::read_only(Privilege::View),
2525 qualities: AttributeQualities::empty(),
2526 reporting: Reporting::OnChange,
2527 conform: Conform::OPTIONAL,
2528 },
2529 Attribute {
2530 id: 0x0037,
2531 name: "ColorPointGY",
2532 kind: "uint16",
2533 access: Access::read_only(Privilege::View),
2534 qualities: AttributeQualities::empty(),
2535 reporting: Reporting::OnChange,
2536 conform: Conform::OPTIONAL,
2537 },
2538 Attribute {
2539 id: 0x0038,
2540 name: "ColorPointGIntensity",
2541 kind: "uint8",
2542 access: Access::read_only(Privilege::View),
2543 qualities: AttributeQualities::NULLABLE,
2544 reporting: Reporting::OnChange,
2545 conform: Conform::OPTIONAL,
2546 },
2547 Attribute {
2548 id: 0x003A,
2549 name: "ColorPointBX",
2550 kind: "uint16",
2551 access: Access::read_only(Privilege::View),
2552 qualities: AttributeQualities::empty(),
2553 reporting: Reporting::OnChange,
2554 conform: Conform::OPTIONAL,
2555 },
2556 Attribute {
2557 id: 0x003B,
2558 name: "ColorPointBY",
2559 kind: "uint16",
2560 access: Access::read_only(Privilege::View),
2561 qualities: AttributeQualities::empty(),
2562 reporting: Reporting::OnChange,
2563 conform: Conform::OPTIONAL,
2564 },
2565 Attribute {
2566 id: 0x003C,
2567 name: "ColorPointBIntensity",
2568 kind: "uint8",
2569 access: Access::read_only(Privilege::View),
2570 qualities: AttributeQualities::NULLABLE,
2571 reporting: Reporting::OnChange,
2572 conform: Conform::OPTIONAL,
2573 },
2574 Attribute {
2575 id: 0x4000,
2576 name: "EnhancedCurrentHue",
2577 kind: "uint16",
2578 access: Access::read_only(Privilege::View),
2579 qualities: AttributeQualities::NON_VOLATILE.union(AttributeQualities::SCENE),
2580 reporting: Reporting::Quieter,
2581 conform: Conform {
2582 clauses: &[Clause {
2583 verdict: Conformance::Mandatory,
2584 when: Condition::Feature(1),
2585 }],
2586 },
2587 },
2588 Attribute {
2589 id: 0x4001,
2590 name: "EnhancedColorMode",
2591 kind: "EnhancedColorModeEnum",
2592 access: Access::read_only(Privilege::View),
2593 qualities: AttributeQualities::NON_VOLATILE.union(AttributeQualities::SCENE),
2594 reporting: Reporting::OnChange,
2595 conform: Conform::MANDATORY,
2596 },
2597 Attribute {
2598 id: 0x4002,
2599 name: "ColorLoopActive",
2600 kind: "uint8",
2601 access: Access::read_only(Privilege::View),
2602 qualities: AttributeQualities::NON_VOLATILE.union(AttributeQualities::SCENE),
2603 reporting: Reporting::OnChange,
2604 conform: Conform {
2605 clauses: &[Clause {
2606 verdict: Conformance::Mandatory,
2607 when: Condition::Feature(2),
2608 }],
2609 },
2610 },
2611 Attribute {
2612 id: 0x4003,
2613 name: "ColorLoopDirection",
2614 kind: "ColorLoopDirectionEnum",
2615 access: Access::read_only(Privilege::View),
2616 qualities: AttributeQualities::NON_VOLATILE.union(AttributeQualities::SCENE),
2617 reporting: Reporting::OnChange,
2618 conform: Conform {
2619 clauses: &[Clause {
2620 verdict: Conformance::Mandatory,
2621 when: Condition::Feature(2),
2622 }],
2623 },
2624 },
2625 Attribute {
2626 id: 0x4004,
2627 name: "ColorLoopTime",
2628 kind: "uint16",
2629 access: Access::read_only(Privilege::View),
2630 qualities: AttributeQualities::NON_VOLATILE.union(AttributeQualities::SCENE),
2631 reporting: Reporting::OnChange,
2632 conform: Conform {
2633 clauses: &[Clause {
2634 verdict: Conformance::Mandatory,
2635 when: Condition::Feature(2),
2636 }],
2637 },
2638 },
2639 Attribute {
2640 id: 0x4005,
2641 name: "ColorLoopStartEnhancedHue",
2642 kind: "uint16",
2643 access: Access::read_only(Privilege::View),
2644 qualities: AttributeQualities::empty(),
2645 reporting: Reporting::OnChange,
2646 conform: Conform {
2647 clauses: &[Clause {
2648 verdict: Conformance::Mandatory,
2649 when: Condition::Feature(2),
2650 }],
2651 },
2652 },
2653 Attribute {
2654 id: 0x4006,
2655 name: "ColorLoopStoredEnhancedHue",
2656 kind: "uint16",
2657 access: Access::read_only(Privilege::View),
2658 qualities: AttributeQualities::empty(),
2659 reporting: Reporting::OnChange,
2660 conform: Conform {
2661 clauses: &[Clause {
2662 verdict: Conformance::Mandatory,
2663 when: Condition::Feature(2),
2664 }],
2665 },
2666 },
2667 Attribute {
2668 id: 0x400A,
2669 name: "ColorCapabilities",
2670 kind: "ColorCapabilitiesBitmap",
2671 access: Access::read_only(Privilege::View),
2672 qualities: AttributeQualities::empty(),
2673 reporting: Reporting::OnChange,
2674 conform: Conform::MANDATORY,
2675 },
2676 Attribute {
2677 id: 0x400B,
2678 name: "ColorTempPhysicalMinMireds",
2679 kind: "uint16",
2680 access: Access::read_only(Privilege::View),
2681 qualities: AttributeQualities::empty(),
2682 reporting: Reporting::OnChange,
2683 conform: Conform {
2684 clauses: &[Clause {
2685 verdict: Conformance::Mandatory,
2686 when: Condition::Feature(4),
2687 }],
2688 },
2689 },
2690 Attribute {
2691 id: 0x400C,
2692 name: "ColorTempPhysicalMaxMireds",
2693 kind: "uint16",
2694 access: Access::read_only(Privilege::View),
2695 qualities: AttributeQualities::empty(),
2696 reporting: Reporting::OnChange,
2697 conform: Conform {
2698 clauses: &[Clause {
2699 verdict: Conformance::Mandatory,
2700 when: Condition::Feature(4),
2701 }],
2702 },
2703 },
2704 Attribute {
2705 id: 0x400D,
2706 name: "CoupleColorTempToLevelMinMireds",
2707 kind: "uint16",
2708 access: Access::read_only(Privilege::View),
2709 qualities: AttributeQualities::empty(),
2710 reporting: Reporting::OnChange,
2711 conform: Conform {
2712 clauses: &[Clause {
2713 verdict: Conformance::Mandatory,
2714 when: Condition::Feature(4),
2715 }],
2716 },
2717 },
2718 Attribute {
2719 id: 0x4010,
2720 name: "StartUpColorTemperatureMireds",
2721 kind: "uint16",
2722 access: Access::read_write_with(Privilege::View, Privilege::Manage),
2723 qualities: AttributeQualities::NULLABLE.union(AttributeQualities::NON_VOLATILE),
2724 reporting: Reporting::OnChange,
2725 conform: Conform {
2726 clauses: &[Clause {
2727 verdict: Conformance::Mandatory,
2728 when: Condition::Feature(4),
2729 }],
2730 },
2731 },
2732];
2733
2734pub const COMMANDS: &[Command] = &[
2736 Command {
2737 id: 0x00,
2738 name: "MoveToHue",
2739 to_server: true,
2740 response: None,
2741 access: Access::invoke(Privilege::Operate),
2742 conform: Conform {
2743 clauses: &[Clause {
2744 verdict: Conformance::Mandatory,
2745 when: Condition::Feature(0),
2746 }],
2747 },
2748 },
2749 Command {
2750 id: 0x01,
2751 name: "MoveHue",
2752 to_server: true,
2753 response: None,
2754 access: Access::invoke(Privilege::Operate),
2755 conform: Conform {
2756 clauses: &[Clause {
2757 verdict: Conformance::Mandatory,
2758 when: Condition::Feature(0),
2759 }],
2760 },
2761 },
2762 Command {
2763 id: 0x02,
2764 name: "StepHue",
2765 to_server: true,
2766 response: None,
2767 access: Access::invoke(Privilege::Operate),
2768 conform: Conform {
2769 clauses: &[Clause {
2770 verdict: Conformance::Mandatory,
2771 when: Condition::Feature(0),
2772 }],
2773 },
2774 },
2775 Command {
2776 id: 0x03,
2777 name: "MoveToSaturation",
2778 to_server: true,
2779 response: None,
2780 access: Access::invoke(Privilege::Operate),
2781 conform: Conform {
2782 clauses: &[Clause {
2783 verdict: Conformance::Mandatory,
2784 when: Condition::Feature(0),
2785 }],
2786 },
2787 },
2788 Command {
2789 id: 0x04,
2790 name: "MoveSaturation",
2791 to_server: true,
2792 response: None,
2793 access: Access::invoke(Privilege::Operate),
2794 conform: Conform {
2795 clauses: &[Clause {
2796 verdict: Conformance::Mandatory,
2797 when: Condition::Feature(0),
2798 }],
2799 },
2800 },
2801 Command {
2802 id: 0x05,
2803 name: "StepSaturation",
2804 to_server: true,
2805 response: None,
2806 access: Access::invoke(Privilege::Operate),
2807 conform: Conform {
2808 clauses: &[Clause {
2809 verdict: Conformance::Mandatory,
2810 when: Condition::Feature(0),
2811 }],
2812 },
2813 },
2814 Command {
2815 id: 0x06,
2816 name: "MoveToHueAndSaturation",
2817 to_server: true,
2818 response: None,
2819 access: Access::invoke(Privilege::Operate),
2820 conform: Conform {
2821 clauses: &[Clause {
2822 verdict: Conformance::Mandatory,
2823 when: Condition::Feature(0),
2824 }],
2825 },
2826 },
2827 Command {
2828 id: 0x07,
2829 name: "MoveToColor",
2830 to_server: true,
2831 response: None,
2832 access: Access::invoke(Privilege::Operate),
2833 conform: Conform {
2834 clauses: &[Clause {
2835 verdict: Conformance::Mandatory,
2836 when: Condition::Feature(3),
2837 }],
2838 },
2839 },
2840 Command {
2841 id: 0x08,
2842 name: "MoveColor",
2843 to_server: true,
2844 response: None,
2845 access: Access::invoke(Privilege::Operate),
2846 conform: Conform {
2847 clauses: &[Clause {
2848 verdict: Conformance::Mandatory,
2849 when: Condition::Feature(3),
2850 }],
2851 },
2852 },
2853 Command {
2854 id: 0x09,
2855 name: "StepColor",
2856 to_server: true,
2857 response: None,
2858 access: Access::invoke(Privilege::Operate),
2859 conform: Conform {
2860 clauses: &[Clause {
2861 verdict: Conformance::Mandatory,
2862 when: Condition::Feature(3),
2863 }],
2864 },
2865 },
2866 Command {
2867 id: 0x0A,
2868 name: "MoveToColorTemperature",
2869 to_server: true,
2870 response: None,
2871 access: Access::invoke(Privilege::Operate),
2872 conform: Conform {
2873 clauses: &[Clause {
2874 verdict: Conformance::Mandatory,
2875 when: Condition::Feature(4),
2876 }],
2877 },
2878 },
2879 Command {
2880 id: 0x40,
2881 name: "EnhancedMoveToHue",
2882 to_server: true,
2883 response: None,
2884 access: Access::invoke(Privilege::Operate),
2885 conform: Conform {
2886 clauses: &[Clause {
2887 verdict: Conformance::Mandatory,
2888 when: Condition::Feature(1),
2889 }],
2890 },
2891 },
2892 Command {
2893 id: 0x41,
2894 name: "EnhancedMoveHue",
2895 to_server: true,
2896 response: None,
2897 access: Access::invoke(Privilege::Operate),
2898 conform: Conform {
2899 clauses: &[Clause {
2900 verdict: Conformance::Mandatory,
2901 when: Condition::Feature(1),
2902 }],
2903 },
2904 },
2905 Command {
2906 id: 0x42,
2907 name: "EnhancedStepHue",
2908 to_server: true,
2909 response: None,
2910 access: Access::invoke(Privilege::Operate),
2911 conform: Conform {
2912 clauses: &[Clause {
2913 verdict: Conformance::Mandatory,
2914 when: Condition::Feature(1),
2915 }],
2916 },
2917 },
2918 Command {
2919 id: 0x43,
2920 name: "EnhancedMoveToHueAndSaturation",
2921 to_server: true,
2922 response: None,
2923 access: Access::invoke(Privilege::Operate),
2924 conform: Conform {
2925 clauses: &[Clause {
2926 verdict: Conformance::Mandatory,
2927 when: Condition::Feature(1),
2928 }],
2929 },
2930 },
2931 Command {
2932 id: 0x44,
2933 name: "ColorLoopSet",
2934 to_server: true,
2935 response: None,
2936 access: Access::invoke(Privilege::Operate),
2937 conform: Conform {
2938 clauses: &[Clause {
2939 verdict: Conformance::Mandatory,
2940 when: Condition::Feature(2),
2941 }],
2942 },
2943 },
2944 Command {
2945 id: 0x47,
2946 name: "StopMoveStep",
2947 to_server: true,
2948 response: None,
2949 access: Access::invoke(Privilege::Operate),
2950 conform: Conform {
2951 clauses: &[Clause {
2952 verdict: Conformance::Mandatory,
2953 when: Condition::Any(&[
2954 Condition::Feature(0),
2955 Condition::Feature(3),
2956 Condition::Feature(4),
2957 ]),
2958 }],
2959 },
2960 },
2961 Command {
2962 id: 0x4B,
2963 name: "MoveColorTemperature",
2964 to_server: true,
2965 response: None,
2966 access: Access::invoke(Privilege::Operate),
2967 conform: Conform {
2968 clauses: &[Clause {
2969 verdict: Conformance::Mandatory,
2970 when: Condition::Feature(4),
2971 }],
2972 },
2973 },
2974 Command {
2975 id: 0x4C,
2976 name: "StepColorTemperature",
2977 to_server: true,
2978 response: None,
2979 access: Access::invoke(Privilege::Operate),
2980 conform: Conform {
2981 clauses: &[Clause {
2982 verdict: Conformance::Mandatory,
2983 when: Condition::Feature(4),
2984 }],
2985 },
2986 },
2987];
2988
2989pub const EVENTS: &[Event] = &[];
2991
2992pub const CLUSTER: Cluster = Cluster {
2994 id: ID,
2995 name: "Color Control",
2996 revision: REVISION,
2997 pics: "CC",
2998 derived_from: None,
2999 features: FEATURES,
3000 attributes: ATTRIBUTES,
3001 commands: COMMANDS,
3002 events: EVENTS,
3003};