pub struct Connection { /* private fields */ }Expand description
An open LE connection. Cloning it is cheap.
Implementations§
Source§impl Connection
impl Connection
Sourcepub fn identity(&self) -> Address
pub fn identity(&self) -> Address
The peer’s identity: its identity address once resolved (from a bond’s IRK, or from pairing), otherwise the address it connected with.
Sourcepub fn params(&self) -> ConnParams
pub fn params(&self) -> ConnParams
Current connection parameters.
Sourcepub fn data_length(&self) -> DataLength
pub fn data_length(&self) -> DataLength
Current data length.
Sourcepub fn is_connected(&self) -> bool
pub fn is_connected(&self) -> bool
Whether it is still open.
Sourcepub async fn disconnected(&self) -> u8
pub async fn disconnected(&self) -> u8
Waits until the connection closes; returns the HCI reason.
Sourcepub async fn disconnect(&self) -> Result<()>
pub async fn disconnect(&self) -> Result<()>
Closes the connection (reason: Remote User Terminated Connection).
Sourcepub async fn update_params(&self, p: ParamsRequest) -> Result<ConnParams>
pub async fn update_params(&self, p: ParamsRequest) -> Result<ConnParams>
Asks for new connection parameters. As central the controller negotiates them; as peripheral we ask the central over L2CAP.
Sourcepub async fn set_phy(
&self,
tx: &[Phy],
rx: &[Phy],
coded_s8: bool,
) -> Result<(Phy, Phy)>
pub async fn set_phy( &self, tx: &[Phy], rx: &[Phy], coded_s8: bool, ) -> Result<(Phy, Phy)>
Asks for PHYs. Each set lists the PHYs we accept in that direction;
coded_s8 prefers the S=8 coding on the coded PHY (longer range).
Sourcepub async fn set_data_length(&self, tx_octets: u16, tx_time: u16) -> Result<()>
pub async fn set_data_length(&self, tx_octets: u16, tx_time: u16) -> Result<()>
Asks for a data length (octets 27 to 251, time 328 to 17040 µs).
Sourcepub async fn remote_features(&self) -> Result<u64>
pub async fn remote_features(&self) -> Result<u64>
The peer’s LE features (read once, then remembered).
Sourcepub async fn pair(&self) -> Result<Security>
pub async fn pair(&self) -> Result<Security>
Pairs (and bonds, per the host’s configuration). As peripheral this sends a Security Request and the central decides.