pub struct Device { /* private fields */ }Expand description
A Bluetooth LE device.
Implementations§
Source§impl Device
impl Device
Sourcepub async fn name_async(&self) -> Result<String>
pub async fn name_async(&self) -> Result<String>
This method is kept for compatibility with bluest.
Sourcepub async fn is_connected(&self) -> bool
pub async fn is_connected(&self) -> bool
The connection status for this device.
NOTE: currently this just checks if it is registered in this library instance.
Sourcepub async fn pair(&self) -> Result<()>
pub async fn pair(&self) -> Result<()>
Attempt to pair this device using the system default pairing UI.
Sourcepub async fn discover_services(&self) -> Result<Vec<Service>>
pub async fn discover_services(&self) -> Result<Vec<Service>>
Discover the primary services of this device.
Sourcepub async fn discover_services_with_uuid(
&self,
uuid: Uuid,
) -> Result<Vec<Service>>
pub async fn discover_services_with_uuid( &self, uuid: Uuid, ) -> Result<Vec<Service>>
Discover the primary service(s) of this device with the given Uuid.
Sourcepub async fn services(&self) -> Result<Vec<Service>>
pub async fn services(&self) -> Result<Vec<Service>>
Get previously discovered services.
If no services have been discovered yet, this method will perform service discovery.
Sourcepub async fn service_changed_indications(
&self,
) -> Result<impl Stream<Item = Result<ServicesChanged>> + Send + Unpin + '_>
pub async fn service_changed_indications( &self, ) -> Result<impl Stream<Item = Result<ServicesChanged>> + Send + Unpin + '_>
(Experimental) Monitors the device for service changed indications.
This requires Android API level 31 or higher.
Sourcepub async fn rssi(&self) -> Result<i16>
pub async fn rssi(&self) -> Result<i16>
Get the current signal strength from the device in dBm.
Sourcepub async fn open_l2cap_channel(
&self,
psm: u16,
secure: bool,
) -> Result<L2capChannel>
pub async fn open_l2cap_channel( &self, psm: u16, secure: bool, ) -> Result<L2capChannel>
Open an L2CAP connection-oriented channel (CoC) to this device.
This requires Android API level 29 or higher.