pub struct BluetoothLETransport<A: BleAdapter> { /* private fields */ }Expand description
Bluetooth LE mesh transport
Implements the transport abstraction for BLE, providing:
- Peer discovery via advertising/scanning
- GATT-based data exchange
- Connection management
- PHY selection
§Example
ⓘ
use peat_btle::{BluetoothLETransport, BleConfig, NodeId};
let config = BleConfig::peat_lite(NodeId::new(0x12345678));
let transport = BluetoothLETransport::new(config)?;
transport.start().await?;
let conn = transport.connect(&peer_id).await?;Implementations§
Source§impl<A: BleAdapter> BluetoothLETransport<A>
impl<A: BleAdapter> BluetoothLETransport<A>
Sourcepub fn new(config: BleConfig, adapter: A) -> Self
pub fn new(config: BleConfig, adapter: A) -> Self
Create a new BLE transport with the given adapter
Sourcepub fn capabilities(&self) -> &TransportCapabilities
pub fn capabilities(&self) -> &TransportCapabilities
Get the current capabilities
Trait Implementations§
Source§impl<A: BleAdapter + Send + Sync> MeshTransport for BluetoothLETransport<A>
impl<A: BleAdapter + Send + Sync> MeshTransport for BluetoothLETransport<A>
Source§fn start<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn start<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Start the transport layer
Source§fn stop<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn stop<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Stop the transport layer
Source§fn connect<'life0, 'life1, 'async_trait>(
&'life0 self,
peer_id: &'life1 NodeId,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn BleConnection>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn connect<'life0, 'life1, 'async_trait>(
&'life0 self,
peer_id: &'life1 NodeId,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn BleConnection>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Connect to a peer by node ID
Source§fn disconnect<'life0, 'life1, 'async_trait>(
&'life0 self,
peer_id: &'life1 NodeId,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn disconnect<'life0, 'life1, 'async_trait>(
&'life0 self,
peer_id: &'life1 NodeId,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Disconnect from a peer
Source§fn get_connection(&self, peer_id: &NodeId) -> Option<Box<dyn BleConnection>>
fn get_connection(&self, peer_id: &NodeId) -> Option<Box<dyn BleConnection>>
Get an existing connection
Source§fn peer_count(&self) -> usize
fn peer_count(&self) -> usize
Get the number of connected peers
Source§fn connected_peers(&self) -> Vec<NodeId>
fn connected_peers(&self) -> Vec<NodeId>
Get list of connected peer IDs
Source§fn send_to<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
peer_id: &'life1 NodeId,
data: &'life2 [u8],
) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn send_to<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
peer_id: &'life1 NodeId,
data: &'life2 [u8],
) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Send data to a connected peer Read more
Source§fn capabilities(&self) -> &TransportCapabilities
fn capabilities(&self) -> &TransportCapabilities
Get transport capabilities
Source§fn is_connected(&self, peer_id: &NodeId) -> bool
fn is_connected(&self, peer_id: &NodeId) -> bool
Check if connected to a specific peer
Auto Trait Implementations§
impl<A> Freeze for BluetoothLETransport<A>where
A: Freeze,
impl<A> RefUnwindSafe for BluetoothLETransport<A>where
A: RefUnwindSafe,
impl<A> Send for BluetoothLETransport<A>
impl<A> Sync for BluetoothLETransport<A>
impl<A> Unpin for BluetoothLETransport<A>where
A: Unpin,
impl<A> UnsafeUnpin for BluetoothLETransport<A>where
A: UnsafeUnpin,
impl<A> UnwindSafe for BluetoothLETransport<A>where
A: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more