Illustrated C/C++ source sheets, symbol index, API relationship graph, compiler console and debug trace

LIVE AI / FLEXIBLE SENSING / FLIGHT CONTEXT

Sensoraia API

Live AI and sensing, connected to the flight.
See, listen, inspect and return supported results while airborne.

Loading...
Searching...
No Matches
sensor_capture.h File Reference

Exact bounded SENSOR02 capture evidence, independent of TIFF byte order. More...

#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <string.h>
Include dependency graph for sensor_capture.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  sensor_capture

Macros

#define SENSOR_CAPTURE_BYTES   104U
#define SENSOR_CAPTURE_TAG   0xc7a1U

Functions

static void sensor_capture_put (unsigned char *data, uint64_t value, size_t bytes)
 Write a fixed-width little-endian integer.
static uint64_t sensor_capture_get (const unsigned char *data, size_t bytes)
 Read a fixed-width little-endian integer.
static int64_t sensor_capture_signed (uint64_t value)
 Interpret a 64-bit wire field as a signed two's-complement value.
static bool sensor_capture_valid (const struct sensor_capture *record)
 Check the structural constraints shared by the wire encoder and decoder.
static bool sensor_capture_encode (const struct sensor_capture *record, unsigned char *data, size_t capacity)
 Encode a SENSOR02 record in the fixed on-disk layout.
static bool sensor_capture_decode (struct sensor_capture *record, const unsigned char *data, size_t size)
 Decode a complete SENSOR02 record.

Detailed Description

Exact bounded SENSOR02 capture evidence, independent of TIFF byte order.

See docs/exif.md for byte offsets. Structural validity does not qualify exposure timing; the arbiter checks current boot, JPEG dimensions and freshness.

Definition in file sensor_capture.h.

Macro Definition Documentation

◆ SENSOR_CAPTURE_BYTES

#define SENSOR_CAPTURE_BYTES   104U

Definition at line 30 of file sensor_capture.h.

◆ SENSOR_CAPTURE_TAG

#define SENSOR_CAPTURE_TAG   0xc7a1U

Definition at line 31 of file sensor_capture.h.

Function Documentation

◆ sensor_capture_decode()

bool sensor_capture_decode ( struct sensor_capture * record,
const unsigned char * data,
size_t size )
inlinestatic

Decode a complete SENSOR02 record.

Parameters
[out]recordDestination for the decoded fields.
dataSerialized source record.
sizeExact source length in bytes.
Returns
True on success; false leaves the destination unchanged.

Check version and length before indexing the data, then validate a temporary record before assigning it to the caller's destination.

Definition at line 136 of file sensor_capture.h.

◆ sensor_capture_encode()

bool sensor_capture_encode ( const struct sensor_capture * record,
unsigned char * data,
size_t capacity )
inlinestatic

Encode a SENSOR02 record in the fixed on-disk layout.

Parameters
recordValidated source record; must not overlap data.
[out]dataDestination byte buffer.
capacityAvailable bytes in data.
Returns
True on success; false leaves the destination unchanged.

Validate before the first write, then emit the magic and fields at fixed offsets without copying struct padding.

Definition at line 109 of file sensor_capture.h.

◆ sensor_capture_get()

uint64_t sensor_capture_get ( const unsigned char * data,
size_t bytes )
inlinestatic

Read a fixed-width little-endian integer.

Parameters
dataReadable storage of at least bytes octets.
bytesField width from 1 to 8, validated by the caller.
Returns
The value zero-extended to 64 bits.

Assemble bytes rather than loading a native integer, since fields can start at unaligned offsets.

Definition at line 61 of file sensor_capture.h.

◆ sensor_capture_put()

void sensor_capture_put ( unsigned char * data,
uint64_t value,
size_t bytes )
inlinestatic

Write a fixed-width little-endian integer.

Parameters
[out]dataWritable storage for bytes octets.
valueInteger whose least significant bytes are written.
bytesField width from 1 to 8, validated by the caller.

Explicit byte offsets keep the record independent of alignment and host byte order.

Definition at line 48 of file sensor_capture.h.

◆ sensor_capture_signed()

int64_t sensor_capture_signed ( uint64_t value)
inlinestatic

Interpret a 64-bit wire field as a signed two's-complement value.

Parameters
valueDecoded unsigned bit pattern.
Returns
Signed value represented by the same bits.

For negative values, convert the complement first so the cast never receives a value outside the signed range.

Definition at line 75 of file sensor_capture.h.

◆ sensor_capture_valid()

bool sensor_capture_valid ( const struct sensor_capture * record)
inlinestatic

Check the structural constraints shared by the wire encoder and decoder.

Parameters
recordNullable capture record.
Returns
True for JPEG-sized dimensions and a terminated lowercase UUID-shaped boot ID.

This checks syntax and dimensions, not whether the boot ID and timing actually belong to the current capture.

Definition at line 87 of file sensor_capture.h.