basic_info: Add Software Version String support
This commit is contained in:
parent
fb82caf391
commit
a3b24c91fc
4 changed files with 11 additions and 0 deletions
|
@ -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(),
|
||||
};
|
||||
|
|
|
@ -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),
|
||||
|
|
|
@ -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(),
|
||||
//! };
|
||||
|
|
|
@ -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(),
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue