aboutsummaryrefslogtreecommitdiffstats
path: root/attrib/client.c
diff options
context:
space:
mode:
authorVinicius Costa Gomes <vinicius.gomes@openbossa.org>2010-09-10 17:50:00 -0300
committerAnderson Lizardo <anderson.lizardo@openbossa.org>2010-09-13 15:51:28 -0400
commit62b464cb5006c16da8af429cec3e76d974d864dd (patch)
tree3f571c1aff461229175c66e6bc2510c9c21dcb67 /attrib/client.c
parentf9352f3eb7640748fe46e35cbd28092a780d22b4 (diff)
downloadbluez-62b464cb5006c16da8af429cec3e76d974d864dd.tar.gz
bluez-62b464cb5006c16da8af429cec3e76d974d864dd.tar.xz
bluez-62b464cb5006c16da8af429cec3e76d974d864dd.zip
Fix not registering all characteristics for a service
Besides registering the characteristics when we receive the Attribute Not Found Error, we should also register the characteristics when we get to the end of the handle range contained in that service.
Diffstat (limited to 'attrib/client.c')
-rw-r--r--attrib/client.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/attrib/client.c b/attrib/client.c
index 3111922f..19930b3b 100644
--- a/attrib/client.c
+++ b/attrib/client.c
@@ -573,14 +573,8 @@ static void char_discovered_cb(guint8 status, const guint8 *pdu, guint16 plen,
uint16_t last, *previous_end = NULL;
int i;
- if (status == ATT_ECODE_ATTR_NOT_FOUND) {
- store_characteristics(gatt, prim);
- register_characteristics(prim);
-
- g_slist_foreach(prim->chars, update_all_chars, gatt);
- g_free(current);
- return;
- }
+ if (status == ATT_ECODE_ATTR_NOT_FOUND)
+ goto done;
if (status != 0) {
DBG("Discover all characteristics failed: %s",
@@ -628,12 +622,23 @@ static void char_discovered_cb(guint8 status, const guint8 *pdu, guint16 plen,
att_data_list_free(list);
+ if (last >= prim->end)
+ goto done;
+
/* Fetch remaining characteristics for the CURRENT primary service */
gatt_discover_char(gatt->attrib, last + 1, prim->end,
char_discovered_cb, current);
return;
+done:
+ store_characteristics(gatt, prim);
+ register_characteristics(prim);
+
+ g_slist_foreach(prim->chars, update_all_chars, gatt);
+ g_free(current);
+ return;
+
fail:
g_free(current);
gatt_service_free(gatt);