[Bugfix][API-860][Data]Fix Data Call Response later than URC report Lead to Data call 8004

Change-Id: I713a547dd35ccc1603da6c02bc0a87c05fc5a346
(cherry picked from commit 7a47740570986737def768dcfa6990cbaf78c181)
diff --git a/lib/liblynq-data/lynq_data.cpp b/lib/liblynq-data/lynq_data.cpp
index c0af733..460eb9c 100755
--- a/lib/liblynq-data/lynq_data.cpp
+++ b/lib/liblynq-data/lynq_data.cpp
@@ -71,10 +71,12 @@
 * @brief mark data send request mutex
 */
 static pthread_mutex_t g_lynq_data_sendto_mutex;
-
+/*This value data the state of the wait*/
 static int data_waiting_status = 0;
-
+/*The value indicates that 8085 error occurs in data*/
 static int data_invaild_error = 0;
+/*This value ensure the data call timing is correct*/
+static int data_timelimit = 0;
 
 /**g_lynq_data_init_flag
 * @brief mark data initialization state
@@ -381,6 +383,7 @@
     int resp_type;
     int urcid;
     int slot_id;
+    int check_count = 0;
 
     int pdnState = 0;
     char apn[LYNQ_APN_MAX_LEN];
@@ -460,8 +463,20 @@
                 LYDBGLOG("data call state:%d",lynq_data_call);
                 if(lynq_data_call==1)
                 {
+                    while (data_timelimit == 0)
+                    {
+                        LYINFLOG("client not ready to wait");
+                        for (check_count = 0;check_count < 500;check_count++)
+                        {
+                            /*wait 10ms*/
+                            usleep(10*1000);
+                        }
+                        LYERRLOG("client still without res");
+                        break;
+                    }
                     sendSignalDataCallStateChange();
                     lynq_data_call = 0;
+                    data_timelimit = 0;
                 }
             }
             else
@@ -486,8 +501,20 @@
                 LYDBGLOG("data call state:%d",lynq_data_call);
                 if(lynq_data_call==1)
                 {
+                    while (data_timelimit == 0)
+                    {
+                        LYINFLOG("client not ready to wait");
+                        for (check_count = 0;check_count < 500;check_count++)
+                        {
+                            /*wait 10ms*/
+                            usleep(10*1000);
+                        }
+                        LYERRLOG("client still without res");
+                        break;
+                    }
                     sendSignalDataCallStateChange();
                     lynq_data_call = 0;
+                    data_timelimit = 0;
                 }
             }
             break;
@@ -641,6 +668,7 @@
     LYINFLOG("resp_type=%d,request=%d,slot_id=%d,error_code=%d",resp_type,request,slot_id,error);
     if(error==0)
     {
+        data_timelimit = 1;
         if (waitDataCallstateChange(60000) == ETIMEDOUT) // 60s
         {
             error = LYNQ_E_TIME_OUT;
@@ -790,6 +818,7 @@
     LYINFLOG("resp_type=%d,request=%d,slot_id=%d,error_code=%d",resp_type,request,slot_id,error);
     if(error==0)
     {
+        data_timelimit = 1;   
         if(waitDataCallstateChange(60000)==ETIMEDOUT)//60s
         {
             error = LYNQ_E_TIME_OUT;