gatt_client: add service/connection id to GATT_EVENT_CHARACTERISTIC_QUERY_RESULT

This commit is contained in:
Matthias Ringwald 2024-08-26 10:46:09 +02:00
parent 521f582021
commit 185497a5c5
3 changed files with 26 additions and 4 deletions

View File

@ -975,11 +975,13 @@ static void emit_gatt_included_service_query_result_event(gatt_client_t * gatt_c
static void emit_gatt_characteristic_query_result_event(gatt_client_t * gatt_client, uint16_t start_handle, uint16_t value_handle, uint16_t end_handle,
uint16_t properties, const uint8_t * uuid128){
// @format HY
uint8_t packet[28];
// @format H22Y
uint8_t packet[32];
hci_event_builder_context_t context;
hci_event_builder_init(&context, packet, sizeof(packet), GATT_EVENT_CHARACTERISTIC_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, start_handle);
hci_event_builder_add_16(&context, value_handle);
hci_event_builder_add_16(&context, end_handle);

View File

@ -1441,8 +1441,10 @@ typedef uint8_t sm_key_t[16];
#define GATT_EVENT_SERVICE_QUERY_RESULT 0xA1u
/**
* @format HY
* @format H22Y
* @param handle
* @param service_id
* @param connection_id
* @param characteristic
*/
#define GATT_EVENT_CHARACTERISTIC_QUERY_RESULT 0xA2u

View File

@ -2747,6 +2747,24 @@ static inline void gatt_event_service_query_result_get_service(const uint8_t * e
static inline hci_con_handle_t gatt_event_characteristic_query_result_get_handle(const uint8_t * event){
return little_endian_read_16(event, 2);
}
/**
* @brief Get field service_id from event GATT_EVENT_CHARACTERISTIC_QUERY_RESULT
* @param event packet
* @return service_id
* @note: btstack_type 2
*/
static inline uint16_t gatt_event_characteristic_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_CHARACTERISTIC_QUERY_RESULT
* @param event packet
* @return connection_id
* @note: btstack_type 2
*/
static inline uint16_t gatt_event_characteristic_query_result_get_connection_id(const uint8_t * event){
return little_endian_read_16(event, 6);
}
/**
* @brief Get field characteristic from event GATT_EVENT_CHARACTERISTIC_QUERY_RESULT
* @param event packet
@ -2754,7 +2772,7 @@ static inline hci_con_handle_t gatt_event_characteristic_query_result_get_handle
* @note: btstack_type Y
*/
static inline void gatt_event_characteristic_query_result_get_characteristic(const uint8_t * event, gatt_client_characteristic_t * characteristic){
gatt_client_deserialize_characteristic(event, 4, characteristic);
gatt_client_deserialize_characteristic(event, 8, characteristic);
}
#endif