diff --git a/src/btstack_defines.h b/src/btstack_defines.h index e6355f17b..a75bd74fa 100644 --- a/src/btstack_defines.h +++ b/src/btstack_defines.h @@ -321,6 +321,7 @@ typedef uint8_t sm_key_t[16]; * @param remote_name */ #define HCI_EVENT_REMOTE_NAME_REQUEST_COMPLETE 0x07u + /** * @format 121 * @param status @@ -328,12 +329,14 @@ typedef uint8_t sm_key_t[16]; * @param encryption_enabled */ #define HCI_EVENT_ENCRYPTION_CHANGE 0x08u + /** * @format 12 * @param status * @param connection_handle */ #define HCI_EVENT_CHANGE_CONNECTION_LINK_KEY_COMPLETE 0x09u + /** * @format 121 * @param status @@ -421,6 +424,9 @@ typedef uint8_t sm_key_t[16]; // TODO: bd_addr B, link_key 16octets, key_type 1 #define HCI_EVENT_LINK_KEY_NOTIFICATION 0x18u +// event params contains HCI ccommand +#define HCI_EVENT_LOOPBACK_COMMAND 0x19u + /** * @format 1 * @param link_type @@ -451,7 +457,37 @@ typedef uint8_t sm_key_t[16]; */ #define HCI_EVENT_CONNECTION_PACKET_TYPE_CHANGED 0x1Du -/** +/** + * @format H + * @param handle + */ +#define HCI_EVENT_QOS_VIOLATION 0x1Eu + +// 0x1f not defined + +/** + * @format H1 + * @param handle + * @param page_scan_repetition_mode + */ +#define HCI_EVENT_PAGE_SCAN_REPETITION_MODE_CHANGE 0x20u + +/** + * @format 1H1114444 + * @param status + * @param handle + * @param unused + * @param flow_direction + * @param service_type + * @param token_rate + * @param token_bucket_size + * @param peak_bandwidth + * @param access_latency + * + */ +#define HCI_EVENT_FLOW_SPECIFICATION_COMPLETE 0x21u + +/** * @format 1B11321 * @param num_responses * @param bd_addr @@ -465,6 +501,8 @@ typedef uint8_t sm_key_t[16]; #define HCI_EVENT_READ_REMOTE_EXTENDED_FEATURES_COMPLETE 0x23u +// 0x24..0x2b not defined + /** * @format 1HB111221 * @param status @@ -479,8 +517,31 @@ typedef uint8_t sm_key_t[16]; */ #define HCI_EVENT_SYNCHRONOUS_CONNECTION_COMPLETE 0x2Cu +/** + * @format 1H1122 + * @param status + * @param handle + * @param transmission_interval + * @param retransmission_interval + * @param rx_packet_length + * @param tx_packet_length + */ +#define HCI_EVENT_SYNCHRONOUS_CONNECTION_CHANGED 0x2Du + +/** + * @format 1H2222 + * @param status + * @param handle + * @param max_tx_latency + * @param max_rx_latency + * @param min_remote_timeout + * @param min_local_timeout + */ +#define HCI_EVENT_SNIFF_SUBRATING 0x2Eu + // TODO: serialize extended_inquiry_response and provide parser -/** + +/** * @format 1B11321 * @param num_responses * @param bd_addr @@ -540,6 +601,21 @@ typedef uint8_t sm_key_t[16]; */ #define HCI_EVENT_SIMPLE_PAIRING_COMPLETE 0x36u +/** + * @format H2 + * @param handle + * @param link_supervision_timeout + */ +#define HCI_EVENT_LINK_SUPERVISION_TIMEOUT_CHANGED 0x38u + +/** + * @format H + * @param handle + */ +#define HCI_EVENT_ENHANCED_FLUSH_COMPLETE 0x39u + +// 0x03a not defined + /** * @format B4 * @param bd_addr @@ -554,11 +630,26 @@ typedef uint8_t sm_key_t[16]; */ #define HCI_EVENT_KEYPRESS_NOTIFICATION 0x3Cu +#define HCI_EVENT_REMOTE_HOST_SUPPORTED_FEATURES 0x3Du + #define HCI_EVENT_LE_META 0x3Eu -// last used HCI_EVENT in 2.1 is 0x3du -// last used HCI_EVENT in 4.1 is 0x57u -// last used HCI_EVENT in 5.2 is 0x58u +// 0x3f..0x47 not defined + +#define HCI_EVENT_NUMBER_OF_COMPLETED_DATA_BLOCKS 0x48u + +// 0x49..0x58 not defined + +/** + * @format 1211 + * @param status + * @param connection_handle + * @param encryption_enabled + * @param encryption_key_zie + */ +#define HCI_EVENT_ENCRYPTION_CHANGE_V2 0x59u + +// last used HCI_EVENT in 5.3 is 0x59u #define HCI_EVENT_VENDOR_SPECIFIC 0xFFu diff --git a/src/btstack_event.h b/src/btstack_event.h index db9593bea..5900e4927 100644 --- a/src/btstack_event.h +++ b/src/btstack_event.h @@ -778,6 +778,117 @@ static inline uint16_t hci_event_connection_packet_type_changed_get_packet_types return little_endian_read_16(event, 5); } +/** + * @brief Get field handle from event HCI_EVENT_QOS_VIOLATION + * @param event packet + * @return handle + * @note: btstack_type H + */ +static inline hci_con_handle_t hci_event_qos_violation_get_handle(const uint8_t * event){ + return little_endian_read_16(event, 2); +} + +/** + * @brief Get field handle from event HCI_EVENT_PAGE_SCAN_REPETITION_MODE_CHANGE + * @param event packet + * @return handle + * @note: btstack_type H + */ +static inline hci_con_handle_t hci_event_page_scan_repetition_mode_change_get_handle(const uint8_t * event){ + return little_endian_read_16(event, 2); +} +/** + * @brief Get field page_scan_repetition_mode from event HCI_EVENT_PAGE_SCAN_REPETITION_MODE_CHANGE + * @param event packet + * @return page_scan_repetition_mode + * @note: btstack_type 1 + */ +static inline uint8_t hci_event_page_scan_repetition_mode_change_get_page_scan_repetition_mode(const uint8_t * event){ + return event[4]; +} + +/** + * @brief Get field status from event HCI_EVENT_FLOW_SPECIFICATION_COMPLETE + * @param event packet + * @return status + * @note: btstack_type 1 + */ +static inline uint8_t hci_event_flow_specification_complete_get_status(const uint8_t * event){ + return event[2]; +} +/** + * @brief Get field handle from event HCI_EVENT_FLOW_SPECIFICATION_COMPLETE + * @param event packet + * @return handle + * @note: btstack_type H + */ +static inline hci_con_handle_t hci_event_flow_specification_complete_get_handle(const uint8_t * event){ + return little_endian_read_16(event, 3); +} +/** + * @brief Get field unused from event HCI_EVENT_FLOW_SPECIFICATION_COMPLETE + * @param event packet + * @return unused + * @note: btstack_type 1 + */ +static inline uint8_t hci_event_flow_specification_complete_get_unused(const uint8_t * event){ + return event[5]; +} +/** + * @brief Get field flow_direction from event HCI_EVENT_FLOW_SPECIFICATION_COMPLETE + * @param event packet + * @return flow_direction + * @note: btstack_type 1 + */ +static inline uint8_t hci_event_flow_specification_complete_get_flow_direction(const uint8_t * event){ + return event[6]; +} +/** + * @brief Get field service_type from event HCI_EVENT_FLOW_SPECIFICATION_COMPLETE + * @param event packet + * @return service_type + * @note: btstack_type 1 + */ +static inline uint8_t hci_event_flow_specification_complete_get_service_type(const uint8_t * event){ + return event[7]; +} +/** + * @brief Get field token_rate from event HCI_EVENT_FLOW_SPECIFICATION_COMPLETE + * @param event packet + * @return token_rate + * @note: btstack_type 4 + */ +static inline uint32_t hci_event_flow_specification_complete_get_token_rate(const uint8_t * event){ + return little_endian_read_32(event, 8); +} +/** + * @brief Get field token_bucket_size from event HCI_EVENT_FLOW_SPECIFICATION_COMPLETE + * @param event packet + * @return token_bucket_size + * @note: btstack_type 4 + */ +static inline uint32_t hci_event_flow_specification_complete_get_token_bucket_size(const uint8_t * event){ + return little_endian_read_32(event, 12); +} +/** + * @brief Get field peak_bandwidth from event HCI_EVENT_FLOW_SPECIFICATION_COMPLETE + * @param event packet + * @return peak_bandwidth + * @note: btstack_type 4 + */ +static inline uint32_t hci_event_flow_specification_complete_get_peak_bandwidth(const uint8_t * event){ + return little_endian_read_32(event, 16); +} +/** + * @brief Get field access_latency from event HCI_EVENT_FLOW_SPECIFICATION_COMPLETE + * @param event packet + * @return access_latency + * @note: btstack_type 4 + */ +static inline uint32_t hci_event_flow_specification_complete_get_access_latency(const uint8_t * event){ + return little_endian_read_32(event, 20); +} + /** * @brief Get field num_responses from event HCI_EVENT_INQUIRY_RESULT_WITH_RSSI * @param event packet @@ -924,6 +1035,116 @@ static inline uint8_t hci_event_synchronous_connection_complete_get_air_mode(con return event[18]; } +/** + * @brief Get field status from event HCI_EVENT_SYNCHRONOUS_CONNECTION_CHANGED + * @param event packet + * @return status + * @note: btstack_type 1 + */ +static inline uint8_t hci_event_synchronous_connection_changed_get_status(const uint8_t * event){ + return event[2]; +} +/** + * @brief Get field handle from event HCI_EVENT_SYNCHRONOUS_CONNECTION_CHANGED + * @param event packet + * @return handle + * @note: btstack_type H + */ +static inline hci_con_handle_t hci_event_synchronous_connection_changed_get_handle(const uint8_t * event){ + return little_endian_read_16(event, 3); +} +/** + * @brief Get field transmission_interval from event HCI_EVENT_SYNCHRONOUS_CONNECTION_CHANGED + * @param event packet + * @return transmission_interval + * @note: btstack_type 1 + */ +static inline uint8_t hci_event_synchronous_connection_changed_get_transmission_interval(const uint8_t * event){ + return event[5]; +} +/** + * @brief Get field retransmission_interval from event HCI_EVENT_SYNCHRONOUS_CONNECTION_CHANGED + * @param event packet + * @return retransmission_interval + * @note: btstack_type 1 + */ +static inline uint8_t hci_event_synchronous_connection_changed_get_retransmission_interval(const uint8_t * event){ + return event[6]; +} +/** + * @brief Get field rx_packet_length from event HCI_EVENT_SYNCHRONOUS_CONNECTION_CHANGED + * @param event packet + * @return rx_packet_length + * @note: btstack_type 2 + */ +static inline uint16_t hci_event_synchronous_connection_changed_get_rx_packet_length(const uint8_t * event){ + return little_endian_read_16(event, 7); +} +/** + * @brief Get field tx_packet_length from event HCI_EVENT_SYNCHRONOUS_CONNECTION_CHANGED + * @param event packet + * @return tx_packet_length + * @note: btstack_type 2 + */ +static inline uint16_t hci_event_synchronous_connection_changed_get_tx_packet_length(const uint8_t * event){ + return little_endian_read_16(event, 9); +} + +/** + * @brief Get field status from event HCI_EVENT_SNIFF_SUBRATING + * @param event packet + * @return status + * @note: btstack_type 1 + */ +static inline uint8_t hci_event_sniff_subrating_get_status(const uint8_t * event){ + return event[2]; +} +/** + * @brief Get field handle from event HCI_EVENT_SNIFF_SUBRATING + * @param event packet + * @return handle + * @note: btstack_type H + */ +static inline hci_con_handle_t hci_event_sniff_subrating_get_handle(const uint8_t * event){ + return little_endian_read_16(event, 3); +} +/** + * @brief Get field max_tx_latency from event HCI_EVENT_SNIFF_SUBRATING + * @param event packet + * @return max_tx_latency + * @note: btstack_type 2 + */ +static inline uint16_t hci_event_sniff_subrating_get_max_tx_latency(const uint8_t * event){ + return little_endian_read_16(event, 5); +} +/** + * @brief Get field max_rx_latency from event HCI_EVENT_SNIFF_SUBRATING + * @param event packet + * @return max_rx_latency + * @note: btstack_type 2 + */ +static inline uint16_t hci_event_sniff_subrating_get_max_rx_latency(const uint8_t * event){ + return little_endian_read_16(event, 7); +} +/** + * @brief Get field min_remote_timeout from event HCI_EVENT_SNIFF_SUBRATING + * @param event packet + * @return min_remote_timeout + * @note: btstack_type 2 + */ +static inline uint16_t hci_event_sniff_subrating_get_min_remote_timeout(const uint8_t * event){ + return little_endian_read_16(event, 9); +} +/** + * @brief Get field min_local_timeout from event HCI_EVENT_SNIFF_SUBRATING + * @param event packet + * @return min_local_timeout + * @note: btstack_type 2 + */ +static inline uint16_t hci_event_sniff_subrating_get_min_local_timeout(const uint8_t * event){ + return little_endian_read_16(event, 11); +} + /** * @brief Get field num_responses from event HCI_EVENT_EXTENDED_INQUIRY_RESPONSE * @param event packet @@ -1112,6 +1333,35 @@ static inline void hci_event_simple_pairing_complete_get_bd_addr(const uint8_t * reverse_bytes(&event[3], bd_addr, 6); } +/** + * @brief Get field handle from event HCI_EVENT_LINK_SUPERVISION_TIMEOUT_CHANGED + * @param event packet + * @return handle + * @note: btstack_type H + */ +static inline hci_con_handle_t hci_event_link_supervision_timeout_changed_get_handle(const uint8_t * event){ + return little_endian_read_16(event, 2); +} +/** + * @brief Get field link_supervision_timeout from event HCI_EVENT_LINK_SUPERVISION_TIMEOUT_CHANGED + * @param event packet + * @return link_supervision_timeout + * @note: btstack_type 2 + */ +static inline uint16_t hci_event_link_supervision_timeout_changed_get_link_supervision_timeout(const uint8_t * event){ + return little_endian_read_16(event, 4); +} + +/** + * @brief Get field handle from event HCI_EVENT_ENHANCED_FLUSH_COMPLETE + * @param event packet + * @return handle + * @note: btstack_type H + */ +static inline hci_con_handle_t hci_event_enhanced_flush_complete_get_handle(const uint8_t * event){ + return little_endian_read_16(event, 2); +} + /** * @brief Get field bd_addr from event HCI_EVENT_USER_PASSKEY_NOTIFICATION * @param event packet @@ -1150,6 +1400,43 @@ static inline uint8_t hci_event_keypress_notification_get_notification_type(cons return event[8]; } +/** + * @brief Get field status from event HCI_EVENT_ENCRYPTION_CHANGE_V2 + * @param event packet + * @return status + * @note: btstack_type 1 + */ +static inline uint8_t hci_event_encryption_change_v2_get_status(const uint8_t * event){ + return event[2]; +} +/** + * @brief Get field connection_handle from event HCI_EVENT_ENCRYPTION_CHANGE_V2 + * @param event packet + * @return connection_handle + * @note: btstack_type 2 + */ +static inline uint16_t hci_event_encryption_change_v2_get_connection_handle(const uint8_t * event){ + return little_endian_read_16(event, 3); +} +/** + * @brief Get field encryption_enabled from event HCI_EVENT_ENCRYPTION_CHANGE_V2 + * @param event packet + * @return encryption_enabled + * @note: btstack_type 1 + */ +static inline uint8_t hci_event_encryption_change_v2_get_encryption_enabled(const uint8_t * event){ + return event[5]; +} +/** + * @brief Get field encryption_key_zie from event HCI_EVENT_ENCRYPTION_CHANGE_V2 + * @param event packet + * @return encryption_key_zie + * @note: btstack_type 1 + */ +static inline uint8_t hci_event_encryption_change_v2_get_encryption_key_zie(const uint8_t * event){ + return event[6]; +} + /** * @brief Get field state from event BTSTACK_EVENT_STATE * @param event packet