| #include "lynq_qser_network.h" |
| #include "mbtk_type.h" |
| #include "mbtk_info_api.h" |
| |
| #include <stdio.h> |
| #include <stdlib.h> |
| |
| mbtk_info_handle_t* lynq_nw_info_handle = NULL; |
| uint64_t tmp_mode = 0xFF; |
| |
| nw_client_handle_type g_nw_val = -1; |
| |
| |
| typedef struct |
| { |
| QSER_NW_RxMsgHandlerFunc_t handlerPtr; |
| void* contextPtr; |
| } lynq_cust_cb_func; |
| |
| static lynq_cust_cb_func lynq_func_cb_handle; |
| |
| static int roaming_pref = 1; // Open roaming for default. |
| |
| typedef enum { |
| RADIO_TECH_3GPP = 1, /* 3GPP Technologies - GSM, WCDMA */ |
| RADIO_TECH_3GPP2 = 2 /* 3GPP2 Technologies - CDMA */ |
| } RIL_RadioTechnologyFamily; |
| |
| |
| typedef struct |
| { |
| uint8 *lynq_operator_l; |
| uint8 *lynq_operator_s; |
| uint32 lynq_mcc_mnc; |
| } lynq_operator_mcc_mnc_t; |
| |
| static lynq_operator_mcc_mnc_t lynq_operator_mcc_mnc[] = |
| { |
| {"China Mobile","CMCC",46000}, |
| {"China Unicom","CU",46001}, |
| {"China Mobile","CMCC",46002}, |
| {"China Telecom","CT",46003}, |
| {"China Mobile","CMCC",46004}, |
| {"China Telecom","CT",46005}, |
| {"China Unicom","CU",46006}, |
| {"China Mobile","CMCC",46007}, |
| {"China Mobile","CMCC",46008}, |
| {"China Unicom","CU",46009}, |
| {"China Telecom","CT",46011} |
| }; |
| |
| void lynq_nw_state_change_cb(const void* data, int data_len) |
| { |
| uint8 *net_data = NULL; |
| |
| net_data = (uint8*)data; |
| log_hex(">>>data",data,data_len); |
| |
| if (net_data == NULL) |
| { |
| LOG(">>>NO DATA"); |
| } |
| else |
| { |
| LOG(">>>net_data =[%0x]\n",*net_data[2]); |
| } |
| |
| /* |
| uint8 data[3]; |
| data[0] = (uint8)MBTK_NET_CS_STATE; |
| |
| net_data[0] = *(uint8 *)(data); //MBTK_NET_PS_STATE |
| net_data[1] = *(uint8 *)(data + sizeof(uint8)); //mbtk_net_reg_state_enum state Reg State |
| net_data[2] = *(uint8 *)(data + sizeof(uint8) + sizeof(uint8)); //act |
| */ |
| |
| if(roaming_pref == 0) |
| { |
| mbtk_modem_info_t info; |
| if(*net_data == 5) |
| { |
| info.fun=4; |
| } |
| else |
| info.fun=1; |
| info.rst=0; |
| mbtk_set_modem_fun(lynq_nw_info_handle, &info); |
| } |
| |
| if(lynq_func_cb_handle.handlerPtr != NULL) |
| { |
| //lynq_func_cb_handle.handlerPtr(g_nw_val, NW_IND_VOICE_REG_EVENT_IND_FLAG,&(net_data[2]), sizeof(&(net_data[2])), NULL); |
| lynq_func_cb_handle.handlerPtr(g_nw_val, NW_IND_DATA_REG_EVENT_IND_FLAG,&(net_data[2]), sizeof(&(net_data[2])), NULL); |
| //lynq_func_cb_handle.handlerPtr(g_nw_val, NW_IND_SIGNAL_STRENGTH_EVENT_IND_FLAG,&(net_data[2]), sizeof(&(net_data[2])), NULL); |
| } |
| } |
| |
| |
| static uint8 lynq_net_pre_change(bool mbtk_2_lynq,int net_mode) |
| { |
| uint8 mbtk_net_pre = 0xFF; |
| |
| #if 0 |
| 此参数表在别处使用 |
| E_QSER_NW_RADIO_TECH_TD_SCDMA = 1, Y3 1 |
| E_QSER_NW_RADIO_TECH_GSM = 2, /**< GSM; only supports voice. */ YL2 0 |
| E_QSER_NW_RADIO_TECH_HSPAP = 3, /**< HSPA+. */ 3 1 |
| E_QSER_NW_RADIO_TECH_LTE = 4, /**< LTE. */ 4 5 |
| E_QSER_NW_RADIO_TECH_EHRPD = 5, /**< EHRPD. */ 3 1 |
| E_QSER_NW_RADIO_TECH_EVDO_B = 6, /**< EVDO B. */ D3 1 |
| E_QSER_NW_RADIO_TECH_HSPA = 7, /**< HSPA. */ 3 1 |
| E_QSER_NW_RADIO_TECH_HSUPA = 8, /**< HSUPA. */ 3.5 1 |
| E_QSER_NW_RADIO_TECH_HSDPA = 9, /**< HSDPA. */ 3.5 1 |
| E_QSER_NW_RADIO_TECH_EVDO_A = 10, /**< EVDO A. */ D3 1 |
| E_QSER_NW_RADIO_TECH_EVDO_0 = 11, /**< EVDO 0. */ D3 1 |
| E_QSER_NW_RADIO_TECH_1xRTT = 12, /**< 1xRTT. */ 2 0 |
| E_QSER_NW_RADIO_TECH_IS95B = 13, /**< IS95B. */ 3 0 |
| E_QSER_NW_RADIO_TECH_IS95A = 14, /**< IS95A. */ 3 0 |
| E_QSER_NW_RADIO_TECH_UMTS = 15, /**< UMTS. */ L3 1 |
| E_QSER_NW_RADIO_TECH_EDGE = 16, /**< EDGE. */ 2.75 0 |
| E_QSER_NW_RADIO_TECH_GPRS = 17, /**< GPRS. */ 2.5 0 |
| E_QSER_NW_RADIO_TECH_NONE = 18 /**< No technology selected. */ |
| #endif |
| /* |
| 0 : GSM only |
| 1 : UMTS only |
| 2 : GSM/UMTS(auto) |
| 3 : GSM/UMTS(GSM preferred) |
| 4 : GSM/UMTS(UMTS preferred) |
| 5 : LTE only |
| 6 : GSM/LTE(auto) |
| 7 : GSM/LTE(GSM preferred) |
| 8 : GSM/LTE(LTE preferred) |
| 9 : UMTS/LTE(auto) |
| 10 : UMTS/LTE(UMTS preferred) |
| 11 : UMTS/LTE(LTE preferred) |
| 12 : GSM/UMTS/LTE(auto) |
| 13 : GSM/UMTS/LTE(GSM preferred) |
| 14 : GSM/UMTS/LTE(UMTS preferred) |
| 15 : GSM/UMTS/LTE(LTE preferred) |
| */ |
| |
| if(mbtk_2_lynq) { |
| switch(net_mode) |
| { |
| //使用之前set的tmp_mode的值来进行回显get |
| case QSER_NW_MODE_GSM: |
| mbtk_net_pre = QSER_NW_MODE_GSM; |
| break; |
| case QSER_NW_MODE_WCDMA: |
| mbtk_net_pre = QSER_NW_MODE_WCDMA; |
| break; |
| case QSER_NW_MODE_CDMA: |
| mbtk_net_pre = QSER_NW_MODE_CDMA; |
| break; |
| case QSER_NW_MODE_EVDO: |
| mbtk_net_pre = QSER_NW_MODE_EVDO; |
| break; |
| case QSER_NW_MODE_LTE: |
| mbtk_net_pre = QSER_NW_MODE_LTE; |
| break; |
| case QSER_NW_MODE_TDSCDMA: |
| mbtk_net_pre = QSER_NW_MODE_TDSCDMA; |
| break; |
| default: |
| mbtk_net_pre = 0xFF; |
| break; |
| } |
| } else { |
| switch(net_mode) |
| { |
| //只做234G的only下配 MBTK_NET_PREF_GSM_ONLY/MBTK_NET_PREF_UMTS_ONLY/MBTK_NET_PREF_LTE_ONLY |
| case QSER_NW_MODE_GSM: |
| mbtk_net_pre = MBTK_NET_PREF_GSM_ONLY; |
| break; |
| case QSER_NW_MODE_WCDMA: |
| mbtk_net_pre = MBTK_NET_PREF_GSM_UMTS_UMTS_PREF; |
| break; |
| case QSER_NW_MODE_CDMA: |
| mbtk_net_pre = MBTK_NET_PREF_GSM_UMTS_UMTS_PREF; |
| break; |
| case QSER_NW_MODE_EVDO: |
| mbtk_net_pre = MBTK_NET_PREF_GSM_UMTS_UMTS_PREF; |
| break; |
| case QSER_NW_MODE_LTE: |
| mbtk_net_pre = MBTK_NET_PREF_GSM_UMTS_LTE_LTE_PREF; |
| break; |
| case QSER_NW_MODE_TDSCDMA: |
| mbtk_net_pre = MBTK_NET_PREF_GSM_UMTS_UMTS_PREF; |
| break; |
| default: |
| mbtk_net_pre = 0xFF; |
| break; |
| } |
| } |
| return mbtk_net_pre; |
| } |
| |
| int qser_nw_client_init(nw_client_handle_type *ph_nw) |
| { |
| //UNUSED(ph_nw); |
| |
| if(lynq_nw_info_handle == NULL) |
| { |
| lynq_nw_info_handle = mbtk_info_handle_get(); |
| if(lynq_nw_info_handle) |
| { |
| printf("creat lynq_nw_info_handle is success\n"); |
| *ph_nw = lynq_nw_info_handle->client_fd; |
| g_nw_val = lynq_nw_info_handle->client_fd; |
| } |
| else |
| { |
| printf("creat lynq_nw_info_handle is fail\n"); |
| return -1; |
| } |
| } |
| |
| return 0; |
| } |
| |
| int qser_nw_client_deinit(nw_client_handle_type h_nw) |
| { |
| //UNUSED(h_nw); |
| if (h_nw != g_nw_val || g_nw_val == -1) |
| { |
| printf("handle NULL\n"); |
| return -1; |
| } |
| |
| if(lynq_nw_info_handle) |
| { |
| mbtk_info_handle_free(&lynq_nw_info_handle); |
| } |
| else |
| { |
| printf("deinit lynq_nw_info_handle is fail\n"); |
| return -1; |
| } |
| |
| return 0; |
| } |
| |
| int qser_nw_set_config(nw_client_handle_type h_nw,QSER_NW_CONFIG_INFO_T *pt_info) |
| { |
| //UNUSED(h_nw); |
| //UNUSED(pt_info); |
| if (h_nw != g_nw_val || g_nw_val == -1) |
| { |
| printf("handle NULL\n"); |
| return -1; |
| } |
| |
| if(lynq_nw_info_handle == NULL) |
| { |
| printf("lynq_nw_info_handle == NULL.\n"); |
| return -1; |
| } |
| |
| if(pt_info == NULL) |
| { |
| printf("pt_info == NULL.\n"); |
| return -1; |
| } |
| |
| roaming_pref = pt_info->roaming_pref; |
| |
| mbtk_band_info_t band; |
| memset(&band, 0, sizeof(mbtk_band_info_t)); |
| tmp_mode = pt_info->preferred_nw_mode;//临时保存一下原本的mode |
| |
| //printf("tmp_mode = [%llu]",tmp_mode); |
| band.net_pref = lynq_net_pre_change(FALSE, pt_info->preferred_nw_mode); |
| printf("band.net_pref = [%d]\n",band.net_pref); |
| |
| if(band.net_pref == 0xFF) |
| { |
| LOGE("lynq_net_pre_change() fail."); |
| return -1; |
| } |
| |
| if(mbtk_current_band_set(lynq_nw_info_handle, &band)) |
| { |
| return -1; |
| } |
| |
| return 0; |
| } |
| |
| int qser_nw_get_operator_name(nw_client_handle_type h_nw, QSER_NW_OPERATOR_NAME_INFO_T *pt_info) |
| { |
| //UNUSED(h_nw); |
| //UNUSED(pt_info); |
| if (h_nw != g_nw_val || g_nw_val == -1) |
| { |
| printf("handle NULL\n"); |
| return -1; |
| } |
| |
| if(lynq_nw_info_handle == NULL) |
| { |
| printf("lynq_nw_info_handle == NULL.\n"); |
| return -1; |
| } |
| |
| if(pt_info == NULL) |
| { |
| printf("pt_info == NULL.\n"); |
| return -1; |
| } |
| |
| char OperatorFN[128]; |
| char OperatorSH[128]; |
| char MccMnc[128]; |
| mbtk_net_info_t net; |
| if(!mbtk_net_sel_mode_get(lynq_nw_info_handle, &net) && net.plmn > 0) |
| { |
| // printf("Net : %d, %d, %d\n", net.net_sel_mode, net.net_type, net.plmn); |
| int i = 0; |
| while(i < ARRAY_SIZE(lynq_operator_mcc_mnc)) |
| { |
| if(lynq_operator_mcc_mnc[i].lynq_mcc_mnc == net.plmn) |
| break; |
| i++; |
| } |
| |
| if(i == ARRAY_SIZE(lynq_operator_mcc_mnc)) // No found mcc&mnc |
| { |
| strcpy(OperatorFN, "UNKNOWN"); |
| strcpy(OperatorSH, "UNKNOWN"); |
| sprintf(MccMnc, "%d", net.plmn); |
| } |
| else |
| { |
| strcpy(OperatorFN, lynq_operator_mcc_mnc[i].lynq_operator_l); |
| strcpy(OperatorSH, lynq_operator_mcc_mnc[i].lynq_operator_s); |
| sprintf(MccMnc, "%d", lynq_operator_mcc_mnc[i].lynq_mcc_mnc); |
| } |
| memset(pt_info->long_eons,0,128); |
| memcpy(pt_info->long_eons,lynq_operator_mcc_mnc[i].lynq_operator_l,strlen(lynq_operator_mcc_mnc[i].lynq_operator_l)); |
| memset(pt_info->short_eons,0,128); |
| memcpy(pt_info->short_eons,lynq_operator_mcc_mnc[i].lynq_operator_s,strlen(lynq_operator_mcc_mnc[i].lynq_operator_s)); |
| memset(pt_info->mcc,0,4); |
| memset(pt_info->mnc,0,4); |
| sprintf(pt_info->mcc, "%d", (lynq_operator_mcc_mnc[i].lynq_mcc_mnc)/100); |
| sprintf(pt_info->mnc, "%d", (lynq_operator_mcc_mnc[i].lynq_mcc_mnc)%100); |
| //pt_info->act; |
| return 0; |
| } |
| |
| return -1; |
| } |
| |
| int qser_nw_get_reg_status(nw_client_handle_type h_nw, QSER_NW_REG_STATUS_INFO_T *pt_info) |
| { |
| //UNUSED(h_nw); |
| //UNUSED(pt_info); |
| if (h_nw != g_nw_val || g_nw_val == -1) |
| { |
| printf("handle NULL\n"); |
| return -1; |
| } |
| |
| if(lynq_nw_info_handle == NULL) |
| { |
| printf("lynq_nw_info_handle == NULL.\n"); |
| return -1; |
| } |
| |
| if(pt_info == NULL) |
| { |
| printf("pt_info == NULL.\n"); |
| return -1; |
| } |
| |
| /*VOICE/DATA/IMS*/ |
| mbtk_net_reg_info_t reg; |
| int err = mbtk_net_reg_get(lynq_nw_info_handle, ®); |
| if(err) |
| { |
| LOGE("mbtk_net_reg_get fail."); |
| return -1; |
| } |
| else |
| { |
| memset(pt_info, 0x0, sizeof(QSER_NW_REG_STATUS_INFO_T)); |
| |
| |
| char OperatorFN[128]; |
| char OperatorSH[128]; |
| char MccMnc[128]; |
| mbtk_net_info_t net; |
| if(!mbtk_net_sel_mode_get(lynq_nw_info_handle, &net) && net.plmn > 0) |
| { |
| // printf("Net : %d, %d, %d\n", net.net_sel_mode, net.net_type, net.plmn); |
| int i = 0; |
| while(i < ARRAY_SIZE(lynq_operator_mcc_mnc)) |
| { |
| if(lynq_operator_mcc_mnc[i].lynq_mcc_mnc == net.plmn) |
| break; |
| i++; |
| } |
| |
| if(i == ARRAY_SIZE(lynq_operator_mcc_mnc)) // No found mcc&mnc |
| { |
| strcpy(OperatorFN, "UNKNOWN"); |
| strcpy(OperatorSH, "UNKNOWN"); |
| sprintf(MccMnc, "%d", net.plmn); |
| } |
| else |
| { |
| sprintf(MccMnc, "%d", lynq_operator_mcc_mnc[i].lynq_mcc_mnc); |
| } |
| sprintf(pt_info->data_registration_details_3gpp.mcc, "%d", (lynq_operator_mcc_mnc[i].lynq_mcc_mnc)/100); |
| sprintf(pt_info->data_registration_details_3gpp.mnc, "%d", (lynq_operator_mcc_mnc[i].lynq_mcc_mnc)%100); |
| sprintf(pt_info->voice_registration_details_3gpp.mcc, "%d", (lynq_operator_mcc_mnc[i].lynq_mcc_mnc)/100); |
| sprintf(pt_info->voice_registration_details_3gpp.mnc, "%d", (lynq_operator_mcc_mnc[i].lynq_mcc_mnc)%100); |
| //pt_info->act; |
| } |
| |
| //暂时未知是否其他也被使用,现根据ql模块的传输情况, |
| //只配置3gpp,涉及call,data状态没有对应的匹配的就没有赋值 |
| |
| pt_info->voice_registration_valid = FALSE; |
| //pt_info->voice_registration |
| |
| pt_info->data_registration_valid = FALSE; |
| //pt_info->data_registration |
| |
| pt_info->voice_registration_details_3gpp_valid = TRUE; |
| pt_info->voice_registration_details_3gpp.lac = reg.lac; |
| pt_info->voice_registration_details_3gpp.cid = reg.ci; |
| //补位填0 or 1 |
| pt_info->voice_registration_details_3gpp.tech_domain = 1; |
| pt_info->voice_registration_details_3gpp.roaming = 0; |
| pt_info->voice_registration_details_3gpp.forbidden = 0; |
| pt_info->voice_registration_details_3gpp.psc = 0; |
| pt_info->voice_registration_details_3gpp.tac = 0; |
| |
| pt_info->data_registration_details_3gpp_valid = TRUE; |
| pt_info->data_registration_details_3gpp.lac = reg.lac; |
| pt_info->data_registration_details_3gpp.cid = reg.ci; |
| //补位填0 or 1 |
| pt_info->data_registration_details_3gpp.tech_domain = 1; |
| pt_info->data_registration_details_3gpp.roaming = 0; |
| pt_info->data_registration_details_3gpp.forbidden = 0; |
| pt_info->data_registration_details_3gpp.psc = 0; |
| pt_info->data_registration_details_3gpp.tac = 0; |
| |
| |
| pt_info->voice_registration_details_3gpp2_valid = FALSE; |
| //pt_info->voice_registration_details_3gpp2 |
| |
| pt_info->data_registration_details_3gpp2_valid = FALSE; |
| //pt_info->data_registration_details_3gpp2 |
| |
| |
| switch(reg.type) |
| { |
| case MBTK_RADIO_TECH_GSM: |
| case MBTK_RADIO_TECH_GSM_COMPACT: |
| case MBTK_RADIO_TECH_GSM_EGPRS: |
| case MBTK_RADIO_TECH_UTRAN_HSPA: |
| { |
| pt_info->data_registration_details_3gpp.radio_tech = E_QSER_NW_RADIO_TECH_GPRS; |
| pt_info->voice_registration_details_3gpp.radio_tech = E_QSER_NW_RADIO_TECH_GSM; |
| break; |
| } |
| case MBTK_RADIO_TECH_UTRAN: |
| case MBTK_RADIO_TECH_UTRAN_HSDPA: |
| case MBTK_RADIO_TECH_UTRAN_HSUPA: |
| case MBTK_RADIO_TECH_UTRAN_HSDPA_HSUPA: |
| { |
| pt_info->data_registration_details_3gpp.radio_tech = E_QSER_NW_RADIO_TECH_UMTS; |
| pt_info->voice_registration_details_3gpp.radio_tech = E_QSER_NW_RADIO_TECH_UMTS; |
| break; |
| } |
| case MBTK_RADIO_TECH_E_UTRAN: |
| { |
| pt_info->data_registration_details_3gpp.radio_tech = E_QSER_NW_RADIO_TECH_LTE; |
| pt_info->voice_registration_details_3gpp.radio_tech = E_QSER_NW_RADIO_TECH_LTE; |
| break; |
| } |
| default: |
| { |
| pt_info->data_registration_details_3gpp.radio_tech = E_QSER_NW_RADIO_TECH_NONE; |
| pt_info->voice_registration_details_3gpp.radio_tech = E_QSER_NW_RADIO_TECH_NONE; |
| break; |
| } |
| } |
| } |
| |
| return 0; |
| } |
| |
| int qser_nw_get_signal_strength(nw_client_handle_type h_nw,QSER_NW_SIGNAL_STRENGTH_INFO_T *pt_info) |
| { |
| //UNUSED(h_nw); |
| //UNUSED(pt_info); |
| if (h_nw != g_nw_val || g_nw_val == -1) |
| { |
| printf("handle NULL\n"); |
| return -1; |
| } |
| |
| if(lynq_nw_info_handle == NULL) |
| { |
| printf("lynq_nw_info_handle == NULL.\n"); |
| return -1; |
| } |
| |
| if(pt_info == NULL) |
| { |
| printf("pt_info == NULL.\n"); |
| return -1; |
| } |
| |
| int ret; |
| mbtk_signal_info_t signal; |
| ret = mbtk_net_signal_get(lynq_nw_info_handle, &signal); |
| if(ret != 0) { |
| LOGE("mbtk_net_signal_get fail."); |
| return -1; |
| } |
| else |
| { |
| memset(pt_info, 0x0, sizeof(QSER_NW_SIGNAL_STRENGTH_INFO_T)); |
| if(signal.type == MBTK_RADIO_TECH_GSM || signal.type == MBTK_RADIO_TECH_GSM_COMPACT || \ |
| signal.type == MBTK_RADIO_TECH_GSM_EGPRS) //GSM |
| { |
| pt_info->gsm_sig_info_valid = TRUE; |
| pt_info->gsm_sig_info.rssi = signal.rssi; |
| } |
| else if(signal.type == MBTK_RADIO_TECH_E_UTRAN) //LTE |
| { |
| pt_info->lte_sig_info_valid = TRUE; |
| pt_info->lte_sig_info.rsrp = signal.rsrp; |
| pt_info->lte_sig_info.rsrq = signal.rsrq; |
| pt_info->lte_sig_info.snr = 0; //->MBTK接口无该参数,写死值为0 |
| pt_info->lte_sig_info.rssi = signal.rssi; |
| } |
| else if (signal.type == MBTK_RADIO_TECH_UTRAN || signal.type == MBTK_RADIO_TECH_UTRAN_HSDPA || \ |
| signal.type == MBTK_RADIO_TECH_UTRAN_HSUPA || signal.type == MBTK_RADIO_TECH_UTRAN_HSDPA_HSUPA || \ |
| signal.type == MBTK_RADIO_TECH_UTRAN_HSPA )//WCDMA |
| { |
| pt_info->wcdma_sig_info_valid = TRUE; |
| pt_info->wcdma_sig_info.rssi = signal.rssi; |
| pt_info->wcdma_sig_info.ecio = 0; //->MBTK接口无该参数,写死值为0 |
| } |
| else |
| { |
| return -1; |
| } |
| } |
| |
| return 0; |
| } |
| |
| int qser_nw_add_rx_msg_handler (nw_client_handle_type h_nw, QSER_NW_RxMsgHandlerFunc_t handlerPtr, void* contextPtr) |
| { |
| //UNUSED(h_nw); |
| //UNUSED(handlerPtr); |
| //UNUSED(contextPtr); |
| |
| if (h_nw != g_nw_val || g_nw_val == -1) |
| { |
| printf("handle NULL\n"); |
| return -1; |
| } |
| |
| if(lynq_nw_info_handle == NULL) |
| { |
| printf("lynq_nw_info_handle == NULL.\n"); |
| return -1; |
| } |
| |
| lynq_func_cb_handle.handlerPtr = handlerPtr; |
| lynq_func_cb_handle.contextPtr = contextPtr; |
| |
| mbtk_net_state_change_cb_reg(lynq_nw_info_handle, lynq_nw_state_change_cb); |
| |
| return 0; |
| } |
| |
| int qser_nw_set_oos_config (nw_client_handle_type h_nw, QSER_NW_OOS_CONFIG_INFO_T *pt_info) |
| { |
| UNUSED(h_nw); |
| UNUSED(pt_info); |
| |
| return 0; |
| } |
| |
| int qser_nw_get_oos_config (nw_client_handle_type h_nw, QSER_NW_OOS_CONFIG_INFO_T *pt_info) |
| { |
| UNUSED(h_nw); |
| UNUSED(pt_info); |
| |
| return 0; |
| } |
| |
| int qser_nw_set_rf_mode (nw_client_handle_type h_nw, E_QSER_NW_RF_MODE_TYPE_T rf_mode) |
| { |
| //UNUSED(h_nw); |
| //UNUSED(rf_mode); |
| int ret; |
| |
| if (h_nw != g_nw_val || g_nw_val == -1) |
| { |
| printf("handle NULL\n"); |
| return -1; |
| } |
| |
| if(lynq_nw_info_handle == NULL) |
| { |
| printf("lynq_nw_info_handle == NULL.\n"); |
| return -1; |
| } |
| |
| if (rf_mode == 4) |
| { |
| printf("Flight Mode no Support Now\n"); |
| return -1; |
| } |
| |
| ret = mbtk_radio_state_set(lynq_nw_info_handle, rf_mode); |
| if (ret != 0) |
| { |
| LOGE("mbtk_radio_state_set fail."); |
| return -1; |
| } |
| else |
| { |
| printf("qser_nw_set_rf_mode is success\n"); |
| } |
| |
| return 0; |
| } |
| |
| int qser_nw_get_rf_mode (nw_client_handle_type h_nw, E_QSER_NW_RF_MODE_TYPE_T *rf_mode) |
| { |
| //UNUSED(h_nw); |
| //UNUSED(rf_mode); |
| int ret; |
| int tmp_rf; |
| |
| if (h_nw != g_nw_val || g_nw_val == -1) |
| { |
| printf("handle NULL\n"); |
| return -1; |
| } |
| |
| if(lynq_nw_info_handle == NULL) |
| { |
| printf("lynq_nw_info_handle == NULL.\n"); |
| return -1; |
| } |
| |
| ret = mbtk_radio_state_get(lynq_nw_info_handle, &tmp_rf); |
| if (ret != 0) |
| { |
| LOGE("mbtk_radio_state_get fail."); |
| return -1; |
| } |
| else |
| { |
| printf("qser_nw_get_rf_mode is success\n"); |
| *rf_mode = tmp_rf; |
| } |
| |
| |
| return 0; |
| } |
| |
| |