nRF Connect SDK API 3.3.99
Loading...
Searching...
No Matches

◆ read_variable_data()

int read_variable_data ( enum variable_data_type data_type,
uint8_t * buf,
uint32_t * buf_len )

#include <include/bl_storage.h>

Read variable data from OTP.

Variable data starts with variable data collection ID, followed by amount of variable data entries and the variable data entries themselves. [Collection ID][Variable count][Type][Variable data length][Variable data][Type]... 2 bytes 2 bytes 1 byte 1 byte 0-255 bytes

Note
If data is not found, function does not fail. Instead, 0 length is returned.
Parameters
[in]data_typeType of the variable data to read.
[out]bufBuffer to store the variable data.
[in,out]buf_lenOn input, the size of the buffer. On output, the length of the data.
Return values
0Variable data read successfully, or not found.
-EINVALNo buffer provided.
-ENOMEMBuffer too small.