mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-04-17 11:42:34 +00:00
gatt_client: add gatt_client_write_value_of_characteristic_with_context
This commit is contained in:
parent
cb5b2b64b6
commit
b444aa754d
@ -2817,8 +2817,8 @@ uint8_t gatt_client_write_value_of_characteristic_without_response(hci_con_handl
|
||||
|
||||
return att_write_request(gatt_client, ATT_WRITE_COMMAND, value_handle, value_length, value);
|
||||
}
|
||||
|
||||
uint8_t gatt_client_write_value_of_characteristic(btstack_packet_handler_t callback, hci_con_handle_t con_handle, uint16_t value_handle, uint16_t value_length, uint8_t * value){
|
||||
uint8_t gatt_client_write_value_of_characteristic_with_context(btstack_packet_handler_t callback, hci_con_handle_t con_handle, uint16_t value_handle,
|
||||
uint16_t value_length, uint8_t * value, uint16_t service_id, uint16_t connection_id){
|
||||
gatt_client_t * gatt_client;
|
||||
uint8_t status = gatt_client_provide_context_for_request(con_handle, &gatt_client);
|
||||
if (status != ERROR_CODE_SUCCESS){
|
||||
@ -2826,6 +2826,8 @@ uint8_t gatt_client_write_value_of_characteristic(btstack_packet_handler_t callb
|
||||
}
|
||||
|
||||
gatt_client->callback = callback;
|
||||
gatt_client->service_id = service_id;
|
||||
gatt_client->connection_id = connection_id;
|
||||
gatt_client->attribute_handle = value_handle;
|
||||
gatt_client->attribute_length = value_length;
|
||||
gatt_client->attribute_value = value;
|
||||
@ -2833,6 +2835,9 @@ uint8_t gatt_client_write_value_of_characteristic(btstack_packet_handler_t callb
|
||||
gatt_client_run();
|
||||
return ERROR_CODE_SUCCESS;
|
||||
}
|
||||
uint8_t gatt_client_write_value_of_characteristic(btstack_packet_handler_t callback, hci_con_handle_t con_handle, uint16_t value_handle, uint16_t value_length, uint8_t * value) {
|
||||
return gatt_client_write_value_of_characteristic_with_context(callback, con_handle, value_handle, value_length, value, 0, 0);
|
||||
}
|
||||
|
||||
uint8_t gatt_client_write_long_value_of_characteristic_with_offset(btstack_packet_handler_t callback, hci_con_handle_t con_handle, uint16_t value_handle, uint16_t offset, uint16_t value_length, uint8_t * value){
|
||||
gatt_client_t * gatt_client;
|
||||
|
@ -779,12 +779,13 @@ uint8_t gatt_client_write_value_of_characteristic_without_response(hci_con_handl
|
||||
* @param value_handle
|
||||
* @param message_len
|
||||
* @param message is not copied, make sure memory is accessible until write is done
|
||||
* @return status ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if no HCI connection for con_handle is found
|
||||
* @return status ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if no HCI connection for con_handle is found
|
||||
* BTSTACK_MEMORY_ALLOC_FAILED if no GATT client for con_handle could be allocated
|
||||
* GATT_CLIENT_IN_WRONG_STATE if GATT client is not ready
|
||||
* ERROR_CODE_SUCCESS if query is successfully registered
|
||||
*/
|
||||
uint8_t gatt_client_signed_write_without_response(btstack_packet_handler_t callback, hci_con_handle_t con_handle, uint16_t value_handle, uint16_t message_len, uint8_t * message);
|
||||
uint8_t gatt_client_signed_write_without_response(btstack_packet_handler_t callback, hci_con_handle_t con_handle, uint16_t value_handle,
|
||||
uint16_t message_len, uint8_t * message);
|
||||
|
||||
/**
|
||||
* @brief Writes the characteristic value using the characteristic's value handle.
|
||||
@ -804,6 +805,26 @@ uint8_t gatt_client_signed_write_without_response(btstack_packet_handler_t callb
|
||||
uint8_t gatt_client_write_value_of_characteristic(btstack_packet_handler_t callback, hci_con_handle_t con_handle, uint16_t value_handle, uint16_t value_length, uint8_t * value);
|
||||
|
||||
/**
|
||||
* @brief Writes the characteristic value using the characteristic's value handle.
|
||||
* The GATT_EVENT_QUERY_COMPLETE event marks the end of write.
|
||||
* The write is successfully performed, if the event's att_status field is set to
|
||||
* ATT_ERROR_SUCCESS (see bluetooth.h for ATT_ERROR codes).
|
||||
* @param callback
|
||||
* @param con_handle
|
||||
* @param value_handle
|
||||
* @param value_length
|
||||
* @param value is not copied, make sure memory is accessible until write is done, i.e. GATT_EVENT_QUERY_COMPLETE is received
|
||||
* @param service_id
|
||||
* @param connection_id
|
||||
* @return status ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER if no HCI connection for con_handle is found
|
||||
* BTSTACK_MEMORY_ALLOC_FAILED if no GATT client for con_handle could be allocated
|
||||
* GATT_CLIENT_IN_WRONG_STATE if GATT client is not ready
|
||||
* ERROR_CODE_SUCCESS if query is successfully registered
|
||||
*/
|
||||
uint8_t gatt_client_write_value_of_characteristic_with_context(btstack_packet_handler_t callback, hci_con_handle_t con_handle, uint16_t value_handle,
|
||||
uint16_t value_length, uint8_t * value, uint16_t service_id, uint16_t connection_id);
|
||||
|
||||
/**
|
||||
* @brief Writes the characteristic value using the characteristic's value handle.
|
||||
* The GATT_EVENT_QUERY_COMPLETE event marks the end of write.
|
||||
* The write is successfully performed if the event's att_status field is set to ATT_ERROR_SUCCESS (see bluetooth.h for ATT_ERROR codes).
|
||||
|
Loading…
x
Reference in New Issue
Block a user