Skip to main content

Crate libertas_matter

Crate libertas_matter 

Source
Expand description

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::dm::device_types::device_type_add_on_off_light;
use rs_matter::dm::cluster_basic_information::BasicInfoConfig;
use rs_matter::sc::spake2p::VerifierData;


/// 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.

Modules§

error
im
This module contains the TLV-serde types as defined by the Interaction Model.
tlv
utils

Macros§

bitflags_tlv
Implements to/from TLV for the given enumeration that was created using bitflags!
import
Re-export the libertas_matter_macros::import proc-macro Generate code for one or more Matter cluster definitions as specified in the Matter IDL file.