1 unstable release
0.1.0 | Jul 28, 2023 |
---|
#1697 in Embedded development
795KB
19K
SLoC
rs-matter: The Rust Implementation of Matter Library
This is the actual rs-matter
library crate. See the main README file for more information.
lib.rs
:
Native Rust Implementation of Matter (Smart-Home)
This crate implements the Matter specification that can be run on embedded devices to build Matter-compatible smart-home/IoT devices.
Currently Ethernet based transport is supported.
Examples
TODO: Fix once new API has stabilized a bit use rs_matter::{Matter, CommissioningData}; use rs_matter::data_model::device_types::device_type_add_on_off_light; use rs_matter::data_model::cluster_basic_information::BasicInfoConfig; use rs_matter::secure_channel::spake2p::VerifierData;
use rs_matter::data_model::sdm::dev_att::{DataType, DevAttDataFetcher};
use rs_matter::error::Error;
pub struct DevAtt{}
impl DevAttDataFetcher for DevAtt{
fn get_devatt_data(&self, data_type: DataType, data: &mut [u8]) -> Result<usize, Error> { Ok(0) }
}
let dev_att = Box::new(DevAtt{});
/// The commissioning data for this device let comm_data = CommissioningData { verifier: VerifierData::new_with_pw(123456), discriminator: 250, };
/// The basic information about this device let dev_info = BasicInfoConfig { vid: 0x8000, 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(), };
/// Get the Matter Object /// The dev_att is an object that implements the DevAttDataFetcher trait. let mut matter = Matter::new(dev_info, dev_att, comm_data).unwrap(); let dm = matter.get_data_model(); { let mut node = dm.node.write().unwrap(); /// Add our device-types let endpoint = device_type_add_on_off_light(&mut node).unwrap(); } // Start the Matter Daemon // matter.start_daemon().unwrap();
Start off exploring by going to the [Matter] object.
Dependencies
~18–33MB
~541K SLoC