Updated: October 26, 2022

Content of a data buffer


#include <sensor/sensor_api.h>
typedef struct sensor_buffer_t {
    sensor_format_t format;
    uint64_t size;
    uint8_t* data;
    uint64_t metadata_size;
    void* metadata;
    int64_t timestamp;
    sensor_format_info_t info;
} sensor_buffer_t;


sensor_format_t format
The format of the data in the buffer.

It is used to distinguish between members of the sensor_format_info_t union.

uint64_t size
The size of the sensor_buffer_t structure.

This member doesn't describe the size of the data pointed to by data. The size is described in the info member.

uint8_t* data
A pointer to the data payload.
uint64_t metadata_size
The size of the associated metadata, in bytes.
void* metadata
A pointer to the associated metadata.
int64_t timestamp
The timestamp when the buffer was filled.

The timestamp is referenced to the clock specified in the sensor configuration file (which defaults to system monotonic clock, CLOCK_MONOTONIC) and is in microseconds.

sensor_format_info_t info
The union which provides further information on the format of the data.

Its actual content depends on the value of format.