T108 sim Voie data network sms 支持双卡 ql 接口第一版
Change-Id: If5a9fb81971258bb5a3d811f3e4562b2df351853
diff --git a/mbtk/test/libql_lib_v2/ql_data_call_test.c b/mbtk/test/libql_lib_v2/ql_data_call_test.c
index 240ef45..fbcd5d8 100755
--- a/mbtk/test/libql_lib_v2/ql_data_call_test.c
+++ b/mbtk/test/libql_lib_v2/ql_data_call_test.c
@@ -305,7 +305,7 @@
ql_data_call_param_set_ip_version(pcfg, dat);
}
- printf("Please input reconnect_mode [0-disable,1-normal,2-mode1,3-mode2] :");
+ printf("Please input reconnect_mode [0-disable,1-normal,2-mode1,3-mode2] :\n");
ret = t_get_int(&dat);
if(ret < 0)
{
@@ -326,7 +326,7 @@
}
- printf("Please input interval_list [split by ,.:] :");
+ printf("Please input interval_list [split by ,.:] :\n");
dat_len = sizeof(dat_buf)/sizeof(dat_buf[0]);
ret = t_get_int_list(dat_buf, &dat_len);
if(ret < 0)
@@ -624,7 +624,7 @@
return;
}
- printf("Please input auth_pref [0-NONE,1-PAP,2-CHAP,3-PAP&CHAP] :");
+ printf("Please input auth_pref [0-NONE,1-PAP,2-CHAP,3-PAP&CHAP] :\n");
ret = t_get_int(&dat);
if(ret < 0)
{
@@ -643,7 +643,7 @@
cfg.auth_pref = dat;
}
- printf("Please input ip_version [1-IPV4,2-IPV6,3-IPV4V6] :");
+ printf("Please input ip_version [1-IPV4,2-IPV6,3-IPV4V6] :\n");
ret = t_get_int(&dat);
if(ret < 0)
{
@@ -737,6 +737,42 @@
}
}
+void item_ql_set_data_slot(void)
+{
+ 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)
+ {
+ ql_set_sms_slot(QL_SIM_SLOT_1);
+ }
+ else if (choice == 2)
+ {
+ ql_set_sms_slot(QL_SIM_SLOT_2);
+ }
+
+}
+
#if 0
void item_ql_nslookup(void)
{
@@ -818,7 +854,7 @@
ql_data_call_apn_config_t cfg = {0};
printf("Start to item_ql_data_call_set_attach_apn_config,apn id is 1\n");
- printf("Please input auth_pref [0-NONE,1-PAP,2-CHAP,3-PAP&CHAP] :");
+ printf("Please input auth_pref [0-NONE,1-PAP,2-CHAP,3-PAP&CHAP] :\n");
ret = t_get_int(&dat);
if(ret < 0)
{
@@ -837,7 +873,7 @@
cfg.auth_pref = dat;
}
- printf("Please input ip_version [1-IPV4,2-IPV6,3-IPV4V6] :");
+ printf("Please input ip_version [1-IPV4,2-IPV6,3-IPV4V6] :\n");
ret = t_get_int(&dat);
if(ret < 0)
{
@@ -910,7 +946,8 @@
{"ql_data_call_set_service_error_cb", item_ql_data_call_set_service_error_cb},
{"ql_data_call_deinit", item_ql_data_call_deinit},
// {"ql_nslookup",item_ql_nslookup},
- {"ql_data_call_set_attach_apn_config", item_ql_data_call_set_attach_apn_config}
+ {"ql_data_call_set_attach_apn_config", item_ql_data_call_set_attach_apn_config},
+ {"ql_set_data_slot", item_ql_set_data_slot}
};
static void help()
diff --git a/mbtk/test/libql_lib_v2/ql_nw_test.c b/mbtk/test/libql_lib_v2/ql_nw_test.c
index 409a966..15b4bc0 100755
--- a/mbtk/test/libql_lib_v2/ql_nw_test.c
+++ b/mbtk/test/libql_lib_v2/ql_nw_test.c
@@ -1400,6 +1400,8 @@
return;
}
+
+
#if 0
void item_ql_nw_wea_set_config(void)
{
@@ -1606,6 +1608,59 @@
printf("Sucessful\n");
}
}
+void item_ql_set_nw_slot(void)
+{
+ int choice = -1;
+ int ret = -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_sms_slot(QL_SIM_SLOT_1);
+ if(ret != QL_ERR_OK)
+ {
+ printf("ql_set_sms_slot failed %d\n",ret);
+ }
+ else
+ {
+ printf("ql_set_sms_slot success\n");
+ }
+ }
+ else if (choice == 2)
+ {
+ ret = ql_set_sms_slot(QL_SIM_SLOT_2);
+ if(ret != QL_ERR_OK)
+ {
+ printf("ql_set_sms_slot failed %d\n",ret);
+ }
+ else
+ {
+ printf("ql_set_sms_slot success\n");
+ }
+ }
+
+}
static t_item_t ql_nw_items[] =
@@ -1635,6 +1690,7 @@
// {"ql_nw_etws_set_config", item_ql_nw_etws_set_config},
// {"ql_nw_etws_get_config", item_ql_nw_etws_get_config},
{"ql_nw_set_service_error_cb", item_ql_nw_set_service_error_cb},
+ {"ql_set_nw_slot", item_ql_set_nw_slot},
{"ql_nw_deinit", item_ql_nw_deinit},
};
diff --git a/mbtk/test/libql_lib_v2/ql_sim_test.c b/mbtk/test/libql_lib_v2/ql_sim_test.c
index f71d93e..6cb4787 100755
--- a/mbtk/test/libql_lib_v2/ql_sim_test.c
+++ b/mbtk/test/libql_lib_v2/ql_sim_test.c
@@ -70,7 +70,7 @@
QL_SIM_APP_TYPE_E app_type;
printf("test ql_sim_get_imsi: \n");
- printf("please enter slot(1 or 2): ");
+ printf("please enter slot(1 or 2): \n");
scanf("%d", &input);
getchar();
if (1 == input)
@@ -128,7 +128,7 @@
QL_SIM_SLOT_E slot;
printf("test ql_sim_get_iccid: \n");
- printf("please enter slot(1 or 2): ");
+ printf("please enter slot(1 or 2): \n");
scanf("%d", &input);
getchar();
if (1 == input)
@@ -156,6 +156,7 @@
}
}
+
static void item_ql_sim_get_phone_num(void)
{
int ret = 0;
@@ -165,7 +166,7 @@
QL_SIM_APP_TYPE_E app_type;
printf("test ql_sim_get_phone_num: \n");
- printf("please enter slot(1 or 2): ");
+ printf("please enter slot(1 or 2): \n");
scanf("%d", &input);
getchar();
if (1 == input)
@@ -182,7 +183,7 @@
return;
}
- printf("please enter app type(0-unknown, 1-3gpp, 2-3gpp2, 3-isim): ");
+ printf("please enter app type(0-unknown, 1-3gpp, 2-3gpp2, 3-isim): \n");
scanf("%d", &input);
getchar();
switch (input)
@@ -203,7 +204,7 @@
printf("bad app type: %d\n", input);
return;
}
-
+
ret = ql_sim_get_phone_num(slot, app_type, num, sizeof(num));
if (ret == QL_ERR_OK)
{
@@ -288,7 +289,7 @@
QL_SIM_PIN_E pin;
printf("test ql_sim_enable_pin: \n");
- printf("please enter slot(1 or 2): ");
+ printf("please enter slot(1 or 2): \n");
scanf("%d", &input);
getchar();
if (1 == input)
@@ -393,7 +394,7 @@
QL_SIM_PIN_E pin;
printf("test ql_sim_disable_pin: \n");
- printf("please enter slot(1 or 2): ");
+ printf("please enter slot(1 or 2): \n");
scanf("%d", &input);
getchar();
if (1 == input)
@@ -410,7 +411,7 @@
return;
}
- printf("please enter app type(0-unknown, 1-3gpp, 2-3gpp2, 3-isim): ");
+ printf("please enter app type(0-unknown, 1-3gpp, 2-3gpp2, 3-isim): \n");
scanf("%d", &input);
getchar();
switch (input)
@@ -432,7 +433,7 @@
return;
}
- printf("please enter pin(1 or 2): ");
+ printf("please enter pin(1 or 2): \n");
scanf("%d", &input);
getchar();
if (1 == input)
@@ -449,7 +450,7 @@
return;
}
- printf("please enter pin value(at most %d digit): ", QL_SIM_PIN_MAX);
+ printf("please enter pin value(at most %d digit): \n", QL_SIM_PIN_MAX);
if (NULL == fgets(pin_value, sizeof(pin_value), stdin))
{
printf("can not read pin value\n");
@@ -463,7 +464,7 @@
}
printf("pin value: %s\n", pin_value);
- printf("proceed? [y/n]: ");
+ printf("proceed? [y/n]: \n");
c = getchar();
if ('\n' != c)
{
@@ -498,7 +499,7 @@
QL_SIM_PIN_E pin;
printf("test ql_sim_verify_pin: \n");
- printf("please enter slot(1 or 2): ");
+ printf("please enter slot(1 or 2): \n");
scanf("%d", &input);
getchar();
if (1 == input)
@@ -515,7 +516,7 @@
return;
}
- printf("please enter app type(0-unknown, 1-3gpp, 2-3gpp2, 3-isim): ");
+ printf("please enter app type(0-unknown, 1-3gpp, 2-3gpp2, 3-isim): \n");
scanf("%d", &input);
getchar();
switch (input)
@@ -537,7 +538,7 @@
return;
}
- printf("please enter pin(1 or 2): ");
+ printf("please enter pin(1 or 2): \n");
scanf("%d", &input);
getchar();
if (1 == input)
@@ -554,7 +555,7 @@
return;
}
- printf("please enter pin value(at most %d digit): ", QL_SIM_PIN_MAX);
+ printf("please enter pin value(at most %d digit): \n", QL_SIM_PIN_MAX);
if (NULL == fgets(pin_value, sizeof(pin_value), stdin))
{
printf("can not read pin value\n");
@@ -568,7 +569,7 @@
}
printf("pin value: %s\n", pin_value);
- printf("proceed? [y/n]: ");
+ printf("proceed? [y/n]: \n");
c = getchar();
if ('\n' != c)
{
@@ -605,7 +606,7 @@
QL_SIM_PIN_E pin;
printf("test ql_sim_change_pin: \n");
- printf("please enter slot(1 or 2): ");
+ printf("please enter slot(1 or 2): \n");
scanf("%d", &input);
getchar();
if (1 == input)
@@ -622,7 +623,7 @@
return;
}
- printf("please enter app type(0-unknown, 1-3gpp, 2-3gpp2, 3-isim): ");
+ printf("please enter app type(0-unknown, 1-3gpp, 2-3gpp2, 3-isim): \n");
scanf("%d", &input);
getchar();
switch (input)
@@ -644,7 +645,7 @@
return;
}
- printf("please enter pin(1 or 2): ");
+ printf("please enter pin(1 or 2): \n");
scanf("%d", &input);
getchar();
if (1 == input)
@@ -661,7 +662,7 @@
return;
}
- printf("please enter old pin value(at most %d digit): ", QL_SIM_PIN_MAX);
+ printf("please enter old pin value(at most %d digit): \n", QL_SIM_PIN_MAX);
if (NULL == fgets(old_pin_value, sizeof(old_pin_value), stdin))
{
printf("can not read old pin value\n");
@@ -674,7 +675,7 @@
old_len--;
}
- printf("please enter new pin value(at most %d digit): ", QL_SIM_PIN_MAX);
+ printf("please enter new pin value(at most %d digit): \n", QL_SIM_PIN_MAX);
if (NULL == fgets(new_pin_value, sizeof(new_pin_value), stdin))
{
printf("can not read new pin value\n");
@@ -743,7 +744,7 @@
return;
}
- printf("please enter app type(0-unknown, 1-3gpp, 2-3gpp2, 3-isim): ");
+ printf("please enter app type(0-unknown, 1-3gpp, 2-3gpp2, 3-isim): \n");
scanf("%d", &input);
getchar();
switch (input)
@@ -765,7 +766,7 @@
return;
}
- printf("please enter pin(1 or 2): ");
+ printf("please enter pin(1 or 2): \n");
scanf("%d", &input);
getchar();
if (1 == input)
@@ -782,7 +783,7 @@
return;
}
- printf("please enter puk value(at most %d digit): ", QL_SIM_PIN_MAX);
+ printf("please enter puk value(at most %d digit): \n", QL_SIM_PIN_MAX);
if (NULL == fgets(puk_value, sizeof(puk_value), stdin))
{
printf("can not read old pin value\n");
@@ -795,7 +796,7 @@
len--;
}
- printf("please enter new pin value(at most %d digit): ", QL_SIM_PIN_MAX);
+ printf("please enter new pin value(at most %d digit): \n", QL_SIM_PIN_MAX);
if (NULL == fgets(new_pin_value, sizeof(new_pin_value), stdin))
{
printf("can not read new pin value\n");
diff --git a/mbtk/test/libql_lib_v2/ql_sms_test.c b/mbtk/test/libql_lib_v2/ql_sms_test.c
index 1ebdde2..e4ecaf9 100755
--- a/mbtk/test/libql_lib_v2/ql_sms_test.c
+++ b/mbtk/test/libql_lib_v2/ql_sms_test.c
@@ -30,7 +30,7 @@
int main(int argc, char *argv[])
{
- char operator[10];
+ //char operator[10];
int opt;
int ret;
// int sms;
@@ -47,15 +47,12 @@
"\t3 sms set msg recv cb\n"
"\t4 sms set ser error cb\n"
"\t5 sms send msg async\n"
+ "\t6 sms set slot to send msg\n"
"operator: >> \n");
while(1)
{
- memset(operator, 0, sizeof(operator));
- if(NULL == fgets(operator, sizeof(operator), stdin))
- break;
- fflush(stdin);
- opt = atoi(operator);
+ scanf("%d",&opt);
switch (opt)
{
case 0:
@@ -149,7 +146,60 @@
}
}
break;
-
+ case 6:
+ {
+ 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_sms_slot(QL_SIM_SLOT_1);
+ if(ret != 0)
+ {
+ printf("ql_set_sms_slot failed %d\n",ret);
+ }
+ else
+ {
+ printf("ql_set_sms_slot success \n");
+ }
+ }
+ else if (choice == 2)
+ {
+ ret = ql_set_sms_slot(QL_SIM_SLOT_2);
+ if(ret != 0)
+ {
+ printf("ql_set_sms_slot failed %d\n",ret);
+ }
+ else
+ {
+ printf("ql_set_sms_slot success \n");
+ }
+ }
+ break;
+ }
default:
break;
diff --git a/mbtk/test/libql_lib_v2/ql_voice_test.c b/mbtk/test/libql_lib_v2/ql_voice_test.c
index 61a6cc3..132e7ea 100755
--- a/mbtk/test/libql_lib_v2/ql_voice_test.c
+++ b/mbtk/test/libql_lib_v2/ql_voice_test.c
@@ -30,7 +30,7 @@
int main(int argc, char *argv[])
{
- char operator[10];
+
int opt;
int ret;
int voice;
@@ -51,14 +51,12 @@
"\t7 voice answer\n"
"\t8 voice get records\n"
"\t9 voice send dtmf char\n"
+ "\t10 voice set sim card\n"
"operator: >> \n");
while(1)
{
- memset(operator, 0, sizeof(operator));
- fgets(operator, sizeof(operator), stdin);
- fflush(stdin);
- opt = atoi(operator);
+ scanf("%d",&opt);
switch (opt)
{
case 0:
@@ -132,7 +130,10 @@
printf(">>>>>Input ql_voice_dial<<<<<\n");
uint32_t id = 0;
- ret = ql_voice_dial("13388257090", 11, &id);
+ char phone_num[16] = {0};
+ printf("Please input dial number\n");
+ scanf("%s",phone_num);
+ ret = ql_voice_dial(phone_num,11, &id);
printf("id:%d", id);
if(ret < 0)
{
@@ -222,9 +223,60 @@
}
}
break;
-
-
-
+
+ case 10:
+ {
+ 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_sms_slot(QL_SIM_SLOT_1);
+ if(ret != 0)
+ {
+ printf("ql_set_sms_slot failed %d\n",ret);
+ }
+ else
+ {
+ printf("ql_set_sms_slot success \n");
+ }
+ }
+ else if (choice == 2)
+ {
+ ret = ql_set_sms_slot(QL_SIM_SLOT_2);
+ if(ret != 0)
+ {
+ printf("ql_set_sms_slot failed %d\n",ret);
+ }
+ else
+ {
+ printf("ql_set_sms_slot success \n");
+ }
+ }
+ break;
+ }
default:
break;
}