Bluetooth: Shell: Add bt security command to list current security level

The command could previously only set the security level.

Signed-off-by: Herman Berget <herman.berget@nordicsemi.no>
This commit is contained in:
Herman Berget 2022-06-03 15:40:14 +02:00 committed by Carles Cufí
commit a0ce235d9b

View file

@ -2589,6 +2589,12 @@ static int cmd_security(const struct shell *sh, size_t argc, char *argv[])
return -ENOEXEC;
}
if (argc < 2) {
shell_print(sh, "BT_SECURITY_L%d", bt_conn_get_security(default_conn));
return 0;
}
sec = *argv[1] - '0';
if ((info.type == BT_CONN_TYPE_BR &&
@ -3429,7 +3435,7 @@ SHELL_STATIC_SUBCMD_SET_CREATE(bt_cmds,
#if defined(CONFIG_BT_SMP) || defined(CONFIG_BT_BREDR)
SHELL_CMD_ARG(security, NULL, "<security level BR/EDR: 0 - 3, "
"LE: 1 - 4> [force-pair]",
cmd_security, 2, 1),
cmd_security, 1, 2),
SHELL_CMD_ARG(bondable, NULL, "<bondable: on, off>", cmd_bondable,
2, 0),
SHELL_CMD_ARG(bonds, NULL, HELP_NONE, cmd_bonds, 1, 0),