From 31663a042acd02e8d0ec93f01702e9feada9b22c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Narajowski?= Date: Tue, 10 Apr 2018 12:22:38 +0200 Subject: [PATCH] mesh: Fix Node Identity advertising with PB-ADV The Node Identity advertising should only be automatically enabled when provisioning happened over PB-GATT, but not when it happened over PB-ADV. Move the enabling of Node Identity to the provisioning code, where we know the bearer that was used (this information does not get passed to the bt_mesh_provision function). --- nimble/host/mesh/src/net.c | 3 +-- nimble/host/mesh/src/prov.c | 7 +++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/nimble/host/mesh/src/net.c b/nimble/host/mesh/src/net.c index ffde0a6aa..9bd79681a 100644 --- a/nimble/host/mesh/src/net.c +++ b/nimble/host/mesh/src/net.c @@ -476,8 +476,7 @@ int bt_mesh_net_create(u16_t idx, u8_t flags, const u8_t key[16], sub->net_idx = idx; if ((MYNEWT_VAL(BLE_MESH_GATT_PROXY))) { - sub->node_id = BT_MESH_NODE_IDENTITY_RUNNING; - sub->node_id_start = k_uptime_get_32(); + sub->node_id = BT_MESH_NODE_IDENTITY_STOPPED; } else { sub->node_id = BT_MESH_NODE_IDENTITY_NOT_SUPPORTED; } diff --git a/nimble/host/mesh/src/prov.c b/nimble/host/mesh/src/prov.c index 747f0d910..a5a18fcfb 100644 --- a/nimble/host/mesh/src/prov.c +++ b/nimble/host/mesh/src/prov.c @@ -1073,6 +1073,13 @@ static void prov_data(const u8_t *data) bt_mesh_provision(pdu, net_idx, flags, iv_index, 0, addr, dev_key); +#if MYNEWT_VAL(BLE_MESH_PB_GATT) && MYNEWT_VAL(BLE_MESH_GATT_PROXY) + /* After PB-GATT provisioning we should start advertising + * using Node Identity. + */ + bt_mesh_proxy_identity_enable(); +#endif + done: os_mbuf_free_chain(msg); }