1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/// Defines the `Device` trait for interfacing with Bluetooth devices via D-Bus.
/// Provides methods for connecting, pairing, and managing device properties.
#[zbus::proxy(default_service = "org.bluez", interface = "org.bluez.Device1")]
pub trait Device {
/// Initiates a connection to the Bluetooth device.
fn connect(&self) -> zbus::Result<()>;
/// Disconnects the Bluetooth device.
fn disconnect(&self) -> zbus::Result<()>;
/// Pairs the Bluetooth device with the adapter.
fn pair(&self) -> zbus::Result<()>;
/// Cancels an ongoing pairing process.
fn cancel_pairing(&self) -> zbus::Result<()>;
/// Checks if the device's services have been resolved.
#[zbus(property)]
fn services_resolved(&self) -> zbus::Result<bool>;
/// Retrieves the Bluetooth device's unique address (MAC address).
#[zbus(property)]
fn address(&self) -> zbus::Result<String>;
/// Retrieves the name of the Bluetooth device.
#[zbus(property)]
fn name(&self) -> zbus::Result<String>;
/// Checks if the device is currently connected.
#[zbus(property)]
fn connected(&self) -> zbus::Result<bool>;
/// Checks if the device is paired.
#[zbus(property)]
fn paired(&self) -> zbus::Result<bool>;
/// Checks if the device is marked as trusted.
#[zbus(property)]
fn trusted(&self) -> zbus::Result<bool>;
/// Sets the device as trusted or untrusted.
///
/// # Arguments
/// * `trusted` - `true` to mark as trusted, `false` to unmark.
#[zbus(property)]
fn set_trusted(&self, trusted: bool) -> zbus::Result<()>;
/// Checks if the device is blocked.
#[zbus(property)]
fn blocked(&self) -> zbus::Result<bool>;
/// Blocks or unblocks the device.
///
/// # Arguments
/// * `blocked` - `true` to block, `false` to unblock.
#[zbus(property)]
fn set_blocked(&self, blocked: bool) -> zbus::Result<()>;
}