mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-21 04:21:03 +00:00
Merge branch 'master' of https://github.com/bluekitchen/btstack
This commit is contained in:
commit
32785c7462
61
src/hfp_ag.c
61
src/hfp_ag.c
@ -1115,9 +1115,10 @@ 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;
|
||||
|
||||
//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){
|
||||
case HFP_CALL_STATUS_NO_HELD_OR_ACTIVE_CALLS:
|
||||
switch (hfp_ag_callsetup_state){
|
||||
@ -1145,6 +1146,7 @@ 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){
|
||||
case HFP_CALL_STATUS_NO_HELD_OR_ACTIVE_CALLS:
|
||||
@ -1176,6 +1178,7 @@ 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){
|
||||
case HFP_CALL_STATUS_ACTIVE_OR_HELD_CALL_IS_PRESENT:
|
||||
switch (hfp_ag_callheld_state){
|
||||
@ -1195,6 +1198,7 @@ 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){
|
||||
@ -1217,7 +1221,8 @@ 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:
|
||||
// clear CLIP
|
||||
hfp_gsm_handle_event(HFP_AG_RESPONSE_AND_HOLD_ACCEPT_INCOMING_CALL_BY_AG);
|
||||
// clear CLIP
|
||||
clip_type = 0;
|
||||
switch (hfp_ag_call_state){
|
||||
case HFP_CALL_STATUS_NO_HELD_OR_ACTIVE_CALLS:
|
||||
@ -1242,7 +1247,8 @@ 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:
|
||||
// clear CLIP
|
||||
hfp_gsm_handle_event(HFP_AG_RESPONSE_AND_HOLD_ACCEPT_INCOMING_CALL_BY_HF);
|
||||
// clear CLIP
|
||||
clip_type = 0;
|
||||
switch (hfp_ag_call_state){
|
||||
case HFP_CALL_STATUS_NO_HELD_OR_ACTIVE_CALLS:
|
||||
@ -1268,6 +1274,7 @@ 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_ag_response_and_hold_active = 0;
|
||||
@ -1278,6 +1285,7 @@ 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_ag_response_and_hold_active = 0;
|
||||
@ -1289,6 +1297,7 @@ static void hfp_ag_call_sm(hfp_ag_call_event_t event, hfp_connection_t * connect
|
||||
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){
|
||||
@ -1319,6 +1328,7 @@ 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){
|
||||
@ -1343,6 +1353,7 @@ 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){
|
||||
@ -1379,6 +1390,12 @@ static void hfp_ag_call_sm(hfp_ag_call_event_t event, hfp_connection_t * connect
|
||||
break;
|
||||
|
||||
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;
|
||||
}
|
||||
hfp_gsm_handle_event(HFP_AG_OUTGOING_CALL_INITIATED);
|
||||
connection->call_state = HFP_CALL_OUTGOING_INITIATED;
|
||||
|
||||
@ -1386,6 +1403,13 @@ static void hfp_ag_call_sm(hfp_ag_call_event_t event, hfp_connection_t * connect
|
||||
break;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
hfp_gsm_handle_event(HFP_AG_OUTGOING_REDIAL_INITIATED);
|
||||
connection->call_state = HFP_CALL_OUTGOING_INITIATED;
|
||||
|
||||
@ -1393,25 +1417,26 @@ static void hfp_ag_call_sm(hfp_ag_call_event_t event, hfp_connection_t * connect
|
||||
break;
|
||||
|
||||
case HFP_AG_OUTGOING_CALL_REJECTED:
|
||||
hfp_gsm_handle_event(HFP_AG_OUTGOING_CALL_REJECTED);
|
||||
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_REJECTED);
|
||||
connection->call_state = HFP_CALL_IDLE;
|
||||
connection->send_error = 1;
|
||||
hfp_run_for_context(connection);
|
||||
break;
|
||||
|
||||
case HFP_AG_OUTGOING_CALL_ACCEPTED:
|
||||
// hfp_gsm_handle_event();
|
||||
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;
|
||||
|
||||
@ -1439,13 +1464,14 @@ static void hfp_ag_call_sm(hfp_ag_call_event_t event, hfp_connection_t * connect
|
||||
log_info("hfp_ag_call_sm: did not find outgoing connection in dialing state");
|
||||
break;
|
||||
}
|
||||
|
||||
hfp_gsm_handle_event(HFP_AG_OUTGOING_CALL_RINGING);
|
||||
connection->call_state = HFP_CALL_OUTGOING_RINGING;
|
||||
hfp_ag_set_callsetup_state(HFP_CALLSETUP_STATUS_OUTGOING_CALL_SETUP_IN_ALERTING_STATE);
|
||||
hfp_ag_transfer_callsetup_state();
|
||||
break;
|
||||
|
||||
case HFP_AG_OUTGOING_CALL_ESTABLISHED:
|
||||
// hfp_gsm_handle_event();
|
||||
// get outgoing call
|
||||
connection = hfp_ag_connection_for_call_state(HFP_CALL_OUTGOING_RINGING);
|
||||
if (!connection){
|
||||
@ -1455,6 +1481,8 @@ static void hfp_ag_call_sm(hfp_ag_call_event_t event, hfp_connection_t * connect
|
||||
log_info("hfp_ag_call_sm: did not find outgoing connection");
|
||||
break;
|
||||
}
|
||||
|
||||
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);
|
||||
@ -1469,6 +1497,17 @@ static void hfp_ag_call_sm(hfp_ag_call_event_t event, hfp_connection_t * connect
|
||||
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){
|
||||
@ -1910,6 +1949,14 @@ void hfp_ag_init(uint16_t rfcomm_channel_nr, uint32_t supported_features,
|
||||
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));
|
||||
subscriber_numbers = NULL;
|
||||
subscriber_numbers_count = 0;
|
||||
|
||||
hfp_gsm_init();
|
||||
}
|
||||
|
||||
void hfp_ag_establish_service_level_connection(bd_addr_t bd_addr){
|
||||
|
@ -65,6 +65,8 @@
|
||||
|
||||
typedef enum{
|
||||
CALL_NONE,
|
||||
CALL_INITIATED,
|
||||
CALL_RESPONSE_HOLD,
|
||||
CALL_ACTIVE,
|
||||
CALL_HELD
|
||||
} hfp_gsm_call_status_t;
|
||||
@ -72,15 +74,17 @@ typedef enum{
|
||||
|
||||
typedef struct {
|
||||
hfp_gsm_call_status_t status;
|
||||
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));
|
||||
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;
|
||||
@ -106,9 +110,21 @@ static inline int get_active_call_index(){
|
||||
return get_call_index_with_status(CALL_ACTIVE);
|
||||
}
|
||||
|
||||
// static inline int get_number_none_calls(){
|
||||
// return get_number_calls_with_status(CALL_NONE);
|
||||
// }
|
||||
static inline int get_initiated_call_index(){
|
||||
return get_call_index_with_status(CALL_INITIATED);
|
||||
}
|
||||
|
||||
static inline int get_held_call_index(){
|
||||
return get_call_index_with_status(CALL_HELD);
|
||||
}
|
||||
|
||||
static inline int get_response_held_call_index(){
|
||||
return get_call_index_with_status(CALL_RESPONSE_HOLD);
|
||||
}
|
||||
|
||||
static inline int get_number_none_calls(){
|
||||
return get_number_calls_with_status(CALL_NONE);
|
||||
}
|
||||
|
||||
static inline int get_number_active_calls(){
|
||||
return get_number_calls_with_status(CALL_ACTIVE);
|
||||
@ -118,8 +134,16 @@ 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);
|
||||
}
|
||||
|
||||
hfp_call_status_t hfp_gsm_call_status(){
|
||||
if (get_number_active_calls() + get_number_held_calls()){
|
||||
if (get_number_active_calls() + get_number_held_calls() + get_number_response_held_calls()){
|
||||
return HFP_CALL_STATUS_ACTIVE_OR_HELD_CALL_IS_PRESENT;
|
||||
}
|
||||
return HFP_CALL_STATUS_NO_HELD_OR_ACTIVE_CALLS;
|
||||
@ -140,33 +164,166 @@ hfp_callsetup_status_t hfp_gsm_callsetup_status(){
|
||||
return callsetup_status;
|
||||
}
|
||||
|
||||
int hfp_gsm_response_held_active(){
|
||||
return get_response_held_call_index() != -1 ;
|
||||
}
|
||||
|
||||
int hfp_gsm_call_possible(void){
|
||||
return get_number_none_calls() > 0;
|
||||
}
|
||||
|
||||
void hfp_gsm_handle_event(hfp_ag_call_event_t event){
|
||||
int next_free_slot = get_none_call_index();
|
||||
int current_call_index = get_active_call_index();
|
||||
|
||||
int initiated_call_index = get_initiated_call_index();
|
||||
int held_call_index = get_held_call_index();
|
||||
|
||||
switch (event){
|
||||
case HFP_AG_OUTGOING_CALL_INITIATED:
|
||||
case HFP_AG_OUTGOING_REDIAL_INITIATED:
|
||||
|
||||
if (next_free_slot == -1){
|
||||
log_error("max nr gsm call exceeded");
|
||||
log_error("gsm: max call nr exceeded");
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
case HFP_AG_OUTGOING_CALL_REJECTED:
|
||||
if (current_call_index != -1){
|
||||
gsm_calls[current_call_index].status = CALL_NONE;
|
||||
}
|
||||
callsetup_status = HFP_CALLSETUP_STATUS_NO_CALL_SETUP_IN_PROGRESS;
|
||||
break;
|
||||
|
||||
case HFP_AG_OUTGOING_CALL_ACCEPTED:
|
||||
if (current_call_index != -1){
|
||||
gsm_calls[current_call_index].status = CALL_HELD;
|
||||
}
|
||||
gsm_calls[next_free_slot].status = CALL_ACTIVE;
|
||||
gsm_calls[next_free_slot].status = CALL_INITIATED;
|
||||
callsetup_status = HFP_CALLSETUP_STATUS_OUTGOING_CALL_SETUP_IN_DIALING_STATE;
|
||||
break;
|
||||
case HFP_AG_OUTGOING_CALL_REJECTED:
|
||||
break;
|
||||
case HFP_AG_OUTGOING_CALL_ACCEPTED:
|
||||
break;
|
||||
|
||||
case HFP_AG_OUTGOING_CALL_RINGING:
|
||||
if (current_call_index == -1){
|
||||
log_error("gsm: no active call");
|
||||
return;
|
||||
}
|
||||
callsetup_status = HFP_CALLSETUP_STATUS_OUTGOING_CALL_SETUP_IN_ALERTING_STATE;
|
||||
break;
|
||||
case HFP_AG_OUTGOING_CALL_ESTABLISHED:
|
||||
callsetup_status = HFP_CALLSETUP_STATUS_NO_CALL_SETUP_IN_PROGRESS;
|
||||
gsm_calls[initiated_call_index].status = CALL_ACTIVE;
|
||||
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;
|
||||
|
||||
case HFP_AG_HELD_CALL_JOINED_BY_AG:
|
||||
if (hfp_gsm_call_status() != HFP_CALL_STATUS_ACTIVE_OR_HELD_CALL_IS_PRESENT) break;
|
||||
|
||||
// TODO: mark joined calls with "multiparty flag" (if we cannot calculate it otherwise)
|
||||
// TODO: is following condition correct? Can we join incoming call before it is answered?
|
||||
if (callsetup_status == HFP_CALLSETUP_STATUS_INCOMING_CALL_SETUP_IN_PROGRESS){
|
||||
gsm_calls[initiated_call_index].status = CALL_ACTIVE;
|
||||
callsetup_status = HFP_CALLSETUP_STATUS_NO_CALL_SETUP_IN_PROGRESS;
|
||||
break;
|
||||
}
|
||||
|
||||
if (hfp_gsm_callheld_status() == HFP_CALLHELD_STATUS_CALL_ON_HOLD_OR_SWAPPED) {
|
||||
gsm_calls[held_call_index].status = CALL_ACTIVE;
|
||||
break;
|
||||
}
|
||||
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;
|
||||
|
||||
case HFP_AG_RESPONSE_AND_HOLD_ACCEPT_INCOMING_CALL_BY_AG:
|
||||
case HFP_AG_RESPONSE_AND_HOLD_ACCEPT_INCOMING_CALL_BY_HF:
|
||||
if (hfp_gsm_callsetup_status() != HFP_CALLSETUP_STATUS_INCOMING_CALL_SETUP_IN_PROGRESS) break;
|
||||
if (hfp_gsm_call_status() != HFP_CALL_STATUS_NO_HELD_OR_ACTIVE_CALLS) break;
|
||||
callsetup_status = HFP_CALLSETUP_STATUS_NO_CALL_SETUP_IN_PROGRESS;
|
||||
gsm_calls[initiated_call_index].status = CALL_RESPONSE_HOLD;
|
||||
break;
|
||||
|
||||
case HFP_AG_RESPONSE_AND_HOLD_ACCEPT_HELD_CALL_BY_AG:
|
||||
case HFP_AG_RESPONSE_AND_HOLD_ACCEPT_HELD_CALL_BY_HF:
|
||||
if (!hfp_gsm_response_held_active()) break;
|
||||
gsm_calls[get_response_held_call_index()].status = CALL_ACTIVE;
|
||||
break;
|
||||
|
||||
case HFP_AG_RESPONSE_AND_HOLD_REJECT_HELD_CALL_BY_AG:
|
||||
case HFP_AG_RESPONSE_AND_HOLD_REJECT_HELD_CALL_BY_HF:
|
||||
if (!hfp_gsm_response_held_active()) break;
|
||||
gsm_calls[get_response_held_call_index()].status = CALL_NONE;
|
||||
break;
|
||||
|
||||
|
||||
case HFP_AG_TERMINATE_CALL_BY_HF:
|
||||
switch (hfp_gsm_call_status()){
|
||||
case HFP_CALL_STATUS_NO_HELD_OR_ACTIVE_CALLS:
|
||||
callsetup_status = HFP_CALLSETUP_STATUS_NO_CALL_SETUP_IN_PROGRESS;
|
||||
break;
|
||||
case HFP_CALL_STATUS_ACTIVE_OR_HELD_CALL_IS_PRESENT:
|
||||
gsm_calls[current_call_index].status = CALL_NONE;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case HFP_AG_TERMINATE_CALL_BY_AG:
|
||||
switch (hfp_gsm_call_status()){
|
||||
case HFP_CALL_STATUS_NO_HELD_OR_ACTIVE_CALLS:
|
||||
if (hfp_gsm_callsetup_status() != HFP_CALLSETUP_STATUS_INCOMING_CALL_SETUP_IN_PROGRESS) break;
|
||||
callsetup_status = HFP_CALLSETUP_STATUS_NO_CALL_SETUP_IN_PROGRESS;
|
||||
break;
|
||||
case HFP_CALL_STATUS_ACTIVE_OR_HELD_CALL_IS_PRESENT:
|
||||
callsetup_status = HFP_CALLSETUP_STATUS_NO_CALL_SETUP_IN_PROGRESS;
|
||||
gsm_calls[current_call_index].status = CALL_NONE;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case HFP_AG_CALL_DROPPED:{
|
||||
callsetup_status = HFP_CALLSETUP_STATUS_NO_CALL_SETUP_IN_PROGRESS;
|
||||
if (hfp_gsm_call_status() != HFP_CALL_STATUS_ACTIVE_OR_HELD_CALL_IS_PRESENT) break;
|
||||
|
||||
int i ;
|
||||
for (i = 0; i < HFP_GSM_MAX_NR_CALLS; i++){
|
||||
gsm_calls[i].status = CALL_NONE;
|
||||
gsm_calls[i].clip_type = 0;
|
||||
gsm_calls[i].clip_number[0] = '\0';
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -63,6 +63,10 @@ hfp_callheld_status_t hfp_gsm_callheld_status();
|
||||
hfp_call_status_t hfp_gsm_call_status();
|
||||
hfp_callsetup_status_t hfp_gsm_callsetup_status();
|
||||
|
||||
int hfp_gsm_call_possible(void);
|
||||
|
||||
void hfp_gsm_init(void);
|
||||
|
||||
void hfp_gsm_handle_event(hfp_ag_call_event_t event);
|
||||
|
||||
// /**
|
||||
|
@ -337,7 +337,8 @@ static void simulate_test_sequence(hfp_test_item_t * test_item){
|
||||
int previous_step = -1;
|
||||
while ( i < test_item->len){
|
||||
previous_step++;
|
||||
if (i < previous_step) exit(0);
|
||||
CHECK_EQUAL(i >= previous_step, 1);
|
||||
|
||||
char * expected_cmd = test_steps[i];
|
||||
int expected_cmd_len = strlen(expected_cmd);
|
||||
printf("\nStep %d, %s \n", i, expected_cmd);
|
||||
@ -527,6 +528,7 @@ TEST_GROUP(HFPClient){
|
||||
|
||||
TEST(HFPClient, PTSRHHTests){
|
||||
for (int i = 0; i < hfp_pts_ag_rhh_tests_size(); i++){
|
||||
setup();
|
||||
simulate_test_sequence(&hfp_pts_ag_rhh_tests()[i]);
|
||||
teardown();
|
||||
}
|
||||
@ -534,6 +536,7 @@ TEST(HFPClient, PTSRHHTests){
|
||||
|
||||
TEST(HFPClient, PTSECCTests){
|
||||
for (int i = 0; i < hfp_pts_ag_ecc_tests_size(); i++){
|
||||
setup();
|
||||
simulate_test_sequence(&hfp_pts_ag_ecc_tests()[i]);
|
||||
teardown();
|
||||
}
|
||||
@ -541,6 +544,7 @@ TEST(HFPClient, PTSECCTests){
|
||||
|
||||
TEST(HFPClient, PTSECSTests){
|
||||
for (int i = 0; i < hfp_pts_ag_ecs_tests_size(); i++){
|
||||
setup();
|
||||
simulate_test_sequence(&hfp_pts_ag_ecs_tests()[i]);
|
||||
teardown();
|
||||
}
|
||||
@ -548,6 +552,7 @@ TEST(HFPClient, PTSECSTests){
|
||||
|
||||
TEST(HFPClient, PTSTWCTests){
|
||||
for (int i = 0; i < hfp_pts_ag_twc_tests_size(); i++){
|
||||
setup();
|
||||
simulate_test_sequence(&hfp_pts_ag_twc_tests()[i]);
|
||||
teardown();
|
||||
}
|
||||
@ -555,6 +560,7 @@ TEST(HFPClient, PTSTWCTests){
|
||||
|
||||
TEST(HFPClient, PTSATATests){
|
||||
for (int i = 0; i < hfp_pts_ag_ata_tests_size(); i++){
|
||||
setup();
|
||||
simulate_test_sequence(&hfp_pts_ag_ata_tests()[i]);
|
||||
teardown();
|
||||
}
|
||||
@ -562,6 +568,7 @@ TEST(HFPClient, PTSATATests){
|
||||
|
||||
TEST(HFPClient, PTSSLCTests){
|
||||
for (int i = 0; i < hfp_pts_ag_slc_tests_size(); i++){
|
||||
setup();
|
||||
simulate_test_sequence(&hfp_pts_ag_slc_tests()[i]);
|
||||
teardown();
|
||||
}
|
||||
|
@ -318,7 +318,8 @@ void simulate_test_sequence(hfp_test_item_t * test_item){
|
||||
int previous_step = -1;
|
||||
while ( i < test_item->len){
|
||||
previous_step++;
|
||||
if (i < previous_step) exit(0);
|
||||
CHECK_EQUAL(i >= previous_step, 1);
|
||||
|
||||
char * expected_cmd = test_steps[i];
|
||||
int expected_cmd_len = strlen(expected_cmd);
|
||||
printf("\nStep %d, %s \n", i, expected_cmd);
|
||||
@ -495,6 +496,7 @@ TEST_GROUP(HFPClient){
|
||||
|
||||
TEST(HFPClient, PTSRHHTests){
|
||||
for (int i = 0; i < hfp_pts_hf_rhh_tests_size(); i++){
|
||||
setup();
|
||||
simulate_test_sequence(&hfp_pts_hf_rhh_tests()[i]);
|
||||
teardown();
|
||||
}
|
||||
@ -502,6 +504,7 @@ TEST(HFPClient, PTSRHHTests){
|
||||
|
||||
TEST(HFPClient, PTSECCTests){
|
||||
for (int i = 0; i < hfp_pts_hf_ecc_tests_size(); i++){
|
||||
setup();
|
||||
simulate_test_sequence(&hfp_pts_hf_ecc_tests()[i]);
|
||||
teardown();
|
||||
}
|
||||
@ -509,6 +512,7 @@ TEST(HFPClient, PTSECCTests){
|
||||
|
||||
TEST(HFPClient, PTSECSTests){
|
||||
for (int i = 0; i < hfp_pts_hf_ecs_tests_size(); i++){
|
||||
setup();
|
||||
simulate_test_sequence(&hfp_pts_hf_ecs_tests()[i]);
|
||||
teardown();
|
||||
}
|
||||
@ -516,6 +520,7 @@ TEST(HFPClient, PTSECSTests){
|
||||
|
||||
TEST(HFPClient, PTSTWCTests){
|
||||
for (int i = 0; i < hfp_pts_hf_twc_tests_size(); i++){
|
||||
setup();
|
||||
simulate_test_sequence(&hfp_pts_hf_twc_tests()[i]);
|
||||
teardown();
|
||||
}
|
||||
@ -523,6 +528,7 @@ TEST(HFPClient, PTSTWCTests){
|
||||
|
||||
TEST(HFPClient, PTSATATests){
|
||||
for (int i = 0; i < hfp_pts_hf_ata_tests_size(); i++){
|
||||
setup();
|
||||
simulate_test_sequence(&hfp_pts_hf_ata_tests()[i]);
|
||||
teardown();
|
||||
}
|
||||
@ -530,6 +536,7 @@ TEST(HFPClient, PTSATATests){
|
||||
|
||||
TEST(HFPClient, PTSSLCTests){
|
||||
for (int i = 0; i < hfp_pts_hf_slc_tests_size(); i++){
|
||||
setup();
|
||||
simulate_test_sequence(&hfp_pts_hf_slc_tests()[i]);
|
||||
teardown();
|
||||
}
|
||||
|
@ -1883,7 +1883,8 @@ const char * TC_AG_ECS_BV_03_I[] = {
|
||||
"OK" ,
|
||||
"AT+CMEE=1" ,
|
||||
"OK" ,
|
||||
"USER:c" , // "+CIEV:3,1" ,
|
||||
"USER:c" ,
|
||||
"+CIEV:3,1" ,
|
||||
"RING" ,
|
||||
"+CLIP: \"1234567\",129" ,
|
||||
"ATA" ,
|
||||
@ -1902,7 +1903,7 @@ const char * TC_AG_ECS_BV_03_I[] = {
|
||||
hfp_test_item_t pts_ag_ecs_tests[] = {
|
||||
TEST_SEQUENCE(TC_AG_ECS_BV_01_I),
|
||||
TEST_SEQUENCE(TC_AG_ECS_BV_02_I),
|
||||
// TEST_SEQUENCE(TC_AG_ECS_BV_03_I)
|
||||
TEST_SEQUENCE(TC_AG_ECS_BV_03_I)
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user