Skip to main content

BluetoothDeviceTrait

Trait BluetoothDeviceTrait 

Source
pub trait BluetoothDeviceTrait {
    // Required methods
    fn get_uuids(&mut self) -> Result<Vec<BluetoothUuid>, Error>;
    fn get_name(&self) -> Result<String, Error>;
    fn get_address(&mut self) -> Result<String, Error>;
    fn get_pair_state(&self) -> Result<PairingStatus, Error>;
    fn get_rfcomm_socket(
        &mut self,
        uuid: BluetoothUuid,
        is_secure: bool,
    ) -> Result<BluetoothSocket<'_>, String>;
    fn get_l2cap_socket(
        &mut self,
        uuid: BluetoothUuid,
        is_secure: bool,
    ) -> Result<BluetoothSocket<'_>, String>;
    fn run_sdp(&mut self);
}
Expand description

The trait that all bluetooth devices must implement

Required Methods§

Source

fn get_uuids(&mut self) -> Result<Vec<BluetoothUuid>, Error>

Get all known uuids for this device

Source

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

Retrieve the device name

Source

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

Retrieve the device address

Source

fn get_pair_state(&self) -> Result<PairingStatus, Error>

Retrieve the device pairing status

Source

fn get_rfcomm_socket( &mut self, uuid: BluetoothUuid, 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, uuid: BluetoothUuid, is_secure: bool, ) -> Result<BluetoothSocket<'_>, String>

Attempt to get an l2cap socket for the given uuid and security setting

Source

fn run_sdp(&mut self)

Run the service discovery protocol

Implementors§