openaliro
Aliro reader: UWB/CCC core and ESP32-S3/C5/C6 port
Loading...
Searching...
No Matches
aliro_device_uwb.h
Go to the documentation of this file.
1// Device/initiator side of the UWB ranging-service setup codec: the interface for
2// parsing the reader's M1 and M3 and building the device's M2 and M4. Declares the
3// decoded views of M1 and M3, the parameter structs the two builders take, and
4// select_m2, which chooses a config and slot layout from what M1 offered. Pure
5// TLV, no crypto and no session state, so it is host-testable against the reader's
6// own codec by loopback.
18#pragma once
19
20#include <stddef.h>
21#include <stdint.h>
22
23#include "aliro_uwb_msg_spec.h"
24
25struct aliro_uwb_message; /* defined by the UWB session headers; opaque here */
26
27#define ALIRO_DEV_UWB_MAX_CONFIGS 8
28#define ALIRO_DEV_UWB_MAX_COMBOS 8
29
32 uint16_t config_ids[ALIRO_DEV_UWB_MAX_CONFIGS];
33 size_t config_count;
34 uint8_t pulse_shape_combos[ALIRO_DEV_UWB_MAX_COMBOS];
35 size_t combo_count;
36 uint8_t channel_bitmask;
37 uint32_t session_id;
38};
39
42 uint8_t ran_multiplier;
43 uint8_t chaps_per_slot;
44 uint8_t num_responders;
45 uint8_t slots_per_round;
46 uint32_t sync_code_index_bitmask;
47 uint8_t hopping_config_bitmask;
48 uint8_t mac_mode;
49};
50
53 uint16_t config_id;
54 uint8_t pulse_shape_combo;
55 uint8_t channel_bitmask;
56 uint8_t ran_multiplier;
57 uint8_t slot_bitmask;
58 uint32_t sync_code_index_bitmask;
59 uint8_t hopping_config_bitmask;
60};
61
64 uint32_t sts_index0;
65 uint64_t uwb_time0;
66 uint32_t hop_mode_key;
67 uint8_t sync_code_index;
68};
69
72int aliro_dev_uwb_parse_m1(const uint8_t *msg, size_t len, struct aliro_dev_uwb_m1 *out);
73int aliro_dev_uwb_parse_m3(const uint8_t *msg, size_t len, struct aliro_dev_uwb_m3 *out);
74
78void aliro_dev_uwb_select_m2(const struct aliro_dev_uwb_m1 *m1,
79 struct aliro_dev_uwb_m2_params *out);
80
struct aliro_uwb_message * aliro_dev_uwb_build_m4(const struct aliro_dev_uwb_m4_params *p)
Build an M4 UWB message from STS index, UWB time, hop mode key, and sync code index.
Definition aliro_device_uwb.c:197
int 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.
Definition aliro_device_uwb.c:20
void 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,...
Definition aliro_device_uwb.c:139
int aliro_dev_uwb_parse_m3(const uint8_t *msg, size_t len, struct aliro_dev_uwb_m3 *out)
Parse an M3 UWB message: extract and validate ran multiplier, chaps per slot, number of responders,...
Definition aliro_device_uwb.c:78
struct aliro_uwb_message * aliro_dev_uwb_build_m2(const struct aliro_dev_uwb_m2_params *p)
Build an M2 / M4 message.
Definition aliro_device_uwb.c:151
— UWB ranging-service framing constants.
Ranging capabilities the reader offered in M1 (reader -> device).
Definition aliro_device_uwb.h:31
Device selections carried in M2 (device -> reader).
Definition aliro_device_uwb.h:52
Ranging parameters the reader committed in M3 (reader -> device).
Definition aliro_device_uwb.h:41
Device selections carried in M4 (device -> reader).
Definition aliro_device_uwb.h:63
Framed Aliro BLE message with 4-byte header followed by TLV payload.
Definition aliro_uwb_session.h:24