mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-04-10 06:44:32 +00:00
split HFP_CALL_W4_AUDIO_CONNECTION into _FOR_IN_BAND_RING and _FOR_ACTIVE
This commit is contained in:
parent
be26d8c843
commit
99757d8753
@ -298,8 +298,9 @@ typedef enum {
|
|||||||
typedef enum {
|
typedef enum {
|
||||||
HFP_CALL_IDLE,
|
HFP_CALL_IDLE,
|
||||||
HFP_CALL_TRIGGER_AUDIO_CONNECTION,
|
HFP_CALL_TRIGGER_AUDIO_CONNECTION,
|
||||||
HFP_CALL_W4_AUDIO_CONNECTION,
|
HFP_CALL_W4_AUDIO_CONNECTION_FOR_IN_BAND_RING,
|
||||||
HFP_CALL_RINGING,
|
HFP_CALL_RINGING,
|
||||||
|
HFP_CALL_W4_AUDIO_CONNECTION_FOR_ACTIVE,
|
||||||
HFP_CALL_ACTIVE
|
HFP_CALL_ACTIVE
|
||||||
} hfp_call_state_t;
|
} hfp_call_state_t;
|
||||||
|
|
||||||
|
26
src/hfp_ag.c
26
src/hfp_ag.c
@ -665,14 +665,18 @@ static void hfp_timeout_stop(hfp_connection_t * context){
|
|||||||
//
|
//
|
||||||
static int incoming_call_state_machine(hfp_connection_t * context){
|
static int incoming_call_state_machine(hfp_connection_t * context){
|
||||||
if (context->state != HFP_AUDIO_CONNECTION_ESTABLISHED) return 0;
|
if (context->state != HFP_AUDIO_CONNECTION_ESTABLISHED) return 0;
|
||||||
if (context->call_state != HFP_CALL_W4_AUDIO_CONNECTION) return 0;
|
|
||||||
|
|
||||||
// we got event: audio connection established
|
// we got event: audio connection established
|
||||||
if (use_in_band_tone()){
|
switch (context->call_state){
|
||||||
context->call_state = HFP_CALL_RINGING;
|
case HFP_CALL_W4_AUDIO_CONNECTION_FOR_IN_BAND_RING:
|
||||||
hfp_emit_event(hfp_callback, HFP_SUBEVENT_START_RINGINIG, 0);
|
context->call_state = HFP_CALL_RINGING;
|
||||||
} else {
|
hfp_emit_event(hfp_callback, HFP_SUBEVENT_START_RINGINIG, 0);
|
||||||
context->call_state = HFP_CALL_ACTIVE;
|
break;
|
||||||
|
case HFP_CALL_W4_AUDIO_CONNECTION_FOR_ACTIVE:
|
||||||
|
context->call_state = HFP_CALL_ACTIVE;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -685,7 +689,7 @@ static void hfp_ag_hf_start_ringing(hfp_connection_t * context){
|
|||||||
hfp_timeout_start(context);
|
hfp_timeout_start(context);
|
||||||
context->ag_ring = 1;
|
context->ag_ring = 1;
|
||||||
if (use_in_band_tone()){
|
if (use_in_band_tone()){
|
||||||
context->call_state = HFP_CALL_W4_AUDIO_CONNECTION;
|
context->call_state = HFP_CALL_W4_AUDIO_CONNECTION_FOR_IN_BAND_RING;
|
||||||
hfp_ag_establish_audio_connection(context->remote_addr);
|
hfp_ag_establish_audio_connection(context->remote_addr);
|
||||||
} else {
|
} else {
|
||||||
context->call_state = HFP_CALL_RINGING;
|
context->call_state = HFP_CALL_RINGING;
|
||||||
@ -736,7 +740,7 @@ static void hfp_ag_hf_accept_call(hfp_connection_t * source){
|
|||||||
if (use_in_band_tone()){
|
if (use_in_band_tone()){
|
||||||
connection->call_state = HFP_CALL_ACTIVE;
|
connection->call_state = HFP_CALL_ACTIVE;
|
||||||
} else {
|
} else {
|
||||||
connection->call_state = HFP_CALL_W4_AUDIO_CONNECTION;
|
connection->call_state = HFP_CALL_W4_AUDIO_CONNECTION_FOR_ACTIVE;
|
||||||
hfp_ag_establish_audio_connection(connection->remote_addr);
|
hfp_ag_establish_audio_connection(connection->remote_addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -873,7 +877,7 @@ static void hfp_ag_call_sm(hfp_ag_call_event_t event, hfp_connection_t * connect
|
|||||||
switch (hfp_ag_call_state){
|
switch (hfp_ag_call_state){
|
||||||
case HFP_CALL_STATUS_ACTIVE_OR_HELD_CALL_IS_PRESENT:
|
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_callsetup_state(HFP_CALLSETUP_STATUS_NO_CALL_SETUP_IN_PROGRESS);
|
||||||
hfp_ag_set_call_state(HFP_CALL_STATUS_ACTIVE_OR_HELD_CALL_IS_PRESENT);
|
hfp_ag_set_call_state(HFP_CALL_STATUS_NO_HELD_OR_ACTIVE_CALLS);
|
||||||
hfp_ag_trigger_terminate_call();
|
hfp_ag_trigger_terminate_call();
|
||||||
printf("TODO AG terminate call\n");
|
printf("TODO AG terminate call\n");
|
||||||
break;
|
break;
|
||||||
@ -886,7 +890,7 @@ static void hfp_ag_call_sm(hfp_ag_call_event_t event, hfp_connection_t * connect
|
|||||||
switch (hfp_ag_call_state){
|
switch (hfp_ag_call_state){
|
||||||
case HFP_CALL_STATUS_ACTIVE_OR_HELD_CALL_IS_PRESENT:
|
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_callsetup_state(HFP_CALLSETUP_STATUS_NO_CALL_SETUP_IN_PROGRESS);
|
||||||
hfp_ag_set_call_state(HFP_CALL_STATUS_ACTIVE_OR_HELD_CALL_IS_PRESENT);
|
hfp_ag_set_call_state(HFP_CALL_STATUS_NO_HELD_OR_ACTIVE_CALLS);
|
||||||
hfp_ag_trigger_terminate_call();
|
hfp_ag_trigger_terminate_call();
|
||||||
printf("TODO AG terminate call\n");
|
printf("TODO AG terminate call\n");
|
||||||
break;
|
break;
|
||||||
@ -898,7 +902,7 @@ static void hfp_ag_call_sm(hfp_ag_call_event_t event, hfp_connection_t * connect
|
|||||||
switch (hfp_ag_call_state){
|
switch (hfp_ag_call_state){
|
||||||
case HFP_CALL_STATUS_ACTIVE_OR_HELD_CALL_IS_PRESENT:
|
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_callsetup_state(HFP_CALLSETUP_STATUS_NO_CALL_SETUP_IN_PROGRESS);
|
||||||
hfp_ag_set_call_state(HFP_CALL_STATUS_ACTIVE_OR_HELD_CALL_IS_PRESENT);
|
hfp_ag_set_call_state(HFP_CALL_STATUS_NO_HELD_OR_ACTIVE_CALLS);
|
||||||
hfp_ag_trigger_terminate_call();
|
hfp_ag_trigger_terminate_call();
|
||||||
printf("TODO AG notify call dropped\n");
|
printf("TODO AG notify call dropped\n");
|
||||||
break;
|
break;
|
||||||
|
@ -117,7 +117,7 @@ static void show_usage(void){
|
|||||||
printf("B - release AUDIO connection\n");
|
printf("B - release AUDIO connection\n");
|
||||||
|
|
||||||
printf("c - simulate incoming call\n");
|
printf("c - simulate incoming call\n");
|
||||||
printf("C - simulate terminage call\n");
|
printf("C - simulate call dropped\n");
|
||||||
|
|
||||||
printf("d - report AG failure\n");
|
printf("d - report AG failure\n");
|
||||||
|
|
||||||
@ -180,7 +180,7 @@ static int stdin_process(struct data_source *ds){
|
|||||||
break;
|
break;
|
||||||
case 'C':
|
case 'C':
|
||||||
printf("Simulate terminate call\n");
|
printf("Simulate terminate call\n");
|
||||||
hfp_ag_terminate_call();
|
hfp_ag_call_dropped();
|
||||||
break;
|
break;
|
||||||
case 'd':
|
case 'd':
|
||||||
printf("Report AG failure\n");
|
printf("Report AG failure\n");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user