Bluetooth: shell: gatt: Add discover command

This adds discover command which can be used to discover all attributes
using BT_GATT_DISCOVER_ATTRIBUTE:

uart:~$ gatt discover
Discover pending
Descriptor 2800 found: handle 1
Descriptor 2803 found: handle 2
Descriptor 2a00 found: handle 3
Descriptor 2803 found: handle 4
Descriptor 2a01 found: handle 5
Descriptor 2800 found: handle 6
Descriptor 2803 found: handle 7
Descriptor 2a05 found: handle 8
Descriptor 2902 found: handle 9
Descriptor 2803 found: handle a
Descriptor 2b29 found: handle b
Descriptor 2803 found: handle c
Descriptor 2b2a found: handle d
Descriptor 2803 found: handle e
Descriptor 2b2b found: handle f

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This commit is contained in:
Luiz Augusto von Dentz 2019-06-19 11:45:47 +03:00 committed by Johan Hedberg
commit 3408bfe211

View file

@ -178,7 +178,9 @@ static int cmd_discover(const struct shell *shell, size_t argc, char *argv[])
}
}
if (!strcmp(argv[0], "discover-secondary")) {
if (!strcmp(argv[0], "discover")) {
discover_params.type = BT_GATT_DISCOVER_ATTRIBUTE;
} else if (!strcmp(argv[0], "discover-secondary")) {
discover_params.type = BT_GATT_DISCOVER_SECONDARY;
} else if (!strcmp(argv[0], "discover-include")) {
discover_params.type = BT_GATT_DISCOVER_INCLUDE;
@ -1005,6 +1007,8 @@ static int cmd_set(const struct shell *shell, size_t argc, char *argv[])
SHELL_STATIC_SUBCMD_SET_CREATE(gatt_cmds,
#if defined(CONFIG_BT_GATT_CLIENT)
SHELL_CMD_ARG(discover, NULL,
"[UUID] [start handle] [end handle]", cmd_discover, 1, 3),
SHELL_CMD_ARG(discover-characteristic, NULL,
"[UUID] [start handle] [end handle]", cmd_discover, 1, 3),
SHELL_CMD_ARG(discover-descriptor, NULL,