get_packet_func_t

Updated: April 19, 2023

Retrieve the next available data packet

Synopsis:

#include <sensor/external_sensor_api.h>
typedef int(* get_packet_func_t)(void *handle,
            void *bufferIn,
            sensor_flags_t *flags,
            void **bufferOut,
            int64_t *timestamp);

Arguments:

handle
The handle that's returned from calling the function referred to by open_external_sensor_func_t.
bufferIn
An empty buffer fed to the sensor
flags
Filled by the sensor with info about the capture. See sensor_flags_t for more information.
bufferOut
Points to a filled sensor buffer if one is available; otherwise NULL if no filled sensor buffer is available.
timestamp
The returned timestamp that indicates the capture time of the data. The clock is measured in microseconds and is in the sensor-time domain. See get_time() for more information.

Library:

libsensor

Description:

This is the main interface between the upper layer thread and the sensor. This one operation both enqueues empty buffers for use by the sensor (e.g., to pipeline), and expects to receive filled buffers from the sensor. If the sensor's hardware requires pipelining, it's expected that this function doesn't return any new data packet until enough empty buffers have been supplied.

Note:

This function call is blocking when the sensor is fully pipelined.

Returns:

SENSOR_EOK when the function successfully completes; otherwise another sensor_error_t value that provides the reason that the call failed.