Bluetooth: Mesh: Rename prov_dev->provisionee
Renames "prov device" references and options to "provisionee" to align implementation with Mesh Protocol specification v1.1, section 5.4. Signed-off-by: Anders Storrø <anders.storro@nordicsemi.no>
This commit is contained in:
parent
00f7c0e445
commit
25d44a828d
11 changed files with 76 additions and 61 deletions
|
|
@ -282,7 +282,7 @@ Provisioning
|
||||||
============
|
============
|
||||||
|
|
||||||
To allow a device to broadcast connectable unprovisioned beacons, the
|
To allow a device to broadcast connectable unprovisioned beacons, the
|
||||||
:kconfig:option:`CONFIG_BT_MESH_PROV_DEVICE` configuration option must be enabled, along with the
|
:kconfig:option:`CONFIG_BT_MESH_PROVISIONEE` configuration option must be enabled, along with the
|
||||||
:kconfig:option:`CONFIG_BT_MESH_PB_GATT` option.
|
:kconfig:option:`CONFIG_BT_MESH_PB_GATT` option.
|
||||||
|
|
||||||
``mesh prov pb-gatt <Val(off, on)>``
|
``mesh prov pb-gatt <Val(off, on)>``
|
||||||
|
|
@ -295,7 +295,7 @@ To allow a device to broadcast connectable unprovisioned beacons, the
|
||||||
* ``Val``: Enable or disable provisioning with GATT
|
* ``Val``: Enable or disable provisioning with GATT
|
||||||
|
|
||||||
To allow a device to broadcast unprovisioned beacons, the
|
To allow a device to broadcast unprovisioned beacons, the
|
||||||
:kconfig:option:`CONFIG_BT_MESH_PROV_DEVICE` configuration option must be enabled, along with the
|
:kconfig:option:`CONFIG_BT_MESH_PROVISIONEE` configuration option must be enabled, along with the
|
||||||
:kconfig:option:`CONFIG_BT_MESH_PB_ADV` option.
|
:kconfig:option:`CONFIG_BT_MESH_PB_ADV` option.
|
||||||
|
|
||||||
``mesh prov pb-adv <Val(off, on)>``
|
``mesh prov pb-adv <Val(off, on)>``
|
||||||
|
|
|
||||||
|
|
@ -195,19 +195,25 @@ Bluetooth
|
||||||
cleared on :c:func:`bt_enable`. Callbacks can now be registered before the initial
|
cleared on :c:func:`bt_enable`. Callbacks can now be registered before the initial
|
||||||
call to :c:func:`bt_enable`, and should no longer be re-registered after a :c:func:`bt_disable`
|
call to :c:func:`bt_enable`, and should no longer be re-registered after a :c:func:`bt_disable`
|
||||||
:c:func:`bt_enable` cycle. (:github:`63693`)
|
:c:func:`bt_enable` cycle. (:github:`63693`)
|
||||||
* The Bluetooth Mesh ``model`` declaration has been changed to add prefix ``const``.
|
|
||||||
The ``model->user_data``, ``model->elem_idx`` and ``model->mod_idx`` field has been changed to
|
|
||||||
the new runtime structure, replaced by ``model->rt->user_data``, ``model->rt->elem_idx`` and
|
|
||||||
``model->rt->mod_idx`` separately. (:github:`65152`)
|
|
||||||
* The Bluetooth Mesh ``element`` declaration has been changed to add prefix ``const``.
|
|
||||||
The ``elem->addr`` field has been changed to the new runtime structure, replaced by
|
|
||||||
``elem->rt->addr``. (:github:`65388`)
|
|
||||||
* The Bluetooth UUID has been modified to rodata in ``BT_UUID_DECLARE_16``, ``BT_UUID_DECLARE_32`
|
* The Bluetooth UUID has been modified to rodata in ``BT_UUID_DECLARE_16``, ``BT_UUID_DECLARE_32`
|
||||||
and ``BT_UUID_DECLARE_128`` as the return value has been changed to `const`.
|
and ``BT_UUID_DECLARE_128`` as the return value has been changed to `const`.
|
||||||
Any pointer to a UUID must be prefixed with `const`, otherwise there will be a compilation warning.
|
Any pointer to a UUID must be prefixed with `const`, otherwise there will be a compilation warning.
|
||||||
For example change ``struct bt_uuid *uuid = BT_UUID_DECLARE_16(xx)`` to
|
For example change ``struct bt_uuid *uuid = BT_UUID_DECLARE_16(xx)`` to
|
||||||
``const struct bt_uuid *uuid = BT_UUID_DECLARE_16(xx)``. (:github:`66136`)
|
``const struct bt_uuid *uuid = BT_UUID_DECLARE_16(xx)``. (:github:`66136`)
|
||||||
|
|
||||||
|
* Mesh
|
||||||
|
|
||||||
|
* The Bluetooth Mesh ``model`` declaration has been changed to add prefix ``const``.
|
||||||
|
The ``model->user_data``, ``model->elem_idx`` and ``model->mod_idx`` field has been changed to
|
||||||
|
the new runtime structure, replaced by ``model->rt->user_data``, ``model->rt->elem_idx`` and
|
||||||
|
``model->rt->mod_idx`` separately. (:github:`65152`)
|
||||||
|
* The Bluetooth Mesh ``element`` declaration has been changed to add prefix ``const``.
|
||||||
|
The ``elem->addr`` field has been changed to the new runtime structure, replaced by
|
||||||
|
``elem->rt->addr``. (:github:`65388`)
|
||||||
|
* Deprecated :kconfig:option:`CONFIG_BT_MESH_PROV_DEVICE`. This option is
|
||||||
|
replaced by new option :kconfig:option:`CONFIG_BT_MESH_PROVISIONEE` to
|
||||||
|
be aligned with Mesh Protocol Specification v1.1, section 5.4. (:github:`64252`)
|
||||||
|
|
||||||
LoRaWAN
|
LoRaWAN
|
||||||
=======
|
=======
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ CONFIG_BT_MESH_RELAY=y
|
||||||
CONFIG_BT_MESH_RELAY_RETRANSMIT_COUNT=3
|
CONFIG_BT_MESH_RELAY_RETRANSMIT_COUNT=3
|
||||||
|
|
||||||
CONFIG_BT_MESH_PROVISIONER=y
|
CONFIG_BT_MESH_PROVISIONER=y
|
||||||
CONFIG_BT_MESH_PROV_DEVICE=n
|
CONFIG_BT_MESH_PROVISIONEE=n
|
||||||
CONFIG_BT_MESH_CDB=y
|
CONFIG_BT_MESH_CDB=y
|
||||||
CONFIG_BT_MESH_CDB_NODE_COUNT=16
|
CONFIG_BT_MESH_CDB_NODE_COUNT=16
|
||||||
CONFIG_BT_MESH_CDB_SUBNET_COUNT=3
|
CONFIG_BT_MESH_CDB_SUBNET_COUNT=3
|
||||||
|
|
|
||||||
|
|
@ -1012,7 +1012,7 @@ legacy-debug-sym = BT_MESH_DEBUG_PROVISIONER
|
||||||
module-str = "Provisioner"
|
module-str = "Provisioner"
|
||||||
source "subsys/bluetooth/common/Kconfig.template.log_config_bt"
|
source "subsys/bluetooth/common/Kconfig.template.log_config_bt"
|
||||||
|
|
||||||
module = BT_MESH_PROV_DEVICE
|
module = BT_MESH_PROVISIONEE
|
||||||
legacy-debug-sym = BT_MESH_DEBUG_PROV_DEVICE
|
legacy-debug-sym = BT_MESH_DEBUG_PROV_DEVICE
|
||||||
module-str = "Provisioning device"
|
module-str = "Provisioning device"
|
||||||
source "subsys/bluetooth/common/Kconfig.template.log_config_bt"
|
source "subsys/bluetooth/common/Kconfig.template.log_config_bt"
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ zephyr_library_sources_ifdef(CONFIG_BT_MESH_FRIEND friend.c)
|
||||||
|
|
||||||
zephyr_library_sources_ifdef(CONFIG_BT_MESH_PROV prov.c)
|
zephyr_library_sources_ifdef(CONFIG_BT_MESH_PROV prov.c)
|
||||||
|
|
||||||
zephyr_library_sources_ifdef(CONFIG_BT_MESH_PROV_DEVICE prov_device.c)
|
zephyr_library_sources_ifdef(CONFIG_BT_MESH_PROVISIONEE provisionee.c)
|
||||||
|
|
||||||
zephyr_library_sources_ifdef(CONFIG_BT_MESH_PROVISIONER provisioner.c)
|
zephyr_library_sources_ifdef(CONFIG_BT_MESH_PROVISIONER provisioner.c)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -240,7 +240,7 @@ config BT_MESH_PB_GATT
|
||||||
select BT_MESH_GATT_SERVER
|
select BT_MESH_GATT_SERVER
|
||||||
select BT_MESH_PROV
|
select BT_MESH_PROV
|
||||||
select BT_MESH_PB_GATT_COMMON
|
select BT_MESH_PB_GATT_COMMON
|
||||||
select BT_MESH_PROV_DEVICE
|
select BT_MESH_PROVISIONEE
|
||||||
help
|
help
|
||||||
Enable this option to allow the device to be provisioned over
|
Enable this option to allow the device to be provisioned over
|
||||||
GATT.
|
GATT.
|
||||||
|
|
@ -268,7 +268,16 @@ config BT_MESH_PB_GATT_CLIENT
|
||||||
endif # BT_CONN
|
endif # BT_CONN
|
||||||
|
|
||||||
config BT_MESH_PROV_DEVICE
|
config BT_MESH_PROV_DEVICE
|
||||||
bool "Provisioning device role support"
|
bool "[DEPRECATED] Provisioning device role support"
|
||||||
|
select DEPRECATED
|
||||||
|
select BT_MESH_PROVISIONEE
|
||||||
|
help
|
||||||
|
Enable this option to allow the device to be provisioned into a mesh network.
|
||||||
|
The option is marked as deprecated and will be replaced by BT_MESH_PROVISIONEE
|
||||||
|
option.
|
||||||
|
|
||||||
|
config BT_MESH_PROVISIONEE
|
||||||
|
bool "Provisionee role support"
|
||||||
depends on BT_MESH_PB_ADV || BT_MESH_PB_GATT
|
depends on BT_MESH_PB_ADV || BT_MESH_PB_GATT
|
||||||
default y
|
default y
|
||||||
help
|
help
|
||||||
|
|
@ -276,7 +285,7 @@ config BT_MESH_PROV_DEVICE
|
||||||
|
|
||||||
config BT_MESH_PROV_OOB_PUBLIC_KEY
|
config BT_MESH_PROV_OOB_PUBLIC_KEY
|
||||||
bool "OOB Public key support"
|
bool "OOB Public key support"
|
||||||
depends on BT_MESH_PROV_DEVICE
|
depends on BT_MESH_PROVISIONEE
|
||||||
help
|
help
|
||||||
Enable this option if public key is to be exchanged via Out of Band (OOB) technology.
|
Enable this option if public key is to be exchanged via Out of Band (OOB) technology.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,9 +32,9 @@
|
||||||
#include "settings.h"
|
#include "settings.h"
|
||||||
#include "rpr.h"
|
#include "rpr.h"
|
||||||
|
|
||||||
#define LOG_LEVEL CONFIG_BT_MESH_PROV_DEVICE_LOG_LEVEL
|
#define LOG_LEVEL CONFIG_BT_MESH_PROVISIONEE_LOG_LEVEL
|
||||||
#include <zephyr/logging/log.h>
|
#include <zephyr/logging/log.h>
|
||||||
LOG_MODULE_REGISTER(bt_mesh_prov_device);
|
LOG_MODULE_REGISTER(bt_mesh_provisionee);
|
||||||
|
|
||||||
static void reprovision_fail(void);
|
static void reprovision_fail(void);
|
||||||
|
|
||||||
|
|
@ -696,8 +696,8 @@ int bt_mesh_prov_enable(bt_mesh_prov_bearer_t bearers)
|
||||||
return -EALREADY;
|
return -EALREADY;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(CONFIG_BT_MESH_PROV_DEVICE_LOG_LEVEL)
|
#if defined(CONFIG_BT_MESH_PROVISIONEE_LOG_LEVEL)
|
||||||
if (CONFIG_BT_MESH_PROV_DEVICE_LOG_LEVEL > 2) {
|
if (CONFIG_BT_MESH_PROVISIONEE_LOG_LEVEL > 2) {
|
||||||
struct bt_uuid_128 uuid = { .uuid = { BT_UUID_TYPE_128 } };
|
struct bt_uuid_128 uuid = { .uuid = { BT_UUID_TYPE_128 } };
|
||||||
|
|
||||||
sys_memcpy_swap(uuid.val, bt_mesh_prov->uuid, 16);
|
sys_memcpy_swap(uuid.val, bt_mesh_prov->uuid, 16);
|
||||||
|
|
@ -46,7 +46,7 @@ static struct {
|
||||||
uint8_t attention_duration;
|
uint8_t attention_duration;
|
||||||
uint8_t uuid[16];
|
uint8_t uuid[16];
|
||||||
uint8_t new_dev_key[16];
|
uint8_t new_dev_key[16];
|
||||||
} prov_device;
|
} provisionee;
|
||||||
|
|
||||||
static void send_pub_key(void);
|
static void send_pub_key(void);
|
||||||
static void prov_dh_key_gen(void);
|
static void prov_dh_key_gen(void);
|
||||||
|
|
@ -54,8 +54,8 @@ static void prov_dh_key_gen(void);
|
||||||
static int reset_state(void)
|
static int reset_state(void)
|
||||||
{
|
{
|
||||||
if (!atomic_test_bit(bt_mesh_prov_link.flags, REPROVISION) &&
|
if (!atomic_test_bit(bt_mesh_prov_link.flags, REPROVISION) &&
|
||||||
prov_device.node != NULL) {
|
provisionee.node != NULL) {
|
||||||
bt_mesh_cdb_node_del(prov_device.node, false);
|
bt_mesh_cdb_node_del(provisionee.node, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
return bt_mesh_prov_reset_state();
|
return bt_mesh_prov_reset_state();
|
||||||
|
|
@ -86,9 +86,9 @@ static void send_invite(void)
|
||||||
LOG_DBG("");
|
LOG_DBG("");
|
||||||
|
|
||||||
bt_mesh_prov_buf_init(&inv, PROV_INVITE);
|
bt_mesh_prov_buf_init(&inv, PROV_INVITE);
|
||||||
net_buf_simple_add_u8(&inv, prov_device.attention_duration);
|
net_buf_simple_add_u8(&inv, provisionee.attention_duration);
|
||||||
|
|
||||||
memcpy(bt_mesh_prov_link.conf_inputs.invite, &prov_device.attention_duration,
|
memcpy(bt_mesh_prov_link.conf_inputs.invite, &provisionee.attention_duration,
|
||||||
PDU_LEN_INVITE);
|
PDU_LEN_INVITE);
|
||||||
|
|
||||||
if (bt_mesh_prov_send(&inv, NULL)) {
|
if (bt_mesh_prov_send(&inv, NULL)) {
|
||||||
|
|
@ -246,8 +246,8 @@ static void prov_capabilities(const uint8_t *data)
|
||||||
LOG_DBG("Input OOB Size: %u", caps.input_size);
|
LOG_DBG("Input OOB Size: %u", caps.input_size);
|
||||||
LOG_DBG("Input OOB Action: 0x%04x", caps.input_actions);
|
LOG_DBG("Input OOB Action: 0x%04x", caps.input_actions);
|
||||||
|
|
||||||
prov_device.elem_count = caps.elem_count;
|
provisionee.elem_count = caps.elem_count;
|
||||||
if (prov_device.elem_count == 0) {
|
if (provisionee.elem_count == 0) {
|
||||||
LOG_ERR("Invalid number of elements");
|
LOG_ERR("Invalid number of elements");
|
||||||
prov_fail(PROV_ERR_NVAL_FMT);
|
prov_fail(PROV_ERR_NVAL_FMT);
|
||||||
return;
|
return;
|
||||||
|
|
@ -271,7 +271,7 @@ static void prov_capabilities(const uint8_t *data)
|
||||||
if (atomic_test_bit(bt_mesh_prov_link.flags, REPROVISION)) {
|
if (atomic_test_bit(bt_mesh_prov_link.flags, REPROVISION)) {
|
||||||
if (!bt_mesh_prov_link.addr) {
|
if (!bt_mesh_prov_link.addr) {
|
||||||
bt_mesh_prov_link.addr = bt_mesh_cdb_free_addr_get(
|
bt_mesh_prov_link.addr = bt_mesh_cdb_free_addr_get(
|
||||||
prov_device.elem_count);
|
provisionee.elem_count);
|
||||||
if (!bt_mesh_prov_link.addr) {
|
if (!bt_mesh_prov_link.addr) {
|
||||||
LOG_ERR("Failed allocating address for node");
|
LOG_ERR("Failed allocating address for node");
|
||||||
prov_fail(PROV_ERR_ADDR);
|
prov_fail(PROV_ERR_ADDR);
|
||||||
|
|
@ -279,19 +279,19 @@ static void prov_capabilities(const uint8_t *data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
prov_device.node =
|
provisionee.node =
|
||||||
bt_mesh_cdb_node_alloc(prov_device.uuid,
|
bt_mesh_cdb_node_alloc(provisionee.uuid,
|
||||||
bt_mesh_prov_link.addr,
|
bt_mesh_prov_link.addr,
|
||||||
prov_device.elem_count,
|
provisionee.elem_count,
|
||||||
prov_device.net_idx);
|
provisionee.net_idx);
|
||||||
if (prov_device.node == NULL) {
|
if (provisionee.node == NULL) {
|
||||||
LOG_ERR("Failed allocating node 0x%04x", bt_mesh_prov_link.addr);
|
LOG_ERR("Failed allocating node 0x%04x", bt_mesh_prov_link.addr);
|
||||||
prov_fail(PROV_ERR_RESOURCES);
|
prov_fail(PROV_ERR_RESOURCES);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Address might change in the alloc call */
|
/* Address might change in the alloc call */
|
||||||
bt_mesh_prov_link.addr = prov_device.node->addr;
|
bt_mesh_prov_link.addr = provisionee.node->addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(bt_mesh_prov_link.conf_inputs.capabilities, data, PDU_LEN_CAPABILITIES);
|
memcpy(bt_mesh_prov_link.conf_inputs.capabilities, data, PDU_LEN_CAPABILITIES);
|
||||||
|
|
@ -517,16 +517,16 @@ static void send_prov_data(void)
|
||||||
LOG_DBG("Nonce: %s", bt_hex(nonce, 13));
|
LOG_DBG("Nonce: %s", bt_hex(nonce, 13));
|
||||||
|
|
||||||
err = bt_mesh_dev_key(bt_mesh_prov_link.dhkey,
|
err = bt_mesh_dev_key(bt_mesh_prov_link.dhkey,
|
||||||
bt_mesh_prov_link.prov_salt, prov_device.new_dev_key);
|
bt_mesh_prov_link.prov_salt, provisionee.new_dev_key);
|
||||||
if (err) {
|
if (err) {
|
||||||
LOG_ERR("Unable to generate device key");
|
LOG_ERR("Unable to generate device key");
|
||||||
prov_fail(PROV_ERR_UNEXP_ERR);
|
prov_fail(PROV_ERR_UNEXP_ERR);
|
||||||
goto session_key_destructor;
|
goto session_key_destructor;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub = bt_mesh_cdb_subnet_get(prov_device.node->net_idx);
|
sub = bt_mesh_cdb_subnet_get(provisionee.node->net_idx);
|
||||||
if (sub == NULL) {
|
if (sub == NULL) {
|
||||||
LOG_ERR("No subnet with net_idx %u", prov_device.node->net_idx);
|
LOG_ERR("No subnet with net_idx %u", provisionee.node->net_idx);
|
||||||
prov_fail(PROV_ERR_UNEXP_ERR);
|
prov_fail(PROV_ERR_UNEXP_ERR);
|
||||||
goto session_key_destructor;
|
goto session_key_destructor;
|
||||||
}
|
}
|
||||||
|
|
@ -540,14 +540,14 @@ static void send_prov_data(void)
|
||||||
|
|
||||||
bt_mesh_prov_buf_init(&pdu, PROV_DATA);
|
bt_mesh_prov_buf_init(&pdu, PROV_DATA);
|
||||||
net_buf_simple_add_mem(&pdu, net_key, sizeof(net_key));
|
net_buf_simple_add_mem(&pdu, net_key, sizeof(net_key));
|
||||||
net_buf_simple_add_be16(&pdu, prov_device.node->net_idx);
|
net_buf_simple_add_be16(&pdu, provisionee.node->net_idx);
|
||||||
net_buf_simple_add_u8(&pdu, bt_mesh_cdb_subnet_flags(sub));
|
net_buf_simple_add_u8(&pdu, bt_mesh_cdb_subnet_flags(sub));
|
||||||
net_buf_simple_add_be32(&pdu, bt_mesh_cdb.iv_index);
|
net_buf_simple_add_be32(&pdu, bt_mesh_cdb.iv_index);
|
||||||
net_buf_simple_add_be16(&pdu, bt_mesh_prov_link.addr);
|
net_buf_simple_add_be16(&pdu, bt_mesh_prov_link.addr);
|
||||||
net_buf_simple_add(&pdu, 8); /* For MIC */
|
net_buf_simple_add(&pdu, 8); /* For MIC */
|
||||||
|
|
||||||
LOG_DBG("net_idx %u, iv_index 0x%08x, addr 0x%04x",
|
LOG_DBG("net_idx %u, iv_index 0x%08x, addr 0x%04x",
|
||||||
prov_device.node->net_idx, bt_mesh.iv_index,
|
provisionee.node->net_idx, bt_mesh.iv_index,
|
||||||
bt_mesh_prov_link.addr);
|
bt_mesh_prov_link.addr);
|
||||||
|
|
||||||
err = bt_mesh_prov_encrypt(&session_key, nonce, &pdu.data[1],
|
err = bt_mesh_prov_encrypt(&session_key, nonce, &pdu.data[1],
|
||||||
|
|
@ -571,10 +571,10 @@ session_key_destructor:
|
||||||
|
|
||||||
static void prov_complete(const uint8_t *data)
|
static void prov_complete(const uint8_t *data)
|
||||||
{
|
{
|
||||||
struct bt_mesh_cdb_node *node = prov_device.node;
|
struct bt_mesh_cdb_node *node = provisionee.node;
|
||||||
|
|
||||||
LOG_DBG("key %s, net_idx %u, num_elem %u, addr 0x%04x",
|
LOG_DBG("key %s, net_idx %u, num_elem %u, addr 0x%04x",
|
||||||
bt_hex(&prov_device.new_dev_key, 16), node->net_idx,
|
bt_hex(&provisionee.new_dev_key, 16), node->net_idx,
|
||||||
node->num_elem, node->addr);
|
node->num_elem, node->addr);
|
||||||
|
|
||||||
bt_mesh_prov_link.expect = PROV_NO_PDU;
|
bt_mesh_prov_link.expect = PROV_NO_PDU;
|
||||||
|
|
@ -586,15 +586,15 @@ static void prov_complete(const uint8_t *data)
|
||||||
static void prov_node_add(void)
|
static void prov_node_add(void)
|
||||||
{
|
{
|
||||||
LOG_DBG("");
|
LOG_DBG("");
|
||||||
struct bt_mesh_cdb_node *node = prov_device.node;
|
struct bt_mesh_cdb_node *node = provisionee.node;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (atomic_test_bit(bt_mesh_prov_link.flags, REPROVISION)) {
|
if (atomic_test_bit(bt_mesh_prov_link.flags, REPROVISION)) {
|
||||||
bt_mesh_cdb_node_update(node, bt_mesh_prov_link.addr,
|
bt_mesh_cdb_node_update(node, bt_mesh_prov_link.addr,
|
||||||
prov_device.elem_count);
|
provisionee.elem_count);
|
||||||
}
|
}
|
||||||
|
|
||||||
err = bt_mesh_cdb_node_key_import(node, prov_device.new_dev_key);
|
err = bt_mesh_cdb_node_key_import(node, provisionee.new_dev_key);
|
||||||
if (err) {
|
if (err) {
|
||||||
LOG_ERR("Failed to import node device key");
|
LOG_ERR("Failed to import node device key");
|
||||||
return;
|
return;
|
||||||
|
|
@ -604,7 +604,7 @@ static void prov_node_add(void)
|
||||||
bt_mesh_cdb_node_store(node);
|
bt_mesh_cdb_node_store(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
prov_device.node = NULL;
|
provisionee.node = NULL;
|
||||||
|
|
||||||
if (bt_mesh_prov->node_added) {
|
if (bt_mesh_prov->node_added) {
|
||||||
bt_mesh_prov->node_added(node->net_idx, node->uuid, node->addr,
|
bt_mesh_prov->node_added(node->net_idx, node->uuid, node->addr,
|
||||||
|
|
@ -807,7 +807,7 @@ static int link_open(const uint8_t *uuid, const struct prov_bearer *bearer,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (uuid) {
|
if (uuid) {
|
||||||
memcpy(prov_device.uuid, uuid, 16);
|
memcpy(provisionee.uuid, uuid, 16);
|
||||||
|
|
||||||
struct bt_uuid_128 uuid_repr = { .uuid = { BT_UUID_TYPE_128 } };
|
struct bt_uuid_128 uuid_repr = { .uuid = { BT_UUID_TYPE_128 } };
|
||||||
|
|
||||||
|
|
@ -823,8 +823,8 @@ static int link_open(const uint8_t *uuid, const struct prov_bearer *bearer,
|
||||||
bt_mesh_prov_link.addr = addr;
|
bt_mesh_prov_link.addr = addr;
|
||||||
bt_mesh_prov_link.bearer = bearer;
|
bt_mesh_prov_link.bearer = bearer;
|
||||||
bt_mesh_prov_link.role = &role_provisioner;
|
bt_mesh_prov_link.role = &role_provisioner;
|
||||||
prov_device.net_idx = net_idx;
|
provisionee.net_idx = net_idx;
|
||||||
prov_device.attention_duration = attention_duration;
|
provisionee.attention_duration = attention_duration;
|
||||||
|
|
||||||
err = bt_mesh_prov_link.bearer->link_open(
|
err = bt_mesh_prov_link.bearer->link_open(
|
||||||
uuid, timeout, bt_mesh_prov_bearer_cb_get(), bearer_cb_data);
|
uuid, timeout, bt_mesh_prov_bearer_cb_get(), bearer_cb_data);
|
||||||
|
|
@ -877,15 +877,15 @@ static int reprovision_local_client_server(uint16_t addr)
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_DBG("net_idx %u iv_index 0x%08x, addr 0x%04x",
|
LOG_DBG("net_idx %u iv_index 0x%08x, addr 0x%04x",
|
||||||
prov_device.node->net_idx, bt_mesh_cdb.iv_index, addr);
|
provisionee.node->net_idx, bt_mesh_cdb.iv_index, addr);
|
||||||
|
|
||||||
atomic_set_bit(bt_mesh_prov_link.flags, REPROVISION);
|
atomic_set_bit(bt_mesh_prov_link.flags, REPROVISION);
|
||||||
atomic_set_bit(bt_mesh_prov_link.flags, PROVISIONER);
|
atomic_set_bit(bt_mesh_prov_link.flags, PROVISIONER);
|
||||||
bt_mesh_prov_link.addr = addr;
|
bt_mesh_prov_link.addr = addr;
|
||||||
bt_mesh_prov_link.bearer = &pb_remote_cli;
|
bt_mesh_prov_link.bearer = &pb_remote_cli;
|
||||||
bt_mesh_prov_link.role = &role_provisioner;
|
bt_mesh_prov_link.role = &role_provisioner;
|
||||||
prov_device.net_idx = prov_device.node->net_idx;
|
provisionee.net_idx = provisionee.node->net_idx;
|
||||||
prov_device.attention_duration = 0;
|
provisionee.attention_duration = 0;
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_BT_MESH_PROV_OOB_PUBLIC_KEY) &&
|
if (IS_ENABLED(CONFIG_BT_MESH_PROV_OOB_PUBLIC_KEY) &&
|
||||||
bt_mesh_prov->public_key_be && bt_mesh_prov->private_key_be) {
|
bt_mesh_prov->public_key_be && bt_mesh_prov->private_key_be) {
|
||||||
|
|
@ -908,13 +908,13 @@ static int reprovision_local_client_server(uint16_t addr)
|
||||||
LOG_DBG("DHkey: %s", bt_hex(bt_mesh_prov_link.dhkey, DH_KEY_SIZE));
|
LOG_DBG("DHkey: %s", bt_hex(bt_mesh_prov_link.dhkey, DH_KEY_SIZE));
|
||||||
|
|
||||||
err = bt_mesh_dev_key(bt_mesh_prov_link.dhkey,
|
err = bt_mesh_dev_key(bt_mesh_prov_link.dhkey,
|
||||||
bt_mesh_prov_link.prov_salt, prov_device.new_dev_key);
|
bt_mesh_prov_link.prov_salt, provisionee.new_dev_key);
|
||||||
if (err) {
|
if (err) {
|
||||||
LOG_ERR("Unable to generate device key");
|
LOG_ERR("Unable to generate device key");
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
bt_mesh_dev_key_cand(prov_device.new_dev_key);
|
bt_mesh_dev_key_cand(provisionee.new_dev_key);
|
||||||
/* Mark the link that was never opened as closed. */
|
/* Mark the link that was never opened as closed. */
|
||||||
atomic_set_bit(bt_mesh_prov_link.flags, COMPLETE);
|
atomic_set_bit(bt_mesh_prov_link.flags, COMPLETE);
|
||||||
bt_mesh_reprovision(addr);
|
bt_mesh_reprovision(addr);
|
||||||
|
|
@ -943,8 +943,8 @@ int bt_mesh_pb_remote_open_node(struct bt_mesh_rpr_cli *cli,
|
||||||
ctx.refresh = BT_MESH_RPR_NODE_REFRESH_DEVKEY;
|
ctx.refresh = BT_MESH_RPR_NODE_REFRESH_DEVKEY;
|
||||||
}
|
}
|
||||||
|
|
||||||
prov_device.node = bt_mesh_cdb_node_get(srv->addr);
|
provisionee.node = bt_mesh_cdb_node_get(srv->addr);
|
||||||
if (!prov_device.node) {
|
if (!provisionee.node) {
|
||||||
LOG_ERR("No CDB node for 0x%04x", srv->addr);
|
LOG_ERR("No CDB node for 0x%04x", srv->addr);
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
}
|
}
|
||||||
|
|
@ -954,7 +954,7 @@ int bt_mesh_pb_remote_open_node(struct bt_mesh_rpr_cli *cli,
|
||||||
return reprovision_local_client_server(addr);
|
return reprovision_local_client_server(addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
return link_open(NULL, &pb_remote_cli, prov_device.node->net_idx, addr,
|
return link_open(NULL, &pb_remote_cli, provisionee.node->net_idx, addr,
|
||||||
0, &ctx, 0);
|
0, &ctx, 0);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -771,7 +771,7 @@ static int cmd_provision_gatt(const struct shell *sh, size_t argc,
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_BT_MESH_PB_GATT_CLIENT */
|
#endif /* CONFIG_BT_MESH_PB_GATT_CLIENT */
|
||||||
|
|
||||||
#if defined(CONFIG_BT_MESH_PROV_DEVICE)
|
#if defined(CONFIG_BT_MESH_PROVISIONEE)
|
||||||
static int cmd_pb(bt_mesh_prov_bearer_t bearer, const struct shell *sh,
|
static int cmd_pb(bt_mesh_prov_bearer_t bearer, const struct shell *sh,
|
||||||
size_t argc, char *argv[])
|
size_t argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
|
@ -822,7 +822,7 @@ static int cmd_pb_gatt(const struct shell *sh, size_t argc, char *argv[])
|
||||||
return cmd_pb(BT_MESH_PROV_GATT, sh, argc, argv);
|
return cmd_pb(BT_MESH_PROV_GATT, sh, argc, argv);
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_BT_MESH_PB_GATT */
|
#endif /* CONFIG_BT_MESH_PB_GATT */
|
||||||
#endif /* CONFIG_BT_MESH_PROV_DEVICE */
|
#endif /* CONFIG_BT_MESH_PROVISIONEE */
|
||||||
|
|
||||||
#if defined(CONFIG_BT_MESH_PROVISIONER)
|
#if defined(CONFIG_BT_MESH_PROVISIONER)
|
||||||
static int cmd_remote_pub_key_set(const struct shell *sh, size_t argc, char *argv[])
|
static int cmd_remote_pub_key_set(const struct shell *sh, size_t argc, char *argv[])
|
||||||
|
|
@ -1681,14 +1681,14 @@ SHELL_STATIC_SUBCMD_SET_CREATE(
|
||||||
SHELL_CMD_ARG(comp-change, NULL, NULL, cmd_comp_change, 1, 0),
|
SHELL_CMD_ARG(comp-change, NULL, NULL, cmd_comp_change, 1, 0),
|
||||||
|
|
||||||
/* Provisioning operations */
|
/* Provisioning operations */
|
||||||
#if defined(CONFIG_BT_MESH_PROV_DEVICE)
|
#if defined(CONFIG_BT_MESH_PROVISIONEE)
|
||||||
#if defined(CONFIG_BT_MESH_PB_GATT)
|
#if defined(CONFIG_BT_MESH_PB_GATT)
|
||||||
SHELL_CMD_ARG(pb-gatt, NULL, "<Val(off, on)>", cmd_pb_gatt, 2, 0),
|
SHELL_CMD_ARG(pb-gatt, NULL, "<Val(off, on)>", cmd_pb_gatt, 2, 0),
|
||||||
#endif
|
#endif
|
||||||
#if defined(CONFIG_BT_MESH_PB_ADV)
|
#if defined(CONFIG_BT_MESH_PB_ADV)
|
||||||
SHELL_CMD_ARG(pb-adv, NULL, "<Val(off, on)>", cmd_pb_adv, 2, 0),
|
SHELL_CMD_ARG(pb-adv, NULL, "<Val(off, on)>", cmd_pb_adv, 2, 0),
|
||||||
#endif
|
#endif
|
||||||
#endif /* CONFIG_BT_MESH_PROV_DEVICE */
|
#endif /* CONFIG_BT_MESH_PROVISIONEE */
|
||||||
|
|
||||||
#if defined(CONFIG_BT_MESH_PROVISIONER)
|
#if defined(CONFIG_BT_MESH_PROVISIONER)
|
||||||
SHELL_CMD(auth-method, &auth_cmds, "Authentication methods", bt_mesh_shell_mdl_cmds_help),
|
SHELL_CMD(auth-method, &auth_cmds, "Authentication methods", bt_mesh_shell_mdl_cmds_help),
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ CONFIG_BT_MESH_LABEL_COUNT=3
|
||||||
CONFIG_BT_MESH_IV_UPDATE_TEST=y
|
CONFIG_BT_MESH_IV_UPDATE_TEST=y
|
||||||
CONFIG_BT_MESH_PB_ADV=y
|
CONFIG_BT_MESH_PB_ADV=y
|
||||||
CONFIG_BT_MESH_PROVISIONER=y
|
CONFIG_BT_MESH_PROVISIONER=y
|
||||||
CONFIG_BT_MESH_PROV_DEVICE=y
|
CONFIG_BT_MESH_PROVISIONEE=y
|
||||||
CONFIG_BT_MESH_CDB=y
|
CONFIG_BT_MESH_CDB=y
|
||||||
CONFIG_BT_MESH_CDB_NODE_COUNT=4
|
CONFIG_BT_MESH_CDB_NODE_COUNT=4
|
||||||
CONFIG_BT_MESH_PROV_OOB_PUBLIC_KEY=y
|
CONFIG_BT_MESH_PROV_OOB_PUBLIC_KEY=y
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ CONFIG_BT_MESH_LABEL_COUNT=3
|
||||||
CONFIG_BT_MESH_IV_UPDATE_TEST=y
|
CONFIG_BT_MESH_IV_UPDATE_TEST=y
|
||||||
CONFIG_BT_MESH_PB_ADV=y
|
CONFIG_BT_MESH_PB_ADV=y
|
||||||
CONFIG_BT_MESH_PROVISIONER=y
|
CONFIG_BT_MESH_PROVISIONER=y
|
||||||
CONFIG_BT_MESH_PROV_DEVICE=y
|
CONFIG_BT_MESH_PROVISIONEE=y
|
||||||
CONFIG_BT_MESH_CDB=y
|
CONFIG_BT_MESH_CDB=y
|
||||||
CONFIG_BT_MESH_CDB_NODE_COUNT=4
|
CONFIG_BT_MESH_CDB_NODE_COUNT=4
|
||||||
CONFIG_BT_MESH_PROV_OOB_PUBLIC_KEY=y
|
CONFIG_BT_MESH_PROV_OOB_PUBLIC_KEY=y
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue