From: Jefferson Delfes <jefferson.delfes@openbossa.org>
To: linux-bluetooth@vger.kernel.org
Cc: Jefferson Delfes <jefferson.delfes@openbossa.org>
Subject: [PATCH v3 BlueZ 2/2] gatttool: Add "included" command
Date: Mon, 30 Jul 2012 11:24:35 -0400 [thread overview]
Message-ID: <1343661875-27700-3-git-send-email-jefferson.delfes@openbossa.org> (raw)
In-Reply-To: <1343661875-27700-1-git-send-email-jefferson.delfes@openbossa.org>
New command to find included services in interactive mode.
---
attrib/interactive.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 60 insertions(+)
diff --git a/attrib/interactive.c b/attrib/interactive.c
index 3657798..2bb44ee 100644
--- a/attrib/interactive.c
+++ b/attrib/interactive.c
@@ -209,6 +209,34 @@ static void primary_by_uuid_cb(GSList *ranges, guint8 status,
rl_forced_update_display();
}
+static void included_cb(GSList *includes, guint8 status, gpointer user_data)
+{
+ GSList *l;
+
+ if (status) {
+ printf("Find included services failed: %s\n",
+ att_ecode2str(status));
+ goto done;
+ }
+
+ if (includes == NULL) {
+ printf("No included services found for this range\n");
+ goto done;
+ }
+
+ printf("\n");
+ for (l = includes; l; l = l->next) {
+ struct gatt_included *incl = l->data;
+ printf("handle: 0x%04x, start handle: 0x%04x, "
+ "end handle: 0x%04x uuid: %s\n",
+ incl->handle, incl->range.start,
+ incl->range.end, incl->uuid);
+ }
+
+done:
+ rl_forced_update_display();
+}
+
static void char_cb(GSList *characteristics, guint8 status, gpointer user_data)
{
GSList *l;
@@ -426,6 +454,36 @@ static int strtohandle(const char *src)
return dst;
}
+static void cmd_included(int argcp, char **argvp)
+{
+ int start = 0x0001;
+ int end = 0xffff;
+
+ if (conn_state != STATE_CONNECTED) {
+ printf("Command failed: disconnected\n");
+ return;
+ }
+
+ if (argcp > 1) {
+ start = strtohandle(argvp[1]);
+ if (start < 0) {
+ printf("Invalid start handle: %s\n", argvp[1]);
+ return;
+ }
+ end = start;
+ }
+
+ if (argcp > 2) {
+ end = strtohandle(argvp[2]);
+ if (end < 0) {
+ printf("Invalid end handle: %s\n", argvp[2]);
+ return;
+ }
+ }
+
+ gatt_find_included(attrib, start, end, included_cb, NULL);
+}
+
static void cmd_char(int argcp, char **argvp)
{
int start = 0x0001;
@@ -752,6 +810,8 @@ static struct {
"Disconnect from a remote device" },
{ "primary", cmd_primary, "[UUID]",
"Primary Service Discovery" },
+ { "included", cmd_included, "[start hnd [end hnd]]",
+ "Find Included Services" },
{ "characteristics", cmd_char, "[start hnd [end hnd [UUID]]]",
"Characteristics Discovery" },
{ "char-desc", cmd_char_desc, "[start hnd] [end hnd]",
--
1.7.11.3
prev parent reply other threads:[~2012-07-30 15:24 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-04 20:45 [PATCH BlueZ 0/2] Add support for find included services Jefferson Delfes
2012-04-04 20:45 ` [PATCH BlueZ 1/2] GATT: " Jefferson Delfes
2012-04-12 9:51 ` Johan Hedberg
2012-04-04 20:45 ` [PATCH BlueZ 2/2] gatttool: Add "included" command Jefferson Delfes
2012-04-13 21:01 ` [PATCHv2 BlueZ 0/2] Add support for find included services Jefferson Delfes
2012-04-13 21:01 ` [PATCHv2 BlueZ 1/2] GATT: " Jefferson Delfes
2012-04-26 14:31 ` Johan Hedberg
2012-04-26 14:55 ` Jefferson Delfes
2012-04-13 21:01 ` [PATCHv2 BlueZ 2/2] gatttool: Add "included" command Jefferson Delfes
2012-04-26 13:35 ` [PATCHv2 BlueZ 0/2] Add support for find included services Jefferson Delfes
2012-07-30 15:24 ` [PATCH v3 " Jefferson Delfes
2012-07-30 15:24 ` [PATCH v3 BlueZ 1/2] GATT: " Jefferson Delfes
2012-07-30 15:24 ` Jefferson Delfes [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1343661875-27700-3-git-send-email-jefferson.delfes@openbossa.org \
--to=jefferson.delfes@openbossa.org \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).