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