openaliro
Aliro reader: UWB/CCC core and ESP32-S3/C5/C6 port
Loading...
Searching...
No Matches
aliro_uwb_msg_parser.h
Go to the documentation of this file.
1
3#pragma once
4
6
8
9#include <stdbool.h>
10#include <stddef.h>
11#include <stdint.h>
12
20 uint8_t id;
21 uint8_t length;
22 uint8_t value[];
23};
24
32 size_t length;
33 size_t offset;
34 const uint8_t *data;
35};
36
38#define ALIRO_UWB_MSG_PARSER_INIT(msg_) \
39 { \
40 .length = (msg_)->len, \
41 .offset = ALIRO_HEADER_LENGTH, \
42 .data = (msg_)->data, \
43 }
44
47
48/* Exact-length big-endian readers; return false on a size mismatch. */
49bool aliro_uwb_msg_read_u8(const struct aliro_uwb_msg_attribute *attr, const char *name,
50 uint8_t *out);
51bool aliro_uwb_msg_read_u16(const struct aliro_uwb_msg_attribute *attr, const char *name,
52 uint16_t *out);
53bool aliro_uwb_msg_read_u32(const struct aliro_uwb_msg_attribute *attr, const char *name,
54 uint32_t *out);
55bool aliro_uwb_msg_read_u64(const struct aliro_uwb_msg_attribute *attr, const char *name,
56 uint64_t *out);
bool aliro_uwb_msg_read_u64(const struct aliro_uwb_msg_attribute *attr, const char *name, uint64_t *out)
Decodes a 64-bit big-endian integer from an attribute.
Definition aliro_uwb_msg_parser.c:133
bool aliro_uwb_msg_read_u16(const struct aliro_uwb_msg_attribute *attr, const char *name, uint16_t *out)
Decodes a 16-bit big-endian integer from an attribute; returns false on width mismatch or parse error...
Definition aliro_uwb_msg_parser.c:94
bool aliro_uwb_msg_read_u8(const struct aliro_uwb_msg_attribute *attr, const char *name, uint8_t *out)
Decodes an 8-bit big-endian integer from an attribute; returns false on width mismatch or parse error...
Definition aliro_uwb_msg_parser.c:74
struct aliro_uwb_msg_attribute * aliro_uwb_msg_next_attribute(struct aliro_uwb_msg_parser *parser)
Advance to the next attribute; NULL at end-of-payload or on overrun.
Definition aliro_uwb_msg_parser.c:15
bool aliro_uwb_msg_read_u32(const struct aliro_uwb_msg_attribute *attr, const char *name, uint32_t *out)
Decodes a 32-bit big-endian integer from an attribute; returns false on width mismatch or parse error...
Definition aliro_uwb_msg_parser.c:114
— UWB ranging-service framing constants.
— per-session public interface.
A single type/length/value attribute overlaid on message bytes.
Definition aliro_uwb_msg_parser.h:19
Cursor walking the attributes of one message payload.
Definition aliro_uwb_msg_parser.h:31