Skip to main content

Crate hap_ble

Crate hap_ble 

Source
Expand description

HomeKit Accessory Protocol (HAP) Bluetooth LE transport.

Discover, pair with, read from, and stream events off a HomeKit accessory over BLE, reusing the pairing crypto from hap_crypto, the TLV8 codec from hap_tlv8, and the attribute model from hap_model.

This is Milestone A: a standalone transport. Unifying it with the IP hap_controller under one HapController is Milestone B.

Structs§

Accessory
One accessory in the bridge/accessory database.
AccessoryPairing
The pairing material a successful Pair Setup yields about the accessory.
BleAccessory
A connected BLE accessory: holds the GATT link, the secure session, the cached attribute database, and a map from (aid, iid) to GATT characteristic UUID for issuing PDUs.
BleBroadcastState
Broadcast-notification material for one accessory, persistable by the caller. Holds a secret (BroadcastKey is zeroized on drop).
BleController
A BLE HAP controller: holds the long-term controller identity used for pairing and verification.
BluestConnection
A GattConnection over a connected bluest Device that reconnects and retries on a dropped link.
BroadcastKey
A 32-byte ChaCha20-Poly1305 key for decrypting encrypted broadcast notifications. Zeroized on drop; its Debug is redacted.
Characteristic
One characteristic on a service.
CharacteristicEvent
A characteristic value-change event.
ControllerKeypair
A controller’s long-term Ed25519 identity used across pairings.
DiscoveredBleAccessory
A HAP accessory found while scanning over BLE.
GattCharacteristic
One GATT characteristic discovered on the accessory.
GattService
One GATT service and its characteristics.
Paired
The result of a successful BLE pairing.
RawAdvert
A raw advertisement observed by a backend scanner: the Apple (0x004C) manufacturer-data bytes. Parsed into a crate::advert::HapAdvert by callers.
Service
One service on an accessory.

Enums§

BleError
Errors from the BLE transport.
CharFormat
The HAP characteristic value format (the format field on a characteristic).
CharValue
A decoded characteristic value, collapsed across the integer widths.
CharacteristicType
HAP-defined CharacteristicType (generated). Unknown carries any non-HAP UUID.
HapAdvert
A parsed HAP advertisement of interest to the controller.
ServiceType
HAP-defined ServiceType (generated). Unknown carries any non-HAP UUID.

Traits§

AdvertSource
A source of continuous BLE advertisements, used post-pairing to receive sleepy-device events with no active connection. Separate from GattConnection (the connected I/O seam) so each has one responsibility. Backends without a scanner return an immediately-closed receiver.
GattConnection
The transport seam: read/write/subscribe a characteristic and enumerate the GATT database. One real impl (bluest), one mock (tests).

Functions§

connect_gatt
Connect to a discovered accessory and return a resilient GATT link.
scan
Scan for HAP accessories advertising over BLE for timeout.

Type Aliases§

Result
The crate result alias.