diff --git a/profiles/heartrate/heartrate.c b/profiles/heartrate/heartrate.c
index 871b74e..81ff310 100644
--- a/profiles/heartrate/heartrate.c
+++ b/profiles/heartrate/heartrate.c
process_measurement(hr, pdu + 3, len - 3);
}
-static void ccc_write_cb(guint8 status, const guint8 *pdu, guint16 len,
- gpointer user_data)
-{
- struct heartrate *hr = user_data;
-
- if (status != 0) {
- error("Enable measurement failed");
- return;
- }
-
- hr->attionotid = g_attrib_register(hr->attrib, ATT_OP_HANDLE_NOTIFY,
- hr->measurement_val_handle,
- notify_handler, hr, NULL);
-}
-
static void discover_ccc_cb(guint8 status, const guint8 *pdu,
guint16 len, gpointer user_data)
{
uuid = att_get_u16(value + 2);
if (uuid == GATT_CLIENT_CHARAC_CFG_UUID) {
+ char *msg;
uint8_t value[2];
hr->measurement_ccc_handle = handle;
break;
att_put_u16(GATT_CLIENT_CHARAC_CFG_NOTIF_BIT, value);
+ msg = g_strdup("Enable measurement");
gatt_write_char(hr->attrib, handle, value,
- sizeof(value), ccc_write_cb, hr);
+ sizeof(value), char_write_cb, msg);
break;
}
hr->measurement_val_handle = c->value_handle;
+ hr->attionotid = g_attrib_register(hr->attrib,
+ ATT_OP_HANDLE_NOTIFY,
+ c->value_handle,
+ notify_handler, hr, NULL);
+
discover_measurement_ccc(hr, c, c_next);
} else if (g_strcmp0(c->uuid, BODY_SENSOR_LOCATION_UUID) == 0) {
DBG("Body Sensor Location supported");