Bluetooth: Mesh: add shell statistic commands
Commit adds commands to get and to clear the frame statistic. Signed-off-by: Aleksandr Khromykh <aleksandr.khromykh@nordicsemi.no>
This commit is contained in:
parent
7199425792
commit
9b4d080419
@ -1693,3 +1693,18 @@ The Solicitation PDU RPL Client model is an optional mesh subsystem that can be
|
||||
* ``RngStart``: Start address of the SSRC range.
|
||||
* ``Ackd``: This argument decides on whether an acknowledged or unacknowledged message will be sent.
|
||||
* ``RngLen``: Range length for the SSRC addresses to be cleared from the solicitiation RPL list. This parameter is optional; if absent, only a single SSRC address will be cleared.
|
||||
|
||||
|
||||
Frame statistic
|
||||
===============
|
||||
|
||||
``mesh stat get``
|
||||
-----------------
|
||||
|
||||
Get the frame statistic. The command prints numbers of received frames, as well as numbers of planned and succeeded transmission attempts.
|
||||
|
||||
|
||||
``mesh stat clear``
|
||||
-------------------
|
||||
|
||||
Clear all statistics collected before.
|
||||
|
||||
@ -1595,6 +1595,35 @@ static int cmd_appidx(const struct shell *sh, size_t argc, char *argv[])
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_BT_MESH_STATISTIC)
|
||||
static int cmd_stat_get(const struct shell *sh, size_t argc, char *argv[])
|
||||
{
|
||||
struct bt_mesh_statistic st;
|
||||
|
||||
bt_mesh_stat_get(&st);
|
||||
|
||||
shell_print(sh, "Received frames over:");
|
||||
shell_print(sh, "adv: %d", st.rx_adv);
|
||||
shell_print(sh, "loopback: %d", st.rx_loopback);
|
||||
shell_print(sh, "proxy: %d", st.rx_proxy);
|
||||
shell_print(sh, "unknown: %d", st.rx_uknown);
|
||||
|
||||
shell_print(sh, "Transmitted frames: <planned> - <succeeded>");
|
||||
shell_print(sh, "relay adv: %d - %d", st.tx_adv_relay_planned, st.tx_adv_relay_succeeded);
|
||||
shell_print(sh, "local adv: %d - %d", st.tx_local_planned, st.tx_local_succeeded);
|
||||
shell_print(sh, "friend: %d - %d", st.tx_friend_planned, st.tx_friend_succeeded);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cmd_stat_clear(const struct shell *sh, size_t argc, char *argv[])
|
||||
{
|
||||
bt_mesh_stat_reset();
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_BT_MESH_SHELL_CDB)
|
||||
SHELL_STATIC_SUBCMD_SET_CREATE(
|
||||
cdb_cmds,
|
||||
@ -1723,6 +1752,13 @@ SHELL_STATIC_SUBCMD_SET_CREATE(target_cmds,
|
||||
SHELL_CMD_ARG(app, NULL, "[AppKeyIdx]", cmd_appidx, 1, 1),
|
||||
SHELL_SUBCMD_SET_END);
|
||||
|
||||
#if defined(CONFIG_BT_MESH_STATISTIC)
|
||||
SHELL_STATIC_SUBCMD_SET_CREATE(stat_cmds,
|
||||
SHELL_CMD_ARG(get, NULL, NULL, cmd_stat_get, 1, 0),
|
||||
SHELL_CMD_ARG(clear, NULL, NULL, cmd_stat_clear, 1, 0),
|
||||
SHELL_SUBCMD_SET_END);
|
||||
#endif
|
||||
|
||||
/* Placeholder for model shell modules that is configured in the application */
|
||||
SHELL_SUBCMD_SET_CREATE(model_cmds, (mesh, models));
|
||||
|
||||
@ -1760,6 +1796,10 @@ SHELL_STATIC_SUBCMD_SET_CREATE(mesh_cmds,
|
||||
#endif
|
||||
SHELL_CMD(target, &target_cmds, "Target commands", bt_mesh_shell_mdl_cmds_help),
|
||||
|
||||
#if defined(CONFIG_BT_MESH_STATISTIC)
|
||||
SHELL_CMD(stat, &stat_cmds, "Statistic commands", bt_mesh_shell_mdl_cmds_help),
|
||||
#endif
|
||||
|
||||
SHELL_SUBCMD_SET_END
|
||||
);
|
||||
|
||||
|
||||
@ -78,3 +78,4 @@ CONFIG_BT_MESH_IV_UPDATE_TEST=y
|
||||
CONFIG_BT_MESH_LOG_LEVEL_DBG=y
|
||||
CONFIG_BT_MESH_CDB=y
|
||||
CONFIG_BT_MESH_PROVISIONER=y
|
||||
CONFIG_BT_MESH_STATISTIC=y
|
||||
|
||||
Loading…
Reference in New Issue
Block a user