gatt_client: add service/connection id to GATT_EVENT_SERVICE_QUERY_RESULT

This commit is contained in:
Matthias Ringwald 2024-08-26 10:36:17 +02:00
parent 88371317a5
commit 521f582021
3 changed files with 26 additions and 4 deletions

View File

@ -947,11 +947,13 @@ static void emit_gatt_complete_event(gatt_client_t * gatt_client, uint8_t att_st
}
static void emit_gatt_service_query_result_event(gatt_client_t * gatt_client, uint16_t start_group_handle, uint16_t end_group_handle, const uint8_t * uuid128){
// @format HX
uint8_t packet[24];
// @format H22X
uint8_t packet[28];
hci_event_builder_context_t context;
hci_event_builder_init(&context, packet, sizeof(packet), GATT_EVENT_SERVICE_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_group_handle);
hci_event_builder_add_16(&context, end_group_handle);
hci_event_builder_add_128(&context, uuid128);

View File

@ -1432,8 +1432,10 @@ typedef uint8_t sm_key_t[16];
#define GATT_EVENT_QUERY_COMPLETE 0xA0u
/**
* @format HX
* @format H22X
* @param handle
* @param service_id
* @param connection_id
* @param service
*/
#define GATT_EVENT_SERVICE_QUERY_RESULT 0xA1u

View File

@ -2708,6 +2708,24 @@ static inline uint8_t gatt_event_query_complete_get_att_status(const uint8_t * e
static inline hci_con_handle_t gatt_event_service_query_result_get_handle(const uint8_t * event){
return little_endian_read_16(event, 2);
}
/**
* @brief Get field service_id from event GATT_EVENT_SERVICE_QUERY_RESULT
* @param event packet
* @return service_id
* @note: btstack_type 2
*/
static inline uint16_t gatt_event_service_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_SERVICE_QUERY_RESULT
* @param event packet
* @return connection_id
* @note: btstack_type 2
*/
static inline uint16_t gatt_event_service_query_result_get_connection_id(const uint8_t * event){
return little_endian_read_16(event, 6);
}
/**
* @brief Get field service from event GATT_EVENT_SERVICE_QUERY_RESULT
* @param event packet
@ -2715,7 +2733,7 @@ static inline hci_con_handle_t gatt_event_service_query_result_get_handle(const
* @note: btstack_type X
*/
static inline void gatt_event_service_query_result_get_service(const uint8_t * event, gatt_client_service_t * service){
gatt_client_deserialize_service(event, 4, service);
gatt_client_deserialize_service(event, 8, service);
}
#endif