hfp: clear VRA requested status on SCO disconnect

This commit is contained in:
Milanka Ringwald 2025-04-14 15:40:35 +02:00
parent 74350e1564
commit 4fe47d69db

View File

@ -594,11 +594,15 @@ hfp_connection_t * get_hfp_connection_context_for_acl_handle(uint16_t handle, hf
} }
static void hfp_vra_handle_disconnect(hfp_connection_t * hfp_connection) { static void hfp_vra_handle_disconnect(hfp_connection_t * hfp_connection) {
hfp_voice_recognition_activation_status_t current_vra_state = hfp_connection->vra_state; bool emit_vra_disabled = (hfp_connection->vra_state != HFP_VRA_VOICE_RECOGNITION_OFF) ||
(hfp_connection->vra_state_requested != HFP_VRA_VOICE_RECOGNITION_OFF);
hfp_connection->vra_state = HFP_VRA_VOICE_RECOGNITION_OFF; hfp_connection->vra_state = HFP_VRA_VOICE_RECOGNITION_OFF;
if (current_vra_state != HFP_VRA_VOICE_RECOGNITION_OFF){ hfp_connection->vra_state_requested = hfp_connection->vra_state;
hfp_emit_voice_recognition_disabled(hfp_connection, ERROR_CODE_SUCCESS); // ignore subsequent ok/error response
} else if (hfp_connection->vra_state_requested != HFP_VRA_VOICE_RECOGNITION_OFF){ hfp_connection->ok_pending = 0;
if (emit_vra_disabled){
hfp_emit_voice_recognition_disabled(hfp_connection, ERROR_CODE_SUCCESS); hfp_emit_voice_recognition_disabled(hfp_connection, ERROR_CODE_SUCCESS);
} }
} }