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
//! Linux BLE from pure Rust, with no dependencies.
//!
//! Two ways to reach a controller, because Linux offers two:
//!
//! * **`bluez`** — the supported path, over `dbus` to `org.bluez`. Pairing,
//! bonding and agents are the daemon's problem.
//! * **`hci` + `gatt`** — no daemon at all. ATT over an L2CAP socket for
//! GATT, a raw HCI socket for scanning.
//!
//! Neither binds a C library. D-Bus is a wire protocol over a Unix socket and
//! is spoken as one; ATT, HCI and L2CAP are kernel sockets reached through
//! `sys`.
//!
//! [`dbus::codec`], [`dbus::value`] and `att` are pure byte manipulation and
//! build everywhere, so the parts where the bugs live — alignment, truncation,
//! signature-directed decoding — are unit-tested on any host rather than only
//! inside a container.
//!
//! ## License
//! MIT — Copyright © 2025 [Eugene Hauptmann](https://github.com/eugenehp)
/// LE scanning. The advertising-data parser is portable; only the raw socket
/// inside it is Linux-only.
// The adapter: BlueZ expressed as the portable model.
// Public so `webbluetooth` can reach it, and not an API anyone else
// should call: the facade is what a caller holds. Hidden from the docs
// for the same reason, which also keeps the same 38 adapter methods from
// being documented six times over.
// The peripheral-role adapter: a GATT server expressed as the portable model.
// The same adapter without BlueZ: ATT over an L2CAP socket for GATT, a raw
// HCI socket for scanning.
//
// Compiled whenever the other one is, rather than behind the `linux-hci`
// feature that selects it. Two adapters that are only ever built one at a
// time are two adapters that drift, and this one is the one almost nobody
// builds.
// Public so `webbluetooth` can reach it, and not an API anyone else
// should call: the facade is what a caller holds. Hidden from the docs
// for the same reason, which also keeps the same 38 adapter methods from
// being documented six times over.