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.
Loading...
Searching...
No Matches
meshx_nvs.h
Go to the documentation of this file.
1
11
12#ifndef __MESHX_NVS_H__
13#define __MESHX_NVS_H__
14
15#include <stdint.h>
16#include "meshx_control_task.h"
17#include "meshx_os_timer.h"
18
19#define MESHX_NVS_TIMER_PERIOD_DEF 1000
20
21#ifndef MESHX_NVS_TIMER_PERIOD
22#define MESHX_NVS_TIMER_PERIOD MESHX_NVS_TIMER_PERIOD_DEF
23#endif /* MESHX_NVS_TIMER_PERIOD */
24
25#define MESHX_NVS_AUTO_COMMIT true
26#define MESHX_NVS_NO_AUTO_COMMIT false
27
32typedef struct meshx_nvs {
33 uint16_t init;
34 uint16_t cid;
35 uint16_t pid;
36 uintptr_t meshx_nvs_handle;
37#ifdef MESHX_NVS_TIMER_PERIOD
39#endif /* MESHX_NVS_TIMER_PERIOD */
41
49
59
69
79
90meshx_err_t meshx_nvs_remove(char const* key);
91
108meshx_err_t meshx_nvs_open(uint16_t cid, uint16_t pid, uint32_t commit_timeout_ms);
109
122meshx_err_t meshx_nvs_get(char const *key, void *blob, uint16_t blob_size);
123
137meshx_err_t meshx_nvs_set(char const* key, void const* blob, uint16_t blob_size, bool arm_timer);
138
152meshx_err_t meshx_nvs_element_ctx_get(uint16_t element_id, void *blob, size_t blob_size);
153
167meshx_err_t meshx_nvs_element_ctx_set(uint16_t element_id, const void *blob, size_t blob_size);
168
180meshx_err_t meshx_nvs_element_ctx_remove(uint16_t element_id);
181
182#endif /* __MESHX_NVS_H__ */
183
Header file for the control task in the BLE mesh node application.
meshx_err_t
MeshX Error Codes.
Definition meshx_err.h:39
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.
Definition meshx_nvs.c:444
meshx_err_t meshx_nvs_init(void)
MeshX NVS Initialisation.
Definition meshx_nvs.c:135
meshx_err_t meshx_nvs_close(void)
Close the NVS handle.
Definition meshx_nvs.c:297
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.
Definition meshx_nvs.c:424
meshx_err_t meshx_nvs_element_ctx_remove(uint16_t element_id)
Remove the context of a specific element from NVS.
Definition meshx_nvs.c:462
struct meshx_nvs meshx_nvs_t
meshx_err_t meshx_nvs_remove(char const *key)
Remove a key-value pair from the NVS.
Definition meshx_nvs.c:326
meshx_err_t meshx_nvs_open(uint16_t cid, uint16_t pid, uint32_t commit_timeout_ms)
Open the NVS with a timeout.
Definition meshx_nvs.c:165
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.
Definition meshx_nvs.c:366
meshx_err_t meshx_nvs_commit(void)
Commit changes to the NVS.
Definition meshx_nvs.c:259
meshx_err_t meshx_nvs_erase(void)
Erase all key-value pairs stored in the NVS.
Definition meshx_nvs.c:243
meshx_err_t meshx_nvs_get(char const *key, void *blob, uint16_t blob_size)
Get a value from the NVS.
Definition meshx_nvs.c:346
Header file for OS timer utilities.
struct meshx_os_timer meshx_os_timer_t
Alias for the meshx_os_timer structure.
Structure to hold the MeshX NVS data.
Definition meshx_nvs.h:32
uintptr_t meshx_nvs_handle
Definition meshx_nvs.h:36
uint16_t pid
Definition meshx_nvs.h:35
uint16_t init
Definition meshx_nvs.h:33
meshx_os_timer_t * meshx_nvs_commit_tmr
Definition meshx_nvs.h:38
uint16_t cid
Definition meshx_nvs.h:34