Thread (18 messages) flat view 18 messages, 2 authors, 2012-09-21

Re: [PATCH v6 08/13] heartrate: Add support to enable notifications

From: Johan Hedberg <hidden>
Date: 2012-09-21 13:42:00

Hi Andrzej,

On Thu, Sep 20, 2012, Andrzej Kaczmarek wrote:
quoted hunk ↗ jump to hunk
@@ -238,6 +249,18 @@ static void discover_ccc_cb(guint8 status, const guint8 *pdu,
 
 		if (uuid == GATT_CLIENT_CHARAC_CFG_UUID) {
 			hr->measurement_ccc_handle = handle;
+
+			if (g_slist_length(hr->hradapter->watchers) > 0) {
+				uint8_t value[2];
+				char *msg;
+
+				att_put_u16(GATT_CLIENT_CHARAC_CFG_NOTIF_BIT,
+									value);
+				msg = g_strdup("Enable measurement");
+
+				gatt_write_char(hr->attrib, handle, value,
+					sizeof(value), char_write_cb, msg);
+			}
 			break;
 		}
Seems like you could avoid the extra indentation above by inverting the
g_slist_length test:

	if (g_slist_length(hr->hradapter->watchers) == 0)
		break;

	...
	break;
 	g_dbus_remove_watch(conn, watcher->id);
+
+
+	if (g_slist_length(hradapter->watchers) == 0)
Two consecutive empty lines should never be needed. Please remove one.

Johan
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help