Our file abstract library provides a unified definition of calls for accessing any object, which can be treated as a file.
Applications can use this library as a common API for read and write operations. Currently there are two file ports defined:
The generic API is shown below:
API | Description |
---|---|
iot_file_fopen | Open the file instance with given size. |
iot_file_fread | Read given number of bytes from the file |
iot_file_fwrite | Write given number of bytes to the file. |
iot_file_fseek | Move file's cursor to given position. |
iot_file_ftell | Read actual cursor position. |
iot_file_frewind | Set file cursor position to the beginning of the file. |
iot_file_fclose | Close file, reset cursor. |
Creating a new file port consists of a few steps:
In order to use the IoT File Static port, you need to include two files. One which includes the instance definition and API (file abstract) and another which defines the selected file type.
The second step is to define and initialize the file instance and components needed by that file type (like static buffer).
The file API can now be used for accessing the assigned buffer.
The following configuration parameters should be defined in sdk_config.h
.
Disables debug tracing in the module. To enable tracing, this flag must be set to 0 and NRF_LOG_ENABLED must be set to 1.
Description | Value |
---|---|
Enable debug trace | 0 |
Disable debug trace | 1 |
Dependencies | NRF_LOG_ENABLED |
Disables API parameter checks in the module. Set this define to 1 to disable checks on API parameters in the module.
API parameter checks are added to ensure that the correct parameters are passed to the module. These checks are useful during development phase, but they might be redundant when the application is finalized. Disabling these checks might improve performance.
Description | Value |
---|---|
Enable API parameters check | 0 |
Disable API parameters check | 1 |
Dependencies | None |
The following sections describe the specifics and limitations of the current implementation.