Struct esp32_nimble::BLEDevice
source · pub struct BLEDevice { /* private fields */ }
Implementations§
source§impl BLEDevice
impl BLEDevice
pub fn init()
pub fn take() -> &'static mut Self
sourcepub fn deinit_full() -> Result<(), EspError>
pub fn deinit_full() -> Result<(), EspError>
Shutdown the NimBLE stack/controller server/advertising/scan will be reset.
pub fn get_server(&self) -> &'static mut BLEServer
pub fn get_advertising(&self) -> &'static Mutex<BLEAdvertising>
pub fn set_power( &mut self, power_type: PowerType, power_level: PowerLevel, ) -> Result<(), BLEError>
pub fn get_power(&self, power_type: PowerType) -> PowerLevel
sourcepub fn set_preferred_mtu(&self, mtu: u16) -> Result<(), BLEError>
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.
sourcepub fn get_preferred_mtu(&self) -> u16
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.
sourcepub fn bonded_addresses(&self) -> Result<Vec<BLEAddress>, BLEError>
pub fn bonded_addresses(&self) -> Result<Vec<BLEAddress>, BLEError>
Get the addresses of all bonded peer device.
sourcepub fn delete_all_bonds(&self) -> Result<(), BLEError>
pub fn delete_all_bonds(&self) -> Result<(), BLEError>
Deletes all bonding information.
sourcepub fn delete_bond(&self, address: &BLEAddress) -> Result<(), BLEError>
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.
pub fn set_white_list( &mut self, white_list: &[BLEAddress], ) -> Result<(), BLEError>
pub fn security(&mut self) -> &mut BLESecurity
sourcepub fn set_own_addr_type(&mut self, own_addr_type: OwnAddrType)
pub fn set_own_addr_type(&mut self, own_addr_type: OwnAddrType)
Set the own address type.
sourcepub fn set_own_addr_type_to_non_resolvable_random(&mut self)
pub fn set_own_addr_type_to_non_resolvable_random(&mut self)
Set the own address type to non-resolvable random address.
sourcepub fn set_rnd_addr(&mut self, addr: [u8; 6]) -> Result<(), BLEError>
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.