diff options
author | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2018-05-07 18:41:10 +0300 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2018-05-24 11:09:30 +0300 |
commit | 4f68e5f1fe89702e0fddb69b65ead76499f70d8a (patch) | |
tree | c13743b53b6abb1276c3e4c9324115bd9c5dc8c1 /client/main.c | |
parent | eca59ac27890843248e764c59ea1b844173d5c63 (diff) | |
download | bluez-4f68e5f1fe89702e0fddb69b65ead76499f70d8a.tar.gz |
client: Add advertise.discoverable command
This adds advertise.discoverable command which can be used to set it
own instance:
[bluetooth]# advertise.discoverable on
[bluetooth]# advertise on
@ MGMT Command: Add Advertising (0x003e) plen 14
Instance: 1
Flags: 0x00000001
Switch into Connectable mode
Duration: 0
Timeout: 0
Advertising data length: 3
Flags: 0x02
LE General Discoverable Mode
Scan response length: 0
< HCI Command: LE Set Advertising Data (0x08|0x0008) plen 32
Length: 3
Flags: 0x02
LE General Discoverable Mode
Diffstat (limited to 'client/main.c')
-rw-r--r-- | client/main.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/client/main.c b/client/main.c index 52d807946..26ce94947 100644 --- a/client/main.c +++ b/client/main.c @@ -2213,6 +2213,21 @@ static void cmd_advertise_data(int argc, char *argv[]) ad_advertise_data(dbus_conn, argc, argv); } +static void cmd_advertise_discoverable(int argc, char *argv[]) +{ + dbus_bool_t discoverable; + + if (argc < 2) { + ad_advertise_discoverable(dbus_conn, NULL); + return; + } + + if (!parse_argument(argc, argv, NULL, NULL, &discoverable, NULL)) + return bt_shell_noninteractive_quit(EXIT_FAILURE); + + ad_advertise_discoverable(dbus_conn, &discoverable); +} + static void cmd_advertise_tx_power(int argc, char *argv[]) { dbus_bool_t powered; @@ -2403,6 +2418,8 @@ static const struct bt_shell_menu advertise_menu = { "Set/Get advertise manufacturer data" }, { "data", "[type] [data=xx xx ...]", cmd_advertise_data, "Set/Get advertise data" }, + { "discoverable", "[on/off]", cmd_advertise_discoverable, + "Set/Get advertise discoverable" }, { "tx-power", "[on/off]", cmd_advertise_tx_power, "Show/Enable/Disable TX power to be advertised", NULL }, |