pub trait BluetoothDeviceTrait {
// Required methods
fn supports_async(&mut self) -> Option<&mut dyn BluetoothDeviceAsyncTrait>;
fn supports_sync(&mut self) -> Option<&mut dyn BluetoothDeviceSyncTrait>;
fn get_address(&mut self) -> Result<String, Error>;
fn get_rfcomm_socket(
&mut self,
channel: u8,
is_secure: bool,
) -> Result<BluetoothSocket, String>;
fn get_l2cap_socket(
&mut self,
psm: u16,
is_secure: bool,
) -> Result<BluetoothSocket, String>;
// Provided method
fn run_sdp(&mut self, uuid: BluetoothUuid) -> Result<ServiceRecord, String> { ... }
}Expand description
The trait that all bluetooth devices must implement
Required Methods§
Sourcefn supports_async(&mut self) -> Option<&mut dyn BluetoothDeviceAsyncTrait>
fn supports_async(&mut self) -> Option<&mut dyn BluetoothDeviceAsyncTrait>
Does the device support async?
Sourcefn supports_sync(&mut self) -> Option<&mut dyn BluetoothDeviceSyncTrait>
fn supports_sync(&mut self) -> Option<&mut dyn BluetoothDeviceSyncTrait>
Does the device support sync?
Sourcefn get_address(&mut self) -> Result<String, Error>
fn get_address(&mut self) -> Result<String, Error>
Retrieve the device address
Sourcefn get_rfcomm_socket(
&mut self,
channel: u8,
is_secure: bool,
) -> Result<BluetoothSocket, String>
fn get_rfcomm_socket( &mut self, channel: u8, is_secure: bool, ) -> Result<BluetoothSocket, String>
Attempt to get an rfcomm socket for the given uuid and security setting
Sourcefn get_l2cap_socket(
&mut self,
psm: u16,
is_secure: bool,
) -> Result<BluetoothSocket, String>
fn get_l2cap_socket( &mut self, psm: u16, is_secure: bool, ) -> Result<BluetoothSocket, String>
Attempt to get an l2cap socket for the given uuid and security setting
Provided Methods§
Sourcefn run_sdp(&mut self, uuid: BluetoothUuid) -> Result<ServiceRecord, String>
fn run_sdp(&mut self, uuid: BluetoothUuid) -> Result<ServiceRecord, String>
Run the service discovery protocol