b.liu | 4e243dc | 2023-11-27 11:20:00 +0800 | [diff] [blame] | 1 | #include "lynq_qser_network.h" |
r.xiao | e73f870 | 2024-01-06 01:40:03 -0800 | [diff] [blame] | 2 | #include "mbtk_type.h" |
| 3 | #include "mbtk_info_api.h" |
r.xiao | ba8483c | 2024-04-14 18:53:10 -0700 | [diff] [blame] | 4 | #include "mbtk_log.h" |
r.xiao | e73f870 | 2024-01-06 01:40:03 -0800 | [diff] [blame] | 5 | |
| 6 | #include <stdio.h> |
| 7 | #include <stdlib.h> |
| 8 | |
r.xiao | fca7c47 | 2024-04-24 01:00:23 -0700 | [diff] [blame] | 9 | |
r.xiao | e73f870 | 2024-01-06 01:40:03 -0800 | [diff] [blame] | 10 | mbtk_info_handle_t* lynq_nw_info_handle = NULL; |
| 11 | uint64_t tmp_mode = 0xFF; |
| 12 | |
| 13 | nw_client_handle_type g_nw_val = -1; |
| 14 | |
r.xiao | e73f870 | 2024-01-06 01:40:03 -0800 | [diff] [blame] | 15 | typedef struct |
| 16 | { |
| 17 | QSER_NW_RxMsgHandlerFunc_t handlerPtr; |
| 18 | void* contextPtr; |
| 19 | } lynq_cust_cb_func; |
| 20 | |
| 21 | static lynq_cust_cb_func lynq_func_cb_handle; |
| 22 | |
| 23 | static int roaming_pref = 1; // Open roaming for default. |
| 24 | |
| 25 | typedef enum { |
| 26 | RADIO_TECH_3GPP = 1, /* 3GPP Technologies - GSM, WCDMA */ |
| 27 | RADIO_TECH_3GPP2 = 2 /* 3GPP2 Technologies - CDMA */ |
| 28 | } RIL_RadioTechnologyFamily; |
| 29 | |
| 30 | |
| 31 | typedef struct |
| 32 | { |
| 33 | uint8 *lynq_operator_l; |
| 34 | uint8 *lynq_operator_s; |
| 35 | uint32 lynq_mcc_mnc; |
| 36 | } lynq_operator_mcc_mnc_t; |
| 37 | |
| 38 | static lynq_operator_mcc_mnc_t lynq_operator_mcc_mnc[] = |
| 39 | { |
| 40 | {"China Mobile","CMCC",46000}, |
| 41 | {"China Unicom","CU",46001}, |
| 42 | {"China Mobile","CMCC",46002}, |
| 43 | {"China Telecom","CT",46003}, |
| 44 | {"China Mobile","CMCC",46004}, |
| 45 | {"China Telecom","CT",46005}, |
| 46 | {"China Unicom","CU",46006}, |
| 47 | {"China Mobile","CMCC",46007}, |
| 48 | {"China Mobile","CMCC",46008}, |
| 49 | {"China Unicom","CU",46009}, |
| 50 | {"China Telecom","CT",46011} |
| 51 | }; |
| 52 | |
r.xiao | fca7c47 | 2024-04-24 01:00:23 -0700 | [diff] [blame] | 53 | #if 0 |
| 54 | //T106的实现 |
| 55 | /*Used to wait for an update signal*/ |
| 56 | int lynq_wait_signalchanges(int *handle) |
r.xiao | e73f870 | 2024-01-06 01:40:03 -0800 | [diff] [blame] | 57 | { |
r.xiao | fca7c47 | 2024-04-24 01:00:23 -0700 | [diff] [blame] | 58 | LYDBGLOG("start wait signalchanges info"); |
| 59 | if(NULL == handle) |
| 60 | { |
| 61 | LYERRLOG("illegal input"); |
| 62 | return LYNQ_E_PARAMETER_ANONALY; |
| 63 | } |
| 64 | wait_urc_signal_changes(); |
| 65 | LYDBGLOG("get signalchanges"); |
| 66 | *handle = s_module_wait_urc_id; |
| 67 | return RESULT_OK; |
| 68 | } |
| 69 | |
| 70 | bool is_support_urc(int urc_id) |
| 71 | { |
| 72 | switch(urc_id) |
| 73 | { |
| 74 | case RIL_UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED: |
| 75 | case RIL_UNSOL_RESPONSE_PS_NETWORK_STATE_CHANGED: |
| 76 | case RIL_UNSOL_RESPONSE_IMS_NETWORK_STATE_CHANGED: |
| 77 | case RIL_UNSOL_SIGNAL_STRENGTH: |
| 78 | return true; |
| 79 | default: |
| 80 | return false; |
| 81 | } |
| 82 | } |
| 83 | |
| 84 | /*Used to get urc info*/ |
| 85 | int lynq_get_urc_info(const int handle,signalStrength_t *solSigStren,int *slot_id) |
| 86 | { |
| 87 | if(g_module_init_flag != MODULE_RUNNING) |
| 88 | { |
| 89 | LYERRLOG("%s module state %d error",__func__,g_module_init_flag); |
| 90 | return -1; |
| 91 | } |
| 92 | LYDBGLOG("start get urc info"); |
| 93 | if(is_support_urc(handle)==false) |
| 94 | { |
| 95 | LYINFLOG("invalid handle!!!"); |
| 96 | return -1; |
| 97 | } |
| 98 | if((handle ==RIL_UNSOL_SIGNAL_STRENGTH && NULL == solSigStren) || |
| 99 | (handle !=RIL_UNSOL_SIGNAL_STRENGTH && NULL == slot_id)) |
| 100 | { |
| 101 | LYINFLOG("incoming solSigStren or slot_id is NULL!!!"); |
| 102 | return -1; |
| 103 | } |
| 104 | switch(handle) |
| 105 | { |
| 106 | case RIL_UNSOL_SIGNAL_STRENGTH: //1009 |
| 107 | { |
| 108 | LYDBGLOG("get state update to signal info"); |
| 109 | solSigStren->gw_sig_valid = s_network_urc_solSigStren.gw_sig_valid; |
| 110 | solSigStren->rssi = s_network_urc_solSigStren.rssi; |
| 111 | solSigStren->wcdma_signalstrength = s_network_urc_solSigStren.wcdma_signalstrength; |
| 112 | solSigStren->wcdma_sig_valid = s_network_urc_solSigStren.wcdma_sig_valid; |
| 113 | solSigStren->rscp = s_network_urc_solSigStren.rscp; |
| 114 | solSigStren->ecno = s_network_urc_solSigStren.ecno; |
| 115 | solSigStren->lte_signalstrength = s_network_urc_solSigStren.lte_signalstrength; |
| 116 | solSigStren->lte_sig_valid = s_network_urc_solSigStren.lte_sig_valid; |
| 117 | solSigStren->rsrp = s_network_urc_solSigStren.rsrp; |
| 118 | solSigStren->rsrq = s_network_urc_solSigStren.rsrq; |
| 119 | solSigStren->rssnr = s_network_urc_solSigStren.rssnr; |
| 120 | solSigStren->nr_sig_valid = s_network_urc_solSigStren.nr_sig_valid; |
| 121 | solSigStren->ssRsrp = s_network_urc_solSigStren.ssRsrp; |
| 122 | solSigStren->ssRsrq = s_network_urc_solSigStren.ssRsrq; |
| 123 | solSigStren->ssSinr = s_network_urc_solSigStren.ssSinr; |
| 124 | solSigStren->csiRsrp = s_network_urc_solSigStren.csiRsrp; |
| 125 | solSigStren->csiRsrq = s_network_urc_solSigStren.csiRsrq; |
| 126 | solSigStren->csiSinr = s_network_urc_solSigStren.csiSinr; |
| 127 | break; |
| 128 | } |
| 129 | default: |
| 130 | { |
| 131 | *slot_id = s_module_urc_slot_id; |
| 132 | LYINFLOG("slot_id = %d",s_module_urc_slot_id); |
| 133 | } |
| 134 | } |
| 135 | return 0; |
| 136 | } |
| 137 | |
| 138 | |
| 139 | void urc_msg_process_voice_reg() |
| 140 | { |
| 141 | if(s_handlerPtr != NULL) |
| 142 | { |
| 143 | s_handlerPtr(g_nw_val,NW_IND_VOICE_REG_EVENT_IND_FLAG,NULL,0,s_contextPtr); |
| 144 | } |
| 145 | } |
| 146 | |
| 147 | void urc_msg_process_data_reg() |
| 148 | { |
| 149 | if(s_handlerPtr != NULL) |
| 150 | { |
| 151 | s_handlerPtr(g_nw_val,NW_IND_DATA_REG_EVENT_IND_FLAG,NULL,0,s_contextPtr); |
| 152 | } |
| 153 | } |
| 154 | |
| 155 | void urc_msg_process_ims_reg() |
| 156 | { |
| 157 | if(s_handlerPtr != NULL) |
| 158 | { |
| 159 | s_handlerPtr(g_nw_val,NW_IND_IMS_REG_EVENT_IND_FLAG,NULL,0,s_contextPtr); |
| 160 | } |
| 161 | } |
| 162 | |
| 163 | void *new_network_thread_recv(void *context) |
| 164 | { |
| 165 | int handle = -1; |
| 166 | uint32_t ind_flag = 0; |
| 167 | |
| 168 | while (1) |
| 169 | { |
| 170 | lynq_wait_signalchanges(&handle); |
| 171 | |
| 172 | switch(handle) |
| 173 | { |
| 174 | case 1002: //RIL_UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED: |
| 175 | { |
| 176 | urc_msg_process_voice_reg(); |
| 177 | |
| 178 | break; |
| 179 | } |
| 180 | case 3015://RIL_UNSOL_RESPONSE_PS_NETWORK_STATE_CHANGED: |
| 181 | { |
| 182 | urc_msg_process_data_reg(); |
| 183 | break; |
| 184 | } |
| 185 | case 1009://RIL_UNSOL_SIGNAL_STRENGTH: |
| 186 | { |
| 187 | urc_msg_process_signal_strength(); |
| 188 | break; |
| 189 | } |
| 190 | case 1037://RIL_UNSOL_RESPONSE_IMS_NETWORK_STATE_CHANGED: |
| 191 | { |
| 192 | urc_msg_process_ims_reg(); |
| 193 | break; |
| 194 | } |
| 195 | } |
| 196 | } |
| 197 | return NULL; |
| 198 | } |
| 199 | |
| 200 | void urc_msg_process_signal_strength() |
| 201 | { |
| 202 | signalStrength_t signalstrength; |
| 203 | int slot_id; |
| 204 | |
| 205 | int ret = lynq_get_urc_info(1009,&signalstrength,&slot_id); |
| 206 | if (ret == 0) |
| 207 | { |
| 208 | QSER_NW_SINGNAL_EVENT_IND_T msg_buf; |
| 209 | msg_buf.gsm_sig_info_valid = signalstrength.gw_sig_valid; |
| 210 | msg_buf.gsm_sig_info.rssi = signalstrength.rssi; |
| 211 | msg_buf.wcdma_sig_info_valid = signalstrength.wcdma_sig_valid; |
| 212 | msg_buf.wcdma_sig_info.rssi = signalstrength.rscp; |
| 213 | msg_buf.wcdma_sig_info.ecio = signalstrength.ecno; |
| 214 | msg_buf.tdscdma_sig_info_valid = 0; |
| 215 | msg_buf.lte_sig_info_valid = signalstrength.lte_sig_valid; |
| 216 | msg_buf.lte_sig_info.rssi = -125; |
| 217 | msg_buf.lte_sig_info.rsrp = signalstrength.rsrp; |
| 218 | msg_buf.lte_sig_info.rsrq = signalstrength.rsrq; |
| 219 | msg_buf.lte_sig_info.snr = signalstrength.rssnr; |
| 220 | msg_buf.cdma_sig_info_valid = 0; |
| 221 | msg_buf.hdr_sig_info_valid = 0; |
| 222 | msg_buf.nr_sig_info_valid = signalstrength.nr_sig_valid; |
| 223 | msg_buf.nr_sig_info.ssRsrp = signalstrength.ssRsrp; |
| 224 | msg_buf.nr_sig_info.ssRsrq = signalstrength.ssRsrq; |
| 225 | msg_buf.nr_sig_info.ssSinr = signalstrength.ssSinr; |
| 226 | msg_buf.nr_sig_info.csiRsrp = signalstrength.csiRsrp; |
| 227 | msg_buf.nr_sig_info.csiRsrq = signalstrength.csiRsrq; |
| 228 | msg_buf.nr_sig_info.csiSinr = signalstrength.csiSinr; |
| 229 | void *ind_msg_buf= &msg_buf; |
| 230 | if(s_handlerPtr!=NULL) |
| 231 | { |
| 232 | s_handlerPtr(g_nw_val,NW_IND_SIGNAL_STRENGTH_EVENT_IND_FLAG,ind_msg_buf,sizeof (msg_buf) ,s_contextPtr); |
| 233 | } |
| 234 | } |
| 235 | } |
| 236 | |
| 237 | #endif |
| 238 | |
| 239 | |
| 240 | |
| 241 | void lynq_signal_state_change_cb(const void* data, int data_len) |
| 242 | { |
| 243 | #if 0 |
r.xiao | cfd7c68 | 2024-01-22 03:59:46 -0800 | [diff] [blame] | 244 | |
| 245 | /* |
r.xiao | e73f870 | 2024-01-06 01:40:03 -0800 | [diff] [blame] | 246 | uint8 *net_data = NULL; |
| 247 | |
| 248 | net_data = (uint8*)data; |
r.xiao | e73f870 | 2024-01-06 01:40:03 -0800 | [diff] [blame] | 249 | |
r.xiao | cfd7c68 | 2024-01-22 03:59:46 -0800 | [diff] [blame] | 250 | if(data && data_len > 0) |
r.xiao | e73f870 | 2024-01-06 01:40:03 -0800 | [diff] [blame] | 251 | { |
r.xiao | cfd7c68 | 2024-01-22 03:59:46 -0800 | [diff] [blame] | 252 | if(*net_data == 0) |
| 253 | { // CS |
| 254 | printf("CS:act=%d, mode=%d\n", *(net_data + 1), *(net_data + 2)); |
| 255 | } |
| 256 | else |
| 257 | { // PS |
| 258 | printf("PS[%s]:act=%d, mode=%d\n", *(net_data + 3) == 0 ? "GSM/WCDMA" : "LTE", *(net_data + 1), *(net_data + 2)); |
| 259 | } |
r.xiao | e73f870 | 2024-01-06 01:40:03 -0800 | [diff] [blame] | 260 | } |
| 261 | else |
| 262 | { |
r.xiao | cfd7c68 | 2024-01-22 03:59:46 -0800 | [diff] [blame] | 263 | printf("NET_CB : NULL"); |
r.xiao | e73f870 | 2024-01-06 01:40:03 -0800 | [diff] [blame] | 264 | } |
r.xiao | e73f870 | 2024-01-06 01:40:03 -0800 | [diff] [blame] | 265 | */ |
| 266 | |
r.xiao | fca7c47 | 2024-04-24 01:00:23 -0700 | [diff] [blame] | 267 | if(s_handlerPtr != NULL)//数据原样输出 |
r.xiao | e73f870 | 2024-01-06 01:40:03 -0800 | [diff] [blame] | 268 | { |
r.xiao | fca7c47 | 2024-04-24 01:00:23 -0700 | [diff] [blame] | 269 | s_handlerPtr(g_nw_val, NW_IND_DATA_REG_EVENT_IND_FLAG, data, data_len, NULL); |
r.xiao | e73f870 | 2024-01-06 01:40:03 -0800 | [diff] [blame] | 270 | } |
r.xiao | fca7c47 | 2024-04-24 01:00:23 -0700 | [diff] [blame] | 271 | #endif |
| 272 | |
| 273 | /* |
| 274 | data_signal[0] = signal.type; |
| 275 | data_signal[1] = signal.rssi; |
| 276 | data_signal[2] = signal.rxlev; |
| 277 | data_signal[3] = signal.ber; |
| 278 | data_signal[4] = signal.rscp; |
| 279 | data_signal[5] = signal.ecno; |
| 280 | data_signal[6] = signal.rsrq; |
| 281 | data_signal[7] = signal.rsrp; |
| 282 | */ |
| 283 | |
| 284 | uint8 *net_data = NULL; |
| 285 | QSER_NW_SINGNAL_EVENT_IND_T msg_buf; |
| 286 | |
| 287 | if(data && data_len > 0) |
| 288 | { |
| 289 | net_data = (uint8*)data; |
| 290 | //printf("net_data[0] => *net_data =%d\n",*net_data); |
| 291 | msg_buf.gsm_sig_info_valid = FALSE; |
| 292 | msg_buf.lte_sig_info_valid = FALSE; |
| 293 | msg_buf.wcdma_sig_info_valid = FALSE; |
| 294 | |
| 295 | if(*net_data == MBTK_RADIO_TECH_GSM || *net_data == MBTK_RADIO_TECH_GSM_COMPACT || \ |
| 296 | *net_data == MBTK_RADIO_TECH_GSM_EGPRS) //GSM |
| 297 | { |
| 298 | msg_buf.gsm_sig_info_valid = TRUE; |
| 299 | } |
| 300 | else if(*net_data == MBTK_RADIO_TECH_E_UTRAN) //LTE |
| 301 | { |
| 302 | msg_buf.lte_sig_info_valid = TRUE; |
| 303 | } |
| 304 | else if (*net_data == MBTK_RADIO_TECH_UTRAN || *net_data == MBTK_RADIO_TECH_UTRAN_HSDPA || \ |
| 305 | *net_data == MBTK_RADIO_TECH_UTRAN_HSUPA || *net_data == MBTK_RADIO_TECH_UTRAN_HSDPA_HSUPA || \ |
| 306 | *net_data == MBTK_RADIO_TECH_UTRAN_HSPA )//WCDMA |
| 307 | { |
| 308 | msg_buf.wcdma_sig_info_valid = TRUE; |
| 309 | } |
| 310 | |
| 311 | //msg_buf.gsm_sig_info_valid = TRUE;//signalstrength.gw_sig_valid; |
| 312 | msg_buf.gsm_sig_info.rssi = *(net_data + 1);//signalstrength.rssi; |
| 313 | printf("rssi = %d\n", *(net_data + 1)); |
| 314 | //msg_buf.wcdma_sig_info_valid = TRUE;//.wcdma_sig_valid; |
| 315 | msg_buf.wcdma_sig_info.rssi = *(net_data + 4);//signalstrength.rscp; |
| 316 | printf("rscp = %d\n", *(net_data + 4)); |
| 317 | msg_buf.wcdma_sig_info.ecio = *(net_data + 5);//signalstrength.ecno; |
| 318 | printf("ecno = %d\n", *(net_data + 5)); |
| 319 | msg_buf.tdscdma_sig_info_valid = FALSE; |
| 320 | //msg_buf.lte_sig_info_valid = TRUE;//signalstrength.lte_sig_valid; |
| 321 | msg_buf.lte_sig_info.rssi = -125; |
| 322 | msg_buf.lte_sig_info.rsrp = *(net_data + 7);//signalstrength.rsrp; |
| 323 | printf("rsrp = %d\n", *(net_data + 7)); |
| 324 | msg_buf.lte_sig_info.rsrq = *(net_data + 6);//signalstrength.rsrq; |
| 325 | printf("rsrq = %d\n", *(net_data + 6)); |
| 326 | msg_buf.lte_sig_info.snr = 0x7FFFFFFFF; //signalstrength.rssnr;(当前mbtk没有该参数) |
| 327 | msg_buf.cdma_sig_info_valid = FALSE; |
| 328 | msg_buf.hdr_sig_info_valid = FALSE; |
| 329 | msg_buf.nr_sig_info_valid = FALSE;//(当前mbtk没有该参数) |
| 330 | msg_buf.nr_sig_info.ssRsrp = 0; |
| 331 | msg_buf.nr_sig_info.ssRsrq = 0; |
| 332 | msg_buf.nr_sig_info.ssSinr = 0; |
| 333 | msg_buf.nr_sig_info.csiRsrp = 0; |
| 334 | msg_buf.nr_sig_info.csiRsrq = 0; |
| 335 | msg_buf.nr_sig_info.csiSinr = 0; |
| 336 | |
| 337 | void *ind_msg_buf= &msg_buf; |
| 338 | if(lynq_func_cb_handle.handlerPtr != NULL) |
| 339 | { |
| 340 | lynq_func_cb_handle.handlerPtr(g_nw_val, NW_IND_SIGNAL_STRENGTH_EVENT_IND_FLAG, ind_msg_buf, sizeof (msg_buf), lynq_func_cb_handle.contextPtr); |
| 341 | } |
| 342 | } |
| 343 | else |
| 344 | { |
| 345 | LOGE("lynq_nw_state_change_cb : NULL"); |
| 346 | } |
| 347 | |
r.xiao | e73f870 | 2024-01-06 01:40:03 -0800 | [diff] [blame] | 348 | } |
| 349 | |
| 350 | |
| 351 | static uint8 lynq_net_pre_change(bool mbtk_2_lynq,int net_mode) |
| 352 | { |
| 353 | uint8 mbtk_net_pre = 0xFF; |
| 354 | |
| 355 | #if 0 |
| 356 | 此参数表在别处使用 |
| 357 | E_QSER_NW_RADIO_TECH_TD_SCDMA = 1, Y3 1 |
| 358 | E_QSER_NW_RADIO_TECH_GSM = 2, /**< GSM; only supports voice. */ YL2 0 |
| 359 | E_QSER_NW_RADIO_TECH_HSPAP = 3, /**< HSPA+. */ 3 1 |
| 360 | E_QSER_NW_RADIO_TECH_LTE = 4, /**< LTE. */ 4 5 |
| 361 | E_QSER_NW_RADIO_TECH_EHRPD = 5, /**< EHRPD. */ 3 1 |
| 362 | E_QSER_NW_RADIO_TECH_EVDO_B = 6, /**< EVDO B. */ D3 1 |
| 363 | E_QSER_NW_RADIO_TECH_HSPA = 7, /**< HSPA. */ 3 1 |
| 364 | E_QSER_NW_RADIO_TECH_HSUPA = 8, /**< HSUPA. */ 3.5 1 |
| 365 | E_QSER_NW_RADIO_TECH_HSDPA = 9, /**< HSDPA. */ 3.5 1 |
| 366 | E_QSER_NW_RADIO_TECH_EVDO_A = 10, /**< EVDO A. */ D3 1 |
| 367 | E_QSER_NW_RADIO_TECH_EVDO_0 = 11, /**< EVDO 0. */ D3 1 |
| 368 | E_QSER_NW_RADIO_TECH_1xRTT = 12, /**< 1xRTT. */ 2 0 |
| 369 | E_QSER_NW_RADIO_TECH_IS95B = 13, /**< IS95B. */ 3 0 |
| 370 | E_QSER_NW_RADIO_TECH_IS95A = 14, /**< IS95A. */ 3 0 |
| 371 | E_QSER_NW_RADIO_TECH_UMTS = 15, /**< UMTS. */ L3 1 |
| 372 | E_QSER_NW_RADIO_TECH_EDGE = 16, /**< EDGE. */ 2.75 0 |
| 373 | E_QSER_NW_RADIO_TECH_GPRS = 17, /**< GPRS. */ 2.5 0 |
| 374 | E_QSER_NW_RADIO_TECH_NONE = 18 /**< No technology selected. */ |
| 375 | #endif |
| 376 | /* |
| 377 | 0 : GSM only |
| 378 | 1 : UMTS only |
| 379 | 2 : GSM/UMTS(auto) |
| 380 | 3 : GSM/UMTS(GSM preferred) |
| 381 | 4 : GSM/UMTS(UMTS preferred) |
| 382 | 5 : LTE only |
| 383 | 6 : GSM/LTE(auto) |
| 384 | 7 : GSM/LTE(GSM preferred) |
| 385 | 8 : GSM/LTE(LTE preferred) |
| 386 | 9 : UMTS/LTE(auto) |
| 387 | 10 : UMTS/LTE(UMTS preferred) |
| 388 | 11 : UMTS/LTE(LTE preferred) |
| 389 | 12 : GSM/UMTS/LTE(auto) |
| 390 | 13 : GSM/UMTS/LTE(GSM preferred) |
| 391 | 14 : GSM/UMTS/LTE(UMTS preferred) |
| 392 | 15 : GSM/UMTS/LTE(LTE preferred) |
| 393 | */ |
| 394 | |
liuyang | 4ac8c63 | 2024-05-24 14:42:31 +0800 | [diff] [blame] | 395 | if(mbtk_2_lynq) |
| 396 | { |
r.xiao | e73f870 | 2024-01-06 01:40:03 -0800 | [diff] [blame] | 397 | switch(net_mode) |
| 398 | { |
| 399 | //使用之前set的tmp_mode的值来进行回显get |
| 400 | case QSER_NW_MODE_GSM: |
| 401 | mbtk_net_pre = QSER_NW_MODE_GSM; |
| 402 | break; |
| 403 | case QSER_NW_MODE_WCDMA: |
| 404 | mbtk_net_pre = QSER_NW_MODE_WCDMA; |
| 405 | break; |
| 406 | case QSER_NW_MODE_CDMA: |
| 407 | mbtk_net_pre = QSER_NW_MODE_CDMA; |
| 408 | break; |
| 409 | case QSER_NW_MODE_EVDO: |
| 410 | mbtk_net_pre = QSER_NW_MODE_EVDO; |
| 411 | break; |
| 412 | case QSER_NW_MODE_LTE: |
| 413 | mbtk_net_pre = QSER_NW_MODE_LTE; |
| 414 | break; |
| 415 | case QSER_NW_MODE_TDSCDMA: |
| 416 | mbtk_net_pre = QSER_NW_MODE_TDSCDMA; |
| 417 | break; |
| 418 | default: |
| 419 | mbtk_net_pre = 0xFF; |
| 420 | break; |
| 421 | } |
liuyang | 4ac8c63 | 2024-05-24 14:42:31 +0800 | [diff] [blame] | 422 | } |
| 423 | else |
| 424 | { |
| 425 | if(QSER_NW_MODE_GSM == net_mode) |
r.xiao | e73f870 | 2024-01-06 01:40:03 -0800 | [diff] [blame] | 426 | { |
liuyang | 4ac8c63 | 2024-05-24 14:42:31 +0800 | [diff] [blame] | 427 | mbtk_net_pre = MBTK_NET_PREF_GSM_ONLY; |
| 428 | } |
| 429 | else if(QSER_NW_MODE_WCDMA == net_mode) |
| 430 | { |
| 431 | mbtk_net_pre = MBTK_NET_PREF_UMTS_ONLY; |
| 432 | } |
| 433 | else if(QSER_NW_MODE_LTE == net_mode) |
| 434 | { |
| 435 | mbtk_net_pre = MBTK_NET_PREF_LTE_ONLY; |
| 436 | } |
| 437 | else if((QSER_NW_MODE_GSM | QSER_NW_MODE_WCDMA) == net_mode) |
| 438 | { |
| 439 | mbtk_net_pre = MBTK_NET_PREF_GSM_UMTS_UMTS_PREF; |
| 440 | } |
| 441 | else if((QSER_NW_MODE_WCDMA | QSER_NW_MODE_LTE) == net_mode) |
| 442 | { |
| 443 | mbtk_net_pre = MBTK_NET_PREF_UMTS_LTE_LTE_PREF; |
| 444 | } |
| 445 | else if((QSER_NW_MODE_GSM | QSER_NW_MODE_LTE) == net_mode) |
| 446 | { |
| 447 | mbtk_net_pre = MBTK_NET_PREF_GSM_LTE_LTE_PREF; |
| 448 | } |
| 449 | else if((QSER_NW_MODE_GSM | QSER_NW_MODE_WCDMA | QSER_NW_MODE_LTE) == net_mode) |
| 450 | { |
| 451 | mbtk_net_pre = MBTK_NET_PREF_GSM_UMTS_LTE_LTE_PREF; |
| 452 | } |
| 453 | else |
| 454 | { |
| 455 | mbtk_net_pre = 0xFF; |
r.xiao | e73f870 | 2024-01-06 01:40:03 -0800 | [diff] [blame] | 456 | } |
| 457 | } |
| 458 | return mbtk_net_pre; |
| 459 | } |
b.liu | 5fa9e77 | 2023-11-23 18:00:55 +0800 | [diff] [blame] | 460 | |
| 461 | int qser_nw_client_init(nw_client_handle_type *ph_nw) |
| 462 | { |
r.xiao | e73f870 | 2024-01-06 01:40:03 -0800 | [diff] [blame] | 463 | //UNUSED(ph_nw); |
b.liu | 5fa9e77 | 2023-11-23 18:00:55 +0800 | [diff] [blame] | 464 | |
r.xiao | e73f870 | 2024-01-06 01:40:03 -0800 | [diff] [blame] | 465 | if(lynq_nw_info_handle == NULL) |
| 466 | { |
| 467 | lynq_nw_info_handle = mbtk_info_handle_get(); |
| 468 | if(lynq_nw_info_handle) |
| 469 | { |
r.xiao | d9dd06e | 2024-02-02 04:17:52 -0800 | [diff] [blame] | 470 | LOGI("creat lynq_nw_info_handle is success"); |
r.xiao | e73f870 | 2024-01-06 01:40:03 -0800 | [diff] [blame] | 471 | *ph_nw = lynq_nw_info_handle->client_fd; |
| 472 | g_nw_val = lynq_nw_info_handle->client_fd; |
| 473 | } |
| 474 | else |
| 475 | { |
r.xiao | d9dd06e | 2024-02-02 04:17:52 -0800 | [diff] [blame] | 476 | LOGE("creat lynq_nw_info_handle is fail"); |
r.xiao | e73f870 | 2024-01-06 01:40:03 -0800 | [diff] [blame] | 477 | return -1; |
| 478 | } |
| 479 | } |
| 480 | |
b.liu | 5fa9e77 | 2023-11-23 18:00:55 +0800 | [diff] [blame] | 481 | return 0; |
| 482 | } |
| 483 | |
| 484 | int qser_nw_client_deinit(nw_client_handle_type h_nw) |
| 485 | { |
r.xiao | e73f870 | 2024-01-06 01:40:03 -0800 | [diff] [blame] | 486 | //UNUSED(h_nw); |
| 487 | if (h_nw != g_nw_val || g_nw_val == -1) |
| 488 | { |
r.xiao | d9dd06e | 2024-02-02 04:17:52 -0800 | [diff] [blame] | 489 | LOGE("handle NULL"); |
r.xiao | e73f870 | 2024-01-06 01:40:03 -0800 | [diff] [blame] | 490 | return -1; |
| 491 | } |
| 492 | |
r.xiao | fca7c47 | 2024-04-24 01:00:23 -0700 | [diff] [blame] | 493 | mbtk_signal_state_change_cb_reg(lynq_nw_info_handle, NULL); |
| 494 | |
r.xiao | e73f870 | 2024-01-06 01:40:03 -0800 | [diff] [blame] | 495 | if(lynq_nw_info_handle) |
| 496 | { |
| 497 | mbtk_info_handle_free(&lynq_nw_info_handle); |
| 498 | } |
| 499 | else |
| 500 | { |
r.xiao | d9dd06e | 2024-02-02 04:17:52 -0800 | [diff] [blame] | 501 | LOGE("deinit lynq_nw_info_handle is fail"); |
r.xiao | e73f870 | 2024-01-06 01:40:03 -0800 | [diff] [blame] | 502 | return -1; |
| 503 | } |
b.liu | 5fa9e77 | 2023-11-23 18:00:55 +0800 | [diff] [blame] | 504 | |
| 505 | return 0; |
| 506 | } |
| 507 | |
| 508 | int qser_nw_set_config(nw_client_handle_type h_nw,QSER_NW_CONFIG_INFO_T *pt_info) |
| 509 | { |
r.xiao | e73f870 | 2024-01-06 01:40:03 -0800 | [diff] [blame] | 510 | //UNUSED(h_nw); |
| 511 | //UNUSED(pt_info); |
| 512 | if (h_nw != g_nw_val || g_nw_val == -1) |
| 513 | { |
r.xiao | d9dd06e | 2024-02-02 04:17:52 -0800 | [diff] [blame] | 514 | LOGE("handle NULL"); |
r.xiao | e73f870 | 2024-01-06 01:40:03 -0800 | [diff] [blame] | 515 | return -1; |
| 516 | } |
| 517 | |
| 518 | if(lynq_nw_info_handle == NULL) |
| 519 | { |
r.xiao | d9dd06e | 2024-02-02 04:17:52 -0800 | [diff] [blame] | 520 | LOGE("lynq_nw_info_handle == NULL."); |
r.xiao | e73f870 | 2024-01-06 01:40:03 -0800 | [diff] [blame] | 521 | return -1; |
| 522 | } |
| 523 | |
| 524 | if(pt_info == NULL) |
| 525 | { |
r.xiao | d9dd06e | 2024-02-02 04:17:52 -0800 | [diff] [blame] | 526 | LOGE("pt_info == NULL."); |
r.xiao | e73f870 | 2024-01-06 01:40:03 -0800 | [diff] [blame] | 527 | return -1; |
| 528 | } |
| 529 | |
| 530 | roaming_pref = pt_info->roaming_pref; |
| 531 | |
| 532 | mbtk_band_info_t band; |
| 533 | memset(&band, 0, sizeof(mbtk_band_info_t)); |
| 534 | tmp_mode = pt_info->preferred_nw_mode;//临时保存一下原本的mode |
| 535 | |
| 536 | //printf("tmp_mode = [%llu]",tmp_mode); |
| 537 | band.net_pref = lynq_net_pre_change(FALSE, pt_info->preferred_nw_mode); |
r.xiao | d9dd06e | 2024-02-02 04:17:52 -0800 | [diff] [blame] | 538 | LOGI("band.net_pref = [%d] ",band.net_pref); |
r.xiao | e73f870 | 2024-01-06 01:40:03 -0800 | [diff] [blame] | 539 | |
| 540 | if(band.net_pref == 0xFF) |
| 541 | { |
| 542 | LOGE("lynq_net_pre_change() fail."); |
| 543 | return -1; |
| 544 | } |
| 545 | |
| 546 | if(mbtk_current_band_set(lynq_nw_info_handle, &band)) |
| 547 | { |
| 548 | return -1; |
| 549 | } |
b.liu | 5fa9e77 | 2023-11-23 18:00:55 +0800 | [diff] [blame] | 550 | |
| 551 | return 0; |
| 552 | } |
| 553 | |
| 554 | int qser_nw_get_operator_name(nw_client_handle_type h_nw, QSER_NW_OPERATOR_NAME_INFO_T *pt_info) |
| 555 | { |
r.xiao | e73f870 | 2024-01-06 01:40:03 -0800 | [diff] [blame] | 556 | //UNUSED(h_nw); |
| 557 | //UNUSED(pt_info); |
| 558 | if (h_nw != g_nw_val || g_nw_val == -1) |
| 559 | { |
r.xiao | d9dd06e | 2024-02-02 04:17:52 -0800 | [diff] [blame] | 560 | LOGE("handle NULL"); |
r.xiao | e73f870 | 2024-01-06 01:40:03 -0800 | [diff] [blame] | 561 | return -1; |
| 562 | } |
b.liu | 5fa9e77 | 2023-11-23 18:00:55 +0800 | [diff] [blame] | 563 | |
r.xiao | e73f870 | 2024-01-06 01:40:03 -0800 | [diff] [blame] | 564 | if(lynq_nw_info_handle == NULL) |
| 565 | { |
r.xiao | d9dd06e | 2024-02-02 04:17:52 -0800 | [diff] [blame] | 566 | LOGE("lynq_nw_info_handle == NULL."); |
r.xiao | e73f870 | 2024-01-06 01:40:03 -0800 | [diff] [blame] | 567 | return -1; |
| 568 | } |
| 569 | |
| 570 | if(pt_info == NULL) |
| 571 | { |
r.xiao | d9dd06e | 2024-02-02 04:17:52 -0800 | [diff] [blame] | 572 | LOGE("pt_info == NULL."); |
r.xiao | e73f870 | 2024-01-06 01:40:03 -0800 | [diff] [blame] | 573 | return -1; |
| 574 | } |
| 575 | |
| 576 | char OperatorFN[128]; |
| 577 | char OperatorSH[128]; |
| 578 | char MccMnc[128]; |
| 579 | mbtk_net_info_t net; |
| 580 | if(!mbtk_net_sel_mode_get(lynq_nw_info_handle, &net) && net.plmn > 0) |
| 581 | { |
| 582 | // printf("Net : %d, %d, %d\n", net.net_sel_mode, net.net_type, net.plmn); |
| 583 | int i = 0; |
| 584 | while(i < ARRAY_SIZE(lynq_operator_mcc_mnc)) |
| 585 | { |
| 586 | if(lynq_operator_mcc_mnc[i].lynq_mcc_mnc == net.plmn) |
| 587 | break; |
| 588 | i++; |
| 589 | } |
| 590 | |
| 591 | if(i == ARRAY_SIZE(lynq_operator_mcc_mnc)) // No found mcc&mnc |
| 592 | { |
| 593 | strcpy(OperatorFN, "UNKNOWN"); |
| 594 | strcpy(OperatorSH, "UNKNOWN"); |
| 595 | sprintf(MccMnc, "%d", net.plmn); |
| 596 | } |
| 597 | else |
| 598 | { |
| 599 | strcpy(OperatorFN, lynq_operator_mcc_mnc[i].lynq_operator_l); |
| 600 | strcpy(OperatorSH, lynq_operator_mcc_mnc[i].lynq_operator_s); |
| 601 | sprintf(MccMnc, "%d", lynq_operator_mcc_mnc[i].lynq_mcc_mnc); |
| 602 | } |
| 603 | memset(pt_info->long_eons,0,128); |
| 604 | memcpy(pt_info->long_eons,lynq_operator_mcc_mnc[i].lynq_operator_l,strlen(lynq_operator_mcc_mnc[i].lynq_operator_l)); |
| 605 | memset(pt_info->short_eons,0,128); |
| 606 | memcpy(pt_info->short_eons,lynq_operator_mcc_mnc[i].lynq_operator_s,strlen(lynq_operator_mcc_mnc[i].lynq_operator_s)); |
| 607 | memset(pt_info->mcc,0,4); |
| 608 | memset(pt_info->mnc,0,4); |
| 609 | sprintf(pt_info->mcc, "%d", (lynq_operator_mcc_mnc[i].lynq_mcc_mnc)/100); |
| 610 | sprintf(pt_info->mnc, "%d", (lynq_operator_mcc_mnc[i].lynq_mcc_mnc)%100); |
| 611 | //pt_info->act; |
| 612 | return 0; |
| 613 | } |
| 614 | |
| 615 | return -1; |
b.liu | 5fa9e77 | 2023-11-23 18:00:55 +0800 | [diff] [blame] | 616 | } |
| 617 | |
| 618 | int qser_nw_get_reg_status(nw_client_handle_type h_nw, QSER_NW_REG_STATUS_INFO_T *pt_info) |
| 619 | { |
r.xiao | e73f870 | 2024-01-06 01:40:03 -0800 | [diff] [blame] | 620 | //UNUSED(h_nw); |
| 621 | //UNUSED(pt_info); |
| 622 | if (h_nw != g_nw_val || g_nw_val == -1) |
| 623 | { |
r.xiao | d9dd06e | 2024-02-02 04:17:52 -0800 | [diff] [blame] | 624 | LOGE("handle NULL"); |
r.xiao | e73f870 | 2024-01-06 01:40:03 -0800 | [diff] [blame] | 625 | return -1; |
| 626 | } |
| 627 | |
| 628 | if(lynq_nw_info_handle == NULL) |
| 629 | { |
r.xiao | d9dd06e | 2024-02-02 04:17:52 -0800 | [diff] [blame] | 630 | LOGE("lynq_nw_info_handle == NULL."); |
r.xiao | e73f870 | 2024-01-06 01:40:03 -0800 | [diff] [blame] | 631 | return -1; |
| 632 | } |
| 633 | |
| 634 | if(pt_info == NULL) |
| 635 | { |
r.xiao | d9dd06e | 2024-02-02 04:17:52 -0800 | [diff] [blame] | 636 | LOGE("pt_info == NULL."); |
r.xiao | e73f870 | 2024-01-06 01:40:03 -0800 | [diff] [blame] | 637 | return -1; |
| 638 | } |
| 639 | |
| 640 | /*VOICE/DATA/IMS*/ |
| 641 | mbtk_net_reg_info_t reg; |
| 642 | int err = mbtk_net_reg_get(lynq_nw_info_handle, ®); |
| 643 | if(err) |
| 644 | { |
| 645 | LOGE("mbtk_net_reg_get fail."); |
| 646 | return -1; |
| 647 | } |
| 648 | else |
| 649 | { |
| 650 | memset(pt_info, 0x0, sizeof(QSER_NW_REG_STATUS_INFO_T)); |
| 651 | |
| 652 | |
| 653 | char OperatorFN[128]; |
| 654 | char OperatorSH[128]; |
| 655 | char MccMnc[128]; |
| 656 | mbtk_net_info_t net; |
| 657 | if(!mbtk_net_sel_mode_get(lynq_nw_info_handle, &net) && net.plmn > 0) |
| 658 | { |
| 659 | // printf("Net : %d, %d, %d\n", net.net_sel_mode, net.net_type, net.plmn); |
| 660 | int i = 0; |
| 661 | while(i < ARRAY_SIZE(lynq_operator_mcc_mnc)) |
| 662 | { |
| 663 | if(lynq_operator_mcc_mnc[i].lynq_mcc_mnc == net.plmn) |
| 664 | break; |
| 665 | i++; |
| 666 | } |
| 667 | |
| 668 | if(i == ARRAY_SIZE(lynq_operator_mcc_mnc)) // No found mcc&mnc |
| 669 | { |
| 670 | strcpy(OperatorFN, "UNKNOWN"); |
| 671 | strcpy(OperatorSH, "UNKNOWN"); |
| 672 | sprintf(MccMnc, "%d", net.plmn); |
| 673 | } |
| 674 | else |
| 675 | { |
| 676 | sprintf(MccMnc, "%d", lynq_operator_mcc_mnc[i].lynq_mcc_mnc); |
| 677 | } |
| 678 | sprintf(pt_info->data_registration_details_3gpp.mcc, "%d", (lynq_operator_mcc_mnc[i].lynq_mcc_mnc)/100); |
| 679 | sprintf(pt_info->data_registration_details_3gpp.mnc, "%d", (lynq_operator_mcc_mnc[i].lynq_mcc_mnc)%100); |
| 680 | sprintf(pt_info->voice_registration_details_3gpp.mcc, "%d", (lynq_operator_mcc_mnc[i].lynq_mcc_mnc)/100); |
| 681 | sprintf(pt_info->voice_registration_details_3gpp.mnc, "%d", (lynq_operator_mcc_mnc[i].lynq_mcc_mnc)%100); |
| 682 | //pt_info->act; |
| 683 | } |
| 684 | |
| 685 | //暂时未知是否其他也被使用,现根据ql模块的传输情况, |
| 686 | //只配置3gpp,涉及call,data状态没有对应的匹配的就没有赋值 |
| 687 | |
r.xiao | fca7c47 | 2024-04-24 01:00:23 -0700 | [diff] [blame] | 688 | pt_info->voice_registration_valid = TRUE; |
| 689 | pt_info->voice_registration.deny_reason = 0; |
| 690 | pt_info->voice_registration.roaming = 0; |
| 691 | pt_info->voice_registration.tech_domain = 0; |
r.xiao | e73f870 | 2024-01-06 01:40:03 -0800 | [diff] [blame] | 692 | |
r.xiao | fca7c47 | 2024-04-24 01:00:23 -0700 | [diff] [blame] | 693 | |
| 694 | pt_info->data_registration_valid = TRUE; |
| 695 | pt_info->data_registration.deny_reason = 0; |
| 696 | pt_info->data_registration.roaming = 0; |
| 697 | pt_info->data_registration.tech_domain = 0; |
| 698 | |
| 699 | if (reg.call_state == 1 || reg.call_state == 5) |
| 700 | { |
| 701 | pt_info->voice_registration.registration_state = E_QSER_NW_SERVICE_FULL; |
| 702 | } |
| 703 | else if (reg.call_state == 0 || reg.call_state == 2 || reg.call_state == 3 || reg.call_state == 4) |
| 704 | { |
| 705 | pt_info->voice_registration.registration_state = E_QSER_NW_SERVICE_NONE; |
| 706 | } |
| 707 | |
| 708 | if (reg.data_state == 1 || reg.data_state == 5) |
| 709 | { |
| 710 | pt_info->data_registration.registration_state = E_QSER_NW_SERVICE_FULL; |
| 711 | } |
| 712 | else if (reg.data_state == 0 || reg.data_state == 2 || reg.data_state == 3 || reg.data_state == 4) |
| 713 | { |
| 714 | pt_info->data_registration.registration_state = E_QSER_NW_SERVICE_NONE; |
| 715 | } |
| 716 | |
r.xiao | e73f870 | 2024-01-06 01:40:03 -0800 | [diff] [blame] | 717 | |
| 718 | pt_info->voice_registration_details_3gpp_valid = TRUE; |
| 719 | pt_info->voice_registration_details_3gpp.lac = reg.lac; |
| 720 | pt_info->voice_registration_details_3gpp.cid = reg.ci; |
| 721 | //补位填0 or 1 |
| 722 | pt_info->voice_registration_details_3gpp.tech_domain = 1; |
| 723 | pt_info->voice_registration_details_3gpp.roaming = 0; |
| 724 | pt_info->voice_registration_details_3gpp.forbidden = 0; |
| 725 | pt_info->voice_registration_details_3gpp.psc = 0; |
| 726 | pt_info->voice_registration_details_3gpp.tac = 0; |
| 727 | |
| 728 | pt_info->data_registration_details_3gpp_valid = TRUE; |
| 729 | pt_info->data_registration_details_3gpp.lac = reg.lac; |
| 730 | pt_info->data_registration_details_3gpp.cid = reg.ci; |
| 731 | //补位填0 or 1 |
| 732 | pt_info->data_registration_details_3gpp.tech_domain = 1; |
| 733 | pt_info->data_registration_details_3gpp.roaming = 0; |
| 734 | pt_info->data_registration_details_3gpp.forbidden = 0; |
| 735 | pt_info->data_registration_details_3gpp.psc = 0; |
| 736 | pt_info->data_registration_details_3gpp.tac = 0; |
| 737 | |
| 738 | |
| 739 | pt_info->voice_registration_details_3gpp2_valid = FALSE; |
| 740 | //pt_info->voice_registration_details_3gpp2 |
| 741 | |
| 742 | pt_info->data_registration_details_3gpp2_valid = FALSE; |
| 743 | //pt_info->data_registration_details_3gpp2 |
| 744 | |
| 745 | |
| 746 | switch(reg.type) |
| 747 | { |
| 748 | case MBTK_RADIO_TECH_GSM: |
| 749 | case MBTK_RADIO_TECH_GSM_COMPACT: |
| 750 | case MBTK_RADIO_TECH_GSM_EGPRS: |
| 751 | case MBTK_RADIO_TECH_UTRAN_HSPA: |
| 752 | { |
| 753 | pt_info->data_registration_details_3gpp.radio_tech = E_QSER_NW_RADIO_TECH_GPRS; |
| 754 | pt_info->voice_registration_details_3gpp.radio_tech = E_QSER_NW_RADIO_TECH_GSM; |
r.xiao | fca7c47 | 2024-04-24 01:00:23 -0700 | [diff] [blame] | 755 | pt_info->data_registration.radio_tech = E_QSER_NW_RADIO_TECH_GPRS; |
| 756 | pt_info->voice_registration.radio_tech = E_QSER_NW_RADIO_TECH_GSM; |
r.xiao | e73f870 | 2024-01-06 01:40:03 -0800 | [diff] [blame] | 757 | break; |
| 758 | } |
| 759 | case MBTK_RADIO_TECH_UTRAN: |
| 760 | case MBTK_RADIO_TECH_UTRAN_HSDPA: |
| 761 | case MBTK_RADIO_TECH_UTRAN_HSUPA: |
| 762 | case MBTK_RADIO_TECH_UTRAN_HSDPA_HSUPA: |
| 763 | { |
| 764 | pt_info->data_registration_details_3gpp.radio_tech = E_QSER_NW_RADIO_TECH_UMTS; |
| 765 | pt_info->voice_registration_details_3gpp.radio_tech = E_QSER_NW_RADIO_TECH_UMTS; |
r.xiao | fca7c47 | 2024-04-24 01:00:23 -0700 | [diff] [blame] | 766 | pt_info->data_registration.radio_tech = E_QSER_NW_RADIO_TECH_UMTS; |
| 767 | pt_info->voice_registration.radio_tech = E_QSER_NW_RADIO_TECH_UMTS; |
r.xiao | e73f870 | 2024-01-06 01:40:03 -0800 | [diff] [blame] | 768 | break; |
| 769 | } |
| 770 | case MBTK_RADIO_TECH_E_UTRAN: |
| 771 | { |
| 772 | pt_info->data_registration_details_3gpp.radio_tech = E_QSER_NW_RADIO_TECH_LTE; |
| 773 | pt_info->voice_registration_details_3gpp.radio_tech = E_QSER_NW_RADIO_TECH_LTE; |
r.xiao | fca7c47 | 2024-04-24 01:00:23 -0700 | [diff] [blame] | 774 | pt_info->data_registration.radio_tech = E_QSER_NW_RADIO_TECH_LTE; |
| 775 | pt_info->voice_registration.radio_tech = E_QSER_NW_RADIO_TECH_LTE; |
r.xiao | e73f870 | 2024-01-06 01:40:03 -0800 | [diff] [blame] | 776 | break; |
| 777 | } |
| 778 | default: |
| 779 | { |
| 780 | pt_info->data_registration_details_3gpp.radio_tech = E_QSER_NW_RADIO_TECH_NONE; |
| 781 | pt_info->voice_registration_details_3gpp.radio_tech = E_QSER_NW_RADIO_TECH_NONE; |
r.xiao | fca7c47 | 2024-04-24 01:00:23 -0700 | [diff] [blame] | 782 | pt_info->data_registration.radio_tech = E_QSER_NW_RADIO_TECH_NONE; |
| 783 | pt_info->voice_registration.radio_tech = E_QSER_NW_RADIO_TECH_NONE; |
| 784 | pt_info->data_registration.registration_state = E_QSER_NW_SERVICE_NONE; |
| 785 | pt_info->voice_registration.registration_state = E_QSER_NW_SERVICE_NONE; |
r.xiao | e73f870 | 2024-01-06 01:40:03 -0800 | [diff] [blame] | 786 | break; |
| 787 | } |
| 788 | } |
| 789 | } |
b.liu | 5fa9e77 | 2023-11-23 18:00:55 +0800 | [diff] [blame] | 790 | |
| 791 | return 0; |
| 792 | } |
| 793 | |
| 794 | int qser_nw_get_signal_strength(nw_client_handle_type h_nw,QSER_NW_SIGNAL_STRENGTH_INFO_T *pt_info) |
| 795 | { |
r.xiao | e73f870 | 2024-01-06 01:40:03 -0800 | [diff] [blame] | 796 | //UNUSED(h_nw); |
| 797 | //UNUSED(pt_info); |
| 798 | if (h_nw != g_nw_val || g_nw_val == -1) |
| 799 | { |
r.xiao | d9dd06e | 2024-02-02 04:17:52 -0800 | [diff] [blame] | 800 | LOGE("handle NULL"); |
r.xiao | e73f870 | 2024-01-06 01:40:03 -0800 | [diff] [blame] | 801 | return -1; |
| 802 | } |
| 803 | |
| 804 | if(lynq_nw_info_handle == NULL) |
| 805 | { |
r.xiao | d9dd06e | 2024-02-02 04:17:52 -0800 | [diff] [blame] | 806 | LOGE("lynq_nw_info_handle == NULL."); |
r.xiao | e73f870 | 2024-01-06 01:40:03 -0800 | [diff] [blame] | 807 | return -1; |
| 808 | } |
| 809 | |
| 810 | if(pt_info == NULL) |
| 811 | { |
r.xiao | d9dd06e | 2024-02-02 04:17:52 -0800 | [diff] [blame] | 812 | LOGE("pt_info == NULL."); |
r.xiao | e73f870 | 2024-01-06 01:40:03 -0800 | [diff] [blame] | 813 | return -1; |
| 814 | } |
| 815 | |
| 816 | int ret; |
| 817 | mbtk_signal_info_t signal; |
| 818 | ret = mbtk_net_signal_get(lynq_nw_info_handle, &signal); |
| 819 | if(ret != 0) { |
| 820 | LOGE("mbtk_net_signal_get fail."); |
| 821 | return -1; |
| 822 | } |
| 823 | else |
| 824 | { |
| 825 | memset(pt_info, 0x0, sizeof(QSER_NW_SIGNAL_STRENGTH_INFO_T)); |
r.xiao | fca7c47 | 2024-04-24 01:00:23 -0700 | [diff] [blame] | 826 | |
r.xiao | e73f870 | 2024-01-06 01:40:03 -0800 | [diff] [blame] | 827 | if(signal.type == MBTK_RADIO_TECH_GSM || signal.type == MBTK_RADIO_TECH_GSM_COMPACT || \ |
| 828 | signal.type == MBTK_RADIO_TECH_GSM_EGPRS) //GSM |
| 829 | { |
| 830 | pt_info->gsm_sig_info_valid = TRUE; |
| 831 | pt_info->gsm_sig_info.rssi = signal.rssi; |
| 832 | } |
| 833 | else if(signal.type == MBTK_RADIO_TECH_E_UTRAN) //LTE |
| 834 | { |
| 835 | pt_info->lte_sig_info_valid = TRUE; |
| 836 | pt_info->lte_sig_info.rsrp = signal.rsrp; |
| 837 | pt_info->lte_sig_info.rsrq = signal.rsrq; |
r.xiao | fca7c47 | 2024-04-24 01:00:23 -0700 | [diff] [blame] | 838 | pt_info->lte_sig_info.snr = 0x7FFFFFFFF; //->MBTK接口无该参数(对应参数为rssnr,该值INT_MAX:0x7FFFFFFFF表示无效值),写死值为0x7FFFFFFFF |
| 839 | pt_info->lte_sig_info.rssi = -125; |
r.xiao | e73f870 | 2024-01-06 01:40:03 -0800 | [diff] [blame] | 840 | } |
| 841 | else if (signal.type == MBTK_RADIO_TECH_UTRAN || signal.type == MBTK_RADIO_TECH_UTRAN_HSDPA || \ |
| 842 | signal.type == MBTK_RADIO_TECH_UTRAN_HSUPA || signal.type == MBTK_RADIO_TECH_UTRAN_HSDPA_HSUPA || \ |
| 843 | signal.type == MBTK_RADIO_TECH_UTRAN_HSPA )//WCDMA |
| 844 | { |
| 845 | pt_info->wcdma_sig_info_valid = TRUE; |
r.xiao | fca7c47 | 2024-04-24 01:00:23 -0700 | [diff] [blame] | 846 | pt_info->wcdma_sig_info.rssi = signal.rscp; |
| 847 | pt_info->wcdma_sig_info.ecio = signal.ecno; |
r.xiao | e73f870 | 2024-01-06 01:40:03 -0800 | [diff] [blame] | 848 | } |
| 849 | else |
| 850 | { |
| 851 | return -1; |
| 852 | } |
r.xiao | fca7c47 | 2024-04-24 01:00:23 -0700 | [diff] [blame] | 853 | /* |
| 854 | pt_info->gsm_sig_info_valid = 1//signal.gw_sig_valid; |
| 855 | pt_info->gsm_sig_info.rssi = signal.rssi;//signal.rssi-110; |
| 856 | pt_info->wcdma_sig_info_valid = 1//signal.wcdma_sig_valid; |
| 857 | pt_info->wcdma_sig_info.rssi = signal.rscp;//signal.wcdma_signalstrength-110; |
| 858 | pt_info->wcdma_sig_info.ecio = //signal.ecno/5; |
| 859 | pt_info->tdscdma_sig_info_valid = 0; |
| 860 | pt_info->lte_sig_info_valid = 1//signal.lte_sig_valid; |
| 861 | pt_info->lte_sig_info.rssi = -125;//signal.lte_signalstrength-110; |
| 862 | pt_info->lte_sig_info.rsrp = signal.rsrp;//signal.rsrp*(-1); |
| 863 | pt_info->lte_sig_info.rsrq = signal.rsrq;//signal.rsrq*(-1); |
| 864 | pt_info->lte_sig_info.snr = 0x7FFFFFFFF;//signal.rssnr; |
| 865 | pt_info->cdma_sig_info_valid = 0; |
| 866 | pt_info->hdr_sig_info_valid = 0; |
| 867 | //mbtk 无nr |
| 868 | pt_info->nr_sig_info_valid = 0//signal.nr_sig_valid; |
| 869 | pt_info->nr_sig_info.ssRsrp = 0//signal.ssRsrp; |
| 870 | pt_info->nr_sig_info.ssRsrq = 0//signal.ssRsrq; |
| 871 | pt_info->nr_sig_info.ssSinr = 0//signal.ssSinr; |
| 872 | pt_info->nr_sig_info.csiRsrp = 0//signal.csiRsrp; |
| 873 | pt_info->nr_sig_info.csiRsrq = 0//signal.csiRsrq; |
| 874 | pt_info->nr_sig_info.csiSinr = 0//signal.csiSinr; |
| 875 | */ |
r.xiao | e73f870 | 2024-01-06 01:40:03 -0800 | [diff] [blame] | 876 | } |
b.liu | 5fa9e77 | 2023-11-23 18:00:55 +0800 | [diff] [blame] | 877 | |
| 878 | return 0; |
| 879 | } |
| 880 | |
b.liu | 4e243dc | 2023-11-27 11:20:00 +0800 | [diff] [blame] | 881 | int qser_nw_add_rx_msg_handler (nw_client_handle_type h_nw, QSER_NW_RxMsgHandlerFunc_t handlerPtr, void* contextPtr) |
b.liu | 5fa9e77 | 2023-11-23 18:00:55 +0800 | [diff] [blame] | 882 | { |
r.xiao | e73f870 | 2024-01-06 01:40:03 -0800 | [diff] [blame] | 883 | //UNUSED(h_nw); |
| 884 | //UNUSED(handlerPtr); |
| 885 | //UNUSED(contextPtr); |
| 886 | |
| 887 | if (h_nw != g_nw_val || g_nw_val == -1) |
| 888 | { |
r.xiao | d9dd06e | 2024-02-02 04:17:52 -0800 | [diff] [blame] | 889 | LOGE("handle NULL"); |
r.xiao | e73f870 | 2024-01-06 01:40:03 -0800 | [diff] [blame] | 890 | return -1; |
| 891 | } |
| 892 | |
| 893 | if(lynq_nw_info_handle == NULL) |
| 894 | { |
r.xiao | d9dd06e | 2024-02-02 04:17:52 -0800 | [diff] [blame] | 895 | LOGE("lynq_nw_info_handle == NULL."); |
r.xiao | e73f870 | 2024-01-06 01:40:03 -0800 | [diff] [blame] | 896 | return -1; |
| 897 | } |
| 898 | |
| 899 | lynq_func_cb_handle.handlerPtr = handlerPtr; |
| 900 | lynq_func_cb_handle.contextPtr = contextPtr; |
| 901 | |
r.xiao | fca7c47 | 2024-04-24 01:00:23 -0700 | [diff] [blame] | 902 | mbtk_signal_state_change_cb_reg(lynq_nw_info_handle, lynq_signal_state_change_cb); |
b.liu | 5fa9e77 | 2023-11-23 18:00:55 +0800 | [diff] [blame] | 903 | |
| 904 | return 0; |
| 905 | } |
| 906 | |
| 907 | int qser_nw_set_oos_config (nw_client_handle_type h_nw, QSER_NW_OOS_CONFIG_INFO_T *pt_info) |
| 908 | { |
r.xiao | cfd7c68 | 2024-01-22 03:59:46 -0800 | [diff] [blame] | 909 | //UNUSED(h_nw); |
| 910 | //UNUSED(pt_info); |
| 911 | if (h_nw != g_nw_val || g_nw_val == -1) |
| 912 | { |
r.xiao | d9dd06e | 2024-02-02 04:17:52 -0800 | [diff] [blame] | 913 | LOGE("handle NULL"); |
r.xiao | cfd7c68 | 2024-01-22 03:59:46 -0800 | [diff] [blame] | 914 | return -1; |
| 915 | } |
| 916 | |
| 917 | if (pt_info == NULL) |
| 918 | { |
r.xiao | d9dd06e | 2024-02-02 04:17:52 -0800 | [diff] [blame] | 919 | LOGE("QSER_NW_OOS_CONFIG_INFO_T NULL"); |
r.xiao | cfd7c68 | 2024-01-22 03:59:46 -0800 | [diff] [blame] | 920 | return -1; |
| 921 | } |
| 922 | |
| 923 | uint32 oosPhase_0, oosPhase_1, oosPhase_2; |
| 924 | char tmp_type; |
| 925 | mbtk_oos_info oos_info; |
| 926 | |
| 927 | memset(&oos_info, 0x00, sizeof(mbtk_oos_info)); |
| 928 | |
| 929 | |
| 930 | tmp_type = pt_info->type; |
| 931 | |
| 932 | if (tmp_type == QSER_NW_OOS_CFG_TYPE_FULL_BAND_SCAN) |
| 933 | {//如果没有配置对应的值,例如,10,20 |
| 934 | //oosPhase_2这个位置没有配置,则使用默认值20,既不限制次数的5s进行一次扫描 |
| 935 | //同理oosPhase_0,oosPhase_1这个位置没有配置,则使用默认值5,10,既限制次数5次的5s,10s进行一次扫描 |
| 936 | //输入多少配置多少,可以缺省使用默认值 |
| 937 | if (pt_info->u.full_band_scan_info.t_min < 0 || pt_info->u.full_band_scan_info.t_step < 0 || pt_info->u.full_band_scan_info.t_max < 0) |
| 938 | { |
r.xiao | d9dd06e | 2024-02-02 04:17:52 -0800 | [diff] [blame] | 939 | LOGE("qser_nw_set_oos_config set time < 0 "); |
r.xiao | cfd7c68 | 2024-01-22 03:59:46 -0800 | [diff] [blame] | 940 | return -1; |
| 941 | } |
| 942 | else if ((pt_info->u.full_band_scan_info.t_min > 0 && pt_info->u.full_band_scan_info.t_min <= 255) && pt_info->u.full_band_scan_info.t_step == 0 && pt_info->u.full_band_scan_info.t_max == 0) |
| 943 | { |
| 944 | oosPhase_0 = pt_info->u.full_band_scan_info.t_min; |
| 945 | oos_info.mode = 1; |
| 946 | oos_info.oosPhase[0] = oosPhase_0; |
| 947 | } |
| 948 | else if ((pt_info->u.full_band_scan_info.t_min > 0 && pt_info->u.full_band_scan_info.t_min <= 255) && (pt_info->u.full_band_scan_info.t_step > 0 && pt_info->u.full_band_scan_info.t_step <= 255) && pt_info->u.full_band_scan_info.t_max == 0) |
| 949 | { |
| 950 | oosPhase_0 = pt_info->u.full_band_scan_info.t_min; |
| 951 | oosPhase_1 = pt_info->u.full_band_scan_info.t_step; |
| 952 | oos_info.mode = 1; |
| 953 | oos_info.oosPhase[0] = oosPhase_0; |
| 954 | oos_info.oosPhase[1] = oosPhase_1; |
| 955 | } |
| 956 | else if ((pt_info->u.full_band_scan_info.t_min > 0 && pt_info->u.full_band_scan_info.t_min <= 255) && (pt_info->u.full_band_scan_info.t_step > 0 && pt_info->u.full_band_scan_info.t_step <= 255) && (pt_info->u.full_band_scan_info.t_max > 0 && pt_info->u.full_band_scan_info.t_max <= 255)) |
| 957 | { |
| 958 | oosPhase_0 = pt_info->u.full_band_scan_info.t_min; |
| 959 | oosPhase_1 = pt_info->u.full_band_scan_info.t_step; |
| 960 | oosPhase_2 = pt_info->u.full_band_scan_info.t_max; |
| 961 | oos_info.mode = 1; |
| 962 | oos_info.oosPhase[0] = oosPhase_0; |
| 963 | oos_info.oosPhase[1] = oosPhase_1; |
| 964 | oos_info.oosPhase[2] = oosPhase_2; |
| 965 | } |
| 966 | else if (pt_info->u.full_band_scan_info.t_min == 0 && pt_info->u.full_band_scan_info.t_step == 0 && pt_info->u.full_band_scan_info.t_max == 0) |
| 967 | { |
| 968 | oos_info.mode = 0; |
| 969 | } |
| 970 | else |
| 971 | { |
r.xiao | d9dd06e | 2024-02-02 04:17:52 -0800 | [diff] [blame] | 972 | LOGE("qser_nw_set_oos_config set Format err"); |
r.xiao | cfd7c68 | 2024-01-22 03:59:46 -0800 | [diff] [blame] | 973 | return -1; |
| 974 | } |
| 975 | |
| 976 | int err = mbtk_oos_set(lynq_nw_info_handle, &oos_info); |
| 977 | if (err != 0) |
| 978 | { |
r.xiao | d9dd06e | 2024-02-02 04:17:52 -0800 | [diff] [blame] | 979 | LOGE("qser_nw_set_oos_config mbtk_oos_set err"); |
r.xiao | cfd7c68 | 2024-01-22 03:59:46 -0800 | [diff] [blame] | 980 | return -1; |
| 981 | } |
| 982 | } |
| 983 | else if (tmp_type == QSER_NW_OOS_CFG_TYPE_FAST_SCAN) |
| 984 | { |
r.xiao | d9dd06e | 2024-02-02 04:17:52 -0800 | [diff] [blame] | 985 | LOGE("Not currently supported"); |
r.xiao | cfd7c68 | 2024-01-22 03:59:46 -0800 | [diff] [blame] | 986 | return -1; |
| 987 | } |
| 988 | else |
| 989 | { |
r.xiao | d9dd06e | 2024-02-02 04:17:52 -0800 | [diff] [blame] | 990 | LOGE("type is error"); |
r.xiao | cfd7c68 | 2024-01-22 03:59:46 -0800 | [diff] [blame] | 991 | return -1; |
| 992 | } |
b.liu | 5fa9e77 | 2023-11-23 18:00:55 +0800 | [diff] [blame] | 993 | |
| 994 | return 0; |
| 995 | } |
| 996 | |
| 997 | int qser_nw_get_oos_config (nw_client_handle_type h_nw, QSER_NW_OOS_CONFIG_INFO_T *pt_info) |
| 998 | { |
r.xiao | cfd7c68 | 2024-01-22 03:59:46 -0800 | [diff] [blame] | 999 | //UNUSED(h_nw); |
| 1000 | //UNUSED(pt_info); |
| 1001 | if (h_nw != g_nw_val || g_nw_val == -1) |
| 1002 | { |
r.xiao | d9dd06e | 2024-02-02 04:17:52 -0800 | [diff] [blame] | 1003 | LOGE("handle NULL"); |
r.xiao | cfd7c68 | 2024-01-22 03:59:46 -0800 | [diff] [blame] | 1004 | return -1; |
| 1005 | } |
| 1006 | |
| 1007 | mbtk_oos_info oos_info; |
| 1008 | uint32 oosPhase_0, oosPhase_1, oosPhase_2; |
| 1009 | char cmd[100] = {0}; |
| 1010 | |
| 1011 | memset(&oos_info, 0x00, sizeof(mbtk_oos_info)); |
| 1012 | |
| 1013 | int err = mbtk_oos_get(lynq_nw_info_handle, &oos_info); |
| 1014 | if (err != 0) |
| 1015 | { |
r.xiao | d9dd06e | 2024-02-02 04:17:52 -0800 | [diff] [blame] | 1016 | LOGE("qser_nw_get_oos_config mbtk_oos_get err "); |
r.xiao | cfd7c68 | 2024-01-22 03:59:46 -0800 | [diff] [blame] | 1017 | return -1; |
| 1018 | } |
r.xiao | ffbe6ce | 2024-01-22 19:01:01 -0800 | [diff] [blame] | 1019 | /* |
r.xiao | cfd7c68 | 2024-01-22 03:59:46 -0800 | [diff] [blame] | 1020 | printf("oos_info.mode =[%d] \n",oos_info.mode); |
| 1021 | printf("oos_info.1 =[%d] \n",oos_info.oosPhase[0]); |
| 1022 | printf("oos_info.2 =[%d] \n",oos_info.oosPhase[1]); |
| 1023 | printf("oos_info.3 =[%d] \n",oos_info.oosPhase[2]); |
r.xiao | ffbe6ce | 2024-01-22 19:01:01 -0800 | [diff] [blame] | 1024 | */ |
r.xiao | cfd7c68 | 2024-01-22 03:59:46 -0800 | [diff] [blame] | 1025 | if(oos_info.mode == 0)//关闭状态 |
| 1026 | { |
| 1027 | pt_info->u.full_band_scan_info.t_min = 0; |
| 1028 | pt_info->u.full_band_scan_info.t_step = 0; |
| 1029 | pt_info->u.full_band_scan_info.t_max = 0; |
| 1030 | } |
| 1031 | else |
| 1032 | { |
| 1033 | pt_info->u.full_band_scan_info.t_min = (int)oos_info.oosPhase[0]; |
| 1034 | pt_info->u.full_band_scan_info.t_step = (int)oos_info.oosPhase[1]; |
| 1035 | pt_info->u.full_band_scan_info.t_max = (int)oos_info.oosPhase[2]; |
| 1036 | } |
| 1037 | pt_info->type = QSER_NW_OOS_CFG_TYPE_FULL_BAND_SCAN; |
| 1038 | |
| 1039 | |
| 1040 | if (pt_info == NULL) |
| 1041 | { |
r.xiao | d9dd06e | 2024-02-02 04:17:52 -0800 | [diff] [blame] | 1042 | LOGE("qser_nw_get_oos_config pt_info is null "); |
r.xiao | cfd7c68 | 2024-01-22 03:59:46 -0800 | [diff] [blame] | 1043 | return -1; |
| 1044 | } |
b.liu | 5fa9e77 | 2023-11-23 18:00:55 +0800 | [diff] [blame] | 1045 | |
| 1046 | return 0; |
r.xiao | e73f870 | 2024-01-06 01:40:03 -0800 | [diff] [blame] | 1047 | } |
| 1048 | |
| 1049 | int qser_nw_set_rf_mode (nw_client_handle_type h_nw, E_QSER_NW_RF_MODE_TYPE_T rf_mode) |
| 1050 | { |
| 1051 | //UNUSED(h_nw); |
| 1052 | //UNUSED(rf_mode); |
| 1053 | int ret; |
r.xiao | cfd7c68 | 2024-01-22 03:59:46 -0800 | [diff] [blame] | 1054 | mbtk_modem_info_t info; |
r.xiao | e73f870 | 2024-01-06 01:40:03 -0800 | [diff] [blame] | 1055 | |
| 1056 | if (h_nw != g_nw_val || g_nw_val == -1) |
| 1057 | { |
r.xiao | d9dd06e | 2024-02-02 04:17:52 -0800 | [diff] [blame] | 1058 | LOGE("handle NULL"); |
r.xiao | e73f870 | 2024-01-06 01:40:03 -0800 | [diff] [blame] | 1059 | return -1; |
| 1060 | } |
| 1061 | |
| 1062 | if(lynq_nw_info_handle == NULL) |
| 1063 | { |
r.xiao | d9dd06e | 2024-02-02 04:17:52 -0800 | [diff] [blame] | 1064 | LOGE("lynq_nw_info_handle == NULL."); |
r.xiao | e73f870 | 2024-01-06 01:40:03 -0800 | [diff] [blame] | 1065 | return -1; |
| 1066 | } |
| 1067 | |
r.xiao | cfd7c68 | 2024-01-22 03:59:46 -0800 | [diff] [blame] | 1068 | /* |
r.xiao | e73f870 | 2024-01-06 01:40:03 -0800 | [diff] [blame] | 1069 | if (rf_mode == 4) |
| 1070 | { |
| 1071 | printf("Flight Mode no Support Now\n"); |
| 1072 | return -1; |
| 1073 | } |
r.xiao | cfd7c68 | 2024-01-22 03:59:46 -0800 | [diff] [blame] | 1074 | */ |
| 1075 | if (rf_mode != 4 && rf_mode != 0 && rf_mode != 1) |
| 1076 | { |
r.xiao | d9dd06e | 2024-02-02 04:17:52 -0800 | [diff] [blame] | 1077 | LOGE("mode is error!"); |
r.xiao | cfd7c68 | 2024-01-22 03:59:46 -0800 | [diff] [blame] | 1078 | return -1; |
| 1079 | } |
r.xiao | e73f870 | 2024-01-06 01:40:03 -0800 | [diff] [blame] | 1080 | |
r.xiao | cfd7c68 | 2024-01-22 03:59:46 -0800 | [diff] [blame] | 1081 | info.fun = rf_mode; |
| 1082 | info.rst = 0; |
| 1083 | ret = mbtk_set_modem_fun(lynq_nw_info_handle, &info); |
| 1084 | |
| 1085 | //ret = mbtk_radio_state_set(lynq_nw_info_handle, rf_mode); |
r.xiao | e73f870 | 2024-01-06 01:40:03 -0800 | [diff] [blame] | 1086 | if (ret != 0) |
| 1087 | { |
| 1088 | LOGE("mbtk_radio_state_set fail."); |
| 1089 | return -1; |
| 1090 | } |
| 1091 | else |
| 1092 | { |
r.xiao | d9dd06e | 2024-02-02 04:17:52 -0800 | [diff] [blame] | 1093 | LOGI("qser_nw_set_rf_mode is success\n"); |
r.xiao | e73f870 | 2024-01-06 01:40:03 -0800 | [diff] [blame] | 1094 | } |
| 1095 | |
| 1096 | return 0; |
| 1097 | } |
| 1098 | |
| 1099 | int qser_nw_get_rf_mode (nw_client_handle_type h_nw, E_QSER_NW_RF_MODE_TYPE_T *rf_mode) |
| 1100 | { |
| 1101 | //UNUSED(h_nw); |
| 1102 | //UNUSED(rf_mode); |
| 1103 | int ret; |
| 1104 | int tmp_rf; |
| 1105 | |
| 1106 | if (h_nw != g_nw_val || g_nw_val == -1) |
| 1107 | { |
r.xiao | d9dd06e | 2024-02-02 04:17:52 -0800 | [diff] [blame] | 1108 | LOGE("handle NULL"); |
r.xiao | e73f870 | 2024-01-06 01:40:03 -0800 | [diff] [blame] | 1109 | return -1; |
| 1110 | } |
| 1111 | |
| 1112 | if(lynq_nw_info_handle == NULL) |
| 1113 | { |
r.xiao | d9dd06e | 2024-02-02 04:17:52 -0800 | [diff] [blame] | 1114 | LOGE("lynq_nw_info_handle == NULL."); |
r.xiao | e73f870 | 2024-01-06 01:40:03 -0800 | [diff] [blame] | 1115 | return -1; |
| 1116 | } |
| 1117 | |
r.xiao | cfd7c68 | 2024-01-22 03:59:46 -0800 | [diff] [blame] | 1118 | ret = mbtk_get_modem_fun(lynq_nw_info_handle, &tmp_rf); |
| 1119 | |
| 1120 | //ret = mbtk_radio_state_get(lynq_nw_info_handle, &tmp_rf); |
r.xiao | e73f870 | 2024-01-06 01:40:03 -0800 | [diff] [blame] | 1121 | if (ret != 0) |
| 1122 | { |
| 1123 | LOGE("mbtk_radio_state_get fail."); |
| 1124 | return -1; |
| 1125 | } |
| 1126 | else |
| 1127 | { |
r.xiao | d9dd06e | 2024-02-02 04:17:52 -0800 | [diff] [blame] | 1128 | LOGI("qser_nw_get_rf_mode is success\n"); |
r.xiao | e73f870 | 2024-01-06 01:40:03 -0800 | [diff] [blame] | 1129 | *rf_mode = tmp_rf; |
| 1130 | } |
| 1131 | |
| 1132 | |
| 1133 | return 0; |
| 1134 | } |
| 1135 | |
r.xiao | ba8483c | 2024-04-14 18:53:10 -0700 | [diff] [blame] | 1136 | int qser_nw_set_ims_enable(nw_client_handle_type h_nw, E_QSER_NW_IMS_MODE_TYPE_T ims_mode) |
| 1137 | { |
| 1138 | int ret = 0; |
| 1139 | |
| 1140 | if (h_nw != g_nw_val || g_nw_val == -1) |
| 1141 | { |
| 1142 | LOGE("handle NULL"); |
| 1143 | return -1; |
| 1144 | } |
| 1145 | |
| 1146 | if(lynq_nw_info_handle == NULL) |
| 1147 | { |
| 1148 | LOGE("lynq_nw_info_handle == NULL."); |
| 1149 | return -1; |
| 1150 | } |
| 1151 | |
| 1152 | ret = mbtk_net_ims_set(lynq_nw_info_handle, ims_mode); |
| 1153 | if (ret != 0) |
| 1154 | { |
| 1155 | LOGE("mbtk_net_ims_set fail."); |
| 1156 | return -1; |
| 1157 | } |
| 1158 | |
| 1159 | return 0; |
| 1160 | } |
| 1161 | |
| 1162 | int qser_nw_get_ims_reg_status(nw_client_handle_type h_nw, QSER_NW_IMS_REG_STATUS_INFO_T *pt_info) |
| 1163 | { |
| 1164 | int ret = 0; |
| 1165 | int tmp_pt; |
| 1166 | |
| 1167 | if (h_nw != g_nw_val || g_nw_val == -1) |
| 1168 | { |
| 1169 | LOGE("handle NULL"); |
| 1170 | return -1; |
| 1171 | } |
| 1172 | |
| 1173 | if(lynq_nw_info_handle == NULL) |
| 1174 | { |
| 1175 | LOGE("lynq_nw_info_handle == NULL."); |
| 1176 | return -1; |
| 1177 | } |
| 1178 | |
b.liu | fdf0317 | 2024-06-07 15:01:29 +0800 | [diff] [blame^] | 1179 | ret = mbtk_net_ims_reg_state_get(lynq_nw_info_handle, &tmp_pt); |
r.xiao | ba8483c | 2024-04-14 18:53:10 -0700 | [diff] [blame] | 1180 | if (ret != 0) |
| 1181 | { |
| 1182 | LOGE("mbtk_net_ims_get fail."); |
| 1183 | return -1; |
| 1184 | } |
| 1185 | |
| 1186 | if (tmp_pt == 0) |
| 1187 | pt_info->registration_state = E_QSER_NW_IMS_SERVICE_NONE; |
| 1188 | else if (tmp_pt == 1) |
| 1189 | pt_info->registration_state = E_QSER_NW_IMS_SERVICE_REGISTERED; |
| 1190 | else |
| 1191 | { |
| 1192 | LOGE("mbtk_net_ims_get value error fail."); |
| 1193 | return -1; |
| 1194 | } |
| 1195 | |
| 1196 | return 0; |
| 1197 | } |
| 1198 | |
r.xiao | e73f870 | 2024-01-06 01:40:03 -0800 | [diff] [blame] | 1199 | |