static uint8_t get_char_extended_prop(const struct gatt_db_attribute *attrib) { uint16_t ext_prop; if (!attrib) return 0; if (bt_uuid_cmp(&characteristic_uuid, &attrib->uuid)) return 0; /* Check properties first */ if (!(attrib->value[0] & BT_GATT_CHRC_PROP_EXT_PROP)) return 0; ext_prop = 0; /* * Cast needed for foreach function. We do not change attrib during * this call */ gatt_db_service_foreach_desc((struct gatt_db_attribute *) attrib, read_ext_prop, &ext_prop); return ext_prop; }
static bool create_descriptors(struct gatt_db_attribute *attr, struct characteristic *charac) { struct export_data data; data.root = charac; data.failed = false; gatt_db_service_foreach_desc(attr, export_desc, &data); return !data.failed; }
static void print_chrc(struct gatt_db_attribute *attr, void *user_data) { uint16_t handle, value_handle; uint8_t properties; bt_uuid_t uuid; if (!gatt_db_attribute_get_char_data(attr, &handle, &value_handle, &properties, &uuid)) return; printf("\t " COLOR_YELLOW "charac" COLOR_OFF " - start: 0x%04x, value: 0x%04x, " "props: 0x%02x, uuid: ", handle, value_handle, properties); print_uuid(&uuid); gatt_db_service_foreach_desc(attr, print_desc, NULL); }