mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-30 07:21:20 +00:00
hfp: ag terminates call
This commit is contained in:
parent
4630085960
commit
a8714e14a6
14
src/hfp_ag.c
14
src/hfp_ag.c
@ -605,17 +605,22 @@ static int incoming_call_state_machine(hfp_connection_t * context){
|
|||||||
if (context->state < HFP_SERVICE_LEVEL_CONNECTION_ESTABLISHED) return 0;
|
if (context->state < HFP_SERVICE_LEVEL_CONNECTION_ESTABLISHED) return 0;
|
||||||
|
|
||||||
// printf(" -> State machine: Incoming Call\n");
|
// printf(" -> State machine: Incoming Call\n");
|
||||||
int done = 0;
|
|
||||||
hfp_ag_indicator_t * indicator;
|
hfp_ag_indicator_t * indicator;
|
||||||
|
|
||||||
if (context->terminate_call){
|
if (context->terminate_call){
|
||||||
printf(" -> State machine: Terminate Incoming Call\n");
|
printf(" -> State machine: Terminate Incoming Call\n");
|
||||||
// TODO, reset flags
|
indicator = get_ag_indicator_for_name("call");
|
||||||
|
if (!indicator) return 0;
|
||||||
|
|
||||||
|
indicator->status = HFP_CALLSETUP_STATUS_NO_CALL_SETUP_IN_PROGRESS;
|
||||||
|
hfp_ag_transfer_ag_indicators_status_cmd(context->rfcomm_cid, indicator);
|
||||||
|
|
||||||
context->terminate_call = 0;
|
context->terminate_call = 0;
|
||||||
context->run_call_state_machine = 0;
|
context->run_call_state_machine = 0;
|
||||||
return done;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int done = 0;
|
||||||
switch (context->call_state){
|
switch (context->call_state){
|
||||||
case HFP_CALL_IDLE:
|
case HFP_CALL_IDLE:
|
||||||
//printf(" HFP_CALL_TRIGGER_AUDIO_CONNECTION \n");
|
//printf(" HFP_CALL_TRIGGER_AUDIO_CONNECTION \n");
|
||||||
@ -685,7 +690,7 @@ static int incoming_call_state_machine(hfp_connection_t * context){
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
case HFP_CALL_ACTIVE:
|
case HFP_CALL_ACTIVE:
|
||||||
//printf(" HFP_CALL_ACTIVE \n");
|
printf(" HFP_CALL_ACTIVE \n");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -908,7 +913,6 @@ void hfp_ag_terminate_call(void){
|
|||||||
linked_list_iterator_init(&it, hfp_get_connections());
|
linked_list_iterator_init(&it, hfp_get_connections());
|
||||||
while (linked_list_iterator_has_next(&it)){
|
while (linked_list_iterator_has_next(&it)){
|
||||||
hfp_connection_t * connection = (hfp_connection_t *)linked_list_iterator_next(&it);
|
hfp_connection_t * connection = (hfp_connection_t *)linked_list_iterator_next(&it);
|
||||||
if (connection->state != HFP_AUDIO_CONNECTION_ESTABLISHED) return;
|
|
||||||
connection->terminate_call = 1;
|
connection->terminate_call = 1;
|
||||||
hfp_run_for_context(connection);
|
hfp_run_for_context(connection);
|
||||||
}
|
}
|
||||||
|
@ -229,6 +229,9 @@ TEST(HFPClient, HFAnswerIncomingCallWithInBandRingTone){
|
|||||||
|
|
||||||
simulate_test_sequence(alert_ic_setup(), alert_ic_setup_size());
|
simulate_test_sequence(alert_ic_setup(), alert_ic_setup_size());
|
||||||
CHECK_EQUAL(stop_ringing, 1);
|
CHECK_EQUAL(stop_ringing, 1);
|
||||||
|
|
||||||
|
hfp_ag_terminate_call();
|
||||||
|
simulate_test_sequence(terminate_ic_ag_setup(), terminate_ic_ag_setup_size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -181,7 +181,19 @@ const char * ic_alert_test1[] = {
|
|||||||
"NOP",
|
"NOP",
|
||||||
"+CIEV:2,1", // call = 1
|
"+CIEV:2,1", // call = 1
|
||||||
"NOP",
|
"NOP",
|
||||||
"+CIEV:3,0"
|
"+CIEV:3,0",
|
||||||
|
};
|
||||||
|
|
||||||
|
const char * ic_ag_terminates_call[] = {
|
||||||
|
// AG terminates call
|
||||||
|
"+CIEV:2,0"
|
||||||
|
};
|
||||||
|
|
||||||
|
const char * ic_hf_terminates_call[] = {
|
||||||
|
// HF terminates call
|
||||||
|
"AT+CHUP",
|
||||||
|
"OK"
|
||||||
|
"+CIEV:2,0"
|
||||||
};
|
};
|
||||||
|
|
||||||
hfp_test_item_t ic_tests[] = {
|
hfp_test_item_t ic_tests[] = {
|
||||||
@ -221,4 +233,11 @@ int default_ic_setup_size(){ return sizeof(ic_test1)/sizeof(char*);}
|
|||||||
|
|
||||||
char ** alert_ic_setup() { return (char **)ic_alert_test1;}
|
char ** alert_ic_setup() { return (char **)ic_alert_test1;}
|
||||||
int alert_ic_setup_size(){ return sizeof(ic_alert_test1)/sizeof(char*);}
|
int alert_ic_setup_size(){ return sizeof(ic_alert_test1)/sizeof(char*);}
|
||||||
|
|
||||||
|
|
||||||
|
char ** terminate_ic_ag_setup() { return (char **)ic_ag_terminates_call;}
|
||||||
|
int terminate_ic_ag_setup_size(){ return sizeof(ic_ag_terminates_call)/sizeof(char*);}
|
||||||
|
|
||||||
|
char ** terminate_ic_hf_setup() { return (char **)ic_hf_terminates_call;}
|
||||||
|
int terminate_ic_hf_setup_size(){ return sizeof(ic_hf_terminates_call)/sizeof(char*);}
|
||||||
|
|
@ -76,3 +76,10 @@ int default_ic_setup_size();
|
|||||||
|
|
||||||
char ** alert_ic_setup();
|
char ** alert_ic_setup();
|
||||||
int alert_ic_setup_size();
|
int alert_ic_setup_size();
|
||||||
|
|
||||||
|
char ** terminate_ic_ag_setup();
|
||||||
|
int terminate_ic_ag_setup_size();
|
||||||
|
|
||||||
|
char ** terminate_ic_hf_setup();
|
||||||
|
int terminate_ic_hf_setup_size();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user