Structures and public API definition.
More...
Structures and public API definition.
typedef void(* iot_file_callback_t)(iot_file_t *p_file, iot_file_evt_t event, uint32_t result, void *p_data, uint32_t size) |
IoT File user callback type definition.
- Parameters
-
[in] | p_file | Reference to an IoT file instance. |
[in] | event | Event structure describing what has happened. |
[in] | result | Result code (should be NRF_SUCCESS for all events except errors). |
[in] | p_data | Pointer to memory buffer. |
[in] | size | Size of data stored in memory buffer. |
- Return values
-
List of events returned in callback for file ports with asynchrounous operation like open, read, write and close.
Enumerator |
---|
IOT_FILE_OPENED |
Event indicates that file has been opened.
|
IOT_FILE_WRITE_COMPLETE |
Event indicates that single write operation has been completed.
|
IOT_FILE_READ_COMPLETE |
Event indicates that single read operation has been completed.
|
IOT_FILE_CLOSED |
Event indicates that file has been closed.
|
IOT_FILE_ERROR |
Event indicates that file encountered a problem.
|
Function to close IoT file. Depending on port, it should free used buffer.
- Parameters
-
[in] | p_file | Pointer to an IoT file instance. |
- Return values
-
NRF_SUCCESS | on successful execution of procedure, else an error code indicating reason for failure. |
uint32_t iot_file_fopen |
( |
iot_file_t * |
p_file, |
|
|
uint32_t |
requested_size |
|
) |
| |
Function to open IoT file. Depending on port, it should allocate required buffer.
- Parameters
-
[in] | p_file | Pointer to an IoT file instance. |
[in] | requested_size | Maximum number of bytes to be read/written. |
- Return values
-
NRF_SUCCESS | on successful execution of procedure, else an error code indicating reason for failure. |
uint32_t iot_file_fread |
( |
iot_file_t * |
p_file, |
|
|
void * |
p_data, |
|
|
uint32_t |
size |
|
) |
| |
Function to read data buffer from file.
- Parameters
-
[in] | p_file | Pointer to an IoT file instance. |
[in] | p_data | Pointer to data block to be filled with read data. |
[in] | size | Number of bytes to be read. |
- Return values
-
NRF_SUCCESS | on successful execution of procedure, else an error code indicating reason for failure. |
Function to rewind file cursor.
- Parameters
-
[in] | p_file | Pointer to an IoT file instance. |
- Return values
-
NRF_SUCCESS | on successful execution of procedure, else an error code indicating reason for failure. |
uint32_t iot_file_fseek |
( |
iot_file_t * |
p_file, |
|
|
uint32_t |
cursor |
|
) |
| |
Function to set current cursor position.
- Parameters
-
[in] | p_file | Pointer to an IoT file instance. |
[in] | cursor | New cursor value. |
- Return values
-
NRF_SUCCESS | on successful execution of procedure, else an error code indicating reason for failure. |
uint32_t iot_file_ftell |
( |
iot_file_t * |
p_file, |
|
|
uint32_t * |
p_cursor |
|
) |
| |
Function to read current cursor position.
- Parameters
-
[in] | p_file | Pointer to an IoT file instance. |
[out] | p_cursor | Current value of a cursor. |
- Return values
-
NRF_SUCCESS | on successful execution of procedure, else an error code indicating reason for failure. |
uint32_t iot_file_fwrite |
( |
iot_file_t * |
p_file, |
|
|
const void * |
p_data, |
|
|
uint32_t |
size |
|
) |
| |
Function to write data buffer into a file.
- Parameters
-
[in] | p_file | Pointer to an IoT file instance. |
[in] | p_data | Pointer to data block which will be written into the file. |
[in] | size | Number of bytes to be written. |
- Return values
-
NRF_SUCCESS | on successful execution of procedure, else an error code indicating reason for failure. |