hfp: handle reject by HF

This commit is contained in:
Matthias Ringwald 2015-11-20 17:23:54 +01:00
parent 86bcf286c1
commit 9027be1e16

View File

@ -785,6 +785,22 @@ static void hfp_ag_ag_accept_call(void){
}
}
static void hfp_ag_trigger_reject_call(void){
int callsetup_indicator_index = get_ag_indicator_index_for_name("callsetup");
linked_list_iterator_t it;
linked_list_iterator_init(&it, hfp_get_connections());
while (linked_list_iterator_has_next(&it)){
hfp_connection_t * connection = (hfp_connection_t *)linked_list_iterator_next(&it);
if (connection->call_state != HFP_CALL_RINGING) continue;
hfp_ag_hf_stop_ringing(connection);
connection->ag_indicators_status_update_bitmap = store_bit(connection->ag_indicators_status_update_bitmap, callsetup_indicator_index, 1);
connection->run_call_state_machine = 0;
connection->call_state = HFP_CALL_IDLE;
hfp_run_for_context(connection);
break; // only single
}
}
static void hfp_ag_trigger_terminate_call(void){
int call_indicator_index = get_ag_indicator_index_for_name("call");
@ -881,14 +897,23 @@ static void hfp_ag_call_sm(hfp_ag_call_event_t event, hfp_connection_t * connect
case HFP_AG_TERMINATE_CALL_BY_HF:
switch (hfp_ag_call_state){
case HFP_CALL_STATUS_NO_HELD_OR_ACTIVE_CALLS:
switch (hfp_ag_callsetup_state){
case HFP_CALLSETUP_STATUS_INCOMING_CALL_SETUP_IN_PROGRESS:
hfp_ag_set_callsetup_state(HFP_CALLSETUP_STATUS_NO_CALL_SETUP_IN_PROGRESS);
hfp_ag_trigger_reject_call();
printf("TODO HF Rejected Incoming call, AG terminate call\n");
break;
default:
break;
}
break;
case HFP_CALL_STATUS_ACTIVE_OR_HELD_CALL_IS_PRESENT:
hfp_ag_set_callsetup_state(HFP_CALLSETUP_STATUS_NO_CALL_SETUP_IN_PROGRESS);
hfp_ag_set_call_state(HFP_CALL_STATUS_NO_HELD_OR_ACTIVE_CALLS);
hfp_ag_trigger_terminate_call();
printf("TODO AG terminate call\n");
break;
default:
break;
}
break;