[Bugfix][T106][task-view-396] aligen some timeout\get_urc\print  code
with T800

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

Change-Id: I7172747d911ec2f40841bbb3987a8b765e1af79b
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-network/lynq_network.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-network/lynq_network.cpp
index e0e20c9..3e55731 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-network/lynq_network.cpp
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-network/lynq_network.cpp
@@ -25,6 +25,11 @@
 #define WAIT_TIME_LENGTH_FOR_SET_NETWORK_SELECTION_MODE (310)

 /*in CR AUTO00207414, in modem, 23G detach need 10s, 5g ims detach need 5s, so set length to 12s */

 #define WAIT_TIME_LENGTH_FOR_SET_PREFFERRED_NETWORK_TYPE (12) 

+/*For T800-API-1475, cfun 0 need 7s */

+#define WAIT_TIME_LENGTH_FOR_RADIO_ON (65) 

+

+#define WAIT_TIME_LENGTH_FOR_QUERY_AVAILABLE_NETWORK (600) 

+#define WAIT_TIME_LENGTH_FOR_SET_IMS (65) 

 

 #define MAX_AT_INT_RSP_NUM  32

 

@@ -43,6 +48,12 @@
 int g_module_init_flag = 0;

 

 int lynq_network_init(int utoken){

+

+    LYLOGSET(LOG_INFO);

+    LYLOGEINIT(USER_LOG_TAG);

+

+    LYERRLOG("%s start, parameter is %d", __func__,utoken);

+

     if(g_module_init_flag != MODULE_CLOSED)

     {

         LYERRLOG("module state is %d",g_module_init_flag);

@@ -57,9 +68,7 @@
     g_module_init_flag = MODULE_SWITCHING;

 

     g_module_Global_uToken = utoken;

-    LYLOGSET(LOG_INFO);

-    LYLOGEINIT(USER_LOG_TAG);

-    

+	   

     int ret;

 

     init_network_timer_all();

@@ -81,12 +90,16 @@
         return LYNQ_E_INNER_ERROR;

     }

     g_module_init_flag = MODULE_RUNNING;

+

+    LYERRLOG("%s end suc", __func__);

     

     return RESULT_OK;    

 }

 

 int lynq_network_deinit(void){

 

+    LYERRLOG("%s start", __func__);

+

     if (g_module_init_flag != MODULE_RUNNING)

     {

        LYERRLOG("module state is %d",g_module_init_flag);

@@ -99,6 +112,8 @@
     deinit_network_timer_all();

 

     g_module_init_flag = MODULE_CLOSED;

+

+    LYERRLOG("%s end suc", __func__);

     return RESULT_OK;    

 }

 

@@ -651,7 +666,7 @@
     }  

 

     Parcel* p=NULL;

-    int ret=lynq_send_common_request(p,600,RIL_REQUEST_QUERY_AVAILABLE_NETWORKS,0,"");

+    int ret=lynq_send_common_request(p,WAIT_TIME_LENGTH_FOR_QUERY_AVAILABLE_NETWORK,RIL_REQUEST_QUERY_AVAILABLE_NETWORKS,0,"");

 

     if(ret!=RESULT_OK)

     {

@@ -1379,11 +1394,11 @@
 

     if(type==NETWORK_RADIO_ON_TYPE_CFUN_0)

     {

-        ret=lynq_send_common_request(p,g_wait_time,RIL_REQUEST_OEM_HOOK_RAW,1,"%s","AT+CFUN=0");

+        ret=lynq_send_common_request(p,WAIT_TIME_LENGTH_FOR_RADIO_ON,RIL_REQUEST_OEM_HOOK_RAW,1,"%s","AT+CFUN=0");

     }

     else 

     {

-        ret=lynq_send_common_request(p,65,RIL_REQUEST_RADIO_POWER,1,"%d",(type==NETWORK_RADIO_ON_TYPE_NORMAL_MODE));

+        ret=lynq_send_common_request(p,WAIT_TIME_LENGTH_FOR_RADIO_ON,RIL_REQUEST_RADIO_POWER,1,"%d",(type==NETWORK_RADIO_ON_TYPE_NORMAL_MODE));

     }

 

     if(ret!=RESULT_OK)

@@ -1641,7 +1656,7 @@
     }     

 

     Parcel* p=NULL;

-    int ret = lynq_send_common_request(p,65,RIL_REQUEST_SET_IMS_ENABLE,1,"%d",ims_mode);

+    int ret = lynq_send_common_request(p,WAIT_TIME_LENGTH_FOR_SET_IMS,RIL_REQUEST_SET_IMS_ENABLE,1,"%d",ims_mode);

     if(ret!=RESULT_OK)

     {

         LYERRLOG("%s call lynq_send_common_request failure, ret is %d",__func__,ret);

@@ -1661,52 +1676,50 @@
         LYERRLOG("%s module state %d error",__func__,g_module_init_flag);

         return LYNQ_E_CONFLICT;

     }

-    LYDBGLOG("start get urc info");

+    LYINFLOG("get urc info, handle is %d, slot is %d",handle,s_module_urc_slot_id);

     if(is_support_urc(handle)==false)

     {

-        LYINFLOG("invalid handle!!!");

+        LYERRLOG("not support handle!!!");

         return LYNQ_E_PARAMETER_ANONALY;

     }

     if((handle ==RIL_UNSOL_SIGNAL_STRENGTH && NULL == solSigStren) || 

         (handle !=RIL_UNSOL_SIGNAL_STRENGTH && NULL == slot_id))

     {

-        LYINFLOG("incoming solSigStren or slot_id is NULL!!!");

+        LYERRLOG("solSigStren or slot_id is NULL!!!");

         return LYNQ_E_PARAMETER_ANONALY;

+    }  

+

+    if(slot_id!=NULL)

+    {

+        *slot_id = s_module_urc_slot_id;

     }

-    switch(handle)

-    {        

-        case RIL_UNSOL_SIGNAL_STRENGTH: //1009

-        {

-            LYDBGLOG("get state update to signal info");

-            solSigStren->gw_sig_valid = s_network_urc_solSigStren.gw_sig_valid;

-            solSigStren->rssi = s_network_urc_solSigStren.rssi;

-            solSigStren->wcdma_signalstrength = s_network_urc_solSigStren.wcdma_signalstrength;

-            solSigStren->wcdma_sig_valid = s_network_urc_solSigStren.wcdma_sig_valid;

-            solSigStren->rscp = s_network_urc_solSigStren.rscp;

-            solSigStren->ecno = s_network_urc_solSigStren.ecno;

-            solSigStren->lte_signalstrength = s_network_urc_solSigStren.lte_signalstrength;

-            solSigStren->lte_sig_valid = s_network_urc_solSigStren.lte_sig_valid;

-            solSigStren->rsrp = s_network_urc_solSigStren.rsrp;

-            solSigStren->rsrq = s_network_urc_solSigStren.rsrq;

-            solSigStren->rssnr = s_network_urc_solSigStren.rssnr;

-            solSigStren->nr_sig_valid = s_network_urc_solSigStren.nr_sig_valid;

-            solSigStren->ssRsrp = s_network_urc_solSigStren.ssRsrp;

-            solSigStren->ssRsrq = s_network_urc_solSigStren.ssRsrq;

-            solSigStren->ssSinr = s_network_urc_solSigStren.ssSinr;

-            solSigStren->csiRsrp = s_network_urc_solSigStren.csiRsrp;

-            solSigStren->csiRsrq = s_network_urc_solSigStren.csiRsrq;

-            solSigStren->csiSinr = s_network_urc_solSigStren.csiSinr;

-            break;

-        }

-        default:

-        {

-            *slot_id = s_module_urc_slot_id;

-            LYINFLOG("slot_id = %d",s_module_urc_slot_id);

-        }        

-    }

+  

+    if(handle==RIL_UNSOL_SIGNAL_STRENGTH)

+    {

+        LYDBGLOG("get state update to signal info");

+        solSigStren->gw_sig_valid = s_network_urc_solSigStren.gw_sig_valid;

+        solSigStren->rssi = s_network_urc_solSigStren.rssi;

+        solSigStren->wcdma_signalstrength = s_network_urc_solSigStren.wcdma_signalstrength;

+        solSigStren->wcdma_sig_valid = s_network_urc_solSigStren.wcdma_sig_valid;

+        solSigStren->rscp = s_network_urc_solSigStren.rscp;

+        solSigStren->ecno = s_network_urc_solSigStren.ecno;

+        solSigStren->lte_signalstrength = s_network_urc_solSigStren.lte_signalstrength;

+        solSigStren->lte_sig_valid = s_network_urc_solSigStren.lte_sig_valid;

+        solSigStren->rsrp = s_network_urc_solSigStren.rsrp;

+        solSigStren->rsrq = s_network_urc_solSigStren.rsrq;

+        solSigStren->rssnr = s_network_urc_solSigStren.rssnr;

+        solSigStren->nr_sig_valid = s_network_urc_solSigStren.nr_sig_valid;

+        solSigStren->ssRsrp = s_network_urc_solSigStren.ssRsrp;

+        solSigStren->ssRsrq = s_network_urc_solSigStren.ssRsrq;

+        solSigStren->ssSinr = s_network_urc_solSigStren.ssSinr;

+        solSigStren->csiRsrp = s_network_urc_solSigStren.csiRsrp;

+        solSigStren->csiRsrq = s_network_urc_solSigStren.csiRsrq;

+        solSigStren->csiSinr = s_network_urc_solSigStren.csiSinr;

+    }        

     return RESULT_OK;   

 }

 

+

 static pthread_mutex_t urc_signal_state_change_mutex = PTHREAD_MUTEX_INITIALIZER;

 static pthread_cond_t urc_signal_state_change_cond = PTHREAD_COND_INITIALIZER;