Struct nrf_softdevice::ble::Connection
source · 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
pub fn security_handler(&self) -> Option<&dyn SecurityHandler>
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.
sourcepub fn ignore_slave_latency(
&mut self,
ignore: bool
) -> Result<(), IgnoreSlaveLatencyError>
pub fn ignore_slave_latency(
&mut self,
ignore: bool
) -> Result<(), IgnoreSlaveLatencyError>
Temporarily ignore slave latency for peripehral connections.
“Slave latency” is a setting in the conn params that allows the peripheral to intentionally sleep through and miss up to N connection events if it doesn’t have any data to send to the central.
Slave latency is useful because it can yield the same power savings on the peripheral as increasing the conn interval, but it only impacts latency in the central->peripheral direction, not both.
However, in some cases, if the peripheral knows the central will send it some data soon it might be useful to temporarily force ignoring the slave latency setting, ie waking up at every single conn interval, to lower the latency.
This only works on peripheral connections.
pub fn iter() -> ConnectionIter ⓘ
Trait Implementations§
source§impl Clone for Connection
impl Clone for Connection
source§impl Drop for Connection
impl Drop for Connection
source§impl Hash for Connection
impl Hash for Connection
source§impl Ord for Connection
impl Ord for Connection
source§fn cmp(&self, other: &Connection) -> Ordering
fn cmp(&self, other: &Connection) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq<Connection> for Connection
impl PartialEq<Connection> for Connection
source§fn eq(&self, other: &Connection) -> bool
fn eq(&self, other: &Connection) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd<Connection> for Connection
impl PartialOrd<Connection> for Connection
source§fn partial_cmp(&self, other: &Connection) -> Option<Ordering>
fn partial_cmp(&self, other: &Connection) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more