Skip to content

Commit b36f96b

Browse files
committed
mesh: Fix build with CDB disabled
1 parent d9f7595 commit b36f96b

File tree

7 files changed

+19
-15
lines changed

7 files changed

+19
-15
lines changed

nimble/host/mesh/include/mesh/glue.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,7 @@ static inline unsigned int find_msb_set(uint32_t op)
404404
#define CONFIG_SETTINGS BLE_MESH_SETTINGS
405405
#define CONFIG_BT_MESH_PROVISIONER BLE_MESH_PROVISIONER
406406
#define CONFIG_BT_MESH_PROV_DEVICE BLE_MESH_PROV_DEVICE
407+
#define CONFIG_BT_MESH_CDB BLE_MESH_CDB
407408

408409
/* Above flags are used with IS_ENABLED macro */
409410
#define IS_ENABLED(config) MYNEWT_VAL(config)
@@ -442,7 +443,6 @@ static inline unsigned int find_msb_set(uint32_t op)
442443
#define CONFIG_BT_MESH_RELAY MYNEWT_VAL(BLE_MESH_RELAY)
443444
#define CONFIG_BT_MESH_RELAY_RETRANSMIT_COUNT MYNEWT_VAL(BLE_MESH_RELAY_RETRANSMIT_COUNT)
444445
#define CONFIG_BT_MESH_GATT_PROXY_ENABLED MYNEWT_VAL(BLE_MESH_GATT_PROXY_ENABLED)
445-
#define CONFIG_BT_MESH_CDB BLE_MESH_CDB
446446

447447
#define printk console_printf
448448

nimble/host/mesh/src/app_keys.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,4 +504,4 @@ void bt_mesh_app_keys_reset(void)
504504
app_key_del(app);
505505
}
506506
}
507-
}
507+
}

nimble/host/mesh/src/cdb.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
* SPDX-License-Identifier: Apache-2.0
55
*/
66

7-
#if BLE_MESH_CDB
87
#define BT_DBG_ENABLED MYNEWT_VAL(BLE_MESH_DEBUG_CDB)
98
#define LOG_MODULE_NAME bt_mesh_cdb
109
#include "log/log.h"
@@ -16,7 +15,7 @@
1615
#include "mesh_priv.h"
1716
#include "mesh/glue.h"
1817

19-
18+
#if MYNEWT_VAL(BLE_MESH_CDB)
2019
struct bt_mesh_cdb bt_mesh_cdb = {
2120
.nodes = {
2221
[0 ... (CONFIG_BT_MESH_NODE_COUNT - 1)] = {

nimble/host/mesh/src/mesh.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,4 +399,4 @@ int bt_mesh_start(void)
399399
bt_mesh_model_foreach(model_start, NULL);
400400

401401
return 0;
402-
}
402+
}

nimble/host/mesh/src/provisioner.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ static void pub_key_ready(const uint8_t *pkey);
3737

3838
static int reset_state(void)
3939
{
40-
#if BLE_MESH_CDB
40+
#if MYNEWT_VAL(BLE_MESH_CDB)
4141
if (prov_device.node != NULL) {
4242
bt_mesh_cdb_node_del(prov_device.node, false);
4343
}
@@ -238,7 +238,7 @@ static void prov_capabilities(const uint8_t *data)
238238
prov_fail(PROV_ERR_NVAL_FMT);
239239
return;
240240
}
241-
#if BLE_MESH_CDB
241+
#if MYNEWT_VAL(BLE_MESH_CDB)
242242
prov_device.node =
243243
bt_mesh_cdb_node_alloc(prov_device.uuid,
244244
prov_device.addr, data[0],
@@ -454,7 +454,7 @@ static void prov_input_complete(const uint8_t *data)
454454
static void send_prov_data(void)
455455
{
456456
struct os_mbuf *pdu = PROV_BUF(34);
457-
#if BLE_MESH_CDB
457+
#if MYNEWT_VAL(BLE_MESH_CDB)
458458
struct bt_mesh_cdb_subnet *sub;
459459
#endif
460460
uint8_t session_key[16];
@@ -490,7 +490,7 @@ static void send_prov_data(void)
490490
}
491491

492492
BT_DBG("DevKey: %s", bt_hex(prov_device.node->dev_key, 16));
493-
#if BLE_MESH_CDB
493+
#if MYNEWT_VAL(BLE_MESH_CDB)
494494
sub = bt_mesh_cdb_subnet_get(prov_device.node->net_idx);
495495
if (sub == NULL) {
496496
BT_ERR("No subnet with net_idx %u",
@@ -500,7 +500,7 @@ static void send_prov_data(void)
500500
}
501501
#endif
502502
bt_mesh_prov_buf_init(pdu, PROV_DATA);
503-
#if BLE_MESH_CDB
503+
#if MYNEWT_VAL(BLE_MESH_CDB)
504504
net_buf_simple_add_mem(pdu, sub->keys[sub->kr_flag].net_key, 16);
505505
net_buf_simple_add_be16(pdu, prov_device.node->net_idx);
506506
net_buf_simple_add_u8(pdu, bt_mesh_cdb_subnet_flags(sub));
@@ -537,9 +537,11 @@ static void prov_complete(const uint8_t *data)
537537
bt_hex(node->dev_key, 16), node->net_idx, node->num_elem,
538538
node->addr);
539539

540+
#if MYNEWT_VAL(BLE_MESH_CDB)
540541
if (IS_ENABLED(CONFIG_BT_SETTINGS)) {
541542
bt_mesh_store_cdb_node(node);
542543
}
544+
#endif
543545

544546
prov_device.node = NULL;
545547
prov_link_close(PROV_BEARER_LINK_STATUS_SUCCESS);
@@ -743,4 +745,4 @@ int bt_mesh_pb_adv_open(const uint8_t uuid[16], uint16_t net_idx, uint16_t addr,
743745

744746
return err;
745747
}
746-
#endif
748+
#endif

nimble/host/mesh/src/settings.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,6 @@ static struct node_update cdb_node_updates[MYNEWT_VAL(BLE_MESH_CDB_NODE_COUNT)];
147147
static struct key_update cdb_key_updates[
148148
MYNEWT_VAL(BLE_MESH_CDB_SUBNET_COUNT) +
149149
MYNEWT_VAL(BLE_MESH_CDB_APP_KEY_COUNT)];
150-
#else
151-
static struct node_update cdb_node_updates[0];
152-
static struct key_update cdb_key_updates[0];
153150
#endif
154151

155152
int settings_name_next(char *name, char **next)
@@ -1477,6 +1474,7 @@ static void store_pending_keys(void)
14771474
}
14781475
}
14791476

1477+
#if MYNEWT_VAL(BLE_MESH_CDB)
14801478
static void clear_cdb(void)
14811479
{
14821480
int err;
@@ -1752,6 +1750,7 @@ static struct node_update *cdb_node_update_find(uint16_t addr,
17521750

17531751
return match;
17541752
}
1753+
#endif
17551754

17561755
static void encode_mod_path(struct bt_mesh_model *mod, bool vnd,
17571756
const char *key, char *path, size_t path_len)
@@ -2002,6 +2001,7 @@ static void store_pending(struct ble_npl_event *work)
20022001
store_pending_va();
20032002
}
20042003

2004+
#if MYNEWT_VAL(BLE_MESH_CDB)
20052005
if (IS_ENABLED(CONFIG_BT_MESH_CDB)) {
20062006
if (atomic_test_and_clear_bit(bt_mesh_cdb.flags,
20072007
BT_MESH_CDB_SUBNET_PENDING)) {
@@ -2023,6 +2023,7 @@ static void store_pending(struct ble_npl_event *work)
20232023
store_pending_cdb_keys();
20242024
}
20252025
}
2026+
#endif
20262027
}
20272028

20282029
void bt_mesh_store_rpl(struct bt_mesh_rpl *entry)
@@ -2210,6 +2211,7 @@ void bt_mesh_store_label(void)
22102211
schedule_store(BT_MESH_VA_PENDING);
22112212
}
22122213

2214+
#if MYNEWT_VAL(BLE_MESH_CDB)
22132215
static void schedule_cdb_store(int flag)
22142216
{
22152217
atomic_set_bit(bt_mesh_cdb.flags, flag);
@@ -2402,6 +2404,7 @@ void bt_mesh_clear_cdb_app_key(struct bt_mesh_cdb_app_key *key)
24022404

24032405
schedule_cdb_store(BT_MESH_CDB_KEYS_PENDING);
24042406
}
2407+
#endif
24052408

24062409
int bt_mesh_model_data_store(struct bt_mesh_model *mod, bool vnd,
24072410
const char *name, const void *data,

nimble/host/mesh/src/shell.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2719,7 +2719,7 @@ struct shell_cmd_help cmd_del_fault_help = {
27192719
NULL, "[Fault ID]", NULL
27202720
};
27212721

2722-
#if BLE_MESH_CDB
2722+
#if MYNEWT_VAL(BLE_MESH_CDB)
27232723
struct shell_cmd_help cmd_cdb_create_help = {
27242724
NULL, "[NetKey]", NULL
27252725
};

0 commit comments

Comments
 (0)