Skip to content
Permalink
Browse files

Bluetooth: shell: Add name command

name command can be used to read or write the GAP Device Name which is
used by the advertise command.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
  • Loading branch information...
Vudentz authored and jhedberg committed Jul 17, 2018
1 parent d1c4ce8 commit e9e511511635fa8171a5fef537238cf861395623
Showing with 19 additions and 0 deletions.
  1. +18 −0 subsys/bluetooth/shell/bt.c
  2. +1 −0 tests/bluetooth/shell/prj.conf
@@ -526,6 +526,23 @@ static int cmd_init(int argc, char *argv[])
return 0;
}

static int cmd_name(int argc, char *argv[])
{
int err;

if (argc < 2) {
printk("Bluetooth Local Name: %s\n", bt_get_name());
return 0;
}

err = bt_set_name(argv[1]);
if (err) {
printk("Unable to set name %s (err %d)", argv[1], err);
}

return 0;
}

static void cmd_active_scan_on(int dups)
{
int err;
@@ -1909,6 +1926,7 @@ static int cmd_bredr_sdp_find_record(int argc, char *argv[])

static const struct shell_cmd bt_commands[] = {
{ "init", cmd_init, HELP_ADDR_LE },
{ "name", cmd_name, "[name]" },
{ "scan", cmd_scan,
"<value: on, passive, off> <dup filter: dups, nodups>" },
{ "advertise", cmd_advertise,
@@ -17,6 +17,7 @@ CONFIG_BT_TINYCRYPT_ECC=y
CONFIG_CONSOLE_SHELL=y
CONFIG_BT_SHELL=y
CONFIG_BT_DEVICE_NAME="test shell"
CONFIG_BT_DEVICE_NAME_MAX=28
CONFIG_BT_L2CAP_TX_BUF_COUNT=6

CONFIG_BT_SETTINGS=y

0 comments on commit e9e5115

Please sign in to comment.
You can’t perform that action at this time.