From a3b24c91fc0b51fe7add01b462799c5f623e5a67 Mon Sep 17 00:00:00 2001 From: Kedar Sovani Date: Fri, 13 Jan 2023 11:11:23 +0530 Subject: [PATCH] basic_info: Add Software Version String support --- examples/onoff_light/src/main.rs | 1 + matter/src/data_model/cluster_basic_information.rs | 8 ++++++++ matter/src/lib.rs | 1 + matter/tests/common/im_engine.rs | 1 + 4 files changed, 11 insertions(+) diff --git a/examples/onoff_light/src/main.rs b/examples/onoff_light/src/main.rs index ff86b68..2d64027 100644 --- a/examples/onoff_light/src/main.rs +++ b/examples/onoff_light/src/main.rs @@ -35,6 +35,7 @@ fn main() { pid: 0x8002, hw_ver: 2, sw_ver: 1, + sw_ver_str: "1".to_string(), serial_no: "aabbccdd".to_string(), device_name: "OnOff Light".to_string(), }; diff --git a/matter/src/data_model/cluster_basic_information.rs b/matter/src/data_model/cluster_basic_information.rs index 61eecef..3026138 100644 --- a/matter/src/data_model/cluster_basic_information.rs +++ b/matter/src/data_model/cluster_basic_information.rs @@ -28,6 +28,7 @@ enum Attributes { ProductId = 4, HwVer = 7, SwVer = 9, + SwVerString = 0xa, SerialNo = 0x0f, } @@ -37,6 +38,7 @@ pub struct BasicInfoConfig { pub pid: u16, pub hw_ver: u16, pub sw_ver: u32, + pub sw_ver_str: String, pub serial_no: String, /// Device name; up to 32 characters pub device_name: String, @@ -83,6 +85,12 @@ impl BasicInfoCluster { Access::RV, Quality::FIXED, )?, + Attribute::new( + Attributes::SwVerString as u16, + AttrValue::Utf8(cfg.sw_ver_str), + Access::RV, + Quality::FIXED, + )?, Attribute::new( Attributes::SerialNo as u16, AttrValue::Utf8(cfg.serial_no), diff --git a/matter/src/lib.rs b/matter/src/lib.rs index 4ca7e5a..f276961 100644 --- a/matter/src/lib.rs +++ b/matter/src/lib.rs @@ -49,6 +49,7 @@ //! pid: 0xFFF1, //! hw_ver: 2, //! sw_ver: 1, +//! sw_ver_str: "1".to_string(), //! serial_no: "aabbcc".to_string(), //! device_name: "OnOff Light".to_string(), //! }; diff --git a/matter/tests/common/im_engine.rs b/matter/tests/common/im_engine.rs index 2ee55c8..561c014 100644 --- a/matter/tests/common/im_engine.rs +++ b/matter/tests/common/im_engine.rs @@ -94,6 +94,7 @@ impl ImEngine { pid: 11, hw_ver: 12, sw_ver: 13, + sw_ver_str: "13".to_string(), serial_no: "aabbccdd".to_string(), device_name: "Test Device".to_string(), };