Merge "[Feature][T106][task-view-734]Add api to Operated the profile of the SIM card"
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;

 

diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/ril_mm.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/ril_mm.c
index 3835d91..d734936 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/ril_mm.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/ril_mm.c
@@ -643,7 +643,7 @@
 			gsm->signalStrengthGsm.signalStrength = 99;

 		} else if (tGsmEmInfo->bRssi > 99 && tGsmEmInfo->bRssi < 200) {

 			gsm->signalStrengthGsm.signalStrength = changeCSQdbmToLevel(tGsmEmInfo->bRssi - 216, 3);

-		} else if (tGsmEmInfo->bRssi > 1 && tGsmEmInfo->bRssi <= 60) {

+		} else if (tGsmEmInfo->bRssi >= 1 && tGsmEmInfo->bRssi <= 60) { //LYNQ_HUANG_QING_AT_20241126_ZXW_BUG_18_CR_20240807C6B104DE_CHANGE_>_TO_>=

 			gsm->signalStrengthGsm.signalStrength = (tGsmEmInfo->bRssi+ 1) / 2 + 1; /*2-31,99*/

 		} else if (60 < tGsmEmInfo->bRssi && tGsmEmInfo->bRssi <= 63) {

 			gsm->signalStrengthGsm.signalStrength = 31;

@@ -810,7 +810,7 @@
 

 		if (tMeasInfo->bRssi > 99 && tMeasInfo->bRssi < 200) {

 			gsm->signalStrengthGsm.signalStrength = changeCSQdbmToLevel(tMeasInfo->bRssi - 216, 3);

-		} else if (tMeasInfo->bRssi > 1 && tMeasInfo->bRssi <= 60) {

+		} else if (tMeasInfo->bRssi >= 1 && tMeasInfo->bRssi <= 60) { //LYNQ_HUANG_QING_AT_20241126_ZXW_BUG_18_CR_20240807C6B104DE_CHANGE_>_TO_>=

 			gsm->signalStrengthGsm.signalStrength = (tMeasInfo->bRssi+ 1) / 2 + 1; /*2-31,99*/

 		} else if (60 < tMeasInfo->bRssi && tMeasInfo->bRssi <= 63) {

 			gsm->signalStrengthGsm.signalStrength = 31;

@@ -1726,7 +1726,7 @@
 			level = 99;

 		}else if (rxlev > 99 && rxlev < 200) {

 			level = changeCSQdbmToLevel(rxlev - 216, 3);

-		} else if (rxlev > 1 && rxlev <= 60) {

+		} else if (rxlev >= 1 && rxlev <= 60) { //LYNQ_HUANG_QING_AT_20241126_ZXW_BUG_18_CR_20240807C6B104DE_CHANGE_>_TO_>=

 			level = (rxlev + 1) / 2 + 1; /*2-31,99*/

 		} else if (60 < rxlev && rxlev <= 63) {

 			level = 31;