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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
//! # Bluetooth D-Bus API for Rust
//!
//! This library provides an interface to interact with Bluetooth devices
//! using the BlueZ D-Bus API. It enables communication with Bluetooth adapters,
//! devices, GATT profiles, and Low Energy advertisements.
//!
//! ## Features
//! - **Device Discovery**: Scan and list nearby Bluetooth devices.
//! - **Device Management**: Connect, pair, unpair, and trust devices.
//! - **GATT Support**: Read/write characteristics and descriptors.
//! - **LE Advertisement**: Control Bluetooth Low Energy advertisements.
//!
//! ## Example Usage
//! Here’s how you can scan for Bluetooth devices and list them:
//!
//! ```no_run
//!
//! #[tokio::main]
//! async fn main() -> zbus::Result<()> {
//! let conn = bluebus::get_system_connection().await.unwrap();
//! let adapter = bluebus::AdapterProxy::builder(&conn)
//! .path(bluebus::ADAPTER_PATH)?.build().await?;
//!
//! if !adapter.powered().await? {
//! adapter.set_powered(true).await?;
//! }
//!
//! adapter.start_discovery().await?;
//! tokio::time::sleep(tokio::time::Duration::from_secs(3)).await;
//! adapter.stop_discovery().await?;
//!
//! let monitor = Arc::new(bluebus::Monitor::new(conn.clone(), manager).await);
//! let monitor_clone = Arc::clone(&monitor);
//!
//! bluebus::print_avaiable_devices(&objects);
//!
//! tokio::spawn(async move {
//! monitor.monitor_device_added().await;
//! });
//!
//! tokio::spawn(async move {
//! monitor_clone.monitor_device_removed().await;
//! });
//! Ok(())
//! }
//! ```
//!
//! ## Modules Overview
//!
//! - [`adapter`] - Manages Bluetooth adapters (enables/disables, scans devices).
//! - [`agent`] - Handles pairing and authentication requests.
//! - [`device`] - Manages Bluetooth device connections.
//! - [`gatt_service`] - Interfaces with Bluetooth GATT services.
//! - [`monitor`] - Monitors Bluetooth events like device additions/removals.
//! - [`object_manager`] - Handles D-Bus object management.
//!
//! ## Installation
//! Add the following to your `Cargo.toml`:
//!
//! ```toml
//! [dependencies]
//! bluetooth_lib = "0.1"
//! ```
//!
/// Manages Bluetooth adapter interactions.
/// Handles Bluetooth authentication agents.
/// Manages agent registrations.
/// Caches Bluetooth device states.
/// Handles Bluetooth connections.
/// Controls Bluetooth devices.
/// Interfaces with GATT characteristics and services.
/// Manages Bluetooth Low Energy advertisements.
/// Listens for Bluetooth device events.
/// Manages D-Bus objects.
/// Defines Bluetooth system paths.
// Re-export modules for easier access.
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;