aboutsummaryrefslogtreecommitdiffstats
path: root/attrib/client.c
diff options
context:
space:
mode:
authorVinicius Costa Gomes <vinicius.gomes@openbossa.org>2010-08-10 19:27:06 -0300
committerVinicius Costa Gomes <vinicius.gomes@openbossa.org>2010-08-11 13:54:08 -0300
commit80c5a1887bc2023bcbb7aae23b096f9e5b419ef3 (patch)
treee109bfa428090d35179643e537cf1bb3630d8f95 /attrib/client.c
parentf70c6722f02613b0ed5167ad91fc4b5474fb69a4 (diff)
downloadbluez-80c5a1887bc2023bcbb7aae23b096f9e5b419ef3.tar.gz
bluez-80c5a1887bc2023bcbb7aae23b096f9e5b419ef3.tar.xz
bluez-80c5a1887bc2023bcbb7aae23b096f9e5b419ef3.zip
Fix reading the Characteristic value multiple times
We only need to read each characteristic value one time, for example, at the time that try to discover if that characteristic has any descriptor.
Diffstat (limited to 'attrib/client.c')
-rw-r--r--attrib/client.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/attrib/client.c b/attrib/client.c
index 8a7c98ec..110ff897 100644
--- a/attrib/client.c
+++ b/attrib/client.c
@@ -497,16 +497,13 @@ static void descriptor_cb(guint8 status, const guint8 *pdu, guint16 plen,
else if (uuid_desc16_cmp(&uuid, GATT_CHARAC_FMT_UUID) == 0)
gatt_read_char(gatt->attrib, handle,
update_char_format, chr);
-
- gatt_read_char(gatt->attrib, chr->handle, update_char_value,
- chr);
}
att_data_list_free(list);
g_free(current);
}
-static void find_all_descriptors(gpointer data, gpointer user_data)
+static void update_all_chars(gpointer data, gpointer user_data)
{
struct descriptor_data *current;
struct characteristic *chr = data;
@@ -518,6 +515,7 @@ static void find_all_descriptors(gpointer data, gpointer user_data)
gatt_find_info(gatt->attrib, chr->handle + 1, chr->end, descriptor_cb,
current);
+ gatt_read_char(gatt->attrib, chr->handle, update_char_value, chr);
}
static void char_discovered_cb(guint8 status, const guint8 *pdu, guint16 plen,
@@ -534,7 +532,7 @@ static void char_discovered_cb(guint8 status, const guint8 *pdu, guint16 plen,
store_characteristics(gatt, prim);
register_characteristics(prim);
- g_slist_foreach(prim->chars, find_all_descriptors, gatt);
+ g_slist_foreach(prim->chars, update_all_chars, gatt);
g_free(current);
return;
}