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