sensor_roll_open_file()

Updated: May 06, 2022

Create and open the next available file on the sensor roll for writing

Synopsis:

#include <sensor/sensor_api.h>
sensor_error_t sensor_roll_open_file(sensor_handle_t handle,
                                     int *fd,
                                     char *filename,
                                     int namelen,
                                     sensor_roll_format_t ext)

Arguments:

handle
The handle that's returned from calling sensor_open().
fd
A pointer to memory for storing a file descriptor for an open file on the sensor roll.
filename
A pointer to memory for storing the name of the new file on the sensor roll.
namelen
The size of the memory buffer in filename. The recommended size is SENSOR_MAX_FILENAME_LEN.
ext
A sensor_roll_format_t value indicating the type of file to create.

Library:

libsensor

Description:

The sensor roll is a directory where the Sensor library saves files. The Sensor library manages unique filenames within this directory on behalf of the application. Use this function to retrieve the next available file from the sensor roll.

When the function succeeds, the new file is open for writing. To close it, call sensor_roll_close_file().

Returns:

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