6#ifndef _BLUETOOTH_MESH_CDB_H_
7#define _BLUETOOTH_MESH_CDB_H_
9#include "nimble/porting/nimble/include/syscfg/syscfg.h"
11#if MYNEWT_VAL(BLE_MESH_CDB)
12#define NODE_COUNT CONFIG_BT_MESH_NODE_COUNT
13#define SUBNET_COUNT CONFIG_BT_MESH_SUBNET_COUNT
14#define APP_KEY_COUNT CONFIG_BT_MESH_APP_KEY_COUNT
18#define APP_KEY_COUNT 0
24 BT_MESH_CDB_NODE_CONFIGURED,
26 BT_MESH_CDB_NODE_FLAG_COUNT
29struct bt_mesh_cdb_node {
39struct bt_mesh_cdb_subnet {
49struct bt_mesh_cdb_app_key {
60 BT_MESH_CDB_SUBNET_PENDING,
61 BT_MESH_CDB_KEYS_PENDING,
62 BT_MESH_CDB_NODES_PENDING,
63 BT_MESH_CDB_IVU_IN_PROGRESS,
65 BT_MESH_CDB_FLAG_COUNT,
73 struct bt_mesh_cdb_node nodes[NODE_COUNT];
74 struct bt_mesh_cdb_subnet subnets[SUBNET_COUNT];
75 struct bt_mesh_cdb_app_key app_keys[APP_KEY_COUNT];
78extern struct bt_mesh_cdb bt_mesh_cdb;
90int bt_mesh_cdb_create(
const uint8_t key[16]);
98void bt_mesh_cdb_clear(
void);
111void bt_mesh_cdb_iv_update(uint32_t iv_index,
bool iv_update);
125struct bt_mesh_cdb_node *bt_mesh_cdb_node_alloc(
const uint8_t uuid[16], uint16_t addr,
126 uint8_t num_elem, uint16_t net_idx);
135void bt_mesh_cdb_node_del(
struct bt_mesh_cdb_node *node,
bool store);
147struct bt_mesh_cdb_node *bt_mesh_cdb_node_get(uint16_t addr);
153void bt_mesh_cdb_node_store(
const struct bt_mesh_cdb_node *node);
156 BT_MESH_CDB_ITER_STOP = 0,
157 BT_MESH_CDB_ITER_CONTINUE,
169typedef uint8_t (*bt_mesh_cdb_node_func_t)(
struct bt_mesh_cdb_node *node,
180void bt_mesh_cdb_node_foreach(bt_mesh_cdb_node_func_t func,
void *user_data);
190struct bt_mesh_cdb_subnet *bt_mesh_cdb_subnet_alloc(uint16_t net_idx);
199void bt_mesh_cdb_subnet_del(
struct bt_mesh_cdb_subnet *sub,
bool store);
210struct bt_mesh_cdb_subnet *bt_mesh_cdb_subnet_get(uint16_t net_idx);
216void bt_mesh_cdb_subnet_store(
const struct bt_mesh_cdb_subnet *sub);
224uint8_t bt_mesh_cdb_subnet_flags(
const struct bt_mesh_cdb_subnet *sub);
236struct bt_mesh_cdb_app_key *bt_mesh_cdb_app_key_alloc(uint16_t net_idx,
246void bt_mesh_cdb_app_key_del(
struct bt_mesh_cdb_app_key *key,
bool store);
257struct bt_mesh_cdb_app_key *bt_mesh_cdb_app_key_get(uint16_t app_idx);
263void bt_mesh_cdb_app_key_store(
const struct bt_mesh_cdb_app_key *key);
#define ATOMIC_DEFINE(name, num_bits)
Define an array of atomic variables.
Definition atomic.h:274