Expand description
PeatMesh - Unified mesh management facade
This module provides the main entry point for Peat BLE mesh operations. It composes peer management, document sync, and observer notifications into a single interface that platform implementations can use.
§Usage
ⓘ
use peat_btle::peat_mesh::{PeatMesh, PeatMeshConfig};
use peat_btle::observer::{PeatEvent, PeatObserver};
use peat_btle::NodeId;
use std::sync::Arc;
// Create mesh configuration
let config = PeatMeshConfig::new(NodeId::new(0x12345678), "ALPHA-1", "DEMO");
// Create mesh instance
let mesh = PeatMesh::new(config);
// Add observer for events
struct MyObserver;
impl PeatObserver for MyObserver {
fn on_event(&self, event: PeatEvent) {
println!("Event: {:?}", event);
}
}
mesh.add_observer(Arc::new(MyObserver));
// Platform BLE callbacks
mesh.on_ble_discovered("device-uuid", Some("PEAT_DEMO-AABBCCDD"), -65, Some("DEMO"), now_ms);
mesh.on_ble_connected("device-uuid", now_ms);
mesh.on_ble_data_received("device-uuid", &data, now_ms);
// Periodic maintenance
if let Some(sync_data) = mesh.tick(now_ms) {
// Broadcast sync_data to connected peers
}Structs§
- Data
Received Result - Result from receiving BLE data
- Decoded
Translator Frame - ADR-059 Amendment 3 — payload returned in
DataReceivedResult::decoded_translator_framewhen a 0xB6 translator frame decodes successfully on the receive dispatch. Hosts (peat-atak-plugin and equivalents) forward populated entries through their existing publish-with-origin FFI surface (e.g. peat-ffi’spublishDocumentWithOriginJni(collection, doc_json, "ble")). Defined unconditionally — no#[cfg(feature = "mesh-translator")]— so the UniFFI binding shape is stable across feature combos. Population only happens whenmesh-translatoris on. - Peat
Mesh - Main facade for Peat BLE mesh operations
- Peat
Mesh Config - Configuration for PeatMesh
- Relay
Decision - Decision from processing a relay envelope