[API-1138]Revise AT-GNSS's command name
Change-Id: Ia00ee082b34775c072b7a0ab51bc93db1801a373
diff --git a/src/lynq/framework/lynq-ril-service/src/factory/lynq_factory.cpp b/src/lynq/framework/lynq-ril-service/src/factory/lynq_factory.cpp
index e1d6af2..561656e 100755
--- a/src/lynq/framework/lynq-ril-service/src/factory/lynq_factory.cpp
+++ b/src/lynq/framework/lynq-ril-service/src/factory/lynq_factory.cpp
@@ -1,10 +1,10 @@
-#include<sys/types.h>
-#include<sys/socket.h>
-#include<unistd.h>
-#include<netinet/in.h>
-#include<arpa/inet.h>
-#include<netdb.h>
-#include<signal.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <unistd.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <netdb.h>
+#include <signal.h>
#include <log/log.h>
#include <hardware_legacy/power.h>
#include <vendor-ril/telephony/ril.h>
@@ -65,7 +65,7 @@
#include <time.h>
#include "sim.h"
#include <string.h>
-#include<pthread.h>
+#include <pthread.h>
#include <cutils/properties.h>
#include "lynq_at.h"
#ifdef __cplusplus
@@ -112,7 +112,7 @@
void *thread_test(void *arg){
char gnss_buf[128] = {0};
- lynq_factory_response_ttyGS3("+GPS OPEN:OK\n");
+ lynq_factory_response_ttyGS3("OK\r\n");
sprintf(gnss_buf, "%s%d%s", "echo \"GNSS_MODE=", gps_set, "\">>/etc/gnss/mnl.prop");
system(gnss_buf);
sleep(1);
@@ -200,7 +200,7 @@
}
lynq_factory_response_ttyGS3(lynq_factory_buf);
}
- lynq_factory_response_ttyGS3("OK\n");
+ lynq_factory_response_ttyGS3("OK\r\n");
pclose(fp);
return NULL;
}
@@ -248,7 +248,7 @@
}
lynq_factory_response_ttyGS3(lynq_factory_buf);
}
- lynq_factory_response_ttyGS3("OK\n");
+ lynq_factory_response_ttyGS3("OK\r\n");
pclose(fp);
return NULL;
}
@@ -528,7 +528,7 @@
if(check_ok_count >= 120)
{
- lynq_factory_response_ttyGS3("OK\n");
+ lynq_factory_response_ttyGS3("OK\r\n");
}
else
{
@@ -542,13 +542,9 @@
return;
}
-static void lynq_gps_open(char *num){
+static void lynq_gps_open(){
if(already_gps == 1){
- lynq_factory_response_ttyGS3("gps already open\n");
- return;
- }
- if(num == NULL)
- {
+ lynq_factory_response_ttyGS3("+CME ERROR: 100\r\n");
return;
}
gps_set = atoi(num);
@@ -558,7 +554,7 @@
int ret = pthread_create(&lynq_gps_tid, NULL, thread_test, NULL);
if(ret < 0)
{
- lynq_factory_response_ttyGS3("gps thread create failure!!!\n");
+ lynq_factory_response_ttyGS3("+CME ERROR: 100\r\n");
return;
}
already_gps = 1;
@@ -568,14 +564,14 @@
static void lynq_gps_enable(void){
enable_nema = 1;
- lynq_factory_response_ttyGS3("+GPS ENABLE:OK\n");
+ lynq_factory_response_ttyGS3("OK\r\n");
return;
}
static void lynq_gps_disable(void)
{
enable_nema = 0;
- lynq_factory_response_ttyGS3("+GPS DISABLE:OK\n");
+ lynq_factory_response_ttyGS3("OK\r\n");
return;
}
@@ -584,7 +580,7 @@
already_gps = 0;
enable_nema = 0;
system("killall lynq-gnss-test");
- lynq_factory_response_ttyGS3("+GPS CLOSE:OK\n");
+ lynq_factory_response_ttyGS3("OK\r\n");
return;
}
@@ -620,7 +616,7 @@
fgets(lynq_adc_buf,sizeof(lynq_adc_buf),fp);
sprintf(flag,"%s %s", "ADC:", lynq_adc_buf);
lynq_factory_response_ttyGS3(flag);
- lynq_factory_response_ttyGS3("OK\n");
+ lynq_factory_response_ttyGS3("OK\r\n");
pclose(fp);
return 1;
}
@@ -638,12 +634,12 @@
if(!strncmp(lynq_usb_buf,usb3_speed,strlen(usb3_speed)))
{
lynq_factory_response_ttyGS3("[usb][result],3.0 \n");
- lynq_factory_response_ttyGS3("OK\n");
+ lynq_factory_response_ttyGS3("OK\r\n");
}
else if(!strncmp(lynq_usb_buf,usb2_speed,strlen(usb2_speed)))
{
lynq_factory_response_ttyGS3("[usb][result],2.0 \n");
- lynq_factory_response_ttyGS3("OK\n");
+ lynq_factory_response_ttyGS3("OK\r\n");
}
pclose(fp);
return 1;
@@ -654,7 +650,7 @@
char lynq_adudio_time_arr[128] = {0};
char *lynq_argv = (char *)arg;
pthread_mutex_lock(&lynq_audio_mutex);
- lynq_factory_response_ttyGS3("OK\n");
+ lynq_factory_response_ttyGS3("OK\r\n");
system("echo write_reg,0x002c,0x0008 > /sys/kernel/debug/mtksocaudio");
system("echo write_reg,0x0030,0x0010 > /sys/kernel/debug/mtksocaudio");
sprintf(lynq_adudio_time_arr,"arecord -D plughw:0,1 --buffer-size=1024 -r 16000 -d %s -f S16_LE -c1 | aplay -D plughw:0,7 --buffer-size=1024 -r 16000 -d %s -f S16_LE -c1",lynq_argv,lynq_argv);
@@ -697,7 +693,7 @@
return -1;
}
while(fgets(buf, sizeof(buf), fp) != NULL){
- lynq_factory_response_ttyGS3("+EMMC: OK \n");
+ lynq_factory_response_ttyGS3("+EMMC: OK\r\n");
pclose(fp);
return 0;
}
@@ -862,18 +858,18 @@
if(lynq_gpio_test_env_error == 1)
{
- sprintf(lynq_show_gpio_state,"tool error \n");
+ sprintf(lynq_show_gpio_state,"tool error\r\n");
lynq_factory_response_ttyGS3(lynq_show_gpio_state);
}
if(lynq_gpio_beta_state == 1)
{
- sprintf(lynq_show_gpio_state,"[gpio][result]:PASS \n");
+ sprintf(lynq_show_gpio_state,"OK\r\n");
lynq_factory_response_ttyGS3(lynq_show_gpio_state);
}
else
{
- sprintf(lynq_show_gpio_state,"[gpio][result]:FAIL \n");
+ sprintf(lynq_show_gpio_state,"+CME ERROR: 100\r\n");
lynq_factory_response_ttyGS3(lynq_show_gpio_state);
}
}
@@ -907,7 +903,7 @@
sprintf(flag_buf, "%s%d%s%s%s", "SINK[", i+1, "]: ", buf, "\n");
lynq_factory_response_ttyGS3(flag_buf);
}
- lynq_factory_response_ttyGS3("OK\n");
+ lynq_factory_response_ttyGS3("OK\r\n");
pclose(fp);
return 1;
}
@@ -922,7 +918,7 @@
pclose(fp);
if(lynq_get_gpio_state[6] == '1')
{
- lynq_factory_response_ttyGS3("+PCIE: OK\n");
+ lynq_factory_response_ttyGS3("+PCIE: OK\r\n");
}
else
{
@@ -1027,16 +1023,16 @@
}
if(num < 4)
return -1;
- else if(!strcmp(argv[3], "gps_open")){
- lynq_gps_open(argv[4]);
+ else if(!strcmp(argv[1], "AT+CGPS=1")){
+ lynq_gps_open();
}
- else if(!strcmp(argv[3], "gps_enable")){
+ else if(!strcmp(argv[1], "AT+CGPSNMEA=1")){
lynq_gps_enable();
}
- else if(!strcmp(argv[3], "gps_disable")){
+ else if(!strcmp(argv[1], "AT+CGPSNMEA=0")){
lynq_gps_disable();
}
- else if(!strcmp(argv[3], "gps_close")){
+ else if(!strcmp(argv[1], "AT+CGPS=0")){
lynq_gps_close();
}
else if(!strcmp(argv[3], "sink")){
diff --git a/src/lynq/framework/lynq-ril-service/src/lynq_at_transfer_table.h b/src/lynq/framework/lynq-ril-service/src/lynq_at_transfer_table.h
index 46b73fc..328346e 100755
--- a/src/lynq/framework/lynq-ril-service/src/lynq_at_transfer_table.h
+++ b/src/lynq/framework/lynq-ril-service/src/lynq_at_transfer_table.h
@@ -17,6 +17,8 @@
{LYNQ_REQUEST_FOTA,"LYNQFOTA",7},
{LYNQ_REQUEST_INSIDE_VERSION,"CGIR",7},
{LYNQ_REQUEST_FACTORY,"CGSN",7},
+{LYNQ_REQUEST_FACTORY,"CGPS",7},
+{LYNQ_REQUEST_FACTORY,"CGPSNMEA",7},
{LYNQ_REQUEST_TEMP,"LYNQMTSM",1},
{LYNQ_REQUEST_APN,"LEAPNMOD",7},
{-1,NULL,0},
\ No newline at end of file