pub struct MeshConfig {
pub mesh_id: String,
pub max_connections: u8,
pub max_children: u8,
pub supervision_timeout_ms: u16,
pub slave_latency: u16,
pub conn_interval_min_ms: u16,
pub conn_interval_max_ms: u16,
}Expand description
Mesh configuration
Fields§
§mesh_id: StringMesh identifier - nodes only auto-connect to peers with matching mesh ID
Format: 4-character alphanumeric (e.g., “DEMO”, “ALFA”, “TEST”)
This maps to the app_id concept in hive-protocol.
max_connections: u8Maximum number of simultaneous connections
max_children: u8Maximum children for this node (0 = leaf node)
supervision_timeout_ms: u16Connection supervision timeout in milliseconds
slave_latency: u16Slave latency (number of connection events to skip)
conn_interval_min_ms: u16Minimum connection interval in milliseconds
conn_interval_max_ms: u16Maximum connection interval in milliseconds
Implementations§
Source§impl MeshConfig
impl MeshConfig
Sourcepub fn device_name(&self, node_id: NodeId) -> String
pub fn device_name(&self, node_id: NodeId) -> String
Generate the BLE device name for this node
Format: HIVE_<MESH_ID>-<NODE_ID> (e.g., “HIVE_DEMO-12345678”)
Sourcepub fn parse_device_name(name: &str) -> Option<(Option<String>, NodeId)>
pub fn parse_device_name(name: &str) -> Option<(Option<String>, NodeId)>
Parse mesh ID and node ID from a device name
Returns Some((mesh_id, node_id)) for valid names, None otherwise.
Supports both formats:
- New:
HIVE_<MESH_ID>-<NODE_ID>(e.g., “HIVE_DEMO-12345678”) - Legacy:
HIVE-<NODE_ID>(e.g., “HIVE-12345678”) - returns None for mesh_id
Sourcepub fn matches_mesh(&self, device_mesh_id: Option<&str>) -> bool
pub fn matches_mesh(&self, device_mesh_id: Option<&str>) -> bool
Check if a discovered device matches this mesh
Returns true if:
- The device has the same mesh ID, OR
- The device has no mesh ID (legacy format - backwards compatible)
Trait Implementations§
Source§impl Clone for MeshConfig
impl Clone for MeshConfig
Source§fn clone(&self) -> MeshConfig
fn clone(&self) -> MeshConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more