Struct esp32_nimble::BLEClient

source ·
pub struct BLEClient { /* private fields */ }

Implementations§

source§

impl BLEClient

source

pub fn new() -> Self

source

pub fn on_passkey_request( &mut self, callback: impl Fn() -> u32 + Send + Sync + 'static, ) -> &mut Self

source

pub fn on_confirm_pin( &mut self, callback: impl Fn(u32) -> bool + Send + Sync + 'static, ) -> &mut Self

source

pub fn on_connect( &mut self, callback: impl Fn(&mut Self) + Send + Sync + 'static, ) -> &mut Self

source

pub fn on_disconnect( &mut self, callback: impl Fn(i32) + Send + Sync + 'static, ) -> &mut Self

source

pub async fn connect(&mut self, addr: &BLEAddress) -> Result<(), BLEError>

source

pub async fn secure_connection(&mut self) -> Result<(), BLEError>

source

pub fn disconnect(&mut self) -> Result<(), BLEError>

Disconnect from the peer.

source

pub fn disconnect_with_reason(&mut self, reason: u8) -> Result<(), BLEError>

Disconnect from the peer with optional reason.

source

pub fn connected(&self) -> bool

source

pub fn set_connection_params( &mut self, min_interval: u16, max_interval: u16, latency: u16, timeout: u16, scan_interval: u16, scan_window: u16, )

Set the connection parameters to use when connecting to a server.

  • min_interval: The minimum connection interval in 1.25ms units.
  • max_interval: The maximum connection interval in 1.25ms units.
  • latency: The number of packets allowed to skip (extends max interval).
  • timeout: The timeout time in 10ms units before disconnecting.
  • scan_interval: The scan interval to use when attempting to connect in 0.625ms units.
  • scan_window: The scan window to use when attempting to connect in 0.625ms units.
source

pub fn update_conn_params( &mut self, min_interval: u16, max_interval: u16, latency: u16, timeout: u16, ) -> Result<(), BLEError>

Request an Update the connection parameters: Can only be used after a connection has been established.

  • min_interval: The minimum connection interval in 1.25ms units.
  • max_interval: The maximum connection interval in 1.25ms units.
  • latency: The number of packets allowed to skip (extends max interval).
  • timeout: The timeout time in 10ms units before disconnecting.
source

pub fn desc(&self) -> Result<BLEConnDesc, BLEError>

source

pub fn get_rssi(&self) -> Result<i8, BLEError>

Retrieves the most-recently measured RSSI. A connection’s RSSI is updated whenever a data channel PDU is received.

source

pub async fn get_services( &mut self, ) -> Result<IterMut<'_, BLERemoteService>, BLEError>

source

pub async fn get_service( &mut self, uuid: BleUuid, ) -> Result<&mut BLERemoteService, BLEError>

Trait Implementations§

source§

impl Drop for BLEClient

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl Freeze for BLEClient

§

impl !RefUnwindSafe for BLEClient

§

impl !Send for BLEClient

§

impl !Sync for BLEClient

§

impl Unpin for BLEClient

§

impl !UnwindSafe for BLEClient

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.