pub struct BleController { /* private fields */ }Expand description
A BLE HAP controller: holds the long-term controller identity used for pairing and verification.
Implementations§
Source§impl BleController
impl BleController
Sourcepub fn new(keypair: ControllerKeypair) -> Self
pub fn new(keypair: ControllerKeypair) -> Self
Create a controller from a long-term identity.
Sourcepub fn generate(id: String) -> Self
pub fn generate(id: String) -> Self
Generate a fresh controller identity with the given pairing id.
Sourcepub fn keypair(&self) -> &ControllerKeypair
pub fn keypair(&self) -> &ControllerKeypair
The controller’s pairing identity.
Sourcepub async fn pair(
&self,
gatt: Arc<dyn GattConnection>,
_accessory: &DiscoveredBleAccessory,
setup_code: &str,
) -> Result<Paired>
pub async fn pair( &self, gatt: Arc<dyn GattConnection>, _accessory: &DiscoveredBleAccessory, setup_code: &str, ) -> Result<Paired>
Pair with a discovered accessory: run Pair Setup, then Pair Verify, then
build the attribute database. Returns a Paired containing the ready
accessory handle, the persisted AccessoryPairing, and initial
broadcast material.
§Errors
Propagates connection, pairing, and model errors.
Sourcepub async fn connect(
&self,
gatt: Arc<dyn GattConnection>,
pairing: &AccessoryPairing,
broadcast: Option<BleBroadcastState>,
) -> Result<BleAccessory>
pub async fn connect( &self, gatt: Arc<dyn GattConnection>, pairing: &AccessoryPairing, broadcast: Option<BleBroadcastState>, ) -> Result<BleAccessory>
Connect to an already-paired accessory via Pair Verify, then build the DB.
broadcast is optional previously-persisted broadcast state. Its gsn
seeds last_gsn so the accessory handle does not re-emit already-seen
events after a restart. The key in broadcast is the previously-persisted
one — Pair Verify derives a fresh per-session broadcast key, which becomes
the accessory’s current key.
§NOTE
Decrypting pre-connect broadcasts with the persisted key (vs the fresh per-session key derived here) is a documented follow-up task — the fresh key covers forward broadcasts.
§Errors
Propagates connection, verify, and model errors.