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 = 0x0030;
28
29pub const REVISION: u16 = 2;
32
33pub const PICS: &str = "CGEN";
35
36pub mod feature {
41 pub const TERMS_AND_CONDITIONS: u32 = 1 << 0;
45 pub const NETWORK_RECOVERY: u32 = 1 << 1;
49}
50
51pub const FEATURES: &[Feature] = &[
53 Feature {
54 bit: 0,
55 code: "TC",
56 name: "TermsAndConditions",
57 conform: Conform::OPTIONAL,
58 },
59 Feature {
60 bit: 1,
61 code: "NR",
62 name: "NetworkRecovery",
63 conform: Conform {
64 clauses: &[
65 Clause {
66 verdict: Conformance::Provisional,
67 when: Condition::Always,
68 },
69 Clause {
70 verdict: Conformance::Optional,
71 when: Condition::Always,
72 },
73 ],
74 },
75 },
76];
77
78pub mod attribute {
80 use crate::im::AttributeId;
81
82 pub const BREADCRUMB: AttributeId = 0x00;
84 pub const BASIC_COMMISSIONING_INFO: AttributeId = 0x01;
86 pub const REGULATORY_CONFIG: AttributeId = 0x02;
88 pub const LOCATION_CAPABILITY: AttributeId = 0x03;
90 pub const SUPPORTS_CONCURRENT_CONNECTION: AttributeId = 0x04;
92 pub const TC_ACCEPTED_VERSION: AttributeId = 0x05;
94 pub const TC_MIN_REQUIRED_VERSION: AttributeId = 0x06;
96 pub const TC_ACKNOWLEDGEMENTS: AttributeId = 0x07;
98 pub const TC_ACKNOWLEDGEMENTS_REQUIRED: AttributeId = 0x08;
100 pub const TC_UPDATE_DEADLINE: AttributeId = 0x09;
102 pub const RECOVERY_IDENTIFIER: AttributeId = 0x0A;
104 pub const NETWORK_RECOVERY_REASON: AttributeId = 0x0B;
106 pub const IS_COMMISSIONING_WITHOUT_POWER: AttributeId = 0x0C;
108}
109
110pub mod command {
112 use crate::im::CommandId;
113
114 pub const ARM_FAIL_SAFE: CommandId = 0x00;
116 pub const ARM_FAIL_SAFE_RESPONSE: CommandId = 0x01;
118 pub const SET_REGULATORY_CONFIG: CommandId = 0x02;
120 pub const SET_REGULATORY_CONFIG_RESPONSE: CommandId = 0x03;
122 pub const COMMISSIONING_COMPLETE: CommandId = 0x04;
124 pub const COMMISSIONING_COMPLETE_RESPONSE: CommandId = 0x05;
126 pub const SET_TC_ACKNOWLEDGEMENTS: CommandId = 0x06;
128 pub const SET_TC_ACKNOWLEDGEMENTS_RESPONSE: CommandId = 0x07;
130}
131
132#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
134#[repr(u8)]
135pub enum CommissioningErrorEnum {
136 OK = 0,
138 ValueOutsideRange = 1,
140 InvalidAuthentication = 2,
142 NoFailSafe = 3,
144 BusyWithOtherAdmin = 4,
146 RequiredTCNotAccepted = 5,
148 TCAcknowledgementsNotReceived = 6,
150 TCMinVersionNotMet = 7,
152}
153
154impl CommissioningErrorEnum {
155 #[must_use]
157 pub const fn from_value(value: u8) -> Option<Self> {
158 match value {
159 0 => Some(Self::OK),
160 1 => Some(Self::ValueOutsideRange),
161 2 => Some(Self::InvalidAuthentication),
162 3 => Some(Self::NoFailSafe),
163 4 => Some(Self::BusyWithOtherAdmin),
164 5 => Some(Self::RequiredTCNotAccepted),
165 6 => Some(Self::TCAcknowledgementsNotReceived),
166 7 => Some(Self::TCMinVersionNotMet),
167 _ => None,
168 }
169 }
170
171 #[must_use]
173 pub const fn value(self) -> u8 {
174 self as u8
175 }
176}
177
178impl ToTlv for CommissioningErrorEnum {
179 fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
180 self.value().to_tlv(w, tag)
181 }
182}
183
184impl<'a> FromTlv<'a> for CommissioningErrorEnum {
185 fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
186 let value = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
187 Self::from_value(value).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
188 }
189}
190
191#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
193#[repr(u8)]
194pub enum NetworkRecoveryReasonEnum {
195 Unspecified = 0,
197 Auth = 1,
199 Visibility = 2,
201}
202
203impl NetworkRecoveryReasonEnum {
204 #[must_use]
206 pub const fn from_value(value: u8) -> Option<Self> {
207 match value {
208 0 => Some(Self::Unspecified),
209 1 => Some(Self::Auth),
210 2 => Some(Self::Visibility),
211 _ => None,
212 }
213 }
214
215 #[must_use]
217 pub const fn value(self) -> u8 {
218 self as u8
219 }
220}
221
222impl ToTlv for NetworkRecoveryReasonEnum {
223 fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
224 self.value().to_tlv(w, tag)
225 }
226}
227
228impl<'a> FromTlv<'a> for NetworkRecoveryReasonEnum {
229 fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
230 let value = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
231 Self::from_value(value).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
232 }
233}
234
235#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
237#[repr(u8)]
238pub enum RegulatoryLocationTypeEnum {
239 Indoor = 0,
241 Outdoor = 1,
243 IndoorOutdoor = 2,
245}
246
247impl RegulatoryLocationTypeEnum {
248 #[must_use]
250 pub const fn from_value(value: u8) -> Option<Self> {
251 match value {
252 0 => Some(Self::Indoor),
253 1 => Some(Self::Outdoor),
254 2 => Some(Self::IndoorOutdoor),
255 _ => None,
256 }
257 }
258
259 #[must_use]
261 pub const fn value(self) -> u8 {
262 self as u8
263 }
264}
265
266impl ToTlv for RegulatoryLocationTypeEnum {
267 fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
268 self.value().to_tlv(w, tag)
269 }
270}
271
272impl<'a> FromTlv<'a> for RegulatoryLocationTypeEnum {
273 fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
274 let value = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
275 Self::from_value(value).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
276 }
277}
278
279#[derive(Debug, Clone, Copy, PartialEq)]
281pub struct BasicCommissioningInfo {
282 pub fail_safe_expiry_length_seconds: u16,
284 pub max_cumulative_failsafe_seconds: u16,
286}
287
288impl ToTlv for BasicCommissioningInfo {
289 fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
290 w.start_structure(tag)?;
291 self.fail_safe_expiry_length_seconds
292 .to_tlv(w, Tag::Context(0))?;
293 self.max_cumulative_failsafe_seconds
294 .to_tlv(w, Tag::Context(1))?;
295 w.end_container()
296 }
297}
298
299impl<'a> FromTlv<'a> for BasicCommissioningInfo {
300 fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
301 if element.value.container() != Some(ContainerKind::Structure) {
302 return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
303 }
304 let mut fail_safe_expiry_length_seconds = None;
305 let mut max_cumulative_failsafe_seconds = None;
306 loop {
307 let Some(field) = reader.next_element()? else {
308 return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
309 };
310 if field.value == Value::EndOfContainer {
311 break;
312 }
313 match field.tag.context() {
314 Some(0) => fail_safe_expiry_length_seconds = Some(<u16>::from_tlv(reader, &field)?),
315 Some(1) => max_cumulative_failsafe_seconds = Some(<u16>::from_tlv(reader, &field)?),
316 _ => reader.skip_value(&field)?,
320 }
321 }
322 Ok(Self {
323 fail_safe_expiry_length_seconds: fail_safe_expiry_length_seconds
324 .ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
325 max_cumulative_failsafe_seconds: max_cumulative_failsafe_seconds
326 .ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
327 })
328 }
329}
330
331#[derive(Debug, Clone, Copy, PartialEq)]
333pub struct ArmFailSafeFields {
334 pub expiry_length_seconds: u16,
336 pub breadcrumb: u64,
338}
339
340impl ToTlv for ArmFailSafeFields {
341 fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
342 w.start_structure(tag)?;
343 self.expiry_length_seconds.to_tlv(w, Tag::Context(0))?;
344 self.breadcrumb.to_tlv(w, Tag::Context(1))?;
345 w.end_container()
346 }
347}
348
349impl<'a> FromTlv<'a> for ArmFailSafeFields {
350 fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
351 if element.value.container() != Some(ContainerKind::Structure) {
352 return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
353 }
354 let mut expiry_length_seconds = None;
355 let mut breadcrumb = None;
356 loop {
357 let Some(field) = reader.next_element()? else {
358 return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
359 };
360 if field.value == Value::EndOfContainer {
361 break;
362 }
363 match field.tag.context() {
364 Some(0) => expiry_length_seconds = Some(<u16>::from_tlv(reader, &field)?),
365 Some(1) => breadcrumb = Some(<u64>::from_tlv(reader, &field)?),
366 _ => reader.skip_value(&field)?,
370 }
371 }
372 Ok(Self {
373 expiry_length_seconds: expiry_length_seconds
374 .ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
375 breadcrumb: breadcrumb.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
376 })
377 }
378}
379
380#[derive(Debug, Clone, Copy, PartialEq)]
382pub struct ArmFailSafeResponseFields<'a> {
383 pub error_code: CommissioningErrorEnum,
385 pub debug_text: &'a str,
387}
388
389impl<'a> ToTlv for ArmFailSafeResponseFields<'a> {
390 fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
391 w.start_structure(tag)?;
392 self.error_code.to_tlv(w, Tag::Context(0))?;
393 self.debug_text.to_tlv(w, Tag::Context(1))?;
394 w.end_container()
395 }
396}
397
398impl<'a> FromTlv<'a> for ArmFailSafeResponseFields<'a> {
399 fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
400 if element.value.container() != Some(ContainerKind::Structure) {
401 return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
402 }
403 let mut error_code = None;
404 let mut debug_text = None;
405 loop {
406 let Some(field) = reader.next_element()? else {
407 return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
408 };
409 if field.value == Value::EndOfContainer {
410 break;
411 }
412 match field.tag.context() {
413 Some(0) => error_code = Some(<CommissioningErrorEnum>::from_tlv(reader, &field)?),
414 Some(1) => debug_text = Some(<&'a str>::from_tlv(reader, &field)?),
415 _ => reader.skip_value(&field)?,
419 }
420 }
421 Ok(Self {
422 error_code: error_code.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
423 debug_text: debug_text.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
424 })
425 }
426}
427
428#[derive(Debug, Clone, Copy, PartialEq)]
430pub struct SetRegulatoryConfigFields<'a> {
431 pub new_regulatory_config: RegulatoryLocationTypeEnum,
433 pub country_code: &'a str,
435 pub breadcrumb: u64,
437}
438
439impl<'a> ToTlv for SetRegulatoryConfigFields<'a> {
440 fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
441 w.start_structure(tag)?;
442 self.new_regulatory_config.to_tlv(w, Tag::Context(0))?;
443 self.country_code.to_tlv(w, Tag::Context(1))?;
444 self.breadcrumb.to_tlv(w, Tag::Context(2))?;
445 w.end_container()
446 }
447}
448
449impl<'a> FromTlv<'a> for SetRegulatoryConfigFields<'a> {
450 fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
451 if element.value.container() != Some(ContainerKind::Structure) {
452 return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
453 }
454 let mut new_regulatory_config = None;
455 let mut country_code = None;
456 let mut breadcrumb = None;
457 loop {
458 let Some(field) = reader.next_element()? else {
459 return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
460 };
461 if field.value == Value::EndOfContainer {
462 break;
463 }
464 match field.tag.context() {
465 Some(0) => {
466 new_regulatory_config =
467 Some(<RegulatoryLocationTypeEnum>::from_tlv(reader, &field)?)
468 }
469 Some(1) => country_code = Some(<&'a str>::from_tlv(reader, &field)?),
470 Some(2) => breadcrumb = Some(<u64>::from_tlv(reader, &field)?),
471 _ => reader.skip_value(&field)?,
475 }
476 }
477 Ok(Self {
478 new_regulatory_config: new_regulatory_config
479 .ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
480 country_code: country_code.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
481 breadcrumb: breadcrumb.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
482 })
483 }
484}
485
486#[derive(Debug, Clone, Copy, PartialEq)]
488pub struct SetRegulatoryConfigResponseFields<'a> {
489 pub error_code: CommissioningErrorEnum,
491 pub debug_text: &'a str,
493}
494
495impl<'a> ToTlv for SetRegulatoryConfigResponseFields<'a> {
496 fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
497 w.start_structure(tag)?;
498 self.error_code.to_tlv(w, Tag::Context(0))?;
499 self.debug_text.to_tlv(w, Tag::Context(1))?;
500 w.end_container()
501 }
502}
503
504impl<'a> FromTlv<'a> for SetRegulatoryConfigResponseFields<'a> {
505 fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
506 if element.value.container() != Some(ContainerKind::Structure) {
507 return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
508 }
509 let mut error_code = None;
510 let mut debug_text = None;
511 loop {
512 let Some(field) = reader.next_element()? else {
513 return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
514 };
515 if field.value == Value::EndOfContainer {
516 break;
517 }
518 match field.tag.context() {
519 Some(0) => error_code = Some(<CommissioningErrorEnum>::from_tlv(reader, &field)?),
520 Some(1) => debug_text = Some(<&'a str>::from_tlv(reader, &field)?),
521 _ => reader.skip_value(&field)?,
525 }
526 }
527 Ok(Self {
528 error_code: error_code.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
529 debug_text: debug_text.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
530 })
531 }
532}
533
534#[derive(Debug, Clone, Copy, PartialEq)]
536pub struct CommissioningCompleteResponseFields<'a> {
537 pub error_code: CommissioningErrorEnum,
539 pub debug_text: &'a str,
541}
542
543impl<'a> ToTlv for CommissioningCompleteResponseFields<'a> {
544 fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
545 w.start_structure(tag)?;
546 self.error_code.to_tlv(w, Tag::Context(0))?;
547 self.debug_text.to_tlv(w, Tag::Context(1))?;
548 w.end_container()
549 }
550}
551
552impl<'a> FromTlv<'a> for CommissioningCompleteResponseFields<'a> {
553 fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
554 if element.value.container() != Some(ContainerKind::Structure) {
555 return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
556 }
557 let mut error_code = None;
558 let mut debug_text = None;
559 loop {
560 let Some(field) = reader.next_element()? else {
561 return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
562 };
563 if field.value == Value::EndOfContainer {
564 break;
565 }
566 match field.tag.context() {
567 Some(0) => error_code = Some(<CommissioningErrorEnum>::from_tlv(reader, &field)?),
568 Some(1) => debug_text = Some(<&'a str>::from_tlv(reader, &field)?),
569 _ => reader.skip_value(&field)?,
573 }
574 }
575 Ok(Self {
576 error_code: error_code.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
577 debug_text: debug_text.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
578 })
579 }
580}
581
582#[derive(Debug, Clone, Copy, PartialEq)]
584pub struct SetTCAcknowledgementsFields {
585 pub tc_version: u16,
587 pub tc_user_response: u16,
589}
590
591impl ToTlv for SetTCAcknowledgementsFields {
592 fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
593 w.start_structure(tag)?;
594 self.tc_version.to_tlv(w, Tag::Context(0))?;
595 self.tc_user_response.to_tlv(w, Tag::Context(1))?;
596 w.end_container()
597 }
598}
599
600impl<'a> FromTlv<'a> for SetTCAcknowledgementsFields {
601 fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
602 if element.value.container() != Some(ContainerKind::Structure) {
603 return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
604 }
605 let mut tc_version = None;
606 let mut tc_user_response = None;
607 loop {
608 let Some(field) = reader.next_element()? else {
609 return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
610 };
611 if field.value == Value::EndOfContainer {
612 break;
613 }
614 match field.tag.context() {
615 Some(0) => tc_version = Some(<u16>::from_tlv(reader, &field)?),
616 Some(1) => tc_user_response = Some(<u16>::from_tlv(reader, &field)?),
617 _ => reader.skip_value(&field)?,
621 }
622 }
623 Ok(Self {
624 tc_version: tc_version.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
625 tc_user_response: tc_user_response
626 .ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
627 })
628 }
629}
630
631#[derive(Debug, Clone, Copy, PartialEq)]
633pub struct SetTCAcknowledgementsResponseFields {
634 pub error_code: CommissioningErrorEnum,
636}
637
638impl ToTlv for SetTCAcknowledgementsResponseFields {
639 fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
640 w.start_structure(tag)?;
641 self.error_code.to_tlv(w, Tag::Context(0))?;
642 w.end_container()
643 }
644}
645
646impl<'a> FromTlv<'a> for SetTCAcknowledgementsResponseFields {
647 fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
648 if element.value.container() != Some(ContainerKind::Structure) {
649 return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
650 }
651 let mut error_code = None;
652 loop {
653 let Some(field) = reader.next_element()? else {
654 return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
655 };
656 if field.value == Value::EndOfContainer {
657 break;
658 }
659 match field.tag.context() {
660 Some(0) => error_code = Some(<CommissioningErrorEnum>::from_tlv(reader, &field)?),
661 _ => reader.skip_value(&field)?,
665 }
666 }
667 Ok(Self {
668 error_code: error_code.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
669 })
670 }
671}
672
673pub const ATTRIBUTES: &[Attribute] = &[
675 Attribute {
676 id: 0x0000,
677 name: "Breadcrumb",
678 kind: "uint64",
679 access: Access::read_write_with(Privilege::View, Privilege::Administer),
680 qualities: AttributeQualities::empty(),
681 reporting: Reporting::OnChange,
682 conform: Conform::MANDATORY,
683 },
684 Attribute {
685 id: 0x0001,
686 name: "BasicCommissioningInfo",
687 kind: "BasicCommissioningInfo",
688 access: Access::read_only(Privilege::View),
689 qualities: AttributeQualities::FIXED,
690 reporting: Reporting::OnChange,
691 conform: Conform::MANDATORY,
692 },
693 Attribute {
694 id: 0x0002,
695 name: "RegulatoryConfig",
696 kind: "RegulatoryLocationTypeEnum",
697 access: Access::read_only(Privilege::View),
698 qualities: AttributeQualities::empty(),
699 reporting: Reporting::OnChange,
700 conform: Conform::MANDATORY,
701 },
702 Attribute {
703 id: 0x0003,
704 name: "LocationCapability",
705 kind: "RegulatoryLocationTypeEnum",
706 access: Access::read_only(Privilege::View),
707 qualities: AttributeQualities::FIXED,
708 reporting: Reporting::OnChange,
709 conform: Conform::MANDATORY,
710 },
711 Attribute {
712 id: 0x0004,
713 name: "SupportsConcurrentConnection",
714 kind: "bool",
715 access: Access::read_only(Privilege::View),
716 qualities: AttributeQualities::FIXED,
717 reporting: Reporting::OnChange,
718 conform: Conform::MANDATORY,
719 },
720 Attribute {
721 id: 0x0005,
722 name: "TCAcceptedVersion",
723 kind: "uint16",
724 access: Access::read_only(Privilege::Administer),
725 qualities: AttributeQualities::NON_VOLATILE,
726 reporting: Reporting::OnChange,
727 conform: Conform {
728 clauses: &[Clause {
729 verdict: Conformance::Mandatory,
730 when: Condition::Feature(0),
731 }],
732 },
733 },
734 Attribute {
735 id: 0x0006,
736 name: "TCMinRequiredVersion",
737 kind: "uint16",
738 access: Access::read_only(Privilege::Administer),
739 qualities: AttributeQualities::NON_VOLATILE,
740 reporting: Reporting::OnChange,
741 conform: Conform {
742 clauses: &[Clause {
743 verdict: Conformance::Mandatory,
744 when: Condition::Feature(0),
745 }],
746 },
747 },
748 Attribute {
749 id: 0x0007,
750 name: "TCAcknowledgements",
751 kind: "map16",
752 access: Access::read_only(Privilege::Administer),
753 qualities: AttributeQualities::NON_VOLATILE,
754 reporting: Reporting::OnChange,
755 conform: Conform {
756 clauses: &[Clause {
757 verdict: Conformance::Mandatory,
758 when: Condition::Feature(0),
759 }],
760 },
761 },
762 Attribute {
763 id: 0x0008,
764 name: "TCAcknowledgementsRequired",
765 kind: "bool",
766 access: Access::read_only(Privilege::Administer),
767 qualities: AttributeQualities::NON_VOLATILE,
768 reporting: Reporting::OnChange,
769 conform: Conform {
770 clauses: &[Clause {
771 verdict: Conformance::Mandatory,
772 when: Condition::Feature(0),
773 }],
774 },
775 },
776 Attribute {
777 id: 0x0009,
778 name: "TCUpdateDeadline",
779 kind: "uint32",
780 access: Access::read_only(Privilege::Administer),
781 qualities: AttributeQualities::NULLABLE.union(AttributeQualities::NON_VOLATILE),
782 reporting: Reporting::OnChange,
783 conform: Conform {
784 clauses: &[Clause {
785 verdict: Conformance::Mandatory,
786 when: Condition::Feature(0),
787 }],
788 },
789 },
790 Attribute {
791 id: 0x000A,
792 name: "RecoveryIdentifier",
793 kind: "octstr",
794 access: Access::read_only(Privilege::Manage),
795 qualities: AttributeQualities::NON_VOLATILE,
796 reporting: Reporting::OnChange,
797 conform: Conform {
798 clauses: &[
799 Clause {
800 verdict: Conformance::Provisional,
801 when: Condition::Always,
802 },
803 Clause {
804 verdict: Conformance::Mandatory,
805 when: Condition::Feature(1),
806 },
807 ],
808 },
809 },
810 Attribute {
811 id: 0x000B,
812 name: "NetworkRecoveryReason",
813 kind: "NetworkRecoveryReasonEnum",
814 access: Access::read_only(Privilege::Manage),
815 qualities: AttributeQualities::NULLABLE,
816 reporting: Reporting::OnChange,
817 conform: Conform {
818 clauses: &[
819 Clause {
820 verdict: Conformance::Provisional,
821 when: Condition::Always,
822 },
823 Clause {
824 verdict: Conformance::Mandatory,
825 when: Condition::Feature(1),
826 },
827 ],
828 },
829 },
830 Attribute {
831 id: 0x000C,
832 name: "IsCommissioningWithoutPower",
833 kind: "bool",
834 access: Access::read_only(Privilege::View),
835 qualities: AttributeQualities::empty(),
836 reporting: Reporting::OnChange,
837 conform: Conform {
838 clauses: &[
839 Clause {
840 verdict: Conformance::Provisional,
841 when: Condition::Always,
842 },
843 Clause {
844 verdict: Conformance::Optional,
845 when: Condition::Always,
846 },
847 ],
848 },
849 },
850];
851
852pub const COMMANDS: &[Command] = &[
854 Command {
855 id: 0x00,
856 name: "ArmFailSafe",
857 to_server: true,
858 response: Some(0x01),
859 access: Access::invoke(Privilege::Administer),
860 conform: Conform::MANDATORY,
861 },
862 Command {
863 id: 0x01,
864 name: "ArmFailSafeResponse",
865 to_server: false,
866 response: None,
867 access: Access::invoke(Privilege::Operate),
868 conform: Conform::MANDATORY,
869 },
870 Command {
871 id: 0x02,
872 name: "SetRegulatoryConfig",
873 to_server: true,
874 response: Some(0x03),
875 access: Access::invoke(Privilege::Administer),
876 conform: Conform::MANDATORY,
877 },
878 Command {
879 id: 0x03,
880 name: "SetRegulatoryConfigResponse",
881 to_server: false,
882 response: None,
883 access: Access::invoke(Privilege::Operate),
884 conform: Conform::MANDATORY,
885 },
886 Command {
887 id: 0x04,
888 name: "CommissioningComplete",
889 to_server: true,
890 response: Some(0x05),
891 access: Access::invoke(Privilege::Administer)
892 .with_qualities(AccessQualities::FABRIC_SCOPED),
893 conform: Conform::MANDATORY,
894 },
895 Command {
896 id: 0x05,
897 name: "CommissioningCompleteResponse",
898 to_server: false,
899 response: None,
900 access: Access::invoke(Privilege::Operate),
901 conform: Conform::MANDATORY,
902 },
903 Command {
904 id: 0x06,
905 name: "SetTCAcknowledgements",
906 to_server: true,
907 response: Some(0x07),
908 access: Access::invoke(Privilege::Administer),
909 conform: Conform {
910 clauses: &[Clause {
911 verdict: Conformance::Mandatory,
912 when: Condition::Feature(0),
913 }],
914 },
915 },
916 Command {
917 id: 0x07,
918 name: "SetTCAcknowledgementsResponse",
919 to_server: false,
920 response: None,
921 access: Access::invoke(Privilege::Operate),
922 conform: Conform {
923 clauses: &[Clause {
924 verdict: Conformance::Mandatory,
925 when: Condition::Feature(0),
926 }],
927 },
928 },
929];
930
931pub const EVENTS: &[Event] = &[];
933
934pub const CLUSTER: Cluster = Cluster {
936 id: ID,
937 name: "General Commissioning",
938 revision: REVISION,
939 pics: "CGEN",
940 derived_from: None,
941 features: FEATURES,
942 attributes: ATTRIBUTES,
943 commands: COMMANDS,
944 events: EVENTS,
945};