lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 1 | #include "ght_vsim_api.h"
|
| 2 |
|
| 3 | //********2023-01-13***********//
|
| 4 |
|
| 5 | //================================================
|
| 6 |
|
| 7 | typedef int32_t (*zte_mdm_event_ind_callback)(E_MODEM_EVENT_ID event_id, void *ind_data, uint32_t ind_data_len);
|
| 8 | /**********************ZTE funcation Declartion here************
|
| 9 | */
|
| 10 | extern int32_t zte_mdm_event_regist(zte_mdm_event_ind_callback ind_cb);
|
| 11 |
|
| 12 | extern int32_t zte_atVsimInit(VSIM_COMMAND vsim_apdu_process_fn, uint8_t nSimID);
|
xf.li | bdd93d5 | 2023-05-12 07:10:14 -0700 | [diff] [blame] | 13 | extern int32_t zte_atSoftSimInit(SoftSim_COMMAND softssim_apdu_process_fn, uint8_t nSimID);
|
lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 14 |
|
| 15 | extern int32_t zte_atVsimClose(VSIM_COMMAND vsim_apdu_process_fn, uint8_t nSimID);
|
xf.li | bdd93d5 | 2023-05-12 07:10:14 -0700 | [diff] [blame] | 16 | extern int32_t zte_atSoftSimClose(SoftSim_COMMAND softssim_apdu_process_fn, uint8_t nSimID);
|
lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 17 |
|
| 18 | extern int32_t zte_atVsimReset(void);
|
| 19 |
|
| 20 | //extern int16_t zte_SetSimWorkMode(SimTypeInSlot_t SimType, uint8_t nSoltID);
|
| 21 |
|
| 22 | //extern int16_t zte_GetSimWorkMode(SimTypeInSlot_t *SimType, uint8_t nSoltID);
|
| 23 |
|
| 24 | extern int32_t zte_SetGTDUALSIM(uint8_t nSimID);
|
| 25 |
|
| 26 | extern int32_t zte_GetGTDUALSIM(uint8_t *nSimID);
|
| 27 |
|
| 28 | extern int32_t zte_SetGTDATASIM(uint8_t nSimID);
|
| 29 |
|
| 30 | extern int32_t zte_GetGTDATASIM(uint8_t *nSimID);
|
| 31 |
|
| 32 | extern int32_t zte_SetCfunMode(uint8_t mode);
|
| 33 |
|
| 34 | extern int32_t zte_GetCfunMode(uint8_t *mode);
|
| 35 |
|
| 36 | extern int32_t zte_SetIMEIbySimId(uint8_t *imei, uint8_t imei_len, uint8_t nSimID);
|
| 37 |
|
| 38 | extern int32_t zte_GetIMEIbySimId(uint8_t *imei, uint8_t imei_len, uint8_t nSimID);
|
| 39 |
|
| 40 | extern int32_t zte_GetCCIDbySimId(uint8_t *ccid, uint8_t ccid_len, uint8_t nSimID);
|
| 41 |
|
| 42 | extern int32_t zte_GetMCCMNCbySimId(char *mcc, char *mnc, uint8_t nSimID);
|
| 43 |
|
| 44 | extern int32_t zte_SwitchSimHandle(uint8_t mode);
|
| 45 |
|
| 46 | extern int32_t zte_GetCSQbySimId(int32_t *rssi, int32_t *ber, uint8_t nSimID);
|
| 47 |
|
| 48 | extern int32_t zte_GetRegInfobySimid(RegInfo_t *reg_info, uint8_t nSimID);
|
| 49 |
|
| 50 | extern int32_t zte_GetCellInfobySimId(CellInfo_t *pcellinfo, uint8_t nSimID);
|
| 51 |
|
| 52 | extern int32_t zte_GetNetInfobySimId(NetInfo_t *pNetInfo, uint8_t nSimID);
|
| 53 |
|
| 54 | extern int32_t zte_SetAPNbySimID(Data_call_config_info_t *data_call, uint8_t nSimID);
|
| 55 |
|
| 56 | extern int32_t zte_StartDataCallbySimId(Data_call_config_info_t *data_call, uint8_t nSimID);
|
| 57 |
|
| 58 | extern int32_t zte_StopDataCallbySimId(uint8_t profile_id, uint8_t nSimID);
|
| 59 |
|
| 60 | extern int32_t zte_GetDataAddrbySimID(uint8_t profile_id, Data_call_addr_info_list_t *addr_list, uint8_t nSimID);
|
| 61 |
|
| 62 | extern int32_t zte_GetSimStatusbySimId(E_SIM_STATUS *sim_status, uint8_t nSimID);
|
| 63 |
|
| 64 | extern int32_t zte_SendATbySimId(char *req_at, char *info_fmt, void **pval, uint8_t nSimID);
|
| 65 |
|
| 66 | /*
|
| 67 | *************************ZTE API Declartion end*************************/
|
| 68 |
|
| 69 | FIBO_MODEM_EVENT g_ind_cb;
|
| 70 |
|
| 71 | int32_t fibo_mdm_event_ind_cb(E_MODEM_EVENT_ID event_id, void *ind_data, uint32_t ind_data_len)
|
| 72 | {
|
| 73 | if(g_ind_cb)
|
| 74 | g_ind_cb(event_id, ind_data, ind_data_len);
|
| 75 |
|
| 76 | return 0;
|
| 77 | }
|
| 78 |
|
| 79 |
|
| 80 | /***********************The Fibo Public APIs Defination area*********************
|
| 81 | */
|
| 82 | int32_t fibo_mdm_event_regist(FIBO_MODEM_EVENT ind_cb)
|
| 83 | {
|
| 84 | g_ind_cb = ind_cb;
|
| 85 | return 0;
|
| 86 | }
|
| 87 |
|
| 88 | /**********************************************************
|
| 89 | ** Function Name: fibo_vsim_init
|
| 90 | ** Description:
|
| 91 | ** VSIM³õʼ»¯£¬ÐèÒª½«APDU»Øµ÷º¯Êý×÷ΪÈë²Î´«Èë¸ø modem;
|
| 92 | **
|
| 93 | ***********************************************************/
|
| 94 |
|
| 95 | void fibo_vsim_init(VSIM_COMMAND vsim_apdu_process, uint8_t nSimID)
|
| 96 | {
|
| 97 | printf("[VSIM] fibo_vsim_init,%d", nSimID);
|
| 98 | zte_mdm_event_regist(fibo_mdm_event_ind_cb);
|
| 99 | zte_atVsimInit(vsim_apdu_process, nSimID);
|
| 100 | }
|
xf.li | bdd93d5 | 2023-05-12 07:10:14 -0700 | [diff] [blame] | 101 | void fibo_SoftSim_init(SoftSim_COMMAND softsim_apdu_process, uint8_t nSimID)
|
| 102 | {
|
| 103 | printf("[VSIM] fibo_SoftSim_init,%d", nSimID);
|
| 104 | zte_mdm_event_regist(fibo_mdm_event_ind_cb);
|
| 105 | zte_atSoftSimInit(softsim_apdu_process, nSimID);
|
| 106 | }
|
lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 107 |
|
| 108 | /**********************************************************
|
| 109 | ** Function Name: fibo_vsim_close
|
| 110 | ** Description:
|
| 111 | ** ¹Ø±ÕVSIM;
|
| 112 | **
|
| 113 | ***********************************************************/
|
| 114 |
|
| 115 | void fibo_vsim_close(VSIM_COMMAND vsim_apdu_process, uint8_t nSimID)
|
| 116 | {
|
| 117 | printf("[VSIM] fibo_vsim_close,%d", nSimID);
|
| 118 | zte_atVsimClose(vsim_apdu_process, nSimID);
|
| 119 | }
|
xf.li | bdd93d5 | 2023-05-12 07:10:14 -0700 | [diff] [blame] | 120 | void fibo_SoftSim_close(SoftSim_COMMAND softsim_apdu_process, uint8_t nSimID)
|
| 121 | {
|
| 122 | printf("[VSIM] fibo_SoftSim_close,%d", nSimID);
|
| 123 | zte_atSoftSimClose(softsim_apdu_process, nSimID);
|
| 124 | }
|
lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 125 |
|
| 126 | /**************************************************************
|
| 127 | ** Function Name: fibo_set_sim_workmode
|
| 128 | ** Description:
|
| 129 | ** Õë¶ÔË«¿¨Ä£×飬ÉèÖÃË«¿¨²ÛÖеĿ¨ÀàÐÍ£¬½ø¶øÄܹ»ÊÊÅäÏàÓ¦Ó¦ÓóÌÐò¹¦ÄÜ;
|
| 130 | **
|
| 131 | ***************************************************************/
|
| 132 |
|
| 133 | int16_t fibo_set_sim_workmode(SimTypeInSlot_t SimType, uint8_t nSoltID)
|
| 134 | {
|
| 135 | return 0;
|
| 136 | }
|
| 137 |
|
| 138 | /**************************************************************
|
| 139 | ** Function Name: fibo_get_sim_workmode
|
| 140 | ** Description:
|
| 141 | ** Õë¶ÔË«¿¨Ä£×飬ÉèÖÃË«¿¨²ÛÖеĿ¨ÀàÐÍ£¬½ø¶øÄܹ»ÊÊÅäÏàÓ¦Ó¦ÓóÌÐò¹¦ÄÜ;
|
| 142 | **
|
| 143 | ***************************************************************/
|
| 144 |
|
| 145 | int16_t fibo_get_sim_workmode(SimTypeInSlot_t *SimType, uint8_t nSoltID)
|
| 146 | {
|
| 147 | return 0;
|
| 148 | }
|
| 149 |
|
| 150 | /**************************************************************
|
| 151 | ** Function Name: fibo_set_dualsim
|
| 152 | ** Description:
|
| 153 | ** Ë«¿¨Çл»ÅäÖýӿڣ¬¸ù¾ÝÈë²ÎSimIDÇл»µ½¶ÔÓ¦µÄ¹¤×÷¿¨£¬SIMÏà¹ØATÒ²ÓëÖ®Çл»;
|
| 154 | **
|
| 155 | ***************************************************************/
|
| 156 |
|
| 157 | int32_t fibo_set_dualsim(uint8_t nSimID)
|
| 158 | {
|
| 159 | return zte_SetGTDUALSIM(nSimID);
|
| 160 | }
|
| 161 |
|
| 162 |
|
| 163 | /**************************************************************
|
| 164 | ** Function Name: fibo_set_dualsim
|
| 165 | ** Description:
|
| 166 | ** Ë«¿¨Çл»»ñÈ¡½Ó¿Ú£¬»ñÈ¡µ±Ç°¹¤×÷µÄSIM ID;
|
| 167 | **
|
| 168 | ***************************************************************/
|
| 169 |
|
| 170 | int32_t fibo_get_dualsim(uint8_t *nSimID)
|
| 171 | {
|
| 172 | return zte_GetGTDUALSIM(nSimID);
|
| 173 | }
|
| 174 |
|
| 175 | /**************************************************************
|
| 176 | ** Function Name: fibo_set_dualsim
|
| 177 | ** Description:
|
| 178 | ** ÅäÖÃÊý¾Ý¿¨ÎªnSimIDÖ¸ÏòµÄ¿¨;
|
| 179 | **
|
| 180 | ***************************************************************/
|
| 181 |
|
| 182 | int32_t fibo_set_datasim(uint8_t nSimID)
|
| 183 | {
|
| 184 | return zte_SetGTDATASIM(nSimID);
|
| 185 | }
|
| 186 |
|
| 187 | /**************************************************************
|
| 188 | ** Function Name: fibo_get_datasim
|
| 189 | ** Description:
|
| 190 | ** »ñÈ¡µ±Ç°ÅäÖõÄÊý¾Ý¿¨ID;
|
| 191 | **
|
| 192 | ***************************************************************/
|
| 193 |
|
| 194 | int32_t fibo_get_datasim(uint8_t *nSimID)
|
| 195 | {
|
| 196 | return zte_GetGTDATASIM(nSimID);
|
| 197 | }
|
| 198 |
|
| 199 |
|
| 200 | /**********************************************************
|
| 201 | ** Function Name: fibo_set_IMEI_by_simid
|
| 202 | ** Description:
|
| 203 | ** ÉèÖÃVSIM¶ÔÓ¦µÄIMEI;
|
| 204 | **
|
| 205 | ** Note: É豸IMEI£¬µôµç²»±£´æ£¬ÔÚvsim_initÖ®ºó;
|
| 206 | ***********************************************************/
|
| 207 |
|
| 208 | int32_t fibo_set_IMEI_by_simid(uint8_t *imei, uint8_t imei_len, uint8_t nSimID)
|
| 209 | {
|
| 210 | printf("[VSIM] fibo_set_imei,%d", nSimID);
|
| 211 | return zte_SetIMEIbySimId(imei, imei_len, nSimID);
|
| 212 | }
|
| 213 |
|
| 214 | /**********************************************************
|
| 215 | ** Function Name: fibo_set_IMEI_by_simid
|
| 216 | ** Description:
|
| 217 | ** »ñÈ¡VSIM¶ÔÓ¦µÄIMEI;
|
| 218 | **
|
| 219 | ** Note: É豸IMEI£¬µôµç²»±£´æ£¬ÔÚvsim_initÖ®ºó;
|
| 220 | ***********************************************************/
|
| 221 |
|
| 222 | int32_t fibo_get_IMEI_by_simid(uint8_t *imei, uint8_t imei_len, uint8_t nSimID)
|
| 223 | {
|
| 224 | printf("[VSIM] fibo_get_imei,%d", nSimID);
|
| 225 | return zte_GetIMEIbySimId(imei, imei_len, nSimID);
|
| 226 | }
|
| 227 |
|
| 228 |
|
| 229 | /**********************************************************
|
| 230 | ** Function Name: fibo_get_CCID_by_simid
|
| 231 | ** Description:
|
| 232 | ** »ñȡָ¶¨SIMµÄICCID;
|
| 233 | **
|
| 234 | ***********************************************************/
|
| 235 |
|
| 236 | int32_t fibo_get_CCID_by_simid(uint8_t *ccid, uint8_t ccid_len, uint8_t nSimID)
|
| 237 | {
|
| 238 | printf("[VSIM]fibo_get_CCID_by_simid %d", nSimID);
|
| 239 | return zte_GetCCIDbySimId(ccid, ccid_len, nSimID);
|
| 240 | }
|
| 241 |
|
| 242 | /**********************************************************
|
| 243 | ** Function Name: fibo_xiaoshui_get_mcc_mnc
|
| 244 | ** Description:
|
| 245 | ** ¿Í»§¶¨ÖÆÐèÇó½Ó¿Ú£¬»ñÈ¡·þÎñÍøÂçMCCºÍMNC;
|
| 246 | **
|
| 247 | ***********************************************************/
|
| 248 |
|
| 249 | int32_t fibo_get_MCC_MNC_by_simid(char *mcc, char *mnc, uint8_t nSimID)
|
| 250 | {
|
| 251 | return zte_GetMCCMNCbySimId(mcc, mnc, nSimID);
|
| 252 | }
|
| 253 |
|
| 254 | /**********************************************************
|
| 255 | ** Function Name: fibo_switch_sim_handle
|
| 256 | ** Description:
|
| 257 | ** µ÷ÓøýӿڽøÐÐVSIMÇл»£¬Í¬Ê±Íê³ÉPDPÁ¬½Ó;
|
| 258 | ** mode: 0¹Ø±ÕVSIM, 1¿ªÆôVSIM;
|
| 259 | ** Note: ÈôÊǵ÷ÓÃfibo_switch_sim_handle(1)£¬Ö®ºó´æÔÚµ÷ÓÃfibo_set_dualsim(0)
|
| 260 | ** µÄÇé¿ö£¬´Ëʱfibo_set_dualsim(0)½öÓÃÓÚÁÙʱÇп¨µ½ÊµÌ忨
|
| 261 | ***********************************************************/
|
| 262 |
|
| 263 | int32_t fibo_switch_sim_handle(uint8_t mode)
|
| 264 | {
|
| 265 | return zte_SwitchSimHandle(mode);
|
| 266 | }
|
| 267 |
|
| 268 | /**********************************************************
|
| 269 | ** Function Name: fibo_set_cfun_mode
|
| 270 | ** Description:
|
| 271 | ** ÉèÖÃCFUN²ÎÊý;
|
| 272 | **
|
| 273 | ***********************************************************/
|
| 274 |
|
| 275 | int32_t fibo_set_cfun_mode(uint8_t mode)
|
| 276 | {
|
| 277 | return zte_SetCfunMode(mode);
|
| 278 | //¹ãºÍͨͬ²½Æä¶þ´Î¿ª·¢³ÌÐò²ÎÊý
|
| 279 | }
|
| 280 |
|
| 281 | /**********************************************************
|
| 282 | ** Function Name: fibo_get_cfun_mode
|
| 283 | ** Description:
|
| 284 | ** »ñÈ¡CFUN²ÎÊý;
|
| 285 | **
|
| 286 | ***********************************************************/
|
| 287 |
|
| 288 | int32_t fibo_get_cfun_mode(uint8_t *mode)
|
| 289 | {
|
| 290 | return zte_GetCfunMode(mode);
|
| 291 | //¹ãºÍͨͬ²½Æä¶þ´Î¿ª·¢³ÌÐò²ÎÊý
|
| 292 | }
|
| 293 |
|
| 294 |
|
| 295 | /**********************************************************
|
| 296 | ** Function Name: fibo_set_SysReset
|
| 297 | ** Description:
|
| 298 | ** ÖØÆôÉ豸;
|
| 299 | **
|
| 300 | ***********************************************************/
|
| 301 |
|
| 302 | int32_t fibo_set_SysReset()
|
| 303 | {
|
| 304 | zte_atVsimReset();
|
| 305 | //modem cfun=0¹Ø»ú+ϵͳµ÷Óùػú
|
| 306 | //ϵͳµ÷Óùػú
|
| 307 | //ÆäËû¹ãºÍͨʵÏÖ
|
| 308 | return 0;
|
| 309 | }
|
| 310 |
|
| 311 | /**********************************************************
|
| 312 | ** Function Name: fibo_get_csq_by_simid
|
| 313 | ** Description:
|
| 314 | ** »ñÈ¡ÓëSIM IDÏà¹ØµÄCSQ;
|
| 315 | **
|
| 316 | ***********************************************************/
|
| 317 |
|
| 318 | int32_t fibo_get_CSQ_by_simid(int32_t *rssi, int32_t *ber, uint8_t nSimID)
|
| 319 | {
|
| 320 | return zte_GetCSQbySimId(rssi, ber, nSimID);
|
| 321 | }
|
| 322 |
|
| 323 | /**********************************************************
|
| 324 | ** Function Name: fibo_getRegInfo
|
| 325 | ** Description:
|
| 326 | ** »ñÈ¡ÓëSIM IDÏà¹ØµÄRegInfo;
|
| 327 | **
|
| 328 | ***********************************************************/
|
| 329 |
|
| 330 | int32_t fibo_get_RegInfo_by_simid(RegInfo_t *reg_info, uint8_t nSimID)
|
| 331 | {
|
| 332 | return zte_GetRegInfobySimid(reg_info, nSimID);
|
| 333 | }
|
| 334 |
|
| 335 |
|
| 336 | /**********************************************************
|
| 337 | ** Function Name: fibo_getCellInfo
|
| 338 | ** Description:
|
| 339 | ** »ñÈ¡ÓëSIM IDÏà¹ØµÄCellInfo;
|
| 340 | **
|
| 341 | ***********************************************************/
|
| 342 |
|
| 343 | int32_t fibo_get_CellInfo_by_simid(CellInfo_t *pcellinfo, uint8_t nSimID)
|
| 344 | {
|
| 345 | return zte_GetCellInfobySimId(pcellinfo, nSimID);
|
| 346 | }
|
| 347 |
|
| 348 |
|
| 349 | /**********************************************************
|
| 350 | ** Function Name: fibo_get_NetInfo_by_simid
|
| 351 | ** Description:
|
| 352 | ** »ñÈ¡ÓëSIM IDÏà¹ØµÄ<´ýÈ·ÈÏ>;
|
| 353 | **
|
| 354 | ***********************************************************/
|
| 355 |
|
| 356 | int32_t fibo_get_NetInfo_by_simid(NetInfo_t *pNetInfo, uint8_t nSimID)
|
| 357 | {
|
| 358 | return zte_GetNetInfobySimId(pNetInfo, nSimID);;
|
| 359 | }
|
| 360 |
|
| 361 | /**********************************************************
|
| 362 | ** Function Name: fibo_set_APN_by_simid
|
| 363 | ** Description:
|
| 364 | ** ÅäÖÃÓÃÓÚPDP¼¤»îµÄprofileÐÅÏ¢;
|
| 365 | **
|
| 366 | ***********************************************************/
|
| 367 |
|
| 368 | int32_t fibo_set_APN_by_simid(Data_call_config_info_t *data_call, uint8_t nSimID)
|
| 369 | {
|
| 370 | return zte_SetAPNbySimID(data_call, nSimID);
|
| 371 | }
|
| 372 |
|
| 373 | /**********************************************************
|
| 374 | ** Function Name: fibo_start_Data_Call_by_simid
|
| 375 | ** Description:
|
| 376 | ** ¼¤»îÖ¸¶¨profile PDPÁ¬½Ó;
|
| 377 | **
|
| 378 | ***********************************************************/
|
| 379 |
|
| 380 | int32_t fibo_start_Data_Call_by_simid(Data_call_config_info_t *data_call, uint8_t rndis_flag, uint8_t nSimID)
|
| 381 | {
|
| 382 | return zte_StartDataCallbySimId(data_call, nSimID);
|
| 383 | }
|
| 384 |
|
| 385 | /**********************************************************
|
| 386 | ** Function Name: fibo_stop_Data_Call_by_simid
|
| 387 | ** Description:
|
| 388 | ** È¥¼¤»îÖ¸¶¨profile PDPÁ¬½Ó;
|
| 389 | **
|
| 390 | ***********************************************************/
|
| 391 |
|
| 392 | int32_t fibo_stop_Data_Call_by_simid(uint8_t profile_id, uint8_t rndis_flag, uint8_t nSimID)
|
| 393 | {
|
| 394 | return zte_StopDataCallbySimId(profile_id, nSimID);
|
| 395 | }
|
| 396 |
|
| 397 | /**********************************************************
|
| 398 | ** Function Name: fibo_get_Data_Addr_by_simid
|
| 399 | ** Description:
|
| 400 | ** »ñȡָ¶¨profileµÄµØÖ·ÐÅÏ¢;
|
| 401 | **
|
| 402 | ***********************************************************/
|
| 403 |
|
| 404 | int32_t fibo_get_Data_Addr_by_simid(uint8_t profile_id, Data_call_addr_info_list_t *addr_list, uint8_t nSimID)
|
| 405 | {
|
| 406 | return zte_GetDataAddrbySimID(profile_id, addr_list, nSimID);
|
| 407 | }
|
| 408 |
|
| 409 |
|
| 410 | int32_t fibo_get_SIM_Status_by_simid(E_SIM_STATUS *sim_status, uint8_t nSimID)
|
| 411 | {
|
| 412 | return zte_GetSimStatusbySimId(sim_status, nSimID);
|
| 413 | }
|
| 414 |
|
| 415 | int32_t fibo_send_AT_by_simid(char *req_at, char *info_fmt, void **pval, uint8_t nSimID)
|
| 416 | {
|
| 417 | return zte_SendATbySimId(req_at, info_fmt, pval, nSimID);
|
| 418 | }
|
| 419 |
|
| 420 |
|
| 421 | /*
|
| 422 | **********************The Public APIs Defination area end**********************/
|
| 423 |
|
| 424 |
|