hfp ag cleanup

This commit is contained in:
Milanka Ringwald 2016-01-14 14:53:33 +01:00
parent 1d5aea2342
commit e8d65f6610

View File

@ -96,10 +96,6 @@ 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_setup_audio_connection(hfp_connection_t * connection);
static void hfp_ag_hf_start_ringing(hfp_connection_t * context); static void hfp_ag_hf_start_ringing(hfp_connection_t * context);
static hfp_call_status_t get_hfp_ag_call_state(void){
return hfp_ag_call_state;
// return hfp_gsm_call_status();
}
static hfp_callsetup_status_t get_hfp_ag_callsetup_state(void){ static hfp_callsetup_status_t get_hfp_ag_callsetup_state(void){
return hfp_ag_callsetup_state; return hfp_ag_callsetup_state;
@ -641,11 +637,11 @@ static void hfp_ag_slc_established(hfp_connection_t * context){
hfp_init_link_settings(context); hfp_init_link_settings(context);
// if active call exist, set per-connection state active, too (when audio is on) // if active call exist, set per-connection state active, too (when audio is on)
if (get_hfp_ag_call_state() == HFP_CALL_STATUS_ACTIVE_OR_HELD_CALL_IS_PRESENT){ if (hfp_gsm_call_status() == HFP_CALL_STATUS_ACTIVE_OR_HELD_CALL_IS_PRESENT){
context->call_state = HFP_CALL_W4_AUDIO_CONNECTION_FOR_ACTIVE; context->call_state = HFP_CALL_W4_AUDIO_CONNECTION_FOR_ACTIVE;
} }
// if AG is ringing, also start ringing on the HF // if AG is ringing, also start ringing on the HF
if (get_hfp_ag_call_state() == HFP_CALL_STATUS_NO_HELD_OR_ACTIVE_CALLS && if (hfp_gsm_call_status() == HFP_CALL_STATUS_NO_HELD_OR_ACTIVE_CALLS &&
get_hfp_ag_callsetup_state() == HFP_CALLSETUP_STATUS_INCOMING_CALL_SETUP_IN_PROGRESS){ get_hfp_ag_callsetup_state() == HFP_CALLSETUP_STATUS_INCOMING_CALL_SETUP_IN_PROGRESS){
hfp_ag_hf_start_ringing(context); hfp_ag_hf_start_ringing(context);
} }
@ -1170,7 +1166,7 @@ static void hfp_ag_call_sm(hfp_ag_call_event_t event, hfp_connection_t * connect
break; break;
case HFP_AG_HELD_CALL_JOINED_BY_AG: case HFP_AG_HELD_CALL_JOINED_BY_AG:
switch (get_hfp_ag_call_state()){ switch (hfp_gsm_call_status()){
case HFP_CALL_STATUS_ACTIVE_OR_HELD_CALL_IS_PRESENT: case HFP_CALL_STATUS_ACTIVE_OR_HELD_CALL_IS_PRESENT:
switch (get_hfp_ag_callheld_state()){ switch (get_hfp_ag_callheld_state()){
case HFP_CALLHELD_STATUS_CALL_ON_HOLD_OR_SWAPPED: case HFP_CALLHELD_STATUS_CALL_ON_HOLD_OR_SWAPPED:
@ -1191,7 +1187,7 @@ static void hfp_ag_call_sm(hfp_ag_call_event_t event, hfp_connection_t * connect
case HFP_AG_INCOMING_CALL_ACCEPTED_BY_HF: case HFP_AG_INCOMING_CALL_ACCEPTED_BY_HF:
// clear CLIP // clear CLIP
clip_type = 0; clip_type = 0;
switch (get_hfp_ag_call_state()){ switch (hfp_gsm_call_status()){
case HFP_CALL_STATUS_NO_HELD_OR_ACTIVE_CALLS: case HFP_CALL_STATUS_NO_HELD_OR_ACTIVE_CALLS:
switch (get_hfp_ag_callsetup_state()){ switch (get_hfp_ag_callsetup_state()){
case HFP_CALLSETUP_STATUS_INCOMING_CALL_SETUP_IN_PROGRESS: case HFP_CALLSETUP_STATUS_INCOMING_CALL_SETUP_IN_PROGRESS:
@ -1213,7 +1209,7 @@ static void hfp_ag_call_sm(hfp_ag_call_event_t event, hfp_connection_t * connect
case HFP_AG_RESPONSE_AND_HOLD_ACCEPT_INCOMING_CALL_BY_AG: case HFP_AG_RESPONSE_AND_HOLD_ACCEPT_INCOMING_CALL_BY_AG:
// clear CLIP // clear CLIP
clip_type = 0; clip_type = 0;
switch (get_hfp_ag_call_state()){ switch (hfp_gsm_call_status()){
case HFP_CALL_STATUS_NO_HELD_OR_ACTIVE_CALLS: case HFP_CALL_STATUS_NO_HELD_OR_ACTIVE_CALLS:
switch (get_hfp_ag_callsetup_state()){ switch (get_hfp_ag_callsetup_state()){
case HFP_CALLSETUP_STATUS_INCOMING_CALL_SETUP_IN_PROGRESS: case HFP_CALLSETUP_STATUS_INCOMING_CALL_SETUP_IN_PROGRESS:
@ -1238,7 +1234,7 @@ static void hfp_ag_call_sm(hfp_ag_call_event_t event, hfp_connection_t * connect
case HFP_AG_RESPONSE_AND_HOLD_ACCEPT_INCOMING_CALL_BY_HF: case HFP_AG_RESPONSE_AND_HOLD_ACCEPT_INCOMING_CALL_BY_HF:
// clear CLIP // clear CLIP
clip_type = 0; clip_type = 0;
switch (get_hfp_ag_call_state()){ switch (hfp_gsm_call_status()){
case HFP_CALL_STATUS_NO_HELD_OR_ACTIVE_CALLS: case HFP_CALL_STATUS_NO_HELD_OR_ACTIVE_CALLS:
switch (get_hfp_ag_callsetup_state()){ switch (get_hfp_ag_callsetup_state()){
case HFP_CALLSETUP_STATUS_INCOMING_CALL_SETUP_IN_PROGRESS: case HFP_CALLSETUP_STATUS_INCOMING_CALL_SETUP_IN_PROGRESS:
@ -1285,7 +1281,7 @@ static void hfp_ag_call_sm(hfp_ag_call_event_t event, hfp_connection_t * connect
case HFP_AG_TERMINATE_CALL_BY_HF: case HFP_AG_TERMINATE_CALL_BY_HF:
// clear CLIP // clear CLIP
clip_type = 0; clip_type = 0;
switch (get_hfp_ag_call_state()){ switch (hfp_gsm_call_status()){
case HFP_CALL_STATUS_NO_HELD_OR_ACTIVE_CALLS: case HFP_CALL_STATUS_NO_HELD_OR_ACTIVE_CALLS:
switch (get_hfp_ag_callsetup_state()){ switch (get_hfp_ag_callsetup_state()){
case HFP_CALLSETUP_STATUS_INCOMING_CALL_SETUP_IN_PROGRESS: case HFP_CALLSETUP_STATUS_INCOMING_CALL_SETUP_IN_PROGRESS:
@ -1315,7 +1311,7 @@ static void hfp_ag_call_sm(hfp_ag_call_event_t event, hfp_connection_t * connect
case HFP_AG_TERMINATE_CALL_BY_AG: case HFP_AG_TERMINATE_CALL_BY_AG:
// clear CLIP // clear CLIP
clip_type = 0; clip_type = 0;
switch (get_hfp_ag_call_state()){ switch (hfp_gsm_call_status()){
case HFP_CALL_STATUS_NO_HELD_OR_ACTIVE_CALLS: case HFP_CALL_STATUS_NO_HELD_OR_ACTIVE_CALLS:
switch (get_hfp_ag_callsetup_state()){ switch (get_hfp_ag_callsetup_state()){
case HFP_CALLSETUP_STATUS_INCOMING_CALL_SETUP_IN_PROGRESS: case HFP_CALLSETUP_STATUS_INCOMING_CALL_SETUP_IN_PROGRESS:
@ -1339,7 +1335,7 @@ static void hfp_ag_call_sm(hfp_ag_call_event_t event, hfp_connection_t * connect
case HFP_AG_CALL_DROPPED: case HFP_AG_CALL_DROPPED:
// clear CLIP // clear CLIP
clip_type = 0; clip_type = 0;
switch (get_hfp_ag_call_state()){ switch (hfp_gsm_call_status()){
case HFP_CALL_STATUS_NO_HELD_OR_ACTIVE_CALLS: case HFP_CALL_STATUS_NO_HELD_OR_ACTIVE_CALLS:
switch (get_hfp_ag_callsetup_state()){ switch (get_hfp_ag_callsetup_state()){
case HFP_CALLSETUP_STATUS_INCOMING_CALL_SETUP_IN_PROGRESS: case HFP_CALLSETUP_STATUS_INCOMING_CALL_SETUP_IN_PROGRESS:
@ -1425,7 +1421,7 @@ static void hfp_ag_call_sm(hfp_ag_call_event_t event, hfp_connection_t * connect
connection->ag_indicators_status_update_bitmap = store_bit(connection->ag_indicators_status_update_bitmap, indicator_index, 1); connection->ag_indicators_status_update_bitmap = store_bit(connection->ag_indicators_status_update_bitmap, indicator_index, 1);
// put current call on hold if active // put current call on hold if active
if (get_hfp_ag_call_state() == HFP_CALL_STATUS_ACTIVE_OR_HELD_CALL_IS_PRESENT){ if (hfp_gsm_call_status() == HFP_CALL_STATUS_ACTIVE_OR_HELD_CALL_IS_PRESENT){
printf("AG putting current call on hold for new outgoing call\n"); 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); hfp_ag_set_callheld_state(HFP_CALLHELD_STATUS_CALL_ON_HOLD_AND_NO_ACTIVE_CALLS);
indicator_index = get_ag_indicator_index_for_name("callheld"); indicator_index = get_ag_indicator_index_for_name("callheld");
@ -1474,17 +1470,7 @@ static void hfp_ag_call_sm(hfp_ag_call_event_t event, hfp_connection_t * connect
break; break;
} }
hfp_gsm_handle_event(event); hfp_gsm_handle_event(event);
// if ( (get_hfp_ag_callsetup_state() != hfp_gsm_callsetup_status()) ||
// (get_hfp_ag_callheld_state() != hfp_gsm_callheld_status()) ||
// (get_hfp_ag_call_state() != hfp_gsm_call_status()) ){
// printf("event %d\n", event);
// printf("callsetup %d - %d \n", get_hfp_ag_callsetup_state(), hfp_gsm_callsetup_status());
// printf("callheld %d - %d \n", get_hfp_ag_callheld_state(), hfp_gsm_callheld_status());
// printf("call %d - %d \n", get_hfp_ag_call_state(), hfp_gsm_call_status());
// exit(1);
// }
} }
static void hfp_run_for_context(hfp_connection_t *context){ static void hfp_run_for_context(hfp_connection_t *context){