fira_session.h
Range + URSK store for the CCC Pre-POLL responder.
Overview
Range + URSK store for the CCC Pre-POLL responder.
used by ccc_shim_rx.c uwb_rxdiag.c woz_uwb_facade.c fira_session.c aliro_shell.c
API
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).
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.
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.
Fuint32_t fira_session_current_slot(void)
STS-index slot clock (inert without a MAC time base); returns 0.
##define FIRA_RANGE_NEG_TOL_CM 30
##define FIRA_RANGE_MAX_CM 3000
Fbool fira_session_range_plausible(int32_t cm)
Layer 1: true if cm is a physically plausible DS-TWR distance.
##define FIRA_STS_QUALITY_MIN 0
Fbool 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. @param driver_verdict dwt_readstsquality() return (>=0 good, <0 bad). @param quality_index the signed STS quality index it wrote.
##define FIRA_RANGE_TRUST_K 3
##define FIRA_RANGE_SPREAD_CM 50
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.