mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-31 19:20:26 +00:00
Merge branch 'master' of https://github.com/bluekitchen/btstack
This commit is contained in:
commit
7b90e0b281
@ -255,6 +255,7 @@ typedef enum {
|
||||
HFP_CALLHELD_STATUS_CALL_ON_HOLD_AND_NO_ACTIVE_CALLS
|
||||
} hfp_callheld_status_t;
|
||||
|
||||
|
||||
typedef enum {
|
||||
HFP_AG_INCOMING_CALL,
|
||||
HFP_AG_INCOMING_CALL_ACCEPTED_BY_AG,
|
||||
@ -275,7 +276,12 @@ typedef enum {
|
||||
HFP_AG_RESPONSE_AND_HOLD_REJECT_HELD_CALL_BY_AG,
|
||||
HFP_AG_RESPONSE_AND_HOLD_ACCEPT_INCOMING_CALL_BY_HF,
|
||||
HFP_AG_RESPONSE_AND_HOLD_ACCEPT_HELD_CALL_BY_HF,
|
||||
HFP_AG_RESPONSE_AND_HOLD_REJECT_HELD_CALL_BY_HF
|
||||
HFP_AG_RESPONSE_AND_HOLD_REJECT_HELD_CALL_BY_HF,
|
||||
HFP_AG_CALL_HOLD_USER_BUSY,
|
||||
HFP_AG_CALL_HOLD_RELEASE_ACTIVE_ACCEPT_HELD_OR_WAITING_CALL,
|
||||
HFP_AG_CALL_HOLD_PARK_ACTIVE_ACCEPT_HELD_OR_WAITING_CALL,
|
||||
HFP_AG_CALL_HOLD_ADD_HELD_CALL,
|
||||
HFP_AG_CALL_HOLD_EXIT_AND_JOIN_CALLS
|
||||
} hfp_ag_call_event_t;
|
||||
|
||||
|
||||
|
288
src/hfp_ag.c
288
src/hfp_ag.c
@ -76,8 +76,6 @@ static int hfp_ag_call_hold_services_nr = 0;
|
||||
static char *hfp_ag_call_hold_services[6];
|
||||
static hfp_callback_t hfp_callback;
|
||||
|
||||
|
||||
static hfp_call_status_t hfp_ag_call_state;
|
||||
static hfp_callsetup_status_t hfp_ag_callsetup_state;
|
||||
static hfp_callheld_status_t hfp_ag_callheld_state;
|
||||
static hfp_response_and_hold_state_t hfp_ag_response_and_hold_state;
|
||||
@ -96,6 +94,20 @@ static void hfp_run_for_context(hfp_connection_t *context);
|
||||
static void hfp_ag_setup_audio_connection(hfp_connection_t * connection);
|
||||
static void hfp_ag_hf_start_ringing(hfp_connection_t * context);
|
||||
|
||||
static hfp_call_status_t get_hfp_ag_call_state(void){
|
||||
return hfp_gsm_call_status();
|
||||
}
|
||||
|
||||
static hfp_callsetup_status_t get_hfp_ag_callsetup_state(void){
|
||||
return hfp_ag_callsetup_state;
|
||||
//return hfp_gsm_callsetup_status();
|
||||
}
|
||||
|
||||
static hfp_callheld_status_t get_hfp_ag_callheld_state(void){
|
||||
return hfp_ag_callheld_state;
|
||||
// return hfp_gsm_callheld_status();
|
||||
}
|
||||
|
||||
hfp_generic_status_indicator_t * get_hfp_generic_status_indicators();
|
||||
int get_hfp_generic_status_indicators_nr();
|
||||
void set_hfp_generic_status_indicators(hfp_generic_status_indicator_t * indicators, int indicator_nr);
|
||||
@ -626,12 +638,12 @@ static void hfp_ag_slc_established(hfp_connection_t * context){
|
||||
hfp_init_link_settings(context);
|
||||
|
||||
// if active call exist, set per-connection state active, too (when audio is on)
|
||||
if (hfp_ag_call_state == HFP_CALL_STATUS_ACTIVE_OR_HELD_CALL_IS_PRESENT){
|
||||
if (get_hfp_ag_call_state() == HFP_CALL_STATUS_ACTIVE_OR_HELD_CALL_IS_PRESENT){
|
||||
context->call_state = HFP_CALL_W4_AUDIO_CONNECTION_FOR_ACTIVE;
|
||||
}
|
||||
// if AG is ringing, also start ringing on the HF
|
||||
if (hfp_ag_call_state == HFP_CALL_STATUS_NO_HELD_OR_ACTIVE_CALLS &&
|
||||
hfp_ag_callsetup_state == HFP_CALLSETUP_STATUS_INCOMING_CALL_SETUP_IN_PROGRESS){
|
||||
if (get_hfp_ag_call_state() == HFP_CALL_STATUS_NO_HELD_OR_ACTIVE_CALLS &&
|
||||
get_hfp_ag_callsetup_state() == HFP_CALLSETUP_STATUS_INCOMING_CALL_SETUP_IN_PROGRESS){
|
||||
hfp_ag_hf_start_ringing(context);
|
||||
}
|
||||
}
|
||||
@ -1044,13 +1056,20 @@ static void hfp_ag_set_callheld_state(hfp_callheld_status_t state){
|
||||
indicator->status = state;
|
||||
}
|
||||
|
||||
static void hfp_ag_set_call_state(hfp_call_status_t state){
|
||||
hfp_ag_call_state = state;
|
||||
static void hfp_ag_set_callheld_indicator(){
|
||||
hfp_ag_indicator_t * indicator = get_ag_indicator_for_name("callheld");
|
||||
if (!indicator){
|
||||
log_error("hfp_ag_set_callheld_state: callheld indicator is missing");
|
||||
};
|
||||
indicator->status = hfp_gsm_callheld_status();
|
||||
}
|
||||
|
||||
static void hfp_ag_set_call_indicator(){
|
||||
hfp_ag_indicator_t * indicator = get_ag_indicator_for_name("call");
|
||||
if (!indicator){
|
||||
log_error("hfp_ag_set_call_state: call indicator is missing");
|
||||
};
|
||||
indicator->status = state;
|
||||
indicator->status = hfp_gsm_call_status();
|
||||
}
|
||||
|
||||
static void hfp_ag_stop_ringing(void){
|
||||
@ -1115,14 +1134,18 @@ static int call_setup_state_machine(hfp_connection_t * connection){
|
||||
// connection is used to identify originating HF
|
||||
static void hfp_ag_call_sm(hfp_ag_call_event_t event, hfp_connection_t * connection){
|
||||
int indicator_index;
|
||||
int callsetup_indicator_index = get_ag_indicator_index_for_name("callsetup");
|
||||
int callheld_indicator_index = get_ag_indicator_index_for_name("callheld");
|
||||
int call_indicator_index = get_ag_indicator_index_for_name("call");
|
||||
|
||||
//printf("hfp_ag_call_sm event %d \n", event);
|
||||
switch (event){
|
||||
case HFP_AG_INCOMING_CALL:
|
||||
hfp_gsm_handle_event(HFP_AG_INCOMING_CALL);
|
||||
switch (hfp_ag_call_state){
|
||||
switch (get_hfp_ag_call_state()){
|
||||
case HFP_CALL_STATUS_NO_HELD_OR_ACTIVE_CALLS:
|
||||
switch (hfp_ag_callsetup_state){
|
||||
switch (get_hfp_ag_callsetup_state()){
|
||||
case HFP_CALLSETUP_STATUS_NO_CALL_SETUP_IN_PROGRESS:
|
||||
hfp_gsm_handle_event(HFP_AG_INCOMING_CALL);
|
||||
hfp_ag_set_callsetup_state(HFP_CALLSETUP_STATUS_INCOMING_CALL_SETUP_IN_PROGRESS);
|
||||
hfp_ag_trigger_incoming_call();
|
||||
printf("AG rings\n");
|
||||
@ -1132,8 +1155,9 @@ static void hfp_ag_call_sm(hfp_ag_call_event_t event, hfp_connection_t * connect
|
||||
}
|
||||
break;
|
||||
case HFP_CALL_STATUS_ACTIVE_OR_HELD_CALL_IS_PRESENT:
|
||||
switch (hfp_ag_callsetup_state){
|
||||
switch (get_hfp_ag_callsetup_state()){
|
||||
case HFP_CALLSETUP_STATUS_NO_CALL_SETUP_IN_PROGRESS:
|
||||
hfp_gsm_handle_event(HFP_AG_INCOMING_CALL);
|
||||
hfp_ag_set_callsetup_state(HFP_CALLSETUP_STATUS_INCOMING_CALL_SETUP_IN_PROGRESS);
|
||||
hfp_ag_trigger_incoming_call();
|
||||
printf("AG call waiting\n");
|
||||
@ -1146,13 +1170,13 @@ static void hfp_ag_call_sm(hfp_ag_call_event_t event, hfp_connection_t * connect
|
||||
break;
|
||||
case HFP_AG_INCOMING_CALL_ACCEPTED_BY_AG:
|
||||
// clear CLIP
|
||||
hfp_gsm_handle_event(HFP_AG_INCOMING_CALL_ACCEPTED_BY_AG);
|
||||
clip_type = 0;
|
||||
switch (hfp_ag_call_state){
|
||||
switch (get_hfp_ag_call_state()){
|
||||
case HFP_CALL_STATUS_NO_HELD_OR_ACTIVE_CALLS:
|
||||
switch (hfp_ag_callsetup_state){
|
||||
switch (get_hfp_ag_callsetup_state()){
|
||||
case HFP_CALLSETUP_STATUS_INCOMING_CALL_SETUP_IN_PROGRESS:
|
||||
hfp_ag_set_call_state(HFP_CALL_STATUS_ACTIVE_OR_HELD_CALL_IS_PRESENT);
|
||||
hfp_gsm_handle_event(HFP_AG_INCOMING_CALL_ACCEPTED_BY_AG);
|
||||
hfp_ag_set_call_indicator();
|
||||
hfp_ag_set_callsetup_state(HFP_CALLSETUP_STATUS_NO_CALL_SETUP_IN_PROGRESS);
|
||||
hfp_ag_ag_accept_call();
|
||||
printf("AG answers call, accept call by GSM\n");
|
||||
@ -1162,9 +1186,10 @@ static void hfp_ag_call_sm(hfp_ag_call_event_t event, hfp_connection_t * connect
|
||||
}
|
||||
break;
|
||||
case HFP_CALL_STATUS_ACTIVE_OR_HELD_CALL_IS_PRESENT:
|
||||
switch (hfp_ag_callsetup_state){
|
||||
switch (get_hfp_ag_callsetup_state()){
|
||||
case HFP_CALLSETUP_STATUS_INCOMING_CALL_SETUP_IN_PROGRESS:
|
||||
printf("AG: current call is placed on hold, incoming call gets active\n");
|
||||
hfp_gsm_handle_event(HFP_AG_INCOMING_CALL_ACCEPTED_BY_AG);
|
||||
hfp_ag_set_callsetup_state(HFP_CALLSETUP_STATUS_NO_CALL_SETUP_IN_PROGRESS);
|
||||
hfp_ag_set_callheld_state(HFP_CALLHELD_STATUS_CALL_ON_HOLD_OR_SWAPPED);
|
||||
hfp_ag_transfer_callsetup_state();
|
||||
@ -1178,12 +1203,12 @@ static void hfp_ag_call_sm(hfp_ag_call_event_t event, hfp_connection_t * connect
|
||||
break;
|
||||
|
||||
case HFP_AG_HELD_CALL_JOINED_BY_AG:
|
||||
hfp_gsm_handle_event(HFP_AG_HELD_CALL_JOINED_BY_AG);
|
||||
switch (hfp_ag_call_state){
|
||||
switch (get_hfp_ag_call_state()){
|
||||
case HFP_CALL_STATUS_ACTIVE_OR_HELD_CALL_IS_PRESENT:
|
||||
switch (hfp_ag_callheld_state){
|
||||
switch (get_hfp_ag_callheld_state()){
|
||||
case HFP_CALLHELD_STATUS_CALL_ON_HOLD_OR_SWAPPED:
|
||||
printf("AG: joining held call with active call\n");
|
||||
hfp_gsm_handle_event(HFP_AG_HELD_CALL_JOINED_BY_AG);
|
||||
hfp_ag_set_callheld_state(HFP_CALLHELD_STATUS_NO_CALLS_HELD);
|
||||
hfp_ag_transfer_callheld_state();
|
||||
hfp_emit_event(hfp_callback, HFP_SUBEVENT_CONFERENCE_CALL, 0);
|
||||
@ -1198,15 +1223,15 @@ static void hfp_ag_call_sm(hfp_ag_call_event_t event, hfp_connection_t * connect
|
||||
break;
|
||||
|
||||
case HFP_AG_INCOMING_CALL_ACCEPTED_BY_HF:
|
||||
hfp_gsm_handle_event(HFP_AG_INCOMING_CALL_ACCEPTED_BY_HF);
|
||||
// clear CLIP
|
||||
clip_type = 0;
|
||||
switch (hfp_ag_call_state){
|
||||
switch (get_hfp_ag_call_state()){
|
||||
case HFP_CALL_STATUS_NO_HELD_OR_ACTIVE_CALLS:
|
||||
switch (hfp_ag_callsetup_state){
|
||||
switch (get_hfp_ag_callsetup_state()){
|
||||
case HFP_CALLSETUP_STATUS_INCOMING_CALL_SETUP_IN_PROGRESS:
|
||||
hfp_gsm_handle_event(HFP_AG_INCOMING_CALL_ACCEPTED_BY_HF);
|
||||
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_indicator();
|
||||
hfp_ag_hf_accept_call(connection);
|
||||
printf("HF answers call, accept call by GSM\n");
|
||||
hfp_emit_event(hfp_callback, HFP_CMD_CALL_ANSWERED, 0);
|
||||
@ -1221,18 +1246,18 @@ static void hfp_ag_call_sm(hfp_ag_call_event_t event, hfp_connection_t * connect
|
||||
break;
|
||||
|
||||
case HFP_AG_RESPONSE_AND_HOLD_ACCEPT_INCOMING_CALL_BY_AG:
|
||||
hfp_gsm_handle_event(HFP_AG_RESPONSE_AND_HOLD_ACCEPT_INCOMING_CALL_BY_AG);
|
||||
// clear CLIP
|
||||
clip_type = 0;
|
||||
switch (hfp_ag_call_state){
|
||||
switch (get_hfp_ag_call_state()){
|
||||
case HFP_CALL_STATUS_NO_HELD_OR_ACTIVE_CALLS:
|
||||
switch (hfp_ag_callsetup_state){
|
||||
switch (get_hfp_ag_callsetup_state()){
|
||||
case HFP_CALLSETUP_STATUS_INCOMING_CALL_SETUP_IN_PROGRESS:
|
||||
hfp_gsm_handle_event(HFP_AG_RESPONSE_AND_HOLD_ACCEPT_INCOMING_CALL_BY_AG);
|
||||
hfp_ag_response_and_hold_active = 1;
|
||||
hfp_ag_response_and_hold_state = HFP_RESPONSE_AND_HOLD_INCOMING_ON_HOLD;
|
||||
hfp_ag_send_response_and_hold_state(hfp_ag_response_and_hold_state);
|
||||
// as with regualr call
|
||||
hfp_ag_set_call_state(HFP_CALL_STATUS_ACTIVE_OR_HELD_CALL_IS_PRESENT);
|
||||
hfp_ag_set_call_indicator();
|
||||
hfp_ag_set_callsetup_state(HFP_CALLSETUP_STATUS_NO_CALL_SETUP_IN_PROGRESS);
|
||||
hfp_ag_ag_accept_call();
|
||||
printf("AG response and hold - hold by AG\n");
|
||||
@ -1247,18 +1272,18 @@ static void hfp_ag_call_sm(hfp_ag_call_event_t event, hfp_connection_t * connect
|
||||
break;
|
||||
|
||||
case HFP_AG_RESPONSE_AND_HOLD_ACCEPT_INCOMING_CALL_BY_HF:
|
||||
hfp_gsm_handle_event(HFP_AG_RESPONSE_AND_HOLD_ACCEPT_INCOMING_CALL_BY_HF);
|
||||
// clear CLIP
|
||||
clip_type = 0;
|
||||
switch (hfp_ag_call_state){
|
||||
switch (get_hfp_ag_call_state()){
|
||||
case HFP_CALL_STATUS_NO_HELD_OR_ACTIVE_CALLS:
|
||||
switch (hfp_ag_callsetup_state){
|
||||
switch (get_hfp_ag_callsetup_state()){
|
||||
case HFP_CALLSETUP_STATUS_INCOMING_CALL_SETUP_IN_PROGRESS:
|
||||
hfp_gsm_handle_event(HFP_AG_RESPONSE_AND_HOLD_ACCEPT_INCOMING_CALL_BY_HF);
|
||||
hfp_ag_response_and_hold_active = 1;
|
||||
hfp_ag_response_and_hold_state = HFP_RESPONSE_AND_HOLD_INCOMING_ON_HOLD;
|
||||
hfp_ag_send_response_and_hold_state(hfp_ag_response_and_hold_state);
|
||||
// as with regualr call
|
||||
hfp_ag_set_call_state(HFP_CALL_STATUS_ACTIVE_OR_HELD_CALL_IS_PRESENT);
|
||||
hfp_ag_set_call_indicator();
|
||||
hfp_ag_set_callsetup_state(HFP_CALLSETUP_STATUS_NO_CALL_SETUP_IN_PROGRESS);
|
||||
hfp_ag_hf_accept_call(connection);
|
||||
printf("AG response and hold - hold by HF\n");
|
||||
@ -1274,9 +1299,9 @@ static void hfp_ag_call_sm(hfp_ag_call_event_t event, hfp_connection_t * connect
|
||||
|
||||
case HFP_AG_RESPONSE_AND_HOLD_ACCEPT_HELD_CALL_BY_AG:
|
||||
case HFP_AG_RESPONSE_AND_HOLD_ACCEPT_HELD_CALL_BY_HF:
|
||||
hfp_gsm_handle_event(HFP_AG_RESPONSE_AND_HOLD_ACCEPT_HELD_CALL_BY_AG);
|
||||
if (!hfp_ag_response_and_hold_active) break;
|
||||
if (hfp_ag_response_and_hold_state != HFP_RESPONSE_AND_HOLD_INCOMING_ON_HOLD) break;
|
||||
hfp_gsm_handle_event(HFP_AG_RESPONSE_AND_HOLD_ACCEPT_HELD_CALL_BY_AG);
|
||||
hfp_ag_response_and_hold_active = 0;
|
||||
hfp_ag_response_and_hold_state = HFP_RESPONSE_AND_HOLD_HELD_INCOMING_ACCEPTED;
|
||||
hfp_ag_send_response_and_hold_state(hfp_ag_response_and_hold_state);
|
||||
@ -1285,25 +1310,25 @@ static void hfp_ag_call_sm(hfp_ag_call_event_t event, hfp_connection_t * connect
|
||||
|
||||
case HFP_AG_RESPONSE_AND_HOLD_REJECT_HELD_CALL_BY_AG:
|
||||
case HFP_AG_RESPONSE_AND_HOLD_REJECT_HELD_CALL_BY_HF:
|
||||
hfp_gsm_handle_event(HFP_AG_RESPONSE_AND_HOLD_REJECT_HELD_CALL_BY_AG);
|
||||
if (!hfp_ag_response_and_hold_active) break;
|
||||
if (hfp_ag_response_and_hold_state != HFP_RESPONSE_AND_HOLD_INCOMING_ON_HOLD) break;
|
||||
hfp_gsm_handle_event(HFP_AG_RESPONSE_AND_HOLD_REJECT_HELD_CALL_BY_AG);
|
||||
hfp_ag_response_and_hold_active = 0;
|
||||
hfp_ag_response_and_hold_state = HFP_RESPONSE_AND_HOLD_HELD_INCOMING_REJECTED;
|
||||
hfp_ag_send_response_and_hold_state(hfp_ag_response_and_hold_state);
|
||||
// from terminate by ag
|
||||
hfp_ag_set_call_state(HFP_CALL_STATUS_NO_HELD_OR_ACTIVE_CALLS);
|
||||
hfp_ag_set_call_indicator();
|
||||
hfp_ag_trigger_terminate_call();
|
||||
break;
|
||||
|
||||
case HFP_AG_TERMINATE_CALL_BY_HF:
|
||||
hfp_gsm_handle_event(HFP_AG_TERMINATE_CALL_BY_HF);
|
||||
// clear CLIP
|
||||
clip_type = 0;
|
||||
switch (hfp_ag_call_state){
|
||||
switch (get_hfp_ag_call_state()){
|
||||
case HFP_CALL_STATUS_NO_HELD_OR_ACTIVE_CALLS:
|
||||
switch (hfp_ag_callsetup_state){
|
||||
switch (get_hfp_ag_callsetup_state()){
|
||||
case HFP_CALLSETUP_STATUS_INCOMING_CALL_SETUP_IN_PROGRESS:
|
||||
hfp_gsm_handle_event(HFP_AG_TERMINATE_CALL_BY_HF);
|
||||
hfp_ag_set_callsetup_state(HFP_CALLSETUP_STATUS_NO_CALL_SETUP_IN_PROGRESS);
|
||||
hfp_ag_transfer_callsetup_state();
|
||||
hfp_ag_trigger_reject_call();
|
||||
@ -1311,6 +1336,7 @@ static void hfp_ag_call_sm(hfp_ag_call_event_t event, hfp_connection_t * connect
|
||||
break;
|
||||
case HFP_CALLSETUP_STATUS_OUTGOING_CALL_SETUP_IN_DIALING_STATE:
|
||||
case HFP_CALLSETUP_STATUS_OUTGOING_CALL_SETUP_IN_ALERTING_STATE:
|
||||
hfp_gsm_handle_event(HFP_AG_TERMINATE_CALL_BY_HF);
|
||||
hfp_ag_set_callsetup_state(HFP_CALLSETUP_STATUS_NO_CALL_SETUP_IN_PROGRESS);
|
||||
hfp_ag_transfer_callsetup_state();
|
||||
printf("AG terminate outgoing call process\n");
|
||||
@ -1319,7 +1345,8 @@ static void hfp_ag_call_sm(hfp_ag_call_event_t event, hfp_connection_t * connect
|
||||
}
|
||||
break;
|
||||
case HFP_CALL_STATUS_ACTIVE_OR_HELD_CALL_IS_PRESENT:
|
||||
hfp_ag_set_call_state(HFP_CALL_STATUS_NO_HELD_OR_ACTIVE_CALLS);
|
||||
hfp_gsm_handle_event(HFP_AG_TERMINATE_CALL_BY_HF);
|
||||
hfp_ag_set_call_indicator();
|
||||
hfp_ag_transfer_call_state();
|
||||
connection->call_state = HFP_CALL_IDLE;
|
||||
printf("AG terminate call\n");
|
||||
@ -1328,13 +1355,13 @@ static void hfp_ag_call_sm(hfp_ag_call_event_t event, hfp_connection_t * connect
|
||||
break;
|
||||
|
||||
case HFP_AG_TERMINATE_CALL_BY_AG:
|
||||
hfp_gsm_handle_event(HFP_AG_TERMINATE_CALL_BY_AG);
|
||||
// clear CLIP
|
||||
clip_type = 0;
|
||||
switch (hfp_ag_call_state){
|
||||
switch (get_hfp_ag_call_state()){
|
||||
case HFP_CALL_STATUS_NO_HELD_OR_ACTIVE_CALLS:
|
||||
switch (hfp_ag_callsetup_state){
|
||||
switch (get_hfp_ag_callsetup_state()){
|
||||
case HFP_CALLSETUP_STATUS_INCOMING_CALL_SETUP_IN_PROGRESS:
|
||||
hfp_gsm_handle_event(HFP_AG_TERMINATE_CALL_BY_AG);
|
||||
hfp_ag_set_callsetup_state(HFP_CALLSETUP_STATUS_NO_CALL_SETUP_IN_PROGRESS);
|
||||
hfp_ag_trigger_reject_call();
|
||||
printf("AG Rejected Incoming call, AG terminate call\n");
|
||||
@ -1343,8 +1370,9 @@ static void hfp_ag_call_sm(hfp_ag_call_event_t event, hfp_connection_t * connect
|
||||
break;
|
||||
}
|
||||
case HFP_CALL_STATUS_ACTIVE_OR_HELD_CALL_IS_PRESENT:
|
||||
hfp_gsm_handle_event(HFP_AG_TERMINATE_CALL_BY_AG);
|
||||
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_set_call_indicator();
|
||||
hfp_ag_trigger_terminate_call();
|
||||
printf("AG terminate call\n");
|
||||
break;
|
||||
@ -1353,12 +1381,11 @@ static void hfp_ag_call_sm(hfp_ag_call_event_t event, hfp_connection_t * connect
|
||||
}
|
||||
break;
|
||||
case HFP_AG_CALL_DROPPED:
|
||||
hfp_gsm_handle_event(HFP_AG_CALL_DROPPED);
|
||||
// clear CLIP
|
||||
clip_type = 0;
|
||||
switch (hfp_ag_call_state){
|
||||
switch (get_hfp_ag_call_state()){
|
||||
case HFP_CALL_STATUS_NO_HELD_OR_ACTIVE_CALLS:
|
||||
switch (hfp_ag_callsetup_state){
|
||||
switch (get_hfp_ag_callsetup_state()){
|
||||
case HFP_CALLSETUP_STATUS_INCOMING_CALL_SETUP_IN_PROGRESS:
|
||||
hfp_ag_stop_ringing();
|
||||
printf("Incoming call interrupted\n");
|
||||
@ -1371,16 +1398,19 @@ static void hfp_ag_call_sm(hfp_ag_call_event_t event, hfp_connection_t * connect
|
||||
default:
|
||||
break;
|
||||
}
|
||||
hfp_gsm_handle_event(HFP_AG_CALL_DROPPED);
|
||||
hfp_ag_set_callsetup_state(HFP_CALLSETUP_STATUS_NO_CALL_SETUP_IN_PROGRESS);
|
||||
hfp_ag_transfer_callsetup_state();
|
||||
break;
|
||||
case HFP_CALL_STATUS_ACTIVE_OR_HELD_CALL_IS_PRESENT:
|
||||
if (hfp_ag_response_and_hold_active) {
|
||||
hfp_gsm_handle_event(HFP_AG_CALL_DROPPED);
|
||||
hfp_ag_response_and_hold_state = HFP_RESPONSE_AND_HOLD_HELD_INCOMING_REJECTED;
|
||||
hfp_ag_send_response_and_hold_state(hfp_ag_response_and_hold_state);
|
||||
}
|
||||
hfp_gsm_handle_event(HFP_AG_CALL_DROPPED);
|
||||
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_set_call_indicator();
|
||||
hfp_ag_trigger_terminate_call();
|
||||
printf("AG notify call dropped\n");
|
||||
break;
|
||||
@ -1429,24 +1459,26 @@ static void hfp_ag_call_sm(hfp_ag_call_event_t event, hfp_connection_t * connect
|
||||
hfp_run_for_context(connection);
|
||||
break;
|
||||
|
||||
case HFP_AG_OUTGOING_CALL_ACCEPTED:
|
||||
case HFP_AG_OUTGOING_CALL_ACCEPTED:{
|
||||
connection = hfp_ag_connection_for_call_state(HFP_CALL_OUTGOING_INITIATED);
|
||||
if (!connection){
|
||||
log_info("hfp_ag_call_sm: did not find outgoing connection in initiated state");
|
||||
break;
|
||||
}
|
||||
|
||||
hfp_gsm_handle_event(HFP_AG_OUTGOING_CALL_ACCEPTED);
|
||||
connection->ok_pending = 1;
|
||||
connection->call_state = HFP_CALL_OUTGOING_DIALING;
|
||||
|
||||
// trigger callsetup to be
|
||||
int put_call_on_hold = get_hfp_ag_call_state() == HFP_CALL_STATUS_ACTIVE_OR_HELD_CALL_IS_PRESENT;
|
||||
hfp_gsm_handle_event(HFP_AG_OUTGOING_CALL_ACCEPTED);
|
||||
|
||||
hfp_ag_set_callsetup_state(HFP_CALLSETUP_STATUS_OUTGOING_CALL_SETUP_IN_DIALING_STATE);
|
||||
indicator_index = get_ag_indicator_index_for_name("callsetup");
|
||||
connection->ag_indicators_status_update_bitmap = store_bit(connection->ag_indicators_status_update_bitmap, indicator_index, 1);
|
||||
|
||||
// put current call on hold if active
|
||||
if (hfp_ag_call_state == HFP_CALL_STATUS_ACTIVE_OR_HELD_CALL_IS_PRESENT){
|
||||
if (put_call_on_hold){
|
||||
printf("AG putting current call on hold for new outgoing call\n");
|
||||
hfp_ag_set_callheld_state(HFP_CALLHELD_STATUS_CALL_ON_HOLD_AND_NO_ACTIVE_CALLS);
|
||||
indicator_index = get_ag_indicator_index_for_name("callheld");
|
||||
@ -1456,7 +1488,7 @@ static void hfp_ag_call_sm(hfp_ag_call_event_t event, hfp_connection_t * connect
|
||||
// start audio if needed
|
||||
hfp_ag_establish_audio_connection(connection->remote_addr);
|
||||
break;
|
||||
|
||||
}
|
||||
case HFP_AG_OUTGOING_CALL_RINGING:
|
||||
// hfp_gsm_handle_event();
|
||||
connection = hfp_ag_connection_for_call_state(HFP_CALL_OUTGOING_DIALING);
|
||||
@ -1471,7 +1503,7 @@ static void hfp_ag_call_sm(hfp_ag_call_event_t event, hfp_connection_t * connect
|
||||
hfp_ag_transfer_callsetup_state();
|
||||
break;
|
||||
|
||||
case HFP_AG_OUTGOING_CALL_ESTABLISHED:
|
||||
case HFP_AG_OUTGOING_CALL_ESTABLISHED:{
|
||||
// get outgoing call
|
||||
connection = hfp_ag_connection_for_call_state(HFP_CALL_OUTGOING_RINGING);
|
||||
if (!connection){
|
||||
@ -1482,32 +1514,93 @@ static void hfp_ag_call_sm(hfp_ag_call_event_t event, hfp_connection_t * connect
|
||||
break;
|
||||
}
|
||||
|
||||
int CALLHELD_STATUS_CALL_ON_HOLD_AND_NO_ACTIVE_CALLS = get_hfp_ag_callheld_state() == HFP_CALLHELD_STATUS_CALL_ON_HOLD_AND_NO_ACTIVE_CALLS;
|
||||
hfp_gsm_handle_event(HFP_AG_OUTGOING_CALL_ESTABLISHED);
|
||||
connection->call_state = HFP_CALL_ACTIVE;
|
||||
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_indicator();
|
||||
hfp_ag_transfer_call_state();
|
||||
hfp_ag_transfer_callsetup_state();
|
||||
if (hfp_ag_callheld_state == HFP_CALLHELD_STATUS_CALL_ON_HOLD_AND_NO_ACTIVE_CALLS){
|
||||
if (CALLHELD_STATUS_CALL_ON_HOLD_AND_NO_ACTIVE_CALLS){
|
||||
hfp_ag_set_callheld_state(HFP_CALLHELD_STATUS_CALL_ON_HOLD_OR_SWAPPED);
|
||||
hfp_ag_transfer_callheld_state();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case HFP_AG_CALL_HOLD_USER_BUSY:
|
||||
hfp_gsm_handle_event(HFP_AG_CALL_HOLD_USER_BUSY);
|
||||
hfp_ag_set_callsetup_state(HFP_CALLSETUP_STATUS_NO_CALL_SETUP_IN_PROGRESS);
|
||||
connection->ag_indicators_status_update_bitmap = store_bit(connection->ag_indicators_status_update_bitmap, callsetup_indicator_index, 1);
|
||||
connection->call_state = HFP_CALL_ACTIVE;
|
||||
printf("AG: Call Waiting, User Busy\n");
|
||||
break;
|
||||
|
||||
case HFP_AG_CALL_HOLD_RELEASE_ACTIVE_ACCEPT_HELD_OR_WAITING_CALL:{
|
||||
int call_setup_in_progress = get_hfp_ag_callsetup_state() != HFP_CALLSETUP_STATUS_NO_CALL_SETUP_IN_PROGRESS;
|
||||
int call_held = get_hfp_ag_callheld_state() != HFP_CALLHELD_STATUS_NO_CALLS_HELD;
|
||||
|
||||
// Releases all active calls (if any exist) and accepts the other (held or waiting) call.
|
||||
if (call_setup_in_progress){
|
||||
printf("AG: Call Dropped, Accept new call\n");
|
||||
hfp_ag_set_callsetup_state(HFP_CALLSETUP_STATUS_NO_CALL_SETUP_IN_PROGRESS);
|
||||
connection->ag_indicators_status_update_bitmap = store_bit(connection->ag_indicators_status_update_bitmap, callsetup_indicator_index, 1);
|
||||
} else {
|
||||
printf("AG: Call Dropped, Resume held call\n");
|
||||
}
|
||||
if (call_held){
|
||||
hfp_ag_set_callheld_state(HFP_CALLHELD_STATUS_NO_CALLS_HELD);
|
||||
connection->ag_indicators_status_update_bitmap = store_bit(connection->ag_indicators_status_update_bitmap, callheld_indicator_index, 1);
|
||||
}
|
||||
if (call_held || call_setup_in_progress){
|
||||
hfp_gsm_handle_event(HFP_AG_CALL_HOLD_RELEASE_ACTIVE_ACCEPT_HELD_OR_WAITING_CALL);
|
||||
}
|
||||
connection->call_state = HFP_CALL_ACTIVE;
|
||||
break;
|
||||
}
|
||||
case HFP_AG_CALL_HOLD_PARK_ACTIVE_ACCEPT_HELD_OR_WAITING_CALL:{
|
||||
int call_setup_in_progress = get_hfp_ag_callsetup_state() != HFP_CALLSETUP_STATUS_NO_CALL_SETUP_IN_PROGRESS;
|
||||
// Places all active calls (if any exist) on hold and accepts the other (held or waiting) call.
|
||||
// only update if callsetup changed
|
||||
if (call_setup_in_progress){
|
||||
printf("AG: Call on Hold, Accept new call\n");
|
||||
hfp_ag_set_callsetup_state(HFP_CALLSETUP_STATUS_NO_CALL_SETUP_IN_PROGRESS);
|
||||
connection->ag_indicators_status_update_bitmap = store_bit(connection->ag_indicators_status_update_bitmap, callsetup_indicator_index, 1);
|
||||
} else {
|
||||
printf("AG: Swap calls\n");
|
||||
}
|
||||
hfp_gsm_handle_event(HFP_AG_CALL_HOLD_PARK_ACTIVE_ACCEPT_HELD_OR_WAITING_CALL);
|
||||
hfp_ag_set_callheld_state(HFP_CALLHELD_STATUS_CALL_ON_HOLD_OR_SWAPPED);
|
||||
connection->ag_indicators_status_update_bitmap = store_bit(connection->ag_indicators_status_update_bitmap, callheld_indicator_index, 1);
|
||||
connection->call_state = HFP_CALL_ACTIVE;
|
||||
break;
|
||||
}
|
||||
case HFP_AG_CALL_HOLD_ADD_HELD_CALL:
|
||||
// Adds a held call to the conversation.
|
||||
if (get_hfp_ag_callheld_state() != HFP_CALLHELD_STATUS_NO_CALLS_HELD){
|
||||
printf("AG: Join 3-way-call\n");
|
||||
hfp_gsm_handle_event(HFP_AG_CALL_HOLD_ADD_HELD_CALL);
|
||||
hfp_ag_set_callheld_state(HFP_CALLHELD_STATUS_NO_CALLS_HELD);
|
||||
connection->ag_indicators_status_update_bitmap = store_bit(connection->ag_indicators_status_update_bitmap, callheld_indicator_index, 1);
|
||||
hfp_emit_event(hfp_callback, HFP_SUBEVENT_CONFERENCE_CALL, 0);
|
||||
}
|
||||
connection->call_state = HFP_CALL_ACTIVE;
|
||||
break;
|
||||
case HFP_AG_CALL_HOLD_EXIT_AND_JOIN_CALLS:
|
||||
// Connects the two calls and disconnects the subscriber from both calls (Explicit Call Transfer)
|
||||
hfp_gsm_handle_event(HFP_AG_CALL_HOLD_EXIT_AND_JOIN_CALLS);
|
||||
printf("AG: Transfer call -> Connect two calls and disconnect\n");
|
||||
hfp_ag_set_call_indicator();
|
||||
hfp_ag_set_callheld_state(HFP_CALLHELD_STATUS_NO_CALLS_HELD);
|
||||
connection->ag_indicators_status_update_bitmap = store_bit(connection->ag_indicators_status_update_bitmap, call_indicator_index, 1);
|
||||
connection->ag_indicators_status_update_bitmap = store_bit(connection->ag_indicators_status_update_bitmap, callheld_indicator_index, 1);
|
||||
connection->call_state = HFP_CALL_IDLE;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if ( (hfp_ag_callsetup_state != hfp_gsm_callsetup_status()) ||
|
||||
(hfp_ag_callheld_state != hfp_gsm_callheld_status()) ||
|
||||
(hfp_ag_call_state != hfp_gsm_call_status()) ){
|
||||
|
||||
printf("event %d\n", event);
|
||||
printf("callsetup %d - %d \n", hfp_ag_callsetup_state, hfp_gsm_callsetup_status());
|
||||
printf("callheld %d - %d \n", hfp_ag_callheld_state, hfp_gsm_callheld_status());
|
||||
printf("call %d - %d \n", hfp_ag_call_state, hfp_gsm_call_status());
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
static void hfp_run_for_context(hfp_connection_t *context){
|
||||
@ -1778,73 +1871,24 @@ static void hfp_handle_rfcomm_data(uint8_t packet_type, uint16_t channel, uint8_
|
||||
case HFP_CMD_CALL_HOLD: {
|
||||
// TODO: fully implement this
|
||||
log_error("HFP: unhandled call hold type %c", context->line_buffer[0]);
|
||||
int callsetup_indicator_index = get_ag_indicator_index_for_name("callsetup");
|
||||
int callheld_indicator_index = get_ag_indicator_index_for_name("callheld");
|
||||
int call_indicator_index = get_ag_indicator_index_for_name("call");
|
||||
context->command = HFP_CMD_NONE;
|
||||
context->ok_pending = 1;
|
||||
|
||||
switch (context->line_buffer[0]){
|
||||
case '0':
|
||||
context->command = HFP_CMD_NONE;
|
||||
context->ok_pending = 1;
|
||||
hfp_ag_set_callsetup_state(HFP_CALLSETUP_STATUS_NO_CALL_SETUP_IN_PROGRESS);
|
||||
context->ag_indicators_status_update_bitmap = store_bit(context->ag_indicators_status_update_bitmap, callsetup_indicator_index, 1);
|
||||
context->call_state = HFP_CALL_ACTIVE;
|
||||
printf("AG: Call Waiting, User Busy\n");
|
||||
hfp_ag_call_sm(HFP_AG_CALL_HOLD_USER_BUSY, context);
|
||||
break;
|
||||
case '1':
|
||||
// Releases all active calls (if any exist) and accepts the other (held or waiting) call.
|
||||
context->command = HFP_CMD_NONE;
|
||||
context->ok_pending = 1;
|
||||
if (hfp_ag_callsetup_state != HFP_CALLSETUP_STATUS_NO_CALL_SETUP_IN_PROGRESS){
|
||||
printf("AG: Call Dropped, Accept new call\n");
|
||||
hfp_ag_set_callsetup_state(HFP_CALLSETUP_STATUS_NO_CALL_SETUP_IN_PROGRESS);
|
||||
context->ag_indicators_status_update_bitmap = store_bit(context->ag_indicators_status_update_bitmap, callsetup_indicator_index, 1);
|
||||
} else {
|
||||
printf("AG: Call Dropped, Resume held call\n");
|
||||
}
|
||||
if (hfp_ag_callheld_state != HFP_CALLHELD_STATUS_NO_CALLS_HELD){
|
||||
hfp_ag_set_callheld_state(HFP_CALLHELD_STATUS_NO_CALLS_HELD);
|
||||
context->ag_indicators_status_update_bitmap = store_bit(context->ag_indicators_status_update_bitmap, callheld_indicator_index, 1);
|
||||
}
|
||||
context->call_state = HFP_CALL_ACTIVE;
|
||||
hfp_ag_call_sm(HFP_AG_CALL_HOLD_RELEASE_ACTIVE_ACCEPT_HELD_OR_WAITING_CALL, context);
|
||||
break;
|
||||
case '2':
|
||||
// Places all active calls (if any exist) on hold and accepts the other (held or waiting) call.
|
||||
context->command = HFP_CMD_NONE;
|
||||
context->ok_pending = 1;
|
||||
// only update if callsetup changed
|
||||
if (hfp_ag_callsetup_state != HFP_CALLSETUP_STATUS_NO_CALL_SETUP_IN_PROGRESS){
|
||||
printf("AG: Call on Hold, Accept new call\n");
|
||||
hfp_ag_set_callsetup_state(HFP_CALLSETUP_STATUS_NO_CALL_SETUP_IN_PROGRESS);
|
||||
context->ag_indicators_status_update_bitmap = store_bit(context->ag_indicators_status_update_bitmap, callsetup_indicator_index, 1);
|
||||
} else {
|
||||
printf("AG: Swap calls\n");
|
||||
}
|
||||
hfp_ag_set_callheld_state(HFP_CALLHELD_STATUS_CALL_ON_HOLD_OR_SWAPPED);
|
||||
context->ag_indicators_status_update_bitmap = store_bit(context->ag_indicators_status_update_bitmap, callheld_indicator_index, 1);
|
||||
context->call_state = HFP_CALL_ACTIVE;
|
||||
hfp_ag_call_sm(HFP_AG_CALL_HOLD_PARK_ACTIVE_ACCEPT_HELD_OR_WAITING_CALL, context);
|
||||
break;
|
||||
case '3':
|
||||
// Adds a held call to the conversation.
|
||||
context->command = HFP_CMD_NONE;
|
||||
context->ok_pending = 1;
|
||||
if (hfp_ag_callheld_state != HFP_CALLHELD_STATUS_NO_CALLS_HELD){
|
||||
printf("AG: Join 3-way-call\n");
|
||||
hfp_ag_set_callheld_state(HFP_CALLHELD_STATUS_NO_CALLS_HELD);
|
||||
context->ag_indicators_status_update_bitmap = store_bit(context->ag_indicators_status_update_bitmap, callheld_indicator_index, 1);
|
||||
hfp_emit_event(hfp_callback, HFP_SUBEVENT_CONFERENCE_CALL, 0);
|
||||
}
|
||||
context->call_state = HFP_CALL_ACTIVE;
|
||||
hfp_ag_call_sm(HFP_AG_CALL_HOLD_ADD_HELD_CALL, context);
|
||||
break;
|
||||
case '4':
|
||||
// Connects the two calls and disconnects the subscriber from both calls (Explicit Call Transfer)
|
||||
context->command = HFP_CMD_NONE;
|
||||
context->ok_pending = 1;
|
||||
printf("AG: Transfer call -> Connect two calls and disconnect\n");
|
||||
hfp_ag_set_call_state(HFP_CALL_STATUS_NO_HELD_OR_ACTIVE_CALLS);
|
||||
hfp_ag_set_callheld_state(HFP_CALLHELD_STATUS_NO_CALLS_HELD);
|
||||
context->ag_indicators_status_update_bitmap = store_bit(context->ag_indicators_status_update_bitmap, call_indicator_index, 1);
|
||||
context->ag_indicators_status_update_bitmap = store_bit(context->ag_indicators_status_update_bitmap, callheld_indicator_index, 1);
|
||||
context->call_state = HFP_CALL_IDLE;
|
||||
hfp_ag_call_sm(HFP_AG_CALL_HOLD_EXIT_AND_JOIN_CALLS, context);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -1946,10 +1990,10 @@ void hfp_ag_init(uint16_t rfcomm_channel_nr, uint32_t supported_features,
|
||||
hfp_ag_call_hold_services_nr = call_hold_services_nr;
|
||||
memcpy(hfp_ag_call_hold_services, call_hold_services, call_hold_services_nr * sizeof(char *));
|
||||
|
||||
hfp_ag_call_state = HFP_CALL_STATUS_NO_HELD_OR_ACTIVE_CALLS;
|
||||
hfp_ag_callsetup_state = HFP_CALLSETUP_STATUS_NO_CALL_SETUP_IN_PROGRESS;
|
||||
hfp_ag_callheld_state = HFP_CALLHELD_STATUS_NO_CALLS_HELD;
|
||||
|
||||
|
||||
hfp_ag_response_and_hold_active = 0;
|
||||
clip_type = 0; // 0 == not set
|
||||
memset(clip_number,0,sizeof(clip_number));
|
||||
|
@ -83,6 +83,10 @@ static hfp_callsetup_status_t callsetup_status = HFP_CALLSETUP_STATUS_NO_CALL_SE
|
||||
|
||||
void hfp_gsm_init(void){
|
||||
memset(gsm_calls, 0, sizeof(gsm_calls));
|
||||
int i;
|
||||
for (i = 0; i < HFP_GSM_MAX_NR_CALLS; i++){
|
||||
gsm_calls[i].status = CALL_NONE;
|
||||
}
|
||||
callsetup_status = HFP_CALLSETUP_STATUS_NO_CALL_SETUP_IN_PROGRESS;
|
||||
}
|
||||
|
||||
@ -134,10 +138,6 @@ static inline int get_number_held_calls(){
|
||||
return get_number_calls_with_status(CALL_HELD);
|
||||
}
|
||||
|
||||
static inline int get_number_initiated_calls(){
|
||||
return get_number_calls_with_status(CALL_INITIATED);
|
||||
}
|
||||
|
||||
static inline int get_number_response_held_calls(){
|
||||
return get_number_calls_with_status(CALL_RESPONSE_HOLD);
|
||||
}
|
||||
@ -177,7 +177,7 @@ void hfp_gsm_handle_event(hfp_ag_call_event_t event){
|
||||
int current_call_index = get_active_call_index();
|
||||
int initiated_call_index = get_initiated_call_index();
|
||||
int held_call_index = get_held_call_index();
|
||||
|
||||
printf("hfp_gsm_handle_event %d \n", event);
|
||||
switch (event){
|
||||
case HFP_AG_OUTGOING_CALL_INITIATED:
|
||||
case HFP_AG_OUTGOING_REDIAL_INITIATED:
|
||||
@ -215,25 +215,19 @@ void hfp_gsm_handle_event(hfp_ag_call_event_t event){
|
||||
break;
|
||||
|
||||
case HFP_AG_INCOMING_CALL:
|
||||
printf("HFP_AG_INCOMING_CALL \n");
|
||||
if (hfp_gsm_callsetup_status() != HFP_CALLSETUP_STATUS_NO_CALL_SETUP_IN_PROGRESS) break;
|
||||
printf("HFP_AG_INCOMING_CALL 1: HFP_CALLSETUP_STATUS_NO_CALL_SETUP_IN_PROGRESS -> HFP_CALLSETUP_STATUS_INCOMING_CALL_SETUP_IN_PROGRESS, CALL_INITIATED %d\n", next_free_slot);
|
||||
callsetup_status = HFP_CALLSETUP_STATUS_INCOMING_CALL_SETUP_IN_PROGRESS;
|
||||
gsm_calls[next_free_slot].status = CALL_INITIATED;
|
||||
gsm_calls[next_free_slot].clip_type = 0;
|
||||
break;
|
||||
|
||||
case HFP_AG_INCOMING_CALL_ACCEPTED_BY_AG:
|
||||
printf("HFP_AG_INCOMING_CALL_ACCEPTED_BY_AG \n");
|
||||
if (hfp_gsm_callsetup_status() != HFP_CALLSETUP_STATUS_INCOMING_CALL_SETUP_IN_PROGRESS) break;
|
||||
callsetup_status = HFP_CALLSETUP_STATUS_NO_CALL_SETUP_IN_PROGRESS;
|
||||
|
||||
if (hfp_gsm_call_status() == HFP_CALL_STATUS_ACTIVE_OR_HELD_CALL_IS_PRESENT){
|
||||
printf("HFP_AG_INCOMING_CALL_ACCEPTED_BY_AG 1: HFP_CALL_STATUS_ACTIVE_OR_HELD_CALL_IS_PRESENT, CALL_HELD %d\n", current_call_index);
|
||||
gsm_calls[current_call_index].status = CALL_HELD;
|
||||
}
|
||||
printf("HFP_AG_INCOMING_CALL_ACCEPTED_BY_AG 2: HFP_CALL_STATUS_ACTIVE_OR_HELD_CALL_IS_PRESENT, CALL_ACTIVE %d\n", initiated_call_index);
|
||||
|
||||
gsm_calls[initiated_call_index].status = CALL_ACTIVE;
|
||||
break;
|
||||
|
||||
@ -255,11 +249,8 @@ void hfp_gsm_handle_event(hfp_ag_call_event_t event){
|
||||
break;
|
||||
|
||||
case HFP_AG_INCOMING_CALL_ACCEPTED_BY_HF:
|
||||
printf("HFP_AG_INCOMING_CALL_ACCEPTED_BY_HF \n");
|
||||
if (hfp_gsm_callsetup_status() != HFP_CALLSETUP_STATUS_INCOMING_CALL_SETUP_IN_PROGRESS) break;
|
||||
printf("HFP_AG_INCOMING_CALL_ACCEPTED_BY_HF 1: HFP_CALLSETUP_STATUS_INCOMING_CALL_SETUP_IN_PROGRESS\n");
|
||||
if (hfp_gsm_call_status() != HFP_CALL_STATUS_NO_HELD_OR_ACTIVE_CALLS) break;
|
||||
printf("HFP_AG_INCOMING_CALL_ACCEPTED_BY_HF 2\n");
|
||||
callsetup_status = HFP_CALLSETUP_STATUS_NO_CALL_SETUP_IN_PROGRESS;
|
||||
gsm_calls[initiated_call_index].status = CALL_ACTIVE;
|
||||
break;
|
||||
@ -323,7 +314,74 @@ void hfp_gsm_handle_event(hfp_ag_call_event_t event){
|
||||
}
|
||||
}
|
||||
break;
|
||||
case HFP_AG_CALL_HOLD_USER_BUSY:
|
||||
// Held or waiting call gets active,
|
||||
callsetup_status = HFP_CALLSETUP_STATUS_NO_CALL_SETUP_IN_PROGRESS;
|
||||
gsm_calls[initiated_call_index].status = CALL_NONE;
|
||||
gsm_calls[held_call_index].status = CALL_ACTIVE;
|
||||
break;
|
||||
|
||||
case HFP_AG_CALL_HOLD_RELEASE_ACTIVE_ACCEPT_HELD_OR_WAITING_CALL:{
|
||||
int i ;
|
||||
for (i = 0; i < HFP_GSM_MAX_NR_CALLS; i++){
|
||||
if (gsm_calls[i].status == CALL_ACTIVE){
|
||||
gsm_calls[i].clip_type = 0;
|
||||
gsm_calls[i].clip_number[0] = '\0';
|
||||
gsm_calls[i].status = CALL_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
if (callsetup_status != HFP_CALLSETUP_STATUS_NO_CALL_SETUP_IN_PROGRESS){
|
||||
gsm_calls[initiated_call_index].status = CALL_ACTIVE;
|
||||
} else {
|
||||
gsm_calls[held_call_index].status = CALL_ACTIVE;
|
||||
}
|
||||
callsetup_status = HFP_CALLSETUP_STATUS_NO_CALL_SETUP_IN_PROGRESS;
|
||||
break;
|
||||
}
|
||||
case HFP_AG_CALL_HOLD_PARK_ACTIVE_ACCEPT_HELD_OR_WAITING_CALL:{
|
||||
int i ;
|
||||
for (i = 0; i < HFP_GSM_MAX_NR_CALLS; i++){
|
||||
if (gsm_calls[i].status == CALL_ACTIVE){
|
||||
gsm_calls[i].clip_type = 0;
|
||||
gsm_calls[i].clip_number[0] = '\0';
|
||||
gsm_calls[i].status = CALL_HELD;
|
||||
}
|
||||
}
|
||||
|
||||
if (callsetup_status != HFP_CALLSETUP_STATUS_NO_CALL_SETUP_IN_PROGRESS){
|
||||
gsm_calls[initiated_call_index].status = CALL_ACTIVE;
|
||||
} else {
|
||||
gsm_calls[held_call_index].status = CALL_ACTIVE;
|
||||
}
|
||||
callsetup_status = HFP_CALLSETUP_STATUS_NO_CALL_SETUP_IN_PROGRESS;
|
||||
break;
|
||||
}
|
||||
case HFP_AG_CALL_HOLD_ADD_HELD_CALL:{
|
||||
if (hfp_gsm_callheld_status() != HFP_CALLHELD_STATUS_NO_CALLS_HELD){
|
||||
int i ;
|
||||
for (i = 0; i < HFP_GSM_MAX_NR_CALLS; i++){
|
||||
if (gsm_calls[i].status == CALL_HELD){
|
||||
gsm_calls[i].clip_type = 0;
|
||||
gsm_calls[i].clip_number[0] = '\0';
|
||||
gsm_calls[i].status = CALL_ACTIVE;
|
||||
}
|
||||
}
|
||||
}
|
||||
gsm_calls[initiated_call_index].status = CALL_ACTIVE;
|
||||
|
||||
break;
|
||||
}
|
||||
case HFP_AG_CALL_HOLD_EXIT_AND_JOIN_CALLS:{
|
||||
int i ;
|
||||
for (i = 0; i < HFP_GSM_MAX_NR_CALLS; i++){
|
||||
gsm_calls[i].clip_type = 0;
|
||||
gsm_calls[i].clip_number[0] = '\0';
|
||||
gsm_calls[i].status = CALL_NONE;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user