Zephyr API Documentation
3.7.0
A Scalable Open Source RTOS
|
sensor value header More...
#include <sensing_datatypes.h>
Data Fields | |
uint64_t | base_timestamp |
Base timestamp of this data readings, unit is micro seconds. | |
uint16_t | reading_count |
Count of this data readings. | |
sensor value header
Each sensor value data structure should have this header
Here use 'base_timestamp' (uint64_t) and 'timestamp_delta' (uint32_t) to save memory usage in batching mode.
The 'base_timestamp' is for readings[0], the 'timestamp_delta' is relation to the previous 'readings'. So, timestamp of readings[0] is header.base_timestamp + readings[0].timestamp_delta. timestamp of readings[1] is timestamp of readings[0] + readings[1].timestamp_delta.
Since timestamp unit is micro seconds, the max 'timestamp_delta' (uint32_t) is 4295 seconds.
If a sensor has batched data where two consecutive readings differ by more than 4295 seconds, the sensor subsystem core will split them across multiple instances of the readings structure, and send multiple events.
This concept is borrowed from CHRE: https://cs.android.com/android/platform/superproject/+/master:\ system/chre/chre_api/include/chre_api/chre/sensor_types.h
uint64_t sensing_sensor_value_header::base_timestamp |
Base timestamp of this data readings, unit is micro seconds.
uint16_t sensing_sensor_value_header::reading_count |
Count of this data readings.