MeshX 0.3
This repository provides an implementation for Bluetooth Low Energy (BLE) Mesh network nodes. The project allows you to create BLE mesh nodes that can communicate with each other, enabling the development of smart home solutions or other IoT-based applications.
|
Header file for MeshX Non-Volatile Storage (NVS) operations. More...
Go to the source code of this file.
Data Structures | |
struct | meshx_nvs |
Structure to hold the MeshX NVS data. More... | |
Macros | |
#define | MESHX_NVS_TIMER_PERIOD_DEF 1000 |
#define | MESHX_NVS_TIMER_PERIOD MESHX_NVS_TIMER_PERIOD_DEF |
#define | MESHX_NVS_AUTO_COMMIT true |
#define | MESHX_NVS_NO_AUTO_COMMIT false |
Typedefs | |
typedef struct meshx_nvs | meshx_nvs_t |
Functions | |
meshx_err_t | meshx_nvs_init (void) |
MeshX NVS Initialisation. | |
meshx_err_t | meshx_nvs_erase (void) |
Erase all key-value pairs stored in the NVS. | |
meshx_err_t | meshx_nvs_commit (void) |
Commit changes to the NVS. | |
meshx_err_t | meshx_nvs_close (void) |
Close the NVS handle. | |
meshx_err_t | meshx_nvs_remove (char const *key) |
Remove a key-value pair from the NVS. | |
meshx_err_t | meshx_nvs_open (uint16_t cid, uint16_t pid, uint32_t commit_timeout_ms) |
Open the NVS with a timeout. | |
meshx_err_t | meshx_nvs_get (char const *key, void *blob, uint16_t blob_size) |
Get a value from the NVS. | |
meshx_err_t | meshx_nvs_set (char const *key, void const *blob, uint16_t blob_size, bool arm_timer) |
Set a value in the NVS. | |
meshx_err_t | meshx_nvs_element_ctx_get (uint16_t element_id, void *blob, size_t blob_size) |
Retrieve the context of a specific element from NVS. | |
meshx_err_t | meshx_nvs_element_ctx_set (uint16_t element_id, const void *blob, size_t blob_size) |
Store the context of a specific element to NVS. | |
meshx_err_t | meshx_nvs_element_ctx_remove (uint16_t element_id) |
Remove the context of a specific element from NVS. | |
Header file for MeshX Non-Volatile Storage (NVS) operations.
This file provides APIs to manage the Non-Volatile Storage (NVS) used in the MeshX system. It includes functions to read, write, erase, and manage key-value pairs stored persistently.
Definition in file meshx_nvs.h.
#define MESHX_NVS_AUTO_COMMIT true |
Definition at line 25 of file meshx_nvs.h.
#define MESHX_NVS_NO_AUTO_COMMIT false |
Definition at line 26 of file meshx_nvs.h.
#define MESHX_NVS_TIMER_PERIOD MESHX_NVS_TIMER_PERIOD_DEF |
Definition at line 22 of file meshx_nvs.h.
#define MESHX_NVS_TIMER_PERIOD_DEF 1000 |
Definition at line 19 of file meshx_nvs.h.
typedef struct meshx_nvs meshx_nvs_t |
meshx_err_t meshx_nvs_close | ( | void | ) |
Close the NVS handle.
This function releases any resources associated with the NVS handle.
Definition at line 297 of file meshx_nvs.c.
meshx_err_t meshx_nvs_commit | ( | void | ) |
Commit changes to the NVS.
This function ensures that any pending changes to the NVS are flushed to persistent storage.
Definition at line 259 of file meshx_nvs.c.
meshx_err_t meshx_nvs_element_ctx_get | ( | uint16_t | element_id, |
void * | blob, | ||
size_t | blob_size ) |
Retrieve the context of a specific element from NVS.
This function fetches the stored context of a given element identified by its ID from the Non-Volatile Storage (NVS).
[in] | element_id | The ID of the element whose context is to be retrieved. |
[out] | blob | Pointer to the buffer where the retrieved context will be stored. |
[in] | blob_size | Size of the buffer provided to store the context. |
Definition at line 424 of file meshx_nvs.c.
meshx_err_t meshx_nvs_element_ctx_remove | ( | uint16_t | element_id | ) |
Remove the context of a specific element from NVS.
This function deletes the stored context of a given element identified by its ID from the Non-Volatile Storage (NVS).
[in] | element_id | The ID of the element whose context is to be removed. |
Definition at line 462 of file meshx_nvs.c.
meshx_err_t meshx_nvs_element_ctx_set | ( | uint16_t | element_id, |
const void * | blob, | ||
size_t | blob_size ) |
Store the context of a specific element to NVS.
This function saves the context of a given element identified by its ID to the Non-Volatile Storage (NVS).
[in] | element_id | The ID of the element whose context is to be stored. |
[in] | blob | Pointer to the buffer containing the context to be stored. |
[in] | blob_size | Size of the buffer containing the context. |
Definition at line 444 of file meshx_nvs.c.
meshx_err_t meshx_nvs_erase | ( | void | ) |
Erase all key-value pairs stored in the NVS.
This function clears all data stored in the Non-Volatile Storage.
Definition at line 243 of file meshx_nvs.c.
meshx_err_t meshx_nvs_get | ( | char const * | key, |
void * | blob, | ||
uint16_t | blob_size ) |
Get a value from the NVS.
This function retrieves a value associated with the given key from the NVS.
[in] | key | The key identifying the value to be retrieved. |
[out] | blob | Pointer to the buffer where the value will be stored. |
[in] | blob_size | Size of the buffer in bytes. |
Definition at line 346 of file meshx_nvs.c.
meshx_err_t meshx_nvs_init | ( | void | ) |
MeshX NVS Initialisation.
Definition at line 135 of file meshx_nvs.c.
meshx_err_t meshx_nvs_open | ( | uint16_t | cid, |
uint16_t | pid, | ||
uint32_t | commit_timeout_ms ) |
Open the NVS with a timeout.
This function initializes the NVS and sets a timeout for stability operations.
[in] | cid | Company ID |
[in] | pid | Product ID |
[in] | commit_timeout_ms | Timeout for stability operations in milliseconds. |
Definition at line 165 of file meshx_nvs.c.
meshx_err_t meshx_nvs_remove | ( | char const * | key | ) |
Remove a key-value pair from the NVS.
This function deletes a specific key-value pair from the NVS based on the provided key.
[in] | key | The key identifying the value to be removed. |
Definition at line 326 of file meshx_nvs.c.
meshx_err_t meshx_nvs_set | ( | char const * | key, |
void const * | blob, | ||
uint16_t | blob_size, | ||
bool | arm_timer ) |
Set a value in the NVS.
This function stores a value associated with the given key in the NVS.
[in] | key | The key identifying the value to be stored. |
[in] | blob | Pointer to the buffer containing the value. |
[in] | blob_size | Size of the buffer in bytes. |
[in] | arm_timer | Re-arm stability timer and auto commit |
Definition at line 366 of file meshx_nvs.c.