Reset : Update LYNQ test
Change-Id: I1846ff06ae0414fe6f3c7e83af14e55da98a4e96
diff --git a/mbtk/test/liblynq_lib/fota_test.c b/mbtk/test/liblynq_lib/fota_test.c
new file mode 100755
index 0000000..0984443
--- /dev/null
+++ b/mbtk/test/liblynq_lib/fota_test.c
@@ -0,0 +1,175 @@
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include "lynq-qser-fota.h"
+
+
+
+int fota_cb(int status, int percent)
+{
+ printf("status: %d, percent: %d%%\n", status, percent);
+ return 0;
+}
+
+int main(void)
+{
+ int cmdIdx = 0,i=0;
+ int ret = 0;
+ int type_path = 0;
+ char path[256] = {0};
+ char operator[10];
+ int opt = 0;
+
+
+ while(1)
+ {
+ printf("=========fota========2\n"
+ "\t 0 lynq_fota_set_addr_value\n"
+ "\t 1 lynq_rock_main\n"
+ "\t 2 lynq_fota_nrestart\n"
+ "\t 3 lynq_get_upgrade_status\n"
+ "\t 4 Close \n"
+ "=========================\n");
+
+ fflush(stdin);
+ fgets(operator, sizeof(operator), stdin);
+ opt = atoi(operator);
+
+ switch(opt)
+ {
+ case 0://"ql_fota_start"
+ {
+ ret = lynq_fota_set_addr_value("/tmp/updata.bin", 26976256);
+ if(ret)
+ {
+ printf("lynq_fota_set_addr_value failed, ret=%d\n", ret);
+ }
+
+ break;
+ }
+ case 1://"ql_fota_start"
+ {
+ ret = lynq_rock_main(1);
+ printf("lynq_rock_main() ret:%d!\n", ret);
+
+ break;
+ }
+ case 2://"ql_fota_start"
+ {
+ ret = lynq_fota_nrestart();
+ printf("lynq_fota_nrestart() ret:%d!\n", ret);
+
+ break;
+ }
+ case 3://"ql_fota_start"
+ {
+ ret = lynq_get_upgrade_status();
+
+ printf("lynq_get_upgrade_status() ret:%d!\n", ret);
+
+ break;
+ }
+ default://"ql_fota_start"
+ {
+ printf("break\n");
+ return 0;
+ }
+ }
+ }
+ return 0;
+}
+
+
+int main_1(void)
+{
+ int cmdIdx = 0,i=0;
+ int ret = 0;
+ int type_path = 0;
+ char path[256] = {0};
+ char operator[10];
+ int opt = 0;
+
+
+ while(1)
+ {
+ printf("=========fota========2\n"
+ "\t 0 ql_fota_init\n"
+ "\t 1 ql_fota_fw_write_by_url\n"
+ "\t 2 ql_fota_fw_write\n"
+ "\t 3 ql_fota_done\n"
+ "\t 4 Close \n"
+ "=========================\n");
+
+ fflush(stdin);
+ fgets(operator, sizeof(operator), stdin);
+ opt = atoi(operator);
+
+ switch(opt)
+ {
+ case 0://"ql_fota_start"
+ {
+ ret = ql_fota_init(fota_cb);
+ if(ret)
+ {
+ printf("ql_fota_init failed, ret=%d\n", ret);
+ }
+
+ break;
+ }
+ case 1://"ql_fota_start"
+ {
+ printf("<** please input url path(http://118.114.239.159:30119/update.bin)**!>\n");
+
+ memcpy(path, "http://118.114.239.159:30119/update.bin", strlen("http://118.114.239.159:30119/update.bin"));
+ if(!strncasecmp(path, "ftp://", 6) || !strncasecmp(path, "http://", 7) || !strncasecmp(path, "https://", 8)) //url
+ {
+ ret = ql_fota_fw_write_by_url(path, 3*1024*1024, 10, 600);
+ if(ret)
+ {
+ printf("ql_fota_fw_write_by_url failed, ret=%d\n", ret);
+ break;
+ }
+ }
+
+ break;
+ }
+ case 2://"ql_fota_start"
+ {
+ printf("<** please input local path( /NVM/updata.bin)>\n");
+ ret = ql_fota_fw_write("/NVM/updata.bin", 3*1024*1024);
+ if(ret)
+ {
+ printf("ql_fota_fw_write failed, ret=%d\n", ret);
+ }else{
+ printf("ql_fota_fw_write success ret £º%\n", ret);
+ }
+
+ break;
+ }
+ case 3://"ql_fota_start"
+ {
+ ret = ql_fota_done(1);
+ if(ret)
+ {
+ printf("ql_fota_done failed, ret=%d\n", ret);
+ break;
+ }
+ else
+ {
+ printf("download firmware success!\n");
+ }
+ break;
+ }
+ default://"ql_fota_start"
+ {
+ printf("break\n");
+ return 0;
+ }
+ }
+ }
+ return 0;
+}
+
+
+
diff --git a/mbtk/test/liblynq_lib/lynq-audio-demo.cpp b/mbtk/test/liblynq_lib/lynq-audio-demo.cpp
index c60480d..d97464d 100755
--- a/mbtk/test/liblynq_lib/lynq-audio-demo.cpp
+++ b/mbtk/test/liblynq_lib/lynq-audio-demo.cpp
@@ -3,8 +3,7 @@
#include <string.h>
#include <errno.h>
#include "ring_tele.h"
-#include <lynq/lynq-qser-audio.h>
-
+#include "lynq/lynq-qser-audio.h"
static int playback_handle = 1;
diff --git a/mbtk/test/liblynq_lib/lynq_call_test.c b/mbtk/test/liblynq_lib/lynq_call_test.c
new file mode 100755
index 0000000..9bb9572
--- /dev/null
+++ b/mbtk/test/liblynq_lib/lynq_call_test.c
@@ -0,0 +1,377 @@
+#include "lynq-qser-voice.h"
+
+#include "mbtk_type.h"
+#include "mbtk_info_api.h"
+#include "mbtk_audio.h"
+
+
+#if 0
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/types.h>
+#include <pthread.h>
+#include <unistd.h>
+#include <dlfcn.h>
+#include <stdint.h>
+
+//#include"lynq-qser-voice-demo.h"
+
+typedef struct
+{
+ int cmdIdx;
+ char *funcName;
+} st_api_test_case;
+
+//for server test
+st_api_test_case at_api_testcases[] =
+{
+ {0, "print_help"},
+ {1, "qser_voice_call_start"},
+ {2, "qser_voice_call_end"},
+ {3, "qser_voice_call_answer"},
+ {4, "qser_voice_set_speech_volume"},
+ {5, "qser_voice_get_speech_volume"},
+ {-1, NULL}
+};
+
+
+
+typedef uint32_t voice_client_handle_type;
+
+static pthread_t s_lynq_voice_tid = -1;
+
+
+int (*qser_voice_call_client_init)(voice_client_handle_type *ph_voice);
+int (*qser_voice_call_client_deinit)(voice_client_handle_type );
+int (*qser_voice_call_addstatehandler)(voice_client_handle_type h_voice,
+ QSER_VoiceCall_StateHandlerFunc_t handlerPtr,
+ void *contextPtr);
+
+int (*qser_voice_call_removestatehandle)(voice_client_handle_type );
+int (*qser_voice_call_start)(voice_client_handle_type h_voice,
+ E_QSER_VCALL_ID_T simId,
+ char *phone_number, int *call_id);
+
+int (*qser_voice_call_end)(voice_client_handle_type ,int );
+int (*qser_voice_call_answer)(voice_client_handle_type ,int );
+int (*qser_voice_set_speech_volume)(const int volume);
+int (*qser_voice_get_speech_volume)(int *volume);
+
+void *dlHandle_call = NULL;
+
+static void yk_voice_call_cb_func(int call_id,
+ char* phone_num,
+ qser_voice_call_state_t state,
+ void *contextPtr)
+{
+ char *call_state[] = {"INCOMING", "DIALING", "ALERTING", "ACTIVE", "HOLDING", "END", "WAITING"};
+
+ printf("######### Call id=%d, PhoneNum:%s, event=%s! ######\n", call_id, phone_num, call_state[state]);
+}
+
+void print_help(void)
+{
+ int i;
+ printf("Supported test cases:\n");
+ for(i = 0; ; i++)
+ {
+ if(at_api_testcases[i].cmdIdx == -1)
+ {
+ break;
+ }
+ printf("%d:\t%s\n", at_api_testcases[i].cmdIdx, at_api_testcases[i].funcName);
+ }
+}
+
+int main(int argc, char const *argv[])
+{
+ int cmdIdx = 0;
+ int ret = 0;
+ int voice_call_id = 0;
+ voice_client_handle_type h_voice = 0;
+
+ //const char *lynqLibPath_Call = "/lib/liblynq-qser-voice.so";
+ const char *lynqLibPath_Call = "/lib/liblynq_lib.so";
+ dlHandle_call = dlopen(lynqLibPath_Call, RTLD_NOW);
+ if (dlHandle_call == NULL)
+ {
+ printf("dlopen dlHandle_call failed: %s\n", dlerror());
+ exit(EXIT_FAILURE);
+ }
+
+ qser_voice_call_client_init = (int(*)(voice_client_handle_type *ph_voice))dlsym(dlHandle_call, "qser_voice_call_client_init");
+ if(qser_voice_call_client_init == NULL)
+ {
+ printf("qser_voice_call_client_init not defined or exported in %s\n", lynqLibPath_Call);
+ return -1;
+ }
+
+ qser_voice_call_addstatehandler = (int(*)(voice_client_handle_type h_voice,
+ QSER_VoiceCall_StateHandlerFunc_t handlerPtr,
+ void *contextPtr))dlsym(dlHandle_call,"qser_voice_call_addstatehandler");
+ if(qser_voice_call_addstatehandler == NULL)
+ {
+ printf("qser_voice_call_addstatehandler not defined or exported in %s\n", lynqLibPath_Call);
+ return -1;
+ }
+
+ qser_voice_call_answer = (int(*)(voice_client_handle_type,int ))dlsym(dlHandle_call,"qser_voice_call_answer");
+ if(qser_voice_call_answer == NULL)
+ {
+ printf("qser_voice_call_answer not defined or exported in %s\n", lynqLibPath_Call);
+ return -1;
+ }
+
+ qser_voice_call_start = (int(*)(voice_client_handle_type h_voice,E_QSER_VCALL_ID_T simId,
+ char *phone_number, int *call_id))dlsym(dlHandle_call,"qser_voice_call_start");
+ if(qser_voice_call_start == NULL)
+ {
+ printf("qser_voice_call_start not defined or exported in %s\n", lynqLibPath_Call);
+ return -1;
+ }
+
+ qser_voice_call_end = (int(*)(voice_client_handle_type ,int))dlsym(dlHandle_call,"qser_voice_call_end");
+ if(qser_voice_call_end == NULL)
+ {
+ printf("qser_voice_call_end not defined or exported in %s\n", lynqLibPath_Call);
+ return -1;
+ }
+
+
+ qser_voice_call_client_deinit = (int (*)(voice_client_handle_type h_voice))dlsym(dlHandle_call,"qser_voice_call_client_deinit");
+ if(qser_voice_call_client_deinit == NULL)
+ {
+ printf("qser_voice_call_client_deinit not defined or exported in %s\n", lynqLibPath_Call);
+ return -1;
+ }
+
+ qser_voice_call_removestatehandle = (int (*)(voice_client_handle_type))dlsym(dlHandle_call,"qser_voice_call_removestatehandle");
+ if(qser_voice_call_removestatehandle == NULL)
+ {
+ printf("qser_voice_call_removestatehandle not defined or exported in %s\n", lynqLibPath_Call);
+ return -1;
+ }
+
+ qser_voice_set_speech_volume = (int (*)(const int ))dlsym(dlHandle_call,"qser_voice_set_speech_volume");
+ if(qser_voice_set_speech_volume == NULL)
+ {
+ printf("qser_voice_set_speech_volume not defined or exported in %s\n", lynqLibPath_Call);
+ return -1;
+ }
+
+ qser_voice_get_speech_volume = (int (*)(int* ))dlsym(dlHandle_call,"qser_voice_get_speech_volume");
+ if(qser_voice_get_speech_volume == NULL)
+ {
+ printf("qser_voice_get_speech_volume not defined or exported in %s\n", lynqLibPath_Call);
+ return -1;
+ }
+
+ ret = qser_voice_call_client_init(&h_voice);
+ if(ret != 0 )
+ {
+ printf("qser_voice_call_client_init FAIL\n");
+ return -1;
+ }
+
+ ret = qser_voice_call_addstatehandler(h_voice, yk_voice_call_cb_func, &voice_call_id);
+ if(ret != 0)
+ {
+ printf("qser_voice_call_addstatehandler FAIL\n");
+ return -1;
+ }
+
+
+ print_help();
+ while(1)
+ {
+ printf("\nplease input cmd index(-1 exit): ");
+ scanf("%d", &cmdIdx);
+ if(cmdIdx == -1)
+ {
+ break;
+ }
+
+ switch(cmdIdx)
+ {
+ //"print_help
+ case 0:
+ print_help();
+ break;
+
+ //"qser_voice_call_start"
+ case 1:
+ {
+ char PhoneNum[32] = {0};
+
+ printf("please input dest phone number: \n");
+ scanf("%s", PhoneNum);
+
+ ret = qser_voice_call_start(h_voice, E_QSER_VCALL_EXTERNAL_SLOT_1, PhoneNum, &voice_call_id);
+ printf("qser_voice_call_start ret = %d, with voice_call_id=%d\n", ret, voice_call_id);
+ break;
+ }
+
+ //"qser_voice_call_end"
+ case 2:
+ {
+ int call_id = -1;
+ printf("please input end call id: \n");
+ scanf("%d", &call_id);
+ ret = qser_voice_call_end(h_voice, call_id);
+ printf(" ret = %d\n", ret);
+ break;
+ }
+
+ //"qser_voice_call_answer"
+ case 3:
+ {
+ int call_id = -1;
+ printf(" please input answer call id\n");
+ scanf("%d", &call_id);
+ ret = qser_voice_call_answer(h_voice, call_id);
+ printf(" ret = %d\n", ret);
+ break;
+ }
+ case 4:
+ {
+ int volume = 0;
+ printf("Please set speech volume:0-5 level\n");
+ scanf("%d",&volume);
+ ret = qser_voice_set_speech_volume(volume);
+ printf("ret is %d\n",ret);
+ break;
+
+ }
+
+ case 5:
+ {
+ int volume = -1;
+ printf("Enter get speech volume\n");
+ ret = qser_voice_get_speech_volume(&volume);
+ printf("ret is %d,get volume is %d\n",ret,volume);
+ break;
+
+ }
+ default:
+ print_help();
+ break;
+ }
+
+ }
+ ret = qser_voice_call_removestatehandle(h_voice);
+ if(ret != 0 && ret != 1)
+ {
+ printf("qser_voice_call_removestatehandle FAIL!!!\n");
+ return -1;
+ }
+ printf("qser_voice_call_removestatehandle ret = %d\n", ret);
+
+
+ ret = qser_voice_call_client_deinit(h_voice);
+ if(ret != 0)
+ {
+ printf("qser_voice_call_client_deinit FAIL\n");
+ return -1;
+ }
+ printf("qser_voice_call_client_deinit ret = %d, with h_voice=%d\n", ret, h_voice);
+
+ return 0;
+}
+
+
+#else
+
+static void yk_voice_call_cb_func(int call_id,
+ char* phone_num,
+ qser_voice_call_state_t state,
+ void *contextPtr)
+{
+ char *call_state[] = {"INCOMING", "DIALING", "ALERTING", "ACTIVE", "HOLDING", "END", "WAITING"};
+
+ printf("######### Call id=%d, PhoneNum:%s, event=%s! ######\n", call_id, phone_num, call_state[state]);
+}
+
+int main(int argc, char *argv[])
+{
+ char operator[10];
+ int opt;
+ int lv_voll = 0;
+ voice_client_handle_type handle = -1;
+ int voice_call_id = 0;
+ mbtk_log_init("radio", "CALL_TEST");
+
+ while(1)
+ {
+ printf("=========call main=========\n"
+ "\t0 exit\n"
+ "\t1 call init\n"
+ "\t2 call add register handle\n"
+ "\t3 call start\n"
+ "\t4 call end\n"
+ "\t5 call answer\n"
+ "\t6 call remove register handle\n"
+ "\t7 call set volume level 0-5\n"
+ "\t8 call get volume\n"
+ "\t9 call deinit\n"
+ "operator: >> \n");
+
+ fgets(operator, sizeof(operator), stdin);
+ fflush(stdin);
+ opt = atoi(operator);
+ switch (opt)
+ {
+ case 0:
+ printf("main exit\n");
+ return 0;
+ case 1:
+ qser_voice_call_client_init(&handle);
+ printf("test>>: handle = %d\n",handle);
+ break;
+ case 2:
+ qser_voice_call_addstatehandler(handle, yk_voice_call_cb_func, &voice_call_id);
+ break;
+ case 3:
+ qser_voice_call_start(handle, E_QSER_VCALL_EXTERNAL_SLOT_1, "18981904623", &voice_call_id);//被叫电话
+ break;
+ case 4:
+ qser_voice_call_end(handle, voice_call_id);
+ break;
+ case 5:
+ qser_voice_call_anser(handle, voice_call_id);
+ break;
+ case 6:
+ qser_voice_call_removestatehandle(handle);
+ break;
+ case 7:
+ {
+ printf("Pleas set volume level(0-5)>>>>\n");
+ memset(operator, 0x00, sizeof(operator));
+ fgets(operator, sizeof(operator), stdin);
+ fflush(stdin);
+ //def level 3
+ lv_voll = atoi(operator);
+ if (lv_voll >= 0 && lv_voll <= 5)
+ qser_voice_set_speech_volume(lv_voll);
+ else
+ printf("set volume level(0-5) ERR\n");
+ }
+ break;
+ case 8:
+ qser_voice_get_speech_volume(&lv_voll);
+ printf("volume level = %d\n",lv_voll);
+ break;
+ case 9:
+ qser_voice_call_client_deinit(handle);
+ break;
+ default:
+ break;
+ }
+
+ }
+
+ return 0;
+}
+
+#endif
+
diff --git a/mbtk/test/liblynq_lib/lynq_nw_test.c b/mbtk/test/liblynq_lib/lynq_nw_test.c
new file mode 100755
index 0000000..82cd6d8
--- /dev/null
+++ b/mbtk/test/liblynq_lib/lynq_nw_test.c
@@ -0,0 +1,265 @@
+#include "lynq_qser_network.h"
+#include "mbtk_type.h"
+#include "mbtk_info_api.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+
+
+char *tech_domain[] = {"NONE", "3GPP", "3GPP2"};
+char *radio_tech[] = {"unknown",
+ "TD_SCDMA", "GSM", "HSPAP", "LTE", "EHRPD", "EVDO_B",
+ "HSPA", "HSUPA", "HSDPA", "EVDO_A", "EVDO_0", "1xRTT",
+ "IS95B", "IS95A", "UMTS", "EDGE", "GPRS", "NONE"};
+
+void nw_event_ind_handler (
+ nw_client_handle_type h_nw,
+ u_int32_t ind_flag,
+ void *ind_msg_buf,
+ u_int32_t ind_msg_len,
+ void *contextPtr)
+{
+ uint8 *net_data = NULL;
+
+ net_data = (uint8*)ind_msg_buf;
+
+ if(ind_msg_buf && ind_msg_len > 0)//无处理原始数据传输过来
+ {
+ if(*net_data == 0)
+ { // CS
+ printf("CS:act=%d, mode=%d\n", *(net_data + 1), *(net_data + 2));
+ }
+ else
+ { // PS
+ printf("PS[%s]:act=%d, mode=%d\n", *(net_data + 3) == 0 ? "GSM/WCDMA" : "LTE", *(net_data + 1), *(net_data + 2));
+ }
+ }
+ else
+ {
+ printf("NET_CB : NULL");
+ }
+
+}
+
+
+int main(int argc, char *argv[])
+{
+ char operator[10];
+ int opt;
+ int lv_voll = 0;
+ nw_client_handle_type handle = -1;
+ mbtk_log_init("radio", "NW_TEST");
+
+ while(1)
+ {
+ printf("=========network main=========\n"
+ "\t0 exit\n"
+ "\t1 network init\n"
+ "\t2 network add rx msg handle\n"
+ "\t3 network band set config\n"
+ "\t4 network get operator name\n"
+ "\t5 network get reg status\n"
+ "\t6 network get signal strength\n"
+ "\t7 network set oos config\n"
+ "\t8 network get oos config\n"
+ "\t9 network set rf config\n"
+ "\t10 network get rf config\n"
+ "\t11 network deinit\n"
+ "operator: >> ");
+
+ fgets(operator, sizeof(operator), stdin);
+ fflush(stdin);
+ opt = atoi(operator);
+ switch (opt)
+ {
+ case 0:
+ printf("main exit\n");
+ return 0;
+ case 1:
+ qser_nw_client_init(&handle);
+ break;
+ case 2:
+ qser_nw_add_rx_msg_handler(handle, nw_event_ind_handler, NULL);
+ break;
+ case 3:
+ {
+ //漫游开关现在不支持,所以就不用配置
+ printf("please input \n"
+ "\t1:GSM \n"
+ "\t2:WCDMA \n"
+ "\t4:CDMA \n"
+ "\t8:EVDO \n"
+ "\t16:LTE \n"
+ "\t32:TDSCDMA \n"
+ );
+ memset(operator,0x00, sizeof(operator));
+ fgets(operator, sizeof(operator)-1, stdin);
+ fflush(stdin);
+ opt = atoi(operator);
+ QSER_NW_CONFIG_INFO_T t_info;
+ switch(opt)
+ {
+ case 1:
+ t_info.preferred_nw_mode = QSER_NW_MODE_GSM;//2G
+ break;
+ case 2:
+ t_info.preferred_nw_mode = QSER_NW_MODE_WCDMA;//3G
+ break;
+ case 4:
+ t_info.preferred_nw_mode = QSER_NW_MODE_CDMA;//3G
+ break;
+ case 8:
+ t_info.preferred_nw_mode = QSER_NW_MODE_EVDO;//3G
+ break;
+ case 16:
+ t_info.preferred_nw_mode = QSER_NW_MODE_LTE;//4G
+ break;
+ case 32:
+ t_info.preferred_nw_mode = QSER_NW_MODE_TDSCDMA;//3G
+ break;
+ default:
+ t_info.preferred_nw_mode = QSER_NW_MODE_LTE;//4G
+ break;
+ }
+ qser_nw_set_config(handle, &t_info);
+ }
+ break;
+ case 4:
+ {
+ QSER_NW_OPERATOR_NAME_INFO_T t_info;
+ int err = qser_nw_get_operator_name(handle, &t_info);
+ if(err)
+ {
+ printf("Error : %d\n", err);
+ } else
+ {
+ printf("Operator : %s, %s, %s, %s\n", t_info.long_eons, t_info.short_eons, t_info.mcc, t_info.mnc);
+ }
+ }
+ break;
+ case 5:
+ {
+ QSER_NW_REG_STATUS_INFO_T reg;
+ int err = qser_nw_get_reg_status(handle, ®);
+ if(err)
+ {
+ printf("Error : %d\n", err);
+ }
+ else
+ {
+ if(reg.voice_registration_details_3gpp_valid)
+ {
+ printf("voice_registration_details_3gpp: tech_domain=%d, radio_tech=%d, mcc=%s, mnc=%s, roaming=%d, forbidden=%d, cid=0x%X, lac=%d, psc=%d, tac=%d\n",
+ reg.voice_registration_details_3gpp.tech_domain,
+ reg.voice_registration_details_3gpp.radio_tech,
+ reg.voice_registration_details_3gpp.mcc,
+ reg.voice_registration_details_3gpp.mnc,
+ reg.voice_registration_details_3gpp.roaming,
+ reg.voice_registration_details_3gpp.forbidden,
+ reg.voice_registration_details_3gpp.cid,
+ reg.voice_registration_details_3gpp.lac,
+ reg.voice_registration_details_3gpp.psc,
+ reg.voice_registration_details_3gpp.tac);
+ }
+ if(reg.data_registration_details_3gpp_valid)
+ {
+ printf("data_registration_details_3gpp: tech_domain=%d, radio_tech=%d, mcc=%s, mnc=%s, roaming=%d, forbidden=%d, cid=0x%X, lac=%d, psc=%d, tac=%d\n",
+ reg.data_registration_details_3gpp.tech_domain,
+ reg.data_registration_details_3gpp.radio_tech,
+ reg.data_registration_details_3gpp.mcc,
+ reg.data_registration_details_3gpp.mnc,
+ reg.data_registration_details_3gpp.roaming,
+ reg.data_registration_details_3gpp.forbidden,
+ reg.data_registration_details_3gpp.cid,
+ reg.data_registration_details_3gpp.lac,
+ reg.data_registration_details_3gpp.psc,
+ reg.data_registration_details_3gpp.tac);
+ }
+ //printf("Data Reg: radio_tech = %d, lac = %x, cid = %x\n", reg.data_registration_details_3gpp.radio_tech, reg.data_registration_details_3gpp.lac, reg.data_registration_details_3gpp.cid);
+ //printf("Voice Reg: radio_tech = %d, lac = %x, cid = %x\n", reg.voice_registration_details_3gpp.radio_tech, reg.voice_registration_details_3gpp.lac, reg.voice_registration_details_3gpp.cid);
+ }
+ }
+ break;
+ case 6:
+ {
+ QSER_NW_SIGNAL_STRENGTH_INFO_T sig;
+ int err = qser_nw_get_signal_strength(handle, &sig);
+ if(err)
+ {
+ printf("Error : %d\n", err);
+ }
+ else
+ {
+ if (sig.gsm_sig_info_valid == TRUE)
+ printf("Signal GSM: rssi = %d\n", sig.gsm_sig_info.rssi);
+ else if (sig.lte_sig_info_valid == TRUE)
+ printf("Signal LTE: rssi = %d, rsrp = %d, rsrq = %d, snr = %d\n", sig.lte_sig_info.rssi , sig.lte_sig_info.rsrp, sig.lte_sig_info.rsrq, sig.lte_sig_info.snr);
+ else if (sig.wcdma_sig_info_valid == TRUE)
+ printf("Signal UTRAN: rssi = %d, ecio = %d\n", sig.wcdma_sig_info.rssi , sig.wcdma_sig_info.ecio);
+ else
+ printf("Signal type not supported \n");
+ }
+ }
+ break;
+ case 7:
+ {
+ QSER_NW_OOS_CONFIG_INFO_T pt_info_s;
+ memset(&pt_info_s, 0x00, sizeof(QSER_NW_OOS_CONFIG_INFO_T));
+ /*取值范围0-255,设置时间自定义
+ phase 1 5次 次数无法更改,这五次都是以10秒为一次的间隔搜网
+ phase 2 5次 次数无法更改,这五次都是以15秒为一次的间隔搜网
+ phase 3 不限制次数的秒数设置,第三阶段不限制次数以20秒为一次的间隔搜网
+ 如果要关闭OOS配置,则把min step max 全部配置为0即可
+ */
+ pt_info_s.type = QSER_NW_OOS_CFG_TYPE_FULL_BAND_SCAN;//平台提供自定义配置搜网时间间隔
+ {
+ pt_info_s.u.full_band_scan_info.t_min = 10;//phase 1
+ pt_info_s.u.full_band_scan_info.t_step = 15;//phase 2
+ pt_info_s.u.full_band_scan_info.t_num = 0;//可以不配置,并没有使用
+ pt_info_s.u.full_band_scan_info.t_max = 20;//phase 3
+ }
+ printf("set OOS %d %d %d \n",pt_info_s.u.full_band_scan_info.t_min, pt_info_s.u.full_band_scan_info.t_step, pt_info_s.u.full_band_scan_info.t_max);
+ //pt_info_s.type = QSER_NW_OOS_CFG_TYPE_FAST_SCAN;平台本身有历史频点优先处理的逻辑(无接口不需要我们进行处理)
+ qser_nw_set_oos_config(handle, &pt_info_s);
+ }
+ break;
+ case 8:
+ {
+ QSER_NW_OOS_CONFIG_INFO_T pt_info_g;
+ qser_nw_get_oos_config(handle, &pt_info_g);
+ if (pt_info_g.type == QSER_NW_OOS_CFG_TYPE_FULL_BAND_SCAN)
+ printf("TYPE: %d min: %d setp: %d max: %d\n", pt_info_g.type, pt_info_g.u.full_band_scan_info.t_min, pt_info_g.u.full_band_scan_info.t_step, pt_info_g.u.full_band_scan_info.t_max);
+ else
+ printf("type not supported \n");
+ }
+ break;
+ case 9:
+ {
+ printf("please input 0 or 1 or 4: \n");
+ memset(operator,0x00, sizeof(operator));
+ fgets(operator, sizeof(operator)-1, stdin);
+ fflush(stdin);
+ opt = atoi(operator);
+ printf("rf_mode: [%d]\n",opt);
+ qser_nw_set_rf_mode(handle, opt);
+ }
+ break;
+ case 10:
+ {
+ int rf_t;
+ qser_nw_get_rf_mode(handle, &rf_t);
+ printf(">>>rf_mode = [%d]\n",rf_t);
+ }
+ break;
+ case 11:
+ qser_nw_client_deinit(handle);
+ break;
+ default:
+ break;
+ }
+
+ }
+
+ return 0;
+}
+
diff --git a/mbtk/test/liblynq_lib/qser_sim_test.c b/mbtk/test/liblynq_lib/qser_sim_test.c
index d6478c4..cae4530 100755
--- a/mbtk/test/liblynq_lib/qser_sim_test.c
+++ b/mbtk/test/liblynq_lib/qser_sim_test.c
@@ -18,420 +18,304 @@
sim_client_handle_type ph_sim = 2023;
sim_client_handle_type h_sim = 2023;
-int flag_init = 0;
-typedef struct
-{
- int cmdIdx;
- const char *funcName;
-} st_api_test_case;
-
-//for server test
-st_api_test_case at_api_testcases[] =
-{
- {0, "qser_sim_init"},
- {1, "qser_get_imsi"},
- {2, "qser_get_iccid"},
- {3, "qser_get_phonenumber"},
- {4, "qser_verify_pin"},
- {5, "qser_change_pin"},
- {6, "qser_unlock_pin"},
- {7, "qser_enable_pin"},
- {8, "qser_disable_pin"},
- {9, "qser_get_sim_status"},
- {10, "qser_get_imei"},
- {11, "qser_get_imei_and_sv"},
- {12, "qser_reset_modem"},
- {13, "qser_get_version"},
- {14, "qser_reset_sim"},
- {15, "qser_deinit_sim"},
- {-1, NULL}
-};
-
-void print_help(void)
-{
- int i;
- printf("Supported test cases:\n");
- for(i = 0; ; i++)
- {
- if(at_api_testcases[i].cmdIdx == -1)
- {
- break;
- }
- printf("%d:\t%s\n", at_api_testcases[i].cmdIdx, at_api_testcases[i].funcName);
- }
-}
int main(int argc, char const *argv[])
{
- int cmdIdx = 0;
- int res = 0;
+ printf("=========sim main=========\n"
+ "\t0 qser_sim_init\n"
+ "\t1 qser_get_imsi\n"
+ "\t2 qser_get_iccid\n"
+ "\t3 qser_get_phonenumber\n"
+ "\t4 qser_verify_pin\n"
+ "\t5 qser_change_pin\n"
+ "\t6 qser_unlock_pin\n"
+ "\t7 qser_enable_pin\n"
+ "\t8 qser_disable_pin\n"
+ "\t9 qser_get_sim_status\n"
+ "\t10 qser_get_imei\n"
+ "\t11 qser_get_imei_and_sv\n"
+ "\t12 qser_reset_modem\n"
+ "\t13 qser_get_version\n"
+ "\t14 qser_reset_sim\n"
+ "\t15 qser_deinit_sim\n"
+ "\t16 exit\n");
- print_help();
while(1)
{
- printf("\nplease input cmd index(-1 exit): ");
+ int cmdIdx = -1;
+ int res = -1;
+
+ printf("operator: >> \n");
+
scanf("%d", &cmdIdx);
- if(cmdIdx == -1)
- {
- break;
- }
+ fflush(stdin);
switch(cmdIdx)
{
//"qser_sim_init"
case 0:
{
- if(flag_init == 1)
+ //int token;
+ //printf("input token\n");
+ //scanf("%d", &token);
+ res = qser_sim_client_init(&h_sim);
+ if(res == 0)
{
- printf("init is already\n");
- break;
- }
- else{
- //int token;
- //printf("input token\n");
- //scanf("%d", &token);
- res = qser_sim_client_init(&h_sim);
- if(res == 0)
- {
- printf("Run qser_sim_client_init\n");
- flag_init = 1;
- }else{
- printf("qser_sim_client_init error\n");
- }
-
- break;
+ printf("Run qser_sim_client_init\n");
+ }else{
+ printf("qser_sim_client_init error\n");
}
}
-
+ break;
//"qser_sim_getimsi"
case 1:
{
- if(flag_init == 0){
- printf("must init first\n");
+ char imsi[BUF_SIZE] = {0};
+ QSER_SIM_APP_ID_INFO_T pt_info;
+ res = qser_sim_getimsi(h_sim, &pt_info, imsi, BUF_SIZE);
+ if(res == 0)
+ {
+ printf("imsi is %s!!!\n",imsi);
+ }else{
+ printf("get imsi error, res = %d\n", res);
}
- else{
- char imsi[BUF_SIZE] = {0};
- QSER_SIM_APP_ID_INFO_T pt_info;
- res = qser_sim_getimsi(h_sim, &pt_info, imsi, 32);
- if(res == 0)
- {
- printf("imsi is %s!!!\n",imsi);
- }else{
- printf("get imsi error, res = %d\n", res);
- }
- }
- break;
}
-
+ break;
//"qser_get_iccid"
case 2:
{
- if(flag_init == 0){
- printf("must init first\n");
+ char iccid[BUF_SIZE] = {0};
+ res = qser_sim_geticcid(h_sim, QSER_SIM_SLOT_ID_1, iccid, BUF_SIZE);
+ if(res == 0)
+ {
+ printf("get iccid success!!! iccid is %s\n",iccid);
+ }else{
+ printf("get iccid error, res = %d\n", res);
}
- else{
- char iccid[BUF_SIZE] = {0};
- res = qser_sim_geticcid(h_sim, QSER_SIM_SLOT_ID_1, iccid, 32);
- if(res == 0)
- {
- printf("get iccid success!!! iccid is %s\n",iccid);
- }else{
- printf("get iccid error, res = %d\n", res);
- }
- }
- break;
}
+ break;
//qser_get_phonenumber
case 3:
{
- if(flag_init == 0){
- printf("must init first\n");
+ char phonenumber[BUF_SIZE] = "";
+ QSER_SIM_APP_ID_INFO_T pt_info;
+ res = qser_sim_getphonenumber(h_sim, &pt_info, phonenumber, BUF_SIZE);
+ if(res == 0)
+ {
+ printf("get phonenumber success!!! phonenumber is %s\n",phonenumber);
+ }else{
+ printf("get phonenumber error, res = %d\n", res);
}
- else{
- char phonenumber[BUF_SIZE] = "";
- QSER_SIM_APP_ID_INFO_T pt_info;
- res = qser_sim_getphonenumber(h_sim, &pt_info, phonenumber, 32);
- if(res == 0)
- {
- printf("get phonenumber success!!! phonenumber is %s\n",phonenumber);
- }else{
- printf("get phonenumber error, res = %d\n", res);
- }
- }
- break;
- }
- //qser_verify_pin
+ }
+ break;
+ //qser_verify_pin
case 4:
{
- if(flag_init == 0){
- printf("must init first\n");
- }
- else{
- char pin[BUF_PIN] = {0};
- QSER_SIM_VERIFY_PIN_INFO_T pt_info;
- printf("input pin\n");
- scanf("%s", pin);
- strncpy(pt_info.pin_value, pin, BUF_PIN);
- printf("pin_value = %s , pin = %s\n", pt_info.pin_value, pin);
- pt_info.pin_value_len = strlen(pt_info.pin_value);
-
- res = qser_sim_verifypin(h_sim, &pt_info);
- if(res == 0)
- {
- printf("verify pin success!!!\n");
- }else{
- printf("verify pin error, res = %d\n", res);
- }
+ char pin[BUF_PIN] = {0};
+ QSER_SIM_VERIFY_PIN_INFO_T pt_info;
+ printf("input pin\n");
+ scanf("%s", pin);
+ strncpy(pt_info.pin_value, pin, BUF_PIN);
+ printf("pin_value = %s , pin = %s\n", pt_info.pin_value, pin);
+ pt_info.pin_value_len = strlen(pt_info.pin_value);
+ res = qser_sim_verifypin(h_sim, &pt_info);
+ if(res == 0)
+ {
+ printf("verify pin success!!!\n");
+ }else{
+ printf("verify pin error, res = %d\n", res);
}
- break;
}
+ break;
//qser_change_pin
case 5:
{
- if(flag_init == 0){
- printf("must init first\n");
- }
- else{
- char old_pin[BUF_PIN] = {0};
- QSER_SIM_CHANGE_PIN_INFO_T pt_info;
- printf("input old pin\n");
- scanf("%s", old_pin);
- char new_pin[BUF_PIN] = {0};
- printf("input new pin\n");
- scanf("%s", new_pin);
- strncpy(pt_info.old_pin_value, old_pin, BUF_PIN);
- strncpy(pt_info.new_pin_value, new_pin, BUF_PIN);
- printf("pt_info.old_pin_value = %s, old_pin = %s\n", pt_info.old_pin_value, old_pin);
- printf("pt_info.new_pin_value = %s, new_pin = %s\n", pt_info.new_pin_value, new_pin);
- pt_info.old_pin_value_len = strlen(pt_info.old_pin_value);
- pt_info.new_pin_value_len = strlen(pt_info.new_pin_value);
+ char old_pin[BUF_PIN] = {0};
+ QSER_SIM_CHANGE_PIN_INFO_T pt_info;
+ printf("input old pin\n");
+ scanf("%s", old_pin);
+ char new_pin[BUF_PIN] = {0};
+ printf("input new pin\n");
+ scanf("%s", new_pin);
+ strncpy(pt_info.old_pin_value, old_pin, BUF_PIN);
+ strncpy(pt_info.new_pin_value, new_pin, BUF_PIN);
+ printf("pt_info.old_pin_value = %s, old_pin = %s\n", pt_info.old_pin_value, old_pin);
+ printf("pt_info.new_pin_value = %s, new_pin = %s\n", pt_info.new_pin_value, new_pin);
+ pt_info.old_pin_value_len = strlen(pt_info.old_pin_value);
+ pt_info.new_pin_value_len = strlen(pt_info.new_pin_value);
- res = qser_sim_changepin(h_sim, &pt_info);
- if(res == 0)
- {
- printf("change pin success!!!\n");
- }else{
- printf("change pin error, res = %d\n", res);
- }
+ res = qser_sim_changepin(h_sim, &pt_info);
+ if(res == 0)
+ {
+ printf("change pin success!!!\n");
+ }else{
+ printf("change pin error, res = %d\n", res);
}
- break;
}
+ break;
//qser_unlock_pin
case 6:
{
- if(flag_init == 0){
- printf("must init first\n");
- }
- else{
- char puk[BUF_PIN] = {0};
- QSER_SIM_UNBLOCK_PIN_INFO_T pt_info;
- printf("input puk\n");
- scanf("%s", puk);
- char new_pin[BUF_PIN] = {0};
- printf("input new pin\n");
- scanf("%s", new_pin);
+ char puk[BUF_PIN] = {0};
+ QSER_SIM_UNBLOCK_PIN_INFO_T pt_info;
+ printf("input puk\n");
+ scanf("%s", puk);
+ char new_pin[BUF_PIN] = {0};
+ printf("input new pin\n");
+ scanf("%s", new_pin);
- strncpy(pt_info.puk_value, puk, BUF_PIN);
- strncpy(pt_info.new_pin_value, new_pin, BUF_PIN);
- printf("pt_info.puk_value = %s, puk = %s\n", pt_info.puk_value, puk);
- printf("pt_info.new_pin_value = %s, new_pin = %s\n", pt_info.new_pin_value, new_pin);
- pt_info.new_pin_value_len = strlen(pt_info.new_pin_value);
- pt_info.puk_value_len = strlen(pt_info.puk_value);
-
- res = qser_sim_unblockpin(h_sim, &pt_info);
- if(res == 0)
- {
- printf("unlock pin success!!!\n");
- }else{
- printf("unlock pin error, res = %d\n", res);
- }
+ strncpy(pt_info.puk_value, puk, BUF_PIN);
+ strncpy(pt_info.new_pin_value, new_pin, BUF_PIN);
+ printf("pt_info.puk_value = %s, puk = %s\n", pt_info.puk_value, puk);
+ printf("pt_info.new_pin_value = %s, new_pin = %s\n", pt_info.new_pin_value, new_pin);
+ pt_info.new_pin_value_len = strlen(pt_info.new_pin_value);
+ pt_info.puk_value_len = strlen(pt_info.puk_value);
+
+ res = qser_sim_unblockpin(h_sim, &pt_info);
+ if(res == 0)
+ {
+ printf("unlock pin success!!!\n");
+ }else{
+ printf("unlock pin error, res = %d\n", res);
}
- break;
}
+ break;
//qser_enable_pin
case 7:
- {
- if(flag_init == 0){
- printf("must init first\n");
+ {
+ char pin[BUF_PIN] = {0};
+ QSER_SIM_ENABLE_PIN_INFO_T pt_info;
+ printf("input pin\n");
+ scanf("%s", pin);
+ strncpy(pt_info.pin_value, pin, BUF_PIN);
+ pt_info.pin_value_len = strlen(pt_info.pin_value);
+
+ res = qser_sim_enablepin(h_sim, &pt_info);
+ if(res == 0)
+ {
+ printf("pin enabled!!!\n");
+ }else{
+ printf("pin enable error, res =%d\n", res);
}
- else{
- char pin[BUF_PIN] = {0};
- QSER_SIM_ENABLE_PIN_INFO_T pt_info;
- printf("input pin\n");
- scanf("%s", pin);
- strncpy(pt_info.pin_value, pin, BUF_PIN);
- pt_info.pin_value_len = strlen(pt_info.pin_value);
-
- res = qser_sim_enablepin(h_sim, &pt_info);
- if(res == 0)
- {
- printf("pin enabled!!!\n");
- }else{
- printf("pin enable error, res =%d\n", res);
- }
- }
- break;
}
+ break;
//qser_disable_pin
case 8:
{
- if(flag_init == 0){
- printf("must init first\n");
+ char pin[BUF_PIN] = {0};
+ QSER_SIM_ENABLE_PIN_INFO_T pt_info;
+ printf("input pin\n");
+ scanf("%s", pin);
+ strncpy(pt_info.pin_value, pin, BUF_PIN);
+ pt_info.pin_value_len = strlen(pt_info.pin_value);
+
+ res = qser_sim_disablepin(h_sim, &pt_info);
+ if(res == 0)
+ {
+ printf("pin disnabled!!!\n");
+ }else{
+ printf("pin disable error,res = %d\n", res);
}
- else{
- char pin[BUF_PIN] = {0};
- QSER_SIM_ENABLE_PIN_INFO_T pt_info;
- printf("input pin\n");
- scanf("%s", pin);
- strncpy(pt_info.pin_value, pin, BUF_PIN);
- pt_info.pin_value_len = strlen(pt_info.pin_value);
-
- res = qser_sim_disablepin(h_sim, &pt_info);
- if(res == 0)
- {
- printf("pin disnabled!!!\n");
- }else{
- printf("pin disable error,res = %d\n", res);
- }
- }
- break;
}
- //qser_get_sim_status
+ break;
+ //qser_get_sim_status
case 9:
{
- if(flag_init == 0){
- printf("must init first\n");
- }
- else{
- QSER_SIM_CARD_STATUS_INFO_T pt_info;
+ QSER_SIM_CARD_STATUS_INFO_T pt_info;
- res = qser_sim_getcardstatus(h_sim, QSER_SIM_SLOT_ID_1, &pt_info);
- if(res == 0)
- {
- printf("state is %d !!!\n",pt_info.e_card_state);
- }else{
- printf("get imsi error,res = %d\n", res);
- }
+ res = qser_sim_getcardstatus(h_sim, QSER_SIM_SLOT_ID_1, &pt_info);
+ if(res == 0)
+ {
+ printf("state is %d !!!\n",pt_info.e_card_state);
+ }else{
+ printf("get imsi error,res = %d\n", res);
}
- break;
}
+ break;
//qser_get_imei
case 10:
{
- if(flag_init == 0){
- printf("must init first\n");
+ char imei[BUF_SIZE]="";
+ res = qser_sim_getimei(h_sim, imei);
+ if(res == 0)
+ {
+ printf("get imei success!!! imei = %s\n", imei);
+ }else{
+ printf("get imei error, res = %d\n", res);
}
- else{
- char imei[BUF_SIZE]="";
- res = qser_sim_getimei(h_sim, imei);
- if(res == 0)
- {
- printf("get imei success!!! imei = %s\n", imei);
- }else{
- printf("get imei error, res = %d\n", res);
- }
- }
- //flag_init = 0;
- break;
}
+ break;
//qser_get_imei_and_sv
case 11:
{
char imei[BUF_SIZE]="";
char sv[BUF_SIZE]="";
- if(flag_init == 0){
- printf("must init first\n");
+ res = qser_get_imei_and_sv(h_sim, imei, sv);
+ if(res == 0)
+ {
+ printf("get imei and sv success!!!imei = %s sv = %s\n", imei, sv);
+ }else{
+ printf("get imei and sv error, res = %d\n", res);
}
- else{
- res = qser_get_imei_and_sv(h_sim, imei, sv);
- if(res == 0)
- {
- printf("get imei and sv success!!!imei = %s sv = %s\n", imei, sv);
- }else{
- printf("get imei and sv error, res = %d\n", res);
- }
- }
- //flag_init = 0;
- break;
}
+ break;
//qser_reset_modem
case 12:
{
- if(flag_init == 0){
- printf("must init first\n");
+ res = qser_reset_modem(h_sim);
+ if(res == 0)
+ {
+ printf("reset modem success!!!\n");
+ }else{
+ printf("reset modem error, res = %d\n", res);
}
- else{
- res = qser_reset_modem(h_sim);
- if(res == 0)
- {
- printf("reset modem success!!!\n");
- }else{
- printf("reset modem error, res = %d\n", res);
- }
- }
- //flag_init = 0;
- break;
}
+ break;
//qser_get_version
case 13:
{
char buf[VER_SIZE]="";
- if(flag_init == 0){
- printf("must init first\n");
+
+ res = qser_get_version(h_sim, buf);
+ if(res == 0)
+ {
+ printf("get version success!!! ver = %s\n", buf);
+ }else{
+ printf("get version error, res = %d\n", res);
}
- else{
- res = qser_get_version(h_sim, buf);
- if(res == 0)
- {
- printf("get version success!!! ver = %s\n", buf);
- }else{
- printf("get version error, res = %d\n", res);
- }
- }
- //flag_init = 0;
- break;
}
+ break;
//qser_reset_sim
case 14:
{
- if(flag_init == 0){
- printf("must init first\n");
+ res = qser_reset_sim(h_sim);
+ if(res == 0)
+ {
+ printf("reset sim success!!!\n");
+ }else{
+ printf("reset sim error, res = %d\n", res);
}
- else{
- res = qser_reset_sim(h_sim);
- if(res == 0)
- {
- printf("reset sim success!!!\n");
- }else{
- printf("reset sim error, res = %d\n", res);
- }
- }
- //flag_init = 0;
- break;
}
+ break;
//qser_deinit_sim
case 15:
{
- if(flag_init == 0){
- printf("must init first\n");
+ res = qser_sim_client_deinit(h_sim);
+ if(res == 0)
+ {
+ printf("sim deinit success is!!!\n");
+ }else{
+ printf("sim deint errors, res = %d\n", res);
}
- else{
- res = qser_sim_client_deinit(h_sim);
- if(res == 0)
- {
- printf("sim deinit success is!!!\n");
- }else{
- printf("sim deint errors, res = %d\n", res);
- }
- }
- flag_init = 0;
- break;
}
- default:
- print_help();
+ break;
+ case 16:
+ printf("main exit\n");
+ return 0;
+ default :
break;
}
diff --git a/mbtk/test/liblynq_lib_t106/Makefile b/mbtk/test/liblynq_lib_t106/Makefile
new file mode 100755
index 0000000..d8eea05
--- /dev/null
+++ b/mbtk/test/liblynq_lib_t106/Makefile
@@ -0,0 +1,34 @@
+BUILD_ROOT = $(shell pwd)/../..
+include $(BUILD_ROOT)/Make.defines
+
+INC_DIR +=
+
+LIB_DIR +=
+
+LIBS += -lmbtk_lib -lmbtk_ril -lmbtk_net -lmbtk_audio -lmbtk_fota -lmbtk_gnss -lmbtk_factory -llynq_lib
+
+CFLAGS +=
+
+DEFINE +=
+
+LOCAL_SRC_FILES = $(wildcard *.c) $(wildcard *.cpp)
+
+$(info LOCAL_SRC_FILES = $(LOCAL_SRC_FILES))
+
+OBJS = $(patsubst %.c,%.o,$(patsubst %.cpp,%.o,$(LOCAL_SRC_FILES)))
+BINS = $(patsubst %.o,%,$(OBJS))
+
+all: $(BINS)
+
+$(BINS):$(OBJS)
+ @echo " BIN $@"
+ $(CC) $(CFLAGS) $(LIB_DIR) $(LIBS) $@.o -o $(OUT_DIR)/bin/$@
+
+%.o:%.c
+ $(CC) $(CFLAGS) $(INC_DIR) $(DEFINE) -c $< -o $@
+
+%.o:%.cpp
+ $(CC) $(CFLAGS) $(INC_DIR) $(DEFINE) -c $< -o $@
+
+clean:
+ rm -f $(OBJS)
diff --git a/mbtk/test/liblynq_lib/lynq-adc-demo.cpp b/mbtk/test/liblynq_lib_t106/lynq-adc-demo.cpp
similarity index 100%
rename from mbtk/test/liblynq_lib/lynq-adc-demo.cpp
rename to mbtk/test/liblynq_lib_t106/lynq-adc-demo.cpp
diff --git a/mbtk/test/liblynq_lib_t106/lynq-audio-demo.cpp b/mbtk/test/liblynq_lib_t106/lynq-audio-demo.cpp
new file mode 100755
index 0000000..c60480d
--- /dev/null
+++ b/mbtk/test/liblynq_lib_t106/lynq-audio-demo.cpp
@@ -0,0 +1,164 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include "ring_tele.h"
+#include <lynq/lynq-qser-audio.h>
+
+
+static int playback_handle = 1;
+
+void player_cmd_proc(char *cmdstr)
+{
+ if (strcmp(cmdstr, "P\n") == 0)
+ {
+ qser_AudPlayer_Pause(playback_handle);
+ }
+ else if (strcmp(cmdstr, "R\n") == 0)
+ {
+ qser_AudPlayer_Resume(playback_handle);
+ }
+ else if (strcmp(cmdstr, "T\n") == 0)
+ {
+ qser_AudPlayer_Stop(playback_handle);
+ }
+ else
+ {
+ printf("Unknown command: %s", cmdstr);
+ }
+}
+
+void capture_cmd_proc(char *cmdstr)
+{
+ if (strcmp(cmdstr, "P\n") == 0)
+ {
+ qser_AudRecorder_Pause();
+ }
+ else if (strcmp(cmdstr, "R\n") == 0)
+ {
+ qser_AudRecorder_Resume();
+ }
+ else if (strcmp(cmdstr, "T\n") == 0)
+ {
+ qser_AudRecorder_Stop();
+ }
+ else
+ {
+ printf("Unknown command: %s", cmdstr);
+ }
+}
+
+int main(int argc, char *argv[])
+{
+ if (argc < 2)
+ {
+ printf("Usage: %s <play|recd|playbuf> [file]\n", argv[0]);
+ return 1;
+ }
+
+ const char *action = argv[1];
+ const char *file = argv[2];
+
+ int g_audio_owner_id = 0;
+ char player_device[] = "device1";
+ char recorder_device[] = "device2";
+ char cmdstr[256];
+
+ _cb_onPlayer cb_fun = [](int result)
+ {
+ if (result == 0)
+ {
+ printf("Audio recorder opened successfully.\n");
+ }
+ else
+ {
+ printf("Failed to open audio recorder, error code: %d\n", result);
+ }
+ };
+
+ if (strcmp(action, "playbuf") == 0)
+ {
+ int player_open_result = qser_AudPlayer_Open(player_device, cb_fun);
+ if (player_open_result != 0)
+ {
+ printf("Failed to open audio player.\n");
+ return 1;
+ }
+ qser_AudPlayer_PlayPcmBuf(PCM_DATA, PCM_DATA_SIZE, 640, 3, 1, 8000, g_audio_owner_id);
+ while (1)
+ {
+ printf("Please input a player command (P/R/T/exit) :\n");
+ if (fgets(cmdstr, sizeof(cmdstr), stdin) != NULL)
+ {
+ if (strcmp(cmdstr, "exit\n") == 0)
+ {
+ qser_AudPlayer_Close(playback_handle);
+ break;
+ }
+ player_cmd_proc(cmdstr);
+ }
+ }
+ qser_AudPlayer_Close(playback_handle);
+ }
+ else if (strcmp(action, "play") == 0)
+ {
+ int player_open_result = qser_AudPlayer_Open(player_device, cb_fun);
+ if (player_open_result != 0)
+ {
+ printf("Failed to open audio player.\n");
+ return 1;
+ }
+
+ qser_AudPlayer_PlayFrmFile(g_audio_owner_id, file, 0);
+
+ while (1)
+ {
+ printf("Please input a player command (P/R/T/exit) :\n");
+ if (fgets(cmdstr, sizeof(cmdstr), stdin) != NULL)
+ {
+ if (strcmp(cmdstr, "exit\n") == 0)
+ {
+ qser_AudPlayer_Close(playback_handle);
+ break;
+ }
+ player_cmd_proc(cmdstr);
+ }
+ }
+
+ qser_AudPlayer_Close(playback_handle);
+ }
+ else if (strcmp(action, "recd") == 0)
+ {
+ int recorder_open_result = qser_AudRecorder_Open(recorder_device, cb_fun);
+ if (recorder_open_result != 0) {
+ printf("Failed to open audio recorder.\n");
+ return 1;
+ }
+
+ qser_AudRecorder_StartRecord(g_audio_owner_id, file, 0);
+
+ while (1)
+ {
+ printf("Please input a player command (P/R/T/exit) :\n");
+ if (fgets(cmdstr, sizeof(cmdstr), stdin) != NULL)
+ {
+ if (strcmp(cmdstr, "exit\n") == 0)
+ {
+ qser_AudRecorder_Close();
+ break;
+ }
+ capture_cmd_proc(cmdstr);
+ }
+ }
+ qser_AudRecorder_Close();
+ }
+ else
+ {
+ printf("Unknown action: %s\n", action);
+ return 1;
+ }
+
+ qser_Audio_Deinit();
+
+ return 0;
+}
diff --git a/mbtk/test/liblynq_lib/lynq-gpio-demo.cpp b/mbtk/test/liblynq_lib_t106/lynq-gpio-demo.cpp
similarity index 100%
rename from mbtk/test/liblynq_lib/lynq-gpio-demo.cpp
rename to mbtk/test/liblynq_lib_t106/lynq-gpio-demo.cpp
diff --git a/mbtk/test/liblynq_lib/lynq-irq-demo.cc b/mbtk/test/liblynq_lib_t106/lynq-irq-demo.cc
similarity index 100%
rename from mbtk/test/liblynq_lib/lynq-irq-demo.cc
rename to mbtk/test/liblynq_lib_t106/lynq-irq-demo.cc
diff --git a/mbtk/test/liblynq_lib/lynq-qser-autosuspend-demo.cpp b/mbtk/test/liblynq_lib_t106/lynq-qser-autosuspend-demo.cpp
similarity index 100%
rename from mbtk/test/liblynq_lib/lynq-qser-autosuspend-demo.cpp
rename to mbtk/test/liblynq_lib_t106/lynq-qser-autosuspend-demo.cpp
diff --git a/mbtk/test/liblynq_lib/lynq-qser-data-demo.cpp b/mbtk/test/liblynq_lib_t106/lynq-qser-data-demo.cpp
similarity index 100%
rename from mbtk/test/liblynq_lib/lynq-qser-data-demo.cpp
rename to mbtk/test/liblynq_lib_t106/lynq-qser-data-demo.cpp
diff --git a/mbtk/test/liblynq_lib/lynq-qser-fota-demo.cpp b/mbtk/test/liblynq_lib_t106/lynq-qser-fota-demo.cpp
similarity index 100%
rename from mbtk/test/liblynq_lib/lynq-qser-fota-demo.cpp
rename to mbtk/test/liblynq_lib_t106/lynq-qser-fota-demo.cpp
diff --git a/mbtk/test/liblynq_lib/lynq-qser-gnss-demo.cpp b/mbtk/test/liblynq_lib_t106/lynq-qser-gnss-demo.cpp
similarity index 100%
rename from mbtk/test/liblynq_lib/lynq-qser-gnss-demo.cpp
rename to mbtk/test/liblynq_lib_t106/lynq-qser-gnss-demo.cpp
diff --git a/mbtk/test/liblynq_lib/lynq-qser-gnss-demo.h b/mbtk/test/liblynq_lib_t106/lynq-qser-gnss-demo.h
similarity index 100%
rename from mbtk/test/liblynq_lib/lynq-qser-gnss-demo.h
rename to mbtk/test/liblynq_lib_t106/lynq-qser-gnss-demo.h
diff --git a/mbtk/test/liblynq_lib/lynq-qser-network-demo.cpp b/mbtk/test/liblynq_lib_t106/lynq-qser-network-demo.cpp
similarity index 100%
rename from mbtk/test/liblynq_lib/lynq-qser-network-demo.cpp
rename to mbtk/test/liblynq_lib_t106/lynq-qser-network-demo.cpp
diff --git a/mbtk/test/liblynq_lib/lynq-qser-sim-demo.cpp b/mbtk/test/liblynq_lib_t106/lynq-qser-sim-demo.cpp
similarity index 100%
rename from mbtk/test/liblynq_lib/lynq-qser-sim-demo.cpp
rename to mbtk/test/liblynq_lib_t106/lynq-qser-sim-demo.cpp
diff --git a/mbtk/test/liblynq_lib/lynq-qser-sim-demo.h b/mbtk/test/liblynq_lib_t106/lynq-qser-sim-demo.h
similarity index 100%
rename from mbtk/test/liblynq_lib/lynq-qser-sim-demo.h
rename to mbtk/test/liblynq_lib_t106/lynq-qser-sim-demo.h
diff --git a/mbtk/test/liblynq_lib/lynq-qser-sms-demo.cpp b/mbtk/test/liblynq_lib_t106/lynq-qser-sms-demo.cpp
similarity index 100%
rename from mbtk/test/liblynq_lib/lynq-qser-sms-demo.cpp
rename to mbtk/test/liblynq_lib_t106/lynq-qser-sms-demo.cpp
diff --git a/mbtk/test/liblynq_lib/lynq-qser-sms-demo.h b/mbtk/test/liblynq_lib_t106/lynq-qser-sms-demo.h
similarity index 100%
rename from mbtk/test/liblynq_lib/lynq-qser-sms-demo.h
rename to mbtk/test/liblynq_lib_t106/lynq-qser-sms-demo.h
diff --git a/mbtk/test/liblynq_lib/lynq-qser-thermal-demo.cpp b/mbtk/test/liblynq_lib_t106/lynq-qser-thermal-demo.cpp
similarity index 100%
rename from mbtk/test/liblynq_lib/lynq-qser-thermal-demo.cpp
rename to mbtk/test/liblynq_lib_t106/lynq-qser-thermal-demo.cpp
diff --git a/mbtk/test/liblynq_lib/lynq-qser-thermal-demo.h b/mbtk/test/liblynq_lib_t106/lynq-qser-thermal-demo.h
similarity index 100%
rename from mbtk/test/liblynq_lib/lynq-qser-thermal-demo.h
rename to mbtk/test/liblynq_lib_t106/lynq-qser-thermal-demo.h
diff --git a/mbtk/test/liblynq_lib/lynq-qser-voice-demo.cpp b/mbtk/test/liblynq_lib_t106/lynq-qser-voice-demo.cpp
similarity index 100%
rename from mbtk/test/liblynq_lib/lynq-qser-voice-demo.cpp
rename to mbtk/test/liblynq_lib_t106/lynq-qser-voice-demo.cpp
diff --git a/mbtk/test/liblynq_lib/lynq-qser-voice-demo.h b/mbtk/test/liblynq_lib_t106/lynq-qser-voice-demo.h
similarity index 100%
rename from mbtk/test/liblynq_lib/lynq-qser-voice-demo.h
rename to mbtk/test/liblynq_lib_t106/lynq-qser-voice-demo.h
diff --git a/mbtk/test/liblynq_lib/lynq-usb-demo.cc b/mbtk/test/liblynq_lib_t106/lynq-usb-demo.cc
similarity index 100%
rename from mbtk/test/liblynq_lib/lynq-usb-demo.cc
rename to mbtk/test/liblynq_lib_t106/lynq-usb-demo.cc
diff --git a/mbtk/test/liblynq_lib/lynq-wifi-demo.cc b/mbtk/test/liblynq_lib_t106/lynq-wifi-demo.cc
similarity index 100%
rename from mbtk/test/liblynq_lib/lynq-wifi-demo.cc
rename to mbtk/test/liblynq_lib_t106/lynq-wifi-demo.cc
diff --git a/mbtk/test/liblynq_lib/lynq_led-demo.c b/mbtk/test/liblynq_lib_t106/lynq_led-demo.c
similarity index 100%
rename from mbtk/test/liblynq_lib/lynq_led-demo.c
rename to mbtk/test/liblynq_lib_t106/lynq_led-demo.c
diff --git a/mbtk/test/liblynq_lib/lynq_qser_network.h b/mbtk/test/liblynq_lib_t106/lynq_qser_network.h
similarity index 100%
rename from mbtk/test/liblynq_lib/lynq_qser_network.h
rename to mbtk/test/liblynq_lib_t106/lynq_qser_network.h
diff --git a/mbtk/test/liblynq_lib/lynq_systime_demo.cpp b/mbtk/test/liblynq_lib_t106/lynq_systime_demo.cpp
similarity index 100%
rename from mbtk/test/liblynq_lib/lynq_systime_demo.cpp
rename to mbtk/test/liblynq_lib_t106/lynq_systime_demo.cpp
diff --git a/mbtk/test/liblynq_lib/poweralarm-demo.cpp b/mbtk/test/liblynq_lib_t106/poweralarm-demo.cpp
similarity index 100%
rename from mbtk/test/liblynq_lib/poweralarm-demo.cpp
rename to mbtk/test/liblynq_lib_t106/poweralarm-demo.cpp
diff --git a/mbtk/test/liblynq_lib_t106/qser_sim_test.c b/mbtk/test/liblynq_lib_t106/qser_sim_test.c
new file mode 100755
index 0000000..d6478c4
--- /dev/null
+++ b/mbtk/test/liblynq_lib_t106/qser_sim_test.c
@@ -0,0 +1,441 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/types.h>
+#include <pthread.h>
+#include <unistd.h>
+#include <dlfcn.h>
+#include <stdint.h>
+
+#include"lynq_qser_sim.h"
+
+
+#define BUF_SIZE 32
+#define BUF_PIN 16
+#define VER_SIZE 128
+
+typedef uint32_t sim_client_handle_type;
+
+sim_client_handle_type ph_sim = 2023;
+sim_client_handle_type h_sim = 2023;
+int flag_init = 0;
+
+typedef struct
+{
+ int cmdIdx;
+ const char *funcName;
+} st_api_test_case;
+
+//for server test
+st_api_test_case at_api_testcases[] =
+{
+ {0, "qser_sim_init"},
+ {1, "qser_get_imsi"},
+ {2, "qser_get_iccid"},
+ {3, "qser_get_phonenumber"},
+ {4, "qser_verify_pin"},
+ {5, "qser_change_pin"},
+ {6, "qser_unlock_pin"},
+ {7, "qser_enable_pin"},
+ {8, "qser_disable_pin"},
+ {9, "qser_get_sim_status"},
+ {10, "qser_get_imei"},
+ {11, "qser_get_imei_and_sv"},
+ {12, "qser_reset_modem"},
+ {13, "qser_get_version"},
+ {14, "qser_reset_sim"},
+ {15, "qser_deinit_sim"},
+ {-1, NULL}
+};
+
+void print_help(void)
+{
+ int i;
+ printf("Supported test cases:\n");
+ for(i = 0; ; i++)
+ {
+ if(at_api_testcases[i].cmdIdx == -1)
+ {
+ break;
+ }
+ printf("%d:\t%s\n", at_api_testcases[i].cmdIdx, at_api_testcases[i].funcName);
+ }
+}
+
+int main(int argc, char const *argv[])
+{
+ int cmdIdx = 0;
+ int res = 0;
+
+ print_help();
+ while(1)
+ {
+ printf("\nplease input cmd index(-1 exit): ");
+ scanf("%d", &cmdIdx);
+ if(cmdIdx == -1)
+ {
+ break;
+ }
+
+ switch(cmdIdx)
+ {
+ //"qser_sim_init"
+ case 0:
+ {
+ if(flag_init == 1)
+ {
+ printf("init is already\n");
+ break;
+ }
+ else{
+ //int token;
+ //printf("input token\n");
+ //scanf("%d", &token);
+ res = qser_sim_client_init(&h_sim);
+ if(res == 0)
+ {
+ printf("Run qser_sim_client_init\n");
+ flag_init = 1;
+ }else{
+ printf("qser_sim_client_init error\n");
+ }
+
+ break;
+ }
+ }
+
+ //"qser_sim_getimsi"
+ case 1:
+ {
+ if(flag_init == 0){
+ printf("must init first\n");
+ }
+ else{
+ char imsi[BUF_SIZE] = {0};
+ QSER_SIM_APP_ID_INFO_T pt_info;
+ res = qser_sim_getimsi(h_sim, &pt_info, imsi, 32);
+ if(res == 0)
+ {
+ printf("imsi is %s!!!\n",imsi);
+ }else{
+ printf("get imsi error, res = %d\n", res);
+ }
+ }
+ break;
+ }
+
+ //"qser_get_iccid"
+ case 2:
+ {
+ if(flag_init == 0){
+ printf("must init first\n");
+ }
+ else{
+ char iccid[BUF_SIZE] = {0};
+ res = qser_sim_geticcid(h_sim, QSER_SIM_SLOT_ID_1, iccid, 32);
+ if(res == 0)
+ {
+ printf("get iccid success!!! iccid is %s\n",iccid);
+ }else{
+ printf("get iccid error, res = %d\n", res);
+ }
+ }
+ break;
+ }
+ //qser_get_phonenumber
+ case 3:
+ {
+ if(flag_init == 0){
+ printf("must init first\n");
+ }
+ else{
+ char phonenumber[BUF_SIZE] = "";
+ QSER_SIM_APP_ID_INFO_T pt_info;
+ res = qser_sim_getphonenumber(h_sim, &pt_info, phonenumber, 32);
+ if(res == 0)
+ {
+ printf("get phonenumber success!!! phonenumber is %s\n",phonenumber);
+ }else{
+ printf("get phonenumber error, res = %d\n", res);
+ }
+ }
+ break;
+ }
+ //qser_verify_pin
+ case 4:
+ {
+ if(flag_init == 0){
+ printf("must init first\n");
+ }
+ else{
+ char pin[BUF_PIN] = {0};
+ QSER_SIM_VERIFY_PIN_INFO_T pt_info;
+ printf("input pin\n");
+ scanf("%s", pin);
+ strncpy(pt_info.pin_value, pin, BUF_PIN);
+ printf("pin_value = %s , pin = %s\n", pt_info.pin_value, pin);
+ pt_info.pin_value_len = strlen(pt_info.pin_value);
+
+ res = qser_sim_verifypin(h_sim, &pt_info);
+ if(res == 0)
+ {
+ printf("verify pin success!!!\n");
+ }else{
+ printf("verify pin error, res = %d\n", res);
+ }
+
+ }
+ break;
+ }
+ //qser_change_pin
+ case 5:
+ {
+ if(flag_init == 0){
+ printf("must init first\n");
+ }
+ else{
+ char old_pin[BUF_PIN] = {0};
+ QSER_SIM_CHANGE_PIN_INFO_T pt_info;
+ printf("input old pin\n");
+ scanf("%s", old_pin);
+ char new_pin[BUF_PIN] = {0};
+ printf("input new pin\n");
+ scanf("%s", new_pin);
+ strncpy(pt_info.old_pin_value, old_pin, BUF_PIN);
+ strncpy(pt_info.new_pin_value, new_pin, BUF_PIN);
+ printf("pt_info.old_pin_value = %s, old_pin = %s\n", pt_info.old_pin_value, old_pin);
+ printf("pt_info.new_pin_value = %s, new_pin = %s\n", pt_info.new_pin_value, new_pin);
+ pt_info.old_pin_value_len = strlen(pt_info.old_pin_value);
+ pt_info.new_pin_value_len = strlen(pt_info.new_pin_value);
+
+ res = qser_sim_changepin(h_sim, &pt_info);
+ if(res == 0)
+ {
+ printf("change pin success!!!\n");
+ }else{
+ printf("change pin error, res = %d\n", res);
+ }
+ }
+ break;
+ }
+ //qser_unlock_pin
+ case 6:
+ {
+ if(flag_init == 0){
+ printf("must init first\n");
+ }
+ else{
+ char puk[BUF_PIN] = {0};
+ QSER_SIM_UNBLOCK_PIN_INFO_T pt_info;
+ printf("input puk\n");
+ scanf("%s", puk);
+ char new_pin[BUF_PIN] = {0};
+ printf("input new pin\n");
+ scanf("%s", new_pin);
+
+ strncpy(pt_info.puk_value, puk, BUF_PIN);
+ strncpy(pt_info.new_pin_value, new_pin, BUF_PIN);
+ printf("pt_info.puk_value = %s, puk = %s\n", pt_info.puk_value, puk);
+ printf("pt_info.new_pin_value = %s, new_pin = %s\n", pt_info.new_pin_value, new_pin);
+ pt_info.new_pin_value_len = strlen(pt_info.new_pin_value);
+ pt_info.puk_value_len = strlen(pt_info.puk_value);
+
+ res = qser_sim_unblockpin(h_sim, &pt_info);
+ if(res == 0)
+ {
+ printf("unlock pin success!!!\n");
+ }else{
+ printf("unlock pin error, res = %d\n", res);
+ }
+ }
+ break;
+ }
+ //qser_enable_pin
+ case 7:
+ {
+ if(flag_init == 0){
+ printf("must init first\n");
+ }
+ else{
+ char pin[BUF_PIN] = {0};
+ QSER_SIM_ENABLE_PIN_INFO_T pt_info;
+ printf("input pin\n");
+ scanf("%s", pin);
+ strncpy(pt_info.pin_value, pin, BUF_PIN);
+ pt_info.pin_value_len = strlen(pt_info.pin_value);
+
+ res = qser_sim_enablepin(h_sim, &pt_info);
+ if(res == 0)
+ {
+ printf("pin enabled!!!\n");
+ }else{
+ printf("pin enable error, res =%d\n", res);
+ }
+ }
+ break;
+ }
+ //qser_disable_pin
+ case 8:
+ {
+ if(flag_init == 0){
+ printf("must init first\n");
+ }
+ else{
+ char pin[BUF_PIN] = {0};
+ QSER_SIM_ENABLE_PIN_INFO_T pt_info;
+ printf("input pin\n");
+ scanf("%s", pin);
+ strncpy(pt_info.pin_value, pin, BUF_PIN);
+ pt_info.pin_value_len = strlen(pt_info.pin_value);
+
+ res = qser_sim_disablepin(h_sim, &pt_info);
+ if(res == 0)
+ {
+ printf("pin disnabled!!!\n");
+ }else{
+ printf("pin disable error,res = %d\n", res);
+ }
+ }
+ break;
+ }
+ //qser_get_sim_status
+ case 9:
+ {
+ if(flag_init == 0){
+ printf("must init first\n");
+ }
+ else{
+ QSER_SIM_CARD_STATUS_INFO_T pt_info;
+
+ res = qser_sim_getcardstatus(h_sim, QSER_SIM_SLOT_ID_1, &pt_info);
+ if(res == 0)
+ {
+ printf("state is %d !!!\n",pt_info.e_card_state);
+ }else{
+ printf("get imsi error,res = %d\n", res);
+ }
+ }
+ break;
+ }
+ //qser_get_imei
+ case 10:
+ {
+ if(flag_init == 0){
+ printf("must init first\n");
+ }
+ else{
+ char imei[BUF_SIZE]="";
+ res = qser_sim_getimei(h_sim, imei);
+ if(res == 0)
+ {
+ printf("get imei success!!! imei = %s\n", imei);
+ }else{
+ printf("get imei error, res = %d\n", res);
+ }
+ }
+ //flag_init = 0;
+ break;
+ }
+ //qser_get_imei_and_sv
+ case 11:
+ {
+ char imei[BUF_SIZE]="";
+ char sv[BUF_SIZE]="";
+
+ if(flag_init == 0){
+ printf("must init first\n");
+ }
+ else{
+ res = qser_get_imei_and_sv(h_sim, imei, sv);
+ if(res == 0)
+ {
+ printf("get imei and sv success!!!imei = %s sv = %s\n", imei, sv);
+ }else{
+ printf("get imei and sv error, res = %d\n", res);
+ }
+ }
+ //flag_init = 0;
+ break;
+ }
+ //qser_reset_modem
+ case 12:
+ {
+ if(flag_init == 0){
+ printf("must init first\n");
+ }
+ else{
+ res = qser_reset_modem(h_sim);
+ if(res == 0)
+ {
+ printf("reset modem success!!!\n");
+ }else{
+ printf("reset modem error, res = %d\n", res);
+ }
+ }
+ //flag_init = 0;
+ break;
+ }
+ //qser_get_version
+ case 13:
+ {
+ char buf[VER_SIZE]="";
+ if(flag_init == 0){
+ printf("must init first\n");
+ }
+ else{
+ res = qser_get_version(h_sim, buf);
+ if(res == 0)
+ {
+ printf("get version success!!! ver = %s\n", buf);
+ }else{
+ printf("get version error, res = %d\n", res);
+ }
+ }
+ //flag_init = 0;
+ break;
+ }
+ //qser_reset_sim
+ case 14:
+ {
+ if(flag_init == 0){
+ printf("must init first\n");
+ }
+ else{
+ res = qser_reset_sim(h_sim);
+ if(res == 0)
+ {
+ printf("reset sim success!!!\n");
+ }else{
+ printf("reset sim error, res = %d\n", res);
+ }
+ }
+ //flag_init = 0;
+ break;
+ }
+ //qser_deinit_sim
+ case 15:
+ {
+ if(flag_init == 0){
+ printf("must init first\n");
+ }
+ else{
+ res = qser_sim_client_deinit(h_sim);
+ if(res == 0)
+ {
+ printf("sim deinit success is!!!\n");
+ }else{
+ printf("sim deint errors, res = %d\n", res);
+ }
+ }
+ flag_init = 0;
+ break;
+ }
+ default:
+ print_help();
+ break;
+ }
+
+ }
+
+ return 0;
+}