From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ 1/4] core/gatt-client: Don't read extended properties
Date: Fri, 22 Apr 2016 14:42:34 +0300 [thread overview]
Message-ID: <1461325357-4013-1-git-send-email-luiz.dentz@gmail.com> (raw)
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Extended properties are already read and stored in the database and can be
retrieved with gatt_db_attribute_get_char_data.
---
src/gatt-client.c | 55 +++----------------------------------------------------
1 file changed, 3 insertions(+), 52 deletions(-)
diff --git a/src/gatt-client.c b/src/gatt-client.c
index ebb7b35..16a1f6c 100644
--- a/src/gatt-client.c
+++ b/src/gatt-client.c
@@ -71,7 +71,6 @@ struct service {
bt_uuid_t uuid;
char *path;
struct queue *chrcs;
- struct queue *pending_ext_props;
};
struct characteristic {
@@ -1283,7 +1282,8 @@ static struct characteristic *characteristic_create(
gatt_db_attribute_get_char_data(attr, &chrc->handle,
&chrc->value_handle,
- &chrc->props, NULL,
+ &chrc->props,
+ &chrc->ext_props,
&uuid);
chrc->attr = gatt_db_get_attribute(service->client->db,
@@ -1398,7 +1398,6 @@ static void service_free(void *data)
struct service *service = data;
queue_destroy(service->chrcs, NULL); /* List should be empty here */
- queue_destroy(service->pending_ext_props, NULL);
g_free(service->path);
free(service);
}
@@ -1412,7 +1411,6 @@ static struct service *service_create(struct gatt_db_attribute *attr,
service = new0(struct service, 1);
service->chrcs = queue_new();
- service->pending_ext_props = queue_new();
service->client = client;
gatt_db_attribute_get_service_data(attr, &service->start_handle,
@@ -1484,44 +1482,6 @@ static void export_desc(struct gatt_db_attribute *attr, void *user_data)
queue_push_tail(charac->descs, desc);
}
-static void read_ext_props_cb(bool success, uint8_t att_ecode,
- const uint8_t *value, uint16_t length,
- void *user_data)
-{
- struct characteristic *chrc = user_data;
- struct service *service = chrc->service;
-
- if (!success) {
- error("Failed to obtain extended properties - error: 0x%02x",
- att_ecode);
- return;
- }
-
- if (!value || length != 2) {
- error("Malformed extended properties value");
- return;
- }
-
- chrc->ext_props = get_le16(value);
- if (chrc->ext_props)
- g_dbus_emit_property_changed(btd_get_dbus_connection(),
- chrc->path,
- GATT_CHARACTERISTIC_IFACE,
- "Flags");
-
- queue_remove(service->pending_ext_props, chrc);
-}
-
-static void read_ext_props(void *data, void *user_data)
-{
- struct characteristic *chrc = data;
-
- bt_gatt_client_read_value(chrc->service->client->gatt,
- chrc->ext_props_handle,
- read_ext_props_cb,
- chrc, NULL);
-}
-
static bool create_descriptors(struct gatt_db_attribute *attr,
struct characteristic *charac)
{
@@ -1555,9 +1515,6 @@ static void export_char(struct gatt_db_attribute *attr, void *user_data)
queue_push_tail(service->chrcs, charac);
- if (charac->ext_props_handle)
- queue_push_tail(service->pending_ext_props, charac);
-
return;
fail:
@@ -1574,13 +1531,7 @@ static bool create_characteristics(struct gatt_db_attribute *attr,
gatt_db_service_foreach_char(attr, export_char, &data);
- if (data.failed)
- return false;
-
- /* Obtain extended properties */
- queue_foreach(service->pending_ext_props, read_ext_props, NULL);
-
- return true;
+ return !data.failed;
}
static void export_service(struct gatt_db_attribute *attr, void *user_data)
--
2.5.5
next reply other threads:[~2016-04-22 11:42 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-22 11:42 Luiz Augusto von Dentz [this message]
2016-04-22 11:42 ` [PATCH BlueZ 2/4] core/device: Remove code related to GattServices Luiz Augusto von Dentz
2016-04-22 11:42 ` [PATCH BlueZ 3/4] core/device: Fix not storing GATT attributes Luiz Augusto von Dentz
2016-04-22 11:42 ` [PATCH BlueZ 4/4] doc/settings-storage: Add alternative format for descriptors Luiz Augusto von Dentz
2016-04-29 10:07 ` [PATCH BlueZ 1/4] core/gatt-client: Don't read extended properties Luiz Augusto von Dentz
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=1461325357-4013-1-git-send-email-luiz.dentz@gmail.com \
--to=luiz.dentz@gmail.com \
--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).