gatt_client: Use ATT_READ_REQUEST for first blob of Read Long Characteristic

This commit is contained in:
Milanka Ringwald 2021-03-25 10:01:33 +01:00
parent 1167ff8389
commit 309522270a
3 changed files with 15 additions and 4 deletions

View File

@ -63,6 +63,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- HSP AG: emit HSP_SUBEVENT_BUTTON_PRESSED instead of audio connection setup/release
- Examples: use `btstack_event.h` getters instead of direct array access, use enum to compare status codes
- HCI Transport: extract convenience function declaration for h4, h5, em9304_spi, and usb into separate hci_transport_{type}.h
- GATT Client: Use ATT_READ_REQUEST for first blob of Read Long Characteristic
## Release v1.3.2

View File

@ -435,7 +435,11 @@ static void send_gatt_read_by_type_request(gatt_client_t * gatt_client){
}
static void send_gatt_read_blob_request(gatt_client_t *gatt_client){
att_read_blob_request(ATT_READ_BLOB_REQUEST, gatt_client->con_handle, gatt_client->attribute_handle, gatt_client->attribute_offset);
if (gatt_client->attribute_offset == 0){
att_read_request(ATT_READ_REQUEST, gatt_client->con_handle, gatt_client->attribute_handle);
} else {
att_read_blob_request(ATT_READ_BLOB_REQUEST, gatt_client->con_handle, gatt_client->attribute_handle, gatt_client->attribute_offset);
}
}
static void send_gatt_read_multiple_request(gatt_client_t * gatt_client){
@ -1460,6 +1464,12 @@ static void gatt_client_att_packet_handler(uint8_t packet_type, uint16_t handle,
emit_gatt_complete_event(gatt_client, ATT_ERROR_SUCCESS);
break;
}
// Use ATT_READ_REQUEST for first blob of Read Long Characteristic
case P_W4_READ_BLOB_RESULT:
report_gatt_long_characteristic_value_blob(gatt_client, gatt_client->attribute_handle, &packet[1], size - 1u, gatt_client->attribute_offset);
trigger_next_blob_query(gatt_client, P_W2_SEND_READ_BLOB_QUERY, size - 1u);
// GATT_EVENT_QUERY_COMPLETE is emitted by trigger_next_xxx when done
break;
default:
break;
}

View File

@ -438,7 +438,7 @@ uint8_t gatt_client_read_value_of_characteristics_by_uuid16(btstack_packet_handl
uint8_t gatt_client_read_value_of_characteristics_by_uuid128(btstack_packet_handler_t callback, hci_con_handle_t con_handle, uint16_t start_handle, uint16_t end_handle, uint8_t * uuid128);
/**
* @brief Reads the long characteristic value using the characteristic's value handle. The value will be returned in several blobs. For each blob, an le_characteristic_value_event_t with type set to GATT_EVENT_CHARACTERISTIC_VALUE_QUERY_RESULT and updated value offset will be generated and passed to the registered callback. The gatt_complete_event_t with type set to GATT_EVENT_QUERY_COMPLETE, mark the end of read.
* @brief Reads the long characteristic value using the characteristic's value handle. The value will be returned in several blobs. For each blob, an le_characteristic_value_event_t with type set to GATT_EVENT_LONG_CHARACTERISTIC_VALUE_QUERY_RESULT and updated value offset will be generated and passed to the registered callback. The gatt_complete_event_t with type set to GATT_EVENT_QUERY_COMPLETE, mark the end of read.
* @param callback
* @param con_handle
* @param characteristic
@ -449,7 +449,7 @@ uint8_t gatt_client_read_value_of_characteristics_by_uuid128(btstack_packet_hand
uint8_t gatt_client_read_long_value_of_characteristic(btstack_packet_handler_t callback, hci_con_handle_t con_handle, gatt_client_characteristic_t *characteristic);
/**
* @brief Reads the long characteristic value using the characteristic's value handle. The value will be returned in several blobs. For each blob, an le_characteristic_value_event_t with type set to GATT_EVENT_CHARACTERISTIC_VALUE_QUERY_RESULT and updated value offset will be generated and passed to the registered callback. The gatt_complete_event_t with type set to GATT_EVENT_QUERY_COMPLETE, mark the end of read.
* @brief Reads the long characteristic value using the characteristic's value handle. The value will be returned in several blobs. For each blob, an le_characteristic_value_event_t with type set to GATT_EVENT_LONG_CHARACTERISTIC_VALUE_QUERY_RESULT and updated value offset will be generated and passed to the registered callback. The gatt_complete_event_t with type set to GATT_EVENT_QUERY_COMPLETE, mark the end of read.
* @param callback
* @param con_handle
* @param characteristic_value_handle
@ -460,7 +460,7 @@ uint8_t gatt_client_read_long_value_of_characteristic(btstack_packet_handler_t c
uint8_t gatt_client_read_long_value_of_characteristic_using_value_handle(btstack_packet_handler_t callback, hci_con_handle_t con_handle, uint16_t characteristic_value_handle);
/**
* @brief Reads the long characteristic value using the characteristic's value handle. The value will be returned in several blobs. For each blob, an le_characteristic_value_event_t with type set to GATT_EVENT_CHARACTERISTIC_VALUE_QUERY_RESULT and updated value offset will be generated and passed to the registered callback. The gatt_complete_event_t with type set to GATT_EVENT_QUERY_COMPLETE, mark the end of read.
* @brief Reads the long characteristic value using the characteristic's value handle. The value will be returned in several blobs. For each blob, an le_characteristic_value_event_t with type set to GATT_EVENT_LONG_CHARACTERISTIC_VALUE_QUERY_RESULT and updated value offset will be generated and passed to the registered callback. The gatt_complete_event_t with type set to GATT_EVENT_QUERY_COMPLETE, mark the end of read.
* @param callback
* @param con_handle
* @param characteristic_value_handle