sensor_roll_open_file()

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 the returned open file descriptor. The value that is returned corresponds to an open file on the sensor roll.
filename
A pointer to the returned name of the file on the sensor roll. Ensure that the buffer pointed to by filename is the same size as specified by namelen.
namelen
The size of the buffer provided by the caller as filename. The recommended size for filenames is defined by 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 application saves files. The Sensor Framework library manages unique filenames on behalf of the application. Use this function to retrieve the next available file from the sensor roll.

After this function successfully returns, a file is created and opened for writing. To close the file, you must call the sensor_roll_close_file() function.

Returns:

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