sensor_data_callback_t

Updated: April 19, 2023

Callback function that receives data

Synopsis:

#include <sensor/sensor_api.h>
typedef bool(* sensor_data_callback_t)(sensor_handle_t handle,
             sensor_buffer_t *buf,
             void *arg);

Arguments:

handle
The handle returned by a call to the sensor_open() function.
buf
A pointer to the data buffer of the sensor.
arg
The user argument you provided when calling sensor_register_data_callback().

Library:

libsensor

Description:

This callback function is invoked when data is available for the sensor event that you've registered for. Register a callback function of this type by calling sensor_register_data_callback().

Returns:

Return true if you want the Sensor library to free the received buffer upon return of this function; return false if your application will free the buffer at a later time using sensor_return_buffer().