Zephyr API Documentation  2.7.0-rc2
A Scalable Open Source RTOS
cdb.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2019 Tobias Svehagen
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6#ifndef ZEPHYR_INCLUDE_BLUETOOTH_MESH_CDB_H_
7#define ZEPHYR_INCLUDE_BLUETOOTH_MESH_CDB_H_
8
9#include <inttypes.h>
10#include <sys/atomic.h>
11
12#ifdef __cplusplus
13extern "C" {
14#endif
15
16#if defined(CONFIG_BT_MESH_CDB)
17#define NODE_COUNT CONFIG_BT_MESH_CDB_NODE_COUNT
18#define SUBNET_COUNT CONFIG_BT_MESH_CDB_SUBNET_COUNT
19#define APP_KEY_COUNT CONFIG_BT_MESH_CDB_APP_KEY_COUNT
20#else
21#define NODE_COUNT 0
22#define SUBNET_COUNT 0
23#define APP_KEY_COUNT 0
24#endif
25
26enum {
28
30};
31
38
40};
41
44
46
47 struct {
49 } keys[2];
50};
51
55
56 struct {
58 } keys[2];
59};
60
61enum {
67
69};
70
73
75
79};
80
81extern struct bt_mesh_cdb bt_mesh_cdb;
82
94
102
115
130
138void bt_mesh_cdb_node_del(struct bt_mesh_cdb_node *node, bool store);
139
151
157
158enum {
161};
162
173 void *user_data);
174
184
194
202void bt_mesh_cdb_subnet_del(struct bt_mesh_cdb_subnet *sub, bool store);
203
214
220
228
229
241
250
261
267
268#ifdef __cplusplus
269}
270#endif
271
272#endif /* ZEPHYR_INCLUDE_BLUETOOTH_MESH_CDB_H_ */
int bt_mesh_cdb_create(const uint8_t key[16])
Create the Mesh Configuration Database.
uint8_t bt_mesh_cdb_subnet_flags(const struct bt_mesh_cdb_subnet *sub)
Get the flags for a subnet.
@ BT_MESH_CDB_ITER_CONTINUE
Definition: cdb.h:160
@ BT_MESH_CDB_ITER_STOP
Definition: cdb.h:159
struct bt_mesh_cdb_subnet * bt_mesh_cdb_subnet_get(uint16_t net_idx)
Get a subnet by NetIdx.
struct bt_mesh_cdb_node * bt_mesh_cdb_node_get(uint16_t addr)
Get a node by address.
void bt_mesh_cdb_clear(void)
Clear the Mesh Configuration Database.
void bt_mesh_cdb_app_key_store(const struct bt_mesh_cdb_app_key *key)
Store application key to persistent storage.
void bt_mesh_cdb_subnet_store(const struct bt_mesh_cdb_subnet *sub)
Store subnet to persistent storage.
#define SUBNET_COUNT
Definition: cdb.h:22
void bt_mesh_cdb_subnet_del(struct bt_mesh_cdb_subnet *sub, bool store)
Delete a subnet.
void bt_mesh_cdb_app_key_del(struct bt_mesh_cdb_app_key *key, bool store)
Delete an application key.
void bt_mesh_cdb_node_del(struct bt_mesh_cdb_node *node, bool store)
Delete a node.
@ BT_MESH_CDB_NODE_FLAG_COUNT
Definition: cdb.h:29
@ BT_MESH_CDB_NODE_CONFIGURED
Definition: cdb.h:27
void bt_mesh_cdb_iv_update(uint32_t iv_index, bool iv_update)
Set and store the IV Index and IV Update flag.
#define APP_KEY_COUNT
Definition: cdb.h:23
struct bt_mesh_cdb_node * bt_mesh_cdb_node_alloc(const uint8_t uuid[16], uint16_t addr, uint8_t num_elem, uint16_t net_idx)
Allocate a node.
struct bt_mesh_cdb_app_key * bt_mesh_cdb_app_key_get(uint16_t app_idx)
Get an application key by AppIdx.
struct bt_mesh_cdb_app_key * bt_mesh_cdb_app_key_alloc(uint16_t net_idx, uint16_t app_idx)
Allocate an application key.
@ BT_MESH_CDB_IVU_IN_PROGRESS
Definition: cdb.h:66
@ BT_MESH_CDB_NODES_PENDING
Definition: cdb.h:65
@ BT_MESH_CDB_SUBNET_PENDING
Definition: cdb.h:63
@ BT_MESH_CDB_KEYS_PENDING
Definition: cdb.h:64
@ BT_MESH_CDB_FLAG_COUNT
Definition: cdb.h:68
@ BT_MESH_CDB_VALID
Definition: cdb.h:62
void bt_mesh_cdb_node_store(const struct bt_mesh_cdb_node *node)
Store node to persistent storage.
uint8_t(* bt_mesh_cdb_node_func_t)(struct bt_mesh_cdb_node *node, void *user_data)
Node iterator callback.
Definition: cdb.h:172
#define NODE_COUNT
Definition: cdb.h:21
void bt_mesh_cdb_node_foreach(bt_mesh_cdb_node_func_t func, void *user_data)
Node iterator.
struct bt_mesh_cdb_subnet * bt_mesh_cdb_subnet_alloc(uint16_t net_idx)
Allocate a subnet.
#define ATOMIC_DEFINE(name, num_bits)
Define an array of atomic variables.
Definition: atomic.h:113
flags
Definition: http_parser.h:131
static k_spinlock_key_t key
Definition: spinlock_error_case.c:14
__UINT32_TYPE__ uint32_t
Definition: stdint.h:60
__UINT8_TYPE__ uint8_t
Definition: stdint.h:58
__UINT16_TYPE__ uint16_t
Definition: stdint.h:59
Definition: cdb.h:52
uint16_t app_idx
Definition: cdb.h:54
struct bt_mesh_cdb_app_key::@80 keys[2]
uint8_t app_key[16]
Definition: cdb.h:57
uint16_t net_idx
Definition: cdb.h:53
Definition: cdb.h:32
uint8_t num_elem
Definition: cdb.h:36
uint8_t dev_key[16]
Definition: cdb.h:37
uint8_t uuid[16]
Definition: cdb.h:33
uint16_t addr
Definition: cdb.h:34
uint16_t net_idx
Definition: cdb.h:35
Definition: cdb.h:42
uint8_t kr_phase
Definition: cdb.h:45
uint16_t net_idx
Definition: cdb.h:43
struct bt_mesh_cdb_subnet::@79 keys[2]
uint8_t net_key[16]
Definition: cdb.h:48
Definition: cdb.h:71
uint32_t iv_index
Definition: cdb.h:72
struct bt_mesh_cdb_app_key app_keys[0]
Definition: cdb.h:78
struct bt_mesh_cdb_node nodes[0]
Definition: cdb.h:76
struct bt_mesh_cdb_subnet subnets[0]
Definition: cdb.h:77
static const intptr_t user_data[5]
Definition: main.c:590