pub struct Connection<'stack> { /* 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> Connection<'stack>
impl<'stack> Connection<'stack>
Sourcepub async fn next(&self) -> ConnectionEvent<'stack>
pub async fn next(&self) -> ConnectionEvent<'stack>
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 disconnect(&self)
pub fn disconnect(&self)
Request connection to be disconnected.
Sourcepub async fn rssi<T>(
&self,
stack: &Stack<'_, T>,
) -> Result<i8, BleHostError<T::Error>>where
T: ControllerCmdSync<ReadRssi>,
pub async fn rssi<T>(
&self,
stack: &Stack<'_, T>,
) -> 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>,
phy: PhyKind,
) -> Result<(), BleHostError<T::Error>>where
T: ControllerCmdAsync<LeSetPhy>,
pub async fn set_phy<T>(
&self,
stack: &Stack<'_, T>,
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>,
) -> Result<(PhyKind, PhyKind), BleHostError<T::Error>>where
T: ControllerCmdSync<LeReadPhy>,
pub async fn read_phy<T>(
&self,
stack: &Stack<'_, T>,
) -> 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>,
params: &ConnectParams,
) -> Result<(), BleHostError<T::Error>>where
T: ControllerCmdAsync<LeConnUpdate>,
pub async fn update_connection_params<T>(
&self,
stack: &Stack<'_, T>,
params: &ConnectParams,
) -> Result<(), BleHostError<T::Error>>where
T: ControllerCmdAsync<LeConnUpdate>,
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, ATT_MAX, CCCD_MAX, CONN_MAX>,
) -> Result<GattConnection<'stack, 'server>, 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, ATT_MAX, CCCD_MAX, CONN_MAX>, ) -> Result<GattConnection<'stack, 'server>, Error>
Transform BLE connection into a GattConnection
Trait Implementations§
Source§impl Clone for Connection<'_>
impl Clone for Connection<'_>
Auto Trait Implementations§
impl<'stack> Freeze for Connection<'stack>
impl<'stack> !RefUnwindSafe for Connection<'stack>
impl<'stack> !Send for Connection<'stack>
impl<'stack> !Sync for Connection<'stack>
impl<'stack> Unpin for Connection<'stack>
impl<'stack> !UnwindSafe for Connection<'stack>
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