hfp: drop redundant bd_addr, sco_handle in hfp_emit_sco_connection_established

This commit is contained in:
Matthias Ringwald 2023-01-17 17:28:33 +01:00
parent 2ef72a1c4c
commit f14c5daf9a
3 changed files with 10 additions and 13 deletions

View File

@ -468,9 +468,8 @@ static void hfp_emit_audio_connection_released(hfp_connection_t * hfp_connection
hfp_emit_event_for_context(hfp_connection, event, sizeof(event));
}
void hfp_emit_sco_connection_established(hfp_connection_t *hfp_connection, uint8_t status, hci_con_handle_t sco_handle,
bd_addr_t addr, uint8_t negotiated_codec, uint16_t packet_types,
uint16_t rx_packet_length, uint16_t tx_packet_length) {
void hfp_emit_sco_connection_established(hfp_connection_t *hfp_connection, uint8_t status, uint8_t negotiated_codec,
uint16_t packet_types, uint16_t rx_packet_length, uint16_t tx_packet_length) {
btstack_assert(hfp_connection != NULL);
uint8_t event[17];
int pos = 0;
@ -480,9 +479,9 @@ void hfp_emit_sco_connection_established(hfp_connection_t *hfp_connection, uint8
little_endian_store_16(event, pos, hfp_connection->acl_handle);
pos += 2;
event[pos++] = status; // status 0 == OK
little_endian_store_16(event, pos, sco_handle);
little_endian_store_16(event, pos, hfp_connection->sco_handle);
pos += 2;
reverse_bd_addr(addr,&event[pos]);
reverse_bd_addr(hfp_connection->remote_addr,&event[pos]);
pos += 6;
event[pos++] = negotiated_codec;
little_endian_store_16(event, pos, packet_types);
@ -886,7 +885,7 @@ void hfp_handle_hci_event(uint8_t packet_type, uint16_t channel, uint8_t *packet
if (hfp_handle_failed_sco_connection(status)) break;
hfp_connection->establish_audio_connection = 0;
hfp_connection->state = HFP_SERVICE_LEVEL_CONNECTION_ESTABLISHED;
hfp_emit_sco_connection_established(hfp_connection, status, 0, hfp_connection->remote_addr,
hfp_emit_sco_connection_established(hfp_connection, status,
hfp_connection->negotiated_codec, 0, 0, 0);
}
break;
@ -907,7 +906,7 @@ void hfp_handle_hci_event(uint8_t packet_type, uint16_t channel, uint8_t *packet
hfp_connection->establish_audio_connection = 0;
hfp_connection->state = HFP_SERVICE_LEVEL_CONNECTION_ESTABLISHED;
hfp_emit_sco_connection_established(hfp_connection, status, 0, event_addr,
hfp_emit_sco_connection_established(hfp_connection, status,
hfp_connection->negotiated_codec,
0, 0, 0);
break;
@ -960,7 +959,7 @@ void hfp_handle_hci_event(uint8_t packet_type, uint16_t channel, uint8_t *packet
hfp_connection->ag_audio_connection_opened_before_vra = true;
break;
}
hfp_emit_sco_connection_established(hfp_connection, status, sco_handle, event_addr,
hfp_emit_sco_connection_established(hfp_connection, status,
hfp_connection->negotiated_codec,
packet_types, rx_packet_length, tx_packet_length);
break;

View File

@ -759,9 +759,8 @@ int store_bit(uint32_t bitmap, int position, uint8_t value);
// UTILS_END
void hfp_finalize_connection_context(hfp_connection_t * hfp_connection);
void hfp_emit_sco_connection_established(hfp_connection_t *hfp_connection, uint8_t status, hci_con_handle_t sco_handle,
bd_addr_t addr, uint8_t negotiated_codec, uint16_t packet_types,
uint16_t rx_packet_length, uint16_t tx_packet_length);
void hfp_emit_sco_connection_established(hfp_connection_t *hfp_connection, uint8_t status, uint8_t negotiated_codec,
uint16_t packet_types, uint16_t rx_packet_length, uint16_t tx_packet_length);
void hfp_set_ag_callback(btstack_packet_handler_t callback);
void hfp_set_ag_rfcomm_packet_handler(btstack_packet_handler_t handler);

View File

@ -1352,8 +1352,7 @@ static void hfp_hf_handle_rfcomm_command(hfp_connection_t * hfp_connection){
switch (hfp_connection->codecs_state){
case HFP_CODECS_RECEIVED_TRIGGER_CODEC_EXCHANGE:
hfp_reset_context_flags(hfp_connection);
hfp_emit_sco_connection_established(hfp_connection, HFP_REMOTE_REJECTS_AUDIO_CONNECTION, 0,
hfp_connection->remote_addr,
hfp_emit_sco_connection_established(hfp_connection, HFP_REMOTE_REJECTS_AUDIO_CONNECTION,
hfp_connection->negotiated_codec,
0, 0, 0);
return;