modules/woz_aliro/src/aliro_ranging.h
asxeem/openaliro
Module

aliro_ranging.h

Aliro M1-M4 ranging-setup interface: negotiates UWB ranging parameters with the device and…

modules/woz_aliro/src/aliro_ranging.h

Overview

Aliro M1-M4 ranging-setup interface: negotiates UWB ranging parameters with the device and produces the BLE ranging-control secure channel used to carry the M1-M4 exchange.

used by aliro_ranging.c aliro_reader.c

API

Fint aliro_ranging_init(void)

modules/woz_aliro/src/aliro_ranging.h:31

One-time bring-up of the reader UWB adapter (cherry ctx + capabilities + reader config). Idempotent. Returns 0 on success, negative on failure (the reader still runs; ranging just won't start).

Fint aliro_ranging_start(uint16_t conn_handle, uint32_t session_id, const uint8_t *ursk, struct aliro_secchan *sc_ble)

modules/woz_aliro/src/aliro_ranging.h:44

Arm the M1-M4 ranging setup for a connection: create the session with ranging session id @session_id, bound to the 32-byte @ursk and the BleSK ranging channel @sc_ble, whose reader-direction counter is used to seal the engine's outbound SDUs (continuing from the AP-Completed message). @session_id MUST match the value the device derived from the AUTH0 transaction id (big-endian txid[12..15]); it is advertised in M1 and the device indexes its URSK by it. M1 is NOT sent here — the engine emits it when the device sends its Initiate-Ranging-Session. Returns 0 on success, negative on failure or if a ranging session is already active (the DW3000 is single-session).

Fint aliro_ranging_feed(uint16_t conn_handle, const uint8_t *data, size_t len)

modules/woz_aliro/src/aliro_ranging.h:51

Feed one inbound post-auth PLAINTEXT SDU (already BleSK-opened by the reader; proto/id/len header + payload) to the active ranging session. M4 makes the engine start the responder with the negotiated parameters. Returns 0 if consumed, negative if there is no active session or the engine rejected it.

Fvoid aliro_ranging_stop(uint16_t conn_handle)

modules/woz_aliro/src/aliro_ranging.h:55

Tear down the ranging session for a connection (on disconnect). No-op if none is active for @conn_handle.