modules/woz_uwb/src/aliro/aliro_uwb_msg_parser.c
asxeem/openaliro
Module

aliro_uwb_msg_parser.c

TLV attribute parser and big-endian reads.

modules/woz_uwb/src/aliro/aliro_uwb_msg_parser.c6 documented symbols

Overview

TLV attribute parser and big-endian reads.

depends on woz_log.h aliro_uwb_msg_parser.h

API

Fstruct aliro_uwb_msg_attribute *aliro_uwb_msg_next_attribute(struct aliro_uwb_msg_parser *parser)

modules/woz_uwb/src/aliro/aliro_uwb_msg_parser.c:15

Parses the next TLV attribute from the message payload; returns NULL if offset exceeds declared message length, clamping to prevent overrun.

parser
Parser cursor to advance.
returns
The next attribute, or NULL at end-of-payload or on overrun.

Fstatic bool read_be(const struct aliro_uwb_msg_attribute *attr, const char *name, uint8_t width, uint64_t *out)

modules/woz_uwb/src/aliro/aliro_uwb_msg_parser.c:48

Decodes a big-endian fixed-width integer from an attribute; returns false if declared length does not match width or on parse error.

attr
Attribute whose value bytes are decoded.
name
Attribute name, used for error logging.
width
Expected byte width of the encoded integer.
out
Destination for the decoded value.
returns
true on success, false if the attribute's declared length does not match width.
called by aliro_uwb_msg_read_u16, aliro_uwb_msg_read_u32, aliro_uwb_msg_read_u64, aliro_uwb_msg_read_u8

Fbool aliro_uwb_msg_read_u8(const struct aliro_uwb_msg_attribute *attr, const char *name, uint8_t *out)

modules/woz_uwb/src/aliro/aliro_uwb_msg_parser.c:74

Decodes an 8-bit big-endian integer from an attribute; returns false on width mismatch or parse error.

attr
Attribute whose value bytes are decoded.
name
Attribute name, used for error logging.
out
Destination for the decoded value.
returns
true on success, false on a size mismatch.
calls read_be

Fbool aliro_uwb_msg_read_u16(const struct aliro_uwb_msg_attribute *attr, const char *name, uint16_t *out)

modules/woz_uwb/src/aliro/aliro_uwb_msg_parser.c:94

Decodes a 16-bit big-endian integer from an attribute; returns false on width mismatch or parse error.

attr
Attribute whose value bytes are decoded.
name
Attribute name, used for error logging.
out
Destination for the decoded value.
returns
true on success, false on a size mismatch.
calls read_be

Fbool aliro_uwb_msg_read_u32(const struct aliro_uwb_msg_attribute *attr, const char *name, uint32_t *out)

modules/woz_uwb/src/aliro/aliro_uwb_msg_parser.c:114

Decodes a 32-bit big-endian integer from an attribute; returns false on width mismatch or parse error.

attr
Attribute whose value bytes are decoded.
name
Attribute name, used for error logging.
out
Destination for the decoded value.
returns
true on success, false on a size mismatch.
calls read_be

Fbool aliro_uwb_msg_read_u64(const struct aliro_uwb_msg_attribute *attr, const char *name, uint64_t *out)

modules/woz_uwb/src/aliro/aliro_uwb_msg_parser.c:133

Decodes a 64-bit big-endian integer from an attribute.

attr
Attribute holding the encoded value.
name
Attribute name, used only in the mismatch log line.
out
Receives the decoded value on success.
returns
true on success, false on a width mismatch or parse error.
calls read_be