Skip to content

Commit

Permalink
Bluetooth: Mesh: Remove sequence number from bt_mesh_provision()
Browse files Browse the repository at this point in the history
The sequence number was acting as a stop-gap for missing persistent
storage. Now that we have the settings support in place it's no longer
needed.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
  • Loading branch information
jhedberg committed May 11, 2018
1 parent da82976 commit 88dfd39
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 12 deletions.
5 changes: 2 additions & 3 deletions include/bluetooth/mesh/main.h
Expand Up @@ -285,15 +285,14 @@ void bt_mesh_reset(void);
* @param net_idx Network Key Index
* @param flags Provisioning Flags
* @param iv_index IV Index
* @param seq Sequence Number (0 if newly provisioned).
* @param addr Primary element address
* @param dev_key Device Key
*
* @return Zero on success or (negative) error code otherwise.
*/
int bt_mesh_provision(const u8_t net_key[16], u16_t net_idx,
u8_t flags, u32_t iv_index, u32_t seq,
u16_t addr, const u8_t dev_key[16]);
u8_t flags, u32_t iv_index, u16_t addr,
const u8_t dev_key[16]);

/** @brief Toggle the IV Update test mode
*
Expand Down
2 changes: 1 addition & 1 deletion samples/bluetooth/mesh_demo/src/main.c
Expand Up @@ -197,7 +197,7 @@ static void bt_ready(int err)
settings_load();
}

err = bt_mesh_provision(net_key, net_idx, flags, iv_index, 0, addr,
err = bt_mesh_provision(net_key, net_idx, flags, iv_index, addr,
dev_key);
if (err == -EALREADY) {
printk("Using stored settings\n");
Expand Down
6 changes: 3 additions & 3 deletions subsys/bluetooth/host/mesh/main.c
Expand Up @@ -33,8 +33,8 @@
#include "mesh.h"

int bt_mesh_provision(const u8_t net_key[16], u16_t net_idx,
u8_t flags, u32_t iv_index, u32_t seq,
u16_t addr, const u8_t dev_key[16])
u8_t flags, u32_t iv_index, u16_t addr,
const u8_t dev_key[16])
{
int err;

Expand All @@ -55,7 +55,7 @@ int bt_mesh_provision(const u8_t net_key[16], u16_t net_idx,
return err;
}

bt_mesh.seq = seq;
bt_mesh.seq = 0;

bt_mesh_comp_provision(addr);

Expand Down
2 changes: 1 addition & 1 deletion subsys/bluetooth/host/mesh/prov.c
Expand Up @@ -1073,7 +1073,7 @@ static void prov_data(const u8_t *data)
identity_enable = false;
}

bt_mesh_provision(pdu, net_idx, flags, iv_index, 0, addr, dev_key);
bt_mesh_provision(pdu, net_idx, flags, iv_index, addr, dev_key);

/* After PB-GATT provisioning we should start advertising
* using Node Identity.
Expand Down
2 changes: 1 addition & 1 deletion subsys/bluetooth/host/mesh/shell.c
Expand Up @@ -1508,7 +1508,7 @@ static int cmd_provision(int argc, char *argv[])
iv_index = 0;
}

err = bt_mesh_provision(default_key, net_idx, 0, iv_index, 0, addr,
err = bt_mesh_provision(default_key, net_idx, 0, iv_index, addr,
default_key);
if (err) {
printk("Provisioning failed (err %d)\n", err);
Expand Down
4 changes: 1 addition & 3 deletions tests/bluetooth/tester/src/mesh.c
Expand Up @@ -29,7 +29,6 @@ static u8_t net_key[16];
static u16_t net_key_idx;
static u8_t flags;
static u32_t iv_index;
static u32_t seq_num;
static u16_t addr;
static u8_t dev_key[16];
static u8_t input_size;
Expand Down Expand Up @@ -411,7 +410,6 @@ static void provision_node(u8_t *data, u16_t len)
flags = cmd->flags;
iv_index = sys_le32_to_cpu(cmd->iv_index);
net_key_idx = sys_le16_to_cpu(cmd->net_key_idx);
seq_num = sys_le32_to_cpu(cmd->seq_num);

tester_rsp(BTP_SERVICE_ID_MESH, MESH_PROVISION_NODE,
CONTROLLER_INDEX, BTP_STATUS_SUCCESS);
Expand All @@ -433,7 +431,7 @@ static void init(u8_t *data, u16_t len)

if (addr) {
err = bt_mesh_provision(net_key, net_key_idx, flags, iv_index,
seq_num, addr, dev_key);
addr, dev_key);
if (err) {
status = BTP_STATUS_FAILED;
}
Expand Down

0 comments on commit 88dfd39

Please sign in to comment.