bluetooth_mesh 0.1.4

Cross-platform, full Bluetooth Mesh stack implemented in Rust. Following the Bluetooth Mesh Spec Core v1.0 by SIG. Designed to work with any almost any BLE radio (uses https://github.com/AndrewGi/btle/ for platform dependent Bluetooth drivers). While a stack is provided by the library, all the primatives and objects needed to customize and create your own stack are provided. See https://github.com/AndrewGi/BluetoothMeshRust for more.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use crate::access::Opcode;
use crate::models::{MessagePackError, PackableMessage};

pub trait State {}

pub trait StateEndpoint {
    type Message: PackableMessage;
    fn opcode() -> Opcode;
    fn handle_message(&mut self, message: Self::Message);
    fn handle_message_bytes(&mut self, bytes: &[u8]) -> Result<(), MessagePackError> {
        let msg = Self::Message::unpack_from(bytes)?;
        self.handle_message(msg);
        Ok(())
    }
}