Add cell get/set API for V2.
Change-Id: I7a001cd0f091a199ef0f7583becead01c38e1777
diff --git a/mbtk/include/mbtk/mbtk_ril_api.h b/mbtk/include/mbtk/mbtk_ril_api.h
index 1803411..862309e 100755
--- a/mbtk/include/mbtk/mbtk_ril_api.h
+++ b/mbtk/include/mbtk/mbtk_ril_api.h
@@ -18,7 +18,7 @@
#define MBTK_APN_CID_MIN 1
#define MBTK_APN_CID_MAX 7
-#define CELL_NUM_MAX 50
+#define CELL_NUM_MAX 15
#define APN_STR_MAX 64
#define RIL_PIN_STR_MAX 16
@@ -37,7 +37,7 @@
} mbtk_ril_cid_enum;
typedef enum {
- MBTK_RIL_ERR_SUCCESS = 300,
+ MBTK_RIL_ERR_SUCCESS = 0,
MBTK_RIL_ERR_INITED,
MBTK_RIL_ERR_NOT_INIT,
MBTK_RIL_ERR_PARAMETER, // Parameter error.
@@ -472,8 +472,9 @@
} __attribute__((packed)) mbtk_cell_info_t;
typedef struct {
+ mbtk_cell_type_enum type;
int num;
- mbtk_cell_info_t cell[10];
+ mbtk_cell_info_t cell[CELL_NUM_MAX];
} mbtk_cell_info_array_t;
typedef struct {
@@ -505,6 +506,12 @@
uint32 duration;
} __attribute__((packed)) mbtk_call_dtmf_info_t;
+typedef struct
+{
+ bool running;
+
+ mbtk_cell_info_array_t cell_list;
+} mbtk_cell_pack_info_t;
mbtk_ril_err_enum mbtk_ril_init();
@@ -648,9 +655,15 @@
mbtk_ril_err_enum mbtk_cell_get(mbtk_cell_info_array_t *cell_list);
/*
-* Set AT*CELL.
+* Set cell info.
+*
+* at*CELL=<mode>,<act>,< band>,<freq>,<cellId>
+* at*cell=2,3,,40936,429 //
+* at*cell=0 //
+*
+* Restarting takes effect after execution.
*/
-mbtk_ril_err_enum mbtk_cell_set(const mbtk_cell_info_t *cell);
+mbtk_ril_err_enum mbtk_cell_set(char *info, char *response);
/*
* Get current APN informations.
diff --git a/mbtk/libmbtk_ril_v2/inc/mbtk_ril.h b/mbtk/libmbtk_ril_v2/inc/mbtk_ril.h
index 9303e26..e32b1dd 100755
--- a/mbtk/libmbtk_ril_v2/inc/mbtk_ril.h
+++ b/mbtk/libmbtk_ril_v2/inc/mbtk_ril.h
@@ -300,6 +300,15 @@
MBTK_LTE_EXT_BAND_69 = 16
} mbtk_lte_ext_band_enum;
+typedef struct
+{
+ uint8 type; // 0: GSM 1: UMTS 2: LTE
+ bool running;
+
+ int cell_num;
+ mbtk_cell_info_t cell[CELL_NUM_MAX];
+} mbtK_cell_pack_info_t;
+
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/mbtk/libmbtk_ril_v2/src/mbtk_ril_api.c b/mbtk/libmbtk_ril_v2/src/mbtk_ril_api.c
index b18e9d0..d864a75 100755
--- a/mbtk/libmbtk_ril_v2/src/mbtk_ril_api.c
+++ b/mbtk/libmbtk_ril_v2/src/mbtk_ril_api.c
@@ -1162,6 +1162,7 @@
return ril_req_process(RIL_MSG_ID_NET_CELL, NULL, 0, cell_array, FALSE);
}
+
/*
* Set cell info.
*
@@ -1171,20 +1172,20 @@
*
* Restarting takes effect after execution.
*/
-mbtk_ril_err_enum mbtk_cell_set(const mbtk_cell_info_t *cell_info)
+mbtk_ril_err_enum mbtk_cell_set(char *info, char *response)
{
if(!ril_cli.ril_ready)
{
return MBTK_RIL_ERR_NOT_INIT;
}
- if(cell_info == NULL)
+ if(info == NULL || response == NULL)
{
LOGE("ARG error.");
return MBTK_RIL_ERR_PARAMETER;
}
- return ril_req_process(RIL_MSG_ID_NET_CELL, cell_info, sizeof(mbtk_cell_info_t), NULL, FALSE);
+ return ril_req_process(RIL_MSG_ID_NET_CELL, info, strlen(info), response, FALSE);
}
/*
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;
}
diff --git a/mbtk/test/libmbtk_ril/mbtk_ril_test.c b/mbtk/test/libmbtk_ril/mbtk_ril_test.c
index cbb56c2..20178b3 100755
--- a/mbtk/test/libmbtk_ril/mbtk_ril_test.c
+++ b/mbtk/test/libmbtk_ril/mbtk_ril_test.c
@@ -698,56 +698,53 @@
}
}
}
-#if 0
-
else if(!strncasecmp(cmd, "cell", 4)){
char *ptr = strstr(cmd, ","); //CPMS,ME,ME,ME
if(ptr == NULL)
{
- printf("ptr == NULL\n");
- list_node_t* cell_list = NULL;
- int type;
- err = mbtk_cell_get(info_handle, &type, &cell_list);
- if(err || cell_list == NULL) {
+ mbtk_cell_info_array_t cell;
+ err = mbtk_cell_get(&cell);
+ if(err) {
printf("Error : %d\n", err);
- } else {
- list_first(cell_list);
- mbtk_cell_info_t* cell = (mbtk_cell_info_t*) list_next(cell_list);
- if(cell) { // Current server cell.
- switch(type)
- {
- case 0:
- printf("GSM : lac=%d, ci=%d, arfcn=%d, bsic=%d\n", cell->value1, cell->value2, cell->value3, cell->value4);
- break;
- case 1:
- printf("UMTS : lac=%d, ci=%d, arfcn=%d\n", cell->value1, cell->value2, cell->value3);
- break;
- case 2:
- printf("LTE : tac=%d, PCI=%d, dlEuarfcn=%d, ulEuarfcn=%d, band=%d\n", cell->value1, cell->value2, cell->value3, cell->value4, cell->value5);
- break;
- default:
- break;
- }
- }
- while ((cell = (mbtk_cell_info_t*) list_next(cell_list)))
+ } else if(cell.num > 0){
+ // Current server cell.
+ switch(cell.type)
{
- switch(type)
+ case MBTK_CELL_TYPE_GSM:
+ printf("GSM : lac=%d, ci=%d, arfcn=%d, bsic=%d\n", cell.cell[0].value1, cell.cell[0].value2, cell.cell[0].value3, cell.cell[0].value4);
+ break;
+ case MBTK_CELL_TYPE_UMTS:
+ printf("UMTS : lac=%d, ci=%d, arfcn=%d\n", cell.cell[0].value1, cell.cell[0].value2, cell.cell[0].value3);
+ break;
+ 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;
+ default:
+ break;
+ }
+
+ int i = 1;
+ while (i < cell.num)
+ {
+ switch(cell.type)
{
- case 0:
- printf("CELL : %d, %d, %d, %d, %d", cell->value1, cell->value2, cell->value3, cell->value4, cell->value5);
+ case MBTK_CELL_TYPE_GSM:
+ printf("CELL : %d, %d, %d, %d, %d", cell.cell[i].value1, cell.cell[i].value2, cell.cell[i].value3, cell.cell[i].value4, cell.cell[i].value5);
break;
- case 1:
- printf("CELL : lac=%d, ci=%d, arfcn=%d\n", cell->value1, cell->value2, cell->value3);
+ case MBTK_CELL_TYPE_UMTS:
+ printf("CELL : lac=%d, ci=%d, arfcn=%d\n", cell.cell[i].value1, cell.cell[i].value2, cell.cell[i].value3);
break;
- case 2:
- printf("CELL : phyCellId=%d, euArfcn=%d, rsrp=%d, rsrq=%d\n", cell->value1, cell->value2, cell->value3, cell->value4);
+ 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;
default:
break;
}
+ i++;
}
+ } else {
+ printf("Cell no found.");
}
- list_free(cell_list);
}
else{
char *ptr = strstr(cmd, ","); //cell,2,3,,40936,430
@@ -763,15 +760,15 @@
printf("cell_mem: %s \n", mem);
memset(resp, 0, sizeof(resp));
- err = mbtk_cell_set(info_handle, mem, resp);
+ err = mbtk_cell_set(mem, resp);
if(err) {
printf("Error : %d\n", err);
} else {
printf("cell set . resp:%s\n", resp);
}
-
}
- } else if(!strncasecmp(cmd, "call", 4)){
+ }
+ else if(!strncasecmp(cmd, "call", 4)){
char phone_number[12];
char *ptr = strstr(cmd, " ");
if(ptr == NULL)
@@ -781,14 +778,14 @@
memset(phone_number,0,strlen(phone_number));
memcpy(phone_number,ptr,strlen(ptr));
printf("phone number is: %s\n",phone_number);
- err = mbtk_call_start(info_handle, phone_number);
+ err = mbtk_call_start(phone_number);
if(err) {
printf("Error : %d\n", err);
} else {
printf("Call success.\n");
}
} else if(!strncasecmp(cmd, "answer", 6)){
- err = mbtk_call_answer(info_handle);
+ err = mbtk_call_answer();
if(err) {
printf("Error : %d\n", err);
} else {
@@ -797,21 +794,21 @@
} else if(!strncasecmp(cmd, "hangup", 6)){
int phone_id;
if(!strcasecmp(cmd, "hangup")) { // hang up all
- err = mbtk_call_hang(info_handle);
+ err = mbtk_call_hang();
if(err) {
printf("Error : %d\n", err);
} else {
printf("Call hang up all.\n");
}
} else if(!strcasecmp(cmd, "hangup 0")) {
- err = mbtk_waiting_or_background_call_hang(info_handle);
+ err = mbtk_waiting_or_background_call_hang();
if(err) {
printf("Error : %d\n", err);
} else {
printf("Call hang up waiting or background.\n");
}
} else if(!strcasecmp(cmd, "hangup 3")) {
- err = mbtk_foreground_resume_background_call_hang(info_handle);
+ err = mbtk_foreground_resume_background_call_hang();
if(err) {
printf("Error : %d\n", err);
} else {
@@ -825,7 +822,7 @@
} else {
printf("Error : Invalid input\n");
}
- err = mbtk_a_call_hang(info_handle, phone_id);
+ err = mbtk_a_call_hang(phone_id);
if(err) {
printf("Error : %d\n", err);
} else {
@@ -834,7 +831,7 @@
}
} else if(!strncasecmp(cmd, "waitin", 6)){
mbtk_call_info_t reg;
- err = mbtk_call_reg_get(info_handle, ®);
+ err = mbtk_call_reg_get(®);
if(err) {
printf("Error : %d\n", err);
} else {
@@ -848,7 +845,7 @@
} else if(!strncasecmp(cmd, "mute", 4)){ // "mute" or "mute 0" or "mute 1"
int mute;
if(!strcasecmp(cmd, "mute")) { // Get
- err = mbtk_mute_state_get(info_handle, &mute);
+ err = mbtk_mute_state_get(&mute);
if(err) {
printf("Error : %d\n", err);
} else {
@@ -860,7 +857,7 @@
} else { // off mute
mute = 0;
}
- err = mbtk_mute_state_set(info_handle, mute);
+ err = mbtk_mute_state_set(mute);
if(err) {
printf("Error : %d\n", err);
} else {
@@ -885,13 +882,313 @@
ptr++;
reg.duration = (uint32)atoi(ptr);
printf("DTMF character is: %c,%d\n",reg.character, reg.duration);
- err = mbtk_dtmf_send(info_handle, ®);
+ err = mbtk_dtmf_send(®);
if(err) {
printf("Error : %d\n", err);
} else {
printf("DTMF success.\n");
}
- } else if(!strncasecmp(cmd, "shutdown", 8)){
+ } else if(!strncasecmp(cmd, "cmgf", 4)){ // set mode 0: pud, 1:text
+ int mode;
+ if(!strcasecmp(cmd, "cmgf")) { // Get
+ err = mbtk_sms_cmgf_get(&mode);
+ if(err) {
+ printf("Error : %d\n", err);
+ } else {
+ printf("VoLTE : %d\n", mode);
+ }
+ } else { // Set
+ if(!strcasecmp(cmd, "cmgf 1")) { // cmgf 1
+ mode = 1;
+ } else { //
+ mode = 0;
+ }
+ printf("mode:%d\n", mode);
+ sleep(2);
+ err = mbtk_sms_cmgf_set(mode);
+ if(err) {
+ printf("Error : %d\n", err);
+ } else {
+ printf("VoLTE set success\n");
+ }
+ }
+ }else if(!strncasecmp(cmd, "cpms", 4)){ // //CPMS=ME, ME, ME
+ char mem[100] = {0};
+ char resp[100] = {0};
+ if(!strcasecmp(cmd, "cpms")) { // Get
+ err = mbtk_sms_cpms_get(&mem);
+ if(err) {
+ printf("Error : %d\n", err);
+ } else {
+ printf("cpms : %s\n", mem);
+ }
+ } else { // Set
+
+ char *ptr = strstr(cmd, ","); //CPMS,ME,ME,ME
+ if(ptr != NULL)
+ {
+ ptr++;
+ memset(mem, 0, sizeof(mem));
+ memcpy(mem, ptr, strlen(ptr));
+ printf("cpms:%s\n", mem);
+ }
+ printf("cpms 0\n");
+
+ memset(resp, 0, sizeof(resp));
+ err = mbtk_sms_cpms_set(mem, resp);
+ if(err) {
+ printf("Error : %d\n", err);
+ } else {
+ printf("cpms set success. resp:%s\n", resp);
+ }
+ }
+ }else if(!strncasecmp(cmd, "cmgs", 4)){ // AT+CMGS="10086", CMGS TEST
+ char cmgs[1024] = {0};
+ char resp[50] = {0};
+ if(!strcasecmp(cmd, "cmgs")) { // Get
+ int mode;
+ // err = mbtk_sms_cmgs_get(info_handle, &mode);
+ if(err) {
+ printf("Error : %d\n", err);
+ } else {
+ printf("VoLTE : %d\n", mode);
+ }
+ } else { // Set
+
+ /*
+ *AT+CMGS="10086", CMGS TEST // Send a SMS
+ > CMGS TEST
+ +CMGS: 17
+ OK
+ */
+
+ char *ptr = strstr(cmd, "cmgs,"); //CMGS="10086",hf
+ if(ptr != NULL)
+ {
+ ptr = strstr(cmd, ",");
+ ptr++;
+ memset(cmgs, 0, sizeof(cmgs));
+ memcpy(cmgs, ptr, strlen(ptr));
+ printf("1cmgs:%s, strlen(cmgs):%d\n", cmgs, strlen(cmgs));
+ }
+
+ memset(resp, 0, sizeof(resp));
+ err = mbtk_sms_cmgs_set(cmgs, resp);
+ if(err) {
+ printf("Error : %d\n", err);
+ } else {
+ printf("cmgs set success . resp:%s\n", resp);
+ }
+ }
+ }else if(!strncasecmp(cmd, "cmss", 4)){ // +CMSS=<index>[,<da>[,<toda>]]
+ char cmss[20] = {0};
+ char resp[20] = {0};
+ if(!strcasecmp(cmd, "cmgs")) { // Get
+ printf("cmss : OK\n");
+
+ } else {
+ char *ptr = strstr(cmd, "cmss,"); //CMSS=<index>
+ if(ptr != NULL)
+ {
+ ptr = strstr(cmd, ",");
+ ptr++;
+ memset(cmss, 0, sizeof(cmss));
+ memcpy(cmss, ptr, strlen(ptr));
+ printf("1cmss:%s\n", cmss);
+ }
+
+
+ err = mbtk_sms_cmss_set(cmss, resp);
+ if(err) {
+ printf("Error : %d\n", err);
+ } else {
+ printf("cmss set success. resp:%s\n", resp);
+ }
+ }
+ }
+ else if(!strncasecmp(cmd, "cmgr", 4)){ // +CMGR=<index
+ int index = 0;
+ char resp[1024] = {0};
+ if(!strcasecmp(cmd, "cmgr")) { // Get
+ printf("cmgr : OK\n");
+
+ } else {
+ char *ptr = strstr(cmd, "cmgr,"); //+CMGR <index>
+ if(ptr != NULL)
+ {
+ ptr = strstr(cmd, ",");
+ ptr++;
+ index = atoi(ptr);
+ }
+ printf("1index:%d\n", index);
+
+ memset(resp, 0, sizeof(resp));
+ err = mbtk_sms_cmgr_set(index, resp);
+ if(err) {
+ printf("Error : %d\n", err);
+ } else {
+ printf("cmgr set success. rep:%s\n", resp);
+ }
+ }
+ }
+ else if(!strncasecmp(cmd, "cmgw", 4)){ // +CMGW=<oa/da>[,<tooa/toda>[,<stat>]]<CR>
+ //+CMGW=<length>[,<stat>]<CR>PDU is given<ctrl-Z/ESC>
+ char cmgw[128] = {0};
+ char resp[50] = {0};
+ if(!strcasecmp(cmd, "cmgw")) { // Get
+ printf("cmgw : OK\n");
+
+ } else {
+ char *ptr = strstr(cmd, "cmgw,"); //+CMGW, <oa/da>, data
+ if(ptr != NULL)
+ {
+ ptr = strstr(cmd, ",");
+ ptr++;
+ memset(cmgw, 0, sizeof(cmgw));
+ memcpy(cmgw, ptr, strlen(ptr));
+ printf("cmgw:%s\n", cmgw);
+ }
+
+ memset(resp, 0, sizeof(resp));
+ err = mbtk_sms_cmgw_set(cmgw, resp);
+ if(err) {
+ printf("Error : %d\n", err);
+ } else {
+ printf("cmgw set success. resp:%s\n", resp);
+ }
+ }
+ }
+ else if(!strncasecmp(cmd, "cmgd", 4)){ // +CMGD=<index>[,<delflag>
+ //
+ char cmgd[128] = {0};
+ if(!strcasecmp(cmd, "cmgd")) { // Get
+ printf("cmgd : OK\n");
+
+ } else {
+ char *ptr = strstr(cmd, ","); //+CMGD=<index>[,<delflag>
+ if(ptr != NULL)
+ {
+ ptr++;
+ memset(cmgd, 0, sizeof(cmgd));
+ memcpy(cmgd, ptr, strlen(ptr));
+ printf("1cmgd:%s\n", cmgd);
+ }
+
+
+ err = mbtk_sms_cmgd_set(cmgd);
+ if(err) {
+ printf("Error : %d\n", err);
+ } else {
+ printf("VoLTE set success\n");
+ }
+ }
+ }
+ else if(!strncasecmp(cmd, "cmgl", 4)){ // AT+CMGL[=<stat>]
+ //
+ char cmgl[128] = {0};
+ char resp[5*1024] ={0};
+ if(!strcasecmp(cmd, "cmgl")) { // Get
+ printf("cmgl : OK\n");
+
+ } else {
+ char *ptr = strstr(cmd, "cmgl,"); // AT+CMGL[=<stat>]
+ if(ptr != NULL)
+ {
+ ptr = strstr(cmd, ",");
+ ptr++;
+ memset(cmgl, 0, sizeof(cmgl));
+ memcpy(cmgl, ptr, strlen(ptr));
+ printf("0cmgl:%s\n", cmgl);
+ }
+
+ memset(resp, 0, sizeof(resp));
+ err = mbtk_sms_cmgl_set(cmgl, resp);
+ if(err) {
+ printf("Error : %d\n", err);
+ } else {
+ // printf("cmgl set success, reg:%s\n",resp);
+ }
+ }
+ }
+ else if(!strncasecmp(cmd, "csca", 4)){ // AT+CSCA=<number> [,<type>]
+ //
+ char csca[128] = {0};
+ if(!strcasecmp(cmd, "csca")) { // Get
+ err = mbtk_sms_csca_get(csca);
+ if(err) {
+ printf("mbtk_sms_csca_get Error : %d\n", err);
+ } else {
+ printf("mbtk_sms_csca_get success\n");
+ }
+
+ } else {
+ char *ptr = strstr(cmd, ","); // AT+CSCA=<number> [,<type>]
+ if(ptr != NULL)
+ {
+ ptr++;
+ memset(csca, 0, sizeof(csca));
+ memcpy(csca, ptr, strlen(ptr));
+ printf("csca:%s\n", csca);
+ }
+
+ err = mbtk_sms_csca_set(csca);
+ if(err) {
+ printf("Error : %d\n", err);
+ } else {
+ printf("VoLTE set success\n");
+ }
+ }
+ }
+ else if(!strncasecmp(cmd, "csmp", 4)){ // AT+CSMP=[<fo>[,<vp>[,<pid>[,<dcs>]]]]
+ //
+ char csmp[128] = {0};
+ if(!strcasecmp(cmd, "csmp")) { // Get
+ printf("cmgl : OK\n");
+
+ } else {
+ char *ptr = strstr(cmd, ","); // AT+CSMP=[<fo>[,<vp>[,<pid>[,<dcs>]]]]
+ if(ptr != NULL)
+ {
+ ptr++;
+ memset(csmp, 0, sizeof(csmp));
+ memcpy(csmp, ptr, strlen(ptr));
+ printf("csmp:%s\n", csmp);
+ }
+
+ err = mbtk_sms_csmp_set(csmp);
+ if(err) {
+ printf("Error : %d\n", err);
+ } else {
+ printf("VoLTE set success\n");
+ }
+ }
+ }
+ else if(!strncasecmp(cmd, "cscb", 4)){ // AT+CSCB=<[<mode>[,<mids>[,<dcss>]]]>
+ //
+ char cscb[128] = {0};
+ if(!strcasecmp(cmd, "cscb")) { // Get
+ printf("cmgl : OK\n");
+
+ } else {
+ char *ptr = strstr(cmd, ","); // AT+CSCB=<[<mode>[,<mids>[,<dcss>]]]>
+ if(ptr != NULL)
+ {
+ ptr++;
+ memset(cscb, 0, sizeof(cscb));
+ memcpy(cscb, ptr, strlen(ptr));
+ printf("cscb:%s\n", cscb);
+ }
+
+ err = mbtk_sms_cscb_set(cscb);
+ if(err) {
+ printf("Error : %d\n", err);
+ } else {
+ printf("VoLTE set success\n");
+ }
+ }
+ }
+#if 0
+ else if(!strncasecmp(cmd, "shutdown", 8)){
if(!strcasecmp(cmd, "shutdown 0")) {
err = mbtk_system_reboot(0);
if(err) {
@@ -965,51 +1262,6 @@
printf("Time type:%d.\n", time_type);
}
}
- } else if(!strncasecmp(cmd, "apn", 3)){
- if(!strcasecmp(cmd, "apn")) { // Get apn
- #define APN_MAX 10
- mbtk_apn_info_t apns[APN_MAX];
- int apn_num = APN_MAX;
- err = mbtk_apn_get(info_handle, &apn_num, apns);
- if(err) {
- printf("Error : %d\n", err);
- } else {
- printf("APN Num:%d\n", apn_num);
- int i = 0;
- while(i < apn_num) {
- printf("APN : %d, %s, %s\n", apns[i].cid, apn2str(apns[i].ip_type), apns[i].apn);
- i++;
- }
- }
- } else { // apn <cid> <0/1/2/3> <apn>
- char *ptr = strstr(cmd, " ");
- if(ptr == NULL)
- continue;
- while(*ptr != '\0' && *ptr == ' ')
- ptr++;
- int cid = atoi(ptr);
-
- ptr = strstr(ptr, " ");
- if(ptr == NULL)
- continue;
- while(*ptr != '\0' && *ptr == ' ')
- ptr++;
- mbtk_ip_type_enum ip_type = (mbtk_ip_type_enum)atoi(ptr);
-
- ptr = strstr(ptr, " ");
- if(ptr == NULL)
- continue;
- while(*ptr != '\0' && *ptr == ' ')
- ptr++;
- char *apn = ptr;
-
- err = mbtk_apn_set(info_handle, cid, ip_type, apn, NULL, NULL, NULL);
- if(err) {
- printf("Error : %d\n", err);
- } else {
- printf("APN set success\n");
- }
- }
} else if(!strncasecmp(cmd, "data_call", 9)){ // data_call <0/1/2> <cid> <timeout>
// data_call <0/1/2> <cid> <timeout>
char *ptr = strstr(cmd, " ");
@@ -1128,335 +1380,6 @@
} else {
printf("DATA_CALL success\n");
}
- }else if(!strncasecmp(cmd, "cmgf", 4)){ // set mode 0: pud, 1:text
- int mode;
- if(!strcasecmp(cmd, "cmgf")) { // Get
- err = mbtk_sms_cmgf_get(info_handle, &mode);
- if(err) {
- printf("Error : %d\n", err);
- } else {
- printf("VoLTE : %d\n", mode);
- }
- } else { // Set
- if(!strcasecmp(cmd, "cmgf 1")) { // cmgf 1
- mode = 1;
- } else { //
- mode = 0;
- }
- printf("mode:%d\n", mode);
- sleep(2);
- err = mbtk_sms_cmgf_set(info_handle, mode);
- if(err) {
- printf("Error : %d\n", err);
- } else {
- printf("VoLTE set success\n");
- }
- }
- }else if(!strncasecmp(cmd, "cpms", 4)){ // //CPMS=ME, ME, ME
- char mem[100] = {0};
- char resp[100] = {0};
- if(!strcasecmp(cmd, "cpms")) { // Get
- err = mbtk_sms_cpms_get(info_handle, &mem);
- if(err) {
- printf("Error : %d\n", err);
- } else {
- printf("cpms : %s\n", mem);
- }
- } else { // Set
-
- char *ptr = strstr(cmd, ","); //CPMS,ME,ME,ME
- if(ptr != NULL)
- {
- ptr++;
- memset(mem, 0, sizeof(mem));
- memcpy(mem, ptr, strlen(ptr));
- printf("cpms:%s\n", mem);
- }
- printf("cpms 0\n");
-
- memset(resp, 0, sizeof(resp));
- err = mbtk_sms_cpms_set(info_handle, mem, resp);
- if(err) {
- printf("Error : %d\n", err);
- } else {
- printf("cpms set success. resp:%s\n", resp);
- }
- }
- }else if(!strncasecmp(cmd, "cmgs", 4)){ // AT+CMGS="10086", CMGS TEST
- char cmgs[1024] = {0};
- char resp[50] = {0};
- if(!strcasecmp(cmd, "cmgs")) { // Get
- int mode;
- // err = mbtk_sms_cmgs_get(info_handle, &mode);
- if(err) {
- printf("Error : %d\n", err);
- } else {
- printf("VoLTE : %d\n", mode);
- }
- } else { // Set
-
- /*
- *AT+CMGS="10086", CMGS TEST // Send a SMS
- > CMGS TEST
- +CMGS: 17
- OK
- */
-
- char *ptr = strstr(cmd, "cmgs,"); //CMGS="10086",hf
- if(ptr != NULL)
- {
- ptr = strstr(cmd, ",");
- ptr++;
- memset(cmgs, 0, sizeof(cmgs));
- memcpy(cmgs, ptr, strlen(ptr));
- printf("1cmgs:%s, strlen(cmgs):%d\n", cmgs, strlen(cmgs));
- }
-
- memset(resp, 0, sizeof(resp));
- err = mbtk_sms_cmgs_set(info_handle, cmgs, resp);
- if(err) {
- printf("Error : %d\n", err);
- } else {
- printf("cmgs set success . resp:%s\n", resp);
- }
- }
- }else if(!strncasecmp(cmd, "cmss", 4)){ // +CMSS=<index>[,<da>[,<toda>]]
- char cmss[20] = {0};
- char resp[20] = {0};
- if(!strcasecmp(cmd, "cmgs")) { // Get
- printf("cmss : OK\n");
-
- } else {
- char *ptr = strstr(cmd, "cmss,"); //CMSS=<index>
- if(ptr != NULL)
- {
- ptr = strstr(cmd, ",");
- ptr++;
- memset(cmss, 0, sizeof(cmss));
- memcpy(cmss, ptr, strlen(ptr));
- printf("1cmss:%s\n", cmss);
- }
-
-
- err = mbtk_sms_cmss_set(info_handle, cmss, resp);
- if(err) {
- printf("Error : %d\n", err);
- } else {
- printf("cmss set success. resp:%s\n", resp);
- }
- }
- }
- else if(!strncasecmp(cmd, "cmgr", 4)){ // +CMGR=<index
- int index = 0;
- char resp[1024] = {0};
- if(!strcasecmp(cmd, "cmgr")) { // Get
- printf("cmgr : OK\n");
-
- } else {
- char *ptr = strstr(cmd, "cmgr,"); //+CMGR <index>
- if(ptr != NULL)
- {
- ptr = strstr(cmd, ",");
- ptr++;
- index = atoi(ptr);
- }
- printf("1index:%d\n", index);
-
- memset(resp, 0, sizeof(resp));
- err = mbtk_sms_cmgr_set(info_handle, index, resp);
- if(err) {
- printf("Error : %d\n", err);
- } else {
- printf("cmgr set success. rep:%s\n", resp);
- }
- }
- }
- else if(!strncasecmp(cmd, "cmgw", 4)){ // +CMGW=<oa/da>[,<tooa/toda>[,<stat>]]<CR>
- //+CMGW=<length>[,<stat>]<CR>PDU is given<ctrl-Z/ESC>
- char cmgw[128] = {0};
- char resp[50] = {0};
- if(!strcasecmp(cmd, "cmgw")) { // Get
- printf("cmgw : OK\n");
-
- } else {
- char *ptr = strstr(cmd, "cmgw,"); //+CMGW, <oa/da>, data
- if(ptr != NULL)
- {
- ptr = strstr(cmd, ",");
- ptr++;
- memset(cmgw, 0, sizeof(cmgw));
- memcpy(cmgw, ptr, strlen(ptr));
- printf("cmgw:%s\n", cmgw);
- }
-
- memset(resp, 0, sizeof(resp));
- err = mbtk_sms_cmgw_set(info_handle, cmgw, resp);
- if(err) {
- printf("Error : %d\n", err);
- } else {
- printf("cmgw set success. resp:%s\n", resp);
- }
- }
- }
- else if(!strncasecmp(cmd, "cmgd", 4)){ // +CMGD=<index>[,<delflag>
- //
- char cmgd[128] = {0};
- if(!strcasecmp(cmd, "cmgd")) { // Get
- printf("cmgd : OK\n");
-
- } else {
- char *ptr = strstr(cmd, ","); //+CMGD=<index>[,<delflag>
- if(ptr != NULL)
- {
- ptr++;
- memset(cmgd, 0, sizeof(cmgd));
- memcpy(cmgd, ptr, strlen(ptr));
- printf("1cmgd:%s\n", cmgd);
- }
-
-
- err = mbtk_sms_cmgd_set(info_handle, cmgd);
- if(err) {
- printf("Error : %d\n", err);
- } else {
- printf("VoLTE set success\n");
- }
- }
- }
- else if(!strncasecmp(cmd, "cmgl", 4)){ // AT+CMGL[=<stat>]
- //
- char cmgl[128] = {0};
- char resp[5*1024] ={0};
- if(!strcasecmp(cmd, "cmgl")) { // Get
- printf("cmgl : OK\n");
-
- } else {
- char *ptr = strstr(cmd, "cmgl,"); // AT+CMGL[=<stat>]
- if(ptr != NULL)
- {
- ptr = strstr(cmd, ",");
- ptr++;
- memset(cmgl, 0, sizeof(cmgl));
- memcpy(cmgl, ptr, strlen(ptr));
- printf("0cmgl:%s\n", cmgl);
- }
-
- memset(resp, 0, sizeof(resp));
- err = mbtk_sms_cmgl_set(info_handle, cmgl, resp);
- if(err) {
- printf("Error : %d\n", err);
- } else {
- // printf("cmgl set success, reg:%s\n",resp);
- }
- }
- }
- else if(!strncasecmp(cmd, "csca", 4)){ // AT+CSCA=<number> [,<type>]
- //
- char csca[128] = {0};
- if(!strcasecmp(cmd, "csca")) { // Get
- err = mbtk_sms_csca_get(info_handle, csca);
- if(err) {
- printf("mbtk_sms_csca_get Error : %d\n", err);
- } else {
- printf("mbtk_sms_csca_get success\n");
- }
-
- } else {
- char *ptr = strstr(cmd, ","); // AT+CSCA=<number> [,<type>]
- if(ptr != NULL)
- {
- ptr++;
- memset(csca, 0, sizeof(csca));
- memcpy(csca, ptr, strlen(ptr));
- printf("csca:%s\n", csca);
- }
-
- err = mbtk_sms_csca_set(info_handle, csca);
- if(err) {
- printf("Error : %d\n", err);
- } else {
- printf("VoLTE set success\n");
- }
- }
- }
- else if(!strncasecmp(cmd, "csmp", 4)){ // AT+CSMP=[<fo>[,<vp>[,<pid>[,<dcs>]]]]
- //
- char csmp[128] = {0};
- if(!strcasecmp(cmd, "csmp")) { // Get
- printf("cmgl : OK\n");
-
- } else {
- char *ptr = strstr(cmd, ","); // AT+CSMP=[<fo>[,<vp>[,<pid>[,<dcs>]]]]
- if(ptr != NULL)
- {
- ptr++;
- memset(csmp, 0, sizeof(csmp));
- memcpy(csmp, ptr, strlen(ptr));
- printf("csmp:%s\n", csmp);
- }
-
- err = mbtk_sms_csmp_set(info_handle, csmp);
- if(err) {
- printf("Error : %d\n", err);
- } else {
- printf("VoLTE set success\n");
- }
- }
- }
- else if(!strncasecmp(cmd, "cscb", 4)){ // AT+CSCB=<[<mode>[,<mids>[,<dcss>]]]>
- //
- char cscb[128] = {0};
- if(!strcasecmp(cmd, "cscb")) { // Get
- printf("cmgl : OK\n");
-
- } else {
- char *ptr = strstr(cmd, ","); // AT+CSCB=<[<mode>[,<mids>[,<dcss>]]]>
- if(ptr != NULL)
- {
- ptr++;
- memset(cscb, 0, sizeof(cscb));
- memcpy(cscb, ptr, strlen(ptr));
- printf("cscb:%s\n", cscb);
- }
-
- err = mbtk_sms_cscb_set(info_handle, cscb);
- if(err) {
- printf("Error : %d\n", err);
- } else {
- printf("VoLTE set success\n");
- }
- }
- }
- else if(!strncasecmp(cmd, "ims_en", 6)){ // ims_en 0/1
- char enable[10] = {0};
- if(1 == sscanf(cmd, "ims_en %s", enable)) {
- err = mbtk_net_ims_set(info_handle, atoi(enable) ? 1 : 0);
- if(err) {
- printf("Set IMS fail : %d\n", err);
- } else {
- printf("Set IMS success\n");
- }
- } else {
- printf("ARG error\n");
- }
- }
- else if(!strncasecmp(cmd, "ims_state", 9)){ // ims_state
- int enable = 0;
- err = mbtk_net_ims_get(info_handle, &enable);
- if(err) {
- printf("Get IMS state fail : %d\n", err);
- } else {
- printf("IMS state : %d\n", enable);
- }
- }
- else if(!strncasecmp(cmd, "ims_reg", 7)){ // ims_reg
- int reg = 0;
- err = mbtk_net_ims_reg_state_get(info_handle, ®);
- if(err) {
- printf("Get IMS register state fail : %d\n", err);
- } else {
- printf("IMS register state : %d\n", reg);
- }
}
#endif
else if(!strcasecmp(cmd, "h") || !strcasecmp(cmd, "help")) {