[Feature][ZXW-297][network] T106 network modeule 's code about signal
strength aligen with T800
Affected branch: unknown
Affected module: unknown
Is it affected on both ZXIC and MTK: ZXIC
Self-test: Yes
Doc Update: No
Change-Id: I1ba6a5d6d956182711ccd8575172d6ade2fd9cc0
diff --git a/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/ril.cpp b/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/ril.cpp
index 964989e..26f34a7 100755
--- a/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/ril.cpp
+++ b/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/ril.cpp
@@ -2913,12 +2913,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/cap/zx297520v3/src/lynq/lib/liblynq-network/lynq_network.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-network/lynq_network.cpp
index e1fdb18..1fd2780 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-network/lynq_network.cpp
+++ b/cap/zx297520v3/src/lynq/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*/
@@ -1478,6 +1479,54 @@
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 is_nr_ss_rsrp_valid(int ss_rsrp)
+{
+ if(ss_rsrp > 0 && ss_rsrp < 255)
+ {
+ return true;
+ }
+ return false;
+}
+
int lynq_solicited_signal_strength(signalStrength_t *solSigStren)
{
if(g_module_init_flag != MODULE_RUNNING)
@@ -1497,13 +1546,15 @@
{
LYERRLOG("%s call lynq_send_common_request failure, ret is %d",__func__,ret);
return ret;
- }
-
- int sum = 0;
+ }
+
+
int none = 0;
+ int rscp;
+ int ecno;
p->readInt32(&solSigStren->rssi);
- if((solSigStren->rssi > 0)&&(solSigStren->rssi < 99))
+ if(is_rssi_valid(solSigStren->rssi))
{
solSigStren->gw_sig_valid = 1;
}else{
@@ -1526,7 +1577,7 @@
p->readInt32(&solSigStren->rssnr);
LYINFLOG("LTE_signalstrength:%d",solSigStren->lte_signalstrength);
- if((solSigStren->lte_signalstrength > 0)&&(solSigStren->lte_signalstrength< 99))
+ if(is_rssi_valid(solSigStren->lte_signalstrength))
{
solSigStren->lte_sig_valid = 1;
}else{
@@ -1541,26 +1592,32 @@
p->readInt32(&none);
p->readInt32(&solSigStren->wcdma_signalstrength);
p->readInt32(&none);
- p->readInt32(&solSigStren->rscp);
- p->readInt32(&solSigStren->ecno);
+ p->readInt32(&rscp);
+ p->readInt32(&ecno);
+
+
LYINFLOG("WCDMA_signalstrength:%d",solSigStren->wcdma_signalstrength);
- if((solSigStren->wcdma_signalstrength > 0)&&(solSigStren->wcdma_signalstrength < 99))
+ if(is_rssi_valid(solSigStren->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);
- if(solSigStren->ssRsrp > 0 && solSigStren->ssRsrp < 255)
+ p->readInt32(&solSigStren->ssRsrp);
+
+ if(is_nr_ss_rsrp_valid(solSigStren->ssRsrp))
{
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;
}
@@ -1716,7 +1773,7 @@
case RIL_UNSOL_SIGNAL_STRENGTH:
{
p->readInt32(&s_network_urc_solSigStren.rssi);
- if((s_network_urc_solSigStren.rssi<=31)&&(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);
@@ -1734,7 +1791,7 @@
p->readInt32(&s_network_urc_solSigStren.rsrp);
p->readInt32(&s_network_urc_solSigStren.rsrq);
p->readInt32(&s_network_urc_solSigStren.rssnr);
- if((s_network_urc_solSigStren.lte_signalstrength<=31)&&(s_network_urc_solSigStren.lte_signalstrength>=0))
+ if(is_rssi_valid(s_network_urc_solSigStren.lte_signalstrength))
{
s_network_urc_solSigStren.lte_sig_valid = 1;
LYINFLOG("urc_LTE_signalstrength:%d",s_network_urc_solSigStren.lte_signalstrength);
@@ -1750,30 +1807,38 @@
p->readInt32(&none);//bitErrorRate
p->readInt32(&s_network_urc_solSigStren.rscp);
p->readInt32(&s_network_urc_solSigStren.ecno);
- if((s_network_urc_solSigStren.wcdma_signalstrength<=31)&&(s_network_urc_solSigStren.wcdma_signalstrength>=0))
+ if(is_rssi_valid(s_network_urc_solSigStren.wcdma_signalstrength))
{
s_network_urc_solSigStren.wcdma_sig_valid = 1;
LYINFLOG("urc_WCDMA_signalstrength:%d",s_network_urc_solSigStren.wcdma_signalstrength);
}else{
s_network_urc_solSigStren.wcdma_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)
+
+ if(size >= sizeof(RIL_SignalStrength_v14)+sizeof(int)*LYNQ_URC_MSG_HEAD_ELEMENT_NUM)
{
- 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);
- }else{
- s_network_urc_solSigStren.nr_sig_valid = 0;
- }
+ p->readInt32(&s_network_urc_solSigStren.ssRsrp);
+ if(is_nr_ss_rsrp_valid(s_network_urc_solSigStren.ssRsrp))
+ {
+ 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;
+ }
+ }
+ else
+ {
+ s_network_urc_solSigStren.nr_sig_valid = 0;
+ }
send_urc_signal_changes();
break;
}