gatt_client: add service/connection id to GATT_EVENT_QUERY_COMPLETE

This commit is contained in:
Matthias Ringwald 2024-08-26 10:26:33 +02:00
parent 9da0238594
commit 88371317a5
3 changed files with 27 additions and 5 deletions

View File

@ -935,11 +935,13 @@ static void emit_event_to_registered_listeners(hci_con_handle_t con_handle, uint
}
static void emit_gatt_complete_event(gatt_client_t * gatt_client, uint8_t att_status){
// @format H1
uint8_t packet[5];
// @format H122
uint8_t packet[9];
hci_event_builder_context_t context;
hci_event_builder_init(&context, packet, sizeof(packet), GATT_EVENT_QUERY_COMPLETE, 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_08(&context, att_status);
emit_event_new(gatt_client->callback, packet, hci_event_builder_get_length(&context));
}

View File

@ -1423,9 +1423,11 @@ typedef uint8_t sm_key_t[16];
#define SDP_EVENT_QUERY_SERVICE_RECORD_HANDLE 0x95u
/**
* @format H1
* @format H221
* @param handle
* @param att_status see ATT errors in bluetooth.h
* @param service_id
* @param connection_id
* @param att_status see ATT errors in bluetooth.h
*/
#define GATT_EVENT_QUERY_COMPLETE 0xA0u

View File

@ -2669,6 +2669,24 @@ static inline uint32_t sdp_event_query_service_record_handle_get_record_handle(c
static inline hci_con_handle_t gatt_event_query_complete_get_handle(const uint8_t * event){
return little_endian_read_16(event, 2);
}
/**
* @brief Get field service_id from event GATT_EVENT_QUERY_COMPLETE
* @param event packet
* @return service_id
* @note: btstack_type 2
*/
static inline uint16_t gatt_event_query_complete_get_service_id(const uint8_t * event){
return little_endian_read_16(event, 4);
}
/**
* @brief Get field connection_id from event GATT_EVENT_QUERY_COMPLETE
* @param event packet
* @return connection_id
* @note: btstack_type 2
*/
static inline uint16_t gatt_event_query_complete_get_connection_id(const uint8_t * event){
return little_endian_read_16(event, 6);
}
/**
* @brief Get field att_status from event GATT_EVENT_QUERY_COMPLETE
* @param event packet
@ -2676,7 +2694,7 @@ static inline hci_con_handle_t gatt_event_query_complete_get_handle(const uint8_
* @note: btstack_type 1
*/
static inline uint8_t gatt_event_query_complete_get_att_status(const uint8_t * event){
return event[4];
return event[8];
}
#endif