pub struct BLEClient { /* private fields */ }Implementations§
Source§impl BLEClient
impl BLEClient
pub fn on_passkey_request( &mut self, callback: impl Fn() -> u32 + Send + Sync + 'static, ) -> &mut Self
pub fn on_confirm_pin( &mut self, callback: impl Fn(u32) -> bool + Send + Sync + 'static, ) -> &mut Self
pub fn on_connect( &mut self, callback: impl Fn(&mut Self) + Send + Sync + 'static, ) -> &mut Self
pub fn on_disconnect( &mut self, callback: impl Fn(i32) + Send + Sync + 'static, ) -> &mut Self
pub async fn connect(&mut self, addr: &BLEAddress) -> Result<(), BLEError>
pub async fn secure_connection(&mut self) -> Result<(), BLEError>
Sourcepub fn disconnect(&mut self) -> Result<(), BLEError>
pub fn disconnect(&mut self) -> Result<(), BLEError>
Disconnect from the peer.
Sourcepub fn disconnect_with_reason(&mut self, reason: u8) -> Result<(), BLEError>
pub fn disconnect_with_reason(&mut self, reason: u8) -> Result<(), BLEError>
Disconnect from the peer with optional reason.
pub fn connected(&self) -> bool
Sourcepub fn set_connection_params(
&mut self,
min_interval: u16,
max_interval: u16,
latency: u16,
timeout: u16,
scan_interval: u16,
scan_window: u16,
)
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.
Sourcepub fn update_conn_params(
&mut self,
min_interval: u16,
max_interval: u16,
latency: u16,
timeout: u16,
) -> Result<(), BLEError>
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.
pub fn desc(&self) -> Result<BLEConnDesc, BLEError>
Sourcepub fn get_rssi(&self) -> Result<i8, BLEError>
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.
pub async fn get_services( &mut self, ) -> Result<IterMut<'_, BLERemoteService>, BLEError>
pub async fn get_service( &mut self, uuid: BleUuid, ) -> Result<&mut BLERemoteService, BLEError>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for BLEClient
impl !RefUnwindSafe for BLEClient
impl !Send for BLEClient
impl !Sync for BLEClient
impl Unpin for BLEClient
impl UnsafeUnpin for BLEClient
impl !UnwindSafe for BLEClient
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more