add gatt_client_read_characteristic_descriptor_using_descriptor_handle and gatt_client_read_long_characteristic_descriptor_using_descriptor_handler

This commit is contained in:
Matthias Ringwald 2015-10-01 21:09:23 +02:00
parent 00e1247f81
commit 62b9b53a36
2 changed files with 16 additions and 8 deletions

View File

@ -1498,38 +1498,44 @@ le_command_status_t gatt_client_write_client_characteristic_configuration(uint16
return BLE_PERIPHERAL_OK;
}
le_command_status_t gatt_client_read_characteristic_descriptor(uint16_t gatt_client_id, uint16_t con_handle, le_characteristic_descriptor_t * descriptor){
le_command_status_t gatt_client_read_characteristic_descriptor_using_descriptor_handle(uint16_t gatt_client_id, uint16_t con_handle, uint16_t descriptor_handle){
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 = descriptor->handle;
peripheral->uuid16 = descriptor->uuid16;
if (!descriptor->uuid16){
memcpy(peripheral->uuid128, descriptor->uuid128, 16);
}
peripheral->attribute_handle = descriptor_handle;
peripheral->gatt_client_state = P_W2_SEND_READ_CHARACTERISTIC_DESCRIPTOR_QUERY;
gatt_client_run();
return BLE_PERIPHERAL_OK;
}
le_command_status_t gatt_client_read_long_characteristic_descriptor(uint16_t gatt_client_id, uint16_t con_handle, le_characteristic_descriptor_t * 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){
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 = descriptor->handle;
peripheral->attribute_handle = descriptor_handle;
peripheral->attribute_offset = 0;
peripheral->gatt_client_state = P_W2_SEND_READ_BLOB_CHARACTERISTIC_DESCRIPTOR_QUERY;
gatt_client_run();
return BLE_PERIPHERAL_OK;
}
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){
gatt_client_t * peripheral = provide_context_for_conn_handle_and_start_timer(con_handle);

View File

@ -330,11 +330,13 @@ le_command_status_t gatt_client_reliable_write_long_value_of_characteristic(uint
* @brief Reads the characteristic descriptor using its handle. If the characteristic descriptor is found, an le_characteristic_descriptor_event_t with type set to GATT_CHARACTERISTIC_DESCRIPTOR_QUERY_RESULT will be generated and passed to the registered callback. The gatt_complete_event_t with type set to GATT_QUERY_COMPLETE, marks the end of read.
*/
le_command_status_t gatt_client_read_characteristic_descriptor(uint16_t gatt_client_id, uint16_t con_handle, le_characteristic_descriptor_t * descriptor);
le_command_status_t gatt_client_read_characteristic_descriptor_using_descriptor_handle(uint16_t gatt_client_id, uint16_t con_handle, uint16_t descriptor_handle);
/**
* @brief Reads the long characteristic descriptor using its handle. It will be returned in several blobs. For each blob, an le_characteristic_descriptor_event_t with type set to GATT_CHARACTERISTIC_DESCRIPTOR_QUERY_RESULT will be generated and passed to the registered callback. The gatt_complete_event_t with type set to GATT_QUERY_COMPLETE, marks the end of read.
*/
le_command_status_t gatt_client_read_long_characteristic_descriptor(uint16_t gatt_client_id, uint16_t con_handle, le_characteristic_descriptor_t * descriptor);
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);
/**
* @brief Writes the characteristic descriptor using its handle. The gatt_complete_event_t with type set to GATT_QUERY_COMPLETE, marks the end of write. The write is successfully performed, if the event's status field is set to 0.