fira_session.c
Range + URSK store for the CCC Pre-POLL responder.
Overview
Range + URSK store for the CCC Pre-POLL responder.
depends on woz_port.h aliro_kdf.h fira_session.h
API
Fvoid fira_session_set_provisioned_ursk(const uint8_t *ursk)
Stash an Aliro URSK for the CCC Pre-POLL STS decode; NULL clears it.
Fconst uint8_t *fira_session_get_ursk(void)
The stashed Aliro URSK (32 bytes), or NULL if none — for the Pre-POLL decode.
Fuint32_t fira_session_current_slot(void)
STS-index slot clock (inert without a MAC time base); returns 0.
Fbool fira_session_last_range(int32_t *cm_out, uint16_t *addr_out, uint8_t *nlos_out, uint32_t *block_out, int64_t *age_ms_out)
Fetch the most recent valid DS-TWR range; out-params optional (NULL to skip).
Fbool fira_session_range_plausible(int32_t cm)
Layer 1: true if @p cm is a physically plausible DS-TWR distance.
fira_session_set_ccc_range_cmFbool fira_session_sts_quality_ok(int32_t driver_verdict, int16_t quality_index)
Layer 2: true if the STS correlated well enough to trust its timestamp.
driver_verdict- dwt_readstsquality() return (>=0 good, <0 bad).
quality_index- the signed STS quality index it wrote.
Fbool fira_session_range_trusted(void)
Layer 4: true once >= K consecutive plausible, mutually consistent ranges have been latched. Cleared by any implausible or outlier block.
Fuint8_t fira_session_trust_level(void)
Layer 4 diagnostic: the live run length of agreeing plausible blocks (0..FIRA_RANGE_TRUST_K) behind fira_session_range_trusted().
Fvoid fira_session_set_range_listener(void (*cb)(void))
Register a callback fired after each accepted range latch (NULL to clear). Runs on the UWB RX path — keep it to a task wake, nothing heavier.
Fvoid fira_session_set_ccc_range_cm(int32_t cm, uint32_t block)
Latch a CCC DS-TWR range so it flows up the Aliro mRangingData seam.
fira_session_range_plausible