[bugfix][bug-view-1295][voice] cannot answer call when in double slot
Only Configure:No
Affected branch:master
Affected module:voice
Is it affected on: only ASR
Self-test: Yes
Doc Update:No
Change-Id: I96038de377e511673bb3774a234d28d4ccb6dfd1
diff --git a/mbtk/libql_lib_v2_rilv2/ql_voice.c b/mbtk/libql_lib_v2_rilv2/ql_voice.c
index 4ce0151..131301b 100755
--- a/mbtk/libql_lib_v2_rilv2/ql_voice.c
+++ b/mbtk/libql_lib_v2_rilv2/ql_voice.c
@@ -121,6 +121,7 @@
*/
static mbtk_sim_type_enum s_voice_slot = MBTK_SIM_1;
+static mbtk_sim_type_enum urc_voice_slot = MBTK_SIM_1;
static bool check_slot_valid(QL_SIM_SLOT_E slot)
{
@@ -182,29 +183,35 @@
if(MBTK_RIL_CALL_STATE_DISCONNECT != reg->state)
{
- LOG("ql_voice_state_change_cb : %d, %d, %d, %d, %s", reg->call_id, reg->dir, reg->state, reg->num_type, reg->call_number);
-
+ LOG("ql_voice_state_change_cb : %d, %d, %d, %d, %d, %s", reg->sim_id, reg->call_id, reg->dir, reg->state, reg->num_type, reg->call_number);
+ printf("ql_voice_state_change_cb : %d\n", reg->sim_id);
switch(reg->state)
{
- case 0:
+ case MBTK_RIL_CALL_STATE_ACTIVE:
voice_handle->state_t = QL_VOICE_STATE_ACTIVE;
+ urc_voice_slot=reg->sim_id;
break;
- case 1:
+ case MBTK_RIL_CALL_STATE_HELD:
voice_handle->state_t = QL_VOICE_STATE_HOLDING;
+ urc_voice_slot=reg->sim_id;
break;
- case 2:
+ case MBTK_RIL_CALL_STATE_DIALING:
voice_handle->state_t = QL_VOICE_STATE_DIALING;
+ urc_voice_slot=reg->sim_id;
break;
- case 3:
+ case MBTK_RIL_CALL_STATE_ALERTING:
voice_handle->state_t = QL_VOICE_STATE_ALERTING;
+ urc_voice_slot=reg->sim_id;
break;
- case 4:
+ case MBTK_RIL_CALL_STATE_INCOMING:
voice_handle->state_t = QL_VOICE_STATE_INCOMING;
+ urc_voice_slot=reg->sim_id;
break;
- case 5:
+ case MBTK_RIL_CALL_STATE_WAITING:
voice_handle->state_t = QL_VOICE_STATE_WAITING;
+ urc_voice_slot=reg->sim_id;
break;
- case 7:
+ case MBTK_RIL_CALL_STATE_DISCONNECT:
voice_handle->state_t = QL_VOICE_STATE_END;
break;
default:
@@ -478,7 +485,7 @@
return QL_ERR_FAILED;
}
- err = mbtk_call_hang(voice_handle->handle);
+ err = mbtk_ds_call_hang(voice_handle->handle,urc_voice_slot);
if(err)
{
LOGE("Error : %d", err);
@@ -513,7 +520,7 @@
return QL_ERR_FAILED;
}
- err = mbtk_call_answer(voice_handle->handle);
+ err = mbtk_ds_call_answer(voice_handle->handle,urc_voice_slot);
if(err)
{
LOGE("Error : %d", err);
diff --git a/mbtk/test/libql_lib_v2/ql_voice_test.c b/mbtk/test/libql_lib_v2/ql_voice_test.c
index 132e7ea..d929f4b 100755
--- a/mbtk/test/libql_lib_v2/ql_voice_test.c
+++ b/mbtk/test/libql_lib_v2/ql_voice_test.c
@@ -38,12 +38,12 @@
int value;
int pullsel;
- mbtk_log_init("radio", "voice_TEST");
+ mbtk_log_init("radio", "voice_TEST");
printf("=========ql voice main=========\n"
"\t0 exit\n"
"\t1 voice init\n"
- "\t2 voice deinit\n"
+ "\t2 voice deinit\n"
"\t3 voice set call cb\n"
"\t4 voice set ser error cb\n"
"\t5 voice dial\n"
@@ -52,6 +52,7 @@
"\t8 voice get records\n"
"\t9 voice send dtmf char\n"
"\t10 voice set sim card\n"
+ "\t11 voice set voice card\n"
"operator: >> \n");
while(1)
@@ -65,47 +66,47 @@
case 1:
{
printf(">>>>>voice init\n");
- ret = ql_voice_init();
- if(ret != 0)
- {
- printf("ql_voice_init fail\n");
- }
- else
- {
- printf("ql_voice_init success\n");
- }
+ ret = ql_voice_init();
+ if(ret != 0)
+ {
+ printf("ql_voice_init fail\n");
+ }
+ else
+ {
+ printf("ql_voice_init success\n");
+ }
}
break;
case 2:
{
- printf(">>>>>voice uninit\n");
+ printf(">>>>>voice uninit\n");
- ret = ql_voice_deinit();
- if(ret != 0)
- {
- printf("ql_voice_uninit fail\n");
- printf("ret=%d\n", ret);
- }
- else
- {
- printf("ql_voice_uninit success\n");
+ ret = ql_voice_deinit();
+ if(ret != 0)
+ {
+ printf("ql_voice_uninit fail\n");
+ printf("ret=%d\n", ret);
+ }
+ else
+ {
+ printf("ql_voice_uninit success\n");
- }
+ }
}
break;
case 3:
{
printf(">>>>>Input set recv cb<<<<<\n");
- ret = ql_voice_set_call_cb(voice_call_cb);
- if(ret != 0)
- {
- printf("ql_voice_set_msg_recv_cb fail\n");
- }
- else
- {
- printf("ql_voice_set_msg_recv_cb success\n");
- }
+ ret = ql_voice_set_call_cb(voice_call_cb);
+ if(ret != 0)
+ {
+ printf("ql_voice_set_msg_recv_cb fail\n");
+ }
+ else
+ {
+ printf("ql_voice_set_msg_recv_cb success\n");
+ }
}
break;
@@ -113,15 +114,15 @@
{
printf(">>>>>Input set ser cb<<<<<\n");
- ret = ql_voice_set_service_error_cb(voice_servicie_error_cb);
- if(ret < 0)
- {
- printf("ql_voice_set_service_error_cb fail\n");
- }
- else
- {
- printf("ql_voice_set_service_error_cb success\n");
- }
+ ret = ql_voice_set_service_error_cb(voice_servicie_error_cb);
+ if(ret < 0)
+ {
+ printf("ql_voice_set_service_error_cb fail\n");
+ }
+ else
+ {
+ printf("ql_voice_set_service_error_cb success\n");
+ }
}
break;
@@ -135,14 +136,14 @@
scanf("%s",phone_num);
ret = ql_voice_dial(phone_num,11, &id);
printf("id:%d", id);
- if(ret < 0)
- {
- printf("ql_voice_dial fail\n");
- }
- else
- {
- printf("ql_voice_dial success\n");
- }
+ if(ret < 0)
+ {
+ printf("ql_voice_dial fail\n");
+ }
+ else
+ {
+ printf("ql_voice_dial success\n");
+ }
}
break;
case 6:
@@ -167,14 +168,14 @@
int id = 0;
ret = ql_voice_answer(1);
- if(ret < 0)
- {
- printf("ql_voice_answer fail\n");
- }
- else
- {
- printf("ql_voice_answer success\n");
- }
+ if(ret < 0)
+ {
+ printf("ql_voice_answer fail\n");
+ }
+ else
+ {
+ printf("ql_voice_answer success\n");
+ }
}
break;
case 8:
@@ -213,14 +214,14 @@
printf("inputChar is %c\n", inputChar);
ret = ql_voice_send_dtmf_char(1, inputChar);
- if(ret < 0)
- {
- printf("ql_voice_send_dtmf_char fail\n");
- }
- else
- {
- printf("ql_voice_send_dtmf_char success\n");
- }
+ if(ret < 0)
+ {
+ printf("ql_voice_send_dtmf_char fail\n");
+ }
+ else
+ {
+ printf("ql_voice_send_dtmf_char success\n");
+ }
}
break;
@@ -277,6 +278,59 @@
}
break;
}
+ case 11:
+ {
+ int ret = -1;
+ int choice = -1;
+ printf("1:sim card 1, 2:sim card 2\n");
+ while (1)
+ {
+ if (scanf("%d", &choice) == 1)
+ {
+ if (choice == 1 || choice == 2)
+ {
+ break;
+ }
+ else
+ {
+ printf("invlid input \n");
+ }
+ }
+ else
+ {
+
+ int c;
+ while ((c = getchar()) != '\n' && c != EOF);
+ printf("invalid input \n");
+ }
+
+ }
+ if (choice == 1)
+ {
+ ret = ql_set_voice_slot(QL_SIM_SLOT_1);
+ if(ret != 0)
+ {
+ printf("ql_set_voice_slot failed %d\n",ret);
+ }
+ else
+ {
+ printf("ql_set_voice_slot success \n");
+ }
+ }
+ else if (choice == 2)
+ {
+ ret = ql_set_voice_slot(QL_SIM_SLOT_2);
+ if(ret != 0)
+ {
+ printf("ql_set_voice_slot failed %d\n",ret);
+ }
+ else
+ {
+ printf("ql_set_voice_slot success \n");
+ }
+ }
+ break;
+ }
default:
break;
}