pub trait BleAdapter: Send + Sync {
Show 22 methods
// Required methods
fn init<'life0, 'life1, 'async_trait>(
&'life0 mut self,
config: &'life1 BleConfig,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: '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;
fn stop<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn is_powered(&self) -> bool;
fn address(&self) -> Option<String>;
fn start_scan<'life0, 'life1, 'async_trait>(
&'life0 self,
config: &'life1 DiscoveryConfig,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn stop_scan<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn start_advertising<'life0, 'life1, 'async_trait>(
&'life0 self,
config: &'life1 DiscoveryConfig,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn stop_advertising<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn set_discovery_callback(&mut self, callback: Option<DiscoveryCallback>);
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 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 get_connection(&self, peer_id: &NodeId) -> Option<Box<dyn BleConnection>>;
fn peer_count(&self) -> usize;
fn connected_peers(&self) -> Vec<NodeId>;
fn set_connection_callback(&mut self, callback: Option<ConnectionCallback>);
fn register_gatt_service<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn unregister_gatt_service<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn supports_coded_phy(&self) -> bool;
fn supports_extended_advertising(&self) -> bool;
fn max_mtu(&self) -> u16;
fn max_connections(&self) -> u8;
}Expand description
Platform-specific BLE adapter
This is the main abstraction trait that each platform must implement. It provides all BLE functionality needed by the transport layer.
Required Methods§
Sourcefn init<'life0, 'life1, 'async_trait>(
&'life0 mut self,
config: &'life1 BleConfig,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn init<'life0, 'life1, 'async_trait>(
&'life0 mut self,
config: &'life1 BleConfig,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Initialize the adapter with the given configuration
Sourcefn 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 adapter (begin advertising and/or scanning)
Sourcefn 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 adapter
Sourcefn is_powered(&self) -> bool
fn is_powered(&self) -> bool
Check if the adapter is powered on
Sourcefn start_scan<'life0, 'life1, 'async_trait>(
&'life0 self,
config: &'life1 DiscoveryConfig,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn start_scan<'life0, 'life1, 'async_trait>(
&'life0 self,
config: &'life1 DiscoveryConfig,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Start scanning for devices
Sourcefn stop_scan<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn stop_scan<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Stop scanning
Sourcefn start_advertising<'life0, 'life1, 'async_trait>(
&'life0 self,
config: &'life1 DiscoveryConfig,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn start_advertising<'life0, 'life1, 'async_trait>(
&'life0 self,
config: &'life1 DiscoveryConfig,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Start advertising
Sourcefn stop_advertising<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn stop_advertising<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Stop advertising
Sourcefn set_discovery_callback(&mut self, callback: Option<DiscoveryCallback>)
fn set_discovery_callback(&mut self, callback: Option<DiscoveryCallback>)
Set callback for discovered devices
Sourcefn 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
Sourcefn 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
Sourcefn 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
Sourcefn peer_count(&self) -> usize
fn peer_count(&self) -> usize
Get the number of connected peers
Sourcefn connected_peers(&self) -> Vec<NodeId>
fn connected_peers(&self) -> Vec<NodeId>
Get list of connected peer IDs
Sourcefn set_connection_callback(&mut self, callback: Option<ConnectionCallback>)
fn set_connection_callback(&mut self, callback: Option<ConnectionCallback>)
Set callback for connection events
Sourcefn register_gatt_service<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn register_gatt_service<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Register the HIVE GATT service
Sourcefn unregister_gatt_service<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn unregister_gatt_service<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Unregister the HIVE GATT service
Sourcefn supports_coded_phy(&self) -> bool
fn supports_coded_phy(&self) -> bool
Check if Coded PHY is supported
Sourcefn supports_extended_advertising(&self) -> bool
fn supports_extended_advertising(&self) -> bool
Check if extended advertising is supported
Sourcefn max_connections(&self) -> u8
fn max_connections(&self) -> u8
Get maximum number of connections