[Feature][T8TSK-289] merge lynq-ril-service from old platform branch

Only Configure: No
Affected branch: LYNQ_PUBLIC
Affected module: ril
Is it affected on both ZXIC and MTK: only MTK
Self-test: No
Doc Update: No

Change-Id: I2f9e2a881259b07369c4049e22736bf0234f57cf
diff --git a/common_src/framework/lynq-ril-service/src/common.cpp b/common_src/framework/lynq-ril-service/src/common.cpp
index 2c2cdde..402aad1 100755
--- a/common_src/framework/lynq-ril-service/src/common.cpp
+++ b/common_src/framework/lynq-ril-service/src/common.cpp
@@ -95,6 +95,7 @@
 */
 extern int current_data_reg = -1;
 extern int modemStatus = 0;
+int g_lynq_sim_state = -1;
 
 /*Warren add for SZZT 2021/11/14 end*/
 
@@ -372,22 +373,26 @@
     pthread_mutex_unlock(&s_state_change_mutex);
 }
 
-void lynq_wait_result_comeback(int mtime)
+int lynq_wait_result_comeback(int mtime)
 {
     RLOGD("wait_call_state");
     int sec = 0;
-    int usec = 0;
+    int ms = 0;
     struct timeval now;
     struct timespec timeout;
     gettimeofday(&now,NULL);
     sec = mtime/1000;
-    usec = mtime%1000;
+    ms = mtime%1000;
     timeout.tv_sec = now.tv_sec+sec;
-    timeout.tv_nsec = now.tv_usec*1000+usec*1000000;
+    unsigned long long ns;
+    ns = now.tv_usec*1000ull + ms*1000000ull;
+    timeout.tv_sec += ns/1000000000;
+    timeout.tv_nsec = ns % 1000000000;
     pthread_mutex_lock(&s_state_change_mutex);
-    pthread_cond_timedwait(&s_state_change_cond,&s_state_change_mutex,&timeout);
+    int ret = pthread_cond_timedwait(&s_state_change_cond,&s_state_change_mutex,&timeout);
     pthread_mutex_unlock(&s_state_change_mutex);
     RLOGD("wait_call_state end");
+    return ret;
 }
 
 int get_default_sim_voice(){
@@ -566,6 +571,9 @@
     } else {
         RLOGD("[slot%d]updateCardStatusV6: sim card message is null", slot);
     }
+#ifdef LED_SUPPORT
+    mbtk_netled_state_update(GPIO_NETLED_REFLASH_NORMAL);  
+#endif
 }
 
 char* getAid(int slot)
@@ -592,6 +600,9 @@
         reg_voice_service_state[slot] = atoi(code);
         regCodeToServiceState(request, atoi(code), slot);
     }
+#ifdef LED_SUPPORT
+    mbtk_netled_state_update(GPIO_NETLED_REFLASH_NORMAL);  
+#endif
 }
 
 void update_reg_voice_radio_tech(int request, int code, int slot, int32_t token) {
@@ -611,6 +622,9 @@
         current_data_reg = status;       
         /*Warren change for SZZT 2021//11/14 end*/
     }
+#ifdef LED_SUPPORT
+    mbtk_netled_state_update(GPIO_NETLED_REFLASH_NORMAL);  
+#endif
 }
 
 void update_reg_data_radio_tech(int request, int code, int slot, int32_t token){
@@ -1040,6 +1054,18 @@
     }
     return false;	
 }
+
+bool ril_get_if_3gpp_data_reg_success()
+{
+    int slot_id=get_default_sim_data();
+
+    if(slot_id==0 || slot_id ==1)
+    {
+        return reg_data_service_state[slot_id] ==1;
+    }
+    return false;	
+}
+
 #endif
 /*hq add for key info output 2022/03/01 begin*/
 // void lynq_output_LINFO_all()