auto-pts: more debug output for att_db

This commit is contained in:
Matthias Ringwald 2019-12-19 14:35:19 +01:00
parent 272b529870
commit e7733bf21d
2 changed files with 8 additions and 2 deletions

View File

@ -210,6 +210,7 @@ void att_set_db(uint8_t const * db){
log_error("ATT DB version differs, please regenerate .h from .gatt file or update att_db_util.c");
return;
}
log_info("att_set_db %p", db);
att_db = db;
}
@ -1494,12 +1495,17 @@ static uint8_t btp_permissions_for_flags(uint16_t flags){
}
uint16_t btp_att_get_attributes_by_uuid16(uint16_t start_handle, uint16_t end_handle, uint16_t uuid16, uint8_t * response_buffer, uint16_t response_buffer_size){
log_info("btp_att_get_attributes_by_uuid16 %04x from 0x%04x to 0x%04x, db %p", uuid16, start_handle, end_handle, att_db);
att_dump_attributes();
uint8_t num_attributes = 0;
uint16_t pos = 1;
att_iterator_t it;
att_iterator_init(&it);
while (att_iterator_has_next(&it) && ((pos + 6) < response_buffer_size)){
att_iterator_fetch_next(&it);
log_info("handle %04x", it.handle);
if (it.handle == 0) break;
if (it.handle < start_handle) continue;
if (it.handle > end_handle) break;

View File

@ -1079,7 +1079,7 @@ static void btp_gatt_handler(uint8_t opcode, uint8_t controller_index, uint16_t
}
break;
case BTP_GATT_OP_GET_ATTRIBUTE_VALUE:
MESSAGE("BTP_GATT_OP_GET_ATTRIBUTES");
MESSAGE("BTP_GATT_OP_GET_ATTRIBUTE_VALUE");
if (controller_index == 0) {
uint16_t attribute_handle = little_endian_read_16(data,7);
uint16_t response_len = btp_att_get_attribute_value(attribute_handle, response_buffer, sizeof(response_buffer));
@ -1326,7 +1326,7 @@ int btstack_main(int argc, const char * argv[])
uint8_t add_primary_svc_aa50[] = { BTP_GATT_SERVICE_TYPE_PRIMARY, 2, 0x50, 0xAA};
uint8_t add_characteristic_aa51[] = { 0, 0, ATT_PROPERTY_READ, BTP_GATT_PERM_READ, 2, 0x51, 0xaa};
uint8_t set_value_01[] = { 0x00, 0x00, 0x01, 0x00, 0x01 };
uint8_t get_attributes[] = { 0x00, 0x00, 0xff, 0xff, 0x02, 0x03, 0x28 };
uint8_t get_attributes[] = { 0x01, 0x00, 0xff, 0xff, 0x02, 0x03, 0x28 };
uint8_t get_attribute_value[] = { 0x00, 1,2,3,4,5,6, 0x01, 0x00 };
btp_packet_handler(BTP_SERVICE_ID_GATT, BTP_GATT_OP_ADD_SERVICE, 0, sizeof(add_primary_svc_aa50), add_primary_svc_aa50);
btp_packet_handler(BTP_SERVICE_ID_GATT, BTP_GATT_OP_ADD_CHARACTERISTIC, 0, sizeof(add_characteristic_aa51), add_characteristic_aa51);