sensor_ext_reference_clock_t

A list of functions, which external reference clock libraries must implement

Synopsis:

#include <sensor/external_sensor_api.h>
typedef struct sensor_ext_reference_clock_t {
    sensor_error_t (*open)(sensor_unit_t);
    sensor_error_t (*get_time)(sensor_unit_t,
                                                                  int64_t *timestamp);
    sensor_error_t (*close)(sensor_unit_t);
} sensor_ext_reference_clock_t;

Data:

sensor_error_t (*open)(sensor_unit_t)
Called when the sensor starts streaming.
sensor_error_t (*get_time)(sensor_unit_t, int64_t *timestamp)
Called periodically after the sensor starts to stream to resync the sensor timestamps using the returned timestamp value as the base reference time.
sensor_error_t (*close)(sensor_unit_t)
Called when sensor stops streaming.

Library:

libsensor

Description:

This structure can be used when you configure these parameters in the sensor configuration file:

  • reference_clock to external
  • reference_clock_library to path_to_external_clock_library.

When configured as mentioned, the Sensor service looks for a sensor_ext_reference_clock_t structure instance, which must be named reference_clock_defs and dynamically loads it from the library to retrieve the function pointers used to interface with it.