Skip to main content

BluetoothDeviceTrait

Trait BluetoothDeviceTrait 

Source
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§

Source

fn supports_async(&mut self) -> Option<&mut dyn BluetoothDeviceAsyncTrait>

Does the device support async?

Source

fn supports_sync(&mut self) -> Option<&mut dyn BluetoothDeviceSyncTrait>

Does the device support sync?

Source

fn get_address(&mut self) -> Result<String, Error>

Retrieve the device address

Source

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

Source

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§

Source

fn run_sdp(&mut self, uuid: BluetoothUuid) -> Result<ServiceRecord, String>

Run the service discovery protocol

Implementors§