hfp: drop negotiated codec from SLC and Audio connection events

This commit is contained in:
Matthias Ringwald 2016-07-25 10:41:07 +02:00
parent 973d7173e5
commit 8901a7c412
5 changed files with 6 additions and 28 deletions

View File

@ -489,8 +489,7 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t * even
printf("Audio connection establishment failed with status %u\n", hfp_subevent_audio_connection_established_get_status(event));
} else {
sco_handle = hfp_subevent_audio_connection_established_get_handle(event);
negotiated_codec = hfp_subevent_audio_connection_established_get_negotiated_codec(event);
printf("Audio connection established with SCO handle 0x%04x and codec 0x%02x.\n", sco_handle, negotiated_codec);
printf("Audio connection established with SCO handle 0x%04x.\n", sco_handle);
hci_request_sco_can_send_now_event();
}
break;

View File

@ -920,7 +920,6 @@ typedef uint8_t sm_key_t[16];
* @param status 0 == OK
* @param con_handle
* @param bd_addr
* @param negotiated_codec
*/
#define HFP_SUBEVENT_SERVICE_LEVEL_CONNECTION_ESTABLISHED 0x01
@ -936,7 +935,6 @@ typedef uint8_t sm_key_t[16];
* @param status 0 == OK
* @param handle
* @param bd_addr
* @param negotiated_codec
*/
#define HFP_SUBEVENT_AUDIO_CONNECTION_ESTABLISHED 0x03

View File

@ -2748,15 +2748,6 @@ static inline hci_con_handle_t hfp_subevent_service_level_connection_established
static inline void hfp_subevent_service_level_connection_established_get_bd_addr(const uint8_t * event, bd_addr_t bd_addr){
reverse_bd_addr(&event[6], bd_addr);
}
/**
* @brief Get field negotiated_codec from event HFP_SUBEVENT_SERVICE_LEVEL_CONNECTION_ESTABLISHED
* @param event packet
* @return negotiated_codec
* @note: btstack_type 1
*/
static inline uint8_t hfp_subevent_service_level_connection_established_get_negotiated_codec(const uint8_t * event){
return event[12];
}
/**
@ -2786,15 +2777,6 @@ static inline hci_con_handle_t hfp_subevent_audio_connection_established_get_han
static inline void hfp_subevent_audio_connection_established_get_bd_addr(const uint8_t * event, bd_addr_t bd_addr){
reverse_bd_addr(&event[6], bd_addr);
}
/**
* @brief Get field negotiated_codec from event HFP_SUBEVENT_AUDIO_CONNECTION_ESTABLISHED
* @param event packet
* @return negotiated_codec
* @note: btstack_type 1
*/
static inline uint8_t hfp_subevent_audio_connection_established_get_negotiated_codec(const uint8_t * event){
return event[12];
}
/**

View File

@ -224,9 +224,9 @@ void hfp_emit_event(btstack_packet_handler_t callback, uint8_t event_subtype, ui
(*callback)(HCI_EVENT_PACKET, 0, event, sizeof(event));
}
void hfp_emit_connection_event(btstack_packet_handler_t callback, uint8_t event_subtype, uint8_t status, hci_con_handle_t con_handle, bd_addr_t addr, uint8_t codec){
void hfp_emit_connection_event(btstack_packet_handler_t callback, uint8_t event_subtype, uint8_t status, hci_con_handle_t con_handle, bd_addr_t addr){
if (!callback) return;
uint8_t event[13];
uint8_t event[12];
int pos = 0;
event[pos++] = HCI_EVENT_HFP_META;
event[pos++] = sizeof(event) - 2;
@ -236,7 +236,6 @@ void hfp_emit_connection_event(btstack_packet_handler_t callback, uint8_t event_
pos += 2;
reverse_bd_addr(addr,&event[pos]);
pos += 6;
event[pos] = codec;
(*callback)(HCI_EVENT_PACKET, 0, event, sizeof(event));
}
@ -530,7 +529,7 @@ void hfp_handle_hci_event(uint8_t packet_type, uint16_t channel, uint8_t *packet
if (!hfp_connection || hfp_connection->state != HFP_W4_RFCOMM_CONNECTED) return;
if (status) {
hfp_emit_connection_event(hfp_callback, HFP_SUBEVENT_SERVICE_LEVEL_CONNECTION_ESTABLISHED, status, rfcomm_event_channel_opened_get_con_handle(packet), event_addr, hfp_connection->negotiated_codec);
hfp_emit_connection_event(hfp_callback, HFP_SUBEVENT_SERVICE_LEVEL_CONNECTION_ESTABLISHED, status, rfcomm_event_channel_opened_get_con_handle(packet), event_addr);
remove_hfp_connection_context(hfp_connection);
} else {
hfp_connection->acl_handle = rfcomm_event_channel_opened_get_con_handle(packet);
@ -623,7 +622,7 @@ void hfp_handle_hci_event(uint8_t packet_type, uint16_t channel, uint8_t *packet
hfp_connection->sco_handle = sco_handle;
hfp_connection->establish_audio_connection = 0;
hfp_connection->state = HFP_AUDIO_CONNECTION_ESTABLISHED;
hfp_emit_connection_event(hfp_callback, HFP_SUBEVENT_AUDIO_CONNECTION_ESTABLISHED, packet[2], sco_handle, event_addr, hfp_connection->negotiated_codec);
hfp_emit_connection_event(hfp_callback, HFP_SUBEVENT_AUDIO_CONNECTION_ESTABLISHED, packet[2], sco_handle, event_addr);
break;
}

View File

@ -628,7 +628,7 @@ void hfp_handle_hci_event(uint8_t packet_type, uint16_t channel, uint8_t *packet
void hfp_emit_event(btstack_packet_handler_t callback, uint8_t event_subtype, uint8_t value);
void hfp_emit_simple_event(btstack_packet_handler_t callback, uint8_t event_subtype);
void hfp_emit_string_event(btstack_packet_handler_t callback, uint8_t event_subtype, const char * value);
void hfp_emit_connection_event(btstack_packet_handler_t callback, uint8_t event_subtype, uint8_t status, hci_con_handle_t con_handle, bd_addr_t addr, uint8_t codec);
void hfp_emit_connection_event(btstack_packet_handler_t callback, uint8_t event_subtype, uint8_t status, hci_con_handle_t con_handle, bd_addr_t addr);
void hfp_emit_codec_event(btstack_packet_handler_t callback, uint8_t status, uint8_t codec);
hfp_connection_t * get_hfp_connection_context_for_rfcomm_cid(uint16_t cid);