[Feature]][T106][CALL] add qser voice api demo

Change-Id: I5fa6f272a6d561a8707b3b383fbaaa741453c6c7
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/mobiletek-tester-rdit/mobiletek-tester-rdit.bb b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/mobiletek-tester-rdit/mobiletek-tester-rdit.bb
index 9582ab4..4e2e7ec 100755
--- a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/mobiletek-tester-rdit/mobiletek-tester-rdit.bb
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/mobiletek-tester-rdit/mobiletek-tester-rdit.bb
@@ -5,7 +5,7 @@
 LICENSE = "CLOSED"
 LIC_FILES_CHKSUM = "file://LICENSE;md5=b1e07e8d88e26263e71d3a9e2aa9a2ff"
 
-DEPENDS += "liblynq-call liblynq-sms liblynq-network liblynq-sim liblynq-data liblynq-qser-data liblynq-qser-network"
+DEPENDS += "liblynq-call liblynq-sms liblynq-network liblynq-sim liblynq-data liblynq-qser-data liblynq-qser-network liblynq-qser-voice"
 
 #inherit workonsrc
 WORKONSRC = "${TOPDIR}/../src/lynq/packages/apps/Mobiletek_Tester_RDIT"
diff --git a/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/dispatch.cpp b/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/dispatch.cpp
index f3f74e6..ee4453e 100755
--- a/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/dispatch.cpp
+++ b/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/dispatch.cpp
@@ -12,6 +12,8 @@
 #include "sms.h"
 #include "network.h"
 #include "data.h"
+#include "qser-voice.h"
+
 
 #define SOCKET_BUF_SIZE 512
 typedef struct {
@@ -55,6 +57,15 @@
         case LYNQ_DIAL: return "LYNQ_DIAL";
         case LYNQ_ANSWER: return "LYNQ_ANSWER";
         case LYNQ_HUNGUP: return "LYNQ_HUNGUP";
+        case LYNQ_QSER_CALL_INIT :return  "LYNQ_QSER_CALL_INIT";
+        case LYNQ_QSER_CALL_DEINIT : return "LYNQ_QSER_CALL_DEINIT";
+        case LYNQ_QSER_CALL_START : return "LYNQ_QSER_CALL_START";
+        case LYNQ_QSER_CALL_ANSWER : return "LYNQ_QSER_CALL_ANSWER";
+        case LYNQ_QSER_CALL_END : return "LYNQ_QSER_CALL_END";
+        case LYNQ_QSER_CALL_HANDLER : return "LYNQ_QSER_CALL_HANDLER";
+        case LYNQ_QSER_CALL_REMOVE : return "LYNQ_QSER_CALL_REMOVE ";
+        case LYNQ_QSER_CALL_HOLD : return "LYNQ_QSER_CALL_HOLD";
+        case LYNQ_QSER_CALL_UNHOLD: return "LYNQ_QSER_CALL_UNHOLD";
         default: return "<unknown request>";
     }
 }
diff --git a/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/lynq.h b/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/lynq.h
index f989fd8..177aed8 100755
--- a/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/lynq.h
+++ b/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/lynq.h
@@ -67,4 +67,16 @@
 #define LYNQ_QSER_NETWORK_GET_REG_STATUS LYNQ_QSER_NETWORK + 5
 #define LYNQ_QSER_NETWORK_SOLICITED_SIGNAL_STRENGTH LYNQ_QSER_NETWORK + 6
 
+#define LYNQ_QSER LYNQ_BASE + 110
+#define LYNQ_QSER_CALL_INIT       LYNQ_QSER + 1
+#define LYNQ_QSER_CALL_DEINIT     LYNQ_QSER + 2
+#define LYNQ_QSER_CALL_START      LYNQ_QSER + 3
+#define LYNQ_QSER_CALL_ANSWER     LYNQ_QSER + 4
+#define LYNQ_QSER_CALL_END        LYNQ_QSER + 5
+#define LYNQ_QSER_CALL_HANDLER    LYNQ_QSER + 6
+#define LYNQ_QSER_CALL_REMOVE     LYNQ_QSER + 7
+#define LYNQ_QSER_CALL_HOLD       LYNQ_QSER + 8
+#define LYNQ_QSER_CALL_UNHOLD     LYNQ_QSER + 9
+
+
 int create_socket(const int domain, const int type, const int protocol,const int port,const char *IP,const char *socket_name,void * addr,int backlog,int cs);
diff --git a/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/makefile b/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/makefile
index df7feff..fe0b8c0 100755
--- a/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/makefile
+++ b/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/makefile
@@ -30,9 +30,10 @@
     -llynq-sim \
     -llynq-qser-network \
     -llynq-qser-data \
+    -llynq-qser-voice \
 
 
-SOURCES = main.cpp cc.cpp dispatch.cpp sms.cpp network.cpp data.cpp
+SOURCES = main.cpp cc.cpp dispatch.cpp sms.cpp network.cpp data.cpp qser-voice.cpp
 SOURCES_TOOL = dispatch.cpp socket-tool.cpp
 
 EXECUTABLE = Mobiletek-Tester-RDIT
diff --git a/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/qser-voice.cpp b/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/qser-voice.cpp
new file mode 100755
index 0000000..f78ea4d
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/qser-voice.cpp
@@ -0,0 +1,125 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <string.h>
+#include <cstring>
+#include <include/lynq-qser-voice.h>
+
+#include "qser-voice.h"
+
+#define TEST_RESULT "lynq_result="
+
+static int qser_hadler = 1 ;
+
+
+static int handle = -1;
+void callback_state_handler_fun(int id,char *num,qser_voice_call_state_t  state, void  *contextPtr )
+{
+    printf("callback show call id is %d,call num %s,call_state is %d,\n",id,num,state);
+    handle = id;
+    return ;
+}
+
+
+//lynq_call_init
+int qser_voice_call_client_init_test(int argc, char *argv[], int sp_test)
+{
+    printf("[%s][%d] enter!\n",__FUNCTION__,__LINE__);
+    int ret= 0;
+    unsigned int uToken = atoi(argv[1]);
+    ret = qser_voice_call_client_init(&uToken);//
+    printf("%s%d\n",TEST_RESULT,ret);
+    return ret;
+}
+
+//call deinit
+int qser_voice_call_client_deinit_test(int argc, char *argv[], int sp_test)
+{
+    printf("[%s][%d] enter!\n",__FUNCTION__,__LINE__);
+    int ret = 0;
+    ret = qser_voice_call_client_deinit(qser_hadler);
+    printf("%s%d\n",TEST_RESULT,ret);
+    return ret;
+
+}
+
+//lynq_call
+int qser_voice_call_start_test(int argc, char *argv[], int sp_test)
+{
+    printf("[%s][%d] enter!\n",__FUNCTION__,__LINE__);
+    int ret = 0;
+    int call_id = -1;
+    char addr[16] = {0};
+    strncpy(addr,argv[1],sizeof(addr) - 1);
+    ret = qser_voice_call_start(qser_hadler,E_QSER_VCALL_EXTERNAL_SLOT_1,addr,&call_id);
+    printf("%s%d%d\n",TEST_RESULT,ret,call_id);
+    return ret;
+
+}
+
+//lynq_call_answer
+int qser_voice_call_answer_test(int argc, char *argv[], int sp_test)
+{
+    printf("[%s][%d] enter!\n",__FUNCTION__,__LINE__);
+    int ret = 0;
+    ret = qser_voice_call_answer(qser_hadler,qser_hadler);
+    printf("%s%d\n",TEST_RESULT,ret);
+    return ret;
+}
+
+//hugup
+int qser_voice_call_end_test(int argc, char *argv[], int sp_test)
+{
+    printf("[%s][%d] enter!\n",__FUNCTION__,__LINE__);
+    int ret = 0;
+    ret = qser_voice_call_end(qser_hadler,handle);
+    printf("%s%d\n",TEST_RESULT,ret);
+    return ret;
+}
+
+
+//add callback
+int qser_voice_call_addstatehandler_test(int argc, char *argv[], int sp_test)
+{
+    printf("[%s][%d] enter!\n",__FUNCTION__,__LINE__);
+    int ret = 0;
+    ret = qser_voice_call_addstatehandler(qser_hadler,callback_state_handler_fun,NULL);
+    printf("%s%d\n",TEST_RESULT,ret);
+    return ret ;
+}
+
+//remove
+int qser_voice_call_removestatehandle_test(int argc, char *argv[], int sp_test)
+{
+    printf("[%s][%d] enter!\n",__FUNCTION__,__LINE__);
+    int ret = 0;
+    ret = qser_voice_call_removestatehandle(qser_hadler);
+    printf("%s%d\n",TEST_RESULT,ret);
+    return ret ;
+
+}
+
+//hold
+int qser_voice_call_hold_test(int argc, char *argv[], int sp_test)
+{
+    printf("[%s][%d] enter!\n",__FUNCTION__,__LINE__);
+    int ret = 0;
+    ret = qser_voice_call_hold(qser_hadler);
+    printf("%s%d\n",TEST_RESULT,ret);
+    return ret ;
+
+}
+
+//unhold
+int qser_voice_call_unhold_test(int argc, char *argv[], int sp_test)
+{
+    printf("[%s][%d] enter!\n",__FUNCTION__,__LINE__);
+    int ret = 0;
+    ret = qser_voice_call_unhold(qser_hadler);
+    printf("%s%d\n",TEST_RESULT,ret);
+    return ret ;
+
+}
+
+
+
diff --git a/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/qser-voice.h b/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/qser-voice.h
new file mode 100755
index 0000000..ed1e341
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/qser-voice.h
@@ -0,0 +1,12 @@
+
+int qser_voice_call_client_init_test(int argc, char *argv[], int sp_test);
+int qser_voice_call_client_deinit_test(int argc, char *argv[], int sp_test);
+int qser_voice_call_start_test(int argc, char *argv[], int sp_test);
+int qser_voice_call_answer_test(int argc, char *argv[], int sp_test);
+int qser_voice_call_end_test(int argc, char *argv[], int sp_test);
+int qser_voice_call_addstatehandler_test(int argc, char *argv[], int sp_test);
+int qser_voice_call_removestatehandle_test(int argc, char *argv[], int sp_test);
+int qser_voice_call_hold_test(int argc, char *argv[], int sp_test);
+int qser_voice_call_unhold_test(int argc, char *argv[], int sp_test);
+
+
diff --git a/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/req_commands.h b/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/req_commands.h
index 49ff14c..5551f4d 100755
--- a/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/req_commands.h
+++ b/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/req_commands.h
@@ -49,6 +49,17 @@
     {"LYNQ_QSER_APN_ADD",lynq_qser_apn_add, "set apn", LYNQ_QSER_APN_ADD},
     {"LYNQ_QSER_APN_DEL",lynq_qser_apn_del, "del apn", LYNQ_QSER_APN_DEL},
     {"LYNQ_QSER_APN_GET_LIST",lynq_qser_apn_get_list, "get apn list", LYNQ_QSER_APN_GET_LIST},
+//QSER VOICE
+    {"LYNQ_QSER_CALL_INIT",qser_voice_call_client_init_test,"qser_voice_call_client_init_test",LYNQ_QSER_CALL_INIT},
+    {"LYNQ_QSER_CALL_DEINIT",qser_voice_call_client_deinit_test,"qser_voice_call_client_deinit_test",LYNQ_QSER_CALL_DEINIT},
+    {"LYNQ_QSER_CALL_START",qser_voice_call_start_test,"qser_voice_call_start_test",LYNQ_QSER_CALL_START},
+    {"LYNQ_QSER_CALL_ANSWER",qser_voice_call_answer_test,"qser_voice_call_answer_test",LYNQ_QSER_CALL_ANSWER},
+    {"LYNQ_QSER_CALL_END",qser_voice_call_end_test,"qser_voice_call_end_test",LYNQ_QSER_CALL_END},
+    {"LYNQ_QSER_CALL_HANDLER",qser_voice_call_addstatehandler_test,"qser_voice_call_addstatehandler_test",LYNQ_QSER_CALL_HANDLER},
+    {"LYNQ_QSER_CALL_REMOVE",qser_voice_call_removestatehandle_test,"qser_voice_call_removestatehandle_test",LYNQ_QSER_CALL_REMOVE},
+    {"LYNQ_QSER_CALL_HOLD",qser_voice_call_hold_test,"qser_voice_call_hold_test",LYNQ_QSER_CALL_HOLD},
+    {"LYNQ_QSER_CALL_UNHOLD",qser_voice_call_unhold_test,"qser_voice_call_unhold_test",LYNQ_QSER_CALL_UNHOLD},
+
     {(char *)NULL, NULL, (char *)NULL , -1},