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

Capture and replay UWB frames and session configuration from a walk-up to a host for analysis and replay. More...

#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
Include dependency graph for flight_recorder.h:

Go to the source code of this file.

Data Structures

struct  fr_meta
 Metadata header for a flight recorder stream: protocol version, port identifier (target), and the firmware commit SHA1. More...
 
struct  fr_config
 Captured Aliro session configuration snapshot: channel, timing parameters, STS index, URSK, and responder credentials. More...
 
struct  fr_ev
 Single UWB event captured during a walk-up: endpoint identity, status register, frame length, Ipatov and TX timestamps, STS quality metrics, and up to FR_FRAME_MAX bytes of the received frame. More...
 
struct  fr_end
 Trailer record marking the end of a flight recorder session: the count of captured events and a truncation flag (1 if the ring filled and later events were dropped). More...
 
struct  fr_record
 One record in a flight recorder stream: a discriminated union holding either a metadata header, session configuration snapshot, a captured event, or the end-of-session trailer. More...
 

Functions

void fr_writer_init (fr_writer_t *w, uint8_t *buf, size_t cap)
 Initialize a flight-recorder writer with an output buffer; write the magic prefix if capacity permits, otherwise latch overflow flag.
 
int fr_write_meta (fr_writer_t *w, uint16_t port, const char *sha)
 Emit a META record containing flight-recorder version, host port, and optional commit SHA; return 0 on success or -1 on buffer overflow.
 
int fr_write_config (fr_writer_t *w, const struct fr_config *cfg)
 Emit a CONFIG record containing Aliro session parameters and UWB radio configuration; truncate URSK and radio controller data to maximum lengths if needed; return 0 on success or -1 on buffer overflow.
 
int fr_write_ev (fr_writer_t *w, const struct fr_ev *ev)
 Emit an EV record containing DW3000 register snapshot and received frame data; truncate frame to maximum length if needed; return 0 on success or -1 on buffer overflow.
 
int fr_write_end (fr_writer_t *w, uint32_t n_events, bool truncated)
 Emit an END record with event count and truncation flag; return 0 on success or -1 on buffer overflow.
 
void fr_reader_init (fr_reader_t *r, const uint8_t *buf, size_t len)
 Initialize a flight-recorder reader to parse a binary buffer; do not validate the magic prefix until the first read.
 
int fr_read_next (fr_reader_t *r, struct fr_record *out)
 Parse one flight-recorder record from the reader buffer; check magic prefix on first call, validate frame format and type; return the record type on success, 0 for clean end-of-buffer, or -1 on malformed input.
 
static void fr_set_enabled (bool on)
 Stub callback that enables or disables flight recording.
 
static bool fr_enabled (void)
 Returns true if the flight recorder is enabled and capturing events; false otherwise.
 
static void fr_capture_config (const struct woz_uwb_aliro_cfg *cfg)
 Stub callback invoked when the flight recorder captures the Aliro session configuration.
 
static void fr_capture_ev (uint8_t ep, uint32_t status, uint16_t datalength)
 Stub callback invoked when the flight recorder captures a UWB event (endpoint fire, status, or frame length).
 
static void fr_dump (void)
 Stub callback that dumps the flight recorder ring buffer to the host interface.
 
static void fr_clear (void)
 Stub callback that clears the flight recorder ring buffer.
 

Detailed Description

Capture and replay UWB frames and session configuration from a walk-up to a host for analysis and replay.

Records endpoint identity, status registers, frame data, and timing metadata into a fixed-size ring buffer; provides reader and writer interfaces for host tools.

Function Documentation

◆ fr_capture_config()

static void fr_capture_config ( const struct woz_uwb_aliro_cfg cfg)
inlinestatic

Stub callback invoked when the flight recorder captures the Aliro session configuration.

No-op when the flight recorder is disabled.

◆ fr_capture_ev()

static void fr_capture_ev ( uint8_t  ep,
uint32_t  status,
uint16_t  datalength 
)
inlinestatic

Stub callback invoked when the flight recorder captures a UWB event (endpoint fire, status, or frame length).

No-op when the flight recorder is disabled.

◆ fr_clear()

static void fr_clear ( void  )
inlinestatic

Stub callback that clears the flight recorder ring buffer.

No-op when the flight recorder is disabled.

◆ fr_dump()

static void fr_dump ( void  )
inlinestatic

Stub callback that dumps the flight recorder ring buffer to the host interface.

No-op when the flight recorder is disabled.

◆ fr_enabled()

static bool fr_enabled ( void  )
inlinestatic

Returns true if the flight recorder is enabled and capturing events; false otherwise.

Stub when disabled.

◆ fr_set_enabled()

static void fr_set_enabled ( bool  on)
inlinestatic

Stub callback that enables or disables flight recording.

No-op when the flight recorder is disabled.