Thread (28 messages) flat view 28 messages, 2 authors, 2012-09-28
STALE5059d

[PATCH BlueZ v1 8/8] scan: Avoid discover if scan handle is known

From: Claudio Takahasi <hidden>
Date: 2012-09-03 18:12:45
Subsystem: the rest · Maintainer: Linus Torvalds

This patch avoids the characteristic discovery for Scan Interval Window
if the attribute value handle was discovered on a previous interaction.
---
 profiles/scanparam/scan.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/profiles/scanparam/scan.c b/profiles/scanparam/scan.c
index 50fef43..491b50d 100644
--- a/profiles/scanparam/scan.c
+++ b/profiles/scanparam/scan.c
@@ -208,11 +208,16 @@ static void attio_connected_cb(GAttrib *attrib, gpointer user_data)
 	struct scan *scan = user_data;
 	bt_uuid_t iwin_uuid, refresh_uuid;
 
+	scan->attrib = g_attrib_ref(attrib);
+
+	if (scan->iwhandle) {
+		write_scan_params(scan->attrib, scan->iwhandle);
+		return;
+	}
+
 	bt_uuid16_create(&iwin_uuid, SCAN_INTERVAL_WIN_UUID);
 	bt_uuid16_create(&refresh_uuid, SCAN_REFRESH_UUID);
 
-	scan->attrib = g_attrib_ref(attrib);
-
 	gatt_discover_char(scan->attrib, scan->range.start, scan->range.end,
 					&iwin_uuid, iwin_discovered_cb, scan);
 
-- 
1.7.12
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help