Add cell get/set API for V2.
Change-Id: I7a001cd0f091a199ef0f7583becead01c38e1777
diff --git a/mbtk/mbtk_rild_v2/src/main.c b/mbtk/mbtk_rild_v2/src/main.c
index 45a30f6..24a74a3 100755
--- a/mbtk/mbtk_rild_v2/src/main.c
+++ b/mbtk/mbtk_rild_v2/src/main.c
@@ -51,6 +51,7 @@
static bool ril_server_ready = FALSE; // Only one time.
ril_band_info_t band_info;
ril_info_t ril_info;
+extern mbtk_cell_pack_info_t cell_info;
// int urc_msg_distribute(bool async_process, info_urc_msg_id_enum msg, void *data, int data_len);
// int mbtk_signal_log(char *data);
@@ -281,16 +282,651 @@
}
}
+static void urc_cell_process(const char *s, const char *sms_pdu)
+{
+ /*
+ // <mcc>, <length of mnc>, <mnc>, <tac>, <PCI>, <dlEuarfcn>, < ulEuarfcn >, <band>, <dlBandwidth>,
+ // <rsrp>,<rsrq>, <sinr>,
+ // errcModeState,emmState,serviceState,IsSingleEmmRejectCause,EMMRejectCause,mmeGroupId,mmeCode,mTmsi,
+ // cellId,subFrameAssignType,specialSubframePatterns,transMode
+ // mainRsrp,diversityRsrp,mainRsrq,diversityRsrq,rssi,cqi,pathLoss,tb0DlTpt,tb1DlTpt,tb0DlPeakTpt,tb1DlPeakTpt,tb0UlPeakTpt,
+ // tb1UlPeakTpt,dlThroughPut,dlPeakThroughPut,averDlPRB,averCQITb0,averCQITb1,rankIndex,grantTotal,ulThroughPut,ulPeakThroughPut,currPuschTxPower,averUlPRB,
+ // dlBer, ulBer,
+ // diversitySinr, diversityRssi
+ +EEMLTESVC: 1120, 2, 0, 33584, 430, 40936, 40936, 41, 20,
+ 0, 0, 0,
+ 1, 10, 0, 1, 0, 1059, 78, 3959566565,
+ 105149248, 2, 7, 7,
+ 0, 0, 0, 0, 0, 0, 0, 1190919, 0, 0, 0, 16779777,
+ 0, 5112867, 3959566565, 2, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0,
+ 7, 44
+ */
+ if(strStartsWith(s, "+EEMLTESVC:")) // LTE Server Cell
+ {
+ // tac, PCI, dlEuarfcn, ulEuarfcn, band
+ if(cell_info.running) {
+ int tmp_int;
+ int i = 0;
+ char* tmp_s = memdup(s,strlen(s));
+ char* free_ptr = tmp_s;
+ char *line = tmp_s;
+ if (at_tok_start(&line) < 0)
+ {
+ goto EEMLTESVC_EXIT;
+ }
+
+ if (at_tok_nextint(&line, &tmp_int) < 0)
+ {
+ goto EEMLTESVC_EXIT;
+ }
+ cell_info.cell_list.cell[cell_info.cell_list.num].value6 = (uint32)tmp_int; //mcc
+ if (at_tok_nextint(&line, &tmp_int) < 0)
+ {
+ goto EEMLTESVC_EXIT;
+ }
+ if (at_tok_nextint(&line, &tmp_int) < 0)
+ {
+ goto EEMLTESVC_EXIT;
+ }
+ cell_info.cell_list.cell[cell_info.cell_list.num].value7 = (uint32)tmp_int; //mnc
+ /*
+ // Jump 2 integer.
+ i = 0;
+ while(i < 2) {
+ if (at_tok_nextint(&line, &tmp_int) < 0)
+ {
+ goto EEMLTESVC_EXIT;
+ }
+ i++;
+ }
+ */
+ if (at_tok_nextint(&line, &tmp_int) < 0)
+ {
+ goto EEMLTESVC_EXIT;
+ }
+ cell_info.cell_list.cell[cell_info.cell_list.num].value1 = (uint32)tmp_int; //tac
+ if (at_tok_nextint(&line, &tmp_int) < 0)
+ {
+ goto EEMLTESVC_EXIT;
+ }
+ cell_info.cell_list.cell[cell_info.cell_list.num].value2 = (uint32)tmp_int; //pci
+ if (at_tok_nextint(&line, &tmp_int) < 0)
+ {
+ goto EEMLTESVC_EXIT;
+ }
+ cell_info.cell_list.cell[cell_info.cell_list.num].value3 = (uint32)tmp_int; //dl arfcn
+ if (at_tok_nextint(&line, &tmp_int) < 0)
+ {
+ goto EEMLTESVC_EXIT;
+ }
+ cell_info.cell_list.cell[cell_info.cell_list.num].value4 = (uint32)tmp_int; //ul arfcn
+ if (at_tok_nextint(&line, &tmp_int) < 0)
+ {
+ goto EEMLTESVC_EXIT;
+ }
+ cell_info.cell_list.cell[cell_info.cell_list.num].value5 = (uint32)tmp_int; //band
+ if (at_tok_nextint(&line, &tmp_int) < 0)
+ {
+ goto EEMLTESVC_EXIT;
+ }
+ if (at_tok_nextint(&line, &tmp_int) < 0)
+ {
+ goto EEMLTESVC_EXIT;
+ }
+ cell_info.cell_list.cell[cell_info.cell_list.num].value8 = (uint32)tmp_int; //cid
+ if (at_tok_nextint(&line, &tmp_int) < 0)
+ {
+ goto EEMLTESVC_EXIT;
+ }
+ cell_info.cell_list.cell[cell_info.cell_list.num].value9 = (uint32)tmp_int; //rsrp
+
+ for(i =0; i < 10; i++)
+ {
+ if (at_tok_nextint(&line, &tmp_int) < 0)
+ {
+ goto EEMLTESVC_EXIT;
+ }
+ }
+ cell_info.cell_list.cell[cell_info.cell_list.num].value10 = (uint32)tmp_int; //cell identiy
+
+ cell_info.cell_list.num++;
+
+EEMLTESVC_EXIT:
+ free(free_ptr);
+ }
+ }
+ /*
+ // index,phyCellId,euArfcn,rsrp,rsrq
+ +EEMLTEINTER: 0, 65535, 38950, 0, 0
+ */
+ else if(strStartsWith(s, "+EEMLTEINTER:") || strStartsWith(s, "+EEMLTEINTRA:")) // LTE ÒìÆµ/Í¬ÆµÐ¡Çø
+ {
+ // phyCellId,euArfcn,rsrp,rsrq
+ if(cell_info.running) {
+ int tmp_int;
+ char* tmp_s = memdup(s,strlen(s));
+ char* free_ptr = tmp_s;
+ char *line = tmp_s;
+ if (at_tok_start(&line) < 0)
+ {
+ goto EEMLTEINTER_EXIT;
+ }
+ if (at_tok_nextint(&line, &tmp_int) < 0)
+ {
+ goto EEMLTEINTER_EXIT;
+ }
+ if (at_tok_nextint(&line, &tmp_int) < 0 || tmp_int <= 0 || tmp_int > 503)
+ {
+ goto EEMLTEINTER_EXIT;
+ }
+ cell_info.cell_list.cell[cell_info.cell_list.num].value1 = (uint32)tmp_int;
+ if (at_tok_nextint(&line, &tmp_int) < 0)
+ {
+ goto EEMLTEINTER_EXIT;
+ }
+ cell_info.cell_list.cell[cell_info.cell_list.num].value2 = (uint32)tmp_int;
+ if (at_tok_nextint(&line, &tmp_int) < 0)
+ {
+ goto EEMLTEINTER_EXIT;
+ }
+ cell_info.cell_list.cell[cell_info.cell_list.num].value3 = (uint32)tmp_int;
+ LOG("cell line : %s", line);
+ if (at_tok_nextint(&line, &tmp_int) < 0)
+ {
+ goto EEMLTEINTER_EXIT;
+ }
+ cell_info.cell_list.cell[cell_info.cell_list.num].value4 = (uint32)tmp_int;
+ if (at_tok_nextint(&line, &tmp_int) < 0)
+ {
+ LOG("cell tmp_int : %d", tmp_int);
+ goto EEMLTEINTER_EXIT;
+ }
+ cell_info.cell_list.cell[cell_info.cell_list.num].value5 = (uint32)tmp_int;
+ LOG("cell value5 : %d", cell_info.cell_list.cell[cell_info.cell_list.num].value5);
+ cell_info.cell_list.num++;
+EEMLTEINTER_EXIT:
+ free(free_ptr);
+ }
+ }
+ // Do nothing
+ else if(strStartsWith(s, "+EEMLTEINTERRAT:")) // LTE RATÐ¡ÇøÐÅÏ¢
+ {
+ if(cell_info.running) {
+
+ }
+ }
+ // WCDMA
+ /*
+ // Mode, sCMeasPresent, sCParamPresent, ueOpStatusPresent,
+
+ // if sCMeasPresent == 1
+ // cpichRSCP, utraRssi, cpichEcN0, sQual, sRxLev, txPower,
+ // endif
+
+ // if sCParamPresent == 1
+ // rac, nom, mcc, mnc_len, mnc, lac, ci,
+ // uraId, psc, arfcn, t3212, t3312, hcsUsed, attDetAllowed,
+ // csDrxCycleLen, psDrxCycleLen, utranDrxCycleLen, HSDPASupport, HSUPASupport,
+ // endif
+
+ // if ueOpStatusPresent == 1
+ // rrcState, numLinks, srncId, sRnti,
+ // algPresent, cipherAlg, cipherOn, algPresent, cipherAlg, cipherOn,
+ // HSDPAActive, HSUPAActive, MccLastRegisteredNetwork, MncLastRegisteredNetwork, TMSI, PTMSI, IsSingleMmRejectCause, IsSingleGmmRejectCause,
+ // MMRejectCause, GMMRejectCause, mmState, gmmState, gprsReadyState, readyTimerValueInSecs, NumActivePDPContext, ULThroughput, DLThroughput,
+ // serviceStatus, pmmState, LAU_status, LAU_count, RAU_status, RAU_count
+ // endif
+ //
+ +EEMUMTSSVC: 3, 1, 1, 1,
+ -80, 27, -6, -18, -115, -32768,
+ 1, 1, 1120, 2, 1, 61697, 168432821,
+ 15, 24, 10763, 0, 0, 0, 0,
+ 128, 128, 65535, 0, 0,
+ 2, 255, 65535, 4294967295,
+ 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 1, 1,
+ 28672, 28672, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0
+ */
+ else if(strStartsWith(s, "+EEMUMTSSVC:")) // WCDMA Server Cell
+ {
+ // lac, ci, arfcn
+ if(cell_info.running) {
+ int tmp_int;
+ int i = 0;
+ char* tmp_s = memdup(s,strlen(s));
+ char* free_ptr = tmp_s;
+ char *line = tmp_s;
+ if (at_tok_start(&line) < 0)
+ {
+ goto EEMUMTSSVC_EXIT;
+ }
+ // Jump 12 integer.
+ i = 0;
+ while(i < 12) {
+ if (at_tok_nextint(&line, &tmp_int) < 0)
+ {
+ goto EEMUMTSSVC_EXIT;
+ }
+ i++;
+ }
+ // mcc
+ if (at_tok_nextint(&line, &tmp_int) < 0)
+ {
+ goto EEMUMTSSVC_EXIT;
+ }
+ cell_info.cell_list.cell[cell_info.cell_list.num].value4= (uint32)tmp_int;
+ // mnc
+ if (at_tok_nextint(&line, &tmp_int) < 0)
+ {
+ goto EEMUMTSSVC_EXIT;
+ }
+ cell_info.cell_list.cell[cell_info.cell_list.num].value5= (uint32)tmp_int;
+ // lac
+ if (at_tok_nextint(&line, &tmp_int) < 0)
+ {
+ goto EEMUMTSSVC_EXIT;
+ }
+ cell_info.cell_list.cell[cell_info.cell_list.num].value1 = (uint32)tmp_int;
+ // ci
+ if (at_tok_nextint(&line, &tmp_int) < 0)
+ {
+ goto EEMUMTSSVC_EXIT;
+ }
+ cell_info.cell_list.cell[cell_info.cell_list.num].value2 = (uint32)tmp_int;
+
+ if (at_tok_nextint(&line, &tmp_int) < 0)
+ {
+ goto EEMUMTSSVC_EXIT;
+ }
+ // cpi
+ if (at_tok_nextint(&line, &tmp_int) < 0)
+ {
+ goto EEMUMTSSVC_EXIT;
+ }
+ cell_info.cell_list.cell[cell_info.cell_list.num].value6= (uint32)tmp_int;
+ /*
+ // Jump 2 integer.
+ i = 0;
+ while(i < 2) {
+ if (at_tok_nextint(&line, &tmp_int) < 0)
+ {
+ goto EEMUMTSSVC_EXIT;
+ }
+ i++;
+ }
+ */
+ // arfcn
+ if (at_tok_nextint(&line, &tmp_int) < 0)
+ {
+ goto EEMUMTSSVC_EXIT;
+ }
+ cell_info.cell_list.cell[cell_info.cell_list.num].value3 = (uint32)tmp_int;
+
+ cell_info.cell_list.num++;
+EEMUMTSSVC_EXIT:
+ free(free_ptr);
+ }
+ }
+ /*
+ // index, cpichRSCP, utraRssi, cpichEcN0, sQual, sRxLev ,mcc, mnc, lac, ci, arfcn, psc
+ +EEMUMTSINTRA: 0, -32768, -1, -32768, -18, -115, 0, 0, 65534, 1, 10763, 32
+ */
+ else if(strStartsWith(s, "+EEMUMTSINTRA:")) // WCDMAÁÙ½üÐ¡Çø
+ {
+ // lac, ci, arfcn
+ if(cell_info.running) {
+ int tmp_int;
+ int i = 0;
+ char* tmp_s = memdup(s,strlen(s));
+ char* free_ptr = tmp_s;
+ char *line = tmp_s;
+ if (at_tok_start(&line) < 0)
+ {
+ goto EEMUMTSINTRA_EXIT;
+ }
+ // Jump 8 integer.
+ i = 0;
+ while(i < 8) {
+ if (at_tok_nextint(&line, &tmp_int) < 0)
+ {
+ goto EEMUMTSINTRA_EXIT;
+ }
+ i++;
+ }
+
+ // lac
+ if (at_tok_nextint(&line, &tmp_int) < 0 || tmp_int <= 0 || tmp_int >= 65536)
+ {
+ goto EEMUMTSINTRA_EXIT;
+ }
+ cell_info.cell_list.cell[cell_info.cell_list.num].value1 = (uint32)tmp_int;
+
+ // ci
+ if (at_tok_nextint(&line, &tmp_int) < 0 || tmp_int <= 0 || tmp_int >= 65536)
+ {
+ goto EEMUMTSINTRA_EXIT;
+ }
+ cell_info.cell_list.cell[cell_info.cell_list.num].value2 = (uint32)tmp_int;
+
+ // arfcn
+ if (at_tok_nextint(&line, &tmp_int) < 0 || tmp_int <= 0 || tmp_int >= 65536)
+ {
+ goto EEMUMTSINTRA_EXIT;
+ }
+ cell_info.cell_list.cell[cell_info.cell_list.num].value3 = (uint32)tmp_int;
+
+ cell_info.cell_list.num++;
+EEMUMTSINTRA_EXIT:
+ free(free_ptr);
+ }
+ }
+ /*
+ // index,gsmRssi,rxLev,C1,C2,mcc,mnc,lac,ci,arfcn,bsic
+ +EEMUMTSINTERRAT: 0, -32768, -107, -1, -1, 0, 0, 65534, 0, 117, 36
+ */
+ else if(strStartsWith(s, "+EEMUMTSINTERRAT:")) // WCDMA RATÐ¡ÇøÐÅÏ¢
+ {
+ // lac, ci, arfcn
+ if(cell_info.running) {
+ int tmp_int;
+ int i = 0;
+ char* tmp_s = memdup(s,strlen(s));
+ char* free_ptr = tmp_s;
+ char *line = tmp_s;
+ if (at_tok_start(&line) < 0)
+ {
+ goto EEMUMTSINTERRAT_EXIT;
+ }
+ // Jump 7 integer.
+ i = 0;
+ while(i < 7) {
+ if (at_tok_nextint(&line, &tmp_int) < 0)
+ {
+ goto EEMUMTSINTERRAT_EXIT;
+ }
+ i++;
+ }
+
+ // lac
+ if (at_tok_nextint(&line, &tmp_int) < 0 || tmp_int <= 0 || tmp_int >= 65536)
+ {
+ goto EEMUMTSINTERRAT_EXIT;
+ }
+ cell_info.cell_list.cell[cell_info.cell_list.num].value1 = (uint32)tmp_int;
+
+ // ci
+ if (at_tok_nextint(&line, &tmp_int) < 0 || tmp_int <= 0 || tmp_int >= 65536)
+ {
+ goto EEMUMTSINTERRAT_EXIT;
+ }
+ cell_info.cell_list.cell[cell_info.cell_list.num].value2 = (uint32)tmp_int;
+
+ // arfcn
+ if (at_tok_nextint(&line, &tmp_int) < 0 || tmp_int <= 0 || tmp_int >= 65536)
+ {
+ goto EEMUMTSINTERRAT_EXIT;
+ }
+ cell_info.cell_list.cell[cell_info.cell_list.num].value3 = (uint32)tmp_int;
+
+ cell_info.cell_list.num++;
+EEMUMTSINTERRAT_EXIT:
+ free(free_ptr);
+ }
+ }
+ // GSM
+ // +EEMGINFOBASIC: 2
+ // Do nothing.
+ else if(strStartsWith(s, "+EEMGINFOBASIC:")) // Basic information in GSM
+ // 0: ME in Idle mode 1: ME in Dedicated mode 2: ME in PS PTM mode
+ {
+ if(cell_info.running) {
+
+ }
+ }
+ /*
+ // mcc, mnc_len, mnc, lac, ci, nom, nco,
+ // bsic, C1, C2, TA, TxPwr,
+ // RxSig, RxSigFull, RxSigSub, RxQualFull, RxQualSub,
+ // ARFCB_tch, hopping_chnl, chnl_type, TS, PacketIdle, rac, arfcn,
+ // bs_pa_mfrms, C31, C32, t3212, t3312, pbcch_support, EDGE_support,
+ // ncc_permitted, rl_timeout, ho_count, ho_succ, chnl_access_count, chnl_access_succ_count,
+ // gsmBand,channelMode
+ +EEMGINFOSVC: 1120, 2, 0, 32784, 24741, 2, 0,
+ 63, 36, 146, 1, 7,
+ 46, 42, 42, 7, 0,
+ 53, 0, 8, 0, 1, 6, 53,
+ 2, 0, 146, 42, 54, 0, 1,
+ 1, 32, 0, 0, 0, 0,
+ 0, 0
+ */
+ else if(strStartsWith(s, "+EEMGINFOSVC:")) // GSM Server Cell
+ {
+ // lac, ci, arfcn, bsic
+ LOG("+EEMGINFOSVC: 1= %d\n.",cell_info.running);
+ if(cell_info.running) {
+ int tmp_int;
+ int i = 0;
+ char* tmp_s = memdup(s,strlen(s));
+ char* free_ptr = tmp_s;
+ char *line = tmp_s;
+ if (at_tok_start(&line) < 0)
+ {
+ goto EEMGINFOSVC_EXIT;
+ }
+
+ // mcc
+ if (at_tok_nextint(&line, &tmp_int) < 0 || tmp_int <= 0 || tmp_int >= 65536)
+ {
+ goto EEMGINFOSVC_EXIT;
+ }
+ cell_info.cell_list.cell[cell_info.cell_list.num].value5 = (uint32)tmp_int;
+
+ //mnc_len
+ if (at_tok_nextint(&line, &tmp_int) < 0 || tmp_int <= 0 || tmp_int >= 65536)
+ {
+ goto EEMGINFOSVC_EXIT;
+ }
+ // mnc
+ if (at_tok_nextint(&line, &tmp_int) < 0 || tmp_int <= 0 || tmp_int >= 65536)
+ {
+ goto EEMGINFOSVC_EXIT;
+ }
+ cell_info.cell_list.cell[cell_info.cell_list.num].value6 = (uint32)tmp_int;
+
+ /*
+ // Jump 3 integer.
+ i = 0;
+ while(i < 3) {
+ if (at_tok_nextint(&line, &tmp_int) < 0)
+ {
+ goto EEMGINFOSVC_EXIT;
+ }
+ i++;
+ }
+ */
+ // lac
+ if (at_tok_nextint(&line, &tmp_int) < 0 || tmp_int < 0 || tmp_int >= 65536)
+ {
+ goto EEMGINFOSVC_EXIT;
+ }
+ cell_info.cell_list.cell[cell_info.cell_list.num].value1 = (uint32)tmp_int;
+
+ // ci
+ if (at_tok_nextint(&line, &tmp_int) < 0 || tmp_int < 0 || tmp_int >= 65536)
+ {
+ goto EEMGINFOSVC_EXIT;
+ }
+ cell_info.cell_list.cell[cell_info.cell_list.num].value2 = (uint32)tmp_int;
+
+ // Jump 2 integer.
+ i = 0;
+ while(i < 2) {
+ if (at_tok_nextint(&line, &tmp_int) < 0)
+ {
+ goto EEMGINFOSVC_EXIT;
+ }
+ i++;
+ }
+
+ // bsic
+ if (at_tok_nextint(&line, &tmp_int) < 0 || tmp_int < 0 || tmp_int >= 65536)
+ {
+ goto EEMGINFOSVC_EXIT;
+ }
+ cell_info.cell_list.cell[cell_info.cell_list.num].value4 = (uint32)tmp_int;
+
+ // Jump 15 integer.
+ i = 0;
+ while(i < 15) {
+ if (at_tok_nextint(&line, &tmp_int) < 0)
+ {
+ goto EEMGINFOSVC_EXIT;
+ }
+ i++;
+ }
+
+ // arfcn
+ if (at_tok_nextint(&line, &tmp_int) < 0 || tmp_int < 0 || tmp_int >= 65536)
+ {
+ goto EEMGINFOSVC_EXIT;
+ }
+ cell_info.cell_list.cell[cell_info.cell_list.num].value3 = (uint32)tmp_int;
+
+ cell_info.cell_list.num++;
+EEMGINFOSVC_EXIT:
+ free(free_ptr);
+ }
+ }
+ /*
+ // PS_attached, attach_type, service_type, tx_power, c_value,
+ // ul_ts, dl_ts, ul_cs, dl_cs, ul_modulation, dl_modulation,
+ // gmsk_cv_bep, 8psk_cv_bep, gmsk_mean_bep, 8psk_mean_bep, EDGE_bep_period, single_gmm_rej_cause
+ // pdp_active_num, mac_mode, network_control, network_mode, EDGE_slq_measurement_mode, edge_status
+ +EEMGINFOPS: 1, 255, 0, 0, 0,
+ 0, 0, 268435501, 1, 0, 0,
+ 4, 0, 96, 0, 0, 0,
+ 0, 0, 0, 65535, 0, 13350
+ */
+ // Do nothing.
+ else if(strStartsWith(s, "+EEMGINFOPS:")) // PSÐÅÏ¢
+ {
+ if(cell_info.running) {
+
+ }
+ }
+ else if(strStartsWith(s, "+EEMGINFONC:")) // cell
+ {
+ if(cell_info.running) {
+ int tmp_int;
+ int i = 0;
+ char* tmp_s = memdup(s,strlen(s));
+ char* free_ptr = tmp_s;
+ char *line = tmp_s;
+ if (at_tok_start(&line) < 0)
+ {
+ goto EEMGINFOPS_EXIT;
+ }
+
+ // nc_num
+ if (at_tok_nextint(&line, &tmp_int) < 0 || tmp_int < 0 || tmp_int >= 65536)
+ {
+ LOG("cell_info.running 1= %d\n.",cell_info.running);
+ goto EEMGINFOPS_EXIT;
+ }
+ // mcc
+ if (at_tok_nextint(&line, &tmp_int) < 0 || tmp_int < 0 || tmp_int >= 65536)
+ {
+ LOG("cell_info.running 2= %d\n.",cell_info.running);
+ goto EEMGINFOPS_EXIT;
+ }
+ cell_info.cell_list.cell[cell_info.cell_list.num].value5 = (uint32)tmp_int;
+
+ // mnc
+ if (at_tok_nextint(&line, &tmp_int) < 0 || tmp_int < 0 || tmp_int >= 65536)
+ {
+ LOG("cell_info.running 3= %d\n.",cell_info.running);
+ goto EEMGINFOPS_EXIT;
+ }
+ cell_info.cell_list.cell[cell_info.cell_list.num].value6 = (uint32)tmp_int;
+
+ // lac
+ if (at_tok_nextint(&line, &tmp_int) < 0 || tmp_int < 0 || tmp_int >= 65536)
+ {
+ LOG("cell_info.running 4= %d\n.",cell_info.running);
+ goto EEMGINFOPS_EXIT;
+ }
+ cell_info.cell_list.cell[cell_info.cell_list.num].value1 = (uint32)tmp_int;
+
+ // rac
+ if (at_tok_nextint(&line, &tmp_int) < 0 || tmp_int < 0 || tmp_int >= 65536)
+ {
+ LOG("cell_info.running 5= %d\n.",cell_info.running);
+ goto EEMGINFOPS_EXIT;
+ }
+
+ // ci
+ if (at_tok_nextint(&line, &tmp_int) < 0 || tmp_int < 0 || tmp_int >= 65536)
+ {
+ LOG("cell_info.running 6= %d\n.",cell_info.running);
+ goto EEMGINFOPS_EXIT;
+ }
+ cell_info.cell_list.cell[cell_info.cell_list.num].value2 = (uint32)tmp_int;
+
+ // rx_lv
+ if (at_tok_nextint(&line, &tmp_int) < 0)
+ {
+ LOG("cell_info.running 7= %d\n.",cell_info.running);
+ goto EEMGINFOPS_EXIT;
+ }
+
+ // bsic
+ if (at_tok_nextint(&line, &tmp_int) < 0 || tmp_int < 0 || tmp_int >= 65536)
+ {
+ LOG("cell_info.running 8= %d\n.",cell_info.running);
+ goto EEMGINFOPS_EXIT;
+ }
+ cell_info.cell_list.cell[cell_info.cell_list.num].value4 = (uint32)tmp_int;
+
+ // Jump 2 integer.
+ i = 0;
+ while(i < 2) {
+ if (at_tok_nextint(&line, &tmp_int) < 0)
+ {
+ LOG("cell_info.running 9= %d\n.",cell_info.running);
+ goto EEMGINFOPS_EXIT;
+ }
+ i++;
+ }
+
+ // arfcn
+ if (at_tok_nextint(&line, &tmp_int) < 0 || tmp_int < 0 || tmp_int >= 65536)
+ {
+ LOG("cell_info.running 10 = %d\n.",cell_info.running);
+ goto EEMGINFOPS_EXIT;
+ }
+ cell_info.cell_list.cell[cell_info.cell_list.num].value3 = (uint32)tmp_int;
+
+ cell_info.cell_list.num++;
+EEMGINFOPS_EXIT:
+ free(free_ptr);
+ }
+ } else {
+ LOGW("Unknown CELL URC : %s", s);
+ }
+}
+
static void onUnsolicited(const char *s, const char *sms_pdu)
{
LOGD("URC : %s", s);
-#if 0
// MBTK_AT_READY
if (strStartsWith(s, "MBTK_AT_READY")) // AT ready.
{
}
+#if 0
else if(strStartsWith(s, "*RADIOPOWER:")) // "*RADIOPOWER: 1"
{
const char* ptr = s + strlen("*RADIOPOWER:");
@@ -943,634 +1579,15 @@
free(free_ptr);
}
#endif
- /*
- // <mcc>, <length of mnc>, <mnc>, <tac>, <PCI>, <dlEuarfcn>, < ulEuarfcn >, <band>, <dlBandwidth>,
- // <rsrp>,<rsrq>, <sinr>,
- // errcModeState,emmState,serviceState,IsSingleEmmRejectCause,EMMRejectCause,mmeGroupId,mmeCode,mTmsi,
- // cellId,subFrameAssignType,specialSubframePatterns,transMode
- // mainRsrp,diversityRsrp,mainRsrq,diversityRsrq,rssi,cqi,pathLoss,tb0DlTpt,tb1DlTpt,tb0DlPeakTpt,tb1DlPeakTpt,tb0UlPeakTpt,
- // tb1UlPeakTpt,dlThroughPut,dlPeakThroughPut,averDlPRB,averCQITb0,averCQITb1,rankIndex,grantTotal,ulThroughPut,ulPeakThroughPut,currPuschTxPower,averUlPRB,
- // dlBer, ulBer,
- // diversitySinr, diversityRssi
- +EEMLTESVC: 1120, 2, 0, 33584, 430, 40936, 40936, 41, 20,
- 0, 0, 0,
- 1, 10, 0, 1, 0, 1059, 78, 3959566565,
- 105149248, 2, 7, 7,
- 0, 0, 0, 0, 0, 0, 0, 1190919, 0, 0, 0, 16779777,
- 0, 5112867, 3959566565, 2, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0,
- 7, 44
- */
- else if(strStartsWith(s, "+EEMLTESVC:")) // LTE Server Cell
- {
- // tac, PCI, dlEuarfcn, ulEuarfcn, band
- if(cell_info.running) {
- int tmp_int;
- int i = 0;
- char* tmp_s = memdup(s,strlen(s));
- char* free_ptr = tmp_s;
- char *line = tmp_s;
- if (at_tok_start(&line) < 0)
- {
- goto EEMLTESVC_EXIT;
- }
- if (at_tok_nextint(&line, &tmp_int) < 0)
- {
- goto EEMLTESVC_EXIT;
- }
- cell_info.cell[cell_info.cell_num].value6 = (uint32)tmp_int; //mcc
- if (at_tok_nextint(&line, &tmp_int) < 0)
- {
- goto EEMLTESVC_EXIT;
- }
- if (at_tok_nextint(&line, &tmp_int) < 0)
- {
- goto EEMLTESVC_EXIT;
- }
- cell_info.cell[cell_info.cell_num].value7 = (uint32)tmp_int; //mnc
- /*
- // Jump 2 integer.
- i = 0;
- while(i < 2) {
- if (at_tok_nextint(&line, &tmp_int) < 0)
- {
- goto EEMLTESVC_EXIT;
- }
- i++;
- }
- */
- if (at_tok_nextint(&line, &tmp_int) < 0)
- {
- goto EEMLTESVC_EXIT;
- }
- cell_info.cell[cell_info.cell_num].value1 = (uint32)tmp_int; //tac
- if (at_tok_nextint(&line, &tmp_int) < 0)
- {
- goto EEMLTESVC_EXIT;
- }
- cell_info.cell[cell_info.cell_num].value2 = (uint32)tmp_int; //pci
- if (at_tok_nextint(&line, &tmp_int) < 0)
- {
- goto EEMLTESVC_EXIT;
- }
- cell_info.cell[cell_info.cell_num].value3 = (uint32)tmp_int; //dl arfcn
- if (at_tok_nextint(&line, &tmp_int) < 0)
- {
- goto EEMLTESVC_EXIT;
- }
- cell_info.cell[cell_info.cell_num].value4 = (uint32)tmp_int; //ul arfcn
- if (at_tok_nextint(&line, &tmp_int) < 0)
- {
- goto EEMLTESVC_EXIT;
- }
- cell_info.cell[cell_info.cell_num].value5 = (uint32)tmp_int; //band
- if (at_tok_nextint(&line, &tmp_int) < 0)
- {
- goto EEMLTESVC_EXIT;
- }
- if (at_tok_nextint(&line, &tmp_int) < 0)
- {
- goto EEMLTESVC_EXIT;
- }
- cell_info.cell[cell_info.cell_num].value8 = (uint32)tmp_int; //cid
- if (at_tok_nextint(&line, &tmp_int) < 0)
- {
- goto EEMLTESVC_EXIT;
- }
- cell_info.cell[cell_info.cell_num].value9 = (uint32)tmp_int; //rsrp
-
- for(i =0; i < 10; i++)
- {
- if (at_tok_nextint(&line, &tmp_int) < 0)
- {
- goto EEMLTESVC_EXIT;
- }
- }
- cell_info.cell[cell_info.cell_num].value10 = (uint32)tmp_int; //cell identiy
-
- cell_info.cell_num++;
-
-EEMLTESVC_EXIT:
- free(free_ptr);
- }
- }
- /*
- // index,phyCellId,euArfcn,rsrp,rsrq
- +EEMLTEINTER: 0, 65535, 38950, 0, 0
- */
- else if(strStartsWith(s, "+EEMLTEINTER:") || strStartsWith(s, "+EEMLTEINTRA:")) // LTE ÒìÆµ/Í¬ÆµÐ¡Çø
- {
- // phyCellId,euArfcn,rsrp,rsrq
- if(cell_info.running) {
- int tmp_int;
- char* tmp_s = memdup(s,strlen(s));
- char* free_ptr = tmp_s;
- char *line = tmp_s;
- if (at_tok_start(&line) < 0)
- {
- goto EEMLTEINTER_EXIT;
- }
- if (at_tok_nextint(&line, &tmp_int) < 0)
- {
- goto EEMLTEINTER_EXIT;
- }
- if (at_tok_nextint(&line, &tmp_int) < 0 || tmp_int <= 0 || tmp_int > 503)
- {
- goto EEMLTEINTER_EXIT;
- }
- cell_info.cell[cell_info.cell_num].value1 = (uint32)tmp_int;
- if (at_tok_nextint(&line, &tmp_int) < 0)
- {
- goto EEMLTEINTER_EXIT;
- }
- cell_info.cell[cell_info.cell_num].value2 = (uint32)tmp_int;
- if (at_tok_nextint(&line, &tmp_int) < 0)
- {
- goto EEMLTEINTER_EXIT;
- }
- cell_info.cell[cell_info.cell_num].value3 = (uint32)tmp_int;
- LOG("cell line : %s", line);
- if (at_tok_nextint(&line, &tmp_int) < 0)
- {
- goto EEMLTEINTER_EXIT;
- }
- cell_info.cell[cell_info.cell_num].value4 = (uint32)tmp_int;
- if (at_tok_nextint(&line, &tmp_int) < 0)
- {
- LOG("cell tmp_int : %d", tmp_int);
- goto EEMLTEINTER_EXIT;
- }
- cell_info.cell[cell_info.cell_num].value5 = (uint32)tmp_int;
- LOG("cell value5 : %d", cell_info.cell[cell_info.cell_num].value5);
- cell_info.cell_num++;
-EEMLTEINTER_EXIT:
- free(free_ptr);
- }
- }
- // Do nothing
- else if(strStartsWith(s, "+EEMLTEINTERRAT:")) // LTE RATÐ¡ÇøÐÅÏ¢
- {
- if(cell_info.running) {
-
- }
- }
- // WCDMA
- /*
- // Mode, sCMeasPresent, sCParamPresent, ueOpStatusPresent,
-
- // if sCMeasPresent == 1
- // cpichRSCP, utraRssi, cpichEcN0, sQual, sRxLev, txPower,
- // endif
-
- // if sCParamPresent == 1
- // rac, nom, mcc, mnc_len, mnc, lac, ci,
- // uraId, psc, arfcn, t3212, t3312, hcsUsed, attDetAllowed,
- // csDrxCycleLen, psDrxCycleLen, utranDrxCycleLen, HSDPASupport, HSUPASupport,
- // endif
-
- // if ueOpStatusPresent == 1
- // rrcState, numLinks, srncId, sRnti,
- // algPresent, cipherAlg, cipherOn, algPresent, cipherAlg, cipherOn,
- // HSDPAActive, HSUPAActive, MccLastRegisteredNetwork, MncLastRegisteredNetwork, TMSI, PTMSI, IsSingleMmRejectCause, IsSingleGmmRejectCause,
- // MMRejectCause, GMMRejectCause, mmState, gmmState, gprsReadyState, readyTimerValueInSecs, NumActivePDPContext, ULThroughput, DLThroughput,
- // serviceStatus, pmmState, LAU_status, LAU_count, RAU_status, RAU_count
- // endif
- //
- +EEMUMTSSVC: 3, 1, 1, 1,
- -80, 27, -6, -18, -115, -32768,
- 1, 1, 1120, 2, 1, 61697, 168432821,
- 15, 24, 10763, 0, 0, 0, 0,
- 128, 128, 65535, 0, 0,
- 2, 255, 65535, 4294967295,
- 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 1, 1,
- 28672, 28672, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0
- */
- else if(strStartsWith(s, "+EEMUMTSSVC:")) // WCDMA Server Cell
- {
- // lac, ci, arfcn
- if(cell_info.running) {
- int tmp_int;
- int i = 0;
- char* tmp_s = memdup(s,strlen(s));
- char* free_ptr = tmp_s;
- char *line = tmp_s;
- if (at_tok_start(&line) < 0)
- {
- goto EEMUMTSSVC_EXIT;
- }
- // Jump 12 integer.
- i = 0;
- while(i < 12) {
- if (at_tok_nextint(&line, &tmp_int) < 0)
- {
- goto EEMUMTSSVC_EXIT;
- }
- i++;
- }
- // mcc
- if (at_tok_nextint(&line, &tmp_int) < 0)
- {
- goto EEMUMTSSVC_EXIT;
- }
- cell_info.cell[cell_info.cell_num].value4= (uint32)tmp_int;
- // mnc
- if (at_tok_nextint(&line, &tmp_int) < 0)
- {
- goto EEMUMTSSVC_EXIT;
- }
- cell_info.cell[cell_info.cell_num].value5= (uint32)tmp_int;
- // lac
- if (at_tok_nextint(&line, &tmp_int) < 0)
- {
- goto EEMUMTSSVC_EXIT;
- }
- cell_info.cell[cell_info.cell_num].value1 = (uint32)tmp_int;
- // ci
- if (at_tok_nextint(&line, &tmp_int) < 0)
- {
- goto EEMUMTSSVC_EXIT;
- }
- cell_info.cell[cell_info.cell_num].value2 = (uint32)tmp_int;
-
- if (at_tok_nextint(&line, &tmp_int) < 0)
- {
- goto EEMUMTSSVC_EXIT;
- }
- // cpi
- if (at_tok_nextint(&line, &tmp_int) < 0)
- {
- goto EEMUMTSSVC_EXIT;
- }
- cell_info.cell[cell_info.cell_num].value6= (uint32)tmp_int;
- /*
- // Jump 2 integer.
- i = 0;
- while(i < 2) {
- if (at_tok_nextint(&line, &tmp_int) < 0)
- {
- goto EEMUMTSSVC_EXIT;
- }
- i++;
- }
- */
- // arfcn
- if (at_tok_nextint(&line, &tmp_int) < 0)
- {
- goto EEMUMTSSVC_EXIT;
- }
- cell_info.cell[cell_info.cell_num].value3 = (uint32)tmp_int;
-
- cell_info.cell_num++;
-EEMUMTSSVC_EXIT:
- free(free_ptr);
- }
- }
- /*
- // index, cpichRSCP, utraRssi, cpichEcN0, sQual, sRxLev ,mcc, mnc, lac, ci, arfcn, psc
- +EEMUMTSINTRA: 0, -32768, -1, -32768, -18, -115, 0, 0, 65534, 1, 10763, 32
- */
- else if(strStartsWith(s, "+EEMUMTSINTRA:")) // WCDMAÁÙ½üÐ¡Çø
- {
- // lac, ci, arfcn
- if(cell_info.running) {
- int tmp_int;
- int i = 0;
- char* tmp_s = memdup(s,strlen(s));
- char* free_ptr = tmp_s;
- char *line = tmp_s;
- if (at_tok_start(&line) < 0)
- {
- goto EEMUMTSINTRA_EXIT;
- }
- // Jump 8 integer.
- i = 0;
- while(i < 8) {
- if (at_tok_nextint(&line, &tmp_int) < 0)
- {
- goto EEMUMTSINTRA_EXIT;
- }
- i++;
- }
-
- // lac
- if (at_tok_nextint(&line, &tmp_int) < 0 || tmp_int <= 0 || tmp_int >= 65536)
- {
- goto EEMUMTSINTRA_EXIT;
- }
- cell_info.cell[cell_info.cell_num].value1 = (uint32)tmp_int;
-
- // ci
- if (at_tok_nextint(&line, &tmp_int) < 0 || tmp_int <= 0 || tmp_int >= 65536)
- {
- goto EEMUMTSINTRA_EXIT;
- }
- cell_info.cell[cell_info.cell_num].value2 = (uint32)tmp_int;
-
- // arfcn
- if (at_tok_nextint(&line, &tmp_int) < 0 || tmp_int <= 0 || tmp_int >= 65536)
- {
- goto EEMUMTSINTRA_EXIT;
- }
- cell_info.cell[cell_info.cell_num].value3 = (uint32)tmp_int;
-
- cell_info.cell_num++;
-EEMUMTSINTRA_EXIT:
- free(free_ptr);
- }
- }
- /*
- // index,gsmRssi,rxLev,C1,C2,mcc,mnc,lac,ci,arfcn,bsic
- +EEMUMTSINTERRAT: 0, -32768, -107, -1, -1, 0, 0, 65534, 0, 117, 36
- */
- else if(strStartsWith(s, "+EEMUMTSINTERRAT:")) // WCDMA RATÐ¡ÇøÐÅÏ¢
- {
- // lac, ci, arfcn
- if(cell_info.running) {
- int tmp_int;
- int i = 0;
- char* tmp_s = memdup(s,strlen(s));
- char* free_ptr = tmp_s;
- char *line = tmp_s;
- if (at_tok_start(&line) < 0)
- {
- goto EEMUMTSINTERRAT_EXIT;
- }
- // Jump 7 integer.
- i = 0;
- while(i < 7) {
- if (at_tok_nextint(&line, &tmp_int) < 0)
- {
- goto EEMUMTSINTERRAT_EXIT;
- }
- i++;
- }
-
- // lac
- if (at_tok_nextint(&line, &tmp_int) < 0 || tmp_int <= 0 || tmp_int >= 65536)
- {
- goto EEMUMTSINTERRAT_EXIT;
- }
- cell_info.cell[cell_info.cell_num].value1 = (uint32)tmp_int;
-
- // ci
- if (at_tok_nextint(&line, &tmp_int) < 0 || tmp_int <= 0 || tmp_int >= 65536)
- {
- goto EEMUMTSINTERRAT_EXIT;
- }
- cell_info.cell[cell_info.cell_num].value2 = (uint32)tmp_int;
-
- // arfcn
- if (at_tok_nextint(&line, &tmp_int) < 0 || tmp_int <= 0 || tmp_int >= 65536)
- {
- goto EEMUMTSINTERRAT_EXIT;
- }
- cell_info.cell[cell_info.cell_num].value3 = (uint32)tmp_int;
-
- cell_info.cell_num++;
-EEMUMTSINTERRAT_EXIT:
- free(free_ptr);
- }
- }
- // GSM
- // +EEMGINFOBASIC: 2
- // Do nothing.
- else if(strStartsWith(s, "+EEMGINFOBASIC:")) // Basic information in GSM
- // 0: ME in Idle mode 1: ME in Dedicated mode 2: ME in PS PTM mode
- {
- if(cell_info.running) {
-
- }
- }
- /*
- // mcc, mnc_len, mnc, lac, ci, nom, nco,
- // bsic, C1, C2, TA, TxPwr,
- // RxSig, RxSigFull, RxSigSub, RxQualFull, RxQualSub,
- // ARFCB_tch, hopping_chnl, chnl_type, TS, PacketIdle, rac, arfcn,
- // bs_pa_mfrms, C31, C32, t3212, t3312, pbcch_support, EDGE_support,
- // ncc_permitted, rl_timeout, ho_count, ho_succ, chnl_access_count, chnl_access_succ_count,
- // gsmBand,channelMode
- +EEMGINFOSVC: 1120, 2, 0, 32784, 24741, 2, 0,
- 63, 36, 146, 1, 7,
- 46, 42, 42, 7, 0,
- 53, 0, 8, 0, 1, 6, 53,
- 2, 0, 146, 42, 54, 0, 1,
- 1, 32, 0, 0, 0, 0,
- 0, 0
- */
- else if(strStartsWith(s, "+EEMGINFOSVC:")) // GSM Server Cell
- {
- // lac, ci, arfcn, bsic
- LOG("+EEMGINFOSVC: 1= %d\n.",cell_info.running);
- if(cell_info.running) {
- int tmp_int;
- int i = 0;
- char* tmp_s = memdup(s,strlen(s));
- char* free_ptr = tmp_s;
- char *line = tmp_s;
- if (at_tok_start(&line) < 0)
- {
- goto EEMGINFOSVC_EXIT;
- }
-
- // mcc
- if (at_tok_nextint(&line, &tmp_int) < 0 || tmp_int <= 0 || tmp_int >= 65536)
- {
- goto EEMGINFOSVC_EXIT;
- }
- cell_info.cell[cell_info.cell_num].value5 = (uint32)tmp_int;
-
- //mnc_len
- if (at_tok_nextint(&line, &tmp_int) < 0 || tmp_int <= 0 || tmp_int >= 65536)
- {
- goto EEMGINFOSVC_EXIT;
- }
- // mnc
- if (at_tok_nextint(&line, &tmp_int) < 0 || tmp_int <= 0 || tmp_int >= 65536)
- {
- goto EEMGINFOSVC_EXIT;
- }
- cell_info.cell[cell_info.cell_num].value6 = (uint32)tmp_int;
-
- /*
- // Jump 3 integer.
- i = 0;
- while(i < 3) {
- if (at_tok_nextint(&line, &tmp_int) < 0)
- {
- goto EEMGINFOSVC_EXIT;
- }
- i++;
- }
- */
- // lac
- if (at_tok_nextint(&line, &tmp_int) < 0 || tmp_int < 0 || tmp_int >= 65536)
- {
- goto EEMGINFOSVC_EXIT;
- }
- cell_info.cell[cell_info.cell_num].value1 = (uint32)tmp_int;
-
- // ci
- if (at_tok_nextint(&line, &tmp_int) < 0 || tmp_int < 0 || tmp_int >= 65536)
- {
- goto EEMGINFOSVC_EXIT;
- }
- cell_info.cell[cell_info.cell_num].value2 = (uint32)tmp_int;
-
- // Jump 2 integer.
- i = 0;
- while(i < 2) {
- if (at_tok_nextint(&line, &tmp_int) < 0)
- {
- goto EEMGINFOSVC_EXIT;
- }
- i++;
- }
-
- // bsic
- if (at_tok_nextint(&line, &tmp_int) < 0 || tmp_int < 0 || tmp_int >= 65536)
- {
- goto EEMGINFOSVC_EXIT;
- }
- cell_info.cell[cell_info.cell_num].value4 = (uint32)tmp_int;
-
- // Jump 15 integer.
- i = 0;
- while(i < 15) {
- if (at_tok_nextint(&line, &tmp_int) < 0)
- {
- goto EEMGINFOSVC_EXIT;
- }
- i++;
- }
-
- // arfcn
- if (at_tok_nextint(&line, &tmp_int) < 0 || tmp_int < 0 || tmp_int >= 65536)
- {
- goto EEMGINFOSVC_EXIT;
- }
- cell_info.cell[cell_info.cell_num].value3 = (uint32)tmp_int;
-
- cell_info.cell_num++;
-EEMGINFOSVC_EXIT:
- free(free_ptr);
- }
- }
- /*
- // PS_attached, attach_type, service_type, tx_power, c_value,
- // ul_ts, dl_ts, ul_cs, dl_cs, ul_modulation, dl_modulation,
- // gmsk_cv_bep, 8psk_cv_bep, gmsk_mean_bep, 8psk_mean_bep, EDGE_bep_period, single_gmm_rej_cause
- // pdp_active_num, mac_mode, network_control, network_mode, EDGE_slq_measurement_mode, edge_status
- +EEMGINFOPS: 1, 255, 0, 0, 0,
- 0, 0, 268435501, 1, 0, 0,
- 4, 0, 96, 0, 0, 0,
- 0, 0, 0, 65535, 0, 13350
- */
- // Do nothing.
- else if(strStartsWith(s, "+EEMGINFOPS:")) // PSÐÅÏ¢
- {
- if(cell_info.running) {
-
- }
- }
- else if(strStartsWith(s, "+EEMGINFONC:")) // cell
- {
- if(cell_info.running) {
- int tmp_int;
- int i = 0;
- char* tmp_s = memdup(s,strlen(s));
- char* free_ptr = tmp_s;
- char *line = tmp_s;
- if (at_tok_start(&line) < 0)
- {
- goto EEMGINFOPS_EXIT;
- }
-
- // nc_num
- if (at_tok_nextint(&line, &tmp_int) < 0 || tmp_int < 0 || tmp_int >= 65536)
- {
- LOG("cell_info.running 1= %d\n.",cell_info.running);
- goto EEMGINFOPS_EXIT;
- }
- // mcc
- if (at_tok_nextint(&line, &tmp_int) < 0 || tmp_int < 0 || tmp_int >= 65536)
- {
- LOG("cell_info.running 2= %d\n.",cell_info.running);
- goto EEMGINFOPS_EXIT;
- }
- cell_info.cell[cell_info.cell_num].value5 = (uint32)tmp_int;
-
- // mnc
- if (at_tok_nextint(&line, &tmp_int) < 0 || tmp_int < 0 || tmp_int >= 65536)
- {
- LOG("cell_info.running 3= %d\n.",cell_info.running);
- goto EEMGINFOPS_EXIT;
- }
- cell_info.cell[cell_info.cell_num].value6 = (uint32)tmp_int;
-
- // lac
- if (at_tok_nextint(&line, &tmp_int) < 0 || tmp_int < 0 || tmp_int >= 65536)
- {
- LOG("cell_info.running 4= %d\n.",cell_info.running);
- goto EEMGINFOPS_EXIT;
- }
- cell_info.cell[cell_info.cell_num].value1 = (uint32)tmp_int;
-
- // rac
- if (at_tok_nextint(&line, &tmp_int) < 0 || tmp_int < 0 || tmp_int >= 65536)
- {
- LOG("cell_info.running 5= %d\n.",cell_info.running);
- goto EEMGINFOPS_EXIT;
- }
-
- // ci
- if (at_tok_nextint(&line, &tmp_int) < 0 || tmp_int < 0 || tmp_int >= 65536)
- {
- LOG("cell_info.running 6= %d\n.",cell_info.running);
- goto EEMGINFOPS_EXIT;
- }
- cell_info.cell[cell_info.cell_num].value2 = (uint32)tmp_int;
-
- // rx_lv
- if (at_tok_nextint(&line, &tmp_int) < 0)
- {
- LOG("cell_info.running 7= %d\n.",cell_info.running);
- goto EEMGINFOPS_EXIT;
- }
-
- // bsic
- if (at_tok_nextint(&line, &tmp_int) < 0 || tmp_int < 0 || tmp_int >= 65536)
- {
- LOG("cell_info.running 8= %d\n.",cell_info.running);
- goto EEMGINFOPS_EXIT;
- }
- cell_info.cell[cell_info.cell_num].value4 = (uint32)tmp_int;
-
- // Jump 2 integer.
- i = 0;
- while(i < 2) {
- if (at_tok_nextint(&line, &tmp_int) < 0)
- {
- LOG("cell_info.running 9= %d\n.",cell_info.running);
- goto EEMGINFOPS_EXIT;
- }
- i++;
- }
-
- // arfcn
- if (at_tok_nextint(&line, &tmp_int) < 0 || tmp_int < 0 || tmp_int >= 65536)
- {
- LOG("cell_info.running 10 = %d\n.",cell_info.running);
- goto EEMGINFOPS_EXIT;
- }
- cell_info.cell[cell_info.cell_num].value3 = (uint32)tmp_int;
-
- cell_info.cell_num++;
-EEMGINFOPS_EXIT:
- free(free_ptr);
- }
+#endif
+ else if(strStartsWith(s, "+EEMLTESVC:") || strStartsWith(s, "+EEMLTEINTER:")
+ || strStartsWith(s, "+EEMLTEINTRA:") || strStartsWith(s, "+EEMLTEINTERRAT:")
+ || strStartsWith(s, "+EEMUMTSSVC:") || strStartsWith(s, "+EEMUMTSINTRA:")
+ || strStartsWith(s, "+EEMUMTSINTERRAT:") || strStartsWith(s, "+EEMGINFOBASIC:")
+ || strStartsWith(s, "+EEMGINFOSVC:") || strStartsWith(s, "+EEMGINFOPS:")
+ || strStartsWith(s, "+EEMGINFONC:")) {
+ urc_cell_process(s, sms_pdu);
}
else if(strStartsWith(s, "+ZGIPDNS:")) // +ZGIPDNS: 1,"IPV4V6","10.156.239.245","10.156.239.246","223.87.253.100","223.87.253.253","fe80:0000:0000:0000:0001:0001:9b8c:7c0c","fe80::1:1:9b8c:7c0d","2409:8062:2000:2::1","2409:8062:2000:2::2"
{
@@ -1580,7 +1597,6 @@
{
LOGV("Unknown URC : %s", s);
}
-#endif
}
static int openSocket(const char* sockname)
@@ -1626,7 +1642,7 @@
if(ril_info.sim_state == MBTK_SIM_STATE_READY)
{
LOGD("SIM READY!");
- at_send_command("AT+COPS=3", NULL);
+ at_send_command("AT+COPS=3", NULL);
// Set APN from prop.
apn_auto_conf_from_prop();
diff --git a/mbtk/mbtk_rild_v2/src/ril_net.c b/mbtk/mbtk_rild_v2/src/ril_net.c
index 3f02965..6e0cd8c 100755
--- a/mbtk/mbtk_rild_v2/src/ril_net.c
+++ b/mbtk/mbtk_rild_v2/src/ril_net.c
@@ -20,6 +20,8 @@
#include "ril_info.h"
#include "mbtk_str.h"
+mbtk_cell_pack_info_t cell_info;
+
extern ril_band_info_t band_info;
void ril_rsp_pack_send(int fd, int ril_id, int msg_index, const void* data, int data_len);
static int req_apn_get(mbtk_apn_info_array_t *apns, int *cme_err);
@@ -1125,6 +1127,354 @@
}
/*
+AT+EEMOPT=1
+OK
+
+// LTE
+AT+EEMGINFO?
+// <mcc>, <length of mnc>, <mnc>, <tac>, <PCI>, <dlEuarfcn>, < ulEuarfcn >, <band>, <dlBandwidth>,
+// <rsrp>,<rsrq>, <sinr>,
+// errcModeState,emmState,serviceState,IsSingleEmmRejectCause,EMMRejectCause,mmeGroupId,mmeCode,mTmsi,
+// cellId,subFrameAssignType,specialSubframePatterns,transMode
+// mainRsrp,diversityRsrp,mainRsrq,diversityRsrq,rssi,cqi,pathLoss,tb0DlTpt,tb1DlTpt,tb0DlPeakTpt,tb1DlPeakTpt,tb0UlPeakTpt,
+// tb1UlPeakTpt,dlThroughPut,dlPeakThroughPut,averDlPRB,averCQITb0,averCQITb1,rankIndex,grantTotal,ulThroughPut,ulPeakThroughPut,currPuschTxPower,averUlPRB,
+// dlBer, ulBer,
+// diversitySinr, diversityRssi
++EEMLTESVC: 1120, 2, 0, 33584, 430, 40936, 40936, 41, 20,
+0, 0, 0,
+1, 10, 0, 1, 0, 1059, 78, 3959566565,
+105149248, 2, 7, 7,
+0, 0, 0, 0, 0, 0, 0, 1190919, 0, 0, 0, 16779777,
+0, 5112867, 3959566565, 2, 0, 0, 0, 0, 0, 0, 0, 0,
+0, 0,
+7, 44
+
+// index,phyCellId,euArfcn,rsrp,rsrq
++EEMLTEINTER: 0, 65535, 38950, 0, 0
+
++EEMLTEINTER: 1, 0, 0, 0, 0
+
++EEMLTEINTER: 2, 0, 4294967295, 255, 255
+
++EEMLTEINTER: 3, 65535, 1300, 0, 0
+
++EEMLTEINTER: 4, 0, 0, 0, 0
+
++EEMLTEINTER: 5, 0, 4294967295, 247, 0
+
++EEMLTEINTER: 6, 197, 41332, 24, 9
+
++EEMLTEINTER: 7, 0, 0, 0, 0
+
++EEMLTEINTER: 8, 0, 0, 0, 0
+
++EEMLTEINTRA: 0, 429, 40936, 56, 12
+
++EEMLTEINTERRAT: 0,0
+
++EEMLTEINTERRAT: 1,0
+
++EEMGINFO: 3, 2 // <state>:
+ // 0: ME in Idle mode
+ // 1: ME in Dedicated mode
+ // 2: ME in PS PTM mode
+ // 3: invalid state
+ // <nw_type>:
+ // 0: GSM 1: UMTS 2: LTE
+
+OK
+
+// WCDMA
+AT+EEMGINFO?
+// Mode, sCMeasPresent, sCParamPresent, ueOpStatusPresent,
+
+// if sCMeasPresent == 1
+// cpichRSCP, utraRssi, cpichEcN0, sQual, sRxLev, txPower,
+// endif
+
+// if sCParamPresent == 1
+// rac, nom, mcc, mnc_len, mnc, lac, ci,
+// uraId, psc, arfcn, t3212, t3312, hcsUsed, attDetAllowed,
+// csDrxCycleLen, psDrxCycleLen, utranDrxCycleLen, HSDPASupport, HSUPASupport,
+// endif
+
+// if ueOpStatusPresent == 1
+// rrcState, numLinks, srncId, sRnti,
+// algPresent, cipherAlg, cipherOn, algPresent, cipherAlg, cipherOn,
+// HSDPAActive, HSUPAActive, MccLastRegisteredNetwork, MncLastRegisteredNetwork, TMSI, PTMSI, IsSingleMmRejectCause, IsSingleGmmRejectCause,
+// MMRejectCause, GMMRejectCause, mmState, gmmState, gprsReadyState, readyTimerValueInSecs, NumActivePDPContext, ULThroughput, DLThroughput,
+// serviceStatus, pmmState, LAU_status, LAU_count, RAU_status, RAU_count
+// endif
+//
++EEMUMTSSVC: 3, 1, 1, 1,
+-80, 27, -6, -18, -115, -32768,
+1, 1, 1120, 2, 1, 61697, 168432821,
+15, 24, 10763, 0, 0, 0, 0,
+128, 128, 65535, 0, 0,
+2, 255, 65535, 4294967295,
+0, 0, 0, 0, 0, 0,
+0, 0, 0, 0, 0, 0, 1, 1,
+28672, 28672, 0, 0, 0, 0, 0, 0, 0,
+0, 0, 0, 0, 0, 0
+
+// index, cpichRSCP, utraRssi, cpichEcN0, sQual, sRxLev ,mcc, mnc, lac, ci, arfcn, psc
++EEMUMTSINTRA: 0, -32768, -1, -32768, -18, -115, 0, 0, 65534, 1, 10763, 32
+
++EEMUMTSINTRA: 1, -1, -32768, -18, -115, 0, 0, 65534, 2, 10763, 40, 32768
+
++EEMUMTSINTRA: 2, -32768, -18, -115, 0, 0, 65534, 3, 10763, 278, 32768, 65535
+
++EEMUMTSINTRA: 3, -18, -115, 0, 0, -2, 4, 10763, 28, 32768, 65535, 32768
+
++EEMUMTSINTRA: 4, -115, 0, 0, -2, 5, 10763, 270, 32768, 65535, 32768, 65518
+
++EEMUMTSINTRA: 5, 0, 0, -2, 6, 10763, 286, 32768, 65535, 32768, 65518, 65421
+
++EEMUMTSINTRA: 6, 0, -2, 7, 10763, 80, 32768, 65535, 32768, 65518, 65421, 0
+
++EEMUMTSINTRA: 7, -2, 8, 10763, 206, -32768, 65535, 32768, 65518, 65421, 0, 0
+
++EEMUMTSINTRA: 8, 9, 10763, 11, -32768, -1, 32768, 65518, 65421, 0, 0, 65534
+
++EEMUMTSINTRA: 9, 10763, 19, -32768, -1, -32768, 65518, 65421, 0, 0, 65534, 11
+
++EEMUMTSINTRA: 10, 232, -32768, -1, -32768, -18, 65421, 0, 0, 65534, 12, 10763
+
++EEMUMTSINTRA: 11, -32768, -1, -32768, -18, -115, 0, 0, 65534, 13, 10763, 66
+
++EEMUMTSINTRA: 12, -1, -32768, -18, -115, 0, 0, 65534, 14, 10763, 216, 32768
+
++EEMUMTSINTRA: 13, -32768, -18, -115, 0, 0, 65534, 15, 10763, 183, 32768, 65535
+
++EEMUMTSINTRA: 14, -18, -115, 0, 0, -2, 16, 10763, 165, 32768, 65535, 32768
+
++EEMUMTSINTRA: 15, -115, 0, 0, -2, 17, 10763, 151, 32768, 65535, 32768, 65518
+
++EEMUMTSINTRA: 16, 0, 0, -2, 18, 10763, 43, 32768, 65535, 32768, 65518, 65421
+
++EEMUMTSINTRA: 17, 0, -2, 19, 10763, 72, 32768, 65535, 32768, 65518, 65421, 0
+
++EEMUMTSINTRA: 18, -2, 20, 10763, 157, -32768, 65535, 32768, 65518, 65421, 0, 0
+
++EEMUMTSINTRA: 19, 21, 10763, 165, -32768, -1, 32768, 65518, 65421, 0, 0, 65534
+
++EEMUMTSINTRA: 20, 10763, 301, -32768, -1, -32768, 65518, 65421, 0, 0, 65534, 23
+
++EEMUMTSINTRA: 21, 23, -32768, -1, -32768, -18, 65421, 0, 0, 65534, 24, 10763
+
++EEMUMTSINTRA: 22, -32768, -1, -32768, -18, -115, 0, 0, 65534, 25, 10763, 0
+
++EEMUMTSINTRA: 23, -1, -32768, -18, -115, 0, 0, 65534, 26, 10763, 167, 32768
+
++EEMUMTSINTRA: 24, -32768, -18, -115, 0, 0, 65534, 27, 10763, 34, 32768, 65535
+
++EEMUMTSINTRA: 25, -18, -115, 0, 0, -2, 28, 10763, 313, 32768, 65535, 32768
+
++EEMUMTSINTRA: 26, -115, 0, 0, -2, 29, 10763, 152, 32768, 65535, 32768, 65518
+
++EEMUMTSINTRA: 27, 0, 0, -2, 30, 10763, 239, 0, 0, 0, 0, 0
+
++EEMUMTSINTRA: 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+
++EEMUMTSINTRA: 29, 0, 0, 0, 0, -115, 0, 0, 65534, 30, 10763, 239
+
+// index,gsmRssi,rxLev,C1,C2,mcc,mnc,lac,ci,arfcn,bsic
++EEMUMTSINTERRAT: 0, -32768, -107, -1, -1, 0, 0, 65534, 0, 117, 36
+
++EEMUMTSINTERRAT: 1, -107, -1, -1, 0, 0, 65534, 1, 72, 49, 0
+
++EEMUMTSINTERRAT: 2, -1, -1, 0, 0, 65534, 2, 119, 15, 32768, 149
+
++EEMUMTSINTERRAT: 3, -1, 0, 0, -2, 3, 121, 23, 0, 0, 0
+
++EEMGINFO: 3, 1
+
+OK
+
+
+// GSM
+AT+EEMGINFO?
++EEMGINFOBASIC: 2
+
+// mcc, mnc_len, mnc, lac, ci, nom, nco,
+// bsic, C1, C2, TA, TxPwr,
+// RxSig, RxSigFull, RxSigSub, RxQualFull, RxQualSub,
+// ARFCB_tch, hopping_chnl, chnl_type, TS, PacketIdle, rac, arfcn,
+// bs_pa_mfrms, C31, C32, t3212, t3312, pbcch_support, EDGE_support,
+// ncc_permitted, rl_timeout, ho_count, ho_succ, chnl_access_count, chnl_access_succ_count,
+// gsmBand,channelMode
++EEMGINFOSVC: 1120, 2, 0, 32784, 24741, 2, 0,
+63, 36, 146, 1, 7,
+46, 42, 42, 7, 0,
+53, 0, 8, 0, 1, 6, 53,
+2, 0, 146, 42, 54, 0, 1,
+1, 32, 0, 0, 0, 0,
+0, 0
+
+// PS_attached, attach_type, service_type, tx_power, c_value,
+// ul_ts, dl_ts, ul_cs, dl_cs, ul_modulation, dl_modulation,
+// gmsk_cv_bep, 8psk_cv_bep, gmsk_mean_bep, 8psk_mean_bep, EDGE_bep_period, single_gmm_rej_cause
+// pdp_active_num, mac_mode, network_control, network_mode, EDGE_slq_measurement_mode, edge_status
++EEMGINFOPS: 1, 255, 0, 0, 0,
+0, 0, 268435501, 1, 0, 0,
+4, 0, 96, 0, 0, 0,
+0, 0, 0, 65535, 0, 13350
+
++EEMGINFO: 0, 0
+
+OK
+
+*/
+static int req_cell_info_get(int *cme_err)
+{
+ ATResponse *response = NULL;
+ int tmp_int;
+ int buff_size = 0;
+ // AT+EEMOPT=1 in the first.
+ int err = at_send_command("AT+EEMOPT=1", &response);
+ if (err < 0 || response->success == 0){
+ *cme_err = at_get_cme_error(response);
+ goto exit;
+ }
+
+ // Reset buffer in the first.
+ memset(&cell_info, 0xFF, sizeof(mbtK_cell_pack_info_t));
+ cell_info.running = true;
+ cell_info.cell_list.num = 0;
+
+ err = at_send_command_singleline("AT+EEMGINFO?", "+EEMGINFO:", &response);
+ if (err < 0 || response->success == 0 || !response->p_intermediates){
+ *cme_err = at_get_cme_error(response);
+ goto exit;
+ }
+
+ // Now, cell infomation has get from URC message.
+
+ char *line = response->p_intermediates->line;
+ err = at_tok_start(&line);
+ if (err < 0)
+ {
+ goto exit;
+ }
+ err = at_tok_nextint(&line, &tmp_int);
+ if (err < 0)
+ {
+ goto exit;
+ }
+ err = at_tok_nextint(&line, &tmp_int);
+ if (err < 0)
+ {
+ goto exit;
+ }
+
+ cell_info.cell_list.type = (uint8)tmp_int;
+ cell_info.running = false;
+
+#if 0
+ while(lines_ptr)
+ {
+ // LTE
+ if(strStartsWith(line, "+EEMLTESVC:")) // LTE Server Cell
+ {
+
+ }
+ else if(strStartsWith(line, "+EEMLTEINTER:")) // LTE
+ {
+
+ }
+ else if(strStartsWith(line, "+EEMLTEINTRA:")) // LTE
+ {
+
+ }
+ else if(strStartsWith(line, "+EEMLTEINTERRAT:")) // LTE
+ {
+
+ }
+ else if(strStartsWith(line, "+EEMGINFO:")) // <state>: 0: ME in Idle mode 1: ME in Dedicated mode 2: ME in PS PTM mode 3: invalid state
+ // <nw_type>: 0: GSM 1: UMTS 2: LTE
+ {
+
+ }
+ // WCDMA
+ else if(strStartsWith(line, "+EEMUMTSSVC:")) // WCDMA Server Cell
+ {
+
+ }
+ else if(strStartsWith(line, "+EEMUMTSINTRA:")) // WCDMA
+ {
+
+ }
+ else if(strStartsWith(line, "+EEMUMTSINTERRAT:")) // WCDMA
+ {
+
+ }
+ // GSM
+ else if(strStartsWith(line, "+EEMGINFOBASIC:")) // Basic information in GSM
+ // 0: ME in Idle mode 1: ME in Dedicated mode 2: ME in PS PTM mode
+ {
+
+ }
+ else if(strStartsWith(line, "+EEMGINFOSVC:")) // GSM Server Cell
+ {
+
+ }
+ else if(strStartsWith(line, "+EEMGINFOPS:")) // PS
+ {
+
+ }
+
+
+ lines_ptr = lines_ptr->p_next;
+ }
+#endif
+
+exit:
+ at_response_free(response);
+ return buff_size;
+}
+
+static int req_cell_info_set(const char *cmgl, char *reg, int len, int *cme_err)
+{
+ ATResponse *response = NULL;
+ char cmd[30] = {0};
+ char data[218] = {0};
+ int err = 0;
+
+ memcpy(data, cmgl, len);
+
+ sprintf(cmd, "AT*CELL=%s", data);
+
+ if(strlen(cmd) > 0)
+ {
+ err = at_send_command_multiline(cmd, "", &response);
+ if (err < 0 || response->success == 0 || !response->p_intermediates){
+ *cme_err = at_get_cme_error(response);
+ goto exit;
+ }
+
+ ATLine* lines_ptr = response->p_intermediates;
+ char *line = NULL;
+ int reg_len = 0;
+ bool flag = false;
+ while(lines_ptr)
+ {
+ line = lines_ptr->line;
+ if(line ==NULL)
+ {
+ LOGD("line is null----------------------");
+ }
+ lines_ptr = lines_ptr->p_next;
+ }
+ }
+ err = 0;
+ memcpy(reg, "req_cell_info_set succss", strlen("req_cell_info_set succss"));
+exit:
+ at_response_free(response);
+ return err;
+}
+
+
+/*
AT+CGDCONT?
+CGDCONT: 1,"IPV4V6","ctnet","10.142.64.116 254.128.0.0.0.0.0.0.0.0.0.0.0.0.0.1",0,0,0,2,0,0
@@ -1696,28 +2046,40 @@
}
case RIL_MSG_ID_NET_CELL:
{
- if(pack->data_len == 0 || pack->data == NULL)
+ if(pack->data_len == 0 || pack->data == NULL) // Get net cell.
{
- mbtk_net_info_array_t net_array;
- memset(&net_array, 0, sizeof(mbtk_net_info_array_t));
- if(req_available_net_get(&net_array, &cme_err) || cme_err != MBTK_RIL_ERR_CME_NON)
+ if(req_cell_info_get(&cme_err) || cme_err != MBTK_RIL_ERR_CME_NON)
{
if(cme_err != MBTK_RIL_ERR_CME_NON) {
err = MBTK_RIL_ERR_CME + cme_err;
} else {
err = MBTK_RIL_ERR_UNKNOWN;
}
- LOGD("Get Available Net fail.");
+ LOG("Get net cell fail.");
}
else
{
- ril_rsp_pack_send(cli_info->fd, pack->msg_id, pack->msg_index, &net_array, sizeof(mbtk_net_info_array_t));
+ LOG("req_cell_info_get() success,cell number: %d", cell_info.cell_list.num);
+ ril_rsp_pack_send(cli_info->fd, pack->msg_id, pack->msg_index, &cell_info.cell_list, sizeof(mbtk_cell_info_array_t));
}
}
- else // Set
+ else // Lock cell
{
- err = MBTK_RIL_ERR_UNSUPPORTED;
- LOGW("Unsupport set available net.");
+ char *mem = (char*)(pack->data);
+ int len = pack->data_len;
+ char reg[100] = {0};
+ if(req_cell_info_set(mem, reg, len, &cme_err) || cme_err != MBTK_RIL_ERR_CME_NON)
+ {
+ if(cme_err != MBTK_RIL_ERR_CME_NON) {
+ err = MBTK_RIL_ERR_CME + cme_err;
+ } else {
+ err = MBTK_RIL_ERR_UNKNOWN;
+ }
+ }
+ else
+ {
+ ril_rsp_pack_send(cli_info->fd, pack->msg_id, pack->msg_index, reg, strlen(reg));
+ }
}
break;
}