1
0
mirror of https://github.com/bluekitchen/btstack.git synced 2025-02-23 18:39:52 +00:00

hfp: reset VRA on SLC shut down

This commit is contained in:
Milanka Ringwald 2021-07-06 11:04:33 +02:00
parent 52cbdd6d38
commit 11b091bf48
2 changed files with 12 additions and 2 deletions
src/classic

@ -758,6 +758,14 @@ static int hfp_handle_failed_sco_connection(uint8_t status){
return 1;
}
static void hfp_reset_voice_recognition(hfp_connection_t * hfp_connection){
btstack_assert(hfp_connection != NULL);
hfp_connection->vra_state = HFP_VRA_VOICE_RECOGNITION_OFF;
hfp_connection->vra_state_requested = HFP_VRA_VOICE_RECOGNITION_OFF;
hfp_connection->ag_vra_status = 0;
hfp_connection->ag_vra_state = HFP_VOICE_RECOGNITION_STATE_AG_READY;
}
void hfp_handle_hci_event(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size, hfp_role_t local_role){
UNUSED(packet_type);
@ -902,6 +910,7 @@ void hfp_handle_hci_event(uint8_t packet_type, uint16_t channel, uint8_t *packet
hfp_connection->ag_audio_connection_opened_after_vra = false;
if (hfp_connection->acl_handle == HCI_CON_HANDLE_INVALID){
hfp_reset_voice_recognition(hfp_connection);
hfp_emit_event(hfp_connection, HFP_SUBEVENT_SERVICE_LEVEL_CONNECTION_RELEASED, 0);
hfp_finalize_connection_context(hfp_connection);
} else if (hfp_connection->release_slc_connection == 1){
@ -1014,6 +1023,7 @@ void hfp_handle_rfcomm_event(uint8_t packet_type, uint16_t channel, uint8_t *pac
default:
// regular case
hfp_reset_voice_recognition(hfp_connection);
hfp_emit_event(hfp_connection, HFP_SUBEVENT_SERVICE_LEVEL_CONNECTION_RELEASED, 0);
hfp_finalize_connection_context(hfp_connection);
break;

@ -262,7 +262,7 @@ uint8_t hfp_ag_notify_incoming_call_waiting(hci_con_handle_t acl_handle);
/*
* @brief Activate voice recognition and emit HFP_SUBEVENT_VOICE_RECOGNITION_STATUS event with status ERROR_CODE_SUCCESS
* if successful, otherwise ERROR_CODE_COMMAND_DISALLOWED. The state field of this event is set to 1.
* if successful. The state field of this event is set to current voice recognition status (1 for activated, 0 otherwise).
*
* @param acl_handle
* @return status ERROR_CODE_SUCCESS if successful, otherwise:
@ -273,7 +273,7 @@ uint8_t hfp_ag_activate_voice_recognition(hci_con_handle_t acl_handle);
/*
* @brief Deactivate voice recognition and emit HFP_SUBEVENT_VOICE_RECOGNITION_STATUS event with status ERROR_CODE_SUCCESS
* if successful, otherwise ERROR_CODE_COMMAND_DISALLOWED. The state field of this event is set to 0.
* if successful. The state field of this event is set to current voice recognition status (1 for activated, 0 otherwise).
*
* @param acl_handle
* @return status ERROR_CODE_SUCCESS if successful, otherwise: