From a41449ef2a19a7a91c4eb9fb351ed9171bb34e51 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Fri, 24 Nov 2017 20:57:13 +0200 Subject: [PATCH] Bluetooth: Mesh: shell: Add iv-update command This command is needed to pass some IV Update-related PTS tests. Signed-off-by: Johan Hedberg --- subsys/bluetooth/host/mesh/shell.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/subsys/bluetooth/host/mesh/shell.c b/subsys/bluetooth/host/mesh/shell.c index 5f224474b8c..391b4c72fd0 100644 --- a/subsys/bluetooth/host/mesh/shell.c +++ b/subsys/bluetooth/host/mesh/shell.c @@ -660,6 +660,25 @@ static int cmd_net_send(int argc, char *argv[]) return 0; } +static int cmd_iv_update(int argc, char *argv[]) +{ + if (!bt_mesh_is_provisioned()) { + printk("Not yet provisioned!\n"); + return 0; + } + + if (bt_mesh.iv_update) { + printk("Transitioning to IV Update Normal state\n"); + bt_mesh_iv_update(bt_mesh.iv_index, false); + } else { + printk("Transitioning to IV Update In Progress state\n"); + bt_mesh_iv_update(bt_mesh.iv_index + 1, true); + printk("New IV Index 0x%08x\n", bt_mesh.iv_index); + } + + return 0; +} + static int cmd_beacon(int argc, char *argv[]) { u8_t status; @@ -1760,7 +1779,9 @@ static const struct shell_cmd mesh_commands[] = { { "netidx", cmd_netidx, "[NetIdx]" }, { "appidx", cmd_appidx, "[AppIdx]" }, + /* Commands which access internal APIs, for testing only */ { "net-send", cmd_net_send, "" }, + { "iv-update", cmd_iv_update, NULL }, /* Configuration Client Model operations */ { "get-comp", cmd_get_comp, "[page]" },