Bluetooth: shell: Add phy procedure options to the shell

Add command line options to set the PHY options coding schemed and
no preference.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
This commit is contained in:
Joakim Andersson 2020-05-12 12:09:32 +02:00 committed by Carles Cufí
commit 0f67f6cb72

View file

@ -1568,10 +1568,19 @@ static int cmd_conn_phy_update(const struct shell *shell, size_t argc,
int err; int err;
param.pref_tx_phy = strtoul(argv[1], NULL, 16); param.pref_tx_phy = strtoul(argv[1], NULL, 16);
if (argc > 2) { param.pref_rx_phy = param.pref_tx_phy;
param.pref_rx_phy = strtoul(argv[2], NULL, 16); param.options = BT_CONN_LE_PHY_OPT_NONE;
} else {
param.pref_rx_phy = param.pref_tx_phy; for (size_t argn = 2; argn < argc; argn++) {
const char *arg = argv[argn];
if (!strcmp(arg, "s2")) {
param.options |= BT_CONN_LE_PHY_OPT_CODED_S2;
} else if (!strcmp(arg, "s8")) {
param.options |= BT_CONN_LE_PHY_OPT_CODED_S8;
} else {
param.pref_rx_phy = strtoul(arg, NULL, 16);
}
} }
err = bt_conn_le_phy_update(default_conn, &param); err = bt_conn_le_phy_update(default_conn, &param);
@ -2431,8 +2440,8 @@ SHELL_STATIC_SUBCMD_SET_CREATE(bt_cmds,
cmd_conn_data_len_update, 2, 1), cmd_conn_data_len_update, 2, 1),
#endif #endif
#if defined(CONFIG_BT_USER_PHY_UPDATE) #if defined(CONFIG_BT_USER_PHY_UPDATE)
SHELL_CMD_ARG(phy-update, NULL, "<tx_phy> [rx_phy]", SHELL_CMD_ARG(phy-update, NULL, "<tx_phy> [rx_phy] [s2] [s8]",
cmd_conn_phy_update, 2, 1), cmd_conn_phy_update, 2, 3),
#endif #endif
#if defined(CONFIG_BT_CENTRAL) #if defined(CONFIG_BT_CENTRAL)
SHELL_CMD_ARG(channel-map, NULL, "<channel-map: XXXXXXXXXX> (36-0)", SHELL_CMD_ARG(channel-map, NULL, "<channel-map: XXXXXXXXXX> (36-0)",