mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-29 04:20:20 +00:00
Merge branch 'master' of https://github.com/bluekitchen/btstack
This commit is contained in:
commit
2b949bb1ec
@ -21,6 +21,6 @@
|
||||
#define HAVE_HCI_DUMP
|
||||
#define SDP_DES_DUMP
|
||||
|
||||
#define HAVE_SCO
|
||||
// #define HAVE_SCO
|
||||
|
||||
#endif
|
||||
|
57
src/hfp_ag.c
57
src/hfp_ag.c
@ -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,19 +897,38 @@ 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;
|
||||
|
||||
case HFP_AG_TERMINATE_CALL_BY_AG:
|
||||
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 AG Rejected Incoming call, AG terminate call\n");
|
||||
break;
|
||||
default:
|
||||
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);
|
||||
@ -1179,24 +1214,6 @@ void hfp_ag_terminate_call(void){
|
||||
hfp_ag_call_sm(HFP_AG_TERMINATE_CALL_BY_AG, NULL);
|
||||
}
|
||||
|
||||
|
||||
void hfp_ag_audio_connection_transfer_towards_ag(bd_addr_t bd_addr){
|
||||
hfp_connection_t * connection = get_hfp_connection_context_for_bd_addr(bd_addr);
|
||||
if (connection->call_state != HFP_CALL_ACTIVE) return;
|
||||
if (connection->state != HFP_AUDIO_CONNECTION_ESTABLISHED) return;
|
||||
hfp_ag_release_audio_connection(bd_addr);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
void hfp_ag_audio_connection_transfer_towards_hf(bd_addr_t bd_addr){
|
||||
hfp_connection_t * connection = get_hfp_connection_context_for_bd_addr(bd_addr);
|
||||
if (connection->call_state != HFP_CALL_ACTIVE) return;
|
||||
if (connection->state != HFP_AUDIO_CONNECTION_ESTABLISHED) return;
|
||||
hfp_ag_establish_audio_connection(bd_addr);
|
||||
}
|
||||
|
||||
void hfp_ag_place_a_call_with_phone_number(void){
|
||||
// linked_list_iterator_t it;
|
||||
// linked_list_iterator_init(&it, hfp_get_connections());
|
||||
|
10
src/hfp_ag.h
10
src/hfp_ag.h
@ -190,16 +190,6 @@ void hfp_ag_call_dropped(void);
|
||||
*/
|
||||
void hfp_ag_terminate_call(void);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
void hfp_ag_audio_connection_transfer_towards_hf(bd_addr_t bd_addr);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
void hfp_ag_audio_connection_transfer_towards_ag(bd_addr_t bd_addr);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*/
|
||||
|
@ -122,6 +122,7 @@ static void show_usage(void){
|
||||
printf("d - report AG failure\n");
|
||||
|
||||
printf("e - answer call on AG\n");
|
||||
printf("E - reject call on AG\n");
|
||||
|
||||
printf("r - disable in-band ring tone\n");
|
||||
printf("R - enable in-band ring tone\n");
|
||||
@ -138,8 +139,6 @@ static void show_usage(void){
|
||||
printf("i - Set battery level to 3\n");
|
||||
printf("I - Set battery level to 5\n");
|
||||
|
||||
printf("j - Transfer audio from AG to HF\n");
|
||||
|
||||
printf("t - terminate connection\n");
|
||||
|
||||
printf("---\n");
|
||||
@ -192,6 +191,10 @@ static int stdin_process(struct data_source *ds){
|
||||
printf("Answer call on AG\n");
|
||||
hfp_ag_answer_incoming_call();
|
||||
break;
|
||||
case 'E':
|
||||
printf("Reject call on AG\n");
|
||||
hfp_ag_terminate_call();
|
||||
break;
|
||||
case 'f':
|
||||
printf("Disable cellular network\n");
|
||||
hfp_ag_set_registration_status(0);
|
||||
@ -224,9 +227,6 @@ static int stdin_process(struct data_source *ds){
|
||||
printf("Set battery level to 5\n");
|
||||
hfp_ag_set_battery_level(5);
|
||||
break;
|
||||
case 'j':
|
||||
hfp_ag_audio_connection_transfer_towards_hf(device_addr);
|
||||
break;
|
||||
case 'r':
|
||||
printf("Disable in-band ring tone\n");
|
||||
hfp_ag_set_use_in_band_ring_tone(0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user