From: Sheldon Demario <sheldon.demario@openbossa.org>
To: linux-bluetooth@vger.kernel.org
Cc: Sheldon Demario <sheldon.demario@openbossa.org>
Subject: [PATCH v3 4/7] Add Characteristics Descriptor Discovery option in interactive gatttool
Date: Thu, 24 Feb 2011 10:54:09 -0300 [thread overview]
Message-ID: <1298555649-5529-1-git-send-email-sheldon.demario@openbossa.org> (raw)
In-Reply-To: <1298328606-7993-1-git-send-email-sheldon.demario@openbossa.org>
---
Remove return statements at the end of void functions.
attrib/interactive.c | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 59 insertions(+), 0 deletions(-)
diff --git a/attrib/interactive.c b/attrib/interactive.c
index ed45894..b00d0bc 100644
--- a/attrib/interactive.c
+++ b/attrib/interactive.c
@@ -169,6 +169,47 @@ static void char_cb(GSList *characteristics, guint8 status, gpointer user_data)
rl_forced_update_display();
}
+static void char_desc_cb(guint8 status, const guint8 *pdu, guint16 plen,
+ gpointer user_data)
+{
+ struct att_data_list *list;
+ guint8 format;
+ int i;
+
+ if (status != 0) {
+ printf("Discover all characteristic descriptors failed: "
+ "%s\n", att_ecode2str(status));
+ return;
+ }
+
+ list = dec_find_info_resp(pdu, plen, &format);
+ if (list == NULL)
+ return;
+
+ printf("\n");
+ for (i = 0; i < list->num; i++) {
+ char uuidstr[MAX_LEN_UUID_STR];
+ uint16_t handle;
+ uint8_t *value;
+ uuid_t uuid;
+
+ value = list->data[i];
+ handle = att_get_u16(value);
+
+ if (format == 0x01)
+ sdp_uuid16_create(&uuid, att_get_u16(&value[2]));
+ else
+ sdp_uuid128_create(&uuid, &value[2]);
+
+ sdp_uuid2strn(&uuid, uuidstr, MAX_LEN_UUID_STR);
+ printf("handle: 0x%04x, uuid: %s\n", handle, uuidstr);
+ }
+
+ att_data_list_free(list);
+
+ rl_forced_update_display();
+}
+
static void cmd_exit(int argcp, char **argvp)
{
rl_callback_handler_remove();
@@ -287,6 +328,22 @@ static void cmd_char(int argcp, char **argvp)
return;
}
+static void cmd_char_desc(int argcp, char **argvp)
+{
+ int start = 0x0001;
+ int end = 0xffff;
+
+ if (conn_state != STATE_CONNECTED) {
+ printf("Command failed: disconnected\n");
+ return;
+ }
+
+ if (set_handles(&start, &end, argcp, argvp))
+ return;
+
+ gatt_find_info(attrib, start, end, char_desc_cb, NULL);
+}
+
static struct {
const char *cmd;
void (*func)(int argcp, char **argvp);
@@ -305,6 +362,8 @@ static struct {
"Primary Service Discovery" },
{ "characteristics", cmd_char, "[start hnd] [end hnd]",
"Characteristics Discovery" },
+ { "char-desc", cmd_char_desc, "[start hnd] [end hnd]",
+ "Characteristics Descriptor Discovery" },
{ NULL, NULL, NULL}
};
--
1.7.1
next prev parent reply other threads:[~2011-02-24 13:54 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-21 22:50 [PATCH 1/7] Improve help messages in interactive gatttool Sheldon Demario
2011-02-21 22:50 ` [PATCH 2/7] Add Characteristics Discovery option to " Sheldon Demario
2011-02-21 22:50 ` [PATCH 3/7] Create helper functions to deal with handles on " Sheldon Demario
2011-02-21 22:50 ` [PATCH 4/7] Add Characteristics Descriptor Discovery option in " Sheldon Demario
2011-02-21 22:50 ` [PATCH 5/7] Add characteristics read options " Sheldon Demario
2011-02-21 22:50 ` [PATCH 6/7] Move attr_data_from_string() to utils.c Sheldon Demario
2011-02-21 22:50 ` [PATCH 7/7] Add Write Request in interactive gatttool Sheldon Demario
2011-02-22 19:11 ` [PATCH v2 1/7] Improve help messages " Sheldon Demario
2011-02-22 19:11 ` [PATCH v2 2/7] Add Characteristics Discovery option to " Sheldon Demario
2011-02-22 19:12 ` [PATCH v2 3/7] Create helper functions to deal with handles on " Sheldon Demario
2011-02-23 3:09 ` Johan Hedberg
2011-02-23 12:21 ` Anderson Lizardo
2011-02-23 13:23 ` Sheldon Demario
2011-02-23 14:20 ` [PATCH v3 " Sheldon Demario
2011-02-22 19:12 ` [PATCH v2 4/7] Add Characteristics Descriptor Discovery option in " Sheldon Demario
2011-02-22 19:12 ` [PATCH v2 5/7] Add characteristics read options " Sheldon Demario
2011-02-22 19:12 ` [PATCH v2 6/7] Move attr_data_from_string() to utils.c Sheldon Demario
2011-02-22 19:12 ` [PATCH v2 7/7] Add Write Request in interactive gatttool Sheldon Demario
2011-02-24 13:54 ` Sheldon Demario [this message]
2011-02-24 13:55 ` [PATCH v3 5/7] Add characteristics read options " Sheldon Demario
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=1298555649-5529-1-git-send-email-sheldon.demario@openbossa.org \
--to=sheldon.demario@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