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