gatt_client: add gatt_client_read_long_value_of_characteristic_using_value_handle_with_context

This commit is contained in:
Matthias Ringwald 2024-08-27 14:18:11 +02:00
parent b538fb896c
commit 691e02c222
2 changed files with 33 additions and 1 deletions

View File

@ -2774,9 +2774,23 @@ uint8_t gatt_client_read_long_value_of_characteristic_using_value_handle_with_of
gatt_client_run(); gatt_client_run();
return ERROR_CODE_SUCCESS; return ERROR_CODE_SUCCESS;
} }
uint8_t gatt_client_read_long_value_of_characteristic_using_value_handle_with_context(btstack_packet_handler_t callback,
hci_con_handle_t con_handle, uint16_t value_handle,
uint16_t service_id, uint16_t connection_id){
// TODO: move into gatt_client_read_long_value_of_characteristic_using_value_handle_with_offset once
// gatt_client_read_long_value_of_characteristic_using_value_handle_with_offset_and_context exists
gatt_client_t * gatt_client;
uint8_t status = gatt_client_provide_context_for_request(con_handle, &gatt_client);
if (status != ERROR_CODE_SUCCESS){
return status;
}
gatt_client->service_id = service_id;
gatt_client->connection_id = connection_id;
return gatt_client_read_long_value_of_characteristic_using_value_handle_with_offset(callback, con_handle, value_handle, 0);
}
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 value_handle){ 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 value_handle){
return gatt_client_read_long_value_of_characteristic_using_value_handle_with_offset(callback, con_handle, value_handle, 0); return gatt_client_read_long_value_of_characteristic_using_value_handle_with_context(callback, con_handle, value_handle, 0, 0);
} }
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){ 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){

View File

@ -729,6 +729,24 @@ 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 value_handle); 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 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, a GATT_EVENT_LONG_CHARACTERISTIC_VALUE_QUERY_RESULT event with updated value offset will be emitted.
* The GATT_EVENT_QUERY_COMPLETE event marks the end of read.
* @param callback
* @param con_handle
* @param value_handle
* @param service_id - context provided to callback in events
* @param connection_id - contest provided to callback in events
* @return status BTSTACK_MEMORY_ALLOC_FAILED, if no GATT client for con_handle is found
* GATT_CLIENT_IN_WRONG_STATE , if GATT client is not ready
* ERROR_CODE_SUCCESS , if query is successfully registered
*/
uint8_t gatt_client_read_long_value_of_characteristic_using_value_handle_with_context(btstack_packet_handler_t callback,
hci_con_handle_t con_handle, uint16_t value_handle,
uint16_t service_id, uint16_t connection_id);
/** /**
* @brief Reads the long characteristic value using the characteristic's value handle. * @brief Reads the long characteristic value using the characteristic's value handle.
* The value will be returned in several blobs. * The value will be returned in several blobs.