Skip to main content

matter_kit/clusters/generated/
power_source.rs

1// Generated by `cargo xtask` from the CSA data model 1.6. Do not edit.
2//
3// Power Source — cluster 0x002F.
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//! Power Source (cluster `0x002F`, revision 3).
10//!
11//! 35 identifiers, 4 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 = 0x002F;
28
29/// The highest revision the specification's history defines — what `ClusterRevision`
30/// must report (Core §7.13.1).
31pub const REVISION: u16 = 3;
32
33/// The PICS code, which a certification declaration names the cluster by.
34pub const PICS: &str = "PS";
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    /// A wired power source
42    ///
43    /// Code `WIRED`, bit 0.
44    pub const WIRED: u32 = 1 << 0;
45    /// A battery power source
46    ///
47    /// Code `BAT`, bit 1.
48    pub const BATTERY: u32 = 1 << 1;
49    /// A rechargeable battery power source
50    ///
51    /// Code `RECHG`, bit 2.
52    pub const RECHARGEABLE: u32 = 1 << 2;
53    /// A replaceable battery power source
54    ///
55    /// Code `REPLC`, bit 3.
56    pub const REPLACEABLE: u32 = 1 << 3;
57}
58
59/// Every feature bit, with its conformance.
60pub const FEATURES: &[Feature] = &[
61    Feature {
62        bit: 0,
63        code: "WIRED",
64        name: "Wired",
65        conform: Conform::OPTIONAL,
66    },
67    Feature {
68        bit: 1,
69        code: "BAT",
70        name: "Battery",
71        conform: Conform::OPTIONAL,
72    },
73    Feature {
74        bit: 2,
75        code: "RECHG",
76        name: "Rechargeable",
77        conform: Conform {
78            clauses: &[Clause {
79                verdict: Conformance::Optional,
80                when: Condition::Feature(1),
81            }],
82        },
83    },
84    Feature {
85        bit: 3,
86        code: "REPLC",
87        name: "Replaceable",
88        conform: Conform {
89            clauses: &[Clause {
90                verdict: Conformance::Optional,
91                when: Condition::Feature(1),
92            }],
93        },
94    },
95];
96
97/// The attribute ids.
98pub mod attribute {
99    use crate::im::AttributeId;
100
101    /// `Status`.
102    pub const STATUS: AttributeId = 0x00;
103    /// `Order`.
104    pub const ORDER: AttributeId = 0x01;
105    /// `Description`.
106    pub const DESCRIPTION: AttributeId = 0x02;
107    /// `WiredAssessedInputVoltage`.
108    pub const WIRED_ASSESSED_INPUT_VOLTAGE: AttributeId = 0x03;
109    /// `WiredAssessedInputFrequency`.
110    pub const WIRED_ASSESSED_INPUT_FREQUENCY: AttributeId = 0x04;
111    /// `WiredCurrentType`.
112    pub const WIRED_CURRENT_TYPE: AttributeId = 0x05;
113    /// `WiredAssessedCurrent`.
114    pub const WIRED_ASSESSED_CURRENT: AttributeId = 0x06;
115    /// `WiredNominalVoltage`.
116    pub const WIRED_NOMINAL_VOLTAGE: AttributeId = 0x07;
117    /// `WiredMaximumCurrent`.
118    pub const WIRED_MAXIMUM_CURRENT: AttributeId = 0x08;
119    /// `WiredPresent`.
120    pub const WIRED_PRESENT: AttributeId = 0x09;
121    /// `ActiveWiredFaults`.
122    pub const ACTIVE_WIRED_FAULTS: AttributeId = 0x0A;
123    /// `BatVoltage`.
124    pub const BAT_VOLTAGE: AttributeId = 0x0B;
125    /// `BatPercentRemaining`.
126    pub const BAT_PERCENT_REMAINING: AttributeId = 0x0C;
127    /// `BatTimeRemaining`.
128    pub const BAT_TIME_REMAINING: AttributeId = 0x0D;
129    /// `BatChargeLevel`.
130    pub const BAT_CHARGE_LEVEL: AttributeId = 0x0E;
131    /// `BatReplacementNeeded`.
132    pub const BAT_REPLACEMENT_NEEDED: AttributeId = 0x0F;
133    /// `BatReplaceability`.
134    pub const BAT_REPLACEABILITY: AttributeId = 0x10;
135    /// `BatPresent`.
136    pub const BAT_PRESENT: AttributeId = 0x11;
137    /// `ActiveBatFaults`.
138    pub const ACTIVE_BAT_FAULTS: AttributeId = 0x12;
139    /// `BatReplacementDescription`.
140    pub const BAT_REPLACEMENT_DESCRIPTION: AttributeId = 0x13;
141    /// `BatCommonDesignation`.
142    pub const BAT_COMMON_DESIGNATION: AttributeId = 0x14;
143    /// `BatANSIDesignation`.
144    pub const BAT_ANSI_DESIGNATION: AttributeId = 0x15;
145    /// `BatIECDesignation`.
146    pub const BAT_IEC_DESIGNATION: AttributeId = 0x16;
147    /// `BatApprovedChemistry`.
148    pub const BAT_APPROVED_CHEMISTRY: AttributeId = 0x17;
149    /// `BatCapacity`.
150    pub const BAT_CAPACITY: AttributeId = 0x18;
151    /// `BatQuantity`.
152    pub const BAT_QUANTITY: AttributeId = 0x19;
153    /// `BatChargeState`.
154    pub const BAT_CHARGE_STATE: AttributeId = 0x1A;
155    /// `BatTimeToFullCharge`.
156    pub const BAT_TIME_TO_FULL_CHARGE: AttributeId = 0x1B;
157    /// `BatFunctionalWhileCharging`.
158    pub const BAT_FUNCTIONAL_WHILE_CHARGING: AttributeId = 0x1C;
159    /// `BatChargingCurrent`.
160    pub const BAT_CHARGING_CURRENT: AttributeId = 0x1D;
161    /// `ActiveBatChargeFaults`.
162    pub const ACTIVE_BAT_CHARGE_FAULTS: AttributeId = 0x1E;
163    /// `EndpointList`.
164    pub const ENDPOINT_LIST: AttributeId = 0x1F;
165}
166
167/// The event ids.
168pub mod event {
169    use crate::im::EventId;
170
171    /// `WiredFaultChange`.
172    pub const WIRED_FAULT_CHANGE: EventId = 0x00;
173    /// `BatFaultChange`.
174    pub const BAT_FAULT_CHANGE: EventId = 0x01;
175    /// `BatChargeFaultChange`.
176    pub const BAT_CHARGE_FAULT_CHANGE: EventId = 0x02;
177}
178
179/// `BatApprovedChemistryEnum`.
180#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
181#[repr(u8)]
182pub enum BatApprovedChemistryEnum {
183    /// Cell chemistry is unspecified or unknown
184    Unspecified = 0,
185    /// Cell chemistry is alkaline
186    Alkaline = 1,
187    /// Cell chemistry is lithium carbon fluoride
188    LithiumCarbonFluoride = 2,
189    /// Cell chemistry is lithium chromium oxide
190    LithiumChromiumOxide = 3,
191    /// Cell chemistry is lithium copper oxide
192    LithiumCopperOxide = 4,
193    /// Cell chemistry is lithium iron disulfide
194    LithiumIronDisulfide = 5,
195    /// Cell chemistry is lithium manganese dioxide
196    LithiumManganeseDioxide = 6,
197    /// Cell chemistry is lithium thionyl chloride
198    LithiumThionylChloride = 7,
199    /// Cell chemistry is magnesium
200    Magnesium = 8,
201    /// Cell chemistry is mercury oxide
202    MercuryOxide = 9,
203    /// Cell chemistry is nickel oxyhydride
204    NickelOxyhydride = 10,
205    /// Cell chemistry is silver oxide
206    SilverOxide = 11,
207    /// Cell chemistry is zinc air
208    ZincAir = 12,
209    /// Cell chemistry is zinc carbon
210    ZincCarbon = 13,
211    /// Cell chemistry is zinc chloride
212    ZincChloride = 14,
213    /// Cell chemistry is zinc manganese dioxide
214    ZincManganeseDioxide = 15,
215    /// Cell chemistry is lead acid
216    LeadAcid = 16,
217    /// Cell chemistry is lithium cobalt oxide
218    LithiumCobaltOxide = 17,
219    /// Cell chemistry is lithium ion
220    LithiumIon = 18,
221    /// Cell chemistry is lithium ion polymer
222    LithiumIonPolymer = 19,
223    /// Cell chemistry is lithium iron phosphate
224    LithiumIronPhosphate = 20,
225    /// Cell chemistry is lithium sulfur
226    LithiumSulfur = 21,
227    /// Cell chemistry is lithium titanate
228    LithiumTitanate = 22,
229    /// Cell chemistry is nickel cadmium
230    NickelCadmium = 23,
231    /// Cell chemistry is nickel hydrogen
232    NickelHydrogen = 24,
233    /// Cell chemistry is nickel iron
234    NickelIron = 25,
235    /// Cell chemistry is nickel metal hydride
236    NickelMetalHydride = 26,
237    /// Cell chemistry is nickel zinc
238    NickelZinc = 27,
239    /// Cell chemistry is silver zinc
240    SilverZinc = 28,
241    /// Cell chemistry is sodium ion
242    SodiumIon = 29,
243    /// Cell chemistry is sodium sulfur
244    SodiumSulfur = 30,
245    /// Cell chemistry is zinc bromide
246    ZincBromide = 31,
247    /// Cell chemistry is zinc cerium
248    ZincCerium = 32,
249}
250
251impl BatApprovedChemistryEnum {
252    /// Reads a wire value, or `None` for one this revision does not define.
253    #[must_use]
254    pub const fn from_value(value: u8) -> Option<Self> {
255        match value {
256            0 => Some(Self::Unspecified),
257            1 => Some(Self::Alkaline),
258            2 => Some(Self::LithiumCarbonFluoride),
259            3 => Some(Self::LithiumChromiumOxide),
260            4 => Some(Self::LithiumCopperOxide),
261            5 => Some(Self::LithiumIronDisulfide),
262            6 => Some(Self::LithiumManganeseDioxide),
263            7 => Some(Self::LithiumThionylChloride),
264            8 => Some(Self::Magnesium),
265            9 => Some(Self::MercuryOxide),
266            10 => Some(Self::NickelOxyhydride),
267            11 => Some(Self::SilverOxide),
268            12 => Some(Self::ZincAir),
269            13 => Some(Self::ZincCarbon),
270            14 => Some(Self::ZincChloride),
271            15 => Some(Self::ZincManganeseDioxide),
272            16 => Some(Self::LeadAcid),
273            17 => Some(Self::LithiumCobaltOxide),
274            18 => Some(Self::LithiumIon),
275            19 => Some(Self::LithiumIonPolymer),
276            20 => Some(Self::LithiumIronPhosphate),
277            21 => Some(Self::LithiumSulfur),
278            22 => Some(Self::LithiumTitanate),
279            23 => Some(Self::NickelCadmium),
280            24 => Some(Self::NickelHydrogen),
281            25 => Some(Self::NickelIron),
282            26 => Some(Self::NickelMetalHydride),
283            27 => Some(Self::NickelZinc),
284            28 => Some(Self::SilverZinc),
285            29 => Some(Self::SodiumIon),
286            30 => Some(Self::SodiumSulfur),
287            31 => Some(Self::ZincBromide),
288            32 => Some(Self::ZincCerium),
289            _ => None,
290        }
291    }
292
293    /// Its wire value.
294    #[must_use]
295    pub const fn value(self) -> u8 {
296        self as u8
297    }
298}
299
300impl ToTlv for BatApprovedChemistryEnum {
301    fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
302        self.value().to_tlv(w, tag)
303    }
304}
305
306impl<'a> FromTlv<'a> for BatApprovedChemistryEnum {
307    fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
308        let value = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
309        Self::from_value(value).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
310    }
311}
312
313/// `BatChargeFaultEnum`.
314#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
315#[repr(u8)]
316pub enum BatChargeFaultEnum {
317    /// The Node detects an unspecified fault on this battery source.
318    Unspecified = 0,
319    /// The Node detects the ambient temperature is above the nominal range for this battery source.
320    AmbientTooHot = 1,
321    /// The Node detects the ambient temperature is below the nominal range for this battery source.
322    AmbientTooCold = 2,
323    /// The Node detects the temperature of this battery source is above the nominal range.
324    BatteryTooHot = 3,
325    /// The Node detects the temperature of this battery source is below the nominal range.
326    BatteryTooCold = 4,
327    /// The Node detects this battery source is not present.
328    BatteryAbsent = 5,
329    /// The Node detects this battery source is over voltage.
330    BatteryOverVoltage = 6,
331    /// The Node detects this battery source is under voltage.
332    BatteryUnderVoltage = 7,
333    /// The Node detects the charger for this battery source is over voltage.
334    ChargerOverVoltage = 8,
335    /// The Node detects the charger for this battery source is under voltage.
336    ChargerUnderVoltage = 9,
337    /// The Node detects a charging safety timeout for this battery source.
338    SafetyTimeout = 10,
339}
340
341impl BatChargeFaultEnum {
342    /// Reads a wire value, or `None` for one this revision does not define.
343    #[must_use]
344    pub const fn from_value(value: u8) -> Option<Self> {
345        match value {
346            0 => Some(Self::Unspecified),
347            1 => Some(Self::AmbientTooHot),
348            2 => Some(Self::AmbientTooCold),
349            3 => Some(Self::BatteryTooHot),
350            4 => Some(Self::BatteryTooCold),
351            5 => Some(Self::BatteryAbsent),
352            6 => Some(Self::BatteryOverVoltage),
353            7 => Some(Self::BatteryUnderVoltage),
354            8 => Some(Self::ChargerOverVoltage),
355            9 => Some(Self::ChargerUnderVoltage),
356            10 => Some(Self::SafetyTimeout),
357            _ => None,
358        }
359    }
360
361    /// Its wire value.
362    #[must_use]
363    pub const fn value(self) -> u8 {
364        self as u8
365    }
366}
367
368impl ToTlv for BatChargeFaultEnum {
369    fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
370        self.value().to_tlv(w, tag)
371    }
372}
373
374impl<'a> FromTlv<'a> for BatChargeFaultEnum {
375    fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
376        let value = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
377        Self::from_value(value).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
378    }
379}
380
381/// `BatChargeLevelEnum`.
382#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
383#[repr(u8)]
384pub enum BatChargeLevelEnum {
385    /// Charge level is nominal
386    OK = 0,
387    /// Charge level is low, intervention may soon be required.
388    Warning = 1,
389    /// Charge level is critical, immediate intervention is required
390    Critical = 2,
391}
392
393impl BatChargeLevelEnum {
394    /// Reads a wire value, or `None` for one this revision does not define.
395    #[must_use]
396    pub const fn from_value(value: u8) -> Option<Self> {
397        match value {
398            0 => Some(Self::OK),
399            1 => Some(Self::Warning),
400            2 => Some(Self::Critical),
401            _ => None,
402        }
403    }
404
405    /// Its wire value.
406    #[must_use]
407    pub const fn value(self) -> u8 {
408        self as u8
409    }
410}
411
412impl ToTlv for BatChargeLevelEnum {
413    fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
414        self.value().to_tlv(w, tag)
415    }
416}
417
418impl<'a> FromTlv<'a> for BatChargeLevelEnum {
419    fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
420        let value = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
421        Self::from_value(value).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
422    }
423}
424
425/// `BatChargeStateEnum`.
426#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
427#[repr(u8)]
428pub enum BatChargeStateEnum {
429    /// Unable to determine the charging state
430    Unknown = 0,
431    /// The battery is charging
432    IsCharging = 1,
433    /// The battery is at full charge
434    IsAtFullCharge = 2,
435    /// The battery is not charging
436    IsNotCharging = 3,
437}
438
439impl BatChargeStateEnum {
440    /// Reads a wire value, or `None` for one this revision does not define.
441    #[must_use]
442    pub const fn from_value(value: u8) -> Option<Self> {
443        match value {
444            0 => Some(Self::Unknown),
445            1 => Some(Self::IsCharging),
446            2 => Some(Self::IsAtFullCharge),
447            3 => Some(Self::IsNotCharging),
448            _ => None,
449        }
450    }
451
452    /// Its wire value.
453    #[must_use]
454    pub const fn value(self) -> u8 {
455        self as u8
456    }
457}
458
459impl ToTlv for BatChargeStateEnum {
460    fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
461        self.value().to_tlv(w, tag)
462    }
463}
464
465impl<'a> FromTlv<'a> for BatChargeStateEnum {
466    fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
467        let value = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
468        Self::from_value(value).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
469    }
470}
471
472/// `BatCommonDesignationEnum`.
473#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
474#[repr(u8)]
475pub enum BatCommonDesignationEnum {
476    /// Common type is unknown or unspecified
477    Unspecified = 0,
478    /// Common type is as specified
479    AAA = 1,
480    /// Common type is as specified
481    AA = 2,
482    /// Common type is as specified
483    C = 3,
484    /// Common type is as specified
485    D = 4,
486    /// Common type is as specified
487    N4V5 = 5,
488    /// Common type is as specified
489    N6V0 = 6,
490    /// Common type is as specified
491    N9V0 = 7,
492    /// Common type is as specified
493    N12AA = 8,
494    /// Common type is as specified
495    AAAA = 9,
496    /// Common type is as specified
497    A = 10,
498    /// Common type is as specified
499    B = 11,
500    /// Common type is as specified
501    F = 12,
502    /// Common type is as specified
503    N = 13,
504    /// Common type is as specified
505    No6 = 14,
506    /// Common type is as specified
507    SubC = 15,
508    /// Common type is as specified
509    A23 = 16,
510    /// Common type is as specified
511    A27 = 17,
512    /// Common type is as specified
513    BA5800 = 18,
514    /// Common type is as specified
515    Duplex = 19,
516    /// Common type is as specified
517    N4SR44 = 20,
518    /// Common type is as specified
519    N523 = 21,
520    /// Common type is as specified
521    N531 = 22,
522    /// Common type is as specified
523    N15V0 = 23,
524    /// Common type is as specified
525    N22V5 = 24,
526    /// Common type is as specified
527    N30V0 = 25,
528    /// Common type is as specified
529    N45V0 = 26,
530    /// Common type is as specified
531    N67V5 = 27,
532    /// Common type is as specified
533    J = 28,
534    /// Common type is as specified
535    CR123A = 29,
536    /// Common type is as specified
537    CR2 = 30,
538    /// Common type is as specified
539    N2CR5 = 31,
540    /// Common type is as specified
541    CRP2 = 32,
542    /// Common type is as specified
543    CRV3 = 33,
544    /// Common type is as specified
545    SR41 = 34,
546    /// Common type is as specified
547    SR43 = 35,
548    /// Common type is as specified
549    SR44 = 36,
550    /// Common type is as specified
551    SR45 = 37,
552    /// Common type is as specified
553    SR48 = 38,
554    /// Common type is as specified
555    SR54 = 39,
556    /// Common type is as specified
557    SR55 = 40,
558    /// Common type is as specified
559    SR57 = 41,
560    /// Common type is as specified
561    SR58 = 42,
562    /// Common type is as specified
563    SR59 = 43,
564    /// Common type is as specified
565    SR60 = 44,
566    /// Common type is as specified
567    SR63 = 45,
568    /// Common type is as specified
569    SR64 = 46,
570    /// Common type is as specified
571    SR65 = 47,
572    /// Common type is as specified
573    SR66 = 48,
574    /// Common type is as specified
575    SR67 = 49,
576    /// Common type is as specified
577    SR68 = 50,
578    /// Common type is as specified
579    SR69 = 51,
580    /// Common type is as specified
581    SR516 = 52,
582    /// Common type is as specified
583    SR731 = 53,
584    /// Common type is as specified
585    SR712 = 54,
586    /// Common type is as specified
587    LR932 = 55,
588    /// Common type is as specified
589    A5 = 56,
590    /// Common type is as specified
591    A10 = 57,
592    /// Common type is as specified
593    A13 = 58,
594    /// Common type is as specified
595    A312 = 59,
596    /// Common type is as specified
597    A675 = 60,
598    /// Common type is as specified
599    AC41E = 61,
600    /// Common type is as specified
601    N10180 = 62,
602    /// Common type is as specified
603    N10280 = 63,
604    /// Common type is as specified
605    N10440 = 64,
606    /// Common type is as specified
607    N14250 = 65,
608    /// Common type is as specified
609    N14430 = 66,
610    /// Common type is as specified
611    N14500 = 67,
612    /// Common type is as specified
613    N14650 = 68,
614    /// Common type is as specified
615    N15270 = 69,
616    /// Common type is as specified
617    N16340 = 70,
618    /// Common type is as specified
619    RCR123A = 71,
620    /// Common type is as specified
621    N17500 = 72,
622    /// Common type is as specified
623    N17670 = 73,
624    /// Common type is as specified
625    N18350 = 74,
626    /// Common type is as specified
627    N18500 = 75,
628    /// Common type is as specified
629    N18650 = 76,
630    /// Common type is as specified
631    N19670 = 77,
632    /// Common type is as specified
633    N25500 = 78,
634    /// Common type is as specified
635    N26650 = 79,
636    /// Common type is as specified
637    N32600 = 80,
638}
639
640impl BatCommonDesignationEnum {
641    /// Reads a wire value, or `None` for one this revision does not define.
642    #[must_use]
643    pub const fn from_value(value: u8) -> Option<Self> {
644        match value {
645            0 => Some(Self::Unspecified),
646            1 => Some(Self::AAA),
647            2 => Some(Self::AA),
648            3 => Some(Self::C),
649            4 => Some(Self::D),
650            5 => Some(Self::N4V5),
651            6 => Some(Self::N6V0),
652            7 => Some(Self::N9V0),
653            8 => Some(Self::N12AA),
654            9 => Some(Self::AAAA),
655            10 => Some(Self::A),
656            11 => Some(Self::B),
657            12 => Some(Self::F),
658            13 => Some(Self::N),
659            14 => Some(Self::No6),
660            15 => Some(Self::SubC),
661            16 => Some(Self::A23),
662            17 => Some(Self::A27),
663            18 => Some(Self::BA5800),
664            19 => Some(Self::Duplex),
665            20 => Some(Self::N4SR44),
666            21 => Some(Self::N523),
667            22 => Some(Self::N531),
668            23 => Some(Self::N15V0),
669            24 => Some(Self::N22V5),
670            25 => Some(Self::N30V0),
671            26 => Some(Self::N45V0),
672            27 => Some(Self::N67V5),
673            28 => Some(Self::J),
674            29 => Some(Self::CR123A),
675            30 => Some(Self::CR2),
676            31 => Some(Self::N2CR5),
677            32 => Some(Self::CRP2),
678            33 => Some(Self::CRV3),
679            34 => Some(Self::SR41),
680            35 => Some(Self::SR43),
681            36 => Some(Self::SR44),
682            37 => Some(Self::SR45),
683            38 => Some(Self::SR48),
684            39 => Some(Self::SR54),
685            40 => Some(Self::SR55),
686            41 => Some(Self::SR57),
687            42 => Some(Self::SR58),
688            43 => Some(Self::SR59),
689            44 => Some(Self::SR60),
690            45 => Some(Self::SR63),
691            46 => Some(Self::SR64),
692            47 => Some(Self::SR65),
693            48 => Some(Self::SR66),
694            49 => Some(Self::SR67),
695            50 => Some(Self::SR68),
696            51 => Some(Self::SR69),
697            52 => Some(Self::SR516),
698            53 => Some(Self::SR731),
699            54 => Some(Self::SR712),
700            55 => Some(Self::LR932),
701            56 => Some(Self::A5),
702            57 => Some(Self::A10),
703            58 => Some(Self::A13),
704            59 => Some(Self::A312),
705            60 => Some(Self::A675),
706            61 => Some(Self::AC41E),
707            62 => Some(Self::N10180),
708            63 => Some(Self::N10280),
709            64 => Some(Self::N10440),
710            65 => Some(Self::N14250),
711            66 => Some(Self::N14430),
712            67 => Some(Self::N14500),
713            68 => Some(Self::N14650),
714            69 => Some(Self::N15270),
715            70 => Some(Self::N16340),
716            71 => Some(Self::RCR123A),
717            72 => Some(Self::N17500),
718            73 => Some(Self::N17670),
719            74 => Some(Self::N18350),
720            75 => Some(Self::N18500),
721            76 => Some(Self::N18650),
722            77 => Some(Self::N19670),
723            78 => Some(Self::N25500),
724            79 => Some(Self::N26650),
725            80 => Some(Self::N32600),
726            _ => None,
727        }
728    }
729
730    /// Its wire value.
731    #[must_use]
732    pub const fn value(self) -> u8 {
733        self as u8
734    }
735}
736
737impl ToTlv for BatCommonDesignationEnum {
738    fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
739        self.value().to_tlv(w, tag)
740    }
741}
742
743impl<'a> FromTlv<'a> for BatCommonDesignationEnum {
744    fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
745        let value = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
746        Self::from_value(value).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
747    }
748}
749
750/// `BatFaultEnum`.
751#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
752#[repr(u8)]
753pub enum BatFaultEnum {
754    /// The Node detects an unspecified fault on this battery power source.
755    Unspecified = 0,
756    /// The Node detects the temperature of this battery power source is above ideal operating conditions.
757    OverTemp = 1,
758    /// The Node detects the temperature of this battery power source is below ideal operating conditions.
759    UnderTemp = 2,
760}
761
762impl BatFaultEnum {
763    /// Reads a wire value, or `None` for one this revision does not define.
764    #[must_use]
765    pub const fn from_value(value: u8) -> Option<Self> {
766        match value {
767            0 => Some(Self::Unspecified),
768            1 => Some(Self::OverTemp),
769            2 => Some(Self::UnderTemp),
770            _ => None,
771        }
772    }
773
774    /// Its wire value.
775    #[must_use]
776    pub const fn value(self) -> u8 {
777        self as u8
778    }
779}
780
781impl ToTlv for BatFaultEnum {
782    fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
783        self.value().to_tlv(w, tag)
784    }
785}
786
787impl<'a> FromTlv<'a> for BatFaultEnum {
788    fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
789        let value = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
790        Self::from_value(value).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
791    }
792}
793
794/// `BatReplaceabilityEnum`.
795#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
796#[repr(u8)]
797pub enum BatReplaceabilityEnum {
798    /// The replaceability is unspecified or unknown.
799    Unspecified = 0,
800    /// The battery is not replaceable.
801    NotReplaceable = 1,
802    /// The battery is replaceable by the user or customer.
803    UserReplaceable = 2,
804    /// The battery is replaceable by an authorized factory technician.
805    FactoryReplaceable = 3,
806}
807
808impl BatReplaceabilityEnum {
809    /// Reads a wire value, or `None` for one this revision does not define.
810    #[must_use]
811    pub const fn from_value(value: u8) -> Option<Self> {
812        match value {
813            0 => Some(Self::Unspecified),
814            1 => Some(Self::NotReplaceable),
815            2 => Some(Self::UserReplaceable),
816            3 => Some(Self::FactoryReplaceable),
817            _ => None,
818        }
819    }
820
821    /// Its wire value.
822    #[must_use]
823    pub const fn value(self) -> u8 {
824        self as u8
825    }
826}
827
828impl ToTlv for BatReplaceabilityEnum {
829    fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
830        self.value().to_tlv(w, tag)
831    }
832}
833
834impl<'a> FromTlv<'a> for BatReplaceabilityEnum {
835    fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
836        let value = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
837        Self::from_value(value).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
838    }
839}
840
841/// `PowerSourceStatusEnum`.
842#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
843#[repr(u8)]
844pub enum PowerSourceStatusEnum {
845    /// Indicate the source status is not specified
846    Unspecified = 0,
847    /// Indicate the source is available and currently supplying power
848    Active = 1,
849    /// Indicate the source is available, but is not currently supplying power
850    Standby = 2,
851    /// Indicate the source is not currently available to supply power
852    Unavailable = 3,
853}
854
855impl PowerSourceStatusEnum {
856    /// Reads a wire value, or `None` for one this revision does not define.
857    #[must_use]
858    pub const fn from_value(value: u8) -> Option<Self> {
859        match value {
860            0 => Some(Self::Unspecified),
861            1 => Some(Self::Active),
862            2 => Some(Self::Standby),
863            3 => Some(Self::Unavailable),
864            _ => None,
865        }
866    }
867
868    /// Its wire value.
869    #[must_use]
870    pub const fn value(self) -> u8 {
871        self as u8
872    }
873}
874
875impl ToTlv for PowerSourceStatusEnum {
876    fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
877        self.value().to_tlv(w, tag)
878    }
879}
880
881impl<'a> FromTlv<'a> for PowerSourceStatusEnum {
882    fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
883        let value = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
884        Self::from_value(value).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
885    }
886}
887
888/// `WiredCurrentTypeEnum`.
889#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
890#[repr(u8)]
891pub enum WiredCurrentTypeEnum {
892    /// Indicates AC current
893    AC = 0,
894    /// Indicates DC current
895    DC = 1,
896}
897
898impl WiredCurrentTypeEnum {
899    /// Reads a wire value, or `None` for one this revision does not define.
900    #[must_use]
901    pub const fn from_value(value: u8) -> Option<Self> {
902        match value {
903            0 => Some(Self::AC),
904            1 => Some(Self::DC),
905            _ => None,
906        }
907    }
908
909    /// Its wire value.
910    #[must_use]
911    pub const fn value(self) -> u8 {
912        self as u8
913    }
914}
915
916impl ToTlv for WiredCurrentTypeEnum {
917    fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
918        self.value().to_tlv(w, tag)
919    }
920}
921
922impl<'a> FromTlv<'a> for WiredCurrentTypeEnum {
923    fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
924        let value = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
925        Self::from_value(value).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
926    }
927}
928
929/// `WiredFaultEnum`.
930#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
931#[repr(u8)]
932pub enum WiredFaultEnum {
933    /// The Node detects an unspecified fault on this wired power source.
934    Unspecified = 0,
935    /// The Node detects the supplied voltage is above maximum supported value for this wired power source.
936    OverVoltage = 1,
937    /// The Node detects the supplied voltage is below maximum supported value for this wired power source.
938    UnderVoltage = 2,
939}
940
941impl WiredFaultEnum {
942    /// Reads a wire value, or `None` for one this revision does not define.
943    #[must_use]
944    pub const fn from_value(value: u8) -> Option<Self> {
945        match value {
946            0 => Some(Self::Unspecified),
947            1 => Some(Self::OverVoltage),
948            2 => Some(Self::UnderVoltage),
949            _ => None,
950        }
951    }
952
953    /// Its wire value.
954    #[must_use]
955    pub const fn value(self) -> u8 {
956        self as u8
957    }
958}
959
960impl ToTlv for WiredFaultEnum {
961    fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
962        self.value().to_tlv(w, tag)
963    }
964}
965
966impl<'a> FromTlv<'a> for WiredFaultEnum {
967    fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
968        let value = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
969        Self::from_value(value).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
970    }
971}
972
973/// Every attribute the specification defines, with its conformance.
974pub const ATTRIBUTES: &[Attribute] = &[
975    Attribute {
976        id: 0x0000,
977        name: "Status",
978        kind: "PowerSourceStatusEnum",
979        access: Access::read_only(Privilege::View),
980        qualities: AttributeQualities::empty(),
981        reporting: Reporting::OnChange,
982        conform: Conform::MANDATORY,
983    },
984    Attribute {
985        id: 0x0001,
986        name: "Order",
987        kind: "uint8",
988        access: Access::read_only(Privilege::View),
989        qualities: AttributeQualities::NON_VOLATILE,
990        reporting: Reporting::OnChange,
991        conform: Conform::MANDATORY,
992    },
993    Attribute {
994        id: 0x0002,
995        name: "Description",
996        kind: "string",
997        access: Access::read_only(Privilege::View),
998        qualities: AttributeQualities::FIXED,
999        reporting: Reporting::OnChange,
1000        conform: Conform::MANDATORY,
1001    },
1002    Attribute {
1003        id: 0x0003,
1004        name: "WiredAssessedInputVoltage",
1005        kind: "uint32",
1006        access: Access::read_only(Privilege::View),
1007        qualities: AttributeQualities::NULLABLE,
1008        reporting: Reporting::ChangesOmitted,
1009        conform: Conform {
1010            clauses: &[Clause {
1011                verdict: Conformance::Optional,
1012                when: Condition::Feature(0),
1013            }],
1014        },
1015    },
1016    Attribute {
1017        id: 0x0004,
1018        name: "WiredAssessedInputFrequency",
1019        kind: "uint16",
1020        access: Access::read_only(Privilege::View),
1021        qualities: AttributeQualities::NULLABLE,
1022        reporting: Reporting::ChangesOmitted,
1023        conform: Conform {
1024            clauses: &[Clause {
1025                verdict: Conformance::Optional,
1026                when: Condition::Feature(0),
1027            }],
1028        },
1029    },
1030    Attribute {
1031        id: 0x0005,
1032        name: "WiredCurrentType",
1033        kind: "WiredCurrentTypeEnum",
1034        access: Access::read_only(Privilege::View),
1035        qualities: AttributeQualities::FIXED,
1036        reporting: Reporting::OnChange,
1037        conform: Conform {
1038            clauses: &[Clause {
1039                verdict: Conformance::Mandatory,
1040                when: Condition::Feature(0),
1041            }],
1042        },
1043    },
1044    Attribute {
1045        id: 0x0006,
1046        name: "WiredAssessedCurrent",
1047        kind: "uint32",
1048        access: Access::read_only(Privilege::View),
1049        qualities: AttributeQualities::NULLABLE,
1050        reporting: Reporting::ChangesOmitted,
1051        conform: Conform {
1052            clauses: &[Clause {
1053                verdict: Conformance::Optional,
1054                when: Condition::Feature(0),
1055            }],
1056        },
1057    },
1058    Attribute {
1059        id: 0x0007,
1060        name: "WiredNominalVoltage",
1061        kind: "uint32",
1062        access: Access::read_only(Privilege::View),
1063        qualities: AttributeQualities::FIXED,
1064        reporting: Reporting::OnChange,
1065        conform: Conform {
1066            clauses: &[Clause {
1067                verdict: Conformance::Optional,
1068                when: Condition::Feature(0),
1069            }],
1070        },
1071    },
1072    Attribute {
1073        id: 0x0008,
1074        name: "WiredMaximumCurrent",
1075        kind: "uint32",
1076        access: Access::read_only(Privilege::View),
1077        qualities: AttributeQualities::FIXED,
1078        reporting: Reporting::OnChange,
1079        conform: Conform {
1080            clauses: &[Clause {
1081                verdict: Conformance::Optional,
1082                when: Condition::Feature(0),
1083            }],
1084        },
1085    },
1086    Attribute {
1087        id: 0x0009,
1088        name: "WiredPresent",
1089        kind: "bool",
1090        access: Access::read_only(Privilege::View),
1091        qualities: AttributeQualities::empty(),
1092        reporting: Reporting::OnChange,
1093        conform: Conform {
1094            clauses: &[Clause {
1095                verdict: Conformance::Optional,
1096                when: Condition::Feature(0),
1097            }],
1098        },
1099    },
1100    Attribute {
1101        id: 0x000A,
1102        name: "ActiveWiredFaults",
1103        kind: "list[WiredFaultEnum]",
1104        access: Access::read_only(Privilege::View),
1105        qualities: AttributeQualities::empty(),
1106        reporting: Reporting::OnChange,
1107        conform: Conform {
1108            clauses: &[Clause {
1109                verdict: Conformance::Optional,
1110                when: Condition::Feature(0),
1111            }],
1112        },
1113    },
1114    Attribute {
1115        id: 0x000B,
1116        name: "BatVoltage",
1117        kind: "uint32",
1118        access: Access::read_only(Privilege::View),
1119        qualities: AttributeQualities::NULLABLE,
1120        reporting: Reporting::ChangesOmitted,
1121        conform: Conform {
1122            clauses: &[Clause {
1123                verdict: Conformance::Optional,
1124                when: Condition::Feature(1),
1125            }],
1126        },
1127    },
1128    Attribute {
1129        id: 0x000C,
1130        name: "BatPercentRemaining",
1131        kind: "uint8",
1132        access: Access::read_only(Privilege::View),
1133        qualities: AttributeQualities::NULLABLE,
1134        reporting: Reporting::Quieter,
1135        conform: Conform {
1136            clauses: &[Clause {
1137                verdict: Conformance::Optional,
1138                when: Condition::Feature(1),
1139            }],
1140        },
1141    },
1142    Attribute {
1143        id: 0x000D,
1144        name: "BatTimeRemaining",
1145        kind: "uint32",
1146        access: Access::read_only(Privilege::View),
1147        qualities: AttributeQualities::NULLABLE,
1148        reporting: Reporting::Quieter,
1149        conform: Conform {
1150            clauses: &[Clause {
1151                verdict: Conformance::Optional,
1152                when: Condition::Feature(1),
1153            }],
1154        },
1155    },
1156    Attribute {
1157        id: 0x000E,
1158        name: "BatChargeLevel",
1159        kind: "BatChargeLevelEnum",
1160        access: Access::read_only(Privilege::View),
1161        qualities: AttributeQualities::empty(),
1162        reporting: Reporting::OnChange,
1163        conform: Conform {
1164            clauses: &[Clause {
1165                verdict: Conformance::Mandatory,
1166                when: Condition::Feature(1),
1167            }],
1168        },
1169    },
1170    Attribute {
1171        id: 0x000F,
1172        name: "BatReplacementNeeded",
1173        kind: "bool",
1174        access: Access::read_only(Privilege::View),
1175        qualities: AttributeQualities::empty(),
1176        reporting: Reporting::OnChange,
1177        conform: Conform {
1178            clauses: &[Clause {
1179                verdict: Conformance::Mandatory,
1180                when: Condition::Feature(1),
1181            }],
1182        },
1183    },
1184    Attribute {
1185        id: 0x0010,
1186        name: "BatReplaceability",
1187        kind: "BatReplaceabilityEnum",
1188        access: Access::read_only(Privilege::View),
1189        qualities: AttributeQualities::FIXED,
1190        reporting: Reporting::OnChange,
1191        conform: Conform {
1192            clauses: &[Clause {
1193                verdict: Conformance::Mandatory,
1194                when: Condition::Feature(1),
1195            }],
1196        },
1197    },
1198    Attribute {
1199        id: 0x0011,
1200        name: "BatPresent",
1201        kind: "bool",
1202        access: Access::read_only(Privilege::View),
1203        qualities: AttributeQualities::empty(),
1204        reporting: Reporting::OnChange,
1205        conform: Conform {
1206            clauses: &[Clause {
1207                verdict: Conformance::Optional,
1208                when: Condition::Feature(1),
1209            }],
1210        },
1211    },
1212    Attribute {
1213        id: 0x0012,
1214        name: "ActiveBatFaults",
1215        kind: "list[BatFaultEnum]",
1216        access: Access::read_only(Privilege::View),
1217        qualities: AttributeQualities::empty(),
1218        reporting: Reporting::OnChange,
1219        conform: Conform {
1220            clauses: &[Clause {
1221                verdict: Conformance::Optional,
1222                when: Condition::Feature(1),
1223            }],
1224        },
1225    },
1226    Attribute {
1227        id: 0x0013,
1228        name: "BatReplacementDescription",
1229        kind: "string",
1230        access: Access::read_only(Privilege::View),
1231        qualities: AttributeQualities::FIXED,
1232        reporting: Reporting::OnChange,
1233        conform: Conform {
1234            clauses: &[Clause {
1235                verdict: Conformance::Mandatory,
1236                when: Condition::Feature(3),
1237            }],
1238        },
1239    },
1240    Attribute {
1241        id: 0x0014,
1242        name: "BatCommonDesignation",
1243        kind: "BatCommonDesignationEnum",
1244        access: Access::read_only(Privilege::View),
1245        qualities: AttributeQualities::FIXED,
1246        reporting: Reporting::OnChange,
1247        conform: Conform {
1248            clauses: &[Clause {
1249                verdict: Conformance::Optional,
1250                when: Condition::Feature(3),
1251            }],
1252        },
1253    },
1254    Attribute {
1255        id: 0x0015,
1256        name: "BatANSIDesignation",
1257        kind: "string",
1258        access: Access::read_only(Privilege::View),
1259        qualities: AttributeQualities::FIXED,
1260        reporting: Reporting::OnChange,
1261        conform: Conform {
1262            clauses: &[Clause {
1263                verdict: Conformance::Optional,
1264                when: Condition::Feature(3),
1265            }],
1266        },
1267    },
1268    Attribute {
1269        id: 0x0016,
1270        name: "BatIECDesignation",
1271        kind: "string",
1272        access: Access::read_only(Privilege::View),
1273        qualities: AttributeQualities::FIXED,
1274        reporting: Reporting::OnChange,
1275        conform: Conform {
1276            clauses: &[Clause {
1277                verdict: Conformance::Optional,
1278                when: Condition::Feature(3),
1279            }],
1280        },
1281    },
1282    Attribute {
1283        id: 0x0017,
1284        name: "BatApprovedChemistry",
1285        kind: "BatApprovedChemistryEnum",
1286        access: Access::read_only(Privilege::View),
1287        qualities: AttributeQualities::FIXED,
1288        reporting: Reporting::OnChange,
1289        conform: Conform {
1290            clauses: &[Clause {
1291                verdict: Conformance::Optional,
1292                when: Condition::Feature(3),
1293            }],
1294        },
1295    },
1296    Attribute {
1297        id: 0x0018,
1298        name: "BatCapacity",
1299        kind: "uint32",
1300        access: Access::read_only(Privilege::View),
1301        qualities: AttributeQualities::FIXED,
1302        reporting: Reporting::OnChange,
1303        conform: Conform {
1304            clauses: &[Clause {
1305                verdict: Conformance::Optional,
1306                when: Condition::Any(&[Condition::Feature(3), Condition::Feature(2)]),
1307            }],
1308        },
1309    },
1310    Attribute {
1311        id: 0x0019,
1312        name: "BatQuantity",
1313        kind: "uint8",
1314        access: Access::read_only(Privilege::View),
1315        qualities: AttributeQualities::FIXED,
1316        reporting: Reporting::OnChange,
1317        conform: Conform {
1318            clauses: &[Clause {
1319                verdict: Conformance::Mandatory,
1320                when: Condition::Feature(3),
1321            }],
1322        },
1323    },
1324    Attribute {
1325        id: 0x001A,
1326        name: "BatChargeState",
1327        kind: "BatChargeStateEnum",
1328        access: Access::read_only(Privilege::View),
1329        qualities: AttributeQualities::empty(),
1330        reporting: Reporting::OnChange,
1331        conform: Conform {
1332            clauses: &[Clause {
1333                verdict: Conformance::Mandatory,
1334                when: Condition::Feature(2),
1335            }],
1336        },
1337    },
1338    Attribute {
1339        id: 0x001B,
1340        name: "BatTimeToFullCharge",
1341        kind: "uint32",
1342        access: Access::read_only(Privilege::View),
1343        qualities: AttributeQualities::NULLABLE,
1344        reporting: Reporting::Quieter,
1345        conform: Conform {
1346            clauses: &[Clause {
1347                verdict: Conformance::Optional,
1348                when: Condition::Feature(2),
1349            }],
1350        },
1351    },
1352    Attribute {
1353        id: 0x001C,
1354        name: "BatFunctionalWhileCharging",
1355        kind: "bool",
1356        access: Access::read_only(Privilege::View),
1357        qualities: AttributeQualities::empty(),
1358        reporting: Reporting::OnChange,
1359        conform: Conform {
1360            clauses: &[Clause {
1361                verdict: Conformance::Mandatory,
1362                when: Condition::Feature(2),
1363            }],
1364        },
1365    },
1366    Attribute {
1367        id: 0x001D,
1368        name: "BatChargingCurrent",
1369        kind: "uint32",
1370        access: Access::read_only(Privilege::View),
1371        qualities: AttributeQualities::NULLABLE,
1372        reporting: Reporting::ChangesOmitted,
1373        conform: Conform {
1374            clauses: &[Clause {
1375                verdict: Conformance::Optional,
1376                when: Condition::Feature(2),
1377            }],
1378        },
1379    },
1380    Attribute {
1381        id: 0x001E,
1382        name: "ActiveBatChargeFaults",
1383        kind: "list[BatChargeFaultEnum]",
1384        access: Access::read_only(Privilege::View),
1385        qualities: AttributeQualities::empty(),
1386        reporting: Reporting::OnChange,
1387        conform: Conform {
1388            clauses: &[Clause {
1389                verdict: Conformance::Optional,
1390                when: Condition::Feature(2),
1391            }],
1392        },
1393    },
1394    Attribute {
1395        id: 0x001F,
1396        name: "EndpointList",
1397        kind: "list[endpoint-no]",
1398        access: Access::read_only(Privilege::View),
1399        qualities: AttributeQualities::empty(),
1400        reporting: Reporting::OnChange,
1401        conform: Conform::MANDATORY,
1402    },
1403];
1404
1405/// Every command, with its conformance.
1406pub const COMMANDS: &[Command] = &[];
1407
1408/// Every event, with its conformance.
1409pub const EVENTS: &[Event] = &[
1410    Event {
1411        id: 0x00,
1412        name: "WiredFaultChange",
1413        priority: EventPriority::Info,
1414        access: Access::read_only(Privilege::View),
1415        conform: Conform {
1416            clauses: &[Clause {
1417                verdict: Conformance::Optional,
1418                when: Condition::Feature(0),
1419            }],
1420        },
1421    },
1422    Event {
1423        id: 0x01,
1424        name: "BatFaultChange",
1425        priority: EventPriority::Info,
1426        access: Access::read_only(Privilege::View),
1427        conform: Conform {
1428            clauses: &[Clause {
1429                verdict: Conformance::Optional,
1430                when: Condition::Feature(1),
1431            }],
1432        },
1433    },
1434    Event {
1435        id: 0x02,
1436        name: "BatChargeFaultChange",
1437        priority: EventPriority::Info,
1438        access: Access::read_only(Privilege::View),
1439        conform: Conform {
1440            clauses: &[Clause {
1441                verdict: Conformance::Optional,
1442                when: Condition::Feature(2),
1443            }],
1444        },
1445    },
1446];
1447
1448/// The whole cluster, as the specification defines it.
1449pub const CLUSTER: Cluster = Cluster {
1450    id: ID,
1451    name: "Power Source",
1452    revision: REVISION,
1453    pics: "PS",
1454    derived_from: None,
1455    features: FEATURES,
1456    attributes: ATTRIBUTES,
1457    commands: COMMANDS,
1458    events: EVENTS,
1459};