diff --git a/example/embedded/ancs_client_demo.c b/example/embedded/ancs_client_demo.c index f33d28e50..b4a02578b 100644 --- a/example/embedded/ancs_client_demo.c +++ b/example/embedded/ancs_client_demo.c @@ -83,7 +83,6 @@ const uint8_t adv_data[] = { uint8_t adv_data_len = sizeof(adv_data); static void app_packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){ - sm_event_t * sm_event; switch (packet_type) { case HCI_EVENT_PACKET: switch (packet[0]) { @@ -92,14 +91,12 @@ static void app_packet_handler (uint8_t packet_type, uint16_t channel, uint8_t * printf("ANCS Client Demo ready.\n"); } break; - case SM_JUST_WORKS_REQUEST: - sm_event = (sm_event_t *) packet; - sm_just_works_confirm(sm_event->addr_type, sm_event->address); + case SM_EVENT_JUST_WORKS_REQUEST: + sm_just_works_confirm(sm_event_just_works_request_get_handle(packet)); printf("Just Works Confirmed.\n"); break; - case SM_PASSKEY_DISPLAY_NUMBER: - sm_event = (sm_event_t *) packet; - printf("Passkey display: %06u.\n", sm_event->passkey); + case SM_EVENT_PASSKEY_DISPLAY_NUMBER: + printf("Passkey display: %06u.\n", sm_event_passkey_display_number_get_passkey(packet)); break; } break; @@ -116,9 +113,9 @@ static void ancs_callback(uint8_t packet_type, uint8_t *packet, uint16_t size){ printf("ANCS Client: Disconnected\n"); break; case ANCS_EVENT_CLIENT_NOTIFICATION: - attribute_name = ancs_client_attribute_name_for_id(ancs_client_notification_event_get_attribute_id(packet)); + attribute_name = ancs_client_attribute_name_for_id(ancs_event_client_notification_get_attribute_id(packet)); if (!attribute_name) break; - printf("Notification: %s - %s\n", attribute_name, ancs_client_notification_event_get_text(packet)); + printf("Notification: %s - %s\n", attribute_name, ancs_event_client_notification_get_text(packet)); break; default: break; diff --git a/example/embedded/panu_demo.c b/example/embedded/panu_demo.c index f6dea6491..277e1f654 100644 --- a/example/embedded/panu_demo.c +++ b/example/embedded/panu_demo.c @@ -326,17 +326,17 @@ static void handle_sdp_client_query_result(uint8_t packet_type, uint8_t *packet, switch (packet[0]){ case SDP_EVENT_QUERY_ATTRIBUTE_VALUE: // Handle new SDP record - if (sdp_query_attribute_byte_event_get_record_id(packet) != record_id) { - record_id = sdp_query_attribute_byte_event_get_record_id(packet); + if (sdp_event_query_attribute_byte_get_record_id(packet) != record_id) { + record_id = sdp_event_query_attribute_byte_get_record_id(packet); printf("SDP Record: Nr: %d\n", record_id); } - if (sdp_query_attribute_byte_event_get_attribute_length(packet) <= attribute_value_buffer_size) { - attribute_value[sdp_query_attribute_byte_event_get_data_offset(packet)] = sdp_query_attribute_byte_event_get_data(packet); + if (sdp_event_query_attribute_byte_get_attribute_length(packet) <= attribute_value_buffer_size) { + attribute_value[sdp_event_query_attribute_byte_get_data_offset(packet)] = sdp_event_query_attribute_byte_get_data(packet); - if ((uint16_t)(sdp_query_attribute_byte_event_get_data_offset(packet)+1) == sdp_query_attribute_byte_event_get_attribute_length(packet)) { + if ((uint16_t)(sdp_event_query_attribute_byte_get_data_offset(packet)+1) == sdp_event_query_attribute_byte_get_attribute_length(packet)) { - switch(sdp_query_attribute_byte_event_get_attribute_id(packet)) { + switch(sdp_event_query_attribute_byte_get_attribute_id(packet)) { case SDP_ServiceClassIDList: if (de_get_element_type(attribute_value) != DE_DES) break; for (des_iterator_init(&des_list_it, attribute_value); des_iterator_has_more(&des_list_it); des_iterator_next(&des_list_it)) { @@ -347,7 +347,7 @@ static void handle_sdp_client_query_result(uint8_t packet_type, uint8_t *packet, case SDP_PANU: case SDP_NAP: case SDP_GN: - printf("SDP Attribute 0x%04x: BNEP PAN protocol UUID: %04x\n", sdp_query_attribute_byte_event_get_attribute_id(packet), uuid); + printf("SDP Attribute 0x%04x: BNEP PAN protocol UUID: %04x\n", sdp_event_query_attribute_byte_get_attribute_id(packet), uuid); bnep_remote_uuid = uuid; break; default: @@ -358,11 +358,11 @@ static void handle_sdp_client_query_result(uint8_t packet_type, uint8_t *packet, case 0x0100: case 0x0101: str = get_string_from_data_element(attribute_value); - printf("SDP Attribute: 0x%04x: %s\n", sdp_query_attribute_byte_event_get_attribute_id(packet), str); + printf("SDP Attribute: 0x%04x: %s\n", sdp_event_query_attribute_byte_get_attribute_id(packet), str); free(str); break; case 0x0004: { - printf("SDP Attribute: 0x%04x\n", sdp_query_attribute_byte_event_get_attribute_id(packet)); + printf("SDP Attribute: 0x%04x\n", sdp_event_query_attribute_byte_get_attribute_id(packet)); for (des_iterator_init(&des_list_it, attribute_value); des_iterator_has_more(&des_list_it); des_iterator_next(&des_list_it)) { uint8_t *des_element; @@ -404,12 +404,12 @@ static void handle_sdp_client_query_result(uint8_t packet_type, uint8_t *packet, } } } else { - fprintf(stderr, "SDP attribute value buffer size exceeded: available %d, required %d\n", attribute_value_buffer_size, sdp_query_attribute_byte_event_get_attribute_length(packet)); + fprintf(stderr, "SDP attribute value buffer size exceeded: available %d, required %d\n", attribute_value_buffer_size, sdp_event_query_attribute_byte_get_attribute_length(packet)); } break; case SDP_EVENT_QUERY_COMPLETE: - fprintf(stderr, "General query done with status %d.\n", sdp_query_complete_event_get_status(packet)); + fprintf(stderr, "General query done with status %d.\n", sdp_event_query_complete_get_status(packet)); break; } diff --git a/example/embedded/sdp_bnep_query.c b/example/embedded/sdp_bnep_query.c index 930d5b32d..9c41b9278 100644 --- a/example/embedded/sdp_bnep_query.c +++ b/example/embedded/sdp_bnep_query.c @@ -169,22 +169,22 @@ static void handle_sdp_client_query_result(uint8_t packet_type, uint8_t *packet, switch (packet[0]){ case SDP_EVENT_QUERY_ATTRIBUTE_VALUE: // handle new record - if (sdp_query_attribute_byte_event_get_record_id(packet) != record_id){ - record_id = sdp_query_attribute_byte_event_get_record_id(packet); + if (sdp_event_query_attribute_byte_get_record_id(packet) != record_id){ + record_id = sdp_event_query_attribute_byte_get_record_id(packet); printf("\n---\nRecord nr. %u\n", record_id); } - assertBuffer(sdp_query_attribute_byte_event_get_attribute_length(packet)); + assertBuffer(sdp_event_query_attribute_byte_get_attribute_length(packet)); - attribute_value[sdp_query_attribute_byte_event_get_data_offset(packet)] = sdp_query_attribute_byte_event_get_data(packet); - if ((uint16_t)(sdp_query_attribute_byte_event_get_data_offset(packet)+1) == sdp_query_attribute_byte_event_get_attribute_length(packet)){ + attribute_value[sdp_event_query_attribute_byte_get_data_offset(packet)] = sdp_event_query_attribute_byte_get_data(packet); + if ((uint16_t)(sdp_event_query_attribute_byte_get_data_offset(packet)+1) == sdp_event_query_attribute_byte_get_attribute_length(packet)){ /* LISTING_RESUME */ /* @text The Service Class ID List is a Data Element Sequence (DES) of UUIDs. * The BNEP PAN protocol UUID is within this list. */ - switch(sdp_query_attribute_byte_event_get_attribute_id(packet)){ + switch(sdp_event_query_attribute_byte_get_attribute_id(packet)){ // 0x0001 "Service Class ID List" case SDP_ServiceClassIDList: if (de_get_element_type(attribute_value) != DE_DES) break; @@ -196,7 +196,7 @@ static void handle_sdp_client_query_result(uint8_t packet_type, uint8_t *packet, case PANU_UUID: case NAP_UUID: case GN_UUID: - printf(" ** Attribute 0x%04x: BNEP PAN protocol UUID: %04x\n", sdp_query_attribute_byte_event_get_attribute_id(packet), uuid); + printf(" ** Attribute 0x%04x: BNEP PAN protocol UUID: %04x\n", sdp_event_query_attribute_byte_get_attribute_id(packet), uuid); break; default: break; @@ -209,7 +209,7 @@ static void handle_sdp_client_query_result(uint8_t packet_type, uint8_t *packet, // 0x0101 "Service Description" case 0x0101: str = get_string_from_data_element(attribute_value); - printf(" ** Attribute 0x%04x: %s\n", sdp_query_attribute_byte_event_get_attribute_id(packet), str); + printf(" ** Attribute 0x%04x: %s\n", sdp_event_query_attribute_byte_get_attribute_id(packet), str); free(str); break; @@ -220,7 +220,7 @@ static void handle_sdp_client_query_result(uint8_t packet_type, uint8_t *packet, * and another DES with the BNEP UUID and the the BNEP version. */ case SDP_ProtocolDescriptorList:{ - printf(" ** Attribute 0x%04x: ", sdp_query_attribute_byte_event_get_attribute_id(packet)); + printf(" ** Attribute 0x%04x: ", sdp_event_query_attribute_byte_get_attribute_id(packet)); uint16_t l2cap_psm = 0; uint16_t bnep_version = 0; @@ -257,7 +257,7 @@ static void handle_sdp_client_query_result(uint8_t packet_type, uint8_t *packet, } break; case SDP_EVENT_QUERY_COMPLETE: - printf("General query done with status %d.\n\n", sdp_query_complete_event_get_status(packet)); + printf("General query done with status %d.\n\n", sdp_event_query_complete_get_status(packet)); break; } /* LISTING_RESUME */ diff --git a/example/embedded/sdp_general_query.c b/example/embedded/sdp_general_query.c index 1ad2de232..dd9cf4b0a 100644 --- a/example/embedded/sdp_general_query.c +++ b/example/embedded/sdp_general_query.c @@ -148,21 +148,21 @@ static void handle_sdp_client_query_result(uint8_t packet_type, uint8_t *packet, switch (packet[0]){ case SDP_EVENT_QUERY_ATTRIBUTE_VALUE: // handle new record - if (sdp_query_attribute_byte_event_get_record_id(packet) != record_id){ - record_id = sdp_query_attribute_byte_event_get_record_id(packet); + if (sdp_event_query_attribute_byte_get_record_id(packet) != record_id){ + record_id = sdp_event_query_attribute_byte_get_record_id(packet); printf("\n---\nRecord nr. %u\n", record_id); } - assertBuffer(sdp_query_attribute_byte_event_get_attribute_length(packet)); + assertBuffer(sdp_event_query_attribute_byte_get_attribute_length(packet)); - attribute_value[sdp_query_attribute_byte_event_get_data_offset(packet)] = sdp_query_attribute_byte_event_get_data(packet); - if ((uint16_t)(sdp_query_attribute_byte_event_get_data_offset(packet)+1) == sdp_query_attribute_byte_event_get_attribute_length(packet)){ - printf("Attribute 0x%04x: ", sdp_query_attribute_byte_event_get_attribute_id(packet)); + attribute_value[sdp_event_query_attribute_byte_get_data_offset(packet)] = sdp_event_query_attribute_byte_get_data(packet); + if ((uint16_t)(sdp_event_query_attribute_byte_get_data_offset(packet)+1) == sdp_event_query_attribute_byte_get_attribute_length(packet)){ + printf("Attribute 0x%04x: ", sdp_event_query_attribute_byte_get_attribute_id(packet)); de_dump_data_element(attribute_value); } break; case SDP_EVENT_QUERY_COMPLETE: - printf("General query done with status %d.\n\n", sdp_query_complete_event_get_status(packet)); + printf("General query done with status %d.\n\n", sdp_event_query_complete_get_status(packet)); exit(0); break; } diff --git a/example/embedded/sdp_rfcomm_query.c b/example/embedded/sdp_rfcomm_query.c index 2dd19fa08..0761aeda5 100644 --- a/example/embedded/sdp_rfcomm_query.c +++ b/example/embedded/sdp_rfcomm_query.c @@ -111,8 +111,8 @@ static void report_found_services(void){ static void handle_query_rfcomm_event(uint8_t packet_type, uint8_t *packet, uint16_t size){ switch (packet[0]){ case SDP_EVENT_QUERY_RFCOMM_SERVICE: - store_found_service(sdp_query_rfcomm_service_event_get_name(packet), - sdp_query_rfcomm_service_event_get_rfcomm_channel(packet)); + store_found_service(sdp_event_query_rfcomm_service_get_name(packet), + sdp_event_query_rfcomm_service_get_rfcomm_channel(packet)); break; case SDP_EVENT_QUERY_COMPLETE: report_found_services(); diff --git a/example/embedded/spp_streamer.c b/example/embedded/spp_streamer.c index 207109109..4e5eb5ad6 100644 --- a/example/embedded/spp_streamer.c +++ b/example/embedded/spp_streamer.c @@ -164,8 +164,8 @@ static void handle_found_service(const char * name, uint8_t port){ static void handle_query_rfcomm_event(uint8_t packet_type, uint8_t *packet, uint16_t size){ switch (packet[0]){ case SDP_EVENT_QUERY_RFCOMM_SERVICE: - handle_found_service(sdp_query_rfcomm_service_event_get_name(packet), - sdp_query_rfcomm_service_event_get_rfcomm_channel(packet)); + handle_found_service(sdp_event_query_rfcomm_service_get_name(packet), + sdp_event_query_rfcomm_service_get_rfcomm_channel(packet)); break; case SDP_EVENT_QUERY_COMPLETE: if (state != W4_SDP_COMPLETE){ diff --git a/platform/daemon/daemon.c b/platform/daemon/daemon.c index 09ec6a09f..1dfd1ceb6 100644 --- a/platform/daemon/daemon.c +++ b/platform/daemon/daemon.c @@ -1669,18 +1669,18 @@ static void handle_sdp_client_query_result(uint8_t packet_type, uint8_t *packet, switch (packet[0]){ case SDP_EVENT_QUERY_ATTRIBUTE_BYTE: - sdp_client_assert_buffer(sdp_query_attribute_byte_event_get_attribute_length(packet)); - attribute_value[sdp_query_attribute_byte_event_get_data_offset(packet)] = sdp_query_attribute_byte_event_get_data(packet); - if ((uint16_t)(sdp_query_attribute_byte_event_get_data_offset(packet)+1) == sdp_query_attribute_byte_event_get_attribute_length(packet)){ - hexdump(attribute_value, sdp_query_attribute_byte_event_get_attribute_length(packet)); + sdp_client_assert_buffer(sdp_event_query_attribute_byte_get_attribute_length(packet)); + attribute_value[sdp_event_query_attribute_byte_get_data_offset(packet)] = sdp_event_query_attribute_byte_get_data(packet); + if ((uint16_t)(sdp_event_query_attribute_byte_get_data_offset(packet)+1) == sdp_event_query_attribute_byte_get_attribute_length(packet)){ + hexdump(attribute_value, sdp_event_query_attribute_byte_get_attribute_length(packet)); - int event_len = 1 + 3 * 2 + sdp_query_attribute_byte_event_get_attribute_length(packet); + int event_len = 1 + 3 * 2 + sdp_event_query_attribute_byte_get_attribute_length(packet); uint8_t event[event_len]; event[0] = SDP_EVENT_QUERY_ATTRIBUTE_VALUE; - little_endian_store_16(event, 1, sdp_query_attribute_byte_event_get_record_id(packet)); - little_endian_store_16(event, 3, sdp_query_attribute_byte_event_get_attribute_id(packet)); - little_endian_store_16(event, 5, (uint16_t)sdp_query_attribute_byte_event_get_attribute_length(packet)); - memcpy(&event[7], attribute_value, sdp_query_attribute_byte_event_get_attribute_length(packet)); + little_endian_store_16(event, 1, sdp_event_query_attribute_byte_get_record_id(packet)); + little_endian_store_16(event, 3, sdp_event_query_attribute_byte_get_attribute_id(packet)); + little_endian_store_16(event, 5, (uint16_t)sdp_event_query_attribute_byte_get_attribute_length(packet)); + memcpy(&event[7], attribute_value, sdp_event_query_attribute_byte_get_attribute_length(packet)); hci_dump_packet(SDP_CLIENT_PACKET, 0, event, event_len); socket_connection_send_packet(sdp_client_query_connection, SDP_CLIENT_PACKET, 0, event, event_len); } diff --git a/src/btstack_event.h b/src/btstack_event.h index 9a2cd5c12..81dae7c61 100644 --- a/src/btstack_event.h +++ b/src/btstack_event.h @@ -58,162 +58,582 @@ extern "C" { /** - * @brief Get field status from event sdp_query_complete_event + * @brief Get field status from event sdp_event_service_registered * @param Event packet * @return status * @note: btstack_type 1 */ -static inline uint8_t sdp_query_complete_event_get_status(const uint8_t * event){ +static inline uint8_t sdp_event_service_registered_get_status(const uint8_t * event){ return event[2]; } /** - * @brief Get field rfcomm_channel from event sdp_query_rfcomm_service_event + * @brief Get field service_record_handle from event sdp_event_service_registered + * @param Event packet + * @return service_record_handle + * @note: btstack_type 4 + */ +static inline uint32_t sdp_event_service_registered_get_service_record_handle(const uint8_t * event){ + return little_endian_read_32(event, 3); +} + +/** + * @brief Get field status from event sdp_event_query_complete + * @param Event packet + * @return status + * @note: btstack_type 1 + */ +static inline uint8_t sdp_event_query_complete_get_status(const uint8_t * event){ + return event[2]; +} + +/** + * @brief Get field rfcomm_channel from event sdp_event_query_rfcomm_service * @param Event packet * @return rfcomm_channel * @note: btstack_type 1 */ -static inline uint8_t sdp_query_rfcomm_service_event_get_rfcomm_channel(const uint8_t * event){ +static inline uint8_t sdp_event_query_rfcomm_service_get_rfcomm_channel(const uint8_t * event){ return event[2]; } /** - * @brief Get field name from event sdp_query_rfcomm_service_event + * @brief Get field name from event sdp_event_query_rfcomm_service * @param Event packet * @return name * @note: btstack_type T */ -static inline const char * sdp_query_rfcomm_service_event_get_name(const uint8_t * event){ +static inline const char * sdp_event_query_rfcomm_service_get_name(const uint8_t * event){ return (const char *) &event[3]; } /** - * @brief Get field record_id from event sdp_query_attribute_byte_event + * @brief Get field record_id from event sdp_event_query_attribute_byte * @param Event packet * @return record_id * @note: btstack_type 2 */ -static inline uint16_t sdp_query_attribute_byte_event_get_record_id(const uint8_t * event){ +static inline uint16_t sdp_event_query_attribute_byte_get_record_id(const uint8_t * event){ return little_endian_read_16(event, 2); } /** - * @brief Get field attribute_id from event sdp_query_attribute_byte_event + * @brief Get field attribute_id from event sdp_event_query_attribute_byte * @param Event packet * @return attribute_id * @note: btstack_type 2 */ -static inline uint16_t sdp_query_attribute_byte_event_get_attribute_id(const uint8_t * event){ +static inline uint16_t sdp_event_query_attribute_byte_get_attribute_id(const uint8_t * event){ return little_endian_read_16(event, 4); } /** - * @brief Get field attribute_length from event sdp_query_attribute_byte_event + * @brief Get field attribute_length from event sdp_event_query_attribute_byte * @param Event packet * @return attribute_length * @note: btstack_type 2 */ -static inline uint16_t sdp_query_attribute_byte_event_get_attribute_length(const uint8_t * event){ +static inline uint16_t sdp_event_query_attribute_byte_get_attribute_length(const uint8_t * event){ return little_endian_read_16(event, 6); } /** - * @brief Get field data_offset from event sdp_query_attribute_byte_event + * @brief Get field data_offset from event sdp_event_query_attribute_byte * @param Event packet * @return data_offset * @note: btstack_type 2 */ -static inline uint16_t sdp_query_attribute_byte_event_get_data_offset(const uint8_t * event){ +static inline uint16_t sdp_event_query_attribute_byte_get_data_offset(const uint8_t * event){ return little_endian_read_16(event, 8); } /** - * @brief Get field data from event sdp_query_attribute_byte_event + * @brief Get field data from event sdp_event_query_attribute_byte * @param Event packet * @return data * @note: btstack_type 1 */ -static inline uint8_t sdp_query_attribute_byte_event_get_data(const uint8_t * event){ +static inline uint8_t sdp_event_query_attribute_byte_get_data(const uint8_t * event){ return event[10]; } /** - * @brief Get field total_count from event sdp_query_service_record_handle_event + * @brief Get field record_id from event sdp_event_query_attribute_value * @param Event packet - * @return total_count + * @return record_id * @note: btstack_type 2 */ -static inline uint16_t sdp_query_service_record_handle_event_get_total_count(const uint8_t * event){ +static inline uint16_t sdp_event_query_attribute_value_get_record_id(const uint8_t * event){ return little_endian_read_16(event, 2); } /** - * @brief Get field record_index from event sdp_query_service_record_handle_event - * @param Event packet - * @return record_index - * @note: btstack_type 2 - */ -static inline uint16_t sdp_query_service_record_handle_event_get_record_index(const uint8_t * event){ - return little_endian_read_16(event, 4); -} - -/** - * @brief Get field record_handle from event sdp_query_service_record_handle_event - * @param Event packet - * @return record_handle - * @note: btstack_type 4 - */ -static inline uint32_t sdp_query_service_record_handle_event_get_record_handle(const uint8_t * event){ - return little_endian_read_32(event, 6); -} - -/** - * @brief Get field handle from event ancs_client_connected_event - * @param Event packet - * @return handle - * @note: btstack_type H - */ -static inline hci_con_handle_t ancs_client_connected_event_get_handle(const uint8_t * event){ - return little_endian_read_16(event, 2); -} - -/** - * @brief Get field handle from event ancs_client_notification_event - * @param Event packet - * @return handle - * @note: btstack_type H - */ -static inline hci_con_handle_t ancs_client_notification_event_get_handle(const uint8_t * event){ - return little_endian_read_16(event, 2); -} - -/** - * @brief Get field attribute_id from event ancs_client_notification_event + * @brief Get field attribute_id from event sdp_event_query_attribute_value * @param Event packet * @return attribute_id * @note: btstack_type 2 */ -static inline uint16_t ancs_client_notification_event_get_attribute_id(const uint8_t * event){ +static inline uint16_t sdp_event_query_attribute_value_get_attribute_id(const uint8_t * event){ return little_endian_read_16(event, 4); } /** - * @brief Get field text from event ancs_client_notification_event + * @brief Get field attribute_length from event sdp_event_query_attribute_value * @param Event packet - * @return text - * @note: btstack_type T + * @return attribute_length + * @note: btstack_type L */ -static inline const char * ancs_client_notification_event_get_text(const uint8_t * event){ - return (const char *) &event[6]; +static inline int sdp_event_query_attribute_value_get_attribute_length(const uint8_t * event){ + return little_endian_read_16(event, 6); } /** - * @brief Get field handle from event ancs_client_disconnected_event + * @brief Get field attribute_value from event sdp_event_query_attribute_value + * @param Event packet + * @return attribute_value + * @note: btstack_type V + */ +static inline const uint8_t * sdp_event_query_attribute_value_get_attribute_value(const uint8_t * event){ + return &event[8]; +} + +/** + * @brief Get field total_count from event sdp_event_query_service_record_handle + * @param Event packet + * @return total_count + * @note: btstack_type 2 + */ +static inline uint16_t sdp_event_query_service_record_handle_get_total_count(const uint8_t * event){ + return little_endian_read_16(event, 2); +} + +/** + * @brief Get field record_index from event sdp_event_query_service_record_handle + * @param Event packet + * @return record_index + * @note: btstack_type 2 + */ +static inline uint16_t sdp_event_query_service_record_handle_get_record_index(const uint8_t * event){ + return little_endian_read_16(event, 4); +} + +/** + * @brief Get field record_handle from event sdp_event_query_service_record_handle + * @param Event packet + * @return record_handle + * @note: btstack_type 4 + */ +static inline uint32_t sdp_event_query_service_record_handle_get_record_handle(const uint8_t * event){ + return little_endian_read_32(event, 6); +} + +/** + * @brief Get field handle from event sm_event_just_works_request * @param Event packet * @return handle * @note: btstack_type H */ -static inline hci_con_handle_t ancs_client_disconnected_event_get_handle(const uint8_t * event){ +static inline hci_con_handle_t sm_event_just_works_request_get_handle(const uint8_t * event){ + return little_endian_read_16(event, 2); +} + +/** + * @brief Get field addr_type from event sm_event_just_works_request + * @param Event packet + * @return addr_type + * @note: btstack_type 1 + */ +static inline uint8_t sm_event_just_works_request_get_addr_type(const uint8_t * event){ + return event[4]; +} + +/** + * @brief Get field address from event sm_event_just_works_request + * @param Event packet + * @param Pointer to storage for address + * @note: btstack_type B + */ +static inline void sm_event_just_works_request_get_address(const uint8_t * event, bd_addr_t address){ + swap48(&event[5], address); +} + +/** + * @brief Get field handle from event sm_event_just_works_cancel + * @param Event packet + * @return handle + * @note: btstack_type H + */ +static inline hci_con_handle_t sm_event_just_works_cancel_get_handle(const uint8_t * event){ + return little_endian_read_16(event, 2); +} + +/** + * @brief Get field addr_type from event sm_event_just_works_cancel + * @param Event packet + * @return addr_type + * @note: btstack_type 1 + */ +static inline uint8_t sm_event_just_works_cancel_get_addr_type(const uint8_t * event){ + return event[4]; +} + +/** + * @brief Get field address from event sm_event_just_works_cancel + * @param Event packet + * @param Pointer to storage for address + * @note: btstack_type B + */ +static inline void sm_event_just_works_cancel_get_address(const uint8_t * event, bd_addr_t address){ + swap48(&event[5], address); +} + +/** + * @brief Get field handle from event sm_event_passkey_display_number + * @param Event packet + * @return handle + * @note: btstack_type H + */ +static inline hci_con_handle_t sm_event_passkey_display_number_get_handle(const uint8_t * event){ + return little_endian_read_16(event, 2); +} + +/** + * @brief Get field addr_type from event sm_event_passkey_display_number + * @param Event packet + * @return addr_type + * @note: btstack_type 1 + */ +static inline uint8_t sm_event_passkey_display_number_get_addr_type(const uint8_t * event){ + return event[4]; +} + +/** + * @brief Get field address from event sm_event_passkey_display_number + * @param Event packet + * @param Pointer to storage for address + * @note: btstack_type B + */ +static inline void sm_event_passkey_display_number_get_address(const uint8_t * event, bd_addr_t address){ + swap48(&event[5], address); +} + +/** + * @brief Get field passkey from event sm_event_passkey_display_number + * @param Event packet + * @return passkey + * @note: btstack_type 4 + */ +static inline uint32_t sm_event_passkey_display_number_get_passkey(const uint8_t * event){ + return little_endian_read_32(event, 11); +} + +/** + * @brief Get field handle from event sm_event_passkey_display_cancel + * @param Event packet + * @return handle + * @note: btstack_type H + */ +static inline hci_con_handle_t sm_event_passkey_display_cancel_get_handle(const uint8_t * event){ + return little_endian_read_16(event, 2); +} + +/** + * @brief Get field addr_type from event sm_event_passkey_display_cancel + * @param Event packet + * @return addr_type + * @note: btstack_type 1 + */ +static inline uint8_t sm_event_passkey_display_cancel_get_addr_type(const uint8_t * event){ + return event[4]; +} + +/** + * @brief Get field address from event sm_event_passkey_display_cancel + * @param Event packet + * @param Pointer to storage for address + * @note: btstack_type B + */ +static inline void sm_event_passkey_display_cancel_get_address(const uint8_t * event, bd_addr_t address){ + swap48(&event[5], address); +} + +/** + * @brief Get field handle from event sm_event_passkey_input_number + * @param Event packet + * @return handle + * @note: btstack_type H + */ +static inline hci_con_handle_t sm_event_passkey_input_number_get_handle(const uint8_t * event){ + return little_endian_read_16(event, 2); +} + +/** + * @brief Get field addr_type from event sm_event_passkey_input_number + * @param Event packet + * @return addr_type + * @note: btstack_type 1 + */ +static inline uint8_t sm_event_passkey_input_number_get_addr_type(const uint8_t * event){ + return event[4]; +} + +/** + * @brief Get field address from event sm_event_passkey_input_number + * @param Event packet + * @param Pointer to storage for address + * @note: btstack_type B + */ +static inline void sm_event_passkey_input_number_get_address(const uint8_t * event, bd_addr_t address){ + swap48(&event[5], address); +} + +/** + * @brief Get field handle from event sm_event_passkey_input_cancel + * @param Event packet + * @return handle + * @note: btstack_type H + */ +static inline hci_con_handle_t sm_event_passkey_input_cancel_get_handle(const uint8_t * event){ + return little_endian_read_16(event, 2); +} + +/** + * @brief Get field addr_type from event sm_event_passkey_input_cancel + * @param Event packet + * @return addr_type + * @note: btstack_type 1 + */ +static inline uint8_t sm_event_passkey_input_cancel_get_addr_type(const uint8_t * event){ + return event[4]; +} + +/** + * @brief Get field address from event sm_event_passkey_input_cancel + * @param Event packet + * @param Pointer to storage for address + * @note: btstack_type B + */ +static inline void sm_event_passkey_input_cancel_get_address(const uint8_t * event, bd_addr_t address){ + swap48(&event[5], address); +} + +/** + * @brief Get field handle from event sm_event_identity_resolving_started + * @param Event packet + * @return handle + * @note: btstack_type H + */ +static inline hci_con_handle_t sm_event_identity_resolving_started_get_handle(const uint8_t * event){ + return little_endian_read_16(event, 2); +} + +/** + * @brief Get field addr_type from event sm_event_identity_resolving_started + * @param Event packet + * @return addr_type + * @note: btstack_type 1 + */ +static inline uint8_t sm_event_identity_resolving_started_get_addr_type(const uint8_t * event){ + return event[4]; +} + +/** + * @brief Get field address from event sm_event_identity_resolving_started + * @param Event packet + * @param Pointer to storage for address + * @note: btstack_type B + */ +static inline void sm_event_identity_resolving_started_get_address(const uint8_t * event, bd_addr_t address){ + swap48(&event[5], address); +} + +/** + * @brief Get field handle from event sm_event_identity_resolving_failed + * @param Event packet + * @return handle + * @note: btstack_type H + */ +static inline hci_con_handle_t sm_event_identity_resolving_failed_get_handle(const uint8_t * event){ + return little_endian_read_16(event, 2); +} + +/** + * @brief Get field addr_type from event sm_event_identity_resolving_failed + * @param Event packet + * @return addr_type + * @note: btstack_type 1 + */ +static inline uint8_t sm_event_identity_resolving_failed_get_addr_type(const uint8_t * event){ + return event[4]; +} + +/** + * @brief Get field address from event sm_event_identity_resolving_failed + * @param Event packet + * @param Pointer to storage for address + * @note: btstack_type B + */ +static inline void sm_event_identity_resolving_failed_get_address(const uint8_t * event, bd_addr_t address){ + swap48(&event[5], address); +} + +/** + * @brief Get field handle from event sm_event_identity_resolving_succeeded + * @param Event packet + * @return handle + * @note: btstack_type H + */ +static inline hci_con_handle_t sm_event_identity_resolving_succeeded_get_handle(const uint8_t * event){ + return little_endian_read_16(event, 2); +} + +/** + * @brief Get field addr_type from event sm_event_identity_resolving_succeeded + * @param Event packet + * @return addr_type + * @note: btstack_type 1 + */ +static inline uint8_t sm_event_identity_resolving_succeeded_get_addr_type(const uint8_t * event){ + return event[4]; +} + +/** + * @brief Get field address from event sm_event_identity_resolving_succeeded + * @param Event packet + * @param Pointer to storage for address + * @note: btstack_type B + */ +static inline void sm_event_identity_resolving_succeeded_get_address(const uint8_t * event, bd_addr_t address){ + swap48(&event[5], address); +} + +/** + * @brief Get field le_device_db_index from event sm_event_identity_resolving_succeeded + * @param Event packet + * @return le_device_db_index + * @note: btstack_type 2 + */ +static inline uint16_t sm_event_identity_resolving_succeeded_get_le_device_db_index(const uint8_t * event){ + return little_endian_read_16(event, 11); +} + +/** + * @brief Get field handle from event sm_event_authorization_request + * @param Event packet + * @return handle + * @note: btstack_type H + */ +static inline hci_con_handle_t sm_event_authorization_request_get_handle(const uint8_t * event){ + return little_endian_read_16(event, 2); +} + +/** + * @brief Get field addr_type from event sm_event_authorization_request + * @param Event packet + * @return addr_type + * @note: btstack_type 1 + */ +static inline uint8_t sm_event_authorization_request_get_addr_type(const uint8_t * event){ + return event[4]; +} + +/** + * @brief Get field address from event sm_event_authorization_request + * @param Event packet + * @param Pointer to storage for address + * @note: btstack_type B + */ +static inline void sm_event_authorization_request_get_address(const uint8_t * event, bd_addr_t address){ + swap48(&event[5], address); +} + +/** + * @brief Get field handle from event sm_event_authorization_result + * @param Event packet + * @return handle + * @note: btstack_type H + */ +static inline hci_con_handle_t sm_event_authorization_result_get_handle(const uint8_t * event){ + return little_endian_read_16(event, 2); +} + +/** + * @brief Get field addr_type from event sm_event_authorization_result + * @param Event packet + * @return addr_type + * @note: btstack_type 1 + */ +static inline uint8_t sm_event_authorization_result_get_addr_type(const uint8_t * event){ + return event[4]; +} + +/** + * @brief Get field address from event sm_event_authorization_result + * @param Event packet + * @param Pointer to storage for address + * @note: btstack_type B + */ +static inline void sm_event_authorization_result_get_address(const uint8_t * event, bd_addr_t address){ + swap48(&event[5], address); +} + +/** + * @brief Get field authorization_result from event sm_event_authorization_result + * @param Event packet + * @return authorization_result + * @note: btstack_type 1 + */ +static inline uint8_t sm_event_authorization_result_get_authorization_result(const uint8_t * event){ + return event[11]; +} + +/** + * @brief Get field handle from event ancs_event_client_connected + * @param Event packet + * @return handle + * @note: btstack_type H + */ +static inline hci_con_handle_t ancs_event_client_connected_get_handle(const uint8_t * event){ + return little_endian_read_16(event, 2); +} + +/** + * @brief Get field handle from event ancs_event_client_notification + * @param Event packet + * @return handle + * @note: btstack_type H + */ +static inline hci_con_handle_t ancs_event_client_notification_get_handle(const uint8_t * event){ + return little_endian_read_16(event, 2); +} + +/** + * @brief Get field attribute_id from event ancs_event_client_notification + * @param Event packet + * @return attribute_id + * @note: btstack_type 2 + */ +static inline uint16_t ancs_event_client_notification_get_attribute_id(const uint8_t * event){ + return little_endian_read_16(event, 4); +} + +/** + * @brief Get field text from event ancs_event_client_notification + * @param Event packet + * @return text + * @note: btstack_type T + */ +static inline const char * ancs_event_client_notification_get_text(const uint8_t * event){ + return (const char *) &event[6]; +} + +/** + * @brief Get field handle from event ancs_event_client_disconnected + * @param Event packet + * @return handle + * @note: btstack_type H + */ +static inline hci_con_handle_t ancs_event_client_disconnected_get_handle(const uint8_t * event){ return little_endian_read_16(event, 2); } diff --git a/src/classic/hfp.c b/src/classic/hfp.c index 9c253f70b..88876e59f 100644 --- a/src/classic/hfp.c +++ b/src/classic/hfp.c @@ -423,10 +423,10 @@ static void handle_query_rfcomm_event(uint8_t packet_type, uint8_t *packet, uint switch (packet[0]){ case SDP_EVENT_QUERY_RFCOMM_SERVICE: if (!connection) { - log_error("handle_query_rfcomm_event alloc connection for RFCOMM port %u failed", sdp_query_rfcomm_service_event_get_rfcomm_channel(packet)); + log_error("handle_query_rfcomm_event alloc connection for RFCOMM port %u failed", sdp_event_query_rfcomm_service_get_rfcomm_channel(packet)); return; } - connection->rfcomm_channel_nr = sdp_query_rfcomm_service_event_get_rfcomm_channel(packet); + connection->rfcomm_channel_nr = sdp_event_query_rfcomm_service_get_rfcomm_channel(packet); break; case SDP_EVENT_QUERY_COMPLETE: connection_doing_sdp_query = NULL; @@ -436,7 +436,7 @@ static void handle_query_rfcomm_event(uint8_t packet_type, uint8_t *packet, uint rfcomm_create_channel(connection->remote_addr, connection->rfcomm_channel_nr, NULL); break; } - log_info("rfcomm service not found, status %u.", sdp_query_complete_event_get_status(packet)); + log_info("rfcomm service not found, status %u.", sdp_event_query_complete_get_status(packet)); break; default: break; diff --git a/src/classic/hsp_ag.c b/src/classic/hsp_ag.c index 00c67078f..904dcbab8 100644 --- a/src/classic/hsp_ag.c +++ b/src/classic/hsp_ag.c @@ -628,8 +628,8 @@ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *pack static void handle_query_rfcomm_event(uint8_t packet_type, uint8_t *packet, uint16_t size, void * context){ switch (event->type){ case SDP_EVENT_QUERY_RFCOMM_SERVICE: - channel_nr = sdp_query_rfcomm_service_event_get_rfcomm_channel(packet); - printf("** Service name: '%s', RFCOMM port %u\n", sdp_query_rfcomm_service_event_get_name(packet), channel_nr); + channel_nr = sdp_event_query_rfcomm_service_get_rfcomm_channel(packet); + printf("** Service name: '%s', RFCOMM port %u\n", sdp_event_query_rfcomm_service_get_name(packet), channel_nr); break; case SDP_EVENT_QUERY_COMPLETE: if (channel_nr > 0){ @@ -639,9 +639,9 @@ static void handle_query_rfcomm_event(uint8_t packet_type, uint8_t *packet, uint break; } hsp_ag_reset_state(); - printf("Service not found, status %u.\n", sdp_query_complete_event_get_status(packet)); - if (sdp_query_complete_event_get_status(packet)){ - emit_event(HSP_SUBEVENT_AUDIO_CONNECTION_COMPLETE, sdp_query_complete_event_get_status(packet)); + printf("Service not found, status %u.\n", sdp_event_query_complete_get_status(packet)); + if (sdp_event_query_complete_get_status(packet)){ + emit_event(HSP_SUBEVENT_AUDIO_CONNECTION_COMPLETE, sdp_event_query_complete_get_status(packet)); } else { emit_event(HSP_SUBEVENT_AUDIO_CONNECTION_COMPLETE, SDP_SERVICE_NOT_FOUND); } diff --git a/src/classic/hsp_hs.c b/src/classic/hsp_hs.c index ca3b5b629..879d69af6 100644 --- a/src/classic/hsp_hs.c +++ b/src/classic/hsp_hs.c @@ -576,8 +576,8 @@ static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *pack static void handle_query_rfcomm_event(uint8_t packet_type, uint8_t *packet, uint16_t size){ switch (packet[0]){ case SDP_EVENT_QUERY_RFCOMM_SERVICE: - channel_nr = sdp_query_rfcomm_service_event_get_rfcomm_channel(packet); - printf("** Service name: '%s', RFCOMM port %u\n", sdp_query_rfcomm_service_event_get_name(packet), channel_nr); + channel_nr = sdp_event_query_rfcomm_service_get_rfcomm_channel(packet); + printf("** Service name: '%s', RFCOMM port %u\n", sdp_event_query_rfcomm_service_get_name(packet), channel_nr); break; case SDP_EVENT_QUERY_COMPLETE: if (channel_nr > 0){ @@ -587,7 +587,7 @@ static void handle_query_rfcomm_event(uint8_t packet_type, uint8_t *packet, uint break; } hsp_hs_reset_state(); - printf("Service not found, status %u.\n", sdp_query_complete_event_get_status(packet)); + printf("Service not found, status %u.\n", sdp_event_query_complete_get_status(packet)); exit(0); break; } diff --git a/src/classic/sdp_query_rfcomm.c b/src/classic/sdp_query_rfcomm.c index e0d4730ce..19589c058 100644 --- a/src/classic/sdp_query_rfcomm.c +++ b/src/classic/sdp_query_rfcomm.c @@ -267,20 +267,20 @@ static void handle_sdp_parser_event(uint8_t packet_type, uint8_t *packet, uint16 break; case SDP_EVENT_QUERY_ATTRIBUTE_VALUE: // log_info("handle_sdp_parser_event [ AID, ALen, DOff, Data] : [%x, %u, %u] BYTE %02x", - // ve->attribute_id, sdp_query_attribute_byte_event_get_attribute_length(packet), - // sdp_query_attribute_byte_event_get_data_offset(packet), sdp_query_attribute_byte_event_get_data(packet)); - switch (sdp_query_attribute_byte_event_get_attribute_id(packet)){ + // ve->attribute_id, sdp_event_query_attribute_byte_get_attribute_length(packet), + // sdp_event_query_attribute_byte_get_data_offset(packet), sdp_event_query_attribute_byte_get_data(packet)); + switch (sdp_event_query_attribute_byte_get_attribute_id(packet)){ case SDP_ProtocolDescriptorList: // find rfcomm channel - handleProtocolDescriptorListData(sdp_query_attribute_byte_event_get_attribute_length(packet), - sdp_query_attribute_byte_event_get_data_offset(packet), - sdp_query_attribute_byte_event_get_data(packet)); + handleProtocolDescriptorListData(sdp_event_query_attribute_byte_get_attribute_length(packet), + sdp_event_query_attribute_byte_get_data_offset(packet), + sdp_event_query_attribute_byte_get_data(packet)); break; case 0x0100: // get service name - handleServiceNameData(sdp_query_attribute_byte_event_get_attribute_length(packet), - sdp_query_attribute_byte_event_get_data_offset(packet), - sdp_query_attribute_byte_event_get_data(packet)); + handleServiceNameData(sdp_event_query_attribute_byte_get_attribute_length(packet), + sdp_event_query_attribute_byte_get_data_offset(packet), + sdp_event_query_attribute_byte_get_data(packet)); break; default: // give up diff --git a/test/pts/classic_test.c b/test/pts/classic_test.c index 305587fdb..c292f445c 100644 --- a/test/pts/classic_test.c +++ b/test/pts/classic_test.c @@ -398,8 +398,8 @@ static void handle_found_service(char * name, uint8_t port){ static void handle_query_rfcomm_event(uint8_t packet_type, uint8_t *packet, uint16_t size, void * context){ switch (packet[0]){ case SDP_EVENT_QUERY_RFCOMM_SERVICE: - handle_found_service(sdp_query_rfcomm_service_event_get_name(packet), - sdp_query_rfcomm_service_event_get_rfcomm_channel(packet)); + handle_found_service(sdp_event_query_rfcomm_service_get_name(packet), + sdp_event_query_rfcomm_service_get_rfcomm_channel(packet)); break; case SDP_EVENT_QUERY_COMPLETE: printf("SDP SPP Query complete\n"); diff --git a/test/pts/hfp_test.c b/test/pts/hfp_test.c index 45b3438d8..5a128f37a 100644 --- a/test/pts/hfp_test.c +++ b/test/pts/hfp_test.c @@ -142,8 +142,8 @@ static void packet_handler(void * connection, uint8_t packet_type, uint16_t chan void handle_query_rfcomm_event(uint8_t packet_type, uint8_t *packet, uint16_t size, void * context){ switch (event->type){ case SDP_EVENT_QUERY_RFCOMM_SERVICE: - channel_nr = sdp_query_rfcomm_service_event_get_name(packet); - printf("** Service name: '%s', RFCOMM port %u\n", sdp_query_rfcomm_service_event_get_rfcomm_channel(packet), channel_nr); + channel_nr = sdp_event_query_rfcomm_service_get_name(packet); + printf("** Service name: '%s', RFCOMM port %u\n", sdp_event_query_rfcomm_service_get_rfcomm_channel(packet), channel_nr); break; case SDP_EVENT_QUERY_COMPLETE: if (channel_nr > 0) { diff --git a/test/sdp_client/general_sdp_query.c b/test/sdp_client/general_sdp_query.c index 14ff72771..2bea9c2b3 100644 --- a/test/sdp_client/general_sdp_query.c +++ b/test/sdp_client/general_sdp_query.c @@ -118,27 +118,27 @@ static void test_attribute_value_event(const uint8_t * event){ CHECK_EQUAL(event[0], SDP_EVENT_QUERY_ATTRIBUTE_VALUE); // record ids are sequential - if (sdp_query_attribute_byte_event_get_record_id(event) != recordId){ + if (sdp_event_query_attribute_byte_get_record_id(event) != recordId){ recordId++; } - CHECK_EQUAL(sdp_query_attribute_byte_event_get_record_id(event), recordId); + CHECK_EQUAL(sdp_event_query_attribute_byte_get_record_id(event), recordId); // is attribute value complete - if (sdp_query_attribute_byte_event_get_attribute_id(event) != attributeId ){ + if (sdp_event_query_attribute_byte_get_attribute_id(event) != attributeId ){ if (attributeLength > 0){ CHECK_EQUAL(attributeLength, attributeOffset+1); } - attributeId = sdp_query_attribute_byte_event_get_attribute_id(event); + attributeId = sdp_event_query_attribute_byte_get_attribute_id(event); attributeOffset = 0; } // count attribute value bytes - if (sdp_query_attribute_byte_event_get_data_offset(event) != attributeOffset){ + if (sdp_event_query_attribute_byte_get_data_offset(event) != attributeOffset){ attributeOffset++; } - attributeLength = sdp_query_attribute_byte_event_get_attribute_length(event); + attributeLength = sdp_event_query_attribute_byte_get_attribute_length(event); - CHECK_EQUAL(sdp_query_attribute_byte_event_get_data_offset(event), attributeOffset); + CHECK_EQUAL(sdp_event_query_attribute_byte_get_data_offset(event), attributeOffset); } @@ -148,16 +148,16 @@ static void handle_sdp_parser_event(uint8_t packet_type, uint8_t *packet, uint16 test_attribute_value_event(packet); // handle new record - if (sdp_query_attribute_byte_event_get_record_id(packet) != record_id){ - record_id = sdp_query_attribute_byte_event_get_record_id(packet); + if (sdp_event_query_attribute_byte_get_record_id(packet) != record_id){ + record_id = sdp_event_query_attribute_byte_get_record_id(packet); } // buffer data - assertBuffer(sdp_query_attribute_byte_event_get_attribute_length(packet)); - attribute_value[sdp_query_attribute_byte_event_get_data_offset(packet)] = sdp_query_attribute_byte_event_get_data(packet); + assertBuffer(sdp_event_query_attribute_byte_get_attribute_length(packet)); + attribute_value[sdp_event_query_attribute_byte_get_data_offset(packet)] = sdp_event_query_attribute_byte_get_data(packet); break; case SDP_EVENT_QUERY_COMPLETE: - printf("General query done with status %d.\n", sdp_query_complete_event_get_status(packet)); + printf("General query done with status %d.\n", sdp_event_query_complete_get_status(packet)); break; } } diff --git a/test/sdp_client/sdp_rfcomm_query.c b/test/sdp_client/sdp_rfcomm_query.c index 65fdeb5ee..e9d38af0b 100644 --- a/test/sdp_client/sdp_rfcomm_query.c +++ b/test/sdp_client/sdp_rfcomm_query.c @@ -93,9 +93,9 @@ void sdp_query_rfcomm_init(); void handle_query_rfcomm_event(uint8_t packet_type, uint8_t *packet, uint16_t size, void * context){ switch (packet[0]){ case SDP_EVENT_QUERY_RFCOMM_SERVICE: - channel_nr[service_index] = sdp_query_rfcomm_service_event_get_rfcomm_channel(packet); + channel_nr[service_index] = sdp_event_query_rfcomm_service_get_rfcomm_channel(packet); service_name[service_index] = (char*) malloc(SDP_SERVICE_NAME_LEN+1); - strncpy(service_name[service_index], sdp_query_rfcomm_service_event_get_name(packet), SDP_SERVICE_NAME_LEN); + strncpy(service_name[service_index], sdp_event_query_rfcomm_service_get_name(packet), SDP_SERVICE_NAME_LEN); service_name[service_index][SDP_SERVICE_NAME_LEN] = 0; // printf("CALLBACK: Service name: '%s', RFCOMM port %u, service index %d\n", service_name[service_index], channel_nr[service_index], service_index); service_index++; diff --git a/test/sdp_client/service_attribute_search_query.c b/test/sdp_client/service_attribute_search_query.c index e4e4d1f40..62cf0b904 100644 --- a/test/sdp_client/service_attribute_search_query.c +++ b/test/sdp_client/service_attribute_search_query.c @@ -61,29 +61,29 @@ static void test_attribute_value_event(const uint8_t * event){ CHECK_EQUAL(event[0], SDP_EVENT_QUERY_ATTRIBUTE_VALUE); // record ids are sequential - // printf("sdp_query_attribute_byte_event_get_record_id(event) %d",sdp_query_attribute_byte_event_get_record_id(event)); + // printf("sdp_event_query_attribute_byte_get_record_id(event) %d",sdp_event_query_attribute_byte_get_record_id(event)); - if (sdp_query_attribute_byte_event_get_record_id(event) != recordId){ + if (sdp_event_query_attribute_byte_get_record_id(event) != recordId){ recordId++; } - CHECK_EQUAL(sdp_query_attribute_byte_event_get_record_id(event), recordId); + CHECK_EQUAL(sdp_event_query_attribute_byte_get_record_id(event), recordId); // is attribute value complete - if (sdp_query_attribute_byte_event_get_attribute_id(event) != attributeId ){ + if (sdp_event_query_attribute_byte_get_attribute_id(event) != attributeId ){ if (attributeLength > 0){ CHECK_EQUAL(attributeLength, attributeOffset+1); } - attributeId = sdp_query_attribute_byte_event_get_attribute_id(event); + attributeId = sdp_event_query_attribute_byte_get_attribute_id(event); attributeOffset = 0; } // count attribute value bytes - if (sdp_query_attribute_byte_event_get_data_offset(event) != attributeOffset){ + if (sdp_event_query_attribute_byte_get_data_offset(event) != attributeOffset){ attributeOffset++; } - attributeLength = sdp_query_attribute_byte_event_get_attribute_length(event); + attributeLength = sdp_event_query_attribute_byte_get_attribute_length(event); - CHECK_EQUAL(sdp_query_attribute_byte_event_get_data_offset(event), attributeOffset); + CHECK_EQUAL(sdp_event_query_attribute_byte_get_data_offset(event), attributeOffset); } @@ -93,16 +93,16 @@ static void handle_sdp_parser_event(uint8_t packet_type, uint8_t *packet, uint16 test_attribute_value_event(packet); // handle new record - if (sdp_query_attribute_byte_event_get_record_id(packet) != record_id){ - record_id = sdp_query_attribute_byte_event_get_record_id(packet); + if (sdp_event_query_attribute_byte_get_record_id(packet) != record_id){ + record_id = sdp_event_query_attribute_byte_get_record_id(packet); } // buffer data - assertBuffer(sdp_query_attribute_byte_event_get_attribute_length(packet)); - attribute_value[sdp_query_attribute_byte_event_get_data_offset(packet)] = sdp_query_attribute_byte_event_get_data(packet); + assertBuffer(sdp_event_query_attribute_byte_get_attribute_length(packet)); + attribute_value[sdp_event_query_attribute_byte_get_data_offset(packet)] = sdp_event_query_attribute_byte_get_data(packet); break; case SDP_EVENT_QUERY_COMPLETE: - printf("General query done with status %d.\n", sdp_query_complete_event_get_status(packet)); + printf("General query done with status %d.\n", sdp_event_query_complete_get_status(packet)); break; } } diff --git a/test/sdp_client/service_search_query.c b/test/sdp_client/service_search_query.c index cc830ce3c..8fc0113c8 100644 --- a/test/sdp_client/service_search_query.c +++ b/test/sdp_client/service_search_query.c @@ -48,7 +48,7 @@ static void handle_sdp_parser_event(uint8_t packet_type, uint8_t *packet, uint16 record_handle++; break; case SDP_EVENT_QUERY_COMPLETE: - printf("General query done with status %d.\n", sdp_query_complete_event_get_status(packet)); + printf("General query done with status %d.\n", sdp_event_query_complete_get_status(packet)); break; } } diff --git a/tool/btstack_event_generator.py b/tool/btstack_event_generator.py index 0fdca5e00..024c90c3b 100755 --- a/tool/btstack_event_generator.py +++ b/tool/btstack_event_generator.py @@ -203,15 +203,9 @@ def create_events(events): fout.write(copyright) fout.write(hfile_header_begin) for event_type, event_name, format, args in events: - if not event_name in [ - 'SDP_EVENT_QUERY_COMPLETE', - 'SDP_EVENT_QUERY_RFCOMM_SERVICE', - 'SDP_EVENT_QUERY_ATTRIBUTE_BYTE', - 'SDP_EVENT_QUERY_SERVICE_RECORD_HANDLE', - 'ANCS_EVENT_CLIENT_CONNECTED', - 'ANCS_EVENT_CLIENT_NOTIFICATION', - 'ANCS_EVENT_CLIENT_DISCONNECTED']: - continue + parts = event_name.split("_") + if not parts[0] in [ 'SDP', 'ANCS', 'SM']: + continue event_name = format_function_name(event_name) length_name = '' offset = 2