liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame^] | 1 | /* |
| 2 | * |
| 3 | * Data : 2022/10/21 16:00:28 |
| 4 | * Author : LiuBin |
| 5 | */ |
| 6 | #ifndef _LYNQ_NET_API_H |
| 7 | #define _LYNQ_NET_API_H |
| 8 | #include "mbtk_info_api.h" |
| 9 | |
| 10 | typedef enum { |
| 11 | RADIO_TECH_3GPP = 1, /* 3GPP Technologies - GSM, WCDMA */ |
| 12 | RADIO_TECH_3GPP2 = 2 /* 3GPP2 Technologies - CDMA */ |
| 13 | } RIL_RadioTechnologyFamily; |
| 14 | |
| 15 | typedef struct |
| 16 | { |
| 17 | int rssi; // 0: 113 dBm or less |
| 18 | // 1: 111 dBm |
| 19 | // 2...30: 109 dBm...53 dBm |
| 20 | // 31: 51 dBm or greater |
| 21 | // 99: not known or not detectable |
| 22 | int ber; // 0...7 as RXQUAL values in the table in 3GPP TS 45.008 [20] subclause 8.2.4 |
| 23 | // 99 not known or not detectable |
| 24 | int gsm_sig_valid; |
| 25 | int rxlev;// 0:rssi < -110 dBm |
| 26 | // 1: -110 dBm <= rssi < -109 dBm |
| 27 | // 2: -109 dBm <= rssi < -108 dBm |
| 28 | // ...... |
| 29 | // 61: -50 dBm <= rssi < -49 dBm |
| 30 | // 62: -49 dBm <= rssi < -48 dBm |
| 31 | // 63: -48 dBm <= rssi |
| 32 | // 99: not known or not detectable |
| 33 | int umts_sig_valid; |
| 34 | int rscp; // 0: rscp < -120 dBm |
| 35 | // 1: -120 dBm <= rscp < -119 dBm |
| 36 | // 2: -119 dBm <= rscp < -118 dBm |
| 37 | // ...... |
| 38 | // 94: -27 dBm <= rscp < -26 dBm |
| 39 | // 95: -26 dBm <= rscp < -25 dBm |
| 40 | // 96: - 25 dBm <= rscp |
| 41 | // 255: not known or not detectable |
| 42 | int ecno; // 0: Ec/Io < -24 dB |
| 43 | // 1: -24 dB <= Ec/Io < -23.5 dB |
| 44 | // 2: -23.5 dB <= Ec/Io < -23 dB |
| 45 | // ...... |
| 46 | // 47: -1 dB <= Ec/Io < -0.5 dB |
| 47 | // 48: -0.5 dB <= Ec/Io < 0 dB |
| 48 | // 49: 0 dB <= Ec/Io |
| 49 | // 255: not known or not detectable |
| 50 | int lte_sig_valid; |
| 51 | int rsrq; // 0: rsrq < -19.5 dB |
| 52 | // 1: -19.5 dB <= rsrq < -19 dB |
| 53 | // 2: -19 dB <= rsrq < -18.5 dB |
| 54 | // ...... |
| 55 | // 32: -4 dB <= rsrq < -3.5 dB |
| 56 | // 33: -3.5 dB <= rsrq < -3 dB |
| 57 | // 34: -3 dB <= rsrq |
| 58 | // 255: not known or not detectable |
| 59 | int rsrp; // 0: rsrp < -140 dBm |
| 60 | // 1: -140 dBm <= rsrp < -139 dBm |
| 61 | // 2: -139 dBm <= rsrp < -138 dBm |
| 62 | // ...... |
| 63 | // 95: -46 dBm <= rsrp < -45 dBm |
| 64 | // 96: -45 dBm <= rsrp < -44 dBm |
| 65 | // 97: -44 dBm <= rsrp |
| 66 | // 255: not known or not detectable |
| 67 | } signalStrength_t; |
| 68 | |
| 69 | typedef enum { |
| 70 | ZONE_NUM_SOC = 0, |
| 71 | ZONE_NUM_RF |
| 72 | } ZONE_NUM; |
| 73 | |
| 74 | int lynq_network_init(int uToken); |
| 75 | |
| 76 | int lynq_network_deinit(void); |
| 77 | |
| 78 | int lynq_get_version(char buf[]); |
| 79 | |
| 80 | int lynq_get_imei(char buf[]); |
| 81 | |
| 82 | int lynq_get_sn(char buf[]); |
| 83 | |
| 84 | int lynq_shutdown(char options[]); |
| 85 | |
| 86 | int lynq_time_set(mbtk_time_type_enum time_type, char* time_str); |
| 87 | |
| 88 | int lynq_get_zone_tmp(ZONE_NUM num, int *temp); |
| 89 | |
| 90 | int lynq_get_sim_status(int *card_status); |
| 91 | |
| 92 | int lynq_get_imsi(char buf[]); |
| 93 | |
| 94 | int lynq_get_iccid(char buf[]); |
| 95 | |
| 96 | int lynq_query_phone_number(char buf[]); |
| 97 | |
| 98 | int lynq_sim_power (int mode); |
| 99 | |
| 100 | int lynq_query_operater(char *OperatorFN,char *OperatorSH,char *MccMnc); |
| 101 | |
| 102 | int lynq_query_network_selection_mode (int *netselMode); |
| 103 | |
| 104 | int lynq_set_network_selection_mode(const char *mode, const char* mccmnc); |
| 105 | |
| 106 | int lynq_query_available_network(list_node_t** net_list); |
| 107 | |
| 108 | int lynq_query_registration_state(const char *type, int* regState,int *imsRegState,char * LAC,char *CID,int *netType,int * radioTechFam,int *netRejected); |
| 109 | |
| 110 | int lynq_query_prefferred_networktype (int *preNetType); |
| 111 | |
| 112 | int lynq_set_prefferred_networktype (const int preNetType); |
| 113 | |
| 114 | int lynq_set_band_mode(int gsm_band, int umts_band, int tdlte_band, int fddlte_band); |
| 115 | |
| 116 | int lynq_query_available_bandmode (int *gsm_band, int *umts_band, int *tdlte_band, int *fddlte_band); |
| 117 | |
| 118 | int lynq_radio_on (const int data); |
| 119 | |
| 120 | int lynq_query_radio_tech (int* radioTech); |
| 121 | |
| 122 | int lynq_solicited_signal_strength (signalStrength_t *solSigStren); |
| 123 | |
| 124 | int lynq_set_ims (const int ims_mode); |
| 125 | |
| 126 | int lynq_init_cell(void); |
| 127 | |
| 128 | int lynq_deinit_cell(void); |
| 129 | |
| 130 | int lynq_query_cell_info(int *type, list_node_t **cell_list); |
| 131 | |
| 132 | void lynq_set_cell_info(char *mem); |
| 133 | |
| 134 | /* |
| 135 | * Set specific APN informations. |
| 136 | * |
| 137 | * cid : 2-7 |
| 138 | */ |
| 139 | int lynq_apn_set(int cid, mbtk_ip_type_enum ip_type, const void* apn_name, |
| 140 | const void *user_name, const void *user_pass, const void *auth); |
| 141 | |
| 142 | /* |
| 143 | * Get current all APN informations. |
| 144 | */ |
| 145 | int lynq_apn_get(int *apn_num, mbtk_apn_info_t apns[]); |
| 146 | |
| 147 | /* |
| 148 | * Start data call. |
| 149 | */ |
| 150 | int lynq_data_call_start(int cid, int timeout); |
| 151 | |
| 152 | /* |
| 153 | * Stop data call. |
| 154 | */ |
| 155 | int lynq_data_call_stop(int cid, int timeout); |
| 156 | |
| 157 | /* |
| 158 | * Query data call state. |
| 159 | */ |
| 160 | int lynq_data_call_query(int cid, mbtk_ipv4_info_t *ipv4, mbtk_ipv6_info_t *ipv6); |
| 161 | |
| 162 | /* |
| 163 | *Get native ip and free port |
| 164 | */ |
| 165 | int lynq_get_ip_and_port(char *ipBuf_out,int *port,int iptype); |
| 166 | |
| 167 | #endif /* _LYNQ_NET_API_H */ |