Skip to main content

hap_ble/
lib.rs

1//! HomeKit Accessory Protocol (HAP) **Bluetooth LE** transport.
2//!
3//! Discover, pair with, read from, and stream events off a HomeKit accessory
4//! over BLE, reusing the pairing crypto from [`hap_crypto`], the TLV8 codec
5//! from [`hap_tlv8`], and the attribute model from [`hap_model`].
6//!
7//! The transport-unified API lives in [`hap_controller`] (feature `ble`);
8//! this crate remains usable standalone.
9#![forbid(unsafe_code)]
10
11mod accessory;
12mod advert;
13mod bluest_gatt;
14mod broadcast_state;
15mod controller;
16mod db;
17mod discovery;
18mod error;
19mod gatt;
20mod pairing;
21mod pdu;
22mod scan_gate;
23mod session;
24
25/// Test-support seam: the in-memory GATT mock and a ready-made accessory
26/// fixture. Compiled for this crate's own tests and for consumers that enable
27/// the `test-support` feature. **Exempt from semver guarantees.**
28#[cfg(any(test, feature = "test-support"))]
29pub mod test_support;
30
31pub use accessory::{BleAccessory, CharacteristicEvent};
32pub use advert::HapAdvert;
33pub use bluest_gatt::BluestConnection;
34pub use broadcast_state::BleBroadcastState;
35pub use controller::{BleController, Paired};
36pub use discovery::{connect_gatt, scan, DiscoveredBleAccessory};
37pub use error::{BleError, Result};
38pub use gatt::{AdvertSource, GattCharacteristic, GattConnection, GattService, RawAdvert};
39
40// Lower-crate types that appear in this crate's public API.
41pub use hap_crypto::{AccessoryPairing, BroadcastKey, ControllerKeypair};
42pub use hap_model::{
43    format::{CharFormat, CharValue},
44    tree::{Accessory, Characteristic, Service},
45    CharacteristicType, ServiceType,
46};