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
use crate::provisioning::pb_adv;
use crate::provisioning::pb_adv::{LinkID, TransactionNumber};
use alloc::collections::BTreeSet;
use core::sync::atomic::Ordering;
#[derive(Debug)]
pub struct AtomicTransactionNumber(core::sync::atomic::AtomicU8);
impl AtomicTransactionNumber {
    pub fn new(num: TransactionNumber) -> Self {
        Self(core::sync::atomic::AtomicU8::new(num.0))
    }
    pub fn get(&self) -> TransactionNumber {
        TransactionNumber(self.0.load(Ordering::SeqCst))
    }
    pub fn set(&self, new_number: TransactionNumber) {
        self.0.store(new_number.0, Ordering::SeqCst);
    }
}
impl Clone for AtomicTransactionNumber {
    fn clone(&self) -> Self {
        Self::new(self.get())
    }
}
impl PartialEq for AtomicTransactionNumber {
    fn eq(&self, other: &Self) -> bool {
        self.get() == other.get()
    }
}
impl Eq for AtomicTransactionNumber {}
impl PartialOrd for AtomicTransactionNumber {
    fn partial_cmp(&self, other: &Self) -> Option<core::cmp::Ordering> {
        self.get().partial_cmp(&other.get())
    }
}
impl Ord for AtomicTransactionNumber {
    fn cmp(&self, other: &Self) -> core::cmp::Ordering {
        self.get().cmp(&other.get())
    }
}
pub struct Links {
    links: BTreeSet<Link>,
}
impl Links {
    pub fn handle_pb_adv_pdu(&mut self, _pdu: &pb_adv::PDU) {
        unimplemented!()
    }
}
pub enum LinkError {
    Closed,
}
#[derive(Clone, Ord, PartialOrd, Eq, PartialEq, Debug)]
pub struct Link {
    link_id: LinkID,
    my_transaction_number: AtomicTransactionNumber,
    other_transaction_number: Option<AtomicTransactionNumber>,
}
impl Link {
    pub fn handle_pb_adv_pdu(&self, pdu: &pb_adv::PDU) {
        if pdu.link_id != self.link_id {
            return;
        }
    }
}