diff --git a/test/remote_operation.c b/test/remote_operation.c index ec8023f..2d6be43 100644 --- a/test/remote_operation.c +++ b/test/remote_operation.c @@ -14,4 +14,14 @@ void remote_call_operation(int slot_id, const char* phone_number, enum REMOTE_CA sprintf(remote_command_buf, "AT+REMOTECALL=%d,0,0,%s,129", (int)op, phone_number); tapi_invoke_oem_ril_request_strings(get_tapi_ctx(), slot_id, EVENT_OEM_RIL_REQUEST_STRINGS_DONE, oem_req, 1, NULL); -} \ No newline at end of file +} + +void remote_call_hangup_with_disconnect_reason(int slot_id, const char* phone_number, int disconnect_reason) +{ + char* oem_req[1]; + oem_req[0] = remote_command_buf; + memset(remote_command_buf, 0, sizeof(remote_command_buf)); + sprintf(remote_command_buf, "AT+REMOTECALL=6,0,0,%s,129,%d", phone_number, disconnect_reason); + tapi_invoke_oem_ril_request_strings(get_tapi_ctx(), slot_id, + EVENT_OEM_RIL_REQUEST_STRINGS_DONE, oem_req, 1, NULL); +} diff --git a/test/remote_operation.h b/test/remote_operation.h index 282e510..06fb005 100644 --- a/test/remote_operation.h +++ b/test/remote_operation.h @@ -5,4 +5,8 @@ enum REMOTE_CALL_COMMAND_TYPE { REJECT_CALL = 6, }; -void remote_call_operation(int slot_id, const char* phone_number, enum REMOTE_CALL_COMMAND_TYPE op); \ No newline at end of file +#define DISCONNECT_REASON_REMOTE_HANGUP 16 +#define DISCONNECT_REASON_NETWORK_HANGUP 34 + +void remote_call_operation(int slot_id, const char* phone_number, enum REMOTE_CALL_COMMAND_TYPE op); +void remote_call_hangup_with_disconnect_reason(int slot_id, const char* phone_number, int disconnect_reason); diff --git a/test/telephony_call_test.c b/test/telephony_call_test.c index 4e49164..49bb802 100644 --- a/test/telephony_call_test.c +++ b/test/telephony_call_test.c @@ -1180,7 +1180,7 @@ int remote_operation_call_reject_test(int slot_id) judge_data_init(); judge_data.expect = CALL_REMOTE_HANGUP; - remote_call_operation(slot_id, phone_num, REJECT_CALL); + remote_call_hangup_with_disconnect_reason(slot_id, phone_num, DISCONNECT_REASON_REMOTE_HANGUP); if (judge()) { syslog(LOG_ERR, "No hangup call message received in %s", __func__); @@ -1384,17 +1384,8 @@ int outgoing_call_remote_answer_and_hangup(int slot_id) } sleep(5); - judge_data_init(); - judge_data.expect = CALL_STATE_CHANGE_TO_ACTIVE; - remote_call_operation(slot_id, phone_num, ACTIVE_CALL); - if (judge()) { - syslog(LOG_ERR, "No active call message received in %s", __func__); - res = -1; - goto on_exit; - } - - if (judge_data.result) { - syslog(LOG_ERR, "Unsolicited message error in %s", __func__); + if (remote_operation_call_active_test(slot_id) < 0) { + syslog(LOG_ERR, "Remote call active fail in %s", __func__); res = -1; goto on_exit; } @@ -1794,19 +1785,8 @@ int call_incoming_and_hangup_by_dialer_before_answer_numerous(int slot_id) int incoming_call_answer_and_hangup(int slot_id) { int res = 0; - judge_data_init(); - test_case_data_init(); - judge_data.expect = NEW_CALL_INCOMING; - - remote_call_operation(slot_id, phone_num, INCOMING_CALL); - if (judge()) { - syslog(LOG_ERR, "No incoming call message received in %s", __func__); - res = -1; - goto on_exit; - } - - if (judge_data.result) { - syslog(LOG_ERR, "Unsolicited message error in %s", __func__); + if (remote_operation_call_incoming_test(slot_id) < 0) { + syslog(LOG_ERR, "Incoming call fail in %s", __func__); res = -1; goto on_exit; } @@ -1832,19 +1812,8 @@ int incoming_call_answer_and_hangup(int slot_id) int incoming_call_answer_and_remote_hangup(int slot_id) { int res = 0; - judge_data_init(); - test_case_data_init(); - judge_data.expect = NEW_CALL_INCOMING; - - remote_call_operation(slot_id, phone_num, INCOMING_CALL); - if (judge()) { - syslog(LOG_ERR, "No incoming call message received in %s", __func__); - res = -1; - goto on_exit; - } - - if (judge_data.result) { - syslog(LOG_ERR, "Unsolicited message error in %s", __func__); + if (remote_operation_call_incoming_test(slot_id) < 0) { + syslog(LOG_ERR, "Incoming call fail in %s", __func__); res = -1; goto on_exit; } @@ -3728,17 +3697,8 @@ int call_connect_and_local_hangup(int slot_id) } sleep(5); - judge_data_init(); - judge_data.expect = CALL_STATE_CHANGE_TO_ACTIVE; - remote_call_operation(slot_id, phone_num, ACTIVE_CALL); - if (judge()) { - syslog(LOG_ERR, "No active call message received in %s", __func__); - res = -1; - goto on_exit; - } - - if (judge_data.result) { - syslog(LOG_ERR, "Unsolicited message error in %s", __func__); + if (remote_operation_call_active_test(slot_id) < 0) { + syslog(LOG_ERR, "remote call active fail in %s", __func__); res = -1; goto on_exit; } @@ -3832,4 +3792,4 @@ void incoming_another_call(void) { test_case_data_init(); set_callback_data(NEW_CALL_WAITING); -} \ No newline at end of file +}