Skip to main content

BluetoothLETransport

Struct BluetoothLETransport 

Source
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>

Source

pub fn new(config: BleConfig, adapter: A) -> Self

Create a new BLE transport with the given adapter

Source

pub fn config(&self) -> &BleConfig

Get the current configuration

Source

pub fn capabilities(&self) -> &TransportCapabilities

Get the current capabilities

Source

pub fn node_id(&self) -> &NodeId

Get the node ID

Trait Implementations§

Source§

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,

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,

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,

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,

Disconnect from a peer
Source§

fn get_connection(&self, peer_id: &NodeId) -> Option<Box<dyn BleConnection>>

Get an existing connection
Source§

fn peer_count(&self) -> usize

Get the number of connected peers
Source§

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,

Send data to a connected peer Read more
Source§

fn capabilities(&self) -> &TransportCapabilities

Get transport capabilities
Source§

fn is_connected(&self, peer_id: &NodeId) -> bool

Check if connected to a specific peer

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.