Skip to content

Commit

Permalink
Merge pull request project-chip#160 from ivmarkov/commissioning-info
Browse files Browse the repository at this point in the history
Expose concurrent commissioning flow attribute
  • Loading branch information
kedars authored May 14, 2024
2 parents bcf4979 + c3a7584 commit e6007f1
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 5 deletions.
2 changes: 1 addition & 1 deletion rs-matter/src/data_model/root_endpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ pub fn wrap<'a>(
.chain(
endpoint_id,
general_commissioning::ID,
GenCommCluster::new(failsafe, rand),
GenCommCluster::new(failsafe, true, rand),
)
.chain(
endpoint_id,
Expand Down
17 changes: 16 additions & 1 deletion rs-matter/src/data_model/sdm/general_commissioning.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ pub enum Attributes {
BasicCommissioningInfo(()) = 1,
RegConfig(AttrType<u8>) = 2,
LocationCapability(AttrType<u8>) = 3,
SupportsConcurrentConnection(AttrType<bool>) = 4,
}

attribute_enum!(Attributes);
Expand Down Expand Up @@ -106,6 +107,11 @@ pub const CLUSTER: Cluster<'static> = Cluster {
Access::RV,
Quality::FIXED,
),
Attribute::new(
AttributesDiscriminants::SupportsConcurrentConnection as u16,
Access::RV,
Quality::FIXED,
),
],
commands: &[
Commands::ArmFailsafe as _,
Expand All @@ -129,11 +135,16 @@ struct BasicCommissioningInfo {
pub struct GenCommCluster<'a> {
data_ver: Dataver,
basic_comm_info: BasicCommissioningInfo,
supports_concurrent_connection: bool,
failsafe: &'a RefCell<FailSafe>,
}

impl<'a> GenCommCluster<'a> {
pub fn new(failsafe: &'a RefCell<FailSafe>, rand: Rand) -> Self {
pub fn new(
failsafe: &'a RefCell<FailSafe>,
supports_concurrent_connection: bool,
rand: Rand,
) -> Self {
Self {
data_ver: Dataver::new(rand),
failsafe,
Expand All @@ -142,6 +153,7 @@ impl<'a> GenCommCluster<'a> {
expiry_len: 120,
max_cmltv_failsafe_secs: 120,
},
supports_concurrent_connection,
}
}

Expand Down Expand Up @@ -169,6 +181,9 @@ impl<'a> GenCommCluster<'a> {
.to_tlv(&mut writer, AttrDataWriter::TAG)?;
writer.complete()
}
Attributes::SupportsConcurrentConnection(codec) => {
codec.encode(writer, self.supports_concurrent_connection)
}
}
}
} else {
Expand Down
12 changes: 9 additions & 3 deletions rs-matter/tests/data_model/long_reads.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,12 @@ fn wildcard_read_resp(part: u8) -> Vec<AttrResp<'static>> {
gen_comm::AttributesDiscriminants::BasicCommissioningInfo,
dont_care.clone()
),
attr_data!(
0,
48,
gen_comm::AttributesDiscriminants::SupportsConcurrentConnection,
dont_care.clone()
),
attr_data!(0, 49, GlobalElements::FeatureMap, dont_care.clone()),
attr_data!(0, 49, GlobalElements::AttributeList, dont_care.clone()),
attr_data!(
Expand Down Expand Up @@ -201,15 +207,15 @@ fn wildcard_read_resp(part: u8) -> Vec<AttrResp<'static>> {
adm_comm::AttributesDiscriminants::WindowStatus,
dont_care.clone()
),
];

let part2 = vec![
attr_data!(
0,
60,
adm_comm::AttributesDiscriminants::AdminFabricIndex,
dont_care.clone()
),
];

let part2 = vec![
attr_data!(
0,
60,
Expand Down

0 comments on commit e6007f1

Please sign in to comment.