Wirepas SDK
wms_storage.h File Reference

Detailed Description

A small number of bytes is reserved for the application in the same area where the stack firmware stores its own persistent settings (the Settings library, wms_settings.h). The Storage library can be used to read and write this data. Currently, 32 bytes is reserved for the application.

Library services are accessed via lib_storage handle.

Definition in file wms_storage.h.

Go to the source code of this file.

Typedefs

typedef app_res_e(* app_lib_storage_write_persistent_f) (const void *bytes, size_t num_bytes)
 Write data to persistent storage. More...
 
typedef app_res_e(* app_lib_storage_read_persistent_f) (void *bytes, size_t num_bytes)
 Read data written to persistent storage. More...
 
typedef size_t(* app_lib_storage_get_persistent_max_size_f) (void)
 Get persistent maximum size. More...
 

Data Structures

struct  app_lib_storage_t
 

Macros

#define APP_LIB_STORAGE_NAME   0x7713d6af
 Library symbolic name. More...
 
#define APP_LIB_STORAGE_VERSION   0x200
 Maximum supported library version. More...
 

Typedef Documentation

◆ app_lib_storage_get_persistent_max_size_f

typedef size_t(* app_lib_storage_get_persistent_max_size_f) (void)

Get persistent maximum size.

Return the size of persistent area reserved for application, in bytes. Currently, returns 32.

Returns
The maximum size in bytes of the storage area

Definition at line 72 of file wms_storage.h.

◆ app_lib_storage_read_persistent_f

typedef app_res_e(* app_lib_storage_read_persistent_f) (void *bytes, size_t num_bytes)

Read data written to persistent storage.

Parameters
bytesPointer to buffer for reading bytes
num_bytesTotal number of bytes to read
Returns
Result code, APP_RES_OK if successful If size is too large or data is NULL, APP_RES_INVALID_VALUE

Definition at line 60 of file wms_storage.h.

◆ app_lib_storage_write_persistent_f

typedef app_res_e(* app_lib_storage_write_persistent_f) (const void *bytes, size_t num_bytes)

Write data to persistent storage.

Write new data to the persistent area. All old data is erased, even if new data does not extend to the end of the end of the persistent area.

Parameters
bytesPointer to bytes to write
num_bytesTotal number of bytes to write
Returns
Result code, APP_RES_OK if successful If size is too large or data is NULL, APP_RES_INVALID_VALUE

Definition at line 47 of file wms_storage.h.


Data Structure Documentation

◆ app_lib_storage_t

struct app_lib_storage_t

The function table returned from app_open_library_f

Definition at line 77 of file wms_storage.h.

Data Fields
app_lib_storage_get_persistent_max_size_f getPersistentMaxSize
app_lib_storage_read_persistent_f readPersistent
app_lib_storage_write_persistent_f writePersistent

Macro Definition Documentation

◆ APP_LIB_STORAGE_NAME

#define APP_LIB_STORAGE_NAME   0x7713d6af

Library symbolic name.

"STORAG"

Definition at line 28 of file wms_storage.h.

◆ APP_LIB_STORAGE_VERSION

#define APP_LIB_STORAGE_VERSION   0x200

Maximum supported library version.

Definition at line 31 of file wms_storage.h.