From 14a84f8ae3e20ce5c6ddab85ac1485e275b469e2 Mon Sep 17 00:00:00 2001 From: Milanka Ringwald Date: Fri, 20 Nov 2015 11:39:44 +0100 Subject: [PATCH] extract hf start ringing from hp call state machine --- src/hfp_ag.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/hfp_ag.c b/src/hfp_ag.c index 4b13a0d53..6a7b7213c 100644 --- a/src/hfp_ag.c +++ b/src/hfp_ag.c @@ -688,19 +688,6 @@ static int incoming_call_state_machine(hfp_connection_t * context){ int done = 0; switch (context->call_state){ - case HFP_CALL_IDLE: - //printf(" HFP_CALL_TRIGGER_AUDIO_CONNECTION \n"); - hfp_timeout_start(context); - context->ag_ring = 1; - - if (use_in_band_tone()){ - context->call_state = HFP_CALL_TRIGGER_AUDIO_CONNECTION; - } else { - context->call_state = HFP_CALL_W4_ANSWER; - hfp_emit_event(hfp_callback, HFP_SUBEVENT_START_RINGINIG, 0); - } - return 1; - case HFP_CALL_W4_ANSWER: if (context->command != HFP_CMD_CALL_ANSWERED && context->command != HFP_CMD_AG_ANSWER_CALL) { @@ -775,6 +762,18 @@ static int incoming_call_state_machine(hfp_connection_t * context){ return done; } +static void hfp_ag_hf_start_ringing(hfp_connection_t * context){ + //printf(" HFP_CALL_TRIGGER_AUDIO_CONNECTION \n"); + hfp_timeout_start(context); + context->ag_ring = 1; + if (use_in_band_tone()){ + context->call_state = HFP_CALL_TRIGGER_AUDIO_CONNECTION; + } else { + context->call_state = HFP_CALL_W4_ANSWER; + hfp_emit_event(hfp_callback, HFP_SUBEVENT_START_RINGINIG, 0); + } +} + static void hfp_ag_trigger_incoming_call(void){ int indicator_index = get_ag_indicator_index_for_name("callsetup"); if (indicator_index < 0) return; @@ -785,6 +784,7 @@ static void hfp_ag_trigger_incoming_call(void){ hfp_connection_t * connection = (hfp_connection_t *)linked_list_iterator_next(&it); hfp_ag_establish_service_level_connection(connection->remote_addr); if (connection->call_state == HFP_CALL_IDLE){ + hfp_ag_hf_start_ringing(connection); connection->run_call_state_machine = 1; connection->ag_indicators_status_update_bitmap = store_bit(connection->ag_indicators_status_update_bitmap, indicator_index, 1); }