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;
24mod sleepy;
25
26/// Test-support seam: the in-memory GATT mock and a ready-made accessory
27/// fixture. Compiled for this crate's own tests and for consumers that enable
28/// the `test-support` feature. **Exempt from semver guarantees.**
29#[cfg(any(test, feature = "test-support"))]
30pub mod test_support;
31
32pub use accessory::{BleAccessory, CharacteristicEvent};
33pub use advert::HapAdvert;
34pub use bluest_gatt::BluestConnection;
35pub use broadcast_state::BleBroadcastState;
36pub use controller::{BleController, Paired};
37pub use discovery::{connect_gatt, scan, DiscoveredBleAccessory};
38pub use error::{BleError, Result};
39pub use gatt::{AdvertSource, GattCharacteristic, GattConnection, GattService, RawAdvert};
40pub use sleepy::{BluestSleepyConnector, SleepyConnector};
41
42// Lower-crate types that appear in this crate's public API.
43pub use hap_crypto::{AccessoryPairing, BroadcastKey, ControllerKeypair};
44pub use hap_model::{
45    format::{CharFormat, CharValue},
46    tree::{Accessory, Characteristic, Service},
47    CharacteristicType, ServiceType,
48};