Merge "[Bugfix][T106BUG-31] call lynq_query_registration_state to get voice state, Segmentation fault"
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-network/include/lynq_network/lynq_network.h b/cap/zx297520v3/src/lynq/lib/liblynq-network/include/lynq_network/lynq_network.h
index ba7c1f4..e466e46 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-network/include/lynq_network/lynq_network.h
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-network/include/lynq_network/lynq_network.h
@@ -11,6 +11,7 @@
int gw_sig_valid; /*1 valid,1 invalid*/
int rssi; /* Valid values are (0-31, 99) as defined in TS 27.007 8.5 */
int wcdma_sig_valid;/*1 valid,0 invalid*/
+ int wcdma_signalstrength;
int rscp; /* The Received Signal Code Power in dBm multipled by -1.
* Range : 25 to 120
* INT_MAX: 0x7FFFFFFF denotes invalid value.
@@ -19,6 +20,7 @@
* by -10. Example: If the actual Ec/Io is -12.5 dB, then this response value
* will be 125.*/
int lte_sig_valid;/*1 valid,0 invalid*/
+ int lte_signalstrength;
int rsrp; /* The current Reference Signal Receive Power in dBm multipled by -1.
* Range: 44 to 140 dBm
* INT_MAX: 0x7FFFFFFF denotes invalid value.
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 c025404..b9d3388 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-network/lynq_network.cpp
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-network/lynq_network.cpp
@@ -507,27 +507,41 @@
}
int num,i;
- char *resp[LYNQ_RESP_STRING_MAX_NUM];
+ char *resp[LYNQ_RESP_STRING_MAX_NUM]={0};
if(!strcmp(str,"VOICE"))
{
p->readInt32(&num);
if(num == 15)
{
- for(i=0;i<15;i++)
+ for(i=0;i<num;i++)
{
- resp[i]=lynqStrdupReadString(p);
- }
- *regState = atoi(resp[0]);
+ resp[i]=lynqStrdupReadString(p);
+ }
+ if(resp[0]==NULL || resp[3]==NULL)
+ {
+ LYERRLOG("%s voice resp[0] resp[3] %s %s is NULL",__func__,resp[0],resp[3]);
+ ret=LYNQ_E_INNER_ERROR;
+ goto registration_return;
+ }
+ *regState = atoi(resp[0]);
*netType = atoi(resp[3]);
- *netRejected = atoi(resp[14]);
- for(i=0;i<15;i++)
+ if(*regState==3)
{
- if(resp[i]!=NULL)
- {
- free(resp[i]);
- }
- }
+ if(resp[13]==NULL)
+ {
+ LYERRLOG("%s resp[13] is NULL",__func__);
+ ret=LYNQ_E_INNER_ERROR;
+ goto registration_return;
+ }
+ *netRejected = atoi(resp[13]);
+ }
+ else
+ {
+ *netRejected=0;
+
+}
set_state_to_buf(NETWORK_STATE_BUFFER_TYPE_VOICE_REG,3,*regState,*netType,*netRejected,0);
+ goto registration_return;
}
else
{
@@ -538,24 +552,40 @@
}
else if(!strcmp(str,"DATA")){
p->readInt32(&num);
- if(num == 11)
- {
- for(i=0;i<4;i++)
+ if(num >=5 && num <=11)
+ {
+ num=5;
+ for(i=0;i<num;i++)
{
resp[i]=lynqStrdupReadString(p);
}
- *regState = atoi(resp[0]);
+ if(resp[0]==NULL || resp[1]==NULL || resp[2]==NULL || resp[3]==NULL)
+ {
+ LYERRLOG("%s data resp[0] resp[1] resp[2] resp[3] %s %s %s %s is NULL",__func__,resp[0],resp[1],resp[2],resp[3]);
+ ret=LYNQ_E_INNER_ERROR;
+ goto registration_return;
+ }
+ *regState = atoi(resp[0]);
+ if(*regState==3)
+ {
+ if(resp[4]==NULL)
+ {
+ LYERRLOG("%s resp[4] is NULL",__func__);
+ ret=LYNQ_E_INNER_ERROR;
+ goto registration_return;
+ }
+ *netRejected = atoi(resp[4]);
+ }
+ else
+ {
+ *netRejected=0;
+
+ }
strcpy(LAC,resp[1]);
strcpy(CID,resp[2]);
*netType = atoi(resp[3]);
- for(i=0;i<4;i++)
- {
- if(resp[i]!=NULL)
- {
- free(resp[i]);
- }
- }
- set_state_to_buf(NETWORK_STATE_BUFFER_TYPE_DATA_REG,2,*regState,*netType,2,LAC,CID);
+ set_state_to_buf(NETWORK_STATE_BUFFER_TYPE_DATA_REG,2,*regState,*netType,2,LAC,CID);
+ goto registration_return;
}
else
{
@@ -580,10 +610,25 @@
delete p;
return LYNQ_E_INNER_ERROR;
}
+ }
+
+registration_return:
+
+ if(ret==RESULT_OK)
+ {
+ LYINFLOG("%s suc",__func__);
}
- LYINFLOG("%s suc",__func__);
- delete p;
- return RESULT_OK;
+
+ for(i=0;i<num;i++)
+ {
+ if(resp[i]!=NULL)
+ {
+ free(resp[i]);
+ }
+ }
+ delete p;
+ return ret;
+
}
int lynq_query_prefferred_networktype(int *preNetType)
@@ -960,49 +1005,51 @@
}
int sum = 0;
- int LTE_signalstrength = 0;
- int WCDMA_signalstrength = 0;
int none = 0;
p->readInt32(&solSigStren->rssi);
- if((solSigStren->rssi!=99)&&(solSigStren->rssi!=0))
+ if((solSigStren->rssi<=31)&&(solSigStren->rssi>=0))
{
solSigStren->gw_sig_valid = 1;
}else{
solSigStren->gw_sig_valid = 0;
}
- p->readInt32(&none);
- p->readInt32(&none);
- p->readInt32(&none);
- p->readInt32(&none);
- p->readInt32(&none);
- p->readInt32(&none);
- p->readInt32(&none);
- p->readInt32(<E_signalstrength);
- // p->readInt32(&solSigStren->signalStrength.LTE_SignalStrength.signalStrength);
- p->readInt32(&solSigStren->rsrp);
- p->readInt32(&solSigStren->rsrq);
- p->readInt32(&solSigStren->rssnr);
- LYINFLOG("LTE_signalstrength:%d",LTE_signalstrength);
- if((LTE_signalstrength!=99)&&(LTE_signalstrength!=0))
- {
- solSigStren->lte_sig_valid = 1;
- }else{
- solSigStren->lte_sig_valid = 0;
- }
p->readInt32(&none);
p->readInt32(&none);
p->readInt32(&none);
p->readInt32(&none);
p->readInt32(&none);
- p->readInt32(&WCDMA_signalstrength);
+ p->readInt32(&none);
+ p->readInt32(&none);
+ p->readInt32(&solSigStren->lte_signalstrength);
+
+ // p->readInt32(&solSigStren->signalStrength.LTE_SignalStrength.signalStrength);
+ p->readInt32(&solSigStren->rsrp);
+ p->readInt32(&solSigStren->rsrq);
+ p->readInt32(&solSigStren->rssnr);
+
+ LYINFLOG("LTE_signalstrength:%d",solSigStren->lte_signalstrength);
+ if((solSigStren->lte_signalstrength<=31)&&(solSigStren->lte_signalstrength>=0))
+ {
+ solSigStren->lte_sig_valid = 1;
+ }else{
+ solSigStren->lte_sig_valid = 0;
+ }
+
+
+ p->readInt32(&none);
+ p->readInt32(&none);
+ p->readInt32(&none);
+ p->readInt32(&none);
+ p->readInt32(&none);
+ p->readInt32(&solSigStren->wcdma_signalstrength);
p->readInt32(&none);
p->readInt32(&solSigStren->rscp);
p->readInt32(&solSigStren->ecno);
- LYINFLOG("WCDMA_signalstrength:%d",WCDMA_signalstrength);
- if((WCDMA_signalstrength!=99)&&(WCDMA_signalstrength!=0))
+ LYINFLOG("WCDMA_signalstrength:%d",solSigStren->wcdma_signalstrength);
+ if((solSigStren->wcdma_signalstrength<=31)&&(solSigStren->wcdma_signalstrength>=0))
{
solSigStren->wcdma_sig_valid = 1;
}else{
@@ -1089,9 +1136,11 @@
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;
@@ -1147,9 +1196,6 @@
int resp_type;
int none = 0;
int NR_sum = 0;
- int urc_LTE_signalstrength = 0;
- int urc_WCDMA_signalstrength = 0;
-
int size=p->dataSize();
p->readInt32(&resp_type);
p->readInt32(&s_module_wait_urc_id);
@@ -1178,16 +1224,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((s_network_urc_solSigStren.rssi<=31)&&(s_network_urc_solSigStren.rssi>=0))
{
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);
@@ -1195,40 +1238,33 @@
p->readInt32(&none);
p->readInt32(&none);
p->readInt32(&none);
- p->readInt32(&urc_LTE_signalstrength);
- // p.readInt32(&solSigStren->signalStrength.LTE_SignalStrength.signalStrength);
+ p->readInt32(&s_network_urc_solSigStren.lte_signalstrength);
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((s_network_urc_solSigStren.lte_signalstrength<=31)&&(s_network_urc_solSigStren.lte_signalstrength>=0))
{
s_network_urc_solSigStren.lte_sig_valid = 1;
+ LYINFLOG("urc_LTE_signalstrength:%d",s_network_urc_solSigStren.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);
p->readInt32(&none);
p->readInt32(&none);
- p->readInt32(&urc_WCDMA_signalstrength);
- p->readInt32(&none);
+ p->readInt32(&s_network_urc_solSigStren.wcdma_signalstrength);
+ p->readInt32(&none);//bitErrorRate
p->readInt32(&s_network_urc_solSigStren.rscp);
p->readInt32(&s_network_urc_solSigStren.ecno);
- if((urc_WCDMA_signalstrength!=99)&&(urc_WCDMA_signalstrength!=0))
+ if((s_network_urc_solSigStren.wcdma_signalstrength<=31)&&(s_network_urc_solSigStren.wcdma_signalstrength>=0))
{
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;
}
- if(s_network_urc_solSigStren.wcdma_sig_valid == 1)
- {
- LYINFLOG("urc_WCDMA_signalstrength:%d",urc_WCDMA_signalstrength);
- }
p->readInt32(&s_network_urc_solSigStren.ssRsrp);
p->readInt32(&s_network_urc_solSigStren.ssRsrq);
p->readInt32(&s_network_urc_solSigStren.ssSinr);
@@ -1240,15 +1276,12 @@
if(NR_sum != 0)
{
s_network_urc_solSigStren.nr_sig_valid = 1;
- }else{
- 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);
- }
+ }else{
+ s_network_urc_solSigStren.nr_sig_valid = 0;
+ }
send_urc_signal_changes();
break;
}
diff --git a/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/network.cpp b/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/network.cpp
index 834b94d..748906b 100755
--- a/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/network.cpp
+++ b/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/network.cpp
@@ -95,11 +95,11 @@
{
printf("[%s][%d] enter!\n",__FUNCTION__,__LINE__);
int ret = -1;
- signalStrength_t solSigStren = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1};
+ signalStrength_t solSigStren = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1};
ret = lynq_solicited_signal_strength(&solSigStren);
printf("%s%d\n",TEST_RESULT,ret);
- printf("LYNQ_SOLICITED_SIGNAL_STRENGTH: gw_sig_valid=%d, wcdma_valid=%d, rssi=%d, rscp=%d\n", solSigStren.gw_sig_valid, solSigStren.wcdma_sig_valid, solSigStren.rssi, solSigStren.rscp);
+ printf("LYNQ_SOLICITED_SIGNAL_STRENGTH: gw_sig_valid=%d, wcdma_valid=%d, lte_valid=%d, rssi=%d, wcdma sig strength is =%d lte sig strength is %d\n", solSigStren.gw_sig_valid, solSigStren.wcdma_sig_valid, solSigStren.lte_sig_valid,solSigStren.rssi, solSigStren.wcdma_signalstrength,solSigStren.lte_signalstrength);
return ret;
}
int set_ims(int argc, char *argv[], int sp_test)
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/reference-ril.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/reference-ril.c
index 4c47ad3..23d114c 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/reference-ril.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/sdk/ril/reference-ril/reference-ril.c
Binary files differ