static void ccc_read_cb(guint8 status, const guint8 *pdu, guint16 len, gpointer user_data) { struct report *report = user_data; if (status != 0) { error("Error reading CCC value: %s", att_ecode2str(status)); return; } write_ccc(report->hog->attrib, report->ccc_handle, report); }
static void discover_descriptor_cb(guint8 status, const guint8 *pdu, guint16 len, gpointer user_data) { struct report *report; struct hog_device *hogdev; struct att_data_list *list; uint8_t format; int i; if (status != 0) { error("Discover all characteristic descriptors failed: %s", att_ecode2str(status)); return; } list = dec_find_info_resp(pdu, len, &format); if (list == NULL) return; if (format != ATT_FIND_INFO_RESP_FMT_16BIT) goto done; for (i = 0; i < list->num; i++) { uint16_t uuid16, handle; uint8_t *value; value = list->data[i]; handle = att_get_u16(value); uuid16 = att_get_u16(&value[2]); switch (uuid16) { case GATT_CLIENT_CHARAC_CFG_UUID: report = user_data; write_ccc(handle, report->hogdev); break; case GATT_REPORT_REFERENCE: report = user_data; gatt_read_char(report->hogdev->attrib, handle, report_reference_cb, report); break; case GATT_EXTERNAL_REPORT_REFERENCE: hogdev = user_data; gatt_read_char(hogdev->attrib, handle, external_report_reference_cb, hogdev); break; } } done: att_data_list_free(list); }
static void ccc_read_cb(guint8 status, const guint8 *pdu, guint16 len, gpointer user_data) { struct gatt_request *req = user_data; struct bt_bas *bas = req->user_data; destroy_gatt_req(req); if (status != 0) { error("Error reading CCC value: %s", att_ecode2str(status)); return; } write_ccc(bas, bas->attrib, bas->ccc_handle, bas); }
static void discover_descriptor_cb(uint8_t status, GSList *descs, void *user_data) { struct bt_scpp *scan = user_data; struct gatt_desc *desc; if (status != 0) { error("Discover descriptors failed: %s", att_ecode2str(status)); return; } /* There will be only one descriptor on list and it will be CCC */ desc = descs->data; write_ccc(scan, scan->attrib, desc->handle, scan); }
static void discover_descriptor_cb(uint8_t status, GSList *descs, void *user_data) { struct report *report; struct hog_device *hogdev; GAttrib *attrib = NULL; if (status != 0) { error("Discover all descriptors failed: %s", att_ecode2str(status)); return; } for ( ; descs; descs = descs->next) { struct gatt_desc *desc = descs->data; switch (desc->uuid16) { case GATT_CLIENT_CHARAC_CFG_UUID: report = user_data; write_ccc(desc->handle, report); break; case GATT_REPORT_REFERENCE: report = user_data; attrib = report->hogdev->attrib; gatt_read_char(attrib, desc->handle, report_reference_cb, report); break; case GATT_EXTERNAL_REPORT_REFERENCE: hogdev = user_data; attrib = hogdev->attrib; gatt_read_char(attrib, desc->handle, external_report_reference_cb, hogdev); break; } } }