openaliro
Aliro reader: UWB/CCC core and ESP32-S3/C5/C6 port
Loading...
Searching...
No Matches
aliro_device_uwb.c File Reference

— device-side UWB ranging-service setup codec. More...

#include "aliro_device_uwb.h"
#include <string.h>
#include "aliro_uwb_msg.h"
#include "aliro_uwb_msg_builder.h"
#include "aliro_uwb_msg_parser.h"
Include dependency graph for aliro_device_uwb.c:

Functions

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.
 
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, slots per round, sync code index bitmask, hopping configuration, and MAC mode.
 
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, and default the remaining fields to values the reader accepts.
 
struct aliro_uwb_messagealiro_dev_uwb_build_m2 (const struct aliro_dev_uwb_m2_params *p)
 Build an M2 / M4 message.
 
struct aliro_uwb_messagealiro_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.
 

Detailed Description

— device-side UWB ranging-service setup codec.

See aliro_device_uwb.h.

Copyright (c) 2026 asxeem SPDX-License-Identifier: ISC

Function Documentation

◆ aliro_dev_uwb_build_m2()

struct 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.

◆ aliro_dev_uwb_parse_m1()

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.

Returns 0 on success, -1 on a header/attribute mismatch.

◆ aliro_dev_uwb_parse_m3()

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, slots per round, sync code index bitmask, hopping configuration, and MAC mode.

Return 0 on success or -1 if the message is malformed or required fields are missing.

◆ aliro_dev_uwb_select_m2()

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, and default the remaining fields to values the reader accepts.

A real device would consult its own capabilities here.