hfp: use acl_handle in all events, set to HCI_CON_HANDLE_INVALID if no connection associated

This commit is contained in:
Matthias Ringwald 2021-04-08 12:18:53 +02:00
parent 3e0b44a98e
commit 7d81706fa7
4 changed files with 121 additions and 116 deletions

View File

@ -1521,14 +1521,14 @@ typedef uint8_t sm_key_t[16];
/**
* @format 1H
* @param subevent_code
* @param con_handle
* @param acl_handle
*/
#define HFP_SUBEVENT_SERVICE_LEVEL_CONNECTION_RELEASED 0x02
/**
* @format 1H1HB1
* @param subevent_code
* @param con_handle
* @param acl_handle
* @param status 0 == OK
* @param sco_handle
* @param bd_addr
@ -1539,7 +1539,7 @@ typedef uint8_t sm_key_t[16];
/**
* @format 1HH
* @param subevent_code
* @param con_handle
* @param acl_handle
* @param sco_handle
*/
#define HFP_SUBEVENT_AUDIO_CONNECTION_RELEASED 0x04
@ -1547,7 +1547,7 @@ typedef uint8_t sm_key_t[16];
/**
* @format 1H1
* @param subevent_code
* @param con_handle
* @param acl_handle
* @param status 0 == OK
*/
#define HFP_SUBEVENT_COMPLETE 0x05
@ -1555,7 +1555,7 @@ typedef uint8_t sm_key_t[16];
/**
* @format 1H1111111T
* @param subevent_code
* @param con_handle
* @param acl_handle
* @param indicator_index
* @param indicator_status
* @param indicator_min_range
@ -1570,7 +1570,7 @@ typedef uint8_t sm_key_t[16];
/**
* @format 1H11T
* @param subevent_code
* @param con_handle
* @param acl_handle
* @param network_operator_mode
* @param network_operator_format
* @param network_operator_name
@ -1580,7 +1580,7 @@ typedef uint8_t sm_key_t[16];
/**
* @format 1H1
* @param subevent_code
* @param con_handle
* @param acl_handle
* @param error
*/
#define HFP_SUBEVENT_EXTENDED_AUDIO_GATEWAY_ERROR 0x08
@ -1588,27 +1588,28 @@ typedef uint8_t sm_key_t[16];
/**
* @format 1H
* @param subevent_code
* @param con_handle
* @param acl_handle
*/
#define HFP_SUBEVENT_START_RINGINIG 0x0A
/**
* @format 1H
* @param subevent_code
* @param con_handle
* @param acl_handle
*/
#define HFP_SUBEVENT_STOP_RINGINIG 0x0B
/**
* @format 1
* @format 1H
* @param subevent_code
* @param acl_handle
*/
#define HFP_SUBEVENT_CALL_TERMINATED 0x0C
/**
* @format 1HT
* @param subevent_code
* @param con_handle
* @param acl_handle
* @param number
*/
#define HFP_SUBEVENT_PLACE_CALL_WITH_NUMBER 0x0D
@ -1616,14 +1617,14 @@ typedef uint8_t sm_key_t[16];
/**
* @format 1H
* @param subevent_code
* @param con_handle
* @param acl_handle
*/
#define HFP_SUBEVENT_ATTACH_NUMBER_TO_VOICE_TAG 0x0E
/**
* @format 1HT
* @param subevent_code
* @param con_handle
* @param acl_handle
* @param number
*/
#define HFP_SUBEVENT_NUMBER_FOR_VOICE_TAG 0x0F
@ -1631,7 +1632,7 @@ typedef uint8_t sm_key_t[16];
/**
* @format 1HT
* @param subevent_code
* @param con_handle
* @param acl_handle
* @param dtmf code
*/
#define HFP_SUBEVENT_TRANSMIT_DTMF_CODES 0x10
@ -1639,28 +1640,28 @@ typedef uint8_t sm_key_t[16];
/**
* @format 1H
* @param subevent_code
* @param con_handle
* @param acl_handle
*/
#define HFP_SUBEVENT_CALL_ANSWERED 0x11
/**
* @format 1H
* @param subevent_code
* @param con_handle
* @param acl_handle
*/
#define HFP_SUBEVENT_CONFERENCE_CALL 0x12
/**
* @format 1H
* @param subevent_code
* @param con_handle
* @param acl_handle
*/
#define HFP_SUBEVENT_RING 0x13
/**
* @format 1H1
* @param subevent_code
* @param con_handle
* @param acl_handle
* @param gain
*/
#define HFP_SUBEVENT_SPEAKER_VOLUME 0x14
@ -1668,7 +1669,7 @@ typedef uint8_t sm_key_t[16];
/**
* @format 1H1
* @param subevent_code
* @param con_handle
* @param acl_handle
* @param gain
*/
#define HFP_SUBEVENT_MICROPHONE_VOLUME 0x15
@ -1676,7 +1677,7 @@ typedef uint8_t sm_key_t[16];
/**
* @format 1H1T
* @param subevent_code
* @param con_handle
* @param acl_handle
* @param type
* @param number
*/
@ -1685,7 +1686,7 @@ typedef uint8_t sm_key_t[16];
/**
* @format 1H1T
* @param subevent_code
* @param con_handle
* @param acl_handle
* @param type
* @param number
*/
@ -1694,7 +1695,7 @@ typedef uint8_t sm_key_t[16];
/**
* @format 1H111111T
* @param subevent_code
* @param con_handle
* @param acl_handle
* @param clcc_idx
* @param clcc_dir
* @param clcc_status
@ -1708,7 +1709,7 @@ typedef uint8_t sm_key_t[16];
/**
* @format 1H11T
* @param subevent_code
* @param con_handle
* @param acl_handle
* @param status
* @param bnip_type
* @param bnip_number
@ -1718,7 +1719,7 @@ typedef uint8_t sm_key_t[16];
/**
* @format 1HT
* @param subevent_code
* @param con_handle
* @param acl_handle
* @param value
*/
#define HFP_SUBEVENT_RESPONSE_AND_HOLD_STATUS 0x1A
@ -1726,7 +1727,7 @@ typedef uint8_t sm_key_t[16];
/**
* @format 1HT
* @param subevent_code
* @param con_handle
* @param acl_handle
* @param command
*/
#define HFP_SUBEVENT_AT_MESSAGE_SENT 0x1B
@ -1734,7 +1735,7 @@ typedef uint8_t sm_key_t[16];
/**
* @format 1HT
* @param subevent_code
* @param con_handle
* @param acl_handle
* @param command
*/
#define HFP_SUBEVENT_AT_MESSAGE_RECEIVED 0x1C

View File

@ -3979,22 +3979,22 @@ static inline void hfp_subevent_service_level_connection_established_get_bd_addr
}
/**
* @brief Get field con_handle from event HFP_SUBEVENT_SERVICE_LEVEL_CONNECTION_RELEASED
* @brief Get field acl_handle from event HFP_SUBEVENT_SERVICE_LEVEL_CONNECTION_RELEASED
* @param event packet
* @return con_handle
* @return acl_handle
* @note: btstack_type H
*/
static inline hci_con_handle_t hfp_subevent_service_level_connection_released_get_con_handle(const uint8_t * event){
static inline hci_con_handle_t hfp_subevent_service_level_connection_released_get_acl_handle(const uint8_t * event){
return little_endian_read_16(event, 3);
}
/**
* @brief Get field con_handle from event HFP_SUBEVENT_AUDIO_CONNECTION_ESTABLISHED
* @brief Get field acl_handle from event HFP_SUBEVENT_AUDIO_CONNECTION_ESTABLISHED
* @param event packet
* @return con_handle
* @return acl_handle
* @note: btstack_type H
*/
static inline hci_con_handle_t hfp_subevent_audio_connection_established_get_con_handle(const uint8_t * event){
static inline hci_con_handle_t hfp_subevent_audio_connection_established_get_acl_handle(const uint8_t * event){
return little_endian_read_16(event, 3);
}
/**
@ -4035,12 +4035,12 @@ static inline uint8_t hfp_subevent_audio_connection_established_get_negotiated_c
}
/**
* @brief Get field con_handle from event HFP_SUBEVENT_AUDIO_CONNECTION_RELEASED
* @brief Get field acl_handle from event HFP_SUBEVENT_AUDIO_CONNECTION_RELEASED
* @param event packet
* @return con_handle
* @return acl_handle
* @note: btstack_type H
*/
static inline hci_con_handle_t hfp_subevent_audio_connection_released_get_con_handle(const uint8_t * event){
static inline hci_con_handle_t hfp_subevent_audio_connection_released_get_acl_handle(const uint8_t * event){
return little_endian_read_16(event, 3);
}
/**
@ -4054,12 +4054,12 @@ static inline hci_con_handle_t hfp_subevent_audio_connection_released_get_sco_ha
}
/**
* @brief Get field con_handle from event HFP_SUBEVENT_COMPLETE
* @brief Get field acl_handle from event HFP_SUBEVENT_COMPLETE
* @param event packet
* @return con_handle
* @return acl_handle
* @note: btstack_type H
*/
static inline hci_con_handle_t hfp_subevent_complete_get_con_handle(const uint8_t * event){
static inline hci_con_handle_t hfp_subevent_complete_get_acl_handle(const uint8_t * event){
return little_endian_read_16(event, 3);
}
/**
@ -4073,12 +4073,12 @@ static inline uint8_t hfp_subevent_complete_get_status(const uint8_t * event){
}
/**
* @brief Get field con_handle from event HFP_SUBEVENT_AG_INDICATOR_STATUS_CHANGED
* @brief Get field acl_handle from event HFP_SUBEVENT_AG_INDICATOR_STATUS_CHANGED
* @param event packet
* @return con_handle
* @return acl_handle
* @note: btstack_type H
*/
static inline hci_con_handle_t hfp_subevent_ag_indicator_status_changed_get_con_handle(const uint8_t * event){
static inline hci_con_handle_t hfp_subevent_ag_indicator_status_changed_get_acl_handle(const uint8_t * event){
return little_endian_read_16(event, 3);
}
/**
@ -4155,12 +4155,12 @@ static inline const char * hfp_subevent_ag_indicator_status_changed_get_indicato
}
/**
* @brief Get field con_handle from event HFP_SUBEVENT_NETWORK_OPERATOR_CHANGED
* @brief Get field acl_handle from event HFP_SUBEVENT_NETWORK_OPERATOR_CHANGED
* @param event packet
* @return con_handle
* @return acl_handle
* @note: btstack_type H
*/
static inline hci_con_handle_t hfp_subevent_network_operator_changed_get_con_handle(const uint8_t * event){
static inline hci_con_handle_t hfp_subevent_network_operator_changed_get_acl_handle(const uint8_t * event){
return little_endian_read_16(event, 3);
}
/**
@ -4192,12 +4192,12 @@ static inline const char * hfp_subevent_network_operator_changed_get_network_ope
}
/**
* @brief Get field con_handle from event HFP_SUBEVENT_EXTENDED_AUDIO_GATEWAY_ERROR
* @brief Get field acl_handle from event HFP_SUBEVENT_EXTENDED_AUDIO_GATEWAY_ERROR
* @param event packet
* @return con_handle
* @return acl_handle
* @note: btstack_type H
*/
static inline hci_con_handle_t hfp_subevent_extended_audio_gateway_error_get_con_handle(const uint8_t * event){
static inline hci_con_handle_t hfp_subevent_extended_audio_gateway_error_get_acl_handle(const uint8_t * event){
return little_endian_read_16(event, 3);
}
/**
@ -4211,33 +4211,42 @@ static inline uint8_t hfp_subevent_extended_audio_gateway_error_get_error(const
}
/**
* @brief Get field con_handle from event HFP_SUBEVENT_START_RINGINIG
* @brief Get field acl_handle from event HFP_SUBEVENT_START_RINGINIG
* @param event packet
* @return con_handle
* @return acl_handle
* @note: btstack_type H
*/
static inline hci_con_handle_t hfp_subevent_start_ringinig_get_con_handle(const uint8_t * event){
static inline hci_con_handle_t hfp_subevent_start_ringinig_get_acl_handle(const uint8_t * event){
return little_endian_read_16(event, 3);
}
/**
* @brief Get field con_handle from event HFP_SUBEVENT_STOP_RINGINIG
* @brief Get field acl_handle from event HFP_SUBEVENT_STOP_RINGINIG
* @param event packet
* @return con_handle
* @return acl_handle
* @note: btstack_type H
*/
static inline hci_con_handle_t hfp_subevent_stop_ringinig_get_con_handle(const uint8_t * event){
static inline hci_con_handle_t hfp_subevent_stop_ringinig_get_acl_handle(const uint8_t * event){
return little_endian_read_16(event, 3);
}
/**
* @brief Get field con_handle from event HFP_SUBEVENT_PLACE_CALL_WITH_NUMBER
* @brief Get field acl_handle from event HFP_SUBEVENT_CALL_TERMINATED
* @param event packet
* @return con_handle
* @return acl_handle
* @note: btstack_type H
*/
static inline hci_con_handle_t hfp_subevent_place_call_with_number_get_con_handle(const uint8_t * event){
static inline hci_con_handle_t hfp_subevent_call_terminated_get_acl_handle(const uint8_t * event){
return little_endian_read_16(event, 3);
}
/**
* @brief Get field acl_handle from event HFP_SUBEVENT_PLACE_CALL_WITH_NUMBER
* @param event packet
* @return acl_handle
* @note: btstack_type H
*/
static inline hci_con_handle_t hfp_subevent_place_call_with_number_get_acl_handle(const uint8_t * event){
return little_endian_read_16(event, 3);
}
/**
@ -4251,22 +4260,22 @@ static inline const char * hfp_subevent_place_call_with_number_get_number(const
}
/**
* @brief Get field con_handle from event HFP_SUBEVENT_ATTACH_NUMBER_TO_VOICE_TAG
* @brief Get field acl_handle from event HFP_SUBEVENT_ATTACH_NUMBER_TO_VOICE_TAG
* @param event packet
* @return con_handle
* @return acl_handle
* @note: btstack_type H
*/
static inline hci_con_handle_t hfp_subevent_attach_number_to_voice_tag_get_con_handle(const uint8_t * event){
static inline hci_con_handle_t hfp_subevent_attach_number_to_voice_tag_get_acl_handle(const uint8_t * event){
return little_endian_read_16(event, 3);
}
/**
* @brief Get field con_handle from event HFP_SUBEVENT_NUMBER_FOR_VOICE_TAG
* @brief Get field acl_handle from event HFP_SUBEVENT_NUMBER_FOR_VOICE_TAG
* @param event packet
* @return con_handle
* @return acl_handle
* @note: btstack_type H
*/
static inline hci_con_handle_t hfp_subevent_number_for_voice_tag_get_con_handle(const uint8_t * event){
static inline hci_con_handle_t hfp_subevent_number_for_voice_tag_get_acl_handle(const uint8_t * event){
return little_endian_read_16(event, 3);
}
/**
@ -4280,12 +4289,12 @@ static inline const char * hfp_subevent_number_for_voice_tag_get_number(const ui
}
/**
* @brief Get field con_handle from event HFP_SUBEVENT_TRANSMIT_DTMF_CODES
* @brief Get field acl_handle from event HFP_SUBEVENT_TRANSMIT_DTMF_CODES
* @param event packet
* @return con_handle
* @return acl_handle
* @note: btstack_type H
*/
static inline hci_con_handle_t hfp_subevent_transmit_dtmf_codes_get_con_handle(const uint8_t * event){
static inline hci_con_handle_t hfp_subevent_transmit_dtmf_codes_get_acl_handle(const uint8_t * event){
return little_endian_read_16(event, 3);
}
/**
@ -4299,42 +4308,42 @@ static inline const char * hfp_subevent_transmit_dtmf_codes_get_dtmf(const uint8
}
/**
* @brief Get field con_handle from event HFP_SUBEVENT_CALL_ANSWERED
* @brief Get field acl_handle from event HFP_SUBEVENT_CALL_ANSWERED
* @param event packet
* @return con_handle
* @return acl_handle
* @note: btstack_type H
*/
static inline hci_con_handle_t hfp_subevent_call_answered_get_con_handle(const uint8_t * event){
static inline hci_con_handle_t hfp_subevent_call_answered_get_acl_handle(const uint8_t * event){
return little_endian_read_16(event, 3);
}
/**
* @brief Get field con_handle from event HFP_SUBEVENT_CONFERENCE_CALL
* @brief Get field acl_handle from event HFP_SUBEVENT_CONFERENCE_CALL
* @param event packet
* @return con_handle
* @return acl_handle
* @note: btstack_type H
*/
static inline hci_con_handle_t hfp_subevent_conference_call_get_con_handle(const uint8_t * event){
static inline hci_con_handle_t hfp_subevent_conference_call_get_acl_handle(const uint8_t * event){
return little_endian_read_16(event, 3);
}
/**
* @brief Get field con_handle from event HFP_SUBEVENT_RING
* @brief Get field acl_handle from event HFP_SUBEVENT_RING
* @param event packet
* @return con_handle
* @return acl_handle
* @note: btstack_type H
*/
static inline hci_con_handle_t hfp_subevent_ring_get_con_handle(const uint8_t * event){
static inline hci_con_handle_t hfp_subevent_ring_get_acl_handle(const uint8_t * event){
return little_endian_read_16(event, 3);
}
/**
* @brief Get field con_handle from event HFP_SUBEVENT_SPEAKER_VOLUME
* @brief Get field acl_handle from event HFP_SUBEVENT_SPEAKER_VOLUME
* @param event packet
* @return con_handle
* @return acl_handle
* @note: btstack_type H
*/
static inline hci_con_handle_t hfp_subevent_speaker_volume_get_con_handle(const uint8_t * event){
static inline hci_con_handle_t hfp_subevent_speaker_volume_get_acl_handle(const uint8_t * event){
return little_endian_read_16(event, 3);
}
/**
@ -4348,12 +4357,12 @@ static inline uint8_t hfp_subevent_speaker_volume_get_gain(const uint8_t * event
}
/**
* @brief Get field con_handle from event HFP_SUBEVENT_MICROPHONE_VOLUME
* @brief Get field acl_handle from event HFP_SUBEVENT_MICROPHONE_VOLUME
* @param event packet
* @return con_handle
* @return acl_handle
* @note: btstack_type H
*/
static inline hci_con_handle_t hfp_subevent_microphone_volume_get_con_handle(const uint8_t * event){
static inline hci_con_handle_t hfp_subevent_microphone_volume_get_acl_handle(const uint8_t * event){
return little_endian_read_16(event, 3);
}
/**
@ -4367,12 +4376,12 @@ static inline uint8_t hfp_subevent_microphone_volume_get_gain(const uint8_t * ev
}
/**
* @brief Get field con_handle from event HFP_SUBEVENT_CALL_WAITING_NOTIFICATION
* @brief Get field acl_handle from event HFP_SUBEVENT_CALL_WAITING_NOTIFICATION
* @param event packet
* @return con_handle
* @return acl_handle
* @note: btstack_type H
*/
static inline hci_con_handle_t hfp_subevent_call_waiting_notification_get_con_handle(const uint8_t * event){
static inline hci_con_handle_t hfp_subevent_call_waiting_notification_get_acl_handle(const uint8_t * event){
return little_endian_read_16(event, 3);
}
/**
@ -4395,12 +4404,12 @@ static inline const char * hfp_subevent_call_waiting_notification_get_number(con
}
/**
* @brief Get field con_handle from event HFP_SUBEVENT_CALLING_LINE_IDENTIFICATION_NOTIFICATION
* @brief Get field acl_handle from event HFP_SUBEVENT_CALLING_LINE_IDENTIFICATION_NOTIFICATION
* @param event packet
* @return con_handle
* @return acl_handle
* @note: btstack_type H
*/
static inline hci_con_handle_t hfp_subevent_calling_line_identification_notification_get_con_handle(const uint8_t * event){
static inline hci_con_handle_t hfp_subevent_calling_line_identification_notification_get_acl_handle(const uint8_t * event){
return little_endian_read_16(event, 3);
}
/**
@ -4423,12 +4432,12 @@ static inline const char * hfp_subevent_calling_line_identification_notification
}
/**
* @brief Get field con_handle from event HFP_SUBEVENT_ENHANCED_CALL_STATUS
* @brief Get field acl_handle from event HFP_SUBEVENT_ENHANCED_CALL_STATUS
* @param event packet
* @return con_handle
* @return acl_handle
* @note: btstack_type H
*/
static inline hci_con_handle_t hfp_subevent_enhanced_call_status_get_con_handle(const uint8_t * event){
static inline hci_con_handle_t hfp_subevent_enhanced_call_status_get_acl_handle(const uint8_t * event){
return little_endian_read_16(event, 3);
}
/**
@ -4496,12 +4505,12 @@ static inline const char * hfp_subevent_enhanced_call_status_get_bnip_number(con
}
/**
* @brief Get field con_handle from event HFP_SUBEVENT_SUBSCRIBER_NUMBER_INFORMATION
* @brief Get field acl_handle from event HFP_SUBEVENT_SUBSCRIBER_NUMBER_INFORMATION
* @param event packet
* @return con_handle
* @return acl_handle
* @note: btstack_type H
*/
static inline hci_con_handle_t hfp_subevent_subscriber_number_information_get_con_handle(const uint8_t * event){
static inline hci_con_handle_t hfp_subevent_subscriber_number_information_get_acl_handle(const uint8_t * event){
return little_endian_read_16(event, 3);
}
/**
@ -4533,12 +4542,12 @@ static inline const char * hfp_subevent_subscriber_number_information_get_bnip_n
}
/**
* @brief Get field con_handle from event HFP_SUBEVENT_RESPONSE_AND_HOLD_STATUS
* @brief Get field acl_handle from event HFP_SUBEVENT_RESPONSE_AND_HOLD_STATUS
* @param event packet
* @return con_handle
* @return acl_handle
* @note: btstack_type H
*/
static inline hci_con_handle_t hfp_subevent_response_and_hold_status_get_con_handle(const uint8_t * event){
static inline hci_con_handle_t hfp_subevent_response_and_hold_status_get_acl_handle(const uint8_t * event){
return little_endian_read_16(event, 3);
}
/**
@ -4552,12 +4561,12 @@ static inline const char * hfp_subevent_response_and_hold_status_get_value(const
}
/**
* @brief Get field con_handle from event HFP_SUBEVENT_AT_MESSAGE_SENT
* @brief Get field acl_handle from event HFP_SUBEVENT_AT_MESSAGE_SENT
* @param event packet
* @return con_handle
* @return acl_handle
* @note: btstack_type H
*/
static inline hci_con_handle_t hfp_subevent_at_message_sent_get_con_handle(const uint8_t * event){
static inline hci_con_handle_t hfp_subevent_at_message_sent_get_acl_handle(const uint8_t * event){
return little_endian_read_16(event, 3);
}
/**
@ -4571,12 +4580,12 @@ static inline const char * hfp_subevent_at_message_sent_get_command(const uint8_
}
/**
* @brief Get field con_handle from event HFP_SUBEVENT_AT_MESSAGE_RECEIVED
* @brief Get field acl_handle from event HFP_SUBEVENT_AT_MESSAGE_RECEIVED
* @param event packet
* @return con_handle
* @return acl_handle
* @note: btstack_type H
*/
static inline hci_con_handle_t hfp_subevent_at_message_received_get_con_handle(const uint8_t * event){
static inline hci_con_handle_t hfp_subevent_at_message_received_get_acl_handle(const uint8_t * event){
return little_endian_read_16(event, 3);
}
/**

View File

@ -49,7 +49,6 @@
#include "btstack_event.h"
#include "btstack_memory.h"
#include "btstack_run_loop.h"
#include "classic/core.h"
#include "classic/sdp_client_rfcomm.h"
#include "classic/sdp_server.h"
#include "classic/sdp_util.h"
@ -57,7 +56,6 @@
#include "hci.h"
#include "hci_cmd.h"
#include "hci_dump.h"
#include "l2cap.h"
#if defined(ENABLE_CC256X_ASSISTED_HFP) && !defined(ENABLE_SCO_OVER_PCM)
#error "Assisted HFP is only possible over PCM/I2S. Please add define: ENABLE_SCO_OVER_PCM"
@ -331,25 +329,28 @@ static void hfp_emit_event_for_context(hfp_connection_t * hfp_connection, uint8_
}
void hfp_emit_simple_event(hfp_connection_t * hfp_connection, uint8_t event_subtype){
hci_con_handle_t acl_handle = (hfp_connection != NULL) ? hfp_connection->acl_handle : HCI_CON_HANDLE_INVALID;
uint8_t event[5];
event[0] = HCI_EVENT_HFP_META;
event[1] = sizeof(event) - 2;
event[2] = event_subtype;
little_endian_store_16(event, 3, hfp_connection->acl_handle);
little_endian_store_16(event, 3, acl_handle);
hfp_emit_event_for_context(hfp_connection, event, sizeof(event));
}
void hfp_emit_event(hfp_connection_t * hfp_connection, uint8_t event_subtype, uint8_t value){
hci_con_handle_t acl_handle = (hfp_connection != NULL) ? hfp_connection->acl_handle : HCI_CON_HANDLE_INVALID;
uint8_t event[6];
event[0] = HCI_EVENT_HFP_META;
event[1] = sizeof(event) - 2;
event[2] = event_subtype;
little_endian_store_16(event, 3, hfp_connection->acl_handle);
little_endian_store_16(event, 3, acl_handle);
event[5] = value; // status 0 == OK
hfp_emit_event_for_context(hfp_connection, event, sizeof(event));
}
void hfp_emit_slc_connection_event(hfp_connection_t * hfp_connection, uint8_t status, hci_con_handle_t con_handle, bd_addr_t addr){
btstack_assert(hfp_connection != NULL);
uint8_t event[12];
int pos = 0;
event[pos++] = HCI_EVENT_HFP_META;
@ -364,6 +365,7 @@ void hfp_emit_slc_connection_event(hfp_connection_t * hfp_connection, uint8_t st
}
static void hfp_emit_audio_connection_released(hfp_connection_t * hfp_connection, hci_con_handle_t sco_handle){
btstack_assert(hfp_connection != NULL);
uint8_t event[7];
int pos = 0;
event[pos++] = HCI_EVENT_HFP_META;
@ -377,6 +379,7 @@ static void hfp_emit_audio_connection_released(hfp_connection_t * hfp_connection
}
void hfp_emit_sco_event(hfp_connection_t * hfp_connection, uint8_t status, hci_con_handle_t sco_handle, bd_addr_t addr, uint8_t negotiated_codec){
btstack_assert(hfp_connection != NULL);
uint8_t event[15];
int pos = 0;
event[pos++] = HCI_EVENT_HFP_META;
@ -394,6 +397,7 @@ void hfp_emit_sco_event(hfp_connection_t * hfp_connection, uint8_t status, hci_c
}
void hfp_emit_string_event(hfp_connection_t * hfp_connection, uint8_t event_subtype, const char * value){
btstack_assert(hfp_connection != NULL);
#ifdef ENABLE_HFP_AT_MESSAGES
uint8_t event[256];
#else

View File

@ -109,15 +109,6 @@ static hfp_phone_number_t * subscriber_numbers;
static int subscriber_numbers_count;
// code
static void hfp_ag_emit_simple_event(uint8_t event_subtype){
uint8_t event[3];
event[0] = HCI_EVENT_HFP_META;
event[1] = sizeof(event) - 2;
event[2] = event_subtype;
if (!hfp_ag_callback) return;
(*hfp_ag_callback)(HCI_EVENT_PACKET, 0, event, sizeof(event));
}
static int hfp_ag_get_ag_indicators_nr(hfp_connection_t * hfp_connection){
if (hfp_connection->ag_indicators_nr != hfp_ag_indicators_nr){
hfp_connection->ag_indicators_nr = hfp_ag_indicators_nr;
@ -995,7 +986,7 @@ static void hfp_ag_trigger_terminate_call(void){
}
hfp_ag_run_for_context(hfp_connection);
}
hfp_ag_emit_simple_event(HFP_SUBEVENT_CALL_TERMINATED);
hfp_emit_simple_event(NULL, HFP_SUBEVENT_CALL_TERMINATED);
}
static void hfp_ag_set_callsetup_indicator(void){