pub struct Bluetooth { /* private fields */ }Expand description
Bluetooth from BlueZ, from cx.bluetooth(). Cloning it is cheap.
Implementations§
Source§impl Bluetooth
impl Bluetooth
Sourcepub fn adapters(&self) -> ReadSignal<Vec<BluetoothAdapter>>
pub fn adapters(&self) -> ReadSignal<Vec<BluetoothAdapter>>
Every adapter, in path order. Empty while BlueZ isn’t running.
Sourcepub fn devices(&self) -> ReadSignal<Vec<BluetoothDevice>>
pub fn devices(&self) -> ReadSignal<Vec<BluetoothDevice>>
Every device BlueZ knows, in path order. Empty while BlueZ isn’t running.
Sourcepub fn set_powered(&self, adapter: &str, powered: bool)
pub fn set_powered(&self, adapter: &str, powered: bool)
Turns the adapter at adapter, its path, on or off.
Sourcepub fn start_discovery(&self, adapter: &str)
pub fn start_discovery(&self, adapter: &str)
Starts looking for devices. Found ones join devices until BlueZ
forgets them, a while after stop_discovery.
Sourcepub fn stop_discovery(&self, adapter: &str)
pub fn stop_discovery(&self, adapter: &str)
Stops looking for devices.
Sourcepub fn connect(&self, device: &str)
pub fn connect(&self, device: &str)
Connects the device at device, its path. Its state is
Connecting until BlueZ answers
or says it connected or disconnected.
Sourcepub fn disconnect(&self, device: &str)
pub fn disconnect(&self, device: &str)
Disconnects the device at device, which is
Disconnecting as
connect is connecting.
Sourcepub fn pair(&self, device: &str)
pub fn pair(&self, device: &str)
Pairs with the device at device. The shell answers no pairing
questions, so a device that asks for a PIN or a confirmation fails,
and that is logged, unless another program on the desktop answers
for BlueZ.
Sourcepub fn set_trusted(&self, device: &str, trusted: bool)
pub fn set_trusted(&self, device: &str, trusted: bool)
Lets the device at device connect without asking, or not.