diff --git a/ble/gatt_client.c b/ble/gatt_client.c index b5bf6f772..aa2d71210 100644 --- a/ble/gatt_client.c +++ b/ble/gatt_client.c @@ -1392,21 +1392,24 @@ le_command_status_t gatt_client_read_value_of_characteristic(uint16_t gatt_clien return gatt_client_read_value_of_characteristic_using_value_handle(gatt_client_id, handle, characteristic->value_handle); } - -le_command_status_t gatt_client_read_long_value_of_characteristic_using_value_handle(uint16_t gatt_client_id, uint16_t con_handle, uint16_t value_handle){ +le_command_status_t gatt_client_read_long_value_of_characteristic_using_value_handle_with_offset(uint16_t gatt_client_id, uint16_t con_handle, uint16_t characteristic_value_handle, uint16_t offset){ gatt_client_t * peripheral = provide_context_for_conn_handle_and_start_timer(con_handle); if (!peripheral) return (le_command_status_t) BTSTACK_MEMORY_ALLOC_FAILED; if (!is_ready(peripheral)) return BLE_PERIPHERAL_IN_WRONG_STATE; peripheral->subclient_id = gatt_client_id; - peripheral->attribute_handle = value_handle; - peripheral->attribute_offset = 0; + peripheral->attribute_handle = characteristic_value_handle; + peripheral->attribute_offset = offset; peripheral->gatt_client_state = P_W2_SEND_READ_BLOB_QUERY; gatt_client_run(); return BLE_PERIPHERAL_OK; } +le_command_status_t gatt_client_read_long_value_of_characteristic_using_value_handle(uint16_t gatt_client_id, uint16_t con_handle, uint16_t characteristic_value_handle){ + return gatt_client_read_long_value_of_characteristic_using_value_handle_with_offset(gatt_client_id, con_handle, characteristic_value_handle, 0); +} + le_command_status_t gatt_client_read_long_value_of_characteristic(uint16_t gatt_client_id, uint16_t handle, le_characteristic_t *characteristic){ return gatt_client_read_long_value_of_characteristic_using_value_handle(gatt_client_id, handle, characteristic->value_handle); } @@ -1514,7 +1517,6 @@ le_command_status_t gatt_client_read_characteristic_descriptor_using_descriptor_ le_command_status_t gatt_client_read_characteristic_descriptor(uint16_t gatt_client_id, uint16_t con_handle, le_characteristic_descriptor_t * descriptor){ return gatt_client_read_characteristic_descriptor_using_descriptor_handle(gatt_client_id, con_handle, descriptor->handle); - gatt_client_t * peripheral = provide_context_for_conn_handle_and_start_timer(con_handle); } le_command_status_t gatt_client_read_long_characteristic_descriptor_using_descriptor_handler(uint16_t gatt_client_id, uint16_t con_handle, uint16_t descriptor_handle){ @@ -1533,7 +1535,6 @@ le_command_status_t gatt_client_read_long_characteristic_descriptor_using_descri le_command_status_t gatt_client_read_long_characteristic_descriptor(uint16_t gatt_client_id, uint16_t con_handle, le_characteristic_descriptor_t * descriptor){ return gatt_client_read_long_characteristic_descriptor_using_descriptor_handler(gatt_client_id, con_handle, descriptor->handle); - gatt_client_t * peripheral = provide_context_for_conn_handle_and_start_timer(con_handle); } le_command_status_t gatt_client_write_characteristic_descriptor(uint16_t gatt_client_id, uint16_t con_handle, le_characteristic_descriptor_t * descriptor, uint16_t length, uint8_t * value){ diff --git a/ble/gatt_client.h b/ble/gatt_client.h index 000b0ee55..bc38c34b7 100644 --- a/ble/gatt_client.h +++ b/ble/gatt_client.h @@ -304,6 +304,7 @@ le_command_status_t gatt_client_read_value_of_characteristic_using_value_handle( */ le_command_status_t gatt_client_read_long_value_of_characteristic(uint16_t gatt_client_id, uint16_t con_handle, le_characteristic_t *characteristic); le_command_status_t gatt_client_read_long_value_of_characteristic_using_value_handle(uint16_t gatt_client_id, uint16_t con_handle, uint16_t characteristic_value_handle); +le_command_status_t gatt_client_read_long_value_of_characteristic_using_value_handle_with_offset(uint16_t gatt_client_id, uint16_t con_handle, uint16_t characteristic_value_handle, uint16_t offset); /** * @brief Writes the characteristic value using the characteristic's value handle without an acknowledgment that the write was successfully performed.