[feature] cut function test
Change-Id: Ie2fccd8aff332ca543d13a7fc748daf4e7c90b26
diff --git a/packages/apps/lynq-function-test/src/main.cpp b/packages/apps/lynq-function-test/src/main.cpp
old mode 100644
new mode 100755
index f490c22..048861c
--- a/packages/apps/lynq-function-test/src/main.cpp
+++ b/packages/apps/lynq-function-test/src/main.cpp
@@ -3,27 +3,17 @@
#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 "fota_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 "liblynq-broadcast/broadcast_send.h"
#include <gio/gio.h>
#include <glib.h>
-#include "liblynq-driver/libdriver.h"
+//#include "liblynq-driver/libdriver.h"
#ifdef __cplusplus
}
@@ -37,37 +27,12 @@
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_WIFI=0,
+ API_AUDIO,
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 )
{
@@ -138,50 +103,21 @@
// 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"))
+ 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"))
+/*
+ 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);
@@ -205,50 +141,19 @@
// }
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);
+ //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_FOTA:
+ {
+ //fota_test(menu[1],argvHead);
+ break;
+ }
case API_WIFI:
- case API_GNSS:
break;
default:
// printf("pram module error\n");
@@ -274,7 +179,7 @@
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]);
+ //send_broadcast_by_name("function", strlen(argv[2]), argv[2]);
}
else{
LYVERBLOG("+[thhandle]: error num = %d\n", INVALID_CMD);
@@ -360,35 +265,11 @@
}
int main()
{
-
LYLOGEINIT(USER_LOG_TAG);
- LYLOGSET(4);
- registerTriggerCallback(getCallback);
- register_key_info();
- lynqRegisterUnsolicitedResponse(&mytest);
+ // LYLOGSET(4);
/*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];