lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 1 | #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 |
|
| 19 | typedef enum {
|
| 20 | E_SIM_TYPE_USIM, //ʵÌ忨
|
| 21 | E_SIM_TYPE_VSIM, //ÔÆ¿¨
|
| 22 | E_SIM_TYPE_SSIM, //Soft SIM
|
| 23 | }SimTypeInSlot_t;
|
| 24 |
|
| 25 |
|
| 26 | typedef 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 |
|
| 37 | typedef enum {
|
| 38 | E_NW_STATUS_SRV_NONE = 0,
|
xf.li | 742dd02 | 2023-06-08 01:43:32 -0700 | [diff] [blame] | 39 | E_NW_STATUS_SRV_LIMITED = 1,
|
| 40 | E_NW_STATUS_SRV_AVAILABLE = 2,
|
lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 41 | }e_nw_srv_status_t;
|
| 42 |
|
| 43 |
|
| 44 | typedef struct
|
| 45 | {
|
| 46 | uint32_t tac;
|
| 47 | uint32_t cell_id;
|
xf.li | 742dd02 | 2023-06-08 01:43:32 -0700 | [diff] [blame] | 48 | uint32_t roamingFlag; ///< 1:roaming,0:non roaming
|
lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 49 | }lte_scell_info_t;
|
| 50 |
|
| 51 | typedef struct
|
| 52 | {
|
| 53 | uint32_t lac;
|
| 54 | uint32_t cell_id;
|
| 55 | }gsm_w_scell_info_t;
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 | typedef 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 |
|
| 67 | typedef struct{
|
| 68 | uint16_t mcc;
|
| 69 | uint16_t mnc;
|
| 70 | uint32_t tac;
|
| 71 | uint32_t cell_id;
|
| 72 | uint16_t bandwidth;
|
xf.li | 742dd02 | 2023-06-08 01:43:32 -0700 | [diff] [blame] | 73 | uint16_t pcid;//int16_t rxlev;
|
lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 74 | uint32_t arfcn;
|
lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 75 | }base_cell_info_t;//Hex format
|
| 76 |
|
| 77 |
|
| 78 | typedef struct
|
| 79 | {
|
xf.li | 742dd02 | 2023-06-08 01:43:32 -0700 | [diff] [blame] | 80 | uint16_t roamingFlag; ///< 1:roaming,0:non roaming
|
lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 81 | 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 |
|
| 89 | typedef 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 |
|
| 97 | typedef 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 |
|
| 106 | typedef 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 |
|
| 114 | typedef struct
|
| 115 | {
|
| 116 | lte_Scell_t lteScell;
|
| 117 | uint16_t lteNcellNum;
|
| 118 | lte_Ncell_t lteNcell[6];
|
| 119 | }lte_cellinfo_t;
|
| 120 |
|
| 121 | typedef 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 |
|
| 127 | typedef 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 |
|
| 135 | typedef 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 |
|
| 144 | typedef 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 |
|
| 152 | typedef 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 |
|
| 161 | typedef 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 |
|
| 170 | typedef 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 |
|
| 189 | typedef 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 |
|
| 195 | typedef 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 |
|
| 205 | typedef 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 |
|
| 212 | typedef 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.li | 742dd02 | 2023-06-08 01:43:32 -0700 | [diff] [blame] | 216 | E_GET_CELLINFO_BY_SIMID_EVENT = 0x65, /**< É¨ÍøÍê³É. */
|
lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 217 | }E_MODEM_EVENT_ID;
|
| 218 |
|
| 219 | typedef 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 |
|
| 237 | typedef 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.li | bdd93d5 | 2023-05-12 07:10:14 -0700 | [diff] [blame] | 238 | typedef int (*SoftSim_COMMAND)(uint8_t *apdu_req, uint16_t apdu_req_len,uint8_t *apdu_rsp, uint16_t *apdu_rsp_len, uint8_t slot);
|
lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 239 | /*********************************************************************
|
| 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 |
|
| 247 | typedef 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 | *********************************************************************/
|
| 255 | extern int32_t zte_mdm_event_regist(zte_mdm_event_ind_callback ind_cb);
|
| 256 |
|
| 257 |
|
| 258 | /*********************ZTE VSIM API***************************/
|
| 259 |
|
| 260 | extern int32_t zte_atVsimInit(VSIM_COMMAND vsim_apdu_process_fn, uint8_t nSimID);
|
| 261 |
|
| 262 | extern int32_t zte_atVsimClose(VSIM_COMMAND vsim_apdu_process_fn, uint8_t nSimID);
|
| 263 |
|
| 264 | extern 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 |
|
| 270 | extern int32_t zte_SetGTDUALSIM(uint8_t nSimID);
|
| 271 |
|
| 272 | extern int32_t zte_GetGTDUALSIM(uint8_t *nSimID);
|
| 273 |
|
| 274 | extern int32_t zte_SetGTDATASIM(uint8_t nSimID);
|
| 275 |
|
| 276 | extern int32_t zte_GetGTDATASIM(uint8_t *nSimID);
|
| 277 |
|
| 278 | extern int32_t zte_SetCfunMode(uint8_t mode);
|
| 279 |
|
| 280 | extern int32_t zte_GetCfunMode(uint8_t *mode);
|
| 281 |
|
| 282 | extern int32_t zte_SetIMEIbySimId(uint8_t *imei, uint8_t imei_len, uint8_t nSimID);
|
| 283 |
|
| 284 | extern int32_t zte_GetIMEIbySimId(uint8_t *imei, uint8_t imei_len, uint8_t nSimID);
|
| 285 |
|
| 286 | extern int32_t zte_GetCCIDbySimId(uint8_t *ccid, uint8_t ccid_len, uint8_t nSimID);
|
| 287 |
|
| 288 | extern int32_t zte_GetMCCMNCbySimId(char *mcc, char *mnc, uint8_t nSimID);
|
| 289 |
|
| 290 | extern int32_t zte_SwitchSimHandle(uint8_t mode);
|
| 291 |
|
| 292 | extern int32_t zte_GetCSQbySimId(int32_t *rssi, int32_t *ber, uint8_t nSimID);
|
| 293 |
|
| 294 | extern int32_t zte_GetRegInfobySimid(RegInfo_t *reg_info, uint8_t nSimID);
|
| 295 |
|
xf.li | 742dd02 | 2023-06-08 01:43:32 -0700 | [diff] [blame] | 296 | extern int32_t zte_GetCellInfobySimId(uint8_t nSimID);
|
lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 297 |
|
| 298 | extern int32_t zte_GetNetInfobySimId(NetInfo_t *pNetInfo, uint8_t nSimID);
|
| 299 |
|
| 300 | extern int32_t zte_SetAPNbySimID(Data_call_config_info_t *data_call, uint8_t nSimID);
|
| 301 |
|
| 302 | extern int32_t zte_StartDataCallbySimId(Data_call_config_info_t *data_call, uint8_t nSimID);
|
| 303 |
|
| 304 | extern int32_t zte_StopDataCallbySimId(uint8_t profile_id, uint8_t nSimID);
|
| 305 |
|
| 306 | extern int32_t zte_GetDataAddrbySimID(uint8_t profile_id, Data_call_addr_info_list_t *addr_list, uint8_t nSimID);
|
| 307 |
|
| 308 | extern int32_t zte_GetSimStatusbySimId(E_SIM_STATUS *sim_status, uint8_t nSimID);
|
| 309 |
|
| 310 | extern 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 |
|