#![allow(
clippy::all,
clippy::pedantic,
dead_code,
unreachable_pub,
unused_imports
)]
use crate::datatypes::SemanticTagStruct;
use crate::error::ClusterError;
use crate::types::Nullable;
use matter_codec::{ContainerKind, Element, Tag, TlvReader, TlvWriter, Value};
pub const CLUSTER_ID: u32 = 0x003F;
pub const CLUSTER_REVISION: u16 = 2;
pub mod command_id {
pub const KEY_SET_WRITE: u32 = 0x00;
pub const KEY_SET_READ: u32 = 0x01;
pub const KEY_SET_READ_RESPONSE: u32 = 0x02;
pub const KEY_SET_REMOVE: u32 = 0x03;
pub const KEY_SET_READ_ALL_INDICES: u32 = 0x04;
pub const KEY_SET_READ_ALL_INDICES_RESPONSE: u32 = 0x05;
}
pub mod attribute_id {
pub const GROUP_KEY_MAP: u32 = 0x0000;
pub const GROUP_TABLE: u32 = 0x0001;
pub const MAX_GROUPS_PER_FABRIC: u32 = 0x0002;
pub const MAX_GROUP_KEYS_PER_FABRIC: u32 = 0x0003;
}
bitflags::bitflags! {
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
pub struct Feature: u32 {
const CS = 1 << 0;
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub struct GroupInfoMapStruct {
pub group_id: u16,
pub endpoints: Vec<u16>,
pub group_name: Option<String>,
pub fabric_index: u8,
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub struct GroupKeyMapStruct {
pub group_id: u16,
pub group_key_set_id: u16,
pub fabric_index: u8,
}
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub enum GroupKeyMulticastPolicyEnum {
PerGroupId,
AllNodes,
Unknown(u8),
}
impl GroupKeyMulticastPolicyEnum {
#[must_use]
pub fn from_raw(v: u8) -> Self {
match v {
0 => Self::PerGroupId,
1 => Self::AllNodes,
other => Self::Unknown(other),
}
}
#[must_use]
pub fn to_raw(self) -> u8 {
match self {
Self::PerGroupId => 0,
Self::AllNodes => 1,
Self::Unknown(v) => v,
}
}
}
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub enum GroupKeySecurityPolicyEnum {
TrustFirst,
CacheAndSync,
Unknown(u8),
}
impl GroupKeySecurityPolicyEnum {
#[must_use]
pub fn from_raw(v: u8) -> Self {
match v {
0 => Self::TrustFirst,
1 => Self::CacheAndSync,
other => Self::Unknown(other),
}
}
#[must_use]
pub fn to_raw(self) -> u8 {
match self {
Self::TrustFirst => 0,
Self::CacheAndSync => 1,
Self::Unknown(v) => v,
}
}
}
#[derive(Clone, Debug, PartialEq)]
pub struct GroupKeySetStruct {
pub group_key_set_id: u16,
pub group_key_security_policy: GroupKeySecurityPolicyEnum,
pub epoch_key0: Nullable<Vec<u8>>,
pub epoch_start_time0: Nullable<u64>,
pub epoch_key1: Nullable<Vec<u8>>,
pub epoch_start_time1: Nullable<u64>,
pub epoch_key2: Nullable<Vec<u8>>,
pub epoch_start_time2: Nullable<u64>,
pub group_key_multicast_policy: Option<GroupKeyMulticastPolicyEnum>,
pub fabric_index: Option<u8>,
}
impl GroupInfoMapStruct {
pub fn decode_from(r: &mut TlvReader<'_>) -> Result<Self, ClusterError> {
let mut f_group_id: Option<u16> = None;
let mut f_endpoints: Option<Vec<u16>> = None;
let mut f_group_name: Option<String> = None;
let mut f_fabric_index: Option<u8> = None;
loop {
match r.next()? {
Some(Element::ContainerEnd) => break,
Some(Element::Scalar {
tag: Tag::Context(1),
value: Value::Uint(v),
}) => {
f_group_id =
Some(u16::try_from(v).map_err(|_| ClusterError::InvalidLength("GroupId"))?)
}
Some(Element::ContainerStart {
tag: Tag::Context(2),
kind: ContainerKind::Array,
}) => {
let mut out = Vec::new();
loop {
match r.next()? {
Some(Element::ContainerEnd) => break,
Some(Element::Scalar {
value: Value::Uint(v),
..
}) => out.push(
u16::try_from(v)
.map_err(|_| ClusterError::InvalidLength("Endpoints"))?,
),
None => {
return Err(ClusterError::Tlv(
matter_codec::Error::UnclosedContainer,
))
}
Some(Element::ContainerStart { .. }) => r.skip_container()?,
Some(_) => {} }
}
f_endpoints = Some(out);
}
Some(Element::Scalar {
tag: Tag::Context(3),
value: Value::Utf8(v),
}) => f_group_name = Some(v),
Some(Element::Scalar {
tag: Tag::Context(254),
value: Value::Uint(v),
}) => {
f_fabric_index = Some(
u8::try_from(v).map_err(|_| ClusterError::InvalidLength("FabricIndex"))?,
)
}
None => return Err(ClusterError::Tlv(matter_codec::Error::UnclosedContainer)),
Some(Element::ContainerStart { .. }) => r.skip_container()?,
Some(_) => {} }
}
Ok(Self {
group_id: f_group_id.ok_or(ClusterError::MissingField("GroupId"))?,
endpoints: f_endpoints.ok_or(ClusterError::MissingField("Endpoints"))?,
group_name: f_group_name,
fabric_index: f_fabric_index.ok_or(ClusterError::MissingField("FabricIndex"))?,
})
}
pub fn decode(tlv: &[u8]) -> Result<Self, ClusterError> {
let mut r = TlvReader::new(tlv);
match r.next()? {
Some(Element::ContainerStart {
kind: ContainerKind::Structure,
..
}) => {}
_ => {
return Err(ClusterError::UnexpectedType {
context: "GroupInfoMapStruct",
})
}
}
Self::decode_from(&mut r)
}
}
impl GroupKeyMapStruct {
pub fn decode_from(r: &mut TlvReader<'_>) -> Result<Self, ClusterError> {
let mut f_group_id: Option<u16> = None;
let mut f_group_key_set_id: Option<u16> = None;
let mut f_fabric_index: Option<u8> = None;
loop {
match r.next()? {
Some(Element::ContainerEnd) => break,
Some(Element::Scalar {
tag: Tag::Context(1),
value: Value::Uint(v),
}) => {
f_group_id =
Some(u16::try_from(v).map_err(|_| ClusterError::InvalidLength("GroupId"))?)
}
Some(Element::Scalar {
tag: Tag::Context(2),
value: Value::Uint(v),
}) => {
f_group_key_set_id = Some(
u16::try_from(v)
.map_err(|_| ClusterError::InvalidLength("GroupKeySetId"))?,
)
}
Some(Element::Scalar {
tag: Tag::Context(254),
value: Value::Uint(v),
}) => {
f_fabric_index = Some(
u8::try_from(v).map_err(|_| ClusterError::InvalidLength("FabricIndex"))?,
)
}
None => return Err(ClusterError::Tlv(matter_codec::Error::UnclosedContainer)),
Some(Element::ContainerStart { .. }) => r.skip_container()?,
Some(_) => {} }
}
Ok(Self {
group_id: f_group_id.ok_or(ClusterError::MissingField("GroupId"))?,
group_key_set_id: f_group_key_set_id
.ok_or(ClusterError::MissingField("GroupKeySetId"))?,
fabric_index: f_fabric_index.ok_or(ClusterError::MissingField("FabricIndex"))?,
})
}
pub fn decode(tlv: &[u8]) -> Result<Self, ClusterError> {
let mut r = TlvReader::new(tlv);
match r.next()? {
Some(Element::ContainerStart {
kind: ContainerKind::Structure,
..
}) => {}
_ => {
return Err(ClusterError::UnexpectedType {
context: "GroupKeyMapStruct",
})
}
}
Self::decode_from(&mut r)
}
#[allow(clippy::expect_used)] pub fn write_fields(&self, w: &mut TlvWriter<'_>) {
w.put_uint(Tag::Context(1), u64::from(self.group_id))
.expect("infallible: vec writer");
w.put_uint(Tag::Context(2), u64::from(self.group_key_set_id))
.expect("infallible: vec writer");
w.put_uint(Tag::Context(254), u64::from(self.fabric_index))
.expect("infallible: vec writer");
}
#[must_use]
#[allow(clippy::expect_used)] pub fn encode(&self) -> Vec<u8> {
let mut buf = Vec::new();
let mut w = TlvWriter::new(&mut buf);
w.start_structure(Tag::Anonymous)
.expect("infallible: vec writer");
self.write_fields(&mut w);
w.end_container().expect("infallible: vec writer");
buf
}
}
impl GroupKeySetStruct {
pub fn decode_from(r: &mut TlvReader<'_>) -> Result<Self, ClusterError> {
let mut f_group_key_set_id: Option<u16> = None;
let mut f_group_key_security_policy: Option<GroupKeySecurityPolicyEnum> = None;
let mut f_epoch_key0: Option<Nullable<Vec<u8>>> = None;
let mut f_epoch_start_time0: Option<Nullable<u64>> = None;
let mut f_epoch_key1: Option<Nullable<Vec<u8>>> = None;
let mut f_epoch_start_time1: Option<Nullable<u64>> = None;
let mut f_epoch_key2: Option<Nullable<Vec<u8>>> = None;
let mut f_epoch_start_time2: Option<Nullable<u64>> = None;
let mut f_group_key_multicast_policy: Option<GroupKeyMulticastPolicyEnum> = None;
let mut f_fabric_index: Option<u8> = None;
loop {
match r.next()? {
Some(Element::ContainerEnd) => break,
Some(Element::Scalar {
tag: Tag::Context(0),
value: Value::Uint(v),
}) => {
f_group_key_set_id = Some(
u16::try_from(v)
.map_err(|_| ClusterError::InvalidLength("GroupKeySetId"))?,
)
}
Some(Element::Scalar {
tag: Tag::Context(1),
value: Value::Uint(v),
}) => {
f_group_key_security_policy = Some(GroupKeySecurityPolicyEnum::from_raw(
u8::try_from(v)
.map_err(|_| ClusterError::InvalidLength("GroupKeySecurityPolicy"))?,
))
}
Some(Element::Scalar {
tag: Tag::Context(2),
value: Value::Null,
}) => f_epoch_key0 = Some(Nullable::Null),
Some(Element::Scalar {
tag: Tag::Context(2),
value: Value::Bytes(v),
}) => f_epoch_key0 = Some(Nullable::Value(v)),
Some(Element::Scalar {
tag: Tag::Context(3),
value: Value::Null,
}) => f_epoch_start_time0 = Some(Nullable::Null),
Some(Element::Scalar {
tag: Tag::Context(3),
value: Value::Uint(v),
}) => {
f_epoch_start_time0 =
Some(Nullable::Value(u64::try_from(v).map_err(|_| {
ClusterError::InvalidLength("EpochStartTime0")
})?))
}
Some(Element::Scalar {
tag: Tag::Context(4),
value: Value::Null,
}) => f_epoch_key1 = Some(Nullable::Null),
Some(Element::Scalar {
tag: Tag::Context(4),
value: Value::Bytes(v),
}) => f_epoch_key1 = Some(Nullable::Value(v)),
Some(Element::Scalar {
tag: Tag::Context(5),
value: Value::Null,
}) => f_epoch_start_time1 = Some(Nullable::Null),
Some(Element::Scalar {
tag: Tag::Context(5),
value: Value::Uint(v),
}) => {
f_epoch_start_time1 =
Some(Nullable::Value(u64::try_from(v).map_err(|_| {
ClusterError::InvalidLength("EpochStartTime1")
})?))
}
Some(Element::Scalar {
tag: Tag::Context(6),
value: Value::Null,
}) => f_epoch_key2 = Some(Nullable::Null),
Some(Element::Scalar {
tag: Tag::Context(6),
value: Value::Bytes(v),
}) => f_epoch_key2 = Some(Nullable::Value(v)),
Some(Element::Scalar {
tag: Tag::Context(7),
value: Value::Null,
}) => f_epoch_start_time2 = Some(Nullable::Null),
Some(Element::Scalar {
tag: Tag::Context(7),
value: Value::Uint(v),
}) => {
f_epoch_start_time2 =
Some(Nullable::Value(u64::try_from(v).map_err(|_| {
ClusterError::InvalidLength("EpochStartTime2")
})?))
}
Some(Element::Scalar {
tag: Tag::Context(8),
value: Value::Uint(v),
}) => {
f_group_key_multicast_policy = Some(GroupKeyMulticastPolicyEnum::from_raw(
u8::try_from(v)
.map_err(|_| ClusterError::InvalidLength("GroupKeyMulticastPolicy"))?,
))
}
Some(Element::Scalar {
tag: Tag::Context(254),
value: Value::Uint(v),
}) => {
f_fabric_index = Some(
u8::try_from(v).map_err(|_| ClusterError::InvalidLength("FabricIndex"))?,
)
}
None => return Err(ClusterError::Tlv(matter_codec::Error::UnclosedContainer)),
Some(Element::ContainerStart { .. }) => r.skip_container()?,
Some(_) => {} }
}
Ok(Self {
group_key_set_id: f_group_key_set_id
.ok_or(ClusterError::MissingField("GroupKeySetId"))?,
group_key_security_policy: f_group_key_security_policy
.ok_or(ClusterError::MissingField("GroupKeySecurityPolicy"))?,
epoch_key0: f_epoch_key0.ok_or(ClusterError::MissingField("EpochKey0"))?,
epoch_start_time0: f_epoch_start_time0
.ok_or(ClusterError::MissingField("EpochStartTime0"))?,
epoch_key1: f_epoch_key1.ok_or(ClusterError::MissingField("EpochKey1"))?,
epoch_start_time1: f_epoch_start_time1
.ok_or(ClusterError::MissingField("EpochStartTime1"))?,
epoch_key2: f_epoch_key2.ok_or(ClusterError::MissingField("EpochKey2"))?,
epoch_start_time2: f_epoch_start_time2
.ok_or(ClusterError::MissingField("EpochStartTime2"))?,
group_key_multicast_policy: f_group_key_multicast_policy,
fabric_index: f_fabric_index,
})
}
pub fn decode(tlv: &[u8]) -> Result<Self, ClusterError> {
let mut r = TlvReader::new(tlv);
match r.next()? {
Some(Element::ContainerStart {
kind: ContainerKind::Structure,
..
}) => {}
_ => {
return Err(ClusterError::UnexpectedType {
context: "GroupKeySetStruct",
})
}
}
Self::decode_from(&mut r)
}
#[allow(clippy::expect_used)] pub fn write_fields(&self, w: &mut TlvWriter<'_>) {
w.put_uint(Tag::Context(0), u64::from(self.group_key_set_id))
.expect("infallible: vec writer");
w.put_uint(
Tag::Context(1),
u64::from(self.group_key_security_policy.to_raw()),
)
.expect("infallible: vec writer");
match &self.epoch_key0 {
Nullable::Null => w.put_null(Tag::Context(2)).expect("infallible: vec writer"),
Nullable::Value(epoch_key0) => {
w.put_bytes(Tag::Context(2), &*epoch_key0)
.expect("infallible: vec writer");
}
}
match &self.epoch_start_time0 {
Nullable::Null => w.put_null(Tag::Context(3)).expect("infallible: vec writer"),
Nullable::Value(epoch_start_time0) => {
w.put_uint(Tag::Context(3), u64::from(*epoch_start_time0))
.expect("infallible: vec writer");
}
}
match &self.epoch_key1 {
Nullable::Null => w.put_null(Tag::Context(4)).expect("infallible: vec writer"),
Nullable::Value(epoch_key1) => {
w.put_bytes(Tag::Context(4), &*epoch_key1)
.expect("infallible: vec writer");
}
}
match &self.epoch_start_time1 {
Nullable::Null => w.put_null(Tag::Context(5)).expect("infallible: vec writer"),
Nullable::Value(epoch_start_time1) => {
w.put_uint(Tag::Context(5), u64::from(*epoch_start_time1))
.expect("infallible: vec writer");
}
}
match &self.epoch_key2 {
Nullable::Null => w.put_null(Tag::Context(6)).expect("infallible: vec writer"),
Nullable::Value(epoch_key2) => {
w.put_bytes(Tag::Context(6), &*epoch_key2)
.expect("infallible: vec writer");
}
}
match &self.epoch_start_time2 {
Nullable::Null => w.put_null(Tag::Context(7)).expect("infallible: vec writer"),
Nullable::Value(epoch_start_time2) => {
w.put_uint(Tag::Context(7), u64::from(*epoch_start_time2))
.expect("infallible: vec writer");
}
}
if let Some(group_key_multicast_policy) = &self.group_key_multicast_policy {
w.put_uint(
Tag::Context(8),
u64::from((*group_key_multicast_policy).to_raw()),
)
.expect("infallible: vec writer");
}
if let Some(fabric_index) = &self.fabric_index {
w.put_uint(Tag::Context(254), u64::from(*fabric_index))
.expect("infallible: vec writer");
}
}
#[must_use]
#[allow(clippy::expect_used)] pub fn encode(&self) -> Vec<u8> {
let mut buf = Vec::new();
let mut w = TlvWriter::new(&mut buf);
w.start_structure(Tag::Anonymous)
.expect("infallible: vec writer");
self.write_fields(&mut w);
w.end_container().expect("infallible: vec writer");
buf
}
}
pub fn decode_group_key_map(tlv: &[u8]) -> Result<Vec<GroupKeyMapStruct>, ClusterError> {
let mut r = TlvReader::new(tlv);
match r.next()? {
Some(Element::ContainerStart {
kind: ContainerKind::Array,
..
}) => {}
_ => {
return Err(ClusterError::UnexpectedType {
context: "GroupKeyMap",
})
}
}
let r = &mut r;
let mut out = Vec::new();
loop {
match r.next()? {
Some(Element::ContainerEnd) => break,
Some(Element::ContainerStart {
kind: ContainerKind::Structure,
..
}) => {
out.push(GroupKeyMapStruct::decode_from(r)?);
}
None => return Err(ClusterError::Tlv(matter_codec::Error::UnclosedContainer)),
Some(Element::ContainerStart { .. }) => r.skip_container()?,
Some(_) => {} }
}
Ok(out)
}
pub fn decode_group_table(tlv: &[u8]) -> Result<Vec<GroupInfoMapStruct>, ClusterError> {
let mut r = TlvReader::new(tlv);
match r.next()? {
Some(Element::ContainerStart {
kind: ContainerKind::Array,
..
}) => {}
_ => {
return Err(ClusterError::UnexpectedType {
context: "GroupTable",
})
}
}
let r = &mut r;
let mut out = Vec::new();
loop {
match r.next()? {
Some(Element::ContainerEnd) => break,
Some(Element::ContainerStart {
kind: ContainerKind::Structure,
..
}) => {
out.push(GroupInfoMapStruct::decode_from(r)?);
}
None => return Err(ClusterError::Tlv(matter_codec::Error::UnclosedContainer)),
Some(Element::ContainerStart { .. }) => r.skip_container()?,
Some(_) => {} }
}
Ok(out)
}
pub fn decode_max_groups_per_fabric(tlv: &[u8]) -> Result<u16, ClusterError> {
let mut r = TlvReader::new(tlv);
match r.next()? {
Some(Element::Scalar {
value: Value::Uint(v),
..
}) => Ok(u16::try_from(v).map_err(|_| ClusterError::InvalidLength("MaxGroupsPerFabric"))?),
_ => Err(ClusterError::UnexpectedType {
context: "MaxGroupsPerFabric",
}),
}
}
pub fn decode_max_group_keys_per_fabric(tlv: &[u8]) -> Result<u16, ClusterError> {
let mut r = TlvReader::new(tlv);
match r.next()? {
Some(Element::Scalar {
value: Value::Uint(v),
..
}) => {
Ok(u16::try_from(v)
.map_err(|_| ClusterError::InvalidLength("MaxGroupKeysPerFabric"))?)
}
_ => Err(ClusterError::UnexpectedType {
context: "MaxGroupKeysPerFabric",
}),
}
}
#[must_use]
#[allow(clippy::expect_used, clippy::missing_panics_doc)] pub fn encode_key_set_write(group_key_set: GroupKeySetStruct) -> Vec<u8> {
let mut buf = Vec::new();
let mut w = TlvWriter::new(&mut buf);
w.start_structure(Tag::Anonymous)
.expect("infallible: vec writer");
w.start_structure(Tag::Context(0))
.expect("infallible: vec writer");
group_key_set.write_fields(&mut w);
w.end_container().expect("infallible: vec writer");
w.end_container().expect("infallible: vec writer");
buf
}
#[must_use]
#[allow(clippy::expect_used, clippy::missing_panics_doc)] pub fn encode_key_set_read(group_key_set_id: u16) -> Vec<u8> {
let mut buf = Vec::new();
let mut w = TlvWriter::new(&mut buf);
w.start_structure(Tag::Anonymous)
.expect("infallible: vec writer");
w.put_uint(Tag::Context(0), u64::from(group_key_set_id))
.expect("infallible: vec writer");
w.end_container().expect("infallible: vec writer");
buf
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub struct KeySetReadResponse {
pub group_key_set: GroupKeySetStruct,
}
impl KeySetReadResponse {
pub fn decode_from(r: &mut TlvReader<'_>) -> Result<Self, ClusterError> {
let mut f_group_key_set: Option<GroupKeySetStruct> = None;
loop {
match r.next()? {
Some(Element::ContainerEnd) => break,
Some(Element::ContainerStart {
tag: Tag::Context(0),
kind: ContainerKind::Structure,
}) => f_group_key_set = Some(GroupKeySetStruct::decode_from(r)?),
None => return Err(ClusterError::Tlv(matter_codec::Error::UnclosedContainer)),
Some(Element::ContainerStart { .. }) => r.skip_container()?,
Some(_) => {} }
}
Ok(Self {
group_key_set: f_group_key_set.ok_or(ClusterError::MissingField("GroupKeySet"))?,
})
}
pub fn decode(tlv: &[u8]) -> Result<Self, ClusterError> {
let mut r = TlvReader::new(tlv);
match r.next()? {
Some(Element::ContainerStart {
kind: ContainerKind::Structure,
..
}) => {}
_ => {
return Err(ClusterError::UnexpectedType {
context: "KeySetReadResponse",
})
}
}
Self::decode_from(&mut r)
}
}
#[must_use]
#[allow(clippy::expect_used, clippy::missing_panics_doc)] pub fn encode_key_set_remove(group_key_set_id: u16) -> Vec<u8> {
let mut buf = Vec::new();
let mut w = TlvWriter::new(&mut buf);
w.start_structure(Tag::Anonymous)
.expect("infallible: vec writer");
w.put_uint(Tag::Context(0), u64::from(group_key_set_id))
.expect("infallible: vec writer");
w.end_container().expect("infallible: vec writer");
buf
}
#[must_use]
#[allow(clippy::expect_used, clippy::missing_panics_doc)] pub fn encode_key_set_read_all_indices() -> Vec<u8> {
let mut buf = Vec::new();
let mut w = TlvWriter::new(&mut buf);
w.start_structure(Tag::Anonymous)
.expect("infallible: vec writer");
w.end_container().expect("infallible: vec writer");
buf
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub struct KeySetReadAllIndicesResponse {
pub group_key_set_i_ds: Vec<u16>,
}
impl KeySetReadAllIndicesResponse {
pub fn decode_from(r: &mut TlvReader<'_>) -> Result<Self, ClusterError> {
let mut f_group_key_set_i_ds: Option<Vec<u16>> = None;
loop {
match r.next()? {
Some(Element::ContainerEnd) => break,
Some(Element::ContainerStart {
tag: Tag::Context(0),
kind: ContainerKind::Array,
}) => {
let mut out = Vec::new();
loop {
match r.next()? {
Some(Element::ContainerEnd) => break,
Some(Element::Scalar {
value: Value::Uint(v),
..
}) => out.push(
u16::try_from(v)
.map_err(|_| ClusterError::InvalidLength("GroupKeySetIDs"))?,
),
None => {
return Err(ClusterError::Tlv(
matter_codec::Error::UnclosedContainer,
))
}
Some(Element::ContainerStart { .. }) => r.skip_container()?,
Some(_) => {} }
}
f_group_key_set_i_ds = Some(out);
}
None => return Err(ClusterError::Tlv(matter_codec::Error::UnclosedContainer)),
Some(Element::ContainerStart { .. }) => r.skip_container()?,
Some(_) => {} }
}
Ok(Self {
group_key_set_i_ds: f_group_key_set_i_ds
.ok_or(ClusterError::MissingField("GroupKeySetIDs"))?,
})
}
pub fn decode(tlv: &[u8]) -> Result<Self, ClusterError> {
let mut r = TlvReader::new(tlv);
match r.next()? {
Some(Element::ContainerStart {
kind: ContainerKind::Structure,
..
}) => {}
_ => {
return Err(ClusterError::UnexpectedType {
context: "KeySetReadAllIndicesResponse",
})
}
}
Self::decode_from(&mut r)
}
}