b.liu | 86b7ff2 | 2024-04-03 14:25:55 +0800 | [diff] [blame] | 1 | #include "lynq_qser_network.h" |
| 2 | #include "mbtk_type.h" |
| 3 | #include "mbtk_info_api.h" |
| 4 | |
| 5 | #include <stdio.h> |
| 6 | #include <stdlib.h> |
| 7 | |
| 8 | |
| 9 | char *tech_domain[] = {"NONE", "3GPP", "3GPP2"}; |
| 10 | char *radio_tech[] = {"unknown", |
| 11 | "TD_SCDMA", "GSM", "HSPAP", "LTE", "EHRPD", "EVDO_B", |
| 12 | "HSPA", "HSUPA", "HSDPA", "EVDO_A", "EVDO_0", "1xRTT", |
| 13 | "IS95B", "IS95A", "UMTS", "EDGE", "GPRS", "NONE"}; |
| 14 | |
| 15 | void nw_event_ind_handler ( |
| 16 | nw_client_handle_type h_nw, |
| 17 | u_int32_t ind_flag, |
| 18 | void *ind_msg_buf, |
| 19 | u_int32_t ind_msg_len, |
| 20 | void *contextPtr) |
| 21 | { |
r.xiao | fca7c47 | 2024-04-24 01:00:23 -0700 | [diff] [blame] | 22 | switch(ind_flag) { |
| 23 | case NW_IND_VOICE_REG_EVENT_IND_FLAG: |
| 24 | { |
| 25 | QSER_NW_VOICE_REG_EVENT_IND_T *ind = (QSER_NW_VOICE_REG_EVENT_IND_T*)ind_msg_buf; |
| 26 | printf("Recv event indication : VOICE REG EVENT\n"); |
| 27 | |
| 28 | if(ind==NULL) |
| 29 | { |
| 30 | printf("ind is NULL\n"); |
| 31 | break; |
| 32 | } |
b.liu | 86b7ff2 | 2024-04-03 14:25:55 +0800 | [diff] [blame] | 33 | |
r.xiao | fca7c47 | 2024-04-24 01:00:23 -0700 | [diff] [blame] | 34 | if(ind->registration_valid) |
| 35 | { |
| 36 | printf("voice_registration: \ntech_domain=%s, radio_tech=%s, roaming=%d, registration_state=%d\n", |
| 37 | tech_domain[ind->registration.tech_domain], |
| 38 | radio_tech[ind->registration.radio_tech], |
| 39 | ind->registration.roaming, |
| 40 | ind->registration.registration_state); |
| 41 | } |
| 42 | if(ind->registration_details_3gpp_valid) |
| 43 | { |
| 44 | printf("voice_registration_details_3gpp: \ntech_domain=%s, radio_tech=%s, mcc=%s, mnc=%s, roaming=%d, forbidden=%d, cid=0x%X, lac=%d, psc=%d, tac=%d\n", |
| 45 | tech_domain[ind->registration_details_3gpp.tech_domain], |
| 46 | radio_tech[ind->registration_details_3gpp.radio_tech], |
| 47 | ind->registration_details_3gpp.mcc, |
| 48 | ind->registration_details_3gpp.mnc, |
| 49 | ind->registration_details_3gpp.roaming, |
| 50 | ind->registration_details_3gpp.forbidden, |
| 51 | ind->registration_details_3gpp.cid, |
| 52 | ind->registration_details_3gpp.lac, |
| 53 | ind->registration_details_3gpp.psc, |
| 54 | ind->registration_details_3gpp.tac); |
| 55 | } |
b.liu | 86b7ff2 | 2024-04-03 14:25:55 +0800 | [diff] [blame] | 56 | |
r.xiao | fca7c47 | 2024-04-24 01:00:23 -0700 | [diff] [blame] | 57 | if(ind->registration_details_3gpp2_valid) |
| 58 | { |
| 59 | printf("voice_registration_details_3gpp2: \ntech_domain=%s, radio_tech=%s, mcc=%s, mnc=%s, roaming=%d, forbidden=%d, sid=%d, nid=%d, bsid=%d\n", |
| 60 | tech_domain[ind->registration_details_3gpp2.tech_domain], |
| 61 | radio_tech[ind->registration_details_3gpp2.radio_tech], |
| 62 | ind->registration_details_3gpp2.mcc, |
| 63 | ind->registration_details_3gpp2.mnc, |
| 64 | ind->registration_details_3gpp2.roaming, |
| 65 | ind->registration_details_3gpp2.forbidden, |
| 66 | ind->registration_details_3gpp2.sid, |
| 67 | ind->registration_details_3gpp2.nid, |
| 68 | ind->registration_details_3gpp2.bsid); |
| 69 | } |
| 70 | |
| 71 | break; |
| 72 | } |
| 73 | case NW_IND_DATA_REG_EVENT_IND_FLAG: |
| 74 | { |
| 75 | QSER_NW_DATA_REG_EVENT_IND_T *ind = (QSER_NW_DATA_REG_EVENT_IND_T*)ind_msg_buf; |
| 76 | |
| 77 | printf("Recv event indication : DATA REG EVENT\n"); |
| 78 | |
| 79 | if(ind==NULL) |
| 80 | { |
| 81 | printf("ind is NULL\n"); |
| 82 | break; |
| 83 | } |
| 84 | |
| 85 | |
| 86 | if(ind->registration_valid) |
| 87 | { |
| 88 | printf("data_registration: \ntech_domain=%s, radio_tech=%s, roaming=%d, registration_state=%d\n", |
| 89 | tech_domain[ind->registration.tech_domain], |
| 90 | radio_tech[ind->registration.radio_tech], |
| 91 | ind->registration.roaming, |
| 92 | ind->registration.registration_state); |
| 93 | } |
| 94 | if(ind->registration_details_3gpp_valid) |
| 95 | { |
| 96 | printf("data_registration_details_3gpp: \ntech_domain=%s, radio_tech=%s, mcc=%s, mnc=%s, roaming=%d, forbidden=%d, cid=0x%X, lac=%d, psc=%d, tac=%d\n", |
| 97 | tech_domain[ind->registration_details_3gpp.tech_domain], |
| 98 | radio_tech[ind->registration_details_3gpp.radio_tech], |
| 99 | ind->registration_details_3gpp.mcc, |
| 100 | ind->registration_details_3gpp.mnc, |
| 101 | ind->registration_details_3gpp.roaming, |
| 102 | ind->registration_details_3gpp.forbidden, |
| 103 | ind->registration_details_3gpp.cid, |
| 104 | ind->registration_details_3gpp.lac, |
| 105 | ind->registration_details_3gpp.psc, |
| 106 | ind->registration_details_3gpp.tac); |
| 107 | } |
| 108 | |
| 109 | if(ind->registration_details_3gpp2_valid) |
| 110 | { |
| 111 | printf("data_registration_details_3gpp2: \ntech_domain=%s, radio_tech=%s, mcc=%s, mnc=%s, roaming=%d, forbidden=%d, prl=%d, css=%d, sid=%d, nid=%d, bsid=%d\n", |
| 112 | tech_domain[ind->registration_details_3gpp2.tech_domain], |
| 113 | radio_tech[ind->registration_details_3gpp2.radio_tech], |
| 114 | ind->registration_details_3gpp2.mcc, |
| 115 | ind->registration_details_3gpp2.mnc, |
| 116 | ind->registration_details_3gpp2.roaming, |
| 117 | ind->registration_details_3gpp2.forbidden, |
| 118 | ind->registration_details_3gpp2.inPRL, |
| 119 | ind->registration_details_3gpp2.css, |
| 120 | ind->registration_details_3gpp2.sid, |
| 121 | ind->registration_details_3gpp2.nid, |
| 122 | ind->registration_details_3gpp2.bsid); |
| 123 | } |
| 124 | |
| 125 | break; |
| 126 | } |
| 127 | case NW_IND_SIGNAL_STRENGTH_EVENT_IND_FLAG: |
| 128 | { |
| 129 | QSER_NW_SINGNAL_EVENT_IND_T *ind = (QSER_NW_SINGNAL_EVENT_IND_T*)ind_msg_buf; |
| 130 | |
| 131 | printf("Recv event indication : SIGNAL STRENGTH EVENT\n"); |
| 132 | |
| 133 | if(ind==NULL) |
| 134 | { |
| 135 | printf("ind is NULL\n"); |
| 136 | break; |
| 137 | } |
| 138 | |
| 139 | if(ind->gsm_sig_info_valid) |
| 140 | { |
| 141 | printf("gsm_sig_info: rssi=%d\n", |
| 142 | ind->gsm_sig_info.rssi); |
| 143 | } |
| 144 | |
| 145 | if(ind->wcdma_sig_info_valid) |
| 146 | { |
| 147 | printf("wcdma_sig_info: rssi=%d, ecio=%d\n", |
| 148 | ind->wcdma_sig_info.rssi, |
| 149 | ind->wcdma_sig_info.ecio); |
| 150 | } |
| 151 | if(ind->tdscdma_sig_info_valid) |
| 152 | { |
| 153 | printf("tdscdma_sig_info: rssi=%d, rscp=%d, ecio=%d, sinr=%d\n", |
| 154 | ind->tdscdma_sig_info.rssi, |
| 155 | ind->tdscdma_sig_info.rscp, |
| 156 | ind->tdscdma_sig_info.ecio, |
| 157 | ind->tdscdma_sig_info.sinr); |
| 158 | } |
| 159 | if(ind->lte_sig_info_valid) |
| 160 | { |
| 161 | printf("lte_sig_info: rssi=%d, rsrq=%d, rsrp=%d, snr=%d\n", |
| 162 | ind->lte_sig_info.rssi, |
| 163 | ind->lte_sig_info.rsrq, |
| 164 | ind->lte_sig_info.rsrp, |
| 165 | ind->lte_sig_info.snr); |
| 166 | } |
| 167 | if(ind->cdma_sig_info_valid) |
| 168 | { |
| 169 | printf("cdma_sig_info: rssi=%d, ecio=%d\n", |
| 170 | ind->cdma_sig_info.rssi, |
| 171 | ind->cdma_sig_info.ecio); |
| 172 | } |
| 173 | if(ind->hdr_sig_info_valid) |
| 174 | { |
| 175 | printf("hdr_sig_info: rssi=%d, ecio=%d, sinr=%d, io=%d\n", |
| 176 | ind->hdr_sig_info.rssi, |
| 177 | ind->hdr_sig_info.ecio, |
| 178 | ind->hdr_sig_info.sinr, |
| 179 | ind->hdr_sig_info.io); |
| 180 | } |
| 181 | break; |
| 182 | } |
| 183 | case NW_IND_IMS_REG_EVENT_IND_FLAG: |
| 184 | { |
liuyang | 37623a0 | 2024-06-20 15:21:39 +0800 | [diff] [blame] | 185 | printf("Recv event indication : IMS REG EVENT\n"); |
| 186 | printf("ind is NULL\n"); |
r.xiao | fca7c47 | 2024-04-24 01:00:23 -0700 | [diff] [blame] | 187 | |
| 188 | break; |
| 189 | } |
| 190 | default: |
| 191 | break; |
b.liu | 86b7ff2 | 2024-04-03 14:25:55 +0800 | [diff] [blame] | 192 | } |
b.liu | 86b7ff2 | 2024-04-03 14:25:55 +0800 | [diff] [blame] | 193 | } |
| 194 | |
| 195 | |
r.xiao | fca7c47 | 2024-04-24 01:00:23 -0700 | [diff] [blame] | 196 | |
b.liu | 86b7ff2 | 2024-04-03 14:25:55 +0800 | [diff] [blame] | 197 | int main(int argc, char *argv[]) |
| 198 | { |
| 199 | char operator[10]; |
| 200 | int opt; |
| 201 | int lv_voll = 0; |
r.xiao | ba8483c | 2024-04-14 18:53:10 -0700 | [diff] [blame] | 202 | int ret; |
b.liu | 86b7ff2 | 2024-04-03 14:25:55 +0800 | [diff] [blame] | 203 | nw_client_handle_type handle = -1; |
| 204 | mbtk_log_init("radio", "NW_TEST"); |
| 205 | |
r.xiao | ba8483c | 2024-04-14 18:53:10 -0700 | [diff] [blame] | 206 | printf("=========network main=========\n" |
| 207 | "\t0 exit\n" |
| 208 | "\t1 network init\n" |
| 209 | "\t2 network add rx msg handle\n" |
| 210 | "\t3 network band set config\n" |
| 211 | "\t4 network get operator name\n" |
| 212 | "\t5 network get reg status\n" |
| 213 | "\t6 network get signal strength\n" |
| 214 | "\t7 network set oos config\n" |
| 215 | "\t8 network get oos config\n" |
| 216 | "\t9 network set rf config\n" |
| 217 | "\t10 network get rf config\n" |
| 218 | "\t11 network set ims config\n" |
| 219 | "\t12 network get ims config\n" |
| 220 | "\t13 network deinit\n" |
| 221 | "operator: >> "); |
| 222 | |
b.liu | 86b7ff2 | 2024-04-03 14:25:55 +0800 | [diff] [blame] | 223 | while(1) |
| 224 | { |
b.liu | 86b7ff2 | 2024-04-03 14:25:55 +0800 | [diff] [blame] | 225 | |
r.xiao | ba8483c | 2024-04-14 18:53:10 -0700 | [diff] [blame] | 226 | opt = -1; |
b.liu | 86b7ff2 | 2024-04-03 14:25:55 +0800 | [diff] [blame] | 227 | fgets(operator, sizeof(operator), stdin); |
| 228 | fflush(stdin); |
| 229 | opt = atoi(operator); |
| 230 | switch (opt) |
| 231 | { |
| 232 | case 0: |
| 233 | printf("main exit\n"); |
| 234 | return 0; |
| 235 | case 1: |
r.xiao | ba8483c | 2024-04-14 18:53:10 -0700 | [diff] [blame] | 236 | ret = qser_nw_client_init(&handle); |
| 237 | printf("qser_nw_client_init ret = %d\n", ret); |
b.liu | 86b7ff2 | 2024-04-03 14:25:55 +0800 | [diff] [blame] | 238 | break; |
| 239 | case 2: |
r.xiao | ba8483c | 2024-04-14 18:53:10 -0700 | [diff] [blame] | 240 | ret = qser_nw_add_rx_msg_handler(handle, nw_event_ind_handler, NULL); |
| 241 | printf("qser_nw_add_rx_msg_handler ret = %d\n", ret); |
b.liu | 86b7ff2 | 2024-04-03 14:25:55 +0800 | [diff] [blame] | 242 | break; |
| 243 | case 3: |
| 244 | { |
| 245 | //漫游开关现在不支持,所以就不用配置 |
| 246 | printf("please input \n" |
| 247 | "\t1:GSM \n" |
| 248 | "\t2:WCDMA \n" |
| 249 | "\t4:CDMA \n" |
| 250 | "\t8:EVDO \n" |
| 251 | "\t16:LTE \n" |
| 252 | "\t32:TDSCDMA \n" |
| 253 | ); |
| 254 | memset(operator,0x00, sizeof(operator)); |
| 255 | fgets(operator, sizeof(operator)-1, stdin); |
| 256 | fflush(stdin); |
| 257 | opt = atoi(operator); |
| 258 | QSER_NW_CONFIG_INFO_T t_info; |
liuyang | 4ac8c63 | 2024-05-24 14:42:31 +0800 | [diff] [blame] | 259 | |
| 260 | t_info.preferred_nw_mode = opt; |
r.xiao | ba8483c | 2024-04-14 18:53:10 -0700 | [diff] [blame] | 261 | ret = qser_nw_set_config(handle, &t_info); |
| 262 | printf("qser_nw_set_config ret = %d\n", ret); |
b.liu | 86b7ff2 | 2024-04-03 14:25:55 +0800 | [diff] [blame] | 263 | } |
| 264 | break; |
| 265 | case 4: |
| 266 | { |
| 267 | QSER_NW_OPERATOR_NAME_INFO_T t_info; |
| 268 | int err = qser_nw_get_operator_name(handle, &t_info); |
| 269 | if(err) |
| 270 | { |
| 271 | printf("Error : %d\n", err); |
| 272 | } else |
| 273 | { |
| 274 | printf("Operator : %s, %s, %s, %s\n", t_info.long_eons, t_info.short_eons, t_info.mcc, t_info.mnc); |
| 275 | } |
| 276 | } |
| 277 | break; |
| 278 | case 5: |
| 279 | { |
r.xiao | fca7c47 | 2024-04-24 01:00:23 -0700 | [diff] [blame] | 280 | QSER_NW_REG_STATUS_INFO_T t_info; |
| 281 | int err = qser_nw_get_reg_status(handle, &t_info); |
b.liu | 86b7ff2 | 2024-04-03 14:25:55 +0800 | [diff] [blame] | 282 | if(err) |
| 283 | { |
| 284 | printf("Error : %d\n", err); |
| 285 | } |
| 286 | else |
| 287 | { |
r.xiao | fca7c47 | 2024-04-24 01:00:23 -0700 | [diff] [blame] | 288 | if(t_info.voice_registration_valid) |
b.liu | 86b7ff2 | 2024-04-03 14:25:55 +0800 | [diff] [blame] | 289 | { |
r.xiao | fca7c47 | 2024-04-24 01:00:23 -0700 | [diff] [blame] | 290 | printf("voice_registration: \ntech_domain=%s, radio_tech=%s, roaming=%d, registration_state=%d\n", |
| 291 | tech_domain[t_info.voice_registration.tech_domain], |
| 292 | radio_tech[t_info.voice_registration.radio_tech], |
| 293 | t_info.voice_registration.roaming, |
| 294 | t_info.voice_registration.registration_state); |
b.liu | 86b7ff2 | 2024-04-03 14:25:55 +0800 | [diff] [blame] | 295 | } |
r.xiao | fca7c47 | 2024-04-24 01:00:23 -0700 | [diff] [blame] | 296 | if(t_info.data_registration_valid) |
b.liu | 86b7ff2 | 2024-04-03 14:25:55 +0800 | [diff] [blame] | 297 | { |
r.xiao | fca7c47 | 2024-04-24 01:00:23 -0700 | [diff] [blame] | 298 | printf("data_registration: \ntech_domain=%s, radio_tech=%s, roaming=%d, registration_state=%d\n", |
| 299 | tech_domain[t_info.data_registration.tech_domain], |
| 300 | radio_tech[t_info.data_registration.radio_tech], |
| 301 | t_info.data_registration.roaming, |
| 302 | t_info.data_registration.registration_state); |
b.liu | 86b7ff2 | 2024-04-03 14:25:55 +0800 | [diff] [blame] | 303 | } |
r.xiao | fca7c47 | 2024-04-24 01:00:23 -0700 | [diff] [blame] | 304 | if(t_info.voice_registration_details_3gpp_valid) |
| 305 | { |
| 306 | printf("voice_registration_details_3gpp: \ntech_domain=%s, radio_tech=%s, mcc=%s, mnc=%s, roaming=%d, forbidden=%d, cid=0x%X, lac=%d, psc=%d, tac=%d\n", |
| 307 | tech_domain[t_info.voice_registration_details_3gpp.tech_domain], |
| 308 | radio_tech[t_info.voice_registration_details_3gpp.radio_tech], |
| 309 | t_info.voice_registration_details_3gpp.mcc, |
| 310 | t_info.voice_registration_details_3gpp.mnc, |
| 311 | t_info.voice_registration_details_3gpp.roaming, |
| 312 | t_info.voice_registration_details_3gpp.forbidden, |
| 313 | t_info.voice_registration_details_3gpp.cid, |
| 314 | t_info.voice_registration_details_3gpp.lac, |
| 315 | t_info.voice_registration_details_3gpp.psc, |
| 316 | t_info.voice_registration_details_3gpp.tac); |
| 317 | } |
| 318 | if(t_info.data_registration_details_3gpp_valid) |
| 319 | { |
| 320 | printf("data_registration_details_3gpp: \ntech_domain=%s, radio_tech=%s, mcc=%s, mnc=%s, roaming=%d, forbidden=%d, cid=0x%X, lac=%d, psc=%d, tac=%d\n", |
| 321 | tech_domain[t_info.data_registration_details_3gpp.tech_domain], |
| 322 | radio_tech[t_info.data_registration_details_3gpp.radio_tech], |
| 323 | t_info.data_registration_details_3gpp.mcc, |
| 324 | t_info.data_registration_details_3gpp.mnc, |
| 325 | t_info.data_registration_details_3gpp.roaming, |
| 326 | t_info.data_registration_details_3gpp.forbidden, |
| 327 | t_info.data_registration_details_3gpp.cid, |
| 328 | t_info.data_registration_details_3gpp.lac, |
| 329 | t_info.data_registration_details_3gpp.psc, |
| 330 | t_info.data_registration_details_3gpp.tac); |
| 331 | } |
| 332 | |
| 333 | if(t_info.voice_registration_details_3gpp2_valid) |
| 334 | { |
| 335 | printf("voice_registration_details_3gpp2: \ntech_domain=%s, radio_tech=%s, mcc=%s, mnc=%s, roaming=%d, forbidden=%d, sid=%d, nid=%d, bsid=%d\n", |
| 336 | tech_domain[t_info.voice_registration_details_3gpp2.tech_domain], |
| 337 | radio_tech[t_info.voice_registration_details_3gpp2.radio_tech], |
| 338 | t_info.voice_registration_details_3gpp2.mcc, |
| 339 | t_info.voice_registration_details_3gpp2.mnc, |
| 340 | t_info.voice_registration_details_3gpp2.roaming, |
| 341 | t_info.voice_registration_details_3gpp2.forbidden, |
| 342 | t_info.voice_registration_details_3gpp2.sid, |
| 343 | t_info.voice_registration_details_3gpp2.nid, |
| 344 | t_info.voice_registration_details_3gpp2.bsid); |
| 345 | } |
| 346 | |
| 347 | if(t_info.data_registration_details_3gpp2_valid) |
| 348 | { |
| 349 | printf("data_registration_details_3gpp2: \ntech_domain=%s, radio_tech=%s, mcc=%s, mnc=%s, roaming=%d, forbidden=%d, sid=%d, nid=%d, bsid=%d\n", |
| 350 | tech_domain[t_info.data_registration_details_3gpp2.tech_domain], |
| 351 | radio_tech[t_info.data_registration_details_3gpp2.radio_tech], |
| 352 | t_info.data_registration_details_3gpp2.mcc, |
| 353 | t_info.data_registration_details_3gpp2.mnc, |
| 354 | t_info.data_registration_details_3gpp2.roaming, |
| 355 | t_info.data_registration_details_3gpp2.forbidden, |
| 356 | t_info.data_registration_details_3gpp2.sid, |
| 357 | t_info.data_registration_details_3gpp2.nid, |
| 358 | t_info.data_registration_details_3gpp2.bsid); |
| 359 | } |
| 360 | |
b.liu | 86b7ff2 | 2024-04-03 14:25:55 +0800 | [diff] [blame] | 361 | //printf("Data Reg: radio_tech = %d, lac = %x, cid = %x\n", reg.data_registration_details_3gpp.radio_tech, reg.data_registration_details_3gpp.lac, reg.data_registration_details_3gpp.cid); |
| 362 | //printf("Voice Reg: radio_tech = %d, lac = %x, cid = %x\n", reg.voice_registration_details_3gpp.radio_tech, reg.voice_registration_details_3gpp.lac, reg.voice_registration_details_3gpp.cid); |
| 363 | } |
| 364 | } |
| 365 | break; |
| 366 | case 6: |
| 367 | { |
r.xiao | fca7c47 | 2024-04-24 01:00:23 -0700 | [diff] [blame] | 368 | QSER_NW_SIGNAL_STRENGTH_INFO_T t_info; |
| 369 | int err = qser_nw_get_signal_strength(handle, &t_info); |
b.liu | 86b7ff2 | 2024-04-03 14:25:55 +0800 | [diff] [blame] | 370 | if(err) |
| 371 | { |
| 372 | printf("Error : %d\n", err); |
| 373 | } |
| 374 | else |
| 375 | { |
r.xiao | fca7c47 | 2024-04-24 01:00:23 -0700 | [diff] [blame] | 376 | printf("qser_nw_get_signal_strength, ret=%d\n", err); |
| 377 | if(err==0) |
| 378 | { |
| 379 | printf("qser_solicited_signal_strength gsm_sig_info_valid = %d\n" |
| 380 | " gsm_sig_info.rssi = %d\n" |
| 381 | " wcdma _sig_info_valid = %d\n" |
| 382 | " wcdma_sig_info.rssi = %d\n" |
| 383 | " wcdma_sig_info.ecio = %d\n" |
| 384 | " tdscdma_sig_info_valid = %d\n" |
| 385 | " lte_sig_info_valid = %d\n" |
| 386 | " lte_sig_info.rssi = %d\n" |
| 387 | " lte_sig_info.rsrp = %d\n" |
| 388 | " lte_sig_info.rsrq = %d\n" |
| 389 | " lte_sig_info.snr = %d\n" |
| 390 | " cdma_sig_info_valid = %d\n" |
| 391 | " hdr_sig_info_valid = %d\n" |
| 392 | " nr_sig_info_valid = %d\n" |
| 393 | " nr_sig_info.ssRsrp = %d\n" |
| 394 | " nr_sig_info.ssRsrq = %d\n" |
| 395 | " nr_sig_info.ssSinr = %d\n" |
| 396 | " nr_sig_info.csiRsrp = %d\n" |
| 397 | " nr_sig_info.csiRsrq = %d\n" |
| 398 | " nr_sig_info.csiSinr = %d\n", |
| 399 | t_info.gsm_sig_info_valid, t_info.gsm_sig_info.rssi, |
| 400 | t_info.wcdma_sig_info_valid, t_info.wcdma_sig_info.rssi, t_info.wcdma_sig_info.ecio, |
| 401 | t_info.tdscdma_sig_info_valid, |
| 402 | t_info.lte_sig_info_valid, t_info.lte_sig_info.rssi, t_info.lte_sig_info.rsrp, t_info.lte_sig_info.rsrq, t_info.lte_sig_info.snr, |
| 403 | t_info.cdma_sig_info_valid, |
| 404 | t_info.hdr_sig_info_valid, |
| 405 | t_info.nr_sig_info_valid, t_info.nr_sig_info.ssRsrp, t_info.nr_sig_info.ssRsrq, t_info.nr_sig_info.ssSinr, |
| 406 | t_info.nr_sig_info.csiRsrp, t_info.nr_sig_info.csiRsrq, t_info.nr_sig_info.csiSinr); |
| 407 | |
| 408 | } |
| 409 | |
b.liu | 86b7ff2 | 2024-04-03 14:25:55 +0800 | [diff] [blame] | 410 | } |
| 411 | } |
| 412 | break; |
| 413 | case 7: |
| 414 | { |
| 415 | QSER_NW_OOS_CONFIG_INFO_T pt_info_s; |
| 416 | memset(&pt_info_s, 0x00, sizeof(QSER_NW_OOS_CONFIG_INFO_T)); |
| 417 | /*取值范围0-255,设置时间自定义 |
| 418 | phase 1 5次 次数无法更改,这五次都是以10秒为一次的间隔搜网 |
| 419 | phase 2 5次 次数无法更改,这五次都是以15秒为一次的间隔搜网 |
| 420 | phase 3 不限制次数的秒数设置,第三阶段不限制次数以20秒为一次的间隔搜网 |
| 421 | 如果要关闭OOS配置,则把min step max 全部配置为0即可 |
| 422 | */ |
r.xiao | 9aa0e40 | 2024-08-21 01:32:57 -0700 | [diff] [blame] | 423 | int p1,p2,p3; |
| 424 | printf("input phase 1 number:\n"); |
r.xiao | 8308518 | 2024-09-23 02:14:11 -0700 | [diff] [blame] | 425 | memset(operator, 0x0, 10); |
| 426 | fgets(operator, 10, stdin); |
r.xiao | 9aa0e40 | 2024-08-21 01:32:57 -0700 | [diff] [blame] | 427 | fflush(stdin); |
| 428 | p1 = atoi(operator); |
| 429 | printf("phase 1 number:%s\n", operator); |
| 430 | |
| 431 | printf("input phase 2 number:\n"); |
r.xiao | 8308518 | 2024-09-23 02:14:11 -0700 | [diff] [blame] | 432 | memset(operator, 0x0, 10); |
| 433 | fgets(operator, 10, stdin); |
r.xiao | 9aa0e40 | 2024-08-21 01:32:57 -0700 | [diff] [blame] | 434 | fflush(stdin); |
| 435 | p2 = atoi(operator); |
| 436 | printf("phase 2 number:%s\n", operator); |
| 437 | |
| 438 | printf("input phase 3 number:\n"); |
r.xiao | 8308518 | 2024-09-23 02:14:11 -0700 | [diff] [blame] | 439 | memset(operator, 0x0, 10); |
| 440 | fgets(operator, 10, stdin); |
r.xiao | 9aa0e40 | 2024-08-21 01:32:57 -0700 | [diff] [blame] | 441 | fflush(stdin); |
| 442 | p3 = atoi(operator); |
| 443 | printf("phase 3 number:%s\n", operator); |
| 444 | |
b.liu | 86b7ff2 | 2024-04-03 14:25:55 +0800 | [diff] [blame] | 445 | pt_info_s.type = QSER_NW_OOS_CFG_TYPE_FULL_BAND_SCAN;//平台提供自定义配置搜网时间间隔 |
| 446 | { |
r.xiao | 9aa0e40 | 2024-08-21 01:32:57 -0700 | [diff] [blame] | 447 | pt_info_s.u.full_band_scan_info.t_min = p1;//phase 1 |
| 448 | pt_info_s.u.full_band_scan_info.t_step = p2;//phase 2 |
b.liu | 86b7ff2 | 2024-04-03 14:25:55 +0800 | [diff] [blame] | 449 | pt_info_s.u.full_band_scan_info.t_num = 0;//可以不配置,并没有使用 |
r.xiao | 9aa0e40 | 2024-08-21 01:32:57 -0700 | [diff] [blame] | 450 | pt_info_s.u.full_band_scan_info.t_max = p3;//phase 3 |
b.liu | 86b7ff2 | 2024-04-03 14:25:55 +0800 | [diff] [blame] | 451 | } |
| 452 | printf("set OOS %d %d %d \n",pt_info_s.u.full_band_scan_info.t_min, pt_info_s.u.full_band_scan_info.t_step, pt_info_s.u.full_band_scan_info.t_max); |
| 453 | //pt_info_s.type = QSER_NW_OOS_CFG_TYPE_FAST_SCAN;平台本身有历史频点优先处理的逻辑(无接口不需要我们进行处理) |
r.xiao | ba8483c | 2024-04-14 18:53:10 -0700 | [diff] [blame] | 454 | ret = qser_nw_set_oos_config(handle, &pt_info_s); |
| 455 | printf("qser_nw_set_oos_config ret = %d\n", ret); |
b.liu | 86b7ff2 | 2024-04-03 14:25:55 +0800 | [diff] [blame] | 456 | } |
| 457 | break; |
| 458 | case 8: |
| 459 | { |
| 460 | QSER_NW_OOS_CONFIG_INFO_T pt_info_g; |
| 461 | qser_nw_get_oos_config(handle, &pt_info_g); |
| 462 | if (pt_info_g.type == QSER_NW_OOS_CFG_TYPE_FULL_BAND_SCAN) |
| 463 | printf("TYPE: %d min: %d setp: %d max: %d\n", pt_info_g.type, pt_info_g.u.full_band_scan_info.t_min, pt_info_g.u.full_band_scan_info.t_step, pt_info_g.u.full_band_scan_info.t_max); |
| 464 | else |
| 465 | printf("type not supported \n"); |
| 466 | } |
| 467 | break; |
| 468 | case 9: |
| 469 | { |
| 470 | printf("please input 0 or 1 or 4: \n"); |
| 471 | memset(operator,0x00, sizeof(operator)); |
| 472 | fgets(operator, sizeof(operator)-1, stdin); |
| 473 | fflush(stdin); |
| 474 | opt = atoi(operator); |
| 475 | printf("rf_mode: [%d]\n",opt); |
r.xiao | ba8483c | 2024-04-14 18:53:10 -0700 | [diff] [blame] | 476 | ret = qser_nw_set_rf_mode(handle, opt); |
| 477 | printf("qser_nw_set_rf_mode ret = %d\n", ret); |
b.liu | 86b7ff2 | 2024-04-03 14:25:55 +0800 | [diff] [blame] | 478 | } |
| 479 | break; |
| 480 | case 10: |
| 481 | { |
| 482 | int rf_t; |
| 483 | qser_nw_get_rf_mode(handle, &rf_t); |
| 484 | printf(">>>rf_mode = [%d]\n",rf_t); |
| 485 | } |
| 486 | break; |
| 487 | case 11: |
r.xiao | ba8483c | 2024-04-14 18:53:10 -0700 | [diff] [blame] | 488 | { |
| 489 | E_QSER_NW_IMS_MODE_TYPE_T ims_mode; |
| 490 | printf("please input you want set ims mode (0: off; 1: volte enable \n"); |
| 491 | scanf("%d", &ims_mode); |
| 492 | ret = qser_nw_set_ims_enable(handle, ims_mode); |
| 493 | printf("qser_nw_set_ims_enable %d ret = %d\n",ims_mode, ret); |
| 494 | } |
| 495 | break; |
| 496 | case 12: |
| 497 | { |
| 498 | QSER_NW_IMS_REG_STATUS_INFO_T t_info; |
| 499 | memset(&t_info, 0, sizeof(QSER_NW_IMS_REG_STATUS_INFO_T)); |
| 500 | ret = qser_nw_get_ims_reg_status(handle, &t_info); |
| 501 | printf("qser_nw_get_ims_reg_status ret = %d, detail info:\n", ret); |
| 502 | if(ret == 0) |
| 503 | { |
| 504 | printf("ims_registration: registration_state=%d\n", t_info.registration_state); |
| 505 | } |
| 506 | } |
| 507 | break; |
| 508 | case 13: |
b.liu | 86b7ff2 | 2024-04-03 14:25:55 +0800 | [diff] [blame] | 509 | qser_nw_client_deinit(handle); |
| 510 | break; |
| 511 | default: |
| 512 | break; |
| 513 | } |
| 514 | |
| 515 | } |
| 516 | |
| 517 | return 0; |
| 518 | } |
| 519 | |