hfp ag/gsm: update init methods

This commit is contained in:
Milanka Ringwald 2016-01-14 12:12:35 +01:00
parent 1335ac5955
commit 868fae3b10
2 changed files with 29 additions and 26 deletions

View File

@ -1391,11 +1391,11 @@ static void hfp_ag_call_sm(hfp_ag_call_event_t event, hfp_connection_t * connect
case HFP_AG_OUTGOING_CALL_INITIATED:
// directly reject call if number of free slots is exceeded
// if (!hfp_gsm_call_possible()){
// connection->send_error = 1;
// hfp_run_for_context(connection);
// break;
// }
if (!hfp_gsm_call_possible()){
connection->send_error = 1;
hfp_run_for_context(connection);
break;
}
hfp_gsm_handle_event(HFP_AG_OUTGOING_CALL_INITIATED);
connection->call_state = HFP_CALL_OUTGOING_INITIATED;
@ -1404,11 +1404,11 @@ static void hfp_ag_call_sm(hfp_ag_call_event_t event, hfp_connection_t * connect
case HFP_AG_OUTGOING_REDIAL_INITIATED:
// directly reject call if number of free slots is exceeded
// if (!hfp_gsm_call_possible()){
// connection->send_error = 1;
// hfp_run_for_context(connection);
// break;
// }
if (!hfp_gsm_call_possible()){
connection->send_error = 1;
hfp_run_for_context(connection);
break;
}
hfp_gsm_handle_event(HFP_AG_OUTGOING_REDIAL_INITIATED);
connection->call_state = HFP_CALL_OUTGOING_INITIATED;
@ -1498,16 +1498,16 @@ static void hfp_ag_call_sm(hfp_ag_call_event_t event, hfp_connection_t * connect
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()) ){
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);
// }
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){
@ -1950,6 +1950,12 @@ void hfp_ag_init(uint16_t rfcomm_channel_nr, uint32_t supported_features,
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));
subscriber_numbers = NULL;
subscriber_numbers_count = 0;
hfp_gsm_init();
}

View File

@ -77,17 +77,14 @@ typedef struct {
uint8_t clip_type;
char clip_number[25];
} hfp_gsm_call_t;
//
static hfp_gsm_call_t gsm_calls[HFP_GSM_MAX_NR_CALLS];
static hfp_callsetup_status_t callsetup_status = HFP_CALLSETUP_STATUS_NO_CALL_SETUP_IN_PROGRESS;
void hfp_gsm_init(void){
memset(gsm_calls, 0, sizeof(gsm_calls));
}
//
static hfp_callsetup_status_t callsetup_status = HFP_CALLSETUP_STATUS_NO_CALL_SETUP_IN_PROGRESS;
callsetup_status = HFP_CALLSETUP_STATUS_NO_CALL_SETUP_IN_PROGRESS;
}
static int get_number_calls_with_status(hfp_gsm_call_status_t status){
int i, count = 0;