[Feature] add GA346 baseline version

Change-Id: Ic62933698569507dcf98240cdf5d9931ae34348f
diff --git a/packages/apps/lynq-function-test/src/audio_test.cpp b/packages/apps/lynq-function-test/src/audio_test.cpp
new file mode 100644
index 0000000..c99e61e
--- /dev/null
+++ b/packages/apps/lynq-function-test/src/audio_test.cpp
@@ -0,0 +1,127 @@
+
+
+
+/*============================================================================= 
+**     FileName: audio_test.cpp
+**     Desc: about function test
+**     Author: zhouqunchao
+**     Version: V1.0
+**     LastChange: 2021-08-18 
+**     History: 
+=============================================================================*/
+
+
+#include "function_common.h"
+#include <log/log.h>
+#include "audio_test.h"
+#include <unistd.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include "liblog/liblog.h"
+#include "liblog/lynq_deflog.h"
+#ifdef __cplusplus
+extern "C" {
+#endif 
+#include "liblynq-media/lynq_medial.h"
+#include "liblynq-media/lynq_modem_voice.h"
+#ifdef __cplusplus
+}
+#endif 
+void *media_handle = NULL;
+int check_spk_volume(int volume_level)
+{
+    if((volume_level>VOLUME_MAX)||(volume_level<VOLUME_MIN)){
+      //  LYVERBLOG("+[audio][spk_volume_set]: error num = %d\n", AUDIO_PRAME_ERROR);
+	    return 0;
+	}
+	return 1;
+}
+int check_mic_volume(int volume_level)
+{
+    if((volume_level>VOLUME_MAX)||(volume_level<VOLUME_MIN)){
+        LYVERBLOG("+[audio][mic_volume_set]: error num = %d\n", AUDIO_PRAME_ERROR);
+	    return 0;
+	}
+	return 1;
+}
+int audio_test(char *api,char *string) {
+    char *argv[100] = {0};
+	int spk_volume,mic_volume;
+    parseParameters(string,argv);
+    for(int i = 0;i < 10;i++){
+        printf("argv[%d] = %s \n", i, argv[i]);
+    }
+    if(!strcmp(api, "spk_volume_set")){
+        
+        int volume_level = atoi(argv[0]);
+        int ret;
+        if(check_spk_volume(volume_level))
+        {
+            ret = lynq_set_spk_volume(volume_level);
+            if(ret == 1)			
+            LYVERBLOG("+[audio][spk_volume_set][success]\n");
+            else
+            LYVERBLOG("+[audio][spk_volume_set]: error num = %d\n",  AUDIO_PRAME_ERROR);
+		}
+		else
+		{
+            LYVERBLOG("+[audio][spk_volume_set]: error num = %d\n",  AUDIO_PRAME_ERROR);
+            return	0;
+		}
+    }
+    else if(!strcmp(api, "spk_volume_get")){    
+        spk_volume = lynq_get_spk_volume();	
+        LYVERBLOG("+[audio][spk_volume_get][success]: data = %d\n",spk_volume);
+    }
+    else if(!strcmp(api,"mic_volume_set")){
+        int volume_level = atoi(argv[0]);
+        if(check_mic_volume(volume_level))
+        {
+            lynq_set_spk_volume(volume_level);	
+            LYVERBLOG("+[audio][spk_volume_set][success]\n");
+        }
+        else
+        {
+            LYVERBLOG("+[audio][mic_volume_set]: error num = %d\n",  AUDIO_PRAME_ERROR);
+            return	0;
+        }
+    }
+    else if(!strcmp(api, "mic_volume_get")){    
+        mic_volume = lynq_get_spk_volume();	
+        LYVERBLOG("+[audio][mic_volume_get][success]: data = %d\n",mic_volume);
+    }
+    else if(!strcmp(api, "record_start")){ 
+       // if((access(argv[0],F_OK))!=-1)
+        //{
+           lynq_incall_record(argv[0]);
+           LYVERBLOG("+[audio][record_start][success]");
+       // }
+       // else
+        //{
+ //          LYVERBLOG("+[audio][record_start]: error num = %d\n", AUDIO_PRAME_ERROR);
+       // }
+    }
+    else if(!strcmp(api, "record_stop")){ 
+        lynq_stop_record();
+        LYVERBLOG("+[audio][record_stop][success]");	
+    }
+    else if(!strcmp(api,"play_audio")){
+        if((access(argv[0],F_OK))!=-1){	
+           media_handle = lynq_media_play_audio(argv[0]);
+           LYVERBLOG("+[audio][play_audio][success]");
+        }
+        else
+        {
+           LYVERBLOG("+[audio][play_audio]: error num = %d\n", AUDIO_PRAME_ERROR);
+        }
+    }
+    else if(!strcmp(api,"stop_audio")){
+          lynq_media_stop_audio(media_handle);
+    }
+    else {
+        LYVERBLOG("+[command error]:error num = %d\n", AUDIO_API_ERROR);
+    }
+    return 0;
+}
diff --git a/packages/apps/lynq-function-test/src/audio_test.h b/packages/apps/lynq-function-test/src/audio_test.h
new file mode 100644
index 0000000..c596926
--- /dev/null
+++ b/packages/apps/lynq-function-test/src/audio_test.h
@@ -0,0 +1,10 @@
+typedef enum {
+   AUDIO_SUCCESS  = 0 ,
+   AUDIO_API_ERROR ,
+   AUDIO_PRAME_ERROR ,
+
+}AUDIO_RESULT;
+
+int audio_test(char *api,char *string);
+
+
diff --git a/packages/apps/lynq-function-test/src/commands.h b/packages/apps/lynq-function-test/src/commands.h
new file mode 100644
index 0000000..71316d4
--- /dev/null
+++ b/packages/apps/lynq-function-test/src/commands.h
@@ -0,0 +1,60 @@
+/*============================================================================= 

+**     FileName: command.h

+**     Desc: about function test

+**     Author: Warren

+**     Version: V1.0

+**     LastChange: 2021-02-26 

+**     History: 

+=============================================================================*/

+//call api

+{"dial",eventDial, "dial a call"},

+{"an",eventAnswer,"answer in coming call"},

+{"atan",eventAutoAnswer,"auto answer mode"},

+{"stme",eventSetMute, "set mute"},

+{"gtme",eventGetMute, "get mute status"},

+{"lcfc",eventLastCallFailCause, "last call fail cause"},

+{"hup",eventCallHangUp, "hang up a call"},

+{"udub",eventRejectCall, "hang up all call or reject a call"},

+{"dtmf",eventSetDTMF, "send DTMF number"},

+{"dtmfv",eventSetDTMFVolume, "set DTMF volume"},

+{"hwc",eventHangupWatingForCall, "hang up waiting or background call"},

+{"hfrb",eventHangupForegroundResumeBackground, "hang up foregound call and resume background call"},

+{"swha",eventSwitchWaitOrHoldAndActiveCall, "switch waiting or holding call to active"},

+{"dmc",eventDoMultiConference, "do multi conference"},

+{"och",eventOthercallHold, "separate conferece"},

+//data api

+{"edc",eventSetupDataCall, "enable data call"},

+{"ddc",eventDeactiveDataCall, "disable data call"},

+{"gdcl",eventGetDataCalllist,"get data call list"},

+//network

+{"qop",eventQueryOperator, "query operator"},

+{"qnsm",eventQueryNetSelectMode, "query network selection mode"},

+{"snsm",eventSetNetSelectMode,"set network selection mode"},

+{"qan",eventQueryAvailableNetwork, "query available network"},

+{"qrs",eventQueryRegistrationState, "query registration state"},

+{"gpnt",eventQueryPrefferredNetworkType,"get preferred network type"},

+{"spnt",eventSetPrefferredNetworkType, "set preferred network type"},

+{"gcil",eventQueryCellInfo, "get cell info list"},

+{"sucilr",eventSetUnsolCellInfoListrate,"set unsol cell info list rate"},

+{"gncid",eventQueryNeighboringCellids, "get neighboring cell IDs"},

+{"sbm",eventSetBandMode, "set band mode"},

+{"qabm",eventQueryAvailableBandmode,"query available band mode"},

+{"rpo",eventRadioOn,"set radio power on/off"},

+{"vrt",eventQueryRadioTech,"voice radio tech"},

+{"sst",eventSolicitedSignalStrength,"singal strength"},

+{"mpo",eventModemOn,"modem power"},

+//sim api

+{"gss",eventGetSimStatus, "get sim status"},

+{"gimsi",eventGetImsi, "get IMSI"},

+//sms api

+{"ssm",eventSendSms,"send sms"},

+{"iss",eventImsSendSms,"send  sms over IMS"},

+{"wsts",eventWriteSmsToSim,"write sms to sim card"},

+{"rsms",eventReportSmsMemoryStatus,"report sms memory state"},

+{"dsos",eventDeletSmsOnSim,"delete sms on sim"},

+{"gsmsc",eventGetSmscAddress,"get smsc address"},

+{"ssmsc",eventSetSmscAddress,"set smsc address"},

+{"sstm",evenStoreSmsToMemory,"srore sms to memory"},

+{"gsfm",eventGetSmsFromMemory,"get sms from memory"},

+{"dmfm",eventDeleteMessageFromMemory,"delete sms from memory"},

+{(char *)NULL, NULL, (char *)NULL},

diff --git a/packages/apps/lynq-function-test/src/fota_test.cpp b/packages/apps/lynq-function-test/src/fota_test.cpp
new file mode 100644
index 0000000..35ee638
--- /dev/null
+++ b/packages/apps/lynq-function-test/src/fota_test.cpp
@@ -0,0 +1,286 @@
+/*============================================================================= 

+**     FileName: fota_test.c

+**     Desc: about function test

+**     Author: victor

+**     Version: V1.0

+**     LastChange: 2021-10-11

+**     History: 

+=============================================================================*/

+#include "function_common.h"

+#include <log/log.h>

+#include <stdio.h>

+#include <string.h>

+#include <stdlib.h>

+#include "fota_test.h"

+#include "fcntl.h"

+#include "mtk_device_wrap.h"

+

+

+#ifdef __cplusplus

+extern "C" {

+#endif

+#include "include/iot_rock.h"

+#include "ftp/lynq_ftp.h"

+#ifdef __cplusplus

+}

+#endif

+

+lynq_ftp_socker_info ftp_log_info;
+

+#define UPDATA_ADDR "/tmp/fota.delta"
+#define READ_BLOCK_SIZE 0x40000

+

+int lynq_fota_md5_flag = -1;

+

+#if 0
+#define FLASH_DEV_DELTA       "/dev/disk/by-partlabel/delta"
+#else
+#define FLASH_DEV_DELTA       "/dev/mtd41"	
+#endif

+

+

+

+#if 0

+#define BUF_SIZE 		1024

+int lynq_fota_str_arr(char *str, char *substr, char parts[][BUF_SIZE])

+{         

+	char *p = NULL;  

+	char *q = NULL;		

+	char tmp[BUF_SIZE] = {0};	

+	char end[BUF_SIZE] = {0};			

+	int i = 0, j = 0, k = 0, par_num=0;

+

+	char *start = strdup(str);	

+

+	while(*str != '\0')    

+	{        

+		p = str;        

+		q = substr;		

+		tmp[i] = *str;		

+		i++;

+		

+		while((*p == *q) && (*p != '\0') && (*q != '\0'))        

+		{            

+			p++;            

+			q++;        

+		}         

+		if(*q == '\0')

+		{			

+			memset(end, 0, sizeof(end));			

+			strcpy(end, p);

+

+			memset(parts[j], 0, sizeof(parts[j]));

+			

+			j == 0 ? memcpy(parts[j], tmp, strlen(tmp)-1) : memcpy(parts[j], tmp+1, strlen(tmp)-2) ;			

+

+			j++;			

+			memset(tmp, 0, sizeof(tmp));			

+			i = 0;			            

+			par_num++;         

+		}		

+

+		str++;

+	}	

+	

+	

+	if (!par_num) {

+		LYDBGLOG("[%s-%d] cmd is error!!!\n", __FUNCTION__, __LINE__);

+		LYVERBLOG("+[thhandle]: error \n");

+		return -1;

+	}

+		

+	

+	if (strcmp(end, "") != 0) {		

+		memset(parts[j], 0, sizeof(parts[j]));

+		memcpy(parts[j], tmp+1, strlen(tmp)-2);

+	}

+

+	for (i = 0 ; i < par_num + 1 ; i++)

+		memcpy(parts[i], strchr(parts[i],'"')+1,strlen(parts[i]));	

+	

+	return par_num; 			

+}

+#endif

+

+int lynq_ftp_download_fota_package(char *string[])

+{

+

+   sprintf(ftp_log_info.sevname,"%s",string[1]);

+   LYVERBLOG("[+UP]: sevname:%s\n",ftp_log_info.sevname);

+    ftp_log_info.portnum = atoi(string[2]);

+  LYVERBLOG("[+UP]: portnum:%d\n",ftp_log_info.portnum);

+ 

+   sprintf(ftp_log_info.username,"%s",string[3]);

+   sprintf(ftp_log_info.pw,"%s",string[4]);

+LYVERBLOG("[+UP]: username:%s\n",ftp_log_info.username);

+LYVERBLOG("[+UP]: pw:%s\n",ftp_log_info.pw);

+

+   sprintf(ftp_log_info.is_pasv_mode,"%s",string[5]);

+   sprintf(ftp_log_info.file_type,"%s",string[6]);

+   sprintf(ftp_log_info.put_opt,"%s",string[7]);

+

+   sprintf(ftp_log_info.getfilename_path,"%s",string[8]);

+   sprintf(ftp_log_info.getfilename,"%s",string[9]);

+  LYVERBLOG("[+UP]: getfilename_path:%s\n",ftp_log_info.getfilename_path);

+
+   LYVERBLOG("[+UP]: Download the FTP data start\n");

+   lynq_ftp_login(&ftp_log_info);
+   lynq_ftp_download(&ftp_log_info);
+   LYVERBLOG("[+UP]: Download the FTP data end\n");

+

+   return 0;

+}

+

+int lynq_md5_fota_package(char *string[])

+{

+    int ret = 0;

+    int fd_down,size,fd_target;

+    char delta_data[READ_BLOCK_SIZE];

+    char input_md5_data[64] = {0};

+	

+    sprintf(input_md5_data,"%s",string[0]);

+//LYVERBLOG("[+UP]: input_md5_data:%s\n",input_md5_data);

+	lynq_fota_md5_flag = lynq_md5_file_verfy(UPDATA_ADDR, input_md5_data);

+	if(lynq_fota_md5_flag == 0)

+	{

+		LYVERBLOG("[+UP]: md5 fota package success\n");

+	}

+	else

+	{

+		LYVERBLOG("[+UP]: md5 fota package fail\n");

+		return 1;

+	}

+

+	   fd_down = open(UPDATA_ADDR,O_RDONLY);

+		if (fd_down < 0) {

+			LYVERBLOG("[+UP]: open source  error\n");

+		    return 1;

+		}

+

+	    fd_target = mtk_device_wrap_open(FLASH_DEV_DELTA,O_RDWR);

+	 

+	    if (fd_target < 0) {

+	       close(fd_down);

+		LYERRLOG("+[UA]: open target  error\n");

+	        return 1;

+	    } 

+

+		LYVERBLOG("[+UP]: Get ftp data write to delta\n");

+		while(( size = read(fd_down,delta_data,READ_BLOCK_SIZE))>0) {

+	    	   mtk_device_wrap_write(fd_target,delta_data,READ_BLOCK_SIZE);

+		   memset(delta_data,0,READ_BLOCK_SIZE);

+	    }

+		

+		LYVERBLOG("[+UP]: Store upgrade data to delta success\n");

+		

+		mtk_device_wrap_close(fd_target);

+		close(fd_down);

+		

+		return 0;

+}

+

+#if 0

+int lynq_md5_fota_package_new(char *string[])

+{

+    int ret = 0;

+    int fd_down,size,fd_target;

+    int total_len = 0,pack_len = 0;

+    char delta_data[READ_BLOCK_SIZE];

+    char input_md5_data[64] = {0};

+	

+    sprintf(input_md5_data,"%s",string[0]);

+    pack_len = atoi(string[1]);

+//LYVERBLOG("[+UP]: input_md5_data:%s\n",input_md5_data);

+	lynq_fota_md5_flag = md5_file_verfy_new(FLASH_DEV_DELTA, input_md5_data,pack_len);

+	if(lynq_fota_md5_flag == 0)

+	{

+		LYVERBLOG("[+UP]: md5 fota package success\n");

+	}

+	else

+	{

+		LYVERBLOG("[+UP]: md5 fota package fail\n");

+		return 1;

+	}

+

+	   fd_down = open(UPDATA_ADDR,O_RDONLY);

+		if (fd_down < 0) {

+			LYVERBLOG("[+UP]: open source  error\n");

+		    return 1;

+		}

+

+	    fd_target = mtk_device_wrap_open(FLASH_DEV_DELTA,O_RDWR);

+	 

+	    if (fd_target < 0) {

+	       close(fd_down);

+		LYERRLOG("+[UA]: open target  error\n");

+	        return 1;

+	    } 

+

+		LYVERBLOG("[+UP]: Get ftp data write to delta\n");

+		while(( size = read(fd_down,delta_data,READ_BLOCK_SIZE))>0) {

+	    	   mtk_device_wrap_write(fd_target,delta_data,READ_BLOCK_SIZE);

+		   memset(delta_data,0,READ_BLOCK_SIZE);

+	    }

+		LYVERBLOG("[+UP]: Store upgrade data to delta success\n");

+		

+		mtk_device_wrap_close(fd_target);

+		close(fd_down);

+		

+		return 0;

+}

+#endif

+int lynq_fota_func_test(void)

+{

+	int first_run = 1; 

+	LYVERBLOG("+[UA]: Upgrade to start\n");

+	if(lynq_fota_md5_flag == 0)

+	{
+		lynq_rock_main(first_run);

+	}

+	else

+	{

+		LYVERBLOG("+[UA]: MD5 verify fail\n");

+		return 1;

+	}

+	LYVERBLOG("+[UA]: Upgrade to end\n");

+	return 0;

+}

+

+int fota_test(char *api,char *string) 

+{

+//    char argv[20][BUF_SIZE] = {0};

+//    int line = lynq_fota_str_arr(string, "\"&", argv)+1;

+    char *argv[100] = {0};

+    parseParameters(string,argv);

+    if(!strcmp(api, "download"))

+   {

+      if(!(strcmp(argv[0], "ftp")))

+      	{

+		lynq_ftp_download_fota_package(argv);

+	 }

+	 else if(!(strcmp(argv[0], "http")))

+	 {

+

+	 }

+

+    }

+   else if(!(strcmp(api, "md5")))

+   {

+        lynq_md5_fota_package(argv);

+   }

+//   else if(!(strcmp(api, "md5new")))

+//   {

+//        lynq_md5_fota_package_new(argv);

+//   }

+    else if(!(strcmp(api, "upgrade")))

+   {

+        lynq_fota_func_test();

+   }

+   else

+   {

+	LYVERBLOG("+[fota][fota_test]: fota api error!!!\n");

+   }

+    return 0;

+}

+

+

diff --git a/packages/apps/lynq-function-test/src/fota_test.h b/packages/apps/lynq-function-test/src/fota_test.h
new file mode 100644
index 0000000..06187d8
--- /dev/null
+++ b/packages/apps/lynq-function-test/src/fota_test.h
@@ -0,0 +1,4 @@
+#ifndef __FOTA_TEST_H__

+#define __FOTA_TEST_H__

+int fota_test(char *api,char *string);

+#endif //__FOTA_TEST_H__
\ No newline at end of file
diff --git a/packages/apps/lynq-function-test/src/function_common.cpp b/packages/apps/lynq-function-test/src/function_common.cpp
new file mode 100644
index 0000000..1771661
--- /dev/null
+++ b/packages/apps/lynq-function-test/src/function_common.cpp
@@ -0,0 +1,188 @@
+/*============================================================================= 

+**     FileName: function_common.cpp

+**     Desc: about function test

+**     Author: Warren

+**     Version: V1.0

+**     LastChange: 2021-02-26 

+**     History: 

+=============================================================================*/

+/*Get private menu,take only the first two parameters, and return the head pointer of the remaining string*/

+#include <stdio.h>

+#include <string.h>

+#include "function_common.h"

+#include <sys/time.h>

+#include <unistd.h>

+void set_timer(int it_interval_sec, int it_interval_usec,int it_value_sec,int it_value_usec)

+{

+    struct itimerval itv, oldtv;

+    itv.it_interval.tv_sec = it_interval_sec;

+    itv.it_interval.tv_usec = it_interval_usec;

+    itv.it_value.tv_sec = it_value_sec;

+    itv.it_value.tv_usec = it_value_usec;

+    setitimer(ITIMER_REAL, &itv, &oldtv);

+}

+ 

+int sleep_with_restart(int second)

+{

+    int left = second;

+    while (left > 0) 

+    {

+        left = sleep(left);

+    }

+    return 0;

+}

+int millli_sleep_with_restart(int millisecond)

+{

+    int left = millisecond*1000;

+    while (left > 0) 

+    { 

+        left = usleep(left);

+    }

+

+    return 0;

+}

+//Get private menu,take only the first two parameters, and return the head pointer of the remaining string

+char* getMenu(char * str,char *argv[])

+{

+    char* pos = str;

+    int menu = 0;

+    int num = 0;

+    if (str == NULL)

+    {

+        return NULL;

+    }

+    while (1)

+    {

+        menu = 0;

+        if (num == 2)

+        {

+            break;

+        }

+        while (1)

+        {

+            if (*pos == '"')

+            {

+                if (menu == 0)

+                {

+                    menu++;

+                    argv[num++] = pos+1;

+                }

+                else if (menu == 1)

+                {

+                    *pos++ = '\0';

+                    break;

+                }

+                else 

+                {

+                    break;

+                }

+            }

+            pos++;

+        }

+        

+    }

+    printf("moudle = %s\nAPI = %s\n", argv[0], argv[1]);

+    return pos;

+}

+/*parse the parameters,and then stroge every parameter to argv.*/

+/*return the number of parameters.*/

+int getParam(char * str,char *argv[])

+{

+    char* pos = str;

+    int num = 0;

+    if (str == NULL)

+    {

+        return 0;

+    }

+    while (1)

+    {

+        if (*pos == '\0')

+        {

+            break;

+        }

+        while (1)

+        {

+            if (*(pos - 1) == '=' && *pos == '"')// "="" as the basis for starting the parameter.   

+            {

+                argv[num++] = pos+1;

+            }

+            else if (*(pos - 1) == '"' && *pos == '&')// "="" as the basis for the end of the parameter

+            {

+                *(pos - 1) = '\0';

+                pos++;

+                break;

+            }

+            else if (*pos == '\0'&&*(pos-1) == '"')//the string end.

+            {

+                *(pos - 1) = '\0';

+                break;

+            }

+            else if (*pos == '\0')//the string end.

+            {

+                break;

+            }

+            pos++;

+        }

+    }

+  //  for (int i = 0;i < num;i++)

+  //  {

+   //     printf("argv[%d] = %s\n",i,argv[i]);

+   // }

+    return num;

+}

+

+/*remove the escape character '\'*/

+int removeTage(const int length,char* argv[])

+{

+    char* temp = NULL;

+    char* temp1 = NULL;

+    char** pos = argv;

+    for (int i = 0;i < length;i++)

+    {

+        temp1 = pos[i];

+        while (1)

+        {

+            if (*pos[i] == '\0')

+            {

+                break;

+            }

+            if ((*pos[i] == '"') && (*(pos[i] - 1) == '\\'))//Remove "\"" when encountering '\'

+            {

+                temp = pos[i];

+                while (1)

+                {

+                    *(pos[i] - 1) = *(pos[i]);

+                    if (*(pos[i]) == '\0')

+                    {

+                        break;

+                    }

+                    pos[i]++;

+                }

+                pos[i] = temp;

+            }

+            pos[i]++;

+        }

+        pos[i] = temp1;

+    }

+    return 0;

+}

+int parseParameters(char *str,char *argv[])

+{

+    int argc = 0;

+    argc = getParam(str,argv);

+    removeTage(argc,argv);

+   // for (int i = 0;i < argc; i++)

+   // {

+  //      printf("param %d = %s\n",i, argv[i]);

+  //  }

+    return 0;

+}

+RIL_COMMAND*find_command (char *name,RIL_COMMAND *Class)

+{

+    register int i;

+    for (i = 0; Class[i].name; i++)

+        if (strcmp (name, Class[i].name) == 0)

+            return (&Class[i]);

+    return ((RIL_COMMAND *)NULL);

+}

+

diff --git a/packages/apps/lynq-function-test/src/function_common.h b/packages/apps/lynq-function-test/src/function_common.h
new file mode 100644
index 0000000..42a0c7d
--- /dev/null
+++ b/packages/apps/lynq-function-test/src/function_common.h
@@ -0,0 +1,44 @@
+/*============================================================================= 

+**     FileName: function_common.h

+**     Desc: about function test

+**     Author: Warren 

+**     Version: V1.0

+**     LastChange: 2021-02-26 

+**     History: 

+=============================================================================*/

+

+

+#ifndef FUNCTION_COMMON_H

+#define FUNCTION_COMMON_H

+

+#ifdef __cplusplus

+extern "C" {

+#endif

+  #include "liblog/liblog.h"

+  #include "liblog/lynq_deflog.h"

+#ifdef __cplusplus

+}

+#endif

+typedef enum{

+    MENU_INPUT_ERROR=0,

+    MODULE_INPUT_ERROR,

+    API_INPUT_ERROR,

+    INVALID_CMD,

+}COMMAND_ERROR;

+typedef struct {

+    char *name;                    /* User printable name of the function. */

+    int (*func)(char **param); /* Function to call to do the job. */

+    char *doc;

+} RIL_COMMAND;

+RIL_COMMAND*find_command (char *name,RIL_COMMAND *Class);

+

+void set_timer(int it_interval_sec, int it_interval_usec,int it_value_sec,int it_value_usec);

+int sleep_with_restart(int second);

+int millli_sleep_with_restart(int millisecond);

+

+char* getMenu(char * str,char *argv[]);

+int parseParameters(char *str,char *argv[]);

+//int getParam(char * str,char *argv[]);

+//int removeTage(const int length,char* argv[]);

+

+#endif
\ No newline at end of file
diff --git a/packages/apps/lynq-function-test/src/gpio_test.cpp b/packages/apps/lynq-function-test/src/gpio_test.cpp
new file mode 100644
index 0000000..ca00017
--- /dev/null
+++ b/packages/apps/lynq-function-test/src/gpio_test.cpp
@@ -0,0 +1,91 @@
+/*============================================================================= 

+**     FileName: gpio_test.cpp

+**     Desc: about function test

+**     Author: zhou

+**     Version: V1.0

+**     LastChange: 2021-03-04 

+**     History: 

+=============================================================================*/

+#include "function_common.h"

+#include <log/log.h>

+#include "gpio_test.h"

+#include <stdio.h>

+#include <string.h>

+#include <stdlib.h>

+#ifdef __cplusplus

+extern "C" {

+#endif   

+#include "liblynq-driver/libdriver.h"

+#ifdef __cplusplus

+}

+#endif

+int check_mode(const char *mode)

+{

+if(!strcmp(mode, GPIO_DIR))

+{

+  return 1;

+}

+if(!strcmp(mode, GPIO_OUT))

+{

+	return 1;

+}

+if(!strcmp(mode, GPIO_MODE))

+{

+	return 1;	

+}

+  return -1;

+}

+int check_status(int statu)

+{

+    if (statu == 0)

+        return 1;

+    if (statu ==1)

+        return 1;

+    return -1;

+}

+int gpio_test(char *api,char *string) {

+    char *argv[100] = {0};

+    parseParameters(string,argv);

+    if(!strcmp(api, "get")){

+        char output1[1024] = {0};

+        int value = atoi(argv[0]);

+        lynq_get_gpio (value,output1);

+       // printf("Factory_result get %d gpio:%s \n",value,output1)

+        LYVERBLOG("+[gpio][get]: data = %s\n",output1);

+

+    }

+    else if(!strcmp(api, "set")){

+        int gpio_numb = atoi(argv[1]);

+        int gpio_statu = atoi(argv[2]);

+        int check_prame;

+        check_prame = check_mode(argv[0]);

+        if(check_prame == -1)

+        {

+         LYVERBLOG("+[gpio][set]: error num = %d \n",GPIO_PRAME_ERROR);

+        return 0;

+        }

+        check_prame = check_status(gpio_statu);

+        if(check_prame == -1)

+        {

+         LYVERBLOG("+[gpio][set]: error num = %d \n",GPIO_PRAME_ERROR);

+         return 0;

+        }

+        int result = lynq_set_gpio(argv[0], gpio_numb,gpio_statu);

+        if(result == -1)

+        {

+         LYVERBLOG("+[gpio][set]: error num = %d \n",GPIO_SET_ERROR);

+         return 0;

+        }

+        else

+        {

+         LYVERBLOG("+[gpio][set]: ok!!\n",result);

+         return 1;

+        }

+       //  printf("Factory_result gpio %d set state :%d\n",gpio_numb,result);	   

+    }

+    else {

+        LYVERBLOG("+[gpio][lynq_set_gpio]: error num =%d\n",GPIO_PRAME_ERROR);

+    }

+

+    return 0;

+}
\ No newline at end of file
diff --git a/packages/apps/lynq-function-test/src/gpio_test.h b/packages/apps/lynq-function-test/src/gpio_test.h
new file mode 100644
index 0000000..204cfe0
--- /dev/null
+++ b/packages/apps/lynq-function-test/src/gpio_test.h
@@ -0,0 +1,12 @@
+#ifndef __LYNQ_GPIO_TEST_H__

+#define __LYNQ_GPIO_TEST_H__

+#define GPIO_MODE "mode"

+#define GPIO_DIR "dir"

+#define GPIO_OUT "out"

+typedef enum {

+   GPIO_SET_SUCCESS  = 0 ,

+   GPIO_PRAME_ERROR = 1,

+   GPIO_SET_ERROR  = 2,

+}GPIO_SET_RESULT;

+int gpio_test(char *api,char *string);

+#endif //__LYNQ_GPIO_TEST_H__
\ No newline at end of file
diff --git a/packages/apps/lynq-function-test/src/main.cpp b/packages/apps/lynq-function-test/src/main.cpp
new file mode 100644
index 0000000..f490c22
--- /dev/null
+++ b/packages/apps/lynq-function-test/src/main.cpp
@@ -0,0 +1,437 @@
+
+/* gets example */
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <libtel/lib_tele.h>
+#include "ril_test.h"
+#include "gpio_test.h"
+#include "fota_test.h"
+#include "audio_test.h"
+#include "system_test.h"
+//#include "service_test.h"
+#include "function_common.h"
+//#include "conti_plugin_test.h"
+//#include "exception_multicast.h"
+
+
+#include<unistd.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#include "liblynq-broadcast/broadcast_send.h"
+#include <gio/gio.h>
+#include <glib.h>
+#include "liblynq-driver/libdriver.h"
+
+#ifdef __cplusplus
+}
+#endif
+
+#define BUFFER_SIZE 8192
+#define USER_LOG_TAG "FUNCTION_TEST"
+#define MAX_ARGS 5
+typedef enum {
+    API_MENU = 1,
+    DEMO_MENU,
+}TEST_MAIN_ITEM;
+typedef enum{
+    API_RIL=0,
+    API_GPIO,
+    API_MQTT,
+    API_HTTP,
+    API_WIFI,
+    API_GNSS,
+    API_SERVICE,
+    API_AUDIO,
+    API_DHCP,
+    API_SYSTEM,
+    API_FOTA,
+} API_MOUDLE;
+
+
+void lynq_incoming_call_cb(RIL_SOCKET_ID soc_id,int index, char * addr, RIL_CallState state, int toa)
+{
+   // printf("[SIM%d]index is %d,addr is %s,state is %d,toa is %d\n",soc_id,index,addr,state,toa);
+    LYVERBLOG("[SIM%d]index is %d,addr is %s,state is %d,toa is %d\n",soc_id,index,addr,state,toa);
+}
+
+void lynq_recive_new_sms_cb(RIL_SOCKET_ID soc_id,char * num, char * smsc, char * msg, int charset)
+{
+  //  printf("[SIM%d]num is %s,smsc is %s,msg is %s,charset is %d\n",soc_id,num,smsc,msg,charset);
+    LYVERBLOG("[SIM%d]num is %s,smsc is %s,msg is %s,charset is %d\n",soc_id,num,smsc,msg,charset);
+}
+
+static user_cb mytest={
+    lynq_recive_new_sms_cb,
+    lynq_incoming_call_cb
+};
+
+
+static void getCallback(const char* str_arg, int int_arg )
+{
+    //printf("SignalCallback,str_arg:%s,int_arg:%d\n", str_arg,int_arg);
+    LYVERBLOG("SignalCallback,str_arg:%s,int_arg:%d\n", str_arg,int_arg);
+
+    return;
+}
+
+void hold_on(){
+    char any[5]={ 0 };
+    printf("Press any key to return\n");
+    fgets(any, 5, stdin);
+}
+
+int parse_param(char *cmd, char *argv[], int max_args){
+    char *pos, *pos2;
+    int argc = 0;
+
+    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 = strchr(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') 
+                {
+                    if (*pos == '"' && (pos2 = strchr(pos + 1, '"'))) 
+                    {
+                        pos = pos2 ;
+                    }
+                    else
+                    pos++;
+                }
+            *pos++ = '\0';
+        }
+
+    // Check if the maximum of arguments is reached.
+        if (argc == max_args) {
+            break;
+        }
+    }
+
+    return argc;
+}
+int getRilModule(char *module)
+{
+    if (module==NULL)
+    {
+       //printf("[ERROR] Please input module,and try again!");
+       // LYVERBLOG("+[command error]:error num = %d\n",MENU_INPUT_ERROR);
+        return -1;
+    }
+    if(!strcmp(module,"ril"))
+    {
+        return API_RIL;
+    }
+    else if(!strcmp(module,"gpio"))
+    {
+        return API_GPIO;
+    }
+    else if(!strcmp(module,"MQTT"))
+    {
+        return API_MQTT;
+    }
+    else if(!strcmp(module,"HTTP"))
+    {
+        return API_HTTP;
+    }
+    else if(!strcmp(module,"WIFI"))
+    {
+        return API_WIFI;
+    }
+    else if(!strcmp(module,"GNSS"))
+    {
+        return API_GNSS;
+    }
+  //  else if(!strcmp(module, "SERVICE"))
+   // {
+  //      return API_SERVICE;
+  //  }
+      else if(!strcmp(module, "AUDIO"))
+    {
+        return API_AUDIO;
+    }
+	else if(!strcmp(module,"DHCP"))
+    {
+        return API_DHCP;
+    }
+    else if(!strcmp(module,"SYSTEM"))
+    {
+        return API_SYSTEM;
+    }
+    else if(!strcmp(module, "fota"))
+    {
+        return API_FOTA;
+    }
+    else
+    {
+       LYVERBLOG("+[command error]:error num = %d\n",MENU_INPUT_ERROR);
+       // printf("can not find %s API  module ",module);
+        return -1;
+    }
+    return -1;
+}
+
+int api_start(int argc, char *argv[]){
+    LYDBGLOG("api_start,argc:%d\n",argc);
+    char *menu[2] = {0};// menu[0] is the "moudle",menu[1] is the "API"
+    char* argvHead=NULL;
+    int module = -1;
+    argvHead = getMenu(argv[2],menu);//find the "module" and the "API"
+    module = getRilModule(menu[0]);
+   // if(argvHead == NULL)
+   // {
+    //     printf("pram api error\n");
+    //     return 0;
+   // }
+    switch(module)
+    {
+        case API_RIL:
+        {
+            if(argvHead)
+            {
+                ril_test(menu[1],argvHead);
+                break;
+            }
+        }
+        /* Add the code of the owner modules below*/
+        case API_GPIO:
+        {
+            gpio_test(menu[1],argvHead);
+            break;
+        }
+     //   case API_SERVICE:
+    //    {
+      //      service_test(menu[1],argvHead);
+       //     break;
+     //   }
+        case API_AUDIO:
+        {
+            audio_test(menu[1],argvHead);
+            break;
+        }
+        case API_DHCP:
+        {
+            //dhcp_test(menu[1],argvHead);
+            break;
+        }
+        case API_SYSTEM:
+        {
+            system_test(menu[1],argvHead);
+            break;
+        }
+	case API_FOTA:
+	{
+		fota_test(menu[1],argvHead);		
+		break;
+	}
+
+        case API_MQTT:
+        case API_HTTP:
+        case API_WIFI:
+        case API_GNSS:
+            break;
+        default:
+          //  printf("pram module error\n");
+          LYVERBLOG("+[command error]:error num = %d\n",MENU_INPUT_ERROR);
+
+            break;
+    }
+   // hold_on(); //add by zhouqunchao delete help message
+    return 1;
+}
+
+int function_start(int argc, char *argv[])
+{
+	int select_menu = atoi(argv[0]);
+	int thread = atoi(argv[1]);
+	// printf("select_menu:%d,thread:%d\n",select_menu,thread);
+ 	switch(select_menu)
+	{
+		case API_MENU:
+		{
+			if (thread == 1)//rita add @2021.6.21 for threadhandle test
+			{
+				LYDBGLOG("[%s-%d] argv[2] = [%s]\n", __FUNCTION__, __LINE__, argv[2]);
+				if(strlen(argv[2])){//rita add @2021.6.21 for data error
+					LYDBGLOG("[%s-%d] argv[2] = [%s]\n", __FUNCTION__, __LINE__, argv[2]);
+					send_broadcast_by_name("function", strlen(argv[2]), argv[2]);
+				}
+				else{
+					LYVERBLOG("+[thhandle]: error num = %d\n", INVALID_CMD);
+					return INVALID_CMD;
+				}
+			}
+			else if(thread ==2){//rita add @2021.6.21 for local test
+				api_start(argc,argv);
+			}
+			else{
+				//printf("thread 1,local 2\n");
+				LYDBGLOG("thread 1,local 2\n");
+			}
+			break;
+		}
+		case DEMO_MENU:
+		{
+			//printf("DEMO_MENU\n");
+			LYDBGLOG("DEMO_MENU\n");
+			break;
+		}
+		default:
+        break;
+    }
+    return 0; 
+}
+
+
+void help_display(){
+    printf("\n");
+    printf("*****************************************************************************\n");
+    printf("0:help ------- help\n");
+    printf("*****************************************************************************\n");
+    printf("1:API TEST\n" );
+    printf("          1-1:Async api-\n" );
+    printf("                        --MQTT\n" );
+    printf("\n");
+    printf("                        --HTTP\n" );
+    printf("          1-2:Sync api-\n" );
+    printf("                        --GPIO\n" );
+    printf("\n");
+    printf("                        --RIL\n" );
+    printf("\n");
+    printf("                        --WIFI\n" );
+    printf("\n");
+    printf("                        --GNSS\n" );
+    printf("\n");
+    printf("                        --SERVICE\n" );
+    printf("*****************************************************************************\n");
+    printf("2:DEMO TEST:Subsequent updates\n" );
+    printf("*****************************************************************************\n");
+    printf("\n");
+    printf("1:API TEST The format is as follows :\n" );
+    printf("{menu}-{mode selection} moudle=\"{moudle}\"&API=\"{api interface}\"&session=\"{session id}\"\"&parameterA=\"{parameter A}\"\n" );
+    /*
+    printf("The main parameters are as follows:\n");
+    printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n");
+    printf("menu:1--API TEST,2--DEMO TEST\n" );
+    printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n");
+    printf("mode selection:1--async api,2--sync api\n" );
+    printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n");
+    printf("moudle:Test module--includes the following modules\n" );
+    printf("RIL, GPIO,MQTT,HTTP,WIFI,GNSS\n" );
+    printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n");
+    printf("api interface:--Interface corresponding to module\n" );
+    printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n");
+    printf("session id:--Used to distinguish different session groups of the same module\n" );
+    printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n");
+    printf("parameter A:--API parameter,Add format {\"&parameter_name=\"{parameter}\"} \n" );
+    printf("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n");
+    */
+    printf("Select menu:\n");
+}
+void menu_display(){
+    printf("\n");
+    printf("**********************\n");
+    printf("0:help menu\n");
+    printf("1:API TEST\n");
+    printf("2:DEMO TEST\n");
+    printf("**********************\n");
+    printf("\n");
+    printf("Select menu:\n");
+}
+int main()
+{   
+
+    LYLOGEINIT(USER_LOG_TAG);
+    LYLOGSET(4);
+    registerTriggerCallback(getCallback);
+    register_key_info();
+    lynqRegisterUnsolicitedResponse(&mytest);
+
+    /*Check whether the modem works correctly and start the corresponding service*/  //add by liulei
+    char buf[1024]={0};
+    int fd[2];
+    int backfd;
+    pipe(fd);
+    backfd=dup(STDOUT_FILENO);//备份标准输出,用于恢复
+    dup2(fd[1],STDOUT_FILENO);  //将标准输出重定向到fd[1]
+    system("cat /sys/kernel/ccci/boot");
+    read(fd[0],buf,1024);
+    dup2(backfd,STDOUT_FILENO);  //恢复标准输出
+    LYVERBLOG("this is a test :\n%s",buf);  //上面不恢复,则此处的执行结果无法再屏幕上打印
+    if(!strncmp(buf, "md1:4", 5)){
+        lynq_ril_init();
+    }
+    else{
+        printf("\033[40;31mmodem go wrong, May cause problems with your subsequent use of the service\033[0m\n");
+        printf("\033[40;31mmodem go wrong, May cause problems with your subsequent use of the service\033[0m\n");
+        printf("\033[40;31mmodem go wrong, May cause problems with your subsequent use of the service\033[0m\n");
+    }
+    /*Check whether the modem works correctly and start the corresponding service*/
+    sleep_with_restart(1);
+    register_broadcast_send();
+
+    while (1) {
+        char *argv[MAX_ARGS];
+        char str[BUFFER_SIZE]={ 0 };
+        menu_display();
+        fgets(str, BUFFER_SIZE, stdin);
+        LYDBGLOG("[%s-%d] str= [%s]\n", __FUNCTION__, __LINE__, str);
+        str[strlen(str)-1]='\0';
+        if(!strcmp(str, "0")){
+           help_display();
+           //hold_on(); //add by zhouqunchao delete help message
+           continue;
+        }
+        if(!strcmp(str,"quit"))
+        {   
+            //system("killall lynq-framework-service");
+           break;
+        }
+        if ((strncmp(str,"1-",2) == 0)||
+           (strncmp(str,"2-",2)== 0))
+        {
+         char* at_cmd = strstr(str, "-");
+         strncpy(at_cmd, " ", 1);
+        LYDBGLOG("[%s-%d] at_cmd = [%s]\n", __FUNCTION__, __LINE__, at_cmd);
+
+	
+         int argc = parse_param(str, argv, MAX_ARGS);
+   //add by zqc  Format error judgment start
+        if(argv[2] == NULL)
+        {
+        LYVERBLOG("+[command error]:error num = %d\n",MENU_INPUT_ERROR);
+        continue;
+        }
+        //add by zqc  Format error judgment end
+         function_start(argc,argv);
+         continue;
+        }
+        else{
+        // printf("pram error\n");
+         LYVERBLOG("+[command error]:error num = %d\n",MENU_INPUT_ERROR);
+         continue;
+        }
+   }
+return 0;
+}
+
diff --git a/packages/apps/lynq-function-test/src/makefile b/packages/apps/lynq-function-test/src/makefile
new file mode 100644
index 0000000..740ad4a
--- /dev/null
+++ b/packages/apps/lynq-function-test/src/makefile
@@ -0,0 +1,117 @@
+SHELL = /bin/sh
+RM = rm -f
+
+LOCAL_CFLAGS := -Wall \
+                -g -Os \
+                -flto \
+                -DRIL_SHLIB \
+                -DATCI_PARSE \
+                -DKEEP_ALIVE \
+                -D__LINUX_OS__ \
+                -DECALL_SUPPORT
+
+$(warning ################# C2K support: $(RAT_CONFIG_C2K_SUPPORT))
+ifeq ($(strip $(RAT_CONFIG_C2K_SUPPORT)), yes)
+    LOCAL_CFLAGS += -DC2K_SUPPORT
+
+endif
+
+ifeq ($(strip $(MTK_MULTI_SIM_SUPPORT)), dsds)
+    LOCAL_CFLAGS += -DANDROID_SIM_COUNT_2 \
+                     -DANDROID_MULTI_SIM \
+                     -DMODE_DSDS
+endif
+
+ifeq ($(strip $(MTK_MULTI_SIM_SUPPORT)), dsss)
+    LOCAL_CFLAGS += -DMODE_DSSS
+endif
+
+$(warning ################# TARGET_PLATFORM: $(TARGET_PLATFORM))
+ifeq ($(strip $(TARGET_PLATFORM)), mt2731)
+#$(warning #################add for debug $(ROOT), $(includedir))
+$(warning ################# TARGET_PLATFORM_MT2731)
+    LOCAL_CFLAGS += -DTARGET_PLATFORM_MT2731 \
+                    -DMD_93_SUPPORT
+else ifeq ($(strip $(TARGET_PLATFORM)), mt2635)
+$(warning ################# TARGET_PLATFORM_MT2635)
+    LOCAL_CFLAGS += -DTARGET_PLATFORM_MT2635 \
+                    -DMD_90_SUPPORT
+endif
+
+
+LOCAL_PATH   = .
+#CFLAGS = $(LOCAL_CFLAGS) -std=c99 
+#CXXFLAGS = $(LOCAL_CFLAGS) -std=gnu++14
+$(warning ################# ZHOUQUNCHAO ROOT: $(ROOT),includedir:$(includedir),LOCAL_PATH:$(LOCAL_PATH))
+LOCAL_C_INCLUDES = \
+  -I. \
+  -I$(LOCAL_PATH) \
+  -I$(ROOT)$(includedir)/ \
+  -I$(ROOT)$(includedir)/include  \
+  -I$(ROOT)$(includedir)/logger \
+  -I$(ROOT)$(includedir)/liblynq-media \
+  -I$(ROOT)$(includedir)/liblynq-broadcast \
+  -I$(ROOT)$(includedir)/vendor-ril \
+  -I$(ROOT)$(includedir)/liblog \
+  -I$(ROOT)$(includedir)/ftp \
+  -I$(ROOT)$(includedir)/liblynq-driver \
+  -I$(ROOT)$(includedir)/gstreamer-1.0 \
+  -I$(ROOT)$(includedir)/glib-2.0 \
+  -I$(ROOT)$(libdir)/glib-2.0/include \
+  -I$(ROOT)$(libdir)/gstreamer-1.0/include\
+  -I$(ROOT)$(includedir)/dbus-1.0 \
+  -I$(ROOT)$(libdir)/dbus-1.0/include \
+  -DLIB_GNSS_HAL_DIR='"$(libdir)"'
+
+LOCAL_C_INCLUDES+=$(DNS_FLAGS)
+
+LOCAL_LIBS := \
+    -L. \
+    -ldl \
+    -lstdc++ \
+    -llog \
+    -lcutils \
+    -lutils \
+    -llynq-media \
+    -lpower \
+    -lbinder \
+    -llynq-log \
+    -lpthread \
+    -lrt \
+    -llynq-driver \
+    -lpal \
+    -lgstreamer-1.0 \
+    -lglib-2.0 \
+    -lgstbase-1.0 \
+    -lgstreamer-1.0 \
+    -lgobject-2.0 \
+    -lgio-2.0 \
+    -ldtmf \
+    -lapn \
+    -ldbus-1 \
+    -llynq-broadcast \
+    -llynq-system-own \
+    -llynq-tele-ril \
+    -llynq-protcl \
+    -llynq-fota \
+    -lnandapi  \
+
+LOCAL_SRC_FILES_CPP = $(wildcard *.cpp gpio/*.cpp ril/*.cpp)
+LOCAL_SRC_FILES_C = $(wildcard *.c gps/*.c)
+EXECUTABLE = lynq-function-test
+
+OBJECTS=$(LOCAL_SRC_FILES_CPP:.cpp=.o) $(LOCAL_SRC_FILES_C:.c=.o)
+all: $(EXECUTABLE)
+
+$(EXECUTABLE): $(OBJECTS)
+	$(CXX) $(OBJECTS) $(LOCAL_LIBS) $(LOCAL_CFLAGS) $(LOCAL_C_INCLUDES) -o $@
+
+%.o: %.c
+	$(warning ----->build $<)
+	$(CC) $(LOCAL_C_INCLUDES) $(LOCAL_CFLAGS) $(LOCAL_LIBS) -o $@ -c $<
+%.o : %.cpp
+	$(CXX) $(LOCAL_C_INCLUDES) $(LOCAL_CFLAGS) $(LOCAL_LIBS) -o $@ -c $<
+
+.PHONY: clean
+clean:
+	$(RM) $(OBJECTS) $(EXECUTABLE)
diff --git a/packages/apps/lynq-function-test/src/ril_test.cpp b/packages/apps/lynq-function-test/src/ril_test.cpp
new file mode 100644
index 0000000..eb54b0b
--- /dev/null
+++ b/packages/apps/lynq-function-test/src/ril_test.cpp
@@ -0,0 +1,1770 @@
+/*============================================================================= 

+**     FileName: ril_test.cpp

+**     Desc: about function test

+**     Author: Warren

+**     Version: V1.0

+**     LastChange: 2021-02-26 

+**     History: 

+=============================================================================*/

+#include "function_common.h"

+#include <log/log.h>

+#include <liblog/lynq_deflog.h>

+#include "libtel/lib_tele.h"

+#include <libtel/lynq_call.h>

+#include <libtel/lynq_sim.h>

+#include <libtel/lynq_network.h>

+#include <libtel/lynq_data.h>

+#include <libtel/lynq_sms.h>

+#include "ril_test.h"

+#include <cutils/properties.h>

+#include <string.h>

+#define MAX_P 1024

+RIL_COMMAND api_commands[] = {

+#include "commands.h"

+};

+static int strUpper(char * str)

+{
+    int i=0;
+    while(1)
+    {
+        if(str[i]=='\0')
+        {
+            break;
+        }
+        if(str[i]>='a'&&str[i]<='z')
+        {
+             //printf("str %c\n",str[i]-32);
+             str[i]=str[i]-32;
+        }
+        i++;
+    }
+    return 0;
+}

+

+int eventDial(char **argv)

+{

+    int32_t token;

+    if(argv[0]==NULL)

+    {

+        LYERRLOG("+[ril][dial]: Please input phony number,and try again\n");

+        return -1;

+    }

+    char* addr = argv[0];

+    char output[1024] = {0};

+    lynqCallList *msg = (lynqCallList*)malloc(sizeof(lynqCallList));
+    memset(msg,0,sizeof(lynqCallList));
+    msg->addr=(char *)malloc(sizeof(char));
+    memset(msg->addr,0,sizeof(char));

+    token = lynq_call(addr, msg);

+    LYINFLOG("[MAIN_LOG] request is %d,phone number is %s,token is %x,error is %d,call_state is %d\n",

+        msg->base.request,msg->addr,msg->base.token,msg->base.e,msg->call_state);

+    if(msg->base.e!=0)

+    {

+        LYVERBLOG( "+[ril][dial]: error num = %d\n",msg->base.e);

+    }

+    else

+    {

+        LYVERBLOG( "+[ril][dial]: ok!!\n");

+    }

+    free(msg->addr);
+    msg->addr=NULL;
+    free(msg);
+    msg=NULL;

+    return 0;
+}

+

+int eventAnswer(char **argv)

+{
+    int32_t token;

+    char output[1024] = {0};

+    lynqCallList *msg = (lynqCallList*)malloc(sizeof(lynqCallList));
+    memset(msg,0,sizeof(lynqCallList));
+    msg->addr=(char *)malloc(sizeof(char));
+    memset(msg->addr,0,sizeof(char));
+    //printf("call start \n");

+    token = lynq_call_answer(msg);
+    //printf("[MAIN_LOG] request is %d,phone number is %s,token is %x,error is %d,call_state is %d\n",

+        //msg->base.request,msg->addr,msg->base.token,msg->base.e,msg->call_state);

+    LYINFLOG("[MAIN_LOG] request is %d,phone number is %s,token is %x,error is %d,call_state is %d",

+        msg->base.request,msg->addr,msg->base.request,msg->base.e,msg->call_state);

+    if(msg->base.e==0)

+    {

+        LYVERBLOG( "+[ril][an]: error num = %d\n",msg->base.e);

+    }

+    else

+    {

+        LYVERBLOG( "+[ril][an]: ok!!\n");

+    }

+    //emResultNotify(output,command);

+    free(msg->addr);
+    msg->addr=NULL;
+    free(msg);
+    msg=NULL;
+    return 0;
+}
+int eventAutoAnswer(char **argv)

+{
+    int32_t token=0;
+    int mode=0;

+    char output[1024] = {0};

+    if(argv[0]==NULL)

+    {

+        LYERRLOG("+[ril][atan]: Please input auto answer mode value:0 or 1,and try again\n");

+        return -1;

+    }

+    int status = atoi(argv[0]);

+    if(!(status==1 ||status ==0))

+    {

+        LYERRLOG("+[ril][atan]: Please input auto answer mode value:0 or 1,and try again\n");

+        return -1;

+    }

+    token = lynq_set_auto_answercall(status,&mode);

+    if(mode!=status)

+    {

+        LYVERBLOG( "+[ril][atan]: error num = %d\n",RIL_E_GENERIC_FAILURE);

+    }

+    else

+    {

+        LYVERBLOG( "+[ril][atan]: ok!!\n");

+    }

+    return 0;
+}
+int eventSetMute(char **argv)

+{
+    int32_t token = 0;
+    int status =0;

+    if(argv[0]==NULL)

+    {

+        LYERRLOG("+[ril][stme]: Please input set mute mode:0 or 1,and try again!\n");

+        return -1;

+    }

+    int mute = atoi(argv[0]);

+    token = lynq_set_mute_mic(mute, &status);

+    LYINFLOG("set mute status is %s,current mute status is %s\n",mute>0?"mute on":"mute off",status>0?"mute on":"mute off");

+    if(mute!=status)

+    {

+        LYVERBLOG("+[ril][stme]: error num = %d\n",RIL_E_GENERIC_FAILURE);

+    }

+    else

+    {

+        LYVERBLOG("+[ril][stme]: ok!!\n");

+    }

+    return 0;
+}
+int eventGetMute(char **argv)

+{
+    int32_t token = 0;
+    int status =0;

+    char output[1024] = {0};

+    token = lynq_get_mute_status(&status);
+    LYVERBLOG("+[ril][gtme]: status = %d\n",status>0?1:0);

+    LYVERBLOG("+[ril][gtme]: ok!!\n");

+    return 0;
+}
+int eventLastCallFailCause(char **argv)

+{
+    int32_t token = 0;
+    int status =0;

+    char output[1024] = {0};

+    lynqLastCallFailCause * msg = (lynqLastCallFailCause*)malloc(sizeof(lynqLastCallFailCause));
+    memset(msg,0,sizeof(lynqLastCallFailCause));
+    msg->vendor_cause = (char *)malloc(sizeof(char)*64);

+    memset(msg->vendor_cause,0,sizeof(char));
+    token = lynq_get_last_call_fail_cause(msg);
+    LYINFLOG("token is %x,request is %d,error_code is %d,cause_code is %d,vendor_cause  is %s\n",msg->base.token,

+        msg->base.request,msg->base.e,msg->cause_code,msg->vendor_cause);

+    if(msg->base.e!=0)

+    {

+        LYVERBLOG("+[ril][lcfc]: error num = %d\n",msg->base.e);

+    }

+    else

+    {

+        LYVERBLOG("+[ril][lcfc]: cause_code = %d,vendor_cause = %s\n",msg->cause_code,msg->vendor_cause);

+        LYVERBLOG("+[ril][lcfc]: ok!!\n");

+    }

+    free(msg->vendor_cause);
+    free(msg);
+    return 0;
+}
+int eventCallHangUp(char **argv)

+{
+    lynqBase msg;

+    char output[1024] = {0};

+    if(argv[0]==NULL)

+    {

+        LYERRLOG("+[ril][hup]: Please input call index,and try again!\n");

+        return -1;

+    }

+    int index = atoi(argv[0]);

+    lynq_call_hang_up(index,&msg);

+    //printf("request is %d,token is %x,error is %d\n",msg.request,msg.token,msg.e);

+    LYINFLOG("request is %d,token is %x,error is %d",msg.request,msg.token,msg.e);

+    if(msg.e!=0)

+    {

+        LYVERBLOG("+[ril][hup]: error num = %d\n",msg.e);

+    }

+    else

+    {

+        LYVERBLOG("+[ril][hup]: ok!!\n");

+    }

+    return 0;
+}
+int eventRejectCall(char **argv)

+{
+    lynqBase msg;

+    char output[1024] = {0};

+    lynq_reject_call(&msg);
+    //printf("request is %d,token is %x,error is %d\n",msg.request,msg.token,msg.e);

+    LYINFLOG("request is %d,token is %x,error is %d\n",msg.request,msg.token,msg.e);

+    if(msg.e!=0)

+    {

+        LYVERBLOG("+[ril][udub]: error num = %d\n",msg.e);

+    }

+    else

+    {

+        LYVERBLOG("+[ril][udub]: ok!!\n");

+    }

+    return 0;
+}
+int eventSetDTMF(char **argv)

+{
+    lynqBase msg;

+    char output[1024] = {0};

+    if(argv[0]==NULL)

+    {

+        LYERRLOG("+[ril][dtmf]: Please  input DTMF value:0-9,8,#,and try again!\n");

+        return -1;

+    }

+    char value = argv[0][0];

+    lynq_set_DTMF(value,&msg);

+    LYINFLOG("request is %d,token is %x,error is %d\n",msg.request,msg.token,msg.e);

+    if(msg.e!=0)

+    {

+        LYVERBLOG("+[ril][dtmf]: error num = %d\n",msg.e);

+    }

+    else

+    {

+        LYVERBLOG("+[ril][dtmf]: ok!!\n");

+    }

+    return 0;
+}
+int eventSetDTMFVolume(char **argv)

+{
+    int32_t token =0;

+    if(argv[0]==NULL)

+    {

+        LYERRLOG("+[ril][dtmfv]: Please  input DTMF volume(0-36),and try again!\n");

+        return -1;

+    }

+    int volume = atoi(argv[0]);

+    token = lynq_set_DTMF_volume(volume);

+    LYVERBLOG("+[ril][dtmfv]: ok!!\n");

+    //printf("Factory_result set DTMF Volume is %s\n",(token>0?"success":"fail"));

+    return 0;
+}
+int eventDoMultiConference(char **argv)

+{
+    lynqCallList msg;
+    msg.addr=NULL;

+    lynq_do_multi_conference(&msg);

+    LYINFLOG("request is %d,call id is %d,phone number is %s,type of address is %d,token is %x,error is %d,call_state is %d\n",

+        msg.base.request,msg.call_id,msg.addr,msg.toa,msg.base.token,msg.base.e,msg.call_state);

+    if(msg.base.e!=0)

+    {

+        LYVERBLOG("+[ril][dmc]: error num = %d\n",msg.base.e);

+    }

+    else

+    {

+        LYVERBLOG("+[ril][dmc]: ok!!\n");

+    }

+    return 0;
+}
+int eventOthercallHold(char **argv)

+{
+    lynqBase msg;

+    if(argv[0]==NULL)

+    {

+        LYERRLOG("+[ril][och]: Please  input call id,and try again!\n");

+        return -1;

+    }

+    int call_id = atoi(argv[0]);

+    lynq_othercall_hold(call_id,&msg);

+    LYINFLOG("request is %d,token is %x,error is %d\n",msg.request,msg.token,msg.e);

+    if(msg.e!=0)

+    {

+        LYVERBLOG("+[ril][och]: error num = %d\n",msg.e);

+    }

+    else

+    {

+        LYVERBLOG("+[ril][och]: ok!!\n");

+    }

+    return 0;
+}
+int eventHangupWatingForCall(char **argv)

+{
+    lynqCallList msg;
+    msg.addr=NULL;

+    lynq_hangup_wating_for_call(&msg);

+    LYINFLOG("[MAIN_LOG] request is %d,call id is %d,phone number is %s,type of address is %d,token is %x,error is %d,call_state is %d\n",

+        msg.base.request,msg.call_id,msg.addr,msg.toa,msg.base.token,msg.base.e,msg.call_state);

+    if(msg.base.e!=0)

+    {

+        LYVERBLOG("+[ril][hwc]: error num = %d\n",msg.base.e);

+    }

+    else

+    {

+        LYVERBLOG("+[ril][hwc]: ok!!\n");

+    }

+    return 0;
+}
+int eventHangupForegroundResumeBackground(char **argv)

+{
+    lynqCallList msg;
+    msg.addr=NULL;

+    lynq_hangup_foreground_resume_background(&msg);

+    LYINFLOG("[MAIN_LOG] request is %d,call id is %d,phone number is %s,type of address is %d,token is %x,error is %d,call_state is %d\n",

+        msg.base.request,msg.call_id,msg.addr,msg.toa,msg.base.token,msg.base.e,msg.call_state);

+    if(msg.base.e!=0)

+    {

+        LYVERBLOG("+[ril][hfrb]: error num = %d\n",msg.base.e);

+    }

+    else

+    {

+        LYVERBLOG("+[ril][hfrb]: ok!!\n");

+    }

+    return 0;
+}
+int eventSwitchWaitOrHoldAndActiveCall(char ** argv)

+{
+    lynqCallList msg;
+    msg.addr=NULL;

+    lynq_switch_hold_and_active_call(&msg);

+    LYINFLOG("[MAIN_LOG] request is %d,call id is %d,phone number is %s,type of address is %d,token is %x,error is %d,call_state is %d\n",

+        msg.base.request,msg.call_id,msg.addr,msg.toa,msg.base.token,msg.base.e,msg.call_state);

+    if(msg.base.e!=0)

+    {

+        LYVERBLOG("+[ril][swha]: error num = %d\n",msg.base.e);

+    }

+    else

+    {

+        LYVERBLOG("+[ril][swha]: ok!!\n");

+    }

+    return 0;
+}

+

+int eventQueryOperator(char ** argv)

+{
+    operatorInfo msg;

+    msg.OperatorFN=NULL;
+    msg.OperatorSH=NULL;
+    msg.MccMnc=NULL;
+    lynq_query_operater(&msg);

+    LYINFLOG("request is %d,token is %x,error is %d\n",msg.base.request,msg.base.token,msg.base.e);

+    if(msg.base.e!=0)

+    {

+        LYVERBLOG("+[ril][qop]: error num = %d\n",msg.base.e);

+    }

+    else

+    {

+        LYVERBLOG("+[ril][qop]: OperatorFN = %s,OperatorSH = %s,MccMnc = %s\n",msg.OperatorFN,msg.OperatorSH,msg.MccMnc);

+        LYVERBLOG("+[ril][qop]: ok!!\n");

+    }

+    return 0;
+}
+int eventQueryNetSelectMode(char ** argv)

+{

+    networkSelecttionMode msg;
+    lynq_query_network_selection_mode(& msg);
+    //printf("request is %d,token is %x,error is %d,mode is %d\n",msg.base.request,msg.base.token,msg.base.e,msg.mode);

+    LYINFLOG("request is %d,token is %x,error is %d,mode is %d\n",msg.base.request,msg.base.token,msg.base.e,msg.mode);

+    if(msg.base.e!=0)

+    {

+        LYVERBLOG("+[ril][qnsm]: error num = %d\n",msg.base.e);

+    }

+    else

+    {

+        LYVERBLOG("+[ril][qnsm]: mode = %d\n",msg.mode);

+        LYVERBLOG("+[ril][qnsm]: ok!!\n");

+    }

+    return 0;

+}
+int eventSetNetSelectMode(char ** argv)

+{

+    char str[100]={0};

+    if(argv[0]==NULL)

+    {

+        LYERRLOG("+[ril][snsm]: Please  input network selection mode,and try again!\n");

+        return -1;

+    }

+    int mode = atoi(argv[0]);

+    const char * mccmnc = "46000";//just China Mobile Communications Group

+    lynqBase msg;

+    sprintf(str,"%s",(mode==0?"Auto":"Manual"));

+    if(mode==0)

+    {

+        lynq_set_network_selection_mode(str,NULL,&msg);

+    }

+    else if(mode ==1)

+    {

+        LYVERBLOG("+[ril][snsm]: You have selected manual mode, this command only supports CMCC SIM card temporarily");

+        lynq_set_network_selection_mode(str,mccmnc,&msg);

+    }

+    else

+    {

+        LYERRLOG("+[ril][snsm]: please input network selection mode:0 or 1,and try again\n");

+        return 0;

+    }

+    if(msg.e!=0)

+    {

+        LYVERBLOG("+[ril][snsm]: error num = %d\n",msg.e);

+    }

+    else

+    {

+        LYVERBLOG("+[ril][snsm]: ok!!\n");

+    }

+    return 0;

+}
+int eventQueryAvailableNetwork(char **argv)

+{
+    int32_t token=0;

+    availableNetwork msg;
+    msg.OperatorFN=NULL;
+    msg.OperatorSH=NULL;
+    msg.MccMnc=NULL;
+    msg.NetStatus=NULL;
+    lynq_query_available_network(&msg);

+    LYINFLOG("request is %d,token is %x,error is %d\n",msg.base.request,msg.base.token,msg.base.e);

+    if(msg.base.e!=0)

+    {

+        LYVERBLOG("+[ril][qan]: error num = %d\n",msg.base.e);

+    }

+    else

+    {

+        LYVERBLOG("+[ril][qan]: OperatorFN = %s,OperatorSH = %s,MccMnc = %s,NetStatus = %s\n",msg.OperatorFN,msg.OperatorSH,msg.MccMnc,msg.NetStatus);

+        LYVERBLOG("+[ril][qan]: ok!!\n");

+    }

+    return 0;

+
+}
+ int eventQueryRegistrationState(char ** argv)

+{

+    registrationStateInfo msg;
+    msg.CID=NULL;
+    msg.LAC=NULL;

+    char str[10];

+    if(argv[0]==NULL)

+    {

+        LYERRLOG("+[ril][qrs]: Please  input voice/data/ims,and try again!\n");

+        return -1;

+    }

+    char *type = argv[0];

+    if (strlen(type)>10)
+    {
+        LYERRLOG("+[ril][qrs]: the parameter is inavaliable !\n");

+        return -1;

+    }
+    memcpy(str,type,strlen(type)+1);

+    strUpper(str);

+    //printf("upper str is %s\n",str);

+    lynq_query_registration_state(str,&msg);

+    if(!strcmp(str,"VOICE")){

+        LYINFLOG("request is %d,token is %x,error is %d\n",msg.base.request,msg.base.token,msg.base.e);

+        if(msg.base.e!=0)

+        {

+            LYVERBLOG("+[ril][qrs]: error num = %d\n",msg.base.e);

+        }

+        else

+        {

+            LYVERBLOG("+[ril][qrs]: registrationState = %d\n",msg.regState);

+            LYVERBLOG("+[ril][qrs]: ok!!\n");

+        }

+    }else if(!strcmp(str,"DATA")){
+

+        LYINFLOG("request is %d,token is %x,error is %d\n",msg.base.request,msg.base.token,msg.base.e);

+        if(msg.base.e!=0)

+        {

+            LYVERBLOG("+[ril][qrs]: error num = %d\n",msg.base.e);

+        }

+        else

+        {

+            LYVERBLOG("+[ril][qrs]: registrationState = %d,LAC = %s,CID = %s,networkTyp = %d\n",msg.regState,msg.LAC,msg.CID,msg.netType);

+            LYVERBLOG("+[ril][qrs]: ok!!\n");

+        }

+    }else if(!strcmp(str,"IMS")){

+        LYINFLOG("request is %d,token is %x,error is %d\n",msg.base.request,msg.base.token,msg.base.e);

+        if(msg.base.e!=0)

+        {

+            LYVERBLOG("+[ril][qrs]: error num = %d\n",msg.base.e);

+        }

+        else

+        {

+            LYVERBLOG("+[ril][qrs]: imsRegistrationState = %d,radioTechFamily = %d\n",msg.imsRegState,msg.radioTechFam);

+            LYVERBLOG("+[ril][qrs]: ok!!\n");

+        }

+    }else{
+        LYERRLOG("+[ril][qrs]: [%s][%d] query ims registration state about voice, data, and ims!!! \n",__FUNCTION__,__LINE__);

+        return -1;
+    }

+    return 0;
+ }
+ int eventQueryPrefferredNetworkType(char ** argv)

+{

+    prefferredNetworkType msg;
+    lynq_query_prefferred_networktype(&msg);

+    LYINFLOG("request is %d,token is %x,error is %d\n",msg.base.request,msg.base.token,msg.base.e);

+    if(msg.base.e!=0)

+    {

+        LYVERBLOG("+[ril][gpnt]: error num = %d\n",msg.base.e);

+    }

+    else

+    {

+        LYVERBLOG("+[ril][gpnt]: pnt = %d\n",msg.pnt);

+        LYVERBLOG("+[ril][gpnt]: ok!!\n");

+    }

+    return 0;
+}
+ int eventSetPrefferredNetworkType(char ** argv)

+{
+    lynqBase msg;

+    if(argv[0]==NULL)

+    {

+        LYERRLOG("+[ril][spnt]: Please  input prefferrend neteork type,and try again!\n");

+        return -1;

+    }

+    int type = atoi(argv[0]);

+    lynq_set_prefferred_networktype(type,&msg);

+    LYINFLOG("request is %d,token is %x,error is %d\n",msg.request,msg.token,msg.e);

+    if(msg.e!=0)

+    {

+        LYVERBLOG("+[ril][spnt]: error num = %d\n",msg.e);

+    }

+    else

+    {

+        LYVERBLOG("+[ril][spnt]: ok!!\n");

+    }

+    return 0;
+}
+int eventQueryCellInfo(char ** argv)

+{
+    cellInfoList **msg;

+    int num=5;
+    int realNum =0;
+    int32_t token=0;
+    msg = (cellInfoList **)malloc(sizeof(cellInfoList *)*num);
+    if(msg==NULL)
+    {
+        LYERRLOG("+[ril][gcil]: malloc LYNQ_Data_Call_Response_v11 fail \n");

+        return -1;
+    }
+    for(int i =0;i<num;i++)
+    {
+        msg[i] = (cellInfoList*)malloc(sizeof(cellInfoList));
+        if (msg[i]==NULL)
+        {
+            for (int n=0;n<i;n++)
+            {
+                free(msg[n]);
+            }
+            return -1;
+        }
+        memset(msg[i],0,sizeof(cellInfoList));
+    }
+    token = lynq_query_cell_info(msg, num, &realNum);

+    LYINFLOG("+[ril][gcil]: request is %d,token is %x,e is %d\n",msg[0]->base.request,msg[0]->base.token,msg[0]->base.e);

+    if(msg[0]->base.e!=0)

+    {

+        LYVERBLOG("+[ril][gcil]: error num = %d\n",msg[0]->base.e);

+    }

+    else

+    {

+        for(int i = 0; i<realNum; i++)

+        {

+            LYVERBLOG("+[ril][gcil]: cellInfoType = %d,registered = %d,timeStampType = %d,timeStamp = %d\n",msg[i]->cellinfo.cellInfoType,msg[i]->cellinfo.registered,msg[i]->cellinfo.timeStampType,msg[i]->cellinfo.timeStamp);

+            switch(msg[i]->cellinfo.cellInfoType) {

+                case RIL_CELL_INFO_TYPE_GSM: {

+                    LYVERBLOG("+[ril][gcil]: gsm_mcc = %d,gsm_mnc = %d,gsm_lac = %d,gsm_cid = %d,gsm_signalStrength = %d,gsm_bitErrorRate%d,gsm_timingAdvance = %d\n",

+                        msg[i]->cellinfo.CellInfo.gsm.cellIdentityGsm.mcc,

+                        msg[i]->cellinfo.CellInfo.gsm.cellIdentityGsm.mnc,

+                        msg[i]->cellinfo.CellInfo.gsm.cellIdentityGsm.lac,

+                        msg[i]->cellinfo.CellInfo.gsm.cellIdentityGsm.cid,

+                        msg[i]->cellinfo.CellInfo.gsm.signalStrengthGsm.signalStrength,

+                        msg[i]->cellinfo.CellInfo.gsm.signalStrengthGsm.bitErrorRate,

+                        msg[i]->cellinfo.CellInfo.gsm.signalStrengthGsm.timingAdvance);

+                    break;

+                }

+                case RIL_CELL_INFO_TYPE_WCDMA: {

+                    LYVERBLOG("+[ril][gcil]: wcdma_mcc = %d,wcdma_mnc = %d,wcdma_lac = %d,wcdma_cid = %d,wcdma_psc = %d,wcdma_signalStrength = %d,wcdma_bitErrorRate = %d\n",

+                        msg[i]->cellinfo.CellInfo.wcdma.cellIdentityWcdma.mcc,

+                        msg[i]->cellinfo.CellInfo.wcdma.cellIdentityWcdma.mnc,

+                        msg[i]->cellinfo.CellInfo.wcdma.cellIdentityWcdma.lac,

+                        msg[i]->cellinfo.CellInfo.wcdma.cellIdentityWcdma.cid,

+                        msg[i]->cellinfo.CellInfo.wcdma.cellIdentityWcdma.psc,

+                        msg[i]->cellinfo.CellInfo.wcdma.signalStrengthWcdma.signalStrength,

+                        msg[i]->cellinfo.CellInfo.wcdma.signalStrengthWcdma.bitErrorRate);

+                    break;

+                }

+                case RIL_CELL_INFO_TYPE_CDMA: {

+                    LYVERBLOG("+[ril][gcil]: cdma_networkId = %d,cdma_systemId = %d,cdma_basestationId = %d,cdma_longitude = %d,cdma_latitude = %d,cdma_dbm = %d,cdma_ecio = %d,cdma_Evdo_dbm = %d,cdma_Evdo_ecio = %d,cdma_Evdo_signalNoiseRatio = %d\n",

+                        msg[i]->cellinfo.CellInfo.cdma.cellIdentityCdma.networkId,

+                        msg[i]->cellinfo.CellInfo.cdma.cellIdentityCdma.systemId,

+                        msg[i]->cellinfo.CellInfo.cdma.cellIdentityCdma.basestationId,

+                        msg[i]->cellinfo.CellInfo.cdma.cellIdentityCdma.longitude,

+                        msg[i]->cellinfo.CellInfo.cdma.cellIdentityCdma.latitude,

+                        msg[i]->cellinfo.CellInfo.cdma.signalStrengthCdma.dbm,

+                        msg[i]->cellinfo.CellInfo.cdma.signalStrengthCdma.ecio,

+                        msg[i]->cellinfo.CellInfo.cdma.signalStrengthEvdo.dbm,

+                        msg[i]->cellinfo.CellInfo.cdma.signalStrengthEvdo.ecio,

+                        msg[i]->cellinfo.CellInfo.cdma.signalStrengthEvdo.signalNoiseRatio);

+                    break;

+                }

+                case RIL_CELL_INFO_TYPE_LTE: {

+                    LYVERBLOG("+[ril][gcil]: lte_mcc = %d,lte_mnc = %d,lte_ci = %d,lte_pci = %d,lte_tac = %d,lte_signalStrength = %d,lte_rsrp = %d,lte_rsrq = %d,lte_rssnr = %d,lte_cqi = %d,lte_timingAdvance = %d\n",

+                        msg[i]->cellinfo.CellInfo.lte.cellIdentityLte.mcc,

+                        msg[i]->cellinfo.CellInfo.lte.cellIdentityLte.mnc,

+                        msg[i]->cellinfo.CellInfo.lte.cellIdentityLte.ci,

+                        msg[i]->cellinfo.CellInfo.lte.cellIdentityLte.pci,

+                        msg[i]->cellinfo.CellInfo.lte.cellIdentityLte.tac,

+                        msg[i]->cellinfo.CellInfo.lte.signalStrengthLte.signalStrength,

+                        msg[i]->cellinfo.CellInfo.lte.signalStrengthLte.rsrp,

+                        msg[i]->cellinfo.CellInfo.lte.signalStrengthLte.rsrq,

+                        msg[i]->cellinfo.CellInfo.lte.signalStrengthLte.rssnr,

+                        msg[i]->cellinfo.CellInfo.lte.signalStrengthLte.cqi,

+                        msg[i]->cellinfo.CellInfo.lte.signalStrengthLte.timingAdvance);

+                    break;

+                }

+                case RIL_CELL_INFO_TYPE_TD_SCDMA: {

+                    LYVERBLOG("+[ril][gcil]: tdscdma_mcc = %d,tdscdma_mnc = %d,tdscdma_lac = %d,tdscdma_cid = %d,tdscdma_cpid = %d,tdscdma_rscp = %d\n",

+                        msg[i]->cellinfo.CellInfo.tdscdma.cellIdentityTdscdma.mcc,

+                        msg[i]->cellinfo.CellInfo.tdscdma.cellIdentityTdscdma.mnc,

+                        msg[i]->cellinfo.CellInfo.tdscdma.cellIdentityTdscdma.lac,

+                        msg[i]->cellinfo.CellInfo.tdscdma.cellIdentityTdscdma.cid,

+                        msg[i]->cellinfo.CellInfo.tdscdma.cellIdentityTdscdma.cpid,

+                        msg[i]->cellinfo.CellInfo.tdscdma.signalStrengthTdscdma.rscp);

+                    break;

+                }

+                default:

+                    break;

+            }

+        }

+        LYVERBLOG("+[ril][gcil]: ok!!\n");

+    }

+    for (int i = 0; i < num; i++) 
+    {
+        if (msg[i]!=NULL)
+        {    
+            free(msg[i]);
+            msg[i]=NULL;
+        }
+    }
+    free(msg);
+    msg=NULL;
+    return 0;
+}
+int eventSetUnsolCellInfoListrate(char ** argv)

+{
+    lynqBase msg;

+    if(argv[0]==NULL)

+    {

+        LYERRLOG("+[ril][sucilr]:Please  input unsolicited cell infomation list rate,and try again!\n");

+        return -1;

+    }

+    int rate = atoi(argv[0]);

+    lynq_set_unsol_cell_info_listrate(rate,&msg);

+    LYINFLOG("request is %d,token is %x,error is %d\n",msg.request,msg.token,msg.e);

+    if(msg.e!=0)

+    {

+        LYVERBLOG("+[ril][sucilr]: error num = %d\n",msg.e);

+    }

+    else

+    {

+        LYVERBLOG("+[ril][sucilr]: ok!!\n");

+    }

+    return 0;
+}
+int eventQueryNeighboringCellids(char ** argv)

+{
+    neighboringCellIDs **msg=NULL;

+    int num=5;
+    int realNum =0;
+    int32_t token=0;
+    msg = (neighboringCellIDs **)malloc(sizeof(neighboringCellIDs *)*num);
+    if(msg==NULL)
+    {
+        RLOGD("malloc LYNQ_Data_Call_Response_v11 fail \n");
+        return -1;
+    }
+    for(int i =0;i<num;i++)
+    {
+        msg[i] = (neighboringCellIDs*)malloc(sizeof(neighboringCellIDs));
+        msg[i]->cid = (char*)malloc(sizeof(char));
+        if (msg[i]==NULL)
+        {
+            for (int n=0;n<i;n++)
+            {
+                free(msg[n]->cid);
+                free(msg[n]);
+            }
+            return -1;
+        }
+        memset(msg[i],0,sizeof(neighboringCellIDs));
+    }

+    msg[0]->base.e=(RIL_Errno)(-1);

+    token = lynq_query_neighboring_cellids(msg, num, &realNum);

+    if(msg[0]->base.e!=0)

+    {

+        LYVERBLOG("+[ril][gncid]: error num = %d\n",msg[0]->base.e);

+    }

+    else

+    {

+        LYINFLOG("request is %d,token is %x,error is %d\n",msg[0]->base.request,msg[0]->base.token,msg[0]->base.e);

+        for(int i =0;i<realNum;i++)

+        {

+            LYVERBLOG("+[ril][gncid]: cid = %s,rssi = %d\n",msg[i]->cid,msg[i]->rssi);

+        }

+        LYVERBLOG("+[ril][gncid]: ok!!\n");

+    }

+    for (int i = 0; i < num; i++) 
+    {
+        if (msg[i]!=NULL)
+        {
+            free(msg[i]->cid);
+            msg[i]->cid=NULL;
+            free(msg[i]);
+            msg[i]=NULL;
+        }
+    }
+    free(msg);
+    msg=NULL;
+    return 0;
+}
+int eventSetBandMode(char ** argv)

+{
+    lynqBase msg;

+    if(argv[0]==NULL)

+    {

+        LYERRLOG("+[ril][sbm]: Please  input band mode,and try again!\n");

+        return -1;

+    }

+    int mode = atoi(argv[0]);

+    lynq_set_band_mode(mode,&msg);

+    LYINFLOG("request is %d,token is %x,error is %d\n",msg.request,msg.token,msg.e);

+    if(msg.e!=0)

+    {

+        LYVERBLOG("+[ril][sbm]: error num = %d\n",msg.e);

+    }

+    else

+    {

+        LYVERBLOG("+[ril][sbm]: ok!!\n");

+    }

+    return 0;

+}
+int eventQueryAvailableBandmode(char ** argv)

+{
+    availableBandMode msg;

+    lynq_query_available_bandmode(&msg);

+    char buffer[256] = {0};

+    char element[256] = {0};

+    LYINFLOG("request is %d,token is %x,error is %d\n",msg.base.request,msg.base.token,msg.base.e);

+    if(msg.bandmode[0]>0)
+    {

+        for(int i =1;i<=msg.bandmode[0];i++)
+        {

+            sprintf(element,"%d,",msg.bandmode[i]);

+            strncat(buffer, element, strlen(element));

+        }

+        LYVERBLOG("+[ril][qabm]: availableBandMode = %s\n",buffer);

+        LYVERBLOG("+[ril][qabm]: ok!!\n",buffer);

+        return 0;

+    }

+    LYVERBLOG("+[ril][qabm]: error num = %d\n",msg.base.e);

+    LYINFLOG("available band mode is null");

+    return 0;
+}
+int eventRadioOn(char ** argv)

+{
+    lynqBase msg;

+    if(argv[0]==NULL)

+    {

+        LYERRLOG("+[ril][rpo]: Please  input radio on value,0 or 1,and try again!\n");

+        return -1;

+    }

+    int state = atoi(argv[0]);

+    lynq_radio_on(state,&msg);

+    LYINFLOG("request is %d,token is %x,error is %d\n",msg.request,msg.token,msg.e);

+    if(msg.e!=0)

+    {

+        LYVERBLOG("+[ril][rpo]: error num = %d\n",msg.e);

+    }

+    else

+    {

+        LYVERBLOG("+[ril][rpo]: ok!!\n");

+    }

+    return 0;
+}
+int eventQueryRadioTech(char ** argv)

+{
+    radioTechnology msg;

+    char output[1024] = {0};

+    lynq_query_radio_tech(&msg);

+    LYINFLOG("request is %d,token is %x,error is %d\n",msg.base.request,msg.base.token,msg.base.e);

+    if(msg.base.e!=0)

+    {

+        LYVERBLOG("+[ril][vrt]: error num = %d\n",msg.base.e);

+    }

+    else

+    {

+        LYVERBLOG("+[ril][vrt]: RadioTech = %d\n",msg.radioTech);

+        LYVERBLOG("+[ril][vrt]: ok!!\n");

+    }

+    return 0;
+}

+int eventSolicitedSignalStrength(char ** argv)

+{
+    solicitedSignalStrength msg;

+    lynq_solicited_signal_strength(&msg);

+    LYINFLOG("request is %d,token is %x,error is %d\n",msg.base.request,msg.base.token,msg.base.e);

+    if(msg.base.e!=0)

+    {

+        LYVERBLOG("+[ril][sst]: error num = %d\n",msg.base.e);

+    }

+    else

+    {

+        LYVERBLOG("+[ril][sst]: GW_signalStrength = %d,GW_bitErrorRate = %d,GW_timingAdvance = %d\n",

+            msg.signalStrength.GW_SignalStrength.signalStrength,

+            msg.signalStrength.GW_SignalStrength.bitErrorRate,

+            msg.signalStrength.GW_SignalStrength.timingAdvance);

+        LYVERBLOG("+[ril][sst]: CDMA_dbm = %d,CDMA_ecio = %d\n",

+            msg.signalStrength.CDMA_SignalStrength.dbm,

+            msg.signalStrength.CDMA_SignalStrength.ecio);

+        LYVERBLOG("+[ril][sst]: EVDO_dbm = %d,EVDO_ecio = %d,EVDO_signalNoiseRatio = %d\n",

+            msg.signalStrength.EVDO_SignalStrength.dbm,

+            msg.signalStrength.EVDO_SignalStrength.ecio,

+            msg.signalStrength.EVDO_SignalStrength.signalNoiseRatio);

+        LYVERBLOG("+[ril][sst]: LTE_signalStrength = %d,LTE_rsrp = %d,LTE_rsrq = %d,LTE_rssnr = %d,LTE_cqi = %d,LTE_timingAdvance = %d\n",

+            msg.signalStrength.LTE_SignalStrength.signalStrength,

+            msg.signalStrength.LTE_SignalStrength.rsrp,

+            msg.signalStrength.LTE_SignalStrength.rsrq,

+            msg.signalStrength.LTE_SignalStrength.rssnr,

+            msg.signalStrength.LTE_SignalStrength.cqi,

+            msg.signalStrength.LTE_SignalStrength.timingAdvance);

+        LYVERBLOG("+[ril][sst]: TD_SCDMA_signalStrength = %d,TD_SCDMA_bitErrorRate = %d,TD_SCDMA_rscp = %d\n",

+            msg.signalStrength.TD_SCDMA_SignalStrength.signalStrength,

+            msg.signalStrength.TD_SCDMA_SignalStrength.bitErrorRate,

+            msg.signalStrength.TD_SCDMA_SignalStrength.rscp);

+        LYVERBLOG("+[ril][sst]: WCDMA_signalStrength = %d,WCDMA_bitErrorRate = %d,WCDMA_rscp = %d,WCDMA_ecno = %d\n",

+            msg.signalStrength.WCDMA_SignalStrength.signalStrength,

+            msg.signalStrength.WCDMA_SignalStrength.bitErrorRate,

+            msg.signalStrength.WCDMA_SignalStrength.rscp,

+            msg.signalStrength.WCDMA_SignalStrength.ecno);

+        LYVERBLOG("+[ril][sst]: ok!!\n");

+    }

+    return 0;
+}
+int eventModemOn(char **argv)

+{
+    lynqBase msg;

+    if(argv[0]==NULL)

+    {

+        LYERRLOG("+[ril][mpo]: Please  input mode on value,0 or 1,and try again!\n");

+        return -1;

+    }

+    int state = atoi(argv[0]);

+    lynq_modem_on(state,&msg);

+    //printf("request is %d,token is %x,error is %d\n",msg.request,msg.token,msg.e);

+    LYINFLOG("request is %d,token is %x,error is %d\n",msg.request,msg.token,msg.e);

+    if(msg.e!=0)

+    {

+        LYVERBLOG("+[ril][mpo]: error num = %d\n",msg.e);

+    }

+    else

+    {

+        LYVERBLOG("+[ril][mpo]: ok!!\n");

+    }

+    return 0;
+}

+int eventSetupDataCall(char ** argv)

+{
+    int32_t token;

+    int state=0;
+    token = lynq_data_enable_data(&state);
+    //printf("pdn state is %s\n",state<0?"disconnect":"connect");

+    if(state<0)

+    {

+        LYVERBLOG("+[ril][edc]: error num = %d\n",RIL_E_GENERIC_FAILURE);

+    }

+    else

+    {

+        LYVERBLOG("+[ril][edc]: ok!!\n");

+    }

+    return 0;
+}
+int eventDeactiveDataCall(char ** argv)

+{
+    int32_t token;
+    int state=0;

+    token = lynq_data_dectivate_data_call(&state);

+    LYVERBLOG("+[ril][ddc]: ok!!\n");

+    //printf("Factory_result pdn state is %s\n",state<0?"connect":"disconnect");

+    return 0;
+}
+int eventGetDataCalllist(char ** argv)

+{
+    int32_t token=0;

+    int num=5;
+    int realNum=0;
+    LYNQ_Data_Call_Response_v11 **msg=(LYNQ_Data_Call_Response_v11**)malloc(sizeof(LYNQ_Data_Call_Response_v11*)*num);
+    if (msg == NULL)
+    {
+        LYERRLOG("+[ril][gdcl]: malloc LYNQ_Data_Call_Response_v11 fail \n");

+        return -1;
+    }
+    for(int i =0;i<num;i++)
+    {
+        msg[i] = (LYNQ_Data_Call_Response_v11*)malloc(sizeof(LYNQ_Data_Call_Response_v11));
+        if (msg[i]==NULL)
+        {
+            for (int n=0;n<i;n++)
+            {
+                free(msg[n]);
+            }
+            return -1;
+        }
+        memset(msg[i],0,sizeof(LYNQ_Data_Call_Response_v11));
+    }
+    token = lynq_get_data_call_list(msg, num,&realNum);

+    /*

+    for(int i = 0; i<realNum; i++)
+    {

+        printf("status is %d,\nsuggestedRetryTime is %d,\ncid is %d,\nactive is %d,\nmtu is %d\n",msg[i]->status,msg[i]->suggestedRetryTime,msg[i]->cid,msg[i]->active,msg[i]->mtu);
+        printf("type is %s\n",msg[i]->type);
+        printf("ifname is %s\n",msg[i]->ifname);
+        printf("addresses is %s\n",msg[i]->addresses);
+        printf("dnses is %s\n",msg[i]->dnses);
+        printf("gateways is %s\n",msg[i]->gateways);
+        printf("pcscf is %s\n",msg[i]->pcscf);
+    }

+    */

+    if(realNum>0)

+    {

+    

+        //printf("Factory_result error code 1\n");

+        for(int i = 0; i<realNum; i++)

+        {

+            LYVERBLOG("+[ril][gdcl]: status = %d,suggestedRetryTime = %d,cid = %d,active = %d,mtu = %d\n",msg[i]->status,msg[i]->suggestedRetryTime,msg[i]->cid,msg[i]->active,msg[i]->mtu);

+            LYVERBLOG("+[ril][gdcl]: type = %s,ifname = %s,addresses = %s,dnses = %s,gateways = s%,pcscf = %s\n",msg[i]->type,msg[i]->ifname,msg[i]->addresses,msg[i]->dnses,msg[i]->gateways,msg[i]->pcscf);

+        }

+        LYVERBLOG("+[ril][gdcl]: ok!!\n");

+    }

+    else

+    {

+        LYVERBLOG("+[ril][gdcl]: error num = %d\n",RIL_E_GENERIC_FAILURE);

+    }

+    for (int i = 0; i < num; i++) 
+    {
+        if (msg[i]!=NULL)
+        {    
+            free(msg[i]);
+            msg[i]=NULL;
+        }
+    }
+    free(msg);
+    msg=NULL;
+    return 0;

+}
+

+int eventGetSimStatus(char ** argv)

+{
+    static int32_t token=0;

+    simStatus * sim_status=NULL;
+    sim_status = (simStatus *)malloc(sizeof(simStatus));
+    token = lynq_get_sim_status(sim_status);

+    LYINFLOG("card_status:%d,card_type:%d,pin_state:%d,error_code:%d,request:%d,token:%x\n",sim_status->card_status,

+        sim_status->card_type,sim_status->pin_state,sim_status->base.e,sim_status->base.request,sim_status->base.token);

+    if(sim_status->base.e!=0)

+    {

+        LYVERBLOG("+[ril][gss]: error num = %d\n",sim_status->base.e);

+    }

+    else

+    {

+        LYVERBLOG("+[ril][gss]: card_status = %d,card_type = %d,pin_state = %d\n",sim_status->card_status,

+        sim_status->card_type,sim_status->pin_state);

+        LYVERBLOG("+[ril][gss]: ok!!\n");

+    }

+    if (sim_status->base.e==-1)

+    {
+        free(sim_status);
+        sim_status=NULL;
+        return -1;
+    }
+    free(sim_status);
+    sim_status=NULL;
+    return 0;
+}
+int eventGetImsi(char ** argv)

+{
+    simImsi msg;

+    lynq_get_imsi(&msg);
+    //printf("request is %d, token is %x,error_code %d,imsi is %s\n",msg.base.request,msg.base.token, msg.base.e,msg.imsi);

+    LYINFLOG("request is %d, token is %x,error_code %d,imsi is %s\n",msg.base.request,msg.base.token, msg.base.e,msg.imsi);

+    if(msg.base.e!=0)

+    {

+        LYVERBLOG("+[ril][gimsi]: error num = %d\n",msg.base.e);

+    }

+    else

+    {

+        LYVERBLOG("+[ril][gimsi]: imsi = %s\n",msg.imsi);

+        LYVERBLOG("+[ril][gimsi]: ok!!\n");

+    }

+    if (msg.base.e==-1)

+    {
+        return -1;
+    }
+    return 0;
+}

+int eventSendSms(char ** argv)

+{
+    int32_t token=0;

+    if(argv[0]==NULL||argv[1]==NULL)

+    {

+        LYERRLOG("+[ril][ssm: Please  input telephonyNumber and message,and try again!\n");

+        return -1;

+    }

+    char *telephonyNumber = argv[0];

+    char *msgcont = argv[1];

+    smsResponse msg;
+    msg.smsResp.ackPDU=NULL;

+    //const char *telephonyNumber ="10086";

+    //const char * msgcont = "103";

+    token = lynq_send_sms(telephonyNumber, 0,msgcont, NULL,&msg);

+    //printf("request is %d,token is %x,error is %d,\nmessageRef is %d,ackPDU is %s,errorCode is %d\n",msg.base.request,msg.base.token,msg.base.e,

+        //msg.smsResp.messageRef,msg.smsResp.ackPDU,msg.smsResp.errorCode);

+    LYINFLOG("request is %d,token is %x,error is %d,messageRef is %d,ackPDU is %s,errorCode is %d\n",msg.base.request,msg.base.token,msg.base.e,

+        msg.smsResp.messageRef,msg.smsResp.ackPDU,msg.smsResp.errorCode);

+    if(msg.base.e!=0)

+    {

+        LYVERBLOG("+[ril][ssm]: error num = %d\n",msg.base.e);

+    }

+    else

+    {

+        LYVERBLOG("+[ril][ssm]: ok!!\n");

+    }

+    return 0;
+}
+int eventImsSendSms(char ** argv)

+{
+    int32_t token=0;

+    smsResponse msg;

+    if(argv[0]==NULL||argv[1]==NULL)

+    {

+        LYERRLOG("+[ril][iss]:Please  input telephonyNumber and message,and try again!\n");

+        return -1;

+    }

+    char *telephonyNumber = argv[0];

+    char *msgcont = argv[1];

+    msg.smsResp.ackPDU=NULL;

+    //const char *telephonyNumber ="10086";

+    //const char * msgcont = "103";

+    const char* retryNum ="0";

+    const char *messageRef = "201";

+    token = lynq_Ims_send_sms(telephonyNumber, 0,msgcont,retryNum,messageRef, NULL,&msg);

+    LYINFLOG("request is %d,token is %x,error is %d,messageRef is %d,ackPDU is %s,errorCode is %d\n",msg.base.request,msg.base.token,msg.base.e,

+        msg.smsResp.messageRef,msg.smsResp.ackPDU,msg.smsResp.errorCode);

+    if(msg.base.e!=0)

+    {

+        LYVERBLOG("+[ril][iss]: error num = %d\n",msg.base.e);

+    }

+    else

+    {

+        LYVERBLOG("+[ril][iss]: ok!!\n");

+    }

+    return 0;
+}
+int eventWriteSmsToSim(char ** argv)

+{
+    int32_t token=0;

+    messageStoreInfo msg;

+    if(argv[0]==NULL||argv[1]==NULL||argv[2]==NULL)

+    {

+        LYERRLOG("+[ril][wsts]: Please  input telephonyNumber,message and sms status,and try again!\n");

+        return -1;

+    }

+    const int smsStatus = atoi(argv[0]);

+    const char *recPhonNum = argv[1];

+    const char *msgcont = argv[2];

+    token = lynq_write_sms_to_sim(smsStatus,recPhonNum,0,msgcont,NULL,&msg);

+    LYINFLOG("request is %d,token is %x,error is %d,\nmessage strore index is %d\n",msg.base.request,msg.base.token,msg.base.e,

+        msg.msgStoreIndex);

+    if(msg.base.e!=0)

+    {

+        LYVERBLOG("+[ril][wsts]: error num = %d\n",msg.base.e);

+    }

+    else

+    {

+        LYVERBLOG("+[ril][wsts]: ok!!\n");

+    }

+    return 0;
+}
+int eventReportSmsMemoryStatus(char **argv)

+{
+    lynqBase msg;

+    char output[1024] = {0};

+    if(argv[0]==NULL)

+    {

+        LYERRLOG("+[ril][rsms]: Please  input memory status,0 or 1,and try again!\n");

+        return -1;

+    }

+    int value = atoi(argv[0]);

+    lynq_report_sms_memory_status(value,&msg);

+    //printf("request is %d,token is %x,error is %d,\n",msg.request,msg.token,msg.e);

+    LYINFLOG("request is %d,token is %x,error is %d\n",msg.request,msg.token,msg.e);

+    if(msg.e!=0)

+    {

+        LYVERBLOG("+[ril][rsms]: error num = %d\n",msg.e);

+    }

+    else

+    {

+        LYVERBLOG("+[ril][rsms]: ok!!\n");

+    }

+    return 0;
+}
+int eventDeletSmsOnSim(char **argv)

+{
+    lynqBase msg;

+    if(argv[0]==NULL)

+    {

+        LYERRLOG("+[ril][dsos]: Please  input sms index,and try again!\n");

+        return -1;

+    }

+    int value = atoi(argv[0]);

+    lynq_delet_sms_on_sim(value,&msg);

+    //printf("request is %d,token is %x,error is %d,\n",msg.request,msg.token,msg.e);

+    LYINFLOG("request is %d,token is %x,error is %d\n",msg.request,msg.token,msg.e);

+    if(msg.e!=0)

+    {

+        LYVERBLOG("+[ril][dsos]: error num = %d\n",msg.e);

+    }

+    else

+    {

+        LYVERBLOG("+[ril][dsos]: ok!!\n");

+    }

+    return 0;
+}
+int eventGetSmscAddress(char **argv)

+{
+    smscCbInfo msg;

+    lynq_get_smsc_address(&msg);
+    //printf("request is %d,token is %x,error is %d,smsc address is %s\n",msg.base.request,msg.base.token,msg.base.e,msg.smsc);

+    LYINFLOG("request is %d,token is %x,error is %d,smsc address is %s\n",msg.base.request,msg.base.token,msg.base.e,msg.smsc);

+    if(msg.base.e!=0)

+    {

+        LYVERBLOG("+[ril][gsmsc]: error num = %d\n",msg.base.e);

+    }

+    else

+    {

+        LYVERBLOG("+[ril][gsmsc]: smsc = %s\n",msg.smsc);

+        LYVERBLOG("+[ril][gsmsc]: ok!!\n");

+    }

+    return 0;
+}
+int eventSetSmscAddress(char **argv)

+{
+    lynqBase msg;

+    if(argv[0]==NULL)

+    {

+        LYERRLOG("+[ril][ssmsc]: Please  input smsc address,and try again!\n");

+        return -1;

+    }

+    const char* serviceNumber = argv[0];

+    lynq_set_smsc_address(serviceNumber,&msg);

+    //printf("request is %d,token is %x,error is %d,\n",msg.request,msg.token,msg.e);

+    LYINFLOG("request is %d,token is %x,error is %d\n",msg.request,msg.token,msg.e);

+    if(msg.e!=0)

+    {

+        LYVERBLOG("+[ril][ssmsc]: error num = %d\n",msg.e);

+    }

+    else

+    {

+        LYVERBLOG("+[ril][ssmsc]: ok!!\n");

+    }

+    return 0;

+}

+int evenStoreSmsToMemory(char **argv)

+{
+    lynqBase msg;

+    msg.e = (RIL_Errno)(-1);

+    //printf("argv[2]%d,argv[3]%s,argv[4]%s\n",atoi(argv[2]), argv[3],argv[4]);

+    lynq_store_sms_to_memory(RIL_SOCKET_1,atoi(argv[0]), argv[1],argv[2],&msg);

+    if(msg.e!=0)

+    {

+        LYVERBLOG("+[ril][sstm]: error num = %d\n",msg.e);

+    }

+    else

+    {

+        LYVERBLOG("+[ril][sstm]: ok!!\n");

+    }

+    return 0;
+}
+int eventGetSmsFromMemory(char **argv)

+{
+    lynqBase msg;
+    msg.e = (RIL_Errno)(-1);
+    storeMessageInfo sms;

+    lynq_get_sms_from_memory(atoi(argv[0]),&sms, &msg);

+    if(msg.e!=0)

+    {

+        LYVERBLOG("+[ril][gstfm]: error num = %d\n",msg.e);

+    }

+    else

+    {

+        LYVERBLOG("+[ril][gsfm]: Index = %d,Message = %s,Status = %d,teleNum= %s\n",sms.index,sms.message,sms.status,sms.teleNum);

+        LYVERBLOG("+[ril][gsfm]: ok!!\n");

+    }

+    return 0;
+}
+int eventDeleteMessageFromMemory(char **argv)

+{
+    lynqBase msg;

+    msg.e = (RIL_Errno)(-1);

+    lynq_delete_message_from_memory(atoi(argv[0]), &msg);

+    if(msg.e!=0)

+    {

+        LYVERBLOG("+[ril][dmfm]: error num = %d\n",msg.e);

+    }

+    else

+    {

+        LYVERBLOG("+[ril][dmfm]: ok!!\n");

+    }

+    return 0;
+}

+

+//int callController(int *item, char *value,int command);

+//int networkcontroller(int *item, char *value,int command);

+//int datacontroller(int *item, char *value,int command);

+//int simcontroller(int *item, char *value,int command);

+//int smscontroller(int *item, char *value,int command);

+

+int ril_test(char *api,char *string) {

+    char *argv[MAX_P] = {0};

+    parseParameters(string,argv);

+    RIL_COMMAND *command = find_command(api,api_commands);

+    if(command)

+    {

+        (*(command->func)) (argv);

+    }

+    else

+    {

+        LYERRLOG("Can not find this command from function_test!!!\n");

+    }

+    /*

+    switch (module) {

+        case CALL_API:

+        {

+            callController(menu[1],argv);

+            break;

+        }

+        case NETWORK_API:

+        {

+            networkcontroller(menu[1],argv);

+            break;

+        }

+        case DATA_API:

+        {

+            datacontroller(menu[1],argv);

+            break;

+        }

+        case SMS_API:

+        {

+            smscontroller(menu[1],argv);

+            //RLOGD("test_api,RIL_API");

+            break;

+        }

+        case SIM_API:

+        {

+            simcontroller(menu[1],argv);

+            break;

+        }

+        default:

+            break;

+    }

+    */

+    return 0;

+}

+/*

+int callController(char *api,char **param)

+{

+    char output[1024] = {0};

+    RIL_COMMAND *command = find_command(api,api_commands);

+    (*(command->func)) (param);

+    

+    switch(call_api_choice)

+    {

+        case DAIL:

+        {

+            int num=0;

+            char *argv[2]={0};

+            if(num==parseParam(1, value,argv))

+            {

+                eventDial(argv[1],command);

+            }

+            else

+            {

+                printf("please input inavaliable call number,and try again!\n");

+                emResultNotify(output,command);

+            }

+            

+            //eventDial(item[4],command);

+            //printf("please input inavaliable call number,and try again!\n");

+            //emResultNotify(output,command);

+            

+            break;

+        }

+        case ANSWER_CALL:

+        {

+            eventAnswer(command);

+            break;

+        }

+        case HANGUP_CALL:

+        {

+            int num=0;

+            char *argv[2]={0};

+            if(num==parseParam(1, value,argv))

+            {

+                eventCallHangUp(atoi(&argv[1][0]),command);

+            }

+            else

+            {

+                printf("please input call id,and try again!\n");

+                emResultNotify(output ,command);

+            }

+            break;

+        }

+        case REJECT_CALL:

+        {

+            eventRejectCall(command);

+            break;

+        }

+        case AUTO_ANSWER_CALL:

+        {

+            int num=0;

+            char *argv[2]={0};

+            if(num==parseParam(1, value,argv))

+            {

+                eventAutoAnswer(atoi(&argv[1][0]),command);

+            }

+            else

+            {

+                sprintf(output,"please input auto answer mode value:0 or 1,and try again!\n");

+                emResultNotify(output,command);

+            }

+            break;

+        }

+        case SET_MUTE_STATUS:

+        {

+            int num=0;

+            char *argv[2]={0};

+            if(num==parseParam(1, value,argv))

+            {

+                eventSetMute(atoi(&argv[1][0]),command);

+            }

+            else

+            {

+                sprintf(output,"please input set mute mode:0 or 1,and try again!\n");

+                emResultNotify(output,command);

+            }

+            break;

+        }

+        case GET_MUTE_STATUS:

+        {

+            eventGetMute(command);

+            break;

+        }

+        case SET_DTMF:

+        {

+            int num=0;

+            char *argv[2]={0};

+            if(num==parseParam(1, value,argv))

+            {

+                eventSetDTMF(argv[1][0],command);

+            }

+            else

+            {

+                sprintf(output,"please input DTMF value:0-9,8,#,and try again!\n");

+                emResultNotify(output,command);

+            }

+            break;

+        }

+        case SET_DTMF_V:

+        {

+            int num=0;

+            char *argv[2]={0};

+            if(num==parseParam(1, value,argv))

+            {

+                eventSetDTMFVolume(atoi(&argv[1][0]),command);

+            }

+            else

+            {

+                sprintf(output,"please input volume value,0-36,and try again!\n");

+                emResultNotify(output,command);

+            }

+            break;

+        }

+        case DO_MULTI_CONF:

+        {

+            eventDoMultiConference(command);

+            break;

+        }

+        case OTHER_CALL_HOLD:

+        {

+            int num=0;

+            char *argv[2]={0};

+            if(num==parseParam(1, value,argv))

+            {

+                eventOthercallHold(atoi(&argv[1][0]),command);

+            }

+            else

+            {

+                sprintf(output,"please input call id, and try again!\n");

+                emResultNotify(output,command);

+            }

+            break;

+        }

+        case HANGUP_WAITING_CALL:

+        {

+            eventHangupWatingForCall(command);

+            break;

+        }

+        case HANGUP_FORE_RES_BACK:

+        {

+            eventHangupForegroundResumeBackground(command);

+            break;

+        }

+        case SWITCH_HOLD_AND_ACTIVE_CALL:

+        {

+            eventSwitchWaitOrHoldAndActiveCall(command);

+            break;

+        }

+        case GET_LAST_CALL_FAIL_CAUSE:

+        {

+            eventLastCallFailCause(command);

+            break;

+        }

+        default:

+            break;

+    }

+    return 0;

+}

+int networkcontroller(char *api,char **param)

+{

+    int network_api_choice = item[3];

+    char output[1024] = {0};

+    switch(network_api_choice)

+    {

+        case QUERY_OPERATOR:

+        {

+            eventQueryOperator(command);

+            break;

+        }

+        case QUERY_NETWORK_SELECTION_MODE:

+        {

+            eventQueryNetSelectMode(command);

+            break;

+        }

+        case SET_NETWORK_SELECTION_MODE:

+        {

+            int num=0;

+            char *argv[2]={0};

+            if(num==parseParam(1, value,argv))

+            {

+                eventSetNetSelectMode(atoi(&argv[1][0]),command);

+            }

+            else

+            {

+                sprintf(output,"please input network selection mode 0 or 1, and try again!\n");

+                emResultNotify(output,command);

+            }

+            break;

+        }

+        case QUERY_AVAILABLE_NETWORKS:

+        {

+            eventQueryAvailableNetwork(command);

+            break;

+        }

+        case QUERY_REGISTRATION_STATE:

+        {

+            int num=0;

+            char *argv[2]={0};

+            if(num==parseParam(1, value,argv))

+            {

+                eventQueryRegistrationState(argv[1],command);

+            }

+            else

+            {

+                sprintf(output,"please input type voice,data,or ims, and try again!\n");

+                emResultNotify(output,command);

+            }

+            break;

+        }

+        case GET_PREFERRED_NETWORK_TYPE:

+        {

+            eventQueryPrefferredNetworkType(command);

+            break;

+        }

+        case SET_PREFERRED_NETWORK_TYPE:

+        {

+            int num=0;

+            char *argv[2]={0};

+            if(num==parseParam(1, value,argv))

+            {

+                eventSetPrefferredNetworkType(atoi(&argv[1][0]),command);

+            }

+            else

+            {

+                sprintf(output,"please input preferred network type value , and try again!\n");

+                emResultNotify(output,command);

+            }

+            break;

+        }

+        case GET_CELL_INFO_LIST:

+        {

+            eventQueryCellInfo(command);

+            break;

+        }

+        case SET_UNSOL_CELL_INFO_LIST_RATE:

+        {

+            int num=0;

+            char *argv[2]={0};

+            if(num==parseParam(1, value,argv))

+            {

+                eventSetUnsolCellInfoListrate(atoi(&argv[1][0]),command);

+            }

+            else

+            {

+                sprintf(output,"please input unsolicited cell infomation list rate , and try again!\n");

+                emResultNotify(output,command);

+            }

+            break;

+        }

+        case GET_NEIGHBORING_CELL_IDS:

+        {

+            eventQueryNeighboringCellids(command);

+            break;

+        }

+        case SET_BAND_MODE:

+        {

+            int num=0;

+            char *argv[2]={0};

+            if(num==parseParam(1, value,argv))

+            {

+                eventSetBandMode(atoi(&argv[1][0]),command);

+            }

+            else

+            {

+                sprintf(output,"please input band mode, and try again!\n");

+                emResultNotify(output,command);

+            }

+            break;

+        }

+        case QUERY_AVAILABLE_BAND_MODE:

+        {

+            eventQueryAvailableBandmode(command);

+            break;

+        }

+        case RADIO_POWER:

+        {

+            int num=0;

+            char *argv[2]={0};

+            if(num==parseParam(1, value,argv))

+            {

+                eventRadioOn(atoi(&argv[1][0]),command);

+            }

+            else

+            {

+                sprintf(output,"please input radio power status value 0 or 1, and try again!\n");

+                emResultNotify(output,command);

+            }

+            break;

+        }

+        case VOICE_RADIO_TECH:

+        {

+            eventQueryRadioTech(command);

+            break;

+        }

+        case SIGNAL_STRENGTH:

+        {

+            eventSolicitedSignalStrength(command);

+            break;

+        }

+        case MODEM_POWER:

+        {

+            int num=0;

+            char *argv[2]={0};

+            if(num==parseParam(1, value,argv))

+            {

+                eventModemOn(atoi(&argv[1][0]),command);

+            }

+            else

+            {

+                sprintf(output,"please input modem power status value 0 or 1, and try again!\n");

+                emResultNotify(output,command);

+            }

+            break;

+        }

+        default:

+            break;

+    }

+    return 0;

+}

+int datacontroller(char *api,char **param)

+{

+    int data_api_choice = item[3];

+    char output[1024] = {0};

+    switch(data_api_choice)

+    {

+        case SETUP_DATA_CALL:

+        {

+            eventSetupDataCall(command);

+            break;

+        }

+        case DEACTIVATE_DATA_CALL:

+        {

+            eventDeactiveDataCall(command);

+            break;

+        }

+        case GET_DATA_CALL_LIST:

+        {

+            eventGetDataCalllist(command);

+            break;

+        }

+        default:

+            break;

+    }

+    return 0;

+}

+int simcontroller(char *api,char **param)

+{

+    int sim_api_choice = item[3];

+    char output[1024] = {0};

+    switch(sim_api_choice)

+    {

+        case GET_SIM_STATUS:

+        {

+            eventGetSimStatus(command);

+            break;

+        }

+        case GET_IMSI:

+        {

+            eventGetImsi(command);

+            break;

+        }

+        default:

+            break;

+    }

+    return 0;

+}

+int smscontroller(int *item, char *value,int command)

+{

+    int sms_api_choice = item[3];

+    char output[1024] = {0};

+    switch(sms_api_choice)

+    {

+        case SEND_SMS:

+        {

+            int num=0;

+            char *argv[MAX_P]={0};

+            if(num==parseParam(2, value,argv))

+            {

+                eventSendSms(argv[1], argv[2],command);

+            }

+            else

+            {

+                sprintf(output,"please input phone number and message, and try again!\n");

+                emResultNotify(output,command);

+            }

+            break;

+        }

+        case IMS_SEND_SMS:

+        {

+            int num=0;

+            char *argv[MAX_P]={0};

+            if(num==parseParam(2, value,argv))

+            {

+                eventImsSendSms(argv[1], argv[2],command);

+            }

+            else

+            {

+                sprintf(output,"please input phone number and message, and try again!\n");

+                emResultNotify(output,command);

+            }

+            break;

+        }

+        case WRITE_SMS_TO_SIM:

+        {

+            int num=0;

+            char *argv[MAX_P]={0};

+            if(num==parseParam(3, value,argv))

+            {

+                eventWriteSmsToSim(atoi(&argv[1][0]),argv[2], argv[3],command);

+            }

+            else

+            {

+                sprintf(output,"please input sms status,phone number and message, and try again!\n");

+                emResultNotify(output,command);

+            }

+            break;

+        }

+        case REPORT_SMS_MEMORY_STATUS:

+        {

+            int num=0;

+            char *argv[MAX_P]={0};

+            if(num==parseParam(1, value,argv))

+            {

+                eventReportSmsMemoryStatus(atoi(&argv[1][0]),command);

+            }

+            else

+            {

+                sprintf(output,"please input memory status 0 or 1,and try agin!\n");

+                emResultNotify(output,command);

+            }

+            break;

+        }

+        case DELETE_SMS_ON_SIM:

+        {

+            int num=0;

+            char *argv[MAX_P]={0};

+            if(num==parseParam(1, value,argv))

+            {

+                eventDeletSmsOnSim(atoi(&argv[1][0]),command);

+            }

+            else

+            {

+                sprintf(output,"please input sms index,and try agin!\n");

+                emResultNotify(output,command);

+            }

+            break;

+        }

+        case GET_SMSC_ADDRESS:

+        {

+            eventGetSmscAddress(command);

+            break;

+        }

+        case SET_SMSC_ADDRESS:

+        {

+            int num=0;

+            char *argv[MAX_P]={0};

+            if(num==parseParam(1, value,argv))

+            {

+                eventSetSmscAddress(argv[1],command);

+            }

+            else

+            {

+                sprintf(output,"please input serviceNumber,and try agin!\n");

+                emResultNotify(output,command);

+            }

+            break;

+        }

+    }

+    return 0;

+}

+*/

+

+

diff --git a/packages/apps/lynq-function-test/src/ril_test.h b/packages/apps/lynq-function-test/src/ril_test.h
new file mode 100644
index 0000000..7b1aa66
--- /dev/null
+++ b/packages/apps/lynq-function-test/src/ril_test.h
@@ -0,0 +1,130 @@
+/*============================================================================= 

+**     FileName: ril_test.h

+**     Desc: about function test

+**     Author: Warren

+**     Version: V1.0

+**     LastChange: 2021-02-26 

+**     History: 

+=============================================================================*/

+

+#ifndef __LYNQ_RIL_TEST_H__

+#define __LYNQ_RIL_TEST_H__

+typedef enum {
+   SIM_API  = 0,

+   CALL_API,

+   NETWORK_API,
+   DATA_API,
+   SMS_API,

+}RIL_API_MENU;

+

+typedef enum{
+    DAIL= 0,
+    ANSWER_CALL,
+    HANGUP_CALL,
+    REJECT_CALL,
+    AUTO_ANSWER_CALL,
+    SET_MUTE_STATUS,
+    GET_MUTE_STATUS,
+    SET_DTMF,
+    SET_DTMF_V,
+    DO_MULTI_CONF,
+    OTHER_CALL_HOLD,
+    HANGUP_WAITING_CALL,
+    HANGUP_FORE_RES_BACK,
+    SWITCH_HOLD_AND_ACTIVE_CALL,
+    GET_LAST_CALL_FAIL_CAUSE,
+}RIL_CALL_MENU;
+
+typedef enum
+{
+    QUERY_OPERATOR=0,
+    QUERY_NETWORK_SELECTION_MODE,
+    SET_NETWORK_SELECTION_MODE,
+    QUERY_AVAILABLE_NETWORKS,
+    QUERY_REGISTRATION_STATE,
+    GET_PREFERRED_NETWORK_TYPE,
+    SET_PREFERRED_NETWORK_TYPE,
+    GET_CELL_INFO_LIST,
+    SET_UNSOL_CELL_INFO_LIST_RATE,
+    GET_NEIGHBORING_CELL_IDS  ,
+    SET_BAND_MODE,
+    QUERY_AVAILABLE_BAND_MODE,
+    RADIO_POWER,
+    VOICE_RADIO_TECH,
+    SIGNAL_STRENGTH,
+    MODEM_POWER,
+}RIL_NETWORK_MENU;
+
+typedef enum{
+    SETUP_DATA_CALL=0,
+    DEACTIVATE_DATA_CALL,
+    GET_DATA_CALL_LIST,
+}RIL_DATA_MENU;
+
+typedef enum{
+    GET_SIM_STATUS=0,
+    GET_IMSI,
+}RIL_SIM_MENU;
+
+typedef enum{
+    SEND_SMS=0,
+    IMS_SEND_SMS,
+    WRITE_SMS_TO_SIM,
+    REPORT_SMS_MEMORY_STATUS,
+    DELETE_SMS_ON_SIM,
+    GET_SMSC_ADDRESS,
+    SET_SMSC_ADDRESS,
+}RIL_SMS_MENU;
+int eventDial(char **argv);

+int eventAnswer(char **argv);

+int eventAutoAnswer(char **argv);

+int eventSetMute(char **argv);

+int eventGetMute(char **argv);

+int eventLastCallFailCause(char **argv);

+int eventCallHangUp(char **argv);

+int eventRejectCall(char **argv);

+int eventSetDTMF(char **argv);

+int eventSetDTMFVolume(char **argv);

+int eventDoMultiConference(char **argv);

+int eventOthercallHold(char **argv);

+int eventHangupWatingForCall(char **argv);

+int eventHangupForegroundResumeBackground(char **argv);

+int eventSwitchWaitOrHoldAndActiveCall(char ** argv);

+int eventQueryOperator(char ** argv);

+int eventQueryNetSelectMode(char ** argv);

+int eventSetNetSelectMode(char ** argv);

+int eventQueryAvailableNetwork(char **argv);

+int eventQueryRegistrationState(char ** argv);

+int eventQueryPrefferredNetworkType(char ** argv);

+int eventSetPrefferredNetworkType(char ** argv);

+int eventQueryCellInfo(char ** argv);

+int eventSetUnsolCellInfoListrate(char ** argv);

+int eventQueryNeighboringCellids(char ** argv);

+int eventSetBandMode(char ** argv);

+int eventQueryAvailableBandmode(char ** argv);

+int eventRadioOn(char ** argv);

+int eventQueryRadioTech(char ** argv);

+int eventSolicitedSignalStrength(char ** argv);

+int eventModemOn(char **argv);

+int eventSetupDataCall(char ** argv);

+int eventDeactiveDataCall(char ** argv);

+int eventGetDataCalllist(char ** argv);

+int eventGetSimStatus(char ** argv);

+int eventGetImsi(char ** argv);

+int eventSendSms(char ** argv);

+int eventImsSendSms(char ** argv);

+int eventWriteSmsToSim(char ** argv);

+int eventReportSmsMemoryStatus(char **argv);

+int eventDeletSmsOnSim(char **argv);

+int eventGetSmscAddress(char **argv);

+int eventSetSmscAddress(char **argv);

+int evenStoreSmsToMemory(char **argv);

+int eventGetSmsFromMemory(char **argv);

+int eventDeleteMessageFromMemory(char **argv);

+

+

+int ril_test(char *api,char *string);

+
+
+#endif //__LYNQ_RIL_TEST_H__
+

diff --git a/packages/apps/lynq-function-test/src/system_test.cpp b/packages/apps/lynq-function-test/src/system_test.cpp
new file mode 100644
index 0000000..155d4f2
--- /dev/null
+++ b/packages/apps/lynq-function-test/src/system_test.cpp
@@ -0,0 +1,82 @@
+
+
+
+/*============================================================================= 
+**     FileName: dhcp_test.cpp
+**     Desc: about function test
+**     Author: grays
+**     Version: V1.0
+**     LastChange: 2021-08-18 
+**     History: 
+=============================================================================*/
+
+
+#include "function_common.h"
+#include <log/log.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <pthread.h>
+#include "liblog/liblog.h"
+#include "liblog/lynq_deflog.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif   
+#include "include/lynq-system-own.h"
+#ifdef __cplusplus
+}
+#endif
+
+void* thread(void* arg)
+{
+    #if 1 
+    pthread_detach(pthread_self());
+    int edge=0;
+    while(LYNQ_Lpm_Handler){
+        lynq_lpm_handler(edge);//gpio电平变化则上报
+    }
+    #endif
+    pthread_exit(0);
+}
+
+int system_test(char *api,char *string) {
+    char *argv[100] = {0};
+    pthread_t id;
+    int ret;
+    parseParameters(string,argv);
+    int Flag=0;
+    if(!strcmp(api, "init")){
+        LYNQ_Lpm_Init(lynq_lpm_handler);//初始化lpm,监听gpio电平上报事件
+        ret = pthread_create(&id,NULL,thread,NULL); //创建线程来监听gpio电平变化
+        if(ret != 0)
+        {
+            printf("Create pthread error!\n");
+            exit(1);
+        }
+        sleep(2);
+    }else if(!strcmp(api, "deinit")){
+        LYNQ_Lpm_Deinit();//注销lpm。
+    }else if(!strcmp(api,"adc")){
+        int adc_n = atoi(argv[0]);
+        printf("api = %s adc=%d\n", api,LYNQ_Adc_Show(adc_n));//当前电源电压
+    }else if(!strcmp(api, "suspend")){
+        Flag = atoi(argv[0]);
+        LYNQ_Autosleep_Enable(Flag);//使能系统睡眠
+    }else if(!strcmp(api, "Lock")){
+        LYNQ_SLP_WakeLock_Lock(argv[0]);//创建wakelock锁,此时系统无法进入睡眠
+    }else if(!strcmp(api, "Unlock")){
+        LYNQ_SLP_WakeLock_Unlock(argv[0]);//解锁wakelock,此时系统可进入睡眠
+    }else if(!strcmp(api, "powerdown")){
+        Flag = atoi(argv[0]);
+        LYNQ_Power_Down(Flag);//开关机接口,用于选择关机或重启
+    }else if(!strcmp(api, "changemod")){
+        LYNQ_Power_Mode(argv[0]);//开关机接口,用于选择关机或重启
+    }else {
+       printf("invalid api  \n" );
+    }
+
+    return 0;
+}
diff --git a/packages/apps/lynq-function-test/src/system_test.h b/packages/apps/lynq-function-test/src/system_test.h
new file mode 100644
index 0000000..331da81
--- /dev/null
+++ b/packages/apps/lynq-function-test/src/system_test.h
@@ -0,0 +1,6 @@
+#ifndef __LYNQ_SYSTEM_TEST_H__
+#define __LYNQ_SYSTEM_TEST_H__
+int system_test(char *api,char *string);
+
+#endif //__LYNQ_SYSTEM_TEST_H__
+