blob: a549035c707447357ac3234687cf010b51c237b9 [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001#ifndef __ZTE_VSIM_API_H_
2#define __ZTE_VSIM_API_H_
3#include <stdio.h>
4#include <stdlib.h>
5#include <stdint.h>
6#include <sys/socket.h>
7//********2023-01-13***********//
8
9#define SIM_IMSI_LEN_MAX 16 /** Maximum length of IMSI data. */
10#define SIM_ICCID_LEN_MAX 21 /** Maximum length of ICCID data. */
11#define DATA_MAX_APN_LEN 57 /** Maximum length of the APN. */
12#define DATA_MAX_USERNAME_LEN 127 /** Maximum length of the profile user name. */
13#define DATA_MAX_PASSWORD_LEN 127 /** Maximum length of the profile password. */
14#define DATA_INTERFACE_NAME_LEN 16 /** Interface name length. */
15#define DATA_MAX_ADDR_COUNT 2 /** Maximum number of IP addresses. */
16
17//**************GHT VSIM Struct*********************//
18
19typedef enum {
20 E_SIM_TYPE_USIM, //ʵÌ忨
21 E_SIM_TYPE_VSIM, //ÔÆ¿¨
22 E_SIM_TYPE_SSIM, //Soft SIM
23}SimTypeInSlot_t;
24
25
26typedef enum {
27 E_NW_RADIO_IF_NO_SRV = 0,
28 E_NW_RADIO_IF_GSM = 1,
29 E_NW_RADIO_IF_WCDMA = 2,
30 E_NW_RADIO_IF_LTE = 3,
31 E_NW_RADIO_IF_TDSCDMA = 4,
32 E_NW_RADIO_IF_CDMA = 5,
33 E_NW_RADIO_IF_CDMA2000 = 6,
34}e_nw_rat_type_t; //RAT value
35
36
37typedef enum {
38 E_NW_STATUS_SRV_NONE = 0,
xf.li742dd022023-06-08 01:43:32 -070039 E_NW_STATUS_SRV_LIMITED = 1,
40 E_NW_STATUS_SRV_AVAILABLE = 2,
lh9ed821d2023-04-07 01:36:19 -070041}e_nw_srv_status_t;
42
43
44typedef struct
45{
46 uint32_t tac;
47 uint32_t cell_id;
xf.li742dd022023-06-08 01:43:32 -070048 uint32_t roamingFlag; ///< 1:roaming,0:non roaming
lh9ed821d2023-04-07 01:36:19 -070049}lte_scell_info_t;
50
51typedef struct
52{
53 uint32_t lac;
54 uint32_t cell_id;
55}gsm_w_scell_info_t;
56
57
58
59typedef struct
60{
61 e_nw_rat_type_t curr_rat;
62 e_nw_srv_status_t nStatus;
63 lte_scell_info_t lte_scell_info; //¸³Öµ¿ÉÑ¡£¬Óû§¸ù¾ÝratÖ¸Ê¾ÍøÂçÀàÐÍȡֵ
64 gsm_w_scell_info_t gsm_w_scell_info; //¸³Öµ¿ÉÑ¡£¬Óû§¸ù¾ÝratÖ¸Ê¾ÍøÂçÀàÐÍȡֵ
65}RegInfo_t;
66
67typedef struct{
68 uint16_t mcc;
69 uint16_t mnc;
70 uint32_t tac;
71 uint32_t cell_id;
72 uint16_t bandwidth;
xf.li742dd022023-06-08 01:43:32 -070073 uint16_t pcid;//int16_t rxlev;
lh9ed821d2023-04-07 01:36:19 -070074 uint32_t arfcn;
lh9ed821d2023-04-07 01:36:19 -070075}base_cell_info_t;//Hex format
76
77
78typedef struct
79{
xf.li742dd022023-06-08 01:43:32 -070080 uint16_t roamingFlag; ///< 1:roaming,0:non roaming
lh9ed821d2023-04-07 01:36:19 -070081 int16_t rsrp;
82 int16_t rsrq;
83 uint16_t SINR;
84 uint16_t netMode; //0--tdd 1--fdd
85 uint16_t band;
86 base_cell_info_t base_Scell_info;
87} lte_Scell_t;
88
89typedef struct
90{
91 int16_t rsrp;
92 int16_t rsrq;
93 uint16_t netMode; //0--tdd 1--fdd
94 base_cell_info_t base_Ncell_info;
95}lte_Ncell_t;
96
97typedef struct
98{
99 uint16_t bsic; //only in GSM
100 uint16_t band;
101 uint16_t rscp; //only in W
102 base_cell_info_t base_Ncell_info;
103}gsm_W_Scell_t;
104
105
106typedef struct
107{
108 uint16_t bsic; //only GSM
109 uint16_t band;
110 uint16_t rscp; //only in W
111 base_cell_info_t base_Ncell_info;
112}gsm_W_Ncell_t;
113
114typedef struct
115{
116 lte_Scell_t lteScell;
117 uint16_t lteNcellNum;
118 lte_Ncell_t lteNcell[6];
119}lte_cellinfo_t;
120
121typedef struct{
122 gsm_W_Scell_t scell_info;
123 uint16_t gsm_W_NcellNum;
124 gsm_W_Ncell_t gsm_W_ncell[6];
125}gsm_W_cellifo_t;
126
127typedef struct{
128 e_nw_rat_type_t curr_rat;
129 e_nw_srv_status_t service_status; //0x00: in service; 0x01: not in
130 lte_cellinfo_t lte_cellinfo;
131 gsm_W_cellifo_t gsm_cellinfo;
132}CellInfo_t;
133
134
135typedef struct{
136 uint32_t lwip_ul;
137 uint32_t lwip_dl;
138 uint32_t ppp_ul;
139 uint32_t ppp_dl;
140 uint32_t rndis_ul;
141 uint32_t rndis_dl;
142}NetInfo_t; /**< µ¥Î»: bit*/
143
144typedef enum
145{
146 E_DATA_IP_FAMILY_UNKNOWN = 0x00, /**< unknown */
147 E_DATA_IP_FAMILY_IPV4 = 0x04, /**< IPv4 */
148 E_DATA_IP_FAMILY_IPV6 = 0x06, /**< IPv6 */
149 E_DATA_IP_FAMILY_IPV4V6 = 0x0A /**< IPv4|IPv6 */
150}e_data_ip_family_t;
151
152typedef enum
153{
154 E_DATA_TECH_PREF_UNKNOWN = 0x00, /**< unknown */
155 E_DATA_TECH_PREF_UMTS = 0x01, /**< UMTS */
156 E_DATA_TECH_PREF_CDMA = 0x02, /**< CDMA */
157 E_DATA_TECH_PREF_LTE = 0x03, /**< LTE */
158 E_DATA_TECH_PREF_AUTO = 0x04 /**< AUTO */
159}e_data_tech_pref_t;
160
161typedef enum
162{
163 E_AUTH_PREF_PAP_CHAP_NOT_ALLOWED = 0x00,
164 E_AUTH_PREF_PAP_ONLY_ALLOWED = 0x01,
165 E_AUTH_PREF_CHAP_ONLY_ALLOWED = 0x02,
166 E_AUTH_PREF_PAP_CHAP_BOTH_ALLOWED = 0x03
167}e_data_auth_pref_t;
168
169
170typedef struct
171{
172 uint8_t profile_valid; /**< Must be set to TRUE if umts_profile is being passed. */
173 uint8_t profile_id; /**< profile ID. as well as called cid*/
174 uint8_t ip_family_valid; /**< Must be set to TRUE if ip_family is being passed. */
175 e_data_ip_family_t ip_family; /**< Data IP Family */
176 uint8_t apn_name_valid; /**< Must be set to TRUE if apn_name is being passed. */
177 char apn_name[DATA_MAX_APN_LEN+1]; /**< Data APN Name. A character string that identifies a PDN*/
178 uint8_t user_name_valid; /**< Must be set to TRUE if user_name is being passed. */
179 char user_name[DATA_MAX_USERNAME_LEN+1]; /**< Username for the APN. */
180 uint8_t password_valid; /**< Must be set to TRUE if password is being passed. */
181 char password[DATA_MAX_PASSWORD_LEN+1]; /**< Password for the APN. */
182 uint8_t auth_pref_valid; /**< Must be set to TRUE if tech_pref is being passed. */
183 e_data_auth_pref_t auth_pref; /**< Data auth Preference */
184 uint8_t tech_pref_valid; /**< Must be set to TRUE if tech_pref is being passed. */
185 e_data_tech_pref_t tech_pref; /**< Data Tech Preference */
186}Data_call_config_info_t;
187
188
189typedef struct
190{
191 char addr_valid; /**< Indicates whether a valid address is available. */
192 struct sockaddr_storage addr; /**< Stores the IP address. defined in kernel socket.h*/
193}data_call_addr_t;
194
195typedef struct
196{
197 data_call_addr_t iface_addr_s; /**< Network interface address. */
198 uint32_t iface_mask; /**< Subnet mask. */
199 data_call_addr_t gtwy_addr_s; /**< Gateway server address. */
200 uint32_t gtwy_mask; /**< Gateway mask. */
201 data_call_addr_t dnsp_addr_s; /**< Primary DNS server address. */
202 data_call_addr_t dnss_addr_s; /**< Secondary DNS server address. */
203}data_call_addr_info_t;
204
205typedef struct
206{
207 char iface_name[DATA_INTERFACE_NAME_LEN + 1]; /**< Network interface name. */
208 uint8_t addr_info_len; /**< Must be set to the number of elements in addr_info. */
209 data_call_addr_info_t addr_info[DATA_MAX_ADDR_COUNT]; /**< Data device address list. */
210}Data_call_addr_info_list_t;
211
212typedef enum{
213 E_RF_RESOURCE_CALLBACK_EVENT = 0x00, /**< É䯵×ÊÔ´Çл». */
214 E_NW_ATTACH_COMMPLETE_EVENT = 0x32, /**< ×¢ÍøÍê³É. */
215 E_DATA_PDN_ACT_SUCC_EVENT = 0x64, /**< PDN¼¤»îÍê³É ,ind_dataÖÐЯ´øZGIPDNS:µØÖ·ÐÅÏ¢ */
xf.li742dd022023-06-08 01:43:32 -0700216 E_GET_CELLINFO_BY_SIMID_EVENT = 0x65, /**< É¨ÍøÍê³É. */
lh9ed821d2023-04-07 01:36:19 -0700217}E_MODEM_EVENT_ID;
218
219typedef enum
220{
221 E_SIM_STAT_NOT_INSERTED = 0x00,
222 E_SIM_STAT_READY = 0x01,
223 E_SIM_STAT_PIN = 0x02,
224 E_SIM_STAT_PUK = 0x03,
225 E_SIM_STAT_BUSY = 0x04,
226 E_SIM_STAT_UNKNOWN = 0x05,
227}E_SIM_STATUS;
228
229
230/*********************************************************************
231** Ãû³Æ£º VSIM_COMMAND
232** ÃèÊö£º ModemºÍVSIMµÄAPDUͨÐŽӿں¯ÊýµÄ½á¹¹¶¨Ò壻
233** ¸ÃÀàÐͶ¨ÒåµÄº¯ÊýÐèҪͨ¹ýzte_atVsimInit½Ó¿ÚÍê³É×¢²á
234**
235*********************************************************************/
236
237typedef int (*VSIM_COMMAND)(uint8_t *apdu_req, uint16_t apdu_req_len,uint8_t *apdu_rsp, uint16_t *apdu_rsp_len, uint8_t slot);
xf.libdd93d52023-05-12 07:10:14 -0700238typedef int (*SoftSim_COMMAND)(uint8_t *apdu_req, uint16_t apdu_req_len,uint8_t *apdu_rsp, uint16_t *apdu_rsp_len, uint8_t slot);
lh9ed821d2023-04-07 01:36:19 -0700239/*********************************************************************
240** Ãû³Æ£º zte_mdm_event_ind_callback
241** ÃèÊö£º ÏûϢʼþ֪ͨº¯ÊýµÄ½á¹¹¶¨Òå
242** ind_dataÖÐÆ½Ì¨×Ô¶¨ÒåÌí¼ÓÃèÊö
243** ±ÈÈçRF×ÊÔ´»ØÊÕÔ­Òò£º1. For SIM1 TAU; 2. For SIM1 Regist Network;3. NULL;
244**
245*********************************************************************/
246
247typedef int32_t (*zte_mdm_event_ind_callback)(E_MODEM_EVENT_ID event_id, void *ind_data, uint32_t ind_data_len);
248
249/*********************************************************************
250** Ãû³Æ£º zte_mdm_event_regist
251** ÃèÊö£º
252** ÏûϢʼþ֪ͨº¯Êý×¢²áÈë¿Ú£¬Ìṩ¸ø¿Í»§×¢²áÏûÏ¢º¯Êý;
253** modem²à²úÉúʼþ£¬»áµ÷ÓÃind_cb֪ͨ¿Í»§£»
254*********************************************************************/
255extern int32_t zte_mdm_event_regist(zte_mdm_event_ind_callback ind_cb);
256
257
258/*********************ZTE VSIM API***************************/
259
260extern int32_t zte_atVsimInit(VSIM_COMMAND vsim_apdu_process_fn, uint8_t nSimID);
261
262extern int32_t zte_atVsimClose(VSIM_COMMAND vsim_apdu_process_fn, uint8_t nSimID);
263
264extern int32_t zte_atVsimReset(void);
265
266//extern int16_t zte_SetSimWorkMode(SimTypeInSlot_t SimType, uint8_t nSoltID);
267
268//extern int16_t zte_GetSimWorkMode(SimTypeInSlot_t *SimType, uint8_t nSoltID);
269
270extern int32_t zte_SetGTDUALSIM(uint8_t nSimID);
271
272extern int32_t zte_GetGTDUALSIM(uint8_t *nSimID);
273
274extern int32_t zte_SetGTDATASIM(uint8_t nSimID);
275
276extern int32_t zte_GetGTDATASIM(uint8_t *nSimID);
277
278extern int32_t zte_SetCfunMode(uint8_t mode);
279
280extern int32_t zte_GetCfunMode(uint8_t *mode);
281
282extern int32_t zte_SetIMEIbySimId(uint8_t *imei, uint8_t imei_len, uint8_t nSimID);
283
284extern int32_t zte_GetIMEIbySimId(uint8_t *imei, uint8_t imei_len, uint8_t nSimID);
285
286extern int32_t zte_GetCCIDbySimId(uint8_t *ccid, uint8_t ccid_len, uint8_t nSimID);
287
288extern int32_t zte_GetMCCMNCbySimId(char *mcc, char *mnc, uint8_t nSimID);
289
290extern int32_t zte_SwitchSimHandle(uint8_t mode);
291
292extern int32_t zte_GetCSQbySimId(int32_t *rssi, int32_t *ber, uint8_t nSimID);
293
294extern int32_t zte_GetRegInfobySimid(RegInfo_t *reg_info, uint8_t nSimID);
295
xf.li742dd022023-06-08 01:43:32 -0700296extern int32_t zte_GetCellInfobySimId(uint8_t nSimID);
lh9ed821d2023-04-07 01:36:19 -0700297
298extern int32_t zte_GetNetInfobySimId(NetInfo_t *pNetInfo, uint8_t nSimID);
299
300extern int32_t zte_SetAPNbySimID(Data_call_config_info_t *data_call, uint8_t nSimID);
301
302extern int32_t zte_StartDataCallbySimId(Data_call_config_info_t *data_call, uint8_t nSimID);
303
304extern int32_t zte_StopDataCallbySimId(uint8_t profile_id, uint8_t nSimID);
305
306extern int32_t zte_GetDataAddrbySimID(uint8_t profile_id, Data_call_addr_info_list_t *addr_list, uint8_t nSimID);
307
308extern int32_t zte_GetSimStatusbySimId(E_SIM_STATUS *sim_status, uint8_t nSimID);
309
310extern int32_t zte_SendATbySimId(char *req_at, char *info_fmt, void **pval, uint8_t nSimID);
311/********************ZTE VSIM API END****************************/
312
313
314#endif //#ifndef __ZTE_VSIM_API_H_
315