b.liu | b17525e | 2025-05-14 17:22:29 +0800 | [diff] [blame] | 1 | #include <stdlib.h> |
| 2 | #include <stdint.h> |
| 3 | #include <string.h> |
| 4 | #include <stdbool.h> |
| 5 | #include <stdio.h> |
| 6 | //gsw include |
| 7 | #define GSW_HAL_SUCCESS 0 |
| 8 | #define GSW_HAL_FAIL -1 |
| 9 | #define GSW_HAL_MEM_INVAILD -2 |
| 10 | #define GSW_SIM_ICCID_LENGTH 20+1 |
| 11 | #define GSW_SIM_IMSI_LENGTH 20+1 |
| 12 | #define GSW_SIM_MSISDN_LENGTH 20+1 |
| 13 | #define GSW_SIM_IMEI_LENGTH 20+1 |
| 14 | |
| 15 | typedef enum sim_status |
| 16 | { |
| 17 | SIM_STATUS_ABSENT = 0, /**< sim absent*/ |
| 18 | SIM_STATUS_PRESENT = 1, /**< sim present mtk as ready*/ |
| 19 | SIM_STATUS_ERROR = 2, /**< sim error*/ |
| 20 | SIM_STATUS_READY = 3, /**< sim state ready mtk no this value*/ |
| 21 | SIM_STATUS_PIN = 4, /**< pinlock status*/ |
| 22 | } sim_status_e_type; |
| 23 | |
| 24 | |
| 25 | |
| 26 | /** |
| 27 | * @brief sim sdk init |
| 28 | * @param [in] token usr id define by who use |
| 29 | * @retval 0: success |
| 30 | * @retval other: fail |
| 31 | */ |
| 32 | int gsw_sim_sdk_init(int32_t token); |
| 33 | |
| 34 | |
| 35 | /** |
| 36 | * @brief sim sdk deinit |
| 37 | * @param |
| 38 | * @retval 0: success |
| 39 | * @retval other: fail |
| 40 | */ |
| 41 | int gsw_sim_sdk_deinit(void); |
| 42 | |
| 43 | /** |
| 44 | * @brief get sim state |
| 45 | * @param [out] sim_state sim status as sim_status_e_type |
| 46 | * @retval 0: success |
| 47 | * @retval other: fail |
| 48 | */ |
| 49 | int gsw_get_sim_status(int32_t *sim_state); |
| 50 | |
| 51 | /** |
| 52 | * @brief get iccid function |
| 53 | * @param [in] len iccid length,max is 20 |
| 54 | * @param [out] iccid return iccid from this func |
| 55 | * @retval 0: success |
| 56 | * @retval other: fail |
| 57 | */ |
| 58 | int gsw_get_sim_iccid(int32_t len, int8_t *iccid); |
| 59 | |
| 60 | /** |
| 61 | * @brief get imsi function |
| 62 | * @param [in] len imsi length,max is 20 |
| 63 | * @param [out] iccid return imsi from this func |
| 64 | * @retval 0: success |
| 65 | * @retval other: fail |
| 66 | */ |
| 67 | int gsw_get_sim_imsi(int32_t len, int8_t *imsi); |
| 68 | |
| 69 | /** |
| 70 | * @brief get sim msisdn function |
| 71 | * @param [in] len msisdn length,max is 20 |
| 72 | * @param [out] msisdn msisdn length,max is 20 |
| 73 | * @retval 0: success |
| 74 | * @retval other: fail |
| 75 | */ |
| 76 | int gsw_get_sim_msisdn(int32_t len, int8_t *msisdn); |
| 77 | |
| 78 | /** |
| 79 | * @brief get imei function |
| 80 | * @param [in] len imei length,max is 20 |
| 81 | * @param [out] imei return imei from this func |
| 82 | * @retval 0: success |
| 83 | * @retval other: fail |
| 84 | */ |
| 85 | int gsw_get_imei(int32_t len, int8_t *imei); |
| 86 | |
| 87 | /** |
| 88 | * @brief set sim power down |
| 89 | * @param |
| 90 | * @retval 0: success |
| 91 | * @retval other: fail |
| 92 | */ |
| 93 | int gsw_set_sim_power_down(void); |
| 94 | |
| 95 | /** |
| 96 | * @brief set sim power up |
| 97 | * @param |
| 98 | * @retval 0: success |
| 99 | * @retval other: fail |
| 100 | */ |
| 101 | int gsw_set_sim_power_up(void); |
| 102 | |
| 103 | /** |
| 104 | * @brief reset modem stack only, notice: after use this method, all ril sdk |
| 105 | * need restart by app, means network, sim, sms, data need deinit then init! |
| 106 | * @param |
| 107 | * @retval 0: success |
| 108 | * @retval other: fail |
| 109 | */ |
| 110 | int gsw_reset_modem(void); |
| 111 | |