Squashed 'LYNQ_PUBLIC/' changes from 994e41a76..f3dd8cbdf

f3dd8cbdf [Feature][ZK-92] ftp gpslog to soc with syslog
8bb9992d3 [Feature][API-1508] in NMEA-statement for ZK ,transfer BD to GB
17579bbfa [BugFix][API-1564]fix File descriptor leakage
9c8bb35ff Merge "[Bugfix][API-1561][mtklog]  support mtk log slim fota upgrade"
926d2ad75 [Bugfix][API-1561][mtklog]  support mtk log slim fota upgrade
4bcc14334 Merge "[Bugfix][ZK-78][FOTA]get process and upgrade status error when start fota up status"
610236b60 [Bugfix][ZK-78][FOTA]get process and upgrade status error when start fota up status
f700d98cb Merge "[Bugfix][API-1473][mdlog] lynq_query_registration_state type Voice  lac cid error"
0c874421d [Feature][T8TSK-320]Print the reason for the PDN when disconnected by the modem into the syslog
dac13540e Merge "[Feature][API-1406][API-1113]Adjust SEND_SMS timeout"
31850f3e5 Merge "[Feature][API-1557] FIX libvendor-ril can`t connected RILD issue"
d3a8f5da1 [Feature][API-1557] FIX libvendor-ril can`t connected RILD issue
2f4c07922 Merge "[Feature][T8TSK-316][rtp] rtp confirm to the standard of Geely"
1ee60ec01 Merge "[Bugfix][API-1551[network]  lynq_set_vlan_info, vlan_info is "", ret 8004"
98beaeaf3 Merge "[Bugfix][API-1534]After turning on the USB port, delay for 3 seconds to make a  call"
786e97304 [Feature][T8TSK-289] missing wom when add telephonyware to LYNQ_PUBLIC repo 0
d25d37156 [Bugfix][API-1534]After turning on the USB port, delay for 3 seconds to make a  call
4157623f6 [Feature][T8TSK-316][rtp] rtp confirm to the standard of Geely
c66c73d5d [Bugfix][API-1551[network]  lynq_set_vlan_info, vlan_info is "", ret 8004
4bf2e2e0b [Feature][API-1406][API-1113]Adjust SEND_SMS timeout
4b1c33121 [Bugfix][API-1473][mdlog] lynq_query_registration_state type Voice  lac cid error

git-subtree-dir: LYNQ_PUBLIC
git-subtree-split: f3dd8cbdf17f75f5c9672368b59c1cd59194fce6

Change-Id: Ie206616813b8064220450958d9f91e5048c08ac2
diff --git a/common_src/lib/liblynq-call/lynq_call.cpp b/common_src/lib/liblynq-call/lynq_call.cpp
index 8e6943d..0b7e385 100755
--- a/common_src/lib/liblynq-call/lynq_call.cpp
+++ b/common_src/lib/liblynq-call/lynq_call.cpp
@@ -30,7 +30,8 @@
 #define AUDIO_CTRL_SER "/tmp/audio_ctrl_service"

 #define LIBMODEM_AFE "/tmp/libmodem-afe-ctrl"

 #define TELE_DEMO_LOCK "/tmp/tel_demo_single_proc.lock"

-

+#define CALL_REBOOT_FLAG "/tmp/.call_reboot_flag"

+#define SYSTEM_UPTIME 40

 #define MAX_RING_INCOMING_INTERVAL 10

 

 using ::android::Parcel;

@@ -989,6 +990,49 @@
     return 0;

 }

 

+int call_boot_check()

+{

+    FILE *file = NULL;

+    int uptime = 0;

+

+    file = fopen("/proc/uptime", "r");

+    if(file == NULL) 

+    {

+        LYERRLOG("Error opening /proc/uptime");

+        return -1;

+    }

+    

+    if(fscanf(file, "%d ", &uptime) != 1) 

+    {

+        LYERRLOG("Error reading uptime value");

+    }

+    

+    fclose(file);

+

+    if(uptime > SYSTEM_UPTIME) 

+    {

+        LYINFLOG("System uptime is greater than 40 seconds.");

+    } 

+    else 

+    {

+        LYINFLOG("System uptime is less than 40 seconds.");

+        FILE *fp = NULL;

+        if(check_file_access(CALL_REBOOT_FLAG) != 0)

+        {

+            usleep(3000000);

+            fp = fopen(CALL_REBOOT_FLAG,"w");

+            if(fp == NULL)

+            {

+                LYERRLOG("Creat call reboot flag file failed !!!!");

+                return -1;

+            }

+            LYINFLOG("Creat flag file success");

+            fclose(fp);

+        }

+    }

+    return 0;

+

+}

 int lynq_call(int* handle,char addr[])

 {

     if(g_module_init_flag != MODULE_RUNNING)

@@ -997,6 +1041,11 @@
         return LYNQ_E_CONFLICT;

     }

     try_reset_audio_service();

+

+#ifdef GSW_RIL_CFG

+    call_boot_check();

+#endif

+

     int lynq_call_id = -1;

 

     LYINFLOG("lynq_call begin addr %s",addr);

diff --git a/common_src/lib/liblynq-call/lynq_call_rtp.cpp b/common_src/lib/liblynq-call/lynq_call_rtp.cpp
index 05b3032..092a85c 100755
--- a/common_src/lib/liblynq-call/lynq_call_rtp.cpp
+++ b/common_src/lib/liblynq-call/lynq_call_rtp.cpp
@@ -33,6 +33,17 @@
     return strndup16to8(s16, stringlen);

 }

 

+int is_whitespace_only(const char *str) {  

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

+        if (!isspace((unsigned char)*str)) { 

+            return 0; 

+        }  

+        str++;

+    }  

+    return 1; 

+}  

+

+

 /*set*/

 int lynq_set_voice_audio_mode(const LYNQ_Audio_Mode audio_mode)

 {

@@ -62,9 +73,9 @@
         LYERRLOG("%s module state %d error",__func__,g_module_init_flag);

         return LYNQ_E_CONFLICT;

     }

-    if (NULL == ip)

+    if (NULL == ip || is_whitespace_only(ip))

     {

-        LYERRLOG("ip is NULL!!!");

+        LYERRLOG("ip is NULL or white space string !!!");

         return LYNQ_E_PARAMETER_ANONALY;

     }

     if ((ip_length < strlen(ip)+1) || (ip_length > MAX_IP_LENGTH))

@@ -94,15 +105,24 @@
         LYERRLOG("vlan_info is NULL!!!");

         return LYNQ_E_PARAMETER_ANONALY;

     }

-    

-    if ((vlan_info_length < strlen(vlan_info)+1) || (vlan_info_length > MAX_VLAN_INFO_LENGTH))

-    {

-        LYERRLOG("incoming vlan_info error, vlan info length %d", vlan_info_length);

-        return LYNQ_E_PARAMETER_ANONALY;

-    }    

 

     Parcel* p=NULL;

-    int ret=lynq_send_common_request(p,g_wait_time,LYNQ_REQUEST_SET_VLAN_INFO,1,"%s",vlan_info);

+    int ret;

+

+    if(is_whitespace_only(vlan_info))

+    {

+        ret=lynq_send_common_request(p,g_wait_time,LYNQ_REQUEST_SET_VLAN_INFO,0,"");    

+    }

+    else

+    {

+        if ((vlan_info_length < strlen(vlan_info)+1) || (vlan_info_length > MAX_VLAN_INFO_LENGTH))

+        {

+            LYERRLOG("incoming vlan_info error, vlan info length %d", vlan_info_length);

+            return LYNQ_E_PARAMETER_ANONALY;

+        }       

+        ret=lynq_send_common_request(p,g_wait_time,LYNQ_REQUEST_SET_VLAN_INFO,1,"%s",vlan_info);

+    }    

+    

     if(ret==RESULT_OK)

     {

         delete p;        

diff --git a/common_src/lib/liblynq-call/makefile b/common_src/lib/liblynq-call/makefile
index 6073694..6d3e7ba 100755
--- a/common_src/lib/liblynq-call/makefile
+++ b/common_src/lib/liblynq-call/makefile
@@ -41,6 +41,10 @@
     -llynq-log \
     -llynq-shm \
 
+ifeq ($(strip $(MOBILETEK_RIL_CFG)), GSW)
+    LOCAL_CFLAGS += -DGSW_RIL_CFG
+endif
+
 SOURCES = $(wildcard *.cpp)
 
 EXECUTABLE = liblynq-call.so