|
MeshX 0.4
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...
#include <stdint.h>#include <meshx_common.h>#include "meshx_control_task.h"#include "meshx_os_timer.h"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, meshx_element_type_t element_type, 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, meshx_element_type_t element_type, 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, meshx_element_type_t element_type) |
| 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.
| #define MESHX_NVS_AUTO_COMMIT true |
| #define MESHX_NVS_NO_AUTO_COMMIT false |
| #define MESHX_NVS_TIMER_PERIOD MESHX_NVS_TIMER_PERIOD_DEF |
| #define MESHX_NVS_TIMER_PERIOD_DEF 1000 |
| 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.
| 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.
| meshx_err_t meshx_nvs_element_ctx_get | ( | uint16_t | element_id, |
| meshx_element_type_t | element_type, | ||
| void * | blob, | ||
| size_t | blob_size ) |
Retrieve the context of a specific element from NVS.
| [in] | element_id | The ID of the element whose context is to be retrieved. |
| [in] | element_type | The type of the element. |
| [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. |
| meshx_err_t meshx_nvs_element_ctx_remove | ( | uint16_t | element_id, |
| meshx_element_type_t | element_type ) |
Remove the context of a specific element from NVS.
| [in] | element_id | The ID of the element whose context is to be removed. |
| [in] | element_type | The type of the element. |
| meshx_err_t meshx_nvs_element_ctx_set | ( | uint16_t | element_id, |
| meshx_element_type_t | element_type, | ||
| const void * | blob, | ||
| size_t | blob_size ) |
Store the context of a specific element to NVS.
| [in] | element_id | The ID of the element whose context is to be stored. |
| [in] | element_type | The type of the element. |
| [in] | blob | Pointer to the buffer containing the context to be stored. |
| [in] | blob_size | Size of the buffer containing the context. |
| 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.
| 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. |
| meshx_err_t meshx_nvs_init | ( | void | ) |
MeshX NVS Initialisation.
| 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. |
| 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. |
| 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 |