matter-kit 0.3.0

Matter (CSA smart-home standard) protocol implementation in Rust: no_std, no-alloc, executor-agnostic
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
// Generated by `cargo xtask` from the CSA data model 1.6. Do not edit.
//
// OTA Software Update Provider — cluster 0x0029.
//
// Regenerate with `cargo xtask clusters --dm <checkout>/data_model/1.6`; `cargo xtask check`
// is the CI gate that keeps this file honest. The XML itself is not vendored here — it
// carries the CSA's own copyright notice and is not redistributable.

//! OTA Software Update Provider (cluster `0x0029`, revision 1).
//!
//! 5 identifiers, 0 feature bits, and the specification's own conformance for
//! every element. `CLUSTER` is the whole table.

#![allow(unused_imports)]

use crate::dm::conformance::{Clause, Condition, Conform, Conformance};
use crate::dm::meta::{EventPriority, Reporting};
use crate::dm::spec::{Attribute, Cluster, Command, Event, Feature};
use crate::dm::{Access, AccessQualities, AttributeQualities, Privilege};
use crate::error::Result;
use crate::im::{AttributeId, ClusterId, CommandId, EventId};
use crate::tlv::{
    ContainerKind, Element, FromTlv, Nullable, Tag, TlvList, TlvReader, TlvWriter, ToTlv, Value,
};

/// The cluster id.
pub const ID: ClusterId = 0x0029;

/// The highest revision the specification's history defines — what `ClusterRevision`
/// must report (Core §7.13.1).
pub const REVISION: u16 = 1;

/// The PICS code, which a certification declaration names the cluster by.
pub const PICS: &str = "OTAP";

/// This cluster defines no features, so its `FeatureMap` is always zero.
pub const FEATURES: &[Feature] = &[];

/// The command ids.
pub mod command {
    use crate::im::CommandId;

    /// `QueryImage`.
    pub const QUERY_IMAGE: CommandId = 0x00;
    /// `QueryImageResponse`.
    pub const QUERY_IMAGE_RESPONSE: CommandId = 0x01;
    /// `ApplyUpdateRequest`.
    pub const APPLY_UPDATE_REQUEST: CommandId = 0x02;
    /// `ApplyUpdateResponse`.
    pub const APPLY_UPDATE_RESPONSE: CommandId = 0x03;
    /// `NotifyUpdateApplied`.
    pub const NOTIFY_UPDATE_APPLIED: CommandId = 0x04;
}

/// `ApplyUpdateActionEnum`.
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[repr(u8)]
pub enum ApplyUpdateActionEnum {
    /// Apply the update.
    Proceed = 0,
    /// Wait at least the given delay time.
    AwaitNextAction = 1,
    /// The OTA Provider is conveying a desire to rescind a previously provided Software Image.
    Discontinue = 2,
}

impl ApplyUpdateActionEnum {
    /// Reads a wire value, or `None` for one this revision does not define.
    #[must_use]
    pub const fn from_value(value: u8) -> Option<Self> {
        match value {
            0 => Some(Self::Proceed),
            1 => Some(Self::AwaitNextAction),
            2 => Some(Self::Discontinue),
            _ => None,
        }
    }

    /// Its wire value.
    #[must_use]
    pub const fn value(self) -> u8 {
        self as u8
    }
}

impl ToTlv for ApplyUpdateActionEnum {
    fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
        self.value().to_tlv(w, tag)
    }
}

impl<'a> FromTlv<'a> for ApplyUpdateActionEnum {
    fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
        let value = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
        Self::from_value(value).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
    }
}

/// `DownloadProtocolEnum`.
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[repr(u8)]
pub enum DownloadProtocolEnum {
    /// Indicates support for synchronous BDX.
    BDXSynchronous = 0,
    /// Indicates support for asynchronous BDX.
    BDXAsynchronous = 1,
    /// Indicates support for HTTPS.
    HTTPS = 2,
    /// Indicates support for vendor specific protocol.
    VendorSpecific = 3,
}

impl DownloadProtocolEnum {
    /// Reads a wire value, or `None` for one this revision does not define.
    #[must_use]
    pub const fn from_value(value: u8) -> Option<Self> {
        match value {
            0 => Some(Self::BDXSynchronous),
            1 => Some(Self::BDXAsynchronous),
            2 => Some(Self::HTTPS),
            3 => Some(Self::VendorSpecific),
            _ => None,
        }
    }

    /// Its wire value.
    #[must_use]
    pub const fn value(self) -> u8 {
        self as u8
    }
}

impl ToTlv for DownloadProtocolEnum {
    fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
        self.value().to_tlv(w, tag)
    }
}

impl<'a> FromTlv<'a> for DownloadProtocolEnum {
    fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
        let value = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
        Self::from_value(value).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
    }
}

/// `StatusEnum`.
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[repr(u8)]
pub enum StatusEnum {
    /// Indicates that the OTA Provider has an update available.
    UpdateAvailable = 0,
    /// Indicates OTA Provider may have an update, but it is not ready yet.
    Busy = 1,
    /// Indicates that there is definitely no update currently available from the OTA Provider.
    NotAvailable = 2,
    /// Indicates that the requested download protocol is not supported by the OTA Provider.
    DownloadProtocolNotSupported = 3,
}

impl StatusEnum {
    /// Reads a wire value, or `None` for one this revision does not define.
    #[must_use]
    pub const fn from_value(value: u8) -> Option<Self> {
        match value {
            0 => Some(Self::UpdateAvailable),
            1 => Some(Self::Busy),
            2 => Some(Self::NotAvailable),
            3 => Some(Self::DownloadProtocolNotSupported),
            _ => None,
        }
    }

    /// Its wire value.
    #[must_use]
    pub const fn value(self) -> u8 {
        self as u8
    }
}

impl ToTlv for StatusEnum {
    fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
        self.value().to_tlv(w, tag)
    }
}

impl<'a> FromTlv<'a> for StatusEnum {
    fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
        let value = <u8 as FromTlv<'a>>::from_tlv(reader, element)?;
        Self::from_value(value).ok_or(crate::Error::new(crate::ErrorCode::TlvOutOfRange))
    }
}

/// The fields of `QueryImage` (command `0x00`).
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct QueryImageFields<'a> {
    /// `VendorID`, field 0.
    pub vendor_id: crate::msg::VendorId,
    /// `ProductID`, field 1.
    pub product_id: u16,
    /// `SoftwareVersion`, field 2.
    pub software_version: u32,
    /// `ProtocolsSupported`, field 3.
    pub protocols_supported: TlvList<'a, DownloadProtocolEnum>,
    /// `HardwareVersion`, field 4.
    pub hardware_version: Option<u16>,
    /// `Location`, field 5.
    pub location: Option<&'a str>,
    /// `RequestorCanConsent`, field 6.
    pub requestor_can_consent: Option<bool>,
    /// `MetadataForProvider`, field 7.
    pub metadata_for_provider: Option<&'a [u8]>,
}

impl<'a> ToTlv for QueryImageFields<'a> {
    fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
        w.start_structure(tag)?;
        self.vendor_id.to_tlv(w, Tag::Context(0))?;
        self.product_id.to_tlv(w, Tag::Context(1))?;
        self.software_version.to_tlv(w, Tag::Context(2))?;
        self.protocols_supported.to_tlv(w, Tag::Context(3))?;
        if let Some(value) = &self.hardware_version {
            value.to_tlv(w, Tag::Context(4))?;
        }
        if let Some(value) = &self.location {
            value.to_tlv(w, Tag::Context(5))?;
        }
        if let Some(value) = &self.requestor_can_consent {
            value.to_tlv(w, Tag::Context(6))?;
        }
        if let Some(value) = &self.metadata_for_provider {
            value.to_tlv(w, Tag::Context(7))?;
        }
        w.end_container()
    }
}

impl<'a> FromTlv<'a> for QueryImageFields<'a> {
    fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
        if element.value.container() != Some(ContainerKind::Structure) {
            return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
        }
        let mut vendor_id = None;
        let mut product_id = None;
        let mut software_version = None;
        let mut protocols_supported = None;
        let mut hardware_version = None;
        let mut location = None;
        let mut requestor_can_consent = None;
        let mut metadata_for_provider = None;
        loop {
            let Some(field) = reader.next_element()? else {
                return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
            };
            if field.value == Value::EndOfContainer {
                break;
            }
            match field.tag.context() {
                Some(0) => vendor_id = Some(<crate::msg::VendorId>::from_tlv(reader, &field)?),
                Some(1) => product_id = Some(<u16>::from_tlv(reader, &field)?),
                Some(2) => software_version = Some(<u32>::from_tlv(reader, &field)?),
                Some(3) => {
                    protocols_supported = Some(<TlvList<'a, DownloadProtocolEnum>>::from_tlv(
                        reader, &field,
                    )?)
                }
                Some(4) => hardware_version = Some(<u16>::from_tlv(reader, &field)?),
                Some(5) => location = Some(<&'a str>::from_tlv(reader, &field)?),
                Some(6) => requestor_can_consent = Some(<bool>::from_tlv(reader, &field)?),
                Some(7) => metadata_for_provider = Some(<&'a [u8]>::from_tlv(reader, &field)?),
                // A field this revision does not define. §7.19.2: a receiver
                // ignores what it does not know rather than refusing the whole
                // structure, which is what lets a newer peer talk to an older one.
                _ => reader.skip_value(&field)?,
            }
        }
        Ok(Self {
            vendor_id: vendor_id.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
            product_id: product_id.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
            software_version: software_version
                .ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
            protocols_supported: protocols_supported
                .ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
            hardware_version,
            location,
            requestor_can_consent,
            metadata_for_provider,
        })
    }
}

/// The fields of `QueryImageResponse` (command `0x01`).
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct QueryImageResponseFields<'a> {
    /// `Status`, field 0.
    pub status: StatusEnum,
    /// `DelayedActionTime`, field 1.
    pub delayed_action_time: Option<u32>,
    /// `ImageURI`, field 2.
    pub image_uri: Option<&'a str>,
    /// `SoftwareVersion`, field 3.
    pub software_version: Option<u32>,
    /// `SoftwareVersionString`, field 4.
    pub software_version_string: Option<&'a str>,
    /// `UpdateToken`, field 5.
    pub update_token: Option<&'a [u8]>,
    /// `UserConsentNeeded`, field 6.
    pub user_consent_needed: Option<bool>,
    /// `MetadataForRequestor`, field 7.
    pub metadata_for_requestor: Option<&'a [u8]>,
}

impl<'a> ToTlv for QueryImageResponseFields<'a> {
    fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
        w.start_structure(tag)?;
        self.status.to_tlv(w, Tag::Context(0))?;
        if let Some(value) = &self.delayed_action_time {
            value.to_tlv(w, Tag::Context(1))?;
        }
        if let Some(value) = &self.image_uri {
            value.to_tlv(w, Tag::Context(2))?;
        }
        if let Some(value) = &self.software_version {
            value.to_tlv(w, Tag::Context(3))?;
        }
        if let Some(value) = &self.software_version_string {
            value.to_tlv(w, Tag::Context(4))?;
        }
        if let Some(value) = &self.update_token {
            value.to_tlv(w, Tag::Context(5))?;
        }
        if let Some(value) = &self.user_consent_needed {
            value.to_tlv(w, Tag::Context(6))?;
        }
        if let Some(value) = &self.metadata_for_requestor {
            value.to_tlv(w, Tag::Context(7))?;
        }
        w.end_container()
    }
}

impl<'a> FromTlv<'a> for QueryImageResponseFields<'a> {
    fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
        if element.value.container() != Some(ContainerKind::Structure) {
            return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
        }
        let mut status = None;
        let mut delayed_action_time = None;
        let mut image_uri = None;
        let mut software_version = None;
        let mut software_version_string = None;
        let mut update_token = None;
        let mut user_consent_needed = None;
        let mut metadata_for_requestor = None;
        loop {
            let Some(field) = reader.next_element()? else {
                return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
            };
            if field.value == Value::EndOfContainer {
                break;
            }
            match field.tag.context() {
                Some(0) => status = Some(<StatusEnum>::from_tlv(reader, &field)?),
                Some(1) => delayed_action_time = Some(<u32>::from_tlv(reader, &field)?),
                Some(2) => image_uri = Some(<&'a str>::from_tlv(reader, &field)?),
                Some(3) => software_version = Some(<u32>::from_tlv(reader, &field)?),
                Some(4) => software_version_string = Some(<&'a str>::from_tlv(reader, &field)?),
                Some(5) => update_token = Some(<&'a [u8]>::from_tlv(reader, &field)?),
                Some(6) => user_consent_needed = Some(<bool>::from_tlv(reader, &field)?),
                Some(7) => metadata_for_requestor = Some(<&'a [u8]>::from_tlv(reader, &field)?),
                // A field this revision does not define. §7.19.2: a receiver
                // ignores what it does not know rather than refusing the whole
                // structure, which is what lets a newer peer talk to an older one.
                _ => reader.skip_value(&field)?,
            }
        }
        Ok(Self {
            status: status.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
            delayed_action_time,
            image_uri,
            software_version,
            software_version_string,
            update_token,
            user_consent_needed,
            metadata_for_requestor,
        })
    }
}

/// The fields of `ApplyUpdateRequest` (command `0x02`).
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct ApplyUpdateRequestFields<'a> {
    /// `UpdateToken`, field 0.
    pub update_token: &'a [u8],
    /// `NewVersion`, field 1.
    pub new_version: u32,
}

impl<'a> ToTlv for ApplyUpdateRequestFields<'a> {
    fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
        w.start_structure(tag)?;
        self.update_token.to_tlv(w, Tag::Context(0))?;
        self.new_version.to_tlv(w, Tag::Context(1))?;
        w.end_container()
    }
}

impl<'a> FromTlv<'a> for ApplyUpdateRequestFields<'a> {
    fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
        if element.value.container() != Some(ContainerKind::Structure) {
            return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
        }
        let mut update_token = None;
        let mut new_version = None;
        loop {
            let Some(field) = reader.next_element()? else {
                return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
            };
            if field.value == Value::EndOfContainer {
                break;
            }
            match field.tag.context() {
                Some(0) => update_token = Some(<&'a [u8]>::from_tlv(reader, &field)?),
                Some(1) => new_version = Some(<u32>::from_tlv(reader, &field)?),
                // A field this revision does not define. §7.19.2: a receiver
                // ignores what it does not know rather than refusing the whole
                // structure, which is what lets a newer peer talk to an older one.
                _ => reader.skip_value(&field)?,
            }
        }
        Ok(Self {
            update_token: update_token.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
            new_version: new_version.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
        })
    }
}

/// The fields of `ApplyUpdateResponse` (command `0x03`).
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct ApplyUpdateResponseFields {
    /// `Action`, field 0.
    pub action: ApplyUpdateActionEnum,
    /// `DelayedActionTime`, field 1.
    pub delayed_action_time: u32,
}

impl ToTlv for ApplyUpdateResponseFields {
    fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
        w.start_structure(tag)?;
        self.action.to_tlv(w, Tag::Context(0))?;
        self.delayed_action_time.to_tlv(w, Tag::Context(1))?;
        w.end_container()
    }
}

impl<'a> FromTlv<'a> for ApplyUpdateResponseFields {
    fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
        if element.value.container() != Some(ContainerKind::Structure) {
            return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
        }
        let mut action = None;
        let mut delayed_action_time = None;
        loop {
            let Some(field) = reader.next_element()? else {
                return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
            };
            if field.value == Value::EndOfContainer {
                break;
            }
            match field.tag.context() {
                Some(0) => action = Some(<ApplyUpdateActionEnum>::from_tlv(reader, &field)?),
                Some(1) => delayed_action_time = Some(<u32>::from_tlv(reader, &field)?),
                // A field this revision does not define. §7.19.2: a receiver
                // ignores what it does not know rather than refusing the whole
                // structure, which is what lets a newer peer talk to an older one.
                _ => reader.skip_value(&field)?,
            }
        }
        Ok(Self {
            action: action.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
            delayed_action_time: delayed_action_time
                .ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
        })
    }
}

/// The fields of `NotifyUpdateApplied` (command `0x04`).
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct NotifyUpdateAppliedFields<'a> {
    /// `UpdateToken`, field 0.
    pub update_token: &'a [u8],
    /// `SoftwareVersion`, field 1.
    pub software_version: u32,
}

impl<'a> ToTlv for NotifyUpdateAppliedFields<'a> {
    fn to_tlv(&self, w: &mut TlvWriter<'_>, tag: Tag) -> Result<()> {
        w.start_structure(tag)?;
        self.update_token.to_tlv(w, Tag::Context(0))?;
        self.software_version.to_tlv(w, Tag::Context(1))?;
        w.end_container()
    }
}

impl<'a> FromTlv<'a> for NotifyUpdateAppliedFields<'a> {
    fn from_tlv(reader: &mut TlvReader<'a>, element: &Element<'a>) -> Result<Self> {
        if element.value.container() != Some(ContainerKind::Structure) {
            return Err(crate::Error::new(crate::ErrorCode::TlvWrongType));
        }
        let mut update_token = None;
        let mut software_version = None;
        loop {
            let Some(field) = reader.next_element()? else {
                return Err(crate::Error::new(crate::ErrorCode::TlvTruncated));
            };
            if field.value == Value::EndOfContainer {
                break;
            }
            match field.tag.context() {
                Some(0) => update_token = Some(<&'a [u8]>::from_tlv(reader, &field)?),
                Some(1) => software_version = Some(<u32>::from_tlv(reader, &field)?),
                // A field this revision does not define. §7.19.2: a receiver
                // ignores what it does not know rather than refusing the whole
                // structure, which is what lets a newer peer talk to an older one.
                _ => reader.skip_value(&field)?,
            }
        }
        Ok(Self {
            update_token: update_token.ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
            software_version: software_version
                .ok_or(crate::Error::new(crate::ErrorCode::TlvNotFound))?,
        })
    }
}

/// Every attribute the specification defines, with its conformance.
pub const ATTRIBUTES: &[Attribute] = &[];

/// Every command, with its conformance.
pub const COMMANDS: &[Command] = &[
    Command {
        id: 0x00,
        name: "QueryImage",
        to_server: true,
        response: Some(0x01),
        access: Access::invoke(Privilege::Operate),
        conform: Conform::MANDATORY,
    },
    Command {
        id: 0x01,
        name: "QueryImageResponse",
        to_server: false,
        response: None,
        access: Access::invoke(Privilege::Operate),
        conform: Conform::MANDATORY,
    },
    Command {
        id: 0x02,
        name: "ApplyUpdateRequest",
        to_server: true,
        response: Some(0x03),
        access: Access::invoke(Privilege::Operate),
        conform: Conform::MANDATORY,
    },
    Command {
        id: 0x03,
        name: "ApplyUpdateResponse",
        to_server: false,
        response: None,
        access: Access::invoke(Privilege::Operate),
        conform: Conform::MANDATORY,
    },
    Command {
        id: 0x04,
        name: "NotifyUpdateApplied",
        to_server: true,
        response: None,
        access: Access::invoke(Privilege::Operate),
        conform: Conform::MANDATORY,
    },
];

/// Every event, with its conformance.
pub const EVENTS: &[Event] = &[];

/// The whole cluster, as the specification defines it.
pub const CLUSTER: Cluster = Cluster {
    id: ID,
    name: "OTA Software Update Provider",
    revision: REVISION,
    pics: "OTAP",
    derived_from: None,
    features: FEATURES,
    attributes: ATTRIBUTES,
    commands: COMMANDS,
    events: EVENTS,
};