b.liu | 8583dce | 2024-04-03 13:30:08 +0800 | [diff] [blame] | 1 | #include <stdlib.h>
|
| 2 | #include <stdio.h>
|
| 3 | #include <stdint.h>
|
| 4 | #include <string.h>
|
| 5 | #include <dlfcn.h>
|
| 6 | #include <sys/types.h>
|
| 7 | //#include <pthread.h>
|
| 8 | #include <unistd.h>
|
| 9 | #include "lynq_qser_network.h"
|
| 10 |
|
| 11 | #ifndef LOG_TAG
|
| 12 | #define LOG_TAG "QSER_NETWORK_DEMO"
|
| 13 | #endif
|
| 14 |
|
| 15 | void *handle_network;
|
| 16 |
|
| 17 | int (*qser_nw_client_init_p)(nw_client_handle_type * ph_nw);
|
| 18 | int (*qser_nw_client_deinit_p)(nw_client_handle_type h_nw);
|
| 19 | int (*qser_nw_set_config_p)(nw_client_handle_type h_nw, QSER_NW_CONFIG_INFO_T *pt_info);
|
| 20 | int (*qser_nw_get_operator_name_p)(nw_client_handle_type h_nw, QSER_NW_OPERATOR_NAME_INFO_T *pt_info );
|
| 21 | int (*qser_nw_get_reg_status_p)(nw_client_handle_type h_nw, QSER_NW_REG_STATUS_INFO_T *pt_info);
|
| 22 | int (*qser_nw_add_rx_msg_handler_p)(nw_client_handle_type h_nw, QSER_NW_RxMsgHandlerFunc_t handlerPtr,void* contextPtr);
|
| 23 | int (*qser_nw_get_signal_strength_p)(nw_client_handle_type h_nw,QSER_NW_SIGNAL_STRENGTH_INFO_T *pt_info);
|
| 24 | int (*qser_nw_set_oos_config_p)(nw_client_handle_type h_nw, QSER_NW_OOS_CONFIG_INFO_T *pt_info);
|
| 25 | int (*qser_nw_get_oos_config_p)(nw_client_handle_type h_nw, QSER_NW_OOS_CONFIG_INFO_T *pt_info);
|
| 26 | int (*qser_nw_set_rf_mode_p) (nw_client_handle_type h_nw,E_QSER_NW_RF_MODE_TYPE_T rf_mode);
|
| 27 | int (*qser_nw_get_rf_mode_p) (nw_client_handle_type h_nw,E_QSER_NW_RF_MODE_TYPE_T* rf_mode);
|
| 28 | int (*qser_nw_set_ims_enable_p) (nw_client_handle_type h_nw,E_QSER_NW_IMS_MODE_TYPE_T ims_mode);
|
| 29 | int (*qser_nw_get_ims_reg_status_p) (nw_client_handle_type h_nw, QSER_NW_IMS_REG_STATUS_INFO_T *pt_info);
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 | int getFunc()
|
| 34 | {
|
| 35 | const char *lynq_libpath_network = "/lib/liblynq-qser-network.so";
|
| 36 |
|
| 37 | handle_network = dlopen(lynq_libpath_network,RTLD_NOW);
|
| 38 | if(NULL == handle_network)
|
| 39 | {
|
| 40 | printf("dlopen lynq_libpath_network fail:%s",dlerror());
|
| 41 | exit(EXIT_FAILURE);
|
| 42 | }
|
| 43 |
|
| 44 | qser_nw_client_init_p = (int (*)(nw_client_handle_type * ph_nw))dlsym(handle_network,"qser_nw_client_init");
|
| 45 | qser_nw_client_deinit_p = (int (*)(nw_client_handle_type h_nw))dlsym(handle_network,"qser_nw_client_deinit");
|
| 46 | qser_nw_set_config_p = (int (*)(nw_client_handle_type h_nw, QSER_NW_CONFIG_INFO_T *pt_info))dlsym(handle_network,"qser_nw_set_config");
|
| 47 | qser_nw_get_operator_name_p = (int (*)(nw_client_handle_type h_nw, QSER_NW_OPERATOR_NAME_INFO_T *pt_info ))dlsym(handle_network,"qser_nw_get_operator_name");
|
| 48 | qser_nw_get_reg_status_p = (int (*)(nw_client_handle_type h_nw, QSER_NW_REG_STATUS_INFO_T *pt_info))dlsym(handle_network,"qser_nw_get_reg_status");
|
| 49 | qser_nw_get_signal_strength_p = (int (*)(nw_client_handle_type h_nw, QSER_NW_SIGNAL_STRENGTH_INFO_T *pt_info))dlsym(handle_network,"qser_nw_get_signal_strength");
|
| 50 | qser_nw_add_rx_msg_handler_p = (int (*)(nw_client_handle_type h_nw, QSER_NW_RxMsgHandlerFunc_t handlerPtr,void* contextPtr))dlsym(handle_network,"qser_nw_add_rx_msg_handler");
|
| 51 | qser_nw_get_oos_config_p = (int (*)(nw_client_handle_type h_nw, QSER_NW_OOS_CONFIG_INFO_T *pt_info))dlsym(handle_network,"qser_nw_get_oos_config");
|
| 52 | qser_nw_set_oos_config_p = (int (*)(nw_client_handle_type h_nw, QSER_NW_OOS_CONFIG_INFO_T *pt_info))dlsym(handle_network,"qser_nw_set_oos_config");
|
| 53 | qser_nw_set_rf_mode_p = (int (*)(nw_client_handle_type h_nw, E_QSER_NW_RF_MODE_TYPE_T rf_mode))dlsym(handle_network,"qser_nw_set_rf_mode");
|
| 54 | qser_nw_get_rf_mode_p = (int (*)(nw_client_handle_type h_nw, E_QSER_NW_RF_MODE_TYPE_T* rf_mode))dlsym(handle_network,"qser_nw_get_rf_mode");
|
| 55 | qser_nw_set_ims_enable_p = (int (*)(nw_client_handle_type h_nw, E_QSER_NW_IMS_MODE_TYPE_T ims_mode))dlsym(handle_network,"qser_nw_set_ims_enable");
|
| 56 | qser_nw_get_ims_reg_status_p = (int (*)(nw_client_handle_type h_nw, QSER_NW_IMS_REG_STATUS_INFO_T *pt_info))dlsym(handle_network,"qser_nw_get_ims_reg_status");
|
| 57 |
|
| 58 | if(qser_nw_client_deinit_p==NULL || qser_nw_client_init_p==NULL || qser_nw_set_config_p ==NULL ||
|
| 59 | qser_nw_get_operator_name_p == NULL || qser_nw_get_reg_status_p ==NULL || qser_nw_add_rx_msg_handler_p==NULL ||
|
| 60 | qser_nw_set_rf_mode_p == NULL || qser_nw_get_rf_mode_p == NULL || qser_nw_get_oos_config_p == NULL || qser_nw_set_oos_config_p == NULL ||
|
| 61 | qser_nw_set_ims_enable_p == NULL || qser_nw_get_ims_reg_status_p == NULL)
|
| 62 | {
|
| 63 | printf("get func pointer null");
|
| 64 | exit(EXIT_FAILURE);
|
| 65 | }
|
| 66 | return 0;
|
| 67 | }
|
| 68 |
|
| 69 | static int test_nw(void);
|
| 70 |
|
| 71 | int main(int argc, char const *argv[])
|
| 72 | {
|
| 73 | printf("--------->[%s,%d] start \n",__FUNCTION__,__LINE__);
|
| 74 |
|
| 75 | if(getFunc()==0)
|
| 76 | {
|
| 77 | test_nw();
|
| 78 | }
|
| 79 |
|
| 80 | return 0;
|
| 81 | }
|
| 82 |
|
| 83 | typedef struct
|
| 84 | {
|
| 85 | int cmdIdx;
|
| 86 | char *funcName;
|
| 87 | } st_api_test_case;
|
| 88 |
|
| 89 | st_api_test_case at_nw_testlist[] =
|
| 90 | {
|
| 91 | {0, "qser_nw_client_init"},
|
| 92 | {1, "qser_nw_set_config"},
|
| 93 | {2, "qser_nw_get_operator_name"},
|
| 94 | {3, "qser_nw_get_reg_status"},
|
| 95 | {4, "qser_nw_add_rx_msg_handler"},
|
| 96 | {5, "qser_nw_get_signal_strength"},
|
| 97 | {6, "qser_nw_set_oos_config"},
|
| 98 | {7, "qser_nw_get_oos_config"},
|
| 99 | {8, "qser_nw_set_rf_mode"},
|
| 100 | {9, "qser_nw_get_rf_mode"},
|
| 101 | {10, "qser_nw_set_ims_enable"},
|
| 102 | {11, "qser_nw_get_ims_reg_status"},
|
| 103 | {12, "qser_nw_client_deinit"},
|
| 104 | {-1, "quit"}
|
| 105 | };
|
| 106 |
|
| 107 | typedef int (*TEST)(void);
|
| 108 |
|
| 109 | typedef struct
|
| 110 | {
|
| 111 | char *group_name;
|
| 112 | st_api_test_case *test_cases;
|
| 113 | TEST pf_test;
|
| 114 | } func_api_test_t;
|
| 115 |
|
| 116 | func_api_test_t t_nw_test = {"nw", at_nw_testlist, test_nw};
|
| 117 |
|
| 118 | void show_group_help(func_api_test_t *pt_test)
|
| 119 | {
|
| 120 | int i;
|
| 121 |
|
| 122 | printf("Group Name:%s, Supported test cases:\n", pt_test->group_name);
|
| 123 | for(i = 0; ; i++)
|
| 124 | {
|
| 125 | if(pt_test->test_cases[i].cmdIdx == -1)
|
| 126 | {
|
| 127 | break;
|
| 128 | }
|
| 129 | printf("%d:\t%s\n", pt_test->test_cases[i].cmdIdx, pt_test->test_cases[i].funcName);
|
| 130 | }
|
| 131 | }
|
| 132 |
|
| 133 | static nw_client_handle_type h_nw = 0;
|
| 134 |
|
| 135 | char *tech_domain[] = {"NONE", "3GPP", "3GPP2"};
|
| 136 | char *radio_tech[] = {"unknown",
|
| 137 | "TD_SCDMA", "GSM", "HSPAP", "LTE", "EHRPD", "EVDO_B",
|
| 138 | "HSPA", "HSUPA", "HSDPA", "EVDO_A", "EVDO_0", "1xRTT",
|
| 139 | "IS95B", "IS95A", "UMTS", "EDGE", "GPRS", "NONE"};
|
| 140 |
|
| 141 | void nw_event_ind_handler (
|
| 142 | nw_client_handle_type h_nw,
|
| 143 | u_int32_t ind_flag,
|
| 144 | void *ind_msg_buf,
|
| 145 | u_int32_t ind_msg_len,
|
| 146 | void *contextPtr)
|
| 147 | {
|
| 148 | switch(ind_flag) {
|
| 149 | case NW_IND_VOICE_REG_EVENT_IND_FLAG:
|
| 150 | {
|
| 151 | QSER_NW_VOICE_REG_EVENT_IND_T *ind = (QSER_NW_VOICE_REG_EVENT_IND_T*)ind_msg_buf;
|
| 152 | printf("Recv event indication : VOICE REG EVENT\n");
|
| 153 |
|
| 154 | if(ind==NULL)
|
| 155 | {
|
| 156 | printf("ind is NULL\n");
|
| 157 | break;
|
| 158 | }
|
| 159 |
|
| 160 | if(ind->registration_valid)
|
| 161 | {
|
| 162 | printf("voice_registration: \ntech_domain=%s, radio_tech=%s, roaming=%d, registration_state=%d\n",
|
| 163 | tech_domain[ind->registration.tech_domain],
|
| 164 | radio_tech[ind->registration.radio_tech],
|
| 165 | ind->registration.roaming,
|
| 166 | ind->registration.registration_state);
|
| 167 | }
|
| 168 | if(ind->registration_details_3gpp_valid)
|
| 169 | {
|
| 170 | 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",
|
| 171 | tech_domain[ind->registration_details_3gpp.tech_domain],
|
| 172 | radio_tech[ind->registration_details_3gpp.radio_tech],
|
| 173 | ind->registration_details_3gpp.mcc,
|
| 174 | ind->registration_details_3gpp.mnc,
|
| 175 | ind->registration_details_3gpp.roaming,
|
| 176 | ind->registration_details_3gpp.forbidden,
|
| 177 | ind->registration_details_3gpp.cid,
|
| 178 | ind->registration_details_3gpp.lac,
|
| 179 | ind->registration_details_3gpp.psc,
|
| 180 | ind->registration_details_3gpp.tac);
|
| 181 | }
|
| 182 |
|
| 183 | if(ind->registration_details_3gpp2_valid)
|
| 184 | {
|
| 185 | 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",
|
| 186 | tech_domain[ind->registration_details_3gpp2.tech_domain],
|
| 187 | radio_tech[ind->registration_details_3gpp2.radio_tech],
|
| 188 | ind->registration_details_3gpp2.mcc,
|
| 189 | ind->registration_details_3gpp2.mnc,
|
| 190 | ind->registration_details_3gpp2.roaming,
|
| 191 | ind->registration_details_3gpp2.forbidden,
|
| 192 | ind->registration_details_3gpp2.sid,
|
| 193 | ind->registration_details_3gpp2.nid,
|
| 194 | ind->registration_details_3gpp2.bsid);
|
| 195 | }
|
| 196 |
|
| 197 | break;
|
| 198 | }
|
| 199 | case NW_IND_DATA_REG_EVENT_IND_FLAG:
|
| 200 | {
|
| 201 | QSER_NW_DATA_REG_EVENT_IND_T *ind = (QSER_NW_DATA_REG_EVENT_IND_T*)ind_msg_buf;
|
| 202 |
|
| 203 | printf("Recv event indication : DATA REG EVENT\n");
|
| 204 |
|
| 205 | if(ind==NULL)
|
| 206 | {
|
| 207 | printf("ind is NULL\n");
|
| 208 | break;
|
| 209 | }
|
| 210 |
|
| 211 |
|
| 212 | if(ind->registration_valid)
|
| 213 | {
|
| 214 | printf("data_registration: \ntech_domain=%s, radio_tech=%s, roaming=%d, registration_state=%d\n",
|
| 215 | tech_domain[ind->registration.tech_domain],
|
| 216 | radio_tech[ind->registration.radio_tech],
|
| 217 | ind->registration.roaming,
|
| 218 | ind->registration.registration_state);
|
| 219 | }
|
| 220 | if(ind->registration_details_3gpp_valid)
|
| 221 | {
|
| 222 | 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",
|
| 223 | tech_domain[ind->registration_details_3gpp.tech_domain],
|
| 224 | radio_tech[ind->registration_details_3gpp.radio_tech],
|
| 225 | ind->registration_details_3gpp.mcc,
|
| 226 | ind->registration_details_3gpp.mnc,
|
| 227 | ind->registration_details_3gpp.roaming,
|
| 228 | ind->registration_details_3gpp.forbidden,
|
| 229 | ind->registration_details_3gpp.cid,
|
| 230 | ind->registration_details_3gpp.lac,
|
| 231 | ind->registration_details_3gpp.psc,
|
| 232 | ind->registration_details_3gpp.tac);
|
| 233 | }
|
| 234 |
|
| 235 | if(ind->registration_details_3gpp2_valid)
|
| 236 | {
|
| 237 | 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",
|
| 238 | tech_domain[ind->registration_details_3gpp2.tech_domain],
|
| 239 | radio_tech[ind->registration_details_3gpp2.radio_tech],
|
| 240 | ind->registration_details_3gpp2.mcc,
|
| 241 | ind->registration_details_3gpp2.mnc,
|
| 242 | ind->registration_details_3gpp2.roaming,
|
| 243 | ind->registration_details_3gpp2.forbidden,
|
| 244 | ind->registration_details_3gpp2.inPRL,
|
| 245 | ind->registration_details_3gpp2.css,
|
| 246 | ind->registration_details_3gpp2.sid,
|
| 247 | ind->registration_details_3gpp2.nid,
|
| 248 | ind->registration_details_3gpp2.bsid);
|
| 249 | }
|
| 250 |
|
| 251 | break;
|
| 252 | }
|
| 253 | case NW_IND_SIGNAL_STRENGTH_EVENT_IND_FLAG:
|
| 254 | {
|
| 255 | QSER_NW_SINGNAL_EVENT_IND_T *ind = (QSER_NW_SINGNAL_EVENT_IND_T*)ind_msg_buf;
|
| 256 |
|
| 257 | printf("Recv event indication : SIGNAL STRENGTH EVENT\n");
|
| 258 |
|
| 259 | if(ind==NULL)
|
| 260 | {
|
| 261 | printf("ind is NULL\n");
|
| 262 | break;
|
| 263 | }
|
| 264 |
|
| 265 | if(ind->gsm_sig_info_valid)
|
| 266 | {
|
| 267 | printf("gsm_sig_info: rssi=%d\n",
|
| 268 | ind->gsm_sig_info.rssi);
|
| 269 | }
|
| 270 |
|
| 271 | if(ind->wcdma_sig_info_valid)
|
| 272 | {
|
| 273 | printf("wcdma_sig_info: rssi=%d, ecio=%d\n",
|
| 274 | ind->wcdma_sig_info.rssi,
|
| 275 | ind->wcdma_sig_info.ecio);
|
| 276 | }
|
| 277 | if(ind->tdscdma_sig_info_valid)
|
| 278 | {
|
| 279 | printf("tdscdma_sig_info: rssi=%d, rscp=%d, ecio=%d, sinr=%d\n",
|
| 280 | ind->tdscdma_sig_info.rssi,
|
| 281 | ind->tdscdma_sig_info.rscp,
|
| 282 | ind->tdscdma_sig_info.ecio,
|
| 283 | ind->tdscdma_sig_info.sinr);
|
| 284 | }
|
| 285 | if(ind->lte_sig_info_valid)
|
| 286 | {
|
| 287 | printf("lte_sig_info: rssi=%d, rsrq=%d, rsrp=%d, snr=%d\n",
|
| 288 | ind->lte_sig_info.rssi,
|
| 289 | ind->lte_sig_info.rsrq,
|
| 290 | ind->lte_sig_info.rsrp,
|
| 291 | ind->lte_sig_info.snr);
|
| 292 | }
|
| 293 | if(ind->cdma_sig_info_valid)
|
| 294 | {
|
| 295 | printf("cdma_sig_info: rssi=%d, ecio=%d\n",
|
| 296 | ind->cdma_sig_info.rssi,
|
| 297 | ind->cdma_sig_info.ecio);
|
| 298 | }
|
| 299 | if(ind->hdr_sig_info_valid)
|
| 300 | {
|
| 301 | printf("hdr_sig_info: rssi=%d, ecio=%d, sinr=%d, io=%d\n",
|
| 302 | ind->hdr_sig_info.rssi,
|
| 303 | ind->hdr_sig_info.ecio,
|
| 304 | ind->hdr_sig_info.sinr,
|
| 305 | ind->hdr_sig_info.io);
|
| 306 | }
|
| 307 | break;
|
| 308 | }
|
| 309 | case NW_IND_IMS_REG_EVENT_IND_FLAG:
|
| 310 | {
|
| 311 | printf("Recv event indication : IMS REG EVENT\n");
|
| 312 |
|
| 313 | break;
|
| 314 | }
|
| 315 | default:
|
| 316 | break;
|
| 317 | }
|
| 318 | }
|
| 319 |
|
| 320 | static int test_nw(void)
|
| 321 | {
|
| 322 | int cmdIdx = 0;
|
| 323 | int ret = 0;
|
| 324 |
|
| 325 | while(1)
|
| 326 | {
|
| 327 | show_group_help(&t_nw_test);
|
| 328 | printf("please input cmd index(-1 exit): ");
|
| 329 | ret = scanf("%d", &cmdIdx);
|
| 330 | if(ret != 1)
|
| 331 | {
|
| 332 | char c;
|
| 333 | while(((c=getchar()) != '\n') && (c != EOF))
|
| 334 | {
|
| 335 | ;
|
| 336 | }
|
| 337 | continue;
|
| 338 | }
|
| 339 | if(cmdIdx == -1)
|
| 340 | {
|
| 341 | break;
|
| 342 | }
|
| 343 | switch(cmdIdx)
|
| 344 | {
|
| 345 | case 0://"qser_nw_client_init"
|
| 346 | {
|
| 347 |
|
| 348 | ret = qser_nw_client_init_p(&h_nw);
|
| 349 | printf("qser_nw_client_init ret = %d\n", ret);
|
| 350 | break;
|
| 351 | }
|
| 352 | case 1://"qser_nw_set_config"
|
| 353 | {
|
| 354 | QSER_NW_CONFIG_INFO_T t_info = {0};
|
| 355 |
|
| 356 | int mask = 0;
|
| 357 | printf("please input decimal format number, whose hex format is (TDSCDMA | LTE | EVDO | CDMA | WCDMA | GSM) : \n");
|
| 358 | scanf("%d", &mask);
|
| 359 | t_info.preferred_nw_mode = mask;
|
| 360 |
|
| 361 | ret = qser_nw_set_config_p(h_nw, &t_info);
|
| 362 | printf("qser_nw_set_config ret = %d\n", ret);
|
| 363 | break;
|
| 364 | }
|
| 365 | case 2://"qser_nw_get_operator_name"
|
| 366 | {
|
| 367 | QSER_NW_OPERATOR_NAME_INFO_T t_info;
|
| 368 | ret = qser_nw_get_operator_name_p(h_nw, &t_info);
|
| 369 | printf("qser_nw_get_operator_name ret = %d, long_eons=%s, short_eons=%s, mcc=%s, mnc=%s\n", ret,
|
| 370 | t_info.long_eons, t_info.short_eons, t_info.mcc, t_info.mnc);
|
| 371 | break;
|
| 372 | }
|
| 373 | case 3://"qser_nw_get_reg_status"
|
| 374 | {
|
| 375 | QSER_NW_REG_STATUS_INFO_T t_info;
|
| 376 |
|
| 377 | memset(&t_info, 0, sizeof(QSER_NW_REG_STATUS_INFO_T));
|
| 378 | ret = qser_nw_get_reg_status_p(h_nw, &t_info);
|
| 379 | printf("qser_nw_get_reg_status ret = %d, detail info:\n", ret);
|
| 380 | if(t_info.voice_registration_valid)
|
| 381 | {
|
| 382 | printf("voice_registration: \ntech_domain=%s, radio_tech=%s, roaming=%d, registration_state=%d\n",
|
| 383 | tech_domain[t_info.voice_registration.tech_domain],
|
| 384 | radio_tech[t_info.voice_registration.radio_tech],
|
| 385 | t_info.voice_registration.roaming,
|
| 386 | t_info.voice_registration.registration_state);
|
| 387 | }
|
| 388 | if(t_info.data_registration_valid)
|
| 389 | {
|
| 390 | printf("data_registration: \ntech_domain=%s, radio_tech=%s, roaming=%d, registration_state=%d\n",
|
| 391 | tech_domain[t_info.data_registration.tech_domain],
|
| 392 | radio_tech[t_info.data_registration.radio_tech],
|
| 393 | t_info.data_registration.roaming,
|
| 394 | t_info.data_registration.registration_state);
|
| 395 | }
|
| 396 | if(t_info.voice_registration_details_3gpp_valid)
|
| 397 | {
|
| 398 | 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",
|
| 399 | tech_domain[t_info.voice_registration_details_3gpp.tech_domain],
|
| 400 | radio_tech[t_info.voice_registration_details_3gpp.radio_tech],
|
| 401 | t_info.voice_registration_details_3gpp.mcc,
|
| 402 | t_info.voice_registration_details_3gpp.mnc,
|
| 403 | t_info.voice_registration_details_3gpp.roaming,
|
| 404 | t_info.voice_registration_details_3gpp.forbidden,
|
| 405 | t_info.voice_registration_details_3gpp.cid,
|
| 406 | t_info.voice_registration_details_3gpp.lac,
|
| 407 | t_info.voice_registration_details_3gpp.psc,
|
| 408 | t_info.voice_registration_details_3gpp.tac);
|
| 409 | }
|
| 410 | if(t_info.data_registration_details_3gpp_valid)
|
| 411 | {
|
| 412 | 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",
|
| 413 | tech_domain[t_info.data_registration_details_3gpp.tech_domain],
|
| 414 | radio_tech[t_info.data_registration_details_3gpp.radio_tech],
|
| 415 | t_info.data_registration_details_3gpp.mcc,
|
| 416 | t_info.data_registration_details_3gpp.mnc,
|
| 417 | t_info.data_registration_details_3gpp.roaming,
|
| 418 | t_info.data_registration_details_3gpp.forbidden,
|
| 419 | t_info.data_registration_details_3gpp.cid,
|
| 420 | t_info.data_registration_details_3gpp.lac,
|
| 421 | t_info.data_registration_details_3gpp.psc,
|
| 422 | t_info.data_registration_details_3gpp.tac);
|
| 423 | }
|
| 424 |
|
| 425 | if(t_info.voice_registration_details_3gpp2_valid)
|
| 426 | {
|
| 427 | 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",
|
| 428 | tech_domain[t_info.voice_registration_details_3gpp2.tech_domain],
|
| 429 | radio_tech[t_info.voice_registration_details_3gpp2.radio_tech],
|
| 430 | t_info.voice_registration_details_3gpp2.mcc,
|
| 431 | t_info.voice_registration_details_3gpp2.mnc,
|
| 432 | t_info.voice_registration_details_3gpp2.roaming,
|
| 433 | t_info.voice_registration_details_3gpp2.forbidden,
|
| 434 | t_info.voice_registration_details_3gpp2.sid,
|
| 435 | t_info.voice_registration_details_3gpp2.nid,
|
| 436 | t_info.voice_registration_details_3gpp2.bsid);
|
| 437 | }
|
| 438 |
|
| 439 | if(t_info.data_registration_details_3gpp2_valid)
|
| 440 | {
|
| 441 | 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",
|
| 442 | tech_domain[t_info.data_registration_details_3gpp2.tech_domain],
|
| 443 | radio_tech[t_info.data_registration_details_3gpp2.radio_tech],
|
| 444 | t_info.data_registration_details_3gpp2.mcc,
|
| 445 | t_info.data_registration_details_3gpp2.mnc,
|
| 446 | t_info.data_registration_details_3gpp2.roaming,
|
| 447 | t_info.data_registration_details_3gpp2.forbidden,
|
| 448 | t_info.data_registration_details_3gpp2.sid,
|
| 449 | t_info.data_registration_details_3gpp2.nid,
|
| 450 | t_info.data_registration_details_3gpp2.bsid);
|
| 451 | }
|
| 452 |
|
| 453 | break;
|
| 454 | }
|
| 455 | case 12://"qser_nw_client_deinit"
|
| 456 | {
|
| 457 | ret = qser_nw_client_deinit_p(h_nw);
|
| 458 | printf("qser_nw_client_deinit ret = %d\n", ret);
|
| 459 | break;
|
| 460 | }
|
| 461 | case 4 :
|
| 462 | {
|
| 463 | ret = qser_nw_add_rx_msg_handler_p(h_nw, nw_event_ind_handler, NULL);
|
| 464 | printf("qser_nw_add_rx_msg_handler, ret=%d\n", ret);
|
| 465 | break;
|
| 466 | }
|
| 467 | case 5 :
|
| 468 | {
|
| 469 | QSER_NW_SIGNAL_STRENGTH_INFO_T t_info;
|
| 470 | ret = qser_nw_get_signal_strength_p(h_nw, &t_info);
|
| 471 | printf("qser_nw_get_signal_strength, ret=%d\n", ret);
|
| 472 | if(ret==0)
|
| 473 | {
|
| 474 | printf("qser_solicited_signal_strength gsm_sig_info_valid = %d\n"
|
| 475 | " gsm_sig_info.rssi = %d\n"
|
| 476 | " wcdma _sig_info_valid = %d\n"
|
| 477 | " wcdma_sig_info.rssi = %d\n"
|
| 478 | " wcdma_sig_info.ecio = %d\n"
|
| 479 | " tdscdma_sig_info_valid = %d\n"
|
| 480 | " lte_sig_info_valid = %d\n"
|
| 481 | " lte_sig_info.rssi = %d\n"
|
| 482 | " lte_sig_info.rsrp = %d\n"
|
| 483 | " lte_sig_info.rsrq = %d\n"
|
| 484 | " lte_sig_info.snr = %d\n"
|
| 485 | " cdma_sig_info_valid = %d\n"
|
| 486 | " hdr_sig_info_valid = %d\n"
|
| 487 | " nr_sig_info_valid = %d\n"
|
| 488 | " nr_sig_info.ssRsrp = %d\n"
|
| 489 | " nr_sig_info.ssRsrq = %d\n"
|
| 490 | " nr_sig_info.ssSinr = %d\n"
|
| 491 | " nr_sig_info.csiRsrp = %d\n"
|
| 492 | " nr_sig_info.csiRsrq = %d\n"
|
| 493 | " nr_sig_info.csiSinr = %d\n",
|
| 494 | t_info.gsm_sig_info_valid, t_info.gsm_sig_info.rssi,
|
| 495 | t_info.wcdma_sig_info_valid, t_info.wcdma_sig_info.rssi, t_info.wcdma_sig_info.ecio,
|
| 496 | t_info.tdscdma_sig_info_valid,
|
| 497 | 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,
|
| 498 | t_info.cdma_sig_info_valid,
|
| 499 | t_info.hdr_sig_info_valid,
|
| 500 | t_info.nr_sig_info_valid, t_info.nr_sig_info.ssRsrp, t_info.nr_sig_info.ssRsrq, t_info.nr_sig_info.ssSinr,
|
| 501 | t_info.nr_sig_info.csiRsrp, t_info.nr_sig_info.csiRsrq, t_info.nr_sig_info.csiSinr);
|
| 502 |
|
| 503 | }
|
| 504 | break;
|
| 505 | }
|
| 506 | case 7 :
|
| 507 | {
|
| 508 | QSER_NW_OOS_CONFIG_INFO_T t_info;
|
| 509 | int type = 0;
|
| 510 | printf("please input you want query oos config's type (0: fast network scan config; 1: full band network scan config ) : \n");
|
| 511 | scanf("%d", &type);
|
| 512 | t_info.type = type;
|
| 513 | ret = qser_nw_get_oos_config_p(h_nw, &t_info);
|
| 514 | printf("qser_nw_get_oos_config, ret=%d\n", ret);
|
| 515 | if(ret==0)
|
| 516 | {
|
| 517 | if(t_info.type == QSER_NW_OOS_CFG_TYPE_FULL_BAND_SCAN)
|
| 518 | {
|
| 519 | printf("qser_nw_get_oos_config t_min = %d\n"
|
| 520 | " t_step = %d\n"
|
| 521 | " t_num = %d\n"
|
| 522 | " t_max = %d\n",
|
| 523 | t_info.u.full_band_scan_info.t_min, t_info.u.full_band_scan_info.t_step,
|
| 524 | t_info.u.full_band_scan_info.t_num, t_info.u.full_band_scan_info.t_max);
|
| 525 | }
|
| 526 | else if(t_info.type == QSER_NW_OOS_CFG_TYPE_FAST_SCAN)
|
| 527 | {
|
| 528 | printf("qser_nw_get_oos_config enable = %d\n"
|
| 529 | " time_interval = %d\n",
|
| 530 | t_info.u.fast_can_info.enable, t_info.u.fast_can_info.time_interval);
|
| 531 | }
|
| 532 | else
|
| 533 | {
|
| 534 | printf("qser_nw_get_oos_config tyep is %d, ret is ok",t_info.type);
|
| 535 | }
|
| 536 |
|
| 537 | }
|
| 538 | break;
|
| 539 | }
|
| 540 | case 6 :
|
| 541 | {
|
| 542 | QSER_NW_OOS_CONFIG_INFO_T t_info;
|
| 543 | int type = 0;
|
| 544 | printf("please input you want set oos config's type (0: fast network scan config; 1: full band network scan config ) : \n");
|
| 545 | scanf("%d", &type);
|
| 546 | t_info.type = type;
|
| 547 | if(t_info.type == QSER_NW_OOS_CFG_TYPE_FULL_BAND_SCAN)
|
| 548 | {
|
| 549 | printf("please input t_min: \n");
|
| 550 | scanf("%d", &(t_info.u.full_band_scan_info.t_min));
|
| 551 | printf("please input t_step: \n");
|
| 552 | scanf("%d", &(t_info.u.full_band_scan_info.t_step));
|
| 553 | printf("please input t_num: \n");
|
| 554 | scanf("%d", &(t_info.u.full_band_scan_info.t_num));
|
| 555 | printf("please input t_max: \n");
|
| 556 | scanf("%d", &(t_info.u.full_band_scan_info.t_max));
|
| 557 | ret = qser_nw_set_oos_config_p(h_nw, &t_info);
|
| 558 | printf("qser_nw_get_oos_config, ret=%d\n", ret);
|
| 559 | }
|
| 560 | else if(t_info.type==QSER_NW_OOS_CFG_TYPE_FAST_SCAN)
|
| 561 | {
|
| 562 | printf("please input enable: \n");
|
| 563 | scanf("%d", &(t_info.u.fast_can_info.enable));
|
| 564 | printf("please input time_interval: \n");
|
| 565 | scanf("%d", &(t_info.u.fast_can_info.time_interval));
|
| 566 | ret = qser_nw_set_oos_config_p(h_nw, &t_info);
|
| 567 | printf("qser_nw_get_oos_config, ret=%d\n", ret);
|
| 568 | }
|
| 569 | else
|
| 570 | {
|
| 571 | ret = qser_nw_set_oos_config_p(h_nw, &t_info);
|
| 572 | printf("qser_nw_get_oos_config, ret=%d\n", ret);
|
| 573 | }
|
| 574 | break;
|
| 575 | }
|
| 576 | case 9://"qser_nw_get_rf_mode"
|
| 577 | {
|
| 578 | E_QSER_NW_RF_MODE_TYPE_T rf_mode;
|
| 579 | ret = qser_nw_get_rf_mode_p(h_nw, &rf_mode);
|
| 580 | printf("qser_nw_get_rf_mode ret = %d, rf mode=%d\n", ret, rf_mode);
|
| 581 | break;
|
| 582 | }
|
| 583 | case 8://"qser_nw_set_rf_mode"
|
| 584 | {
|
| 585 | E_QSER_NW_RF_MODE_TYPE_T rf_mode;
|
| 586 | printf("please input you want set rf mode (0: cfun 0; 1: cfun 1; 4: flight mode \n");
|
| 587 | scanf("%d", &rf_mode);
|
| 588 | ret = qser_nw_set_rf_mode_p(h_nw, rf_mode);
|
| 589 | printf("qser_nw_set_rf_mode %d ret = %dn",rf_mode, ret);
|
| 590 | break;
|
| 591 | }
|
| 592 | case 10://"qser_nw_set_ims_enable"
|
| 593 | {
|
| 594 | E_QSER_NW_IMS_MODE_TYPE_T ims_mode;
|
| 595 | printf("please input you want set ims mode (0: off; 1: volte enable \n");
|
| 596 | scanf("%d", &ims_mode);
|
| 597 | ret = qser_nw_set_ims_enable_p(h_nw, ims_mode);
|
| 598 | printf("qser_nw_set_ims_enable %d ret = %dn",ims_mode, ret);
|
| 599 | break;
|
| 600 | }
|
| 601 | case 11://"qser_nw_get_ims_reg_status"
|
| 602 | {
|
| 603 | QSER_NW_IMS_REG_STATUS_INFO_T t_info;
|
| 604 | memset(&t_info, 0, sizeof(QSER_NW_IMS_REG_STATUS_INFO_T));
|
| 605 | ret = qser_nw_get_ims_reg_status_p(h_nw, &t_info);
|
| 606 | printf("qser_nw_get_ims_reg_status ret = %d, detail info:\n", ret);
|
| 607 | if(ret == 0)
|
| 608 | {
|
| 609 | printf("ims_registration: registration_state=%d\n",
|
| 610 | t_info.registration_state);
|
| 611 | }
|
| 612 | break;
|
| 613 | }
|
| 614 | default:
|
| 615 | {
|
| 616 | show_group_help(&t_nw_test);
|
| 617 | }
|
| 618 | }
|
| 619 | }
|
| 620 | return 0;
|
| 621 | }
|
| 622 |
|
| 623 |
|
| 624 |
|
| 625 |
|
| 626 |
|