优化demo代码解决NW部分参数处理错误
Change-Id: I4db3c717b535160ff7dc12bc9723d0d03ef303e8
diff --git a/mbtk/test/liblynq_lib/lynq_nw_test.c b/mbtk/test/liblynq_lib/lynq_nw_test.c
index 32ffc94..725ad69 100755
--- a/mbtk/test/liblynq_lib/lynq_nw_test.c
+++ b/mbtk/test/liblynq_lib/lynq_nw_test.c
@@ -19,29 +19,180 @@
u_int32_t ind_msg_len,
void *contextPtr)
{
- uint8 *net_data = NULL;
+ switch(ind_flag) {
+ case NW_IND_VOICE_REG_EVENT_IND_FLAG:
+ {
+ QSER_NW_VOICE_REG_EVENT_IND_T *ind = (QSER_NW_VOICE_REG_EVENT_IND_T*)ind_msg_buf;
+ printf("Recv event indication : VOICE REG EVENT\n");
+
+ if(ind==NULL)
+ {
+ printf("ind is NULL\n");
+ break;
+ }
- net_data = (uint8*)ind_msg_buf;
+ if(ind->registration_valid)
+ {
+ printf("voice_registration: \ntech_domain=%s, radio_tech=%s, roaming=%d, registration_state=%d\n",
+ tech_domain[ind->registration.tech_domain],
+ radio_tech[ind->registration.radio_tech],
+ ind->registration.roaming,
+ ind->registration.registration_state);
+ }
+ if(ind->registration_details_3gpp_valid)
+ {
+ printf("voice_registration_details_3gpp: \ntech_domain=%s, radio_tech=%s, mcc=%s, mnc=%s, roaming=%d, forbidden=%d, cid=0x%X, lac=%d, psc=%d, tac=%d\n",
+ tech_domain[ind->registration_details_3gpp.tech_domain],
+ radio_tech[ind->registration_details_3gpp.radio_tech],
+ ind->registration_details_3gpp.mcc,
+ ind->registration_details_3gpp.mnc,
+ ind->registration_details_3gpp.roaming,
+ ind->registration_details_3gpp.forbidden,
+ ind->registration_details_3gpp.cid,
+ ind->registration_details_3gpp.lac,
+ ind->registration_details_3gpp.psc,
+ ind->registration_details_3gpp.tac);
+ }
- if(ind_msg_buf && ind_msg_len > 0)//无处理原始数据传输过来
- {
- if(*net_data == 0)
- { // CS
- printf("CS:act=%d, mode=%d\n", *(net_data + 1), *(net_data + 2));
- }
- else
- { // PS
- printf("PS[%s]:act=%d, mode=%d\n", *(net_data + 3) == 0 ? "GSM/WCDMA" : "LTE", *(net_data + 1), *(net_data + 2));
- }
+ if(ind->registration_details_3gpp2_valid)
+ {
+ printf("voice_registration_details_3gpp2: \ntech_domain=%s, radio_tech=%s, mcc=%s, mnc=%s, roaming=%d, forbidden=%d, sid=%d, nid=%d, bsid=%d\n",
+ tech_domain[ind->registration_details_3gpp2.tech_domain],
+ radio_tech[ind->registration_details_3gpp2.radio_tech],
+ ind->registration_details_3gpp2.mcc,
+ ind->registration_details_3gpp2.mnc,
+ ind->registration_details_3gpp2.roaming,
+ ind->registration_details_3gpp2.forbidden,
+ ind->registration_details_3gpp2.sid,
+ ind->registration_details_3gpp2.nid,
+ ind->registration_details_3gpp2.bsid);
+ }
+
+ break;
+ }
+ case NW_IND_DATA_REG_EVENT_IND_FLAG:
+ {
+ QSER_NW_DATA_REG_EVENT_IND_T *ind = (QSER_NW_DATA_REG_EVENT_IND_T*)ind_msg_buf;
+
+ printf("Recv event indication : DATA REG EVENT\n");
+
+ if(ind==NULL)
+ {
+ printf("ind is NULL\n");
+ break;
+ }
+
+
+ if(ind->registration_valid)
+ {
+ printf("data_registration: \ntech_domain=%s, radio_tech=%s, roaming=%d, registration_state=%d\n",
+ tech_domain[ind->registration.tech_domain],
+ radio_tech[ind->registration.radio_tech],
+ ind->registration.roaming,
+ ind->registration.registration_state);
+ }
+ if(ind->registration_details_3gpp_valid)
+ {
+ printf("data_registration_details_3gpp: \ntech_domain=%s, radio_tech=%s, mcc=%s, mnc=%s, roaming=%d, forbidden=%d, cid=0x%X, lac=%d, psc=%d, tac=%d\n",
+ tech_domain[ind->registration_details_3gpp.tech_domain],
+ radio_tech[ind->registration_details_3gpp.radio_tech],
+ ind->registration_details_3gpp.mcc,
+ ind->registration_details_3gpp.mnc,
+ ind->registration_details_3gpp.roaming,
+ ind->registration_details_3gpp.forbidden,
+ ind->registration_details_3gpp.cid,
+ ind->registration_details_3gpp.lac,
+ ind->registration_details_3gpp.psc,
+ ind->registration_details_3gpp.tac);
+ }
+
+ if(ind->registration_details_3gpp2_valid)
+ {
+ printf("data_registration_details_3gpp2: \ntech_domain=%s, radio_tech=%s, mcc=%s, mnc=%s, roaming=%d, forbidden=%d, prl=%d, css=%d, sid=%d, nid=%d, bsid=%d\n",
+ tech_domain[ind->registration_details_3gpp2.tech_domain],
+ radio_tech[ind->registration_details_3gpp2.radio_tech],
+ ind->registration_details_3gpp2.mcc,
+ ind->registration_details_3gpp2.mnc,
+ ind->registration_details_3gpp2.roaming,
+ ind->registration_details_3gpp2.forbidden,
+ ind->registration_details_3gpp2.inPRL,
+ ind->registration_details_3gpp2.css,
+ ind->registration_details_3gpp2.sid,
+ ind->registration_details_3gpp2.nid,
+ ind->registration_details_3gpp2.bsid);
+ }
+
+ break;
+ }
+ case NW_IND_SIGNAL_STRENGTH_EVENT_IND_FLAG:
+ {
+ QSER_NW_SINGNAL_EVENT_IND_T *ind = (QSER_NW_SINGNAL_EVENT_IND_T*)ind_msg_buf;
+
+ printf("Recv event indication : SIGNAL STRENGTH EVENT\n");
+
+ if(ind==NULL)
+ {
+ printf("ind is NULL\n");
+ break;
+ }
+
+ if(ind->gsm_sig_info_valid)
+ {
+ printf("gsm_sig_info: rssi=%d\n",
+ ind->gsm_sig_info.rssi);
+ }
+
+ if(ind->wcdma_sig_info_valid)
+ {
+ printf("wcdma_sig_info: rssi=%d, ecio=%d\n",
+ ind->wcdma_sig_info.rssi,
+ ind->wcdma_sig_info.ecio);
+ }
+ if(ind->tdscdma_sig_info_valid)
+ {
+ printf("tdscdma_sig_info: rssi=%d, rscp=%d, ecio=%d, sinr=%d\n",
+ ind->tdscdma_sig_info.rssi,
+ ind->tdscdma_sig_info.rscp,
+ ind->tdscdma_sig_info.ecio,
+ ind->tdscdma_sig_info.sinr);
+ }
+ if(ind->lte_sig_info_valid)
+ {
+ printf("lte_sig_info: rssi=%d, rsrq=%d, rsrp=%d, snr=%d\n",
+ ind->lte_sig_info.rssi,
+ ind->lte_sig_info.rsrq,
+ ind->lte_sig_info.rsrp,
+ ind->lte_sig_info.snr);
+ }
+ if(ind->cdma_sig_info_valid)
+ {
+ printf("cdma_sig_info: rssi=%d, ecio=%d\n",
+ ind->cdma_sig_info.rssi,
+ ind->cdma_sig_info.ecio);
+ }
+ if(ind->hdr_sig_info_valid)
+ {
+ printf("hdr_sig_info: rssi=%d, ecio=%d, sinr=%d, io=%d\n",
+ ind->hdr_sig_info.rssi,
+ ind->hdr_sig_info.ecio,
+ ind->hdr_sig_info.sinr,
+ ind->hdr_sig_info.io);
+ }
+ break;
+ }
+ case NW_IND_IMS_REG_EVENT_IND_FLAG:
+ {
+ printf("Recv event indication : IMS REG EVENT\n");
+
+ break;
+ }
+ default:
+ break;
}
- else
- {
- printf("NET_CB : NULL");
- }
-
}
+
int main(int argc, char *argv[])
{
char operator[10];
@@ -113,16 +264,16 @@
t_info.preferred_nw_mode = QSER_NW_MODE_WCDMA;//3G
break;
case 4:
- t_info.preferred_nw_mode = QSER_NW_MODE_CDMA;//3G
+ t_info.preferred_nw_mode = QSER_NW_MODE_CDMA;//3G no support
break;
case 8:
- t_info.preferred_nw_mode = QSER_NW_MODE_EVDO;//3G
+ t_info.preferred_nw_mode = QSER_NW_MODE_EVDO;//3G no support
break;
case 16:
t_info.preferred_nw_mode = QSER_NW_MODE_LTE;//4G
break;
case 32:
- t_info.preferred_nw_mode = QSER_NW_MODE_TDSCDMA;//3G
+ t_info.preferred_nw_mode = QSER_NW_MODE_TDSCDMA;//3G no support
break;
default:
t_info.preferred_nw_mode = QSER_NW_MODE_LTE;//4G
@@ -147,42 +298,87 @@
break;
case 5:
{
- QSER_NW_REG_STATUS_INFO_T reg;
- int err = qser_nw_get_reg_status(handle, ®);
+ QSER_NW_REG_STATUS_INFO_T t_info;
+ int err = qser_nw_get_reg_status(handle, &t_info);
if(err)
{
printf("Error : %d\n", err);
}
else
{
- if(reg.voice_registration_details_3gpp_valid)
+ if(t_info.voice_registration_valid)
{
- printf("voice_registration_details_3gpp: tech_domain=%d, radio_tech=%d, mcc=%s, mnc=%s, roaming=%d, forbidden=%d, cid=0x%X, lac=%d, psc=%d, tac=%d\n",
- reg.voice_registration_details_3gpp.tech_domain,
- reg.voice_registration_details_3gpp.radio_tech,
- reg.voice_registration_details_3gpp.mcc,
- reg.voice_registration_details_3gpp.mnc,
- reg.voice_registration_details_3gpp.roaming,
- reg.voice_registration_details_3gpp.forbidden,
- reg.voice_registration_details_3gpp.cid,
- reg.voice_registration_details_3gpp.lac,
- reg.voice_registration_details_3gpp.psc,
- reg.voice_registration_details_3gpp.tac);
+ printf("voice_registration: \ntech_domain=%s, radio_tech=%s, roaming=%d, registration_state=%d\n",
+ tech_domain[t_info.voice_registration.tech_domain],
+ radio_tech[t_info.voice_registration.radio_tech],
+ t_info.voice_registration.roaming,
+ t_info.voice_registration.registration_state);
}
- if(reg.data_registration_details_3gpp_valid)
+ if(t_info.data_registration_valid)
{
- printf("data_registration_details_3gpp: tech_domain=%d, radio_tech=%d, mcc=%s, mnc=%s, roaming=%d, forbidden=%d, cid=0x%X, lac=%d, psc=%d, tac=%d\n",
- reg.data_registration_details_3gpp.tech_domain,
- reg.data_registration_details_3gpp.radio_tech,
- reg.data_registration_details_3gpp.mcc,
- reg.data_registration_details_3gpp.mnc,
- reg.data_registration_details_3gpp.roaming,
- reg.data_registration_details_3gpp.forbidden,
- reg.data_registration_details_3gpp.cid,
- reg.data_registration_details_3gpp.lac,
- reg.data_registration_details_3gpp.psc,
- reg.data_registration_details_3gpp.tac);
+ printf("data_registration: \ntech_domain=%s, radio_tech=%s, roaming=%d, registration_state=%d\n",
+ tech_domain[t_info.data_registration.tech_domain],
+ radio_tech[t_info.data_registration.radio_tech],
+ t_info.data_registration.roaming,
+ t_info.data_registration.registration_state);
}
+ if(t_info.voice_registration_details_3gpp_valid)
+ {
+ printf("voice_registration_details_3gpp: \ntech_domain=%s, radio_tech=%s, mcc=%s, mnc=%s, roaming=%d, forbidden=%d, cid=0x%X, lac=%d, psc=%d, tac=%d\n",
+ tech_domain[t_info.voice_registration_details_3gpp.tech_domain],
+ radio_tech[t_info.voice_registration_details_3gpp.radio_tech],
+ t_info.voice_registration_details_3gpp.mcc,
+ t_info.voice_registration_details_3gpp.mnc,
+ t_info.voice_registration_details_3gpp.roaming,
+ t_info.voice_registration_details_3gpp.forbidden,
+ t_info.voice_registration_details_3gpp.cid,
+ t_info.voice_registration_details_3gpp.lac,
+ t_info.voice_registration_details_3gpp.psc,
+ t_info.voice_registration_details_3gpp.tac);
+ }
+ if(t_info.data_registration_details_3gpp_valid)
+ {
+ printf("data_registration_details_3gpp: \ntech_domain=%s, radio_tech=%s, mcc=%s, mnc=%s, roaming=%d, forbidden=%d, cid=0x%X, lac=%d, psc=%d, tac=%d\n",
+ tech_domain[t_info.data_registration_details_3gpp.tech_domain],
+ radio_tech[t_info.data_registration_details_3gpp.radio_tech],
+ t_info.data_registration_details_3gpp.mcc,
+ t_info.data_registration_details_3gpp.mnc,
+ t_info.data_registration_details_3gpp.roaming,
+ t_info.data_registration_details_3gpp.forbidden,
+ t_info.data_registration_details_3gpp.cid,
+ t_info.data_registration_details_3gpp.lac,
+ t_info.data_registration_details_3gpp.psc,
+ t_info.data_registration_details_3gpp.tac);
+ }
+
+ if(t_info.voice_registration_details_3gpp2_valid)
+ {
+ printf("voice_registration_details_3gpp2: \ntech_domain=%s, radio_tech=%s, mcc=%s, mnc=%s, roaming=%d, forbidden=%d, sid=%d, nid=%d, bsid=%d\n",
+ tech_domain[t_info.voice_registration_details_3gpp2.tech_domain],
+ radio_tech[t_info.voice_registration_details_3gpp2.radio_tech],
+ t_info.voice_registration_details_3gpp2.mcc,
+ t_info.voice_registration_details_3gpp2.mnc,
+ t_info.voice_registration_details_3gpp2.roaming,
+ t_info.voice_registration_details_3gpp2.forbidden,
+ t_info.voice_registration_details_3gpp2.sid,
+ t_info.voice_registration_details_3gpp2.nid,
+ t_info.voice_registration_details_3gpp2.bsid);
+ }
+
+ if(t_info.data_registration_details_3gpp2_valid)
+ {
+ printf("data_registration_details_3gpp2: \ntech_domain=%s, radio_tech=%s, mcc=%s, mnc=%s, roaming=%d, forbidden=%d, sid=%d, nid=%d, bsid=%d\n",
+ tech_domain[t_info.data_registration_details_3gpp2.tech_domain],
+ radio_tech[t_info.data_registration_details_3gpp2.radio_tech],
+ t_info.data_registration_details_3gpp2.mcc,
+ t_info.data_registration_details_3gpp2.mnc,
+ t_info.data_registration_details_3gpp2.roaming,
+ t_info.data_registration_details_3gpp2.forbidden,
+ t_info.data_registration_details_3gpp2.sid,
+ t_info.data_registration_details_3gpp2.nid,
+ t_info.data_registration_details_3gpp2.bsid);
+ }
+
//printf("Data Reg: radio_tech = %d, lac = %x, cid = %x\n", reg.data_registration_details_3gpp.radio_tech, reg.data_registration_details_3gpp.lac, reg.data_registration_details_3gpp.cid);
//printf("Voice Reg: radio_tech = %d, lac = %x, cid = %x\n", reg.voice_registration_details_3gpp.radio_tech, reg.voice_registration_details_3gpp.lac, reg.voice_registration_details_3gpp.cid);
}
@@ -190,22 +386,48 @@
break;
case 6:
{
- QSER_NW_SIGNAL_STRENGTH_INFO_T sig;
- int err = qser_nw_get_signal_strength(handle, &sig);
+ QSER_NW_SIGNAL_STRENGTH_INFO_T t_info;
+ int err = qser_nw_get_signal_strength(handle, &t_info);
if(err)
{
printf("Error : %d\n", err);
}
else
{
- if (sig.gsm_sig_info_valid == TRUE)
- printf("Signal GSM: rssi = %d\n", sig.gsm_sig_info.rssi);
- else if (sig.lte_sig_info_valid == TRUE)
- printf("Signal LTE: rssi = %d, rsrp = %d, rsrq = %d, snr = %d\n", sig.lte_sig_info.rssi , sig.lte_sig_info.rsrp, sig.lte_sig_info.rsrq, sig.lte_sig_info.snr);
- else if (sig.wcdma_sig_info_valid == TRUE)
- printf("Signal UTRAN: rssi = %d, ecio = %d\n", sig.wcdma_sig_info.rssi , sig.wcdma_sig_info.ecio);
- else
- printf("Signal type not supported \n");
+ printf("qser_nw_get_signal_strength, ret=%d\n", err);
+ if(err==0)
+ {
+ printf("qser_solicited_signal_strength gsm_sig_info_valid = %d\n"
+ " gsm_sig_info.rssi = %d\n"
+ " wcdma _sig_info_valid = %d\n"
+ " wcdma_sig_info.rssi = %d\n"
+ " wcdma_sig_info.ecio = %d\n"
+ " tdscdma_sig_info_valid = %d\n"
+ " lte_sig_info_valid = %d\n"
+ " lte_sig_info.rssi = %d\n"
+ " lte_sig_info.rsrp = %d\n"
+ " lte_sig_info.rsrq = %d\n"
+ " lte_sig_info.snr = %d\n"
+ " cdma_sig_info_valid = %d\n"
+ " hdr_sig_info_valid = %d\n"
+ " nr_sig_info_valid = %d\n"
+ " nr_sig_info.ssRsrp = %d\n"
+ " nr_sig_info.ssRsrq = %d\n"
+ " nr_sig_info.ssSinr = %d\n"
+ " nr_sig_info.csiRsrp = %d\n"
+ " nr_sig_info.csiRsrq = %d\n"
+ " nr_sig_info.csiSinr = %d\n",
+ t_info.gsm_sig_info_valid, t_info.gsm_sig_info.rssi,
+ t_info.wcdma_sig_info_valid, t_info.wcdma_sig_info.rssi, t_info.wcdma_sig_info.ecio,
+ t_info.tdscdma_sig_info_valid,
+ t_info.lte_sig_info_valid, t_info.lte_sig_info.rssi, t_info.lte_sig_info.rsrp, t_info.lte_sig_info.rsrq, t_info.lte_sig_info.snr,
+ t_info.cdma_sig_info_valid,
+ t_info.hdr_sig_info_valid,
+ t_info.nr_sig_info_valid, t_info.nr_sig_info.ssRsrp, t_info.nr_sig_info.ssRsrq, t_info.nr_sig_info.ssSinr,
+ t_info.nr_sig_info.csiRsrp, t_info.nr_sig_info.csiRsrq, t_info.nr_sig_info.csiSinr);
+
+ }
+
}
}
break;