gatt_client: add service/connection id to GATT_EVENT_ALL_CHARACTERISTIC_DESCRIPTORS_QUERY_RESULT

This commit is contained in:
Matthias Ringwald 2024-08-26 10:50:42 +02:00
parent 185497a5c5
commit 5a6c9e2aa2
3 changed files with 26 additions and 4 deletions

View File

@ -992,11 +992,13 @@ static void emit_gatt_characteristic_query_result_event(gatt_client_t * gatt_cli
static void emit_gatt_all_characteristic_descriptors_result_event(
gatt_client_t * gatt_client, uint16_t descriptor_handle, const uint8_t * uuid128){
// @format HZ
uint8_t packet[22];
// @format H22Z
uint8_t packet[26];
hci_event_builder_context_t context;
hci_event_builder_init(&context, packet, sizeof(packet), GATT_EVENT_ALL_CHARACTERISTIC_DESCRIPTORS_QUERY_RESULT, 0);
hci_event_builder_add_con_handle(&context, gatt_client->con_handle);
hci_event_builder_add_16(&context, gatt_client->service_id);
hci_event_builder_add_16(&context, gatt_client->connection_id);
hci_event_builder_add_16(&context, descriptor_handle);
hci_event_builder_add_128(&context, uuid128);
emit_event_new(gatt_client->callback, packet, hci_event_builder_get_length(&context));

View File

@ -1458,8 +1458,10 @@ typedef uint8_t sm_key_t[16];
#define GATT_EVENT_INCLUDED_SERVICE_QUERY_RESULT 0xA3u
/**
* @format HZ
* @format H22Z
* @param handle
* @param service_id
* @param connection_id
* @param characteristic_descriptor
*/
#define GATT_EVENT_ALL_CHARACTERISTIC_DESCRIPTORS_QUERY_RESULT 0xA4u

View File

@ -2816,6 +2816,24 @@ static inline void gatt_event_included_service_query_result_get_service(const ui
static inline hci_con_handle_t gatt_event_all_characteristic_descriptors_query_result_get_handle(const uint8_t * event){
return little_endian_read_16(event, 2);
}
/**
* @brief Get field service_id from event GATT_EVENT_ALL_CHARACTERISTIC_DESCRIPTORS_QUERY_RESULT
* @param event packet
* @return service_id
* @note: btstack_type 2
*/
static inline uint16_t gatt_event_all_characteristic_descriptors_query_result_get_service_id(const uint8_t * event){
return little_endian_read_16(event, 4);
}
/**
* @brief Get field connection_id from event GATT_EVENT_ALL_CHARACTERISTIC_DESCRIPTORS_QUERY_RESULT
* @param event packet
* @return connection_id
* @note: btstack_type 2
*/
static inline uint16_t gatt_event_all_characteristic_descriptors_query_result_get_connection_id(const uint8_t * event){
return little_endian_read_16(event, 6);
}
/**
* @brief Get field characteristic_descriptor from event GATT_EVENT_ALL_CHARACTERISTIC_DESCRIPTORS_QUERY_RESULT
* @param event packet
@ -2823,7 +2841,7 @@ static inline hci_con_handle_t gatt_event_all_characteristic_descriptors_query_r
* @note: btstack_type Z
*/
static inline void gatt_event_all_characteristic_descriptors_query_result_get_characteristic_descriptor(const uint8_t * event, gatt_client_characteristic_descriptor_t * characteristic_descriptor){
gatt_client_deserialize_characteristic_descriptor(event, 4, characteristic_descriptor);
gatt_client_deserialize_characteristic_descriptor(event, 8, characteristic_descriptor);
}
#endif