rjw | 1f88458 | 2022-01-06 17:20:42 +0800 | [diff] [blame^] | 1 | /* Copyright Statement: |
| 2 | * |
| 3 | * This software/firmware and related documentation ("MediaTek Software") are |
| 4 | * protected under relevant copyright laws. The information contained herein |
| 5 | * is confidential and proprietary to MediaTek Inc. and/or its licensors. |
| 6 | * Without the prior written permission of MediaTek inc. and/or its licensors, |
| 7 | * any reproduction, modification, use or disclosure of MediaTek Software, |
| 8 | * and information contained herein, in whole or in part, shall be strictly prohibited. |
| 9 | */ |
| 10 | /* MediaTek Inc. (C) 2010. All rights reserved. |
| 11 | * |
| 12 | * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES |
| 13 | * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE") |
| 14 | * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER ON |
| 15 | * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES, |
| 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF |
| 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT. |
| 18 | * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE |
| 19 | * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR |
| 20 | * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES TO LOOK ONLY TO SUCH |
| 21 | * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. RECEIVER EXPRESSLY ACKNOWLEDGES |
| 22 | * THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES |
| 23 | * CONTAINED IN MEDIATEK SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK |
| 24 | * SOFTWARE RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR |
| 25 | * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND |
| 26 | * CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE, |
| 27 | * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE, |
| 28 | * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY RECEIVER TO |
| 29 | * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. |
| 30 | * |
| 31 | * The following software/firmware and/or related documentation ("MediaTek Software") |
| 32 | * have been modified by MediaTek Inc. All revisions are subject to any receiver's |
| 33 | * applicable license agreements with MediaTek Inc. |
| 34 | */ |
| 35 | #include "em/em.h" |
| 36 | |
| 37 | #include <vendor-ril/telephony/ril.h> |
| 38 | #include <stdlib.h> |
| 39 | #include <stdio.h> |
| 40 | #include <cutils/jstring.h> |
| 41 | #include <log/log.h> |
| 42 | #include <unistd.h> |
| 43 | #include <math.h> |
| 44 | #include "common.h" |
| 45 | |
| 46 | #if EM_MODE_SUPPORT |
| 47 | |
| 48 | #undef LOG_TAG |
| 49 | #define LOG_TAG "EM_ENTRY" |
| 50 | |
| 51 | #define NUM_ITEMS(a) (sizeof (a) / sizeof (a)[0]) |
| 52 | em_arry_t lte_info[] = { |
| 53 | //{"4G ERRC Misc Info",0,NULL,1,1}, |
| 54 | //{"4G LTE Support Band",0,NULL,1,1}, |
| 55 | //{"4G Active Intra-RAT Meas (LTE)",0,NULL,1,1}, |
| 56 | //{"4G Active Inter-RAT Meas (UMTS)",0,NULL,1,1}, |
| 57 | //{"4G Active Inter-RAT Meas (GSM)",0,NULL,1,1}, |
| 58 | //{"4G SIB Receive Status",0,NULL,1,1}, |
| 59 | //{"4G CSG Autonomous Search",0,NULL,1,1}, |
| 60 | //{"4G Config Info",0,NULL,1,1}, |
| 61 | //{"ESM",0,NULL,1,1}, |
| 62 | //{"EMM",0,NULL,1,1}, |
| 63 | //{"MMDC",0,NULL,1,1}, |
| 64 | {"EL1",0,NULL,1,1}, |
| 65 | //{"Timer Information",0,NULL,1,1}, |
| 66 | //{"TDD TAS",0,NULL,1,1}, |
| 67 | //{"GSM TAS",0,NULL,1,1}, |
| 68 | //{"WCDMA TAS",0,NULL,1,1}, |
| 69 | //{"LTE TAS",0,NULL,1,1}, |
| 70 | }; |
| 71 | em_arry_t ims_setting[] = { |
| 72 | {"get",0,NULL,0,0}, |
| 73 | {"set",0,NULL,0,0}, |
| 74 | }; |
| 75 | em_arry_t ims_common[] = { |
| 76 | {"operator_code",2,ims_setting,0,0}, |
| 77 | {"sms_support",2,ims_setting,0,0}, |
| 78 | {"voice_support",2,ims_setting,0,0} |
| 79 | }; |
| 80 | em_arry_t ims_call[] = { |
| 81 | {"UA_call_codec_order1",2,ims_setting,0,0}, |
| 82 | {"UA_call_codec_order2",2,ims_setting,0,0}, |
| 83 | {"UA_call_codec_order3",2,ims_setting,0,0}, |
| 84 | {"silence_dropcall_threshold",2,ims_setting,0,0}, |
| 85 | {"jbm_load_params_enable",2,ims_setting,0,0}, |
| 86 | {"jbm_prebuf_len",2,ims_setting,0,0}, |
| 87 | }; |
| 88 | em_arry_t ims_registration[] = { |
| 89 | {"emergency_reg_retain_timer",2,ims_setting,0,0}, |
| 90 | {"UA_reg_auth_password",2,ims_setting,0,0}, |
| 91 | {"UA_reg_auth_name",2,ims_setting,0,0}, |
| 92 | {"VoLTE_Setting_SIP_TCP_On_Demand",2,ims_setting,0,0}, |
| 93 | }; |
| 94 | em_arry_t ims[] = { |
| 95 | {"Common",NUM_ITEMS(ims_common),ims_common,1,1}, |
| 96 | {"Call",NUM_ITEMS(ims_call),ims_call,1,1}, |
| 97 | {"Registration",NUM_ITEMS(ims_registration),ims_registration,1,1}, |
| 98 | }; |
| 99 | em_arry_t gprs[] = { |
| 100 | {"ATTACH",0,NULL,1,1}, |
| 101 | {"DETACH",0,NULL,1,1}, |
| 102 | {"ATTACH_CONTINUE",0,NULL,1,1}, |
| 103 | {"DETACH_CONTINUE",0,NULL,1,1}, |
| 104 | {"SELECT_ATTACH_TYPE_1",0,NULL,1,1}, |
| 105 | {"SELECT_ATTACH_TYPE_0",0,NULL,1,1}, |
| 106 | }; |
| 107 | em_arry_t networkselection[] = { |
| 108 | {"GSM/WCDMA (WCDMA preferred)",0,NULL,1,1}, |
| 109 | {"GSM only",0,NULL,1,1}, |
| 110 | {"WCDMA only",0,NULL,1,1}, |
| 111 | {"GSM/WCDMA (auto)",0,NULL,1,1}, |
| 112 | {"LTE only",0,NULL,1,1}, |
| 113 | {"4G/3G/2G(auto)",0,NULL,1,1}, |
| 114 | {"4G/3G",0,NULL,1,1}, |
| 115 | }; |
| 116 | em_arry_t modem_cta[] = { |
| 117 | {"Integrity Check",0,NULL,1,1}, |
| 118 | {"RLC TL1",0,NULL,1,1}, |
| 119 | {"K1297",0,NULL,1,1}, |
| 120 | {"SN Conflict",0,NULL,1,1}, |
| 121 | {"CF query",0,NULL,1,1}, |
| 122 | {"DLMN lock",0,NULL,1,1}, |
| 123 | {"Measurement open",0,NULL,1,1}, |
| 124 | {"Disable DPA",0,NULL,1,1}, |
| 125 | {"Intra CMR",0,NULL,1,1}, |
| 126 | }; |
| 127 | em_arry_t modem_fta[] = { |
| 128 | {"ANITE",0,NULL,1,1}, |
| 129 | {"CRTUG",0,NULL,1,1}, |
| 130 | {"CRTUW",0,NULL,1,1}, |
| 131 | {"ANRITSU",0,NULL,1,1}, |
| 132 | {"CMW500",0,NULL,1,1}, |
| 133 | }; |
| 134 | em_arry_t modem_C2K_Test_MODEM[] = { |
| 135 | { "NONE", 0, NULL, 1, 1 }, |
| 136 | { "SPIRENT", 0,NULL, 1, 1 }, |
| 137 | }; |
| 138 | em_arry_t modemtest[] = { |
| 139 | {"NONE",0,NULL,1,1}, |
| 140 | {"CTA",NUM_ITEMS(modem_cta),modem_cta,1,1}, |
| 141 | {"FTA",NUM_ITEMS(modem_fta),modem_fta,1,1}, |
| 142 | {"IOT",0,NULL,1,1}, |
| 143 | {"OPERATOR",0,NULL,1,1}, |
| 144 | {"FACTORY",0,NULL,1,1}, |
| 145 | {"CDMA Test Mode", NUM_ITEMS(modem_C2K_Test_MODEM),modem_C2K_Test_MODEM,1,1}, |
| 146 | }; |
| 147 | em_arry_t hspa[] = { |
| 148 | {"QUERY",0,NULL,1,1}, |
| 149 | }; |
| 150 | em_arry_t cfu[] = { |
| 151 | {"Default",0,NULL,1,1}, |
| 152 | {"Always query",0,NULL,1,1}, |
| 153 | {"Always not query",0,NULL,1,1}, |
| 154 | }; |
| 155 | em_arry_t bandmode[] = { |
| 156 | {"getcurrentband",0,NULL,1,1}, |
| 157 | {"setBand(eg: 1.1=1 add band, 1.1=0 remove band) or getSupportBand",0,NULL,1,1}, |
| 158 | }; |
| 159 | em_arry_t networkinfo[] = { |
| 160 | {"RR Cell Sel",0,NULL,1,1}, |
| 161 | {"RR Ch Dscr",0,NULL,1,1}, |
| 162 | {"RR Ctrl chan",0,NULL,1,1}, |
| 163 | {"RR RACH Ctrl",0,NULL,1,1}, |
| 164 | {"RR LAI Info",0,NULL,1,1}, |
| 165 | {"RR Radio Link",0,NULL,1,1}, |
| 166 | {"RR Meas Rep",0,NULL,1,1}, |
| 167 | {"RR Ca List",0,NULL,1,1}, |
| 168 | {"RR Control Msg",0,NULL,1,1}, |
| 169 | {"RR SI2Q Info",0,NULL,1,1}, |
| 170 | {"RR MI Info",0,NULL,1,1}, |
| 171 | {"RR BLK Info",0,NULL,1,1}, |
| 172 | {"RR TBF Info",0,NULL,1,1}, |
| 173 | {"RR GPRS Gen",0,NULL,1,1}, |
| 174 | {"SMEmInfo",0,NULL,1,1}, |
| 175 | {"3GMmEmInfo",0,NULL,1,1}, |
| 176 | {"GmmEmInfo",0,NULL,1,1}, |
| 177 | #if 1 |
| 178 | {"3GTcmMmiEmInfo",0,NULL,1,1}, |
| 179 | {"3GGeneralStatusInd",0,NULL,1,1}, |
| 180 | {"xGCsceEMNeighCellSStatusInd",0,NULL,1,1}, |
| 181 | {"3GCsceEMServCellSStatusInd",0,NULL,1,1}, |
| 182 | {"3GCsceEmInfoMultiPlmn",0,NULL,1,1}, |
| 183 | {"3GMemeEmPeriodicBlerReportInd",0,NULL,1,1}, |
| 184 | {"3GUrrUmtsSrncId",0,NULL,1,1}, |
| 185 | {"3GMemeEmInfoHServCellInd",0,NULL,1,1}, |
| 186 | #endif |
| 187 | #if 1//fdd |
| 188 | {"3GMemeEmInfoUmtsCellStatus",0,NULL,1,1}, |
| 189 | {"3GSlceEmPsDataRateStatusInd",0,NULL,1,1}, |
| 190 | #endif |
| 191 | #if 0//tdd |
| 192 | {"3GHandoverSequenceIndStuct",0,NULL,1,1}, |
| 193 | {"3GUl2EmAdmPoolStatusIndStruct",0,NULL,1,1}, |
| 194 | {"3GUl2EmPsDataRateStatusIndStruct",0,NULL,1,1}, |
| 195 | {"3GUl2EmHsdschReconfigStatusIndStruct",0,NULL,1,1}, |
| 196 | {"3GUl2EmUrlcEventStatusIndStruct",0,NULL,1,1}, |
| 197 | {"3G Ul2EmPeriodicBlerReportInd",0,NULL,1,1}, |
| 198 | #endif |
| 199 | #if 0 //lte |
| 200 | {"3G speech codec",0,NULL,1,1},//lte |
| 201 | {"Security Configuration",0,NULL,1,1},//lte |
| 202 | #endif |
| 203 | }; |
| 204 | |
| 205 | em_arry_t antenna_setmodes_4g[] { |
| 206 | {"RX1&RX2", 0, NULL, 1, 1}, |
| 207 | {"RX1", 0, NULL, 1, 1}, |
| 208 | {"RX2", 0, NULL, 1, 1}, |
| 209 | }; |
| 210 | |
| 211 | em_arry_t antenna_setmodes_3g[] { |
| 212 | {"RX1", 0, NULL, 1, 1}, |
| 213 | {"RX2", 0, NULL, 1, 1}, |
| 214 | {"RX1&RX2", 0, NULL, 1, 1}, |
| 215 | {"Resume default setting", 0, NULL, 1, 1}, |
| 216 | }; |
| 217 | |
| 218 | em_arry_t antenna_setmodes_c2k[] { |
| 219 | {"Resume default setting", 0, NULL, 1, 1}, |
| 220 | {"RX1", 0, NULL, 1, 1}, |
| 221 | {"RX2", 0, NULL, 1, 1}, |
| 222 | {"RX1&RX2", 0, NULL, 1, 1}, |
| 223 | }; |
| 224 | |
| 225 | em_arry_t antenna_4Gmode[] = { |
| 226 | {"getmode",0,NULL,1,1}, |
| 227 | {"setmode",NUM_ITEMS(antenna_setmodes_4g),antenna_setmodes_4g,1,1}, |
| 228 | }; |
| 229 | |
| 230 | em_arry_t antenna_3Gmode[] = { |
| 231 | {"getmode",0,NULL,1,1}, |
| 232 | {"setmode",NUM_ITEMS(antenna_setmodes_3g),antenna_setmodes_3g,1,1}, |
| 233 | }; |
| 234 | |
| 235 | em_arry_t antenna_c2kmode[] = { |
| 236 | {"getmode",0,NULL,1,1}, |
| 237 | {"setmode",NUM_ITEMS(antenna_setmodes_c2k),antenna_setmodes_c2k,1,1}, |
| 238 | }; |
| 239 | |
| 240 | em_arry_t antennatest[] = { |
| 241 | {"4G",NUM_ITEMS(antenna_4Gmode),antenna_4Gmode,1,1}, |
| 242 | {"3G",NUM_ITEMS(antenna_3Gmode),antenna_3Gmode,1,1}, |
| 243 | {"CDMA",NUM_ITEMS(antenna_c2kmode),antenna_c2kmode,1,1}, |
| 244 | }; |
| 245 | |
| 246 | em_arry_t time_reg[] = { |
| 247 | { "disable", 0,NULL, 1, 1 }, |
| 248 | { "enable", 0, NULL, 1, 1 }, |
| 249 | }; |
| 250 | |
| 251 | em_arry_t c2k_modem_setting[] { |
| 252 | {"TIME REG",NUM_ITEMS(time_reg),time_reg,1,1}, |
| 253 | }; |
| 254 | |
| 255 | em_arry_t rfdesense_setting[] = { |
| 256 | {"start",0,NULL,0,0}, |
| 257 | {"set",0,NULL,0,0}, |
| 258 | // {"set_check_Limit",0,NULL,0,0}, |
| 259 | // {"get_check_Limit",0,NULL,0,0}, |
| 260 | }; |
| 261 | |
| 262 | em_arry_t set_get[] = { |
| 263 | {"get",0,NULL,0,0}, |
| 264 | {"set",0,NULL,0,0}, |
| 265 | }; |
| 266 | |
| 267 | em_arry_t rfdesense_gsm_band[] = { |
| 268 | {"GSM 850",0,NULL,0,0}, |
| 269 | {"P-GSM 900",0,NULL,0,0}, |
| 270 | {"E-GSM 900",0,NULL,0,0}, |
| 271 | {"R-GSM 900",0,NULL,0,0}, |
| 272 | {"DCS 1800",0,NULL,0,0}, |
| 273 | {"PCS 1900",0,NULL,0,0}, |
| 274 | }; |
| 275 | |
| 276 | em_arry_t rfdesense_gsm_pattern[] = { |
| 277 | {"RFTOOL_NB_TX_RANDOM_WITH_TSC",0,NULL,0,0}, |
| 278 | {"RFTOOL_NB_TX_ALL_ONES_WITHOUT_TSC",0,NULL,0,0}, |
| 279 | {"RFTOOL_AB_TX_RANDOM_WITH_SYNC_SEQ",0,NULL,0,0}, |
| 280 | {"RFTOOL_CONT_TX_ALL_ZEROS",0,NULL,0,0}, |
| 281 | {"RFTOOL_CONT_TX_ALL_ONES",0,NULL,0,0}, |
| 282 | {"RFTOOL_CONT_TX_ALTERNATE_BITS",0,NULL,0,0}, |
| 283 | {"RFTOOL_CONT_TX_PSEUDO_RANDOM",0,NULL,0,0}, |
| 284 | }; |
| 285 | |
| 286 | em_arry_t rfdesense_gsm_sub[] = { |
| 287 | {"Band",NUM_ITEMS(rfdesense_gsm_band),rfdesense_gsm_band,0,0}, |
| 288 | {"Channel(ARFCN)",NUM_ITEMS(set_get),set_get,0,0}, |
| 289 | {"Power Level",NUM_ITEMS(set_get),set_get,0,0}, |
| 290 | {"AFC",NUM_ITEMS(set_get),set_get,0,0}, |
| 291 | {"TSC",NUM_ITEMS(set_get),set_get,0,0}, |
| 292 | {"PATTERN",NUM_ITEMS(rfdesense_gsm_pattern),rfdesense_gsm_pattern,0,0}, |
| 293 | }; |
| 294 | |
| 295 | em_arry_t rfdesense_gsm[] = { |
| 296 | {"start",0,NULL,0,0}, |
| 297 | {"Parameters_set",NUM_ITEMS(rfdesense_gsm_sub),rfdesense_gsm_sub,0,0}, |
| 298 | {"show default",0,NULL,0,0}, |
| 299 | }; |
| 300 | |
| 301 | em_arry_t rfdesense_tdscdma_band[] = { |
| 302 | {"Band A",0,NULL,0,0}, |
| 303 | {"Band F",0,NULL,0,0}, |
| 304 | }; |
| 305 | |
| 306 | em_arry_t rfdesense_tdscdma_sub[] = { |
| 307 | {"Band",NUM_ITEMS(rfdesense_tdscdma_band),rfdesense_tdscdma_band,0,0}, |
| 308 | {"Channel(ARFCN)",NUM_ITEMS(set_get),set_get,0,0}, |
| 309 | {"Power Level(dBm)",NUM_ITEMS(set_get),set_get,0,0}, |
| 310 | }; |
| 311 | |
| 312 | em_arry_t rfdesense_tdscdma[] = { |
| 313 | {"start",0,NULL,0,0}, |
| 314 | {"Parameters_set",NUM_ITEMS(rfdesense_tdscdma_sub),rfdesense_tdscdma_sub,0,0}, |
| 315 | {"show default",0,NULL,0,0}, |
| 316 | }; |
| 317 | |
| 318 | em_arry_t rfdesense_wcdma_band[] = { |
| 319 | {"Band 1",0,NULL,0,0}, |
| 320 | {"Band 2",0,NULL,0,0}, |
| 321 | {"Band 3",0,NULL,0,0}, |
| 322 | {"Band 4",0,NULL,0,0}, |
| 323 | {"Band 5",0,NULL,0,0}, |
| 324 | {"Band 6",0,NULL,0,0}, |
| 325 | {"Band 7",0,NULL,0,0}, |
| 326 | {"Band 8",0,NULL,0,0}, |
| 327 | {"Band 9",0,NULL,0,0}, |
| 328 | {"Band 10",0,NULL,0,0}, |
| 329 | {"Band 11",0,NULL,0,0}, |
| 330 | {"Band 12",0,NULL,0,0}, |
| 331 | {"Band 13",0,NULL,0,0}, |
| 332 | {"Band 14",0,NULL,0,0}, |
| 333 | {"Band 19",0,NULL,0,0}, |
| 334 | {"Band 20",0,NULL,0,0}, |
| 335 | {"Band 21",0,NULL,0,0}, |
| 336 | {"Band 22",0,NULL,0,0}, |
| 337 | }; |
| 338 | |
| 339 | em_arry_t rfdesense_wcdma_sub[] = { |
| 340 | {"Band",NUM_ITEMS(rfdesense_wcdma_band),rfdesense_wcdma_band,0,0}, |
| 341 | {"Channel(ARFCN)",NUM_ITEMS(set_get),set_get,0,0}, |
| 342 | {"Power Level(dBm)",NUM_ITEMS(set_get),set_get,0,0}, |
| 343 | }; |
| 344 | |
| 345 | em_arry_t rfdesense_wcdma[] { |
| 346 | {"start",0,NULL,0,0}, |
| 347 | {"Parameters_set",NUM_ITEMS(rfdesense_wcdma_sub),rfdesense_wcdma_sub,0,0}, |
| 348 | {"show default",0,NULL,0,0}, |
| 349 | }; |
| 350 | |
| 351 | em_arry_t rfdesense_lte_mode[] = { |
| 352 | {"single tone",0,NULL,0,0}, |
| 353 | {"modulation signal",0,NULL,0,0}, |
| 354 | }; |
| 355 | |
| 356 | em_arry_t rfdesense_fdd_band[] = { |
| 357 | {"1",0,NULL,0,0}, |
| 358 | {"2",0,NULL,0,0}, |
| 359 | {"3",0,NULL,0,0}, |
| 360 | {"4",0,NULL,0,0}, |
| 361 | {"5",0,NULL,0,0}, |
| 362 | {"6",0,NULL,0,0}, |
| 363 | {"7",0,NULL,0,0}, |
| 364 | {"8",0,NULL,0,0}, |
| 365 | {"9",0,NULL,0,0}, |
| 366 | {"10",0,NULL,0,0}, |
| 367 | {"11",0,NULL,0,0}, |
| 368 | {"12",0,NULL,0,0}, |
| 369 | {"13",0,NULL,0,0}, |
| 370 | {"14",0,NULL,0,0}, |
| 371 | {"15",0,NULL,0,0}, |
| 372 | {"16",0,NULL,0,0}, |
| 373 | {"17",0,NULL,0,0}, |
| 374 | {"18",0,NULL,0,0}, |
| 375 | {"19",0,NULL,0,0}, |
| 376 | {"20",0,NULL,0,0}, |
| 377 | {"21",0,NULL,0,0}, |
| 378 | {"22",0,NULL,0,0}, |
| 379 | {"23",0,NULL,0,0}, |
| 380 | {"24",0,NULL,0,0}, |
| 381 | {"25",0,NULL,0,0}, |
| 382 | {"26",0,NULL,0,0}, |
| 383 | {"27",0,NULL,0,0}, |
| 384 | {"28",0,NULL,0,0}, |
| 385 | {"29",0,NULL,0,0}, |
| 386 | {"30",0,NULL,0,0}, |
| 387 | {"31",0,NULL,0,0}, |
| 388 | {"66",0,NULL,0,0}, |
| 389 | }; |
| 390 | |
| 391 | em_arry_t rfdesense_lte_bandwidth[] = { |
| 392 | {"1.4M",0,NULL,0,0}, |
| 393 | {"3M",0,NULL,0,0}, |
| 394 | {"5M",0,NULL,0,0}, |
| 395 | {"10M",0,NULL,0,0}, |
| 396 | {"15M",0,NULL,0,0}, |
| 397 | {"20M",0,NULL,0,0}, |
| 398 | }; |
| 399 | |
| 400 | em_arry_t rfdesense_lte_mcs[] = { |
| 401 | {"QPSK",0,NULL,0,0}, |
| 402 | {"16QAM",0,NULL,0,0}, |
| 403 | {"64QAM",0,NULL,0,0}, |
| 404 | }; |
| 405 | |
| 406 | em_arry_t rfdesense_fdd_sub[] = { |
| 407 | {"mode",NUM_ITEMS(rfdesense_lte_mode),rfdesense_lte_mode,0,0}, |
| 408 | {"band",NUM_ITEMS(rfdesense_fdd_band),rfdesense_fdd_band,0,0}, |
| 409 | {"UL Bandwidth",NUM_ITEMS(rfdesense_lte_bandwidth),rfdesense_lte_bandwidth,0,0}, |
| 410 | {"UL Freq(100kHz)",NUM_ITEMS(set_get),set_get,0,0}, |
| 411 | {"VRB Start(0-99)",NUM_ITEMS(set_get),set_get,0,0}, |
| 412 | {"VRB Length(1-100)",NUM_ITEMS(set_get),set_get,0,0}, |
| 413 | {"MCS",NUM_ITEMS(rfdesense_lte_mcs),rfdesense_lte_mcs,0,0}, |
| 414 | {"Power Level(dbm)(-50_23)",NUM_ITEMS(set_get),set_get,0,0}, |
| 415 | }; |
| 416 | |
| 417 | em_arry_t rfdesense_lte_fdd[] = { |
| 418 | {"start",0,NULL,0,0}, |
| 419 | {"Parameters_set",NUM_ITEMS(rfdesense_fdd_sub),rfdesense_fdd_sub,0,0}, |
| 420 | {"show default",0,NULL,0,0}, |
| 421 | }; |
| 422 | |
| 423 | em_arry_t rfdesense_tdd_band[] = { |
| 424 | {"33",0,NULL,0,0}, |
| 425 | {"34",0,NULL,0,0}, |
| 426 | {"35",0,NULL,0,0}, |
| 427 | {"36",0,NULL,0,0}, |
| 428 | {"37",0,NULL,0,0}, |
| 429 | {"38",0,NULL,0,0}, |
| 430 | {"39",0,NULL,0,0}, |
| 431 | {"40",0,NULL,0,0}, |
| 432 | {"41",0,NULL,0,0}, |
| 433 | {"42",0,NULL,0,0}, |
| 434 | {"43",0,NULL,0,0}, |
| 435 | {"44",0,NULL,0,0}, |
| 436 | }; |
| 437 | |
| 438 | em_arry_t rfdesense_tdd_config[] = { |
| 439 | {"0",0,NULL,0,0}, |
| 440 | {"1",0,NULL,0,0}, |
| 441 | {"2",0,NULL,0,0}, |
| 442 | {"3",0,NULL,0,0}, |
| 443 | {"4",0,NULL,0,0}, |
| 444 | {"5",0,NULL,0,0}, |
| 445 | {"6",0,NULL,0,0}, |
| 446 | }; |
| 447 | |
| 448 | em_arry_t rfdesense_tdd_special[] = { |
| 449 | {"0",0,NULL,0,0}, |
| 450 | {"1",0,NULL,0,0}, |
| 451 | {"2",0,NULL,0,0}, |
| 452 | {"3",0,NULL,0,0}, |
| 453 | {"4",0,NULL,0,0}, |
| 454 | {"5",0,NULL,0,0}, |
| 455 | {"6",0,NULL,0,0}, |
| 456 | {"7",0,NULL,0,0}, |
| 457 | {"8",0,NULL,0,0}, |
| 458 | {"9",0,NULL,0,0}, |
| 459 | }; |
| 460 | |
| 461 | em_arry_t rfdesense_tdd_sub[] = { |
| 462 | {"mode",NUM_ITEMS(rfdesense_lte_mode),rfdesense_lte_mode,0,0}, |
| 463 | {"band",NUM_ITEMS(rfdesense_tdd_band),rfdesense_tdd_band,0,0}, |
| 464 | {"UL Bandwidth",NUM_ITEMS(rfdesense_lte_bandwidth),rfdesense_lte_bandwidth,0,0}, |
| 465 | {"UL Freq(100kHz)",NUM_ITEMS(set_get),set_get,0,0}, |
| 466 | {"TDD Config Index",NUM_ITEMS(rfdesense_tdd_config),rfdesense_tdd_config,0,0}, |
| 467 | {"TDD Special SF Config Index",NUM_ITEMS(rfdesense_tdd_special),rfdesense_tdd_special,0,0}, |
| 468 | {"VRB Start(0-99)",NUM_ITEMS(set_get),set_get,0,0}, |
| 469 | {"VRB Length(1-100)",NUM_ITEMS(set_get),set_get,0,0}, |
| 470 | {"MCS",NUM_ITEMS(rfdesense_lte_mcs),rfdesense_lte_mcs,0,0}, |
| 471 | {"Power Level(dbm)(-50_23)",NUM_ITEMS(set_get),set_get,0,0}, |
| 472 | }; |
| 473 | |
| 474 | em_arry_t rfdesense_lte_tdd[] = { |
| 475 | {"start",0,NULL,0,0}, |
| 476 | {"Parameters_set",NUM_ITEMS(rfdesense_tdd_sub),rfdesense_tdd_sub,0,0}, |
| 477 | {"show default",0,NULL,0,0}, |
| 478 | }; |
| 479 | |
| 480 | em_arry_t rfdesense_cdma_band[] = { |
| 481 | {"Band 0",0,NULL,0,0}, |
| 482 | {"Band 1",0,NULL,0,0}, |
| 483 | {"Band 2",0,NULL,0,0}, |
| 484 | {"Band 3",0,NULL,0,0}, |
| 485 | {"Band 4",0,NULL,0,0}, |
| 486 | {"Band 5",0,NULL,0,0}, |
| 487 | {"Band 6",0,NULL,0,0}, |
| 488 | {"Band 7",0,NULL,0,0}, |
| 489 | {"Band 8",0,NULL,0,0}, |
| 490 | {"Band 9",0,NULL,0,0}, |
| 491 | {"Band 10",0,NULL,0,0}, |
| 492 | {"Band 11",0,NULL,0,0}, |
| 493 | {"Band 12",0,NULL,0,0}, |
| 494 | {"Band 13",0,NULL,0,0}, |
| 495 | {"Band 14",0,NULL,0,0}, |
| 496 | {"Band 15",0,NULL,0,0}, |
| 497 | }; |
| 498 | |
| 499 | em_arry_t rfdesense_cdma_modulation[] = { |
| 500 | {"1X",0,NULL,0,0}, |
| 501 | {"EVDO",0,NULL,0,0}, |
| 502 | }; |
| 503 | |
| 504 | em_arry_t rfdesense_cdma_sub[] = { |
| 505 | {"Band",NUM_ITEMS(rfdesense_cdma_band),rfdesense_cdma_band,0,0}, |
| 506 | {"modulation",NUM_ITEMS(rfdesense_cdma_modulation),rfdesense_cdma_modulation,0,0}, |
| 507 | {"Channel(ARFCN)",NUM_ITEMS(set_get),set_get,0,0}, |
| 508 | {"Power Level(dBm)",NUM_ITEMS(set_get),set_get,0,0}, |
| 509 | }; |
| 510 | |
| 511 | em_arry_t rfdesense_cdma[] = { |
| 512 | {"start",0,NULL,0,0}, |
| 513 | {"Parameters_set",NUM_ITEMS(rfdesense_cdma_sub),rfdesense_cdma_sub,0,0}, |
| 514 | {"show default",0,NULL,0,0}, |
| 515 | }; |
| 516 | |
| 517 | em_arry_t sub_tx_test[] = { |
| 518 | { "GSM", NUM_ITEMS(rfdesense_gsm),rfdesense_gsm, 1, 1 }, |
| 519 | { "TDSCDMA", NUM_ITEMS(rfdesense_tdscdma), rfdesense_tdscdma, 1, 1 }, |
| 520 | { "WCDMA", NUM_ITEMS(rfdesense_wcdma), rfdesense_wcdma, 1, 1 }, |
| 521 | { "LTE(FDD)", NUM_ITEMS(rfdesense_lte_fdd), rfdesense_lte_fdd, 1, 1 }, |
| 522 | { "LTE(TDD)", NUM_ITEMS(rfdesense_lte_tdd), rfdesense_lte_tdd, 1, 1 }, |
| 523 | #ifdef C2K_SUPPORT |
| 524 | { "CDMA(EVDO)", NUM_ITEMS(rfdesense_cdma), rfdesense_cdma, 1, 1 }, |
| 525 | { "CDMA(1x)", NUM_ITEMS(rfdesense_cdma), rfdesense_cdma, 1, 1 }, |
| 526 | #endif/*C2K_SUPPORT*/ |
| 527 | }; |
| 528 | |
| 529 | em_arry_t desense_test[] { |
| 530 | {"Tx Test",NUM_ITEMS(sub_tx_test),sub_tx_test,1,1}, |
| 531 | }; |
| 532 | |
| 533 | em_arry_t no_support[] { |
| 534 | {"NO SUPPORT",0,NULL,0,0}, |
| 535 | }; |
| 536 | |
| 537 | em_arry_t emmain[] = { |
| 538 | {"CDMA modem setting",NUM_ITEMS(c2k_modem_setting),c2k_modem_setting,0,0}, |
| 539 | {"RF Desense Test ",NUM_ITEMS(desense_test),desense_test,0,0}, |
| 540 | {"Modem Test",NUM_ITEMS(modemtest),modemtest,0,0}, |
| 541 | {"HSPA",NUM_ITEMS(hspa),hspa,0,0}, |
| 542 | {"CFU",NUM_ITEMS(cfu),cfu,0,0}, |
| 543 | {"Antenna Test",NUM_ITEMS(antennatest),antennatest,0,0}, |
| 544 | {"Band Mode",NUM_ITEMS(bandmode),bandmode,0,0}, |
| 545 | {"IMS",NUM_ITEMS(ims),ims,0,0}, |
| 546 | //{"Network Info",NUM_ITEMS(networkinfo),networkinfo,0,0}, |
| 547 | {"Network Info",NUM_ITEMS(no_support),no_support,0,0}, |
| 548 | {"LTE",NUM_ITEMS(lte_info),lte_info,0,0}, |
| 549 | //{"GPRS Attach",NUM_ITEMS(gprs),gprs,0,0}, // replace data allow script |
| 550 | //{"NetworkSelection",NUM_ITEMS(networkselection),networkselection,0,0}, // repplace with script |
| 551 | }; |
| 552 | typedef enum { |
| 553 | C2K_MODEM_SETTING = 0, |
| 554 | RF_DESENSE_TEST, |
| 555 | MODEM_TEST_ITEM, |
| 556 | HSPA_ITEM, |
| 557 | CFU_ITEM, |
| 558 | ANTENNATEST_ITEM, |
| 559 | BANDMODE_ITEM, |
| 560 | IMS_ITEM, |
| 561 | NO_SUPPORT, |
| 562 | //NETWORKINFO_ITEM, |
| 563 | LTE_ITEM, |
| 564 | }EM_MAIN_ITEM; |
| 565 | em_arry_t em = {"Telephony",NUM_ITEMS(emmain),emmain,0,0}; |
| 566 | int em_main(int len, int *item, int multilen, char *value[]) { |
| 567 | int testclass = item[0]; |
| 568 | RLOGD("em_main testclase %d", testclass); |
| 569 | switch (testclass) { |
| 570 | case C2K_MODEM_SETTING: |
| 571 | emC2kModemSettingStart(len - 1, multilen, &item[1]); |
| 572 | break; |
| 573 | case RF_DESENSE_TEST: |
| 574 | emRfDesenseStart(len - 1, &item[1], multilen, value); |
| 575 | break; |
| 576 | case MODEM_TEST_ITEM: |
| 577 | emModemtestStart(len - 1, multilen, &item[1]); |
| 578 | break; |
| 579 | case HSPA_ITEM: |
| 580 | emHspaStart(len - 1, &item[1]); |
| 581 | break; |
| 582 | case CFU_ITEM: |
| 583 | emCfuStart(len - 1, &item[1]); |
| 584 | break; |
| 585 | case ANTENNATEST_ITEM: |
| 586 | emAntennaTestStart(len - 1, &item[1],(value != NULL ? value[0] : NULL)); |
| 587 | break; |
| 588 | case BANDMODE_ITEM: |
| 589 | emBandmodeStart(len - 1, &item[1], multilen, value); |
| 590 | break; |
| 591 | case IMS_ITEM: |
| 592 | emImsStart(len - 1, &item[1], (value != NULL ? value[0] : NULL)); |
| 593 | break; |
| 594 | // case NETWORKINFO_ITEM: |
| 595 | // emNwInfoStart(len - 1, multilen, &item[1]); |
| 596 | // break; |
| 597 | case LTE_ITEM: |
| 598 | //lte_em_start(len - 1, multilen, &item[1]); |
| 599 | em_el1_start(len - 1, multilen, &item[1]); |
| 600 | break; |
| 601 | case NO_SUPPORT: |
| 602 | android::emResultNotify("don't support\n"); |
| 603 | break; |
| 604 | default: |
| 605 | break; |
| 606 | } |
| 607 | return 0; |
| 608 | } |
| 609 | |
| 610 | int em_start(int argc, char *argv[], RIL_SOCKET_ID socket_id, RequestInfo *pRI) |
| 611 | { |
| 612 | RLOGD("em_start called"); |
| 613 | int i = 0; |
| 614 | em_arry_t *em_test = &em; |
| 615 | em_arry_t *em_sub = NULL; |
| 616 | RLOGD("Welcome to EM %s",em_test->name); |
| 617 | char output[2048] = {0}; |
| 618 | int len = 0; |
| 619 | |
| 620 | if(argc < 2){ |
| 621 | for(i = 0; i < em_test->subcnt; i++){ |
| 622 | sprintf(output+len,"%d:%s\n",i+1,em_test->subarray[i].name); |
| 623 | len = strlen(output); |
| 624 | } |
| 625 | RLOGD("%s",output); |
| 626 | android::emResultNotify(output); |
| 627 | return 0; |
| 628 | } |
| 629 | int itemlevel = 0; |
| 630 | int select_argvi[32] = {0}; |
| 631 | int current_argvi = -1; |
| 632 | for(itemlevel = 1; itemlevel < argc; itemlevel++){ |
| 633 | select_argvi[itemlevel-1] = atoi(argv[itemlevel]) - 1; |
| 634 | current_argvi = select_argvi[itemlevel-1]; |
| 635 | if (em_test->subcnt < current_argvi + 1) { |
| 636 | sprintf(output, "the select index %d is out of bounds, please reselect.\nfail\n",current_argvi + 1); |
| 637 | android::emResultNotify(output); |
| 638 | return -1; |
| 639 | } |
| 640 | if(em_test->subarray[current_argvi].subarray == NULL){ |
| 641 | for(i = 0 ; i < (argc - itemlevel - 1); i++){ |
| 642 | select_argvi[itemlevel + i] = atoi(argv[itemlevel+1+i]) - 1; |
| 643 | } |
| 644 | RLOGD("em_test->subarray[%d].name: %s",current_argvi, em_test->subarray[current_argvi].name); |
| 645 | if(strncmp(em_test->subarray[current_argvi].name,"set",3) == 0){ |
| 646 | em_main(itemlevel,&select_argvi[0],(argc - itemlevel - 1),&argv[itemlevel+1]); |
| 647 | } |
| 648 | else{ |
| 649 | RLOGD("item level %d",itemlevel); |
| 650 | em_main(itemlevel,&select_argvi[0],(argc - itemlevel - 1),NULL); |
| 651 | } |
| 652 | //android::emResultNotify("done\n"); |
| 653 | break; |
| 654 | }else{ |
| 655 | RLOGD("em_sub[%d].name: %s, itemlevel: %d, argc: %d ",current_argvi, (em_test->subarray[current_argvi].name), itemlevel, argc); |
| 656 | em_sub = &em_test->subarray[current_argvi]; |
| 657 | if(itemlevel == (argc - 1)){ |
| 658 | memset(output,0,2048); |
| 659 | len = 0; |
| 660 | |
| 661 | for(i = 0; i < em_sub->subcnt; i++){ |
| 662 | //RLOGD("%d:%s",i+1,em_sub->subarray[i].name); |
| 663 | sprintf(output+len,"%d:%s\n",i+1,em_sub->subarray[i].name); |
| 664 | len = strlen(output); |
| 665 | } |
| 666 | RLOGD("%s",output); |
| 667 | android::emResultNotify(output); |
| 668 | } |
| 669 | em_test = em_sub; |
| 670 | } |
| 671 | } |
| 672 | return 0; |
| 673 | } |
| 674 | |
| 675 | extern void ARspRequestWithArg(int request, const char* arg, RIL_SOCKET_ID soc_id); |
| 676 | |
| 677 | void emSendATCommand(const char *cmd, int soc_id) |
| 678 | { |
| 679 | ARspRequestWithArg(RIL_REQUEST_OEM_HOOK_RAW, cmd, (RIL_SOCKET_ID)soc_id); |
| 680 | } |
| 681 | |
| 682 | void emEnableRadio(bool isEnable, int soc_id) { |
| 683 | //check main phone |
| 684 | ARspRequestWithArg(RIL_REQUEST_RADIO_POWER, (isEnable ? "1" : "0"), (RIL_SOCKET_ID)soc_id); |
| 685 | } |
| 686 | |
| 687 | std::vector<std::string> getCdmaCmdArr(std::vector<std::string> cmdArray) { |
| 688 | #ifndef MD_93_SUPPORT |
| 689 | return cmdArray; |
| 690 | #else |
| 691 | std::vector<std::string> cmdArrayNew(2); |
| 692 | cmdArrayNew[0] = cmdArray[0]; |
| 693 | cmdArrayNew[1] = cmdArray[1]; |
| 694 | return cmdArrayNew; |
| 695 | #endif /*MD_93_SUPPORT*/ |
| 696 | } |
| 697 | |
| 698 | int emResultNotifyWithDone(std::string str) { |
| 699 | std::string tmp = str + std::string("\ndone\n"); |
| 700 | android::emResultNotify(tmp.c_str()); |
| 701 | return 0; |
| 702 | } |
| 703 | |
| 704 | int emResultNotifyEx(std::string str) { |
| 705 | std::string tmp = str + std::string("\n"); |
| 706 | android::emResultNotify(tmp.c_str()); |
| 707 | return 0; |
| 708 | } |
| 709 | |
| 710 | int em_result_only_msg(std::string str) { |
| 711 | std::string tmp = str + std::string("\nonly_em_message\n"); |
| 712 | android::emResultNotify(tmp.c_str()); |
| 713 | return 0; |
| 714 | } |
| 715 | |
| 716 | int em_result_notify_fail(std::string str) { |
| 717 | std::string tmp = "fail, " + str; |
| 718 | emResultNotifyWithDone(tmp); |
| 719 | return 0; |
| 720 | } |
| 721 | |
| 722 | int em_result_notify_ok(std::string str) { |
| 723 | std::string tmp = "OK, " + str; |
| 724 | emResultNotifyWithDone(tmp); |
| 725 | return 0; |
| 726 | } |
| 727 | |
| 728 | int em_result_notify_error(std::string str) { |
| 729 | std::string tmp = "error, " + str; |
| 730 | emResultNotifyWithDone(tmp); |
| 731 | return 0; |
| 732 | } |
| 733 | #endif |
| 734 | |