pub struct Connection { /* private fields */ }
Implementations§
Source§impl Connection
impl Connection
pub fn role(&self) -> Role
pub fn peer_address(&self) -> Address
pub fn disconnect(&self) -> Result<(), DisconnectedError>
pub fn handle(&self) -> Option<u16>
pub fn from_handle(conn_handle: u16) -> Option<Connection>
Sourcepub fn start_rssi(&self)
pub fn start_rssi(&self)
Start measuring RSSI on this connection.
Sourcepub fn rssi(&self) -> Option<i8>
pub fn rssi(&self) -> Option<i8>
Get the connection’s RSSI.
This will return None if start_rssi
has not been called yet, or if
no measurement has been done yet.
Sourcepub fn conn_params(&self) -> ble_gap_conn_params_t
pub fn conn_params(&self) -> ble_gap_conn_params_t
Get the currently active connection params.
pub fn security_mode(&self) -> SecurityMode
Sourcepub fn set_conn_params(
&self,
conn_params: ble_gap_conn_params_t,
) -> Result<(), SetConnParamsError>
pub fn set_conn_params( &self, conn_params: ble_gap_conn_params_t, ) -> Result<(), SetConnParamsError>
Set the connection params.
Note that this just initiates the connection param change, it does not wait for completion. Immediately after return, the active params will still be the old ones, and after some time they should change to the new ones.
For central connections, this will initiate a Link Layer connection parameter update procedure. For peripheral connections, this will send the corresponding L2CAP request to the central. It is then up to the central to accept or deny the request.
pub fn iter() -> ConnectionIter ⓘ
Sourcepub fn phy_update(
&mut self,
tx_phys: PhySet,
rx_phys: PhySet,
) -> Result<(), PhyUpdateError>
pub fn phy_update( &mut self, tx_phys: PhySet, rx_phys: PhySet, ) -> Result<(), PhyUpdateError>
Send a request to the connected device to change the PHY.
Note that this just initiates the PHY change, it does not wait for completion. Immediately after return, the active PHYs will still be the old ones, and after some time they should change to the new ones.