[Feature][ZXW-5] commit Mobiletek_Tester_RDIT app code

Change-Id: I4725ebbedd2fa63f6f8af189aa37e926d4d5cf58
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
new file mode 100755
index 0000000..90b3164
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/mobiletek-tester-rdit/mobiletek-tester-rdit.bb
@@ -0,0 +1,44 @@
+#inherit externalsrc package
+inherit externalsrc package systemd
+DESCRIPTION = "Mobiletek_Tester_RDIT"
+LICENSE = "MobileTekProprietary"
+LICENSE = "CLOSED"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=b1e07e8d88e26263e71d3a9e2aa9a2ff"
+DEPENDS += "liblynq-call"
+inherit workonsrc
+WORKONSRC = "${TOPDIR}/../src/lynq/packages/apps/Mobiletek_Tester_RDIT"
+
+TARGET_CC_ARCH += "${LDFLAGS}"
+SYSTEMD_PACKAGES = "${PN}"
+SYSTEMD_SERVICE_${PN} = "lynq_ril_service.service"
+FILES_${PN} += "${systemd_unitdir}/system/lynq_ril_service.service"
+FILES_${PN} += "/system/etc/tele/ring ${bindir}"
+#Parameters passed to do_compile()
+EXTRA_OEMAKE = "'RAT_CONFIG_C2K_SUPPORT = ${RAT_CONFIG_C2K_SUPPORT}'\
+                'MTK_MULTI_SIM_SUPPORT = ${MTK_MULTI_SIM_SUPPORT}'\
+                'TARGET_PLATFORM = ${TARGET_PLATFORM}'\
+                'MTK_LED_SUPPORT = ${MTK_LED_SUPPORT}'"
+EXTRA_OEMAKE += "'MOBILETEK_RIL_CFG = ${MOBILETEK_RIL_CFG}'"
+
+EXTRA_OEMAKE += "'MOBILETEK_FOTA_CFG = ${MOBILETEK_FOTA_CFG}'"
+
+#INHIBIT_PACKAGE_STRIP = "1"
+do_compile () {
+	if test "${PACKAGE_ARCH}" = "cortexa7hf-vfp-vfpv4-neon" || test "${PACKAGE_ARCH}" = "cortexa7hf-neon-vfpv4"; then
+		oe_runmake all ROOT=${STAGING_DIR_HOST} OFLAGS="--sysroot=${STAGING_DIR_HOST} -mhard-float"
+	else
+		oe_runmake all ROOT=${STAGING_DIR_HOST} OFLAGS="--sysroot=${STAGING_DIR_HOST}"
+	fi
+}
+
+do_install() {
+	echo "lynq-ril-service PN ${PN}"
+	echo "lynq-ril-service FILES_${PN} ${FILES_${PN}}"
+	echo "lynq-ril-service D ${D}"
+	echo "lynq-ril-service bindir ${bindir}"
+	echo "lynq-ril-service ${D}${bindir}"
+	echo "lynq-ril-service ${S}/Mobiletek_Tester_RDIT"
+	install -d ${D}${bindir}/
+	install -m 0755 ${S}Mobiletek-Tester-RDIT ${D}${bindir}/
+	install -m 0755 ${S}socket-tool ${D}${bindir}/
+}
diff --git a/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/cc.cpp b/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/cc.cpp
new file mode 100755
index 0000000..8337d05
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/cc.cpp
@@ -0,0 +1,41 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <libcall/lynq_call.h>
+#include "cc.h"
+#define TEST_RESULT "lynq_result="
+
+static int handle = 0;
+
+int init_call(int argc, char *argv[], int sp_test)
+{
+    printf("[%s][%d] enter!\n",__FUNCTION__,__LINE__);
+    int ret = -1;
+    int uToken = atoi(argv[1]);
+    ret = lynq_init_call(uToken);
+    printf("%s%d\n",TEST_RESULT,ret);
+    return ret;
+}
+int dial_test(int argc, char *argv[], int sp_test)
+{
+    printf("[%s][%d] enter!\n",__FUNCTION__,__LINE__);
+    int ret = -1;
+    ret = lynq_call(&handle,argv[1]);
+    printf("%s%d\n",TEST_RESULT,ret);
+    return ret;
+}
+int answer_test(int argc, char *argv[], int sp_test)
+{
+    printf("[%s][%d] enter!\n",__FUNCTION__,__LINE__);
+    int ret = -1;
+    ret = lynq_call_answer();
+    printf("%s%d\n",TEST_RESULT,ret);
+    return ret;
+}
+int hungup_test(int argc, char *argv[], int sp_test)
+{
+    printf("[%s][%d] enter!\n",__FUNCTION__,__LINE__);
+    int ret = -1;
+    ret = lynq_call_hungup(&handle);
+    printf("%s%d\n",TEST_RESULT,ret);
+    return ret;
+}
diff --git a/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/cc.h b/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/cc.h
new file mode 100755
index 0000000..a746002
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/cc.h
@@ -0,0 +1,4 @@
+int init_call(int argc, char *argv[], int sp_test);
+int dial_test(int argc, char *argv[], int sp_test);
+int answer_test(int argc, char *argv[], int sp_test);
+int hungup_test(int argc, char *argv[], int sp_test);
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
new file mode 100755
index 0000000..3a07304
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/dispatch.cpp
@@ -0,0 +1,382 @@
+#include <stdio.h>
+#include <unistd.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <sys/types.h>
+#include <pthread.h>
+#include <errno.h>
+
+#include "dispatch.h"
+#include "lynq.h"
+#include "cc.h"
+
+#define SOCKET_BUF_SIZE 512
+typedef struct {
+    char *name;           /* User printable name of the function. */
+    int (*func)(int argc, char *argv[], int sp_test);       /* Function to call to do the job. */
+    char *doc;            /* Documentation for this function.  */
+    int request;
+} COMMAND;
+
+COMMAND commands[] = {
+#include "req_commands.h"
+};
+
+int g_rdit_socket_fd = 0;
+int g_rdit_client_connect = -1;
+static pthread_mutex_t s_startupMutex = PTHREAD_MUTEX_INITIALIZER;
+static pthread_cond_t s_startupCond = PTHREAD_COND_INITIALIZER;
+
+int has_registe_cmd = 0;
+struct sockaddr_un g_remote_addr = {0};
+struct sockaddr_un g_local_addr = {0};
+int g_create_socket = 0;
+int g_start_main_loop = 0;
+
+
+COMMAND* find_command (char *name)
+{
+  register int i;
+
+  for (i = 0; commands[i].name; i++)
+    if (strcmp (name, commands[i].name) == 0)
+      return (&commands[i]);
+
+  return ((COMMAND *)NULL);
+}
+
+const char *requestToString(int request)
+{
+    switch(request)
+    {
+        case LYNQ_DIAL: return "LYNQ_DIAL";
+        case LYNQ_ANSWER: return "LYNQ_ANSWER";
+        case LYNQ_HUNGUP: return "LYNQ_HUNGUP";
+        default: return "<unknown request>";
+    }
+}
+int parse_param(char *cmd, char *argv[], int max_args)
+{
+    char *pos, *pos2;
+    int argc = 0;
+    printf("recive tester cmd=%s\n",cmd);
+    pos = cmd;
+    while (1) {
+        // Trim the space characters.
+        while (*pos == ' ') {
+            pos++;
+        }
+
+        if (*pos == '\0') {
+            break;
+        }
+
+        // One token may start with '"' or other characters.
+        if (*pos == '"' && (pos2 = strrchr(pos+1, '"'))) {
+            argv[argc++] = pos + 1;
+            *pos2 = '\0';
+            pos = pos2 + 1;
+            if(*pos == '\n'){
+                *pos = '\0';
+                pos = pos + 1;
+            }
+
+        } else {
+            argv[argc++] = pos;
+            while (*pos != '\0' && *pos != ' '&& *pos != '\n') {
+                pos++;
+            }
+            *pos++ = '\0';
+
+            if(argc == 1) {
+              char* at_cmd = strstr(argv[0], "RIL_REQUEST_OEM_HOOK_RAW");
+              if(at_cmd != NULL) {
+                while (*pos == ' ') {
+                    pos++;
+                }
+                argv[argc++] = pos;
+                while (*pos != '\0' && *pos != '\n') {
+                    pos++;
+                }
+                *pos++ = '\0';
+                break;
+              }
+            }
+
+        }
+
+        // Check if the maximum of arguments is reached.
+        if (argc == max_args) {
+            break;
+        }
+    }
+
+    return argc;
+}
+dispatch_manager::dispatch_manager()
+{
+    printf("[%s][%d] enter!\n",__FUNCTION__,__LINE__);
+    __init_msg();
+}
+dispatch_manager::~ dispatch_manager(){}
+
+int dispatch_manager::__init_msg()
+{
+    printf("[%s][%d] enter!\n",__FUNCTION__,__LINE__);
+    __request = 0;
+    __argc = 0;
+    __argv = NULL;
+    __socket_name = NULL;
+    return 0;
+}
+int dispatch_manager::__set_request_msg(int req,int argc,char *argv)
+{
+    printf("[%s][%d] enter!\n",__FUNCTION__,__LINE__);
+    printf("requet=%d,argc=%d,argv p=%x\n");
+    __request = req;
+    __argc = argc;
+    __argv = argv;
+}
+int dispatch_manager::set_request_msg(int req,int argc,char *argv)
+{
+    printf("[%s][%d] enter!\n",__FUNCTION__,__LINE__);
+    __set_request_msg(req,argc,argv);
+}
+
+
+int actsvc_cmd_recv(int fd, char *buf, int len)
+{
+    int ret = 0;
+    ret = recv(fd, buf, len, 0);
+    printf("[%d][%s] recv before\n",__LINE__,__FUNCTION__);
+    if (ret < 0)
+    {
+        printf("acti_cmd_recv service select error, ret=%d, error=%s(%d),fd=%d\n", ret,strerror(errno), errno, fd);
+        return LYNQ_E_SOCKET_FAIL;
+    }
+    else if(ret == 0)
+    {
+        printf("acti_cmd_recv service recv error, ret=%d, error=%s(%d),fd=%d\n", ret,strerror(errno), errno, fd);
+        return LYNQ_E_SOCKET_ZERO;
+    }
+    else
+    {
+        printf("[%d][%s] buf is:%s\n",__LINE__,__FUNCTION__,buf);
+        return LYNQ_E_SOCKET_SUCC;
+    }
+}
+
+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)
+{
+    printf("[%d][%s]start create socket\n",__LINE__,__FUNCTION__);
+    printf("domain:%d,type:%d,protocol:%d,port:%d,IP:%s,socket_name:%s,backlog:%d\n",domain,type,protocol,port,IP,socket_name,backlog);
+    int socket_fd = -1;
+    char acBuf[1024] = {0};
+    struct sockaddr_un *local_addr = NULL;
+    local_addr = (struct sockaddr_un *)addr;
+    socket_fd = socket(domain, type,protocol);
+    if(0 > socket_fd)
+    {
+        printf("create socket fail:fd = %d\n",socket_fd);
+        return socket_fd;
+    }
+    switch (domain)
+    {
+        case AF_UNIX:
+        {
+            if (strlen(socket_name) > sizeof(local_addr->sun_path) - 1)
+            {
+                printf("Server socket path too long: %s\n", socket_name);
+                return (-strlen(socket_name));
+            }
+            if(cs == 0)//0:service 1:client
+            {
+                printf("remove %s\n", socket_name);
+                if (remove(socket_name) == -1 && errno != ENOENT)
+                { 
+                    printf("remove-%s fail and errno:%d\n", socket_name,errno);
+                }
+            }
+            if(type == SOCK_STREAM)
+            {
+                while(access(socket_name, R_OK)==0)
+                {
+                    printf("%s still exist\n", socket_name);
+                    usleep(10);
+                }
+            }
+            local_addr->sun_family = AF_UNIX;
+            sprintf(local_addr->sun_path, socket_name);
+            if(cs == 0)//0:service 1:client
+            {
+                if(bind(socket_fd, (struct sockaddr *)local_addr, sizeof(struct sockaddr_un)) < 0)
+                {
+                    printf("bind failed name=[%s] reason=[%s]\n", socket_name, strerror(errno));
+                    //printf("[%d][%s]bind fail and errno: %d",LINE,FUNC,errno);
+                    close(socket_fd);
+                    return -1;
+                }
+                if(type == SOCK_STREAM)
+                {
+                    if(listen(socket_fd,backlog) == -1)
+                    {
+                        printf("[%d]listen fd: %dfail\n",__LINE__);
+                        close(socket_fd);
+                        return -1;
+                    }
+                }
+            }
+            else
+            {
+                printf("init this client\n");
+            }
+            break;
+        }
+        case AF_INET:
+        {
+            break;
+        }
+        default:
+            break;
+    }
+    return socket_fd;
+}
+
+int dispatch_manager::init_socket(char *socket_name)
+{
+    socklen_t client_len;
+    int ret;
+    char parser_buf[SOCKET_BUF_SIZE];
+    TryNewSocket:
+    g_rdit_socket_fd = create_socket(AF_UNIX, SOCK_DGRAM,0, 0, NULL,socket_name, (void *)&g_local_addr, 2, 0);
+    if(0 > g_rdit_socket_fd)
+    {
+        printf("init socket fail and fd:%d",g_rdit_socket_fd);
+        g_create_socket++;
+        if(g_create_socket == 10)
+        {
+            printf("create_socket max try count is %d\n", g_create_socket);
+            return LYNQ_E_SOCKET_CREATE_FAIL;
+        }
+        else
+        {
+            printf("create_socket try again %d\n", g_create_socket);
+            usleep(500*1000);
+            goto TryNewSocket;
+        }
+    }
+    set_socket_fd(g_rdit_socket_fd);
+    return LYNQ_E_SUCCESS;
+}
+
+void *socket_read_loop(void *param)
+{
+    socklen_t client_len;
+    int ret = -1;
+    int socket_fd = -1;
+    char parser_buf[SOCKET_BUF_SIZE];
+    char *argv[32] = {0};
+    int  argc = 0;
+    int *temp = (int*)param;
+    printf("[%d][%s] TryNewLink!\n", __LINE__,__FUNCTION__);
+    pthread_mutex_lock(&s_startupMutex);
+    g_start_main_loop = 1;
+    pthread_cond_broadcast(&s_startupCond);
+    pthread_mutex_unlock(&s_startupMutex);
+    client_len = sizeof(g_local_addr);
+    socket_fd = *temp;
+    printf("[%d][%s] socket_fd = %d,%p!\n",__LINE__,__FUNCTION__,socket_fd,temp);
+#if 0
+    int conn = accept(socket_fd,(struct sockaddr *) &g_local_addr, &client_len);
+    if (conn <= 0)
+    {
+        printf("[%d][%s] accept error!",__LINE__,__FUNCTION__);
+        close(conn);
+        return NULL;
+    }
+    printf("Accept a client , fd is %d", conn);
+    if(g_rdit_client_connect >= 0)
+    {
+        printf("g_rdit_client_connect need close!");
+        close(g_rdit_client_connect);
+    }
+    g_rdit_client_connect = conn;
+#endif
+    /* tranlate data */
+    while (true)
+    {
+        memset(parser_buf, 0, sizeof(parser_buf));
+        ret = actsvc_cmd_recv(socket_fd, parser_buf, SOCKET_BUF_SIZE);
+        if (ret == LYNQ_E_SOCKET_FAIL)
+        {
+            printf("[%d][%s] LYNQ_E_SOCKET_FAIL receive CMD error\n",__LINE__,__FUNCTION__);
+            continue;
+        }
+        argc = parse_param(parser_buf,argv,32);
+        if(argc < 1)
+        {
+            printf("%s: error input.\n", parser_buf);
+            continue;
+        }
+        for(int i = 0;i < argc;i++)
+        {
+            printf("argc:%d---argv = %s\n",i,argv[i]);
+        }
+        COMMAND *command =  find_command(argv[0]);
+        if(!command)
+        {
+            printf("%s: No such command for MobileTek_Tester_RDIT\n", argv[0]);
+            continue;
+        }
+        (*(command->func))(argc,argv,0);
+    }
+    return NULL;
+}
+
+
+void dispatch_manager::start_main_loop()
+{
+    printf("[%d][%s] enter!\n",__LINE__,__FUNCTION__);
+    g_start_main_loop = 0;
+    pthread_t s_tid_dispatch;
+    pthread_mutex_lock(&s_startupMutex);
+    pthread_attr_t attr;
+    pthread_attr_init(&attr);
+    pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
+    int socket_fd = get_socket_fd();
+    printf("[%d][%s] socket_fd = %d,%p!\n",__LINE__,__FUNCTION__,socket_fd,&socket_fd);
+    int result = pthread_create(&s_tid_dispatch, &attr,socket_read_loop, (void *)&socket_fd);
+    if (result != 0) {
+        printf("Failed to create dispatch thread: %s\n", strerror(result));
+        goto done;
+    }
+   
+    while (g_start_main_loop == 0) {
+        pthread_cond_wait(&s_startupCond, &s_startupMutex);
+    }
+    //warren delete,beacuse of update at fwk.
+    /*mobiletek add*
+    s_started = 0;
+    result = pthread_create(&s_tid_dispatch, &attr, eventLoop_at, NULL);
+    if (result != 0) {
+        printf("Failed to create dispatch thread: %s", strerror(result));
+        goto done;
+    }
+
+    while (s_started == 0) {
+        pthread_cond_wait(&s_startupCond, &s_startupMutex);
+    }
+    *mobiletek add
+    result = pthread_create(&s_tid_dispatch, &attr, responseLoop, NULL);
+    if (result != 0) {
+        printf("Failed to create response dispatch thread: %s", strerror(result));
+        goto done;
+    }
+
+    while (s_responseDispatch == 0) {
+        pthread_cond_wait(&s_startupCond, &s_startupMutex);
+    }
+    */
+done:
+    pthread_mutex_unlock(&s_startupMutex);
+}
diff --git a/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/dispatch.h b/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/dispatch.h
new file mode 100755
index 0000000..5c3fb49
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/dispatch.h
@@ -0,0 +1,53 @@
+/*============================================================================= 
+#     FileName: dispatch.h
+#     Desc: 
+#     Author: Warren
+#     Version: V1.0
+#     LastChange: 2023-04-17 
+#     History: 
+=============================================================================*/
+#ifndef __LYNQ_DISPATCH__
+#define __LYNQ_DISPATCH__
+#ifdef __cplusplus
+extern "C" {
+#endif
+class dispatch_manager
+{
+    public:
+        dispatch_manager(void);
+        virtual ~ dispatch_manager();
+        char *get_socket_name()
+        {
+            return __socket_name;
+        }
+        int get_request_msg()
+        {
+            return __request;
+        }
+        int get_socket_fd()
+        {
+            return __socket_fd;
+        }
+        void set_socket_fd(int fd)
+        {
+            __socket_fd = fd;
+        }
+        int set_request_msg(int req,int argc,char *argv);
+        int init_socket(char *socket_name);
+        void start_main_loop();
+        int dispatch_request();
+        int run_event();
+        
+    private:
+        int __init_msg();
+        int __set_request_msg(int req,int argc,char *argv);
+        int __request;
+        int __argc;
+        int __socket_fd;
+        char *__argv;
+        char *__socket_name;
+};
+#ifdef __cplusplus
+}
+#endif
+#endif
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
new file mode 100755
index 0000000..40cc25b
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/lynq.h
@@ -0,0 +1,17 @@
+
+typedef enum
+{
+    LYNQ_E_SUCCESS=0,
+    LYNQ_E_SOCKET_CREATE_FAIL,
+    LYNQ_E_SOCKET_FAIL,
+    LYNQ_E_SOCKET_ZERO,
+    LYNQ_E_SOCKET_SUCC,
+    LYNQ_E_SOCKET_LINK_FAIL
+}LYNQ_E_T;
+
+#define LYNQ_BASE 100
+#define LYNQ_DIAL LYNQ_BASE + 1
+#define LYNQ_ANSWER LYNQ_BASE + 2
+#define LYNQ_HUNGUP LYNQ_BASE + 3
+#define LYNQ_CALL_INIT LYNQ_BASE + 4
+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/main.cpp b/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/main.cpp
new file mode 100755
index 0000000..d3cb37f
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/main.cpp
@@ -0,0 +1,54 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include "dispatch.h"
+#include "lynq.h"
+dispatch_manager *g_dispatch;
+
+int init_msg_dispatch(char * socket_name,int token)
+{
+    int ret;
+    g_dispatch = new dispatch_manager;
+    if(g_dispatch == NULL)
+    {
+        printf("[%s][%d] new class fail!\n",__FUNCTION__,__LINE__);
+        return -1;
+    }
+    ret = g_dispatch->init_socket(socket_name);
+    if(ret!=LYNQ_E_SUCCESS)
+    {
+        printf("[%s][%d] create socket fail!\n",__FUNCTION__,__LINE__);
+        return ret;
+    }
+    g_dispatch->start_main_loop();
+    return LYNQ_E_SUCCESS;
+}
+int main(int argc,char*argv[])
+{
+    printf("[%s][%d] enter\n",__FUNCTION__,__LINE__);
+    int ret = 0;
+    char socket_name[64]={0};
+    if(argc < 3)
+    {
+        printf("[%s][%d] please input socket name and token\n",__FUNCTION__,__LINE__);
+        exit(1);
+    }
+    if((argv[1] != NULL) && (argv[2]!=NULL))
+    {
+        sprintf(socket_name,"/var/socket/%s",argv[1]);
+        if(LYNQ_E_SUCCESS != init_msg_dispatch(socket_name, atoi(argv[2])))
+        {
+            exit(1);
+        }
+    }
+    else
+    {
+	printf("[%s][%d] param fail!\n",__FUNCTION__,__LINE__);
+        exit(1);
+    }
+    while (1)
+    {
+        sleep(1);
+    }
+    return 0;
+}
diff --git a/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/makefile b/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/makefile
new file mode 100755
index 0000000..11720f6
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/makefile
@@ -0,0 +1,57 @@
+SHELL = /bin/sh
+RM = rm -f
+
+LOCAL_CFLAGS := -Wall \
+                -std=gnu++14 \
+                -g -Os \
+                -flto \
+
+ifeq ($(strip $(TARGET_PLATFORM)), T106)
+LOCAL_CFLAGS += -DBINDER_IPC_32BIT=1 -DHAVE_ENDIAN_H -DHAVE_PTHREADS -DHAVE_SYS_UIO_H -DHAVE_POSIX_FILEMAP -DHAVE_STRLCPY -DHAVE_PRCTL -DHAVE_MEMSET16 -DHAVE_MEMSET32 -DANDROID_SMP=0
+endif
+
+LOCAL_CFLAGS += -Wno-error=format-security
+
+LOCAL_PATH   = .
+
+LOCAL_C_INCLUDES = \
+  -I. \
+
+
+LOCAL_LIBS := \
+    -L. \
+    -ldl \
+    -lstdc++ \
+    -lpthread \
+    -llynq-call 
+
+
+
+SOURCES = main.cpp cc.cpp dispatch.cpp
+SOURCES_TOOL = dispatch.cpp socket-tool.cpp
+
+EXECUTABLE = Mobiletek-Tester-RDIT
+
+EXEC_TOOL = socket-tool
+
+OBJECTS=$(SOURCES:.cpp=.o)
+
+OBJECTS_TOOL=$(SOURCES_TOOL:.cpp=.o)
+all: $(EXECUTABLE) $(EXEC_TOOL)
+
+$(EXECUTABLE): $(OBJECTS)
+	$(CXX) $(OBJECTS) $(LOCAL_LIBS) $(LOCAL_CFLAGS) $(LOCAL_C_INCLUDES) -o $@
+
+%.o : %.cpp
+	$(CXX) $(LOCAL_C_INCLUDES) $(LOCAL_CFLAGS) $(LOCAL_LIBS) -o $@ -c $<
+
+$(EXEC_TOOL): $(OBJECTS_TOOL)
+	$(CXX) $(OBJECTS_TOOL) $(LOCAL_LIBS) $(LOCAL_CFLAGS) $(LOCAL_C_INCLUDES) -o $@
+
+%.o : %.cpp
+	$(CXX) $(LOCAL_C_INCLUDES) $(LOCAL_CFLAGS) $(LOCAL_LIBS) -o $@ -c $<
+
+.PHONY: clean
+clean:
+	$(RM) $(OBJECTS) $(EXECUTABLE)
+	$(RM) $(OBJECTS_TOOL) $(EXECUTABLE)
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
new file mode 100755
index 0000000..e20d230
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/req_commands.h
@@ -0,0 +1,6 @@
+//CC
+    {"LYNQ_DIAL",dial_test, "dial a call", LYNQ_DIAL},
+    {"LYNQ_CALL_INIT",init_call, "init the call lib", LYNQ_CALL_INIT},
+    {"LYNQ_ANSWER",answer_test, "answer a call", LYNQ_ANSWER},
+    {"LYNQ_HUNGUP",hungup_test, "hungup a call", LYNQ_HUNGUP},
+    {(char *)NULL, NULL, (char *)NULL , -1},
diff --git a/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/socket-tool.cpp b/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/socket-tool.cpp
new file mode 100755
index 0000000..24e4f22
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/socket-tool.cpp
@@ -0,0 +1,48 @@
+#include <stdio.h>
+#include <unistd.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <sys/types.h>
+#include <pthread.h>
+#include <errno.h>
+#include "lynq.h"
+
+struct sockaddr_un g_client_local_addr = {0};
+
+int main(int argc,char*argv[])
+{
+    int client_socket_fd = -1;
+    char socket_name_client[64]={0};
+    char socket_name_service[64]={0};
+    memset(&g_client_local_addr,0,sizeof(g_client_local_addr));
+    socklen_t addrlen = sizeof(g_client_local_addr);
+    if(argc < 3)
+    {
+        printf("please input socket name and msg\n");
+    }
+    if((argv[1] != NULL) && (argv[2]!=NULL))
+    {
+        sprintf(socket_name_service,"/var/socket/%s",argv[1]);
+        //sprintf(socket_name_client,"/var/socket/%s-client",argv[1]);
+        client_socket_fd = create_socket(AF_UNIX, SOCK_DGRAM,0, 0, NULL,socket_name_service, (void *)&g_client_local_addr, 2, 1);
+        if(0 > client_socket_fd)
+        {
+            printf("init socket fail and fd:%d\n",client_socket_fd);
+            return -1;
+        }
+    }
+    else
+    {
+        return -1;
+    }
+    //g_client_local_addr.sun_family = AF_UNIX;
+    //sprintf(g_client_local_addr.sun_path, socket_name_service);
+    int data_len = sendto(client_socket_fd, argv[2], strlen(argv[2]), 0, (sockaddr*)&g_client_local_addr,addrlen);
+    //int data_len = send(client_socket_fd,argv[2],strlen(argv[2]),0);
+    if(data_len <= 0 )
+    {
+         printf("end msg fail er_code:%s\n",strerror(errno));
+    }
+    close(client_socket_fd);
+    return 0;
+}