Bluetooth: Mesh: Add bt_mesh_provision_adv API
Add API for supporting provisioning of devices over PB-ADV. Signed-off-by: Tobias Svehagen <tobias.svehagen@gmail.com>
This commit is contained in:
parent
80669decce
commit
7e3f0c125a
2 changed files with 33 additions and 0 deletions
|
@ -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,
|
u8_t flags, u32_t iv_index, u16_t addr,
|
||||||
const u8_t dev_key[16]);
|
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.
|
/** @brief Check if the local node has been provisioned.
|
||||||
*
|
*
|
||||||
* This API can be used to check if the local node has been provisioned
|
* This API can be used to check if the local node has been provisioned
|
||||||
|
|
|
@ -88,6 +88,26 @@ int bt_mesh_provision(const u8_t net_key[16], u16_t net_idx,
|
||||||
return 0;
|
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)
|
void bt_mesh_reset(void)
|
||||||
{
|
{
|
||||||
if (!atomic_test_bit(bt_mesh.flags, BT_MESH_VALID)) {
|
if (!atomic_test_bit(bt_mesh.flags, BT_MESH_VALID)) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue