hfp: terminate/reject incoming call

This commit is contained in:
Milanka Ringwald 2015-11-27 16:18:14 +01:00
parent a14eb9fccc
commit 56f716feca
3 changed files with 30 additions and 4 deletions

View File

@ -849,17 +849,32 @@ void hfp_hf_answer_incoming_call(bd_addr_t bd_addr){
if (hfp_callsetup_status == HFP_CALLSETUP_STATUS_INCOMING_CALL_SETUP_IN_PROGRESS){
connection->hf_answer_incoming_call = 1;
hfp_run_for_context(connection);
} else {
log_error("HFP HF: answering incoming call in wrong callsetup state %u", hfp_callsetup_status);
log_error("HFP HF: answering incoming call with wrong callsetup status %u", hfp_callsetup_status);
}
hfp_run_for_context(connection);
}
void hfp_hf_terminate_call(bd_addr_t bd_addr){
hfp_hf_establish_service_level_connection(bd_addr);
hfp_connection_t * connection = get_hfp_connection_context_for_bd_addr(bd_addr);
connection->hf_send_chup = 1;
hfp_run_for_context(connection);
if (hfp_call_status == HFP_CALL_STATUS_ACTIVE_OR_HELD_CALL_IS_PRESENT){
connection->hf_send_chup = 1;
hfp_run_for_context(connection);
} else {
log_error("HFP HF: terminating incoming call with wrong call status %u", hfp_call_status);
}
}
void hfp_hf_reject_call(bd_addr_t bd_addr){
hfp_hf_establish_service_level_connection(bd_addr);
hfp_connection_t * connection = get_hfp_connection_context_for_bd_addr(bd_addr);
if (hfp_callsetup_status == HFP_CALLSETUP_STATUS_INCOMING_CALL_SETUP_IN_PROGRESS){
connection->hf_send_chup = 1;
hfp_run_for_context(connection);
}
}
void hfp_hf_enable_calling_line_identification(bd_addr_t bd_addr){

View File

@ -154,6 +154,11 @@ void hfp_hf_release_audio_connection(bd_addr_t bd_addr);
*/
void hfp_hf_answer_incoming_call(bd_addr_t bd_addr);
/**
* @brief
*/
void hfp_hf_reject_call(bd_addr_t bd_addr);
/**
* @brief
*/

View File

@ -111,7 +111,9 @@ static void show_usage(void){
printf("f - answer incoming call\n");
printf("F - Hangup call\n");
printf("G - Reject call.\n");
printf("g - query network operator name\n");
printf("h - enable Calling Line Identification.\n");
printf("t - terminate connection\n");
@ -171,6 +173,10 @@ static int stdin_process(struct data_source *ds){
printf("Hangup call.\n");
hfp_hf_terminate_call(device_addr);
break;
case 'G':
printf("Reject call.\n");
hfp_hf_reject_call(device_addr);
break;
case 'g':
printf("Query operator.\n");
hfp_hf_query_operator_selection(device_addr);