Fix mbtk from v1265 GSW
Change-Id: I5d8d395616f284bc74c8b9448cfa347164b5a668
diff --git a/mbtk/include/gsw/gsw_data.h b/mbtk/include/gsw/gsw_data.h
new file mode 100755
index 0000000..3449035
--- /dev/null
+++ b/mbtk/include/gsw/gsw_data.h
@@ -0,0 +1,167 @@
+#include <stdint.h>
+//gsw include
+
+
+#define GSW_HAL_SUCCESS 0
+#define GSW_HAL_FAIL -1
+#define GSW_HAL_MEM_INVAILD -2
+#define GSW_NW_OPERATION_NAME_LEN 128
+#define GSW_NW_PLMN_LEN 6
+#define GSW_NW_MCC_LEN 3
+#define GSW_NW_MNC_LEN 3
+#define GSW_NW_PARA_MAX_LEN 128
+#define GSW_MCC_MAX_LEN 16
+#define GSW_MNC_MAX_LEN 16
+#define GSW_APN_CHANNEL_MAX 10
+#define GSW_POXY_ADDR_MAX_LEN 64
+#define GSW_PDP_TYPE_MAX_LEN 16
+#define GSW_APN_MAX_LEN 65
+#define GSW_APN_ID_MAX_LEN 32
+#define GSW_APN_TYPE_MAX_LEN 50
+#define GSW_USR_MAX_LEN 16
+#define GSW_PWD_MAX_LEN 16
+#define GSW_AUTH_TYPE_MAX_LEN 50
+#define GSW_PROTOCO_MAX_LEN 64
+#define GSW_CARRIER_ID_MAX_LEN 64
+#define GSW_IFACE_NAME_MAX_LEN 50
+#define GSW_PDP_ADDR_MAX_LEN 64
+#define GSW_DNS_ADDR_MAX_LEN 64
+#define GSW_GETWAYS_ADDR_MAX_LEN 64
+#define GSW_RSP_MAX_LEN 256
+
+typedef struct {
+ int handle; /**< data connection handle*/
+ int cid; /**< data connection cid*/
+ int state; /**< data connection state*/
+ int fail_cause; /**< data connection fail cause*/
+ char *type; /**< data connection type*/
+ char *ifname; /**< ifname*/
+
+ char *v4_ip; /**< ipv4 address*/
+ char *v4_pdns; /**< ipv4 pdns address*/
+ char *v4_sdns; /**< ipv4 sdns address*/
+ char *v4_gw; /**< ipv4 gateway address*/
+
+ char *v6_ip; /**< ipv6 address*/
+ char *v6_pdns; /**< ipv6 gateway address*/
+ char *v6_sdns; /**< ipv6 gateway address*/
+}Wan_State_ind_s;
+
+typedef struct {
+ char ip[GSW_PDP_ADDR_MAX_LEN]; /**< ip address */
+ char pdns[GSW_DNS_ADDR_MAX_LEN]; /**< pdns address*/
+ char sdns[GSW_DNS_ADDR_MAX_LEN]; /**< sdns address*/
+ char gw[GSW_GETWAYS_ADDR_MAX_LEN]; /**< gate way address*/
+}V4_Addr_s;
+
+typedef struct {
+ char ip[GSW_PDP_ADDR_MAX_LEN]; /**< ip address*/
+ char pdns[GSW_DNS_ADDR_MAX_LEN]; /**< pdns address*/
+ char sdns[GSW_DNS_ADDR_MAX_LEN]; /**< sdns address*/
+}V6_Addr_s;
+
+typedef struct {
+ int handle; /**< data connection handle*/
+
+ /* req info */
+ char mcc[GSW_MCC_MAX_LEN]; /**< apn mcc value*/
+ char mnc[GSW_MNC_MAX_LEN]; /**< apn mnc value*/
+ char apnid[GSW_APN_ID_MAX_LEN]; /**< apn id*/
+ char apn[GSW_APN_MAX_LEN]; /**< apn name*/
+ char apnType[GSW_APN_TYPE_MAX_LEN]; /**< apn type ipv4 ipv4v6 ipv6*/
+ char usr[GSW_USR_MAX_LEN]; /**< apn usr name*/
+ char pwd[GSW_PWD_MAX_LEN]; /**< apn password*/
+ char authType[GSW_AUTH_TYPE_MAX_LEN]; /**< apn auth type*/
+ char normalProtocol[GSW_PROTOCO_MAX_LEN]; /**< apn auth protoco*/
+ char roamingProtocol[GSW_PROTOCO_MAX_LEN]; /**< apn auth protoco roaming*/
+ char carrier[GSW_CARRIER_ID_MAX_LEN]; /**< carrier id*/
+
+ /* rsp */
+ int cid; /**< data connection cid for mdm sdk*/
+ int active; /**< pdn context active state: 2,actived; other,not active */
+ char ifname[GSW_IFACE_NAME_MAX_LEN]; /**< if name of current datalink */
+ int type; /**< data connection type*/
+ V4_Addr_s v4; /**< ipv4 addr*/
+ V6_Addr_s v6; /**< ipv6 addr*/
+ int mtu; /**< mtu value*/
+
+ char out[GSW_RSP_MAX_LEN]; /**< sdk return value*/
+}Link_Info_s;
+
+typedef struct
+{
+ uint64_t tx_pkts; /* the number of packet sent*/
+ uint64_t tx_bytes; /* the number of packet sent bytes */
+ uint64_t tx_dropped_pkts; /* the number of packet dropped by sent*/
+ uint64_t rx_pkts; /* the number of packet received*/
+ uint64_t rx_bytes; /* the number of packet receivedbytes */
+ uint64_t rx_dropped_pkts; /* the number of packet dropped by received*/
+}gsw_data_pkt_stats;
+
+
+typedef void (*gsw_data_call_evt_cb_t)(Wan_State_ind_s *linkState);
+
+/**
+ * @brief datacall sdk init
+ * @param [in] evt_cb callback function for data connection state change event
+ * call back;
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_data_call_init(gsw_data_call_evt_cb_t evt_cb);
+
+
+/**
+ * @brief data_call sdk deinit
+ * @param
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_data_call_deinit(void);
+
+/**
+ * @brief set apn parameters for data call
+ * @param [in/out] LinkInf apn info for pub or private datacall
+ * inlcude apn name mcc mnc, passwork apnid type cid etc
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_data_call_set_apn(Link_Info_s *LinkInf);
+
+
+/**
+ * @brief set apn parameters for data call
+ * @param [in] linkid data connetion link number
+ * @param [in/out] LinkInf link info req: apn info for pub or private datacall
+ * inlcude apn name mcc mnc, passwork apnid etc
+ * resp: data call link state ipaddress type etc
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_data_call_connect(int linkid, Link_Info_s *LinkInf);
+
+
+/**
+ * @brief set apn parameters for data call
+ * @param [in] linkid
+ * @param [in/out] LinkInf link info req: apn info for pub or private datacall
+ * inlcude apn name mcc mnc, passwork apnid etc
+ * resp: data call link state ipaddress type etc
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_data_call_disconnect(int linkid, Link_Info_s *LinkInf);
+
+
+
+/*
+ * @brief get mobile operator name
+ @param [in] linkid apn id
+ @param [out] data_pkt obtian actual data call network card data traffic
+ @retval 0: success
+ @retval 0: other: fail
+ */
+int gsw_get_data_call_pkt_stats(int linkid, gsw_data_pkt_stats *data_pkt);
+
+
+
diff --git a/mbtk/include/gsw/gsw_ecall.h b/mbtk/include/gsw/gsw_ecall.h
new file mode 100755
index 0000000..914ded0
--- /dev/null
+++ b/mbtk/include/gsw/gsw_ecall.h
@@ -0,0 +1,257 @@
+
+
+#define GSW_HAL_SUCCESS 0
+#define GSW_HAL_FAIL -1
+#define GSW_HAL_MEM_INVAILD -2
+
+#define GSW_EU_ECALL_MAX_MSD 140
+#define GSW_EU_ECALL_MAX_PHONE_NUMBER 82
+
+typedef enum
+{
+ GSW_EU_ECALL_TYPE_TEST = 1,
+ GSW_EU_ECALL_TYPE_EMERGENCY = 2,
+ GSW_EU_ECALL_TYPE_RECONFIG = 3,
+} gsw_eu_ecall_type_e;
+
+typedef struct
+{
+ uint32_t msd_len;
+ uint8_t msd[GSW_EU_ECALL_MAX_MSD];
+ gsw_eu_ecall_type_e type;
+ int32_t auto_trigger;
+ char ecall_number[GSW_EU_ECALL_MAX_PHONE_NUMBER];
+} gsw_eu_ecall_info_t;
+
+
+
+typedef enum {
+ GSW_EU_ECALL_STATE_NONE = -1,
+ GSW_EU_ECALL_STATE_INACTIVE = 0,
+ GSW_EU_ECALL_STATE_ORIGINATING_CALL = 1,
+ GSW_EU_ECALL_STATE_IN_CALL_TRANSMITTING = 2,
+ GSW_EU_ECALL_STATE_WAITING_FOR_AL_ACK = 3,
+ GSW_EU_ECALL_STATE_IN_CALL = 4,
+ GSW_EU_ECALL_STATE_IDLE_ALLOW_MT_ECALL = 5,
+} gsw_eu_ecall_state_e;
+
+typedef enum {
+ GSW_EU_ECALL_MODE_NORMAL = 0,
+ GSW_EU_ECALL_MODE_ONLY = 1,
+ GSW_EU_ECALL_MODE_DEFAULT = 2,
+} gsw_eu_ecall_mode_e;
+
+
+typedef struct
+{
+ uint8_t enable;
+ uint8_t voice_mute;
+ gsw_eu_ecall_mode_e mode;
+ uint8_t report_event;
+ uint16_t start_timer;
+ uint16_t hack_timer;
+ uint16_t trans_timer;
+ uint8_t fail_redial;
+ uint8_t drop_redial;
+ uint16_t cleardown_timer;
+ uint16_t init_timer;
+ uint16_t nad_reg_timer;
+ uint16_t nad_dereg_timer;
+ uint8_t standard;
+ uint16_t era_glonass_redial;
+ uint16_t auto_answer; //auto_answer
+} gsw_eu_ecall_config_t;
+
+typedef enum {
+ GSW_EU_ECALL_CONFIG_ENABLE = (1 << 0),
+ GSW_EU_ECALL_CONFIG_VOICE_MUTE = (1 << 1),
+ GSW_EU_ECALL_CONFIG_MODE = (1 << 2),
+ GSW_EU_ECALL_CONFIG_REPORT_EVENT = (1 << 3),
+ GSW_EU_ECALL_CONFIG_START_TIMER = (1 << 4),
+ GSW_EU_ECALL_CONFIG_HACK_TIMER = (1 << 5),
+ GSW_EU_ECALL_CONFIG_TRANS_TIMER = (1 << 6),
+ GSW_EU_ECALL_CONFIG_FAIL_REDIAL = (1 << 7),
+ GSW_EU_ECALL_CONFIG_DROP_REDIAL = (1 << 8),
+ GSW_EU_ECALL_CONFIG_CLEARDOWN_TIMER = (1 << 9),
+ GSW_EU_ECALL_CONFIG_INIT_TIMER = (1 << 10),
+ GSW_EU_ECALL_CONFIG_NAD_REG_TIMER = (1 << 11),
+ GSW_EU_ECALL_CONFIG_NAD_DEREG_TIMER = (1 << 12),
+ GSW_EU_ECALL_CONFIG_STANDARD = (1 << 13),
+ GSW_EU_ECALL_CONFIG_ERA_GLONASS_REDIAL = (1 << 14),
+ GSW_EU_ECALL_CONFIG_AUTO_ANSWER = (1 << 15),
+} gsw_eu_ecall_config_e;
+
+typedef enum {
+ GSW_EU_ECALL_EVENT_FAIL_NONE = 0,
+ GSW_EU_ECALL_EVENT_FAIL_TIMEOUT = 1,
+ GSW_EU_ECALL_EVENT_FAIL_HACK_TIMEOUT = 2,
+ GSW_EU_ECALL_EVENT_FAIL_MSD_TRANS_TIMEOUT = 3,
+ GSW_EU_ECALL_EVENT_FAIL_IVS_RESET_TIMEOUT = 4,
+ GSW_EU_ECALL_EVENT_FAIL_CLEAR_DOWN_FALLBACK_TIMEOUT = 5,
+ GSW_EU_ECALL_EVENT_FAIL_IVS_INITIATION_TIMEOUT = 6,
+} gsw_eu_ecall_event_fail_e;
+
+typedef enum {
+ GSW_EU_ECALL_EVENT_PROCESS_IVS_NONE = 0,
+ GSW_EU_ECALL_EVENT_PROCESS_IVS_START_RECEIVED_MSD = 1,
+ GSW_EU_ECALL_EVENT_PROCESS_IVS_NACK_RECEIVED = 2,
+ GSW_EU_ECALL_EVENT_PROCESS_IVS_ACK_RECEIVED = 3,
+ GSW_EU_ECALL_EVENT_PROCESS_IVS_TX_COMPLETED = 4,
+ GSW_EU_ECALL_EVENT_PROCESS_IVS_HLACK_RECEIVED = 5,
+} gsw_eu_ecall_event_process_e;
+
+typedef enum {
+ GSW_EU_ECALL_EVENT_MSDUPADTE_NONE = -1,
+ GSW_EU_ECALL_EVENT_MSDUPDATE_IVS_UPDATING_MSD = 0,
+ GSW_EU_ECALL_EVENT_MSDUPDATE_PSAP_REQURE_UPDATE_MSD = 1,
+ GSW_EU_ECALL_EVENT_MSDUPDATE_IVS_UPDATE_MSD_TIMEOUT = 2,
+} gsw_eu_ecall_event_msdupdate_e;
+
+typedef enum {
+ GSW_EU_ECALL_EVENT_ESTABLISH_NONE = -1,
+ GSW_EU_ECALL_EVENT_ESTABLISH_SUCCESS = 0,
+ GSW_EU_ECALL_EVENT_ESTABLISH_FAIL = 1,
+} gsw_eu_ecall_event_establish_e;
+
+typedef enum {
+ GSW_EU_ECALL_EVENT_EXTEND_STATE_NONE = -1,
+ GSW_EU_ECALL_EVENT_EXTEND_STATE_START_RECV_SYN = 0,
+ GSW_EU_ECALL_EVENT_EXTEND_STATE_T9_TIMEOUT = 1,
+ GSW_EU_ECALL_EVENT_EXTEND_STATE_T10_TIMEOUT = 2,
+ GSW_EU_ECALL_EVENT_EXTEND_STATE_IVS_ALACK_RECEIVED = 3,
+ GSW_EU_ECALL_EVENT_EXTEND_STATE_IVS_LLACK_RECEIVED = 4,
+ GSW_EU_ECALL_EVENT_EXTEND_STATE_STOPPED = 5,
+ GSW_EU_ECALL_EVENT_EXTEND_STATE_ANSWERING_INCOMING_PSAP_ECALL = 6,
+ GSW_EU_ECALL_EVENT_EXTEND_STATE_CLEARDOWN_RECEIVED = 7,
+ GSW_EU_ECALL_EVENT_EXTEND_STATE_CALLBACK_TIMEOUT = 8,
+ GSW_EU_ECALL_EVENT_IVS_NORMAL_CLEARING = 9,
+ GSW_EU_ECALL_EVENT_IVS_ABNORMAL_CLEARING = 10,
+} gsw_eu_ecall_event_extend_state_e;
+
+typedef struct
+{
+ uint8_t ori_remainder_times;
+ uint16_t time;
+} gsw_eu_ecall_event_originate_fail_redial_t;
+
+typedef struct
+{
+ uint8_t drop_remainder_times;
+ uint16_t time; /* The minimum time duration between the previous call attempt */
+} gsw_eu_ecall_event_drop_redial_t;
+
+
+typedef struct
+{
+ gsw_eu_ecall_event_fail_e fail;
+ gsw_eu_ecall_event_process_e process;
+ gsw_eu_ecall_event_msdupdate_e msdupdate;
+ gsw_eu_ecall_event_establish_e establish;
+ uint16_t hack_code;
+ gsw_eu_ecall_event_originate_fail_redial_t ori_redial;
+ gsw_eu_ecall_event_drop_redial_t drop_redial;
+ gsw_eu_ecall_event_extend_state_e extend_state;
+} gsw_eu_ecall_event_t;
+
+typedef void (*gsw_eu_ecall_event_cb_f)(gsw_eu_ecall_event_t *p_event);
+
+
+typedef enum {
+ GSW_EU_ECALL_MSD_TRANS_STATUS_NONE = -1,
+ GSW_EU_ECALL_MSD_TRANS_STATUS_SUCCESS = 0,
+ GSW_EU_ECALL_MSD_TRANS_STATUS_FAILURE = 1,
+} gsw_eu_ecall_msd_trans_status_e;
+
+typedef void (*gsw_eu_ecall_status_cb_f)(uint32_t id, gsw_eu_ecall_msd_trans_status_e status);
+
+
+/**
+* @brief init the Europe Ecall voice
+* @param [in] None
+* @param [out] None
+* @retval GSW_HAL_SUCCESS\GSW_HAL_FAIL
+*/
+int32_t gsw_eu_ecall_voice_init(void);
+
+/**
+* @brief deinit the Europe Ecall voice
+* @param [in] None
+* @param [out] None
+* @retval GSW_HAL_SUCCESS\GSW_HAL_FAIL
+*/
+int32_t gsw_eu_ecall_voice_deinit(void);
+
+/**
+* @brief start a Europe Ecall
+* @param [in] gsw_eu_ecall_info_t *p_info: ecall info
+* @param [out] None
+* @retval GSW_HAL_SUCCESS\GSW_HAL_FAIL
+*/
+int32_t gsw_eu_ecall_start(gsw_eu_ecall_info_t *p_info);
+
+/**
+* @brief hangup a Europe Ecall
+* @param [in] None
+* @param [out] None
+* @retval GSW_HAL_SUCCESS\GSW_HAL_FAIL
+*/
+int32_t gsw_eu_ecall_hangup(void);
+
+/**
+* @brief update msd data
+* @param [in] uint8_t *msd: msd data
+* @param [in] uint32_t msd_len: msd data length
+* @param [out] None
+* @retval GSW_HAL_SUCCESS\GSW_HAL_FAIL
+*/
+int32_t gsw_eu_ecall_updateMsd(const uint8_t *msd, uint32_t msd_len);
+
+/**
+* @brief using push mode send msd data
+* @param [in] GSW_EU_ECALL_STATE_E state: ecall state
+* @param [out] None
+* @retval GSW_HAL_SUCCESS\GSW_HAL_FAIL
+*/
+int32_t gsw_eu_ecall_pushMsd(gsw_eu_ecall_state_e state);
+
+/**
+* @brief get ecall config
+* @param [in] None
+* @param [out] gsw_eu_ecall_config_t *p_config: ecall config
+* @retval GSW_HAL_SUCCESS\GSW_HAL_FAIL
+*/
+int32_t gsw_eu_ecall_getConfig(gsw_eu_ecall_config_t *p_config);
+
+/**
+* @brief set ecall config
+* @param [in] int32_t item: config item
+* @param [in] gsw_eu_ecall_config_t *p_config: config info
+* @param [out] None
+* @retval GSW_HAL_SUCCESS\GSW_HAL_FAIL
+*/
+int32_t gsw_eu_ecall_setConfig(int32_t item, gsw_eu_ecall_config_t *p_config);
+
+/**
+* @brief register the ecall event callback
+* @param [in] gsw_eu_ecall_event_cb_f cb: callback
+* @param [out] None
+* @retval GSW_HAL_SUCCESS\GSW_HAL_FAIL
+*/
+int32_t gsw_eu_ecall_setEventCB(gsw_eu_ecall_event_cb_f cb);
+
+/**
+* @brief register the ecall status callback
+* @p:callback
+* @param [out] None
+* @retval GSW_HAL_SUCCESS\GSW_HAL_FAIL
+*/
+int32_t gsw_eu_ecall_setStatusCB(gsw_eu_ecall_status_cb_f cb);
+
+
+
+
+
+
+
+
+
diff --git a/mbtk/include/gsw/gsw_gnss.h b/mbtk/include/gsw/gsw_gnss.h
index 90508f6..a8acd4d 100755
--- a/mbtk/include/gsw/gsw_gnss.h
+++ b/mbtk/include/gsw/gsw_gnss.h
@@ -19,29 +19,25 @@
GSW_FREQ_2HZ = 2, /**< 2hZ */
GSW_FREQ_5HZ = 5, /**< 5hZ */
GSW_FREQ_10HZ = 10, /**< 10hZ */
-}GSW_FREQ_TYPE_T;
-
+}gnss_freq_type;
typedef enum{
- GSW_MODE_GPS = 1, /**< GPS only */
- GSW_MODE_BEIDOU, /**< BEIDOU only*/
+ GSW_MODE_GPS_GLONASS = 0, /**< GPS+GLONASS */
GSW_MODE_GPS_BEIDOU, /**< GPS+BEIDOU */
- GSW_MODE_GLONASS, /**< GLONASS only */ /* The high-tech platform does not support this type */
- GSW_MODE_GPS_GLONASS, /**< GPS+GLONASS */
- GSW_MODE_GLONASS_BEIDOU, /**< GLONASS+BEIDOU */ /* The high-tech platform does not support this type */
- GSW_MODE_GPS_GLONASS_BEIDOU, /**< GPS+GLONASS+BEIDOU */ /* The high-tech platform does not support this type */
- GSW_MODE_GALILEO, /**< GALILEO only */
- GSW_MODE_GPS_GALILEO, /**< GPS+GALILEO */
- GSW_MODE_BEIDOU_GALILEO, /**< BEIDOU+GALILEO */
- GSW_MODE_GPS_BEIDOU_GALILEO, /**< GPS+BEIDOU+GALILEO */
- GSW_MODE_GLONASS_GALILEO, /**< GLONASS+GALILEO */
- GSW_MODE_GPS_GLONASS_GALILEO, /**< GPS+GLONASS+GALILEO */
- GSW_MODE_BEIDOU_GLONASS_GALILEO, /**< BEIDOU+GLONASS+GALILEO */ /* The high-tech platform does not support this type */
+ GSW_MODE_GPS_GLONASS_BEIDOU, /**< GPS+GLONASS+BEIDOU */ /* The type does not support this type */
+ GSW_MODE_GPS, /**< GPS only */
+ GSW_MODE_BEIDOU, /**< BEIDOU only*/
+ GSW_MODE_GLONASS, /**< GLONASS only */
+ GSW_MODE_GPS_GLONASS_BEIDOU_GALILEO, /**< GPS+GLONASS+BEIDOU+GALILEO */ /* The type does not support this type */
+ GSW_MODE_GPS_GALILEO, /**< GPS+GALILEO */
+ GSW_MODE_GPS_GLONASS_GALILEO, /**< GPS+GLONASS+GALILEO */
+ GSW_MODE_GPS_GALILEO_ONLY, /**< GPS or GALILEO only */
+ GSW_MODE_GPS_GLONASS_BEIDOU_GALILEO_NAVIC, /**< GPS+GLONASS+BEIDOU+GALILEO+NAVIC */ /* The type does not support this type */
+ GSW_MODE_GNSS_END /**< init value */
}GSW_GNSS_MODE_CONFIGURATION;
-
typedef struct
{
/**< set to sizeof(GpsLocation) */
@@ -88,7 +84,7 @@
typedef struct{
GSW_GNSS_MODE_CONFIGURATION start_mode;
-GSW_FREQ_TYPE_T freq;
+gnss_freq_type freq;
gsw_gnss_cb callback;
}gsw_gnss_init_configure_t;
@@ -100,7 +96,7 @@
* @retval 0: success
* @retval other: fail
*/
-int32_t gsw_gnss_set_freq(int32_t freq);
+int gsw_gnss_set_freq(int freq);
/**
* @brief SDK interface to initialization gnss
@@ -108,7 +104,7 @@
* @retval 0: success
* @retval other: fail
*/
-int32_t gsw_gnss_init(void);
+int gsw_gnss_init(void);
/**
* @brief SDK interface to start gnss
@@ -116,7 +112,7 @@
* @retval 0: success
* @retval other: fail
*/
-int32_t gsw_gnss_start(void);
+int gsw_gnss_start(void);
/**
* @brief SDK interface to stop gnss
@@ -124,7 +120,7 @@
* @retval 0: success
* @retval other: fail
*/
-int32_t gsw_gnss_stop(void);
+int gsw_gnss_stop(void);
/**
* @brief SDK interface to de initialization gnss
@@ -132,7 +128,7 @@
* @retval 0: success
* @retval other: fail
*/
-int32_t gsw_gnss_deinit(void);
+int gsw_gnss_deinit(void);
/**
* @brief SDK interface to set gnss start mode,specific mode refreence GSW_HAL_GNSS_MODE_CONFIGURATION
@@ -140,7 +136,7 @@
* @retval 0: success
* @retval other: fail
*/
-int32_t gsw_gnss_set_start_mode(GSW_GNSS_MODE_CONFIGURATION start_mode);
+int gsw_gnss_set_start_mode(GSW_GNSS_MODE_CONFIGURATION start_mode);
/**
* @brief SDK interface to set EPO switch if open or close
@@ -148,7 +144,7 @@
* @retval 0: success
* @retval other: fail
*/
-int32_t gsw_gnss_epo_switch(GSW_GNSS_CONF_SWITCH switch_op); /* The high-tech platform does not support this type */
+int gsw_gnss_epo_switch(GSW_GNSS_CONF_SWITCH switch_op); /* The high-tech platform does not support this type */
/**
* @brief SDK interface to registered callback function
@@ -156,7 +152,7 @@
* @retval 0: success
* @retval other: fail
*/
-int32_t gsw_gnss_reg_cb_group(gsw_gnss_cb callback);
+int gsw_gnss_reg_cb_group(gsw_gnss_cb callback);
/**
* @brief SDK interface to enable XTRA switch
@@ -164,7 +160,7 @@
* @retval 0: success
* @retval other: fail
*/
-int32_t gsw_gnss_xtra_is_enable(gsw_xtra_state_e state);
+int gsw_gnss_xtra_is_enable(gsw_xtra_state_e state);
/**
* @brief SDK interface to delete aiding data,delete aiding data for cold start
@@ -172,7 +168,7 @@
* @retval 0: success
* @retval other: fail
*/
-int32_t gsw_gnss_delete_aiding_data(unsigned int flags);
+int gsw_gnss_delete_aiding_data(unsigned int flags);
/**
* @brief init and configure gps
@@ -180,5 +176,5 @@
* @retval 0: success
* @retval other: fail
*/
-int32_t gsw_gnss_init_configure_gps(gsw_gnss_init_configure_t init_configure);
+int gsw_gnss_init_configure_gps(gsw_gnss_init_configure_t init_configure);
diff --git a/mbtk/include/gsw/gsw_gpio.h b/mbtk/include/gsw/gsw_gpio.h
index e3737aa..d49cacc 100755
--- a/mbtk/include/gsw/gsw_gpio.h
+++ b/mbtk/include/gsw/gsw_gpio.h
@@ -28,7 +28,7 @@
* @param [in]gsw_hal_pinPullSel pullsel
* @retval GSW_HAL_SUCCESS\GSW_HAL_FAIL
*/
-int32_t gsw_gpio_Init(uint32_t gpioNum, gsw_hal_pinDirection dir, gsw_hal_pinLevel level);
+int32_t gsw_gpio_Init(uint32_t gpioNum, gsw_hal_pinDirection dir, gsw_hal_pinLevel level, gsw_hal_pinPullSel pullsel);
/**
diff --git a/mbtk/include/gsw/gsw_hal_errcode.h b/mbtk/include/gsw/gsw_hal_errcode.h
new file mode 100755
index 0000000..7eafd24
--- /dev/null
+++ b/mbtk/include/gsw/gsw_hal_errcode.h
@@ -0,0 +1,222 @@
+/**
+* @file : gsw_hal_errcode.h
+* @brief : common hal error code
+* @date : 2022-07-05
+* @author : Wind
+* @version : v1.0
+* @copyright Copyright(C) 2022,Geely
+*/
+#ifndef __GSW_HAL_ERRCODE__H__
+#define __GSW_HAL_ERRCODE__H__
+#include <stdint.h>
+
+#define GSW_HAL_SUCCESS (0x0000)
+
+//common error code
+#define GSW_HAL_NORMAL_FAIL (-0x0001)
+#define GSW_HAL_FUNC_UNSUPPORT (-0x0002)
+
+#define GSW_HAL_ARG_INVALID (-0x0011)
+#define GSW_HAL_NO_MEMORY (-0x0012)
+
+//GPIO
+
+//AT
+
+//GNSS
+#define GSW_HAL_GNSS_SUCCESS GSW_HAL_SUCCESS
+#define GSW_HAL_ERROR_GNSS_BASE (-0x0200) /**< Base value for GNSS errors. */
+#define GSW_HAL_ERROR_GNSS_FAIL (-0x0201) /**< Generic failure. */
+#define GSW_HAL_ERROR_GNSS_MCM_SERVICES_NOT_AVAILABLE (-0x0202) /**< MCM services not available. */
+#define GSW_HAL_ERROR_GNSS_GENERIC (-0x0203) /**< Generic error. */
+#define GSW_HAL_ERROR_GNSS_BADPARM (-0x0204) /**< Bad parameter. */
+#define GSW_HAL_ERROR_GNSS_MEMORY (-0x0205) /**< Memory error. */
+#define GSW_HAL_ERROR_GNSS_INVALID_STATE (-0x0206) /**< Invalid state. */
+#define GSW_HAL_ERROR_GNSS_MALFORMED_MSG (-0x0207) /**< Malformed message. */
+#define GSW_HAL_ERROR_GNSS_NO_MEMORY (-0x0208) /**< No memory. */
+#define GSW_HAL_ERROR_GNSS_INTERNAL (-0x0209) /**< Internal error. */
+#define GSW_HAL_ERROR_GNSS_ABORTED (-0x020a) /**< Action was aborted. */
+#define GSW_HAL_ERROR_GNSS_CLIENT_IDS_EXHAUSTED (-0x020b) /**< Client IDs have been exhausted. */
+#define GSW_HAL_ERROR_GNSS_UNABORTABLE_TRANSACTION (-0x020c) /**< Unabortable transaction. */
+#define GSW_HAL_ERROR_GNSS_INVALID_CLIENT_ID (-0x020d) /**< Invalid client ID. */
+#define GSW_HAL_ERROR_GNSS_NO_THRESHOLDS (-0x020e) /**< No thresholds. */
+#define GSW_HAL_ERROR_GNSS_INVALID_HANDLE (-0x020f) /**< Invalid handle. */
+#define GSW_HAL_ERROR_GNSS_INVALID_PROFILE (-0x0210) /**< Invalid profile. */
+#define GSW_HAL_ERROR_GNSS_INVALID_PINID (-0x0211) /**< Invalid PIN ID. */
+#define GSW_HAL_ERROR_GNSS_INCORRECT_PIN (-0x0212) /**< Incorrect PIN. */
+#define GSW_HAL_ERROR_GNSS_NO_NETWORK_FOUND (-0x0213) /**< No network found. */
+#define GSW_HAL_ERROR_GNSS_CALL_FAILED (-0x0214) /**< Call failed. */
+#define GSW_HAL_ERROR_GNSS_OUT_OF_CALL (-0x0215) /**< Out of call. */
+#define GSW_HAL_ERROR_GNSS_NOT_PROVISIONED (-0x0216) /**< Not provisioned. */
+#define GSW_HAL_ERROR_GNSS_MISSING_ARG (-0x0217) /**< Missing argument. */
+#define GSW_HAL_ERROR_GNSS_ARG_TOO_LONG (-0x0218) /**< Argument is too long. */
+#define GSW_HAL_ERROR_GNSS_INVALID_TX_ID (-0x0219) /**< Invalid Tx ID. */
+#define GSW_HAL_ERROR_GNSS_DEVICE_IN_USE (-0x021a) /**< Device is in use. */
+#define GSW_HAL_ERROR_GNSS_OP_NETWORK_UNSUPPORTED (-0x021b) /**< OP network is not supported. */
+#define GSW_HAL_ERROR_GNSS_OP_DEVICE_UNSUPPORTED (-0x021c) /**< OP device is not supported. */
+#define GSW_HAL_ERROR_GNSS_NO_EFFECT (-0x021d) /**< No effect. */
+#define GSW_HAL_ERROR_GNSS_NO_FREE_PROFILE (-0x021e) /**< No free profile. */
+#define GSW_HAL_ERROR_GNSS_INVALID_PDP_TYPE (-0x021f) /**< Invalid PDP type. */
+#define GSW_HAL_ERROR_GNSS_INVALID_TECH_PREF (-0x0220) /**< Invalid technical preference. */
+#define GSW_HAL_ERROR_GNSS_INVALID_PROFILE_TYPE (-0x0221) /**< Invalid profile type. */
+#define GSW_HAL_ERROR_GNSS_INVALID_SERVICE_TYPE (-0x0222) /**< Invalid service type. */
+#define GSW_HAL_ERROR_GNSS_INVALID_REGISTER_ACTION (-0x0223) /**< Invalid register action. */
+#define GSW_HAL_ERROR_GNSS_INVALID_PS_ATTACH_ACTION (-0x0224) /**< Invalid PS attach action. */
+#define GSW_HAL_ERROR_GNSS_AUTHENTICATION_FAILED (-0x0225) /**< Authentication failed. */
+#define GSW_HAL_ERROR_GNSS_PIN_BLOCKED (-0x0226) /**< PIN is blocked. */
+#define GSW_HAL_ERROR_GNSS_PIN_PERM_BLOCKED (-0x0227) /**< PIN is permanently blocked. */
+#define GSW_HAL_ERROR_GNSS_SIM_NOT_INITIALIZED (-0x0228) /**< SIM is not initialized. */
+#define GSW_HAL_ERROR_GNSS_MAX_QOS_REQUESTS_IN_USE (-0x0229) /**< Maximum QoS requests are in use. */
+#define GSW_HAL_ERROR_GNSS_INCORRECT_FLOW_FILTER (-0x022a) /**< Incorrect flow filter. */
+#define GSW_HAL_ERROR_GNSS_NETWORK_QOS_UNAWARE (-0x022b) /**< Network QoS is unaware. */
+#define GSW_HAL_ERROR_GNSS_INVALID_ID (-0x022c) /**< Invalid ID. */
+#define GSW_HAL_ERROR_GNSS_INVALID_QOS_ID (-0x022d) /**< Invalid QoS ID. */
+#define GSW_HAL_ERROR_GNSS_REQUESTED_NUM_UNSUPPORTED (-0x022e) /**< Requested number is not supported. */
+#define GSW_HAL_ERROR_GNSS_INTERFACE_NOT_FOUND (-0x022f) /**< Interface was not found. */
+#define GSW_HAL_ERROR_GNSS_FLOW_SUSPENDED (-0x0230) /**< Flow is suspended. */
+#define GSW_HAL_ERROR_GNSS_INVALID_DATA_FORMAT (-0x0231) /**< Invalid data format. */
+#define GSW_HAL_ERROR_GNSS_GENERAL (-0x0232) /**< General error. */
+#define GSW_HAL_ERROR_GNSS_UNKNOWN (-0x0233) /**< Unknown error. */
+#define GSW_HAL_ERROR_GNSS_INVALID_ARG (-0x0234) /**< Invalid argument. */
+#define GSW_HAL_ERROR_GNSS_INVALID_INDEX (-0x0235) /**< Invalid index. */
+#define GSW_HAL_ERROR_GNSS_GET_DIALED_INFO (-0x0236) /**< NO dialed. */
+#define GSW_HAL_ERROR_GNSS_GET_APN (-0x0237) /**< Get apn fail. */
+#define GSW_HAL_ERROR_GNSS_DATA_CALL_DISCONNECT (-0x0238) /**< Disconnect data-call. */
+#define GSW_HAL_ERROR_GNSS_DATA_CALL_DEINIT (-0x0239) /**< Deinit data-call. */
+#define GSW_HAL_ERROR_GNSS_REPEAT_DATA_CALL (-0x023a) /**< Repeat data-call. */
+#define GSW_HAL_ERROR_GNSS_API_UNSUPPORTED (-0x023b) /**< GNSS api interface unsupport. */
+#define GSW_HAL_ERROR_GNSS_NOT_INITIALIZED (-0x023c) /**< GNSS not inited. */
+#define GSW_HAL_ERROR_GNSS_INVALID_REQUEST (-0x023d) /**< Invalid request. */
+#define GSW_HAL_ERROR_GNSS_XTRA_TIME_UPFATE_FAIL (-0x023e) /**< xtra time update fail. */
+#define GSW_HAL_ERROR_GNSS_XTRA_FILE_DOWNLOAD_FAIL (-0x023f) /**< xtra file download fail. */
+#define GSW_HAL_ERROR_GNSS_XTRA_INJECT_DATA_FAIL (-0x0240) /**< xtra data inject fail. */
+#define GSW_HAL_ERROR_GNSS_XTRA_DATA_CALL_DISABLE_FAIL (-0x0241) /**< data call disable fail. */
+
+//PIN
+
+//NW
+
+//OTA
+#define GSW_HAL_ERROR_OTA_BASE (-0x0300)
+#define GSW_HAL_ERROR_OTA_FAIL (-0x0301)
+#define GSW_HAL_ERROR_OTA_TIMEOUT (-0x0302) /**< ota install timeout */
+#define GSW_HAL_ERROR_OTA_INPROCESS (-0x0303) /**< ota install in process */
+#define GSW_HAL_ERROR_OTA_NO_TASK (-0x0304) /**< ota install no task */
+
+//PM
+
+//VOICE
+
+//WIFI
+#define GSW_HAL_WIFI_API_SUCCESS GSW_HAL_SUCCESS /**< Success. */
+#define GSW_HAL_ERROR_WIFI_API_BASE (-0x0400)
+#define GSW_HAL_ERROR_WIFI_API_FAIL (-0x0401)
+#define GSW_HAL_ERROR_WIFI_API_ERROR_MCM_SERVICES_NOT_AVAILABLE (-0x0402) /**< MCM services not available. */
+#define GSW_HAL_ERROR_WIFI_API_ERROR_GENERIC (-0x0403) /**< Generic error. */
+#define GSW_HAL_ERROR_WIFI_API_ERROR_BADPARM (-0x0404) /**< Bad parameter. */
+#define GSW_HAL_ERROR_WIFI_API_ERROR_MEMORY (-0x0405) /**< Memory error. */
+#define GSW_HAL_ERROR_WIFI_API_ERROR_INVALID_STATE (-0x0406) /**< Invalid state. */
+#define GSW_HAL_ERROR_WIFI_API_ERROR_MALFORMED_MSG (-0x0407) /**< Malformed message. */
+#define GSW_HAL_ERROR_WIFI_API_ERROR_NO_MEMORY (-0x0408) /**< No memory. */
+#define GSW_HAL_ERROR_WIFI_API_ERROR_INTERNAL (-0x0409) /**< Internal error. */
+#define GSW_HAL_ERROR_WIFI_API_ERROR_ABORTED (-0x040a) /**< Action was aborted. */
+#define GSW_HAL_ERROR_WIFI_API_ERROR_CLIENT_IDS_EXHAUSTED (-0x040b) /**< Client IDs have been exhausted. */
+#define GSW_HAL_ERROR_WIFI_API_ERROR_UNABORTABLE_TRANSACTION (-0x040c) /**< Unabortable transaction. */
+#define GSW_HAL_ERROR_WIFI_API_ERROR_INVALID_CLIENT_ID (-0x040d) /**< Invalid client ID. */
+#define GSW_HAL_ERROR_WIFI_API_ERROR_NO_THRESHOLDS (-0x040e) /**< No thresholds. */
+#define GSW_HAL_ERROR_WIFI_API_ERROR_INVALID_HANDLE (-0x040f) /**< Invalid handle. */
+#define GSW_HAL_ERROR_WIFI_API_ERROR_INVALID_PROFILE (-0x0410) /**< Invalid profile. */
+#define GSW_HAL_ERROR_WIFI_API_ERROR_INVALID_PINID (-0x0411) /**< Invalid PIN ID. */
+#define GSW_HAL_ERROR_WIFI_API_ERROR_INCORRECT_PIN (-0x0412) /**< Incorrect PIN. */
+#define GSW_HAL_ERROR_WIFI_API_ERROR_NO_NETWORK_FOUND (-0x0413) /**< No network found. */
+#define GSW_HAL_ERROR_WIFI_API_ERROR_CALL_FAILED (-0x0414) /**< Call failed. */
+#define GSW_HAL_ERROR_WIFI_API_ERROR_OUT_OF_CALL (-0x0415) /**< Out of call. */
+#define GSW_HAL_ERROR_WIFI_API_ERROR_NOT_PROVISIONED (-0x0416) /**< Not provisioned. */
+#define GSW_HAL_ERROR_WIFI_API_ERROR_MISSING_ARG (-0x0417) /**< Missing argument. */
+#define GSW_HAL_ERROR_WIFI_API_ERROR_ARG_TOO_LONG (-0x0418) /**< Argument is too long. */
+#define GSW_HAL_ERROR_WIFI_API_ERROR_INVALID_TX_ID (-0x0419) /**< Invalid Tx ID. */
+#define GSW_HAL_ERROR_WIFI_API_ERROR_DEVICE_IN_USE (-0x041a) /**< Device is in use. */
+#define GSW_HAL_ERROR_WIFI_API_ERROR_OP_NETWORK_UNSUPPORTED (-0x041b) /**< OP network is not supported. */
+#define GSW_HAL_ERROR_WIFI_API_ERROR_OP_DEVICE_UNSUPPORTED (-0x041c) /**< OP device is not supported. */
+#define GSW_HAL_ERROR_WIFI_API_ERROR_NO_EFFECT (-0x041d) /**< No effect. */
+#define GSW_HAL_ERROR_WIFI_API_ERROR_NO_FREE_PROFILE (-0x041e) /**< No free profile. */
+#define GSW_HAL_ERROR_WIFI_API_ERROR_INVALID_PDP_TYPE (-0x041f) /**< Invalid PDP type. */
+#define GSW_HAL_ERROR_WIFI_API_ERROR_INVALID_TECH_PREF (-0x0420) /**< Invalid technical preference. */
+#define GSW_HAL_ERROR_WIFI_API_ERROR_INVALID_PROFILE_TYPE (-0x0421) /**< Invalid profile type. */
+#define GSW_HAL_ERROR_WIFI_API_ERROR_INVALID_SERVICE_TYPE (-0x0422) /**< Invalid service type. */
+#define GSW_HAL_ERROR_WIFI_API_ERROR_INVALID_REGISTER_ACTION (-0x0423) /**< Invalid register action. */
+#define GSW_HAL_ERROR_WIFI_API_ERROR_INVALID_PS_ATTACH_ACTION (-0x0424) /**< Invalid PS attach action. */
+#define GSW_HAL_ERROR_WIFI_API_ERROR_AUTHENTICATION_FAILED (-0x0425) /**< Authentication failed. */
+#define GSW_HAL_ERROR_WIFI_API_ERROR_PIN_BLOCKED (-0x0426) /**< PIN is blocked. */
+#define GSW_HAL_ERROR_WIFI_API_ERROR_PIN_PERM_BLOCKED (-0x0427) /**< PIN is permanently blocked. */
+#define GSW_HAL_ERROR_WIFI_API_ERROR_SIM_NOT_INITIALIZED (-0x0428) /**< SIM is not initialized. */
+#define GSW_HAL_ERROR_WIFI_API_ERROR_MAX_QOS_REQUESTS_IN_USE (-0x0429) /**< Maximum QoS requests are in use. */
+#define GSW_HAL_ERROR_WIFI_API_ERROR_INCORRECT_FLOW_FILTER (-0x042a) /**< Incorrect flow filter. */
+#define GSW_HAL_ERROR_WIFI_API_ERROR_NETWORK_QOS_UNAWARE (-0x042b) /**< Network QoS is unaware. */
+#define GSW_HAL_ERROR_WIFI_API_ERROR_INVALID_ID (-0x042c) /**< Invalid ID. */
+#define GSW_HAL_ERROR_WIFI_API_ERROR_INVALID_QOS_ID (-0x042d) /**< Invalid QoS ID. */
+#define GSW_HAL_ERROR_WIFI_API_ERROR_REQUESTED_NUM_UNSUPPORTED (-0x042e) /**< Requested number is not supported. */
+#define GSW_HAL_ERROR_WIFI_API_ERROR_INTERFACE_NOT_FOUND (-0x042f) /**< Interface was not found. */
+#define GSW_HAL_ERROR_WIFI_API_ERROR_FLOW_SUSPENDED (-0x0430) /**< Flow is suspended. */
+#define GSW_HAL_ERROR_WIFI_API_ERROR_INVALID_DATA_FORMAT (-0x0431) /**< Invalid data format. */
+#define GSW_HAL_ERROR_WIFI_API_ERROR_GENERAL (-0x0432) /**< General error. */
+#define GSW_HAL_ERROR_WIFI_API_ERROR_UNKNOWN (-0x0433) /**< Unknown error. */
+#define GSW_HAL_ERROR_WIFI_API_ERROR_INVALID_ARG (-0x0434) /**< Invalid argument. */
+#define GSW_HAL_ERROR_WIFI_API_ERROR_INVALID_INDEX (-0x0435) /**< Invalid index. */
+
+//Security
+#define GSW_HAL_ERROR_TEE_SUCCESS (GSW_HAL_SUCCESS) /** SUCCESS */
+#define GSW_HAL_ERROR_TEE_INIT_FAILED (-0x00700) /** INIT FALIED */
+#define GSW_HAL_ERROR_TEE_FAILED (-0x00701) /** FAILED */
+#define GSW_HAL_ERROR_TEE_HANDLE (-0x00702) /** Input/output pointer is null */
+#define GSW_HAL_ERROR_TEE_DATATYPE (-0x00703) /** The specified data type does not exist */
+#define GSW_HAL_ERROR_TEE_DATASIZE (-0x00704) /** Input data size exceeds the limit */
+#define GSW_HAL_ERROR_TEE_FILENAMESIZE (-0x00705) /** Input filename size exceeds the limit */
+#define GSW_HAL_ERROR_TEE_NOTSUPPORT (-0x00706) /** function not support */
+#define GSW_HAL_ERROR_TEE_SFS_WRITE (-0x00707) /** An error occurred while writing data to the security file*/
+#define GSW_HAL_ERROR_TEE_SFS_WRITESIZE (-0x00708) /** The actual write was not equal expected */
+#define GSW_HAL_ERROR_TEE_SFS_WRITE_LIMIT (-0x00709) /** The total memory of Secure file exceeds the limit */
+#define GSW_HAL_ERROR_TEE_SFS_READ (-0x0070a) /** An error occurred while reading data to the security file */
+#define GSW_HAL_ERROR_TEE_SFS_READSIZE (-0x0070b) /** The actual read was larger than expected */
+#define GSW_HAL_ERROR_TEE_SFS_FILE_NOEXIST (-0x0070c) /** Not found the secure file */
+#define GSW_HAL_ERROR_TEE_SFS_FILE_DELETE (-0x0070d) /** Failed to delete the file */
+#define GSW_HAL_ERROR_TEE_AES_KEYSIZE (-0x0070e) /** The specified AES key size is incorrect */
+#define GSW_HAL_ERROR_TEE_AES_IVSIZE (-0x0070f) /** The specified AES IV size is incorrect */
+#define GSW_HAL_ERROR_TEE_AES_MODE (-0x00710) /** The specified AES mode is incorrect */
+#define GSW_HAL_ERROR_TEE_AES_PADDING (-0x00711) /** The specified AES padding is incorrect */
+#define GSW_HAL_ERROR_TEE_AES_ENC (-0x00712) /** The specified AES encryption is incorrect */
+#define GSW_HAL_ERROR_TEE_AES_DEC (-0x00713) /** The specified AES decryption is incorrect */
+#define GSW_HAL_ERROR_TEE_AES_CMAC (-0x00714) /** The specified AES cmac is incorrect */
+#define GSW_HAL_ERROR_TEE_AES_IMP (-0x00715) /** The specified AES import is incorrect */
+#define GSW_HAL_ERROR_TEE_RSA_KEYSIZE (-0x00716) /** The specified RSA key size is incorrect */
+#define GSW_HAL_ERROR_TEE_RSA_EXP (-0x00717) /** The specified RSA exp is incorrect */
+#define GSW_HAL_ERROR_TEE_RSA_SHAID (-0x00718) /** The specified RSA sha mode is incorrect */
+#define GSW_HAL_ERROR_TEE_RSA_PADDING (-0x00719) /** The specified RSA padding is incorrect */
+#define GSW_HAL_ERROR_TEE_RSA_ENC (-0x0071a) /** The specified RSA encryption is incorrect */
+#define GSW_HAL_ERROR_TEE_RSA_DEC (-0x0071b) /** The specified RSA decryption is incorrect */
+#define GSW_HAL_ERROR_TEE_RSA_SIGN (-0x0071c) /** The specified RSA sign is incorrect */
+#define GSW_HAL_ERROR_TEE_RSA_VERIFY (-0x0071d) /** The specified RSA verify is incorrect */
+#define GSW_HAL_ERROR_TEE_RSA_IMP (-0x0071e) /** The specified RSA import is incorrect */
+#define GSW_HAL_ERROR_TEE_ECC_KEYSIZE (-0x0071f) /** The specified ECC key size is incorrect */
+#define GSW_HAL_ERROR_TEE_ECC_SHAID (-0x00720) /** The specified ECC sha mode is incorrect */
+#define GSW_HAL_ERROR_TEE_ECC_SIGN (-0x00721) /** The specified ECC sign is incorrect */
+#define GSW_HAL_ERROR_TEE_ECC_VERIFY (-0x00722) /** The specified ECC verify is incorrect */
+#define GSW_HAL_ERROR_TEE_ECC_IMP (-0x00723) /** The specified ECC import is incorrect */
+#define GSW_HAL_ERROR_TEE_SHA_ID (-0x00724) /** The specified SHA mode is incorrect */
+#define GSW_HAL_ERROR_TEE_SHA (-0x00725) /** The specified SHA is incorrect */
+#define GSW_HAL_ERROR_TEE_RANDOM (-0x00726) /** The specified RANDOM is incorrect */
+
+//file
+#define GSW_HAL_ERROR_FILE_BASE (-0x0500)
+#define GSW_HAL_ERROR_FILE_NONE (-0x0501)
+#define GSW_HAL_ERROR_FILE_POPEN (-0x0502)
+#define GSW_HAL_ERROR_FILE_OPEN (-0x0503)
+#define GSW_HAL_ERROR_FILE_WRITE (-0x0504)
+#define GSW_HAL_ERROR_FILE_READ (-0x0505)
+
+//uart
+#define GSW_HAL_ERROR_UART_BASE (-0x0600)
+#define GSW_HAL_ERROR_UART_ERROR (-0x0601)
+#define GSW_HAL_ERROR_UART_TIMEOUT (-0x0602)
+
+#endif
diff --git a/mbtk/include/gsw/gsw_nw.h b/mbtk/include/gsw/gsw_nw.h
new file mode 100755
index 0000000..7399146
--- /dev/null
+++ b/mbtk/include/gsw/gsw_nw.h
@@ -0,0 +1,762 @@
+#include <stdlib.h>
+#include <stdint.h>
+#include <string.h>
+#include <stdbool.h>
+#include <stdio.h>
+
+//gsw include
+#define GSW_HAL_SUCCESS 0
+#define GSW_HAL_FAIL -1
+#define GSW_HAL_MEM_INVAILD -2
+#define GSW_NW_OPERATION_NAME_LEN 128
+#define GSW_NW_PLMN_LEN 6
+#define GSW_NW_MCC_LEN 3
+#define GSW_NW_MNC_LEN 3
+#define GSW_NW_PARA_MAX_LEN 128
+#define GSW_MCC_MAX_LEN 16
+#define GSW_MNC_MAX_LEN 16
+#define GSW_APN_CHANNEL_MAX 10
+#define GSW_POXY_ADDR_MAX_LEN 64
+#define GSW_PDP_TYPE_MAX_LEN 16
+#define GSW_APN_MAX_LEN 65
+#define GSW_APN_ID_MAX_LEN 32
+#define GSW_APN_TYPE_MAX_LEN 50
+#define GSW_USR_MAX_LEN 16
+#define GSW_PWD_MAX_LEN 16
+#define GSW_AUTH_TYPE_MAX_LEN 50
+#define GSW_PROTOCO_MAX_LEN 64
+#define GSW_CARRIER_ID_MAX_LEN 64
+#define GSW_IFACE_NAME_MAX_LEN 50
+#define GSW_PDP_ADDR_MAX_LEN 64
+#define GSW_DNS_ADDR_MAX_LEN 64
+#define GSW_GETWAYS_ADDR_MAX_LEN 64
+#define GSW_RSP_MAX_LEN 256
+#define GSW_PLMN_LIST_MAX_LEN 64
+#define MAX_CELL_EXT_INFO (5)
+
+
+
+typedef enum service_domain
+{
+ GSW_SRV_DOMAIN_NO_SVC = 0x0, /**< no service */
+ GSW_SRV_DOMAIN_CS_ONLY = 0x1, /**< cs only */
+ GSW_SRV_DOMAIN_PS_ONLY = 0x2, /**< ps only */
+ GSW_SRV_DOMAIN_CS_PS = 0x3, /**< reg all in service */
+} GSW_SERVICE_DOMAIN_E;
+
+typedef enum gsw_network_reg_state
+{
+ GSW_NETWORK_REG_NOT_REGISTERED = 0x0, /**< no service */
+ GSW_NETWORK_REG_REGISTERED = 0x1, /**< reg in service home */
+ GSW_NETWORK_REG_NOT_REGISTERED_SEARCHING = 0x2, /**< searching network */
+ GSW_NETWORK_REG_REGISTRATION_DENIED = 0x3, /**< network denny device */
+ GSW_NETWORK_REG_REGISTRATION_UNKNOWN = 0x4, /**< unknown state */
+ GSW_NETWORK_REG_REGISTRATION_ROAMING = 0x5, /**< roaming state in service */
+ GSW_NETWORK_REG_LIMITED_SERVICE = 0x6, /**< limited service */
+} GSW_NW_REG_STATE_E;
+
+typedef enum gsw_network_radio_interface
+{
+ GSW_NETWORK_RADIO_NO_SVC = 0x0, /**< radio state no service */
+ GSW_NETWORK_RADIO_CDMA_1X = 0x1, /**< cdma 1x */
+ GSW_NETWORK_RADIO_CDMA_1XEVDO = 0x2, /**< cdma evdo */
+ GSW_NETWORK_RADIO_AMPS = 0x3, /**< amps gsm 2g*/
+ GSW_NETWORK_RADIO_GSM = 0x4, /**< gsm */
+ GSW_NETWORK_RADIO_UMTS = 0x5, /**< umts wcdma*/
+ GSW_NETWORK_RADIO_LTE = 0x6, /**< LTE 4G */
+ GSW_NETWORK_RADIO_TDSCDMA = 0x7, /**< TDS 3G*/
+ GSW_NETWORK_RADIO_NR5G = 0x8, /**< NR 5G*/
+} GSW_NW_RADIO_ACCESS_TECH_E;
+
+
+typedef enum gsw_network_roaming_state
+{
+ GSW_NETWORK_ROAMING_OFF = 0x0, /**< roaming off */
+ GSW_NETWORK_ROAMING_ON = 0x1, /**< roaming on*/
+} GSW_NW_ROAMING_STATE_E;
+
+typedef enum oprate_mode
+{
+ GSW_OP_MODE_LPM = 0, /**< radio state off*/
+ GSW_OP_MODE_ONLINE = 1, /**< radio state on*/
+ GSW_OP_MODE_FTM = 2, /**< radio state ftm*/
+ GSW_OP_MODE_OFFLINE = 3, /**< radio state offline*/
+} OPERATE_MODE_E;
+
+typedef enum prefer_mode
+{
+ GSW_PREFER_MODE_GSW = 1, /**<2G only*/
+ GSW_PREFER_MODE_WCDMA = 2, /**< 3G only*/
+ GSW_PREFER_MODE_WCDMA_GSM = 3, /**< 3G/2G*/
+ GSW_PREFER_MODE_LTE = 4, /**< 4G only*/
+ GSW_PREFER_MODE_NR5G = 5, /**< 5G only*/
+ GSW_PREFER_MODE_NR5G_LTE = 8, /**< 5G/4G*/
+ GSW_PREFER_MODE_LTE_WCDMA_GSM = 9, /**< 4G/3G/2G*/
+ GSW_PREFER_MODE_NR5G_LTE_WCDMA_GSM = 32, /**< 5G/4G/3G/2G*/
+} PREFER_MODE_E;
+
+typedef enum gsw_hal_nw_mode_state_type
+{
+ GSW_MODEM_STATE_UNKNOWN = 0,
+ GSW_MODEM_STATE_ONLINE,
+ GSW_MODEM_STATE_OFFLINE,
+ GSW_SDK_STATE_SERVICE_DOWN,
+ GSW_SDK_STATE_SERVICE_UP,// service down->up 需要routectl 重启
+ GSW_SDK_STATE_GPS_DOWN,
+ GSW_SDK_STATE_GPS_UP,
+} gsw_mode_state_e;
+
+
+typedef struct
+{
+ GSW_NW_RADIO_ACCESS_TECH_E rej_rat; /**< current network radio tech*/
+ GSW_SERVICE_DOMAIN_E rej_domain; /**< reject code from ps or cs*/
+ int rej_cause; /**< reject code number*/
+} GSW_NW_REJ_CAUSE_E;
+
+typedef struct
+{
+ int32_t gw_sig_valid; /**< 1 valid,1 invalid*/
+ int32_t rssi; /**< Valid values are (0-31, 99) as defined in TS 27.007 8.5 */
+ int32_t wcdma_sig_valid;/**< 1 valid,0 invalid*/
+ int32_t rscp; /**< The Received Signal Code Power in dBm multipled by -1.
+ * Range : 25 to 120
+ * INT_MAX: 0x7FFFFFFF denotes invalid value.
+ * Reference: 3GPP TS 25.123, section 9.1.1.1 */
+ int32_t ecno; /**< Valid values are positive integers. This value is the actual Ec/Io multiplied
+ * by -10. Example: If the actual Ec/Io is -12.5 dB, then this response value
+ * will be 125.*/
+ int32_t lte_sig_valid;/**< 1 valid,0 invalid*/
+ int32_t rsrp; /**< The current Reference Signal Receive Power in dBm multipled by -1.
+ * Range: 44 to 140 dBm
+ * INT_MAX: 0x7FFFFFFF denotes invalid value.
+ * Reference: 3GPP TS 36.133 9.1.4 */
+ int32_t rsrq; /**< The current Reference Signal Receive Quality in dB multiplied by -1.
+ * Range: 20 to 3 dB.
+ * INT_MAX: 0x7FFFFFFF denotes invalid value.
+ * Reference: 3GPP TS 36.133 9.1.7 */
+ int32_t rssnr; /**< The current reference signal signal-to-noise ratio in 0.1 dB units.
+ * Range: -200 to +300 (-200 = -20.0 dB, +300 = 30dB).
+ * INT_MAX : 0x7FFFFFFF denotes invalid value.
+ * Reference: 3GPP TS 36.101 8.1.1 */
+ int32_t nr_sig_valid;/**<1 valid,0 invalid*/
+ int32_t ssRsrp; /**< SS(Synchronization Signal) reference signal received power, multipled by -1.
+ * Reference: 3GPP TS 38.215.
+ * Range [44, 140], INT_MAX means invalid/unreported.*/
+ int32_t ssRsrq; /**< SS reference signal received quality, multipled by -1.
+ * Reference: 3GPP TS 38.215.
+ * Range [3, 20], INT_MAX means invalid/unreported.*/
+ int32_t ssSinr; /**< SS signal-to-noise and interference ratio.
+ * Reference: 3GPP TS 38.215 section 5.1.*, 3GPP TS 38.133 section 10.1.16.1.
+ * Range [-23, 40], INT_MAX means invalid/unreported.*/
+ int32_t csiRsrp; /**< CSI reference signal received power, multipled by -1.
+ * Reference: 3GPP TS 38.215.
+ * Range [44, 140], INT_MAX means invalid/unreported.*/
+ int32_t csiRsrq; /**< CSI reference signal received quality, multipled by -1.
+ * Reference: 3GPP TS 38.215.
+ * Range [3, 20], INT_MAX means invalid/unreported.*/
+ int32_t csiSinr; /**< CSI signal-to-noise and interference ratio.
+ * Reference: 3GPP TS 138.215 section 5.1.*, 3GPP TS 38.133 section 10.1.16.1.
+ * Range [-23, 40], INT_MAX means invalid/unreported.*/
+} signalStrength_t;
+
+typedef struct
+{
+ GSW_NW_REG_STATE_E reg_state; /**< network cs regstate*/
+ GSW_NW_REG_STATE_E ps_state; /**< network ps regstate*/
+ GSW_NW_RADIO_ACCESS_TECH_E reg_rat; /**< current radio state*/
+ GSW_SERVICE_DOMAIN_E srv_domain; /**< current cs or ps state*/
+ GSW_NW_ROAMING_STATE_E roaming_ind; /**< roaming state*/
+ char reg_plmn[GSW_NW_PLMN_LEN + 1]; /**< current cell plmn*/
+ char operator_name[GSW_NW_OPERATION_NAME_LEN + 1]; /**< operator name*/
+ char cell_id[128]; /**< cell id*/
+ char tac[128]; /**< cell tac*/
+ char lac[128]; /**< cell lac*/
+ int sid; /**< cell sid cdma*/
+ int nid; /**< cell nid cdma*/
+} GSW_NW_SERVING_INFO;
+
+
+typedef struct
+{
+ char long_eons[128]; /* Full name of the operator*/
+ char short_eons[128]; /* Shor name of the operator*/
+ char mcc[4]; /* Mobile country code*/
+ char mnc[4]; /* Mobile network code*/
+}gsw_mobile_operator_name;
+
+
+typedef struct
+{
+ unsigned char cell_id_valid;
+ unsigned char pci_valid;
+ unsigned char psc_valid;
+ unsigned char band_valid;
+ unsigned char arfcn_valid;
+ unsigned char rssi_valid;
+ unsigned char rsrp_valid;
+ unsigned char rsrq_valid;
+ unsigned char sinr_valid;
+ unsigned char rscp_valid;
+ unsigned char ecio_valid;
+ GSW_NW_RADIO_ACCESS_TECH_E rat;
+ unsigned int cell_id;
+ int pci;
+ int psc;
+ int band;
+ int arfcn;
+ int rssi;
+ int rsrp;
+ int rsrq;
+ int sinr;
+ int rscp;
+ int ecio;
+ char mcc[5];
+ char mnc[5];
+} GSW_NW_CELL_EXT_INFO;
+
+typedef struct
+{
+ GSW_NW_RADIO_ACCESS_TECH_E rat; /**< current radio state*/
+
+ unsigned char mcc_valid;
+ char mcc[5];
+
+ unsigned char mnc_valid;
+ char mnc[5];
+
+ unsigned char cell_id_valid;
+ unsigned int cell_id; /**< cell id*/
+
+ unsigned char pci_valid;
+ int pci; /**<physical cell id*/
+
+ unsigned char psc_valid;
+ int psc; /*wcdma primary scramble code*/
+
+ unsigned char nrarfcn_valid;
+ int nrarfcn; /*nr cell freq*/
+
+ unsigned char earfcn_valid;
+ int earfcn; /*lte cell freq*/
+
+ unsigned char uarfcn_valid;
+ int uarfcn; /*wcdma cell freq*/
+
+ unsigned char arfcn_valid;
+ int arfcn; /*gsw cell freq*/
+
+ unsigned char tac_valid;
+ unsigned int tac; /**< cell tac*/
+
+ unsigned char lac_valid;
+ unsigned int lac; /**< cell lac*/
+
+ unsigned char sid_valid;
+ int sid; /**< cell sid cdma*/
+
+ unsigned char nid_valid;
+ int nid; /**< cell nid cdma*/
+
+ unsigned char lteMode_valid;
+ int lteMode; /*tdd 0, fdd 1*/
+
+ unsigned char rssi_valid;
+ int rssi; /**< Valid values are (0-31, 99) as defined in TS 27.007 8.5 */
+
+ unsigned char rscp_valid;
+ int rscp; /**< The Received Signal Code Power in dBm multipled by -1.
+ * Range : 25 to 120
+ * INT_MAX: 0x7FFFFFFF denotes invalid value.
+ * Reference: 3GPP TS 25.123, section 9.1.1.1 */
+
+ unsigned char ecio_valid;
+ int ecio; /**< Valid values are positive integers. This value is the actual Ec/Io multiplied
+ * by -10. Example: If the actual Ec/Io is -12.5 dB, then this response value
+ * will be 125.*/
+
+ unsigned char rsrp_valid;
+ int rsrp; /**< The current Reference Signal Receive Power in dBm multipled by -1.
+ * Range: 44 to 140 dBm
+ * INT_MAX: 0x7FFFFFFF denotes invalid value.
+ * Reference: 3GPP TS 36.133 9.1.4 */
+
+ unsigned char rsrq_valid;
+ int rsrq; /**< The current Reference Signal Receive Quality in dB multiplied by -1.
+ * Range: 20 to 3 dB.
+ * INT_MAX: 0x7FFFFFFF denotes invalid value.
+ * Reference: 3GPP TS 36.133 9.1.7 */
+
+ unsigned char rssnr_valid;
+ int rssnr; /**< The current reference signal signal-to-noise ratio in 0.1 dB units.
+ * Range: -200 to +300 (-200 = -20.0 dB, +300 = 30dB).
+ * INT_MAX : 0x7FFFFFFF denotes invalid value.
+ * Reference: 3GPP TS 36.101 8.1.1 */
+
+ unsigned char band_valid;
+ int band;
+
+ unsigned char bler_valid;
+ int bler; /*bit error rate*/
+
+ GSW_NW_CELL_EXT_INFO ext_info[MAX_CELL_EXT_INFO]; /* Used to hold neighborhood information for service cells. */
+} GSW_NW_CELL_INFO;
+
+typedef struct {
+ char mcc[GSW_MCC_MAX_LEN];
+ char mnc[GSW_MNC_MAX_LEN];
+} gsw_nw_plmn_t;
+
+
+typedef struct {
+ int plmn_list_len;
+ gsw_nw_plmn_t plmn_list[GSW_PLMN_LIST_MAX_LEN];
+} gsw_nw_plmn_list_t;
+
+typedef void (* GSW_NW_ServingInfoHandlePtr)(GSW_NW_SERVING_INFO serving_info);
+typedef void (* GSW_NW_SigInfoHandlePtr)(signalStrength_t sig_info);
+typedef void (* GSW_NW_RejectCauseHandlePtr)(GSW_NW_REJ_CAUSE_E *rej_cause);
+typedef void (* GSW_NW_AirplaneModeHandlePtr)(int32_t airplane_mode);
+typedef void (* GSW_NW_ModemStateHandlePtr)(gsw_mode_state_e state);
+
+
+/*--------------------------------------------------------------------------------------------------------------------*/
+/* Data call */
+/*--------------------------------------------------------------------------------------------------------------------*/
+#define GSW_MCC_MAX_LEN 16
+#define GSW_MNC_MAX_LEN 16
+#define GSW_APN_CHANNEL_MAX 10
+#define GSW_POXY_ADDR_MAX_LEN 64
+#define GSW_PDP_TYPE_MAX_LEN 16
+#define GSW_APN_MAX_LEN 65
+#define GSW_APN_ID_MAX_LEN 32
+#define GSW_APN_TYPE_MAX_LEN 50
+#define GSW_USR_MAX_LEN 16
+#define GSW_PWD_MAX_LEN 16
+#define GSW_AUTH_TYPE_MAX_LEN 50
+#define GSW_PROTOCO_MAX_LEN 64
+#define GSW_CARRIER_ID_MAX_LEN 64
+#define GSW_IFACE_NAME_MAX_LEN 50
+#define GSW_PDP_ADDR_MAX_LEN 64
+#define GSW_DNS_ADDR_MAX_LEN 64
+#define GSW_GETWAYS_ADDR_MAX_LEN 64
+#define GSW_RSP_MAX_LEN 256
+
+typedef struct {
+ int handle; /**< data connection handle*/
+ int cid; /**< data connection cid*/
+ int state; /**< data connection state*/
+ int fail_cause; /**< data connection fail cause*/
+ char *type; /**< data connection type*/
+ char *ifname; /**< ifname*/
+
+ char *v4_ip; /**< ipv4 address*/
+ char *v4_pdns; /**< ipv4 pdns address*/
+ char *v4_sdns; /**< ipv4 sdns address*/
+ char *v4_gw; /**< ipv4 gateway address*/
+
+ char *v6_ip; /**< ipv6 address*/
+ char *v6_pdns; /**< ipv6 gateway address*/
+ char *v6_sdns; /**< ipv6 gateway address*/
+}Wan_State_ind_s;
+
+typedef struct {
+ char ip[GSW_PDP_ADDR_MAX_LEN]; /**< ip address */
+ char pdns[GSW_DNS_ADDR_MAX_LEN]; /**< pdns address*/
+ char sdns[GSW_DNS_ADDR_MAX_LEN]; /**< sdns address*/
+ char gw[GSW_GETWAYS_ADDR_MAX_LEN]; /**< gate way address*/
+}V4_Addr_s;
+
+typedef struct {
+ char ip[GSW_PDP_ADDR_MAX_LEN]; /**< ip address*/
+ char pdns[GSW_DNS_ADDR_MAX_LEN]; /**< pdns address*/
+ char sdns[GSW_DNS_ADDR_MAX_LEN]; /**< sdns address*/
+}V6_Addr_s;
+
+typedef struct {
+ int handle; /**< data connection handle*/
+
+ /* req info */
+ char mcc[GSW_MCC_MAX_LEN]; /**< apn mcc value*/
+ char mnc[GSW_MNC_MAX_LEN]; /**< apn mnc value*/
+ char apnid[GSW_APN_ID_MAX_LEN]; /**< apn id*/
+ char apn[GSW_APN_MAX_LEN]; /**< apn name*/
+ char apnType[GSW_APN_TYPE_MAX_LEN]; /**< apn type ipv4 ipv4v6 ipv6*/
+ char usr[GSW_USR_MAX_LEN]; /**< apn usr name*/
+ char pwd[GSW_PWD_MAX_LEN]; /**< apn password*/
+ char authType[GSW_AUTH_TYPE_MAX_LEN]; /**< apn auth type*/
+ char normalProtocol[GSW_PROTOCO_MAX_LEN]; /**< apn auth protoco*/
+ char roamingProtocol[GSW_PROTOCO_MAX_LEN]; /**< apn auth protoco roaming*/
+ char carrier[GSW_CARRIER_ID_MAX_LEN]; /**< carrier id*/
+
+ /* rsp */
+ int cid; /**< data connection cid for mdm sdk*/
+ int active; /**< pdn context active state: 2,actived; other,not active */
+ char ifname[GSW_IFACE_NAME_MAX_LEN]; /**< if name of current datalink */
+ int type; /**< data connection type*/
+ V4_Addr_s v4; /**< ipv4 addr*/
+ V6_Addr_s v6; /**< ipv6 addr*/
+ int mtu; /**< mtu value*/
+
+ char out[GSW_RSP_MAX_LEN]; /**< sdk return value*/
+}Link_Info_s;
+
+typedef struct
+{
+ uint64_t tx_pkts; /* the number of packet sent*/
+ uint64_t tx_bytes; /* the number of packet sent bytes */
+ uint64_t tx_dropped_pkts; /* the number of packet dropped by sent*/
+ uint64_t rx_pkts; /* the number of packet received*/
+ uint64_t rx_bytes; /* the number of packet receivedbytes */
+ uint64_t rx_dropped_pkts; /* the number of packet dropped by received*/
+}gsw_data_pkt_stats;
+
+
+typedef void (*gsw_data_call_evt_cb_t)(Wan_State_ind_s *linkState);
+
+
+/*--------------------------------------------------------------------------------------------------------------------*/
+/* sim */
+/*--------------------------------------------------------------------------------------------------------------------*/
+
+typedef enum sim_status
+{
+ SIM_STATUS_ABSENT = 0, /**< sim absent*/
+ SIM_STATUS_PRESENT = 1, /**< sim present mtk as ready*/
+ SIM_STATUS_ERROR = 2, /**< sim error*/
+ SIM_STATUS_READY = 3, /**< sim state ready mtk no this value*/
+ SIM_STATUS_PIN = 4, /**< pinlock status*/
+} sim_status_e_type;
+
+
+
+/**
+ * @brief SDK interface to call back serving info
+ * @param [in] handle_ptr
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_reg_serving_info_callback(GSW_NW_ServingInfoHandlePtr handle_ptr);
+
+/**
+ * @brief SDK interface to call back sig info
+ * @param [in] handle_ptr
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_reg_sig_info_callback(GSW_NW_SigInfoHandlePtr handle_ptr);
+
+/**
+ * @brief SDK interface to call back rej cause
+ * @param [in] handle_ptr
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_reg_rej_cause_callback(GSW_NW_RejectCauseHandlePtr handle_ptr);
+
+/**
+ * @brief network sdk init
+ * @param [in] token usr id define by who use
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_nw_sdk_init(int token);
+
+/**
+ * @brief network sdk deinit
+ * @param
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_nw_sdk_deinit(void);
+
+/**
+ * @brief get current network reg info
+ * @param [out] serving_info struct for network info
+ * include regstate ps_state opreator name mcc mcn etc
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_get_nwinfo(GSW_NW_SERVING_INFO *serving_info);
+
+/**
+ * @brief get current network type
+ * @param [out] netype as GSW_NW_RADIO_ACCESS_TECH_E type
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_get_netype(int32_t *netype);
+
+/**
+ * @brief get radio opmode, as open and close airplane mode
+ * @param [out] op_mode 1 is radio on, 0 is radio off
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_get_opmode(int *op_mode);
+
+/**
+ * @brief set radio opmode, as open and close airplane mode
+ * @param [in] op_mode 1 is radio on, 0 is radio off
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_set_opmode(int32_t op_mode);
+
+/**
+ * @brief get network mode preference of mdm search network scale
+ * @param [out] mode_pref net_work pref mode:
+ * enum prefer_mode
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_get_mode_preference(int32_t *mode_pref);
+
+/**
+ * @brief set network mode preference of mdm search network scale
+ * @param [in] mode_pref net_work pref mode:
+ * enum prefer_mode
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_set_mode_preference(int32_t mode_pref);
+
+/**
+ * @brief get signal csq value
+ * @param [out] csq_value csq of signalstrengh 0 - 31, 99 invalid
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_get_sig_info(int32_t *csq_value);
+
+/**
+ * @brief set nework power mode, for tcam enter standby or exit standby
+ * @param [in] mode TRUE(1) when enter standby, FALSE(0) after wake up
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_network_set_power_mode(int8_t mode);
+
+/**
+ * @brief convert rsrp rscp rssi to csq value.
+ * @param [in] netType signal radio tech 2 means 2G 3 mens 3G,4 is 4G,5 is 5G
+ * @param [in] sigvalue input signal_strength for different nettype
+ * rsrp for 4G/5G, rscp for 3G, rssi for 2G
+
+ * @retval csq
+ * @retval other: fail
+ */
+int gsw_sigInfo_to_csq(int32_t netType, int32_t sigValue);
+
+/*
+ * @brief get PLMNs from the FPLMN list
+ * @param [inout] plmn_list:
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_get_forbidden_networks(gsw_nw_plmn_list_t *plmn_list);
+
+/*
+ * @brief add PLMNs from the plmn_list to the FPLMN list
+ * @param [in] plmn_list:
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_add_forbidden_networks(gsw_nw_plmn_list_t *plmn_list);
+
+/*
+ * @brief Remove PLMNs from the plmn_list from the FPLMN list
+ * @param [in] plmn_list:
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_remove_forbidden_networks(gsw_nw_plmn_list_t *plmn_list);
+
+/*
+ * @brief clear FPLMN list
+ * @param
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_clear_forbidden_networks(void);
+
+
+
+/*
+ * @brief get mobile operator name
+ @param [out] nw_operator_name_infos get the long and short operator name info
+ @retval 0: success
+ @retval 0: other: fail
+ */
+int gsw_get_mobile_operator_name(gsw_mobile_operator_name *nw_operator_name_infos);
+
+
+
+/*
+ * @brief set modem status event callback
+ @param [in] handle_ptr callback function address
+ @retval 0: success
+ @retval 0: other: fail
+ */
+int gsw_reg_set_modem_status_event_callback(GSW_NW_ModemStateHandlePtr handle_ptr);
+
+
+/*
+ * @brief get current serving cell info
+ * @param cell_info: [out] struct for current cell info
+ * include earfcn mcc mnc pci psc tac lac etc.
+ * @return int: 0 is success, other failed
+ */
+int gsw_get_cell_info(GSW_NW_CELL_INFO *cell_info);
+
+/**
+ * @brief datacall sdk init
+ * @param [in] evt_cb callback function for data connection state change event
+ * call back;
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_data_call_init(gsw_data_call_evt_cb_t evt_cb);
+
+
+/**
+ * @brief data_call sdk deinit
+ * @param
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_data_call_deinit(void);
+
+/**
+ * @brief set apn parameters for data call
+ * @param [in/out] LinkInf apn info for pub or private datacall
+ * inlcude apn name mcc mnc, passwork apnid type cid etc
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_data_call_set_apn(Link_Info_s *LinkInf);
+
+
+/**
+ * @brief set apn parameters for data call
+ * @param [in] linkid data connetion link number
+ * @param [in/out] LinkInf link info req: apn info for pub or private datacall
+ * inlcude apn name mcc mnc, passwork apnid etc
+ * resp: data call link state ipaddress type etc
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_data_call_connect(int linkid, Link_Info_s *LinkInf);
+
+
+/**
+ * @brief set apn parameters for data call
+ * @param [in] linkid
+ * @param [in/out] LinkInf link info req: apn info for pub or private datacall
+ * inlcude apn name mcc mnc, passwork apnid etc
+ * resp: data call link state ipaddress type etc
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_data_call_disconnect(int linkid, Link_Info_s *LinkInf);
+
+
+
+/*
+ * @brief get mobile operator name
+ @param [in] linkid apn id
+ @param [out] data_pkt obtian actual data call network card data traffic
+ @retval 0: success
+ @retval 0: other: fail
+ */
+int gsw_get_data_call_pkt_stats(int linkid, gsw_data_pkt_stats *data_pkt);
+
+
+/**
+ * @brief sim sdk init
+ * @param [in] token usr id define by who use
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_sim_sdk_init(int32_t token);
+
+
+/**
+ * @brief sim sdk deinit
+ * @param
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_sim_sdk_deinit(void);
+
+/**
+ * @brief get sim state
+ * @param [out] sim_state sim status as sim_status_e_type
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_get_sim_status(int32_t *sim_state);
+
+/**
+ * @brief get iccid function
+ * @param [in] len iccid length,max is 20
+ * @param [out] iccid return iccid from this func
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_get_sim_iccid(int32_t len, int8_t *iccid);
+
+/**
+ * @brief get imsi function
+ * @param [in] len imsi length,max is 20
+ * @param [out] iccid return imsi from this func
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_get_sim_imsi(int32_t len, int8_t *imsi);
+
+/**
+ * @brief get sim msisdn function
+ * @param [in] len msisdn length,max is 20
+ * @param [out] msisdn msisdn length,max is 20
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_get_sim_msisdn(int32_t len, int8_t *msisdn);
+
+/**
+ * @brief get imei function
+ * @param [in] len imei length,max is 20
+ * @param [out] imei return imei from this func
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_get_imei(int32_t len, int8_t *imei);
+
+/**
+ * @brief set sim power down
+ * @param
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_set_sim_power_down(void);
+
+/**
+ * @brief set sim power up
+ * @param
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_set_sim_power_up(void);
+
+/**
+ * @brief reset modem stack only, notice: after use this method, all ril sdk
+ * need restart by app, means network, sim, sms, data need deinit then init!
+ * @param
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_reset_modem(void);
+
+
+
diff --git a/mbtk/include/gsw/gsw_nw_interface.h b/mbtk/include/gsw/gsw_nw_interface.h
new file mode 100755
index 0000000..b3e0326
--- /dev/null
+++ b/mbtk/include/gsw/gsw_nw_interface.h
@@ -0,0 +1,1027 @@
+/**
+* @file : gsw_nw_interface.h
+* @brief : sim and apn
+* @date :
+* @author : wind
+* @version : v1.0
+* @copyright
+*/
+#ifndef GSW_NWINFO_INTERFACE_H
+#define GSW_NWINFO_INTERFACE_H
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdbool.h>
+#include <string.h>
+#include <unistd.h>
+#include <pthread.h>
+#include "gsw_hal_errcode.h"
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+#define GSWOL_5G_SDK
+
+#define GSW_NW_OPERATION_NAME_LEN (32)
+#define GSW_NW_PLMN_LEN (6)
+#define GSW_NW_MCC_LEN (3)
+#define GSW_NW_MNC_LEN (3)
+#define GSW_NW_SUCCESS GSW_HAL_SUCCESS
+#define GSW_NW_FAIL GSW_HAL_NORMAL_FAIL
+
+#define GSW_MCC_MAX_LEN (16)
+#define GSW_MNC_MAX_LEN (16)
+#define GSW_APN_CHANNEL_MAX (10)
+#define GSW_POXY_ADDR_MAX_LEN (64)
+#define GSW_PDP_TYPE_MAX_LEN (16)
+#define GSW_APN_MAX_LEN (32)
+#define GSW_APN_ID_MAX_LEN (32)
+#define GSW_APN_TYPE_MAX_LEN (50)
+#define GSW_USR_MAX_LEN (16)
+#define GSW_PWD_MAX_LEN (16)
+#define GSW_AUTH_TYPE_MAX_LEN (50)
+#define GSW_PROTOCO_MAX_LEN (64)
+#define GSW_CARRIER_ID_MAX_LEN (64)
+#define GSW_IFACE_NAME_MAX_LEN (50)
+#define GSW_PDP_ADDR_MAX_LEN (64)
+#define GSW_DNS_ADDR_MAX_LEN (64)
+#define GSW_GETWAYS_ADDR_MAX_LEN (64)
+#define GSW_RSP_MAX_LEN (256)
+
+#define DATA_TOKEN (2022)
+
+#define MAX_CELL_EXT_INFO (5)
+
+#ifndef uint8_t
+typedef unsigned char uint8_t;
+#endif
+
+typedef enum roaming_status
+{
+ WAN_ROAM_STATUS_UNKOWN = 0, /**< init value */
+ WAN_ROAM_STATUS_HOME = 1, /**< china home */
+ WAN_ROAM_STATUS_INTERNAL = 2, /**< china roaming */
+ WAN_ROAM_STATUS_INTERNATIONA = 3, /**< other country roaming */
+} roaming_status_e_type;
+
+typedef enum gsw_network_roaming_state
+{
+ GSW_NETWORK_ROAMING_OFF = 0x0, /**< roaming off */
+ GSW_NETWORK_ROAMING_ON = 0x1, /**< roaming on*/
+} GSW_NW_ROAMING_STATE_E;
+
+typedef enum service_domain
+{
+ GSW_SRV_DOMAIN_NO_SVC = 0x0, /**< no service */
+ GSW_SRV_DOMAIN_CS_ONLY = 0x1, /**< cs only */
+ GSW_SRV_DOMAIN_PS_ONLY = 0x2, /**< ps only */
+ GSW_SRV_DOMAIN_CS_PS = 0x3, /**< reg all in service */
+} GSW_SERVICE_DOMAIN_E;
+
+typedef enum gsw_network_reg_state
+{
+ GSW_NETWORK_REG_NOT_REGISTERED = 0x0, /**< no service */
+ GSW_NETWORK_REG_REGISTERED = 0x1, /**< reg in service home */
+ GSW_NETWORK_REG_NOT_REGISTERED_SEARCHING = 0x2, /**< searching network */
+ GSW_NETWORK_REG_REGISTRATION_DENIED = 0x3, /**< network denny device */
+ GSW_NETWORK_REG_REGISTRATION_UNKNOWN = 0x4, /**< unknown state */
+ GSW_NETWORK_REG_REGISTRATION_ROAMING = 0x5, /**< roaming state in service */
+ GSW_NETWORK_REG_LIMITED_SERVICE = 0x6, /**< limited service */
+} GSW_NW_REG_STATE_E;
+
+typedef enum gsw_network_radio_interface
+{
+ GSW_NETWORK_RADIO_NO_SVC = 0x0, /**< radio state no service */
+ GSW_NETWORK_RADIO_CDMA_1X = 0x1, /**< cdma 1x */
+ GSW_NETWORK_RADIO_CDMA_1XEVDO = 0x2, /**< cdma evdo */
+ GSW_NETWORK_RADIO_AMPS = 0x3, /**< amps gsm 2g*/
+ GSW_NETWORK_RADIO_GSM = 0x4, /**< gsm */
+ GSW_NETWORK_RADIO_UMTS = 0x5, /**< umts wcdma*/
+ GSW_NETWORK_RADIO_LTE = 0x6, /**< LTE 4G */
+ GSW_NETWORK_RADIO_TDSCDMA = 0x7, /**< TDS 3G*/
+ GSW_NETWORK_RADIO_NR5G = 0x8, /**< NR 5G*/
+} GSW_NW_RADIO_ACCESS_TECH_E;
+
+typedef enum data_conn_status
+{
+ DIAL_STATUS_MIN_ENUM_VAL = -1, /**< default value*/
+ DIAL_STATUS_CONNECTING = 0, /**< data connecting*/
+ DIAL_STATUS_CONNECTED = 1, /**< data conneted*/
+ DIAL_STATUS_DISCONNECTING = 2, /**< data disconnecting*/
+ DIAL_STATUS_DISCONNECTED = 3, /**< data disconnected*/
+ DIAL_STATUS_MAX_ENUM_VAL, /**< default max value*/
+} data_conn_status_e_type;
+
+typedef enum sim_status
+{
+ SIM_STATUS_ABSENT = 0, /**< sim absent*/
+ SIM_STATUS_PRESENT = 1, /**< sim present mtk as ready*/
+ SIM_STATUS_ERROR = 2, /**< sim error*/
+ SIM_STATUS_READY = 3, /**< sim state ready mtk no this value*/
+ SIM_STATUS_PIN = 4, /**< pinlock status*/
+} sim_status_e_type;
+
+typedef enum oprate_mode
+{
+ GSW_OP_MODE_LPM = 0, /**< radio state off*/
+ GSW_OP_MODE_ONLINE = 1, /**< radio state on*/
+ GSW_OP_MODE_FTM = 2, /**< radio state ftm*/
+ GSW_OP_MODE_OFFLINE = 3, /**< radio state offline*/
+} OPERATE_MODE_E;
+
+typedef struct
+{
+ unsigned char cell_id_valid;
+ unsigned char pci_valid;
+ unsigned char psc_valid;
+ unsigned char band_valid;
+ unsigned char arfcn_valid;
+ unsigned char rssi_valid;
+ unsigned char rsrp_valid;
+ unsigned char rsrq_valid;
+ unsigned char sinr_valid;
+ unsigned char rscp_valid;
+ unsigned char ecio_valid;
+ GSW_NW_RADIO_ACCESS_TECH_E rat;
+ unsigned int cell_id;
+ int pci;
+ int psc;
+ int band;
+ int arfcn;
+ int rssi;
+ int rsrp;
+ int rsrq;
+ int sinr;
+ int rscp;
+ int ecio;
+ char mcc[5];
+ char mnc[5];
+} GSW_NW_CELL_EXT_INFO;
+
+typedef struct
+{
+ GSW_NW_RADIO_ACCESS_TECH_E rat; /**< current radio state*/
+
+ uint8_t mcc_valid;
+ char mcc[5];
+ uint8_t mnc_valid;
+ char mnc[5];
+ uint8_t cell_id_valid;
+ unsigned int cell_id; /**< cell id*/
+ uint8_t pci_valid;
+ int pci; /**<physical cell id*/
+ uint8_t psc_valid;
+ int psc; /**<wcdma primary scramble code*/
+ uint8_t narfcn_valid;
+ int narfcn; /**<nr cell freq*/
+ uint8_t earfcn_valid;
+ int earfcn; /**<lte cell freq*/
+ uint8_t uarfcn_valid;
+ int uarfcn; /**<wcdma cell freq*/
+ uint8_t arfcn_valid;
+ int arfcn; /**<gsw cell freq*/
+ uint8_t tac_valid;
+ unsigned int tac; /**< cell tac*/
+ uint8_t lac_valid;
+ unsigned int lac; /**< cell lac*/
+ uint8_t sid_valid;
+ int sid; /**< cell sid cdma*/
+ uint8_t nid_valid;
+ int nid; /**< cell nid cdma*/
+ uint8_t lteMode_valid;
+ int lteMode; /**<tdd 0, fdd 1*/
+
+ uint8_t rssi_valid;
+ int rssi; /**< Valid values are (0-31, 99) as defined in TS 27.007 8.5 */
+
+ uint8_t rscp_valid;
+ int rscp; /**< The Received Signal Code Power in dBm multipled by -1.
+ * Range : 25 to 120
+ * INT_MAX: 0x7FFFFFFF denotes invalid value.
+ * Reference: 3GPP TS 25.123, section 9.1.1.1 */
+
+ uint8_t ecio_valid;
+ int ecio; /**< Valid values are positive integers. This value is the actual Ec/Io multiplied
+ * by -10. Example: If the actual Ec/Io is -12.5 dB, then this response value
+ * will be 125.*/
+
+ uint8_t rsrp_valid;
+ int rsrp; /**< The current Reference Signal Receive Power in dBm multipled by -1.
+ * Range: 44 to 140 dBm
+ * INT_MAX: 0x7FFFFFFF denotes invalid value.
+ * Reference: 3GPP TS 36.133 9.1.4 */
+
+ uint8_t rsrq_valid;
+ int rsrq; /**< The current Reference Signal Receive Quality in dB multiplied by -1.
+ * Range: 20 to 3 dB.
+ * INT_MAX: 0x7FFFFFFF denotes invalid value.
+ * Reference: 3GPP TS 36.133 9.1.7 */
+
+ uint8_t rssnr_valid;
+ int rssnr; /**< The current reference signal signal-to-noise ratio in 0.1 dB units.
+ * Range: -200 to +300 (-200 = -20.0 dB, +300 = 30dB).
+ * INT_MAX : 0x7FFFFFFF denotes invalid value.
+ * Reference: 3GPP TS 36.101 8.1.1 */
+
+ uint8_t band_valid;
+ int band;
+
+ uint8_t bler_valid;
+ int bler; /**<bit error rate*/
+ int ext_info_len; /**<ext_info len*/
+ GSW_NW_CELL_EXT_INFO ext_info[MAX_CELL_EXT_INFO];
+
+} GSW_NW_CELL_INFO;
+
+typedef struct
+{
+ GSW_NW_REG_STATE_E reg_state; /**< network cs regstate*/
+ GSW_NW_REG_STATE_E ps_state; /**< network ps regstate*/
+ GSW_NW_RADIO_ACCESS_TECH_E reg_rat; /**< current radio state*/
+ GSW_SERVICE_DOMAIN_E srv_domain; /**< current cs or ps state*/
+ GSW_NW_ROAMING_STATE_E roaming_ind; /**< roaming state*/
+ char reg_plmn[GSW_NW_PLMN_LEN + 1]; /**< current cell plmn*/
+ char operator_name[GSW_NW_OPERATION_NAME_LEN + 1]; /**< operator name*/
+ char cell_id[128]; /**< cell id*/
+ char tac[128]; /**< cell tac*/
+ char lac[128]; /**< cell lac*/
+ int sid; /**< cell sid cdma*/
+ int nid; /**< cell nid cdma*/
+} GSW_NW_SERVING_INFO;
+
+typedef struct
+{
+ GSW_NW_RADIO_ACCESS_TECH_E rej_rat; /**< current network radio tech*/
+ GSW_SERVICE_DOMAIN_E rej_domain; /**< reject code from ps or cs*/
+ int rej_cause; /**< reject code number*/
+} GSW_NW_REJ_CAUSE_E;
+
+typedef enum
+{
+ SMS_FORMAT_GSM_7BIT = 0, /**< 7bit econde*/
+ SMS_FORMAT_BINARY_DATA = 1, /**< 8bit binary encode*/
+ SMS_FORMAT_UCS2 = 2, /**< ucs2 encode*/
+}gsw_sms_format_e;
+
+typedef struct
+{
+ unsigned char year[5]; /**< year of date*/
+ unsigned char month[3]; /**< month of date*/
+ unsigned char day[3]; /**< day of date*/
+ unsigned char hour[3]; /**< hour of time*/
+ unsigned char minutes[3]; /**< minute of time*/
+ unsigned char seconds[3]; /**< second of time*/
+ unsigned char timezone[4]; /**< timezone*/
+}gsw_sms_date_t;
+
+#define GSW_SMS_SEND_NUM_MAX 5 /**< dest num max count */
+#define GSW_SMS_ADDRESS_LEN 32 /**< one dest number max length*/
+#define GSW_SMS_CONCAT_SMS_COUNT_MAX 160 /**< one page max bytes*/
+#define GSW_SMS_MSG_CONTENT_LEN_MAX 3 /**< sms page max count*/
+#define GSW_SMS_CONTENT_LEN_MAX 3 /**< newmsg recv one page*/
+#define GSW_SMS_SEND_CONT_MAX (GSW_SMS_MSG_CONTENT_LEN_MAX*GSW_SMS_CONCAT_SMS_COUNT_MAX*2) /**< sms send max len*/
+#define GSW_SMS_RECV_CONT_MAX 1440 /**< sms receive max len*/
+
+typedef struct
+{
+ char src_num[GSW_SMS_ADDRESS_LEN+1]; /**< sms phone num send msg*/
+ char dest_num[GSW_SMS_ADDRESS_LEN + 1]; /**< sms phone num recv msg*/
+ gsw_sms_format_e content_encode; /**< sms content is 7bit or 8bit or Ucs2 encode*/
+ unsigned int content_len; /**< sms content size*/
+ char content[GSW_SMS_RECV_CONT_MAX + 1]; /**< sms content*/
+ gsw_sms_date_t date; /**< message time*/
+}gsw_sms_msg_type_t;
+
+typedef struct
+{
+ gsw_sms_format_e content_encode; /**< content encode*/
+ int content_len; /**< content len*/
+ char content[GSW_SMS_RECV_CONT_MAX + 1]; /**< sms content*/
+ gsw_sms_date_t date; /**< sms date */
+} gsw_sms_content_t;
+
+typedef enum
+{
+ GSW_SMS_FULL_FLG, /**< sms full flag*/
+ GSW_SMS_RECEIVED_FLG, /**<recv new sms flag*/
+}gsw_sms_state_e;
+
+/*--------------------------------------------------------------------------------------------------------------------*/
+/* Data call adaptation layer struct */
+/*--------------------------------------------------------------------------------------------------------------------*/
+#define LINK0 (0) /**< public use APN2 or APN3 */
+#define LINK1 (1) /**< private use APN1 */
+#define LINK2 (2) /**< public use APN2 or APN3 */
+#define MAX_LINKS (3)
+
+#define INACTIVED (0)
+#define ACTIVED (2)
+
+#define TYPE_IPV4 (0)
+#define TYPE_IPV6 (1)
+#define TYPE_IPV4V6 (2)
+
+typedef struct {
+ char ip[GSW_PDP_ADDR_MAX_LEN]; /**< ip address */
+ char pdns[GSW_DNS_ADDR_MAX_LEN]; /**< pdns address*/
+ char sdns[GSW_DNS_ADDR_MAX_LEN]; /**< sdns address*/
+ char gw[GSW_GETWAYS_ADDR_MAX_LEN]; /**< gate way address*/
+}V4_Addr_s;
+
+typedef struct {
+ char ip[GSW_PDP_ADDR_MAX_LEN]; /**< ip address*/
+ char pdns[GSW_DNS_ADDR_MAX_LEN]; /**< pdns address*/
+ char sdns[GSW_DNS_ADDR_MAX_LEN]; /**< sdns address*/
+}V6_Addr_s;
+
+typedef struct {
+ int handle; /**< data connection handle*/
+
+ /* req info */
+ char mcc[GSW_MCC_MAX_LEN]; /**< apn mcc value*/
+ char mnc[GSW_MNC_MAX_LEN]; /**< apn mnc value*/
+ char apnid[GSW_APN_ID_MAX_LEN]; /**< apn id*/
+ char apn[GSW_APN_MAX_LEN]; /**< apn name*/
+ char apnType[GSW_APN_TYPE_MAX_LEN]; /**< apn type ipv4 ipv4v6 ipv6*/
+ char usr[GSW_USR_MAX_LEN]; /**< apn usr name*/
+ char pwd[GSW_PWD_MAX_LEN]; /**< apn password*/
+ char authType[GSW_AUTH_TYPE_MAX_LEN]; /**< apn auth type*/
+ char normalProtocol[GSW_PROTOCO_MAX_LEN]; /**< apn auth protoco*/
+ char roamingProtocol[GSW_PROTOCO_MAX_LEN]; /**< apn auth protoco roaming*/
+ char carrier[GSW_CARRIER_ID_MAX_LEN]; /**< carrier id*/
+
+ /* rsp */
+ int cid; /**< data connection cid for mdm sdk*/
+ int active; /**< pdn context active state: 2,actived; other,not active */
+ char ifname[GSW_IFACE_NAME_MAX_LEN]; /**< if name of current datalink */
+ int type; /**< data connection type*/
+ V4_Addr_s v4; /**< ipv4 addr*/
+ V6_Addr_s v6; /**< ipv6 addr*/
+ int mtu; /**< mtu value*/
+
+ char out[GSW_RSP_MAX_LEN]; /**< sdk return value*/
+}Link_Info_s;
+
+typedef struct {
+ int handle; /**< data connection handle*/
+ int cid; /**< data connection cid*/
+ int state; /**< data connection state*/
+ int fail_cause; /**< data connection fail cause*/
+ char *type; /**< data connection type*/
+ char *ifname; /**< ifname*/
+
+ char *v4_ip; /**< ipv4 address*/
+ char *v4_pdns; /**< ipv4 pdns address*/
+ char *v4_sdns; /**< ipv4 sdns address*/
+ char *v4_gw; /**< ipv4 gateway address*/
+
+ char *v6_ip; /**< ipv6 address*/
+ char *v6_pdns; /**< ipv6 gateway address*/
+ char *v6_sdns; /**< ipv6 gateway address*/
+}Wan_State_ind_s;
+
+typedef struct{
+ int gw_sig_valid; /**< 1 valid,1 invalid*/
+ int rssi; /**< Valid values are (0-31, 99) as defined in TS 27.007 8.5 */
+ int wcdma_sig_valid;/**< 1 valid,0 invalid*/
+ int rscp; /**< The Received Signal Code Power in dBm multipled by -1.
+ * Range : 25 to 120
+ * INT_MAX: 0x7FFFFFFF denotes invalid value.
+ * Reference: 3GPP TS 25.123, section 9.1.1.1 */
+ int ecno; /**< Valid values are positive integers. This value is the actual Ec/Io multiplied
+ * by -10. Example: If the actual Ec/Io is -12.5 dB, then this response value
+ * will be 125.*/
+ int lte_sig_valid;/**< 1 valid,0 invalid*/
+ int rsrp; /**< The current Reference Signal Receive Power in dBm multipled by -1.
+ * Range: 44 to 140 dBm
+ * INT_MAX: 0x7FFFFFFF denotes invalid value.
+ * Reference: 3GPP TS 36.133 9.1.4 */
+ int rsrq; /**< The current Reference Signal Receive Quality in dB multiplied by -1.
+ * Range: 20 to 3 dB.
+ * INT_MAX: 0x7FFFFFFF denotes invalid value.
+ * Reference: 3GPP TS 36.133 9.1.7 */
+ int rssnr; /**< The current reference signal signal-to-noise ratio in 0.1 dB units.
+ * Range: -200 to +300 (-200 = -20.0 dB, +300 = 30dB).
+ * INT_MAX : 0x7FFFFFFF denotes invalid value.
+ * Reference: 3GPP TS 36.101 8.1.1 */
+ int nr_sig_valid;/**<1 valid,0 invalid*/
+ int ssRsrp; /**< SS(Synchronization Signal) reference signal received power, multipled by -1.
+ * Reference: 3GPP TS 38.215.
+ * Range [44, 140], INT_MAX means invalid/unreported.*/
+ int ssRsrq; /**< SS reference signal received quality, multipled by -1.
+ * Reference: 3GPP TS 38.215.
+ * Range [3, 20], INT_MAX means invalid/unreported.*/
+ int ssSinr; /**< SS signal-to-noise and interference ratio.
+ * Reference: 3GPP TS 38.215 section 5.1.*, 3GPP TS 38.133 section 10.1.16.1.
+ * Range [-23, 40], INT_MAX means invalid/unreported.*/
+ int csiRsrp; /**< CSI reference signal received power, multipled by -1.
+ * Reference: 3GPP TS 38.215.
+ * Range [44, 140], INT_MAX means invalid/unreported.*/
+ int csiRsrq; /**< CSI reference signal received quality, multipled by -1.
+ * Reference: 3GPP TS 38.215.
+ * Range [3, 20], INT_MAX means invalid/unreported.*/
+ int csiSinr; /**< CSI signal-to-noise and interference ratio.
+ * Reference: 3GPP TS 138.215 section 5.1.*, 3GPP TS 38.133 section 10.1.16.1.
+ * Range [-23, 40], INT_MAX means invalid/unreported.*/
+} signalStrength_t;
+
+typedef struct
+{
+ int regState; /**< voice or data reg service state */
+ char CID[128]; /**< gsm/wcdma cid */
+ char LAC[128]; /**< cell lac */
+ int netType; /**< radio tech */
+ int radioTechFam; /**< 1-3GPP; 2-3GPP2 */
+ int netRejectedCode; /**< denied code */
+} lynq_nw_reg_status_t;
+
+typedef enum mode_state_type
+{
+ GSW_MODEM_STATE_UNKNOWN = 0, /**< modem unknow */
+ GSW_MODEM_STATE_ONLINE, /**< modem work online */
+ GSW_MODEM_STATE_OFFLINE, /**< modem offline */
+}gsw_mode_state_e;
+
+
+typedef struct
+{
+ char long_eons[128]; /**< Full name of the operator*/
+ char short_eons[128]; /**< Shor name of the operator*/
+ char mcc[4]; /**< Mobile country code*/
+ char mnc[4]; /**< Mobile network code*/
+}gsw_mobile_operator_name;
+
+
+#define GSW_MCC_MAX_LEN (16)
+#define GSW_MNC_MAX_LEN (16)
+#define GSW_PLMN_LIST_MAX_LEN (85)
+
+
+typedef struct {
+ char mcc[GSW_MCC_MAX_LEN]; /**< Mobile country code*/
+ char mnc[GSW_MNC_MAX_LEN]; /**< Mobile network code*/
+} gsw_nw_plmn_t;
+
+
+typedef struct {
+ int plmn_list_len;
+ gsw_nw_plmn_t plmn_list[GSW_PLMN_LIST_MAX_LEN];
+} gsw_nw_plmn_list_t;
+
+typedef struct
+{
+ uint64_t tx_pkts; /**< the number of packet sent*/
+ uint64_t tx_bytes; /**< the number of packet sent bytes */
+ uint64_t tx_dropped_pkts; /**< the number of packet dropped by sent*/
+ uint64_t rx_pkts; /**< the number of packet received*/
+ uint64_t rx_bytes; /**< the number of packet receivedbytes */
+ uint64_t rx_dropped_pkts; /**< the number of packet dropped by received*/
+}gsw_data_pkt_stats;
+
+typedef struct {
+ char apn_name[GSW_APN_MAX_LEN];
+ char apn_accont[GSW_USR_MAX_LEN];
+ char apn_password[GSW_PWD_MAX_LEN];
+ uint8_t auth_type;
+} gsw_apn_param_t;
+
+/* Callback function registered to QL_SMS_AddRxMsgHandler, msgRef contains the detail msg infor */
+typedef void (* GSW_SMS_Callback_fun)(gsw_sms_state_e state, gsw_sms_msg_type_t *report_info);
+typedef void (* GSW_NW_ServingInfoHandlePtr)(GSW_NW_SERVING_INFO serving_info);
+typedef void (* GSW_NW_SigInfoHandlePtr)(signalStrength_t sig_info);
+typedef void (* GSW_NW_RejectCauseHandlePtr)(GSW_NW_REJ_CAUSE_E *rej_cause);
+typedef void (* GSW_NW_AirplaneModeHandlePtr)(int airplane_mode);
+typedef void (* GSW_NW_ModemStateHandlePtr)(gsw_mode_state_e state);
+
+/**
+ * @brief SDK interface to call back serving info
+ * @param [in] GSW_NW_ServingInfoHandlePtr:
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_reg_serving_info_callback(GSW_NW_ServingInfoHandlePtr handle_ptr);
+
+
+/**
+ * @brief SDK interface to call back sig info
+ * report: event + cycle(5s) 事件+周期上报
+ * 如果底层(modem 上报)有信号上报,就执行回调函数进行上报
+ * 如果底层(modem 上报)超过 5s 没有上报,服务层就自己获取一次信号,做一次补充上报
+ * @param [in] GSW_NW_SigInfoHandlePtr:
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_reg_sig_info_callback(GSW_NW_SigInfoHandlePtr handle_ptr);
+
+
+/**
+ * @brief SDK interface to call back rej cause
+ * @param [in] GSW_NW_RejectCauseHandlePtr:
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_reg_rej_cause_callback(GSW_NW_RejectCauseHandlePtr handle_ptr);
+
+
+/**
+ * @brief SDK interface to call back airplane mode
+ * @param [in] GSW_NW_AirplaneModeHandlePtr:
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_reg_operating_mode_callback(GSW_NW_AirplaneModeHandlePtr handle_ptr);
+
+
+/**
+ * @brief SDK interface to call back sms messages
+ * @param [in] GSW_SMS_Callback_fun:
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_sms_reg_callback(GSW_SMS_Callback_fun handle_ptr);
+
+
+/**
+ * @brief mdm sdk service init before all other sdk init
+ * @param
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_sdk_init(void);
+
+
+/**
+ * @brief network sdk init
+ * @param [in] token usr id define by who use
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_nw_sdk_init(int token);
+
+
+/**
+ * @brief network sdk deinit
+ * @param
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_nw_sdk_deinit(void);
+
+
+/**
+ * @brief sim sdk init
+ * @param [in] token usr id define by who use
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_sim_sdk_init(int token);
+
+
+/**
+ * @brief sim sdk deinit
+ * @param
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_sim_sdk_deinit(void);
+
+
+/**
+ * @brief sms sdk init
+ * @param [in] token
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_sms_sdk_init(int token);
+
+
+/**
+ * @brief sms sdk deinit
+ * @param
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_sms_sdk_deinit(void);
+
+
+/**
+ * @brief get current network reg info
+ * @param [out] GSW_NW_SERVING_INFO struct for network info
+ * include regstate ps_state opreator name mcc mcn etc
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_get_nwinfo(GSW_NW_SERVING_INFO *serving_info);
+
+
+/**
+ * @brief get current network type
+ * @param [out] netype as GSW_NW_RADIO_ACCESS_TECH_E type
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_get_netype(int *netype);
+
+
+/**
+ * @brief get radio opmode, as open and close airplane mode
+ * @param [out] op_mode 1 is radio on, 0 is radio off
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_get_opmode(int *op_mode);
+
+
+/**
+ * @brief set radio opmode, as open and close airplane mode
+ * @param [in] op_mode 1 is radio on, 0 is radio off
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_set_opmode(int op_mode);
+
+
+/**
+ * @brief get network mode preference of mdm search network scale
+ * @param [out] mode_pref net_work pref mode:
+ * 32 - all mode 2G/3G/4G/5G;
+ * 9 - 2G/3G/4G;
+ * 3 - 2G/3G;
+ * 1 - 2G only
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_get_mode_preference(int *mode_pref);
+
+
+/**
+ * @brief set network mode preference of mdm search network scale
+ * @param [in] mode_pref net_work pref mode:
+ * 32 - all mode 2G/3G/4G/5G;
+ * 9 - 2G/3G/4G;
+ * 3 - 2G/3G;
+ * 1 - 2G only
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_set_mode_preference(int mode_pref);
+
+
+/**
+ * @brief get signal csq value
+ * @param [out] csq_value csq of signalstrengh 0 - 31
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_get_sig_info(int *csq_value);
+
+/**
+ * @brief get current serving cell info
+ * @param [out] GSW_NW_CELL_INFO: struct for current cell info
+ * include earfcn mcc mnc pci psc tac lac etc.
+ * @return int: 0 is success, other failed
+ */
+int gsw_get_cell_info(GSW_NW_CELL_INFO *cell_info);
+
+/**
+ * @brief get mobile operator name
+ * @param [out] gsw_mobile_operator_name: get the long and short operator name info
+ * @retval 0: success
+ * @retval 0: other: fail
+ */
+int gsw_get_mobile_operator_name(gsw_mobile_operator_name *nw_operator_name_infos);
+
+/**
+ * @brief get PLMNs from the FPLMN list
+ * @param [inout] gsw_nw_plmn_list_t:
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_get_forbidden_networks(gsw_nw_plmn_list_t *plmn_list);
+
+/**
+ * @brief add PLMNs from the plmn_list to the FPLMN list
+ * @param [in] gsw_nw_plmn_list_t:
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_add_forbidden_networks(gsw_nw_plmn_list_t *plmn_list);
+
+/**
+ * @brief Remove PLMNs from the plmn_list from the FPLMN list
+ * @param [in] gsw_nw_plmn_list_t:
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_remove_forbidden_networks(gsw_nw_plmn_list_t *plmn_list);
+
+/**
+ * @brief clear FPLMN list
+ * @param
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_clear_forbidden_networks(void);
+
+
+/**
+ * @brief set nework power mode, for tcam enter standby or exit standby
+ * @param [in] mode TRUE(1) when enter standby, FALSE(0) after wake up
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_network_set_power_mode(char mode);
+
+
+/**
+ * @brief get sim state
+ * @param [out] sim_state sim status as sim_status_e_type
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_get_sim_status(int *sim_state);
+
+
+/**
+ * @brief get iccid function
+ * @param [in] len iccid length,max is 20
+ * @param [out] iccid return iccid from this func
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_get_sim_iccid(int len, char *iccid);
+
+
+/**
+ * @brief get imsi function
+ * @param [in] len imsi length,max is 20
+ * @param [out] iccid return imsi from this func
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_get_sim_imsi(int len, char *imsi);
+
+
+/**
+ * @brief get sim msisdn function
+ * @param [in] len msisdn length,max is 20
+ * @param [out] msisdn msisdn length,max is 20
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_get_sim_msisdn(int len, char *msisdn);
+
+
+/**
+ * @brief get imei function
+ * @param [in] len imei length,max is 20
+ * @param [out] imei return imei from this func
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_get_imei(int len, char *imei);
+
+
+/**
+ * @brief set sim power down
+ * @param
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_set_sim_power_down(void);
+
+
+/**
+ * @brief set sim power up
+ * @param
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_set_sim_power_up(void);
+
+
+/**
+ * @brief reset modem stack only,
+ * @details notice: after use this method, all ril sdk
+ * need restart, means network, sim, sms, data need deinit then init!
+ *
+ * @param
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_reset_modem(void);
+
+
+/**
+ * @brief send sms fuction
+ * @param [in] phone_num dest phone num send sms
+ * @param [in] char_set encode format for sms 0-7bit; 1-binary; 2-usc2
+ * @param [in] msg sms content
+ * @param [in] msg_len send sms length,max is 1024
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_send_sms(char *phone_num, int char_set, char *msg, int msg_len);
+
+
+/**
+ * @brief get smsc fuction
+ * @param [in] len input buf len for smsc,max is 32
+ * @param [out] smsc address for smsc get from this func *
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_get_smsc_address(int len, char *smsc);
+
+
+/**
+ * @brief set smsc fuction
+ * @param [out] smsc string value for smsc,max length is 32
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_set_smsc_address(const char *smsc);
+
+
+/**
+ * @brief convert rsrp rscp rssi to csq value.
+ * @param [in] netType signal radio tech 2 means 2G 3 mens 3G,4 is 4G,5 is 5G
+ * @param [in] sigvalue input signal_strength for different nettype
+ * rsrp for 4G/5G, rscp for 3G, rssi for 2G
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_sigInfo_to_csq(int netType, int sigValue);
+
+
+/**
+ * @brief data call event sdk callback function define
+ * @param [out] Wan_State_ind_s: data connection state and params indication struct
+ * include datacall state , ipv4 ipv6 address, dns address and ifname
+ * @retval void
+ */
+typedef void (*gsw_data_call_evt_cb_t)(Wan_State_ind_s *linkState);
+
+
+/**
+ * @brief use this api to wait data call event ind call back
+ * @param [out] arg
+ * @retval void
+ */
+void *gsw_onUnsolicited(void *arg);
+
+
+/**
+ * @brief datacall sdk init
+ * @param [in] gsw_data_call_evt_cb_t: data connection state change event
+ * call back;
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_data_call_init(gsw_data_call_evt_cb_t evt_cb);
+
+
+/**
+ * @brief data_call sdk deinit
+ * @param
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_data_call_deinit(void);
+
+/**
+ * @brief get apn info
+ * @param [in/out] gsw_apn_param_t:apn info for pub or private apn
+ * inlcude apn name mcc mnc, passwork apnid authtype iptype etc
+ * @return int : 0 is success , other failed
+ */
+void gsw_get_apn_info(int linkid, gsw_apn_param_t *apn_para);
+
+/**
+ * @brief set apn parameters for data call
+ * @param [in/out] Link_Info_s: for pub or private datacall
+ * inlcude apn name mcc mnc, passwork apnid type cid etc
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_data_call_set_apn(Link_Info_s *LinkInf);
+
+
+/**
+ * @brief set apn parameters for data call
+ * 接口超时时间:120s
+ * 如接口返回失败,不要给apn回调:gsw_data_call_evt_cb_t
+ * 如接口返回成功,从接口调用开始计时,到收到apn回调:gsw_data_call_evt_cb_t,不能超过120s
+ * @param [in] linkid data connetion link number
+ * @param [in/out] Link_Info_s: apn info for pub or private datacall
+ * inlcude apn name mcc mnc, passwork apnid etc
+ * resp: data call link state ipaddress type etc
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_data_call_connect(int linkid, Link_Info_s *LinkInf);
+
+
+/**
+ * @brief set apn parameters for data call
+ * @param [in] linkid
+ * @param [in/out] Link_Info_s: apn info for pub or private datacall
+ * inlcude apn name mcc mnc, passwork apnid etc
+ * resp: data call link state ipaddress type etc
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_data_call_disconnect(int linkid, Link_Info_s *LinkInf);
+
+
+/**
+ * @brief get the data traffic infos
+ @param [in] linkid apn id
+ @param [out] gsw_data_pkt_stats obtian actual data call network card data traffic
+ @retval 0: success
+ @retval 0: other: fail
+ */
+int gsw_get_data_call_pkt_stats(int linkid, gsw_data_pkt_stats *data_pkt);
+
+/**
+ * @brief clear data call if needed when receive apn down event
+ * @param [in] linkid
+ * @param [in/out] Link_Info_s: apn info for pub or private datacall
+ * inlcude apn name mcc mnc, passwork apnid etc
+ * resp: data call link state ipaddress type etc
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_data_call_clear_session(int linkid, Link_Info_s *LinkInf);
+
+/**
+ * @brief Set apn binding to specify interface id
+ * @details This interface supports a total of 8 reserved id information
+ * and the reserved id value ranges from 0-7
+ *
+ * @param [in] reserved_id: -1 unset reserved id,0-7 set reserved id
+ * @param [in] apn APN name
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_set_apn_reserved_id(int reserved_id, const char *apn);
+
+/**
+ * @brief Get the apn name bound to the specified interface id
+ * @param [in] reserved_id Network reserved interface id
+ * @param [out] apn_str APN name
+ * @param [in] apn_str_size APN name size
+ * @retval 0-7: success
+ * @retval -1: unbind reserved id
+ */
+int gsw_get_apn_reserved_name(int reserved_id, char *apn_str, int apn_str_size);
+
+/**
+ * @brief Get apn binding to specify interface id
+ * @param [in] apn
+ * @retval 0: success
+ * @retval 0-7: success
+ * @retval -1: unbind reserved id
+ */
+int gsw_get_apn_reserved_id(const char *apn);
+
+/**
+ * @brief Get get modem state
+ * @param
+ * @retval 0: ok
+ * @retval other: error
+ */
+
+int gsw_get_modem_state_exp(void);
+
+/**
+ * @brief set modem status event callback
+ * @param [in] GSW_NW_ModemStateHandlePtr
+ * @retval 0 : success
+ * @retval other: fail
+ */
+int gsw_reg_set_modem_status_event_callback(GSW_NW_ModemStateHandlePtr handle_ptr);
+
+/**
+ * @brief get tcamid function
+ * @param [in] len tcamid length
+ * @param [out] iccid return tcamid from this func
+ * @retval 0 : success
+ * @retval other: fail
+ */
+int gsw_get_tcamid(int len, char *tcamid);
+
+
+/**
+* @brief Module log disk drop, used when restarting or hibernating
+* @param [in]void
+* @retval void
+*/
+void gsw_modem_log_sync(void);
+
+#if defined(__cplusplus)
+extern "C" }
+#endif
+
+#endif /*GSW_NWINFO_INTERFACE_H*/
diff --git a/mbtk/include/gsw/gsw_oem_rw_interface.h b/mbtk/include/gsw/gsw_oem_rw_interface.h
new file mode 100755
index 0000000..51aadcd
--- /dev/null
+++ b/mbtk/include/gsw/gsw_oem_rw_interface.h
@@ -0,0 +1,51 @@
+/**
+* @file : gsw_oem_rw_interface.h
+* @brief : sdk interface
+* @date :
+* @author :
+* @version : v1.0
+* @copyright
+*/
+#ifndef GSW_OEM_RW_INTERFACE_H
+#define GSW_OEM_RW_INTERFACE_H
+
+#include "gsw_hal_errcode.h"
+
+/**
+ * @brief SDK interface to read data from spec page of flash only GM552A
+ * @param [in] read data
+ * @param [in] size, it must be less than (64 * 4096 - 8)Byte
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_oem_read_data(void *data, unsigned int *len);
+
+/**
+ * @brief SDK interface to write data to spec page of flash only GM552A
+ * @param [in] write data
+ * @param [in] size, it must be less than (64 * 4096 - 8)Byte
+ * @retval 0: success
+ * @retval other: fail
+ */
+int gsw_oem_write_data(void *data, unsigned int len);
+
+/**
+ * @brief Read data from spec block of flash
+ * @param [in] unsigned int
+ * @param [out] void *
+ * @param [out] unsigned int *
+ * @retval GSW_HAL_SUCCESS\GSW_HAL_FAIL
+ */
+int gsw_oem_read_data_ext(unsigned int block_id, void *data, unsigned int *len);
+
+/**
+ * @brief Write data to spec block of flash
+ * @param [in] unsigned int
+ * @param [in] void *
+ * @param [in] unsigned int
+ * @retval 0: success
+ * @retval GSW_HAL_SUCCESS\GSW_HAL_FAIL
+ */
+int gsw_oem_write_data_ext(unsigned int block_id, void *data, unsigned int len);
+#endif /*GSW_RTC_INTERFACE_H*/
+
diff --git a/mbtk/include/gsw/gsw_passwd.h b/mbtk/include/gsw/gsw_passwd.h
new file mode 100755
index 0000000..c46e8b2
--- /dev/null
+++ b/mbtk/include/gsw/gsw_passwd.h
@@ -0,0 +1,7 @@
+
+
+#include <string.h>
+#include <stdio.h>
+
+
+int gsw_set_passwd(char *username, char *passwd);
diff --git a/mbtk/include/gsw/gsw_sms.h b/mbtk/include/gsw/gsw_sms.h
index 916110c..c35fc7b 100755
--- a/mbtk/include/gsw/gsw_sms.h
+++ b/mbtk/include/gsw/gsw_sms.h
@@ -6,16 +6,7 @@
#define GSW_HAL_SMS_ADDRESS_LEN 16
#define GSW_HAL_SMS_RECV_CONT_MAX 1024
#define GSW_HAL_SMS_CONTENT_LEN 1024
-#define MIN_MSM_PARAM_NUM 4
-#define MIN_IMS_MSM_PARAM_NUM 6
-#define MIN_WRITMSM_PARAM_NUM 5
-#define MSG_MAX_LEN 1024
-#define TELEPHONNUM_LEN 64
-#define STORAGSMS_MAX_SIZE 128
-#define SMSC_MAX_LEN 22
-#define SMS_NUM_MAX 255
-#define MSM_NUMBER_MAX 1024+1
-#define RES_NUM_MIN 128
+
// gsw include
diff --git a/mbtk/include/gsw/gsw_tee.h b/mbtk/include/gsw/gsw_tee.h
new file mode 100755
index 0000000..197f16e
--- /dev/null
+++ b/mbtk/include/gsw/gsw_tee.h
@@ -0,0 +1,578 @@
+#include <stdlib.h>
+#include <stdint.h>
+#include <string.h>
+#include <stdbool.h>
+#include <stdio.h>
+
+
+#define GSW_HAL_SUCCESS 0
+#define GSW_HAL_FAIL -1
+#define GSW_HAL_MEM_INVAILD -2
+#define GSW_HAL_NOFOUND -3
+
+typedef enum {
+ GSW_TEE_PARAM_DATA = 1,
+ GSW_TEE_PARAM_FILE
+}GSW_TEE_PARAM_TYPE;
+
+typedef enum {
+ GSW_TEE_DIGEST_MD5 = 1,
+ GSW_TEE_DIGEST_SHA1,
+ GSW_TEE_DIGEST_SHA256,
+}GSW_TEE_DIGEST_TYPE;
+
+typedef enum {
+ GSW_TEE_AES_ECB = 1,
+ GSW_TEE_AES_CBC,
+ GSW_TEE_AES_CMAC,
+ GSW_TEE_AES_GCM,
+}GSW_TEE_AES_ALGO_TYPE;
+
+typedef enum {
+ GSW_TEE_AES_128 = 1,
+ GSW_TEE_AES_192,
+ GSW_TEE_AES_256
+}GSW_TEE_AES_ALGO_BITS;
+
+typedef enum {
+ GSW_TEE_AES_PADDING_NONE = 1,
+ GSW_TEE_AES_PADDING_PKCS7
+}GSW_TEE_AES_PADDING_TYPE;
+
+typedef enum {
+ GSW_TEE_CRYPTO_ENCRYPT = 1,
+ GSW_TEE_CRYPTO_DECRYPT,
+ GSW_TEE_CRYPTO_SIGN,
+ GSW_TEE_CRYPTO_VERIFY
+}GSW_TEE_CRYPTO_TYPE;
+
+typedef enum {
+ GSW_TEE_RSA_BITS_2048 = 1,
+ GSW_TEE_RSA_BITS_3072,
+ GSW_TEE_RSA_BITS_4096
+}GSW_TEE_RSA_BITS_TYPE;
+
+typedef enum {
+ GSW_TEE_RSA_ED_PADDING_NONE = 1,
+ GSW_TEE_RSA_ED_PADDING_PKCS1,
+ GSW_TEE_RSA_ED_PADDING_OAEP
+}GSW_TEE_RSA_ED_PADDING_TYPE;
+
+typedef enum {
+ GSW_TEE_SV_SRC_DATA = 1,
+ GSW_TEE_SV_SRC_SHA256,
+ GSW_TEE_SV_SRC_SHA384,
+ GSW_TEE_SV_SRC_SHA512
+}GSW_TEE_SV_SRC_TYPE;
+
+typedef enum {
+ GSW_TEE_RSA_SV_PADDING_NONE = 1,
+ GSW_TEE_RSA_SV_PADDING_PKCS1_V1_5,
+ GSW_TEE_RSA_SV_PADDING_PSS
+}GSW_TEE_RSA_SV_PADDING_TYPE;
+
+typedef enum {
+ GSW_TEE_ECC_ED_CURVE_ALGO_NISTP192=1,
+ GSW_TEE_ECC_ED_CURVE_ALGO_NISTP224,
+ GSW_TEE_ECC_ED_CURVE_ALGO_NISTP256,
+ GSW_TEE_ECC_ED_CURVE_ALGO_NISTP384,
+ GSW_TEE_ECC_ED_CURVE_ALGO_NISTP521
+}GSW_TEE_ECC_ED_CURVE_ALGO_MODE;
+
+typedef enum {
+ GSW_TEE_ECC_BITS_192=1,
+ GSW_TEE_ECC_BITS_224,
+ GSW_TEE_ECC_BITS_256,
+ GSW_TEE_ECC_BITS_384,
+ GSW_TEE_ECC_BITS_521
+}GSW_TEE_ECC_BITS_TYPE;
+
+typedef enum {
+ GSW_TEE_ECC_SV_CURVE_ALGO_ECDSA = 1,
+ GSW_TEE_ECC_SV_CURVE_ALGO_EDDSA,
+}GSW_TEE_ECC_SV_CURVE_ALGO_MODE;
+
+typedef enum {
+ GSW_TEE_SM4_ECB = 1,
+ GSW_TEE_SM4_CBC,
+ GSW_TEE_SM4_CFB,
+ GSW_TEE_SM4_CTR,
+ GSW_TEE_SM4_OFB,
+ GSW_TEE_SM4_CMAC,
+ GSW_TEE_SM4_GCM,
+}GSW_TEE_SM4_ALGO_TYPE;
+
+typedef enum {
+ GSW_TEE_SM4_PADDING_PKCS5 = 1,
+ GSW_TEE_SM4_PADDING_PKCS7
+}GSW_TEE_SM4_PADDING_TYPE;
+
+typedef struct
+{
+ unsigned short len; /**< data len*/
+ unsigned char data[512]; /**< key data*/
+} GSW_TEE_KEY_UNIT_INFO;
+
+typedef struct
+{
+ unsigned int bits; /**< Public key bits*/
+ GSW_TEE_KEY_UNIT_INFO x; /**< Public key x component*/
+ GSW_TEE_KEY_UNIT_INFO y; /**< Public key y component*/
+} GSW_TEE_SM2_PUB_KEY;
+
+typedef struct
+{
+ unsigned int bits; /**< Public key bits*/
+ GSW_TEE_KEY_UNIT_INFO x; /**< Public key x component*/
+ GSW_TEE_KEY_UNIT_INFO y; /**< Public key y component*/
+} GSW_TEE_ECC_PUB_KEY;
+
+typedef struct
+{
+ unsigned int bits; /**< Public key bits*/
+ GSW_TEE_KEY_UNIT_INFO n; /**< Mode of public key*/
+ unsigned int e; /**< Power of public key*/
+} GSW_TEE_RSA_PUB_KEY;
+
+typedef struct
+{
+ unsigned int bits; /**< Public key bits*/
+ GSW_TEE_KEY_UNIT_INFO d; /**< Private key*/
+} GSW_TEE_SM2_PRI_KEY;
+
+typedef struct
+{
+ unsigned int bits; /**< Public key bits*/
+ GSW_TEE_KEY_UNIT_INFO d; /**< Private key*/
+ GSW_TEE_ECC_ED_CURVE_ALGO_MODE curve_type; /**< Curve algorithm*/
+} GSW_TEE_ECC_PRI_KEY;
+
+typedef struct
+{
+ GSW_TEE_KEY_UNIT_INFO n; /**< Mode of public key*/
+ GSW_TEE_KEY_UNIT_INFO d;
+} GSW_TEE_RSA_PRI_KEY_ND;
+
+typedef struct
+{
+ GSW_TEE_KEY_UNIT_INFO p; /**< Prime factor 1*/
+ GSW_TEE_KEY_UNIT_INFO q; /**< Prime factor 2*/
+ GSW_TEE_KEY_UNIT_INFO dp; /**< crt powers of p*/
+ GSW_TEE_KEY_UNIT_INFO dq; /**< crt powers of q*/
+ GSW_TEE_KEY_UNIT_INFO ce; /**< The inverse modulo p of q*/
+} GSW_TEE_RSA_PRI_KEY_PQDC;
+
+typedef struct
+{
+ unsigned int bits; /**< Public key bits*/
+ union RSA_KEY_INFO{
+ GSW_TEE_RSA_PRI_KEY_ND ne;
+ GSW_TEE_RSA_PRI_KEY_PQDC pqdc;
+ }key_info;
+} GSW_TEE_RSA_PRI_KEY;
+
+typedef struct
+{
+ GSW_TEE_CRYPTO_TYPE crypto_type; /**< Type of operation*/
+ GSW_TEE_AES_ALGO_TYPE algo_type; /**< Algorithm type*/
+ unsigned int in_iv_len; /**< Vector quantity length*/
+ unsigned char iv[32]; /**< Vector quantity*/
+ GSW_TEE_SM4_PADDING_TYPE padding; /**< Filling mode*/
+ GSW_TEE_PARAM_TYPE data_type; /**< data type*/
+ unsigned int in_data_len; /**< Source data length*/
+ char data[1]; /**< Source data/file name*/
+} GSW_TEE_SM4_IN_PARAM;
+
+typedef struct
+{
+ GSW_TEE_PARAM_TYPE data_type; /**< data type*/
+ unsigned int* p_out_buf_len; /**< File length or buf size*/
+ char data[1]; /**< buf Cache or file path*/
+} GSW_TEE_SM4_OUT_PARAM;
+
+typedef struct
+{
+ GSW_TEE_CRYPTO_TYPE crypto_type; /**< Type of operation*/
+ GSW_TEE_PARAM_TYPE data_type; /**< data type*/
+ GSW_TEE_SV_SRC_TYPE src_type; /**< Type of data source*/
+ GSW_TEE_DIGEST_TYPE digt_type;
+ unsigned int in_data_len; /**< Source data length*/
+ char data[1]; /**< Source data/file name*/
+} GSW_TEE_SM2_SV_IN_PARAM;
+
+typedef struct
+{
+ GSW_TEE_PARAM_TYPE data_type; /**< data type*/
+ unsigned int* p_out_buf_len; /**< File length or buf size*/
+ char data[1]; /**< buf Cache or file path*/
+} GSW_TEE_SM2_SV_OUT_PARAM;
+
+typedef struct
+{
+ GSW_TEE_CRYPTO_TYPE crypto_type; /**< Type of operation*/
+ GSW_TEE_PARAM_TYPE data_type; /**< data type*/
+ unsigned int in_data_len; /**< Source data length*/
+ char data[1]; /**< Source data/file name*/
+} GSW_TEE_SM2_ED_IN_PARAM;
+
+typedef struct
+{
+ GSW_TEE_PARAM_TYPE data_type; /**< data type*/
+ unsigned int* p_out_buf_len; /**< File length or buf size*/
+ char data[1]; /**< buf Cache or file path*/
+} GSW_TEE_SM2_ED_OUT_PARAM;
+
+typedef struct
+{
+ GSW_TEE_CRYPTO_TYPE crypto_type; /**< Type of operation*/
+ GSW_TEE_ECC_BITS_TYPE bits_type; /**< Algorithm bit*/
+ GSW_TEE_ECC_SV_CURVE_ALGO_MODE curve_type; /**< Curve algorithm*/
+ GSW_TEE_DIGEST_TYPE digt_type;
+ GSW_TEE_SV_SRC_TYPE src_type; /**< Type of data source*/
+ GSW_TEE_PARAM_TYPE data_type; /**< data type*/
+ unsigned int in_data_len; /**< Source data length*/
+ char data[1]; /**< Source data/file name*/
+} GSW_TEE_ECC_SV_IN_PARAM;
+
+typedef struct
+{
+ GSW_TEE_PARAM_TYPE data_type; /**< data type*/
+ unsigned int* p_out_buf_len; /**< File length or buf size*/
+ char data[1]; /**< buf Cache or file path*/
+} GSW_TEE_ECC_SV_OUT_PARAM;
+
+typedef struct
+{
+ GSW_TEE_CRYPTO_TYPE crypto_type; /**< Type of operation*/
+ GSW_TEE_ECC_BITS_TYPE bits_type; /**< Algorithm bit*/
+ GSW_TEE_ECC_ED_CURVE_ALGO_MODE curve_type; /**< Curve algorithm*/
+ GSW_TEE_PARAM_TYPE data_type; /**< data type*/
+ unsigned int in_data_len; /**< Source data length*/
+ char data[1]; /**< Source data/file name*/
+} GSW_TEE_ECC_ED_IN_PARAM;
+
+typedef struct
+{
+ GSW_TEE_PARAM_TYPE data_type; /**< data type*/
+ unsigned int* p_out_buf_len; /**< File length or buf size*/
+ char data[1]; /**< buf Cache or file path*/
+} GSW_TEE_ECC_ED_OUT_PARAM;
+
+typedef struct
+{
+ GSW_TEE_CRYPTO_TYPE crypto_type; /**< Type of operation*/
+ GSW_TEE_RSA_SV_PADDING_TYPE padding; /**< Filling mode*/
+ GSW_TEE_RSA_BITS_TYPE bits_type; /**< Algorithm bit*/
+ GSW_TEE_SV_SRC_TYPE src_type; /**< Type of data source*/
+ GSW_TEE_DIGEST_TYPE digt_type;
+ GSW_TEE_PARAM_TYPE data_type; /**< data type*/
+ unsigned int in_data_len; /**< Source data length*/
+ char data[1]; /**< Source data/file name*/
+} GSW_TEE_RSA_SV_IN_PARAM;
+
+typedef struct
+{
+ GSW_TEE_PARAM_TYPE data_type; /**< data type*/
+ unsigned int* p_out_buf_len; /**< File length or buf size*/
+ char data[1]; /**< buf Cache or file path*/
+} GSW_TEE_RSA_SV_OUT_PARAM;
+
+typedef struct
+{
+ GSW_TEE_CRYPTO_TYPE crypto_type; /**< Type of operation*/
+ GSW_TEE_RSA_ED_PADDING_TYPE padding; /**< Filling mode*/
+ GSW_TEE_RSA_BITS_TYPE bits_type; /**< Algorithm bit*/
+ GSW_TEE_PARAM_TYPE data_type; /**< data type*/
+ unsigned int in_data_len; /**< Source data length*/
+ char data[1]; /**< Source data/file name*/
+} GSW_TEE_RSA_ED_IN_PARAM;
+
+typedef struct
+{
+ GSW_TEE_PARAM_TYPE data_type; /**< data type*/
+ unsigned int* p_out_buf_len; /**< File length or buf size*/
+ char data[1]; /**< buf Cache or file path*/
+} GSW_TEE_RSA_ED_OUT_PARAM;
+
+typedef struct
+{
+ GSW_TEE_CRYPTO_TYPE crypto_type; /**< Type of operation*/
+ GSW_TEE_AES_ALGO_TYPE algo_type; /**< Algorithm type*/
+ unsigned int in_iv_len; /**< Vector quantity length*/
+ unsigned char iv[32]; /**< Vector quantity*/
+ GSW_TEE_AES_PADDING_TYPE padding; /**< Filling mode*/
+ GSW_TEE_PARAM_TYPE data_type; /**< data type*/
+ unsigned int in_data_len; /**< Source data length*/
+ char data[1]; /**< Source data/file name*/
+} GSW_TEE_AES_IN_PARAM;
+
+typedef struct
+{
+ GSW_TEE_PARAM_TYPE data_type; /**< data type*/
+ unsigned int* p_out_buf_len; /**< File length or buf size*/
+ char data[1]; /**< buf Cache or file path*/
+} GSW_TEE_AES_OUT_PARAM;
+
+
+
+/**
+* @brief init tee sdk
+* @param [in] None
+* @param [out] None
+* @retval GSW_HAL_SUCCESS is success\other is fail
+*/
+int32_t gsw_tee_sdk_init(void);
+
+/**
+* @brief read sensitive data from tee
+* @param [in] char* in_obj_name :Sensitive data name
+* @param [in] unsigned int* p_out_buf_len:The size of sensitive data output cache
+* @param [out] char* out_buf:Cache of sensitive data output
+* @param [out] unsigned int* p_out_buf_len:Sensitive data length
+* @retval GSW_HAL_SUCCESS is success\other is fail
+*/
+int32_t gsw_tee_read_secure_data(const char* in_obj_name, char* out_buf, unsigned int* p_out_buf_len);
+
+/**
+* @brief write sensitive data to tee
+* @param [in] char* in_obj_name :Sensitive data name
+* @param [in] char* in_buf:A cache for writing sensitive data
+* @param [out] unsigned int in_buf_len:Sensitive data length
+* @retval GSW_HAL_SUCCESS is success\other is fail
+*/
+int32_t gsw_tee_write_secure_data(const char* in_obj_name, char* in_buf, unsigned int in_buf_len);
+
+/**
+* @brief delete sensitive data from tee
+* @param [in] char* in_obj_name :Sensitive data name
+* @retval GSW_HAL_SUCCESS is success\other is fail
+*/
+int32_t gsw_tee_delete_secure_data(const char* in_obj_name);
+
+/**
+* @brief check sensitive data from tee
+* @param [in] char* in_obj_name :Sensitive data name
+* @retval GSW_HAL_SUCCESS is exist\ other is not exist or fail
+*/
+int32_t gsw_tee_check_secure_data(const char* in_obj_name);
+
+/**
+* @brief digest algorithm
+* @param [in] char* in_data :Source data/file name
+* @param [in] unsigned int in_data_len :Source data length
+* @param [in] unsigned int* p_out_buf_len:The size of Destination cache
+* @param [in] GSW_TEE_PARAM_TYPE in_param: in_data param type
+* @param [in] GSW_TEE_DIGEST_TYPE in_digest: digest algo type
+* @param [out] char *out_buf:Destination cache
+* @param [out] unsigned int* p_out_buf_len:Destination data length
+* @retval GSW_HAL_SUCCESS is success\other is fail
+*/
+int32_t gsw_tee_digest_algo(char* in_data, unsigned int in_data_len, char *out_buf, unsigned int* p_out_buf_len,GSW_TEE_PARAM_TYPE in_param,GSW_TEE_DIGEST_TYPE in_digest);
+
+/**
+* @brief aes algorithm
+* @param [in] char* in_obj_name :Key name or key information structure
+* @param [in] GSW_TEE_AES_IN_PARAM* in_param :Entry information
+* @param [in/out] GSW_TEE_AES_OUT_PARAM out_param :Exit message
+* @retval GSW_HAL_SUCCESS is success\other is fail
+*/
+int32_t gsw_tee_aes_algo(char* in_obj_name, GSW_TEE_AES_IN_PARAM* in_param, GSW_TEE_AES_OUT_PARAM* out_param);
+
+/**
+* @brief generate random
+* @param [in] unsigned int in_len :generate random bits
+* @param [in] GSW_TEE_PARAM_TYPE out_param:out_buf param type
+* @param [out/in] char *out_buf:Destination cache/file name
+* @retval GSW_HAL_SUCCESS is success\other is fail
+*/
+int32_t gsw_tee_gen_random(char *out_buf, unsigned int in_len,GSW_TEE_PARAM_TYPE out_param);
+
+/**
+* @brief rsa Encryption and decryption algorithm
+* @param [in] char* in_obj_name :Key name or key information structure
+* @param [in] GSW_TEE_RSA_ED_IN_PARAM * in_param:Entry information
+* @param [in/out] GSW_TEE_RSA_ED_OUT_PARAM * out_param:Exit message
+* @retval GSW_HAL_SUCCESS is success\other is fail
+*/
+int32_t gsw_tee_rsa_ed_algo(char* in_obj_name, GSW_TEE_RSA_ED_IN_PARAM * in_param, GSW_TEE_RSA_ED_OUT_PARAM * out_param);
+
+/**
+* @brief rsa Signature verification algorithm
+* @param [in] char* in_obj_name :Key name or key information structure
+* @param [in] GSW_TEE_RSA_SV_IN_PARAM* in_param :Source data/file name
+* @param [in/out] GSW_TEE_RSA_SV_OUT_PARAM* out_param :Source data length
+* @retval GSW_HAL_SUCCESS is success\other is fail
+*/
+int32_t gsw_tee_rsa_sv_algo(char* in_obj_name, GSW_TEE_RSA_SV_IN_PARAM* in_param, GSW_TEE_RSA_SV_OUT_PARAM* out_param);
+
+/**
+* @brief ecc Encryption and decryption algorithm
+* @param [in] char* in_obj_name :Key name or key information structure
+* @param [in] GSW_TEE_ECC_ED_IN_PARAM * in_param:Entry information
+* @param [in/out] GSW_TEE_ECC_ED_OUT_PARAM * out_param:Exit message
+* @retval GSW_HAL_SUCCESS is success\other is fail
+*/
+int32_t gsw_tee_ecc_ed_algo(char* in_obj_name,GSW_TEE_ECC_ED_IN_PARAM * in_param, GSW_TEE_ECC_ED_OUT_PARAM * out_param);
+
+/**
+* @brief ecc Signature verification algorithm
+* @param [in] char* in_obj_name :Key name or key information structure
+* @param [in] GSW_TEE_ECC_SV_IN_PARAM* in_param :Source data/file name
+* @param [in/out] GSW_TEE_ECC_SV_OUT_PARAM* out_param :Source data length
+* @retval GSW_HAL_SUCCESS is success\other is fail
+*/
+int32_t gsw_tee_ecc_sv_algo(char* in_obj_name,GSW_TEE_ECC_SV_IN_PARAM * in_param, GSW_TEE_ECC_SV_OUT_PARAM * out_param);
+
+/**
+* @brief sm2 Encryption and decryption algorithm
+* @param [in] char* in_obj_name :Key name or key information structure
+* @param [in] GSW_TEE_SM2_ED_IN_PARAM * in_param:Entry information
+* @param [in/out] GSW_TEE_SM2_ED_OUT_PARAM * out_param:Exit message
+* @retval GSW_HAL_SUCCESS is success\other is fail
+*/
+int32_t gsw_tee_sm2_ed_algo(char* in_obj_name, GSW_TEE_SM2_ED_IN_PARAM* in_param, GSW_TEE_SM2_ED_OUT_PARAM *out_param);
+
+/**
+* @brief sm2 Signature verification algorithm
+* @param [in] char* in_obj_name :Key name or key information structure
+* @param [in] GSW_TEE_SM2_SV_IN_PARAM * in_param:Entry information
+* @param [in/out] GSW_TEE_SM2_SV_OUT_PARAM * out_param:Exit message
+* @retval GSW_HAL_SUCCESS is success\other is failL
+*/
+int32_t gsw_tee_sm2_sv_algo(char* in_obj_name, GSW_TEE_PARAM_TYPE* in_param, GSW_TEE_PARAM_TYPE* out_param);
+
+/**
+* @brief sm3 algorithm
+* @param [in] char* in_data :Source data/file name
+* @param [in] unsigned int in_data_len :Source data length
+* @param [in] unsigned int* p_out_buf_len:The size of Destination cache
+* @param [in] GSW_TEE_PARAM_TYPE in_param: in_data param type
+* @param [out] char *out_buf:Destination cache
+* @param [out] unsigned int* p_out_buf_len:Destination data length
+* @retval GSW_HAL_SUCCESS is success\other is fail
+*/
+int32_t gsw_tee_sm3_algo(char* in_data, unsigned int in_data_len, char *out_buf, unsigned int* p_out_buf_len,GSW_TEE_PARAM_TYPE in_param);
+
+/**
+* @brief sm4 algorithm
+* @param [in] char* in_obj_name :Key name or key information structure
+* @param [in] GSW_TEE_AM4_IN_PARAM* in_param :Entry information
+* @param [in/out] GSW_TEE_AM4_OUT_PARAM out_param :Exit message
+* @retval GSW_HAL_SUCCESS is success\other is fail
+*/
+int32_t gsw_tee_sm4_algo(char* in_obj_name, GSW_TEE_SM4_IN_PARAM* in_param, GSW_TEE_SM4_OUT_PARAM *out_param);
+
+/**
+* @brief key import
+* @param [in] char* in_obj_name :Key name or key information structure
+* @param [in] char* in_data :Source data/file name
+* @param [in] unsigned int in_data_len :Source data length
+* @param [in] bool permanent :Key import type
+* @param [out] void *out_buf :Returns key information
+* @retval GSW_HAL_SUCCESS is success\other is fail
+*/
+int32_t gsw_tee_aes_key_import(char* in_obj_name, char* in_data, unsigned int in_data_len,void *out_buf,bool permanent);
+
+/**
+* @brief rsa key import
+* @param [in] char* in_obj_name :Key name or key information structure
+* @param [in] GSW_TEE_RSA_PUB_KEY* in_pub_data :Public key information
+* @param [in] GSW_TEE_RSA_PRI_KEY* in_pri_data :Private key information
+* @param [in] bool permanent :Key import type
+* @param [out] void *out_buf :Returns key information
+* @retval GSW_HAL_SUCCESS is success\other is fail
+*/
+int32_t gsw_tee_rsa_key_import(char* in_obj_name, GSW_TEE_RSA_PUB_KEY* in_pub_data,GSW_TEE_RSA_PRI_KEY* in_pri_data,void *out_buf,bool permanent);
+
+/**
+* @brief ecc key import
+* @param [in] char* in_obj_name :Key name or key information structure
+* @param [in] GSW_TEE_ECC_PUB_KEY* in_data :Public key information
+* @param [in] GSW_TEE_ECC_PRI_KEY* in_data :Private key information
+* @param [in] bool permanent :Key import type
+* @param [out] void *out_buf :Returns key information
+* @retval GSW_HAL_SUCCESS is success\other is fail
+*/
+int32_t gsw_tee_ecc_key_import(char* in_obj_name, GSW_TEE_ECC_PUB_KEY* in_pub_data, GSW_TEE_ECC_PRI_KEY* in_pri_data,void *out_buf,bool permanent);
+
+/**
+* @brief ecc key import
+* @param [in] char* in_obj_name :Key name or key information structure
+* @param [in] GSW_TEE_SM2_PUB_KEY* in_data :Public key information
+* @param [in] GSW_TEE_SM2_PRI_KEY* in_data :Private key information
+* @param [in] bool permanent :Key import type
+* @param [out] void *out_buf :Returns key information
+* @retval GSW_HAL_SUCCESS is success\other is fail
+*/
+int32_t gsw_tee_sm2_key_import(char* in_obj_name, GSW_TEE_SM2_PUB_KEY* in_pub_data, GSW_TEE_SM2_PRI_KEY* in_pri_data,void *out_buf,bool permanent);
+
+/**
+* @brief sm4 key import
+* @param [in] char* in_obj_name :Key name or key information structure
+* @param [in] char* in_data :Source data/file name
+* @param [in] unsigned int in_data_len :Source data length
+* @param [in] bool permanent :Key import type
+* @param [out] void *out_buf :Returns key information
+* @retval GSW_HAL_SUCCESS is success\other is fail
+*/
+int32_t gsw_tee_sm4_key_import(char* in_obj_name, char* in_data, unsigned int in_data_len,void *out_buf,bool permanent);
+
+/**
+* @brief key export
+* @param [in] char* in_obj_name :Key name or key information structure
+* @param [in] unsigned int* p_out_buf_len:The size of Destination cache
+* @param [out] char *out_buf:Destination cache/file name
+* @param [out] unsigned int* p_out_buf_len:Destination data length
+* @retval GSW_HAL_SUCCESS is success\other is fail
+*/
+int32_t gsw_tee_aes_key_export(char* in_obj_name, char *out_buf, unsigned int* p_out_buf_len);
+
+/**
+* @brief key export
+* @param [in] char* in_obj_name :Key name or key information structure
+* @param [out] GSW_TEE_RSA_PUB_KEY*out_buf:Destination cache
+* @retval GSW_HAL_SUCCESS is success\other is fail
+*/
+int32_t gsw_tee_rsa_pub_key_export(char* in_obj_name, GSW_TEE_RSA_PUB_KEY*out_buf);
+
+/**
+* @brief ecc key export
+* @param [in] char* in_obj_name :Key name or key information structure
+* @param [out] GSW_TEE_ECC_PUB_KEY *out_buf:Destination cache
+* @retval GSW_HAL_SUCCESS is success\other is fail
+*/
+int32_t gsw_tee_ecc_pub_key_export(char* in_obj_name, GSW_TEE_ECC_PUB_KEY*out_buf);
+
+/**
+* @brief sm2 key export
+* @param [in] char* in_obj_name :Key name or key information structure
+* @param [out] GSW_TEE_SM2_PUB_KEY *out_buf:Destination cache
+* @retval GSW_HAL_SUCCESS is success\other is fail
+*/
+int32_t gsw_tee_sm2_pub_key_export(char* in_obj_name, GSW_TEE_SM2_PUB_KEY*out_buf);
+
+/**
+* @brief sm4 key export
+* @param [in] char* in_obj_name :Key name or key information structure
+* @param [in] unsigned int* p_out_buf_len:The size of Destination cache
+* @param [out] char *out_buf:Destination cache/file name
+* @param [out] unsigned int* p_out_buf_len:Destination data length
+* @retval GSW_HAL_SUCCESS is success\other is fail
+*/
+int32_t gsw_tee_sm4_key_export(char* in_obj_name, char *out_buf, unsigned int* p_out_buf_len);
+
+/**
+* @brief delete key
+* @param [in] char* in_obj_name :Key name or key information structure
+* @retval GSW_HAL_SUCCESS is success\other is fail
+*/
+int32_t gsw_tee_key_delete(char* in_obj_name);
+
+/**
+* @brief deinit tee sdk
+* @param [in] None
+* @param [out] None
+* @retval GSW_HAL_SUCCESS is success\other is fail
+*/
+int32_t gsw_tee_sdk_deinit(void);
+
diff --git a/mbtk/include/gsw/gsw_usb.h b/mbtk/include/gsw/gsw_usb.h
new file mode 100755
index 0000000..f125419
--- /dev/null
+++ b/mbtk/include/gsw/gsw_usb.h
@@ -0,0 +1,29 @@
+
+
+#include <string.h>
+#include <stdio.h>
+#include <stdbool.h>
+
+#define GSW_HAL_SUCCESS 0
+#define GSW_HAL_FAIL -1 //表示失败
+
+
+typedef enum{
+ EN_GSW_USB_SWITCH_CLOSE=0,
+ EN_GSW_USB_SWITCH_OPEN,
+ EN_GSW_USB_SWITCH_MAX,
+}EN_GSW_USB_SWITCH_TYPE;
+
+/**
+* @brief Power failure Save usb switch
+* @param [in] EN_GSW_USB_SWITCH_TYPE type:open or close type
+* @retval GSW_HAL_SUCCESS is success\other is fail
+*/
+int32_t gsw_usb_permanent_switch(EN_GSW_USB_SWITCH_TYPE type);
+
+/**
+* @brief usb switch is not saved after power failure
+* @param [in] EN_GSW_USB_SWITCH_TYPE type:open or close type
+* @retval GSW_HAL_SUCCESS is success\other is fail
+*/
+int32_t gsw_usb_tempporary_switch(EN_GSW_USB_SWITCH_TYPE type);
diff --git a/mbtk/include/gsw/gsw_voice.h b/mbtk/include/gsw/gsw_voice.h
index ef465dc..78a659b 100755
--- a/mbtk/include/gsw/gsw_voice.h
+++ b/mbtk/include/gsw/gsw_voice.h
@@ -50,15 +50,6 @@
*/
int32_t gsw_voice_set_speaker_volume(int32_t volume);
-
-/**
-* @brief set audio mode
-* @param [in] AudioMode audioMode
-* @param [out] None
-* @retval GSW_HAL_SUCCESS\GSW_HAL_FAIL
-*/
-int32_t gsw_voice_set_audio_mode(AudioMode audioMode);
-
/**
* @brief start a voice call
* @param [in] char *callNumber
@@ -93,6 +84,14 @@
int32_t gsw_voice_set_auto_answer_mode(int32_t mode);
/**
+* @brief set audio mode
+* @param [in] AudioMode audioMode
+* @param [out] None
+* @retval GSW_HAL_SUCCESS\GSW_HAL_FAIL
+*/
+int32_t gsw_voice_set_audio_mode(AudioMode audioMode);
+
+/**
* @brief set rtp ip address of remote
* @param [in] char *ip :ip address
* @param [in] int32_t len: length
@@ -101,16 +100,6 @@
*/
int32_t gsw_voice_set_remote_rtp_ip(const char *ip, int32_t len);
-
-/**
-* @brief set rtp vlan Noneme
-* @param [in] char *interfaceNoneme:vlan Noneme
-* @param [out] None
-* @retval GSW_HAL_SUCCESS\GSW_HAL_FAIL
-*/
-int32_t gsw_voice_set_rtp_vlan_info(const char *interfaceNoneme);
-
-
/**
* @brief set rtp mode and port
* @param [in] RTPMode rtpMode: rtp mode
@@ -129,3 +118,11 @@
* @retval GSW_HAL_SUCCESS\GSW_HAL_FAIL
*/
int32_t gsw_voice_set_rtp_param(int32_t clockRate, int32_t channel, int32_t latency);
+
+/**
+* @brief get current call end reason
+* @param [in] CallHandle handle
+* @param [out] None
+* @retval GSW_HAL_SUCCESS\GSW_HAL_FAIL
+*/
+int32_t gsw_voice_get_current_call_end_reason(CallHandle handle);