aliro_ble.h
Aliro BLE-UWB reader transport: GATT service definition, advertised feature flags, and transport…
Overview
Aliro BLE-UWB reader transport: GATT service definition, advertised feature flags, and transport callbacks connecting the BLE peripheral role to the Aliro protocol handler in aliro_reader. Callers configure the transport via aliro_ble_prepare (which builds the READ characteristic payload without touching NimBLE), then register the GATT service returned by aliro_ble_service_def with the host's combined service table.
used by aliro_ranging.c aliro_reader.c
API
Cstruct aliro_ble_features
Aliro BLE-UWB supported-features flags (advertised in the READ char, and parsed from the device WRITE). Serialized as one byte: bit0/1/2.
Cstruct aliro_ble_callbacks
Transport callbacks into the app / Phase-3 Aliro handler. All optional.
Cstruct aliro_ble_config
Reader configuration. proto_versions are host-order uint16s; they are the
provisioned aliroSupportedBLEUWBProtocolVersions (Matter attr 133), NOT a
transport constant, so the caller supplies them.
Fint aliro_ble_start(const struct aliro_ble_config *cfg)
Start NimBLE, register the Aliro GATT service, and begin advertising. Returns 0 on success, negative errno otherwise.
Fuint16_t aliro_ble_spsm(void)
The L2CAP SPSM published to peers in the READ characteristic.
Fint aliro_ble_send(uint16_t conn_handle, const uint8_t *data, size_t len)
Send an SDU to the peer over its L2CAP channel (2.2+). Returns 0 on success.
Fint aliro_ble_disconnect(uint16_t conn_handle)
Terminate the BLE connection (reader-initiated; e.g. the RSSI power gate closing on a departed peer). Returns 0 on success.
Fvoid aliro_ble_post_reader_status(void (*cb)(bool unsecured), bool unsecured)
Fint aliro_ble_prepare(const struct aliro_ble_config *cfg)
Capture config + build the READ payload; does NOT touch NimBLE. 0 on ok.
Fconst struct ble_gatt_svc_def * aliro_ble_service_def(void)
The Aliro GATT service definition, to hand to the host owner's register-extra-services hook. Valid after aliro_ble_prepare().
Fint aliro_ble_start_attached(void)
Bring up the reader on the already-synced shared host: L2CAP CoC + advertising. Returns 0 on success.
Fvoid aliro_ble_set_adv_params(const uint8_t group_id8[8], const uint8_t sub_id2[2], const uint8_t grk[16], int8_t tx_power)
Set the provisioned Aliro advertising params (BLE-UWB approach discovery): the truncated reader group id (8) + sub id (2), the group resolving key (16) for the dynamic tag, and the tx-power byte. Call before start_attached(); once set, the reader advertises the full resolvable 0xFFF2 service data instead of the bare service UUID, so the phone can approach-connect.
Fvoid aliro_ble_readvertise(void)
Re-emit the advertisement with the current adv params (call after aliro_ble_set_adv_params updates the GRK post-provisioning). No-op until start_attached() has brought the advertiser up.
Fvoid aliro_ble_time_updated(void)
The wall clock just stepped (e.g. SNTP first sync): re-derive the dynamic advertisement tag now instead of waiting out the refresh period. Safe from any task; marshaled onto the host task. No-op until start_attached().