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
//! The portable half of `webbluetooth`, and the contract its backends meet.
//!
//! Everything here is platform-independent: the error vocabulary, the UUID
//! registry, the filters, the two blocklists, the grant store, the scan hub.
//! None of it knows whether it is talking to CoreBluetooth, BlueZ, WinRT, the
//! Android framework, a raw HCI socket or the browser's own Web Bluetooth.
//!
//! # Why this is a crate and not a module
//!
//! A backend has to reach this code — it converts platform errors into
//! [`Error`], platform UUIDs into [`BluetoothUuid`], and publishes sightings
//! into a [`ScanHub`](scan::ScanHub). While the backends lived in the same
//! crate as the public API, "reach this code" meant `crate::`, and that cost
//! two things.
//!
//! The first is that a backend could reach *anything*, including the public
//! API above it, and three of them did. The second is that anything two
//! backends both needed had nowhere to live: [`RestoredScan`] was written out
//! six times, once per backend, because a shared type would have had to sit in
//! a module that every backend could see and no backend could be sure of.
//!
//! # What checks that the backends agree
//!
//! Only one of them is ever compiled, so five are invisible to any one build.
//! `tests/backend_surface.rs` reads all six as source and compares the methods
//! they declare, on whatever host it runs on. A trait would have been the
//! obvious mechanism and does not fit — three of those methods take
//! `self: &Arc<Self>`, which a trait cannot declare, and a trait would still
//! only check the backend already being compiled.
//!
//! # What is not here
//!
//! The Web Bluetooth objects themselves — `Bluetooth`, `BluetoothDevice`, the
//! GATT tree — are in `webbluetooth`, above this. They are what a caller
//! holds; this is what they are built out of.
//!
//! L2CAP is not here either, and for a different reason: a channel is a
//! platform socket rather than a portable value, so the glue that adapts one
//! lives in `webbluetooth` beside the backend selection. The specification has
//! no L2CAP, so nothing in the portable model is missing it.
//!
//! # Stability
//!
//! This crate exists so `webbluetooth` and the six backend crates can share a
//! vocabulary. Everything it exports is public because a backend in another
//! crate has to name it — not because it is an API to build on. Depend on
//! `webbluetooth`.
// Re-exported so `forward_to_registry!`, expanded in a backend crate, can name
// the channel type without that crate having to depend on futures-channel.
// Everything public here is named by a backend in another crate, which makes
// "what is this for" a question somebody actually has to answer.
pub use futures_channel;
/// The peripheral role's definitions: what a GATT server publishes.
/// Conversions to and from the `uuid` crate's `Uuid`. Feature `uuid`.
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ManagerState;
pub use ;
pub use ;