[PATCH 08/11] thermometer: Discover descriptors using gatt_discover_desc

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 profiles/thermometer/thermometer.c | 28 +++++-----------------------
 1 file changed, 5 insertions(+), 23 deletions(-)

diff --git a/profiles/thermometer/thermometer.c b/profiles/thermometer/thermometer.c
index 20575c0..e3ab923 100644
--- a/profiles/thermometer/thermometer.c
+++ b/profiles/thermometer/thermometer.c
@@ -574,13 +574,9 @@ static void process_thermometer_desc(struct characteristic *ch, uint16_t uuid,
 							write_ccc_cb, msg);
 }
 
-static void discover_desc_cb(guint8 status, const guint8 *pdu, guint16 len,
-							gpointer user_data)
+static void discover_desc_cb(guint8 status, GSList *descs, gpointer user_data)
 {
 	struct characteristic *ch = user_data;
-	struct att_data_list *list = NULL;
-	uint8_t format;
-	int i;
 
 	if (status != 0) {
 		error("Discover all characteristic descriptors failed [%s]: %s",
@@ -588,27 +584,13 @@ static void discover_desc_cb(guint8 status, const guint8 *pdu, guint16 len,
 		goto done;
 	}
 
-	list = dec_find_info_resp(pdu, len, &format);
-	if (list == NULL)
-		goto done;
-
-	if (format != ATT_FIND_INFO_RESP_FMT_16BIT)
-		goto done;
-
-	for (i = 0; i < list->num; i++) {
-		uint8_t *value;
-		uint16_t handle, uuid;
-
-		value = list->data[i];
-		handle = get_le16(value);
-		uuid = get_le16(value + 2);
+	for ( ; descs; descs = descs->next) {
+		struct gatt_desc *desc = descs->data;
 
-		process_thermometer_desc(ch, uuid, handle);
+		process_thermometer_desc(ch, desc->uuid16, desc->handle);
 	}
 
 done:
-	if (list != NULL)
-		att_data_list_free(list);
 	g_free(ch);
 }
 
@@ -634,7 +616,7 @@ static void discover_desc(struct thermometer *t, struct gatt_char *c,
 	ch->t = t;
 	memcpy(ch->uuid, c->uuid, sizeof(c->uuid));
 
-	gatt_discover_char_desc(t->attrib, start, end, discover_desc_cb, ch);
+	gatt_discover_desc(t->attrib, start, end, NULL, discover_desc_cb, ch);
 }
 
 static void read_temp_type_cb(guint8 status, const guint8 *pdu, guint16 len,
-- 
1.9.2

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux