diff --git a/include/bluetooth/mesh/main.h b/include/bluetooth/mesh/main.h index f86313b4bcf..43fa1d05cb0 100644 --- a/include/bluetooth/mesh/main.h +++ b/include/bluetooth/mesh/main.h @@ -353,6 +353,19 @@ int bt_mesh_provision(const u8_t net_key[16], u16_t net_idx, u8_t flags, u32_t iv_index, u16_t addr, const u8_t dev_key[16]); +/** @brief Provision a Mesh Node using PB-ADV + * + * @param uuid UUID + * @param net_idx Network Key Index + * @param addr Address to assign to remote device. If addr is 0, the lowest + * available address will be chosen. + * @param attention_duration The attention duration to be send to remote device + * + * @return Zero on success or (negative) error code otherwise. + */ +int bt_mesh_provision_adv(const u8_t uuid[16], u16_t net_idx, u16_t addr, + u8_t attention_duration); + /** @brief Check if the local node has been provisioned. * * This API can be used to check if the local node has been provisioned diff --git a/subsys/bluetooth/mesh/main.c b/subsys/bluetooth/mesh/main.c index dccd76b8ef2..1e36a96e720 100644 --- a/subsys/bluetooth/mesh/main.c +++ b/subsys/bluetooth/mesh/main.c @@ -88,6 +88,26 @@ int bt_mesh_provision(const u8_t net_key[16], u16_t net_idx, return 0; } +int bt_mesh_provision_adv(const u8_t uuid[16], u16_t net_idx, u16_t addr, + u8_t attention_duration) +{ + if (!atomic_test_bit(bt_mesh.flags, BT_MESH_VALID)) { + return -EINVAL; + } + + if (bt_mesh_subnet_get(net_idx) == NULL) { + return -EINVAL; + } + + if (IS_ENABLED(CONFIG_BT_MESH_PROVISIONER) && + IS_ENABLED(CONFIG_BT_MESH_PB_ADV)) { + return bt_mesh_pb_adv_open(uuid, net_idx, addr, + attention_duration); + } + + return -ENOTSUP; +} + void bt_mesh_reset(void) { if (!atomic_test_bit(bt_mesh.flags, BT_MESH_VALID)) {