From c3a75847ed2609958b5719b5a2805a9bea7f698b Mon Sep 17 00:00:00 2001 From: ivmarkov Date: Mon, 13 May 2024 16:55:01 +0000 Subject: [PATCH] Expose concurrent commissioning flow attribute --- rs-matter/src/data_model/root_endpoint.rs | 2 +- .../src/data_model/sdm/general_commissioning.rs | 17 ++++++++++++++++- rs-matter/tests/data_model/long_reads.rs | 12 +++++++++--- 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/rs-matter/src/data_model/root_endpoint.rs b/rs-matter/src/data_model/root_endpoint.rs index b39e12fc..474edf79 100644 --- a/rs-matter/src/data_model/root_endpoint.rs +++ b/rs-matter/src/data_model/root_endpoint.rs @@ -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, diff --git a/rs-matter/src/data_model/sdm/general_commissioning.rs b/rs-matter/src/data_model/sdm/general_commissioning.rs index ada444ca..121d3984 100644 --- a/rs-matter/src/data_model/sdm/general_commissioning.rs +++ b/rs-matter/src/data_model/sdm/general_commissioning.rs @@ -46,6 +46,7 @@ pub enum Attributes { BasicCommissioningInfo(()) = 1, RegConfig(AttrType) = 2, LocationCapability(AttrType) = 3, + SupportsConcurrentConnection(AttrType) = 4, } attribute_enum!(Attributes); @@ -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 _, @@ -129,11 +135,16 @@ struct BasicCommissioningInfo { pub struct GenCommCluster<'a> { data_ver: Dataver, basic_comm_info: BasicCommissioningInfo, + supports_concurrent_connection: bool, failsafe: &'a RefCell, } impl<'a> GenCommCluster<'a> { - pub fn new(failsafe: &'a RefCell, rand: Rand) -> Self { + pub fn new( + failsafe: &'a RefCell, + supports_concurrent_connection: bool, + rand: Rand, + ) -> Self { Self { data_ver: Dataver::new(rand), failsafe, @@ -142,6 +153,7 @@ impl<'a> GenCommCluster<'a> { expiry_len: 120, max_cmltv_failsafe_secs: 120, }, + supports_concurrent_connection, } } @@ -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 { diff --git a/rs-matter/tests/data_model/long_reads.rs b/rs-matter/tests/data_model/long_reads.rs index cdbbb59a..b3515258 100644 --- a/rs-matter/tests/data_model/long_reads.rs +++ b/rs-matter/tests/data_model/long_reads.rs @@ -149,6 +149,12 @@ fn wildcard_read_resp(part: u8) -> Vec> { 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!( @@ -201,15 +207,15 @@ fn wildcard_read_resp(part: u8) -> Vec> { 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,