[Bugfix][API-1299][network] in 3g lynq_solicited_signal_strength fail
Affected branch: unknown
Affected module: unknown
Is it affected on both ZXIC and MTK: mtk and zxic both
Self-test: Yes
Doc Update: No
Change-Id: I015f88ed0f0c9443f70cca59bce640e19cd67f72
diff --git a/IC_src/mtk/telephonyware/3.0/hardware/ril/fusion/libril/rilmipc/telephony/network/RpNwController.cpp b/IC_src/mtk/telephonyware/3.0/hardware/ril/fusion/libril/rilmipc/telephony/network/RpNwController.cpp
index c4fddf2..4c37289 100755
--- a/IC_src/mtk/telephonyware/3.0/hardware/ril/fusion/libril/rilmipc/telephony/network/RpNwController.cpp
+++ b/IC_src/mtk/telephonyware/3.0/hardware/ril/fusion/libril/rilmipc/telephony/network/RpNwController.cpp
@@ -348,6 +348,12 @@
{
RIL_SignalStrength_v14 p_cur;
memset(&p_cur, 0, sizeof(p_cur));
+ /*hq add for API-1299 20240325 begin*/
+ p_cur.WCDMA_SignalStrength.signalStrength = -1;
+ p_cur.LTE_SignalStrength.signalStrength = -1;
+ p_cur.GW_SignalStrength.signalStrength = -1;
+ /*hq add for API-1299 20240325 end*/
+
mipc_nw_signal_type_const_enum type = mipc_nw_signal_ind_get_signal_type(result_ptr,mipc_nw_signal_type_const_NONE);
RFX_LOG_D(RFX_LOG_TAG,"mipc_signal_strength_ind_to_parcel type =%d\n", type);
@@ -483,6 +489,12 @@
{
RIL_SignalStrength_v14 p_cur;
memset(&p_cur, 0, sizeof(p_cur));
+ /*hq add for API-1299 20240325 begin*/
+ p_cur.WCDMA_SignalStrength.signalStrength = -1;
+ p_cur.LTE_SignalStrength.signalStrength = -1;
+ p_cur.GW_SignalStrength.signalStrength = -1;
+ /*hq add for API-1299 20240325 end*/
+
mipc_nw_signal_type_const_enum type = mipc_nw_set_signal_cnf_get_signal_type(result_ptr,mipc_nw_signal_type_const_NONE);
RFX_LOG_D(RFX_LOG_TAG,"mipc_signal_strength_cnf_to_parcel type =%d\n", type);
diff --git a/common_src/framework/lynq-ril-service/src/ril.cpp b/common_src/framework/lynq-ril-service/src/ril.cpp
index bf24c67..90a842a 100755
--- a/common_src/framework/lynq-ril-service/src/ril.cpp
+++ b/common_src/framework/lynq-ril-service/src/ril.cpp
@@ -2624,7 +2624,7 @@
str[i] = (char)(c + n%90); //encode
}
else
- { //After encoding, the space beyond the end reaches ‘z’, and the cycle starts from the beginning.
+ { //After encoding, the space beyond the end reaches 'z', and the cycle starts from the beginning.
str[i] = (char)(c + n%90 - 90);//encode
}
}
@@ -2654,7 +2654,7 @@
}
else
{
- //After decoding, there are over spaces until ‘z’, and the lowercase letters are processed into printable information by looping
+ //After decoding, there are over spaces until ''z', and the lowercase letters are processed into printable information by looping
str[i] = (char)(c - n%90 + 90); //decode
}
}
@@ -2998,12 +2998,19 @@
p.writeInt32(p_cur->WCDMA_SignalStrength.rscp);
p.writeInt32(p_cur->WCDMA_SignalStrength.ecno);
#ifdef TELEMATIC_5G_SUPPORT
- p.writeInt32(p_cur->NR_SignalStrength.ssRsrp);
- p.writeInt32(p_cur->NR_SignalStrength.ssRsrq);
- p.writeInt32(p_cur->NR_SignalStrength.ssSinr);
- p.writeInt32(p_cur->NR_SignalStrength.csiRsrp);
- p.writeInt32(p_cur->NR_SignalStrength.csiRsrq);
- p.writeInt32(p_cur->NR_SignalStrength.csiSinr);
+ if(responselen >= sizeof (RIL_SignalStrength_v14))
+ {
+ p.writeInt32(p_cur->NR_SignalStrength.ssRsrp);
+ p.writeInt32(p_cur->NR_SignalStrength.ssRsrq);
+ p.writeInt32(p_cur->NR_SignalStrength.ssSinr);
+ p.writeInt32(p_cur->NR_SignalStrength.csiRsrp);
+ p.writeInt32(p_cur->NR_SignalStrength.csiRsrq);
+ p.writeInt32(p_cur->NR_SignalStrength.csiSinr);
+ }
+ else
+ {
+ memset(&(p_cur->NR_SignalStrength), 0, sizeof(p_cur->NR_SignalStrength));
+ }
#endif
startResponse;
diff --git a/common_src/lib/liblynq-network/lynq_network.cpp b/common_src/lib/liblynq-network/lynq_network.cpp
index 311a360..dad3c78 100755
--- a/common_src/lib/liblynq-network/lynq_network.cpp
+++ b/common_src/lib/liblynq-network/lynq_network.cpp
@@ -18,6 +18,7 @@
#define LYNQ_RESP_STRING_MAX_NUM 128
#define LYNQ_TYPE_BUF 10
+#define LYNQ_URC_MSG_HEAD_ELEMENT_NUM 3
#define USER_LOG_TAG "LYNQ_NETWORK"
/*in CR AUTO00210807 MTK confirm set network selection mode max time is 14min 30s, first set 5 min 10s*/
@@ -1024,6 +1025,45 @@
return RESULT_OK;
}
+void convert_rscp(int relative_value, int* abs_value)
+{
+ if (0 == relative_value) {
+ (*abs_value) = 120;
+ }
+ else if (0 < relative_value && relative_value <= 96) {
+ (*abs_value) = 121 - relative_value;
+ }
+ else
+ {
+ (*abs_value) = 0x7FFFFFFF;
+ }
+}
+
+void convert_ecno(int relative_value, int* opposite_value_10_times)
+{
+ if (0 == relative_value)
+ {
+ (*opposite_value_10_times) = 240 ;
+ }
+ else if (0 < relative_value && relative_value <= 49)
+ {
+ (*opposite_value_10_times) = 245 - relative_value*5;
+ }
+ else
+ {
+ (*opposite_value_10_times) = 0x7FFFFFFF;
+ }
+}
+
+int is_rssi_valid(int rssi)
+{
+ if(rssi < 99 && rssi >=0)
+ {
+ return true;
+ }
+ return false;
+}
+
int lynq_solicited_signal_strength(signalStrength_t *solSigStren)
{
if(g_module_init_flag != MODULE_RUNNING)
@@ -1043,15 +1083,16 @@
{
LYERRLOG("%s call lynq_send_common_request failure, ret is %d",__func__,ret);
return ret;
- }
-
- int sum = 0;
+ }
+
int LTE_signalstrength = 0;
int WCDMA_signalstrength = 0;
int none = 0;
+ int rscp;
+ int ecno;
p->readInt32(&solSigStren->rssi);
- if((solSigStren->rssi!=99)&&(solSigStren->rssi!=0))
+ if(is_rssi_valid(solSigStren->rssi))
{
solSigStren->gw_sig_valid = 1;
}else{
@@ -1071,7 +1112,7 @@
p->readInt32(&solSigStren->rsrq);
p->readInt32(&solSigStren->rssnr);
LYINFLOG("LTE_signalstrength:%d",LTE_signalstrength);
- if((LTE_signalstrength!=99)&&(LTE_signalstrength!=0))
+ if(is_rssi_valid(LTE_signalstrength))
{
solSigStren->lte_sig_valid = 1;
}else{
@@ -1085,29 +1126,34 @@
p->readInt32(&none);
p->readInt32(&WCDMA_signalstrength);
p->readInt32(&none);
- p->readInt32(&solSigStren->rscp);
- p->readInt32(&solSigStren->ecno);
+ p->readInt32(&rscp);
+ p->readInt32(&ecno);
+
+
LYINFLOG("WCDMA_signalstrength:%d",WCDMA_signalstrength);
- if((WCDMA_signalstrength!=99)&&(WCDMA_signalstrength!=0))
+ if(is_rssi_valid(WCDMA_signalstrength))
{
solSigStren->wcdma_sig_valid = 1;
+ convert_rscp(rscp,&solSigStren->rscp);
+ convert_ecno(ecno,&solSigStren->ecno);
}else{
solSigStren->wcdma_sig_valid = 0;
}
/*bug fix*/
- p->readInt32(&solSigStren->ssRsrp);
- p->readInt32(&solSigStren->ssRsrq);
- p->readInt32(&solSigStren->ssSinr);
- p->readInt32(&solSigStren->csiRsrp);
- p->readInt32(&solSigStren->csiRsrq);
- p->readInt32(&solSigStren->csiSinr);
- sum = (solSigStren->ssRsrp) + (solSigStren->ssRsrq) + (solSigStren->ssSinr) + (solSigStren->csiRsrp)+\
- (solSigStren->csiRsrq) + (solSigStren->csiSinr);
- if(sum != 0)
+ p->readInt32(&solSigStren->ssRsrp);
+
+ if(solSigStren->ssRsrp > 0 && solSigStren->ssRsrp < 255)
{
solSigStren->nr_sig_valid = 1;
- }else{
+ p->readInt32(&solSigStren->ssRsrq);
+ p->readInt32(&solSigStren->ssSinr);
+ p->readInt32(&solSigStren->csiRsrp);
+ p->readInt32(&solSigStren->csiRsrq);
+ p->readInt32(&solSigStren->csiSinr);
+ }
+ else{
LYERRLOG("None of NR signal info");
+ solSigStren->nr_sig_valid = 0;
}
LYINFLOG("%s suc",__func__);
@@ -1362,16 +1408,13 @@
case RIL_UNSOL_SIGNAL_STRENGTH:
{
p->readInt32(&s_network_urc_solSigStren.rssi);
- if((s_network_urc_solSigStren.rssi!=99)&&(s_network_urc_solSigStren.rssi!=0))
+ if(is_rssi_valid(s_network_urc_solSigStren.rssi))
{
s_network_urc_solSigStren.gw_sig_valid = 1;
+ LYINFLOG("urc_GSM_signalstrength:%d",s_network_urc_solSigStren.rssi);
}else{
s_network_urc_solSigStren.gw_sig_valid = 0;
}
- if(s_network_urc_solSigStren.gw_sig_valid == 1)
- {
- LYINFLOG("urc_GSM_signalstrength:%d",s_network_urc_solSigStren.rssi);
- }
p->readInt32(&none);
p->readInt32(&none);
p->readInt32(&none);
@@ -1384,16 +1427,14 @@
p->readInt32(&s_network_urc_solSigStren.rsrp);
p->readInt32(&s_network_urc_solSigStren.rsrq);
p->readInt32(&s_network_urc_solSigStren.rssnr);
- if((urc_LTE_signalstrength!=99)&&(urc_LTE_signalstrength!=0))
+ if(is_rssi_valid(urc_LTE_signalstrength))
{
s_network_urc_solSigStren.lte_sig_valid = 1;
+ LYINFLOG("urc_LTE_signalstrength:%d",urc_LTE_signalstrength);
}else{
s_network_urc_solSigStren.lte_sig_valid = 0;
}
- if(s_network_urc_solSigStren.lte_sig_valid == 1)
- {
- LYINFLOG("urc_LTE_signalstrength:%d",urc_LTE_signalstrength);
- }
+
p->readInt32(&none);
p->readInt32(&none);
p->readInt32(&none);
@@ -1403,36 +1444,38 @@
p->readInt32(&none);
p->readInt32(&s_network_urc_solSigStren.rscp);
p->readInt32(&s_network_urc_solSigStren.ecno);
- if((urc_WCDMA_signalstrength!=99)&&(urc_WCDMA_signalstrength!=0))
+ if(is_rssi_valid(urc_WCDMA_signalstrength))
{
s_network_urc_solSigStren.wcdma_sig_valid = 1;
+ LYINFLOG("urc_WCDMA_signalstrength:%d",urc_WCDMA_signalstrength);
}else{
s_network_urc_solSigStren.wcdma_sig_valid = 0;
}
- if(s_network_urc_solSigStren.wcdma_sig_valid == 1)
+
+ if(size >= sizeof(RIL_SignalStrength_v14)+sizeof(int)*LYNQ_URC_MSG_HEAD_ELEMENT_NUM)
{
- LYINFLOG("urc_WCDMA_signalstrength:%d",urc_WCDMA_signalstrength);
+ p->readInt32(&s_network_urc_solSigStren.ssRsrp);
+ if(s_network_urc_solSigStren.ssRsrp > 0 && s_network_urc_solSigStren.ssRsrp < 255)
+ {
+ s_network_urc_solSigStren.nr_sig_valid = 1;
+ p->readInt32(&s_network_urc_solSigStren.ssRsrq);
+ p->readInt32(&s_network_urc_solSigStren.ssSinr);
+ p->readInt32(&s_network_urc_solSigStren.csiRsrp);
+ p->readInt32(&s_network_urc_solSigStren.csiRsrq);
+ p->readInt32(&s_network_urc_solSigStren.csiSinr);
+ LYINFLOG("[NR signal]ssRsrp is %d , ssRsrq is %d , ssSinr is %d , csiRsrp is %d , csiRsrq is %d , csiSinr is %d",\
+ s_network_urc_solSigStren.ssRsrp,s_network_urc_solSigStren.ssRsrq,s_network_urc_solSigStren.ssSinr, \
+ s_network_urc_solSigStren.csiRsrp,s_network_urc_solSigStren.csiRsrq,s_network_urc_solSigStren.csiSinr);
+ }
+ else
+ {
+ s_network_urc_solSigStren.nr_sig_valid = 0;
+ }
}
- p->readInt32(&s_network_urc_solSigStren.ssRsrp);
- p->readInt32(&s_network_urc_solSigStren.ssRsrq);
- p->readInt32(&s_network_urc_solSigStren.ssSinr);
- p->readInt32(&s_network_urc_solSigStren.csiRsrp);
- p->readInt32(&s_network_urc_solSigStren.csiRsrq);
- p->readInt32(&s_network_urc_solSigStren.csiSinr);
- NR_sum = (s_network_urc_solSigStren.ssRsrp) + (s_network_urc_solSigStren.ssRsrq) + (s_network_urc_solSigStren.ssSinr) + (s_network_urc_solSigStren.csiRsrp)+\
- (s_network_urc_solSigStren.csiRsrq) + (s_network_urc_solSigStren.csiSinr);
- if(NR_sum != 0)
+ else
{
- s_network_urc_solSigStren.nr_sig_valid = 1;
- }else{
- s_network_urc_solSigStren.nr_sig_valid = 0;
+ s_network_urc_solSigStren.nr_sig_valid = 0;
}
- if(s_network_urc_solSigStren.nr_sig_valid == 1)
- {
- LYINFLOG("[NR signal]ssRsrp is %d , ssRsrq is %d , ssSinr is %d , csiRsrp is %d , csiRsrq is %d , csiSinr is %d",\
- s_network_urc_solSigStren.ssRsrp,s_network_urc_solSigStren.ssRsrq,s_network_urc_solSigStren.ssSinr, \
- s_network_urc_solSigStren.csiRsrp,s_network_urc_solSigStren.csiRsrq,s_network_urc_solSigStren.csiSinr);
- }
send_urc_signal_changes();
break;
}