Skip to content

Commit 6bec796

Browse files
committed
GenComm: BasicCommInfo Attribute should return the entire structure
1 parent e02b316 commit 6bec796

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

rs-matter/src/data_model/sdm/general_commissioning.rs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,15 @@ struct FailSafeParams {
121121
bread_crumb: u8,
122122
}
123123

124+
#[derive(ToTLV)]
125+
struct BasicCommissioningInfo {
126+
expiry_len: u16,
127+
max_cmltv_failsafe_secs: u16,
128+
}
129+
124130
pub struct GenCommCluster<'a> {
125131
data_ver: Dataver,
126-
expiry_len: u16,
132+
basic_comm_info: BasicCommissioningInfo,
127133
failsafe: &'a RefCell<FailSafe>,
128134
}
129135

@@ -133,7 +139,10 @@ impl<'a> GenCommCluster<'a> {
133139
data_ver: Dataver::new(rand),
134140
failsafe,
135141
// TODO: Arch-Specific
136-
expiry_len: 120,
142+
basic_comm_info: BasicCommissioningInfo {
143+
expiry_len: 120,
144+
max_cmltv_failsafe_secs: 120,
145+
},
137146
}
138147
}
139148

@@ -157,10 +166,8 @@ impl<'a> GenCommCluster<'a> {
157166
codec.encode(writer, RegLocationType::IndoorOutdoor as _)
158167
}
159168
Attributes::BasicCommissioningInfo(_) => {
160-
writer.start_struct(AttrDataWriter::TAG)?;
161-
writer.u16(TagType::Context(0), self.expiry_len)?;
162-
writer.end_container()?;
163-
169+
self.basic_comm_info
170+
.to_tlv(&mut writer, AttrDataWriter::TAG)?;
164171
writer.complete()
165172
}
166173
}

0 commit comments

Comments
 (0)