Add RIL 5G support.
Change-Id: I06020103aad9a5f1975b49fbe494cbecbfac4b7f
diff --git a/mbtk/include/mbtk/mbtk_device.h b/mbtk/include/mbtk/mbtk_device.h
index 9ea8c0b..1e026b2 100755
--- a/mbtk/include/mbtk/mbtk_device.h
+++ b/mbtk/include/mbtk/mbtk_device.h
@@ -43,6 +43,11 @@
#define MBTK_DEVICE_INFO_ITEM_STR_MODEM "MODEM"
#define MBTK_DEVICE_INFO_ITEM_STR_LOG "LOG"
+#define MBTK_NET_SUPPORT_2G (1)
+#define MBTK_NET_SUPPORT_3G (1<<1)
+#define MBTK_NET_SUPPORT_4G (1<<2)
+#define MBTK_NET_SUPPORT_5G (1<<3)
+
typedef enum {
MBTK_DEVICE_INFO_ITEM_BASIC = 0,
MBTK_DEVICE_INFO_ITEM_FOTA,
@@ -65,7 +70,7 @@
} mbtk_device_info_header_t;
typedef enum {
- MBTK_REBOOT_FLAG_NORMAL = 0,
+ MBTK_REBOOT_FLAG_NORMAL = 0,
MBTK_REBOOT_FLAG_DOWNLOAD,
MBTK_REBOOT_FLAG_POWER_OFF, //Power off and restart
MBTK_REBOOT_FLAG_HARDWARE, //Hardware restart
diff --git a/mbtk/include/mbtk/mbtk_ril_api.h b/mbtk/include/mbtk/mbtk_ril_api.h
index 43505b8..bf5523d 100755
--- a/mbtk/include/mbtk/mbtk_ril_api.h
+++ b/mbtk/include/mbtk/mbtk_ril_api.h
@@ -135,7 +135,15 @@
MBTK_RADIO_TECH_UTRAN_HSUPA,
MBTK_RADIO_TECH_UTRAN_HSDPA_HSUPA,
MBTK_RADIO_TECH_E_UTRAN, // LTE
- MBTK_RADIO_TECH_UTRAN_HSPA,
+ MBTK_RADIO_TECH_UTRAN_HSPA, // EC-GSM-IoT
+
+ MBTK_RADIO_TECH_EUTRAN_PLUS, // NB-IoT(NB-S1 mode)
+ MBTK_RADIO_TECH_UTRAN_DC_HSPA,
+ MBTK_RADIO_TECH_EUTRAN_TO_5GCN = 10, // E-UTRAN connected to a 5GCN (NSA)
+ MBTK_RADIO_TECH_NR_TO_5GCN, // NR connected to a 5GCN (SA)
+ MBTK_RADIO_TECH_NGRAN, // NG-RAN (NSA+SA)
+ MBTK_RADIO_TECH_EUTRAN_NR_DUAL_LINK, // dual connectivity of E-UTRA with NR and is connected to an EPS core.
+
MBTK_RADIO_TECH_UNKNOWN = 0xFF
} mbtk_radio_technology_enum;
@@ -338,19 +346,18 @@
uint32 tdlte_band; // mbtk_tdlte_band_enum
uint32 fddlte_band; // mbtk_fddlte_band_enum
uint32 lte_ext_band; // mbtk_lte_ext_band_enum
-#ifdef MBTK_DEV_INFO_VERSION_2
uint32 nr_3_band;
uint32 nr_2_band;
uint32 nr_1_band;
uint32 nr_0_band;
-#endif
} __attribute__((packed)) mbtk_band_info_t;
typedef enum
{
MBTK_CELL_TYPE_GSM = 0,
MBTK_CELL_TYPE_UMTS,
- MBTK_CELL_TYPE_LTE
+ MBTK_CELL_TYPE_LTE,
+ MBTK_CELL_TYPE_NR
} mbtk_cell_type_enum;
typedef struct {
@@ -426,6 +433,28 @@
// 96: -45 dBm �� rsrp < -44 dBm
// 97: -44 dBm �� rsrp
// 255: not known or not detectable
+ uint8 ss_rsrq; // 0: ss_rsrq < -43 dB
+ // 1: -43 dB <= ss_rsrq < -42.5 dB
+ // 2: -42.5 dB <= ss_rsrq < -42 dB
+ // ......
+ // 125: 19 dB <= ss_rsrq < 19.5 dB
+ // 126: 19.5 dB <= ss_rsrq < 20 dB
+ // 255: not known or not detectable
+ uint8 ss_rsrp; // 0: ss_rsrp < -156 dBm
+ // 1: -156 dBm <= ss_rsrp < -155 dBm
+ // 2: -155 dBm <= ss_rsrp < -154 dBm
+ // ......
+ // 125: -32 dBm <= ss_rsrp < -31 dBm
+ // 126: -31 dBm <= ss_rsrp
+ // 255: not known or not detectable
+ uint8 ss_sinr; // 0: ss_sinr < -23 dB
+ // 1: -23 dB ss_sinr < -22.5 dB
+ // 2: -22.5 dB ss_sinr < -22 dB
+ // ......
+ // 125: 39 dB ss_sinr < 39.5 dBm
+ // 126: 39.5 dB ss_sinr < 40 dB
+ // 127: 40 dB ss_sinr
+ // 255: not known or not detectable
} __attribute__((packed)) mbtk_signal_info_t;
@@ -471,8 +500,8 @@
mbtk_net_reg_state_enum data_state : 8;// mbtk_net_reg_state_enum
mbtk_net_reg_state_enum ims_state : 8;// mbtk_net_reg_state_enum
mbtk_radio_technology_enum type : 8; // mbtk_radio_technology_enum
- uint16 lac;
- uint32 ci;
+ uint32 lac;
+ uint64 ci;
} __attribute__((packed)) mbtk_net_reg_info_t;
typedef enum {
@@ -566,23 +595,35 @@
typedef struct
{
+ // NR server cell:
+ // NR cell:
// LTE server cell: tac, PCI, dlEuarfcn, ulEuarfcn, band
// LTE cell: phyCellId,euArfcn,rsrp,rsrq
// WCDMA server cell: lac, ci, arfcn
// WCDMA cell: lac, ci, arfcn
// GSM server cell: lac, ci, arfcn, bsic
// GSM cell:
- mbtk_cell_type_enum type : 8;
+ mbtk_cell_type_enum type:8;
uint32 value1;
uint32 value2;
uint32 value3;
uint32 value4;
uint32 value5;
- uint32 value6;
+ uint32 value6;
uint32 value7;
uint32 value8;
uint32 value9;
uint32 value10;
+ uint32 value11;
+ uint32 value12;
+ uint32 value13;
+ uint32 value14;
+ uint32 value15;
+ uint64 value64_1;
+ uint64 value64_2;
+ uint64 value64_3;
+ uint64 value64_4;
+ uint64 value64_5;
} __attribute__((packed)) mbtk_cell_info_t;
typedef struct {
@@ -654,6 +695,7 @@
MBTK_NET_REG_TYPE_CALL, // +CREG
MBTK_NET_REG_TYPE_DATA_GSM_WCDMA, // +CGREG
MBTK_NET_REG_TYPE_DATA_LTE, // +CEREG
+ MBTK_NET_REG_TYPE_DATA_NR, // +C5GREG
MBTK_NET_REG_TYPE_IMS
} mbtk_net_reg_type_enum;
@@ -667,6 +709,8 @@
mbtk_net_reg_type_enum type : 8;
mbtk_radio_technology_enum tech : 8;
mbtk_net_reg_state_enum reg_state : 8;
+ uint64 tac;
+ uint64 ci;
} mbtk_ril_net_reg_state_info_t;
typedef struct
diff --git a/mbtk/libmbtk_lib/ril/v2/mbtk_ril_api.c b/mbtk/libmbtk_lib/ril/v2/mbtk_ril_api.c
index ac774cf..64ddc5b 100755
--- a/mbtk/libmbtk_lib/ril/v2/mbtk_ril_api.c
+++ b/mbtk/libmbtk_lib/ril/v2/mbtk_ril_api.c
@@ -596,12 +596,14 @@
ril_cli.ports[MBTK_AT_PORT_DEF].open_count--;
if(ril_cli.ports[MBTK_AT_PORT_DEF].open_count == 0) {
ril_cli.ports[MBTK_AT_PORT_DEF].port = ATPORTTYPE_NON;
+ LOGD("Close port : %d", MBTK_AT_PORT_DEF);
}
}
ril_cli.ports[port].open_count--;
if(ril_cli.ports[port].open_count == 0) {
ril_cli.ports[port].port = ATPORTTYPE_NON;
+ LOGD("Close port : %d", port);
}
// All port is close ???
@@ -613,7 +615,7 @@
}
if(i == ATPORTTYPE_NUM) { // All port is close.
- LOGD("Will close port %d", port);
+ LOGD("Will close socket connect.");
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
diff --git a/mbtk/mbtk_rild_v2/src/main.c b/mbtk/mbtk_rild_v2/src/main.c
index da1e040..0823105 100755
--- a/mbtk/mbtk_rild_v2/src/main.c
+++ b/mbtk/mbtk_rild_v2/src/main.c
@@ -721,6 +721,7 @@
// $CREG: 1, "8330", "06447347", 7,"0d4", 2, 0
// $CREG: 1, "8010", "000060a7", 0,, 2, 0
// +CGREG: 1
+// +C5GREG: 1,"00280386","07e920010",11,1,"01"
static void urc_net_reg_state_change_process(const char *s, const char *sms_pdu)
{
mbtk_ril_net_reg_state_info_t state;
@@ -732,6 +733,8 @@
state.type = MBTK_NET_REG_TYPE_CALL;
} else if(strStartsWith(s, "+CGREG:")) {
state.type = MBTK_NET_REG_TYPE_DATA_GSM_WCDMA;
+ } else if(strStartsWith(s, "+C5GREG:")) {
+ state.type = MBTK_NET_REG_TYPE_DATA_NR;
} else {
state.type = MBTK_NET_REG_TYPE_DATA_LTE;
}
@@ -749,23 +752,24 @@
goto CGREG_EXIT;
}
state.reg_state = (mbtk_net_reg_state_enum)tmp_int; // Reg State.
- if (state.reg_state) // Reg
+ if (state.reg_state && at_tok_hasmore(&line)) // Reg
{
- if (at_tok_nextstr(&line, &tmp_str) < 0)
+ if (at_tok_nextstr(&line, &tmp_str) < 0) // tac
{
goto CGREG_EXIT;
}
+ state.tac = (uint64)strtoull(tmp_str, NULL, 16);
- if (at_tok_nextstr(&line, &tmp_str) < 0)
+ if (at_tok_nextstr(&line, &tmp_str) < 0) // ci
{
goto CGREG_EXIT;
}
+ state.ci = (uint64)strtoull(tmp_str, NULL, 16);
if (at_tok_nextint(&line, &tmp_int) < 0)
{
goto CGREG_EXIT;
}
-
state.tech = (mbtk_radio_technology_enum)tmp_int; // AcT
}
@@ -1087,6 +1091,286 @@
static void urc_cell_info_process(const char *s, const char *sms_pdu)
{
+ // +EEMNRSVC: <mcc>,<lenOfMnc>,<mnc>,<tac>,<phyCellId>,<dlNrArfcn>,<dlScs>,<ulNrArfcn>,<ulScs>,<sulNrArfcn>,<sulScs>,<band>,<dlBandwidth>,<cellId>,<IsRedCapCell>,<longDRXCyclePresent>,<shortDRXCyclePresent>,<longDRXCycle>,<shortDRXCycle>,<pagingCycle>,
+ // <rsrp>,<rsrq>,<sinr>,<rssi>,<qRxLevMin>,<qQualMin>,<srxlev>,
+ // <pathLoss>,
+ // <dlBler>,<averDlPRB>,<averDlMcs>,<averDlPortNum>,<averCQI>,<averLi>,<averRi>,<dlThroughPut>,<dlPeakThroughPut>,
+ // <ulBler>,<averUlPRB>,<averUlMcs>,<averUlPortNum>,<currPuschTxPower>,<currPucchTxPower>,<grantTotal>,<ulThroughPut>,<ulPeakThroughPut>,
+ // <nrrcModeState>,<nmmState>,<serviceState>,<IsSingleNmmRejectCause>,<NMMRejectCause>,<amfRegionId>,<amfSetId>,<amfPointer>,<nrTmsi>,
+ // <ulBandwidth>,<dlInitialBwpFreq>,<ulInitialBwpFreq>
+ /*
+ +EEMNRSVC: 1120, 2, 0, 2622342, 137, 158650, 0, 146678, 0, 0, 255, 28, 79, 620598788208, 0, 0, 0, 0, 0, 64,
+ 86, 65, 86, 51, 20, 0, 49,
+ 0,
+ 0, 0, 0, 0, 38, 0, 8, 0, 0,
+ 0, 256, 24, 16, 13, 20, 2, 2, 0,
+ 1, 10, 0, 1, 0, 9, 128, 5, 2358781729,
+ 79, 788390, 733390
+ */
+ if(strStartsWith(s, "+EEMNRSVC:")) {
+ // mcc,lenOfMnc,mnc,tac,PCI,dlNrArfcn,ulNrArfcn,band,rsrp,rsrq,sinr,rssi
+ // cellID
+ if(cell_info.running) {
+ int tmp_int;
+ int i = 0;
+ char* tmp_s = memdup(s,strlen(s) + 1);
+ char* free_ptr = tmp_s;
+ char *line = tmp_s;
+ char *tmp_str;
+ if (at_tok_start(&line) < 0)
+ {
+ goto EEMNRSVC_EXIT;
+ }
+
+ if (at_tok_nextint(&line, &tmp_int) < 0) // mcc
+ {
+ goto EEMNRSVC_EXIT;
+ }
+ cell_info.cell_list.cell[cell_info.cell_list.num].value1 = (uint32)tmp_int;
+
+ if (at_tok_nextint(&line, &tmp_int) < 0) // lenOfMnc
+ {
+ goto EEMNRSVC_EXIT;
+ }
+ cell_info.cell_list.cell[cell_info.cell_list.num].value2 = (uint32)tmp_int;
+ if (at_tok_nextint(&line, &tmp_int) < 0) // mnc
+ {
+ goto EEMNRSVC_EXIT;
+ }
+ cell_info.cell_list.cell[cell_info.cell_list.num].value3 = (uint32)tmp_int;
+
+ if (at_tok_nextint(&line, &tmp_int) < 0) // tac
+ {
+ goto EEMNRSVC_EXIT;
+ }
+ cell_info.cell_list.cell[cell_info.cell_list.num].value4 = (uint32)tmp_int;
+
+ if (at_tok_nextint(&line, &tmp_int) < 0) // pci
+ {
+ goto EEMNRSVC_EXIT;
+ }
+ cell_info.cell_list.cell[cell_info.cell_list.num].value5 = (uint32)tmp_int;
+
+ if (at_tok_nextint(&line, &tmp_int) < 0) // dlNrArfcn
+ {
+ goto EEMNRSVC_EXIT;
+ }
+ cell_info.cell_list.cell[cell_info.cell_list.num].value6 = (uint32)tmp_int;
+
+ if (at_tok_nextint(&line, &tmp_int) < 0) // dlScs
+ {
+ goto EEMNRSVC_EXIT;
+ }
+
+ if (at_tok_nextint(&line, &tmp_int) < 0) // ulNrArfcn
+ {
+ goto EEMNRSVC_EXIT;
+ }
+ cell_info.cell_list.cell[cell_info.cell_list.num].value7 = (uint32)tmp_int;
+
+ // <ulScs>,<sulNrArfcn>,<sulScs>
+ for(i =0; i < 3; i++)
+ {
+ if (at_tok_nextint(&line, &tmp_int) < 0)
+ {
+ goto EEMNRSVC_EXIT;
+ }
+ }
+
+ if (at_tok_nextint(&line, &tmp_int) < 0) // band
+ {
+ goto EEMNRSVC_EXIT;
+ }
+ cell_info.cell_list.cell[cell_info.cell_list.num].value8 = (uint32)tmp_int;
+
+
+ if (at_tok_nextint(&line, &tmp_int) < 0) // dlBandwidth
+ {
+ goto EEMNRSVC_EXIT;
+ }
+
+
+ if (at_tok_nextstr(&line, &tmp_str) < 0) // cellId
+ {
+ goto EEMNRSVC_EXIT;
+ }
+ // LOGD("cellID-str : %s", tmp_str);
+ cell_info.cell_list.cell[cell_info.cell_list.num].value64_1 = (uint64)strtoull(tmp_str, NULL, 10);
+ // LOGD("cellID : %llu", cell_info.cell_list.cell[cell_info.cell_list.num].value64_1);
+
+ // <IsRedCapCell>,<longDRXCyclePresent>,<shortDRXCyclePresent>,<longDRXCycle>,<shortDRXCycle>,<pagingCycle>
+ for(i =0; i < 6; i++)
+ {
+ if (at_tok_nextint(&line, &tmp_int) < 0)
+ {
+ goto EEMNRSVC_EXIT;
+ }
+ }
+
+ if (at_tok_nextint(&line, &tmp_int) < 0) // <rsrp>
+ {
+ goto EEMNRSVC_EXIT;
+ }
+ cell_info.cell_list.cell[cell_info.cell_list.num].value9 = (uint32)tmp_int;
+
+ if (at_tok_nextint(&line, &tmp_int) < 0) // <rsrq>
+ {
+ goto EEMNRSVC_EXIT;
+ }
+ cell_info.cell_list.cell[cell_info.cell_list.num].value10 = (uint32)tmp_int;
+
+ if (at_tok_nextint(&line, &tmp_int) < 0) // <sinr>
+ {
+ goto EEMNRSVC_EXIT;
+ }
+ cell_info.cell_list.cell[cell_info.cell_list.num].value11 = (uint32)tmp_int;
+
+ if (at_tok_nextint(&line, &tmp_int) < 0) // <rssi>
+ {
+ goto EEMNRSVC_EXIT;
+ }
+ cell_info.cell_list.cell[cell_info.cell_list.num].value12 = (uint32)tmp_int;
+
+ cell_info.cell_list.num++;
+
+EEMNRSVC_EXIT:
+ free(free_ptr);
+ }
+ }
+ // +EEMNRINTER: <index>,<phyCellId>,<nrArfcn>,<dlScs>,<rsrp>,<rsrq>,<sinr>,<srxlev>,<mcc>,<lenOfMnc>,<mnc>,<tac>,<cellId>
+ /* +EEMNRINTER: 0, 508, 723360, 0, 39, 64, -8, 1, 0, 0, 0, 0, 4294967295 */
+ /* +EEMNRINTER: 1, 254, 723360, 0, 45, 72, 1, 7, 0, 0, 0, 0, 4294967295 */
+ /* +EEMNRINTER: 2, 595, 723360, 0, 40, 65, -5, 3, 0, 0, 0, 0, 4294967295 */
+ else if(strStartsWith(s, "+EEMNRINTER:")) {
+ // phyCellId,nrArfcn,rsrp,rsrq
+ if(cell_info.running) {
+ int tmp_int;
+ char* tmp_s = memdup(s,strlen(s) + 1);
+ char* free_ptr = tmp_s;
+ char *line = tmp_s;
+ if (at_tok_start(&line) < 0)
+ {
+ goto EEMNRINTER_EXIT;
+ }
+ if (at_tok_nextint(&line, &tmp_int) < 0) // index
+ {
+ goto EEMNRINTER_EXIT;
+ }
+ if (at_tok_nextint(&line, &tmp_int) < 0 || tmp_int < 0 || tmp_int > 1007) // phyCellId (0 - 1007)
+ {
+ goto EEMNRINTER_EXIT;
+ }
+ cell_info.cell_list.cell[cell_info.cell_list.num].value1 = (uint32)tmp_int;
+ if (at_tok_nextint(&line, &tmp_int) < 0) // nrArfcn
+ {
+ goto EEMNRINTER_EXIT;
+ }
+ cell_info.cell_list.cell[cell_info.cell_list.num].value2 = (uint32)tmp_int;
+ if (at_tok_nextint(&line, &tmp_int) < 0) // dlScs
+ {
+ goto EEMNRINTER_EXIT;
+ }
+ if (at_tok_nextint(&line, &tmp_int) < 0) // rsrp
+ {
+ goto EEMNRINTER_EXIT;
+ }
+ cell_info.cell_list.cell[cell_info.cell_list.num].value3 = (uint32)tmp_int;
+ if (at_tok_nextint(&line, &tmp_int) < 0) // rsrq
+ {
+ goto EEMNRINTER_EXIT;
+ }
+ cell_info.cell_list.cell[cell_info.cell_list.num].value4 = (uint32)tmp_int;
+
+ cell_info.cell_list.num++;
+EEMNRINTER_EXIT:
+ free(free_ptr);
+ }
+ }
+ // +EEMNRINTERRAT:<net_type>,<numInterRATEutra>,
+ // <earfcn>,<physCellId>,<rsrp>,<rsrq>,<sinr>,<mcc>,<lenOfMnc>,<mnc>,<tac>
+ // ......
+ // <earfcn>,<physCellId>,<rsrp>,<rsrq>,<sinr>,<mcc>,<lenOfMnc>,<mnc>,<tac>
+ /*
+ +EEMNRINTERRAT: 2, 6, // LTE
+ 1300, 423, 0, 0, 0, 0, 0, 0, 0,
+ 1300, 137, 0, 0, 0, 0, 0, 0, 0,
+ 1300, 149, 0, 0, 0, 0, 0, 0, 0,
+ 1300, 494, 0, 0, 0, 0, 0, 0, 0,
+ 1300, 337, 0, 0, 0, 0, 0, 0, 0,
+ 1300, 288, 0, 0, 0, 0, 0, 0, 0
+ */
+ /*
+ +EEMNRINTERRAT: 1, 0 // UMTS
+ */
+ else if(strStartsWith(s, "+EEMNRINTERRAT:")) {
+ // phyCellId,nrArfcn,rsrp,rsrq
+ if(cell_info.running) {
+ int tmp_int;
+ char* tmp_s = memdup(s,strlen(s) + 1);
+ char* free_ptr = tmp_s;
+ char *line = tmp_s;
+ if (at_tok_start(&line) < 0)
+ {
+ goto EEMNRINTERRAT_EXIT;
+ }
+ if (at_tok_nextint(&line, &tmp_int) < 0) // net_type
+ {
+ goto EEMNRINTERRAT_EXIT;
+ }
+
+#define CI_DEV_EM_NETWORK_LTE 2
+
+ // Only support LTE.
+ if(tmp_int == CI_DEV_EM_NETWORK_LTE) { // LTE
+ int num;
+ int i, j;
+ if (at_tok_nextint(&line, &num) < 0) // numInterRATEutra
+ {
+ goto EEMNRINTERRAT_EXIT;
+ }
+ LOGD("LTE-RAT num : %d", num);
+ for(i = 0; i < num; i++) {
+ if (at_tok_nextint(&line, &tmp_int) < 0) // earfcn
+ {
+ goto EEMNRINTERRAT_EXIT;
+ }
+ cell_info.cell_list.cell[cell_info.cell_list.num].value2 = (uint32)tmp_int;
+
+ if (at_tok_nextint(&line, &tmp_int) < 0) // physCellId
+ {
+ goto EEMNRINTERRAT_EXIT;
+ }
+ cell_info.cell_list.cell[cell_info.cell_list.num].value1 = (uint32)tmp_int;
+
+ if (at_tok_nextint(&line, &tmp_int) < 0) // rsrp
+ {
+ goto EEMNRINTERRAT_EXIT;
+ }
+ cell_info.cell_list.cell[cell_info.cell_list.num].value3 = (uint32)tmp_int;
+
+ if (at_tok_nextint(&line, &tmp_int) < 0) // rsrq
+ {
+ goto EEMNRINTERRAT_EXIT;
+ }
+ cell_info.cell_list.cell[cell_info.cell_list.num].value4 = (uint32)tmp_int;
+
+ // Jump 5 items.
+ j = 0;
+ while(j < 5) {
+ if (at_tok_nextint(&line, &tmp_int) < 0)
+ {
+ goto EEMNRINTERRAT_EXIT;
+ }
+ j++;
+ }
+
+ cell_info.cell_list.num++;
+ }
+ }
+EEMNRINTERRAT_EXIT:
+ free(free_ptr);
+ }
+ }
/*
// <mcc>, <length of mnc>, <mnc>, <tac>, <PCI>, <dlEuarfcn>, < ulEuarfcn >, <band>, <dlBandwidth>,
// <rsrp>,<rsrq>, <sinr>,
@@ -1105,7 +1389,7 @@
0, 0,
7, 44
*/
- if(strStartsWith(s, "+EEMLTESVC:")) // LTE Server Cell
+ else if(strStartsWith(s, "+EEMLTESVC:")) // LTE Server Cell
{
// tac, PCI, dlEuarfcn, ulEuarfcn, band
if(cell_info.running) {
@@ -1735,7 +2019,9 @@
} else if(strStartsWith(s, "CONNECT") || strStartsWith(s, "+CGEV:")) {
urc_pdp_state_change_process(s, sms_pdu);
- } else if(strStartsWith(s, "+EEMLTESVC:") || strStartsWith(s, "+EEMLTEINTER:")
+ } else if(strStartsWith(s, "+EEMNRSVC:") || strStartsWith(s, "+EEMNRINTER:")
+ || strStartsWith(s, "+EEMNRINTERRAT:")
+ || strStartsWith(s, "+EEMLTESVC:") || strStartsWith(s, "+EEMLTEINTER:")
|| strStartsWith(s, "+EEMLTEINTRA:") || strStartsWith(s, "+EEMLTEINTERRAT:")
|| strStartsWith(s, "+EEMUMTSSVC:") || strStartsWith(s, "+EEMUMTSINTRA:")
|| strStartsWith(s, "+EEMUMTSINTERRAT:") || strStartsWith(s, "+EEMGINFOBASIC:")
@@ -1766,9 +2052,11 @@
// $CREG: 1, "8330", "06447347", 7,"0d4", 2, 0
// $CREG: 1, "8010", "000060a7", 0,, 2, 0
// +CGREG: 1
+ // +C5GREG: 1,"00280386","07e920010",11,1,"01"
else if(strStartsWith(s, "+CGREG:") // GMS/WCDMA data registed.
|| strStartsWith(s, "+CEREG:") // LTE data registed.
- || strStartsWith(s, "+CREG:")) // GMS/WCDMA/LTE CS registed.
+ || strStartsWith(s, "+CREG:") // GMS/WCDMA/LTE CS registed.
+ || strStartsWith(s, "+C5GREG:")) // NR data registed.
{
urc_net_reg_state_change_process(s, sms_pdu);
}
@@ -2497,6 +2785,102 @@
return NULL;
}
+static void band_support_init()
+{
+ mbtk_device_info_modem_t info_modem;
+ memset(&band_info.band_support, 0, sizeof(mbtk_band_info_t));
+ memset(&info_modem, 0, sizeof(mbtk_device_info_modem_t));
+#ifdef MBTK_DEV_INFO_VERSION_2
+ if(mbtk_dev_info_read(MBTK_DEVICE_INFO_ITEM_MODEM, &(info_modem), sizeof(mbtk_device_info_modem_t))) {
+ LOGD("mbtk_dev_info_read(MODEM) fail, use default band.");
+ band_info.band_area = MBTK_MODEM_BAND_AREA_ALL;
+#ifdef MBTK_5G_SUPPORT
+ band_info.band_support.net_pref = MBTK_NET_PREF_LTE_NR_NR_PREF; // 19
+ band_info.net_support = MBTK_NET_SUPPORT_4G | MBTK_NET_SUPPORT_5G;
+
+ band_info.band_support.gsm_band = 0;
+ band_info.band_support.umts_band = 0;
+ band_info.band_support.tdlte_band = MBTK_BAND_ALL_TDLTE_DEFAULT;
+ band_info.band_support.fddlte_band = MBTK_BAND_ALL_FDDLTE_DEFAULT;
+ band_info.band_support.lte_ext_band = MBTK_BAND_ALL_EXT_LTE_DEFAULT;
+
+ band_info.band_support.nr_3_band = MBTK_BAND_ALL_NR_3_DEFAULT;
+ band_info.band_support.nr_2_band = MBTK_BAND_ALL_NR_2_DEFAULT;
+ band_info.band_support.nr_1_band = MBTK_BAND_ALL_NR_1_DEFAULT;
+ band_info.band_support.nr_0_band = MBTK_BAND_ALL_NR_0_DEFAULT;
+#else
+ band_info.band_support.net_pref = MBTK_NET_PREF_GSM_UMTS_LTE_LTE_PREF; // 15
+ band_info.net_support = MBTK_NET_SUPPORT_2G | MBTK_NET_SUPPORT_3G | MBTK_NET_SUPPORT_4G;
+
+ band_info.band_support.gsm_band = MBTK_BAND_ALL_GSM_DEFAULT;
+ band_info.band_support.umts_band = MBTK_BAND_ALL_WCDMA_DEFAULT;
+ band_info.band_support.tdlte_band = MBTK_BAND_ALL_TDLTE_DEFAULT;
+ band_info.band_support.fddlte_band = MBTK_BAND_ALL_FDDLTE_DEFAULT;
+ band_info.band_support.lte_ext_band = MBTK_BAND_ALL_EXT_LTE_DEFAULT;
+
+ band_info.band_support.nr_3_band = 0;
+ band_info.band_support.nr_2_band = 0;
+ band_info.band_support.nr_1_band = 0;
+ band_info.band_support.nr_0_band = 0;
+#endif
+ } else {
+ band_info.band_area = info_modem.band_area;
+ band_info.net_support = info_modem.net_support;
+ if(info_modem.net_pref < MBTK_NET_PREF_MAX) {
+ band_info.band_support.net_pref = info_modem.net_pref;
+ } else {
+ if(band_info.net_support & MBTK_NET_SUPPORT_5G) {
+ band_info.band_support.net_pref = MBTK_NET_PREF_LTE_NR_NR_PREF; // 19
+ } else {
+ band_info.band_support.net_pref = MBTK_NET_PREF_GSM_UMTS_LTE_LTE_PREF; // 15
+ }
+ }
+ band_info.band_support.gsm_band = info_modem.band_gsm;
+ band_info.band_support.umts_band = info_modem.band_wcdma;
+ band_info.band_support.tdlte_band = info_modem.band_tdlte;
+ band_info.band_support.fddlte_band = info_modem.band_fddlte;
+ band_info.band_support.lte_ext_band = info_modem.band_lte_ext;
+
+ band_info.band_support.nr_3_band = info_modem.band_nr_3;
+ band_info.band_support.nr_2_band = info_modem.band_nr_2;
+ band_info.band_support.nr_1_band = info_modem.band_nr_1;
+ band_info.band_support.nr_0_band = info_modem.band_nr_0;
+ }
+#else
+ if(mbtk_dev_info_read(MBTK_DEVICE_INFO_ITEM_MODEM, &(info_modem), sizeof(mbtk_device_info_modem_t))) {
+ LOGD("mbtk_dev_info_read(MODEM) fail, use default band.");
+ band_info.band_area = MBTK_MODEM_BAND_AREA_ALL;
+ band_info.band_support.net_pref = MBTK_NET_PREF_GSM_UMTS_LTE_LTE_PREF; // 15
+ band_info.net_support = MBTK_NET_SUPPORT_2G | MBTK_NET_SUPPORT_3G | MBTK_NET_SUPPORT_4G;
+
+ band_info.band_support.gsm_band = MBTK_BAND_ALL_GSM_DEFAULT;
+ band_info.band_support.umts_band = MBTK_BAND_ALL_WCDMA_DEFAULT;
+ band_info.band_support.tdlte_band = MBTK_BAND_ALL_TDLTE_DEFAULT;
+ band_info.band_support.fddlte_band = MBTK_BAND_ALL_FDDLTE_DEFAULT;
+ band_info.band_support.lte_ext_band = MBTK_BAND_ALL_EXT_LTE_DEFAULT;
+
+ band_info.band_support.nr_3_band = 0;
+ band_info.band_support.nr_2_band = 0;
+ band_info.band_support.nr_1_band = 0;
+ band_info.band_support.nr_0_band = 0;
+ } else {
+ band_info.band_area = info_modem.band_area;
+ band_info.net_support = MBTK_NET_SUPPORT_2G | MBTK_NET_SUPPORT_3G | MBTK_NET_SUPPORT_4G;
+ band_info.band_support.net_pref = MBTK_NET_PREF_GSM_UMTS_LTE_LTE_PREF; // 15
+ band_info.band_support.gsm_band = info_modem.band_gsm;
+ band_info.band_support.umts_band = info_modem.band_wcdma;
+ band_info.band_support.tdlte_band = info_modem.band_tdlte;
+ band_info.band_support.fddlte_band = info_modem.band_fddlte;
+ band_info.band_support.lte_ext_band = info_modem.band_lte_ext;
+
+ band_info.band_support.nr_3_band = 0;
+ band_info.band_support.nr_2_band = 0;
+ band_info.band_support.nr_1_band = 0;
+ band_info.band_support.nr_0_band = 0;
+ }
+#endif
+}
+
static void* ril_process_thread(void* arg)
{
UNUSED(arg);
@@ -2559,69 +2943,7 @@
*/
static void* band_config_thread()
{
- mbtk_device_info_modem_t info_modem;
- memset(&band_info.band_support, 0, sizeof(mbtk_band_info_t));
- memset(&info_modem, 0, sizeof(mbtk_device_info_modem_t));
band_info.band_set_success = FALSE;
- if(mbtk_dev_info_read(MBTK_DEVICE_INFO_ITEM_MODEM, &(info_modem), sizeof(mbtk_device_info_modem_t))) {
- LOGD("mbtk_dev_info_read(MODEM) fail, use default band.");
- band_info.band_area = MBTK_MODEM_BAND_AREA_ALL;
-#ifdef MBTK_DEV_INFO_VERSION_2
-
-#ifdef MBTK_5G_SUPPORT
- band_info.band_support.net_pref = MBTK_NET_PREF_LTE_NR_NR_PREF; // 19
- band_info.net_support = MBTK_NET_SUPPORT_4G | MBTK_NET_SUPPORT_5G;
-#else
- band_info.band_support.net_pref = MBTK_NET_PREF_GSM_UMTS_LTE_LTE_PREF; // 15
- band_info.net_support = MBTK_NET_SUPPORT_2G | MBTK_NET_SUPPORT_3G | MBTK_NET_SUPPORT_4G;
-#endif
-
-#else
-
- band_info.band_support.net_pref = MBTK_NET_PREF_GSM_UMTS_LTE_LTE_PREF; // 15
-
-#endif
- band_info.band_support.gsm_band = MBTK_BAND_ALL_GSM_DEFAULT;
- band_info.band_support.umts_band = MBTK_BAND_ALL_WCDMA_DEFAULT;
- band_info.band_support.tdlte_band = MBTK_BAND_ALL_TDLTE_DEFAULT;
- band_info.band_support.fddlte_band = MBTK_BAND_ALL_FDDLTE_DEFAULT;
- band_info.band_support.lte_ext_band = MBTK_BAND_ALL_EXT_LTE_DEFAULT;
-
-#ifdef MBTK_DEV_INFO_VERSION_2
- band_info.band_support.nr_3_band = MBTK_BAND_ALL_NR_3_DEFAULT;
- band_info.band_support.nr_2_band = MBTK_BAND_ALL_NR_2_DEFAULT;
- band_info.band_support.nr_1_band = MBTK_BAND_ALL_NR_1_DEFAULT;
- band_info.band_support.nr_0_band = MBTK_BAND_ALL_NR_0_DEFAULT;
-#endif
- } else {
- band_info.band_area = info_modem.band_area;
-#ifdef MBTK_DEV_INFO_VERSION_2
- band_info.net_support = info_modem.net_support;
- if(info_modem.net_pref < MBTK_NET_PREF_MAX) {
- band_info.band_support.net_pref = info_modem.net_pref;
- } else {
- if(band_info.net_support & MBTK_NET_SUPPORT_5G) {
- band_info.band_support.net_pref = MBTK_NET_PREF_LTE_NR_NR_PREF; // 19
- } else {
- band_info.band_support.net_pref = MBTK_NET_PREF_GSM_UMTS_LTE_LTE_PREF; // 15
- }
- }
-#else
- band_info.band_support.net_pref = MBTK_NET_PREF_GSM_UMTS_LTE_LTE_PREF; // 15
-#endif
- band_info.band_support.gsm_band = info_modem.band_gsm;
- band_info.band_support.umts_band = info_modem.band_wcdma;
- band_info.band_support.tdlte_band = info_modem.band_tdlte;
- band_info.band_support.fddlte_band = info_modem.band_fddlte;
- band_info.band_support.lte_ext_band = info_modem.band_lte_ext;
-#ifdef MBTK_DEV_INFO_VERSION_2
- band_info.band_support.nr_3_band = info_modem.band_nr_3;
- band_info.band_support.nr_2_band = info_modem.band_nr_2;
- band_info.band_support.nr_1_band = info_modem.band_nr_1;
- band_info.band_support.nr_0_band = info_modem.band_nr_0;
-#endif
- }
-
// bool is_first = TRUE;
while(!band_info.band_set_success) {
// Set band.
@@ -2664,6 +2986,9 @@
//check cfun and sim card status
ril_at_ready_process();
+
+ // Init support band.
+ band_support_init();
//any AT instruction that is not sent through pack_process_thread needs to precede the thread
//thread create
diff --git a/mbtk/mbtk_rild_v2/src/ril_net.c b/mbtk/mbtk_rild_v2/src/ril_net.c
index 3c0ee24..649fd72 100755
--- a/mbtk/mbtk_rild_v2/src/ril_net.c
+++ b/mbtk/mbtk_rild_v2/src/ril_net.c
@@ -25,6 +25,19 @@
extern ril_band_info_t band_info;
void ril_rsp_pack_send(ATPortType_enum port, int fd, int ril_id, int msg_index, const void* data, int data_len);
+static bool net_support_check(uint32 net_type, uint32 net_flag)
+{
+#ifdef MBTK_DEV_INFO_VERSION_2
+ return (net_type & net_flag);
+#else
+ if(net_flag == MBTK_NET_SUPPORT_5G) {
+ return FALSE;
+ } else {
+ return TRUE;
+ }
+#endif
+}
+
/*
AT+COPS=?
@@ -260,45 +273,48 @@
if(band->gsm_band == 0 && band->umts_band == 0
&& band->tdlte_band == 0 && band->fddlte_band == 0 && band->lte_ext_band == 0
-#ifdef MBTK_DEV_INFO_VERSION_2
&& band->nr_3_band == 0 && band->nr_2_band == 0
&& band->nr_1_band == 0 && band->nr_0_band == 0
-#endif
) {
sprintf(cmd, "AT*BAND=%d", band->net_pref);
} else {
log_hex("BAND_SUPPORT", &band_info.band_support, sizeof(mbtk_band_info_t));
log_hex("BAND", band, sizeof(mbtk_band_info_t));
- if(band->gsm_band == 0) {
+ if(band->gsm_band == 0 && net_support_check(band_info.net_support, MBTK_NET_SUPPORT_2G)) {
band->gsm_band = band_info.band_support.gsm_band;
}
- if(band->umts_band == 0) {
+ if(band->umts_band == 0 && net_support_check(band_info.net_support, MBTK_NET_SUPPORT_3G)) {
band->umts_band = band_info.band_support.umts_band;
}
- if(band->tdlte_band == 0) {
- band->tdlte_band = band_info.band_support.tdlte_band;
+
+ if(net_support_check(band_info.net_support, MBTK_NET_SUPPORT_4G)) {
+ if(band->tdlte_band == 0) {
+ band->tdlte_band = band_info.band_support.tdlte_band;
+ }
+ if(band->fddlte_band == 0) {
+ band->fddlte_band = band_info.band_support.fddlte_band;
+ }
+ if(band->lte_ext_band == 0) {
+ band->lte_ext_band = band_info.band_support.lte_ext_band;
+ }
}
- if(band->fddlte_band == 0) {
- band->fddlte_band = band_info.band_support.fddlte_band;
+
+ if(net_support_check(band_info.net_support, MBTK_NET_SUPPORT_5G)) {
+ if(band->nr_3_band == 0) {
+ band->nr_3_band = band_info.band_support.nr_3_band;
+ }
+ if(band->nr_2_band == 0) {
+ band->nr_2_band = band_info.band_support.nr_2_band;
+ }
+ if(band->nr_1_band == 0) {
+ band->nr_1_band = band_info.band_support.nr_1_band;
+ }
+ if(band->nr_0_band == 0) {
+ band->nr_0_band = band_info.band_support.nr_0_band;
+ }
}
- if(band->lte_ext_band == 0) {
- band->lte_ext_band = band_info.band_support.lte_ext_band;
- }
-#ifdef MBTK_DEV_INFO_VERSION_2
- if(band->nr_3_band == 0) {
- band->nr_3_band = band_info.band_support.nr_3_band;
- }
- if(band->nr_2_band == 0) {
- band->nr_2_band = band_info.band_support.nr_2_band;
- }
- if(band->nr_1_band == 0) {
- band->nr_1_band = band_info.band_support.nr_1_band;
- }
- if(band->nr_0_band == 0) {
- band->nr_0_band = band_info.band_support.nr_0_band;
- }
-#endif
+
if((band->gsm_band & band_info.band_support.gsm_band) != band->gsm_band) {
LOG("GSM band error.");
goto exit;
@@ -323,7 +339,6 @@
LOG("EXT_LTE band error.");
goto exit;
}
-#ifdef MBTK_DEV_INFO_VERSION_2
if((band->nr_3_band & band_info.band_support.nr_3_band) != band->nr_3_band) {
LOG("nr_3_band band error.");
goto exit;
@@ -343,7 +358,6 @@
LOG("nr_0_band band error.");
goto exit;
}
-#endif
if(band->net_pref == 0xFF) { // No change net_pref.
int tmp_int;
err = at_send_command_singleline(port, "AT*BAND?", "*BAND:", &response);
@@ -370,7 +384,6 @@
at_response_free(response);
}
-#ifdef MBTK_DEV_INFO_VERSION_2
// Only support 4G/5G
if(band_info.net_support & MBTK_NET_SUPPORT_5G) {
// AT*band=19,0,0,482,134742231,0,24576,256,134217877,0
@@ -388,13 +401,6 @@
sprintf(cmd, "AT*BAND=%d,%d,%d,%d,%d", band->net_pref, band->gsm_band, band->umts_band, band->tdlte_band, band->fddlte_band);
}
}
-#else
- if(band->lte_ext_band > 0) {
- sprintf(cmd, "AT*BAND=%d,%d,%d,%d,%d,,,,%d", band->net_pref, band->gsm_band, band->umts_band, band->tdlte_band, band->fddlte_band, band->lte_ext_band);
- } else {
- sprintf(cmd, "AT*BAND=%d,%d,%d,%d,%d", band->net_pref, band->gsm_band, band->umts_band, band->tdlte_band, band->fddlte_band);
- }
-#endif
}
err = at_send_command(port, cmd, &response);
@@ -537,7 +543,6 @@
}
band->fddlte_band = (uint32)tmp_int;
-#ifdef MBTK_DEV_INFO_VERSION_2
if(band_info.net_support & MBTK_NET_SUPPORT_5G)
{
err = at_tok_nextint(&line, &tmp_int);
@@ -568,7 +573,6 @@
}
band->nr_0_band = (uint32)tmp_int;
}
-#endif
// roamingConfig
err = at_tok_nextint(&line, &tmp_int);
@@ -714,6 +718,31 @@
}
signal->rsrp = (uint8)tmp_int;
+ if(at_tok_hasmore(&line)) {
+ err = at_tok_nextint(&line, &tmp_int);
+ if (err < 0)
+ {
+ goto exit;
+ }
+ signal->ss_rsrq = (uint8)tmp_int;
+ }
+ if(at_tok_hasmore(&line)) {
+ err = at_tok_nextint(&line, &tmp_int);
+ if (err < 0)
+ {
+ goto exit;
+ }
+ signal->ss_rsrp = (uint8)tmp_int;
+ }
+ if(at_tok_hasmore(&line)) {
+ err = at_tok_nextint(&line, &tmp_int);
+ if (err < 0)
+ {
+ goto exit;
+ }
+ signal->ss_sinr = (uint8)tmp_int;
+ }
+
at_response_free(response);
err = at_send_command_singleline(port, "AT+COPS?", "+COPS:", &response);
if (err < 0 || response->success == 0 || !response->p_intermediates){
@@ -901,6 +930,56 @@
goto exit;
}
reg->type = (uint8)tmp_int;
+ } else if(reg->data_state == 0 && (band_info.net_support & MBTK_NET_SUPPORT_5G)) {
+ at_response_free(response);
+ err = at_send_command_multiline(port, "AT+C5GREG?", "+C5GREG:", &response);
+ if (err < 0 || response->success == 0 || !response->p_intermediates){
+ if(cme_err) {
+ *cme_err = at_get_cme_error(response);
+ }
+ goto exit;
+ }
+
+ line = response->p_intermediates->line;
+ err = at_tok_start(&line);
+ if (err < 0)
+ {
+ goto exit;
+ }
+ err = at_tok_nextint(&line, &tmp_int); // n
+ if (err < 0)
+ {
+ goto exit;
+ }
+ err = at_tok_nextint(&line, &tmp_int);// stat
+ if (err < 0)
+ {
+ goto exit;
+ }
+ reg->data_state = (uint8)tmp_int;
+
+ if(/*reg->lac == 0 && */at_tok_hasmore(&line)) {
+ err = at_tok_nextstr(&line, &tmp_str); // lac
+ if (err < 0)
+ {
+ goto exit;
+ }
+ reg->lac = strtol(tmp_str, NULL, 16);
+
+ err = at_tok_nextstr(&line, &tmp_str); // ci
+ if (err < 0)
+ {
+ goto exit;
+ }
+ reg->ci = strtol(tmp_str, NULL, 16);
+
+ err = at_tok_nextint(&line, &tmp_int);// AcT
+ if (err < 0)
+ {
+ goto exit;
+ }
+ reg->type = (uint8)tmp_int;
+ }
}
at_response_free(response);
@@ -1517,7 +1596,7 @@
ril_rsp_pack_send(cli_info->port, cli_info->fd, pack->msg_id, pack->msg_index, &band, sizeof(mbtk_band_info_t));
}
} else { // Get support bands.
- ril_rsp_pack_send(cli_info->port, cli_info->fd, pack->msg_id, pack->msg_index, &band_info.band_support , sizeof(mbtk_band_info_t));
+ ril_rsp_pack_send(cli_info->port, cli_info->fd, pack->msg_id, pack->msg_index, &band_info.band_support, sizeof(mbtk_band_info_t));
}
} else { // Set current bands.
mbtk_band_info_t* band = (mbtk_band_info_t*)pack->data;
@@ -1615,6 +1694,7 @@
else
{
LOG("req_cell_info_get() success,cell number: %d", cell_info.cell_list.num);
+ LOGD("data_len = %d", sizeof(mbtk_cell_info_array_t));
ril_rsp_pack_send(cli_info->port, cli_info->fd, pack->msg_id, pack->msg_index, &cell_info.cell_list, sizeof(mbtk_cell_info_array_t));
}
}
diff --git a/mbtk/test/libmbtk_ril/mbtk_ril_test.c b/mbtk/test/libmbtk_ril/mbtk_ril_test.c
index 83d05b2..db7fff2 100755
--- a/mbtk/test/libmbtk_ril/mbtk_ril_test.c
+++ b/mbtk/test/libmbtk_ril/mbtk_ril_test.c
@@ -61,8 +61,8 @@
printf("sel_mode: Get network select mode.\n");
printf("sel_mode <sel_mode> <net_type> <plmn>: Set network select mode.\n");
printf("band: Get current bands.\n");
- printf("band support: Get support bands.\n");
- printf("band <net_pref> <gsm_band> <umts_band> <tdlte_band> <fddlte_band>: Set current bands.\n");
+ printf("band_support: Get support bands.\n");
+ printf("band <net_pref> <gsm_band> <umts_band> <tdlte_band> <fddlte_band> <nr_band_3> <nr_band_2> <nr_band_1> <nr_band_0>: Set current bands.\n");
printf("signal: Get network signal.\n");
printf("reg: Get network registe information.\n");
printf("cell: Get current cell information.\n");
@@ -123,8 +123,8 @@
{
if(data) {
mbtk_ril_net_reg_state_info_t *state = (mbtk_ril_net_reg_state_info_t*)data;
- printf("net reg state change : type - %d, tech - %d, reg_state - %d\n", state->type,
- state->tech, state->reg_state);
+ printf("net reg state change : type - %d, tech - %d, reg_state - %d, TAG - %llx, ci - %llx\n", state->type,
+ state->tech, state->reg_state, state->tac, state->ci);
}
}
@@ -751,16 +751,19 @@
if(err != MBTK_RIL_ERR_SUCCESS) {
printf("Error : %d\n", err);
} else {
- printf("Band : %d, %d, %d, %d, %d, %d\n", band.net_pref, band.gsm_band, band.umts_band, band.tdlte_band, band.fddlte_band, band.lte_ext_band);
+ printf("Band : %d, %d, %d, %d, %d, %d, %d, %d, %d, %d\n", band.net_pref, band.gsm_band, band.umts_band, band.tdlte_band, band.fddlte_band, band.lte_ext_band,
+ band.nr_3_band, band.nr_2_band, band.nr_1_band, band.nr_0_band);
}
- } else if(!strcasecmp(cmd, "band support")) { // Get
+ } else if(!strcasecmp(cmd, "band_support")) { // Get
err = mbtk_support_band_get(handle_def, &band);
if(err != MBTK_RIL_ERR_SUCCESS) {
printf("Error : %d\n", err);
} else {
- printf("Band : %d, %d, %d, %d, %d, %d\n", band.net_pref, band.gsm_band, band.umts_band, band.tdlte_band, band.fddlte_band, band.lte_ext_band);
+ printf("Band : %d, %d, %d, %d, %d, %d, %d, %d, %d, %d\n", band.net_pref, band.gsm_band, band.umts_band, band.tdlte_band, band.fddlte_band, band.lte_ext_band,
+ band.nr_3_band, band.nr_2_band, band.nr_1_band, band.nr_0_band);
}
- } else { // "band 0 79 147 482 524503"
+ } else { // "band 0 79 147 482 524503 x x x x"
+#if 0
char *ptr = strstr(cmd, " ");
if(ptr == NULL)
continue;
@@ -795,7 +798,15 @@
while(*ptr != '\0' && *ptr == ' ')
ptr++;
band.fddlte_band = (uint32)atoi(ptr);
+#else
+ int count = sscanf(cmd, "band %d %d %d %d %d %d %d %d %d %d", &band.net_pref, &band.gsm_band, &band.umts_band,
+ &band.tdlte_band, &band.fddlte_band, &band.lte_ext_band, &band.nr_3_band, &band.nr_2_band, &band.nr_1_band, &band.nr_0_band);
+ if(count != 10 && count != 1) {
+ printf("band set error.\n");
+ continue;
+ }
+#endif
err = mbtk_current_band_set(handle_def, &band);
if(err != MBTK_RIL_ERR_SUCCESS) {
printf("Error : %d\n", err);
@@ -809,8 +820,8 @@
if(err != MBTK_RIL_ERR_SUCCESS) {
printf("Error : %d\n", err);
} else {
- printf("Signal : %d, %d, %d, %d, %d, %d, %d, %d\n", signal.type, signal.rssi, signal.rxlev, signal.ber,
- signal.rscp, signal.ecno, signal.rsrq, signal.rsrp);
+ printf("Signal : %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d\n", signal.type, signal.rssi, signal.rxlev, signal.ber,
+ signal.rscp, signal.ecno, signal.rsrq, signal.rsrp, signal.ss_rsrq, signal.ss_rsrp, signal.ss_sinr);
}
} else if(!strncasecmp(cmd, "reg", 3)){
mbtk_net_reg_info_t reg;
@@ -818,7 +829,7 @@
if(err != MBTK_RIL_ERR_SUCCESS) {
printf("Error : %d\n", err);
} else {
- printf("REG : call_state=%d, data_state=%d, ims_state=%d, net_type=%d, %04x, %08x\n", reg.call_state, reg.data_state, reg.ims_state, reg.type, reg.lac, reg.ci);
+ printf("REG : call_state=%d, data_state=%d, ims_state=%d, net_type=%d, %08x, %09x\n", reg.call_state, reg.data_state, reg.ims_state, reg.type, reg.lac, reg.ci);
}
} else if(!strncasecmp(cmd, "apn_del", 7)) {
mbtk_apn_info_t apn;
@@ -1045,6 +1056,13 @@
case MBTK_CELL_TYPE_LTE:
printf("LTE : tac=%d, PCI=%d, dlEuarfcn=%d, ulEuarfcn=%d, band=%d\n", cell.cell[0].value1, cell.cell[0].value2, cell.cell[0].value3, cell.cell[0].value4, cell.cell[0].value5);
break;
+ // mcc,mnc,tac,PCI,dlNrArfcn,ulNrArfcn,band,rsrp,rsrq,sinr,rssi
+ // cellID
+ case MBTK_CELL_TYPE_NR:
+ printf("NR : mcc=%d, mnc_len=%d, mnc=%d, tac=%d, PCI=%d, dlNrArfcn=%d, ulNrArfcn=%d, band=%d, rsrp=%d, rsrq=%d, sinr=%d, rssi=%d, cellID=%lld\n",
+ cell.cell[0].value1, cell.cell[0].value2, cell.cell[0].value3, cell.cell[0].value4, cell.cell[0].value5, cell.cell[0].value6, cell.cell[0].value7
+ , cell.cell[0].value8, cell.cell[0].value9, cell.cell[0].value10, cell.cell[0].value11, cell.cell[0].value12, cell.cell[0].value64_1);
+ break;
default:
break;
}
@@ -1063,6 +1081,10 @@
case MBTK_CELL_TYPE_LTE:
printf("CELL : phyCellId=%d, euArfcn=%d, rsrp=%d, rsrq=%d\n", cell.cell[i].value1, cell.cell[i].value2, cell.cell[i].value3, cell.cell[i].value4);
break;
+ // phyCellId,nrArfcn,rsrp,rsrq
+ case MBTK_CELL_TYPE_NR:
+ printf("CELL : phyCellId=%d, nrArfcn=%d, rsrp=%d, rsrq=%d\n", cell.cell[i].value1, cell.cell[i].value2, cell.cell[i].value3, cell.cell[i].value4);
+ break;
default:
break;
}
@@ -1594,8 +1616,8 @@
else if(!strcasecmp(cmd, "h") || !strcasecmp(cmd, "help")) {
help();
} else if(!strcasecmp(cmd, "q")) {
- mbtk_ril_close(MBTK_AT_PORT_DEF);
- mbtk_ril_close(ATPORTTYPE_1);
+ //mbtk_ril_close(MBTK_AT_PORT_DEF);
+ //mbtk_ril_close(ATPORTTYPE_1);
break;
} else {
printf("\n");
@@ -1607,9 +1629,8 @@
thread_exit_with_wait();
exit:
#endif
- mbtk_ril_close(MBTK_AT_PORT_DEF);
mbtk_ril_close(ATPORTTYPE_1);
-
+ mbtk_ril_close(MBTK_AT_PORT_DEF);
LOG("Client exec complete.");