All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Storage

Detailed Description

Function Documentation

status_t persist_delete ( const uint32_t  key)

Deletes the value of a key from persistent storage.

Parameters
keyThe key of the field to delete from.
bool persist_exists ( const uint32_t  key)

Checks whether a value has been set for a given key in persistent storage.

Parameters
keyThe key of the field to check.
Returns
true if a value exists, otherwise false.
int persist_get_size ( const uint32_t  key)

Gets the size of a value for a given key in persistent storage.

Parameters
keyThe key of the field to lookup the data size.
Returns
The size of the value in bytes or E_DOES_NOT_EXIST if there is no field matching the given key.
bool persist_read_bool ( const uint32_t  key)

Reads a bool value for a given key from persistent storage. If the value has not yet been set, this will return false.

Parameters
keyThe key of the field to read from.
Returns
The bool value of the key to read from.
int persist_read_data ( const uint32_t  key,
void *  buffer,
const size_t  buffer_size 
)

Reads a blob of data for a given key from persistent storage into a given buffer. If the value has not yet been set, the given buffer is left unchanged.

Parameters
keyThe key of the field to read from.
bufferThe pointer to a buffer to be written to.
buffer_sizeThe maximum size of the given buffer.
Returns
The number of bytes written into the buffer or E_DOES_NOT_EXIST if there is no field matching the given key.
int32_t persist_read_int ( const uint32_t  key)

Reads an int value for a given key from persistent storage.

Note
The int is a signed 32-bit integer. If the value has not yet been set, this will return 0.
Parameters
keyThe key of the field to read from.
Returns
The int value of the key to read from.
int persist_read_string ( const uint32_t  key,
char *  buffer,
const size_t  buffer_size 
)

Reads a string for a given key from persistent storage into a given buffer. The string will be null terminated. If the value has not yet been set, the given buffer is left unchanged.

Parameters
keyThe key of the field to read from.
bufferThe pointer to a buffer to be written to.
buffer_sizeThe maximum size of the given buffer. This includes the null character.
Returns
The number of bytes written into the buffer or E_DOES_NOT_EXIST if there is no field matching the given key.
status_t persist_write_bool ( const uint32_t  key,
const bool  value 
)

Writes a bool value flag for a given key into persistent storage.

Parameters
keyThe key of the field to write to.
valueThe boolean value to write.
int persist_write_data ( const uint32_t  key,
const void *  data,
const size_t  size 
)

Writes a blob of data of a specified size in bytes for a given key into persistent storage. The maximum size is PERSIST_DATA_MAX_LENGTH.

Parameters
keyThe key of the field to write to.
dataThe pointer to the blob of data.
sizeThe size in bytes.
Returns
The number of bytes written.
status_t persist_write_int ( const uint32_t  key,
const int32_t  value 
)

Writes an int value for a given key into persistent storage.

Note
The int is a signed 32-bit integer.
Parameters
keyThe key of the field to write to.
valueThe int value to write.
int persist_write_string ( const uint32_t  key,
const char *  cstring 
)

Writes a string a given key into persistent storage. The maximum size is PERSIST_STRING_MAX_LENGTH including the null terminator.

Parameters
keyThe key of the field to write to.
cstringThe pointer to null terminated string.
Returns
The number of bytes written.

Macro Definition Documentation

#define PERSIST_DATA_MAX_LENGTH   256

The maximum size of a persist value in bytes.

#define PERSIST_STRING_MAX_LENGTH   PERSIST_DATA_MAX_LENGTH

The maximum size of a persist string in bytes including the NULL terminator.