Struct esp32_nimble::BLEDevice

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

Implementations§

source§

impl BLEDevice

source

pub fn init()

source

pub fn take() -> &'static mut Self

source

pub fn deinit() -> Result<(), EspError>

Shutdown the NimBLE stack/controller

source

pub fn deinit_full() -> Result<(), EspError>

Shutdown the NimBLE stack/controller server/advertising/scan will be reset.

source

pub fn get_server(&self) -> &'static mut BLEServer

source

pub fn get_advertising(&self) -> &'static Mutex<BLEAdvertising>

source

pub fn set_power( &mut self, power_type: PowerType, power_level: PowerLevel, ) -> Result<(), BLEError>

source

pub fn get_power(&self, power_type: PowerType) -> PowerLevel

source

pub fn set_preferred_mtu(&self, mtu: u16) -> Result<(), BLEError>

Sets the preferred ATT MTU; the device will indicate this value in all subsequent ATT MTU exchanges. The ATT MTU of a connection is equal to the lower of the two peers’preferred MTU values. The ATT MTU is what dictates the maximum size of any message sent during a GATT procedure.

The specified MTU must be within the following range: [23, BLE_ATT_MTU_MAX]. 23 is a minimum imposed by the Bluetooth specification; BLE_ATT_MTU_MAX is a NimBLE compile-time setting.

source

pub fn get_preferred_mtu(&self) -> u16

Retrieves the preferred ATT MTU. This is the value indicated by the device during an ATT MTU exchange.

source

pub fn bonded_addresses(&self) -> Result<Vec<BLEAddress>, BLEError>

Get the addresses of all bonded peer device.

source

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

Deletes all bonding information.

source

pub fn delete_bond(&self, address: &BLEAddress) -> Result<(), BLEError>

Deletes a peer bond.

  • address: The address of the peer with which to delete bond info.
source

pub fn set_white_list( &mut self, white_list: &[BLEAddress], ) -> Result<(), BLEError>

source

pub fn security(&mut self) -> &mut BLESecurity

source

pub fn set_own_addr_type(&mut self, own_addr_type: OwnAddrType)

Set the own address type.

source

pub fn set_own_addr_type_to_non_resolvable_random(&mut self)

Set the own address type to non-resolvable random address.

source

pub fn set_rnd_addr(&mut self, addr: [u8; 6]) -> Result<(), BLEError>

Set the own address to be used when the address type is random.

source

pub fn set_device_name(device_name: &str) -> Result<(), BLEError>

Auto Trait Implementations§

§

impl Freeze for BLEDevice

§

impl RefUnwindSafe for BLEDevice

§

impl Send for BLEDevice

§

impl Sync for BLEDevice

§

impl Unpin for BLEDevice

§

impl UnwindSafe for BLEDevice

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.