pub struct Connection<'stack, P: PacketPool> { /* private fields */ }
Expand description
Handle to a BLE connection.
When the last reference to a connection is dropped, the connection is automatically disconnected.
Implementations§
Source§impl<'stack, P: PacketPool> Connection<'stack, P>
impl<'stack, P: PacketPool> Connection<'stack, P>
Sourcepub async fn next(&self) -> ConnectionEvent
pub async fn next(&self) -> ConnectionEvent
Wait for next connection event.
Sourcepub fn is_connected(&self) -> bool
pub fn is_connected(&self) -> bool
Check if still connected
Sourcepub fn handle(&self) -> ConnHandle
pub fn handle(&self) -> ConnHandle
Connection handle of this connection.
Sourcepub fn role(&self) -> LeConnRole
pub fn role(&self) -> LeConnRole
The connection role for this connection.
Sourcepub fn peer_address(&self) -> BdAddr
pub fn peer_address(&self) -> BdAddr
The peer address for this connection.
Sourcepub fn peer_identity(&self) -> Identity
pub fn peer_identity(&self) -> Identity
The peer identity key for this connection.
Sourcepub fn disconnect(&self)
pub fn disconnect(&self)
Request connection to be disconnected.
Sourcepub async fn rssi<T>(
&self,
stack: &Stack<'_, T, P>,
) -> Result<i8, BleHostError<T::Error>>where
T: ControllerCmdSync<ReadRssi>,
pub async fn rssi<T>(
&self,
stack: &Stack<'_, T, P>,
) -> Result<i8, BleHostError<T::Error>>where
T: ControllerCmdSync<ReadRssi>,
The RSSI value for this connection.
Sourcepub async fn set_phy<T>(
&self,
stack: &Stack<'_, T, P>,
phy: PhyKind,
) -> Result<(), BleHostError<T::Error>>where
T: ControllerCmdAsync<LeSetPhy>,
pub async fn set_phy<T>(
&self,
stack: &Stack<'_, T, P>,
phy: PhyKind,
) -> Result<(), BleHostError<T::Error>>where
T: ControllerCmdAsync<LeSetPhy>,
Update phy for this connection.
This updates both TX and RX phy of the connection. For more fine grained control, use the LeSetPhy HCI command directly.
Sourcepub async fn read_phy<T>(
&self,
stack: &Stack<'_, T, P>,
) -> Result<(PhyKind, PhyKind), BleHostError<T::Error>>where
T: ControllerCmdSync<LeReadPhy>,
pub async fn read_phy<T>(
&self,
stack: &Stack<'_, T, P>,
) -> Result<(PhyKind, PhyKind), BleHostError<T::Error>>where
T: ControllerCmdSync<LeReadPhy>,
Read the current phy used for the connection.
Sourcepub async fn update_connection_params<T>(
&self,
stack: &Stack<'_, T, P>,
params: &ConnectParams,
) -> Result<(), BleHostError<T::Error>>
pub async fn update_connection_params<T>( &self, stack: &Stack<'_, T, P>, params: &ConnectParams, ) -> Result<(), BleHostError<T::Error>>
Update connection parameters for this connection.
Sourcepub fn with_attribute_server<'values, 'server, M: RawMutex, const ATT_MAX: usize, const CCCD_MAX: usize, const CONN_MAX: usize>(
self,
server: &'server AttributeServer<'values, M, P, ATT_MAX, CCCD_MAX, CONN_MAX>,
) -> Result<GattConnection<'stack, 'server, P>, Error>
pub fn with_attribute_server<'values, 'server, M: RawMutex, const ATT_MAX: usize, const CCCD_MAX: usize, const CONN_MAX: usize>( self, server: &'server AttributeServer<'values, M, P, ATT_MAX, CCCD_MAX, CONN_MAX>, ) -> Result<GattConnection<'stack, 'server, P>, Error>
Transform BLE connection into a GattConnection
Trait Implementations§
Source§impl<P: PacketPool> Clone for Connection<'_, P>
impl<P: PacketPool> Clone for Connection<'_, P>
Source§impl<P: PacketPool> Drop for Connection<'_, P>
impl<P: PacketPool> Drop for Connection<'_, P>
Auto Trait Implementations§
impl<'stack, P> Freeze for Connection<'stack, P>
impl<'stack, P> !RefUnwindSafe for Connection<'stack, P>
impl<'stack, P> !Send for Connection<'stack, P>
impl<'stack, P> !Sync for Connection<'stack, P>
impl<'stack, P> Unpin for Connection<'stack, P>
impl<'stack, P> !UnwindSafe for Connection<'stack, P>
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