aliro_device_uwb.h
Device/initiator side of the UWB ranging-service setup codec: the interface for…
Overview
Device/initiator side of the UWB ranging-service setup codec: the interface for parsing the reader's M1 and M3 and building the device's M2 and M4. Declares the decoded views of M1 and M3, the parameter structs the two builders take, and select_m2, which chooses a config and slot layout from what M1 offered. Pure TLV, no crypto and no session state, so it is host-testable against the reader's own codec by loopback.
depends on aliro_uwb_msg_spec.h · used by aliro_device_uwb.c
API
Cstruct aliro_dev_uwb_m1
Ranging capabilities the reader offered in M1 (reader -> device).
Cstruct aliro_dev_uwb_m3
Ranging parameters the reader committed in M3 (reader -> device).
Cstruct aliro_dev_uwb_m2_params
Device selections carried in M2 (device -> reader).
Cstruct aliro_dev_uwb_m4_params
Device selections carried in M4 (device -> reader).
##define ALIRO_DEV_UWB_MAX_CONFIGS 8
##define ALIRO_DEV_UWB_MAX_COMBOS 8
Fint aliro_dev_uwb_parse_m1(const uint8_t *msg, size_t len, struct aliro_dev_uwb_m1 *out)
Parse an inbound M1 / M3 message ([proto][id][len_be16][attrs]) into the structs above. Returns 0 on success, -1 on a header/attribute mismatch.
Fint aliro_dev_uwb_parse_m3(const uint8_t *msg, size_t len, struct aliro_dev_uwb_m3 *out)
Fvoid aliro_dev_uwb_select_m2(const struct aliro_dev_uwb_m1 *m1, struct aliro_dev_uwb_m2_params *out)
Pick M2 selections from a parsed M1: echo the reader's first config, pulse shape and channel, and default the remaining fields to values the reader accepts. A real device would consult its own capabilities here.
Fstruct aliro_uwb_message * aliro_dev_uwb_build_m2(const struct aliro_dev_uwb_m2_params *p)
Build an M2 / M4 message. Returns a heap-allocated message (free with aliro_uwb_msg_free), or NULL on allocation/encode failure.