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 | { |
| 185 | printf("Recv event indication : IMS REG EVENT\n"); |
| 186 | |
| 187 | break; |
| 188 | } |
| 189 | default: |
| 190 | break; |
b.liu | 86b7ff2 | 2024-04-03 14:25:55 +0800 | [diff] [blame] | 191 | } |
b.liu | 86b7ff2 | 2024-04-03 14:25:55 +0800 | [diff] [blame] | 192 | } |
| 193 | |
| 194 | |
r.xiao | fca7c47 | 2024-04-24 01:00:23 -0700 | [diff] [blame] | 195 | |
b.liu | 86b7ff2 | 2024-04-03 14:25:55 +0800 | [diff] [blame] | 196 | int main(int argc, char *argv[]) |
| 197 | { |
| 198 | char operator[10]; |
| 199 | int opt; |
| 200 | int lv_voll = 0; |
r.xiao | ba8483c | 2024-04-14 18:53:10 -0700 | [diff] [blame] | 201 | int ret; |
b.liu | 86b7ff2 | 2024-04-03 14:25:55 +0800 | [diff] [blame] | 202 | nw_client_handle_type handle = -1; |
| 203 | mbtk_log_init("radio", "NW_TEST"); |
| 204 | |
r.xiao | ba8483c | 2024-04-14 18:53:10 -0700 | [diff] [blame] | 205 | printf("=========network main=========\n" |
| 206 | "\t0 exit\n" |
| 207 | "\t1 network init\n" |
| 208 | "\t2 network add rx msg handle\n" |
| 209 | "\t3 network band set config\n" |
| 210 | "\t4 network get operator name\n" |
| 211 | "\t5 network get reg status\n" |
| 212 | "\t6 network get signal strength\n" |
| 213 | "\t7 network set oos config\n" |
| 214 | "\t8 network get oos config\n" |
| 215 | "\t9 network set rf config\n" |
| 216 | "\t10 network get rf config\n" |
| 217 | "\t11 network set ims config\n" |
| 218 | "\t12 network get ims config\n" |
| 219 | "\t13 network deinit\n" |
| 220 | "operator: >> "); |
| 221 | |
b.liu | 86b7ff2 | 2024-04-03 14:25:55 +0800 | [diff] [blame] | 222 | while(1) |
| 223 | { |
b.liu | 86b7ff2 | 2024-04-03 14:25:55 +0800 | [diff] [blame] | 224 | |
r.xiao | ba8483c | 2024-04-14 18:53:10 -0700 | [diff] [blame] | 225 | opt = -1; |
b.liu | 86b7ff2 | 2024-04-03 14:25:55 +0800 | [diff] [blame] | 226 | fgets(operator, sizeof(operator), stdin); |
| 227 | fflush(stdin); |
| 228 | opt = atoi(operator); |
| 229 | switch (opt) |
| 230 | { |
| 231 | case 0: |
| 232 | printf("main exit\n"); |
| 233 | return 0; |
| 234 | case 1: |
r.xiao | ba8483c | 2024-04-14 18:53:10 -0700 | [diff] [blame] | 235 | ret = qser_nw_client_init(&handle); |
| 236 | printf("qser_nw_client_init ret = %d\n", ret); |
b.liu | 86b7ff2 | 2024-04-03 14:25:55 +0800 | [diff] [blame] | 237 | break; |
| 238 | case 2: |
r.xiao | ba8483c | 2024-04-14 18:53:10 -0700 | [diff] [blame] | 239 | ret = qser_nw_add_rx_msg_handler(handle, nw_event_ind_handler, NULL); |
| 240 | printf("qser_nw_add_rx_msg_handler ret = %d\n", ret); |
b.liu | 86b7ff2 | 2024-04-03 14:25:55 +0800 | [diff] [blame] | 241 | break; |
| 242 | case 3: |
| 243 | { |
| 244 | //漫游开关现在不支持,所以就不用配置 |
| 245 | printf("please input \n" |
| 246 | "\t1:GSM \n" |
| 247 | "\t2:WCDMA \n" |
| 248 | "\t4:CDMA \n" |
| 249 | "\t8:EVDO \n" |
| 250 | "\t16:LTE \n" |
| 251 | "\t32:TDSCDMA \n" |
| 252 | ); |
| 253 | memset(operator,0x00, sizeof(operator)); |
| 254 | fgets(operator, sizeof(operator)-1, stdin); |
| 255 | fflush(stdin); |
| 256 | opt = atoi(operator); |
| 257 | QSER_NW_CONFIG_INFO_T t_info; |
| 258 | switch(opt) |
| 259 | { |
| 260 | case 1: |
| 261 | t_info.preferred_nw_mode = QSER_NW_MODE_GSM;//2G |
| 262 | break; |
| 263 | case 2: |
| 264 | t_info.preferred_nw_mode = QSER_NW_MODE_WCDMA;//3G |
| 265 | break; |
| 266 | case 4: |
r.xiao | fca7c47 | 2024-04-24 01:00:23 -0700 | [diff] [blame] | 267 | t_info.preferred_nw_mode = QSER_NW_MODE_CDMA;//3G no support |
b.liu | 86b7ff2 | 2024-04-03 14:25:55 +0800 | [diff] [blame] | 268 | break; |
| 269 | case 8: |
r.xiao | fca7c47 | 2024-04-24 01:00:23 -0700 | [diff] [blame] | 270 | t_info.preferred_nw_mode = QSER_NW_MODE_EVDO;//3G no support |
b.liu | 86b7ff2 | 2024-04-03 14:25:55 +0800 | [diff] [blame] | 271 | break; |
| 272 | case 16: |
| 273 | t_info.preferred_nw_mode = QSER_NW_MODE_LTE;//4G |
| 274 | break; |
| 275 | case 32: |
r.xiao | fca7c47 | 2024-04-24 01:00:23 -0700 | [diff] [blame] | 276 | t_info.preferred_nw_mode = QSER_NW_MODE_TDSCDMA;//3G no support |
b.liu | 86b7ff2 | 2024-04-03 14:25:55 +0800 | [diff] [blame] | 277 | break; |
| 278 | default: |
| 279 | t_info.preferred_nw_mode = QSER_NW_MODE_LTE;//4G |
| 280 | break; |
| 281 | } |
r.xiao | ba8483c | 2024-04-14 18:53:10 -0700 | [diff] [blame] | 282 | ret = qser_nw_set_config(handle, &t_info); |
| 283 | printf("qser_nw_set_config ret = %d\n", ret); |
b.liu | 86b7ff2 | 2024-04-03 14:25:55 +0800 | [diff] [blame] | 284 | } |
| 285 | break; |
| 286 | case 4: |
| 287 | { |
| 288 | QSER_NW_OPERATOR_NAME_INFO_T t_info; |
| 289 | int err = qser_nw_get_operator_name(handle, &t_info); |
| 290 | if(err) |
| 291 | { |
| 292 | printf("Error : %d\n", err); |
| 293 | } else |
| 294 | { |
| 295 | printf("Operator : %s, %s, %s, %s\n", t_info.long_eons, t_info.short_eons, t_info.mcc, t_info.mnc); |
| 296 | } |
| 297 | } |
| 298 | break; |
| 299 | case 5: |
| 300 | { |
r.xiao | fca7c47 | 2024-04-24 01:00:23 -0700 | [diff] [blame] | 301 | QSER_NW_REG_STATUS_INFO_T t_info; |
| 302 | int err = qser_nw_get_reg_status(handle, &t_info); |
b.liu | 86b7ff2 | 2024-04-03 14:25:55 +0800 | [diff] [blame] | 303 | if(err) |
| 304 | { |
| 305 | printf("Error : %d\n", err); |
| 306 | } |
| 307 | else |
| 308 | { |
r.xiao | fca7c47 | 2024-04-24 01:00:23 -0700 | [diff] [blame] | 309 | if(t_info.voice_registration_valid) |
b.liu | 86b7ff2 | 2024-04-03 14:25:55 +0800 | [diff] [blame] | 310 | { |
r.xiao | fca7c47 | 2024-04-24 01:00:23 -0700 | [diff] [blame] | 311 | printf("voice_registration: \ntech_domain=%s, radio_tech=%s, roaming=%d, registration_state=%d\n", |
| 312 | tech_domain[t_info.voice_registration.tech_domain], |
| 313 | radio_tech[t_info.voice_registration.radio_tech], |
| 314 | t_info.voice_registration.roaming, |
| 315 | t_info.voice_registration.registration_state); |
b.liu | 86b7ff2 | 2024-04-03 14:25:55 +0800 | [diff] [blame] | 316 | } |
r.xiao | fca7c47 | 2024-04-24 01:00:23 -0700 | [diff] [blame] | 317 | if(t_info.data_registration_valid) |
b.liu | 86b7ff2 | 2024-04-03 14:25:55 +0800 | [diff] [blame] | 318 | { |
r.xiao | fca7c47 | 2024-04-24 01:00:23 -0700 | [diff] [blame] | 319 | printf("data_registration: \ntech_domain=%s, radio_tech=%s, roaming=%d, registration_state=%d\n", |
| 320 | tech_domain[t_info.data_registration.tech_domain], |
| 321 | radio_tech[t_info.data_registration.radio_tech], |
| 322 | t_info.data_registration.roaming, |
| 323 | t_info.data_registration.registration_state); |
b.liu | 86b7ff2 | 2024-04-03 14:25:55 +0800 | [diff] [blame] | 324 | } |
r.xiao | fca7c47 | 2024-04-24 01:00:23 -0700 | [diff] [blame] | 325 | if(t_info.voice_registration_details_3gpp_valid) |
| 326 | { |
| 327 | 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", |
| 328 | tech_domain[t_info.voice_registration_details_3gpp.tech_domain], |
| 329 | radio_tech[t_info.voice_registration_details_3gpp.radio_tech], |
| 330 | t_info.voice_registration_details_3gpp.mcc, |
| 331 | t_info.voice_registration_details_3gpp.mnc, |
| 332 | t_info.voice_registration_details_3gpp.roaming, |
| 333 | t_info.voice_registration_details_3gpp.forbidden, |
| 334 | t_info.voice_registration_details_3gpp.cid, |
| 335 | t_info.voice_registration_details_3gpp.lac, |
| 336 | t_info.voice_registration_details_3gpp.psc, |
| 337 | t_info.voice_registration_details_3gpp.tac); |
| 338 | } |
| 339 | if(t_info.data_registration_details_3gpp_valid) |
| 340 | { |
| 341 | 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", |
| 342 | tech_domain[t_info.data_registration_details_3gpp.tech_domain], |
| 343 | radio_tech[t_info.data_registration_details_3gpp.radio_tech], |
| 344 | t_info.data_registration_details_3gpp.mcc, |
| 345 | t_info.data_registration_details_3gpp.mnc, |
| 346 | t_info.data_registration_details_3gpp.roaming, |
| 347 | t_info.data_registration_details_3gpp.forbidden, |
| 348 | t_info.data_registration_details_3gpp.cid, |
| 349 | t_info.data_registration_details_3gpp.lac, |
| 350 | t_info.data_registration_details_3gpp.psc, |
| 351 | t_info.data_registration_details_3gpp.tac); |
| 352 | } |
| 353 | |
| 354 | if(t_info.voice_registration_details_3gpp2_valid) |
| 355 | { |
| 356 | 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", |
| 357 | tech_domain[t_info.voice_registration_details_3gpp2.tech_domain], |
| 358 | radio_tech[t_info.voice_registration_details_3gpp2.radio_tech], |
| 359 | t_info.voice_registration_details_3gpp2.mcc, |
| 360 | t_info.voice_registration_details_3gpp2.mnc, |
| 361 | t_info.voice_registration_details_3gpp2.roaming, |
| 362 | t_info.voice_registration_details_3gpp2.forbidden, |
| 363 | t_info.voice_registration_details_3gpp2.sid, |
| 364 | t_info.voice_registration_details_3gpp2.nid, |
| 365 | t_info.voice_registration_details_3gpp2.bsid); |
| 366 | } |
| 367 | |
| 368 | if(t_info.data_registration_details_3gpp2_valid) |
| 369 | { |
| 370 | 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", |
| 371 | tech_domain[t_info.data_registration_details_3gpp2.tech_domain], |
| 372 | radio_tech[t_info.data_registration_details_3gpp2.radio_tech], |
| 373 | t_info.data_registration_details_3gpp2.mcc, |
| 374 | t_info.data_registration_details_3gpp2.mnc, |
| 375 | t_info.data_registration_details_3gpp2.roaming, |
| 376 | t_info.data_registration_details_3gpp2.forbidden, |
| 377 | t_info.data_registration_details_3gpp2.sid, |
| 378 | t_info.data_registration_details_3gpp2.nid, |
| 379 | t_info.data_registration_details_3gpp2.bsid); |
| 380 | } |
| 381 | |
b.liu | 86b7ff2 | 2024-04-03 14:25:55 +0800 | [diff] [blame] | 382 | //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); |
| 383 | //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); |
| 384 | } |
| 385 | } |
| 386 | break; |
| 387 | case 6: |
| 388 | { |
r.xiao | fca7c47 | 2024-04-24 01:00:23 -0700 | [diff] [blame] | 389 | QSER_NW_SIGNAL_STRENGTH_INFO_T t_info; |
| 390 | int err = qser_nw_get_signal_strength(handle, &t_info); |
b.liu | 86b7ff2 | 2024-04-03 14:25:55 +0800 | [diff] [blame] | 391 | if(err) |
| 392 | { |
| 393 | printf("Error : %d\n", err); |
| 394 | } |
| 395 | else |
| 396 | { |
r.xiao | fca7c47 | 2024-04-24 01:00:23 -0700 | [diff] [blame] | 397 | printf("qser_nw_get_signal_strength, ret=%d\n", err); |
| 398 | if(err==0) |
| 399 | { |
| 400 | printf("qser_solicited_signal_strength gsm_sig_info_valid = %d\n" |
| 401 | " gsm_sig_info.rssi = %d\n" |
| 402 | " wcdma _sig_info_valid = %d\n" |
| 403 | " wcdma_sig_info.rssi = %d\n" |
| 404 | " wcdma_sig_info.ecio = %d\n" |
| 405 | " tdscdma_sig_info_valid = %d\n" |
| 406 | " lte_sig_info_valid = %d\n" |
| 407 | " lte_sig_info.rssi = %d\n" |
| 408 | " lte_sig_info.rsrp = %d\n" |
| 409 | " lte_sig_info.rsrq = %d\n" |
| 410 | " lte_sig_info.snr = %d\n" |
| 411 | " cdma_sig_info_valid = %d\n" |
| 412 | " hdr_sig_info_valid = %d\n" |
| 413 | " nr_sig_info_valid = %d\n" |
| 414 | " nr_sig_info.ssRsrp = %d\n" |
| 415 | " nr_sig_info.ssRsrq = %d\n" |
| 416 | " nr_sig_info.ssSinr = %d\n" |
| 417 | " nr_sig_info.csiRsrp = %d\n" |
| 418 | " nr_sig_info.csiRsrq = %d\n" |
| 419 | " nr_sig_info.csiSinr = %d\n", |
| 420 | t_info.gsm_sig_info_valid, t_info.gsm_sig_info.rssi, |
| 421 | t_info.wcdma_sig_info_valid, t_info.wcdma_sig_info.rssi, t_info.wcdma_sig_info.ecio, |
| 422 | t_info.tdscdma_sig_info_valid, |
| 423 | 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, |
| 424 | t_info.cdma_sig_info_valid, |
| 425 | t_info.hdr_sig_info_valid, |
| 426 | t_info.nr_sig_info_valid, t_info.nr_sig_info.ssRsrp, t_info.nr_sig_info.ssRsrq, t_info.nr_sig_info.ssSinr, |
| 427 | t_info.nr_sig_info.csiRsrp, t_info.nr_sig_info.csiRsrq, t_info.nr_sig_info.csiSinr); |
| 428 | |
| 429 | } |
| 430 | |
b.liu | 86b7ff2 | 2024-04-03 14:25:55 +0800 | [diff] [blame] | 431 | } |
| 432 | } |
| 433 | break; |
| 434 | case 7: |
| 435 | { |
| 436 | QSER_NW_OOS_CONFIG_INFO_T pt_info_s; |
| 437 | memset(&pt_info_s, 0x00, sizeof(QSER_NW_OOS_CONFIG_INFO_T)); |
| 438 | /*取值范围0-255,设置时间自定义 |
| 439 | phase 1 5次 次数无法更改,这五次都是以10秒为一次的间隔搜网 |
| 440 | phase 2 5次 次数无法更改,这五次都是以15秒为一次的间隔搜网 |
| 441 | phase 3 不限制次数的秒数设置,第三阶段不限制次数以20秒为一次的间隔搜网 |
| 442 | 如果要关闭OOS配置,则把min step max 全部配置为0即可 |
| 443 | */ |
| 444 | pt_info_s.type = QSER_NW_OOS_CFG_TYPE_FULL_BAND_SCAN;//平台提供自定义配置搜网时间间隔 |
| 445 | { |
| 446 | pt_info_s.u.full_band_scan_info.t_min = 10;//phase 1 |
| 447 | pt_info_s.u.full_band_scan_info.t_step = 15;//phase 2 |
| 448 | pt_info_s.u.full_band_scan_info.t_num = 0;//可以不配置,并没有使用 |
| 449 | pt_info_s.u.full_band_scan_info.t_max = 20;//phase 3 |
| 450 | } |
| 451 | 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); |
| 452 | //pt_info_s.type = QSER_NW_OOS_CFG_TYPE_FAST_SCAN;平台本身有历史频点优先处理的逻辑(无接口不需要我们进行处理) |
r.xiao | ba8483c | 2024-04-14 18:53:10 -0700 | [diff] [blame] | 453 | ret = qser_nw_set_oos_config(handle, &pt_info_s); |
| 454 | printf("qser_nw_set_oos_config ret = %d\n", ret); |
b.liu | 86b7ff2 | 2024-04-03 14:25:55 +0800 | [diff] [blame] | 455 | } |
| 456 | break; |
| 457 | case 8: |
| 458 | { |
| 459 | QSER_NW_OOS_CONFIG_INFO_T pt_info_g; |
| 460 | qser_nw_get_oos_config(handle, &pt_info_g); |
| 461 | if (pt_info_g.type == QSER_NW_OOS_CFG_TYPE_FULL_BAND_SCAN) |
| 462 | 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); |
| 463 | else |
| 464 | printf("type not supported \n"); |
| 465 | } |
| 466 | break; |
| 467 | case 9: |
| 468 | { |
| 469 | printf("please input 0 or 1 or 4: \n"); |
| 470 | memset(operator,0x00, sizeof(operator)); |
| 471 | fgets(operator, sizeof(operator)-1, stdin); |
| 472 | fflush(stdin); |
| 473 | opt = atoi(operator); |
| 474 | printf("rf_mode: [%d]\n",opt); |
r.xiao | ba8483c | 2024-04-14 18:53:10 -0700 | [diff] [blame] | 475 | ret = qser_nw_set_rf_mode(handle, opt); |
| 476 | printf("qser_nw_set_rf_mode ret = %d\n", ret); |
b.liu | 86b7ff2 | 2024-04-03 14:25:55 +0800 | [diff] [blame] | 477 | } |
| 478 | break; |
| 479 | case 10: |
| 480 | { |
| 481 | int rf_t; |
| 482 | qser_nw_get_rf_mode(handle, &rf_t); |
| 483 | printf(">>>rf_mode = [%d]\n",rf_t); |
| 484 | } |
| 485 | break; |
| 486 | case 11: |
r.xiao | ba8483c | 2024-04-14 18:53:10 -0700 | [diff] [blame] | 487 | { |
| 488 | E_QSER_NW_IMS_MODE_TYPE_T ims_mode; |
| 489 | printf("please input you want set ims mode (0: off; 1: volte enable \n"); |
| 490 | scanf("%d", &ims_mode); |
| 491 | ret = qser_nw_set_ims_enable(handle, ims_mode); |
| 492 | printf("qser_nw_set_ims_enable %d ret = %d\n",ims_mode, ret); |
| 493 | } |
| 494 | break; |
| 495 | case 12: |
| 496 | { |
| 497 | QSER_NW_IMS_REG_STATUS_INFO_T t_info; |
| 498 | memset(&t_info, 0, sizeof(QSER_NW_IMS_REG_STATUS_INFO_T)); |
| 499 | ret = qser_nw_get_ims_reg_status(handle, &t_info); |
| 500 | printf("qser_nw_get_ims_reg_status ret = %d, detail info:\n", ret); |
| 501 | if(ret == 0) |
| 502 | { |
| 503 | printf("ims_registration: registration_state=%d\n", t_info.registration_state); |
| 504 | } |
| 505 | } |
| 506 | break; |
| 507 | case 13: |
b.liu | 86b7ff2 | 2024-04-03 14:25:55 +0800 | [diff] [blame] | 508 | qser_nw_client_deinit(handle); |
| 509 | break; |
| 510 | default: |
| 511 | break; |
| 512 | } |
| 513 | |
| 514 | } |
| 515 | |
| 516 | return 0; |
| 517 | } |
| 518 | |