diff --git a/src/ble/gatt_client.c b/src/ble/gatt_client.c index 154935c11..00c4f0f07 100644 --- a/src/ble/gatt_client.c +++ b/src/ble/gatt_client.c @@ -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); diff --git a/src/btstack_defines.h b/src/btstack_defines.h index 7649b43aa..26bc145ca 100644 --- a/src/btstack_defines.h +++ b/src/btstack_defines.h @@ -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 diff --git a/src/btstack_event.h b/src/btstack_event.h index 8368ae229..860313326 100644 --- a/src/btstack_event.h +++ b/src/btstack_event.h @@ -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