Skip to content
Permalink
Browse files

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>
  • Loading branch information...
Vudentz authored and jhedberg committed Jun 19, 2019
1 parent eb8abda commit 3408bfe21176c12a763fa21a629ffffcfb382045
Showing with 5 additions and 1 deletion.
  1. +5 −1 subsys/bluetooth/shell/gatt.c
@@ -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,

0 comments on commit 3408bfe

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