sensor_format_user_data_t

Updated: April 19, 2023

Format for user data published as interim sensor data

Synopsis:

#include <sensor/sensor_api.h>
typedef struct sensor_format_user_data_t {
    uint32_t data_size;
    uint32_t data_id;
    int64_t publish_timestamp;
    sensor_type_t data_type;
    uint8_t reserved[SENSOR_DATA_EXTENDED_SIZE];
} sensor_format_user_data_t;

Data:

uint32_t data_size
The size of the data, in bytes.
uint32_t data_id
An identifier for the type of user data.

This field permits the definition of different user data items. Interpretation of this field is up to the user application.

int64_t publish_timestamp
The timestamp when the buffer was published.

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_type_t data_type
The type of the user data.

This can be used with data_id to differentiate between multiple data sources in the system.

uint8_t reserved[SENSOR_DATA_EXTENDED_SIZE]
These remaining bytes are left to the user to describe the data.

It is recommended to cast a user-defined structure that depends on data_id over this area.

Library:

libsensor

Description:

This is a basic structure that the user can expand to meet their needs.