Add toolchain and mbtk source
Change-Id: Ie12546301367ea59240bf23d5e184ad7e36e40b3
diff --git a/mbtk/include/lynq/lynq_audio_api.h b/mbtk/include/lynq/lynq_audio_api.h
new file mode 100755
index 0000000..6e709dc
--- /dev/null
+++ b/mbtk/include/lynq/lynq_audio_api.h
@@ -0,0 +1,41 @@
+/*
+*
+* Data : 2022/10/27 17:26:46
+* Author : LuoJian
+*/
+#ifndef _LYNQ_AUDIO_API_H
+#define _LYNQ_AUDIO_API_H
+#include "mbtk_audio.h"
+
+//播放音频文件
+int lynq_media_play_audio(const char *path);
+
+//停止播放音频文件
+void lynq_media_stop_audio(void);
+
+//录制音频文件
+int lynq_media_rec_audio(const char *path);
+
+//停止录制音频文件
+void lynq_media_rec_stop_audio(void);
+
+//获取功放音量
+//volume (0~100)
+int lynq_get_spk_volume(int* volume);
+
+//设置功放音量。
+int lynq_set_spk_volume(const int volume);
+
+//获取麦克风音量
+int lynq_get_mic_volume(int* volume);
+
+//设置麦克风音量
+int lynq_set_mic_volume(const int volume);
+
+
+int lynq_audio_ubus_client_init(mbtk_audio_client_handle_type *ph_audio, mbtk_dtmf_cb cb);
+
+int lynq_audio_ubus_client_deinit(mbtk_audio_client_handle_type h_audio);
+
+#endif /* _LYNQ_AUDIO_API_H */
+
diff --git a/mbtk/include/lynq/lynq_call_api.h b/mbtk/include/lynq/lynq_call_api.h
new file mode 100755
index 0000000..bdb9ffe
--- /dev/null
+++ b/mbtk/include/lynq/lynq_call_api.h
@@ -0,0 +1,72 @@
+/*
+*
+* Data : 2022/11/07 16:57:28
+* Author : HanZhiyu
+*/
+#include "mbtk_audio.h"
+
+typedef enum {
+ LYNQ_CALL_FAIL_UNOBTAINABLE_NUMBER = 1,
+ LYNQ_CALL_FAIL_NORMAL = 16,
+ LYNQ_CALL_FAIL_BUSY = 17,
+ LYNQ_CALL_FAIL_CONGESTION = 34,
+ LYNQ_CALL_FAIL_ACM_LIMIT_EXCEEDED = 68,
+ LYNQ_CALL_FAIL_LYNQ_CALL_BARRED = 240,
+ LYNQ_CALL_FAIL_FDN_BLOCKED = 241,
+ LYNQ_CALL_FAIL_IMSI_UNKNOWN_IN_VLR = 242,
+ LYNQ_CALL_FAIL_IMEI_NOT_ACCEPTED = 243,
+ LYNQ_CALL_FAIL_DIAL_MODIFIED_TO_USSD = 244, /* STK LYNQ_CALL Control */
+ LYNQ_CALL_FAIL_DIAL_MODIFIED_TO_SS = 245,
+ LYNQ_CALL_FAIL_DIAL_MODIFIED_TO_DIAL = 246,
+ LYNQ_CALL_FAIL_CDMA_LOCKED_UNTIL_POWER_CYCLE = 1000,
+ LYNQ_CALL_FAIL_CDMA_DROP = 1001,
+ LYNQ_CALL_FAIL_CDMA_INTERCEPT = 1002,
+ LYNQ_CALL_FAIL_CDMA_REORDER = 1003,
+ LYNQ_CALL_FAIL_CDMA_SO_REJECT = 1004,
+ LYNQ_CALL_FAIL_CDMA_RETRY_ORDER = 1005,
+ LYNQ_CALL_FAIL_CDMA_ACCESS_FAILURE = 1006,
+ LYNQ_CALL_FAIL_CDMA_PREEMPTED = 1007,
+ LYNQ_CALL_FAIL_CDMA_NOT_EMERGENCY = 1008, /* For non-emergency number dialed
+ during emergency callback mode */
+ LYNQ_CALL_FAIL_CDMA_ACCESS_BLOCKED = 1009, /* CDMA network access probes blocked */
+ LYNQ_CALL_FAIL_ERROR_UNSPECIFIED = 0xffff
+} lynq_last_call_fail_cause_t;
+
+typedef enum{
+ AUDIO_MODE_CODEC = 0, /* Codec */
+ AUDIO_MODE_RTP = 1, /* RTP */
+}LYNQ_Audio_Mode;
+
+typedef enum{
+ RTP_CLIENT = 0, /*客户端,从远端拉文件到本地播放*/
+RTP_SERVER =1, /*服务器端,推文件到远端播放*/
+RTP_MODE_MAX
+}LYNQ_Rtp_Mode;
+
+typedef enum{
+ LYNQ_CALL_ACTIVE,
+ LYNQ_CALL_HOLDING,
+ LYNQ_CALL_DIALING,
+ LYNQ_CALL_ALERTING,
+ LYNQ_CALL_INCOMING,
+ LYNQ_CALL_WAITING,
+ LYNQ_CALL_OFFERING,
+}LYNQ_Call_State;
+
+int lynq_init_call(int uToken);
+int lynq_deinit_call(void);
+int lynq_call(int *handle, char addr[]);
+int lynq_call_answer();
+int lynq_call_hungup_all();
+int lynq_call_hungup(int *handle);
+int lynq_hangup_waiting_or_background(void);
+int lynq_switch_waiting_or_holding_and_active(void);
+int lynq_hangup_foreground_resume_background(void);
+int lynq_wait_incoming_call(void *incoming_call_cb);
+int lynq_get_mute_mic (int *status);
+int lynq_set_mute_mic(const int enable);
+int lynq_set_DTMF(const char callnum);
+int lynq_get_current_call_state(int *handle,int *call_state,int*toa,int *direction,char addr[]);
+//void lynq_audio_volume_cb(int volume);
+int lynq_set_speech_volume(const int volume);
+int lynq_get_speech_volume(int * volume);
diff --git a/mbtk/include/lynq/lynq_ecall_api.h b/mbtk/include/lynq/lynq_ecall_api.h
new file mode 100755
index 0000000..58b6e41
--- /dev/null
+++ b/mbtk/include/lynq/lynq_ecall_api.h
@@ -0,0 +1,71 @@
+#ifndef LYNQ_ECALL_H
+#define LYNQ_ECALL_H
+#include "mbtk_type.h"
+#include "mbtk_log.h"
+
+typedef uint32 ecall_handle_type;
+
+typedef enum{
+ LYNQ_ECALL_SET_NUMBER = 0, /* Set Number */
+ LYNQ_ECALL_SET_URI = 1, /* Set Uri */
+}LYNQ_ECall_Set_Type;
+
+typedef enum{
+ LYNQ_EMER_CAT_MANUAL_ECALL = 0, /* Manual Emergency eCall */
+ LYNQ_EMER_CAT_AUTO_ECALL = 1, /* Automatic Emergency eCall */
+}LYNQ_ECall_Category;
+
+typedef enum{
+ LYNQ_ECALL_TEST = 0, /* Test eCall */
+ LYNQ_ECALL_EMERGENCY = 1, /* Emergency eCall */
+ LYNQ_ECALL_RECONFIG = 2, /* Reconfiguration eCall */
+ LYNQ_ECALL_VAR_MAX,
+}LYNQ_ECall_Variant;
+
+typedef enum{
+ LYNQ_ECALL_SENDING_START = 1,
+ LYNQ_ECALL_SENDING_MSD = 2,
+ LYNQ_ECALL_LLACK_RECEIVED = 3,
+ LYNQ_ECALL_ALACK_POSITIVE_RECEIVED = 4,
+ LYNQ_ECALL_ALACK_CLEARDOWN_RECEIVED = 5,
+ LYNQ_ECALL_ACTIVE = 11,
+ LYNQ_ECALL_DISCONNECTED = 12,
+ LYNQ_ECALL_IMS_ACTIVE = 13,
+ LYNQ_ECALL_IMS_DISCONNECTED = 14,
+ LYNQ_ECALL_ABNORMAL_HANGUP=15,
+ LYNQ_ECALL_IMS_MSD_ACK = 20,
+ LYNQ_ECALL_IMS_UPDATE_MSD = 21,
+ LYNQ_ECALL_IMS_IN_BAND_TRANSFER = 22,
+ LYNQ_ECALL_IMS_MSD_NACK = 23,
+ LYNQ_ECALL_IMS_SRVCC = 24,
+ LYNQ_ECALL_ONLY_DEREGISTRATION = 31,
+ LYNQ_ECALL_MAY_DEREGISTER = 32,
+ LYNQ_ECALL_PSAP_CALLBACK_START = 40,
+ LYNQ_ECALL_PSAP_CALLBACK_IMS_UPDATE_MSD = 41,
+ LYNQ_ECALL_T2_TIMER_OUT = 9000,
+ LYNQ_ECALL_T5_TIMER_OUT = 9001,
+ LYNQ_ECALL_T6_TIMER_OUT = 9002,
+ LYNQ_ECALL_T7_TIMER_OUT = 9003,
+ LYNQ_ECALL_REDIAL_TIMER_OUT = 9004,
+ LYNQ_ECALL_AUTO_ANS_TIMER_OUT = 9005,
+ LYNQ_ECALL_AUTO_ANS_IMS_TIMER_OUT = 9006,
+ LYNQ_ECALL_UNSPECIFIED = 0xffff,
+}LYNQ_ECall_Indication;
+
+int lynq_ecall_init(ecall_handle_type *handle);
+int lynq_ecall_deinit(ecall_handle_type handle);
+int lynq_set_test_num(LYNQ_ECall_Set_Type type, const char *test_num, int test_num_length);
+int lynq_set_reconf_num(LYNQ_ECall_Set_Type type, const char *reconf_num, int reconf_num_length);
+int lynq_fast_ecall(int* handle,
+ LYNQ_ECall_Category lynq_ecall_cat,
+ LYNQ_ECall_Variant lynq_ecall_variant,
+ const char *addr, int addr_length,
+ const unsigned char *msd_data, int msd_length);
+int lynq_make_ecall(int* handle, LYNQ_ECall_Variant type);
+int lynq_set_msd(int* handle, const unsigned char *msd_data, int msd_length);
+int lynq_set_ivs(int enable);
+int lynq_ivs_push_msd();
+int lynq_wait_ecall_indication(int* handle, LYNQ_ECall_Indication *eCall_Indication);
+int lynq_ecall_hungup(int handle);
+
+#endif
diff --git a/mbtk/include/lynq/lynq_gnss.h b/mbtk/include/lynq/lynq_gnss.h
new file mode 100755
index 0000000..679039b
--- /dev/null
+++ b/mbtk/include/lynq/lynq_gnss.h
@@ -0,0 +1,121 @@
+#ifndef __MBTK_LYNQ_GNSS_H__
+#define __MBTK_LYNQ_GNSS_H__
+
+typedef enum
+{
+ E_LYNQ_LOC_MSG_ID_STATUS_INFO = 0,
+ E_LYNQ_LOC_MSG_ID_LOCATION_INFO,
+ E_LYNQ_LOC_MSG_ID_SV_INFO,
+ E_LYNQ_LOC_MSG_ID_NMEA_INFO,
+ E_LYNQ_LOC_MSG_ID_CAPABILITIES_INFO,
+ E_LYNQ_LOC_MSG_ID_AGPS_STATUS,
+ E_LYNQ_LOC_MSG_ID_NI_NOTIFICATION,
+ E_LYNQ_LOC_MSG_ID_XTRA_REPORT_SERVER,
+}E_LYNQ_LOC_MSG_ID_T;
+
+#define LYNQ_LOC_NMEA_MAX_LENGTH 255 /** NMEA string maximum length. */
+typedef struct
+{
+ int64_t timestamp; /**< System Timestamp, marked for when got the nmea data */
+ int length; /**< NMEA string length. */
+ char nmea[LYNQ_LOC_NMEA_MAX_LENGTH + 1]; /**< NMEA string.*/
+}LYNQ_LOC_NMEA_INFO_T; /* Message */
+
+/* callback function register to lynq_gnss_rx_ind_msg_handler
+ e_msg_id: which kind of msg can be received depend on the bit_mask set in QL_LOC_Set_Indications;
+ pv_data: depend on the e_msg_id type.
+*/
+typedef void (*lynq_gnss_rx_ind_msg_handler_t)
+(
+ uint32 h_loc,
+ E_LYNQ_LOC_MSG_ID_T e_msg_id,
+ void *pv_data,
+ void *contextPtr
+);
+
+/**
+ * @brief function description
+ *
+ * @details detailed description
+ *
+ * @param param
+ *
+ * @return return type
+ */
+int lynq_gnss_init(void);
+/**
+ * @brief function description
+ *
+ * @details detailed description
+ *
+ * @param param
+ *
+ * @return return type
+ */
+int lynq_gnss_deinit(void);
+
+/**
+ * @brief function description
+ *
+ * @details detailed description
+ *
+ * @param param
+ *
+ * @return return type
+ */
+int lynq_gnss_callback_reg(lynq_gnss_rx_ind_msg_handler_t handlerPtr);
+
+/**
+ * @brief function description
+ *
+ * @details detailed description
+ *
+ * @param param
+ *
+ * @return return type
+ */
+int lynq_gnss_start(void);
+/**
+ * @brief function description
+ *
+ * @details detailed description
+ *
+ * @param param
+ *
+ * @return return type
+ */
+int lynq_gnss_stop(void);
+
+/**
+ * @brief function description
+ *
+ * @details detailed description
+ *
+ * @param param
+ *
+ * @return return type
+ */
+int lynq_gnss_agps_dataconnopen(void);
+/**
+ * @brief function description
+ *
+ * @details detailed description
+ *
+ * @param param
+ *
+ * @return return type
+ */
+int lynq_gnss_dev_reset(void);
+
+/**
+ * @brief function description
+ *
+ * @details detailed description
+ *
+ * @param param
+ *
+ * @return return type
+ */
+int lynq_gnss_enable_glonass(void);
+
+#endif
diff --git a/mbtk/include/lynq/lynq_net_api.h b/mbtk/include/lynq/lynq_net_api.h
new file mode 100755
index 0000000..30f8837
--- /dev/null
+++ b/mbtk/include/lynq/lynq_net_api.h
@@ -0,0 +1,167 @@
+/*
+*
+* Data : 2022/10/21 16:00:28
+* Author : LiuBin
+*/
+#ifndef _LYNQ_NET_API_H
+#define _LYNQ_NET_API_H
+#include "mbtk_info_api.h"
+
+typedef enum {
+ RADIO_TECH_3GPP = 1, /* 3GPP Technologies - GSM, WCDMA */
+ RADIO_TECH_3GPP2 = 2 /* 3GPP2 Technologies - CDMA */
+} RIL_RadioTechnologyFamily;
+
+typedef struct
+{
+ int rssi; // 0: 113 dBm or less
+ // 1: 111 dBm
+ // 2...30: 109 dBm...53 dBm
+ // 31: 51 dBm or greater
+ // 99: not known or not detectable
+ int ber; // 0...7 as RXQUAL values in the table in 3GPP TS 45.008 [20] subclause 8.2.4
+ // 99 not known or not detectable
+ int gsm_sig_valid;
+ int rxlev;// 0:rssi < -110 dBm
+ // 1: -110 dBm <= rssi < -109 dBm
+ // 2: -109 dBm <= rssi < -108 dBm
+ // ......
+ // 61: -50 dBm <= rssi < -49 dBm
+ // 62: -49 dBm <= rssi < -48 dBm
+ // 63: -48 dBm <= rssi
+ // 99: not known or not detectable
+ int umts_sig_valid;
+ int rscp; // 0: rscp < -120 dBm
+ // 1: -120 dBm <= rscp < -119 dBm
+ // 2: -119 dBm <= rscp < -118 dBm
+ // ......
+ // 94: -27 dBm <= rscp < -26 dBm
+ // 95: -26 dBm <= rscp < -25 dBm
+ // 96: - 25 dBm <= rscp
+ // 255: not known or not detectable
+ int ecno; // 0: Ec/Io < -24 dB
+ // 1: -24 dB <= Ec/Io < -23.5 dB
+ // 2: -23.5 dB <= Ec/Io < -23 dB
+ // ......
+ // 47: -1 dB <= Ec/Io < -0.5 dB
+ // 48: -0.5 dB <= Ec/Io < 0 dB
+ // 49: 0 dB <= Ec/Io
+ // 255: not known or not detectable
+ int lte_sig_valid;
+ int rsrq; // 0: rsrq < -19.5 dB
+ // 1: -19.5 dB <= rsrq < -19 dB
+ // 2: -19 dB <= rsrq < -18.5 dB
+ // ......
+ // 32: -4 dB <= rsrq < -3.5 dB
+ // 33: -3.5 dB <= rsrq < -3 dB
+ // 34: -3 dB <= rsrq
+ // 255: not known or not detectable
+ int rsrp; // 0: rsrp < -140 dBm
+ // 1: -140 dBm <= rsrp < -139 dBm
+ // 2: -139 dBm <= rsrp < -138 dBm
+ // ......
+ // 95: -46 dBm <= rsrp < -45 dBm
+ // 96: -45 dBm <= rsrp < -44 dBm
+ // 97: -44 dBm <= rsrp
+ // 255: not known or not detectable
+} signalStrength_t;
+
+typedef enum {
+ ZONE_NUM_SOC = 0,
+ ZONE_NUM_RF
+} ZONE_NUM;
+
+int lynq_network_init(int uToken);
+
+int lynq_network_deinit(void);
+
+int lynq_get_version(char buf[]);
+
+int lynq_get_imei(char buf[]);
+
+int lynq_get_sn(char buf[]);
+
+int lynq_shutdown(char options[]);
+
+int lynq_time_set(mbtk_time_type_enum time_type, char* time_str);
+
+int lynq_get_zone_tmp(ZONE_NUM num, int *temp);
+
+int lynq_get_sim_status(int *card_status);
+
+int lynq_get_imsi(char buf[]);
+
+int lynq_get_iccid(char buf[]);
+
+int lynq_query_phone_number(char buf[]);
+
+int lynq_sim_power (int mode);
+
+int lynq_query_operater(char *OperatorFN,char *OperatorSH,char *MccMnc);
+
+int lynq_query_network_selection_mode (int *netselMode);
+
+int lynq_set_network_selection_mode(const char *mode, const char* mccmnc);
+
+int lynq_query_available_network(list_node_t** net_list);
+
+int lynq_query_registration_state(const char *type, int* regState,int *imsRegState,char * LAC,char *CID,int *netType,int * radioTechFam,int *netRejected);
+
+int lynq_query_prefferred_networktype (int *preNetType);
+
+int lynq_set_prefferred_networktype (const int preNetType);
+
+int lynq_set_band_mode(int gsm_band, int umts_band, int tdlte_band, int fddlte_band);
+
+int lynq_query_available_bandmode (int *gsm_band, int *umts_band, int *tdlte_band, int *fddlte_band);
+
+int lynq_radio_on (const int data);
+
+int lynq_query_radio_tech (int* radioTech);
+
+int lynq_solicited_signal_strength (signalStrength_t *solSigStren);
+
+int lynq_set_ims (const int ims_mode);
+
+int lynq_init_cell(void);
+
+int lynq_deinit_cell(void);
+
+int lynq_query_cell_info(int *type, list_node_t **cell_list);
+
+void lynq_set_cell_info(char *mem);
+
+/*
+* Set specific APN informations.
+*
+* cid : 2-7
+*/
+int lynq_apn_set(int cid, mbtk_ip_type_enum ip_type, const void* apn_name,
+ const void *user_name, const void *user_pass, const void *auth);
+
+/*
+* Get current all APN informations.
+*/
+int lynq_apn_get(int *apn_num, mbtk_apn_info_t apns[]);
+
+/*
+* Start data call.
+*/
+int lynq_data_call_start(int cid, int timeout);
+
+/*
+* Stop data call.
+*/
+int lynq_data_call_stop(int cid, int timeout);
+
+/*
+* Query data call state.
+*/
+int lynq_data_call_query(int cid, mbtk_ipv4_info_t *ipv4, mbtk_ipv6_info_t *ipv6);
+
+/*
+*Get native ip and free port
+*/
+int lynq_get_ip_and_port(char *ipBuf_out,int *port,int iptype);
+
+#endif /* _LYNQ_NET_API_H */
diff --git a/mbtk/include/lynq/lynq_sms_api.h b/mbtk/include/lynq/lynq_sms_api.h
new file mode 100755
index 0000000..cedf230
--- /dev/null
+++ b/mbtk/include/lynq/lynq_sms_api.h
@@ -0,0 +1,73 @@
+#ifndef LYNQ_SMS_QPI_H
+#define LYNQ_SMS_QPI_H
+/*
+*
+* Data : 2022/11/29
+* Author : LuoJian
+*/
+
+#include "mbtk_type.h"
+
+#define TELEPHONE_NUM_MAX 16
+#define MSM_NUMBER_MAX 1024+1
+#define RES_NUM_MIN 128
+
+
+enum EnumDCS {
+ BIT7 = 0, // GSM ×Ö·û¼¯
+ BIT8 = 1, // ASCII×Ö·û¼¯
+ UCS2 = 2 // Unicode ×Ö·û¼¯
+};
+
+struct PDUUDH {
+ unsigned int count; // ÐÅÏ¢ÔªËØÊý¾Ý×Ö½ÚÊý
+ char IEI; // ÐÅÏ¢ÔªËØ±êʶ
+ char *IED; // ÐÅÏ¢ÔªËØÊý¾Ý
+};
+
+// Óû§Êý¾ÝÍ·
+struct UDHS {
+ int count;
+ struct PDUUDH *UDH;
+};
+
+struct SMS_Struct {
+ char *SCA; // ·þÎñÖÐÐĵØÖ·
+ char *OA; // ·¢ËÍ·½µØÖ·
+ char *SCTS; // ·þÎñÖÐÐÄʱ¼ä´Á
+ struct UDHS *UDH; // Óû§Êý¾ÝÍ·
+ char *UD; // Óû§Êý¾Ý
+
+ bool RP; // Ó¦´ð·¾¶
+ bool UDHI; // Óû§Êý¾ÝÍ·±êʶ
+ bool SRI; // ״̬±¨¸æÖ¸Ê¾
+ bool MMS; // ¸ü¶àÐÅÏ¢·¢ËÍ
+ int MTI; // ÐÅÏ¢ÀàÐÍָʾ
+
+ char PID; // PID ÐÒé±êʶ
+
+ enum EnumDCS DCS; // Êý¾Ý±àÂë·½°¸
+ bool TC; // Îı¾Ñ¹Ëõָʾ 0£º δѹËõ 1£ºÑ¹Ëõ
+ int MC; // ÏûÏ¢ÀàÐÍ -1£º ÎÞ 1£ºÒƶ¯Éè±¸ÌØ¶¨ÀàÐÍ 2£ºSIMÌØ¶¨ÀàÐÍ 3£ºÖÕ¶ËÉè±¸ÌØ¶¨ÀàÐÍ
+
+};
+
+extern struct SMS_Struct PDUDecoding(const char *data);
+#define DSC_to_msg(DSC) (DSC == 0 ? "Bit7" : (DSC == 1 ? "Bit8" : "UCS2"))
+
+
+
+int lynq_init_sms(int uToken);
+int lynq_deinit_sms(void);
+int lynq_delete_sms(int index);
+int lynq_wait_receive_new_sms(int *handle);
+int lynq_send_sms(char *telephony_num, int state, char *msg);
+int lynq_list_sms(int stat, int index, char *data);
+int lynq_query_sms_storage_status(void);
+
+void lynq_sms_state_change_cb(const void* data, int data_len);
+
+int lynq_get_smsc_address(char *serviceNumber);
+int lynq_set_smsc_address(const char* service_num);
+
+#endif
diff --git a/mbtk/include/mbtk/mbtk_adc.h b/mbtk/include/mbtk/mbtk_adc.h
new file mode 100755
index 0000000..b0b0b5e
--- /dev/null
+++ b/mbtk/include/mbtk/mbtk_adc.h
@@ -0,0 +1,42 @@
+/*
+ MBTK ADC interface define.
+*/
+/******************************************************************************
+
+ EDIT HISTORY FOR FILE
+
+ WHEN WHO WHAT,WHERE,WHY
+-------- -------- -------------------------------------------------------
+2023/4/3 b.liu Initial version
+
+******************************************************************************/
+#ifndef __MBTK_ADC_H__
+#define __MBTK_ADC_H__
+
+/*
+* MBTK ADC define.
+*/
+typedef enum {
+ MBTK_ADC0 = 0, /* ADC 0 */
+ MBTK_ADC1 /* ADC 1 */
+} mbtk_adc_enum;
+
+
+/*===========================================================================
+FUNCTION mbtk_adc_get
+
+DESCRIPTION:
+ Get ADC's value.
+
+PARAMETERS:
+ adc [IN]: ADC path, refer to mbtk_adc_enum.
+
+RETURN VALUE:
+ int : ADC value.
+
+===========================================================================*/
+int mbtk_adc_get(mbtk_adc_enum adc);
+
+
+#endif /* __MBTK_ADC_H__ */
+
diff --git a/mbtk/include/mbtk/mbtk_at.h b/mbtk/include/mbtk/mbtk_at.h
new file mode 100755
index 0000000..e73414d
--- /dev/null
+++ b/mbtk/include/mbtk/mbtk_at.h
@@ -0,0 +1,64 @@
+/*
+ MBTK AT header file.
+*/
+/******************************************************************************
+
+ EDIT HISTORY FOR FILE
+
+ WHEN WHO WHAT,WHERE,WHY
+-------- -------- -------------------------------------------------------
+2023/4/6 b.liu Initial version
+
+******************************************************************************/
+#ifndef __MBTK_AT__
+#define __MBTK_AT__
+
+/*===========================================================================
+FUNCTION mbtk_at_init
+
+DESCRIPTION:
+ Initial MBTK AT.
+
+PARAMETERS:
+ None.
+
+RETURN VALUE:
+ int : Return 0 if success,other for failure.
+
+===========================================================================*/
+int mbtk_at_init();
+
+
+/*===========================================================================
+FUNCTION mbtk_at_deinit
+
+DESCRIPTION:
+ Deinitial MBTK AT.
+
+PARAMETERS:
+ None.
+
+RETURN VALUE:
+ int : Return 0 if success,other for failure.
+
+===========================================================================*/
+int mbtk_at_deinit();
+
+/*===========================================================================
+FUNCTION mbtk_at_send
+
+DESCRIPTION:
+ Send AT command.
+
+PARAMETERS:
+ cmd [IN]: AT command.
+ rsp [OUT]: AT command response.
+ rsp_len[IN] : AT command response buffer size.
+
+RETURN VALUE:
+ int : Return 0 if success,other for failure.
+
+===========================================================================*/
+int mbtk_at_send(char* cmd, char* rsp, int rsp_len);
+
+#endif /* __MBTK_AT__ */
diff --git a/mbtk/include/mbtk/mbtk_audio.h b/mbtk/include/mbtk/mbtk_audio.h
new file mode 100755
index 0000000..bdc54ee
--- /dev/null
+++ b/mbtk/include/mbtk/mbtk_audio.h
@@ -0,0 +1,208 @@
+/**
+ * \file mbtk_audio_alsa.h
+ * \brief A Documented file.
+ *
+ * Detailed description
+ * Audio API definition.
+ *
+ * \Author: wangjinshu <js.wang@mobiletek.cn>
+ * \Version: 1.0.0
+ * \Date: 2020.04.05
+ */
+
+#ifndef __MBTK_AUDIO_ALSA_H__
+#define __MBTK_AUDIO_ALSA_H__
+#include <pthread.h>
+#include "mbtk_type.h"
+
+typedef void* mbtk_audio_handle;
+typedef void(*mbtk_audio_record_cb_func)(int result, char* databuf, unsigned int len); //callback function get recording data
+typedef int(*mbtk_dtmf_cb)(char result);
+typedef int(*mbtk_volume_cb)(int result);
+typedef uint32 mbtk_audio_client_handle_type;
+
+/*
+* Audio device enum.
+*/
+typedef enum {
+ MBTK_AUTIO_TYPE_OUT = 0, /* Audio play device. */
+ MBTK_AUTIO_TYPE_IN /* Audio record device. */
+} mbtk_audio_dev_enum;
+
+/*
+* Audio running state..
+*/
+typedef enum {
+ AUDIO_NONE = -1,
+ AUDIO_STOP = 0,
+ AUDIO_OPEN = 1,
+ AUDIO_RUNNING = 2,
+ AUDIO_PAUSE = 3,
+ AUDIO_RESUME = 4
+} mbtk_audio_state_enum;
+
+
+/****************************************************************************
+* Audio function
+***************************************************************************/
+/*===========================================================================
+FUNCTION mbtk_audio_open
+
+DESCRIPTION:
+ Initial MBTK audio interface.
+
+PARAMETERS:
+ dev [IN]: Audio device, refer for mbtk_audio_dev_enum.
+ channel [IN]: Audio channel number.
+ rate [IN]: Audio bite rate.
+ usrData [IN]: Additional data, usually specified as NULL.
+
+RETURN VALUE:
+ mbtk_audio_handle : Return audio handle if success, NULL for failure.
+
+===========================================================================*/
+mbtk_audio_handle mbtk_audio_open(mbtk_audio_dev_enum dev, int channels, int rate, void* usrData);
+
+
+/*===========================================================================
+FUNCTION mbtk_audio_play_stream
+
+DESCRIPTION:
+ Play audio stream.
+
+PARAMETERS:
+ dev_hdl [IN]: Audio handle, get by call mbtk_audio_open.
+ pdata [IN]: Audio stream data.
+ len [IN]: Audio stream data length.
+
+RETURN VALUE:
+ int : Return 0 if success,other for failure.
+
+===========================================================================*/
+int mbtk_audio_play_stream(mbtk_audio_handle dev_hdl, const void* pdata, int len);
+
+
+/*===========================================================================
+FUNCTION mbtk_audio_play_file
+
+DESCRIPTION:
+ Play audio file.
+
+PARAMETERS:
+ dev_hdl [IN]: Audio handle, get by call mbtk_audio_open.
+ file_fd [IN]: File descriptor to play.
+ offset [IN]: File offset.
+
+RETURN VALUE:
+ int : Return 0 if success,other for failure.
+
+===========================================================================*/
+int mbtk_audio_play_file(mbtk_audio_handle dev_hdl, int file_fd, int offset);
+
+
+/*===========================================================================
+FUNCTION mbtk_audio_record
+
+DESCRIPTION:
+ Start audio record.This function will call cb_func in the new thread to return record data.
+
+PARAMETERS:
+ dev_hdl [IN]: Audio handle, get by call mbtk_audio_open.
+ cb_func [IN]: Audio record callback function.
+ cb_date [IN]: Audio record additional data,usually specified as NULL.
+
+RETURN VALUE:
+ int : Return 0 if success,other for failure.
+
+===========================================================================*/
+int mbtk_audio_record(mbtk_audio_handle dev_hdl, mbtk_audio_record_cb_func cb_func, void* cb_date);
+int mbtk_audio_play_waitend(void* hdl);
+
+/*===========================================================================
+FUNCTION mbtk_audio_pause
+
+DESCRIPTION:
+ Audio play pause.
+
+PARAMETERS:
+ dev_hdl [IN]: Audio handle, get by call mbtk_audio_open.
+
+RETURN VALUE:
+ int : Return 0 if success,other for failure.
+
+===========================================================================*/
+int mbtk_audio_pause(mbtk_audio_handle dev_hdl);
+
+
+/*===========================================================================
+FUNCTION mbtk_audio_resume
+
+DESCRIPTION:
+ Audio play resume.
+
+PARAMETERS:
+ dev_hdl [IN]: Audio handle, get by call mbtk_audio_open.
+
+RETURN VALUE:
+ int : Return 0 if success,other for failure.
+
+===========================================================================*/
+int mbtk_audio_resume(void* dev_hdl);
+int mbtk_audio_prepare(void* dev_hdl);
+/*===========================================================================
+FUNCTION mbtk_audio_state_get
+
+DESCRIPTION:
+ Get audio play state.
+
+PARAMETERS:
+ dev_hdl [IN]: Audio handle, get by call mbtk_audio_open.
+
+RETURN VALUE:
+ mbtk_audio_state_enum : Return audio state,refer to mbtk_audio_state_enum.
+
+===========================================================================*/
+mbtk_audio_state_enum mbtk_audio_state_get(void *hdl);
+
+
+/*===========================================================================
+FUNCTION mbtk_audio_stop
+
+DESCRIPTION:
+ Stop audio play.
+
+PARAMETERS:
+ dev_hdl [IN]: Audio handle, get by call mbtk_audio_open.
+
+RETURN VALUE:
+ int : Return 0 if success,other for failure.
+
+===========================================================================*/
+int mbtk_audio_stop(void* dev_hdl);
+
+
+/*===========================================================================
+FUNCTION mbtk_audio_resume
+
+DESCRIPTION:
+ Close audio handle.
+
+PARAMETERS:
+ dev_hdl [IN]: Audio handle, get by call mbtk_audio_open.
+
+RETURN VALUE:
+ int : Return 0 if success,other for failure.
+
+===========================================================================*/
+int mbtk_audio_close(void* dev_hdl);
+
+
+int mbtk_audio_ubus_client_init(mbtk_audio_client_handle_type *ph_dtmf, mbtk_dtmf_cb cb);
+int mbtk_audio_ubus_client_deinit(mbtk_audio_client_handle_type h_dtmf);
+void mbtk_audio_ubus_volume_set(unsigned int volume);
+void mbtk_audio_ubus_volume_get(mbtk_volume_cb cb);
+int mbtk_audio_dsp_set(int type, int gain);
+
+int mbtk_audio_mp3_to_wav(const char *wavpath, char *mp3path);
+int mbtk_audio_mp3_to_play(char *mp3path, int hdl, int sample_rate);
+#endif /*__MBTK_AUDIO_ALSA_H__*/
diff --git a/mbtk/include/mbtk/mbtk_coap.h b/mbtk/include/mbtk/mbtk_coap.h
new file mode 100755
index 0000000..23827b6
--- /dev/null
+++ b/mbtk/include/mbtk/mbtk_coap.h
@@ -0,0 +1,228 @@
+/*************************************************************
+Description:
+ L620 Coap support Header file.
+Author:
+ LuoJian
+Date:
+ 2018/9/16 4:26:36
+*************************************************************/
+#ifndef FEATURE_MBTK_ECOAP
+#define FEATURE_MBTK_ECOAP
+#include <ctype.h>
+#include <stdbool.h>
+
+#include "mbtk_coap_api.h"
+
+/*************************************************************
+ Constants and Macros
+*************************************************************/
+#define MBTK_COAP_DTLS_SUPPORT
+
+#define MBTK_ECOAP_NEW_MAX 128
+#define MBTK_ECOAP_OPTION_LEN 512
+#define MBTK_ECOAP_DATA_MAX 1024
+
+
+/*************************************************************
+ Definitions:enum,struct,union,class
+*************************************************************/
+
+#define MBTK_ECOAP_ERR_SUCCESS 0 /* No error */
+#define MBTK_ECOAP_ERR_NO_OPEN 300 /* 300 coap service is not opened. */
+#define MBTK_ECOAP_ERR_IS_OPENED 301 /* 301 coap service is opened.*/
+#define MBTK_ECOAP_ERR_NO_READY 302 /* 302 coap host and port not set */
+#define MBTK_ECOAP_ERR_NET 303 /* 303 DNS error. */
+#define MBTK_ECOAP_ERR_SOCK_CANNOT_RST 304 /* 304 Socket can not reset. */
+#define MBTK_ECOAP_ERR_MSG_ID 305 /* 305 Message ID error. */
+#define MBTK_ECOAP_ERR_PAYLOAD_LENGTH 306 /* 306 Payload length error. */
+#define MBTK_ECOAP_ERR_OPTION 307 /* 307 Potion set error. */
+#define MBTK_ECOAP_ERR_TASK_IS_RUNING 308 /* 308 Task is runing. */
+#define MBTK_ECOAP_ERR_UNKNOWN 350 /* 350 Unknown coap error */
+
+
+
+
+typedef enum
+{
+ MBTK_ECOAP_BLOCK_16,
+ MBTK_ECOAP_BLOCK_32,
+ MBTK_ECOAP_BLOCK_64,
+ MBTK_ECOAP_BLOCK_128,
+ MBTK_ECOAP_BLOCK_256,
+ MBTK_ECOAP_BLOCK_512,
+ MBTK_ECOAP_BLOCK_1024
+} mbtk_ecoap_option_block_e;
+
+typedef enum {
+ MBTK_ECOAP_SIG_START,
+ MBTK_ECOAP_SIG_STOP,
+ MBTK_ECOAP_SIG_SEND,
+ MBTK_ECOAP_SIG_RECV,
+ MBTK_ECOAP_SIG_DISCONNING
+} mbtk_ecoap_base_sig_enum;
+
+typedef enum
+{
+ MBTK_ECOAP_STATE_NON,
+ MBTK_ECOAP_STATE_CLOSING,
+ MBTK_ECOAP_STATE_OPENED,
+ MBTK_ECOAP_STATE_READY
+} mbtk_ecoap_state_e;
+
+typedef struct
+{
+ mbtk_ecoap_option_block_e size;
+ int number;
+ uint8 more_flag;
+} mbtk_ecoap_option_block_s;
+
+typedef struct mbtk_ecoap_option
+{
+ mbtk_coap_option_type type;
+
+ union
+ {
+ mbtk_ecoap_option_block_s opt_block;
+ mbtk_content_format_type opt_content_format;
+ uint8 opt_str[128];
+ int opt_int;
+ } opt;
+
+ struct mbtk_ecoap_option *next;
+} mbtk_ecoap_option_s;
+
+typedef struct mbtk_ecoap_option_2{
+ int optlen;
+ uint8 optVal[512+1];
+}mbtk_ecoap_opt_2;
+
+typedef struct mbtk_ecoap_option_3{
+ int optlen;
+ char optVal[512+1];
+}mbtk_ecoap_opt_3;
+
+typedef struct
+{
+ uint8 version;
+ mbtk_coap_type type;
+ mbtk_coap_code_type code;
+ int message_id;
+
+ uint8 token[8];
+ uint8 token_len;
+
+ uint8 send_count;
+
+ mbtk_ecoap_opt_2 option;
+
+ uint8 *payload;
+ int payload_len;
+}mbtk_ecoap_package_ver;
+
+
+typedef struct mbtk_ecoap_package
+{
+ uint8 send_count;
+
+ uint8 version;
+ mbtk_coap_type type;
+ mbtk_coap_code_type code;
+
+ uint8 token[8];
+ uint8 token_len;
+
+ int message_id;
+
+ mbtk_ecoap_option_s *options;
+
+ uint8 *payload;
+ int payload_len;
+
+ struct mbtk_ecoap_package *next;
+} mbtk_ecoap_package_s;
+
+typedef struct
+{
+ uint8 host[32];
+ int port;
+ int socket;
+#ifdef MBTK_COAP_DTLS_SUPPORT
+ int is_dtls;
+#endif
+ int message_id;
+} mbtk_ecoap_net_s;
+
+
+/*************************************************************
+ Extern variables
+*************************************************************/
+
+
+/*************************************************************
+ Public Function Declaration
+*************************************************************/
+int mbtk_coap_ecoapnew_exec_cmd
+(
+ char *ip_addr,
+ int port,
+ bool is_support_ssl,
+ bool ingnore_cert
+);
+
+int mbtk_coap_ecoaprxmod_exec_cmd
+(
+ int mode
+);
+
+int mbtk_coap_ecoappr_exec_cmd
+(
+ int format
+);
+
+
+int mbtk_coap_ecoaprxget_exec_cmd
+(
+ int len
+);
+
+int mbtk_coap_ecoapver_exec_cmd
+(
+ int version
+);
+
+int mbtk_coap_ecoaptype_exec_cmd
+(
+ mbtk_coap_type type
+);
+
+int mbtk_coap_ecoapcode_exec_cmd
+(
+ mbtk_coap_code_type code
+);
+
+int mbtk_coap_ecoaptoken_exec_cmd
+(
+ char *token_buf, int len
+);
+
+int mbtk_coap_ecoapmsgid_exec_cmd
+(
+ int msg_id
+);
+
+int mbtk_coap_ecoapopt_exec_cmd
+(
+ char *value_buf, int buf_len
+);
+
+int mbtk_coap_ecoapsend_exec_cmd
+(
+ int message_id, int data_len, char *data
+);
+
+int mbtk_coap_ecoapdel_exec_cmd( int del_id );
+
+int mbtk_coap_ecoapnmi_exec_cmd( void );
+
+
+#endif /* _MBTK_COAP_L620_H */
diff --git a/mbtk/include/mbtk/mbtk_coap_api.h b/mbtk/include/mbtk/mbtk_coap_api.h
new file mode 100755
index 0000000..ac1b699
--- /dev/null
+++ b/mbtk/include/mbtk/mbtk_coap_api.h
@@ -0,0 +1,223 @@
+#ifndef MBTK_COAP_API_H
+#define MBTK_COAP_API_H
+
+#include "mbtk_type.h"
+
+// CoAP message types. Note, values only work as enum.
+typedef enum
+{
+ COAP_CONFIRMABLE=0x00,
+ COAP_NON_CONFIRMABLE=0x10,
+ COAP_ACKNOWLEDGEMENT=0x20,
+ COAP_RESET=0x30
+} mbtk_coap_type;
+
+// CoAP response codes.
+typedef enum
+{
+ COAP_EMPTY=0x00,
+ COAP_GET,
+ COAP_POST,
+ COAP_PUT,
+ COAP_DELETE,
+ COAP_LASTMETHOD=0x1F,
+ COAP_CREATED=0x41,
+ COAP_DELETED,
+ COAP_VALID,
+ COAP_CHANGED,
+ COAP_CONTENT,
+ COAP_CONTINUE=0x5F,
+ COAP_BAD_REQUEST=0x80,
+ COAP_UNAUTHORIZED,
+ COAP_BAD_OPTION,
+ COAP_FORBIDDEN,
+ COAP_NOT_FOUND,
+ COAP_METHOD_NOT_ALLOWED,
+ COAP_NOT_ACCEPTABLE,
+ COAP_PRECONDITION_FAILED=0x8C,
+ COAP_REQUEST_ENTITY_TOO_LARGE=0x8D,
+ COAP_UNSUPPORTED_CONTENT_FORMAT=0x8F,
+ COAP_INTERNAL_SERVER_ERROR=0xA0,
+ COAP_NOT_IMPLEMENTED,
+ COAP_BAD_GATEWAY,
+ COAP_SERVICE_UNAVAILABLE,
+ COAP_GATEWAY_TIMEOUT,
+ COAP_PROXYING_NOT_SUPPORTED,
+ COAP_UNDEFINED_CODE=0xFF
+} mbtk_coap_code_type;
+
+/// CoAP option numbers.
+typedef enum
+{
+ COAP_OPTION_NON=0,
+ COAP_OPTION_IF_MATCH=1,
+ COAP_OPTION_URI_HOST=3,
+ COAP_OPTION_ETAG,
+ COAP_OPTION_IF_NONE_MATCH,
+ COAP_OPTION_OBSERVE,
+ COAP_OPTION_URI_PORT,
+ COAP_OPTION_LOCATION_PATH,
+ COAP_OPTION_URI_PATH=11,
+ COAP_OPTION_CONTENT_FORMAT,
+ COAP_OPTION_MAX_AGE=14,
+ COAP_OPTION_URI_QUERY,
+ COAP_OPTION_ACCEPT=17,
+ COAP_OPTION_LOCATION_QUERY=20,
+ COAP_OPTION_BLOCK2=23,
+ COAP_OPTION_BLOCK1=27,
+ COAP_OPTION_SIZE2,
+ COAP_OPTION_PROXY_URI=35,
+ COAP_OPTION_PROXY_SCHEME=39,
+ COAP_OPTION_SIZE1=60
+} mbtk_coap_option_type;
+
+/// CoAP content-formats.
+typedef enum
+{
+ COAP_CONTENT_FORMAT_NON = -1,
+ COAP_CONTENT_FORMAT_TEXT_PLAIN = 0,
+ COAP_CONTENT_FORMAT_APP_LINK = 40,
+ COAP_CONTENT_FORMAT_APP_XML,
+ COAP_CONTENT_FORMAT_APP_OCTET,
+ COAP_CONTENT_FORMAT_APP_EXI = 47,
+ COAP_CONTENT_FORMAT_APP_JSON = 50
+} mbtk_content_format_type;
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern void coapReleaseCoapPUD();
+extern int coapReset();
+extern int coapValidate();
+
+// version
+extern int coapSetVersion(uint8_t version);
+extern uint8_t coapGetVersion();
+
+// message type
+extern void coapSetType(mbtk_coap_type type);
+extern mbtk_coap_type coapGetType();
+
+// tokens
+extern int coapCoapsetTokenLength(uint8_t tokenLength);
+extern int coapGetTokenLength();
+extern uint8_t* coapGetTokenPointer();
+extern int coapSetToken(uint8_t *token, uint8_t tokenLength);
+
+// message code
+extern void coapSetCode(mbtk_coap_code_type code);
+extern mbtk_coap_code_type coapGetCode();
+extern mbtk_coap_code_type coapHttpStatusToCode(int httpStatus);
+
+// message ID
+extern int coapSetMessageID(uint16_t messageID);
+extern uint16_t coapGetMessageID();
+
+// options
+extern int coapAddOption(uint16_t optionNumber, uint16_t optionLength, uint8_t *optionValue);
+// gets a list of all options
+//extern CoapOption* getOptions();
+extern int coapGetNumOptions();
+// shorthand helpers
+extern int coapSetURI(char *uri);
+extern int coapsetURI(char *uri, int urilen);
+extern int coapGetURI(char *dst, int dstlen, int *outLen);
+extern int coapAddURIQuery(char *query);
+
+// content format helper
+extern int coapSetContentFormat(mbtk_content_format_type format);
+
+// payload
+extern uint8_t* coapMallocPayload(int bytes);
+extern int coapSetPayload(uint8_t *value, int len);
+extern uint8_t* coapGetPayloadPointer();
+extern int coapGetPayloadLength();
+extern uint8_t* coapGetPayloadCopy();
+
+// pdu
+extern int coapGetPDULength();
+extern uint8_t* coapGetPDUPointer();
+extern void coapSetPDULength(int len);
+extern int mbtk_coap_get_pdu_Length();
+
+extern void coapDeleteRecv();
+extern int coapCreateRecv(uint8_t *pdu, int pduLength);
+extern void coapPrintHuman(char * outBuffer) ;
+extern const char* coapPrintHumanByIndex(int index);
+extern const char* coapPrintHexByIndex(int index);
+extern void coapGetOptionValueById(uint16_t optionNumber, uint16_t * optionValueLength, uint8_t * optionValuePointer);
+extern uint16_t coapGetRecvMessageID();
+extern mbtk_coap_type coapGetRecvType();
+extern mbtk_coap_code_type coapGetRecvCode();
+extern int coapGetRecvTokenLength();
+extern uint8_t* coapGetRecvTokenPointer();
+extern int coapGetRecvPayloadLength();
+extern uint8_t* coapGetRecvPayloadPointer();
+uint8_t coapGetRecvVersion();
+
+// Return If-Match length,or 0 if fail.
+extern uint16_t coapGetRecvOptionIfMatch(uint16_t *optionValueLength, uint8_t *optionValuePointer);
+
+// Return Uri-Host length,or 0 if fail.
+extern uint16_t coapGetRecvOptionUriHost(uint16_t *optionValueLength, uint8_t *optionValuePointer);
+
+// Return ETag length,or 0 if fail.
+extern uint16_t coapGetRecvOptionETag(uint16_t *optionValueLength, uint8_t *optionValuePointer);
+
+// Return If-None-Match length,or 0 if fail.
+extern uint16_t coapGetRecvOptionIfNoneMatch(uint16_t *optionValueLength, uint8_t *optionValuePointer);
+
+// Return Location-Path length,or 0 if fail.
+extern uint16_t coapGetRecvOptionLocationPath(uint16_t *optionValueLength, uint8_t *optionValuePointer);
+
+// Return Location-Query length,or 0 if fail.
+extern uint16_t coapGetRecvOptionLocationQuery(uint16_t *optionValueLength, uint8_t *optionValuePointer);
+
+// Return Proxy-Uri length,or 0 if fail.
+extern uint16_t coapGetRecvOptionProxyUri(uint16_t *optionValueLength, uint8_t *optionValuePointer);
+
+// Return Proxy-Scheme length,or 0 if fail.
+extern uint16_t coapGetRecvOptionProxyScheme(uint16_t *optionValueLength, uint8_t *optionValuePointer);
+
+// Return Uri-Path length,or 0 if fail.
+extern uint16_t coapGetRecvOptionUriPath(uint16_t *optionValueLength, uint8_t *optionValuePointer);
+
+// Return Uri-Query length,or 0 if fail.
+extern uint16_t coapGetRecvOptionUriQuery(uint16_t *optionValueLength, uint8_t *optionValuePointer);
+
+// Return 1 if get Observe success,or 0 if fail.
+extern uint16_t coapGetRecvOptionObserve(uint16_t *observe);
+
+// Return 1 if get Max-Age success,or 0 if fail.
+extern uint16_t coapGetRecvOptionMaxAge(uint16_t *max_age);
+
+// Return 1 if get Uri-Port success,or 0 if fail.
+extern uint16_t coapGetRecvOptionUriPort(uint16_t *uri_port);
+
+// Return 1 if get Size2 success,or 0 if fail.
+extern uint16_t coapGetRecvOptionSize2(uint16_t *size2);
+
+// Return 1 if get Size1 success,or 0 if fail.
+extern uint16_t coapGetRecvOptionSize1(uint16_t *size1);
+
+// Return 1 if get Block2 success,or 0 if fail.
+extern uint16_t coapGetRecvOptionBlock2(uint32_t *number,uint8_t *more_flag,uint8_t *size);
+
+// Return 1 if get Block1 success,or 0 if fail.
+extern uint16_t coapGetRecvOptionBlock1(uint32_t *number,uint8_t *more_flag,uint8_t *size);
+
+// Return 1 if get Content-Format success,or 0 if fail.
+extern uint16_t coapGetRecvOptionContentFormat(mbtk_content_format_type *type);
+
+// Return 1 if get Accept success,or 0 if fail.
+extern uint16_t coapGetRecvOptionAccept(mbtk_content_format_type *type);
+
+extern int coapHasOption(uint16_t optionNumber );
+extern int coapPrintRecvPayload(char *out);
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/mbtk/include/mbtk/mbtk_device_info.h b/mbtk/include/mbtk/mbtk_device_info.h
new file mode 100755
index 0000000..c5e5bce
--- /dev/null
+++ b/mbtk/include/mbtk/mbtk_device_info.h
@@ -0,0 +1,18 @@
+/*
+* MBTK Device Information Define Header.
+*
+* Author : lb
+* Date : 2021/11/5 17:40:29
+*
+*/
+#ifndef MBTK_DEVICES_INFO_H
+#define MBTK_DEVICES_INFO_H
+
+#define MBTK_DEVICES_MANUFACTURER "LYNQ"
+
+#define MBTK_DEVICES_MODEL "LYNQ_L508TLC"
+
+#define MBTK_DEVICES_REVISION "L508TLCv02.02b06.00"
+
+
+#endif /* MBTK_DEVICES_INFO_H */
diff --git a/mbtk/include/mbtk/mbtk_dhcp.h b/mbtk/include/mbtk/mbtk_dhcp.h
new file mode 100755
index 0000000..8553d43
--- /dev/null
+++ b/mbtk/include/mbtk/mbtk_dhcp.h
@@ -0,0 +1,104 @@
+/*
+* MBTK DHCP Header.
+*
+* Author : lb
+* Date : 2021/8/20 13:38:03
+*
+*/
+#ifndef _MBTK_DHCP_H
+#define _MBTK_DHCP_H
+#include <netinet/in.h>
+
+#include "mbtk_type.h"
+
+#define PORT_BOOTP_SERVER 67
+#define PORT_BOOTP_CLIENT 68
+#define OP_BOOTREQUEST 1
+#define OP_BOOTREPLY 2
+#define FLAGS_BROADCAST 0x8000
+#define HTYPE_ETHER 1
+#define DHCP_MSG_FIXED_SIZE 236
+
+/* first four bytes of options are a cookie to indicate that
+** the payload are DHCP options as opposed to some other BOOTP
+** extension.
+*/
+#define OPT_COOKIE1 0x63
+#define OPT_COOKIE2 0x82
+#define OPT_COOKIE3 0x53
+#define OPT_COOKIE4 0x63
+
+/* BOOTP/DHCP options - see RFC 2132 */
+#define OPT_PAD 0
+
+#define OPT_SUBNET_MASK 1 /* 4 <ipaddr> */
+#define OPT_TIME_OFFSET 2 /* 4 <seconds> */
+#define OPT_GATEWAY 3 /* 4*n <ipaddr> * n */
+#define OPT_DNS 6 /* 4*n <ipaddr> * n */
+#define OPT_DOMAIN_NAME 15 /* n <domainnamestring> */
+#define OPT_BROADCAST_ADDR 28 /* 4 <ipaddr> */
+
+#define OPT_REQUESTED_IP 50 /* 4 <ipaddr> */
+#define OPT_LEASE_TIME 51 /* 4 <seconds> */
+#define OPT_MESSAGE_TYPE 53 /* 1 <msgtype> */
+#define OPT_SERVER_ID 54 /* 4 <ipaddr> */
+#define OPT_PARAMETER_LIST 55 /* n <optcode> * n */
+#define OPT_MESSAGE 56 /* n <errorstring> */
+#define OPT_CLASS_ID 60 /* n <opaque> */
+#define OPT_CLIENT_ID 61 /* n <opaque> */
+#define OPT_END 255
+
+/* DHCP message types */
+#define DHCPDISCOVER 1
+#define DHCPOFFER 2
+#define DHCPREQUEST 3
+#define DHCPDECLINE 4
+#define DHCPACK 5
+#define DHCPNAK 6
+#define DHCPRELEASE 7
+#define DHCPINFORM 8
+
+typedef unsigned long long msecs_t;
+
+typedef struct {
+ uint8_t op; /* BOOTREQUEST / BOOTREPLY */
+ uint8_t htype; /* hw addr type */
+ uint8_t hlen; /* hw addr len */
+ uint8_t hops; /* client set to 0 */
+
+ uint32_t xid; /* transaction id */
+
+ uint16_t secs; /* seconds since start of acq */
+ uint16_t flags;
+
+ uint32_t ciaddr; /* client IP addr */
+ uint32_t yiaddr; /* your (client) IP addr */
+ uint32_t siaddr; /* ip addr of next server */
+ /* (DHCPOFFER and DHCPACK) */
+ uint32_t giaddr; /* relay agent IP addr */
+
+ uint8_t chaddr[16]; /* client hw addr */
+ char sname[64]; /* asciiz server hostname */
+ char file[128]; /* asciiz boot file name */
+
+ uint8_t options[1024]; /* optional parameters */
+} dhcp_msg;
+
+typedef struct {
+ uint32_t type;
+
+ uint32_t ipaddr;
+ uint32_t gateway;
+ uint32_t prefixLength;
+
+ uint32_t dns1;
+ uint32_t dns2;
+
+ uint32_t serveraddr;
+ uint32_t lease;
+} dhcp_info;
+
+int mbtk_do_dhcp(const char *name);
+
+#endif /* _MBTK_DHCP_H */
+
diff --git a/mbtk/include/mbtk/mbtk_file.h b/mbtk/include/mbtk/mbtk_file.h
new file mode 100755
index 0000000..6d17fa1
--- /dev/null
+++ b/mbtk/include/mbtk/mbtk_file.h
@@ -0,0 +1,72 @@
+/*
+*
+*
+* Author : lb
+* Date : 2022/3/4 16:44:14
+*
+*/
+#ifndef _MBTK_FILE_H
+#define _MBTK_FILE_H
+#include "mbtk_type.h"
+
+#ifdef MBTK_PLATFORM_LINUX
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <errno.h>
+#endif
+
+#ifdef MBTK_PLATFORM_QCOMM
+#include "fs_public.h"
+#include "ds_profile.h"
+#include "dsati.h"
+#include "dsat_v.h"
+#include "rex.h"
+#include <stringl/stringl.h>
+#include "mbtk_9205_prod.h"
+#include "mbtk_socket_api.h"
+#endif
+
+#include "mbtk_log.h"
+
+// Return TRUE if file exist,FLASE or not.
+bool file_exist(const char *path);
+
+/*
+ * Return file descriptor if open file success, return -1 or not.
+ *
+ * flag : File open flag.
+ * O_RDONLY 以只读方式打开文件
+ * O_WRONLY 以只写方式打开文件
+ * O_RDWR 以可读写方式打开文件
+ * 上述三种旗标是互斥
+ *
+ * O_CREAT 若欲打开的文件不存在则自动建立该文件。
+ * O_EXCL 如果 O_CREAT 也被设置,此指令会去检查文件是否存在。文件若不存在则
+ * 建立该文件,否则将导致打开文件错误。此外,若 O_CREAT 与 O_EXCL 同时设置,
+ * 并且欲打开的文件为符号连接,则会打开文件失败。
+ * O_NOCTTY 如果欲打开的文件为终端机设备时,则不会将该终端机当成进程控制终端机。
+ * O_TRUNC 若文件存在并且以可写的方式打开时,此旗标会令文件长度清为 0,而原来存于该文件的资料也会消失。
+ * O_APPEND 当读写文件时会从文件尾开始移动,也就是所写入的数据会以附加的方式加入到文件后面。
+ * O_NONBLOCK 以不可阻断的方式打开文件,也就是无论有无数据读取或等待,都会立即返回进程之中。
+ * O_NDELAY 同 O_NONBLOCK。
+ * O_SYNC 以同步的方式打开文件。
+ * O_NOFOLLOW 如果参数 pathname 所指的文件为一符号连接,则会令打开文件失败。
+ * O_DIRECTORY 如果参数 pathname 所指的文件并非为一目录,则会令打开文件失败
+ */
+int file_open(const char *path, int flag);
+
+// Return file size,or -1 if get file size fail.
+int file_length(int fd);
+
+// Read data of specified length.
+int file_read(int fd, void *buf, int nbyte);
+
+// Write data of specified length.
+int file_write(int fd, void *buf, int nbyte);
+
+// Close file.
+int file_close(int fd);
+
+#endif /* _MBTK_FILE_H */
diff --git a/mbtk/include/mbtk/mbtk_ftp.h b/mbtk/include/mbtk/mbtk_ftp.h
new file mode 100755
index 0000000..0eb0a25
--- /dev/null
+++ b/mbtk/include/mbtk/mbtk_ftp.h
@@ -0,0 +1,216 @@
+/*************************************************************
+ Description:
+ MBTK FTP Protocol Head File.
+ Author:
+ LiuBin
+ Date:
+ 2020/10/28 11:49:19
+ *************************************************************/
+#ifndef _MBTK_FTP_H
+#define _MBTK_FTP_H
+
+#include "mbtk_file.h"
+#include "mbtk_sock.h"
+/*************************************************************
+ Constants and Macros
+ *************************************************************/
+#define MBTK_FTP_IP_MAX 50
+#define MBTK_FTP_FILE_NAME_MAX 50
+#define FTP_SERVICE_PORT_DEF 21
+#define FTP_SERVER_USER_NAME_MAX 30
+#define FTP_SERVER_USER_PASS_MAX FTP_SERVER_USER_NAME_MAX
+
+/*************************************************************
+ Definitions:enum,struct,union,class
+ *************************************************************/
+typedef enum
+{
+ FTP_STATE_NON,
+ FTP_STATE_CONNECTING,
+ FTP_STATE_CONNECTED, /* FTP connected. */
+ FTP_STATE_READY, /* FTP logn in success. */
+ FTP_STATE_CMD_PROCESS
+} mbtk_ftp_state_enum;
+
+typedef enum
+{
+ FTP_CMD_CONN, FTP_CMD_PORT, // Active mode(IPV4).
+ FTP_CMD_EPRT, // Active mode(IPV6).
+ FTP_CMD_PASV, // Passive mode(IPV4).
+ FTP_CMD_EPSV, // Passive mode(IPV6).
+ FTP_CMD_LIST, // List files in current directory.
+ FTP_CMD_NLST, // List files in current directory.
+ FTP_CMD_PWD, // Get current directory.
+ FTP_CMD_CWD, // Set current directory.
+ FTP_CMD_MKD, // Create directory.
+ FTP_CMD_RMD, // Remove directory.
+ FTP_CMD_STAT, // Get service status.
+ FTP_CMD_TYPE, // Set data type[A-Ascii,E-EBCDIC,I-Binary].
+ FTP_CMD_SIZE, // Get file size.
+ FTP_CMD_DELE, // Delete file.
+ FTP_CMD_MDTM, // Get file modify time.
+ FTP_CMD_PUT, // Update file.
+ FTP_CMD_GET, // Download file.
+ FTP_CMD_QUIT
+} mbtk_ftp_cmd_enum;
+
+typedef enum
+{
+ FTP_ERR_SUCCESS,
+ FTP_ERR_PARAM_SET,
+ FTP_ERR_CLI_FULL,
+ FTP_ERR_NET_CONN,
+ FTP_ERR_LOGIN_DENIED,
+ FTP_ERR_NET_READ,
+ FTP_ERR_NET_WRITE,
+ FTP_ERR_NET_CLOSE,
+ FTP_ERR_NET_TIMEOUT,
+ FTP_ERR_FILE_NO_FOUND,
+ FTP_ERR_FILE_EXIST,
+ FTP_ERR_DATA_SOCK_BUSY,
+ FTP_ERR_EFS_FILE,
+ FTP_ERR_UNKNOWN
+} mbtk_ftp_error_enum;
+
+typedef enum
+{
+ FTP_MODE_PASSIVE, FTP_MODE_ACTION
+} mbtk_ftp_mode_enum;
+
+typedef enum
+{
+ FTP_DATA_TYPE_A, // Ascii
+ FTP_DATA_TYPE_E, // EBCDIC
+ FTP_DATA_TYPE_I // Binary
+} mbtk_ftp_data_type_enum;
+
+typedef enum
+{
+ FTP_SOCK_CTRL = 0,
+ FTP_SOCK_DATA,
+ FTP_SOCK_MAX
+} mbtk_ftp_sock_type_enum;
+
+typedef int mbtk_ftp_handle;
+typedef void (*mbtk_data_cb_func)(void *data, uint32 data_len);
+
+typedef struct
+{
+ sint16 fd;
+ uint8 host[MBTK_FTP_IP_MAX + 1];
+ uint16 port;
+} mbtk_ftp_sock_s;
+
+typedef struct
+{
+ int fd;
+ uint8 remote_name[MBTK_FTP_FILE_NAME_MAX * 2 + 1];
+ uint8 local_name[MBTK_FTP_FILE_NAME_MAX * 2 + 1];
+ uint8 modify_time[20];
+ mbtk_data_cb_func data_cb;
+ bool is_download;
+ uint32 size_count;
+ uint32 size_send;
+} mbtk_ftp_file_trans_info_s;
+
+typedef struct
+{
+ uint8 name[FTP_SERVER_USER_NAME_MAX + 1];
+ uint8 pass[FTP_SERVER_USER_PASS_MAX + 1];
+} mbtk_ftp_user_info_s;
+
+typedef enum
+{
+ FTP_AUTH_TYPE_NON,
+ FTP_AUTH_TYPE_IMPLICIT,
+ FTP_AUTH_TYPE_EXPLICIT_SSL,
+ FTP_AUTH_TYPE_EXPLICIT_TLS
+} mbtk_ftp_auth_type_enum;
+
+typedef struct
+{
+ mbtk_ftp_handle handle; // 1 - 5
+ mbtk_ftp_auth_type_enum auth_type;
+// bool ssl_enable;
+// bool is_ipv6;
+// bool use_cert;
+ bool is_trans; // Is download or update.
+ bool is_data_sock_busy; // Data socket is busy.
+ //bool should_reconn; // Should reconnect.
+
+ mbtk_ftp_user_info_s user;
+ mbtk_ftp_state_enum state;
+ //mbtk_ftp_sock_s ctrl_sock;
+ mbtk_ftp_file_trans_info_s file_trans;
+ //sint16 data_sock_fd;
+ mbtk_ftp_mode_enum data_mode;
+ mbtk_net_info_s net_info;
+ mbtk_sock_info_s sock_info[FTP_SOCK_MAX];
+ mbtk_init_info ftp_ssl_info;
+ mbtk_init_info ftp_ssl_info_data;
+ mbtk_sock_handle ftp_ssl_handle;
+ mbtk_sock_handle ftp_ssl_handle_data;
+ mbtk_sock_info *ftp_sock_ssl_info;
+ mbtk_sock_info *ftp_sock_ssl_info_data;
+ mbtk_sock_session session;
+ mbtk_sock_session session_data;
+
+} mbtk_ftp_info_s;
+
+typedef struct mbtk_ftp_dir_info
+{
+ uint8 name[MBTK_FTP_FILE_NAME_MAX + 1];
+ bool is_file;
+ uint32 size; // Directory is 0
+
+ struct mbtk_ftp_dir_info *next;
+ void (*ftp_ls_cb_typedef)(void *file_list_cb);
+} mbtk_ftp_file_info_s;
+
+/*************************************************************
+ Extern variables
+ *************************************************************/
+mbtk_ftp_handle mbtk_ftp_init(const void* host, uint16 port, mbtk_ftp_auth_type_enum auth_type,
+ bool is_ipv6, bool use_cert);
+mbtk_ftp_error_enum mbtk_ftp_reconfig(mbtk_ftp_handle handle,const void* host, uint16 port, mbtk_ftp_auth_type_enum auth_type,
+ bool is_ipv6, bool use_cert);
+mbtk_ftp_error_enum mbtk_ftp_deinit(mbtk_ftp_handle handle);
+mbtk_ftp_error_enum mbtk_ftp_quit(mbtk_ftp_handle handle);
+mbtk_ftp_info_s* mbtk_ftp_info_get(mbtk_ftp_handle handle);
+mbtk_ftp_error_enum mbtk_ftp_login(mbtk_ftp_handle handle, void *user,
+ void *pass);
+mbtk_ftp_error_enum mbtk_ftp_net_close(mbtk_ftp_handle handle);
+mbtk_ftp_error_enum mbtk_ftp_pwd(mbtk_ftp_handle handle, void *path);
+mbtk_ftp_error_enum mbtk_ftp_cd(mbtk_ftp_handle handle, void *path);
+mbtk_ftp_error_enum mbtk_ftp_dir_ls(mbtk_ftp_handle handle,
+ mbtk_ftp_file_info_s *list_head);
+uint32 mbtk_ftp_file_size(mbtk_ftp_handle handle, void *path);
+mbtk_ftp_error_enum mbtk_ftp_file_del(mbtk_ftp_handle handle, void *path);
+mbtk_ftp_error_enum mbtk_ftp_dir_mkdir(mbtk_ftp_handle handle, void *path);
+mbtk_ftp_error_enum mbtk_ftp_dir_rmdir(mbtk_ftp_handle handle, void *path);
+mbtk_ftp_error_enum mbtk_ftp_mode_set(mbtk_ftp_handle handle,
+ mbtk_ftp_mode_enum mode);
+mbtk_ftp_error_enum mbtk_ftp_data_type_set(mbtk_ftp_handle handle,
+ mbtk_ftp_data_type_enum data_type);
+uint32 mbtk_ftp_download_start(mbtk_ftp_handle handle, void *remote_path,
+ void *local_path, mbtk_data_cb_func data_cb);
+uint32 mbtk_ftp_download_continue(mbtk_ftp_handle handle);
+int mbtk_ftp_upload_start(mbtk_ftp_handle handle, const void *remote_path,
+ const void *local_path, uint32 size_byte);
+int mbtk_ftp_upload_send(mbtk_ftp_handle handle, const void *data,uint16 data_len);
+mbtk_ftp_error_enum mbtk_ftp_trans_reset(mbtk_ftp_handle handle);
+mbtk_ftp_handle mbtk_ftp_upload_end(mbtk_ftp_handle handle);
+
+#ifdef MBTK_PLATFORM_QCOMM
+int mbtk_ftp_task_handle_set(mbtk_ftp_handle handle,sint15 task_handle);
+mbtk_ftp_error_enum mbtk_ftp_get_ip_and_port(char *ipBuf_out,
+ int *port,int iptype);
+
+#endif
+
+/*************************************************************
+ Public Function Declaration
+ *************************************************************/
+
+#endif /* _MBTK_FTP_H */
+
diff --git a/mbtk/include/mbtk/mbtk_gnss.h b/mbtk/include/mbtk/mbtk_gnss.h
new file mode 100755
index 0000000..027eb48
--- /dev/null
+++ b/mbtk/include/mbtk/mbtk_gnss.h
@@ -0,0 +1,64 @@
+/**
+ * \file mbtk_gnss_internal.h
+ * \brief A Documented file.
+ *
+ * Detailed description
+ * \Author: Sniper <js.wang@mobiletek.cn>
+ * \Version: 1.0.0
+ * \Date: 2022-03-17
+ */
+
+#ifndef __MBTK_GNSS_H__
+#define __MBTK_GNSS_H__
+
+#define MOPEN_GNSS_NMEA_MAX_LENGTH 255 /** NMEA string maximum length. */
+
+typedef uint32 mbtk_gnss_client_handle;
+
+typedef void (*mbtk_gnss_handler_func_t)
+(
+ mbtk_gnss_client_handle h_loc,
+ int e_msg_id,
+ void *pv_data,
+ void *context_ptr
+);
+
+struct mbtk_gnss_location_info_t
+{
+ uint32_t size; /**< Set to the size of mcm_gps_location_t. */
+ int flags; /**< Contains GPS location flags bits. */
+ int position_source; /**< Provider indicator for HYBRID or GPS. */
+ double latitude; /**< Latitude in degrees. */
+ double longitude; /**< Longitude in degrees. */
+ double altitude; /**< Altitude in meters above the WGS 84 reference ellipsoid. */
+ float speed; /**< Speed in meters per second. */
+ float bearing; /**< Heading in degrees. */
+ float accuracy; /**< Expected accuracy in meters. */
+ int64_t timestamp; /**< Timestamp for the location fix in UTC million-second base. */
+ int32_t is_indoor; /**< Location is indoors. */
+ float floor_number; /**< Indicates the floor number. */
+};
+
+typedef struct
+{
+ int64_t timestamp; /**< System Timestamp, marked for when got the nmea data */
+ int length; /**< NMEA string length. */
+ char nmea[MOPEN_GNSS_NMEA_MAX_LENGTH + 1]; /**< NMEA string.*/
+} mbtk_gnss_nmea_info_t; /* Message */
+
+int mbtk_gnss_client_init(uint32 *ph_gnss);
+int mbtk_gnss_client_deinit(uint32 h_gnss);
+int mbtk_gnss_add_rx_msg_handler(uint32 h_gnss, mbtk_gnss_handler_func_t handler_ptr);
+int mbtk_gnss_set_mode(uint32 h_gnss, int mode);
+int mbtk_gnss_set_system_config(uint32 h_gnss, int mode);
+int mbtk_gnss_set_nema_config(uint32 h_gnss, int mode);
+int mbtk_gnss_download_tle(void);
+int mbtk_gnss_injects_aidpos(uint32 h_gnss);
+int mbtk_gnss_firmware_update(void);
+int mbtk_gnss_dev_reset(uint32 h_gnss, int type, int mode);
+int mbtk_gnss_print_version(uint32 h_gnss);
+
+
+int mbtk_at_gnss_start_ttff(int type, int timeout_sec, int count);
+
+#endif
diff --git a/mbtk/include/mbtk/mbtk_http.h b/mbtk/include/mbtk/mbtk_http.h
new file mode 100755
index 0000000..70ade42
--- /dev/null
+++ b/mbtk/include/mbtk/mbtk_http.h
@@ -0,0 +1,364 @@
+/*************************************************************
+Description:
+ MBTK HTTP Header file.
+Author:
+ LiuBin
+Date:
+ 2020/4/29 17:25:55
+*************************************************************/
+#ifndef _MBTK_HTTP_2_H
+#define _MBTK_HTTP_2_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <stdio.h>
+#include "mbtk_type.h"
+#include "mbtk_sock2.h"
+
+
+/*************************************************************
+ Constants and Macros
+*************************************************************/
+#define MBTK_HTTP_URI_MAX 512
+#define MBTK_HTTP_HOST_MAX 50
+#define MBTK_HTTP_URL_MAX (MBTK_HTTP_URI_MAX + MBTK_HTTP_HOST_MAX)
+#define MBTK_HTTP_PORT_DEF 80
+#define MBTK_HTTPS_PORT_DEF 443
+#define HTTP_HANDLE_MAX 3
+#define HTTP_SESSION_MAX 5
+#define HTTP_REQUEST_HEADER_MAX 30
+#define HTTP_RESPONSE_HEADER_MAX 30
+#define HTTP_CONTENT_LEN_MAX 1024
+#define HTTP_MSG_LEN_MAX 1024
+
+#define HTTP_IPC_MSG_PATH "/dev"
+#define HTTP_IPC_MSG_ID 'H'
+
+/*************************************************************
+ Definitions:enum,struct,union,class
+*************************************************************/
+typedef enum {
+ HTTP_VERSION_1_0 = 0,
+ HTTP_VERSION_1_1,
+ HTTP_VERSION_2,
+ HTTP_VERSION_3
+} mbtk_http_version_enum;
+
+typedef enum {
+ HTTP_OPTION_HEAD = 0,
+ HTTP_OPTION_GET,
+ HTTP_OPTION_POST,
+ HTTP_OPTION_PUT,
+ HTTP_OPTION_DELETE,
+ HTTP_OPTION_OPTIONS,
+ HTTP_OPTION_TRACE,
+ HTTP_OPTION_CONNECT,
+ HTTP_OPTION_LINK,
+ HTTP_OPTION_UNLINK
+} mbtk_http_option_enum;
+
+#if 0
+typedef enum {
+ HTTP_HEADER_GENERAL = 0,
+ HTTP_HEADER_REQUEST,
+ HTTP_HEADER_RESPONSE,
+ HTTP_HEADER_ENTITY,
+ HTTP_HEADER_OTHERS
+} mbtk_http_header_type_e;
+
+typedef enum {
+ // General field start.
+ HTTP_HEADER_INDEX_CACHE_CONTROL = 0,
+ HTTP_HEADER_INDEX_CONNECTION,
+ HTTP_HEADER_INDEX_DATE,
+ HTTP_HEADER_INDEX_PRAGMA,
+ HTTP_HEADER_INDEX_TRAILER,
+ HTTP_HEADER_INDEX_TRANSFER_ENCODING,
+ HTTP_HEADER_INDEX_UPGRADE,
+ HTTP_HEADER_INDEX_VIA,
+ HTTP_HEADER_INDEX_WARNING,
+ // General field end.
+ // Request field start.
+ HTTP_HEADER_INDEX_ACCEPT,
+ HTTP_HEADER_INDEX_ACCEPT_CHARSET,
+ HTTP_HEADER_INDEX_ACCEPT_ENCODING,
+ HTTP_HEADER_INDEX_ACCEPT_LANGUAGE,
+ HTTP_HEADER_INDEX_AUTHORIZATION,
+ HTTP_HEADER_INDEX_EXPECT,
+ HTTP_HEADER_INDEX_FROM,
+ HTTP_HEADER_INDEX_HOST,
+ HTTP_HEADER_INDEX_IF_MATCH,
+ HTTP_HEADER_INDEX_IF_MODIFIED_SINCE,
+ HTTP_HEADER_INDEX_IF_NONE_MATCH,
+ HTTP_HEADER_INDEX_IF_RANGE,
+ HTTP_HEADER_INDEX_IF_UNMODIFIED_SINCE,
+ HTTP_HEADER_INDEX_MAX_FORWARDS,
+ HTTP_HEADER_INDEX_PROXY_AUTHORIZATION,
+ HTTP_HEADER_INDEX_RANGE,
+ HTTP_HEADER_INDEX_REFERER,
+ HTTP_HEADER_INDEX_TE,
+ HTTP_HEADER_INDEX_USER_AGENT,
+ // Request field end.
+ // Response field start.
+ HTTP_HEADER_INDEX_ACCEPT_RANGES,
+ HTTP_HEADER_INDEX_AGE,
+ HTTP_HEADER_INDEX_ETAG,
+ HTTP_HEADER_INDEX_LOCATION,
+ HTTP_HEADER_INDEX_PROXY_AUTHENTICATE,
+ HTTP_HEADER_INDEX_RETRY_AFTER,
+ HTTP_HEADER_INDEX_SERVER,
+ HTTP_HEADER_INDEX_VARY,
+ HTTP_HEADER_INDEX_WWW_AUTHENTICATE,
+ // Response field end.
+ // Entity field start.
+ HTTP_HEADER_INDEX_ALLOW,
+ HTTP_HEADER_INDEX_CONTENT_ENCODING,
+ HTTP_HEADER_INDEX_CONTENT_LANGUAGE,
+ HTTP_HEADER_INDEX_CONTENT_LENGTH,
+ HTTP_HEADER_INDEX_CONTENT_LOCATION,
+ HTTP_HEADER_INDEX_CONTENT_MD5,
+ HTTP_HEADER_INDEX_CONTENT_RANGE,
+ HTTP_HEADER_INDEX_CONTENT_TYPE,
+ HTTP_HEADER_INDEX_EXPIRES,
+ HTTP_HEADER_INDEX_LAST_MODIFIED,
+ // Entity field end.
+ // Other field start.
+ HTTP_HEADER_INDEX_SET_COOKIE,
+ HTTP_HEADER_INDEX_COOKIE,
+ HTTP_HEADER_INDEX_X_FRAME_OPTIONS,
+ HTTP_HEADER_INDEX_X_XSS_PROTECTION,
+ HTTP_HEADER_INDEX_DNT,
+ HTTP_HEADER_INDEX_P3P
+ // Other field end.
+} mbtk_http_header_index_e;
+#endif
+
+typedef enum {
+ HTTP_SESSION_STATE_NON = 0,
+ HTTP_SESSION_STATE_CONN,
+ HTTP_SESSION_STATE_WRITE_HEADER,
+ HTTP_SESSION_STATE_WRITE_CONTENT,
+ HTTP_SESSION_STATE_WRITE_END,
+ HTTP_SESSION_STATE_READ_HEADER,
+ HTTP_SESSION_STATE_READ_CONTENT,
+ HTTP_SESSION_STATE_READ_END
+} http_session_state_e;
+
+typedef enum {
+ MBTK_HTTP_STATE_CODE_200 = 200,
+ MBTK_HTTP_STATE_CODE_204 = 204,
+ MBTK_HTTP_STATE_CODE_206 = 206,
+ MBTK_HTTP_STATE_CODE_301 = 301,
+ MBTK_HTTP_STATE_CODE_302 = 302,
+ MBTK_HTTP_STATE_CODE_303 = 303,
+ MBTK_HTTP_STATE_CODE_304 = 304,
+ MBTK_HTTP_STATE_CODE_307 = 307,
+ MBTK_HTTP_STATE_CODE_400 = 400,
+ MBTK_HTTP_STATE_CODE_401 = 401,
+ MBTK_HTTP_STATE_CODE_403 = 403,
+ MBTK_HTTP_STATE_CODE_404 = 404,
+ MBTK_HTTP_STATE_CODE_500 = 500,
+ MBTK_HTTP_STATE_CODE_503 = 503
+} mbtk_http_state_code_e;
+
+typedef enum {
+ MBTK_HTTP_DATA_NON = 0,
+ MBTK_HTTP_DATA_HEADER,
+ MBTK_HTTP_DATA_CONTENT,
+ MBTK_HTTP_DATA_COMPLETE
+} mbtk_http_data_type_enum;
+
+typedef void (*mbtk_http_data_callback_func)(
+ int session_id, mbtk_http_data_type_enum type,
+ void *data,int data_len);
+
+typedef struct mbtk_http_header {
+ char name[30];
+ char *value;
+} mbtk_http_header_t;
+
+typedef struct {
+ int header_cnt;
+ mbtk_http_header_t *req_h[HTTP_REQUEST_HEADER_MAX];
+
+ int content_len; // Post content lenght
+ int content_len_send; // Post content lenght for send.
+ char *content;
+} mbtk_http_session_req_t;
+
+typedef struct {
+ int state_code;
+ mbtk_http_version_enum version;
+
+ int content_length;
+ bool is_chunked;
+ int header_cnt;
+ mbtk_http_header_t *rsp_h[HTTP_RESPONSE_HEADER_MAX];
+} mbtk_http_session_rsp_t;
+
+typedef struct mbtk_http_session{
+ int handle_id;
+ int id;
+ int sock_fd;
+ FILE *sock_file;
+ http_session_state_e state;
+ char host[MBTK_HTTP_HOST_MAX + 1];
+ mbtk_http_option_enum option;
+ mbtk_http_version_enum version;
+ char uri[MBTK_HTTP_URI_MAX + 1];
+ int port;
+ bool is_ssl;
+
+ mbtk_http_session_req_t req;
+ mbtk_http_session_rsp_t rsp;
+} mbtk_http_session_t;
+
+typedef struct mbtk_http_handle{
+ int id;
+ bool show_rsp_header;
+ mbtk_http_data_callback_func data_cb;
+
+ int session_cnt;
+ mbtk_http_session_t *session[HTTP_SESSION_MAX];
+} mbtk_http_handle_t;
+
+#if 0
+typedef enum {
+ HTTP_MSG_SESSION_CREATE_REQ,
+ HTTP_MSG_SESSION_CREATE_RSP,
+ HTTP_MSG_SESSION_FREE_REQ,
+ HTTP_MSG_SESSION_FREE_RSP,
+ HTTP_MSG_SESSION_URL_SET_REQ,
+ HTTP_MSG_SESSION_URL_SET_RSP,
+ HTTP_MSG_SESSION_HEAD_SET_REQ,
+ HTTP_MSG_SESSION_HEAD_SET_RSP,
+ HTTP_MSG_SESSION_CONTENT_SET_REQ,
+ HTTP_MSG_SESSION_CONTENT_SET_RSP,
+ HTTP_MSG_SESSION_ACTION_REQ,
+ HTTP_MSG_SESSION_ACTION_RSP,
+ HTTP_MSG_SESSION_CONTENT_SEND_REQ,
+ HTTP_MSG_SESSION_CONTENT_SEND_RSP
+} mbtk_http_msg_type_enum;
+#endif
+
+typedef enum {
+ HTTP_MSG_SESSION_CREATE,
+ HTTP_MSG_SESSION_FREE,
+ HTTP_MSG_SESSION_HEAD_SET,
+ HTTP_MSG_SESSION_CONTENT_SET,
+ HTTP_MSG_SESSION_ACTION,
+ HTTP_MSG_SESSION_CONTENT_SEND,
+ HTTP_MSG_HANDLE_EXIT
+} mbtk_http_msg_type_enum;
+
+typedef enum {
+ MBTK_HTTP_ERR_SUCCESS,
+ MBTK_HTTP_ERR_UNKNOWN
+} mbtk_http_err_enum;
+
+typedef struct {
+ mbtk_http_msg_type_enum type;
+ int int_arg1;
+ int int_arg2;
+ char str_small[30];
+ char str_large[HTTP_MSG_LEN_MAX];
+} mbtk_http_msg_req_t;
+
+typedef struct {
+ mbtk_http_msg_type_enum type;
+ mbtk_http_err_enum err;
+
+ mbtk_http_data_type_enum data_type;
+ int buff_len;
+ char buff[HTTP_MSG_LEN_MAX];
+} mbtk_http_msg_rsp_t;
+
+/*************************************************************
+ Extern variables
+*************************************************************/
+#if 0
+const mbtk_http_header_field_t mbtk_http_headers[] = {
+ {HTTP_HEADER_INDEX_CACHE_CONTROL, HTTP_HEADER_GENERAL,"Cache-Control"},
+ {HTTP_HEADER_INDEX_CONNECTION, HTTP_HEADER_GENERAL,"Connection"},
+ {HTTP_HEADER_INDEX_DATE, HTTP_HEADER_GENERAL,"Date"},
+ {HTTP_HEADER_INDEX_PRAGMA, HTTP_HEADER_GENERAL,"Pragma"},
+ {HTTP_HEADER_INDEX_TRAILER, HTTP_HEADER_GENERAL,"Trailer"},
+ {HTTP_HEADER_INDEX_TRANSFER_ENCODING, HTTP_HEADER_GENERAL,"Transfer-Encoding"},
+ {HTTP_HEADER_INDEX_UPGRADE, HTTP_HEADER_GENERAL,"Upgrade"},
+ {HTTP_HEADER_INDEX_VIA, HTTP_HEADER_GENERAL,"Via"},
+ {HTTP_HEADER_INDEX_WARNING, HTTP_HEADER_GENERAL,"Warning"},
+ {HTTP_HEADER_INDEX_ACCEPT, HTTP_HEADER_REQUEST,"Accept"},
+ {HTTP_HEADER_INDEX_ACCEPT_CHARSET, HTTP_HEADER_REQUEST,"Accept-Charset"},
+ {HTTP_HEADER_INDEX_ACCEPT_ENCODING, HTTP_HEADER_REQUEST,"Accept-Encoding"},
+ {HTTP_HEADER_INDEX_ACCEPT_LANGUAGE, HTTP_HEADER_REQUEST,"Accept-Language"},
+ {HTTP_HEADER_INDEX_AUTHORIZATION, HTTP_HEADER_REQUEST,"Authorization"},
+ {HTTP_HEADER_INDEX_EXPECT, HTTP_HEADER_REQUEST,"Expect"},
+ {HTTP_HEADER_INDEX_FROM, HTTP_HEADER_REQUEST,"From"},
+ {HTTP_HEADER_INDEX_HOST, HTTP_HEADER_REQUEST,"Host"},
+ {HTTP_HEADER_INDEX_IF_MATCH, HTTP_HEADER_REQUEST,"If-Match"},
+ {HTTP_HEADER_INDEX_IF_MODIFIED_SINCE, HTTP_HEADER_REQUEST,"If-Modified-Since"},
+ {HTTP_HEADER_INDEX_IF_NONE_MATCH, HTTP_HEADER_REQUEST,"If-None-Match"},
+ {HTTP_HEADER_INDEX_IF_RANGE, HTTP_HEADER_REQUEST,"If-Range"},
+ {HTTP_HEADER_INDEX_IF_UNMODIFIED_SINCE, HTTP_HEADER_REQUEST,"If-Unmodified-Since"},
+ {HTTP_HEADER_INDEX_MAX_FORWARDS, HTTP_HEADER_REQUEST,"Max-Forwards"},
+ {HTTP_HEADER_INDEX_PROXY_AUTHORIZATION, HTTP_HEADER_REQUEST,"Proxy-Authorization"},
+ {HTTP_HEADER_INDEX_RANGE, HTTP_HEADER_REQUEST,"Range"},
+ {HTTP_HEADER_INDEX_REFERER, HTTP_HEADER_REQUEST,"Referer"},
+ {HTTP_HEADER_INDEX_TE, HTTP_HEADER_REQUEST,"TE"},
+ {HTTP_HEADER_INDEX_USER_AGENT, HTTP_HEADER_REQUEST,"User-Agent"},
+ {HTTP_HEADER_INDEX_ACCEPT_RANGES, HTTP_HEADER_RESPONSE,"Accept-Ranges"},
+ {HTTP_HEADER_INDEX_AGE, HTTP_HEADER_RESPONSE,"Age"},
+ {HTTP_HEADER_INDEX_ETAG, HTTP_HEADER_RESPONSE,"ETag"},
+ {HTTP_HEADER_INDEX_LOCATION, HTTP_HEADER_RESPONSE,"Location"},
+ {HTTP_HEADER_INDEX_PROXY_AUTHENTICATE, HTTP_HEADER_RESPONSE,"Proxy-Authenticate"},
+ {HTTP_HEADER_INDEX_RETRY_AFTER, HTTP_HEADER_RESPONSE,"Retry-After"},
+ {HTTP_HEADER_INDEX_SERVER, HTTP_HEADER_RESPONSE,"Server"},
+ {HTTP_HEADER_INDEX_VARY, HTTP_HEADER_RESPONSE,"Vary"},
+ {HTTP_HEADER_INDEX_WWW_AUTHENTICATE, HTTP_HEADER_RESPONSE,"WWW-Authenticate"},
+ {HTTP_HEADER_INDEX_ALLOW, HTTP_HEADER_ENTITY,"Allow"},
+ {HTTP_HEADER_INDEX_CONTENT_ENCODING, HTTP_HEADER_ENTITY,"Content-Encoding"},
+ {HTTP_HEADER_INDEX_CONTENT_LANGUAGE, HTTP_HEADER_ENTITY,"Content-Language"},
+ {HTTP_HEADER_INDEX_CONTENT_LENGTH, HTTP_HEADER_ENTITY,"Content-Length"},
+ {HTTP_HEADER_INDEX_CONTENT_LOCATION, HTTP_HEADER_ENTITY,"Content-Location"},
+ {HTTP_HEADER_INDEX_CONTENT_MD5, HTTP_HEADER_ENTITY,"Content-MD5"},
+ {HTTP_HEADER_INDEX_CONTENT_RANGE, HTTP_HEADER_ENTITY,"Content-Range"},
+ {HTTP_HEADER_INDEX_CONTENT_TYPE, HTTP_HEADER_ENTITY,"Content-Type"},
+ {HTTP_HEADER_INDEX_EXPIRES, HTTP_HEADER_ENTITY,"Expires"},
+ {HTTP_HEADER_INDEX_LAST_MODIFIED, HTTP_HEADER_ENTITY,"Last-Modified"},
+ {HTTP_HEADER_INDEX_SET_COOKIE, HTTP_HEADER_OTHERS,"Set-Cookie"},
+ {HTTP_HEADER_INDEX_COOKIE, HTTP_HEADER_OTHERS,"Cookie"},
+ {HTTP_HEADER_INDEX_X_FRAME_OPTIONS, HTTP_HEADER_OTHERS,"X-Frame-Options"},
+ {HTTP_HEADER_INDEX_X_XSS_PROTECTION, HTTP_HEADER_OTHERS,"X-XSS-Protection"},
+ {HTTP_HEADER_INDEX_DNT, HTTP_HEADER_OTHERS,"DNT"},
+ {HTTP_HEADER_INDEX_P3P, HTTP_HEADER_OTHERS,"P3P"}
+};
+#endif
+/*************************************************************
+ Public Function Declaration
+*************************************************************/
+int mbtk_http_handle_get(bool show_rsp_header,mbtk_http_data_callback_func data_cb);
+int mbtk_http_handle_free(int handle_id);
+int mbtk_http_session_create(int handle_id, mbtk_http_option_enum option,
+ mbtk_http_version_enum version);
+int mbtk_http_session_option_reset(int handle_id, int session_id, mbtk_http_option_enum option);
+int mbtk_http_session_free(int handle_id,int session_id);
+int mbtk_http_session_url_set(int handle_id,int session_id,void *url);
+int mbtk_http_session_head_add(int handle_id,int session_id,
+ char *name, char *value);
+int mbtk_http_session_content_set(int handle_id,int session_id,
+ char *content,uint32 content_len);
+int mbtk_http_session_start(int handle_id,int session_id);
+int mbtk_http_session_content_send(int handle_id,int session_id,
+ char *data,int data_len);
+const mbtk_http_session_t* mbtk_http_session_get(int handle_id,int session_id);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _MBTK_HTTP_2_H */
+
+
diff --git a/mbtk/include/mbtk/mbtk_ifc.h b/mbtk/include/mbtk/mbtk_ifc.h
new file mode 100755
index 0000000..a839aea
--- /dev/null
+++ b/mbtk/include/mbtk/mbtk_ifc.h
@@ -0,0 +1,38 @@
+/*
+* MBTK Network Interface Control Header.
+*
+* Author : lb
+* Date : 2021/8/20 13:18:00
+*
+*/
+#ifndef _MBTK_IFC_H
+#define _MBTK_IFC_H
+#include <netinet/in.h>
+
+int mbtk_ifc_open(void);
+int mbtk_ifc_close(void);
+int mbtk_ifc_up(const char *name);
+int mbtk_ifc_down(const char *name);
+int mbtk_ifc_set_addr(const char *name, in_addr_t addr, in_addr_t netmask);
+int mbtk_ifc_get_addr(const char *name, void *addr);
+int mbtk_ifc_get_hwaddr(const char *name, void *ptr);
+int mbtk_ifc_get_ifindex(const char *name, int *if_indexp);
+int mbtk_ifc_ip_config(const char *ifname, const char *ipv4, const char *mask, const char *gateway);
+int mbtk_ifc_set_netmask(const char *ifname, const char *netmask);
+
+int mbtk_ifc_configure1(const char *ifname,
+ in_addr_t address,
+ uint32_t prefixLength,
+ in_addr_t gateway,
+ in_addr_t netmask);
+
+int mbtk_ifc_configure2(const char *ifname,
+ const char *ipv4,
+ uint32_t prefixLength,
+ const char *gateway,
+ const char *netmask);
+
+int mbtk_ipv6_config(const char *ifname, const char *ipv6, uint32_t prefixLength);
+
+#endif /* _MBTK_IFC_H */
+
diff --git a/mbtk/include/mbtk/mbtk_info_api.h b/mbtk/include/mbtk/mbtk_info_api.h
new file mode 100755
index 0000000..8a70c66
--- /dev/null
+++ b/mbtk/include/mbtk/mbtk_info_api.h
@@ -0,0 +1,768 @@
+/*
+*
+* Data : 2022/10/20 11:24:09
+* Author : LiuBin
+*/
+#ifndef _MBTK_INFO_API_H
+#define _MBTK_INFO_API_H
+#include <netinet/in.h>
+
+#include "mbtk_type.h"
+#include "mbtk_list.h"
+#include "mbtk_log.h"
+#include "mbtk_utils.h"
+
+#ifndef UNUSED
+#define UNUSED(a) (void)(a)
+#endif
+
+// LOG_DEBUG_LEVEL 7
+#define LOG LOGI
+
+#define CELL_NUM_MAX 50
+#define APN_STR_MAX 128
+// 2 - 7
+#define MBTK_APN_CID_MIN 2
+#define MBTK_APN_CID_MAX 7
+#define MBTK_DATA_CALL_TIMEOUT_DEFAULT 10 // 10s
+
+typedef void (*mbtk_info_callback_func)(const void* data, int data_len);
+
+typedef enum {
+ MBTK_TIME_TYPE_CELL = 0,
+ MBTK_TIME_TYPE_NTP,
+ MBTK_TIME_TYPE_USER
+} mbtk_time_type_enum;
+
+typedef enum {
+ MBTK_ACTIVE,
+ MBTK_HELD,
+ MBTK_DIALING,
+ MBTK_ALERTING,
+ MBTK_INCOMING,
+ MBTK_WAITING,
+ MBTK_OFFERING,
+} mbtk_call_stat_enum;
+
+/*
+ 0 : GSM only
+ 1 : UMTS only
+ 2 : GSM/UMTS(auto)
+ 3 : GSM/UMTS(GSM preferred)
+ 4 : GSM/UMTS(UMTS preferred)
+ 5 : LTE only
+ 6 : GSM/LTE(auto)
+ 7 : GSM/LTE(GSM preferred)
+ 8 : GSM/LTE(LTE preferred)
+ 9 : UMTS/LTE(auto)
+ 10 : UMTS/LTE(UMTS preferred)
+ 11 : UMTS/LTE(LTE preferred)
+ 12 : GSM/UMTS/LTE(auto)
+ 13 : GSM/UMTS/LTE(GSM preferred)
+ 14 : GSM/UMTS/LTE(UMTS preferred)
+ 15 : GSM/UMTS/LTE(LTE preferred)
+*/
+typedef enum
+{
+ MBTK_NET_PREF_GSM_ONLY = 0,
+ MBTK_NET_PREF_UMTS_ONLY,
+ MBTK_NET_PREF_GSM_UMTS_AUTO,
+ MBTK_NET_PREF_GSM_UMTS_GSM_PREF,
+ MBTK_NET_PREF_GSM_UMTS_UMTS_PREF,
+ MBTK_NET_PREF_LTE_ONLY,
+ MBTK_NET_PREF_GSM_LTE_AUTO,
+ MBTK_NET_PREF_GSM_LTE_GSM_PREF,
+ MBTK_NET_PREF_GSM_LTE_LTE_PREF,
+ MBTK_NET_PREF_UMTS_LTE_AUTO,
+ MBTK_NET_PREF_UMTS_LTE_UMTS_PREF,
+ MBTK_NET_PREF_UMTS_LTE_LTE_PREF,
+ MBTK_NET_PREF_GSM_UMTS_LTE_AUTO,
+ MBTK_NET_PREF_GSM_UMTS_LTE_GSM_PREF,
+ MBTK_NET_PREF_GSM_UMTS_LTE_UMTS_PREF,
+ MBTK_NET_PREF_GSM_UMTS_LTE_LTE_PREF
+} mbtk_net_pref_enum;
+
+typedef enum
+{
+ MBTK_CELL_TYPE_GSM = 0,
+ MBTK_CELL_TYPE_UMTS,
+ MBTK_CELL_TYPE_LTE
+} mbtk_cell_type_enum;
+
+typedef struct
+{
+ int client_fd;
+ pthread_t read_thread_id;
+ int exit_fd[2];
+ bool is_waitting;
+ pthread_cond_t cond;
+ pthread_mutex_t mutex;
+
+ // Temp response data.
+ uint16 info_err;
+ uint16 data_len;
+ void *data;
+
+ //mbtk wyq for server_ready_status add start
+ char server_ready_status;
+ //mbtk wyq for server_ready_status add end
+
+ mbtk_info_callback_func net_state_cb;
+ mbtk_info_callback_func call_state_cb;
+ mbtk_info_callback_func sms_state_cb;
+ mbtk_info_callback_func radio_state_cb;
+ mbtk_info_callback_func sim_state_cb;
+ mbtk_info_callback_func pdp_state_cb;
+} mbtk_info_handle_t;
+
+typedef struct
+{
+ /*
+ 0: automatic
+ 1: manual
+ */
+ uint8 net_sel_mode;
+ /*
+ 0: GSM
+ 1: GSM Compact
+ 2: UTRAN
+ 3: GSM w/EGPRS
+ 4: UTRAN w/HSDPA
+ 5: UTRAN w/HSUPA
+ 6: UTRAN w/HSDPA and HSUPA
+ 7: E-UTRAN
+ 8: UTRAN HSPA+
+ 0xFF: Unused
+ */
+ uint8 net_type;
+ //uint8 plmn[10]; // 46000
+ /*
+ 0: unknown
+ 1: available
+ 2: current
+ 3: forbidden
+ */
+ uint8 net_state;
+ uint32 plmn;
+} __attribute__((packed)) mbtk_net_info_t;
+
+typedef struct
+{
+ uint8 net_pref; // mbtk_net_pref_enum
+ uint16 gsm_band; // mbtk_gsm_band_enum
+ uint16 umts_band; // mbtk_umts_band_enum
+ uint32 tdlte_band; // mbtk_tdlte_band_enum
+ uint32 fddlte_band; // mbtk_fddlte_band_enum
+} __attribute__((packed)) mbtk_band_info_t;
+
+typedef struct
+{
+ uint8 type; // mbtk_radio_technology_enum
+ uint8 rssi; // 0: 113 dBm or less
+ // 1: 111 dBm
+ // 2��30: 109��53 dBm
+ // 31: 51 dBm or greater
+ // 99: not known or not detectable
+ uint8 rxlev;// 0:rssi < -110 dBm
+ // 1: -110 dBm �� rssi < -109 dBm
+ // 2: -109 dBm �� rssi < -108 dBm
+ // ......
+ // 61: -50 dBm �� rssi < -49 dBm
+ // 62: -49 dBm �� rssi < -48 dBm
+ // 63: -48 dBm �� rssi
+ // 99: not known or not detectable
+ uint8 ber; // 0...7 as RXQUAL values in the table in 3GPP TS 45.008 [20] subclause 8.2.4
+ // 99 not known or not detectable
+ uint8 rscp; // 0: rscp < -120 dBm
+ // 1: -120 dBm �� rscp < -119 dBm
+ // 2: -119 dBm �� rscp < -118 dBm
+ // ......
+ // 94: -27 dBm �� rscp < -26 dBm
+ // 95: -26 dBm �� rscp < -25 dBm
+ // 96: - 25 dBm �� rscp
+ // 255: not known or not detectable
+ uint8 ecno; // 0: Ec/Io < -24 dB
+ // 1: -24 dB �� Ec/Io < -23.5 dB
+ // 2: -23.5 dB �� Ec/Io < -23 dB
+ // ......
+ // 47: -1 dB �� Ec/Io < -0.5 dB
+ // 48: -0.5 dB �� Ec/Io < 0 dB
+ // 49: 0 dB �� Ec/Io
+ // 255: not known or not detectable
+ uint8 rsrq; // 0: rsrq < -19.5 dB
+ // 1: -19.5 dB �� rsrq < -19 dB
+ // 2: -19 dB �� rsrq < -18.5 dB
+ // ......
+ // 32: -4 dB �� rsrq < -3.5 dB
+ // 33: -3.5 dB �� rsrq < -3 dB
+ // 34: -3 dB �� rsrq
+ // 255: not known or not detectable
+ uint8 rsrp; // 0: rsrp < -140 dBm
+ // 1: -140 dBm �� rsrp < -139 dBm
+ // 2: -139 dBm �� rsrp < -138 dBm
+ // ......
+ // 95: -46 dBm �� rsrp < -45 dBm
+ // 96: -45 dBm �� rsrp < -44 dBm
+ // 97: -44 dBm �� rsrp
+ // 255: not known or not detectable
+} __attribute__((packed)) mbtk_signal_info_t;
+
+typedef struct
+{
+ uint8 call_state;// mbtk_net_reg_state_enum
+ uint8 data_state;// mbtk_net_reg_state_enum
+ uint8 ims_state;// mbtk_net_reg_state_enum
+ uint8 type; // mbtk_radio_technology_enum
+ uint16 lac;
+ uint32 ci;
+} __attribute__((packed)) mbtk_net_reg_info_t;
+
+typedef struct
+{
+ uint8 call_wait;
+ uint8 dir1;
+ uint8 dir;
+ uint8 state;
+ uint8 mode;
+ uint8 mpty;
+ char phone_number[100];
+ uint8 type;
+ uint8 pas;
+ uint8 disconnected_id;
+} __attribute__((packed)) mbtk_call_info_t;
+
+typedef struct
+{
+ char character;
+ uint32 duration;
+} __attribute__((packed)) mbtk_call_dtmf_info_t;
+
+typedef enum {
+ MBTK_SIM_ABSENT = 0,
+ MBTK_SIM_NOT_READY = 1,
+ MBTK_SIM_READY = 2,
+ MBTK_SIM_PIN = 3,
+ MBTK_SIM_PUK = 4,
+ MBTK_SIM_NETWORK_PERSONALIZATION = 5
+} mbtk_sim_state_enum;
+
+typedef enum {
+ MBTK_IP_TYPE_IP,
+ MBTK_IP_TYPE_IPV6,
+ MBTK_IP_TYPE_IPV4V6,
+ MBTK_IP_TYPE_PPP
+} mbtk_ip_type_enum;
+
+typedef enum
+{
+ MBTK_NET_TYPE_UNKNOWN,
+ MBTK_NET_TYPE_GSM,
+ MBTK_NET_TYPE_UMTS,
+ MBTK_NET_TYPE_LTE
+} mbtk_net_type_enum;
+
+typedef enum {
+ MBTK_CLCC = 1,
+ MBTK_CPAS,
+ MBTK_DISCONNECTED,
+} mbtk_call_enum;
+
+typedef struct
+{
+ // LTE server cell: tac, PCI, dlEuarfcn, ulEuarfcn, band
+ // LTE cell: phyCellId,euArfcn,rsrp,rsrq
+ // WCDMA server cell: lac, ci, arfcn
+ // WCDMA cell: lac, ci, arfcn
+ // GSM server cell: lac, ci, arfcn, bsic
+ // GSM cell:
+ uint32 value1;
+ uint32 value2;
+ uint32 value3;
+ uint32 value4;
+ uint32 value5;
+ uint32 value6;
+ uint32 value7;
+ uint32 value8;
+ uint32 value9;
+ uint32 value10;
+} __attribute__((packed)) mbtk_cell_info_t;
+
+typedef enum {
+ MBTK_CALL_RADY, //MT allows commands from TA/TE
+ MBTK_CALL_UNAVAILABLE, //MT does not allow commands from TA/TE
+ MBTK_CALL_UNKNOWN, //MT is not guaranteed to respond to instructions
+ MBTK_CALL_RINGING, //MT is ready for commands from TA/TE, but the ringer is active
+ MBTK_CALL_PROGRESS, //MT is ready for commands from TA/TE, but a call is in progress
+ MBTK_CALL_ASLEEP, //MT is unable to process commands from TA/TE because it is in a low functionality state
+ MBTK_CALL_ACTIVE,
+} mbtk_call_pas_enum;
+
+typedef enum {
+ MBTK_RADIO_STATE_UNKNOWN,
+ MBTK_RADIO_STATE_ON,
+ MBTK_RADIO_STATE_OFF
+} mbtk_radio_state_enum;
+
+typedef enum {
+ MBTK_DATA_CALL_STOP = 0, // Stop data call.
+ MBTK_DATA_CALL_START, // Start data call.
+ MBTK_DATA_CALL_STATE // Get data call state
+} mbtk_data_call_type_enum;
+
+/*
+0: not registered, MT is not currently searching a new operator to register to
+1: registered, home network
+2: not registered, but MT is currently searching a new operator to register to
+3: registration denied
+4: unknown
+5: registered, roaming
+6: registered, home network, SMS-only (applicable only when AcT is E-UTRAN)
+7: registered, roaming, SMS-only (applicable only when AcT is E-UTRAN)
+8: attached for emergency bearer services only (not applicable)
+9: registered for ��CSFB not preferred��,home network(applicable only when AcT is E-UTRAN)
+10: registered for ��CSFB not preferred��,roaming(applicable only when AcT is E-UTRAN)
+11: only emergency services are available
+*/
+typedef enum
+{
+ MBTK_NET_REG_STATE_NON = 0,
+ MBTK_NET_REG_STATE_HOME,
+ MBTK_NET_REG_STATE_SEARCHING,
+ MBTK_NET_REG_STATE_DENIED,
+ MBTK_NET_REG_STATE_UNKNOWN,
+ MBTK_NET_REG_STATE_ROAMING,
+ MBTK_NET_REG_STATE_SMS_ONLY,
+ MBTK_NET_REG_STATE_ROAMING_SMS,
+ MBTK_NET_REG_STATE_ATTACHED_EMERGENCY,
+ MBTK_NET_REG_STATE_CSFB_HOME,
+ MBTK_NET_REG_STATE_CSFB_ROAMING,
+ MBTK_NET_REG_STATE_EMERGENCY_ONLY
+} mbtk_net_reg_state_enum;
+
+typedef struct {
+ int cid; // 2 - 7
+ mbtk_ip_type_enum ip_type; // mbtk_ip_type_enum
+ uint8 apn[APN_STR_MAX];
+ uint8 user[APN_STR_MAX];
+ uint8 pass[APN_STR_MAX];
+ uint8 auth[APN_STR_MAX];
+} mbtk_apn_info_t;
+
+typedef struct {
+ bool valid;
+ uint32 IPAddr;
+ uint32 PrimaryDNS;
+ uint32 SecondaryDNS;
+ uint32 GateWay;
+ uint32 NetMask;
+} __attribute__((packed)) mbtk_ipv4_info_t;
+
+typedef struct {
+ bool valid;
+ uint32 IPV6Addr[4];
+ uint32 PrimaryDNS[4];
+ uint32 SecondaryDNS[4];
+ uint32 GateWay[4];
+ uint32 NetMask[4];
+} __attribute__((packed)) mbtk_ipv6_info_t;
+
+typedef enum
+{
+ MBTK_DEV_MODEM_MIN_FUN, //Modem 最小功能
+ MBTK_DEV_MODEM_FULL_FUN, //Modem 全功能
+ MBTK_DEV_MODEM_DISABLE_RECEIVE_RF_CIRCUITS = 3, //Modem 禁用射频接收电路
+ MBTK_DEV_MODEM_DISABLE_TRANSMIT_AND_RECEIVE_RF_CIRCUITS, //Modem禁用射频发射和接收电路
+ MBTK_DEV_MODEM_DISABLE_SIM, //Modem 禁用(U)SIM 卡
+ MBTK_DEV_MODEM_TURN_OFF_FULL_SECONDARY_RECEIVE, //Modem 完全禁用辅助接收
+}MBTK_DEV_MODEM_FUNCTION;
+
+/*
+0: GSM
+1: GSM Compact
+2: UTRAN
+3: GSM w/EGPRS
+4: UTRAN w/HSDPA
+5: UTRAN w/HSUPA
+6: UTRAN w/HSDPA and HSUPA
+7: E-UTRAN
+8: UTRAN HSPA+
+*/
+typedef enum {
+ MBTK_RADIO_TECH_GSM = 0,
+ MBTK_RADIO_TECH_GSM_COMPACT,
+ MBTK_RADIO_TECH_UTRAN,
+ MBTK_RADIO_TECH_GSM_EGPRS,
+ MBTK_RADIO_TECH_UTRAN_HSDPA,
+ MBTK_RADIO_TECH_UTRAN_HSUPA,
+ MBTK_RADIO_TECH_UTRAN_HSDPA_HSUPA,
+ MBTK_RADIO_TECH_E_UTRAN, // LTE
+ MBTK_RADIO_TECH_UTRAN_HSPA
+} mbtk_radio_technology_enum;
+
+typedef struct
+{
+ MBTK_DEV_MODEM_FUNCTION fun;
+ int rst;
+} mbtk_modem_info_t;
+
+typedef enum {
+ MBTK_SIM = 0,
+ MBTK_USIM = 1,
+ MBTK_TEST_SIM = 2,
+ MBTK_TEST_USIM = 3,
+ MBTK_UNKNOWN = 4,
+} mbtk_sim_card_type_enum;
+
+typedef struct
+{
+ uint8_t p1_retry;
+ uint8_t p2_retry;
+ uint8_t puk1_retry;
+ uint8_t puk2_retry;
+} mbtk_pin_puk_last_times;
+
+typedef struct
+{
+ uint8_t format;
+ char plmn_name[16];
+}MBTK_SIM_PLMN_INFO_C; //string type
+
+
+typedef struct
+{
+ uint8_t count;
+ uint8_t format;
+ MBTK_SIM_PLMN_INFO_C mbtk_plmn_name[24];
+} mbtk_plmn_info;
+
+typedef struct
+{
+ uint8_t old_pin_value[16];
+ uint8_t new_pin_value[16];
+} mbtk_change_pin_info;
+
+typedef struct
+{
+ uint8_t pin_value[16];
+ uint8_t puk_value[16];
+} mbtk_unlock_pin_info;
+
+typedef struct
+{
+ uint8_t pin_value[16];
+ uint8_t enable;
+} mbtk_enable_pin_info;
+
+typedef struct
+{
+ int sim;
+ int sim_card_type;
+ mbtk_pin_puk_last_times ql_last_times;
+} mbtk_sim_card_info;
+
+mbtk_info_handle_t* mbtk_info_handle_get();
+
+int mbtk_info_handle_free(mbtk_info_handle_t** handle);
+
+/*
+* Get platform version.
+*/
+int mbtk_version_get(mbtk_info_handle_t* handle, void *version);
+
+/*
+* Get platform model.
+*/
+int mbtk_model_get(mbtk_info_handle_t* handle, void *model);
+
+/*
+* Get platform IMEI.
+*/
+int mbtk_imei_get(mbtk_info_handle_t* handle, void *imei);
+
+/*
+* Get platform SN.
+*/
+int mbtk_sn_get(mbtk_info_handle_t* handle, void *sn);
+
+/*
+* Get platform MEID.
+*/
+int mbtk_meid_get(mbtk_info_handle_t* handle, void *meid);
+
+/*
+* Return VoLTE state.
+*/
+int mbtk_volte_state_get(mbtk_info_handle_t* handle, int *volte_state);
+
+/*
+* Return modem state.
+*/
+int mbtk_get_modem_fun(mbtk_info_handle_t* handle, int* fun);
+
+/*
+* Set modem state.
+*/
+int mbtk_set_modem_fun(mbtk_info_handle_t* handle, mbtk_modem_info_t *info);
+
+
+/*
+* Set VoLTE state.
+*
+* volte_state:
+* 0 : Close VoLTE.
+* 1 : Open VoLTE.
+*
+* Restarting takes effect after execution.
+*/
+int mbtk_volte_state_set(mbtk_info_handle_t* handle, int volte_state);
+
+/*
+* Get platform IMSI.
+*/
+int mbtk_imsi_get(mbtk_info_handle_t* handle, void *imsi);
+
+/*
+* Get platform ICCID.
+*/
+int mbtk_iccid_get(mbtk_info_handle_t* handle, void *iccid);
+
+/*
+* Get current phone number.
+*/
+int mbtk_phone_number_get(mbtk_info_handle_t* handle, void *phone_number);
+
+/*
+* Get available network.
+*/
+int mbtk_available_net_get(mbtk_info_handle_t* handle, list_node_t **net_list);
+
+/*
+* Set network select mode. (+COPS=...)
+*/
+int mbtk_net_sel_mode_set(mbtk_info_handle_t* handle, const mbtk_net_info_t *net);
+
+/*
+* Get network select mode. (+COPS?)
+*/
+int mbtk_net_sel_mode_get(mbtk_info_handle_t* handle, mbtk_net_info_t *net);
+
+/*
+* Get platform support bands.
+*/
+int mbtk_support_band_get(mbtk_info_handle_t* handle, mbtk_band_info_t *band);
+
+/*
+* Get platform current bands.
+*/
+int mbtk_current_band_get(mbtk_info_handle_t* handle, mbtk_band_info_t *band);
+
+/*
+* Set platform current bands.
+*/
+int mbtk_current_band_set(mbtk_info_handle_t* handle, const mbtk_band_info_t *band);
+
+/*
+* Get current cell infomation.
+*/
+int mbtk_cell_get(mbtk_info_handle_t* handle, mbtk_cell_type_enum *type, list_node_t **cell_list);
+
+/*
+* Set AT*CELL.
+*/
+int mbtk_cell_set(mbtk_info_handle_t* handle, char * info, char* response);
+
+/*
+* Get current APN informations.
+*/
+int mbtk_apn_get(mbtk_info_handle_t* handle, int *apn_num, mbtk_apn_info_t apns[]);
+
+/*
+* Set current APN informations.
+*/
+int mbtk_apn_set(mbtk_info_handle_t* handle, int cid, mbtk_ip_type_enum ip_type, const void* apn_name,
+ const void *user_name, const void *user_pass, const void *auth);
+
+/*
+* Start data call.
+*/
+int mbtk_data_call_start(mbtk_info_handle_t* handle, int cid, int auto_conn_interval, bool boot_conn, int timeout);
+
+/*
+* Stop data call.
+*/
+int mbtk_data_call_stop(mbtk_info_handle_t* handle, int cid, int timeout);
+
+/*
+* Get data call state.
+*/
+int mbtk_data_call_state_get(mbtk_info_handle_t* handle, int cid, mbtk_ipv4_info_t *ipv4, mbtk_ipv6_info_t *ipv6);
+
+/*
+* Get current network signal.
+*/
+int mbtk_net_signal_get(mbtk_info_handle_t* handle, mbtk_signal_info_t *signal);
+
+/*
+* Get current network register information.
+*/
+int mbtk_net_reg_get(mbtk_info_handle_t* handle, mbtk_net_reg_info_t *reg);
+
+/*
+* Get radio state.
+*/
+int mbtk_radio_state_get(mbtk_info_handle_t* handle, int *radio_state);
+
+/*
+* Set radio state.
+*/
+int mbtk_radio_state_set(mbtk_info_handle_t* handle, int radio_state);
+
+/*
+* Get sim state.
+*/
+int mbtk_sim_state_get(mbtk_info_handle_t* handle, mbtk_sim_state_enum *sim_state);
+
+/*
+* Get sim card type.
+*/
+int mbtk_sim_card_type_get(mbtk_info_handle_t* handle, mbtk_sim_card_type_enum *sim_card_type);
+
+/*
+* Get PIN’s number of remaining retry
+*/
+int mbtk_pin_last_num_get(mbtk_info_handle_t* handle, mbtk_pin_puk_last_times *last_times);
+
+/*
+* Get plmn list
+*/
+int mbtk_get_plmn_list(mbtk_info_handle_t* handle, mbtk_plmn_info *pin);
+
+/*
+* Get system temperature.
+*
+* type[IN]:
+* 0: Soc temperature.
+* 1: RF temperature.
+* temp[OUT]:
+* temperature in celsius.
+*/
+int mbtk_temp_get(mbtk_info_handle_t* handle, int type, int* temp);
+
+/*
+* Set sim power state.
+* power:
+* 0: Sim power off.
+* 1: Sim power on.
+*/
+int mbtk_sim_power_set(int power);
+
+/*
+*enable PIN
+*/
+int mbtk_enable_pin(mbtk_info_handle_t* handle, mbtk_enable_pin_info *pin);
+
+/*
+*Verify PIN
+*/
+int mbtk_verify_pin(mbtk_info_handle_t* handle, char *pin);
+
+/*
+*change PIN
+*/
+int mbtk_change_pin(mbtk_info_handle_t* handle, mbtk_change_pin_info *pin);
+
+/*
+*unlock PIN
+*/
+int mbtk_unlock_pin(mbtk_info_handle_t* handle, mbtk_unlock_pin_info *pin);
+
+
+/*
+* System power.
+* type:
+* 0: Reboot system.
+* 1: Poweroff system.
+* 2: Halt system.
+*/
+int mbtk_system_reboot(int type);
+
+/*
+* Get time type.
+*/
+int mbtk_time_get(mbtk_info_handle_t* handle, int *time_type);
+
+/*
+* Get net time.
+*/
+int mbtk_net_time_get(mbtk_info_handle_t* handle, char* time_str);
+
+/*
+* Absolute time conversion
+*/
+int mbtk_get_abs_time(char *time_str, time_t *time_out);
+
+/*
+* Set time.
+*
+* time_type:
+* 0: Cell time
+* 1: NTP time
+* 2: User time
+* time_str: "YYYY-MM-DD HH:MM:SS"
+*/
+int mbtk_time_set(mbtk_info_handle_t* handle, mbtk_time_type_enum time_type, char* time_str);
+
+//call a phone number
+int mbtk_call_start(mbtk_info_handle_t* handle, char* phone_number);
+//answer a call
+int mbtk_call_answer(mbtk_info_handle_t* handle);
+//hang up all call
+int mbtk_call_hang(mbtk_info_handle_t* handle);
+//hang up a call
+int mbtk_a_call_hang(mbtk_info_handle_t* handle, int phone_id);
+//hang up waiting or background call
+int mbtk_waiting_or_background_call_hang(mbtk_info_handle_t* handle);
+//hang up foreground resume background call
+int mbtk_foreground_resume_background_call_hang(mbtk_info_handle_t* handle);
+//get call infomation
+int mbtk_call_reg_get(mbtk_info_handle_t* handle, mbtk_call_info_t *reg);
+//set call mute
+int mbtk_mute_state_set(mbtk_info_handle_t* handle, int mute_state);
+//get mute state
+int mbtk_mute_state_get(mbtk_info_handle_t* handle, int *mute_state);
+//set dtmf character
+int mbtk_dtmf_send(mbtk_info_handle_t* handle, mbtk_call_dtmf_info_t *dtmf_character);
+
+/*
+* Set pdp state change callback function.
+*/
+int mbtk_pdp_state_change_cb_reg(mbtk_info_handle_t* handle, mbtk_info_callback_func cb);
+
+/*
+* Set network state change callback function.
+*/
+int mbtk_net_state_change_cb_reg(mbtk_info_handle_t* handle, mbtk_info_callback_func cb);
+
+/*
+* Set call state change callback function.
+*/
+int mbtk_call_state_change_cb_reg(mbtk_info_handle_t* handle, mbtk_info_callback_func cb);
+
+/*
+* Set sms state change callback function.
+*/
+int mbtk_sms_state_change_cb_reg(mbtk_info_handle_t* handle, mbtk_info_callback_func cb);
+
+/*
+* Set radio state change callback function.
+*/
+int mbtk_radio_state_change_cb_reg(mbtk_info_handle_t* handle, mbtk_info_callback_func cb);
+
+/*
+* Set sim state change callback function.
+*/
+int mbtk_sim_state_change_cb_reg(mbtk_info_handle_t* handle, mbtk_info_callback_func cb);
+
+int mbtk_sms_cnmi_set(mbtk_info_handle_t* handle);
+
+#endif /* _MBTK_INFO_API_H */
diff --git a/mbtk/include/mbtk/mbtk_list.h b/mbtk/include/mbtk/mbtk_list.h
new file mode 100755
index 0000000..bab5bb3
--- /dev/null
+++ b/mbtk/include/mbtk/mbtk_list.h
@@ -0,0 +1,63 @@
+/*
+ * mbtk_list.h
+ *
+ * Created on: Aug 18, 2020
+ * Author: lb
+ */
+
+#ifndef MBTK_LIST_H_
+#define MBTK_LIST_H_
+#include "mbtk_type.h"
+
+typedef struct list_arraynode
+{
+ void *data;
+ struct list_arraynode *next;
+} list_arraynode_t;
+
+typedef struct list_treenode
+{
+ list_arraynode_t *data;
+ int count;
+ struct list_treenode *left;
+ struct list_treenode *right;
+} list_treenode_t;
+
+typedef int (*list_sort_func)(void *data1, void *data2);
+typedef void (*list_free_func)(void *data);
+
+typedef struct list_node
+{
+ uint32 size;
+ list_sort_func sort_func;
+ list_free_func free_func;
+
+ uint32 cur_index;
+ list_arraynode_t *cur_array_data;
+
+ list_arraynode_t array_data;
+ list_treenode_t tree_data;
+} list_node_t;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+list_node_t* list_create(list_free_func free_func);
+uint32 list_size(list_node_t *list);
+void list_add(list_node_t *list, void *data);
+void list_add_unique(list_node_t *list, void *data, uint32 len);
+void* list_remove(list_node_t *list, void *data);
+void* list_get(list_node_t *list, uint32 index);
+void* list_remove_by_content(list_node_t *list, void *data, uint32 data_len);
+void list_first(list_node_t *list);
+void* list_next(list_node_t *list);
+void list_sort(list_node_t *list, list_sort_func sort_func);
+void list_free(list_node_t *list);
+void list_clear(list_node_t *list);
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* MBTK_LIST_H_ */
+
diff --git a/mbtk/include/mbtk/mbtk_log.h b/mbtk/include/mbtk/mbtk_log.h
new file mode 100755
index 0000000..4f82533
--- /dev/null
+++ b/mbtk/include/mbtk/mbtk_log.h
@@ -0,0 +1,136 @@
+#ifndef MBTK_LOG_INCLUDE
+#define MBTK_LOG_INCLUDE
+#include <string.h>
+
+#ifndef MBTK_ANDROID_LOG
+//#define MBTK_ANDROID_LOG
+#endif
+
+#ifdef MBTK_ANDROID_LOG
+
+#ifndef LOG_TAG
+#define LOG_TAG "mbtk_log"
+#endif
+
+// Print ALOGV log.
+#ifndef LOG_NDEBUG
+//#define LOG_NDEBUG 0
+#endif
+
+#include <cutils/log.h>
+
+#define LOGV(fmt, arg...) ALOGV("Line-%d: " fmt,__LINE__,##arg)
+#define LOGI(fmt, arg...) ALOGI("Line-%d: " fmt,__LINE__,##arg)
+#define LOGD(fmt, arg...) ALOGD("Line-%d: " fmt,__LINE__,##arg)
+#define LOGW(fmt, arg...) ALOGW("Line-%d: " fmt,__LINE__,##arg)
+#define LOGE(fmt, arg...) ALOGE("Line-%d: " fmt,__LINE__,##arg)
+
+#else /* MBTK_ANDROID_LOG */
+
+//#include <log.h>
+#include <stdio.h>
+
+#ifndef UNUSED
+#define UNUSED(a) (void)(a)
+#endif
+
+//#include "pxa_dbg.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+void mbtk_log(int level, const char *format, ...);
+void mbtk_log_init(char *path, char *tag);
+void log_hex(const char *tag, const void *data, int data_len);
+#ifdef __cplusplus
+}
+#endif
+
+#ifndef LOG_ERR_LEVEL
+#define LOG_ERR_LEVEL 3 /* error conditions */
+#endif
+#ifndef LOG_WARN_LEVEL
+#define LOG_WARN_LEVEL 4 /* warning conditions */
+#endif
+#ifndef LOG_INFO_LEVEL
+#define LOG_INFO_LEVEL 6 /* informational */
+#endif
+#ifndef LOG_DEBUG_LEVEL
+#define LOG_DEBUG_LEVEL 7 /* debug-level messages */
+#endif
+#ifndef LOG_VERBOSE_LEVEL
+#define LOG_VERBOSE_LEVEL 8
+#endif
+
+#define LOGV(fmt, args ...) \
+ do{ \
+ char *file_ptr_1001 = __FILE__; \
+ char *ptr_1001 = file_ptr_1001 + strlen(file_ptr_1001) - 1; \
+ char line_1001[10] = {0}; \
+ sprintf(line_1001, "%d", __LINE__); \
+ while(ptr_1001 >= file_ptr_1001 && *ptr_1001){ \
+ if(*ptr_1001 == '/') \
+ break; \
+ ptr_1001--; \
+ } \
+ mbtk_log(LOG_VERBOSE_LEVEL, "%s#%s: " fmt, ptr_1001 + 1, line_1001, ##args); \
+ } while(0)
+
+#define LOGI(fmt, args...) \
+ do{ \
+ char *file_ptr_1001 = __FILE__; \
+ char *ptr_1001 = file_ptr_1001 + strlen(file_ptr_1001) - 1; \
+ char line_1001[10] = {0}; \
+ sprintf(line_1001, "%d", __LINE__); \
+ while(ptr_1001 >= file_ptr_1001 && *ptr_1001){ \
+ if(*ptr_1001 == '/') \
+ break; \
+ ptr_1001--; \
+ } \
+ mbtk_log(LOG_INFO_LEVEL, "%s#%s: " fmt, ptr_1001 + 1, line_1001, ##args); \
+ } while(0)
+
+#define LOGD(fmt, args...) \
+ do{ \
+ char *file_ptr_1001 = __FILE__; \
+ char *ptr_1001 = file_ptr_1001 + strlen(file_ptr_1001) - 1; \
+ char line_1001[10] = {0}; \
+ sprintf(line_1001, "%d", __LINE__); \
+ while(ptr_1001 >= file_ptr_1001 && *ptr_1001){ \
+ if(*ptr_1001 == '/') \
+ break; \
+ ptr_1001--; \
+ } \
+ mbtk_log(LOG_DEBUG_LEVEL, "%s#%s: " fmt "\n", ptr_1001 + 1, line_1001, ##args); \
+ } while(0)
+
+#define LOGW(fmt, args...) \
+ do{ \
+ char *file_ptr_1001 = __FILE__; \
+ char *ptr_1001 = file_ptr_1001 + strlen(file_ptr_1001) - 1; \
+ char line_1001[10] = {0}; \
+ sprintf(line_1001, "%d", __LINE__); \
+ while(ptr_1001 >= file_ptr_1001 && *ptr_1001){ \
+ if(*ptr_1001 == '/') \
+ break; \
+ ptr_1001--; \
+ } \
+ mbtk_log(LOG_WARN_LEVEL, "%s#%s: " fmt, ptr_1001 + 1, line_1001, ##args); \
+ } while(0)
+
+#define LOGE(fmt, args...) \
+ do{ \
+ char *file_ptr_1001 = __FILE__; \
+ char *ptr_1001 = file_ptr_1001 + strlen(file_ptr_1001) - 1; \
+ char line_1001[10] = {0}; \
+ sprintf(line_1001, "%d", __LINE__); \
+ while(ptr_1001 >= file_ptr_1001 && *ptr_1001){ \
+ if(*ptr_1001 == '/') \
+ break; \
+ ptr_1001--; \
+ } \
+ mbtk_log(LOG_ERR_LEVEL, "%s#%s: " fmt, ptr_1001 + 1, line_1001, ##args); \
+ } while(0)
+#endif
+
+#endif /* MBTK_LOG_INCLUDE */
diff --git a/mbtk/include/mbtk/mbtk_map.h b/mbtk/include/mbtk/mbtk_map.h
new file mode 100755
index 0000000..d0ed1d2
--- /dev/null
+++ b/mbtk/include/mbtk/mbtk_map.h
@@ -0,0 +1,44 @@
+/*
+ * mbtk_map.h
+ *
+ * Created on: Aug 18, 2020
+ * Author: lb
+ */
+
+#ifndef MBTK_MAP_H_
+#define MBTK_MAP_H_
+#include "mbtk_type.h"
+
+typedef void (*map_free_func)(void *data);
+
+typedef struct map_data
+{
+ char *key;
+ void *value;
+ struct map_data *next;
+} map_data_t;
+
+typedef struct
+{
+ uint32 size;
+ uint32 capacity;
+ uint32 cur_index;
+ map_data_t *cur_data;
+ map_free_func free_func;
+
+ map_data_t **map_array;
+} map_node_t;
+
+map_node_t* map_create(uint32 capacity, map_free_func free_func);
+uint32 map_size(map_node_t* map);
+uint32 map_hash(const char* key, uint32 capacity);
+void map_put(map_node_t* map, const char* key, void* value);
+void* map_get(map_node_t* map, char* key);
+void* map_remove(map_node_t* map, char* key);
+void map_first(map_node_t *map);
+void* map_next(map_node_t *map);
+void map_clear(map_node_t* map);
+void map_free(map_node_t* map);
+
+#endif /* MBTK_MAP_H_ */
+
diff --git a/mbtk/include/mbtk/mbtk_mqtt.h b/mbtk/include/mbtk/mbtk_mqtt.h
new file mode 100755
index 0000000..02c54e1
--- /dev/null
+++ b/mbtk/include/mbtk/mbtk_mqtt.h
@@ -0,0 +1,107 @@
+#ifndef MBTK_MQTT_H
+#define MBTK_MQTT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "mqtt/MQTTClient.h"
+#include "mqtt/MQTTLinux.h"
+enum iot_ctrl_status_t
+{
+ IOT_STATUS_LOGIN,
+ IOT_STATUS_CONNECT,
+ IOT_STATUS_DROP,
+};
+typedef void (*pMessageArrived_Fun)(void*,int len);
+
+#define MQTT_TOPIC_SIZE (128) //订阅和发布主题长度
+#define MQTT_BUF_SIZE (8 * 1024) //接收后发送缓冲区大小
+#define MQTT_CONFIG_SIZE 256
+#define MBTK_IMQTT_USER_NAME_LEN (100)
+#define MBTK_IMQTT_CLIENT_ID_LEN (160)
+#define MBTK_IMQTT_PASSWORD_LEN (160)
+#define MBTK_ITOPIC_PATH_MAX_LEN (MBTK_IMQTT_CLIENT_ID_LEN+40) //160+40
+
+#define MQTT_HOST "***.***.***.***" //ip地址
+#define MQTT_PORT 61613 //端口号
+#define MQTT_USER "admin" //用户名
+#define MQTT_PASS "password" //密码
+#define MQTT_CLIENT_ID "17849359" //客户端标识
+
+typedef struct {
+ Network* network;
+ Client Client;
+ char sub_topic[MQTT_TOPIC_SIZE]; //存放订阅主题
+ char pub_topic[MQTT_TOPIC_SIZE]; //存放发布主题
+ char mqtt_buffer[MQTT_BUF_SIZE]; //发送缓冲区
+ char mqtt_read_buffer[MQTT_BUF_SIZE]; //接收缓冲区
+
+ unsigned char willFlag;
+ MQTTPacket_willOptions will;
+ char will_topic[MQTT_TOPIC_SIZE]; //存放遗嘱主题
+
+ pMessageArrived_Fun DataArrived_Cb;
+
+ char mqtt_host[MQTT_CONFIG_SIZE] ;
+ char mqtt_client_id[MQTT_CONFIG_SIZE];
+ char mqtt_user[MQTT_CONFIG_SIZE];
+ char mqtt_pass[MQTT_CONFIG_SIZE];
+ int mqtt_port;
+ int keepAliveInterval;
+ int mqtt_version;
+}Cloud_MQTT_t;
+
+typedef struct{
+ enum iot_ctrl_status_t iotstatus;
+ char model[5];
+ char company[32];
+} iot_device_info_t;//主题结构体
+
+
+struct opts_struct {
+ char *clientid;
+ int nodelimiter;
+ char *delimiter;
+ enum QoS qos;
+ char *username;
+ char *password;
+ char *host;
+ int port;
+ int showtopics;
+}; //结构体
+
+typedef struct mbtk_mqtt_device_session{
+ char product_key[MQTT_CONFIG_SIZE];
+ char product_secret[MQTT_CONFIG_SIZE];
+ char device_name[MQTT_CONFIG_SIZE];
+ char device_secret[MQTT_CONFIG_SIZE];
+ int host;
+ int port;
+} mbtk_mqtt_device_session_t;
+
+void mqtt_module_init(void);
+int mqtt_data_write(char *pbuf, int len, char retain);
+
+void iot_mqtt_init(Cloud_MQTT_t *piot_mqtt,char *host,int port ,char *clientid,char *user,char *pass,int keepAliveInterval,int version,char *sub_topic,char *pub_topic,pMessageArrived_Fun mqtt_data_rx_cb);
+int mqtt_will_msg_set(Cloud_MQTT_t *piot_mqtt, char *pbuf, int len);
+int mqtt_device_connect(Cloud_MQTT_t *piot_mqtt);
+int mqtt_device_disconnect(Cloud_MQTT_t *piot_mqtt);
+int mbtk_aliyun_mqtt_one_type_one_secret_unregin_device_connect(Cloud_MQTT_t *piot_mqtt);
+void mbtk_aliyun_mqtt_one_type_one_secret_unregin_set_info_init(Cloud_MQTT_t *piot_mqtt,mbtk_mqtt_device_session_t *device,int keepAliveInterval,int version,pMessageArrived_Fun mqtt_data_rx_cb);
+int mbtk_aliyun_mqtt_one_type_one_secret_unregin_get_regin_info(char *clientId, char *deviceToken);
+void iot_aliyun_mqtt_one_type_one_secret_unregin_connect_init(Cloud_MQTT_t *piot_mqtt,mbtk_mqtt_device_session_t *device, char *clientId, char *deviceToken,
+ int keepAliveInterval,int version,char *sub_topic,char *pub_topic,pMessageArrived_Fun mqtt_data_rx_cb);
+void mqtt_data_rx_cb(void *pbuf, int len);
+void *cloud_mqtt_thread(void *arg);
+int mbtk_MQTTSubscribe(Client* c, const char* topicFilter, enum QoS qos, messageHandler messageHandler);
+int mbtk_MQTTUnsubscribe(Client* c, const char* topicFilter);
+int mbtk_MQTTPublish(char *pbuf, int len, char retain,Client* c,const char* pub_topic,enum QoS qos,char dup);
+#define mDEBUG(fmt, ...) printf("%s[%s](%d):" fmt,__FILE__,__FUNCTION__,__LINE__,##__VA_ARGS__)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/mbtk/include/mbtk/mbtk_net_control.h b/mbtk/include/mbtk/mbtk_net_control.h
new file mode 100755
index 0000000..bc886f8
--- /dev/null
+++ b/mbtk/include/mbtk/mbtk_net_control.h
@@ -0,0 +1,48 @@
+/*************************************************************
+Description:
+ Header file for network control.
+Author:
+ LiuBin
+Date:
+ 2019/7/24 17:18:43
+*************************************************************/
+#ifndef _MBTK_NET_CONTROL_H
+#define _MBTK_NET_CONTROL_H
+#include "mbtk_type.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+/*************************************************************
+ Constants and Macros
+*************************************************************/
+
+
+/*************************************************************
+ Definitions:enum,struct,union,class
+*************************************************************/
+typedef enum {
+ MBTK_NET_STATE_OFF, /* Network off */
+ MBTK_NET_STATE_CONN, /* Network connected */
+ MBTK_NET_STATE_CONN_2G, // 2
+ MBTK_NET_STATE_CONN_3G, // 3
+ MBTK_NET_STATE_CONN_4G, // 4
+ MBTK_NET_STATE_CONN_UNKNOWN
+} mbtk_net_state_t;
+
+/*************************************************************
+ Extern variables
+*************************************************************/
+
+
+/*************************************************************
+ Public Function Declaration
+*************************************************************/
+mbtk_net_state_t mbtk_net_state_get();
+int mbtk_net_enable(bool enable);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif /* _MBTK_NET_CONTROL_H */
diff --git a/mbtk/include/mbtk/mbtk_ntp.h b/mbtk/include/mbtk/mbtk_ntp.h
new file mode 100755
index 0000000..1b3b926
--- /dev/null
+++ b/mbtk/include/mbtk/mbtk_ntp.h
@@ -0,0 +1,39 @@
+#ifndef __MBTK_NTP_H__
+#define __MBTK_NTP_H__
+
+
+/*****************************************************************
+* Function: mbtk_at_systime
+*
+* Description:
+* This function is used to get the time from ntp server "cn.pool.ntp.org"
+*
+* Parameters:
+* null
+*
+* Return:
+* time_t is success
+* 0 is fail
+*****************************************************************/
+int mbtk_at_systime(void);
+
+/*****************************************************************
+* Function: mbtk_ntp_server_set
+*
+* Description:
+* This function is used to set the ip address and port of NTP server.
+* return the time obtained from ntp.
+*
+* Parameters:
+* server_ip : NTP server
+*
+* port : ntp port
+*
+* Return:
+* time_t is success
+* 0 is fail
+*****************************************************************/
+time_t mbtk_ntp_server_set(const char* server_ip, const char * port);
+
+
+#endif
\ No newline at end of file
diff --git a/mbtk/include/mbtk/mbtk_queue.h b/mbtk/include/mbtk/mbtk_queue.h
new file mode 100755
index 0000000..9119355
--- /dev/null
+++ b/mbtk/include/mbtk/mbtk_queue.h
@@ -0,0 +1,71 @@
+/*************************************************************
+Description:
+ mbtk_queue.h
+ Used to define mobiletek standard queue interfaces
+Author:
+ YangDagang
+Date:
+ 2019-7-13
+*************************************************************/
+#ifndef __MBTK_QUEUE_H__
+#define __MBTK_QUEUE_H__
+
+#include "mbtk_type.h"
+#include <pthread.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*************************************************************
+ Constants and Macros
+*************************************************************/
+#define MBTK_QUEUE_MAX_NUM 500
+#define task_mutex pthread_mutex_t
+
+/*************************************************************
+ Definitions:enum,struct,union
+*************************************************************/
+
+typedef struct{
+ task_mutex crit_sect; //User-defined data type
+} mbtk_mutex;
+
+typedef struct node
+{
+ void *payload;
+ int count; //only used to count for internal
+ mbtk_mutex mutex; //only used to count for internal
+ struct node *front;
+ struct node *rear;
+} mbtk_queue_node_t;
+
+/*************************************************************
+ Variables:local,extern
+*************************************************************/
+
+/*************************************************************
+ Local Function Declaration
+*************************************************************/
+
+/*************************************************************
+ Extern Function Declaration
+*************************************************************/
+extern void mbtk_mutex_init(mbtk_mutex *mutex);
+extern void mbtk_mutex_deinit(mbtk_mutex *mutex);
+extern void mbtk_mutex_lock(mbtk_mutex *mutex);
+extern void mbtk_mutex_unlock(mbtk_mutex *mutex);
+
+extern void mbtk_queue_init(mbtk_queue_node_t *queue);
+extern int mbtk_queue_put(mbtk_queue_node_t *queue,void *payload);
+extern void* mbtk_queue_get(mbtk_queue_node_t *queue);
+extern int mbtk_queue_insert(mbtk_queue_node_t *queue,void *payload);
+extern bool mbtk_queue_empty(mbtk_queue_node_t *queue);
+extern bool mbtk_queue_is_full(mbtk_queue_node_t *queue);
+extern void mbtk_queue_deinit(mbtk_queue_node_t *queue);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif /* __MBTK_QUEUE_H__ */
diff --git a/mbtk/include/mbtk/mbtk_sock.h b/mbtk/include/mbtk/mbtk_sock.h
new file mode 100755
index 0000000..5179336
--- /dev/null
+++ b/mbtk/include/mbtk/mbtk_sock.h
@@ -0,0 +1,101 @@
+
+/*
+*
+*
+* Author : lb
+* Date : 2022/3/5 15:33:37
+*
+*/
+#ifndef _MBTK_SOCK_H
+#define _MBTK_SOCK_H
+#include <stdbool.h>
+#include <errno.h>
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <netinet/in.h>
+
+#include "mbtk_type.h"
+#include "mbtk_sock2.h"
+
+
+#define MBTK_BUFF_SIZE 2048
+
+typedef struct
+{
+ union
+ {
+ struct sockaddr_in6 dst_sock_addr6;
+ struct sockaddr_in serverSockAddr;
+ }addr;
+ uint16 ip_version;
+ uint16 addr_len;
+} mbtk_ipv4v6_addr;
+
+typedef enum
+{
+ MBTK_ADDR_IPV4,
+ MBTK_ADDR_IPV6,
+ MBTK_ADDR_IPV4V6
+} mbtk_addr_family_e;
+
+typedef enum
+{
+ MBTK_SOCK_TCP_COM = 0,
+ MBTK_SOCK_UDP_COM
+} mbtk_sock_type_e;
+
+
+typedef struct
+{
+ int16 net_id;
+#ifdef MBTK_PLATFORM_QCOMM
+ sint15 app6_id;
+ sint15 task_handle;
+ uint32 ip_filter;
+ //ds_policy_info_type policy_info; // No use
+#endif
+ bool keep_alive;
+ uint32 recv_buff_size;
+} mbtk_net_info_s;
+
+typedef struct
+{
+ int fd;
+ char host[50];
+ int port;
+ bool is_ssl;
+ bool use_cert;
+ mbtk_sock_type_e sock_type;
+ mbtk_addr_family_e addr_family;
+ mbtk_buffer_t read_buff;
+
+ mbtk_ipv4v6_addr addr;
+ uint16 temp; // Must add (addr.addr_len should be uint32)
+} mbtk_sock_info_s;
+
+int sock_net_open(mbtk_net_info_s *net_info, mbtk_addr_family_e addr_family);
+
+int sock_open(mbtk_net_info_s *net_info, mbtk_sock_info_s *sock_info, uint32 timeout, int *err);
+
+int sock_addr_set(mbtk_net_info_s *net_info,mbtk_sock_info_s *sock_info,void *host, uint32 port);
+
+int sock_bind(int sockfd, bool is_ipv6, uint16 port);
+
+int sock_read(mbtk_net_info_s *net_info, mbtk_sock_info_s *sock_info, void *buffer, uint32 buf_len, uint32 timeout, int *err);
+
+int sock_read_async(mbtk_net_info_s *net_info, mbtk_sock_info_s *sock_info, void *buffer, uint32 buf_len, uint32 timeout, int *err);
+
+int sock_readline(mbtk_net_info_s *net_info, mbtk_sock_info_s *sock_info, void *buffer, uint32 buf_len, uint32 timeout, int *err);
+
+int sock_write(mbtk_net_info_s *net_info, mbtk_sock_info_s *sock_info, const void *buffer, uint32 buf_len, uint32 timeout, int *err);
+
+int sock_recv(mbtk_net_info_s *net_info, mbtk_sock_info_s *sock_info, void *buffer, uint32 buf_len, uint32 timeout);
+
+int sock_sendto(mbtk_net_info_s *net_info, mbtk_sock_info_s *sock_info, const void *buffer, uint32 buf_len, uint32 timeout);
+
+int sock_close(mbtk_net_info_s *net_info, mbtk_sock_info_s *sock_info, uint32 timeout, int *err);
+
+int sock_net_close(mbtk_net_info_s *net_info, uint32 timeout, int *err);
+
+#endif /* _MBTK_SOCK_H */
diff --git a/mbtk/include/mbtk/mbtk_sock2.h b/mbtk/include/mbtk/mbtk_sock2.h
new file mode 100755
index 0000000..fbd8a0d
--- /dev/null
+++ b/mbtk/include/mbtk/mbtk_sock2.h
@@ -0,0 +1,169 @@
+/*************************************************************
+Description:
+ mbtk_sock.h
+ Used to define mobiletek sockets interfaces
+Author:
+ YangDagang
+Date:
+ 2019-1-30
+*************************************************************/
+#ifndef __MBTK_SOCK2_H__
+#define __MBTK_SOCK2_H__
+
+#include "mbtk_type.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define MBTK_SOCK_EVENT_READ 0x01
+
+/*************************************************************
+ Constants and Macros
+*************************************************************/
+typedef int mbtk_sock_handle;
+typedef int mbtk_sock_session;
+
+/*************************************************************
+ Definitions:enum,struct,union
+*************************************************************/
+typedef enum
+{
+ /*common error code (-99 ~ 0)*/
+ MBTK_SOCK_SUCCESS = 0,
+ MBTK_SOCK_ERROR = -1,
+ MBTK_SOCK_EMEMORY = -2,
+ MBTK_SOCK_EARG = -3, /* Invalid buffer or argument */
+ MBTK_SOCK_EDNS = -4, /* DNS error */
+ MBTK_SOCK_ETIMEOUT = -5, /* Timeout */
+ /*socket error code */
+ MBTK_SOCK_EEOF = 0, /* end of file */
+ MBTK_SOCK_EBADF = 100, /* Invalid socket descriptor */
+ MBTK_SOCK_EFAULT= 101, /* Invalid buffer or argument */
+ MBTK_SOCK_EWOULDBLOCK = 102, /* Operation would block */
+ MBTK_SOCK_EAFNOSUPPORT = 103, /* Address family not supported */
+ MBTK_SOCK_EPROTOTYPE = 104, /* Wrong protocol for socket type */
+ MBTK_SOCK_ESOCKNOSUPPORT = 105, /* Socket parameter not supported */
+ MBTK_SOCK_EPROTONOSUPPORT = 106, /* Socket parameter not supported */
+ MBTK_SOCK_EMFILE = 107, /* No more sockets available for opening */
+ MBTK_SOCK_EOPNOTSUPP = 108, /* Operation not supported */
+ MBTK_SOCK_ETIMEDOUT = 116, /* Connection attempt timed out */
+ MBTK_SOCK_ECONNRESET = 117, /* Connection reset */
+ MBTK_SOCK_ECONNABORTED = 118, /* Connection aborted */
+ MBTK_SOCK_EPIPE = 119, /* Broken pipe */
+ MBTK_SOCK_ENETDOWN = 120, /* Network subsystem unavailable */
+ MBTK_SOCK_ENETNONET = 202, /* network subsystem unavailable */
+ /*unkonw error code (-1000 ~ ...)*/
+ MBTK_SOCK_EUNKONW = -1000 /*unkonw error*/
+}mbtk_sock_errno;
+
+typedef enum
+{
+ MBTK_SOCK_TCP = 0,
+ MBTK_SOCK_UDP
+} mbtk_sock_type;
+
+typedef enum
+{
+ MBTK_NET_LINUX = 0, // Default for Linux socket.
+ MBTK_NET_QUAL, // Qcomm modem socket.
+ MBTK_NET_MAX
+} mbtk_net_type;
+
+typedef void (*mbtk_net_cb_func)(mbtk_sock_handle handle, int state);
+typedef void (*mbtk_sock_cb_func)(mbtk_sock_handle handle, mbtk_sock_session sock_fd, int event);
+
+//Used to provide external and to transmit information
+typedef struct
+{
+ mbtk_sock_type type; // socket type:TCP or UDP
+ bool is_support_ssl; //is suppoert ssl
+ bool ingnore_cert; //is ingnore certificate
+ char address[256]; //server address
+ int port; //server port
+ int ftp_ssl_support;
+} mbtk_sock_info;
+
+typedef struct
+{
+ mbtk_net_type net_type;
+ mbtk_net_cb_func net_cb;
+ mbtk_sock_cb_func sock_cb;
+} mbtk_init_info;
+
+#define DFL_SERVER_NAME "asr"
+#define DFL_SERVER_ADDR NULL
+#define DFL_SERVER_PORT 4433
+#define DFL_REQUEST_PAGE "/"
+#define DFL_REQUEST_SIZE -1
+#define DFL_DEBUG_LEVEL 0
+#define DFL_NBIO 0
+#define DFL_CA_FILE "/ca.crt"
+#define DFL_CA_PATH "/ca.crt"
+#define DFL_CRT_FILE "/client.crt"
+#define DFL_KEY_FILE "/client.key"
+#define DFL_PSK ""
+#define DFL_PSK_IDENTITY "Client_identity"
+#define DFL_FORCE_CIPHER 0
+#define DFL_RENEGOTIATION SSL_RENEGOTIATION_DISABLED
+#define DFL_ALLOW_LEGACY SSL_LEGACY_NO_RENEGOTIATION
+#define DFL_RENEGOTIATE 0
+#define DFL_EXCHANGES 1
+#define DFL_MIN_VERSION SSL_MINOR_VERSION_3
+#define DFL_MAX_VERSION SSL_MINOR_VERSION_3
+#define DFL_AUTH_MODE SSL_VERIFY_REQUIRED
+#define DFL_MFL_CODE SSL_MAX_FRAG_LEN_NONE
+#define DFL_TRUNC_HMAC 0
+#define DFL_RECONNECT 0
+#define DFL_RECO_DELAY 0
+#define DFL_TICKETS SSL_SESSION_TICKETS_ENABLED
+#define DFL_ALPN_STRING NULL
+
+/*************************************************************
+ Variables:local,extern
+*************************************************************/
+
+/*************************************************************
+ Local Function Declaration
+*************************************************************/
+
+/*************************************************************
+ Extern Function Declaration
+*************************************************************/
+extern mbtk_sock_handle mbtk_sock_init(mbtk_init_info *info);
+extern mbtk_sock_session mbtk_sock_open(mbtk_sock_handle handle,mbtk_sock_info *info,
+ unsigned int timeout,
+ int *mbtk_errno);
+extern int mbtk_sock_write(mbtk_sock_handle handle,mbtk_sock_session session,
+ void *buffer,
+ unsigned int buf_len,
+ unsigned int timeout,
+ int *mbtk_errno);
+extern int mbtk_sock_read(mbtk_sock_handle handle,mbtk_sock_session session,
+ void *buffer,
+ unsigned int buf_len,
+ unsigned int timeout,
+ int *mbtk_errno);
+extern int mbtk_sock_read_async(mbtk_sock_handle handle,mbtk_sock_session session,
+ void *buffer,
+ unsigned int buf_len);
+extern int mbtk_sock_close(mbtk_sock_handle handle,mbtk_sock_session session,
+ unsigned int timeout,
+ int *mbtk_errno);
+extern int mbtk_sock_deinit(mbtk_sock_handle handle);
+
+extern int mbtk_ssl_init_func(mbtk_sock_handle handle ,bool ingnore_cert,mbtk_sock_session fd);
+extern int mbtk_ssl_close_func(mbtk_sock_handle handle ,bool ingnore_cert,mbtk_sock_session fd);
+extern int mbtk_sock_readline(mbtk_sock_handle handle,mbtk_sock_session session,
+ void *buffer,
+ unsigned int buf_len,
+ unsigned int timeout,
+ int *mbtk_errno,
+ int *read_line_count,
+ char *buf_ptr);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif /* __MBTK_SOCK2_H__ */
diff --git a/mbtk/include/mbtk/mbtk_str.h b/mbtk/include/mbtk/mbtk_str.h
new file mode 100755
index 0000000..c74127d
--- /dev/null
+++ b/mbtk/include/mbtk/mbtk_str.h
@@ -0,0 +1,125 @@
+#ifndef MBTK_STR_INCLUDE
+#define MBTK_STR_INCLUDE
+
+#include "mbtk_type.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+/*
+* Converts all of the characters in this String to lower.
+*
+* Parameters:
+* src - The string should be converted.
+* dest - The lowercase string.
+* len - The length of result string.Must be "strlen(src) + 1"
+* Returns:
+* The string, converted to lowercase,or NULL for fail.
+*/
+void*
+str_tolower
+(
+ const void *src,
+ void *dest,
+ size_t len
+);
+
+/*
+* Converts all of the characters in this String to upper case.
+*
+* Parameters:
+* src - The string should be converted.
+* dest - The uppercase string.
+* len - The length of result string.Must be "strlen(str_ptr) + 1"
+* Returns:
+* The string, converted to uppercase.or NULL for fail.
+*/
+void*
+str_toupper
+(
+ const void *src,
+ void *dest,
+ size_t len
+);
+
+/*
+* Remove the head and tail spaces.
+*/
+void*
+str_trim
+(
+ const void* str,
+ void *result,
+ size_t len
+);
+
+/*
+* Returns true if and only if this string contains the specified sequence of char values.
+*
+* Parameters:
+* str - The substring to search from.
+* sub_str - The substring to search for.
+* Returns:
+* True if str contains sub_str, false otherwise.
+*/
+bool
+str_contains
+(
+ const void* str,
+ const void* sub_str
+);
+
+/*
+* Returns the index within this string of the first occurrence of the specified substring.
+* If no such substring, then -1 is returned.
+*
+* Parameters:
+* str - The substring to search from.
+* sub_str - The substring to search for.
+* Returns:
+* The index of the first occurrence of the specified substring,
+* or -1 if there is no such occurrence.
+*/
+ssize_t
+str_indexof
+(
+ const void* str,
+ const void* sub_str
+);
+
+/*
+* Returns a new string that is a substring of this string. The substring begins
+* at the specified beginIndex and extends to the character at index endIndex - 1.
+* Thus the length of the substring is endIndex-beginIndex.
+*
+* Examples:
+* "hamburger".substring(4, 8) returns "urge"
+* "smiles".substring(1, 5) returns "mile"
+*
+* Parameters:
+* begin_index The beginning index, inclusive.
+* end_index The ending index, exclusive.
+* Returns:
+* The specified substring or NULL.
+*/
+void*
+str_substring
+(
+ const void* str,
+ size_t begin_index,
+ size_t end_index,
+ void *sub_str,
+ size_t len
+);
+
+bool str_startwith(const char* str, const void* prefix);
+
+void* strstr_hex(char *haystack,int haystack_len,
+ const char *needle,int needle_len);
+
+bool str_empty(const void *str);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+#endif /* MBTK_STR_INCLUDE */
diff --git a/mbtk/include/mbtk/mbtk_task.h b/mbtk/include/mbtk/mbtk_task.h
new file mode 100755
index 0000000..d0a0604
--- /dev/null
+++ b/mbtk/include/mbtk/mbtk_task.h
@@ -0,0 +1,79 @@
+/*************************************************************
+Description:
+ mbtk_task.h
+ Used to define mobiletek standard task or thread interfaces
+Author:
+ YangDagang
+Date:
+ 2019-7-13
+*************************************************************/
+#ifndef __MBTK_TASK_H__
+#define __MBTK_TASK_H__
+
+#include "mbtk_queue.h"
+#include <pthread.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*************************************************************
+ Constants and Macros
+*************************************************************/
+typedef void* (*mbtk_task_cb_handle)(void *payload);
+typedef void (*mbtk_uart_printf_cb)(char* data,int data_len);
+
+
+/*************************************************************
+ Definitions:enum,struct,union
+*************************************************************/
+typedef struct
+{
+ unsigned int sig;
+ void* payload;
+} mbtk_signal_info;
+
+typedef struct
+{
+ void* task_id;
+ mbtk_task_cb_handle thread_run;
+ void* args;
+} mbtk_task_info;
+
+typedef struct
+{
+ mbtk_uart_printf_cb urc_prt;
+ mbtk_uart_printf_cb data_prt;
+} mbtk_reg_callback;
+
+typedef struct {
+ pthread_t thread_id;
+ pthread_cond_t cond;
+ mbtk_mutex mutex;
+ mbtk_queue_node_t queue;
+} mbtk_task_queue_info;
+
+
+/*************************************************************
+ Variables:local,extern
+*************************************************************/
+
+/*************************************************************
+ Local Function Declaration
+*************************************************************/
+
+/*************************************************************
+ Extern Function Declaration
+*************************************************************/
+extern int mbtk_task_start(mbtk_task_info *task);
+extern int mbtk_task_queue_start(void *param,mbtk_task_cb_handle cb);
+extern void mbtk_task_queue_stop(void *param);
+extern int mbtk_signal_send(void *param,mbtk_signal_info* info);
+extern mbtk_signal_info *mbtk_signal_get(void *param);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif /* __MBTK_TASK_H__ */
+
diff --git a/mbtk/include/mbtk/mbtk_type.h b/mbtk/include/mbtk/mbtk_type.h
new file mode 100755
index 0000000..f948ab9
--- /dev/null
+++ b/mbtk/include/mbtk/mbtk_type.h
@@ -0,0 +1,120 @@
+#ifndef MBTK_TYPE_INCLUDE
+#define MBTK_TYPE_INCLUDE
+#include <stdio.h>
+#include <stdbool.h>
+#include <sys/types.h>
+
+#ifndef MBTK_PLATFORM_LINUX
+#define MBTK_PLATFORM_LINUX
+#endif
+
+#ifndef MBTK_PLATFORM_QCOMM
+//#define MBTK_PLATFORM_QCOMM
+#endif
+
+#define MBTK_SUCCESS 0
+#define MBTK_FAILE (-1)
+
+#ifndef UNUSED
+#define UNUSED(param) ((void) param)
+#define UNUSEDPARAM UNUSED
+#endif
+
+#ifndef TRUE
+#define TRUE 1 /* Boolean true value. */
+#endif
+
+#ifndef true
+#define true 1 /* Boolean true value. */
+#endif
+
+#ifndef FALSE
+#define FALSE 0 /* Boolean false value. */
+#endif
+
+#ifndef false
+#define false 0 /* Boolean false value. */
+#endif
+
+
+#ifndef NULL
+#define NULL 0
+#endif
+
+
+#ifndef null
+#define null 0
+#endif
+
+/**
+ * Compiler-digit : 16
+ * char : 1 (%c)
+ * char* : 2
+ * short int : 2
+ * int : 2 (%d)
+ * unsigned int : 2 (%u)
+ * float : 4 (%f)
+ * double : 8 (%f)
+ * long : 4
+ * unsigned long : 4
+ * long long : 8
+ * unsigned long long : 8
+ *
+ *
+ * Compiler-digit : 32
+ * char : 1
+ * char* : 4
+ * short int : 2
+ * int : 4
+ * unsigned int : 4
+ * float : 4
+ * double : 8
+ * long : 4
+ * unsigned long : 4
+ * long long : 8
+ * unsigned long long : 8
+ *
+ *
+ * Compiler-digit : 64
+ * char : 1
+ * char* : 8
+ * short int : 2
+ * int : 4
+ * unsigned int : 4
+ * float : 4
+ * double : 8
+ * long : 8
+ * unsigned long : 8
+ * long long : 8
+ * unsigned long long : 8
+ */
+typedef unsigned char boolean; /* Boolean value type. */
+// typedef unsigned char bool; /* Boolean value type. */
+typedef unsigned long long uint64; /* Unsigned 64 bit value */
+typedef unsigned long long uint64_t; /* Unsigned 64 bit value */
+typedef unsigned int uint32; /* Unsigned 32 bit value */
+typedef unsigned int uint32_t; /* Unsigned 32 bit value */
+typedef unsigned short uint16; /* Unsigned 16 bit value */
+typedef unsigned short uint16_t;
+typedef unsigned char uint8; /* Unsigned 8 bit value */
+typedef unsigned char uint8_t;
+typedef signed long long int64; /* Signed 64 bit value */
+typedef signed long long sint64; /* Signed 64 bit value */
+typedef signed int int32; /* Signed 32 bit value */
+typedef signed int sint32; /* Signed 32 bit value */
+typedef signed short int16; /* Signed 16 bit value */
+typedef signed short sint16; /* Signed 16 bit value */
+typedef signed char int8; /* Signed 8 bit value */
+typedef signed char sint8; /* Signed 8 bit value */
+typedef unsigned char byte; /* byte type */
+
+
+typedef struct
+{
+ char *buffer;
+ int size;
+ int size_max;
+} mbtk_buffer_t;
+
+
+#endif /* MBTK_TYPE_INCLUDE */
diff --git a/mbtk/include/mbtk/mbtk_utils.h b/mbtk/include/mbtk/mbtk_utils.h
new file mode 100755
index 0000000..5b2113d
--- /dev/null
+++ b/mbtk/include/mbtk/mbtk_utils.h
@@ -0,0 +1,97 @@
+/*************************************************************
+Description:
+ MBTK utils head file.
+Author:
+ LiuBin
+Date:
+ 2019/7/24 20:08:03
+*************************************************************/
+#ifndef _MBTK_UTILS_H
+#define _MBTK_UTILS_H
+#include "mbtk_type.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/*************************************************************
+ Constants and Macros
+*************************************************************/
+#ifndef ARRAY_SIZE
+#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+#endif
+#define MBTK_CMDLINE_LEN 1024
+
+
+/*************************************************************
+ Definitions:enum,struct,union,class
+*************************************************************/
+typedef void (*mbtk_timer_alrm_func)(int signo);
+typedef void (*mbtk_cmd_cb_func)(char *buf,int buf_size);
+
+
+/*************************************************************
+ Extern variables
+*************************************************************/
+typedef enum {
+ MBTK_BYTEORDER_BIG, // Gig Endian
+ MBTK_BYTEORDER_LITTLE, // Little Endian
+ MBTK_BYTEORDER_UNKNOWN
+} mbtk_byteorder_enum;
+
+/*************************************************************
+ Public Function Declaration
+*************************************************************/
+bool mbtk_cmd_line
+(
+ const char *cmd,
+ char *buf,
+ int buf_size
+);
+
+bool mbtk_cmd_line_ex
+(
+ const char *cmd,
+ mbtk_cmd_cb_func cb
+);
+
+int mbtk_send_at(const void *at_req,void* at_rsp,int rsp_size,int timeout);
+
+/*
+* Set timer as microseconds.
+*/
+int mbtk_timer_set(mbtk_timer_alrm_func func,uint32 timeout_ms);
+
+/**
+* Clear current timer.
+*/
+int mbtk_timer_clear();
+
+int mbtk_get_kernel_cmdline(char *buf, int len);
+
+/** returns 1 if line starts with prefix, 0 if it does not */
+int strStartsWith(const char *line, const char *prefix);
+
+char* mbtk_time_text_get(char *buff, size_t buff_size);
+
+mbtk_byteorder_enum mbtk_byteorder_get();
+
+uint16 byte_2_uint16(const void *buff, bool big_endian);
+
+int uint16_2_byte(uint16 a, void *buff, bool big_endian);
+
+uint32 byte_2_uint32(const void *buff, bool big_endian);
+
+int uint32_2_byte(uint32 a, void *buff, bool big_endian);
+
+uint64 byte_2_uint64(const void *buff, bool big_endian);
+
+int uint64_2_byte(uint64 a, void *buff, bool big_endian);
+
+void* memdup(const void* data, int data_len);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif /* _MBTK_UTILS_H */
diff --git a/mbtk/include/mbtk_device_info.h b/mbtk/include/mbtk_device_info.h
new file mode 100755
index 0000000..2f178eb
--- /dev/null
+++ b/mbtk/include/mbtk_device_info.h
@@ -0,0 +1,17 @@
+/*
+* MBTK Device Information Define Header.
+*
+* Author : lb
+* Date : 2021/11/5 17:40:29
+*
+*/
+#ifndef MBTK_DEVICES_INFO_H
+#define MBTK_DEVICES_INFO_H
+
+#define MBTK_DEVICES_MANUFACTURER "LYNQ"
+
+#define MBTK_DEVICES_MODEL "LYNQ_L508LEN"
+
+#define MBTK_DEVICES_REVISION "L508LENv03.05b01.00"
+
+#endif /* MBTK_DEVICES_INFO_H */
diff --git a/mbtk/include/mqtt/MQTTClient.h b/mbtk/include/mqtt/MQTTClient.h
new file mode 100755
index 0000000..890a11b
--- /dev/null
+++ b/mbtk/include/mqtt/MQTTClient.h
@@ -0,0 +1,100 @@
+/*******************************************************************************
+ * Copyright (c) 2014 IBM Corp.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v1.0 which accompany this distribution.
+ *
+ * The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ * Allan Stockdill-Mander/Ian Craggs - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+
+#ifndef __MQTT_CLIENT_C_
+#define __MQTT_CLIENT_C_
+
+#include "MQTTPacket.h"
+#include "stdio.h"
+#include "MQTTLinux.h"
+
+#define MAX_PACKET_ID 65535
+#define MAX_MESSAGE_HANDLERS 5
+#define MAX_FAIL_ALLOWED 2
+
+enum QoS { QOS0, QOS1, QOS2 };
+
+// all failure return codes must be negative
+enum returnCode {DISCONNECTED = -3, BUFFER_OVERFLOW = -2, FAILURE = -1, SUCCESS = 0 };
+
+void NewTimer(Timer*);
+
+typedef struct MQTTMessage MQTTMessage;
+
+typedef struct MessageData MessageData;
+
+struct MQTTMessage
+{
+ enum QoS qos;
+ char retained;
+ char dup;
+ unsigned short id;
+ void *payload;
+ size_t payloadlen;
+};
+
+struct MessageData
+{
+ MQTTMessage* message;
+ MQTTString* topicName;
+};
+
+typedef struct {
+ char clientId[255];
+ char deviceToken[255];
+} regnwl_info_t;
+
+typedef void (*messageHandler)(MessageData*);
+
+typedef struct Client Client;
+
+int MQTTConnect (Client*, MQTTPacket_connectData*);
+int MQTTPublish (Client*, const char*, MQTTMessage*);
+int MQTTSubscribe (Client*, const char*, enum QoS, messageHandler);
+int MQTTUnsubscribe (Client*, const char*);
+int MQTTDisconnect (Client*,Network*);
+int MQTTYield (Client*, int);
+
+void setDefaultMessageHandler(Client*, messageHandler);
+
+void MQTTClient(Client*, Network*, unsigned int, unsigned char*, size_t, unsigned char*, size_t);
+
+struct Client {
+ unsigned int next_packetid;
+ unsigned int command_timeout_ms;
+ size_t buf_size, readbuf_size;
+ unsigned char *buf;
+ unsigned char *readbuf;
+ unsigned int keepAliveInterval;
+ char ping_outstanding;
+ int fail_count;
+ int isconnected;
+
+ struct MessageHandlers
+ {
+ const char* topicFilter;
+ void (*fp) (MessageData*);
+ } messageHandlers[MAX_MESSAGE_HANDLERS]; // Message handlers are indexed by subscription topic
+
+ void (*defaultMessageHandler) (MessageData*);
+
+ Network* ipstack;
+ Timer ping_timer;
+};
+
+#define DefaultClient {0, 0, 0, 0, NULL, NULL, 0, 0, 0}
+
+#endif
diff --git a/mbtk/include/mqtt/MQTTConnect.h b/mbtk/include/mqtt/MQTTConnect.h
new file mode 100755
index 0000000..d77f18c
--- /dev/null
+++ b/mbtk/include/mqtt/MQTTConnect.h
@@ -0,0 +1,136 @@
+/*******************************************************************************
+ * Copyright (c) 2014 IBM Corp.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v1.0 which accompany this distribution.
+ *
+ * The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ * Ian Craggs - initial API and implementation and/or initial documentation
+ * Xiang Rong - 442039 Add makefile to Embedded C client
+ *******************************************************************************/
+
+#ifndef MQTTCONNECT_H_
+#define MQTTCONNECT_H_
+
+#if !defined(DLLImport)
+ #define DLLImport
+#endif
+#if !defined(DLLExport)
+ #define DLLExport
+#endif
+
+
+typedef union
+{
+ unsigned char all; /**< all connect flags */
+#if defined(REVERSED)
+ struct
+ {
+ unsigned int username : 1; /**< 3.1 user name */
+ unsigned int password : 1; /**< 3.1 password */
+ unsigned int willRetain : 1; /**< will retain setting */
+ unsigned int willQoS : 2; /**< will QoS value */
+ unsigned int will : 1; /**< will flag */
+ unsigned int cleansession : 1; /**< clean session flag */
+ unsigned int : 1; /**< unused */
+ } bits;
+#else
+ struct
+ {
+ unsigned int : 1; /**< unused */
+ unsigned int cleansession : 1; /**< cleansession flag */
+ unsigned int will : 1; /**< will flag */
+ unsigned int willQoS : 2; /**< will QoS value */
+ unsigned int willRetain : 1; /**< will retain setting */
+ unsigned int password : 1; /**< 3.1 password */
+ unsigned int username : 1; /**< 3.1 user name */
+ } bits;
+#endif
+} MQTTConnectFlags; /**< connect flags byte */
+
+
+
+/**
+ * Defines the MQTT "Last Will and Testament" (LWT) settings for
+ * the connect packet.
+ */
+typedef struct
+{
+ /** The eyecatcher for this structure. must be MQTW. */
+ char struct_id[4];
+ /** The version number of this structure. Must be 0 */
+ int struct_version;
+ /** The LWT topic to which the LWT message will be published. */
+ MQTTString topicName;
+ /** The LWT payload. */
+ MQTTString message;
+ /**
+ * The retained flag for the LWT message (see MQTTAsync_message.retained).
+ */
+ unsigned char retained;
+ /**
+ * The quality of service setting for the LWT message (see
+ * MQTTAsync_message.qos and @ref qos).
+ */
+ char qos;
+} MQTTPacket_willOptions;
+
+
+#define MQTTPacket_willOptions_initializer { {'M', 'Q', 'T', 'W'}, 0, {NULL, {0, NULL}}, {NULL, {0, NULL}}, 0, 0 }
+
+
+typedef struct
+{
+ /** The eyecatcher for this structure. must be MQTC. */
+ char struct_id[4];
+ /** The version number of this structure. Must be 0 */
+ int struct_version;
+ /** Version of MQTT to be used. 3 = 3.1 4 = 3.1.1
+ */
+ unsigned char MQTTVersion;
+ MQTTString clientID;
+ unsigned short keepAliveInterval;
+ unsigned char cleansession;
+ unsigned char willFlag;
+ MQTTPacket_willOptions will;
+ MQTTString username;
+ MQTTString password;
+} MQTTPacket_connectData;
+
+typedef union
+{
+ unsigned char all; /**< all connack flags */
+#if defined(REVERSED)
+ struct
+ {
+ unsigned int sessionpresent : 1; /**< session present flag */
+ unsigned int : 7; /**< unused */
+ } bits;
+#else
+ struct
+ {
+ unsigned int : 7; /**< unused */
+ unsigned int sessionpresent : 1; /**< session present flag */
+ } bits;
+#endif
+} MQTTConnackFlags; /**< connack flags byte */
+
+#define MQTTPacket_connectData_initializer { {'M', 'Q', 'T', 'C'}, 0, 4, {NULL, {0, NULL}}, 60, 1, 0, \
+ MQTTPacket_willOptions_initializer, {NULL, {0, NULL}}, {NULL, {0, NULL}} }
+
+DLLExport int MQTTSerialize_connect(unsigned char* buf, int buflen, MQTTPacket_connectData* options);
+DLLExport int MQTTDeserialize_connect(MQTTPacket_connectData* data, unsigned char* buf, int len);
+
+DLLExport int MQTTSerialize_connack(unsigned char* buf, int buflen, unsigned char connack_rc, unsigned char sessionPresent);
+DLLExport int MQTTDeserialize_connack(unsigned char* sessionPresent, unsigned char* connack_rc, unsigned char* buf, int buflen);
+
+DLLExport int MQTTSerialize_disconnect(unsigned char* buf, int buflen);
+DLLExport int MQTTSerialize_pingreq(unsigned char* buf, int buflen);
+
+#endif /* MQTTCONNECT_H_ */
diff --git a/mbtk/include/mqtt/MQTTFormat.h b/mbtk/include/mqtt/MQTTFormat.h
new file mode 100755
index 0000000..f7bd0d1
--- /dev/null
+++ b/mbtk/include/mqtt/MQTTFormat.h
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2014 IBM Corp.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v1.0 which accompany this distribution.
+ *
+ * The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ * Ian Craggs - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+
+#if !defined(MQTTFORMAT_H)
+#define MQTTFORMAT_H
+
+#include "StackTrace.h"
+#include "MQTTPacket.h"
+
+const char* MQTTPacket_getName(unsigned short packetid);
+int MQTTStringFormat_connect(char* strbuf, int strbuflen, MQTTPacket_connectData* data);
+int MQTTStringFormat_connack(char* strbuf, int strbuflen, unsigned char connack_rc, unsigned char sessionPresent);
+int MQTTStringFormat_publish(char* strbuf, int strbuflen, unsigned char dup, int qos, unsigned char retained,
+ unsigned short packetid, MQTTString topicName, unsigned char* payload, int payloadlen);
+int MQTTStringFormat_ack(char* strbuf, int strbuflen, unsigned char packettype, unsigned char dup, unsigned short packetid);
+int MQTTStringFormat_subscribe(char* strbuf, int strbuflen, unsigned char dup, unsigned short packetid, int count,
+ MQTTString topicFilters[], int requestedQoSs[]);
+int MQTTStringFormat_suback(char* strbuf, int strbuflen, unsigned short packetid, int count, int* grantedQoSs);
+int MQTTStringFormat_unsubscribe(char* strbuf, int strbuflen, unsigned char dup, unsigned short packetid,
+ int count, MQTTString topicFilters[]);
+char* MQTTFormat_toClientString(char* strbuf, int strbuflen, unsigned char* buf, int buflen);
+char* MQTTFormat_toServerString(char* strbuf, int strbuflen, unsigned char* buf, int buflen);
+
+#endif
diff --git a/mbtk/include/mqtt/MQTTLinux.h b/mbtk/include/mqtt/MQTTLinux.h
new file mode 100755
index 0000000..6ca888a
--- /dev/null
+++ b/mbtk/include/mqtt/MQTTLinux.h
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * Copyright (c) 2014 IBM Corp.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v1.0 which accompany this distribution.
+ *
+ * The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ * Allan Stockdill-Mander - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+
+#ifndef __MQTT_LINUX_
+#define __MQTT_LINUX_
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/param.h>
+#include <sys/time.h>
+#include <sys/select.h>
+#include <netinet/in.h>
+#include <netinet/tcp.h>
+#include <arpa/inet.h>
+#include <netdb.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdbool.h>
+#include <stdlib.h>
+#include <string.h>
+#include <signal.h>
+
+// #include <openssl/ssl.h>
+// #include <openssl/err.h>
+//#include "DC_iot_port.h"
+
+typedef struct Timer Timer;
+
+struct Timer {
+ struct timeval end_time;
+};
+
+typedef struct Network Network;
+struct Network
+{
+ int my_socket;
+ bool is_support_ssl;
+ bool ingnore_cert;
+ int handle;
+ int (*mqttread) (Network*, unsigned char*, int, int);
+ int (*mqttwrite) (Network*, unsigned char*, int, int);
+ void (*disconnect) (Network*);
+};
+
+char expired(Timer*);
+void countdown_ms(Timer*, unsigned int);
+void countdown(Timer*, unsigned int);
+int left_ms(Timer*);
+
+void InitTimer(Timer*);
+
+int linux_read(Network*, unsigned char*, int, int);
+int linux_write(Network*, unsigned char*, int, int);
+void linux_disconnect(Network*);
+void NewNetwork(Network*);
+
+int ConnectNetwork(Network*, char*, int, bool ,bool );
+
+#endif
\ No newline at end of file
diff --git a/mbtk/include/mqtt/MQTTPacket.h b/mbtk/include/mqtt/MQTTPacket.h
new file mode 100755
index 0000000..f417929
--- /dev/null
+++ b/mbtk/include/mqtt/MQTTPacket.h
@@ -0,0 +1,133 @@
+/*******************************************************************************
+ * Copyright (c) 2014 IBM Corp.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v1.0 which accompany this distribution.
+ *
+ * The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ * Ian Craggs - initial API and implementation and/or initial documentation
+ * Xiang Rong - 442039 Add makefile to Embedded C client
+ *******************************************************************************/
+
+#ifndef MQTTPACKET_H_
+#define MQTTPACKET_H_
+
+#if defined(__cplusplus) /* If this is a C++ compiler, use C linkage */
+extern "C" {
+#endif
+
+#if defined(WIN32_DLL) || defined(WIN64_DLL)
+ #define DLLImport __declspec(dllimport)
+ #define DLLExport __declspec(dllexport)
+#elif defined(LINUX_SO)
+ #define DLLImport extern
+ #define DLLExport __attribute__ ((visibility ("default")))
+#else
+ #define DLLImport
+ #define DLLExport
+#endif
+
+enum errors
+{
+ MQTTPACKET_BUFFER_TOO_SHORT = -2,
+ MQTTPACKET_READ_ERROR = -1,
+ MQTTPACKET_READ_COMPLETE
+};
+
+enum msgTypes
+{
+ CONNECT = 1, CONNACK, PUBLISH, PUBACK, PUBREC, PUBREL,
+ PUBCOMP, SUBSCRIBE, SUBACK, UNSUBSCRIBE, UNSUBACK,
+ PINGREQ, PINGRESP, DISCONNECT
+};
+
+/**
+ * Bitfields for the MQTT header byte.
+ */
+typedef union
+{
+ unsigned char byte; /**< the whole byte */
+#if defined(REVERSED)
+ struct
+ {
+ unsigned int type : 4; /**< message type nibble */
+ unsigned int dup : 1; /**< DUP flag bit */
+ unsigned int qos : 2; /**< QoS value, 0, 1 or 2 */
+ unsigned int retain : 1; /**< retained flag bit */
+ } bits;
+#else
+ struct
+ {
+ unsigned int retain : 1; /**< retained flag bit */
+ unsigned int qos : 2; /**< QoS value, 0, 1 or 2 */
+ unsigned int dup : 1; /**< DUP flag bit */
+ unsigned int type : 4; /**< message type nibble */
+ } bits;
+#endif
+} MQTTHeader;
+
+typedef struct
+{
+ int len;
+ char* data;
+} MQTTLenString;
+
+typedef struct
+{
+ char* cstring;
+ MQTTLenString lenstring;
+} MQTTString;
+
+#define MQTTString_initializer {NULL, {0, NULL}}
+
+int MQTTstrlen(MQTTString mqttstring);
+
+#include "MQTTConnect.h"
+#include "MQTTPublish.h"
+#include "MQTTSubscribe.h"
+#include "MQTTUnsubscribe.h"
+#include "MQTTFormat.h"
+
+int MQTTSerialize_ack(unsigned char* buf, int buflen, unsigned char type, unsigned char dup, unsigned short packetid);
+int MQTTDeserialize_ack(unsigned char* packettype, unsigned char* dup, unsigned short* packetid, unsigned char* buf, int buflen);
+
+int MQTTPacket_len(int rem_len);
+int MQTTPacket_equals(MQTTString* a, char* b);
+
+int MQTTPacket_encode(unsigned char* buf, int length);
+int MQTTPacket_decode(int (*getcharfn)(unsigned char*, int), int* value);
+int MQTTPacket_decodeBuf(unsigned char* buf, int* value);
+
+int readInt(unsigned char** pptr);
+char readChar(unsigned char** pptr);
+void writeChar(unsigned char** pptr, char c);
+void writeInt(unsigned char** pptr, int anInt);
+int readMQTTLenString(MQTTString* mqttstring, unsigned char** pptr, unsigned char* enddata);
+void writeCString(unsigned char** pptr, const char* string);
+void writeMQTTString(unsigned char** pptr, MQTTString mqttstring);
+
+DLLExport int MQTTPacket_read(unsigned char* buf, int buflen, int (*getfn)(unsigned char*, int));
+
+typedef struct {
+ int (*getfn)(void *, unsigned char*, int); /* must return -1 for error, 0 for call again, or the number of bytes read */
+ void *sck; /* pointer to whatever the system may use to identify the transport */
+ int multiplier;
+ int rem_len;
+ int len;
+ char state;
+}MQTTTransport;
+
+int MQTTPacket_readnb(unsigned char* buf, int buflen, MQTTTransport *trp);
+
+#ifdef __cplusplus /* If this is a C++ compiler, use C linkage */
+}
+#endif
+
+
+#endif /* MQTTPACKET_H_ */
diff --git a/mbtk/include/mqtt/MQTTPublish.h b/mbtk/include/mqtt/MQTTPublish.h
new file mode 100755
index 0000000..d62dddb
--- /dev/null
+++ b/mbtk/include/mqtt/MQTTPublish.h
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2014 IBM Corp.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v1.0 which accompany this distribution.
+ *
+ * The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ * Ian Craggs - initial API and implementation and/or initial documentation
+ * Xiang Rong - 442039 Add makefile to Embedded C client
+ *******************************************************************************/
+
+#ifndef MQTTPUBLISH_H_
+#define MQTTPUBLISH_H_
+
+#if !defined(DLLImport)
+ #define DLLImport
+#endif
+#if !defined(DLLExport)
+ #define DLLExport
+#endif
+
+DLLExport int MQTTSerialize_publish(unsigned char* buf, int buflen, unsigned char dup, int qos, unsigned char retained, unsigned short packetid,
+ MQTTString topicName, unsigned char* payload, int payloadlen);
+
+DLLExport int MQTTDeserialize_publish(unsigned char* dup, int* qos, unsigned char* retained, unsigned short* packetid, MQTTString* topicName,
+ unsigned char** payload, int* payloadlen, unsigned char* buf, int len);
+
+DLLExport int MQTTSerialize_puback(unsigned char* buf, int buflen, unsigned short packetid);
+DLLExport int MQTTSerialize_pubrel(unsigned char* buf, int buflen, unsigned char dup, unsigned short packetid);
+DLLExport int MQTTSerialize_pubcomp(unsigned char* buf, int buflen, unsigned short packetid);
+
+#endif /* MQTTPUBLISH_H_ */
diff --git a/mbtk/include/mqtt/MQTTSubscribe.h b/mbtk/include/mqtt/MQTTSubscribe.h
new file mode 100755
index 0000000..383ca0d
--- /dev/null
+++ b/mbtk/include/mqtt/MQTTSubscribe.h
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2014 IBM Corp.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v1.0 which accompany this distribution.
+ *
+ * The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ * Ian Craggs - initial API and implementation and/or initial documentation
+ * Xiang Rong - 442039 Add makefile to Embedded C client
+ *******************************************************************************/
+
+#ifndef MQTTSUBSCRIBE_H_
+#define MQTTSUBSCRIBE_H_
+
+#if !defined(DLLImport)
+ #define DLLImport
+#endif
+#if !defined(DLLExport)
+ #define DLLExport
+#endif
+
+DLLExport int MQTTSerialize_subscribe(unsigned char* buf, int buflen, unsigned char dup, unsigned short packetid,
+ int count, MQTTString topicFilters[], int requestedQoSs[]);
+
+DLLExport int MQTTDeserialize_subscribe(unsigned char* dup, unsigned short* packetid,
+ int maxcount, int* count, MQTTString topicFilters[], int requestedQoSs[], unsigned char* buf, int len);
+
+DLLExport int MQTTSerialize_suback(unsigned char* buf, int buflen, unsigned short packetid, int count, int* grantedQoSs);
+
+DLLExport int MQTTDeserialize_suback(unsigned short* packetid, int maxcount, int* count, int grantedQoSs[], unsigned char* buf, int len);
+
+
+#endif /* MQTTSUBSCRIBE_H_ */
diff --git a/mbtk/include/mqtt/MQTTUnsubscribe.h b/mbtk/include/mqtt/MQTTUnsubscribe.h
new file mode 100755
index 0000000..1644ae5
--- /dev/null
+++ b/mbtk/include/mqtt/MQTTUnsubscribe.h
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2014 IBM Corp.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v1.0 which accompany this distribution.
+ *
+ * The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ * Ian Craggs - initial API and implementation and/or initial documentation
+ * Xiang Rong - 442039 Add makefile to Embedded C client
+ *******************************************************************************/
+
+#ifndef MQTTUNSUBSCRIBE_H_
+#define MQTTUNSUBSCRIBE_H_
+
+#if !defined(DLLImport)
+ #define DLLImport
+#endif
+#if !defined(DLLExport)
+ #define DLLExport
+#endif
+
+DLLExport int MQTTSerialize_unsubscribe(unsigned char* buf, int buflen, unsigned char dup, unsigned short packetid,
+ int count, MQTTString topicFilters[]);
+
+DLLExport int MQTTDeserialize_unsubscribe(unsigned char* dup, unsigned short* packetid, int max_count, int* count, MQTTString topicFilters[],
+ unsigned char* buf, int len);
+
+DLLExport int MQTTSerialize_unsuback(unsigned char* buf, int buflen, unsigned short packetid);
+
+DLLExport int MQTTDeserialize_unsuback(unsigned short* packetid, unsigned char* buf, int len);
+
+#endif /* MQTTUNSUBSCRIBE_H_ */
diff --git a/mbtk/include/mqtt/StackTrace.h b/mbtk/include/mqtt/StackTrace.h
new file mode 100755
index 0000000..c65a2ef
--- /dev/null
+++ b/mbtk/include/mqtt/StackTrace.h
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * Copyright (c) 2014 IBM Corp.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v1.0 which accompany this distribution.
+ *
+ * The Eclipse Public License is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ * and the Eclipse Distribution License is available at
+ * http://www.eclipse.org/org/documents/edl-v10.php.
+ *
+ * Contributors:
+ * Ian Craggs - initial API and implementation and/or initial documentation
+ * Ian Craggs - fix for bug #434081
+ *******************************************************************************/
+
+#ifndef STACKTRACE_H_
+#define STACKTRACE_H_
+
+#include <stdio.h>
+#define NOSTACKTRACE 1
+
+#if defined(NOSTACKTRACE)
+#define FUNC_ENTRY
+#define FUNC_ENTRY_NOLOG
+#define FUNC_ENTRY_MED
+#define FUNC_ENTRY_MAX
+#define FUNC_EXIT
+#define FUNC_EXIT_NOLOG
+#define FUNC_EXIT_MED
+#define FUNC_EXIT_MAX
+#define FUNC_EXIT_RC(x)
+#define FUNC_EXIT_MED_RC(x)
+#define FUNC_EXIT_MAX_RC(x)
+
+#else
+
+#if defined(WIN32)
+#define inline __inline
+#define FUNC_ENTRY StackTrace_entry(__FUNCTION__, __LINE__, TRACE_MINIMUM)
+#define FUNC_ENTRY_NOLOG StackTrace_entry(__FUNCTION__, __LINE__, -1)
+#define FUNC_ENTRY_MED StackTrace_entry(__FUNCTION__, __LINE__, TRACE_MEDIUM)
+#define FUNC_ENTRY_MAX StackTrace_entry(__FUNCTION__, __LINE__, TRACE_MAXIMUM)
+#define FUNC_EXIT StackTrace_exit(__FUNCTION__, __LINE__, NULL, TRACE_MINIMUM)
+#define FUNC_EXIT_NOLOG StackTrace_exit(__FUNCTION__, __LINE__, -1)
+#define FUNC_EXIT_MED StackTrace_exit(__FUNCTION__, __LINE__, NULL, TRACE_MEDIUM)
+#define FUNC_EXIT_MAX StackTrace_exit(__FUNCTION__, __LINE__, NULL, TRACE_MAXIMUM)
+#define FUNC_EXIT_RC(x) StackTrace_exit(__FUNCTION__, __LINE__, &x, TRACE_MINIMUM)
+#define FUNC_EXIT_MED_RC(x) StackTrace_exit(__FUNCTION__, __LINE__, &x, TRACE_MEDIUM)
+#define FUNC_EXIT_MAX_RC(x) StackTrace_exit(__FUNCTION__, __LINE__, &x, TRACE_MAXIMUM)
+#else
+#define FUNC_ENTRY StackTrace_entry(__func__, __LINE__, TRACE_MINIMUM)
+#define FUNC_ENTRY_NOLOG StackTrace_entry(__func__, __LINE__, -1)
+#define FUNC_ENTRY_MED StackTrace_entry(__func__, __LINE__, TRACE_MEDIUM)
+#define FUNC_ENTRY_MAX StackTrace_entry(__func__, __LINE__, TRACE_MAXIMUM)
+#define FUNC_EXIT StackTrace_exit(__func__, __LINE__, NULL, TRACE_MINIMUM)
+#define FUNC_EXIT_NOLOG StackTrace_exit(__func__, __LINE__, NULL, -1)
+#define FUNC_EXIT_MED StackTrace_exit(__func__, __LINE__, NULL, TRACE_MEDIUM)
+#define FUNC_EXIT_MAX StackTrace_exit(__func__, __LINE__, NULL, TRACE_MAXIMUM)
+#define FUNC_EXIT_RC(x) StackTrace_exit(__func__, __LINE__, &x, TRACE_MINIMUM)
+#define FUNC_EXIT_MED_RC(x) StackTrace_exit(__func__, __LINE__, &x, TRACE_MEDIUM)
+#define FUNC_EXIT_MAX_RC(x) StackTrace_exit(__func__, __LINE__, &x, TRACE_MAXIMUM)
+
+void StackTrace_entry(const char* name, int line, int trace);
+void StackTrace_exit(const char* name, int line, void* return_value, int trace);
+
+void StackTrace_printStack(FILE* dest);
+char* StackTrace_get(unsigned long);
+
+#endif
+
+#endif
+
+
+
+
+#endif /* STACKTRACE_H_ */
diff --git a/mbtk/include/ql/DSI_ConnectManager.h b/mbtk/include/ql/DSI_ConnectManager.h
new file mode 100755
index 0000000..3a8029f
--- /dev/null
+++ b/mbtk/include/ql/DSI_ConnectManager.h
@@ -0,0 +1,259 @@
+/**
+ @file
+ DSI_ConnectManager.h
+
+ @brief
+ This file provides the definitions for dsi, and declares the
+ API functions.
+
+*/
+/*============================================================================
+ Copyright (c) 2017 Quectel Wireless Solution, Co., Ltd. All Rights Reserved.
+ Quectel Wireless Solution Proprietary and Confidential.
+ =============================================================================*/
+/*===========================================================================
+
+ EDIT HISTORY FOR MODULE
+
+This section contains comments describing changes made to the module.
+Notice that changes are listed in reverse chronological order.
+
+
+WHEN WHO WHAT, WHERE, WHY
+---------- ------------ ----------------------------------------------------
+24/07/2019 Nebula.li create
+=============================================================================*/
+
+#ifndef __DSI_CONNECTMANAGER_H__
+#define __DSI_CONNECTMANAGER_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define QL_WAN_SUCCESS (0)
+#define QL_WAN_ERROR (-1)
+#define QL_INTERFACE_NAME_LEN 16
+#define QL_IPV4_MAX_ADDR_LEN 32
+#define QL_IPV6_MAX_ADDR_LEN 128
+
+
+/**
+ * used to check network status, when timeout, start data call again.
+*/
+#define QL_WAN_NETWORK_STATUS_MAX_TIMEOUT (60)
+
+
+/**
+ * DSI event define
+ */
+typedef enum
+{
+ CONNECT_DISCON = 0x00,
+ CONNECT_CONSUCCESS,
+ CONNECT_CONNING,
+ CONNECT_REDIAL,
+ CONNECT_DIAL_IMMEDIATELY,
+ CONNECT_ROAM,
+ CONNECT_WAIT_NWCHANGE,
+ CONNECT_GET_GLOBALIP_ERR,
+ CONNECT_DEACTIVATED,
+ CONNECT_WAIT_PS_ATTACH,
+
+ FAIL_BASE_INDEX=0x10,
+ SIM_NOT_READY=FAIL_BASE_INDEX+0x01,
+ NW_NOT_READY=FAIL_BASE_INDEX+0x02,
+ PDP_OPERATOR_BARRED =FAIL_BASE_INDEX+0x08, /* no retry */
+ PDP_INSUFFICIENT_RESOURCES =FAIL_BASE_INDEX+0x1A,
+ PDP_MISSING_UKNOWN_APN = FAIL_BASE_INDEX+0x1B, /* no retry */
+ PDP_UNKNOWN_PDP_ADDRESS_TYPE = FAIL_BASE_INDEX+0x1C, /* no retry */
+ PDP_USER_AUTHENTICATION = FAIL_BASE_INDEX+0x1D, /* no retry */
+ PDP_ACTIVATION_REJECT_GGSN = FAIL_BASE_INDEX+0x1E, /* no retry */
+ PDP_ACTIVATION_REJECT_UNSPECIFIED = FAIL_BASE_INDEX+0x1F,
+ PDP_SERVICE_OPTION_NOT_SUPPORTED = FAIL_BASE_INDEX+0x20, /* no retry */
+ PDP_SERVICE_OPTION_NOT_SUBSCRIBED = FAIL_BASE_INDEX+0x21, /* no retry */
+ PDP_SERVICE_OPTION_OUT_OF_ORDER = FAIL_BASE_INDEX+0x22,
+ PDP_NSAPI_IN_USE = FAIL_BASE_INDEX+0x23, /* no retry */
+ PDP_REGULAR_DEACTIVATION = FAIL_BASE_INDEX+0x24, /* possibly restart radio,
+ based on framework config */
+ PDP_ONLY_IPV4_ALLOWED = FAIL_BASE_INDEX+0x32, /* no retry */
+ PDP_ONLY_IPV6_ALLOWED = FAIL_BASE_INDEX+0x33, /* no retry */
+ PDP_ONLY_SINGLE_BEARER_ALLOWED = FAIL_BASE_INDEX+0x34,
+ PDP_PROTOCOL_ERRORS = FAIL_BASE_INDEX+0x6F, /* no retry */
+
+ /* Not mentioned in the specification */
+ PDP_VOICE_REGISTRATION_FAIL = -1,
+ PDP_DATA_REGISTRATION_FAIL = -2,
+
+ /* reasons for data call drop - network/modem disconnect */
+ PDP_SIGNAL_LOST = -3,
+ PDP_PREF_RADIO_TECH_CHANGED = -4,/* preferred technology has changed, should retry
+ with parameters appropriate for new technology */
+ PDP_RADIO_POWER_OFF = -5, /* data call was disconnected because radio was resetting,
+ powered off - no retry */
+ PDP_TETHERED_CALL_ACTIVE = -6, /* data call was disconnected by modem because tethered
+ mode was up on same APN/data profile - no retry until
+ tethered call is off */
+ PDP_CID_EXIST_FAIL = -7, /* cid is exist already*/
+
+ PDP_NO_CCINET=-10,
+ PDP_DHCP_SERVER_ERR_PIPE=-11,
+
+ PDP_ERROR_UNSPECIFIED = 0xffff, /* retry silently */
+ QL_DSI_EVT_MAX
+} QL_DSI_NET_EVT_T;
+
+#define SIM_REMOVED SIM_NOT_READY
+
+typedef struct
+{
+ char ip[QL_IPV4_MAX_ADDR_LEN];
+ char pri_dns[QL_IPV4_MAX_ADDR_LEN];
+ char sec_dns[QL_IPV4_MAX_ADDR_LEN];
+ char name[QL_INTERFACE_NAME_LEN];
+ char gateway[QL_IPV4_MAX_ADDR_LEN];
+}v4_address_status;
+
+typedef struct
+{
+ int state; //dial status
+ v4_address_status addr; //IPv4 address information
+}v4_info;
+
+typedef struct
+{
+ char ip[QL_IPV6_MAX_ADDR_LEN];
+ char pri_dns[QL_IPV6_MAX_ADDR_LEN];
+ char sec_dns[QL_IPV6_MAX_ADDR_LEN];
+ char name[QL_INTERFACE_NAME_LEN];
+ char gateway[QL_IPV6_MAX_ADDR_LEN];
+}v6_address_status;
+
+typedef struct
+{
+ int state; //dial status
+ v6_address_status addr; //IPv6 address information
+}v6_info;
+
+typedef struct
+{
+ int profile_idx;
+ int ip_type;
+ v4_info v4;
+ v6_info v6;
+}ql_data_call_info;
+
+/**
+ * DSI auth pref define
+*/
+typedef enum
+{
+ QL_DSI_AUTH_PREF_NULL = 0,
+ QL_DSI_AUTH_PREF_ONLY_PAP,
+ QL_DSI_AUTH_PREF_ONLY_CHAP,
+ //QL_DSI_AUTH_PREF_BOTH_PAP_CHAP
+} QL_DSI_AUTH_PREF_T;
+
+/**
+ * callback function used in ql_wan_start, when data call status changed,
+ * Use callback functions for notifications, see enum QL_DSI_NET_EVT_T
+*/
+typedef void (*nw_status_cb)(int status);
+
+
+typedef void (*ex_conn_status_cb)(int cid,int iptype,int status,int cause);
+
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief data call init function, must call first.
+ @return if success return QL_WAN_SUCCESS, else return QL_WAN_ERROR
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_wan_init();
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief data call release function, must call finally.
+ @return if success return QL_WAN_SUCCESS, else return QL_WAN_ERROR
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_wan_release();
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief data call auto connect set, include auto status and interval(seconds).
+ @param[in] auto_status When it is 0, the network cannot be automatically reconnected
+ after disconnection; when it is 1, it can be automatically reconnected
+ @param[in] interval_sec data call status check interval
+ the max value is QL_WAN_NETWORK_STATUS_MAX_TIMEOUT
+ @return if success return QL_WAN_SUCCESS, else return QL_WAN_ERROR
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_wan_set_autoconnect(int auto_status, int interval_sec);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief start data call, must call ql_wan_init first.
+ @param[in] nw_cb this is a callback function, when data call status changed, Use callback
+ functions for notifications
+ @return if success return QL_WAN_SUCCESS, else return QL_WAN_ERROR
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_wan_start(int profile_idx, int op, nw_status_cb nw_cb);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief start data call, must call ql_wan_init first.
+ @param[in] nw_cb this is a callback function, when data call status changed, Use callback
+ functions for notifications
+ @return if success return QL_WAN_SUCCESS, else return QL_WAN_ERROR
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_wan_start_ex(int profile_idx, int op, ex_conn_status_cb nw_cb);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief data call stop function.
+ @return if success return QL_WAN_SUCCESS, else return QL_WAN_ERROR
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_wan_stop(int profile_idx);
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief function to set apn.
+ @param[in] apn apn name want to set
+ @param[in] username user name of apn
+ @param[in] password password of apn
+ @param[in] auth auth type of apn, see enum QL_DSI_AUTH_PREF_T
+ @return if success return QL_WAN_SUCCESS, else return QL_WAN_ERROR
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_wan_setapn(int profile_idx, int ip_type, const char *apn, const char *userName, const char *password, QL_DSI_AUTH_PREF_T auth);
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief function to get first apn infomation.
+ @param[out] apn apn name to return
+ @param[in ] apnLen apn name buffer size
+ @param[out] userName username of apn to return
+ @param[in ] userLen username buffer size
+ @param[out] password password to return
+ @param[in ] pwdLen password buffer size
+ @return if success return QL_WAN_SUCCESS, else return QL_WAN_ERROR
+ */
+/*-----------------------------------------------------------------------------------------------*/
+
+#define ql_wan_getapn(profile_idx,ip_type,apn,apnLen,userName,userLen,password,pwdLen,...) __ql_wan_getapn(profile_idx,ip_type,apn,apnLen,userName,userLen,password,pwdLen,(NULL,##__VA_ARGS__))
+
+int __ql_wan_getapn(int profile_idx, int *ip_type, char *apn, int apnLen, char *userName, int userLen, char *password, int pwdLen,int* auth);
+int ql_get_data_call_info(int profile_idx, ql_data_call_info *info);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/mbtk/include/ql/ql_adc.h b/mbtk/include/ql/ql_adc.h
new file mode 100755
index 0000000..a2c71df
--- /dev/null
+++ b/mbtk/include/ql/ql_adc.h
@@ -0,0 +1,47 @@
+/*****************************************************************************
+* Copyright Statement:
+* --------------------
+* This software is protected by Copyright and the information contained
+* herein is confidential. The software may not be copied and the information
+* contained herein may not be used or disclosed except with the written
+* permission of Quectel Co., Ltd. 2019
+*
+*****************************************************************************/
+/*****************************************************************************
+ *
+ * Filename:
+ * ---------
+ * ql_adc.h
+ *
+ * Project:
+ * --------
+ * OpenLinux
+ *
+ * Description:
+ * ------------
+ * ADC API defines.
+ *
+ *
+ *============================================================================
+ * HISTORY
+ *----------------------------------------------------------------------------
+ * WHO WHEN WHAT
+ *----------------------------------------------------------------------------
+ * Carola.Zhang 20/11/2019 Create.
+ ****************************************************************************/
+
+#ifndef __QL_ADC_H__
+#define __QL_ADC_H__
+
+typedef enum {
+ QADC_NONE = -1,
+ ADC0 = 0,
+ ADC1 = 1,
+ QADC_END
+}Enum_QADC;
+
+
+int ql_adc_show(Enum_QADC qadc);
+
+
+#endif
\ No newline at end of file
diff --git a/mbtk/include/ql/ql_at.h b/mbtk/include/ql/ql_at.h
new file mode 100755
index 0000000..9cd6e8f
--- /dev/null
+++ b/mbtk/include/ql/ql_at.h
@@ -0,0 +1,91 @@
+
+#ifndef __QL_AT_H__
+#define __QL_AT_H__
+
+//#include <stdint.h>
+#include <string.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define TRUE 1
+#define FALSE 0
+
+#define BUF_LEN 1024
+
+#define MAX_URC_EVENT_HANDLER_ARRAY_SIZE 10
+
+//typedef unsigned int size_t;
+typedef int URC_EVENT_HANDLE;
+typedef void (*ql_urc_event_handle_func_t)(const char* urc_content);
+
+typedef struct
+{
+ char* urc_event;
+ ql_urc_event_handle_func_t pfun;
+} st_urc_handle_node;
+
+//--------------------------------------------------------------------------------------------------
+/**
+ * Standard result codes.
+ *
+ * @note All error codes are negative integers. They allow functions with signed
+ * integers to return non-negative values when successful or standard error codes on failure.
+ * @deprecated the result code LE_NOT_POSSIBLE is scheduled to be removed.
+ */
+//--------------------------------------------------------------------------------------------------
+typedef enum
+{
+ E_QL_OK = 0, ///< Successful.
+ E_QL_NOT_FOUND = -1, ///< Referenced item does not exist or could not be found.
+ E_QL_NOT_POSSIBLE = -2, ///< @deprecated It is not possible to perform the requested action.
+ E_QL_OUT_OF_RANGE = -3, ///< An index or other value is out of range.
+ E_QL_NO_MEMORY = -4, ///< Insufficient memory is available.
+ E_QL_NOT_PERMITTED = -5, ///< Current user does not have permission to perform requested action.
+ E_QL_FAULT = -6, ///< Unspecified internal error.
+ E_QL_COMM_ERROR = -7, ///< Communications error.
+ E_QL_TIMEOUT = -8, ///< A time-out occurred.
+ E_QL_OVERFLOW = -9, ///< An overflow occurred or would have occurred.
+ E_QL_UNDERFLOW = -10, ///< An underflow occurred or would have occurred.
+ E_QL_WOULD_BLOCK = -11, ///< Would have blocked if non-blocking behaviour was not requested.
+ E_QL_DEADLOCK = -12, ///< Would have caused a deadlock.
+ E_QL_FORMAT_ERROR = -13, ///< Format error.
+ E_QL_DUPLICATE = -14, ///< Duplicate entry found or operation already performed.
+ E_QL_BAD_PARAMETER = -15, ///< Parameter is invalid.
+ E_QL_CLOSED = -16, ///< The resource is closed.
+ E_QL_BUSY = -17, ///< The resource is busy.
+ E_QL_UNSUPPORTED = -18, ///< The underlying resource does not support this operation.
+ E_QL_IO_ERROR = -19, ///< An IO operation failed.
+ E_QL_NOT_IMPLEMENTED = -20, ///< Unimplemented functionality.
+ E_QL_UNAVAILABLE = -21, ///< A transient or temporary loss of a service or resource.
+ E_QL_TERMINATED = -22, ///< The process, operation, data stream, session, etc. has stopped.
+}E_QL_RESULT;
+
+extern const char strDelimit[];
+
+extern st_urc_handle_node g_urc_handler[];
+
+/*
+ Specify the AT port name used for sending/receiving AT cmd.
+*/
+extern int QL_AT_PortInit(char *device_path);
+
+extern void QL_AT_PortDeinit(void);
+
+/*
+ register the URC event call back, such as "+CMT: ;+CDS: ;+CBM: ;+CMTI: ;" seperated by ";" for sms.
+*/
+extern URC_EVENT_HANDLE register_urc_callback_func(const char* urc_event, ql_urc_event_handle_func_t pfun);
+
+/*
+ unregister the URC event call back.
+*/
+extern void unregister_urc_callback_func(URC_EVENT_HANDLE h_handle);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif //__QL_AT_H__
diff --git a/mbtk/include/ql/ql_atc.h b/mbtk/include/ql/ql_atc.h
new file mode 100755
index 0000000..4c8d8a8
--- /dev/null
+++ b/mbtk/include/ql/ql_atc.h
@@ -0,0 +1,63 @@
+/**
+ @file
+ ql_atc.h
+ @brief
+ send at command api
+
+*/
+/*============================================================================
+ Copyright (c) 2017 Quectel Wireless Solution, Co., Ltd. All Rights Reserved.
+ Quectel Wireless Solution Proprietary and Confidential.
+ =============================================================================*/
+/*===========================================================================
+
+ EDIT HISTORY FOR MODULE
+
+This section contains comments describing changes made to the module.
+Notice that changes are listed in reverse chronological order.
+
+
+WHEN WHO WHAT, WHERE, WHY
+---------- ------------ ----------------------------------------------------
+06/07/2022 Wayen.xu create
+=============================================================================*/
+
+#ifndef QL_ATC_H
+#define QL_ATC_H
+
+/*******************************************************
+* @method: ql_atc_init
+* @Description: initialize environment variables.
+* @param: void
+* @return:
+ success: return 0
+ error: return !0
+********************************************************/
+int ql_atc_init();
+
+/*******************************************************
+* @method: ql_atc_release
+* @Description: release environment variables.
+* @param: void
+* @return:
+ success: return 0
+ error: return !0
+********************************************************/
+int ql_atc_release();
+
+/*******************************************************
+* @method: ql_atc_send
+* @Description: send at command(synchronous)
+ use this api should first call init api and finish call release api
+* @param:
+ cmd: at command
+ resp: at return value
+ len: response value length
+* @return:
+ success: return 0
+ error: return !0
+********************************************************/
+int ql_atc_send(char* cmd, char* resp, int resp_len);
+
+
+#endif
diff --git a/mbtk/include/ql/ql_audio.h b/mbtk/include/ql/ql_audio.h
new file mode 100755
index 0000000..68c2190
--- /dev/null
+++ b/mbtk/include/ql/ql_audio.h
@@ -0,0 +1,627 @@
+/**
+ @file
+ ql_audio.h
+
+ @brief
+ This file provides the definitions for audio & record, and declares the
+ API functions.
+
+*/
+/*============================================================================
+ Copyright (c) 2017 Quectel Wireless Solution, Co., Ltd. All Rights Reserved.
+ Quectel Wireless Solution Proprietary and Confidential.
+ =============================================================================*/
+/*===========================================================================
+
+ EDIT HISTORY FOR MODULE
+
+This section contains comments describing changes made to the module.
+Notice that changes are listed in reverse chronological order.
+
+
+WHEN WHO WHAT, WHERE, WHY
+---------- ------------ ----------------------------------------------------
+07/06/2018 Stanley.yong Revise the comments for API.
+19/04/2018 Zichar.zhang Add Ql_Update_wav_size function.
+ Add Ql_AudPlayer_OpenExt function.
+ Add Ql_AudRecorder_OpenExt function.
+19/12/2016 Stanley.yong Optimize the APIs, and add comments.
+13/12/2016 Running.qian Implement newly-designed APIs.
+18/07/2016 Jun.wu Create
+=============================================================================*/
+
+#ifndef __AUD_H__
+#define __AUD_H__
+
+//this two headers for alsa params setting
+// #include "asoundlib.h"
+//#include "alsa-intf/alsa_audio.h"
+
+#include "mbtk_type.h"
+
+#define QUEC_PCM_8K 8000
+#define QUEC_PCM_16K 16000
+#define QUEC_PCM_44k 44100
+#define QUEC_PCM_MONO 1
+#define QUEC_PCM_STEREO 2
+
+typedef enum {
+ AUD_UP_LINK = 0,
+ AUD_DOWN_LINK,
+} Enum_AudDlink;
+
+typedef enum {
+ AUD_PLAYER_ERROR = -1,
+ AUD_PLAYER_START = 0,
+ AUD_PLAYER_PAUSE,
+ AUD_PLAYER_RESUME,
+ AUD_PLAYER_NODATA, //Buff no data and play tread will sleep
+ AUD_PLAYER_LESSDATA, //Buff has less data
+ AUD_PLAYER_FINISHED,
+} Enum_AudPlayer_State;
+
+typedef enum {
+ AUD_RECORDER_ERROR = -1,
+ AUD_RECORDER_START = 0,
+ AUD_RECORDER_PAUSE,
+ AUD_RECORDER_RESUME,
+ AUD_RECORDER_FINISHED,
+} Enum_AudRecorder_State;
+
+
+/****************************************************************************
+* Audio Volume Level Definition
+***************************************************************************/
+typedef enum {
+ AUD_VOLUME_LEVEL1 = 0,
+ AUD_VOLUME_LEVEL2,
+ AUD_VOLUME_LEVEL3,
+ AUD_VOLUME_LEVEL4,
+ AUD_VOLUME_LEVEL5,
+ AUD_VOLUME_LEVEL_END
+}Enum_AudVolumeLevel;
+
+/****************************************************************************
+* Audio Format
+***************************************************************************/
+typedef enum {
+ AUD_STREAM_FORMAT_MP3 = 0,
+ AUD_STREAM_FORMAT_AMR = 1,
+ AUD_STREAM_FORMAT_PCM = 2,
+ AUD_STREAM_FORMAT_END
+} Enum_AudStreamFormat;
+
+/****************************************************************************
+* Audio Direct
+***************************************************************************/
+typedef enum {
+ AUD_LINK_REVERSE = 0,
+ AUD_LINK_FORWARD = 1,
+ AUD_LINK_BOTH = 2,
+ AUD_LINK_INVALID
+}Enum_AudStreamDirection;
+
+
+/*****************************************************************
+********************New Advanced Audio High API******************
+* ***************************************************************/
+struct wav_header {
+ uint32_t riff_id;
+ uint32_t riff_sz;
+ uint32_t riff_fmt;
+ uint32_t fmt_id;
+ uint32_t fmt_sz;
+ uint16_t audio_format;
+ uint16_t num_channels;
+ uint32_t sample_rate;
+ uint32_t byte_rate; /* sample_rate * num_channels * bps / 8 */
+ uint16_t block_align; /* num_channels * bps / 8 */
+ uint16_t bits_per_sample;
+ uint32_t data_id;
+ uint32_t data_sz;
+};
+
+#define ID_RIFF 0x46464952
+#define ID_WAVE 0x45564157
+#define ID_FMT 0x20746d66
+#define ID_DATA 0x61746164
+#define FORMAT_PCM 1
+
+struct ST_MediaParams {
+ Enum_AudStreamFormat format;
+ Enum_AudVolumeLevel volume;
+ Enum_AudStreamDirection direct;
+};
+
+
+//
+// Function: _cb_onPlayer
+//
+// Description:
+// This callback function handles the result of audio player.
+//
+// @param hdl:
+// Handle received from Ql_AudPlayer_Open().
+// @param result:
+// the executing result for previous operation, such as Open, Play, Pause, Resume, Stop.
+// see the definition of Enum_AudPlayer_State for the specific meaning.
+typedef int(*_cb_onPlayer)(int hdl, int result);
+//
+// Function: _cb_onRecorder
+//
+// Description:
+// This callback function handles the result of audio recorder.
+// If result < 0, the recorder will stop the recording automatically.
+//
+// @param result:
+// the executing result for previous operation, such as Open, StartRecord, Pause, Resume, Stop.
+// see the definition of Enum_AudRecorder_State for the specific meaning.
+// @param pBuf:
+// pointer to the output recording (PCM) data.
+// @param length:
+// the length of the output recording (PCM) data.
+typedef int(*_cb_onRecorder)(int result, unsigned char* pBuf, unsigned int length); //if result < 0 will stop record, else continue record
+
+/*****************************************************************
+* Function: Ql_AudPlayer_Open
+*
+* Description:
+* Open audio play device, and specify the callback function.
+* This function can be called twice to play different audio sources.
+*
+* Parameters:
+* device : a string that specifies the PCM device.
+* NULL, means the audio will be played on the default PCM device.
+*
+* If you want to mixedly play audio sources, you can call this
+* API twice with specifying different PCM device.
+* The string devices available:
+* "hw:0,0" (the default play device)
+* "hw:0,13" (this device can mix audio and TTS)
+* "hw:0,14"
+*
+* cb_func : callback function for audio player.
+* The results of all operations on audio player
+* are informed in callback function.
+*
+* Return:
+* pcm device handle on success
+* -1 for failure
+*****************************************************************/
+int Ql_AudPlayer_Open(char* device, _cb_onPlayer cb_func);
+
+/*========================================================================
+ FUNCTION: Ql_AudPlayer_Play
+=========================================================================*/
+/** @brief
+ This function writes pcm data to pcm device to play.
+
+ @param[in] hdl, the handle returned by Ql_AudPlayer_Open().
+ @param[in] pData, pointer to the start address of pcm data.
+ @param[in] length, the length of pcm data.
+
+ @return
+ on success, the return value is the number of bytes to play
+ on failure, the return value is -1;
+
+ @dependencies
+ Ql_AudPlayer_Open() must be first called successfully.
+*/
+/*=======================================================================*/
+int Ql_AudPlayer_Play(int hdl, unsigned char* pData, unsigned int length);
+
+/*========================================================================
+ FUNCTION: Ql_AudPlayer_PlayFrmFile
+=========================================================================*/
+/** @brief
+ This function plays the pcm data from the specified file.
+
+ @param[in] hdl, the handle returned by Ql_AudPlayer_Open().
+ @param[in] fd, a file descriptor that contains pcm data.
+ Note:
+ the file offset should be set to the start position of pcm
+ data region, which means you should move the file offset
+ skipping the file header (such as wave header, amr header).
+ @param[in] offset, file offset. Please set it to -1 if no need to use.
+
+ @return
+ 0 on success
+ -1 on failure
+
+ @dependencies
+ Ql_AudPlayer_Open() must be first called successfully.
+*/
+/*=======================================================================*/
+int Ql_AudPlayer_PlayFrmFile(int hdl, int fd, int offset);
+//
+// Function: Ql_AudPlayer_Pause
+//
+// Description:
+// Pause playing.
+// @param hdl:
+// Handle received from Ql_AudPlayer_Open().
+int Ql_AudPlayer_Pause(int hdl);
+//
+// Function: Ql_AudPlayer_Resume
+//
+// Description:
+// Resume playing.
+// @param hdl:
+// Handle received from Ql_AudPlayer_Open().
+int Ql_AudPlayer_Resume(int hdl);
+//
+// Function: Ql_AudPlayer_Stop
+//
+// Description:
+// Stop playing audio
+// hdl:
+// Handle received from Ql_AudPlayer_Open().
+void Ql_AudPlayer_Stop(int hdl);
+//
+// Function: Ql_AudPlayer_Close
+//
+// Description:
+// Close player, and free the resource.
+// @param hdl:
+// Handle received from Ql_AudPlayer_Open().
+void Ql_AudPlayer_Close(int hdl);
+
+
+int Ql_AudPlayer_set_LessDataThreshold(int hdl, unsigned short threshSize);
+
+int Ql_AudPlayer_get_freeSpace(int hdl);
+
+
+/*****************************************************************
+* Function: Ql_AudRecorder_Open
+*
+* Description:
+* Open audio record device, and specify the callback function.
+*
+* Parameters:
+* device : not used. MUST be NULL.
+*
+* cb_func : callback function for audio player.
+* The results of all operations on audio recorder
+* are informed in callback function.
+*
+* Return:
+* pcm device handle
+* -1 for failure
+*****************************************************************/
+int Ql_AudRecorder_Open(char* device, _cb_onRecorder cb_fun);
+//
+// Function: Ql_AudRecorder_StartRecord
+//
+// Description:
+// Start to record.
+// The record data is output in _cb_onRecorder.
+//
+// Return:
+// 0 on success
+// -1 on failure
+int Ql_AudRecorder_StartRecord(void);
+//
+// Function: Ql_AudRecorder_Pause
+//
+// Description:
+// Pause recording
+int Ql_AudRecorder_Pause(void);
+//
+// Function: Ql_AudRecorder_Resume
+//
+// Description:
+// Resume recording
+int Ql_AudRecorder_Resume(void);
+//
+// Function: Ql_AudRecorder_Stop
+//
+// Description:
+// Stop recording
+void Ql_AudRecorder_Stop(void);
+//
+// Function: Ql_AudRecorder_Close
+//
+// Description:
+// Close recorder, and free the resource
+void Ql_AudRecorder_Close(void);
+
+//
+// Function: Ql_clt_set_mixer_value
+//
+// Description:
+// Close recorder, and free the resource
+boolean Ql_clt_set_mixer_value(const char *device, int count, const char *value);
+
+
+//****************QL TONE API************************//
+struct Ql_TonePara {
+ unsigned int lowFreq; //100-4000HZ
+ unsigned int highFreq; //100-4000HZ
+ unsigned int volume; //0 -1000
+ unsigned int duration; // >0 ms
+};
+
+int Ql_AudTone_Open(char* device, _cb_onPlayer cb);//cb not support now
+int Ql_AudTone_Start(int hdl, struct Ql_TonePara *para);
+void Ql_AudTone_Stop(int hdl);
+void Ql_AudTone_Close(int hdl);
+
+
+//****************QL Codec API************************//
+struct Ql_ALC5616_DRCAGC {
+ unsigned short control1_mask;
+ unsigned short control1_value;
+ unsigned short control2_mask;
+ unsigned short control2_value;
+ unsigned short control3_mask;
+ unsigned short control3_value;
+};
+
+//
+// Function: Ql_AudCodec_Set_ALC5616_DRCAGC
+//
+// Description:
+// Set ALC5616 DRC/AGC configuration
+int Ql_AudCodec_Set_ALC5616_DRCAGC(const char *i2c, struct Ql_ALC5616_DRCAGC *cfg);
+
+//
+// Function: Ql_Update_wav_size
+//
+// Description:
+// update wav format file size in the header
+// @param fd:
+// wav file discriptor
+// @param size:
+// wav file size to update
+int Ql_Update_wav_size(int fd, int size);
+
+//add by grady, 2018-5-29
+/*
+ * describe : this function is use to open pcm device
+ * paras :
+ * device : this should be fix to hw:0,0
+ * flags ; pcm play flags
+ * rate: sample rate
+ * channels : audio channal 1 or 2
+ * format: format to play or record, 16bit line,MP3
+ * hostless: if there is no file it is true
+ * return :
+ * pcm : pcm handle, use can use this handle to read write data
+ */
+struct pcm *quec_pcm_open(char *device, unsigned flags, unsigned rate, unsigned channels, unsigned format, unsigned hostless);
+
+/*
+ * describe : this function is use to close pcm handle
+ * paras :
+ * pcm : pcm handle to close
+ * return :
+ */
+int quec_pcm_close(struct pcm *pcm );
+
+/*
+ * describe : this function is use to read pcm buffer
+ * paras :
+ * pcm : pcm handle to write date
+ * buffer: data buffer
+ * lenth: data length
+ * return :
+ */
+int quec_read_pcm(struct pcm *pcm, void * buffer, int length);
+
+/*
+ * describe : this function is use to get pcm buffer lenth
+ * paras :
+ * lenth: data length
+ * return
+ * buffer length
+ */
+int quec_get_pem_buffer_len(struct pcm *pcm);
+
+//add by grady, 2018-6-2
+/*
+ * describe : this function is use to open mixer device
+ * paras :
+ * device: mixer device
+ * return
+ * mixer handle
+ */
+struct mixer *quec_mixer_open(const char *device);
+
+/*
+ * describe : this function is use to close mixer device
+ * paras :
+ * mixer: mixer handle
+ * return
+ * none
+ */
+void quec_mixer_close(struct mixer *mixer);
+
+/*
+ * describe : this function is use to get mixer devie control
+ * paras :
+ * mixer: mixer handle
+ * name: mixer device
+ * index: mixer index
+ * return
+ * mixer control
+ */
+struct mixer_ctl *quec_mixer_get_control(struct mixer *mixer, const char *name, unsigned index);
+
+/*
+ * describe : this function is use to set mulvalues
+ * paras :
+ * mixer: mixer handle
+ * count: count
+ * argv: data
+ * return :
+ *
+ */
+int quec_mixer_ctl_mulvalues(struct mixer_ctl *ctl, int count, char ** argv);
+
+
+//end grady
+
+/**
+ * @brief Set RX DSP Gain
+ * @details
+ * Gain support [-36,12] dB
+ *
+ * @param gain
+ * DSP gain
+ */
+
+int Ql_Rxgain_Set(int gain);
+
+/**
+ * @brief Set Playback PCM Samprate
+ * @details
+ * 0 for NB 1 for WB
+ *
+ * @param samprate
+ * samprate for PCM playback,default value is PCM NB
+ */
+
+
+int Ql_Playback_Samprate_Set(int samprate);
+
+/*****************************************************************
+* Function: Ql_AudPlayer_OpenExt
+*
+* Description:
+* expend function from Ql_AudPlayer_OpenExt
+* Open audio play device, and specify the callback function.
+* This function can be called twice to play different audio sources.
+*
+* Parameters:
+* device : a string that specifies the PCM device.
+* NULL, means the audio will be played on the default PCM device.
+*
+* If you want to mixedly play audio sources, you can call this
+* API twice with specifying different PCM device.
+* The string devices available:
+* "hw:0,0" (the default play device)
+* "hw:0,13" (this device can mix audio and TTS)
+* "hw:0,14"
+*
+* cb_func : callback function for audio player.
+* The results of all operations on audio player
+* are informed in callback function.
+*
+* flags : pcm flags, eg: PCM_MMAP, PCM_NMMAP.
+*
+* channels: pcm sample channels.
+*
+* rate : pcm sample rate.
+*
+* format : pcm sample fromat
+*
+* Return:
+* pcm device handle
+* NULL, fail
+*****************************************************************/
+int Ql_AudPlayer_OpenExt(
+ char *dev,
+ _cb_onPlayer cb_fun,
+ int flags,
+ int channels,
+ int rate,
+ int format);
+
+/*****************************************************************
+* Function: Ql_AudRecorder_Open
+*
+* Description:
+* Open audio record device, and specify the callback function.
+*
+* Parameters:
+* device : not used. MUST be NULL.
+*
+* cb_func : callback function for audio player.
+* The results of all operations on audio recorder
+* are informed in callback function.
+*
+* flags : pcm flags, eg: PCM_MMAP, PCM_NMMAP.
+*
+* channels: pcm sample channels.
+*
+* rate : pcm sample rate.
+*
+* format : pcm sample fromat
+*
+* Return:
+* pcm device handle
+* NULL, fail
+*****************************************************************/
+int Ql_AudRecorder_OpenExt(
+ char *dev,
+ _cb_onRecorder cb_fun,
+ int flags,
+ int channels,
+ int rate,
+ int format);
+
+/*****************************************************************
+* Function: Ql_Mp3_To_Wav
+*
+* Description:
+* set mp3 file change to wav file.
+*
+* Parameters:
+* wavpath : wav path
+*
+* mp3path : mp3 path
+*
+* Return:
+* 0: success
+* -1: fail
+*****************************************************************/
+int Ql_Mp3_To_Wav(const char *wavpath, char *mp3path);
+
+
+/*****************************************************************
+* Function: Ql_Mp3_To_Wav
+*
+* Description:
+* flay mp3 file.
+*
+* Parameters:
+* wavpath : wav path
+*
+* hdl : Device handle
+*
+* sample_rate : 0 for NB(8000) 1 for WB(16000)
+*
+* Return:
+* 0: success
+* -1: fail
+*****************************************************************/
+
+int Ql_Mp3_To_Play(char *mp3path, int hdl,int sample_rate);
+/*
+* Function: uac enable
+*
+* Description:
+* uac enable
+*
+* Parameters:
+* none
+* Return:
+* TURE or FALSE
+*/
+int ql_uac_enable(void);
+
+/*
+* Function: uac disable
+*
+* Description:
+* uac disable
+*
+* Parameters:
+* none
+* Return:
+* TURE or FALSE
+*/
+int ql_uac_disable(void);
+
+#endif //__AUD_H__
diff --git a/mbtk/include/ql/ql_cell_locator.h b/mbtk/include/ql/ql_cell_locator.h
new file mode 100755
index 0000000..4244f82
--- /dev/null
+++ b/mbtk/include/ql/ql_cell_locator.h
@@ -0,0 +1,116 @@
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @file ql_cell_locator.h
+ @brief Common API
+*/
+/*-----------------------------------------------------------------------------------------------*/
+/*-------------------------------------------------------------------------------------------------
+ Copyright (c) 2018 Quectel Wireless Solution, Co., Ltd. All Rights Reserved.
+ Quectel Wireless Solution Proprietary and Confidential.
+-------------------------------------------------------------------------------------------------*/
+/*-------------------------------------------------------------------------------------------------
+ EDIT HISTORY
+ This section contains comments describing changes made to the file.
+ Notice that changes are listed in reverse chronological order.
+ $Header: $
+ when who what, where, why
+ -------- --- ----------------------------------------------------------
+ 20190321 baron.qian Created .
+-------------------------------------------------------------------------------------------------*/
+#ifdef __cplusplus
+ extern "C" {
+#endif
+#ifndef __QL_CELL_LOCATOR_H__
+#define __QL_CELL_LOCATOR_H__
+
+/**/
+#define LOCATOR_MAX_ADDRESS_SIZE (256)
+#define LOCATOR_MAX_ERR_MSG_SIZE (256)
+
+
+typedef enum {
+ Q_LOC_ADDR_UTF8 = 0,
+ Q_LOC_ADDR_GBK,
+ Q_LOC_ADDR_ASCII,
+ Q_LOC_ADDR_NUM,
+}QUECLOCATOR_CHARSET;
+
+typedef struct {
+ int err_code;
+ char err_msg[LOCATOR_MAX_ERR_MSG_SIZE];
+} ql_cell_err;
+
+typedef struct {
+ /*longtitude*/
+ double lon;
+ /*latitude*/
+ double lat;
+ /*accuracy*/
+ unsigned short accuracy;
+ /*address charset, not support yet*/
+ QUECLOCATOR_CHARSET charset;
+ /*address info, not support yet*/
+ unsigned char addrinfo[LOCATOR_MAX_ADDRESS_SIZE];
+ /*address length, not support yet*/
+ unsigned short addrlen;
+ /*result*/
+ ql_cell_err err;
+} ql_cell_resp;
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief cell locator init function, when you want to use cell locator, call this function first!
+ @return if success return 0, else return -1
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_cell_locator_init();
+
+
+int ql_cell_locator_release();
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief set locator query server and port, server length must be less than 255 bytes.
+ @param[in] server the query server ip address
+ @param[in] port the query server port
+ @return if success return 0, else return -1
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_cell_locator_set_server(const char *server, unsigned short port);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief set locator query timeout, the value must between 1-300 [seconds]
+ @param[in] timeout value of query timeout
+ @return if success return 0, else return -1
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_cell_locator_set_timeout(unsigned short timeout);
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief set locator query token, token length must be 16 bytes. the token Used to verify that
+ the client accessing the service is valid.
+ @param[in] token string of token which want to be setted.
+ @param[in] length of token string.
+ @return if success return 0, else return -1
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_cell_locator_set_token(const char *token, int len);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief perform cell locator query
+ @param[out] resp include query result or set the error_msg and error_code
+ @return if success return 0, else return -1
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_cell_locator_perform(ql_cell_resp *resp);
+
+
+#endif /* !__QL_CELL_LOCATOR_H__ */
+#ifdef __cplusplus
+}
+#endif
diff --git a/mbtk/include/ql/ql_common.h b/mbtk/include/ql/ql_common.h
new file mode 100755
index 0000000..eef054d
--- /dev/null
+++ b/mbtk/include/ql/ql_common.h
@@ -0,0 +1,76 @@
+
+/**
+ @file
+ ql_common.h
+
+ @brief
+ This file provides the definitions for common functions, and declares the
+ common functions.
+
+*/
+/*============================================================================
+ Copyright (c) 2017 Quectel Wireless Solution, Co., Ltd. All Rights Reserved.
+ Quectel Wireless Solution Proprietary and Confidential.
+ =============================================================================*/
+/*===========================================================================
+
+ EDIT HISTORY FOR MODULE
+
+This section contains comments describing changes made to the module.
+Notice that changes are listed in reverse chronological order.
+
+
+WHEN WHO WHAT, WHERE, WHY
+---------- ------------ ----------------------------------------------------
+23/08/2019 Nebula.li create
+=============================================================================*/
+
+#ifndef __QL_COMMON_H__
+#define __QL_COMMON_H__
+
+#include <sys/types.h>
+#include <unistd.h>
+#include <sys/syscall.h>
+
+#include <libubox/ustream.h>
+#include <libubox/blobmsg_json.h>
+#include <libubox/kvlist.h>
+#include "libubus.h"
+#include "uci_blob.h"
+#include "libubox/uloop.h"
+#include "rilutil.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void Ql_Powerdown(int mode);
+
+int ql_start_main_thread();
+int ql_exit_main_thread();
+int ql_ril_sync_request(unsigned int requestid, const void * data, int len,void* priv,void * cb,int timeout);
+int ql_ril_async_request(unsigned int requestid, const void * data, int len,void* priv,void * cb);
+int ql_ubus_sync_request(char *obj_name, char *method,struct blob_buf *blob_buf,void* priv,void *cb,int timeout);
+int ql_ubus_async_request(char *obj_name, char *method,struct blob_buf *blob_buf,void* priv,void *cb);
+int ql_ubus_subscribe_reg(char *subscriber_name, struct ubus_subscriber *event_obj);
+int ql_ubus_subscribe_remove(char *subscriber_name, struct ubus_subscriber *event_obj);
+
+int atcmd_get_line_num(char * result, int result_len);
+char * atcmd_get_line(char * result, int result_len,int index);
+int atcmd_get_para_num(char * line);
+void atcmd_get_para_value_str(char * line,int index, char *para_value);
+void ql_set_response(struct kvlist *result_list,int reqid, int resp_type, int ret, void *data, int data_len);
+int ql_get_response(struct kvlist *result_list,int reqid, int * resp_type, void *data);
+int kvlist_get_len(struct kvlist *kv, const void *data);
+
+int utf8_to_usc2(unsigned char *utf8_data,int utf8_data_len, unsigned int *usc2_data);
+int usc2_to_utf8(unsigned int *usc2_data, int usc2_data_len, unsigned char *utf8_data);
+
+int set_config_option(const char *package, const char *section, const char *option, const char *value);
+char *get_config_option(char *package, char *section, char *option);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
\ No newline at end of file
diff --git a/mbtk/include/ql/ql_dev.h b/mbtk/include/ql/ql_dev.h
new file mode 100755
index 0000000..04a6dd5
--- /dev/null
+++ b/mbtk/include/ql/ql_dev.h
@@ -0,0 +1,114 @@
+/**
+ @file
+ ql_dev.h
+
+ @brief
+ This file provides the definitions for device, and declares the
+ API functions.
+
+*/
+/*============================================================================
+ Copyright (c) 2017 Quectel Wireless Solution, Co., Ltd. All Rights Reserved.
+ Quectel Wireless Solution Proprietary and Confidential.
+ =============================================================================*/
+/*===========================================================================
+
+ EDIT HISTORY FOR MODULE
+
+This section contains comments describing changes made to the module.
+Notice that changes are listed in reverse chronological order.
+
+
+WHEN WHO WHAT, WHERE, WHY
+---------- ------------ ----------------------------------------------------
+11/10/2019 Nebula.li create
+=============================================================================*/
+
+#ifndef __QL_DEV_H__
+#define __QL_DEV_H__
+
+#include <stdlib.h>
+#include <stdint.h>
+#include <string.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef enum
+{
+ QL_DEV_SUCCESS,
+ QL_DEV_GENERIC_FAILURE,
+ QL_DEV_RADIO_NOT_AVAILABLE,
+}QL_DEV_ERROR_CODE;
+
+typedef enum
+{
+ QL_DEV_MODEM_MIN_FUN,
+ QL_DEV_MODEM_FULL_FUN,
+ QL_DEV_MODEM_DISABLE_RECEIVE_RF_CIRCUITS = 3,
+ QL_DEV_MODEM_DISABLE_TRANSMIT_AND_RECEIVE_RF_CIRCUITS,
+ QL_DEV_MODEM_DISABLE_SIM,
+ QL_DEV_MODEM_TURN_OFF_FULL_SECONDARY_RECEIVE,
+}QL_DEV_MODEM_FUNCTION;
+
+QL_DEV_ERROR_CODE ql_dev_init ();
+QL_DEV_ERROR_CODE ql_dev_release();
+
+/*
+ Get the IMEI string.
+ -imei : input buffer
+*/
+QL_DEV_ERROR_CODE ql_dev_get_imei(char* imei);
+
+
+/*
+ Get the FirmwareVersion string.
+ -version : input buffer
+*/
+QL_DEV_ERROR_CODE ql_dev_get_firmware_version(char* version);
+
+
+/*
+ Get the DeviceModel string.
+ -model : input buffer
+*/
+QL_DEV_ERROR_CODE ql_dev_get_model(char* model);
+
+
+/*
+ Get the SN string.
+ -sn : input buffer
+*/
+QL_DEV_ERROR_CODE ql_dev_get_sn(char* sn);
+
+/*
+ Set the modem function.
+ -function :[in] modem function
+ -rst :[in] if it is to reset modem before setting modem function. (0: not to reset; 1: reset)
+*/
+QL_DEV_ERROR_CODE ql_dev_set_modem_fun(QL_DEV_MODEM_FUNCTION function,int rst);
+
+/*
+ Get the modem function.
+ -function :[out] modem function
+*/
+QL_DEV_ERROR_CODE ql_dev_get_modem_fun(int *function);
+
+/*
+ Set the modem forbid urc.
+ forbid NETWORK 0x01
+ forbid SIM 0x02
+ forbid SMS 0x04
+ forbid CS CALL 0x08
+ forbid PS DATA 0x10
+ -bitmask :[in] modem forbid urc
+ Set bitmask to 31 before sleep and 1 after wake up
+*/
+QL_DEV_ERROR_CODE ql_dev_forbidind(int bitmask);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/mbtk/include/ql/ql_fota.h b/mbtk/include/ql/ql_fota.h
new file mode 100755
index 0000000..fab1d48
--- /dev/null
+++ b/mbtk/include/ql/ql_fota.h
@@ -0,0 +1,95 @@
+/**
+ @file
+ ql_fota.h
+
+ @brief
+ This file provides the definitions for device, and declares the
+ API functions.
+
+*/
+/*============================================================================
+ Copyright (c) 2017 Quectel Wireless Solution, Co., Ltd. All Rights Reserved.
+ Quectel Wireless Solution Proprietary and Confidential.
+ =============================================================================*/
+/*===========================================================================
+
+ EDIT HISTORY FOR MODULE
+
+This section contains comments describing changes made to the module.
+Notice that changes are listed in reverse chronological order.
+
+
+WHEN WHO WHAT, WHERE, WHY
+---------- ------------ ----------------------------------------------------
+08/11/2019 baron.qian create
+=============================================================================*/
+#ifndef __QL_FOTA_H__
+#define __QL_FOTA_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+enum {
+ QUEC_FOTA_OK, /*OK*/
+ QUEC_FOTA_FAILED /*failed*/
+}QL_FOTA_STATUS;
+
+/*callback function define, used to get upgrade state and rate of process*/
+typedef int(*fota_callback)(int state, int percent);
+
+/*******************************************************************************
+* @brief fota initialize
+ @param
+
+ fota_callback: callback function
+ @return
+ if success return 0, else return -1
+ *******************************************************************************/
+int ql_fota_init(fota_callback cb);
+
+/*******************************************************************************
+* @brief write firmware package, the firmware package is written in segments.
+ and The result of the write is output by calling the callback function.
+ the firmware package size must less than 32MB
+ @param
+ fname: firmware package file
+ segment_size: the length of once write, recommending 3*1024*1024 bytes
+ @return
+ if success return 0, else return -1
+ *******************************************************************************/
+int ql_fota_fw_write(char *fname, int segment_size);
+
+
+/*******************************************************************************
+* @brief download firmware by url, and write firmware package, the firmware
+ package is written in segments. The result of the write is output by
+ calling the callback function. the firmware package size must less than
+ 32MB
+ @param
+ url: [IN] the address of download firmware package file, the url
+ support http or https protocol.
+ segment_size: [IN] the length of once write, recommending 3*1024*1024 bytes
+ conn_timeout: [IN] timeout to connect to the server, if set 0 that means
+ switch to the default build-in connection timeout(300s)
+ download_timeout: [IN] timeout for download the firmware file. if set 0 that means
+ it never time out
+ @return
+ if success return 0, else return -1
+ *******************************************************************************/
+int ql_fota_fw_write_by_url(char *url, int segment_size, int conn_timeout, int download_timeout);
+
+
+/*******************************************************************************
+* @brief reboot system and clear env
+ @param
+ is_reboot: if set 1, after fota success, reboot system
+ @return
+ if success return 0, else return -1
+ *******************************************************************************/
+int ql_fota_done(int is_reboot);
+
+#ifdef __cplusplus
+}
+#endif
+#endif //__QL_FOTA_H__
diff --git a/mbtk/include/ql/ql_gpio.h b/mbtk/include/ql/ql_gpio.h
new file mode 100755
index 0000000..74402e9
--- /dev/null
+++ b/mbtk/include/ql/ql_gpio.h
@@ -0,0 +1,376 @@
+/*****************************************************************************
+* Copyright Statement:
+* --------------------
+* This software is protected by Copyright and the information contained
+* herein is confidential. The software may not be copied and the information
+* contained herein may not be used or disclosed except with the written
+* permission of Quectel Co., Ltd. 2019
+*
+*****************************************************************************/
+/*****************************************************************************
+ *
+ * Filename:
+ * ---------
+ * ql_gpio.h
+ *
+ * Project:
+ * --------
+ * OpenLinux
+ *
+ * Description:
+ * ------------
+ * GPIO API defines.
+ *
+ *
+ *============================================================================
+ * HISTORY
+ *----------------------------------------------------------------------------
+ * WHO WHEN WHAT
+ *----------------------------------------------------------------------------
+ * Carola.Zhang 16/07/2019 Create.
+ ****************************************************************************/
+
+#ifndef __QL_GPIO_H__
+#define __QL_GPIO_H__
+
+typedef enum{
+ /*Invalid*/ PINNAME_BEGIN = -1,
+ /*PIN-1*/ PINNAME_GPIO1 = 1,
+ /*PIN-2*/ PINNAME_GPIO2 = 2,
+ /*PIN-3*/ PINNAME_GPIO3 = 3,
+ /*PIN-4*/ PINNAME_GPIO4 = 4,
+ /*PIN-5*/ PINNAME_GPIO5 = 5,
+ /*PIN-6*/ PINNAME_NET_STATUS = 6,
+ /*PIN-11*/ PINNAME_DBG_RXD = 11,
+ /*PIN-12*/ PINNAME_DBG_TXD = 12,
+ /*PIN-13*/ PINNAME_USIM_PRESENCE = 13,
+ /*PIN-23*/ PINNAME_SD_INT_DET = 23,
+ /*PIN-24*/ PINNAME_PCM_IN = 24,
+ /*PIN-25*/ PINNAME_PCM_OUT = 25,
+ /*PIN-26*/ PINNAME_PCM_SYNC = 26,
+ /*PIN-27*/ PINNAME_PCM_CLK = 27,
+ /*PIN-28*/ PINNAME_SDC2_DATA3 = 28,
+ /*PIN-29*/ PINNAME_SDC2_DATA2 = 29,
+ /*PIN-30*/ PINNAME_SDC2_DATA1 = 30,
+ /*PIN-31*/ PINNAME_SDC2_DATA0 = 31,
+ /*PIN-32*/ PINNAME_SDC2_CLK = 32,
+ /*PIN-33*/ PINNAME_SDC2_CMD = 33,
+ /*PIN-37*/ PINNAME_SPI_CS_N = 37,
+ /*PIN-38*/ PINNAME_SPI_MOSI = 38,
+ /*PIN-39*/ PINNAME_SPI_MISO = 39,
+ /*PIN-40*/ PINNAME_SPI_CLK = 40,
+ /*PIN-41*/ PINNAME_I2C_SCL = 41,
+ /*PIN-42*/ PINNAME_I2C_SDA = 42,
+ /*PIN-62*/ PINNAME_GPIO6 = 62,
+ /*PIN-63*/ PINNAME_DCD = 63,
+ /*PIN-66*/ PINNAME_DTR = 66,
+ /*PIN-64*/ PINNAME_MAIN_CTS = 64,
+ /*PIN-65*/ PINNAME_MAIN_RTS = 65,
+ /*PIN-67*/ PINNAME_MAIN_TXD = 67,
+ /*PIN-68*/ PINNAME_MAIN_RXD = 68,
+ /*PIN-73*/ PINNAME_RMII_RXD1 = 73,
+ /*PIN-74*/ PINNAME_RMII_RXCL = 74,
+ /*PIN-75*/ PINNAME_RMII_CLK = 75,
+ /*PIN-76*/ PINNAME_RMII_RXD0 = 76,
+ /*PIN-77*/ PINNAME_RMII_TXD0 = 77,
+ /*PIN-78*/ PINNAME_RMII_TXD1 = 78,
+ /*PIN-79*/ PINNAME_RMII_RXD2 = 79,
+ /*PIN-80*/ PINNAME_RMII_TXD2 = 80,
+ /*PIN-81*/ PINNAME_RMII_TX_CTRL = 81,
+ /*PIN-82*/ PINNAME_RMII_RXD3 = 82,
+ /*PIN-83*/ PINNAME_RMII_TXCL = 83,
+ /*PIN-84*/ PINNAME_RMII_TXD3 = 84,
+ /*PIN-118*/ PINNAME_WLAN_SLP_CLK = 118,
+ /*PIN-119*/ PINNAME_RMII_RST = 119,
+ /*PIN-120*/ PINNAME_RMII_INT = 120,
+ /*PIN-121*/ PINNAME_RMII_MDIO = 121,
+ /*PIN-122*/ PINNAME_RMII_MDC = 122,
+ /*PIN-127*/ PINNAME_WLAN_PER_EN = 127,
+ /*PIN-135*/ PINNAME_WLAN_WAKE = 135,
+ /*PIN-136*/ PINNAME_WLAN_EN = 136,
+ /*PIN-139*/ PINNAME_GPIO8 = 139,
+ PINNAME_END
+}Enum_PinName;
+
+/****************************************************************************
+ * Error Code Definition
+ ***************************************************************************/
+enum {
+ RES_OK = 0,
+ RES_BAD_PARAMETER = -1, ///< Parameter is invalid.
+ RES_IO_NOT_SUPPORT = -2,
+ RES_IO_ERROR = -3,
+ RES_NOT_IMPLEMENTED = -4
+};
+
+typedef enum{
+ PINDIRECTION_IN = 0,
+ PINDIRECTION_OUT = 1
+}Enum_PinDirection;
+
+typedef enum{
+ PINLEVEL_LOW = 0,
+ PINLEVEL_HIGH = 1
+}Enum_PinLevel;
+
+typedef enum{
+ PINPULLSEL_DISABLE = (0<<13), // Disable pull selection
+ PINPULLSEL_PULLDOWN = (5<<13), // Pull-down
+ PINPULLSEL_PULLUP = (6<<13) // Pull-up
+}Enum_PinPullSel;
+
+/****************************************************************************
+ * GPIO Config Items
+ ***************************************************************************/
+typedef struct{
+ Enum_PinName pin_name;
+ Enum_PinDirection pinDirection;
+ Enum_PinLevel pinLevel;
+ Enum_PinPullSel pinPullSel;
+}ST_GPIOConfig;
+
+//------------------------------------------------------------------------------
+/**
+ * The type of GPIO Edge Sensivity.
+ */
+//------------------------------------------------------------------------------
+typedef enum {
+ EINT_SENSE_NONE, // pin is input, but no an interrupt pin.
+ EINT_SENSE_RISING,
+ EINT_SENSE_FALLING,
+ EINT_SENSE_BOTH
+}Enum_EintType;
+
+/*****************************************************************
+* Function: Ql_GPIO_Init
+*
+* Description:
+* This function enables the GPIO function of the specified pin,
+* and initialize the configurations, including direction,
+* level and pull selection.
+*
+* Parameters:
+* pin_name:
+* Pin name, one value of Enum_PinName.
+* dir:
+* The initial direction of GPIO, one value of Enum_PinDirection.
+* level:
+* The initial level of GPIO, one value of Enum_PinLevel.
+* pull_sel:
+* Pull selection, one value of Enum_PinPullSel.
+* Return:
+* RES_OK, this function succeeds.
+* RES_IO_NOT_SUPPORT, the input GPIO is invalid.
+* RES_IO_ERR, the function failed
+* other place. For example this GPIO has been using as EINT.
+*****************************************************************/
+int Ql_GPIO_Init(Enum_PinName pin_name,
+ Enum_PinDirection dir,
+ Enum_PinLevel level,
+ Enum_PinPullSel pull_sel
+ );
+
+/*****************************************************************
+* Function: Ql_GPIO_Base_Init
+*
+* Description:
+* This function enables the GPIO function of the specified pin.
+*
+* Parameters:
+* pin_name:
+* Pin name, one value of Enum_PinName.
+*
+* Return:
+* RES_OK, this function succeeds.
+* RES_IO_NOT_SUPPORT, the input GPIO is invalid.
+* RES_IO_ERR, the function failed
+*****************************************************************/
+int Ql_GPIO_Base_Init(Enum_PinName pin_name );
+
+/*****************************************************************
+* Function: Ql_GPIO_SetLevel
+*
+* Description:
+* This function sets the level of the specified GPIO.
+*
+* Parameters:
+* pin_name:
+* Pin name, one value of Enum_PinName.
+* level:
+* The initial level of GPIO, one value of Enum_PinLevel.
+* Return:
+* RES_OK, this function succeeds.
+* RES_IO_NOT_SUPPORT, the input GPIO is invalid.
+* RES_IO_ERR, the function failed
+* other place. For example this GPIO has been using as EINT.
+*****************************************************************/
+int Ql_GPIO_SetLevel(Enum_PinName pin_name, Enum_PinLevel level);
+
+/*****************************************************************
+* Function: Ql_GPIO_GetLevel
+*
+* Description:
+* This function gets the level of the specified GPIO.
+*
+* Parameters:
+* pin_name:
+* Pin name, one value of Enum_PinName.
+* Return:
+* The level value of the specified GPIO, which is
+* nonnegative integer.
+* RES_IO_NOT_SUPPORT, the input GPIO is invalid.
+*****************************************************************/
+int Ql_GPIO_GetLevel(Enum_PinName pin_name);
+
+/*****************************************************************
+* Function: Ql_GPIO_SetDirection
+*
+* Description:
+* This function sets the direction of the specified GPIO.
+*
+* Parameters:
+* pin_name:
+* Pin name, one value of Enum_PinName.
+* dir:
+* The initial direction of GPIO, one value of Enum_PinDirection.
+* Return:
+* RES_OK, this function succeeds.
+* RES_IO_NOT_SUPPORT, the input GPIO is invalid.
+* RES_IO_ERR, the function failed
+* other place. For example this GPIO has been using as EINT.
+*****************************************************************/
+int Ql_GPIO_SetDirection(Enum_PinName pin_name, Enum_PinDirection dir);
+
+/*****************************************************************
+* Function: Ql_GPIO_GetDirection
+*
+* Description:
+* This function gets the direction of the specified GPIO.
+*
+* Parameters:
+* pin_name:
+* Pin name, one value of Enum_PinName.
+* Return:
+* 0 INPUT
+* 1 OUTPUT
+* RES_IO_NOT_SUPPORT, the input GPIO is invalid.
+* other place. For example this GPIO has been using as EINT.
+*****************************************************************/
+int Ql_GPIO_GetDirection(Enum_PinName pin_name);
+
+/*****************************************************************
+* Function: Ql_GPIO_SetPullSelection
+*
+* Description:
+* This function sets the pull selection of the specified GPIO.
+*
+* Parameters:
+* pin_name:
+* Pin name, one value of Enum_PinName.
+* Enum_PinPullSel:
+* Pull selection, one value of Enum_PinPullSel.
+* Return:
+* RES_OK, this function succeeds.
+* RES_IO_NOT_SUPPORT, the input GPIO is invalid.
+* RES_IO_ERR, the function failed
+* other place. For example this GPIO has been using as EINT.
+*****************************************************************/
+int Ql_GPIO_SetPullSelection(Enum_PinName pin_name, Enum_PinPullSel pull_sel);
+
+/*****************************************************************
+* Function: ql_gpio_get_pull_selection
+*
+* Description:
+* This function gets the pull selection of the specified GPIO.
+*
+* Parameters:
+* pin_name:
+* Pin name, one value of Enum_PinName.
+* Return:
+* 0<<13 no pull
+* 5<<13 pull down
+* 6<<13 pull up
+*****************************************************************/
+int Ql_GPIO_GetPullSelection(Enum_PinName pin_name);
+
+/*****************************************************************
+* Function: Ql_GPIO_Uninit
+*
+* Description:
+* This function releases the specified GPIO that was
+* initialized by calling Ql_GPIO_Init() previously.
+* After releasing, the GPIO can be used for other purpose.
+* Parameters:
+* pin_name:
+* Pin name, one value of Enum_PinName.
+* Return:
+* RES_OK, this function succeeds.
+* RES_IO_NOT_SUPPORT, the input GPIO is invalid.
+* RES_IO_ERR, the function failed
+* other place. For example this GPIO has been using as EINT.
+*****************************************************************/
+int Ql_GPIO_Uninit(Enum_PinName pin_name);
+
+//------------------------------------------------------------------------------
+/*
+* Description:
+* Definition for EINT callback function.
+*
+* Parameters:
+* PinName:
+* EINT pin name, one value of Enum_PinName.
+*
+* level:
+* The EINT level value, one value of Enum_PinLevel.
+* 0 or 1
+*/
+//------------------------------------------------------------------------------
+typedef void (*Ql_EINT_Callback)(Enum_PinName eint_pin_name, int level);
+
+//------------------------------------------------------------------------------
+/*
+* Function: Ql_EINT_Enable
+*
+* Description:
+* Set the interrupt sense mode, and enable interrupt.
+*
+* Parameters:
+* eint_pin_name:
+* EINT pin name, one value of Enum_PinName that has
+* the interrupt function.
+*
+* eint_type:
+* Interrupt type, level-triggered or edge-triggered.
+* Now, only edge-triggered interrupt is supported.
+*
+* eint_callback:
+* call back function
+*
+* Return:
+* RES_OK, this function succeeds.
+* else failed to execute the function.
+*/
+//------------------------------------------------------------------------------
+int Ql_EINT_Enable(Enum_PinName eint_pin_name, Enum_EintType eint_type, Ql_EINT_Callback eint_callback);
+
+
+//------------------------------------------------------------------------------
+/*
+* Function: Ql_EINT_Disable
+*
+* Description:
+* Disable the interrupt sense.
+*
+* Parameters:
+* eint_pin_name:
+* EINT pin name, one value of Enum_PinName that has
+* the interrupt function.
+*
+* Return:
+* RES_OK, this function succeeds.
+* else failed to execute the function.
+*/
+//------------------------------------------------------------------------------
+int Ql_EINT_Disable(Enum_PinName eint_pin_name);
+
+#endif // __QL_GPIO_H__
diff --git a/mbtk/include/ql/ql_i2c.h b/mbtk/include/ql/ql_i2c.h
new file mode 100755
index 0000000..52eb4c8
--- /dev/null
+++ b/mbtk/include/ql/ql_i2c.h
@@ -0,0 +1,41 @@
+/*****************************************************************************
+* Copyright Statement:
+* --------------------
+* This software is protected by Copyright and the information contained
+* herein is confidential. The software may not be copied and the information
+* contained herein may not be used or disclosed except with the written
+* permission of Quectel Co., Ltd. 2019
+*
+*****************************************************************************/
+/*****************************************************************************
+ *
+ * Filename:
+ * ---------
+ * ql_i2c.h
+ *
+ * Project:
+ * --------
+ * OpenLinux
+ *
+ * Description:
+ * ------------
+ * i2c API defines.
+ *
+ *
+ *============================================================================
+ * HISTORY
+ *----------------------------------------------------------------------------
+ * WHO WHEN WHAT
+ *----------------------------------------------------------------------------
+ * Carola.Zhang 16/07/2019 Create.
+ ****************************************************************************/
+#ifndef __QL_UART_H__
+#define __QL_UART_H__
+
+
+int Ql_I2C_Init(char *dev_name);
+int Ql_I2C_Read(int fd, unsigned short slaveAddr, unsigned char ofstAddr, unsigned char* ptrBuff, unsigned short length);
+int Ql_I2C_Write(int fd, unsigned short slaveAddr, unsigned char ofstAddr, unsigned char* ptrData, unsigned short length);
+int Ql_I2C_Deinit(int fd);
+
+#endif /* __QL_i2c_H__ */
\ No newline at end of file
diff --git a/mbtk/include/ql/ql_log.h b/mbtk/include/ql/ql_log.h
new file mode 100755
index 0000000..83940d1
--- /dev/null
+++ b/mbtk/include/ql/ql_log.h
@@ -0,0 +1,86 @@
+/**
+ @file
+ DSI_ConnectManager.h
+
+ @brief
+ This file provides the definitions for quectel log api, and declares the
+ API functions.
+
+*/
+/*============================================================================
+ Copyright (c) 2017 Quectel Wireless Solution, Co., Ltd. All Rights Reserved.
+ Quectel Wireless Solution Proprietary and Confidential.
+ =============================================================================*/
+/*===========================================================================
+
+ EDIT HISTORY FOR MODULE
+
+This section contains comments describing changes made to the module.
+Notice that changes are listed in reverse chronological order.
+
+
+WHEN WHO WHAT, WHERE, WHY
+---------- ------------ ----------------------------------------------------
+24/07/2019 Nebula.li create
+=============================================================================*/
+
+#ifndef _QL_LOG_H_
+#define _QL_LOG_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef enum {
+ QL_LOG_MIN = -1,
+ QL_LOG_EMERG_LEVEL=0, /* system is unusable */
+ QL_LOG_INIT_LEVEL=0, /* log init level */
+ QL_LOG_ALERT_LEVEL=1, /* action must be taken immediately */
+ QL_LOG_CRIT_LEVEL=2, /* critical conditions */
+ QL_LOG_ERR_LEVEL=3, /* error conditions */
+ QL_LOG_WARN_LEVEL=4, /* warning conditions */
+ QL_LOG_NOTICE_LEVEL=5, /* normal but significant condition */
+ QL_LOG_INFO_LEVEL=6, /* informational */
+ QL_LOG_DEBUG_LEVEL=7, /* debug-level messages */
+ QL_LOG_MAX
+} QL_LOG_PRIORITY_E;
+
+#define QL_LOG_PRORIFY_VERIFY(prio) ((prio)>QL_LOG_MIN && (prio)<QL_LOG_MAX)
+
+typedef enum {
+ QL_LOG_ID_MIN = -1,
+ QL_LOG_ID_MAIN = 0,
+ QL_LOG_ID_RADIO = 1,
+ QL_LOG_ID_EVENTS = 2,
+ QL_LOG_ID_SYSTEM = 3,
+ QL_LOG_ID_KMSG = 4,
+ QL_LOG_ID_STDOUT=5,
+ QL_LOG_ID_MAX
+} QL_LOG_ID_E;
+
+#define QL_LOG_ID_VERIFY(log_id) ((log_id)>QL_LOG_ID_MIN && (log_id)<QL_LOG_ID_MAX)
+
+#define LOG_BUF_SIZE 2048
+
+#define QL_LOG_OPEN() ql_log_open()
+#define QL_LOG_CLOSE() ql_log_close()
+#define QL_LOG_SETPOS(log_id) ql_log_setpos(log_id)
+
+#define QL_LOG_DEBUG(fmt, ...) ql_log_print(QL_LOG_DEBUG_LEVEL,__FUNCTION__, __LINE__, fmt, ##__VA_ARGS__)
+#define QL_LOG_INFO(fmt, ...) ql_log_print(QL_LOG_INFO_LEVEL,__FUNCTION__, __LINE__, fmt, ##__VA_ARGS__)
+#define QL_LOG_WARN(fmt, ...) ql_log_print(QL_LOG_WARN_LEVEL,__FUNCTION__, __LINE__, fmt, ##__VA_ARGS__)
+#define QL_LOG_ERROR(fmt, ...) ql_log_print(QL_LOG_ERR_LEVEL,__FUNCTION__, __LINE__, fmt, ##__VA_ARGS__)
+
+
+extern void ql_log_open();
+extern void ql_log_close();
+extern int ql_log_print(QL_LOG_PRIORITY_E prio,const char *func, int line, const char *fmt, ...);
+
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
\ No newline at end of file
diff --git a/mbtk/include/ql/ql_mcm.h b/mbtk/include/ql/ql_mcm.h
new file mode 100755
index 0000000..a5ae770
--- /dev/null
+++ b/mbtk/include/ql/ql_mcm.h
@@ -0,0 +1,165 @@
+#ifndef __QL_MCM_H__
+#define __QL_MCM_H__
+
+
+#define MCM_SERVICE_MAX (17)
+
+#define MCM_SERVICE_DATA 0x01
+#define MCM_SERVICE_DM 0x02
+#define MCM_SERVICE_LOC 0x03
+#define MCM_SERVICE_MOBILEAP 0x04
+#define MCM_SERVICE_NW 0x05
+#define MCM_SERVICE_ATC 0x06
+#define MCM_SERVICE_SMS 0x07
+#define MCM_SERVICE_CLIENT 0x08
+#define MCM_SERVICE_SIM 0x0B
+#define MCM_SERVICE_VCALL 0x10
+
+
+#define SERVICE_REQUIRED 1
+#define SERVICE_NOT_REQUIRED 0
+
+#define MAGIC_MSG_ID_SERVICE_UP 0x87654321
+#define MAGIC_MSG_ID_SERVICE_DOWN 0x87654320
+
+typedef enum
+{
+ E_QL_SUCCESS = 0, /**< Success. */
+ E_QL_SUCCESS_CONDITIONAL_SUCCESS = 1, /**< Conditional success. */
+ E_QL_ERROR_MCM_SERVICES_NOT_AVAILABLE = 2, /**< MCM services not available. */
+ E_QL_ERROR_GENERIC = 3, /**< Generic error. */
+ E_QL_ERROR_BADPARM = 4, /**< Bad parameter. */
+ E_QL_ERROR_MEMORY = 5, /**< Memory error. */
+ E_QL_ERROR_INVALID_STATE = 6, /**< Invalid state. */
+ E_QL_ERROR_MALFORMED_MSG = 7, /**< Malformed message. */
+ E_QL_ERROR_NO_MEMORY = 8, /**< No memory. */
+ E_QL_ERROR_INTERNAL = 9, /**< Internal error. */
+ E_QL_ERROR_ABORTED = 10, /**< Action was aborted. */
+ E_QL_ERROR_CLIENT_IDS_EXHAUSTED = 11, /**< Client IDs have been exhausted. */
+ E_QL_ERROR_UNABORTABLE_TRANSACTION = 12, /**< Unabortable transaction. */
+ E_QL_ERROR_INVALID_CLIENT_ID = 13, /**< Invalid client ID. */
+ E_QL_ERROR_NO_THRESHOLDS = 14, /**< No thresholds. */
+ E_QL_ERROR_INVALID_HANDLE = 15, /**< Invalid handle. */
+ E_QL_ERROR_INVALID_PROFILE = 16, /**< Invalid profile. */
+ E_QL_ERROR_INVALID_PINID = 17, /**< Invalid PIN ID. */
+ E_QL_ERROR_INCORRECT_PIN = 18, /**< Incorrect PIN. */
+ E_QL_ERROR_NO_NETWORK_FOUND = 19, /**< No network found. */
+ E_QL_ERROR_CALL_FAILED = 20, /**< Call failed. */
+ E_QL_ERROR_OUT_OF_CALL = 21, /**< Out of call. */
+ E_QL_ERROR_NOT_PROVISIONED = 22, /**< Not provisioned. */
+ E_QL_ERROR_MISSING_ARG = 23, /**< Missing argument. */
+ E_QL_ERROR_ARG_TOO_LONG = 24, /**< Argument is too long. */
+ E_QL_ERROR_INVALID_TX_ID = 25, /**< Invalid Tx ID. */
+ E_QL_ERROR_DEVICE_IN_USE = 26, /**< Device is in use. */
+ E_QL_ERROR_OP_NETWORK_UNSUPPORTED = 27, /**< OP network is not supported. */
+ E_QL_ERROR_OP_DEVICE_UNSUPPORTED = 28, /**< OP device is not supported. */
+ E_QL_ERROR_NO_EFFECT = 29, /**< No effect. */
+ E_QL_ERROR_NO_FREE_PROFILE = 30, /**< No free profile. */
+ E_QL_ERROR_INVALID_PDP_TYPE = 31, /**< Invalid PDP type. */
+ E_QL_ERROR_INVALID_TECH_PREF = 32, /**< Invalid technical preference. */
+ E_QL_ERROR_INVALID_PROFILE_TYPE = 33, /**< Invalid profile type. */
+ E_QL_ERROR_INVALID_SERVICE_TYPE = 34, /**< Invalid service type. */
+ E_QL_ERROR_INVALID_REGISTER_ACTION = 35, /**< Invalid register action. */
+ E_QL_ERROR_INVALID_PS_ATTACH_ACTION = 36, /**< Invalid PS attach action. */
+ E_QL_ERROR_AUTHENTICATION_FAILED = 37, /**< Authentication failed. */
+ E_QL_ERROR_PIN_BLOCKED = 38, /**< PIN is blocked. */
+ E_QL_ERROR_PIN_PERM_BLOCKED = 39, /**< PIN is permanently blocked. */
+ E_QL_ERROR_SIM_NOT_INITIALIZED = 40, /**< SIM is not initialized. */
+ E_QL_ERROR_MAX_QOS_REQUESTS_IN_USE = 41, /**< Maximum QoS requests are in use. */
+ E_QL_ERROR_INCORRECT_FLOW_FILTER = 42, /**< Incorrect flow filter. */
+ E_QL_ERROR_NETWORK_QOS_UNAWARE = 43, /**< Network QoS is unaware. */
+ E_QL_ERROR_INVALID_ID = 44, /**< Invalid ID. */
+ E_QL_ERROR_INVALID_QOS_ID = 45, /**< Invalid QoS ID. */
+ E_QL_ERROR_REQUESTED_NUM_UNSUPPORTED= 46, /**< Requested number is not supported. */
+ E_QL_ERROR_INTERFACE_NOT_FOUND = 47, /**< Interface was not found. */
+ E_QL_ERROR_FLOW_SUSPENDED = 48, /**< Flow is suspended. */
+ E_QL_ERROR_INVALID_DATA_FORMAT = 49, /**< Invalid data format. */
+ E_QL_ERROR_GENERAL = 50, /**< General error. */
+ E_QL_ERROR_UNKNOWN = 51, /**< Unknown error. */
+ E_QL_ERROR_INVALID_ARG = 52, /**< Invalid argument. */
+ E_QL_ERROR_INVALID_INDEX = 53, /**< Invalid index. */
+ E_QL_ERROR_NO_ENTRY = 54, /**< No entry. */
+ E_QL_ERROR_DEVICE_STORAGE_FULL = 55, /**< Device storage is full. */
+ E_QL_ERROR_DEVICE_NOT_READY = 56, /**< Device is not ready. */
+ E_QL_ERROR_NETWORK_NOT_READY = 57, /**< Network is not ready. */
+ E_QL_ERROR_CAUSE_CODE = 58, /**< Cause code error. */
+ E_QL_ERROR_MESSAGE_NOT_SENT = 59, /**< Message was not sent. */
+ E_QL_ERROR_MESSAGE_DELIVERY_FAILURE = 60, /**< Message delivery failure. */
+ E_QL_ERROR_INVALID_MESSAGE_ID = 61, /**< Invalid message ID. */
+ E_QL_ERROR_ENCODING = 62, /**< Encoding error. */
+ E_QL_ERROR_AUTHENTICATION_LOCK = 63, /**< Authentication lock error. */
+ E_QL_ERROR_INVALID_TRANSITION = 64, /**< Invalid transition. */
+ E_QL_ERROR_NOT_A_MCAST_IFACE = 65, /**< Not an MCast interface. */
+ E_QL_ERROR_MAX_MCAST_REQUESTS_IN_USE= 66, /**< Maximum MCast requests are in use. */
+ E_QL_ERROR_INVALID_MCAST_HANDLE = 67, /**< Invalid MCast handle. */
+ E_QL_ERROR_INVALID_IP_FAMILY_PREF = 68, /**< Invalid IP family preference. */
+ E_QL_ERROR_SESSION_INACTIVE = 69, /**< Session is inactive. */
+ E_QL_ERROR_SESSION_INVALID = 70, /**< Session is invalid. */
+ E_QL_ERROR_SESSION_OWNERSHIP = 71, /**< Session ownership error. */
+ E_QL_ERROR_INSUFFICIENT_RESOURCES = 72, /**< Insufficient resources. */
+ E_QL_ERROR_DISABLED = 73, /**< Disabled. */
+ E_QL_ERROR_INVALID_OPERATION = 74, /**< Invalid operation. */
+ E_QL_ERROR_INVALID_CMD = 75, /**< Invalid command. */
+ E_QL_ERROR_TPDU_TYPE = 76, /**< Transfer Protocol data unit type error. */
+ E_QL_ERROR_SMSC_ADDR = 77, /**< Short message service center address error. */
+ E_QL_ERROR_INFO_UNAVAILABLE = 78, /**< Information is not available. */
+ E_QL_ERROR_SEGMENT_TOO_LONG = 79, /**< Segment is too long. */
+ E_QL_ERROR_SEGMENT_ORDER = 80, /**< Segment order error. */
+ E_QL_ERROR_BUNDLING_NOT_SUPPORTED = 81, /**< Bundling is not supported. */
+ E_QL_ERROR_OP_PARTIAL_FAILURE = 82, /**< OP partial failure. */
+ E_QL_ERROR_POLICY_MISMATCH = 83, /**< Policy mismatch. */
+ E_QL_ERROR_SIM_FILE_NOT_FOUND = 84, /**< SIM file was not found. */
+ E_QL_ERROR_EXTENDED_INTERNAL = 85, /**< Extended internal error. */
+ E_QL_ERROR_ACCESS_DENIED = 86, /**< Access is denied. */
+ E_QL_ERROR_HARDWARE_RESTRICTED = 87, /**< Hardware is restricted. */
+ E_QL_ERROR_ACK_NOT_SENT = 88, /**< Acknowledgement was not sent. */
+ E_QL_ERROR_INJECT_TIMEOUT = 89, /**< Inject timeout error. */
+ E_QL_ERROR_INCOMPATIBLE_STATE = 90, /**< Incompatible state. */
+ E_QL_ERROR_FDN_RESTRICT = 91, /**< Fixed dialing number restrict error. */
+ E_QL_ERROR_SUPS_FAILURE_CAUSE = 92, /**< SUPS failure cause. */
+ E_QL_ERROR_NO_RADIO = 93, /**< No radio. */
+ E_QL_ERROR_NOT_SUPPORTED = 94, /**< Not supported. */
+ E_QL_ERROR_NO_SUBSCRIPTION = 95, /**< No subscription. */
+ E_QL_ERROR_CARD_CALL_CONTROL_FAILED = 96, /**< Card call control failed. */
+ E_QL_ERROR_NETWORK_ABORTED = 97, /**< Network was aborted. */
+ E_QL_ERROR_MSG_BLOCKED = 98, /**< Message was blocked. */
+ E_QL_ERROR_INVALID_SESSION_TYPE = 99, /**< Invalid session type. */
+ E_QL_ERROR_INVALID_PB_TYPE = 100, /**< Invalid phonebook type. */
+ E_QL_ERROR_NO_SIM = 101, /**< No SIM was found. */
+ E_QL_ERROR_PB_NOT_READY = 102, /**< Phonebook not ready. */
+ E_QL_ERROR_PIN_RESTRICTION = 103, /**< PIN restriction. */
+ E_QL_ERROR_PIN2_RESTRICTION = 104, /**< PIN2 restriction. */
+ E_QL_ERROR_PUK_RESTRICTION = 105, /**< PIN unlocking key restriction. */
+ E_QL_ERROR_PUK2_RESTRICTION = 106, /**< PIN unlocking key2 restriction. */
+ E_QL_ERROR_PB_ACCESS_RESTRICTED = 107, /**< Phonebook access is restricted. */
+ E_QL_ERROR_PB_DELETE_IN_PROG = 108, /**< Phonebook delete is in progress. */
+ E_QL_ERROR_PB_TEXT_TOO_LONG = 109, /**< Phonebook text is too long. */
+ E_QL_ERROR_PB_NUMBER_TOO_LONG = 110, /**< Phonebook number is too long. */
+ E_QL_ERROR_PB_HIDDEN_KEY_RESTRICTION= 111, /**< Phonebook hidden key restriction. */
+ E_QL_ERROR_PB_NOT_AVAILABLE = 112, /**< Phonebook is not available. */
+ E_QL_ERROR_DEVICE_MEMORY_ERROR = 113, /**< Device memory error. */
+ E_QL_ERROR_SIM_PIN_BLOCKED = 114, /**< SIM PIN is blocked. */
+ E_QL_ERROR_SIM_PIN_NOT_INITIALIZED = 115, /**< SIM PIN is not initialized. */
+ E_QL_ERROR_SIM_INVALID_PIN = 116, /**< SIM PIN is invalid. */
+ E_QL_ERROR_SIM_INVALID_PERSO_CK = 117, /**< SIM invalid personalization CK. */
+ E_QL_ERROR_SIM_PERSO_BLOCKED = 118, /**< SIM personalization blocked. */
+ E_QL_ERROR_SIM_PERSO_INVALID_DATA = 119, /**< SIM personalization contains invalid data. */
+ E_QL_ERROR_SIM_ACCESS_DENIED = 120, /**< SIM access is denied. */
+ E_QL_ERROR_SIM_INVALID_FILE_PATH = 121, /**< SIM file path is invalid. */
+ E_QL_ERROR_SIM_SERVICE_NOT_SUPPORTED= 122, /**< SIM service is not supported. */
+ E_QL_ERROR_SIM_AUTH_FAIL = 123, /**< SIM authorization failure. */
+ E_QL_ERROR_SIM_PIN_PERM_BLOCKED = 124, /**< SIM PIN is permanently blocked. */
+}E_QL_ERROR_CODE_T;
+
+#if 0
+int QL_MCM_Client_Init( mcm_client_handle_type *ph_mcm,
+ int client_type,
+ mcm_client_ind_cb client_ind_cb,
+ mcm_client_async_cb client_async_cb);
+
+int QL_MCM_Client_Deinit(mcm_client_handle_type h_mcm,
+ int client_type);
+#endif
+
+#endif // __QL_MCM_H__
+
diff --git a/mbtk/include/ql/ql_mcm_call.h b/mbtk/include/ql/ql_mcm_call.h
new file mode 100755
index 0000000..973fb47
--- /dev/null
+++ b/mbtk/include/ql/ql_mcm_call.h
@@ -0,0 +1,909 @@
+/**
+ *@file ql_mcm_voice.h
+ *@date 2017-11-30
+ *@author
+ *@brief
+ */
+
+#ifndef __QL_MCM_VOICE_H__
+#define __QL_MCM_VOICE_H__
+
+#include "mbtk_type.h"
+#include "mbtk_log.h"
+#include "ql_vcall.h"
+
+#define QL_MCM_MAX_VOICE_CALLS 8 /** GSM provides up to 8 calls; 3GPP2 provides 2. */
+#define QL_MCM_MAX_PHONE_NUMBER 82 /** Maximum phone number length. */
+#define QL_MCM_MAX_UUS_DATA 20 /** Maximum user-to-user data. */
+#define QL_MCM_MAX_DTMF_LENGTH 20 /** Maximum DTMF length. */
+#define QL_MCM_MAX_USSD_LENGTH 128 /** Maximum USSD length. */
+#define QL_MCM_MAX_PASSWORD_LENGTH 4 /** Maximum password length. */
+#define QL_MCM_MAX_CALL_FORWARDING_INFO 13 /** Maximum call forwarding information. */
+#define QL_MCM_MAX_ECALL_MSD 140 /** Maximum size of the MSD sent to the network with an eCall */
+#define QL_MCM_MAX_ECALL_URC_EVENT_LENGTH 128 /** Maximum size of the ecall urc event */
+
+
+typedef enum
+{
+ E_QL_MCM_VOICE_CALL_STATE_INCOMING = 0x0000, /**< MT incoming; CC setup. */
+ E_QL_MCM_VOICE_CALL_STATE_DIALING = 0x0001, /**< Dialing state. */
+ E_QL_MCM_VOICE_CALL_STATE_ALERTING = 0x0002, /**< MT call waiting; MO alterting. */
+ E_QL_MCM_VOICE_CALL_STATE_ACTIVE = 0x0003, /**< Call is active. */
+ E_QL_MCM_VOICE_CALL_STATE_HOLDING = 0x0004, /**< Call is on hold. */
+ E_QL_MCM_VOICE_CALL_STATE_END = 0x0005, /**< Call is disconnected. */
+ E_QL_MCM_VOICE_CALL_STATE_WAITING = 0x0006, /**< Call is waiting. */
+} ql_mcm_voice_call_state_t;
+
+typedef enum
+{
+ E_QL_MCM_VOICE_TECH_NONE = 0, /**< None. */
+ E_QL_MCM_VOICE_TECH_3GPP = 1, /**< 3GPP. */
+ E_QL_MCM_VOICE_TECH_3GPP2 = 2, /**< 3GPP2. */
+} ql_mcm_voice_tech_t;
+
+typedef enum
+{
+ E_QL_MCM_VOICE_CALL_NUMBER_UNKNOWN = 0x0000,
+ E_QL_MCM_VOICE_CALL_NUMBER_ALLOWED = 0x0001, /**< Number allowed. */
+ E_QL_MCM_VOICE_CALL_NUMBER_RESTRICTED = 0x0002, /**< Number restricted. */
+ E_QL_MCM_VOICE_CALL_NUMBER_PAYPHONE = 0x0003, /**< Payhone number. */
+} ql_mcm_voice_call_number_presentation_type_t;
+
+typedef enum
+{
+ E_QL_MCM_VOICE_CALL_MOBILE_ORIGINATED = 0x0000, /**< Mobile-originated. */
+ E_QL_MCM_VOICE_CALL_MOBILE_TERMINATED = 0x0001, /**< Mobile-terminated. */
+} ql_mcm_voice_call_direction_type_t;
+
+typedef enum
+{
+ E_QL_MCM_VOICE_CALL_ANSWER, //!<Answer the call.
+ E_QL_MCM_VOICE_CALL_END, //!<Deprecated. Do not use.
+ E_QL_MCM_VOICE_CALL_HOLD, //!<Hold the call.
+ E_QL_MCM_VOICE_CALL_UNHOLD, //!<Release the call from hold.
+ E_QL_MCM_VOICE_CALL_CONFERENCE, //!<Conference call.
+ E_QL_MCM_VOICE_CALL_GO_PRIVATE, //!<Private call.
+ E_QL_MCM_VOICE_CALL_END_ALL //!<End all calls.
+} ql_mcm_voice_call_operation_t; //!< Voice call operation type.
+
+typedef enum
+{
+ E_QL_MCM_VOICE_CALL_END_REASON_NONE = 0,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_OFFLINE = 1,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_CDMA_LOCK = 2,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_NO_SRV = 3,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_FADE = 4,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_INTERCEPT = 5,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_REORDER = 6,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_REL_NORMAL = 7,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_REL_SO_REJ = 8,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_INCOM_CALL = 9,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_ALERT_STOP = 10,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_CLIENT_END = 11,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_ACTIVATION = 12,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_MC_ABORT = 13,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_MAX_ACCESS_PROBE = 14,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_PSIST_N = 15,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_UIM_NOT_PRESENT = 16,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_ACC_IN_PROG = 17,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_ACC_FAIL = 18,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_RETRY_ORDER = 19,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_CCS_NOT_SUPPORTED_BY_BS = 20,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_NO_RESPONSE_FROM_BS = 21,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_REJECTED_BY_BS = 22,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_INCOMPATIBLE = 23,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_ACCESS_BLOCK = 24,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_ALREADY_IN_TC = 25,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_EMERGENCY_FLASHED = 26,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_USER_CALL_ORIG_DURING_GPS = 27,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_USER_CALL_ORIG_DURING_SMS = 28,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_USER_CALL_ORIG_DURING_DATA= 29,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_REDIR_OR_HANDOFF = 30,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_ACCESS_BLOCK_ALL = 31,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_OTASP_SPC_ERR = 32,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_IS707B_MAX_ACC = 33,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_ACC_FAIL_REJ_ORD = 34,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_ACC_FAIL_RETRY_ORD = 35,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_TIMEOUT_T42 = 36,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_TIMEOUT_T40 = 37,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_SRV_INIT_FAIL = 38,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_T50_EXP = 39,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_T51_EXP = 40,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_RL_ACK_TIMEOUT = 41,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_BAD_FL = 42,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_TRM_REQ_FAIL = 43,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_TIMEOUT_T41 = 44,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_INCOM_REJ = 45,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_SETUP_REJ = 46,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_NETWORK_END = 47,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_NO_FUNDS = 48,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_NO_GW_SRV = 49,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_NO_CDMA_SRV = 50,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_NO_FULL_SRV = 51,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_MAX_PS_CALLS = 52,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_UNKNOWN_SUBSCRIBER = 53,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_ILLEGAL_SUBSCRIBER = 54,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_BEARER_SERVICE_NOT_PROVISIONED= 55,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_TELE_SERVICE_NOT_PROVISIONED = 56,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_ILLEGAL_EQUIPMENT = 57,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_CALL_BARRED = 58,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_ILLEGAL_SS_OPERATION = 59,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_SS_ERROR_STATUS = 60,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_SS_NOT_AVAILABLE = 61,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_SS_SUBSCRIPTION_VIOLATION = 62,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_SS_INCOMPATIBILITY = 63,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_FACILITY_NOT_SUPPORTED = 64,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_ABSENT_SUBSCRIBER = 65,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_SHORT_TERM_DENIAL = 66,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_LONG_TERM_DENIAL = 67,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_SYSTEM_FAILURE = 68,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_DATA_MISSING = 69,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_UNEXPECTED_DATA_VALUE = 70,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_PWD_REGISTRATION_FAILURE = 71,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_NEGATIVE_PWD_CHECK = 72,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_NUM_OF_PWD_ATTEMPTS_VIOLATION = 73,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_POSITION_METHOD_FAILURE = 74,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_UNKNOWN_ALPHABET = 75,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_USSD_BUSY = 76,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_REJECTED_BY_USER = 77,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_REJECTED_BY_NETWORK = 78,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_DEFLECTION_TO_SERVED_SUBSCRIBER = 79,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_SPECIAL_SERVICE_CODE = 80,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_INVALID_DEFLECTED_TO_NUMBER = 81,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_MPTY_PARTICIPANTS_EXCEEDED= 82,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_RESOURCES_NOT_AVAILABLE = 83,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_UNASSIGNED_NUMBER = 84,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_NO_ROUTE_TO_DESTINATION = 85,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_CHANNEL_UNACCEPTABLE = 86,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_OPERATOR_DETERMINED_BARRING = 87,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_NORMAL_CALL_CLEARING = 88,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_USER_BUSY = 89,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_NO_USER_RESPONDING = 90,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_USER_ALERTING_NO_ANSWER = 91,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_CALL_REJECTED = 92,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_NUMBER_CHANGED = 93,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_PREEMPTION = 94,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_DESTINATION_OUT_OF_ORDER = 95,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_INVALID_NUMBER_FORMAT = 96,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_FACILITY_REJECTED = 97,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_RESP_TO_STATUS_ENQUIRY = 98,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_NORMAL_UNSPECIFIED = 99,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_NO_CIRCUIT_OR_CHANNEL_AVAILABLE = 100,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_NETWORK_OUT_OF_ORDER = 101,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_TEMPORARY_FAILURE = 102,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_SWITCHING_EQUIPMENT_CONGESTION = 103,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_ACCESS_INFORMATION_DISCARDED = 104,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_REQUESTED_CIRCUIT_OR_CHANNEL_NOT_AVAILABLE = 105,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_RESOURCES_UNAVAILABLE_OR_UNSPECIFIED = 106,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_QOS_UNAVAILABLE = 107,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_REQUESTED_FACILITY_NOT_SUBSCRIBED = 108,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_INCOMING_CALLS_BARRED_WITHIN_CUG = 109,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_BEARER_CAPABILITY_NOT_AUTH = 110,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_BEARER_CAPABILITY_UNAVAILABLE = 111,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_SERVICE_OPTION_NOT_AVAILABLE = 112,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_ACM_LIMIT_EXCEEDED = 113,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_BEARER_SERVICE_NOT_IMPLEMENTED = 114,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_REQUESTED_FACILITY_NOT_IMPLEMENTED= 115,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_ONLY_DIGITAL_INFORMATION_BEARER_AVAILABLE = 116,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_SERVICE_OR_OPTION_NOT_IMPLEMENTED = 117,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_INVALID_TRANSACTION_IDENTIFIER = 118,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_USER_NOT_MEMBER_OF_CUG = 119,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_INCOMPATIBLE_DESTINATION = 120,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_INVALID_TRANSIT_NW_SELECTION = 121,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_SEMANTICALLY_INCORRECT_MESSAGE = 122,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_INVALID_MANDATORY_INFORMATION = 123,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_MESSAGE_TYPE_NON_IMPLEMENTED = 124,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_MESSAGE_TYPE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE = 125,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_INFORMATION_ELEMENT_NON_EXISTENT = 126,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_CONDITONAL_IE_ERROR = 127,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_MESSAGE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE = 128,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_RECOVERY_ON_TIMER_EXPIRED = 129,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_PROTOCOL_ERROR_UNSPECIFIED = 130,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_INTERWORKING_UNSPECIFIED = 131,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_OUTGOING_CALLS_BARRED_WITHIN_CUG = 132,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_NO_CUG_SELECTION = 133,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_UNKNOWN_CUG_INDEX = 134,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_CUG_INDEX_INCOMPATIBLE = 135,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_CUG_CALL_FAILURE_UNSPECIFIED = 136,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_CLIR_NOT_SUBSCRIBED = 137,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_CCBS_POSSIBLE = 138,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_CCBS_NOT_POSSIBLE = 139,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_IMSI_UNKNOWN_IN_HLR = 140,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_ILLEGAL_MS = 141,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_IMSI_UNKNOWN_IN_VLR = 142,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_IMEI_NOT_ACCEPTED = 143,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_ILLEGAL_ME = 144,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_PLMN_NOT_ALLOWED = 145,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_LOCATION_AREA_NOT_ALLOWED = 146,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_ROAMING_NOT_ALLOWED_IN_THIS_LOCATION_AREA = 147,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_NO_SUITABLE_CELLS_IN_LOCATION_AREA= 148,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_NETWORK_FAILURE = 149,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_MAC_FAILURE = 150,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_SYNCH_FAILURE = 151,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_NETWORK_CONGESTION = 152,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_GSM_AUTHENTICATION_UNACCEPTABLE = 153,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_SERVICE_NOT_SUBSCRIBED = 154,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_SERVICE_TEMPORARILY_OUT_OF_ORDER = 155,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_CALL_CANNOT_BE_IDENTIFIED = 156,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_INCORRECT_SEMANTICS_IN_MESSAGE = 157,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_MANDATORY_INFORMATION_INVALID = 158,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_ACCESS_STRATUM_FAILURE = 159,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_INVALID_SIM = 160,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_WRONG_STATE = 161,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_ACCESS_CLASS_BLOCKED = 162,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_NO_RESOURCES = 163,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_INVALID_USER_DATA = 164,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_TIMER_T3230_EXPIRED = 165,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_NO_CELL_AVAILABLE = 166,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_ABORT_MSG_RECEIVED = 167,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_RADIO_LINK_LOST = 168,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_TIMER_T303_EXPIRED = 169,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_CNM_MM_REL_PENDING = 170,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_ACCESS_STRATUM_REJ_RR_REL_IND = 171,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_ACCESS_STRATUM_REJ_RR_RANDOM_ACCESS_FAILURE = 172,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_ACCESS_STRATUM_REJ_RRC_REL_IND = 173,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_ACCESS_STRATUM_REJ_RRC_CLOSE_SESSION_IND = 174,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_ACCESS_STRATUM_REJ_RRC_OPEN_SESSION_FAILURE = 175,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_ACCESS_STRATUM_REJ_LOW_LEVEL_FAIL = 176,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_ACCESS_STRATUM_REJ_LOW_LEVEL_FAIL_REDIAL_NOT_ALLOWED = 177,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_ACCESS_STRATUM_REJ_LOW_LEVEL_IMMED_RETRY = 178,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_ACCESS_STRATUM_REJ_ABORT_RADIO_UNAVAILABLE = 179,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_SERVICE_OPTION_NOT_SUPPORTED = 180,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_AS_REJ_LRRC_UL_DATA_CNF_FAILURE_TXN = 181,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_AS_REJ_LRRC_UL_DATA_CNF_FAILURE_HO = 182,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_AS_REJ_LRRC_UL_DATA_CNF_FAILURE_CONN_REL = 183,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_AS_REJ_LRRC_UL_DATA_CNF_FAILURE_RLF = 184,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_AS_REJ_LRRC_UL_DATA_CNF_FAILURE_CTRL_NOT_CONN = 185,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_AS_REJ_LRRC_CONN_EST_SUCCESS = 186,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_AS_REJ_LRRC_CONN_EST_FAILURE = 187,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_AS_REJ_LRRC_CONN_EST_FAILURE_ABORTED = 188,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_AS_REJ_LRRC_CONN_EST_FAILURE_ACCESS_BARRED = 189,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_AS_REJ_LRRC_CONN_EST_FAILURE_CELL_RESEL = 190,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_AS_REJ_LRRC_CONN_EST_FAILURE_CONFIG_FAILURE = 191,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_AS_REJ_LRRC_CONN_EST_FAILURE_TIMER_EXPIRED = 192,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_AS_REJ_LRRC_CONN_EST_FAILURE_LINK_FAILURE = 193,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_AS_REJ_LRRC_CONN_EST_FAILURE_NOT_CAMPED = 194,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_AS_REJ_LRRC_CONN_EST_FAILURE_SI_FAILURE = 195,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_AS_REJ_LRRC_CONN_EST_FAILURE_CONN_REJECT = 196,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_AS_REJ_LRRC_CONN_REL_NORMAL = 197,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_AS_REJ_LRRC_CONN_REL_RLF = 198,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_AS_REJ_LRRC_CONN_REL_CRE_FAILURE = 199,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_AS_REJ_LRRC_CONN_REL_OOS_DURING_CRE = 200,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_AS_REJ_LRRC_CONN_REL_ABORTED = 201,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_AS_REJ_LRRC_CONN_REL_SIB_READ_ERROR = 202,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_AS_REJ_LRRC_CONN_REL_ABORTED_IRAT_SUCCESS = 203,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_AS_REJ_LRRC_RADIO_LINK_FAILURE = 204,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_AS_REJ_DETACH_WITH_REATTACH_LTE_NW_DETACH = 205,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_AS_REJ_DETACH_WITH_OUT_REATTACH_LTE_NW_DETACH = 206,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_BAD_REQ_WAIT_INVITE = 207,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_BAD_REQ_WAIT_REINVITE = 208,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_INVALID_REMOTE_URI = 209,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_REMOTE_UNSUPP_MEDIA_TYPE = 210,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_PEER_NOT_REACHABLE = 211,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_NETWORK_NO_RESP_TIME_OUT = 212,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_NETWORK_NO_RESP_HOLD_FAIL = 213,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_DATA_CONNECTION_LOST = 214,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_UPGRADE_DOWNGRADE_REJ = 215,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_SIP_403_FORBIDDEN = 216,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_NO_NETWORK_RESP = 217,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_UPGRADE_DOWNGRADE_FAILED = 218,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_UPGRADE_DOWNGRADE_CANCELLED = 219,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_SSAC_REJECT = 220,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_THERMAL_EMERGENCY = 221,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_1XCSFB_SOFT_FAILURE = 222,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_1XCSFB_HARD_FAILURE = 223,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_CONNECTION_EST_FAILURE = 224,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_CONNECTION_FAILURE = 225,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_RRC_CONN_REL_NO_MT_SETUP = 226,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_ESR_FAILURE = 227,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_MT_CSFB_NO_RESPONSE_FROM_NW = 228,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_BUSY_EVERYWHERE = 229,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_ANSWERED_ELSEWHERE = 230,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_RLF_DURING_CC_DISCONNECT = 231,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_TEMP_REDIAL_ALLOWED = 232,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_PERM_REDIAL_NOT_NEEDED = 233,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_MERGED_TO_CONFERENCE = 234,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_LOW_BATTERY = 235,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_CALL_DEFLECTED = 236,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_RTP_RTCP_TIMEOUT = 237,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_RINGING_RINGBACK_TIMEOUT = 238,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_REG_RESTORATION = 239,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_CODEC_ERROR = 240,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_UNSUPPORTED_SDP = 241,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_RTP_FAILURE = 242,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_QoS_FAILURE = 243,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_MULTIPLE_CHOICES = 244,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_MOVED_PERMANENTLY = 245,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_MOVED_TEMPORARILY = 246,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_USE_PROXY = 247,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_ALTERNATE_SERVICE = 248,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_ALTERNATE_EMERGENCY_CALL = 249,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_UNAUTHORIZED = 250,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_PAYMENT_REQUIRED = 251,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_METHOD_NOT_ALLOWED = 252,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_NOT_ACCEPTABLE = 253,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_PROXY_AUTHENTICATION_REQUIRED = 254,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_GONE = 255,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_REQUEST_ENTITY_TOO_LARGE = 256,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_REQUEST_URI_TOO_LARGE = 257,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_UNSUPPORTED_URI_SCHEME = 258,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_BAD_EXTENSION = 259,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_EXTENSION_REQUIRED = 260,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_INTERVAL_TOO_BRIEF = 261,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_CALL_OR_TRANS_DOES_NOT_EXIST = 262,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_LOOP_DETECTED = 263,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_TOO_MANY_HOPS = 264,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_ADDRESS_INCOMPLETE = 265,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_AMBIGUOUS = 266,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_REQUEST_TERMINATED = 267,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_NOT_ACCEPTABLE_HERE = 268,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_REQUEST_PENDING = 269,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_UNDECIPHERABLE = 270,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_SERVER_INTERNAL_ERROR = 271,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_NOT_IMPLEMENTED = 272,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_BAD_GATEWAY = 273,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_SERVER_TIME_OUT = 274,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_VERSION_NOT_SUPPORTED = 275,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_MESSAGE_TOO_LARGE = 276,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_DOES_NOT_EXIST_ANYWHERE = 277,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_SESS_DESCR_NOT_ACCEPTABLE = 278,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_SRVCC_END_CALL = 279,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_INTERNAL_ERROR = 280,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_SERVER_UNAVAILABLE = 281,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_PRECONDITION_FAILURE = 282,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_DRVCC_IN_PROG = 283,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_DRVCC_END_CALL = 284,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_CS_HARD_FAILURE = 285,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_CS_ACQ_FAILURE = 286,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_FALLBACK_TO_CS = 287,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_DEAD_BATTERY = 288,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_HO_NOT_FEASIBLE = 289,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_PDN_DISCONNECTED = 290,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_REJECTED_ELSEWHERE = 291,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_CALL_PULLED = 292,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_CALL_PULL_OUT_OF_SYNC = 293,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_HOLD_RESUME_FAILED = 294,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_HOLD_RESUME_CANCELED = 295,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_REINVITE_COLLISION = 296,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_1XCSFB_MSG_INVAILD = 297,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_1XCSFB_MSG_IGNORE = 298,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_1XCSFB_FAIL_ACQ_FAIL = 299,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_1XCSFB_FAIL_CALL_REL_REL_ORDER= 300,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_1XCSFB_FAIL_CALL_REL_REORDER = 301,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_1XCSFB_FAIL_CALL_REL_INTERCEPT_ORDER = 302,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_1XCSFB_FAIL_CALL_REL_NORMAL = 303,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_1XCSFB_FAIL_CALL_REL_SO_REJ = 304,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_1XCSFB_FAIL_CALL_REL_OTASP_SPC_ERR = 305,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_1XCSFB_FAILURE_SRCH_TT_FAIL = 306,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_1XCSFB_FAILURE_TCH_INIT_FAIL = 307,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_1XCSFB_FAILURE_FAILURE_USER_CALL_END = 308,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_1XCSFB_FAILURE_FAILURE_RETRY_EXHAUST = 309,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_1XCSFB_FAILURE_FAILURE_CALL_REL_REG_REJ = 310,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_1XCSFB_FAILURE_FAILURE_CALL_REL_NW_REL_ODR= 311,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_1XCSFB_HO_FAILURE = 312,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_EMM_REJ_TIMER_T3417_EXT_EXP = 313,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_EMM_REJ_TIMER_T3417_EXP = 314,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_EMM_REJ_SERVICE_REQ_FAILURE_LTE_NW_REJECT = 315,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_EMM_REJ_SERVICE_REQ_FAILURE_CS_DOMAIN_NOT_AVAILABLE = 316,
+ E_QL_MCM_VOICE_CALL_END_CAUSE_EMM_REJ = 317,
+} ql_mcm_voice_call_end_reason_t;
+
+typedef enum
+{
+ E_QL_MCM_VOICE_UUS_TYPE1_IMPLICIT, //!< Type 1 implicit.
+ E_QL_MCM_VOICE_UUS_TYPE1_REQUIRED, //!< Type 1 required.
+ E_QL_MCM_VOICE_UUS_TYPE1_NOT_REQUIRED, //!< Type 1 not required.
+ E_QL_MCM_VOICE_UUS_TYPE2_REQUIRED, //!< Type 2 required.
+ E_QL_MCM_VOICE_UUS_TYPE2_NOT_REQUIRED, //!< Type 2 not required.
+ E_QL_MCM_VOICE_UUS_TYPE3_REQUIRED, //!< Type 3 required.
+ E_QL_MCM_VOICE_UUS_TYPE3_NOT_REQUIRED, //!< Type 3 not required.
+ E_QL_MCM_VOICE_UUS_TYPE_DATA //!< Data.
+} ql_mcm_voice_uus_type_t;
+
+typedef enum
+{
+ E_QL_MCM_VOICE_UUS_DCS_IA5, //!< IA5.
+ E_QL_MCM_VOICE_UUS_DCS_OHLP, //!< OHLP.
+ E_QL_MCM_VOICE_UUS_DCS_USP, //!< USP.
+ E_QL_MCM_VOICE_UUS_DCS_X244 //!< x244.
+} ql_mcm_voice_uus_dcs_type_t; //!< UUS data coding scheme.
+
+
+typedef struct
+{
+ ql_mcm_voice_uus_type_t type; /**< UUS type; range -- 0 to 6.*/
+ ql_mcm_voice_uus_dcs_type_t dcs; /**< UUS data coding scheme; range -- 0 to 4.*/
+ uint32_t uus_data_len; /**< Must be set to the number of elements in uus_data. */
+ uint8_t uus_data[QL_MCM_MAX_UUS_DATA];/**< Voice call UUS data.*/
+} ql_mcm_voice_uusdata_t;
+
+typedef struct
+{
+ uint32_t call_id; /**< Call ID associated with this call.*/
+ ql_mcm_voice_call_state_t state; /**< Current call state (mcm_voice_call_state).*/
+ ql_mcm_voice_tech_t tech; /**< Technology (mcm_tech).*/
+ char number[QL_MCM_MAX_PHONE_NUMBER + 1]; /**< Phone number.*/
+ ql_mcm_voice_call_number_presentation_type_t number_presentation; /**< Number presentation.*/
+ ql_mcm_voice_call_direction_type_t direction; /**< Voice call direction.*/
+ uint8_t uusdata_valid; /**< Indicates whether UUS data is valid.*/
+ ql_mcm_voice_uusdata_t uusdata; /**< User-to-user signaling data.*/
+ uint8_t call_end_reason_valid; /**< Indicates whether call_end_reason is valid.*/
+ ql_mcm_voice_call_end_reason_t call_end_reason;
+} ql_mcm_voice_call_record_t;
+
+typedef struct
+{
+ uint32_t calls_len; /**< Must be set to # of elements in calls */
+ ql_mcm_voice_call_record_t calls[QL_MCM_MAX_VOICE_CALLS]; /**< Calls.*/
+} ql_mcm_voice_calls_state_t;
+
+
+typedef enum
+{
+ E_QL_MCM_VOICE_CALL_FORWARDING_DISABLED = 0, /**< Disabled. */
+ E_QL_MCM_VOICE_CALL_FORWARDING_ENABLED = 1, /**< Enabled. */
+} QL_MCM_VOICE_CALL_FORWARDING_STATUS_T;
+
+typedef enum
+{
+ E_QL_MCM_VOICE_CALL_FORWARDING_TYPE_VOICE = 0, /**< Voice. */
+ E_QL_MCM_VOICE_CALL_FORWARDING_TYPE_DATA = 1, /**< Data. */
+ E_QL_MCM_VOICE_CALL_FORWARDING_TYPE_VOICE_DATA = 2, /**< Voice and data. */
+} QL_MCM_VOICE_CALL_FORWARDING_TYPE_T;
+
+typedef struct
+{
+ QL_MCM_VOICE_CALL_FORWARDING_TYPE_T type; /**< Call forwarding type.*/
+ char number[QL_MCM_MAX_PHONE_NUMBER + 1]; /**< Call forwarding number.*/
+} QL_MCM_VOICE_CALL_FORWARDING_INFO_T; /* Type */
+
+typedef struct
+{
+ QL_MCM_VOICE_CALL_FORWARDING_STATUS_T status; /**< Call forwarding status.*/
+ uint32_t info_len; /**< Must be set to # of elements in info */
+ QL_MCM_VOICE_CALL_FORWARDING_INFO_T info[QL_MCM_MAX_CALL_FORWARDING_INFO];/**< Call forwarding information.*/
+} ql_mcm_voice_call_forwarding_status_list_t; /* Message */
+
+typedef enum
+{
+ E_QL_MCM_VOICE_SERVICE_UNKOWN = 0,
+ E_QL_MCM_VOICE_SERVICE_REGISTER = 1, /**< Register. */
+ E_QL_MCM_VOICE_SERVICE_ERASE = 2, /**< Erase. */
+} E_QL_MCM_VOICE_CALL_SERVICE_T;
+
+typedef enum
+{
+ E_QL_MCM_VOICE_CALL_FORWARD_UNCONDITIONALLY = 0, /**< Unconditional call forwarding. */
+ E_QL_MCM_VOICE_CALL_FORWARD_MOBILEBUSY = 1, /**< Forward when the mobile device is busy. */
+ E_QL_MCM_VOICE_CALL_FORWARD_NOREPLY = 2, /**< Forward when there is no reply. */
+ E_QL_MCM_VOICE_CALL_FORWARD_UNREACHABLE = 3, /**< Forward when the call is unreachable. */
+ E_QL_MCM_VOICE_CALL_FORWARD_ALLFORWARDING = 4, /**< All forwarding(0-3). */
+ E_QL_MCM_VOICE_CALL_FORWARD_ALLCONDITIONAL = 5, /**< All conditional forwarding(1-3). */
+} E_QL_MCM_VOICE_CALL_FORWARDING_REASON_T;
+
+
+typedef enum
+{
+ E_QL_MCM_VOICE_CALL_WAITING_VOICE_ENABLED = 0, /**< Voice call waiting enabled. */
+ E_QL_MCM_VOICE_CALL_WAITING_DISABLED = 1, /**< Voice call waiting disabled. */
+} E_QL_MCM_VOICE_CALL_WAITING_SERVICE_T;
+
+typedef struct
+{
+ E_QL_MCM_VOICE_CALL_WAITING_SERVICE_T waiting_service;
+} ql_mcm_voice_call_waiting_service_t;
+
+
+
+typedef enum
+{
+ E_QL_MCM_VOICE_CLIR_INVOCATION = 0, /**< Invocation. */
+ E_QL_MCM_VOICE_CLIR_SUPPRESSION = 1, /**< Suppression. */
+} ql_mcm_voice_clir_action_t;
+
+typedef enum
+{
+ E_QL_MCM_VOICE_CLIR_NOT_PROVISIONED = 0, /**< Not provisioned. */
+ E_QL_MCM_VOICE_CLIR_PROVISIONED_PERMANENT_MODE = 1, /**< Permanently provisioned. */
+ E_QL_MCM_VOICE_CLIR_PRESENTATION_RESTRICTED = 2, /**< Restricted presentation. */
+ E_QL_MCM_VOICE_CLIR_PRESENTATION_ALLOWED = 3, /**< Allowed presentation. */
+} ql_mcm_voice_clir_presentation_t;
+
+typedef struct
+{
+ ql_mcm_voice_clir_action_t action;
+ ql_mcm_voice_clir_presentation_t presentation; /**< CLIR presentation.*/
+} ql_mcm_voice_clir_info_t;
+
+
+
+typedef enum
+{
+ E_QL_MCM_VOICE_USSD_MSG_TYPE_NEW_MESSAGE = 0, /**< Initiate a new USSD sesion with network. */
+ E_QL_MCM_VOICE_USSD_MSG_TYPE_REPLY_TO_IND = 1, /**< Reply to a USSD indication from the network. */
+} ql_mcm_voice_ussd_msg_type_t;
+
+typedef enum
+{
+ E_QL_MCM_VOICE_USSD_ENCODING_ASCII = 0, /**< ASCII coding scheme. */
+ E_QL_MCM_VOICE_USSD_ENCODING_8BIT = 1, /**< 8-bit coding scheme. */
+ E_QL_MCM_VOICE_USSD_ENCODING_UCS2 = 2, /**< UCS2. */
+} ql_mcm_voice_ussd_encoding_type_t;
+
+typedef struct
+{
+ ql_mcm_voice_ussd_msg_type_t type; /**< Whether sending a new request or a reply to indication*/
+ ql_mcm_voice_ussd_encoding_type_t encoding; /**< USSD encoding.*/
+ char ussd_string[QL_MCM_MAX_USSD_LENGTH + 1]; /**< USSD string.*/
+} ql_mcm_voice_ussd_info_t; /* Message */
+
+
+typedef enum
+{
+ E_QL_MCM_SIMRIL_CHANGE_CALL_BARRING_PWD_REASON_ALLOUTGOING = 0, /**< All outgoing. */
+ E_QL_MCM_SIMRIL_CHANGE_CALL_BARRING_PWD_REASON_OUTGOINGINT = 1, /**< Outgoing internal. */
+ E_QL_MCM_SIMRIL_CHANGE_CALL_BARRING_PWD_REASON_OUTGOINGINTEXTOHOME = 2, /**< Outgoing external to home. */
+ E_QL_MCM_SIMRIL_CHANGE_CALL_BARRING_PWD_REASON_ALLINCOMING = 3, /**< All incoming. */
+ E_QL_MCM_SIMRIL_CHANGE_CALL_BARRING_PWD_REASON_INCOMINGROAMING = 4, /**< Roaming incoming. */
+ E_QL_MCM_SIMRIL_CHANGE_CALL_BARRING_PWD_REASON_ALLBARRING = 5, /**< All calls are barred. */
+ E_QL_MCM_SIMRIL_CHANGE_CALL_BARRING_PWD_REASON_ALLOUTGOINGBARRING = 6, /**< All outgoing calls are barred. */
+ E_QL_MCM_SIMRIL_CHANGE_CALL_BARRING_PWD_REASON_ALLINCOMINGBARRING = 7, /**< All incoming calls are barred. */
+} ql_mcm_change_call_barring_pwd_reason_t;
+
+typedef struct
+{
+ ql_mcm_change_call_barring_pwd_reason_t reason; /**< Reason for the password change. Refer to 3GPP TS 27.007 @xhyperref{S8,[S8]}, Section 7.4.*/
+ char old_pwd[QL_MCM_MAX_PASSWORD_LENGTH + 1];
+ char new_pwd[QL_MCM_MAX_PASSWORD_LENGTH + 1];
+} ql_mcm_change_call_barring_pwd_info_t; /* Message */
+
+
+typedef enum
+{
+ E_QL_MCM_SIMRIL_E911_UNKNOWN = -1, /**< E911 unknown. */
+ E_QL_MCM_SIMRIL_E911_INACTIVE = 0, /**< E911 INACTIVE. */
+ E_QL_MCM_SIMRIL_E911_ACTIVE = 1, /**< E911 ACTIVE. */
+} ql_mcm_simril_e911_state_t;
+
+typedef ql_mcm_voice_call_state_t E_QL_VOICE_CALL_STATE_T;
+
+typedef enum
+{
+ E_QL_MCM_ECALL_TEST = 0x01,
+ E_QL_MCM_ECALL_EMERGENCY = 0x02,
+ E_QL_MCM_ECALL_RECONFIG = 0x03,
+} E_QL_MCM_ECALL_VARIANT_T;
+
+typedef enum
+{
+ E_QL_MCM_VOICE_AUTO_ANSWER_ENABLE = 0, /**< Enable auto-answer. */
+ E_QL_MCM_VOICE_AUTO_ANSWER_DISABLE = 1, /**< Disable auto-answer. */
+} E_QL_MCM_VOICE_AUTO_ANSWER_T;
+
+
+//Laurence.yin-2018/04/03-QCM9XOL00004C011-P02, <[MCM-ECALL] : add ecall status ind info.>
+typedef enum
+{
+ E_QL_MCM_VOICE_UNKOWN_IND = 0,
+ E_QL_MCM_VOICE_CALL_IND,
+ E_QL_MCM_VOICE_ECALL_STATUE_IND,
+ E_QL_MCM_VOICE_ECALL_URC_IND,
+ E_QL_MCM_VOICE_ECALL_EVENT_IND,
+
+} E_QL_MCM_VOICE_IND_T;
+
+typedef enum
+{
+ E_QL_MCM_VOICE_ECALL_MSD_TRANSMISSION_STATUS_SUCCESS = 0x00, /**< Success \n */
+ E_QL_MCM_VOICE_ECALL_MSD_TRANSMISSION_STATUS_FAILURE = 0x01, /**< Generic failure */
+} E_QL_MCM_EALL_MSD_TRANSMISSION_STATUS_T;
+
+typedef enum
+{
+ E_QL_MCM_VOICE_ECALL_INACTIVE = 0,
+ E_QL_MCM_VOICE_ECALL_ORIGINATING_CALL = 1,
+ E_QL_MCM_VOICE_ECALL_IN_CALL_TRANSMITTING = 2, /**< ECALL APP TRANSMITTING */
+ E_QL_MCM_VOICE_ECALL_WATING_FOR_AL_ACK = 3,
+ E_QL_MCM_VOICE_ECALL_IN_CALL = 4,
+ E_QL_MCM_VOICE_ECALL_IDLE_ALLOW_MT_ECALL = 5,
+} E_QL_MCM_ECALL_STATE_T;
+
+typedef enum
+{
+ E_QL_MCM_VOICE_ECALL_MODE_NOMAL = 0,
+ E_QL_MCM_VOICE_ECALL_MODE_ONLY = 1,
+ E_QL_MCM_VOICE_ECALL_MODE_DEFAULT = 2
+} E_QL_MCM_ECALL_MODE_T;
+
+typedef enum
+{
+ E_QL_MCM_VOICE_ECALL_CONFIG_ENABLE = 0,
+ E_QL_MCM_VOICE_ECALL_CONFIG_VIOCECONF,
+ E_QL_MCM_VOICE_ECALL_CONFIG_MODE,
+ E_QL_MCM_VOICE_ECALL_CONFIG_PROCESSINFO,
+ E_QL_MCM_VOICE_ECALL_CONFIG_START_TIMER,
+ E_QL_MCM_VOICE_ECALL_CONFIG_HACK_TIMER,
+ E_QL_MCM_VOICE_ECALL_CONFIG_MSD_TRANSMISSION,
+ E_QL_MCM_VOICE_ECALL_CONFIG_MO_FAILR_REDIAL,
+ E_QL_MCM_VOICE_ECALL_CONFIG_DROP_REDIAL
+} E_QL_MCM_ECALL_CONFIG_T;
+
+typedef struct
+{
+ char ecall_msd[QL_MCM_MAX_ECALL_MSD]; //max msd length 140
+ uint32_t msd_len;
+ int manual;
+ E_QL_MCM_ECALL_VARIANT_T eCallModeType;
+} ql_mcm_ecall_info;
+
+typedef struct
+{
+ uint8_t enable; /* Enable or disable ecall ;0 -- Disable; 1 -- Enable */
+ uint8_t voiceconfig; /* Enable or disable to mute IVS speaker in MSD
+ 0 -- Disable to mute IVS speaker automatical in MSD transmission
+ 1 -- Enable to mute IVS speaker automatical in MSD transmission */
+ E_QL_MCM_ECALL_MODE_T ecallmode; /* The Ecall mode. */
+ uint8_t processinfo; /* Enable or disable to report ecall event info. 0 -- Disable; 1 -- Enable */
+ uint8_t T5; /* The timer of IVS waiting for "START". */
+ uint8_t T6; /* The timer of IVS waiting for "HACK". */
+ uint8_t T7; /* The timer of MSD transmission. */
+ uint8_t mofailredial; /* The dial fail times. */
+ uint8_t dropredial;
+} ql_mcm_ecall_config_info;
+
+
+typedef struct
+{
+ uint8_t call_id; /**< call_id.*/
+ uint8_t ecall_msd_tx_status_valid;
+ E_QL_MCM_EALL_MSD_TRANSMISSION_STATUS_T ecall_msd_tx_status;
+} ql_mcm_voice_ecall_status_t; /* Message */
+
+typedef struct
+{
+ uint8_t call_id; /**< call_id.*/
+ uint32_t ecall_urc_event_len; /**< Must be set to # of elements in ecall_urc_event */
+ char ecall_urc_event[QL_MCM_MAX_ECALL_URC_EVENT_LENGTH];
+} ql_mcm_voice_ecall_urc_t;
+
+typedef enum
+{
+ E_QL_MCM_VOICE_ECALL_EVENT_FAIL_START_TIMEOUT = 1, /**< Wait for START timeout. */
+ E_QL_MCM_VOICE_ECALL_EVENT_FAIL_HACK_TIMEOUT = 2, /**< Wait for HACK timeout. */
+ E_QL_MCM_VOICE_ECALL_EVENT_FAIL_MSD_TRANSMISSION_TIMEOUT = 3, /**< MSD transmission timeout. */
+ E_QL_MCM_VOICE_ECALL_EVENT_FAIL_IVS_RESET_TIMEOUT = 4 /**< IVS reset. */
+} E_QL_MCM_VOICE_ECALL_EVENT_FAIL_T;
+
+typedef enum
+{
+ E_QL_MCM_VOICE_ECALL_EVENT_PROCESS_IVS_START_RECEIVED_MSD = 1, /**< IVS Link Layer receives START message and starts to send MSD */
+ E_QL_MCM_VOICE_ECALL_EVENT_PROCESS_IVS_NACK_RECEIVED = 2, /**< IVS Link Layer receives NACK message. */
+ E_QL_MCM_VOICE_ECALL_EVENT_PROCESS_IVS_ACK_RECEIVED = 3, /**< IVS Link Layer receives the first LACK message. */
+ E_QL_MCM_VOICE_ECALL_EVENT_PROCESS_IVS_TX_COMPLETED = 4, /**< IVS MSD transmission is complete. */
+ E_QL_MCM_VOICE_ECALL_EVENT_PROCESS_IVS_HLACK_RECEIVED = 5 /**< IVS Link Layer receives first HACK message. */
+} E_QL_MCM_VOICE_ECALL_EVENT_PROCESS_T;
+
+typedef enum
+{
+ E_QL_MCM_VOICE_ECALL_EVENT_MSDUPDATE_IVS_UPDATING_MSD = 0, /**< Indicates MSD has been updated. */
+ E_QL_MCM_VOICE_ECALL_EVENT_MSDUPDATE_PSAP_REQURE_UPDATE_MSD = 1, /**< Indicate timeout of updating MSD and module starts to transfer the old MSD. */
+ E_QL_MCM_VOICE_ECALL_EVENT_MSDUPDATE_IVS_UPDATE_MSD_TIMEOUT = 2 /**< Indicate to update MSD in 5 seconds. */
+} E_QL_MCM_VOICE_ECALL_EVENT_MSDUPDATE_T;
+
+typedef enum
+{
+ E_QL_MCM_VOICE_ECALL_EVENT_ECALL_ESTABLISHNG_SUCCESS = 0, /**< Establish eCall successfully. */
+ E_QL_MCM_VOICE_ECALL_EVENT_ECALL_ESTABLISHNG_FAIL = 1 /**< Establish eCall fails. */
+} E_QL_MCM_VOICE_ECALL_EVENT_ESTABLISH_T;
+
+typedef struct
+{
+ uint16_t hack_code; /**< psap hack code.*/
+} ql_mcm_voice_ecall_event_hackcode_t; /* Type */
+
+typedef struct
+{
+ uint8_t ori_remainder_times; /**< originate fail remainder times*/
+ uint16_t time; /**< the minimum time duration between the previous call attempt*/
+} ql_mcm_voice_ecall_event_originate_fail_and_redial_t; /* Type */
+
+typedef struct
+{
+ uint8_t drop_remainder_times; /**< dorp remainder times*/
+ uint16_t time; /**< the minimum time duration between the previous call attempt*/
+} ql_mcm_voice_ecall_event_drop_and_redial_t; /* Type */
+
+
+typedef struct
+{
+ uint8_t ecall_event_fails_valid;
+ E_QL_MCM_VOICE_ECALL_EVENT_FAIL_T ecall_event_fails; /**< event of eCall Failed.*/
+ uint8_t ecall_event_process_valid;
+ E_QL_MCM_VOICE_ECALL_EVENT_PROCESS_T ecall_event_process; /**< event of eCall process.*/
+ uint8_t ecall_event_msdupdate_valid;
+ E_QL_MCM_VOICE_ECALL_EVENT_MSDUPDATE_T ecall_event_msdupdate; /**< event of ecall msd update.*/
+ uint8_t ecall_event_establish_valid;
+ E_QL_MCM_VOICE_ECALL_EVENT_ESTABLISH_T ecall_event_establish; /**< event of eCall establish.*/
+ uint8_t ecall_event_hackcode_valid;
+ ql_mcm_voice_ecall_event_hackcode_t ecall_event_hackcode; /**< event of eCall hack code.*/
+ uint8_t ecall_event_ori_redial_valid;
+ ql_mcm_voice_ecall_event_originate_fail_and_redial_t ecall_event_ori_redial; /**< event of originate fail and redial.*/
+ uint8_t ecall_event_drop_redial_valid;
+ ql_mcm_voice_ecall_event_drop_and_redial_t ecall_event_drop_redial; /**< event of drop and redial.*/
+} ql_mcm_voice_ecall_event_t; /* Message */
+
+
+typedef ql_mcm_voice_calls_state_t ql_mcm_voice_call_ind;
+typedef ql_mcm_voice_ecall_status_t ql_mcm_voice_ecall_status_ind;
+typedef ql_mcm_voice_ecall_urc_t ql_mcm_voice_ecall_urc_ind;
+typedef ql_mcm_voice_ecall_event_t ql_mcm_voice_ecall_event_ind;
+
+
+
+
+/* Callback function registered via QL_Voice_Call_AddStateHandler;
+ This will be called if any stated changed of call_id
+*/
+typedef void (*QL_VoiceCall_CommonStateHandlerFunc_t)
+(
+ unsigned long message_id,
+ void *ind_data,
+ uint32_t ind_data_len
+);
+
+
+typedef uint32 voice_client_handle_type;
+
+/* Callback function registered via QL_Voice_Call_AddStateHandler;
+ This will be called if any stated changed of call_id
+*/
+typedef void (*QL_VoiceCall_StateHandlerFunc_t)
+(
+ int call_id,
+ char* phone_num,
+ E_QL_VOICE_CALL_STATE_T state,
+ void *contextPtr
+);
+
+/* Init voice module and return h_voice, this should be called before any other APIs */
+int QL_Voice_Call_Client_Init(voice_client_handle_type *ph_voice);
+
+/* DeInit voice module and release resources, this should be called at last */
+int QL_Voice_Call_Client_Deinit(voice_client_handle_type h_voice);
+
+/* Add callback function, if any call state changed, handlerPtr will be called to notify App */
+int QL_Voice_Call_AddStateHandler(voice_client_handle_type h_voice,
+ QL_VoiceCall_StateHandlerFunc_t handlerPtr,
+ void* contextPtr);
+
+/* Remove callback function, won't receive any notify anymore */
+int QL_Voice_Call_RemoveStateHandler(voice_client_handle_type h_voice);
+
+//Laurence.yin-2018/04/03-QCM9XOL00004C011-P02, <[MCM-ECALL] : add ecall status ind info.>
+/* Add callback function, if any call state changed, handlerPtr will be called to notify App */
+int QL_Voice_Call_AddCommonStateHandler(voice_client_handle_type h_voice,
+ QL_VoiceCall_CommonStateHandlerFunc_t handlerPtr);
+
+/* Remove callback function, won't receive any notify anymore */
+int QL_Voice_Call_RemoveCommonStateHandler(voice_client_handle_type h_voice);
+
+
+/* Start call and return call_id, this can be used in the later */
+int QL_Voice_Call_Start(voice_client_handle_type h_voice,
+ E_QL_VCALL_ID_T simId,
+ char* phone_number, ///< [IN] Destination identifier for the voice
+ int *call_id); ///< [OUT] call id
+
+/* End call of call_id, which returned by QL_Voice_Call_Start or callback func register via QL_Voice_Call_AddStateHandler */
+int QL_Voice_Call_End( voice_client_handle_type h_voice,
+ int call_id); ///< [IN] call id, return by QL_Voice_Start
+
+/* Answer the call of call_id, which returned by callback func register via QL_Voice_Call_AddStateHandler */
+int QL_Voice_Call_Answer(voice_client_handle_type h_voice,
+ int call_id );
+
+int QL_Voice_Call_Hold( voice_client_handle_type h_voice);
+
+int QL_Voice_Call_UnHold( voice_client_handle_type h_voice);
+
+int QL_Voice_Call_Conference( voice_client_handle_type h_voice);
+
+int QL_Voice_Call_EndConference( voice_client_handle_type h_voice);
+
+int QL_Voice_Call_Ecall(voice_client_handle_type h_voice,
+ E_QL_VCALL_ID_T simId,
+ char* phone_number,
+ ql_mcm_ecall_info ecall_info,
+ int *call_id);
+
+
+int QL_Voice_Call_SetAutoAnswer(voice_client_handle_type h_voice,
+ E_QL_MCM_VOICE_AUTO_ANSWER_T eAnswerType,
+ uint32_t uAnswerTime);
+
+int QL_Voice_Call_Ecall_HangUp(voice_client_handle_type h_voice);
+
+int QL_Voice_Call_Ecall_UpdateMsd(voice_client_handle_type h_voice,const char *msd,uint32_t msd_len);
+
+//Ecall Push caommand
+int QL_Voice_Call_Ecall_MsdPush(voice_client_handle_type h_voice,
+ E_QL_MCM_ECALL_STATE_T *ecall_state);
+
+//Get Ecall config info
+int QL_Voice_Call_Ecall_GetConfigInfo(voice_client_handle_type h_voice,
+ ql_mcm_ecall_config_info *ecall_config);
+
+int QL_Voice_Call_Ecall_SetConfigInfo(voice_client_handle_type h_voice,
+ E_QL_MCM_ECALL_CONFIG_T ecall_config_type,
+ uint8_t value);
+
+
+
+//Cancel dial
+int QL_Voice_Call_CancelDial( voice_client_handle_type h_voice);
+
+//VTS API
+int QL_Voice_Call_Dtmf( voice_client_handle_type h_voice,uint8_t digit,int call_id);
+
+
+int QL_Voice_Call_GetCallStatus
+(
+ int h_voice,
+ int call_id, // If call_id<0, means to get all calls state, or get specified call_id info
+ ql_mcm_voice_calls_state_t *pt_callstate
+);
+
+//Set forwarding
+int QL_Voice_Call_SetForwarding
+(
+ int h_voice,
+ E_QL_MCM_VOICE_CALL_SERVICE_T service,
+ E_QL_MCM_VOICE_CALL_FORWARDING_REASON_T reason,
+ char *number
+);
+
+//Get forwarding status
+int QL_Voice_Call_GetForwardingStatus
+(
+ int h_voice,
+ E_QL_MCM_VOICE_CALL_FORWARDING_REASON_T reason,
+ ql_mcm_voice_call_forwarding_status_list_t *pt_status
+);
+
+//Set voice call waiting
+int QL_Voice_Call_SetWaiting
+(
+ int h_voice,
+ ql_mcm_voice_call_waiting_service_t e_service
+);
+
+//Get voice call waiting status
+int QL_Voice_Call_GetWaitingStatus
+(
+ int h_voice,
+ ql_mcm_voice_call_waiting_service_t *pe_service
+);
+
+
+/*
+Usage 1 (register callback and wait for new call in, then answer):
+1, QL_Voice_Call_Client_Init
+2, QL_Voice_Call_AddStateHandler(pf_cb)
+3, wait for new call arrive, pf_cb will pass the call_id to app.
+4, QL_Voice_Call_Answer(call_id)
+5, QL_Voice_Call_End
+6, QL_Voice_Call_Client_Deinit
+
+
+Usage 2 (call out):
+1, QL_Voice_Call_Client_Init
+2, QL_Voice_Call_AddStateHandler(pf_cb)
+3, QL_Voice_Call_Start
+4, QL_Voice_Call_End
+5, QL_Voice_Call_Client_Deinit
+
+
+*/
+
+
+#endif // __QL_MCM_VOICE_H__
diff --git a/mbtk/include/ql/ql_mcm_gnss.h b/mbtk/include/ql/ql_mcm_gnss.h
new file mode 100755
index 0000000..b2ee20a
--- /dev/null
+++ b/mbtk/include/ql/ql_mcm_gnss.h
@@ -0,0 +1,414 @@
+#ifndef __QL_MCM_GPS_H__
+#define __QL_MCM_GPS_H__
+#include "mbtk_type.h"
+
+
+#define LOC_IND_LOCATION_INFO_ON (1 << 0)
+#define LOC_IND_STATUS_INFO_ON (1 << 1)
+#define LOC_IND_SV_INFO_ON (1 << 2)
+#define LOC_IND_NMEA_INFO_ON (1 << 3)
+#define LOC_IND_CAP_INFO_ON (1 << 4)
+#define LOC_IND_UTC_TIME_REQ_ON (1 << 5)
+#define LOC_IND_XTRA_DATA_REQ_ON (1 << 6)
+#define LOC_IND_AGPS_DATA_CONN_CMD_REQ_ON (1 << 7)
+#define LOC_IND_NI_NFY_USER_RESP_REQ_ON (1 << 8)
+
+typedef uint32 loc_client_handle_type;
+
+typedef enum
+{
+ E_QL_LOC_POS_MODE_STANDALONE = 0, /**< Mode for running GPS standalone (no assistance). */
+ E_QL_LOC_POS_MODE_MS_BASED = 1, /**< AGPS MS-Based mode. */
+ E_QL_LOC_POS_MODE_MS_ASSISTED = 2, /**< AGPS MS-Assisted mode. */
+}E_QL_LOC_POS_MODE_T;
+
+typedef enum
+{
+ E_QL_LOC_POS_RECURRENCE_PERIODIC = 0, /**< Receive GPS fixes on a recurring basis at a specified period. */
+ E_QL_LOC_POS_RECURRENCE_SINGLE = 1, /**< Request a single-shot GPS fix. */
+}E_QL_LOC_POS_RECURRENCE_T;
+
+typedef struct
+{
+ E_QL_LOC_POS_MODE_T mode; /* Position mode. */
+ E_QL_LOC_POS_RECURRENCE_T recurrence; /* Recurrence */
+ uint32_t min_interval; /* Minimum Interval, NMEA report frequency, 1000 means 1Hz, 100 means 10Hz */
+ uint32_t preferred_accuracy; /* Preferred Accuracy , 30m or more, the less it takes longer timer. */
+ uint32_t preferred_time; /* Preferred Time, first cold-boot may take 100s or more, hot boot may take 2s */
+}QL_LOC_POS_MODE_INFO_T;
+
+typedef enum
+{
+ E_QL_LOC_LOCATION_LAT_LONG_VALID = 0x0001, /**< GPS location has valid latitude and longitude. */
+ E_QL_LOC_LOCATION_ALTITUDE_VALID = 0x0002, /**< GPS location has a valid altitude. */
+ E_QL_LOC_LOCATION_SPEED_VALID = 0x0004, /**< GPS location has a valid speed. */
+ E_QL_LOC_LOCATION_BEARING_VALID = 0x0008, /**< GPS location has a valid bearing. */
+ E_QL_LOC_LOCATION_ACCURACY_VALID = 0x0010, /**< GPS location has valid accuracy. */
+ E_QL_LOC_LOCATION_SOURCE_INFO_VALID= 0x0020, /**< GPS location has valid source information. */
+ E_QL_LOC_LOCATION_IS_INDOOR_VALID = 0x0040, /**< GPS location has a valid "is indoor?" flag. */
+ E_QL_LOC_LOCATION_FLOOR_NUMBE_VALID= 0x0080, /**< GPS location has a valid floor number. */
+ E_QL_LOC_LOCATION_MAP_URL_VALID = 0x0100, /**< GPS location has a valid map URL. */
+ E_QL_LOC_LOCATION_MAP_INDEX_VALID = 0x0200, /**< GPS location has a valid map index. */
+}E_QL_LOC_LOCATION_VALID_FLAG;
+
+typedef enum
+{
+ E_QL_LOC_ULP_LOCATION_SOURCE_HYBRID= 0x0001, /**< Position source is ULP. */
+ E_QL_LOC_ULP_LOCATION_SOURCE_GNSS = 0x0002, /**< Position source is GNSS only. */
+}E_QL_LOC_ULP_LOCATION_SOURCE;
+
+#define QL_LOC_GPS_RAW_DATA_LEN_MAX 256 /** Raw data maximum size. */
+#define QL_LOC_GPS_LOCATION_MAP_URL_SIZE 399 /** Location map URL maximum size (used for indoor positioning). */
+#define QL_LOC_GPS_LOCATION_MAP_IDX_SIZE 16 /** Location map index maximum size (used for indoor positioning). */
+typedef struct
+{
+ uint32_t size; /**< Set to the size of mcm_gps_location_t. */
+ E_QL_LOC_LOCATION_VALID_FLAG flags; /**< Contains GPS location flags bits. */
+ E_QL_LOC_ULP_LOCATION_SOURCE position_source; /**< Provider indicator for HYBRID or GPS. */
+ double latitude; /**< Latitude in degrees. */
+ double longitude; /**< Longitude in degrees. */
+ double altitude; /**< Altitude in meters above the WGS 84 reference ellipsoid. */
+ float speed; /**< Speed in meters per second. */
+ float bearing; /**< Heading in degrees. */
+ float accuracy; /**< Expected accuracy in meters. */
+ int64_t timestamp; /**< Timestamp for the location fix in UTC million-second base. */
+ int32_t is_indoor; /**< Location is indoors. */
+ float floor_number; /**< Indicates the floor number. */
+ uint32_t raw_data_len; /**< Must be set to # of elements in raw_data */
+ uint8_t raw_data[QL_LOC_GPS_RAW_DATA_LEN_MAX]; /**< Allows the HAL to pass additional information related to the location. */
+ char map_url[QL_LOC_GPS_LOCATION_MAP_URL_SIZE + 1]; /**< Map URL. */
+ uint8_t map_index[QL_LOC_GPS_LOCATION_MAP_IDX_SIZE]; /**< Map index. */
+}QL_LOC_LOCATION_INFO_T; /* Type */
+
+typedef enum
+{
+ E_QL_LOC_STATUS_NONE = 0, /**< GPS status unknown. */
+ E_QL_LOC_STATUS_SESSION_BEGIN = 1, /**< GPS has begun navigating. */
+ E_QL_LOC_STATUS_SESSION_END = 2, /**< GPS has stopped navigating. */
+ E_QL_LOC_STATUS_ENGINE_ON = 3, /**< GPS has powered on but is not navigating. */
+ E_QL_LOC_STATUS_ENGINE_OFF = 4, /**< GPS is powered off. */
+}E_QL_LOC_STATUS_VALUE_T;
+
+typedef struct
+{
+ uint32_t size; /**< Set to the size of mcm_gps_sv_info_t. */
+ int prn; /**< Pseudo-random number for the SV. */
+ float snr; /**< Signal-to-noise ratio. */
+ float elevation; /**< Elevation of the SV in degrees. */
+ float azimuth; /**< Azimuth of the SV in degrees. */
+}QL_LOC_SV_INFO_T; /* Type */
+
+#define QL_LOC_GPS_SUPPORT_SVS_MAX 32 /** Maximum number of satellites in view. */
+typedef struct
+{
+ uint32_t size; /**< Set to the size of mcm_gps_sv_status_t. */
+ int num_svs; /**< Number of SVs currently visible. */
+ QL_LOC_SV_INFO_T sv_list[QL_LOC_GPS_SUPPORT_SVS_MAX]; /**< Contains an array of SV information. */
+ uint32_t ephemeris_mask; /**< Bitmask indicating which SVs have ephemeris data. */
+ uint32_t almanac_mask; /**< Bitmask indicating which SVs have almanac data. */
+ uint32_t used_in_fix_mask; /**< Bitmask indicating which SVs were used for computing the most recent position fix. */
+}QL_LOC_SV_STATUS_T; /* Type */
+
+
+#define QL_LOC_NMEA_MAX_LENGTH 255 /** NMEA string maximum length. */
+typedef struct
+{
+ int64_t timestamp; /**< System Timestamp, marked for when got the nmea data */
+ int length; /**< NMEA string length. */
+ char nmea[QL_LOC_NMEA_MAX_LENGTH + 1]; /**< NMEA string.*/
+}QL_LOC_NMEA_INFO_T; /* Message */
+
+typedef enum
+{
+ E_QL_LOC_CAPABILITY_SCHEDULING = 0x01, /**< GPS HAL schedules fixes for GPS_POSITION_RECURRENCE_PERIODIC mode.
+ If this is not set, the framework uses \n 1000 ms for min_interval
+ and will call start() and stop() to schedule the GPS. */
+ E_QL_LOC_CAPABILITY_MSB = 0x02, /**< GPS supports MS-Based AGPS mode. */
+ E_QL_LOC_CAPABILITY_MSA = 0x04, /**< GPS supports MS-Assisted AGPS mode. */
+ E_QL_LOC_CAPABILITY_SINGLE_SHOT = 0x08, /**< GPS supports single-shot fixes. */
+ E_QL_LOC_CAPABILITY_ON_DEMAND_TIME = 0x10, /**< GPS supports on-demand time injection. */
+}E_QL_LOC_CAPABILITIES_T;
+
+
+#define QL_LOC_GPS_SSID_BUF_SIZE 32 /** Maximum SSID (Service Set Identifier) buffer size. */
+#define QL_LOC_IPV6_ADDR_LEN 16 /** IPv6 address length. */
+typedef enum
+{
+ E_QL_LOC_AGPS_TYPE_INVALID = -1, /**< Invalid. */
+ E_QL_LOC_AGPS_TYPE_ANY = 0, /**< Any. */
+ E_QL_LOC_AGPS_TYPE_SUPL = 1, /**< SUPL. */
+ E_QL_LOC_AGPS_TYPE_C2K = 2, /**< C2K. */
+ E_QL_LOC_AGPS_TYPE_WWAN_ANY = 3, /**< WWAN any. */
+ E_QL_LOC_AGPS_TYPE_WIFI = 4, /**< Wi-Fi. */
+ E_QL_LOC_AGPS_TYPE_SUPL_ES = 5, /**< SUPL_ES. */
+}E_QL_LOC_AGPS_TYPE_T;
+
+typedef enum
+{
+ E_QL_LOC_REQUEST_AGPS_DATA_CONN = 1, /**< GPS requests a data connection for AGPS. */
+ E_QL_LOC_RELEASE_AGPS_DATA_CONN = 2, /**< GPS releases the AGPS data connection. */
+ E_QL_LOC_AGPS_DATA_CONNECTED = 3, /**< AGPS data connection is initiated */
+ E_QL_LOC_AGPS_DATA_CONN_DONE = 4, /**< AGPS data connection is completed. */
+ E_QL_LOC_AGPS_DATA_CONN_FAILED = 5, /**< AGPS data connection failed. */
+}E_QL_LOC_AGPS_STATUS_VALUE_T;
+
+typedef struct
+{
+ uint32_t size; /**< Set to the size of mcm_agps_status_t. */
+ E_QL_LOC_AGPS_TYPE_T type; /**< Type. */
+ E_QL_LOC_AGPS_STATUS_VALUE_T status; /**< Status. */
+ int ipv4_addr; /**< IPv4 address. */
+ char ipv6_addr[QL_LOC_IPV6_ADDR_LEN + 1]; /**< IPv6 address. */
+ char ssid[QL_LOC_GPS_SSID_BUF_SIZE + 1]; /**< SSID. */
+ char password[QL_LOC_GPS_SSID_BUF_SIZE + 1]; /**< Password. */
+}QL_LOC_AGPS_STATUS_T;
+
+
+#define QL_LOC_NI_SHORT_STRING_MAXLEN 255 /** NI short string maximum length. */
+#define QL_LOC_NI_LONG_STRING_MAXLEN 2047 /** NI long string maximum length. */
+typedef enum
+{
+ E_QL_LOC_NI_TYPE_VOICE = 1, /**< Voice. */
+ E_QL_LOC_NI_TYPE_UMTS_SUPL = 2, /**< UMTS SUPL. */
+ E_QL_LOC_NI_TYPE_UMTS_CTRL_PLANE= 3, /**< UMTS control plane. */
+}E_QL_LOC_NI_TYPE_T;
+
+typedef enum
+{
+ E_QL_LOC_NI_NEED_NOTIFY = 0x0001, /**< NI requires notification. */
+ E_QL_LOC_NI_NEED_VERIFY = 0x0002, /**< NI requires verification. */
+ E_QL_LOC_NI_PRIVACY_OVERRIDE = 0x0004, /**< NI requires privacy override; no notification/minimal trace. */
+}E_QL_LOC_NI_NOTIFY_FLAGS_T;
+
+typedef enum
+{
+ E_QL_LOC_NI_RESPONSE_ACCEPT = 1, /**< Accept. */
+ E_QL_LOC_NI_RESPONSE_DENY = 2, /**< Deny. */
+ E_QL_LOC_NI_RESPONSE_NORESP = 3, /**< No response. */
+}E_QL_LOC_NI_USER_RESPONSE_TYPE_T;
+
+typedef enum
+{
+ E_QL_LOC_NI_ENC_NONE = 0, /**< None. */
+ E_QL_LOC_NI_ENC_SUPL_GSM_DEFAULT= 1, /**< SUPL GSM default. */
+ E_QL_LOC_NI_ENC_SUPL_UTF8 = 2, /**< SUPL UTF8. */
+ E_QL_LOC_NI_ENC_SUPL_UCS2 = 3, /**< SUPL UCS2. */
+ E_QL_LOC_NI_ENC_UNKNOWN = -1, /**< Unknown. */
+}E_QL_LOC_NI_ENC_TYPE_T;
+
+typedef struct
+{
+ uint32_t size; /**< Set to the size of mcm_gps_ni_notification_t. */
+ int notification_id; /**< An ID generated by the HAL to associate NI notifications and UI responses. */
+ E_QL_LOC_NI_TYPE_T ni_type; /**< An NI type used to distinguish different categories of NI events, such as GPS_NI_TYPE_VOICE, GPS_NI_TYPE_UMTS_SUPL, etc. */
+ E_QL_LOC_NI_NOTIFY_FLAGS_T notify_flags; /**< Notification/verification options; combinations of GpsNiNotifyFlags constants. */
+ int timeout; /**< Timeout period to wait for a user response. Set to 0 for no timeout limit. */
+ E_QL_LOC_NI_USER_RESPONSE_TYPE_T default_response; /**< Default response when the response times out. */
+ char requestor_id[QL_LOC_NI_SHORT_STRING_MAXLEN + 1]; /**< Requestor ID. */
+ char text[QL_LOC_NI_LONG_STRING_MAXLEN + 1]; /**< Notification message. It can also be used to store the client ID in some cases. */
+ E_QL_LOC_NI_ENC_TYPE_T requestor_id_encoding; /**< Client ID encoding scheme. */
+ E_QL_LOC_NI_ENC_TYPE_T text_encoding; /**< Client name encoding scheme. */
+ char extras[QL_LOC_NI_LONG_STRING_MAXLEN + 1]; /**< Pointer to extra data. Format:\n- key_1 = value_1, - key_2 = value_2 @tablebulletend */
+}QL_LOC_NI_NOTIFICATION_INTO_T;
+
+#define QL_LOC_MAX_SEVER_ADDR_LENGTH 255 /** Maximum generic server address length for the host name. */
+typedef struct
+{/** Indication Message; Indication with the reported XTRA server URLs. */
+ char server1[QL_LOC_MAX_SEVER_ADDR_LENGTH + 1]; /**< server1.*/
+ char server2[QL_LOC_MAX_SEVER_ADDR_LENGTH + 1]; /**< server2.*/
+ char server3[QL_LOC_MAX_SEVER_ADDR_LENGTH + 1]; /**< server3.*/
+}QL_LOC_XTRA_REPORT_SERVER_INTO_T;
+
+typedef enum
+{
+ E_QL_LOC_NFY_MSG_ID_STATUS_INFO = 0, /**< pv_data = &E_QL_LOC_STATUS_VALUE_T */
+ E_QL_LOC_NFY_MSG_ID_LOCATION_INFO, /**< pv_data = &QL_LOC_LOCATION_INFO_T */
+ E_QL_LOC_NFY_MSG_ID_SV_INFO, /**< pv_data = &QL_LOC_SV_STATUS_T */
+ E_QL_LOC_NFY_MSG_ID_NMEA_INFO, /**< pv_data = &QL_LOC_NMEA_INFO_T */
+ E_QL_LOC_NFY_MSG_ID_CAPABILITIES_INFO, /**< pv_data = &E_QL_LOC_CAPABILITIES_T */
+ E_QL_LOC_NFY_MSG_ID_AGPS_STATUS, /**< pv_data = &QL_LOC_AGPS_STATUS_T */
+ E_QL_LOC_NFY_MSG_ID_NI_NOTIFICATION, /**< pv_data = &QL_LOC_NI_NOTIFICATION_INTO_T */
+ E_QL_LOC_NFY_MSG_ID_XTRA_REPORT_SERVER, /**< pv_data = &QL_LOC_XTRA_REPORT_SERVER_INTO_T */
+}E_QL_LOC_NFY_MSG_ID_T;
+
+/* callback function register to QL_LOC_AddRxIndMsgHandler
+ e_msg_id: which kind of msg can be received depend on the bit_mask set in QL_LOC_Set_Indications;
+ pv_data: depend on the e_msg_id type.
+*/
+typedef void (*QL_LOC_RxIndMsgHandlerFunc_t)
+(
+ loc_client_handle_type h_loc,
+ E_QL_LOC_NFY_MSG_ID_T e_msg_id,
+ void *pv_data,
+ void *contextPtr
+);
+
+typedef enum
+{
+ E_QL_LOC_DELETE_EPHEMERIS = (1 << 0), /**< Delete ephemeris data. */
+ E_QL_LOC_DELETE_ALMANAC = (1 << 1), /**< Delete almanac data. */
+ E_QL_LOC_DELETE_POSITION = (1 << 2), /**< Delete position data. */
+ E_QL_LOC_DELETE_TIME = (1 << 3), /**< Delete time data. */
+ E_QL_LOC_DELETE_IONO = (1 << 4), /**< Delete IONO data. */
+ E_QL_LOC_DELETE_UTC = (1 << 5), /**< Delete UTC data. */
+ E_QL_LOC_DELETE_HEALTH = (1 << 6), /**< Delete health data. */
+ E_QL_LOC_DELETE_SVDIR = (1 << 7), /**< Delete SVDIR data. */
+ E_QL_LOC_DELETE_SVSTEER = (1 << 8), /**< Delete SVSTEER data. */
+ E_QL_LOC_DELETE_SADATA = (1 << 9), /**< Delete SA data. */
+ E_QL_LOC_DELETE_RTI = (1 << 10), /**< Delete RTI data. */
+ E_QL_LOC_DELETE_CELLDB_INFO = (1 << 11), /**< Delete cell DB information. */
+ E_QL_LOC_DELETE_ALMANAC_CORR = (1 << 12), /**< Delete almanac correction data. */
+ E_QL_LOC_DELETE_FREQ_BIAS_EST = (1 << 13), /**< Delete frequency bias estimate. */
+ E_QL_LOC_DELETE_EPHEMERIS_GLO = (1 << 14), /**< Delete ephemeris GLO data. */
+ E_QL_LOC_DELETE_ALMANAC_GLO = (1 << 15), /**< Delete almanac GLO data. */
+ E_QL_LOC_DELETE_SVDIR_GLO = (1 << 16), /**< Delete SVDIR GLO data. */
+ E_QL_LOC_DELETE_SVSTEER_GLO = (1 << 17), /**< Delete SVSTEER GLO data. */
+ E_QL_LOC_DELETE_ALMANAC_CORR_GLO= (1 << 18), /**< Delete almanac correction GLO data. */
+ E_QL_LOC_DELETE_TIME_GPS = (1 << 19), /**< Delete time GPS data. */
+ E_QL_LOC_DELETE_TIME_GLO = (1 << 20), /**< Delete time GLO data. */
+ E_QL_LOC_DELETE_ALL = 0xFFFFFFFF, /**< Delete all location data. */
+}E_QL_LOC_DELETE_AIDING_DATA_TYPE_T;
+
+typedef struct
+{
+ int64_t time; /**< Inject time.*/
+ int64_t time_reference; /**< Time reference.*/
+ int32_t uncertainty; /**< Uncertainty.*/
+}QL_LOC_INJECT_TIME_INTO_T; /* Message */
+
+typedef struct
+{
+ double latitude; /**< Latitude.*/
+ double longitude; /**< Longitude.*/
+ float accuracy; /**< Accuracy.*/
+}QL_LOC_INJECT_LOCATION_INTO_T;
+
+typedef enum
+{
+ E_QL_LOC_AGPS_APN_BEARER_INVALID= -1, /**< Invalid. */
+ E_QL_LOC_AGPS_APN_BEARER_IPV4 = 0, /**< IPv4. */
+ E_QL_LOC_AGPS_APN_BEARER_IPV6 = 1, /**< IPv6. */
+ E_QL_LOC_AGPS_APN_BEARER_IPV4V6 = 2, /**< IPv4/v6. */
+}E_QL_LOC_AGPS_APN_BEARER_TYPE_T;
+
+#define QL_LOC_APN_NAME_LENGTH_MAX 100
+typedef struct
+{
+ E_QL_LOC_AGPS_TYPE_T e_agps_type; /**< AGPS type.*/
+ char apn[QL_LOC_APN_NAME_LENGTH_MAX + 1];/**< APN.*/
+ E_QL_LOC_AGPS_APN_BEARER_TYPE_T e_bearer_type; /**< Bearer type.*/
+}QL_LOC_AGPS_DATA_CONN_OPEN_INTO_T;
+
+#define QL_LOC_SEVER_ADDR_LENGTH_MAX 255
+typedef struct
+{
+ E_QL_LOC_AGPS_TYPE_T e_agps_type; /**< AGPS type.*/
+ char host_name[QL_LOC_SEVER_ADDR_LENGTH_MAX + 1];/**< Host name.*/
+ uint32_t port; /**< Port.*/
+}QL_LOC_AGPS_SERVER_INTO_T;
+
+typedef struct
+{
+ int32_t notify_id; /**< Notification ID.*/
+ E_QL_LOC_NI_USER_RESPONSE_TYPE_T user_resp; /**< User response.*/
+}QL_LOC_NI_RESPONSE_INTO_T;
+
+
+
+/* Add callback function if anything changed specified by the mask in QL_LOC_Set_Indications*/
+int QL_LOC_AddRxIndMsgHandler(QL_LOC_RxIndMsgHandlerFunc_t handlerPtr, void* contextPtr);
+
+/* Set what we want callbacks for, for the detail mean of bit_mask, please refer to the macro of LOC_IND_xxxxx_INFO_ON */
+int QL_LOC_Set_Indications(loc_client_handle_type h_loc, int bit_mask);
+
+/* Set GPS position mode, detail info please refer to QL_LOC_POS_MODE_INFO_T */
+int QL_LOC_Set_Position_Mode(loc_client_handle_type h_loc, QL_LOC_POS_MODE_INFO_T *pt_mode);
+
+/* Start navigation, same as AT+QGPS=1, NMEA port start outputing nmea data */
+int QL_LOC_Start_Navigation(loc_client_handle_type h_loc);
+
+/* Stop navigation, same as AT+QGPSEND, NMEA port stop outputing nmea data */
+int QL_LOC_Stop_Navigation(loc_client_handle_type h_loc);
+
+/* Set up GPS connection and start getting coordinates , this api will call QL_LOC_Start_Navigation inside first,
+ then wait for LOC_IND_LOCATION_INFO_ON event happen, if timeout, it will use last time stored loc_info.
+ If got this event, location infor will save to pt_loc_info and call QL_LOC_Stop_Navigation stop and exit. */
+int QL_LOC_Get_Current_Location(loc_client_handle_type h_loc, QL_LOC_LOCATION_INFO_T *pt_loc_info, int timeout_sec);
+
+/* Init LOC module and return the h_loc, this should be called before any other QL_LOC_xxx api. */
+int QL_LOC_Client_Init(loc_client_handle_type *ph_loc);
+
+/* DeInit LOC module and release resource, this should be called at last. */
+int QL_LOC_Client_Deinit(loc_client_handle_type h_loc);
+
+/* Deletes location-aiding data. */
+int QL_LOC_Delete_Aiding_Data( loc_client_handle_type h_loc,
+ E_QL_LOC_DELETE_AIDING_DATA_TYPE_T flags);
+
+/* Injects time. */
+int QL_LOC_InjectTime( loc_client_handle_type h_loc,
+ QL_LOC_INJECT_TIME_INTO_T *pt_info);
+
+/* Injects Location. */
+int QL_LOC_InjectLocation( loc_client_handle_type h_loc,
+ QL_LOC_INJECT_LOCATION_INTO_T *pt_info);
+
+/** Injects XTRA data.
+ Since the IPC mechanism puts a limit on the size of the data transferable in one message at 64 KB,
+ the application using this command must break the data down into chunks of a smaller size and repeatedly
+ call this API until all the data has been injected. */
+int QL_LOC_Xtra_InjectData(loc_client_handle_type h_loc,
+ char *data,
+ int length); // QL_LOC_XTRA_FILE_DATA_SIZE_MAX
+
+#define QL_LOC_XTRA_FILE_DATA_SIZE_MAX 0xFC00
+/* Injects xtra data via file name. */
+int QL_LOC_Xtra_InjectFile( loc_client_handle_type h_loc,
+ char *filename);
+
+/** Indicates that the AGPS data connection is open. */
+int QL_LOC_Agps_DataConnOpen( loc_client_handle_type h_loc,
+ QL_LOC_AGPS_DATA_CONN_OPEN_INTO_T *pt_info);
+
+/** Indicates that the AGPS data connection is closed. */
+int QL_LOC_Agps_DataConnClose(loc_client_handle_type h_loc,
+ E_QL_LOC_AGPS_TYPE_T atype);
+
+/** Indicates that the AGPS data connection failed to start. */
+int QL_LOC_Agps_NfyDataConnFailed(loc_client_handle_type h_loc,
+ E_QL_LOC_AGPS_TYPE_T atype);
+
+/** Set AGPS server infor. */
+int QL_LOC_Agps_SetServer(loc_client_handle_type h_loc,
+ QL_LOC_AGPS_SERVER_INTO_T *pt_info);
+
+/** Sends a user response for NI. */
+int QL_LOC_NI_SetResponse(loc_client_handle_type h_loc,
+ QL_LOC_NI_RESPONSE_INTO_T *pt_info);
+
+/** Updates the network availability status. */
+int QL_LOC_Agps_UpdateNWAvailability(loc_client_handle_type h_loc,
+ int available,
+ const char *apn);
+
+/*
+Usage 1 (Normally use):
+1, QL_LOC_Client_Init
+2, QL_LOC_AddRxIndMsgHandler(pf_cb)
+3, QL_LOC_Set_Indications
+4, QL_LOC_Start_Navigation
+5, handle the events in pf_cb
+6, QL_LOC_Stop_Navigation
+7, QL_LOC_Client_Deinit
+
+
+Usage 2 (Just get position once):
+1, QL_LOC_Client_Init
+2, QL_LOC_AddRxIndMsgHandler(pf_cb) ---- This can be omitted!
+3, QL_LOC_Set_Indications, set bit_mask=LOC_IND_LOCATION_INFO_ON
+4, QL_LOC_Get_Current_Location, if not timeout, it will return current position infor or use last stored one.
+7, QL_LOC_Client_Deinit
+*/
+
+#endif // __QL_MCM_GPS_H__
+
diff --git a/mbtk/include/ql/ql_mcm_nw.h b/mbtk/include/ql/ql_mcm_nw.h
new file mode 100755
index 0000000..3ec6d62
--- /dev/null
+++ b/mbtk/include/ql/ql_mcm_nw.h
@@ -0,0 +1,467 @@
+/**
+ *@file ql_mcm_nw.h
+ *@date 2018-02-22
+ *@author
+ *@brief
+ */
+#ifndef __QL_MCM_NW_H__
+#define __QL_MCM_NW_H__
+#include "ql_mcm.h"
+#include "mbtk_type.h"
+
+typedef uint32 nw_client_handle_type;
+
+
+#define QL_MCM_NW_MODE_NONE 0x00 /**< No network. */
+#define QL_MCM_NW_MODE_GSM 0x01 /**< Include GSM networks. */
+#define QL_MCM_NW_MODE_WCDMA 0x02 /**< Include WCDMA networks. */
+#define QL_MCM_NW_MODE_CDMA 0x04 /**< Include CDMA networks. */
+#define QL_MCM_NW_MODE_EVDO 0x08 /**< Include EVDO networks. */
+#define QL_MCM_NW_MODE_LTE 0x10 /**< Include LTE networks. */
+#define QL_MCM_NW_MODE_TDSCDMA 0x20 /**< Include TDSCDMA networks. */
+#define QL_MCM_NW_MODE_PRL 0x10000 /**< Give preference according to the preferred roaming list. */
+
+typedef enum
+{
+ E_QL_MCM_NW_ROAM_STATE_OFF = 0, /**< None, or roaming indicator off. */
+ E_QL_MCM_NW_ROAM_STATE_ON = 1 /**< Roaming indicator on. */
+}E_QL_MCM_NW_ROAM_STATE_TYPE_T;
+
+/** Configures the settings that define the MCM network interface. */
+typedef struct
+{
+ /* Configuration parameters for MCM network registration Network registration details Technology dependent network registration details */
+ uint64_t preferred_nw_mode; /**< Preferred network mode for connections; a bitmask of QL_MCM_NW_MODE_xxxx.*/
+ E_QL_MCM_NW_ROAM_STATE_TYPE_T roaming_pref; /**< Roaming preference.*/
+}QL_MCM_NW_CONFIG_INFO_T;
+
+#define QL_MCM_NW_NITZ_BUF_LEN 30
+/** Get NITZ Time information. */
+typedef struct
+{
+ //i.e.: nitz_time="18/09/19,07:40:18+32,00" format: YY/MM/DD,HH:MM:SS'+/-'TZ,daylight, Here TZ multiplied by 4.
+ char nitz_time[QL_MCM_NW_NITZ_BUF_LEN + 1];
+ uint64_t abs_time; // 0 means invalid
+ int8_t leap_sec; // 0 means invalid
+}QL_MCM_NW_NITZ_TIME_INFO_T;
+
+
+//defined for QL_MCM_NW_EventRegister
+#define NW_IND_VOICE_REG_EVENT_IND_FLAG (1 << 0) /**< msg format : QL_MCM_NW_VOICE_REG_EVENT_IND_T */
+#define NW_IND_DATA_REG_EVENT_IND_FLAG (1 << 1) /**< msg format : QL_MCM_NW_DATA_REG_EVENT_IND_T */
+#define NW_IND_SIGNAL_STRENGTH_EVENT_IND_FLAG (1 << 2) /**< msg format : QL_MCM_NW_SINGNAL_EVENT_IND_T */
+#define NW_IND_CELL_ACCESS_STATE_CHG_EVENT_IND_FLAG (1 << 3) /**< msg format : QL_MCM_NW_CELL_ACCESS_STATE_EVENT_IND_T */
+#define NW_IND_NITZ_TIME_UPDATE_EVENT_IND_FLAG (1 << 4) /**< msg format : QL_MCM_NW_NITZ_TIME_EVENT_IND_T */
+
+
+
+typedef struct
+{
+ char long_eons[512 + 1]; /**< Long EONS.*/
+ char short_eons[512 + 1]; /**< Short EONS.*/
+ char mcc[3 + 1]; /**< Mobile country code.*/
+ char mnc[3 + 1]; /**< Mobile network code.*/
+}QL_MCM_NW_OPERATOR_NAME_INFO_T;
+
+typedef enum
+{
+ E_QL_MCM_NW_NETWORK_STATUS_NONE = 0, /**< Network status not available. */
+ E_QL_MCM_NW_NETWORK_STATUS_CURRENT_SERVING = 1, /**< Current serving network. */
+ E_QL_MCM_NW_NETWORK_STATUS_PREFERRED = 2, /**< Preferred network. */
+ E_QL_MCM_NW_NETWORK_STATUS_NOT_PREFERRED = 3, /**< Not the preferred network. */
+ E_QL_MCM_NW_NETWORK_STATUS_AVAILABLE = 4, /**< Service available. */
+ E_QL_MCM_NW_NETWORK_STATUS_FORBIDDEN = 5 /**< Forbidden service. */
+}E_QL_MCM_NW_NETWORK_STATUS_TYPE_T;
+
+typedef enum
+{
+ E_QL_MCM_NW_RADIO_TECH_TD_SCDMA = 1,
+ E_QL_MCM_NW_RADIO_TECH_GSM = 2, /**< GSM; only supports voice. */
+ E_QL_MCM_NW_RADIO_TECH_HSPAP = 3, /**< HSPA+. */
+ E_QL_MCM_NW_RADIO_TECH_LTE = 4, /**< LTE. */
+ E_QL_MCM_NW_RADIO_TECH_EHRPD = 5, /**< EHRPD. */
+ E_QL_MCM_NW_RADIO_TECH_EVDO_B = 6, /**< EVDO B. */
+ E_QL_MCM_NW_RADIO_TECH_HSPA = 7, /**< HSPA. */
+ E_QL_MCM_NW_RADIO_TECH_HSUPA = 8, /**< HSUPA. */
+ E_QL_MCM_NW_RADIO_TECH_HSDPA = 9, /**< HSDPA. */
+ E_QL_MCM_NW_RADIO_TECH_EVDO_A = 10, /**< EVDO A. */
+ E_QL_MCM_NW_RADIO_TECH_EVDO_0 = 11, /**< EVDO 0. */
+ E_QL_MCM_NW_RADIO_TECH_1xRTT = 12, /**< 1xRTT. */
+ E_QL_MCM_NW_RADIO_TECH_IS95B = 13, /**< IS95B. */
+ E_QL_MCM_NW_RADIO_TECH_IS95A = 14, /**< IS95A. */
+ E_QL_MCM_NW_RADIO_TECH_UMTS = 15, /**< UMTS. */
+ E_QL_MCM_NW_RADIO_TECH_EDGE = 16, /**< EDGE. */
+ E_QL_MCM_NW_RADIO_TECH_GPRS = 17, /**< GPRS. */
+ E_QL_MCM_NW_RADIO_TECH_NONE = 18 /**< No technology selected. */
+}E_QL_MCM_NW_RADIO_TECH_TYPE_T;
+
+typedef struct
+{
+ QL_MCM_NW_OPERATOR_NAME_INFO_T operator_name; /**< Operator name.*/
+ E_QL_MCM_NW_NETWORK_STATUS_TYPE_T network_status; /**< Network status.*/
+ E_QL_MCM_NW_RADIO_TECH_TYPE_T rat; /**< Radio technology.*/
+}QL_MCM_NW_SCAN_ENTRY_INFO_T; /* Type */
+
+#define QL_MCM_NW_SCAN_LIST_MAX 40
+/** Gets the status associated with the connection of \<id\>. */
+typedef struct
+{
+ uint32_t entry_len; /**< Must be set to the number of elements in entry. */
+ QL_MCM_NW_SCAN_ENTRY_INFO_T entry[QL_MCM_NW_SCAN_LIST_MAX]; /**< Scan entry.*/
+}QL_MCM_NW_SCAN_RESULT_LIST_INFO_T; /* Message */
+
+
+typedef enum
+{
+ E_QL_MCM_NW_TECH_DOMAIN_NONE = 0, /**< None. */
+ E_QL_MCM_NW_TECH_DOMAIN_3GPP = 1, /**< 3GPP. */
+ E_QL_MCM_NW_TECH_DOMAIN_3GPP2 = 2, /**< 3GPP2. */
+}E_QL_MCM_NW_TECH_DOMAIN_TYPE_T;
+
+typedef enum
+{
+ E_QL_MCM_NW_IMSI_UNKNOWN_HLR_DENY_REASON = 1, /**< IMSI unknown in HLR. */
+ E_QL_MCM_NW_ILLEGAL_MS_DENY_REASON = 2, /**< Illegal MS. */
+ E_QL_MCM_NW_IMSI_UNKNOWN_VLR_DENY_REASON = 3, /**< IMSI unknown in VLR. */
+ E_QL_MCM_NW_IMEI_NOT_ACCEPTED_DENY_REASON = 4, /**< IMEI not accepted. */
+ E_QL_MCM_NW_ILLEGAL_ME_DENY_REASON = 5, /**< Illegal ME. */
+ E_QL_MCM_NW_PLMN_NOT_ALLOWED_DENY_REASON = 6, /**< PLMN not allowed. */
+ E_QL_MCM_NW_LA_NOT_ALLOWED_DENY_REASON = 7, /**< Location area not allowed. */
+ E_QL_MCM_NW_ROAMING_NOT_ALLOWED_LA_DENY_REASON = 8, /**< Roaming not allowed in this location area. */
+ E_QL_MCM_NW_NO_SUITABLE_CELLS_LA_DENY_REASON = 9, /**< No suitable cells in location area. */
+ E_QL_MCM_NW_NETWORK_FAILURE_DENY_REASON = 10, /**< Network failure. */
+ E_QL_MCM_NW_MAC_FAILURE_DENY_REASON = 11, /**< MAC failure. */
+ E_QL_MCM_NW_SYNCH_FAILURE_DENY_REASON = 12, /**< Sync failure. */
+ E_QL_MCM_NW_CONGESTION_DENY_REASON = 13, /**< Congestion. */
+ E_QL_MCM_NW_GSM_AUTHENTICATION_UNACCEPTABLE_DENY_REASON = 14, /**< GSM authentication unacceptable. */
+ E_QL_MCM_NW_NOT_AUTHORIZED_CSG_DENY_REASON = 15, /**< Not authorized in this CSG. */
+ E_QL_MCM_NW_SERVICE_OPTION_NOT_SUPPORTED_DENY_REASON = 16, /**< Service option not supported. */
+ E_QL_MCM_NW_REQ_SERVICE_OPTION_NOT_SUBSCRIBED_DENY_REASON = 17, /**< Requested service option not subscribed. */
+ E_QL_MCM_NW_CALL_CANNOT_BE_IDENTIFIED_DENY_REASON = 18, /**< Call cannot be identified. */
+ E_QL_MCM_NW_SEMANTICALLY_INCORRECT_MSG_DENY_REASON = 19, /**< Semantically incorrect message. */
+ E_QL_MCM_NW_INVALID_MANDATORY_INFO_DENY_REASON = 20, /**< Invalid mandatory information. */
+ E_QL_MCM_NW_MSG_TYPE_NON_EXISTENT_DENY_REASON = 21, /**< Message type non-existent or not implemented. */
+ E_QL_MCM_NW_INFO_ELEMENT_NON_EXISTENT_DENY_REASON = 22, /**< Message type not compatible with the protocol state. */
+ E_QL_MCM_NW_CONDITIONAL_IE_ERR_DENY_REASON = 23, /**< Conditional IE error. */
+ E_QL_MCM_NW_MSG_INCOMPATIBLE_PROTOCOL_STATE_DENY_REASON = 24, /**< Message not compatible with the protocol state. */
+ E_QL_MCM_NW_PROTOCOL_ERROR_DENY_REASON = 25, /**< Unspecified protocol error. */
+}E_QL_MCM_NW_DENY_REASON_TYPE_T;
+
+
+typedef enum
+{
+ E_QL_MCM_NW_SERVICE_NONE = 0x0000, /**< Not registered or no data. */
+ E_QL_MCM_NW_SERVICE_LIMITED = 0x0001, /**< Registered; emergency service only. */
+ E_QL_MCM_NW_SERVICE_FULL = 0x0002, /**< Registered, full service. */
+}E_QL_MCM_NW_SERVICE_TYPE_T;
+
+typedef struct
+{
+ E_QL_MCM_NW_TECH_DOMAIN_TYPE_T tech_domain; /**< Technology, used to determine the structure type mcm_tech: 0 -- None, 1 -- 3GPP, 2 -- 3GPP2.*/
+ E_QL_MCM_NW_RADIO_TECH_TYPE_T radio_tech; /**< Radio technology; see #mcm_nw_radio_tech_t_v01.*/
+ E_QL_MCM_NW_ROAM_STATE_TYPE_T roaming; /**< 0 -- Off, 1 -- Roaming (3GPP2 has extended values).*/
+ E_QL_MCM_NW_DENY_REASON_TYPE_T deny_reason; /**< Set when registration state is #mcm_nw_deny_reason_t_v01.*/
+ E_QL_MCM_NW_SERVICE_TYPE_T registration_state; /**< Registration state.*/
+}QL_MCM_NW_COMMON_REG_INFO_T;
+
+
+typedef struct
+{
+ E_QL_MCM_NW_TECH_DOMAIN_TYPE_T tech_domain; /**< Technology, used to determine the structure type mcm_tech: 0 -- None, 1 -- 3GPP, 2 -- 3GPP2.*/
+ E_QL_MCM_NW_RADIO_TECH_TYPE_T radio_tech; /**< Radio technology; see #mcm_nw_radio_tech_t_v01.*/
+ char mcc[3+1]; /**< Mobile country code.*/
+ char mnc[3+1]; /**< Mobile network code.*/
+ E_QL_MCM_NW_ROAM_STATE_TYPE_T roaming; /**< 0 -- Off, 1 -- Roaming (3GPP2 has extended values).*/
+ uint8_t forbidden; /**< Forbidden: 0 -- No, 1 -- Yes.*/
+ uint32_t cid; /**< Cell ID for the registered 3GPP system.*/
+ uint16_t lac; /**< Locatin area code for the registered 3GPP system.*/
+ uint16_t psc; /**< Primary scrambling code (WCDMA only); 0 -- None.*/
+ uint16_t tac; /**< Tracking area code information for LTE.*/
+}QL_MCM_NW_3GPP_REG_INFO_T;
+
+
+typedef struct
+{
+ E_QL_MCM_NW_TECH_DOMAIN_TYPE_T tech_domain; /**< Technology, used to determine structure type mcm_tech: 0 -- None, 1 -- 3GPP, 2 -- 3GPP2.*/
+ E_QL_MCM_NW_RADIO_TECH_TYPE_T radio_tech; /**< Radio technology; see #mcm_nw_radio_tech_t_v01.*/
+ char mcc[3+1]; /**< Mobile country code.*/
+ char mnc[3+1]; /**< Mobile network code.*/
+ E_QL_MCM_NW_ROAM_STATE_TYPE_T roaming; /**< Roaming status; see #mcm_nw_roam_state_t_v01.*/
+ uint8_t forbidden; /**< Forbidden: 0 -- No, 1 -- Yes.*/
+ uint8_t inPRL; /**< 0 -- Not in PRL, 1 -- In PRL.*/
+ uint8_t css; /**< Concurrent services supported: 0 -- No, 1 -- Yes.*/
+ uint16_t sid; /**< CDMA system ID.*/
+ uint16_t nid; /**< CDMA network ID.*/
+ uint16_t bsid; /**< Base station ID. @newpagetable */
+}QL_MCM_NW_3GPP2_REG_INFO_T;
+
+/** Gets the status associated with the connection of \<id\>. */
+typedef struct
+{
+ uint8_t voice_registration_valid; /**< Must be set to TRUE if voice_registration is being passed. */
+ QL_MCM_NW_COMMON_REG_INFO_T voice_registration; /**< Voice registration. */
+
+ uint8_t data_registration_valid; /**< Must be set to TRUE if data_registration is being passed. */
+ QL_MCM_NW_COMMON_REG_INFO_T data_registration; /**< Data registration. */
+
+ uint8_t voice_registration_details_3gpp_valid; /**< Must be set to TRUE if voice_registration_details_3gpp is being passed. */
+ QL_MCM_NW_3GPP_REG_INFO_T voice_registration_details_3gpp; /**< Voice registration details for 3GPP. */
+
+ uint8_t data_registration_details_3gpp_valid; /**< Must be set to TRUE if data_registration_details_3gpp is being passed. */
+ QL_MCM_NW_3GPP_REG_INFO_T data_registration_details_3gpp; /**< Data registration details for 3GPP. */
+
+ uint8_t voice_registration_details_3gpp2_valid; /**< Must be set to TRUE if voice_registration_details_3gpp2 is being passed. */
+ QL_MCM_NW_3GPP2_REG_INFO_T voice_registration_details_3gpp2; /**< Voice registration details for 3GPP2. */
+
+ uint8_t data_registration_details_3gpp2_valid; /**< Must be set to TRUE if data_registration_details_3gpp2 is being passed. */
+ QL_MCM_NW_3GPP2_REG_INFO_T data_registration_details_3gpp2; /**< Data registration details for 3GPP2. */
+}QL_MCM_NW_REG_STATUS_INFO_T;
+
+
+typedef enum
+{
+ E_QL_MCM_NW_SELECTION_AUTOMATIC = 0, /**< Automatic network selection. */
+ E_QL_MCM_NW_SELECTION_MANUAL = 1, /**< Manual network selection. */
+}E_QL_MCM_NW_SELECTION_TYPE_T;
+
+typedef struct
+{
+ E_QL_MCM_NW_SELECTION_TYPE_T nw_selection_type; /**< Network selection type. */
+ char mcc[3 + 1]; /**< Mobile country code for a manual network selection.*/
+ char mnc[3 + 1]; /**< Mobile network code for a manual network selection.*/
+ E_QL_MCM_NW_RADIO_TECH_TYPE_T rat; /**< Radio technology.*/
+}QL_MCM_NW_SELECTION_INFO_T;
+
+
+typedef struct
+{
+ int8_t rssi; /**< RSSI in dBm. Indicates received signal strength. A signed value; -125 or lower indicates no signal.*/
+}QL_MCM_NW_GSM_SIGNAL_INFO_T;
+
+
+typedef struct
+{
+ int8_t rssi; /**< RSSI in dBm. Indicates forward link pilot Ec. A signed value; -125 or lower indicates no signal.*/
+ int16_t ecio; /**< Ec/Io value representing negative 0.5 dB increments, e.g., 2 equals -1 dbm.*/
+}QL_MCM_NW_WCDMA_SIGNAL_INFO_T;
+
+typedef struct
+{
+ int8_t rssi; /**< RSSI in dBm. Indicates forward link pilot Ec. a signed value; -125 or lower indicates no signal.*/
+ int8_t rscp; /**< RSCP in dBm.*/
+ int16_t ecio; /**< Ec/Io value representing negative 0.5 dB increments, e.g., 2 equals -1 dbm.*/
+ int8_t sinr; /**< Measured SINR in dB. @newpagetable */
+}QL_MCM_NW_TDSCDMA_SIGNAL_INFO_T;
+
+typedef struct
+{
+ int8_t rssi; /**< RSSI in dBm. Indicates forward link pilot Ec. A signed value; -125 or lower indicates no signal.*/
+ int8_t rsrq; /**< RSRQ value in dB (signed integer value), as measured by L1. Range: -3 to -20 (-3 equals -3 dB, -20 equals -20 dB).*/
+ int16_t rsrp; /**< Current RSRP in dBm, as measured by L1. Range: -44 to -140 (-44 equals -44 dBm, -140 equals -140 dBm).*/
+ int16_t snr; /**< SNR level as a scaled integer in units of 0.1 dB; e.g., -16 dB has a value of -160 and 24.6 dB has a value of 246.*/
+}QL_MCM_NW_LTE_SIGNAL_INFO_T;
+
+
+typedef struct
+{
+ int8_t rssi; /**< RSSI in dBm. Indicates forward link pilot Power (AGC) + Ec/Io. A signed value; -125 or lower indicates no signal.*/
+ int16_t ecio; /**< Ec/Io value representing negative 0.5 dB increments, e.g., 2 equals -1 dbm.*/
+}QL_MCM_NW_CDMA_SIGNAL_INFO_T;
+
+typedef struct
+{
+ int8_t rssi; /**< RSSI in dBm. Indicates forward link pilot Power (AGC) + Ec/Io. A signed value; -125 or lower indicates no signal.*/
+ int16_t ecio; /**< Ec/Io value representing negative 0.5 dB increments, e.g., 2 equals -1 dbm.*/
+ int8_t sinr; /**< SINR level.*/
+ int32_t io; /**< Received IO in dBm. */
+}QL_MCM_NW_HDR_SIGNAL_INFO_T;
+
+/** Gets signal strength information. */
+typedef struct
+{
+ uint8_t gsm_sig_info_valid; /**< Must be set to TRUE if gsm_sig_info is being passed. */
+ QL_MCM_NW_GSM_SIGNAL_INFO_T gsm_sig_info; /**< GSM signal information. */
+ uint8_t wcdma_sig_info_valid; /**< Must be set to TRUE if wcdma_sig_info is being passed. */
+ QL_MCM_NW_WCDMA_SIGNAL_INFO_T wcdma_sig_info; /**< WCDMA signal information. */
+ uint8_t tdscdma_sig_info_valid; /**< Must be set to TRUE if tdscdma_sig_info is being passed. */
+ QL_MCM_NW_TDSCDMA_SIGNAL_INFO_T tdscdma_sig_info; /**< TDSCDMA signal information. */
+ uint8_t lte_sig_info_valid; /**< Must be set to TRUE if lte_sig_info is being passed. */
+ QL_MCM_NW_LTE_SIGNAL_INFO_T lte_sig_info; /**< LTE signal information. */
+ uint8_t cdma_sig_info_valid; /**< Must be set to TRUE if cdma_sig_info is being passed. */
+ QL_MCM_NW_CDMA_SIGNAL_INFO_T cdma_sig_info; /**< CDMA signal information. */
+ uint8_t hdr_sig_info_valid; /**< Must be set to TRUE if hdr_sig_info is being passed. */
+ QL_MCM_NW_HDR_SIGNAL_INFO_T hdr_sig_info; /**< HDR signal information. */
+}QL_MCM_NW_SIGNAL_STRENGTH_INFO_T;
+
+
+
+typedef enum
+{
+ E_QL_MCM_NW_CELL_ACCESS_NONE = 0x00, /**< Unknown cell access state. */
+ E_QL_MCM_NW_CELL_ACCESS_NORMAL_ONLY = 0x01, /**< Cell access is allowed for normal calls only. */
+ E_QL_MCM_NW_CELL_ACCESS_EMERGENCY_ONLY = 0x02, /**< Cell access is allowed for emergency calls only. */
+ E_QL_MCM_NW_CELL_ACCESS_NO_CALLS = 0x03, /**< Cell access is not allowed for any call type. */
+ E_QL_MCM_NW_CELL_ACCESS_ALL_CALLS = 0x04, /**< Cell access is allowed for all call types. */
+}E_QL_MCM_NW_CELL_ACCESS_STATE_TYPE_T;
+
+
+/* @bridef Callback function registered to QL_MCM_NW_AddRxMsgHandler
+ * map of ind_flag and ind_msg_buf as bellow :
+ * NW_IND_VOICE_REG_EVENT_IND_FLAG : QL_MCM_NW_VOICE_REG_EVENT_IND_T
+ * NW_IND_DATA_REG_EVENT_IND_FLAG : QL_MCM_NW_DATA_REG_EVENT_IND_T
+ * NW_IND_SIGNAL_STRENGTH_EVENT_IND_FLAG : QL_MCM_NW_SINGNAL_EVENT_IND_T
+ * NW_IND_CELL_ACCESS_STATE_CHG_EVENT_IND_FLAG : QL_MCM_NW_CELL_ACCESS_STATE_EVENT_IND_T
+ * NW_IND_NITZ_TIME_UPDATE_EVENT_IND_FLAG : QL_MCM_NW_NITZ_TIME_EVENT_IND_T
+ * */
+typedef void (*QL_MCM_NW_RxMsgHandlerFunc_t)(
+ nw_client_handle_type h_nw,
+ uint32_t ind_flag,
+ void *ind_msg_buf,
+ uint32_t ind_msg_len,
+ void *contextPtr
+);
+
+
+/** Indication message; Indication for the corresponding registered event flag NW_IND_VOICE_REG_EVENT_IND_FLAG */
+typedef struct {
+
+ uint8_t registration_valid; /**< Must be set to TRUE if voice_registration is being passed. */
+ QL_MCM_NW_COMMON_REG_INFO_T registration; /**< Voice registration. */
+
+ uint8_t registration_details_3gpp_valid; /**< Must be set to TRUE if voice_registration_details_3gpp is being passed. */
+ QL_MCM_NW_3GPP_REG_INFO_T registration_details_3gpp; /**< Voice registration details for 3GPP. */
+
+ uint8_t registration_details_3gpp2_valid; /**< Must be set to TRUE if voice_registration_details_3gpp2 is being passed. */
+ QL_MCM_NW_3GPP2_REG_INFO_T registration_details_3gpp2; /**< Voice registration details for 3GPP2. */
+}QL_MCM_NW_VOICE_REG_EVENT_IND_T;
+
+/** Indication message; Indication for the corresponding registered event flag NW_IND_DATA_REG_EVENT_IND_FLAG */
+typedef struct {
+
+ uint8_t registration_valid; /**< Must be set to TRUE if data_registration is being passed. */
+ QL_MCM_NW_COMMON_REG_INFO_T registration; /**< Data registration. */
+
+ uint8_t registration_details_3gpp_valid; /**< Must be set to TRUE if data_registration_details_3gpp is being passed. */
+ QL_MCM_NW_3GPP_REG_INFO_T registration_details_3gpp; /**< Data registration details for 3GPP. */
+
+ uint8_t registration_details_3gpp2_valid; /**< Must be set to TRUE if data_registration_details_3gpp2 is being passed. */
+ QL_MCM_NW_3GPP2_REG_INFO_T registration_details_3gpp2; /**< Data registration details for 3GPP2. */
+}QL_MCM_NW_DATA_REG_EVENT_IND_T;
+
+
+/** Indication message; Indication for the corresponding registered event flag NW_IND_SIGNAL_STRENGTH_EVENT_IND_FLAG */
+typedef struct {
+ uint8_t gsm_sig_info_valid; /**< Must be set to TRUE if gsm_sig_info is being passed. */
+ QL_MCM_NW_GSM_SIGNAL_INFO_T gsm_sig_info; /**< GSM singal information. */
+
+ uint8_t wcdma_sig_info_valid; /**< Must be set to TRUE if wcdma_sig_info is being passed. */
+ QL_MCM_NW_WCDMA_SIGNAL_INFO_T wcdma_sig_info; /**< WCDMA singal information. */
+
+ uint8_t tdscdma_sig_info_valid; /**< Must be set to TRUE if tdscdma_sig_info is being passed. */
+ QL_MCM_NW_TDSCDMA_SIGNAL_INFO_T tdscdma_sig_info; /**< TDSCDMA singal information. */
+
+ uint8_t lte_sig_info_valid; /**< Must be set to TRUE if lte_sig_info is being passed. */
+ QL_MCM_NW_LTE_SIGNAL_INFO_T lte_sig_info; /**< LTE singal information. */
+
+ uint8_t cdma_sig_info_valid; /**< Must be set to TRUE if cdma_sig_info is being passed. */
+ QL_MCM_NW_CDMA_SIGNAL_INFO_T cdma_sig_info; /**< CDMA singal information. */
+
+ uint8_t hdr_sig_info_valid; /**< Must be set to TRUE if hdr_sig_info is being passed. */
+ QL_MCM_NW_HDR_SIGNAL_INFO_T hdr_sig_info; /**< HDR singal information. */
+}QL_MCM_NW_SINGNAL_EVENT_IND_T;
+
+
+/** Indication message; Indication for a change in the cell access state, e.g., emergency only, CS call only.
+ * Indication for the corresponding registered event flag NW_IND_CELL_ACCESS_STATE_CHG_EVENT_IND_FLAG */
+typedef struct {
+ E_QL_MCM_NW_CELL_ACCESS_STATE_TYPE_T state; /**< Network cell access state. */
+}QL_MCM_NW_CELL_ACCESS_STATE_EVENT_IND_T;
+
+/** Indication Message; Indication to update NITZ time.
+ * Indication for the corresponding registered event flag NW_IND_NITZ_TIME_UPDATE_EVENT_IND_FLAG */
+typedef struct {
+ QL_MCM_NW_NITZ_TIME_INFO_T info;
+}QL_MCM_NW_NITZ_TIME_EVENT_IND_T;
+
+
+
+
+E_QL_ERROR_CODE_T QL_MCM_NW_Client_Init(nw_client_handle_type *ph_nw);
+
+E_QL_ERROR_CODE_T QL_MCM_NW_Client_Deinit(nw_client_handle_type h_nw);
+
+E_QL_ERROR_CODE_T QL_MCM_NW_SetConfig
+(
+ nw_client_handle_type h_nw,
+ QL_MCM_NW_CONFIG_INFO_T *pt_info
+);
+
+E_QL_ERROR_CODE_T QL_MCM_NW_GetConfig
+(
+ nw_client_handle_type h_nw,
+ QL_MCM_NW_CONFIG_INFO_T *pt_info
+);
+
+E_QL_ERROR_CODE_T QL_MCM_NW_GetNitzTimeInfo
+(
+ nw_client_handle_type h_nw,
+ QL_MCM_NW_NITZ_TIME_INFO_T *pt_info
+);
+
+E_QL_ERROR_CODE_T QL_MCM_NW_EventRegister
+(
+ nw_client_handle_type h_nw,
+ uint32_t bitmask // bit OR of NW_IND_xxxx_EVENT_ON
+);
+
+E_QL_ERROR_CODE_T QL_MCM_NW_GetOperatorName
+(
+ nw_client_handle_type h_nw,
+ QL_MCM_NW_OPERATOR_NAME_INFO_T *pt_info //You should malloc this or may cause stack overflow
+);
+
+E_QL_ERROR_CODE_T QL_MCM_NW_PerformScan
+(
+ nw_client_handle_type h_nw,
+ QL_MCM_NW_SCAN_RESULT_LIST_INFO_T *pt_info
+);
+
+E_QL_ERROR_CODE_T QL_MCM_NW_GetRegStatus
+(
+ nw_client_handle_type h_nw,
+ QL_MCM_NW_REG_STATUS_INFO_T *pt_info
+);
+
+E_QL_ERROR_CODE_T QL_MCM_NW_SetLowPowerMode
+(
+ nw_client_handle_type h_nw,
+ uint32_t low_power_mode_on // 0: off, other: on
+);
+
+E_QL_ERROR_CODE_T QL_MCM_NW_SetSelection
+(
+ nw_client_handle_type h_nw,
+ QL_MCM_NW_SELECTION_INFO_T *pt_info
+);
+
+E_QL_ERROR_CODE_T QL_MCM_NW_GetSignalStrength
+(
+ nw_client_handle_type h_nw,
+ QL_MCM_NW_SIGNAL_STRENGTH_INFO_T *pt_info
+);
+
+E_QL_ERROR_CODE_T QL_MCM_NW_GetCellAccessState
+(
+ nw_client_handle_type h_nw,
+ E_QL_MCM_NW_CELL_ACCESS_STATE_TYPE_T *pe_state
+);
+
+E_QL_ERROR_CODE_T QL_MCM_NW_AddRxMsgHandler
+(
+ nw_client_handle_type h_nw,
+ QL_MCM_NW_RxMsgHandlerFunc_t handlerPtr,
+ void* contextPtr
+);
+
+
+#endif//__QL_MCM_NW_H__
diff --git a/mbtk/include/ql/ql_mcm_sim.h b/mbtk/include/ql/ql_mcm_sim.h
new file mode 100755
index 0000000..4fc7b1c
--- /dev/null
+++ b/mbtk/include/ql/ql_mcm_sim.h
@@ -0,0 +1,713 @@
+/**
+ *@file ql_mcm_sim.h
+ *@date 2017-05-02
+ *@author
+ *@brief
+ */
+#ifndef __QL_MCM_SIM_H__
+#define __QL_MCM_SIM_H__
+#include "mbtk_type.h"
+
+#include "ql_mcm.h"
+
+#define QL_SIM_IMSI_LEN_MAX 16 /** Maximum length of IMSI data. */
+#define QL_SIM_ICCID_LEN_MAX 20 /** Maximum length of ICCID data. */
+
+typedef uint32 sim_client_handle_type;
+
+typedef enum
+{
+ E_QL_MCM_SIM_SLOT_ID_1 = 0xB01, /**< Identify card in slot 1. */
+ E_QL_MCM_SIM_SLOT_ID_2 = 0xB02, /**< Identify card in slot 2. */
+}E_QL_MCM_SIM_SLOT_ID_TYPE_T;
+
+typedef enum
+{
+ E_QL_MCM_SIM_APP_TYPE_UNKNOWN = 0xB00, /**< Unknown application type */
+ E_QL_MCM_SIM_APP_TYPE_3GPP = 0xB01, /**< Identify the SIM/USIM application on the card. */
+ E_QL_MCM_SIM_APP_TYPE_3GPP2 = 0xB02, /**< Identify the RUIM/CSIM application on the card. */
+ E_QL_MCM_SIM_APP_TYPE_ISIM = 0xB03, /**< Identify the ISIM application on the card. */
+}E_QL_MCM_SIM_APP_TYPE_T;
+
+typedef struct
+{
+ E_QL_MCM_SIM_SLOT_ID_TYPE_T e_slot_id; /**< Indicates the slot to be used. */
+ E_QL_MCM_SIM_APP_TYPE_T e_app; /**< Indicates the type of the application. */
+}QL_SIM_APP_ID_INFO_T; /* Type */
+
+
+#define QL_SIM_MCC_LEN 3 /** Length of the MCC. */
+#define QL_SIM_MNC_MAX 3 /** Maximum length of the MNC. */
+#define QL_SIM_PLMN_NUM_MAX 24 /** Maximum number of PLMN data sets. */
+typedef struct
+{
+ char mcc[QL_SIM_MCC_LEN]; /**< MCC value in ASCII characters.*/
+ uint32_t mnc_len; /**< Must be set to the number of elements in the MNC. */
+ char mnc[QL_SIM_MNC_MAX]; /**< MNC value in ASCII characters.*/
+}QL_SIM_PLMN_INFO_T;
+
+typedef struct
+{
+ uint32_t preferred_operator_list_len; /**< Must be set to the number of elements in preferred_operator_list. */
+ QL_SIM_PLMN_INFO_T preferred_operator_list[QL_SIM_PLMN_NUM_MAX]; /**< Preferred operator list. */
+}QL_SIM_PREFERRED_OPERATOR_LIST_T; /* Message */
+
+
+#define QL_MCM_SIM_PIN_LEN_MAX 8 /** Maximum length of PIN data. */
+typedef enum
+{
+ E_QL_MCM_SIM_PIN_ID_1 = 0xB01, /**< Level 1 user verification. */
+ E_QL_MCM_SIM_PIN_ID_2 = 0xB02, /**< Level 2 user verification. */
+}E_QL_MCM_SIM_PIN_ID_TYPE_T;
+
+typedef struct
+{
+ QL_SIM_APP_ID_INFO_T app_info; /**< Application identification information. */
+ E_QL_MCM_SIM_PIN_ID_TYPE_T pin_id; /**< PIN ID. */
+ uint32_t pin_value_len; /**< Must be set to the number of elements in pin_value. */
+ char pin_value[QL_MCM_SIM_PIN_LEN_MAX]; /* Value of the PIN */
+}QL_SIM_VERIFY_PIN_INFO_T;
+
+/** Changes the PIN value of an application. The application must pass both the
+ new and the old values of the PIN to complete the operation.
+ The same PIN can be used by multiple sessions (i.e., the PIN is shared
+ between GSM and RUIM in an ICC card). The PIN is automatically verified
+ for all the sessions when the command is executed. */
+typedef struct
+{
+ QL_SIM_APP_ID_INFO_T app_info; /**< Application identification information. */
+ E_QL_MCM_SIM_PIN_ID_TYPE_T pin_id; /**< PIN ID. */
+ uint32_t old_pin_value_len; /**< Must be set to the number of elements in old_pin_value. */
+ char old_pin_value[QL_MCM_SIM_PIN_LEN_MAX]; /**< Value of the old PIN as a sequence of ASCII characters. */
+ uint32_t new_pin_value_len; /**< Must be set to the number of elements in new_pin_value. */
+ char new_pin_value[QL_MCM_SIM_PIN_LEN_MAX]; /**< Value of the new PIN as a sequence of ASCII characters. */
+}QL_SIM_CHANGE_PIN_INFO_T;
+
+/** Unblocks a blocked PIN using the PUK code. The client must pass PUK1 to unblock PIN1 or PUK2 to unblock PIN2.
+ The same PIN can be used by multiple sessions (i.e., the PIN is shared between GSM and RUIM in an ICC card).
+ The PIN is automatically verified for all the sessions when the command is executed. */
+typedef struct
+{
+ QL_SIM_APP_ID_INFO_T app_info; /**< Application identification information. */
+ E_QL_MCM_SIM_PIN_ID_TYPE_T pin_id; /**< PIN ID. */
+ uint32_t puk_value_len; /**< Must be set to the number of elements in puk_value. */
+ char puk_value[QL_MCM_SIM_PIN_LEN_MAX]; /**< Value of the PUK as a sequence of ASCII characters. */
+ uint32_t new_pin_value_len; /**< Must be set to the number of elements in new_pin_value. */
+ char new_pin_value[QL_MCM_SIM_PIN_LEN_MAX]; /**< Value of the new PIN as a sequence of ASCII characters. */
+}QL_SIM_UNBLOCK_PIN_INFO_T;
+
+/** Enables the PIN on an application. */
+typedef QL_SIM_VERIFY_PIN_INFO_T QL_SIM_ENABLE_PIN_INFO_T; //Same
+
+/** Disables the PIN of an application, */
+typedef QL_SIM_VERIFY_PIN_INFO_T QL_SIM_DISABLE_PIN_INFO_T; //Same
+
+
+typedef enum
+{
+ E_QL_MCM_SIM_PERSO_FEATURE_TYPE_UNKNOWN = 0xB00, /**< Unknown personalization feature. */
+ E_QL_MCM_SIM_PERSO_FEATURE_TYPE_3GPP_NETWORK = 0xB01, /**< Featurization based on 3GPP MCC and MNC. */
+ E_QL_MCM_SIM_PERSO_FEATURE_TYPE_3GPP_NETWORK_SUBSET = 0xB02, /**< Featurization based on 3GPP MCC, MNC, and IMSI digits 6 and 7. */
+ E_QL_MCM_SIM_PERSO_FEATURE_TYPE_3GPP_SERVICE_PROVIDER = 0xB03, /**< Featurization based on 3GPP MCC, MNC, and GID1. */
+ E_QL_MCM_SIM_PERSO_FEATURE_TYPE_3GPP_CORPORATE = 0xB04, /**< Featurization based on 3GPP MCC, MNC, GID1, and GID2. */
+ E_QL_MCM_SIM_PERSO_FEATURE_TYPE_3GPP_SIM = 0xB05, /**< Featurization based on the 3GPP IMSI. */
+ E_QL_MCM_SIM_PERSO_FEATURE_TYPE_3GPP2_NETWORK_TYPE_1 = 0xB06, /**< Featurization based on 3GPP2 MCC and MNC. */
+ E_QL_MCM_SIM_PERSO_FEATURE_TYPE_3GPP2_NETWORK_TYPE_2 = 0xB07, /**< Featurization based on 3GPP2 IRM code. */
+ E_QL_MCM_SIM_PERSO_FEATURE_TYPE_3GPP2_RUIM = 0xB08, /**< Featurization based on 3GPP2 IMSI_M. */
+}E_QL_MCM_SIM_PERSO_FEATURE_TYPE_T;
+
+typedef enum
+{
+ E_QL_MCM_SIM_PERSO_OPERATION_DEACTIVATE = 0xB00, /**< Disable an active personalization feature. */
+ E_QL_MCM_SIM_PERSO_OPERATION_UNBLOCK = 0xB01, /**< Unblock a personalization feature that has been blocked. */
+}E_QL_MCM_SIM_PERSO_OPERATION_TYPE_T;
+
+
+#define QL_MCM_SIM_CONTROL_KEY_LEN_MAX 16 /** Maximum length of personalization control key data */
+/** Deactivates or unblocks the personalization on the phone.
+ Each feature can be deactivated/unblocked independently of the other features. */
+typedef struct
+{
+ E_QL_MCM_SIM_PERSO_FEATURE_TYPE_T e_feature_type; /**< Indicates the personalization feature to deactivate or unblock. */
+ E_QL_MCM_SIM_PERSO_OPERATION_TYPE_T e_operation; /**< Indicates the operation to perform. */
+ uint32_t ctrl_key_value_len; /**< Must be set to the number of elements in ck_value. */
+ char ctrl_key_value[QL_MCM_SIM_CONTROL_KEY_LEN_MAX];/**< Control key value. This value is a sequence of ASCII characters.*/
+}QL_MCM_SIM_DEPERSONALIZE_INFO_T; /* Type */
+
+
+typedef struct
+{
+ char mcc[5]; /**< MCC value in ASCII characters.*/
+ uint32_t mnc_len; /**< Must be set to the number of elements in the MNC. */
+ char mnc[5]; /**< MNC value in ASCII characters.*/
+}QL_MCM_SIM_NW_PERSONAL_INFO_T;
+
+typedef struct
+{
+ QL_MCM_SIM_NW_PERSONAL_INFO_T network; /**< MCC and MNC network information.*/
+ char digit6; /**< Digit 6 of the IMSI in ASCII character.*/
+ char digit7; /**< Digit 7 of the IMSI in ASCII character.*/
+}QL_MCM_SIM_NW_SUBSET_PERSONAL_INFO_T;
+
+typedef struct
+{
+ QL_MCM_SIM_NW_PERSONAL_INFO_T network; /**< MCC and MNC network information.*/
+ uint8_t gid1; /**< Service provider code found in GID1.*/
+}QL_MCM_SIM_NW_SP_PERSONAL_INFO_T;
+
+typedef struct
+{
+ QL_MCM_SIM_NW_PERSONAL_INFO_T network; /**< MCC and MNC network information.*/
+ uint8_t gid1; /**< Service provider code found in GID1.*/
+ uint8_t gid2; /**< Corporate customer code found in GID2. @newpagetable */
+}QL_MCM_SIM_GW_CORPORATE_PERSONAL_INFO_T;
+
+#define QL_MCM_SIM_MSIN_LEN_MAX 10 /** Maximum length of the MSIN. */
+typedef struct
+{
+ QL_MCM_SIM_NW_PERSONAL_INFO_T network; /**< MCC and MNC network information.*/
+ uint32_t msin_len; /**< Must be set to the number of elements in MSIN. */
+ char msin[QL_MCM_SIM_MSIN_LEN_MAX];/**< MSIN value stored on the card in ASCII characters.*/
+}QL_MCM_SIM_SIM_PERSONAL_INFO_T; /* Type */
+
+typedef struct
+{
+ char irm_code[4];/**< First 4 digits of the IRM-based MIN of IMSI_M in ASCII characters.*/
+}QL_MCM_SIM_1X_NW_TYPE2_PERSONAL_INFO_T;
+
+
+#define QL_MCM_SIM_PERSO_NUM_NW_MAX 85 /** Maximum number of network personalization data sets. */
+#define QL_MCM_SIM_PERSO_NUM_NS_MAX 64 /** Maximum number of network subset personalization data sets. */
+#define QL_MCM_SIM_PERSO_NUM_GW_SP_MAX 64 /** Maximum number of service provider personalization data sets. */
+#define QL_MCM_SIM_PERSO_NUM_GW_CP_MAX 51 /** Maximum number of corporate personalization data sets. */
+#define QL_MCM_SIM_PERSO_NUM_SIM_MAX 32 /** Maximum number of SIM personalization data sets. */
+#define QL_MCM_SIM_PERSO_NUM_1X_NW2_MAX 128 /** Maximum number of network type 2 personalization data sets. */
+
+typedef union
+{
+ QL_MCM_SIM_NW_PERSONAL_INFO_T feature_gw_network_perso[QL_MCM_SIM_PERSO_NUM_NW_MAX]; /**< GW network personalization. */
+ QL_MCM_SIM_NW_SUBSET_PERSONAL_INFO_T feature_gw_network_subset_perso[QL_MCM_SIM_PERSO_NUM_NS_MAX]; /**< GW network subset personalization. */
+ QL_MCM_SIM_NW_SP_PERSONAL_INFO_T feature_gw_sp_perso[QL_MCM_SIM_PERSO_NUM_GW_SP_MAX]; /**< GW service provider personalization. */
+ QL_MCM_SIM_GW_CORPORATE_PERSONAL_INFO_T feature_gw_corporate_perso[QL_MCM_SIM_PERSO_NUM_GW_CP_MAX]; /**< GW corporate personalization. */
+ QL_MCM_SIM_SIM_PERSONAL_INFO_T feature_gw_sim_perso[QL_MCM_SIM_PERSO_NUM_SIM_MAX]; /**< GW SIM personalization. */
+ QL_MCM_SIM_NW_PERSONAL_INFO_T feature_1x_network1_perso[QL_MCM_SIM_PERSO_NUM_NW_MAX]; /**< 1X network type 1 personalization. */
+ QL_MCM_SIM_1X_NW_TYPE2_PERSONAL_INFO_T feature_1x_network2_perso[QL_MCM_SIM_PERSO_NUM_1X_NW2_MAX]; /**< 1X network type 3 personalization. */
+ QL_MCM_SIM_SIM_PERSONAL_INFO_T feature_1x_ruim_perso[QL_MCM_SIM_PERSO_NUM_SIM_MAX]; /* 1x RUIM Personalization */
+}QL_MCM_SIM_PERSONAL_FEATURE_INFO_DATA_T;
+
+/** Request message; Activates and sets the personalization data on the phone. Each feature can be activated
+ independently of one another; however, network data configurations must be consistent across activated personalization
+ modes in order to prevent contradicting featurization, and only one feature can be activated per message.
+ If personalization is already activated, it must first be deactivated before being reactivated with new data. */
+typedef struct
+{
+ uint32_t ctrl_key_value_len; /**< Must be set to the number of elements in ctrl_key_value. */
+ char ctrl_key_value[60]; /**< Control key value. This value is a sequence of ASCII characters.*/
+ E_QL_MCM_SIM_PERSO_FEATURE_TYPE_T e_feature_type;
+ uint32_t feature_data_len; //Valid array count of t_feature_data
+ QL_MCM_SIM_PERSONAL_FEATURE_INFO_DATA_T t_feature_data;
+}QL_MCM_SIM_PERSONALIZE_FEATURE_INFO_T;
+
+
+typedef enum
+{
+ E_QL_MCM_SIM_CARD_STATE_UNKNOWN = 0xB01, /**< Card state unknown. */
+ E_QL_MCM_SIM_CARD_STATE_ABSENT = 0xB02, /**< Card is absent. */
+ E_QL_MCM_SIM_CARD_STATE_PRESENT = 0xB03, /**< Card is present. */
+ E_QL_MCM_SIM_CARD_STATE_ERROR_UNKNOWN = 0xB04, /**< Unknown error state. */
+ E_QL_MCM_SIM_CARD_STATE_ERROR_POWER_DOWN = 0xB05, /**< Power down. */
+ E_QL_MCM_SIM_CARD_STATE_ERROR_POLL_ERROR = 0xB06, /**< Poll error. */
+ E_QL_MCM_SIM_CARD_STATE_ERROR_NO_ATR_RECEIVED = 0xB07, /**< Failed to receive an answer to reset. */
+ E_QL_MCM_SIM_CARD_STATE_ERROR_VOLT_MISMATCH = 0xB08, /**< Voltage mismatch. */
+ E_QL_MCM_SIM_CARD_STATE_ERROR_PARITY_ERROR = 0xB09, /**< Parity error. */
+ E_QL_MCM_SIM_CARD_STATE_ERROR_SIM_TECHNICAL_PROBLEMS= 0xB0A, /**< Card returned technical problems. */
+}E_QL_MCM_SIM_CARD_STATE_TYPE_T; /**< Card state. */
+
+typedef enum
+{
+ E_QL_MCM_SIM_CARD_TYPE_UNKNOWN = 0xB00, /**< Unidentified card type. */
+ E_QL_MCM_SIM_CARD_TYPE_ICC = 0xB01, /**< Card of SIM or RUIM type. */
+ E_QL_MCM_SIM_CARD_TYPE_UICC = 0xB02, /**< Card of USIM or CSIM type. */
+}E_QL_MCM_SIM_CARD_TYPE_T;
+
+typedef enum
+{
+ E_QL_MCM_SIM_PROV_STATE_NONE = 0xB00, /**< Nonprovisioning. */
+ E_QL_MCM_SIM_PROV_STATE_PRI = 0xB01, /**< Primary provisioning subscription. */
+ E_QL_MCM_SIM_PROV_STATE_SEC = 0xB02, /**< Secondary provisioning subscription. */
+}QL_MCM_SIM_SUBSCRIPTION_TYPE_T;
+
+typedef enum
+{
+ E_QL_MCM_SIM_APP_STATE_UNKNOWN = 0xB00, /**< Application state unknown. */
+ E_QL_MCM_SIM_APP_STATE_DETECTED = 0xB01, /**< Detected state. */
+ E_QL_MCM_SIM_APP_STATE_PIN1_REQ = 0xB02, /**< PIN1 required. */
+ E_QL_MCM_SIM_APP_STATE_PUK1_REQ = 0xB03, /**< PUK1 required. */
+ E_QL_MCM_SIM_APP_STATE_INITALIZATING = 0xB04, /**< Initializing. */
+ E_QL_MCM_SIM_APP_STATE_PERSO_CK_REQ = 0xB05, /**< Personalization control key required. */
+ E_QL_MCM_SIM_APP_STATE_PERSO_PUK_REQ = 0xB06, /**< Personalization unblock key required. */
+ E_QL_MCM_SIM_APP_STATE_PERSO_PERMANENTLY_BLOCKED= 0xB07, /**< Personalization is permanently blocked. */
+ E_QL_MCM_SIM_APP_STATE_PIN1_PERM_BLOCKED = 0xB08, /**< PIN1 is permanently blocked. */
+ E_QL_MCM_SIM_APP_STATE_ILLEGAL = 0xB09, /**< Illegal application state. */
+ E_QL_MCM_SIM_APP_STATE_READY = 0xB0A, /**< Application ready state. @newpage */
+}QL_MCM_SIM_APP_STATE_TYPE_T;
+
+typedef enum
+{
+ E_QL_MCM_SIM_PIN_STATE_UNKNOWN = 0xB01, /**< Unknown PIN state. */
+ E_QL_MCM_SIM_PIN_STATE_ENABLED_NOT_VERIFIED = 0xB02, /**< PIN required, but has not been verified. */
+ E_QL_MCM_SIM_PIN_STATE_ENABLED_VERIFIED = 0xB03, /**< PIN required and has been verified. */
+ E_QL_MCM_SIM_PIN_STATE_DISABLED = 0xB04, /**< PIN not required. */
+ E_QL_MCM_SIM_PIN_STATE_BLOCKED = 0xB05, /**< PIN verification has failed too many times and is blocked. Recoverable through PUK verification. */
+ E_QL_MCM_SIM_PIN_STATE_PERMANENTLY_BLOCKED = 0xB06, /**< PUK verification has failed too many times and is not recoverable. */
+}QL_MCM_SIM_PIN_STATE_TYPE_T;
+
+typedef struct
+{
+ QL_MCM_SIM_SUBSCRIPTION_TYPE_T subscription; /**< Type of subscription (i.e., primary, secondary, etc.). */
+ QL_MCM_SIM_APP_STATE_TYPE_T app_state; /**< Current state of the application. */
+ E_QL_MCM_SIM_PERSO_FEATURE_TYPE_T perso_feature; /**< Current personalization state and feature enabled. */
+ uint8_t perso_retries; /**< Number of personalization retries. */
+ uint8_t perso_unblock_retries; /**< Number of personalization unblock retries. */
+ QL_MCM_SIM_PIN_STATE_TYPE_T pin1_state; /**< Current PIN 1 state. */
+ uint8_t pin1_num_retries; /**< Number of PIN 1 retries. */
+ uint8_t puk1_num_retries; /**< Number of PUK 1 retries. */
+ QL_MCM_SIM_PIN_STATE_TYPE_T pin2_state; /**< Current PIN 2 state. */
+ uint8_t pin2_num_retries; /**< Number of PIN 2 retries. */
+ uint8_t puk2_num_retries; /**< Number of PUK 2 retries. */
+}QL_MCM_SIM_CARD_APP_INFO_T;
+
+typedef struct
+{
+ QL_MCM_SIM_CARD_APP_INFO_T app_3gpp; /**< Stores 3GPP application information. */
+ QL_MCM_SIM_CARD_APP_INFO_T app_3gpp2; /**< Stores 3GPP2 application information. */
+ QL_MCM_SIM_CARD_APP_INFO_T app_isim; /**< Stores ISIM application information. */
+}QL_MCM_SIM_CARD_ALL_APP_INFO_T;
+
+typedef struct
+{
+ E_QL_MCM_SIM_CARD_STATE_TYPE_T e_card_state;/**< Current card and card error state. */
+ E_QL_MCM_SIM_CARD_TYPE_T e_card_type; /**< Card type. */
+ QL_MCM_SIM_CARD_ALL_APP_INFO_T card_app_info; /**< Stores all relevant application information. */
+}QL_MCM_SIM_CARD_STATUS_INFO_T;
+
+#define QL_MCM_SIM_PATH_LEN_MAX 20 /** Maximum length of a full file path in ASCII format. */
+typedef struct
+{
+ uint16_t offset; /**< Offset is only required for write file access where data length is indicated.*/
+ uint8_t record_num; /**< Number of records involved in file access. A record number of 0 indicates transparent file access.*/
+ uint32_t path_len; /**< Must be set to the number of elements in the path. */
+ char path[QL_MCM_SIM_PATH_LEN_MAX]; /**< File path in ASCII characters. @newpagetable */
+}QL_MCM_SIM_CARD_FILE_ACCESS_INFO_T;
+
+#define QL_MCM_SIM_DATA_LEN_MAX 4096 /** Maximum size of data to be read/written. */
+typedef struct
+{
+ QL_SIM_APP_ID_INFO_T app_info; /**< Application identification information. */
+ QL_MCM_SIM_CARD_FILE_ACCESS_INFO_T file_access; /**< File access information. */
+ uint32_t data_len; /**< Must be set to the number of elements in data. */
+ uint8_t data[QL_MCM_SIM_DATA_LEN_MAX]; /**< Data to be updated on the card. */
+}QL_MCM_SIM_CARD_WRITE_FILE_INFO_T;
+
+
+/** Request message; Reads data to a specific file on a specified application on the card. The type of file is determined
+ by the record number field, which indicates a transparent file when zero and a record-based file otherwise.*/
+typedef struct
+{
+ QL_SIM_APP_ID_INFO_T app_info; /**< Application identification information. */
+ QL_MCM_SIM_CARD_FILE_ACCESS_INFO_T file_access; /**< File access information. */
+}QL_MCM_SIM_CARD_FILE_INFO_TO_READ_T;
+
+typedef struct
+{
+ uint32_t data_len; /**< Must be set to the number of elements in data. */
+ uint8_t data[QL_MCM_SIM_DATA_LEN_MAX]; /**< Data retrieved from the card. */
+}QL_MCM_SIM_CARD_FILE_DATA_T;
+
+/** Retrieves the size of a specific file on a specified application on the card. */
+typedef struct
+{
+ QL_SIM_APP_ID_INFO_T app_info; /**< Application identification information. */
+ uint32_t path_len; /**< Must be set to the number of elements in path. */
+ char path[QL_MCM_SIM_PATH_LEN_MAX]; /**< File path in ASCII characters.*/
+}QL_MCM_SIM_CARD_GET_FILE_SIZE_INPUT_INFO_T;
+
+typedef enum
+{
+ E_QL_MCM_SIM_FILE_TYPE_UNKNOWN = 0xB00,/**< Unknown file type */
+ E_QL_MCM_SIM_FILE_TYPE_TRANSPARENT = 0xB01,/**< File structure consisting of a sequence of bytes. */
+ E_QL_MCM_SIM_FILE_TYPE_CYCLIC = 0xB02,/**< File structure consisting of a sequence of records, each containing the same fixed size in
+ chronological order. Once all the records have been used, the oldest data is overwritten. */
+ MCM_SIM_FILE_TYPE_LINEAR_FIXED = 0xB03, /**< File structure consisting of a sequence of records, each containing the same fixed size. */
+}E_QL_MCM_SIM_FILE_TYPE_T;
+
+typedef struct
+{
+ E_QL_MCM_SIM_FILE_TYPE_T e_file_type; /**< File type: */
+ uint16_t file_size; /**< Size of transparent files.*/
+ uint16_t record_size; /**< Size of each cyclic or linear fixed file record.*/
+ uint16_t record_count; /**< Number of cyclic or linear fixed file records.*/
+}QL_MCM_SIM_FILE_SIZE_INFO_T;
+
+typedef enum
+{
+ E_QL_MCM_SIM_REFRESH_EVENT = 0xB00, /**< Card refresh event */
+ E_QL_MCM_SIM_CARD_STATUS_UPDATE_EVENT = 0xB01, /**< Card status update event. */
+}E_QL_SIM_NFY_MSG_ID_T;
+
+
+typedef void (*QL_SIM_CardStatusIndMsgHandlerFunc_t)
+(
+ sim_client_handle_type h_sim,
+ E_QL_SIM_NFY_MSG_ID_T e_msg_id,
+ void *pv_data,
+ void *contextPtr
+);
+
+
+int QL_MCM_SIM_Client_Init(sim_client_handle_type *ph_sim);
+
+int QL_MCM_SIM_Client_Deinit(sim_client_handle_type h_sim);
+
+/* Add callback function if anything changed specified by the mask in QL_LOC_Set_Indications*/
+int QL_MCM_SIM_AddRxIndMsgHandler(QL_SIM_CardStatusIndMsgHandlerFunc_t handlerPtr, void* contextPtr);
+
+
+/*===========================================================================
+
+ FUNCTION: QL_MCM_SIM_GetIMSI
+
+===========================================================================*/
+/*
+ @brief
+ Function sends a command to the modem to retrieve the IMSI (for 3GPP)
+ or IMSI_M (for 3GPP2) from the SIM in ASCII form
+
+ @return
+ void
+*/
+/*=========================================================================*/
+E_QL_ERROR_CODE_T QL_MCM_SIM_GetIMSI
+(
+ sim_client_handle_type h_sim,
+ QL_SIM_APP_ID_INFO_T *pt_info, ///< [IN] The SIM identifier info.
+ char *imsi, ///< [OUT] IMSI buffer
+ size_t imsiLen ///< [IN] IMSI buffer length
+);
+
+
+E_QL_ERROR_CODE_T QL_MCM_SIM_GetIMEI
+(
+ sim_client_handle_type h_sim,
+ char *imei, ///< [OUT] IMSI buffer
+ size_t imeiLen ///< [IN] IMSI buffer length
+);
+
+
+/*===========================================================================
+
+ FUNCTION: QL_MCM_SIM_GetICCID
+
+===========================================================================*/
+/*
+ @brief
+ Function sends a command to the modem to retrieve the ICCID from
+ SIM in ASCII form
+
+ @return
+ E_QL_ERROR_CODE_T
+*/
+/*=========================================================================*/
+E_QL_ERROR_CODE_T QL_MCM_SIM_GetICCID
+(
+ sim_client_handle_type h_sim,
+ E_QL_MCM_SIM_SLOT_ID_TYPE_T simId, ///< [IN] The SIM identifier.
+ char *iccid, ///< [OUT] ICCID
+ size_t iccidLen ///< [IN] ICCID buffer length
+);
+
+
+/*===========================================================================
+
+ FUNCTION: QL_MCM_SIM_GetPhoneNumber
+
+===========================================================================*/
+/*
+ @brief
+ Function sends a command to the modem to retrieve the device phone
+ number from MSISDN (for 3GPP) or MDN (for 3GPP2) from the SIM in
+ ASCII form
+
+ @return
+ E_QL_ERROR_CODE_T
+*/
+/*=========================================================================*/
+E_QL_ERROR_CODE_T QL_MCM_SIM_GetPhoneNumber
+(
+ sim_client_handle_type h_sim,
+ QL_SIM_APP_ID_INFO_T *pt_info, ///< [IN] The SIM identifier.
+ char *phone_num, ///< [OUT] phone number
+ size_t phoneLen ///< [IN] phone number buffer length
+);
+
+/*===========================================================================
+
+ FUNCTION: QL_MCM_SIM_GetOperatorPlmnList
+
+===========================================================================*/
+/*
+ @brief
+ Function sends multiple record based read commands to the modem
+ to retrieve a list of operator preffered PLMN.
+
+ @note
+ Function should only be called for SIM/USIM
+
+ @return
+ E_QL_ERROR_CODE_T
+*/
+/*=========================================================================*/
+E_QL_ERROR_CODE_T QL_MCM_SIM_GetOperatorPlmnList
+(
+ sim_client_handle_type h_sim,
+ E_QL_MCM_SIM_SLOT_ID_TYPE_T simId, ///< [IN] The SIM identifier.
+ QL_SIM_PREFERRED_OPERATOR_LIST_T *pt_info ///< [OUT] Preferred operator list
+);
+
+/*===========================================================================
+
+ FUNCTION: QL_MCM_SIM_VerifyPIN
+
+===========================================================================*/
+/*
+ @brief
+ Function sends a command to the modem to verify either PIN1 or PIN2
+
+ @return
+ E_QL_ERROR_CODE_T
+*/
+/*=========================================================================*/
+E_QL_ERROR_CODE_T QL_MCM_SIM_VerifyPIN
+(
+ sim_client_handle_type h_sim,
+ QL_SIM_VERIFY_PIN_INFO_T *pt_info ///< [IN] Verify PIN infor
+);
+
+
+/*===========================================================================
+
+ FUNCTION: QL_MCM_SIM_ChangePin
+
+===========================================================================*/
+/*
+ @brief
+ Function sends a command to the modem to change the value of
+ either PIN1 or PIN2
+
+ @return
+ E_QL_ERROR_CODE_T
+*/
+/*=========================================================================*/
+E_QL_ERROR_CODE_T QL_MCM_SIM_ChangePin
+(
+ sim_client_handle_type h_sim,
+ QL_SIM_CHANGE_PIN_INFO_T *pt_info ///< [IN] Change PIN infor
+);
+
+
+/*===========================================================================
+
+ FUNCTION: QL_MCM_SIM_UnblockPIN
+
+===========================================================================*/
+/*
+ @brief
+ Function sends a command to the modem to unblock a PIN1 or PIN2 that
+ has been blocked
+
+ @return
+ E_QL_ERROR_CODE_T
+*/
+/*=========================================================================*/
+E_QL_ERROR_CODE_T QL_MCM_SIM_UnblockPIN
+(
+ sim_client_handle_type h_sim,
+ QL_SIM_UNBLOCK_PIN_INFO_T *pt_info ///< [IN] Unblock PIN infor
+);
+
+/*===========================================================================
+
+ FUNCTION: QL_MCM_SIM_EnablePIN
+
+===========================================================================*/
+/*
+ @brief
+ Function sends a command to the modem to enable PIN1 or PIN2
+
+ @return
+ E_QL_ERROR_CODE_T
+*/
+/*=========================================================================*/
+E_QL_ERROR_CODE_T QL_MCM_SIM_EnablePIN
+(
+ sim_client_handle_type h_sim,
+ QL_SIM_ENABLE_PIN_INFO_T *pt_info ///< [IN] Enable PIN infor
+);
+
+/*===========================================================================
+
+ FUNCTION: QL_MCM_SIM_DisablePIN
+
+===========================================================================*/
+/*
+ @brief
+ Function sends a command to the modem to disable PIN1 or PIN2
+
+ @return
+ E_QL_ERROR_CODE_T
+*/
+/*=========================================================================*/
+E_QL_ERROR_CODE_T QL_MCM_SIM_DisablePIN
+(
+ sim_client_handle_type h_sim,
+ QL_SIM_DISABLE_PIN_INFO_T *pt_info ///< [IN] Disable PIN infor
+);
+
+
+/*===========================================================================
+
+ FUNCTION: QL_MCM_SIM_GetCardStatus
+
+===========================================================================*/
+/*
+ @brief
+ Function retrieves the server cached card status informations and
+ sends the information to the client
+
+ @return
+ E_QL_ERROR_CODE_T
+*/
+/*=========================================================================*/
+E_QL_ERROR_CODE_T QL_MCM_SIM_GetCardStatus
+(
+ sim_client_handle_type h_sim,
+ E_QL_MCM_SIM_SLOT_ID_TYPE_T simId, ///< [IN] The SIM identifier.
+ QL_MCM_SIM_CARD_STATUS_INFO_T *pt_info ///< [OUT] Cart status infor output
+);
+
+/*===========================================================================
+
+ FUNCTION: QL_MCM_SIM_Depersonalization
+
+===========================================================================*/
+/*
+ @brief
+ Function sends a command to the modem to disable or unblock SIM Lock
+
+ @return
+ E_QL_ERROR_CODE_T
+*/
+/*=========================================================================*/
+E_QL_ERROR_CODE_T QL_MCM_SIM_Depersonalization
+(
+ sim_client_handle_type h_sim,
+ QL_MCM_SIM_DEPERSONALIZE_INFO_T *pt_info ///< [OUT] Depersonalize information
+);
+
+
+/*===========================================================================
+
+ FUNCTION: QL_MCM_SIM_Personalization
+
+===========================================================================*/
+/*
+ @brief
+ Function sends a command to the modem to set the SIM Lock data
+ and concurrently enable SIM Lock.
+
+ @return
+ E_QL_ERROR_CODE_T
+*/
+/*=========================================================================*/
+E_QL_ERROR_CODE_T QL_MCM_SIM_Personalization
+(
+ sim_client_handle_type h_sim,
+ QL_MCM_SIM_PERSONALIZE_FEATURE_INFO_T *pt_info ///< [OUT] Unblock PIN infor
+);
+
+
+/*===========================================================================
+
+ FUNCTION: QL_MCM_SIM_WriteFile
+
+===========================================================================*/
+/*
+ @brief
+ Function will determine whether the request is for transparent or
+ record based write command based on the record number and calls the
+ corresponding function to send the message to the card.
+
+ record number = 0 - transparent
+ record number > 0 - record based
+
+ @return
+ E_QL_ERROR_CODE_T
+*/
+/*=========================================================================*/
+E_QL_ERROR_CODE_T QL_MCM_SIM_WriteFile
+(
+ sim_client_handle_type h_sim,
+ QL_MCM_SIM_CARD_WRITE_FILE_INFO_T *pt_info ///< [OUT] Verify PIN infor
+);
+
+
+/*===========================================================================
+
+ FUNCTION: QL_MCM_SIM_ReadFile
+
+===========================================================================*/
+/*
+ @brief
+ Function will determine whether the request is for transparent or
+ record based read command based on the record number and calls the
+ corresponding function to send the message to the card.
+
+ record number = 0 - transparent
+ record number > 0 - record based
+
+ @return
+ E_QL_ERROR_CODE_T
+*/
+/*=========================================================================*/
+E_QL_ERROR_CODE_T QL_MCM_SIM_ReadFile
+(
+ sim_client_handle_type h_sim,
+ QL_MCM_SIM_CARD_FILE_INFO_TO_READ_T *pt_info, ///< [IN] input file info which to be read
+ QL_MCM_SIM_CARD_FILE_DATA_T *pt_out ///< [OUT] File data of the specified one by pt_info
+);
+
+/*===========================================================================
+
+ FUNCTION: QL_MCM_SIM_GetFileSize
+
+===========================================================================*/
+/*
+ @brief
+ Function sends a command to the modem to retrieve the file type, file
+ size(transparent files) or record size and record count (record based files)
+
+ @return
+ E_QL_ERROR_CODE_T
+*/
+/*=========================================================================*/
+E_QL_ERROR_CODE_T QL_MCM_SIM_GetFileSize
+(
+ sim_client_handle_type h_sim,
+ QL_MCM_SIM_CARD_GET_FILE_SIZE_INPUT_INFO_T *pt_info, ///< [IN] input file info which to be read
+ QL_MCM_SIM_FILE_SIZE_INFO_T *pt_out ///< [OUT] output file size info
+);
+
+
+
+#endif // __QL_MCM_SIM_H__
+
diff --git a/mbtk/include/ql/ql_mcm_sms.h b/mbtk/include/ql/ql_mcm_sms.h
new file mode 100755
index 0000000..1055325
--- /dev/null
+++ b/mbtk/include/ql/ql_mcm_sms.h
@@ -0,0 +1,282 @@
+/**
+ *@file ql_sms.h
+ *@date 2017-05-02
+ *@author
+ *@brief
+ */
+
+#ifndef __QL_SMS_H__
+#define __QL_SMS_H__
+
+#include "mbtk_type.h"
+
+typedef uint32 sms_client_handle_type;
+
+/** Maximum length of an SMS. */
+#define QL_SMS_MAX_MT_MSG_LENGTH 1440
+
+/** Maximum string length. */
+#define QL_SMS_MAX_ADDR_LENGTH 252
+
+/** Maximum string length. */
+#define QL_SMS_MAX_SCA_TYPE_LENGTH 3
+
+
+typedef enum
+{
+ E_QL_SMS_FORMAT_GSM_7BIT = 0,
+ E_QL_SMS_FORMAT_BINARY_DATA = 1,
+ E_QL_SMS_FORMAT_UCS2 = 2,
+ //<2017/12/28-QCM9XOL00004C001-P01-Vicent.Gao, <[SMS] Segment 1==> CharSet to Alpha implementation.>
+ E_QL_SMS_FORMAT_IRA = 3,
+ //>2017/12/28-QCM9XOL00004C001-P01-Vicent.Gao
+
+}E_QL_SMS_FORMAT_T;
+
+typedef enum
+{
+ E_QL_SMS_TYPE_RX = 0, ///< SMS mobile terminated message.
+ E_QL_SMS_TYPE_TX = 1, ///< SMS mobile originated message.
+ E_QL_SMS_TYPE_BROADCAST_RX = 2 ///< SMS Cell Broadcast message.
+}E_QL_SMS_TYPE_T;
+
+typedef enum
+{
+ E_QL_SMS_STORAGE_TYPE_NONE = -1, /**< Message no need to store. */
+ E_QL_SMS_STORAGE_TYPE_UIM = 0, /**< Message store to UIM. */
+ E_QL_SMS_STORAGE_TYPE_NV = 1, /**< Message store to NV. */
+}E_QL_SMS_STORAGE_TYPE_T;
+
+typedef enum
+{
+ E_QL_SMS_MESSAGE_MODE_UNKNOWN = -1, /**< Message type CDMA */
+ E_QL_SMS_MESSAGE_MODE_CDMA = 0, /**< Message type CDMA */
+ E_QL_SMS_MESSAGE_MODE_GW = 1, /**< Message type GW. */
+}E_QL_SMS_MODE_TYPE_T;
+
+typedef struct
+ {
+ uint8_t total_segments; /**< The number of long short message*/
+ uint8_t seg_number; /**< Current number.*/
+ uint8_t reference_number; /**< reference_number.*/
+}ql_sms_user_data_head_t;
+
+typedef struct
+{
+ /* If sms is stored, it won't parse, you need read it by yourself */
+ E_QL_SMS_STORAGE_TYPE_T e_storage; ///specify where stored this msg
+
+ E_QL_SMS_FORMAT_T format;
+ E_QL_SMS_TYPE_T type;
+ char sms_number_addr[QL_SMS_MAX_ADDR_LENGTH]; ///Telephone number string
+ char sca_number_addr[QL_SMS_MAX_ADDR_LENGTH]; //.SMS Center Number
+ int sms_data_len;
+ char sms_data[QL_SMS_MAX_MT_MSG_LENGTH]; ///SMS content, data format depends on format
+ char timestamp[21]; ///Message time stamp (in text mode). string format: "yy/MM/dd,hh:mm:ss+/-TimeZone"
+ uint8_t user_data_head_valid; //indicate whether long sms. TRUE-long sms; FALSE-short message;
+ ql_sms_user_data_head_t user_data_head; //long sms user data head info.
+ E_QL_SMS_MODE_TYPE_T e_mode; ///specify where stored this msg cdma or gw area
+ uint32_t storage_index; ///storage index, -1 means not store
+} ql_sms_info_t;
+
+
+typedef struct
+{
+ E_QL_SMS_STORAGE_TYPE_T e_storage;
+ E_QL_SMS_MODE_TYPE_T e_mode;
+ uint32_t storage_idx;
+} ql_sms_storage_info_t;
+
+/* 0 = "REC UNREAD" */
+/* 1 = "REC READ" */
+/* 2 = "STO UNSENT" */
+/* 3 = "STO SENT" */
+typedef enum _ql_SMS_SIM_STATUS
+{
+ REC_UNREAD = 0,
+ REC_READ = 1,
+ STO_UNSENT = 2,
+ STO_SENT = 3
+}ql_SMS_SIM_STATUS;
+
+typedef enum
+{
+ E_QL_SMS_MESSAGE_CLASS_0 = 0x00, //display only
+ E_QL_SMS_MESSAGE_CLASS_1 = 0x01, //store in ME
+ E_QL_SMS_MESSAGE_CLASS_2 = 0x02, //store in SIM
+ E_QL_SMS_MESSAGE_CLASS_3 = 0x03, //
+ E_QL_SMS_MESSAGE_CLASS_NONE = 0x04,
+ E_QL_SMS_MESSAGE_CLASS_CDMA = 0x05,
+ E_QL_SMS_MESSAGE_CLASS_MAX = 0x06,
+}E_QL_SMS_MESSAGE_CLASS_TYPE_T;
+
+typedef enum
+{
+ E_QL_SMS_UNKNOWN = -1,
+ E_QL_SMS_DISCARD = 0x00, /* Incoming messages for this route are discarded by the WMS service without
+ notifying QMI_WMS clients */
+ E_QL_SMS_STORE_AND_NOTIFY = 0x01, /* Incoming messages for this route are stored to the specified device
+ memory, and new message notifications */
+ E_QL_SMS_TRANSFER_ONLY = 0x02, /* Incoming messages for this route are transferred to the client, and the
+ client is expected to send ACK to the network */
+ E_QL_SMS_TRANSFER_AND_ACK = 0x03, /* Incoming messages for this route are transferred to the client, and ACK is
+ sent to the network */
+}E_QL_SMS_RECEPTION_ACTION_TYPE_T;
+
+typedef struct
+{
+ E_QL_SMS_MESSAGE_CLASS_TYPE_T message_class;
+ E_QL_SMS_STORAGE_TYPE_T route_storage;
+ E_QL_SMS_RECEPTION_ACTION_TYPE_T receipt_action;
+}ql_sms_route_info_t; /* Type */
+
+typedef struct
+{
+ ql_sms_route_info_t route_list[E_QL_SMS_MESSAGE_CLASS_MAX];
+}ql_sms_route_info_list_t; /* Message */
+
+#define QL_WMS_MESSAGE_LENGTH_MAX 255
+
+typedef enum
+ {
+ E_QL_WMS_MESSAGE_FORMAT_CDMA = 0x00, //- 0x00 -- MESSAGE_FORMAT_CDMA -- CDMA \n
+ E_QL_WMS_MESSAGE_FORMAT_GW_PP = 0x06, //- 0x06 -- MESSAGE_FORMAT_GW_PP -- GW_PP
+}E_QL_WMS_MESSAGE_FORMAT_TYPE;
+
+
+typedef struct
+ {
+ E_QL_WMS_MESSAGE_FORMAT_TYPE format;
+ uint32_t raw_message_len; /**< Must be set to # of elements in raw_message */
+ uint8_t raw_message[QL_WMS_MESSAGE_LENGTH_MAX]; /**< Raw message data*/
+}ql_wms_send_raw_message_data_t;
+
+
+typedef enum
+{
+ E_QL_WMS_TL_CAUSE_CODE_ADDR_VACANT = 0x00,
+ E_QL_WMS_TL_CAUSE_CODE_ADDR_TRANSLATION_FAILURE = 0x01,
+ E_QL_WMS_TL_CAUSE_CODE_NETWORK_RESOURCE_SHORTAGE = 0x02,
+ E_QL_WMS_TL_CAUSE_CODE_NETWORK_FAILURE = 0x03,
+ E_QL_WMS_TL_CAUSE_CODE_INVALID_TELESERVICE_ID = 0x04,
+ E_QL_WMS_TL_CAUSE_CODE_NETWORK_OTHER = 0x05,
+ E_QL_WMS_TL_CAUSE_CODE_NO_PAGE_RESPONSE = 0x20,
+ E_QL_WMS_TL_CAUSE_CODE_DEST_BUSY = 0x21,
+ E_QL_WMS_TL_CAUSE_CODE_NO_ACK = 0x22,
+ E_QL_WMS_TL_CAUSE_CODE_DEST_RESOURCE_SHORTAGE = 0x23,
+ E_QL_WMS_TL_CAUSE_CODE_SMS_DELIVERY_POSTPONED = 0x24,
+ E_QL_WMS_TL_CAUSE_CODE_DEST_OUT_OF_SERV = 0x25,
+ E_QL_WMS_TL_CAUSE_CODE_DEST_NOT_AT_ADDR = 0x26,
+ E_QL_WMS_TL_CAUSE_CODE_DEST_OTHER = 0x27,
+ E_QL_WMS_TL_CAUSE_CODE_RADIO_IF_RESOURCE_SHORTAGE = 0x40,
+ E_QL_WMS_TL_CAUSE_CODE_RADIO_IF_INCOMPATABILITY = 0x41,
+ E_QL_WMS_TL_CAUSE_CODE_RADIO_IF_OTHER = 0x42,
+ E_QL_WMS_TL_CAUSE_CODE_ENCODING = 0x60,
+ E_QL_WMS_TL_CAUSE_CODE_SMS_ORIG_DENIED = 0x61,
+ E_QL_WMS_TL_CAUSE_CODE_SMS_TERM_DENIED = 0x62,
+ E_QL_WMS_TL_CAUSE_CODE_SUPP_SERV_NOT_SUPP = 0x63,
+ E_QL_WMS_TL_CAUSE_CODE_SMS_NOT_SUPP = 0x64,
+ E_QL_WMS_TL_CAUSE_CODE_MISSING_EXPECTED_PARAM = 0x65,
+ E_QL_WMS_TL_CAUSE_CODE_MISSING_MAND_PARAM = 0x66,
+ E_QL_WMS_TL_CAUSE_CODE_UNRECOGNIZED_PARAM_VAL = 0x67,
+ E_QL_WMS_TL_CAUSE_CODE_UNEXPECTED_PARAM_VAL = 0x68,
+ E_QL_WMS_TL_CAUSE_CODE_USER_DATA_SIZE_ERR = 0x69,
+ E_QL_WMS_TL_CAUSE_CODE_GENERAL_OTHER = 0x6A,
+}E_QL_WMS_TL_CAUSE_CODE_TYPE;
+
+typedef struct
+ {
+ uint16_t message_id; /* Message ID */
+ uint8_t cause_code_valid; /**< Must be set to true if cause_code is being passed */
+ E_QL_WMS_TL_CAUSE_CODE_TYPE cause_code;
+}ql_wms_raw_send_resp_t;
+
+typedef struct
+ {
+ char service_center_addr[QL_SMS_MAX_ADDR_LENGTH + 1]; /**< Address of the service center.*/
+ uint8_t service_center_addr_type_valid;
+ char service_center_addr_type[QL_SMS_MAX_SCA_TYPE_LENGTH + 1]; /**< 129 if the SMSC address does not start with a "+" characte;
+ 145 if the SMSC address starts with a "+" character*/
+}ql_sms_service_center_cfg_t;
+
+typedef ql_sms_info_t QL_SMS_Msg_t;
+typedef ql_sms_info_t* QL_SMS_MsgRef;
+
+/* Callback function registered to QL_SMS_AddRxMsgHandler, msgRef contains the detail msg infor */
+typedef void (*QL_SMS_RxMsgHandlerFunc_t)
+(
+ QL_SMS_MsgRef msgRef,
+ void* contextPtr
+);
+
+/* Init SMS module and return h_sms, this should be called before any othe ones */
+int QL_SMS_Client_Init(sms_client_handle_type *ph_sms);
+
+/* Add callback function, if any new msg arrived, it will notify app */
+int QL_SMS_AddRxMsgHandler(QL_SMS_RxMsgHandlerFunc_t handlerPtr, void* contextPtr);
+
+/* Send sms, you just need to fill format/src_addr/sms_data_len/sms_data,
+ if format is UCS2, the data should be Unicode-BE format.
+*/
+int QL_SMS_Send_Sms(sms_client_handle_type h_sms, ql_sms_info_t *pt_sms_info);
+
+/* DeInit SMS module and release resource, this should be called in the last one. */
+int QL_SMS_Client_Deinit(sms_client_handle_type h_sms);
+
+/* Delete the SMS specified in the pt_sms_storage */
+int QL_SMS_DeleteFromStorage(sms_client_handle_type h_sms, ql_sms_storage_info_t *pt_sms_storage);
+
+/* Set route list, normally, sms won't be stored, the route set to transfer_and_ack by default.
+ If you want to save to storage, you can specify it with this api.
+*/
+int QL_SMS_SetRouteList(sms_client_handle_type h_sms, ql_sms_route_info_list_t *pt_route_list);
+
+/* Send sms PDU.
+*/
+int QL_SMS_Send_SmsPdu( sms_client_handle_type h_sms,
+ ql_wms_send_raw_message_data_t *raw_message_data,
+ ql_wms_raw_send_resp_t *rawresp);
+
+int QL_SMS_Get_By_id(ql_sms_storage_info_t *pt_sms_storage);
+
+/* Get sms center address.
+*/
+int QL_SMS_GetSmsCenterAddress( sms_client_handle_type h_sms,
+ ql_sms_service_center_cfg_t *set_sca_cfg);
+
+/* Set sms center address.
+*/
+int QL_SMS_SetSmsCenterAddress( sms_client_handle_type h_sms,
+ ql_sms_service_center_cfg_t *get_sca_cfg);
+
+int QL_SMS_Get_Storage(sms_client_handle_type *ph_sms);
+
+int QL_SMS_Save_Sms(sms_client_handle_type h_sms, ql_sms_info_t *pt_sms_info);
+
+int QL_SMS_Delete_Sms(sms_client_handle_type h_sms, ql_sms_info_t *pt_sms_info);
+/*
+Usage 1 (register callback and wait for new sms arrive):
+1, QL_SMS_Client_Init
+2, QL_SMS_AddRxMsgHandler(pf_cb)
+3, wait for sms arrive, pf_cb will pass the detail sms info to app.
+4, QL_SMS_Client_Deinit
+
+
+Usage 2 (Send sms):
+1, QL_SMS_Client_Init
+2, QL_SMS_AddRxMsgHandler(pf_cb)
+3, QL_SMS_Send_Sms
+4, QL_SMS_Client_Deinit
+
+
+Usage 3 (store sms):
+1, QL_SMS_Client_Init
+2, QL_SMS_AddRxMsgHandler(pf_cb)
+3, QL_SMS_SetRouteList (Notice: class-0 not allowed to store, class-2 must be stored to UIM)
+4, pf_cb will be called when new sms arrived, and tell you where the sms stored
+5, you can call QL_SMS_DeleteFromStorage to delete specified sms, the location can be got from pf_cb.
+6, QL_SMS_Client_Deinit
+*/
+
+#endif // __QL_SMS_H__
+
diff --git a/mbtk/include/ql/ql_network.h b/mbtk/include/ql/ql_network.h
new file mode 100755
index 0000000..241c718
--- /dev/null
+++ b/mbtk/include/ql/ql_network.h
@@ -0,0 +1,51 @@
+/**
+ * @file ql_network.h
+ * @brief Quectel Openlinux network public function declarations.
+ *
+ * @note
+ *
+ * @copyright Copyright (c) 2009-2017 @ Quectel Wireless Solutions Co., Ltd.
+ */
+
+#ifndef __QL_NETWORK_H__
+#define __QL_NETWORK_H__
+#include "mbtk_type.h"
+#include "mbtk_info_api.h"
+
+
+ typedef struct {
+ char gw_ip[20]; /* Gateway Address*/
+ char netmask[20]; /* netmask */
+ unsigned char enable_dhcp; /* Whether to enable DHCP; boolean value. */
+ char dhcp_start_ip[20]; /*DHCP start IP address.*/
+ char dhcp_end_ip[20]; /*DHCP end IP address. */
+ unsigned int lease_time; /*DHCP lease time, in seconds.*/
+ }ql_lan_dhcp_config_s;
+
+
+
+/**
+* Set the network configuration: dhcp configuration.
+*s
+* @param [in] lan_dhcp_config
+*
+* @return
+* On success, 0 is returned. On error, -1 is returned.
+*
+*/
+extern int QL_LAN_DHCP_Config_Set(ql_lan_dhcp_config_s lan_dhcp_config);
+
+/**
+* Get the network configuration: dhcp configuration.
+*
+* @param [out] lan_dhcp_config
+*
+* @return
+* On success, 0 is returned. On error, -1 is returned.
+*
+*/
+extern int QL_LAN_DHCP_Config_Get(ql_lan_dhcp_config_s *lan_dhcp_config);
+
+#endif
+
+
diff --git a/mbtk/include/ql/ql_nw.h b/mbtk/include/ql/ql_nw.h
new file mode 100755
index 0000000..8e1d237
--- /dev/null
+++ b/mbtk/include/ql/ql_nw.h
@@ -0,0 +1,292 @@
+/**
+ @file
+ ql_nw.h
+
+ @brief
+ This file provides the definitions for nw, and declares the
+ API functions.
+
+*/
+/*============================================================================
+ Copyright (c) 2017 Quectel Wireless Solution, Co., Ltd. All Rights Reserved.
+ Quectel Wireless Solution Proprietary and Confidential.
+ =============================================================================*/
+/*===========================================================================
+
+ EDIT HISTORY FOR MODULE
+
+This section contains comments describing changes made to the module.
+Notice that changes are listed in reverse chronological order.
+
+
+WHEN WHO WHAT, WHERE, WHY
+---------- ------------ ----------------------------------------------------
+14/08/2019 Nebula.li create
+=============================================================================*/
+
+#ifndef __QL_NW_H__
+#define __QL_NW_H__
+
+#include <stdlib.h>
+#include <stdint.h>
+#include <string.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define QL_NW_IND_VOICE_REG_EVENT_FLAG (1 << 0) //VOICE注册事件
+#define QL_NW_IND_DATA_REG_EVENT_FLAG (1 << 1) //DATA注册事件
+#define QL_NW_IND_SIGNAL_STRENGTH_EVENT_FLAG (1 << 2) //信号强度事件
+#define QL_NW_IND_NITZ_TIME_UPDATE_EVENT_FLAG (1 << 3) //时间跟新事件
+//START baron-2020.02.29: add for ims register state indication
+#define QL_NW_IND_IMS_NETWORK_STATE_CHANGED_FLAG (1 << 4) //ims register state change
+//END
+#define CELL_MAX_NUM 20
+
+typedef enum
+{
+ QL_NW_SUCCESS,
+ QL_NW_GENERIC_FAILURE,
+ QL_NW_RADIO_NOT_AVAILABLE,
+}QL_NW_ERROR_CODE;
+
+typedef enum {
+ QL_NW_PREF_NET_TYPE_GSM_WCDMA = 0,
+ QL_NW_PREF_NET_TYPE_GSM_ONLY = 1,
+ QL_NW_PREF_NET_TYPE_WCDMA = 2,
+ QL_NW_PREF_NET_TYPE_GSM_WCDMA_AUTO = 3, //根据 PRL自动选择GSM、WCDMA
+ QL_NW_PREF_NET_TYPE_LTE_GSM_WCDMA = 9, //自动选择LTE、GSM、WCDMA
+ QL_NW_PREF_NET_TYPE_LTE_ONLY = 11,
+ QL_NW_PREF_NET_TYPE_LTE_WCDMA = 12,
+ QL_NW_PREF_NET_TYPE_LTE_GSM_GSM_PREF = 13, //优先GSM
+ QL_NW_PREF_NET_TYPE_LTE_GSM_LTE_PREF = 14, //优先LTE
+ QL_NW_PREF_NET_TYPE_LTE_GSM = 15,
+ QL_NW_PREF_NET_TYPE_LTE_WCDMA_WCDMA_PREF = 16,
+ QL_NW_PREF_NET_TYPE_LTE_WCDMA_LTE_PREF = 17,
+ QL_NW_PREF_NET_TYPE_LTE_GSM_WCDMA_GSM_PREF = 19,
+ QL_NW_PREF_NET_TYPE_LTE_GSM_WCDMA_WCDMA_PREF = 20,
+ QL_NW_PREF_NET_TYPE_LTE_GSM_WCDMA_LTE_PREF = 21,
+} QL_NW_PREFERRED_NETWORK_TYPE;
+
+typedef struct
+{
+ QL_NW_PREFERRED_NETWORK_TYPE preferred_nw_mode; //首选的网络制式,见QL_NW_PREFERRED_NETWORK_TYPE
+ int roaming_pref; //漫游开关。 0 关; 1 开
+}QL_NW_CONFIG_INFO_T;
+
+typedef struct
+{
+ char nitz_time[32]; //格式:format: YY/MM/DD HH:MM:SS '+/-'TZ daylight, 18/09/19 07:40:18 +32 00.
+ unsigned long abs_time; //0表示不可用
+ unsigned char leap_sec; //0表示不可用
+}QL_NW_NITZ_TIME_INFO_T;
+
+typedef struct
+{
+ char long_eons[128];
+ char short_eons[128];
+ char mcc[4];
+ char mnc[4];
+}QL_NW_OPERATOR_INFO_T;
+
+//START baron-2020.02.29: add for ims register state
+typedef struct __volte_state
+{
+ int reg_state; /*0: not registered, 1: registered*/
+}VOLTE_STATE;
+//END
+
+typedef enum
+{
+ QL_NW_ACCESS_TECH_GSM = 0,
+ QL_NW_ACCESS_TECH_GSM_COMPACT = 1,
+ QL_NW_ACCESS_TECH_UTRAN = 2,
+ QL_NW_ACCESS_TECH_GSM_wEGPRS = 3,
+ QL_NW_ACCESS_TECH_UTRAN_wHSDPA = 4,
+ QL_NW_ACCESS_TECH_UTRAN_wHSUPA = 5,
+ QL_NW_ACCESS_TECH_UTRAN_wHSDPA_HSUPA = 6,
+ QL_NW_ACCESS_TECH_E_UTRAN = 7,
+ QL_NW_ACCESS_TECH_UTRAN_HSPAP = 8,
+ QL_NW_ACCESS_TECH_E_UTRAN_CA = 9,
+ QL_NW_ACCESS_TECH_NONE = 10,
+}QL_NW_ACCESS_TECHNOLOGY;
+
+typedef struct
+{
+ int status; //0:未知的网络;1:可用的网络;2:当前的网络;3:禁止使用的网络
+ QL_NW_OPERATOR_INFO_T operator_name; //运营商信息,见QL_NW_OPERATOR_INFO_T。
+ QL_NW_ACCESS_TECHNOLOGY act; //注网制式,见QL_NW_RADIO_TECH_TYPE_T。
+}QL_NW_SCAN_ENTRY_INFO_T;
+
+typedef struct
+{
+ int entry_len; //可用网络的个数
+ QL_NW_SCAN_ENTRY_INFO_T entry[40]; //可用网络的列表,见QL_NW_SCAN_ENTRY_INFO_T。
+}QL_NW_SCAN_RESULT_LIST_INFO_T;
+
+
+typedef enum {
+ QL_NW_RADIO_TECH_UNKNOWN = 0,
+ QL_NW_RADIO_TECH_GPRS = 1,
+ QL_NW_RADIO_TECH_EDGE = 2,
+ QL_NW_RADIO_TECH_UMTS = 3,
+ QL_NW_RADIO_TECH_IS95A = 4,
+ QL_NW_RADIO_TECH_IS95B = 5,
+ QL_NW_RADIO_TECH_1xRTT = 6,
+ QL_NW_RADIO_TECH_HSDPA = 9,
+ QL_NW_RADIO_TECH_HSUPA = 10,
+ QL_NW_RADIO_TECH_HSPA = 11,
+ QL_NW_RADIO_TECH_EHRPD = 13,
+ QL_NW_RADIO_TECH_LTE = 14,
+ QL_NW_RADIO_TECH_HSPAP = 15, // HSPA+
+ QL_NW_RADIO_TECH_GSM = 16,
+ QL_NW_RADIO_TECH_TD_SCDMA = 17,
+ QL_NW_RADIO_TECH_IWLAN = 18,
+ QL_NW_RADIO_TECH_LTEP = 19,
+ QL_NW_RADIO_TECH_DC_HSPA = 20
+} QL_NW_RADIO_TECHNOLOGY;
+
+typedef enum {
+ QL_NW_REG_STATE_NOT_REGISTERED=0, //not registered, MT is not currently searching an operator to register to
+ QL_NW_REG_STATE_HOME_NETWORK=1, //registered, home network
+ QL_NW_REG_STATE_TRYING_ATTACH_OR_SEARCHING=2, //not registered, but MT is currently trying to attach or searching an operator to register to
+ QL_NW_REG_STATE_DENIED=3, //registration denied
+ QL_NW_REG_STATE_UNKNOWN=4, //unknown
+ QL_NW_REG_STATE_ROAMING=5, //registered, roaming
+ QL_NW_REG_STATE_HOME_NETWORK_SMS_ONLY=6, //registered for “SMS only”, home network (not applicable)
+ QL_NW_REG_STATE_ROAMING_SMS_ONLY=7,// registered for “SMS only”, roaming (not applicable)
+ QL_NW_REG_STATE_ATTACHED_EMERGENCY_ONLY=8, //attached for emergency bearer services only
+ QL_NW_REG_STATE_HOME_NETWORK_CSFB_NOT_PREFERRED=9, //registered for “CSFB not preferred”, home network (not applicable)
+ QL_NW_REG_STATE_ROAMING_CSFB_NOT_PREFERRED=10,//registered for “CSFB not preferred”, roaming (not applicable)
+ QL_NW_REG_STATE_EMERGENCY_ONLY=11,//emergency bearer services only
+}QL_NW_REG_STATE;
+
+typedef struct
+{
+ QL_NW_REG_STATE state; //注册状态
+ int lac;
+ int cid;
+ QL_NW_RADIO_TECHNOLOGY rat;
+ int rejectCause; //注册被拒绝的原因
+ int psc; //Primary Scrambling Code
+} QL_NW_COMMON_REG_STATUS_INFO_T;
+
+typedef struct
+{
+ QL_NW_COMMON_REG_STATUS_INFO_T voice_reg; //VOICE注册信息,见QL_NW_COMMON_REG_STATUS_INFO_T
+ QL_NW_COMMON_REG_STATUS_INFO_T data_reg; //DATA注册信息。
+}QL_NW_REG_STATUS_INFO_T;
+
+typedef struct
+{
+ int nw_selection_mode; //0 自动;1手动
+ char mcc[4];
+ char mnc[4];
+ QL_NW_ACCESS_TECHNOLOGY act; //selection 制式,见QL_NW_ACCESS_TECHNOLOGY。
+}QL_NW_SELECTION_INFO_T;
+
+typedef struct {
+ int rssi;
+ int bitErrorRate;
+ int rscp;
+ int ecio;
+} QL_NW_GW_SIGNAL_STRENGTH_INFO_T;
+
+typedef struct {
+ int rssi;
+ int rsrp;
+ int rsrq;
+ int rssnr;
+ int cqi;
+} QL_NW_LTE_SIGNAL_STRENGTH_INFO_T;
+
+typedef struct {
+ QL_NW_GW_SIGNAL_STRENGTH_INFO_T GW_SignalStrength;
+ QL_NW_LTE_SIGNAL_STRENGTH_INFO_T LTE_SignalStrength;
+}QL_NW_SIGNAL_STRENGTH_INFO_T;
+
+/* CSQ: just get rssi and ber */
+typedef struct {
+ int rssi;
+ int bitErrorRate;
+} QL_NW_CSQ_SIGNAL_STRENGTH_INFO_T;
+
+typedef struct
+{
+ int flag; /**Cell type, 0:present,1:neighbor.*/
+ int cid; /**Cell ID, (0 indicates information is not represent).*/
+ int mcc; /**This field should be ignored when cid is not present*/
+ int mnc; /**This field should be ignored when cid is not present*/
+ int lac; /**Location area code.(This field should be ignord when cid is not present). */
+ int arfcn; /**Absolute RF channel number. */
+ char bsic; /**Base station identity code. (0 indicates information is not present). */
+ int lenOfMnc; /**Length of MNC, value range (2,3) */
+}QL_MCM_NW_GSM_CELL_INFO_T;
+
+typedef struct
+{
+ int flag; /**Cell type, 0:present,1:inter,2:intra.*/
+ int cid; /**Cell ID, (0 indicates information is not represent).*/
+ int lcid; /**UTRAN Cell ID (0 indicates information is not present). */
+ int mcc; /**This field should be ignored when cid is not present*/
+ int mnc; /**This field should be ignored when cid is not present*/
+ int lac; /**Location area code. (This field should be ignored when cid is not present). */
+ int uarfcn; /**UTRA absolute RF channel number. */
+ int psc; /**Primary scrambling code. */
+ int lenOfMnc; /**Length of MNC, value range (2,3) */
+}QL_MCM_NW_UMTS_CELL_INFO_T;
+
+typedef struct
+{
+ int flag; /**Cell type, 0:present,1:inter,2:intra.*/
+ int cid; /**<Cell ID, (0 indicates information is not represent).*/
+ int mcc; /**This field should be ignored when cid is not present*/
+ int mnc; /**This field should be ignored when cid is not present*/
+ int tac; /**Tracing area code (This field should be ignored when cid is not present). */
+ int pci; /**Physical cell ID. Range: 0 to 503. */
+ int earfcn; /**E-UTRA absolute radio frequency channel number of the cell. RANGE: 0 TO 65535. */
+ int lenOfMnc; /**Length of MNC, value range (2,3) */
+ int rsrp;
+ int rsrq;
+}QL_MCM_NW_LTE_CELL_INFO_T;
+
+/** Gets cell information. */
+typedef struct
+{
+ int gsm_info_valid; /**< Must be set to TRUE if gsm_info is being passed. */
+ int gsm_info_num; /**< Must be set to the number of elements in entry*/
+ QL_MCM_NW_GSM_CELL_INFO_T gsm_info[CELL_MAX_NUM]; /**< GSM cell information (Serving and neighbor. */
+ int umts_info_valid; /**< Must be set to TRUE if umts_info is being passed. */
+ int umts_info_num; /**< Must be set to the number of elements in entry*/
+ QL_MCM_NW_UMTS_CELL_INFO_T umts_info[CELL_MAX_NUM];/**< UMTS cell information (Serving and neighbor). */
+ int lte_info_valid; /**< Must be set to TRUE if lte_info is being passed. */
+ int lte_info_num; /**< Must be set to the number of elements in entry*/
+ QL_MCM_NW_LTE_CELL_INFO_T lte_info[CELL_MAX_NUM]; /**< LTE cell information (Serving and neighbor). */
+}QL_NW_CELL_INFO_T;
+
+
+typedef void (*QL_NW_EventHandlerFunc_t)(unsigned int ind_flag, void *ind_msg_buf, unsigned int ind_msg_len, void *contextPtr);
+
+QL_NW_ERROR_CODE ql_nw_init ();
+QL_NW_ERROR_CODE ql_nw_release();
+QL_NW_ERROR_CODE ql_nw_set_config(QL_NW_CONFIG_INFO_T *pt_info);
+QL_NW_ERROR_CODE ql_nw_get_config(QL_NW_CONFIG_INFO_T *pt_info);
+QL_NW_ERROR_CODE ql_nw_get_nitz_time_info(QL_NW_NITZ_TIME_INFO_T *pt_info);
+QL_NW_ERROR_CODE ql_nw_event_register(unsigned int bitmask);
+QL_NW_ERROR_CODE ql_nw_get_operator_name(QL_NW_OPERATOR_INFO_T *pt_info);
+QL_NW_ERROR_CODE ql_nw_perform_scan(QL_NW_SCAN_RESULT_LIST_INFO_T *pt_info);
+QL_NW_ERROR_CODE ql_nw_get_reg_status(QL_NW_REG_STATUS_INFO_T *pt_info);
+QL_NW_ERROR_CODE ql_nw_set_selection(QL_NW_SELECTION_INFO_T *pt_info);
+QL_NW_ERROR_CODE ql_nw_get_selection(QL_NW_SELECTION_INFO_T *pt_info);
+QL_NW_ERROR_CODE ql_nw_get_signal_strength(QL_NW_SIGNAL_STRENGTH_INFO_T *pt_info);
+QL_NW_ERROR_CODE ql_nw_get_cell_info(QL_NW_CELL_INFO_T *pt_info);
+QL_NW_ERROR_CODE ql_nw_add_event_handler(QL_NW_EventHandlerFunc_t handlerPtr, void* contextPtr);
+QL_NW_ERROR_CODE ql_nw_get_volte_state(VOLTE_STATE *state);
+/* CSQ: just get rssi and ber */
+QL_NW_ERROR_CODE ql_nw_csq_get_signal_strength(QL_NW_CSQ_SIGNAL_STRENGTH_INFO_T *pt_info);
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/mbtk/include/ql/ql_oe.h b/mbtk/include/ql/ql_oe.h
new file mode 100755
index 0000000..ad4f7db
--- /dev/null
+++ b/mbtk/include/ql/ql_oe.h
@@ -0,0 +1,41 @@
+/**
+ @file
+ ql_oe.h
+
+ @brief
+ Include related header file for quectel common api.
+
+*/
+/*============================================================================
+ Copyright (c) 2017 Quectel Wireless Solution, Co., Ltd. All Rights Reserved.
+ Quectel Wireless Solution Proprietary and Confidential.
+ =============================================================================*/
+/*===========================================================================
+
+ EDIT HISTORY FOR MODULE
+
+This section contains comments describing changes made to the module.
+Notice that changes are listed in reverse chronological order.
+
+
+WHEN WHO WHAT, WHERE, WHY
+---------- ------------ ----------------------------------------------------
+24/07/2019 Nebula.li create
+03/08/2019 Juson.zhang add spi and uart head file
+03/08/2019 Carola.zhang add i2c and gpio head file
+=============================================================================*/
+
+#ifndef _QL_OE_H_
+#define _QL_OE_H_
+
+#include "DSI_ConnectManager.h"
+#include "ql_log.h"
+
+//-------------------------peripheral head file-------------------//
+#include "ql_uart.h"
+#include "ql_spi.h"
+#include "ql_gpio.h"
+#include "ql_i2c.h"
+#include "ql_sms.h"
+
+#endif
diff --git a/mbtk/include/ql/ql_sgmii.h b/mbtk/include/ql/ql_sgmii.h
new file mode 100755
index 0000000..292ab8c
--- /dev/null
+++ b/mbtk/include/ql/ql_sgmii.h
@@ -0,0 +1,162 @@
+/**
+ * @file ql_sgmii.h
+ * @brief Quectel Openlinux SGMII public function declarations.
+ *
+ * @note
+ *
+ * @copyright Copyright (c) 2009-2017 @ Quectel Wireless Solutions Co., Ltd.
+ */
+
+#ifndef __QL_SGMII_H__
+#define __QL_SGMII_H__
+#include "mbtk_type.h"
+
+
+typedef enum {
+ QL_SGMII_AUTONEG_OFF = 0,
+ QL_SGMII_AUTONEG_ON
+} ql_sgmii_autoneg_e;
+
+typedef enum {
+ QL_SGMII_SPEED_10MHZ = 0,
+ QL_SGMII_SPEED_100MHZ,
+ QL_SGMII_SPEED_1000MHZ /* this speed can not support */
+} ql_sgmii_speed_e;
+
+typedef enum {
+ QL_SGMII_DUPLEX_FULL = 0,
+ QL_SGMII_DUPLEX_HALF
+} ql_sgmii_duplex_e;
+
+struct ql_sgmii_info {
+ ql_sgmii_autoneg_e autoneg;
+ ql_sgmii_speed_e speed;
+ ql_sgmii_duplex_e duplex;
+ unsigned long tx_bytes;
+ unsigned long rx_bytes;
+ unsigned long tx_pkts;
+ unsigned long rx_pkts;
+};
+
+/**
+ * Enables the SGMII ethernet module.
+ *
+ * @param None
+ *
+ * @return
+ * On success, 0 is returned. On error, -1 is returned.
+ *
+ */
+extern int ql_sgmii_enable(void);
+
+/**
+ * Disable the SGMII ethernet module.
+ *
+ * @param None
+ *
+ * @return
+ * On success, 0 is returned. On error, -1 is returned.
+ *
+ */
+extern int ql_sgmii_disable(void);
+
+/**
+ * Set the SGMII ethernet configuration: the ethernet auto negotiation configuration.
+ *
+ * @param [in] auto negotiation
+ *
+ * @return
+ * On success, 0 is returned. On error, -1 is returned.
+ *
+ * @dependencies
+ * the ql_sgmii_enable must be set enable
+ *
+ */
+extern int ql_sgmii_autoneg_set(ql_sgmii_autoneg_e autoneg);
+
+/**
+ * Get the SGMII ethernet configuration: the ethernet auto negotiation configuration.
+ *
+ * @param [out] auto negotiation
+ *
+ * @return
+ * On success, 0 is returned. On error, -1 is returned.
+ *
+ * @dependencies
+ * the ql_sgmii_enable must be set enable
+ *
+ */
+extern int ql_sgmii_autoneg_get(ql_sgmii_autoneg_e *autoneg);
+
+/**
+ * Set the SGMII ethernet configuration: the ethernet speed configuration.
+ *
+ * @param [in] ethernet speed
+ *
+ * @return
+ * On success, 0 is returned. On error, -1 is returned.
+ *
+ * @dependencies
+ * the ql_sgmii_enable must be set enable
+ *
+ */
+extern int ql_sgmii_speed_set(ql_sgmii_speed_e speed);
+
+/**
+ * Get the SGMII ethernet configuration: the ethernet speed configuration.
+ *
+ * @param [out] the ethernet current speed
+ *
+ * @return
+ * On success, 0 is returned. On error, -1 is returned.
+ *
+ * @dependencies
+ * the ql_sgmii_enable must be set enable
+ *
+ */
+extern int ql_sgmii_speed_get(ql_sgmii_speed_e *speed);
+
+/**
+ * Set the SGMII ethernet configuration: the ethernet duplex configuration.
+ *
+ * @param [in] ethernet duplex
+ *
+ * @return
+ * On success, 0 is returned. On error, -1 is returned.
+ *
+ * @dependencies
+ * the ql_sgmii_enable must be set enable
+ *
+ */
+extern int ql_sgmii_duplex_set(ql_sgmii_duplex_e duplex);
+
+/**
+ * Get the SGMII ethernet configuration: the ethernet duplex configuration.
+ *
+ * @param [out] the ethernet current duplex
+ *
+ * @return
+ * On success, 0 is returned. On error, -1 is returned.
+ *
+ * @dependencies
+ * the ql_sgmii_enable must be set enable
+ *
+ */
+extern int ql_sgmii_duplex_get(ql_sgmii_duplex_e *duplex);
+
+/**
+ * Get the sgmii ethernet information: transmit and receive bytes, transmit and receive packets, speed, duplex.
+ *
+ * @param [out] the ethernet information
+ *
+ * @return
+ * On success, 0 is returned. On error, -1 is returned.
+ *
+ * @dependencies
+ * the ql_sgmii_enable must be set enable
+ *
+ */
+extern int ql_smgii_info_get(struct ql_sgmii_info *info);
+
+
+#endif /* end of __QL_SGMII_H__ */
diff --git a/mbtk/include/ql/ql_sim.h b/mbtk/include/ql/ql_sim.h
new file mode 100755
index 0000000..38ad65c
--- /dev/null
+++ b/mbtk/include/ql/ql_sim.h
@@ -0,0 +1,840 @@
+/**
+ @file
+ ql_sim.h
+
+ @brief
+ This file provides the definitions for sim, and declares the
+ API functions.
+
+*/
+/*============================================================================
+ Copyright (c) 2017 Quectel Wireless Solution, Co., Ltd. All Rights Reserved.
+ Quectel Wireless Solution Proprietary and Confidential.
+ =============================================================================*/
+/*===========================================================================
+
+ EDIT HISTORY FOR MODULE
+
+This section contains comments describing changes made to the module.
+Notice that changes are listed in reverse chronological order.
+
+
+WHEN WHO WHAT, WHERE, WHY
+---------- ------------ ----------------------------------------------------
+21/08/2019 Nebula.li create
+=============================================================================*/
+
+#ifndef __QL_SIM_H__
+#define __QL_SIM_H__
+
+#include <stdlib.h>
+#include <stdint.h>
+#include <string.h>
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef unsigned char UINT8;
+typedef unsigned short UINT16;
+typedef unsigned long UINT32;
+typedef unsigned int UINT;
+
+typedef enum
+{
+ QL_SIM_SUCCESS,
+ QL_SIM_GENERIC_FAILURE,
+ QL_SIM_RADIO_NOT_AVAILABLE,
+ QL_SIM_INCORRECT_PASSWORD,
+ QL_SIM_CARD_NO_INSERTED,
+ QL_SIM_CARD_BUSY,
+ QL_SIM_CARD_BLOCKED,
+}QL_SIM_ERROR_CODE;
+
+
+#define QL_SIM_MCC_LEN 4 /** Length of the MCC. */
+#define QL_SIM_MNC_MAX 4 /** Maximum length of the MNC. */
+#define QL_SIM_PLMN_NUM_MAX 24 /** Maximum number of PLMN data sets. */
+typedef struct
+{
+ uint8_t mcc[QL_SIM_MCC_LEN]; /**< MCC value in ASCII characters.*/
+ uint8_t mnc[QL_SIM_MNC_MAX]; /**< MNC value in ASCII characters.*/
+}QL_SIM_PLMN_INFO;
+typedef struct
+{
+ uint32_t preferred_operator_list_num; /**< Must be set to the number of elements in preferred_operator_list. */
+ QL_SIM_PLMN_INFO preferred_operator_list[QL_SIM_PLMN_NUM_MAX]; /**< Preferred operator list. */
+}QL_SIM_PREFERRED_OPERATOR_LIST; /* Message */
+
+#define QL_SIM_PIN_LEN_MAX 16 /** Maximum length of PIN data. */
+#define QUEC_CI_SIM_MAX_CMD_DATA_SIZE 261
+
+typedef struct
+{
+ uint8_t pin_value[QL_SIM_PIN_LEN_MAX]; /* Value of the PIN */
+}QL_SIM_VERIFY_PIN_INFO;
+
+typedef struct
+{
+ uint8_t old_pin_value[QL_SIM_PIN_LEN_MAX]; /**< Value of the old PIN as a sequence of ASCII characters. */
+ uint8_t new_pin_value[QL_SIM_PIN_LEN_MAX]; /**< Value of the new PIN as a sequence of ASCII characters. */
+}QL_SIM_CHANGE_PIN_INFO;
+
+typedef struct
+{
+ uint8_t puk_value[QL_SIM_PIN_LEN_MAX]; /**< Value of the PUK as a sequence of ASCII characters. */
+ uint8_t new_pin_value[QL_SIM_PIN_LEN_MAX]; /**< Value of the new PIN as a sequence of ASCII characters. */
+}QL_SIM_UNBLOCK_PIN_INFO;
+
+typedef enum
+{
+ QL_SIM_STAT_NOT_INSERTED,
+ QL_SIM_STAT_READY,
+ QL_SIM_STAT_SIM_PIN,
+ QL_SIM_STAT_SIM_PUK,
+ QL_SIM_STAT_PH_SIM_LOCK_PIN,
+ QL_SIM_STAT_PH_SIM_LOCK_PUK,
+ QL_SIM_STAT_PH_FSIM_PIN,
+ QL_SIM_STAT_PH_FSIM_PUK,
+ QL_SIM_STAT_SIM_PIN2,
+ QL_SIM_STAT_SIM_PUK2,
+ QL_SIM_STAT_PH_NET_PIN,
+ QL_SIM_STAT_PH_NET_PUK,
+ QL_SIM_STAT_PH_NET_SUB_PIN,
+ QL_SIM_STAT_PH_NET_SUB_PUK,
+ QL_SIM_STAT_PH_SP_PIN,
+ QL_SIM_STAT_PH_SP_PUK,
+ QL_SIM_STAT_PH_CORP_PIN,
+ QL_SIM_STAT_PH_CORP_PUK,
+ QL_SIM_STAT_BUSY,
+ QL_SIM_STAT_BLOCKED,
+ QL_SIM_STAT_UNKNOWN
+}QL_SIM_CARD_STATE; /**< Card state. */
+typedef enum
+{
+ QL_SIM_CARD_TYPE_UNKNOWN = 0, /**< Unidentified card type. */
+ QL_SIM_CARD_TYPE_ICC = 1, /**< Card of SIM or RUIM type. */
+ QL_SIM_CARD_TYPE_UICC = 2, /**< Card of USIM or CSIM type. */
+}QL_SIM_CARD_TYPE;
+
+typedef enum CI_SIM_PRIM
+{
+ CI_SIM_PRIM_EXECCMD_REQ = 1, /**< \brief Requests to execute a SIM command \details */
+ CI_SIM_PRIM_EXECCMD_CNF, /**< \brief Confirms the request to execute a SIM command \details */
+ CI_SIM_PRIM_DEVICE_IND, /**< \brief Indicates that the current SIM status changed \details */
+ CI_SIM_PRIM_PERSONALIZEME_REQ, /**< \brief Requests that ME personalization be activated, deactivated, disabled, or queried \details */
+ CI_SIM_PRIM_PERSONALIZEME_CNF, /**< \brief Confirms the request to activate, deactivate, disable, or query ME personalization \details */
+ CI_SIM_PRIM_OPERCHV_REQ, /**< \brief Requests that CHVs be verified, enabled, disabled, changed, unblocked, or queried \details */
+ CI_SIM_PRIM_OPERCHV_CNF, /**< \brief Confirms the request to verify, enable, disable, change, unblock, or query CHVs \details */
+ CI_SIM_PRIM_DOWNLOADPROFILE_REQ, /**< \brief Requests a download of the profile that shows ME capabilities relevant to SIM Application Toolkit functionality \details The functionality of this primitive is equivalent to using the SIM command TERMINAL PROFILE in the CI_SIM_PRIM_EXECCMD_REQ primitive.
+ * This primitive saves upper layer effort to build a header for the Terminal Profile SIM command.
+ * If the pProfile pointer is NULL for this request, the communications interface assumes that the application layer does not support
+ * SIM Application Toolkit operations. */
+ CI_SIM_PRIM_DOWNLOADPROFILE_CNF, /**< \brief Confirms the request to download the profile that shows ME capabilities relevant to SIM Application Toolkit functionality \details */
+ CI_SIM_PRIM_ENDATSESSION_IND, /**< \brief \details NOT SUPPORTED REMOVE FROM API */
+ CI_SIM_PRIM_PROACTIVE_CMD_IND, /**< \brief Indicates a SIMAT proactive command \details This primitive forwards the SIMAT proactive command with its original syntax. The primitive CI_SIM_PRIM_ENABLE_SIMAT_INDS_REQ enables and disables proactive command indication. */
+ CI_SIM_PRIM_PROACTIVE_CMD_RSP, /**< \brief Responds to the SIMAT proactive command \details The primitive forwards a SIMAT proactive command response from the entity, such as DISPLAY or TERMINAL, that received the proactive command. */
+ CI_SIM_PRIM_ENVELOPE_CMD_REQ, /**< \brief Requests that an ENVELOPE command be executed \details */
+ CI_SIM_PRIM_ENVELOPE_CMD_CNF, /**< \brief Confirms the request to execute an ENVELOPE command \details */
+ CI_SIM_PRIM_GET_SUBSCRIBER_ID_REQ, /**< \brief Requests the subscriber ID \details */
+ CI_SIM_PRIM_GET_SUBSCRIBER_ID_CNF, /**< \brief Confirms the request for the subscriber ID \details */
+ CI_SIM_PRIM_GET_PIN_STATE_REQ, /**< \brief Requests the current PIN state \details */
+ CI_SIM_PRIM_GET_PIN_STATE_CNF, /**< \brief Confirms the request for the current PIN state \details */
+ CI_SIM_PRIM_GET_TERMINALPROFILE_REQ, /**< \brief Requests the SIMAT terminal profile \details */
+ CI_SIM_PRIM_GET_TERMINALPROFILE_CNF, /**< \brief Confirms the request and returns the SIMAT terminal profile \details */
+ CI_SIM_PRIM_ENABLE_SIMAT_INDS_REQ, /**< \brief Requests that SIMAT related indications, such as the proactive SIM command indication and the SIMAT session ended indication, be enabled or disabled \details */
+ CI_SIM_PRIM_ENABLE_SIMAT_INDS_CNF, /**< \brief Confirms the request to enable or disable SIMAT related indications \details */
+ CI_SIM_PRIM_LOCK_FACILITY_REQ, /**< \brief Requests to lock, unlock, or query SIM-related ME \details */
+ CI_SIM_PRIM_LOCK_FACILITY_CNF, /**< \brief Confirms a request to lock, unlock, or query SIM-related ME \details */
+ CI_SIM_PRIM_GET_FACILITY_CAP_REQ, /**< \brief Requests the bitmask of supported SIM-related facility codes \details */
+ CI_SIM_PRIM_GET_FACILITY_CAP_CNF, /**< \brief Confirms the request for the bitmask of supported SIM-related facility codes \details */
+ CI_SIM_PRIM_GET_SIMAT_NOTIFY_CAP_REQ, /**< \brief Requests SIM Application Toolkit (SIMAT) notification capability information. \details */
+ CI_SIM_PRIM_GET_SIMAT_NOTIFY_CAP_CNF, /**< \brief Confirms the request for SIM Application Toolkit (SIMAT) notification capability information \details */
+ CI_SIM_PRIM_GET_CALL_SETUP_ACK_IND, /**< \brief Indicates that the SIM Application Toolkit (SIMAT) has initiated an outgoing CALL SETUP operation, and requests confirmation/acknowledgment from the mobile user \details The application returns the required acknowledgment in a CI_SIM_PRIM_GET_CALL_SETUP_ACK_RSP response. */
+ CI_SIM_PRIM_GET_CALL_SETUP_ACK_RSP, /**< \brief Responds with an acknowledgment from the mobile user for an outgoing CALL SETUP indication \details The mobile user may accept (allow) or reject (disallow) the SIMAT initiated CALL SETUP operation.
+* If the user allows the CALL SETUP, it proceeds. If the user disallows the CALL SETUP, it is aborted.
+* If the CALL SETUP is allowed to proceed, the MO call progression is managed by the normal call control procedures. See the
+* CI CC Service Group API definition for more information. */
+
+ /* service provider name */
+ CI_SIM_PRIM_GET_SERVICE_PROVIDER_NAME_REQ, /**< \brief Requests the service provider name, as stored on SIM or USIM \details The PIN status is not required to read this information. */
+ CI_SIM_PRIM_GET_SERVICE_PROVIDER_NAME_CNF, /**< \brief Confirms the request to get the service provider name, as stored on SIM or USIM \details The service provider name is coded as 7-bit GSM characters, with the most-significant bit of each character set to zero.
+ * The service provider name pointer is NULL if the result code indicates an error. */
+
+ /* Message Waiting Information */
+ CI_SIM_PRIM_GET_MESSAGE_WAITING_INFO_REQ, /**< \brief Requests to get message waiting information stored on SIM or USIM \details The PIN status is required to read this information. */
+ CI_SIM_PRIM_GET_MESSAGE_WAITING_INFO_CNF, /**< \brief Confirms the request to get message waiting information stored on SIM or USIM \details If the result code indicates an error, the message waiting status information is not useful.
+ * There is a difference between the message categories defined for 2G and 3G SIM storage. This is rationalized by the CCI implementation. */
+ CI_SIM_PRIM_SET_MESSAGE_WAITING_INFO_REQ, /**< \brief Requests to set message waiting information on SIM or USIM \details Requires PIN status to write this information. There is a difference between the message categories defined for 2G and 3G SIM storage. This is rationalized by the CCI implementation. */
+ CI_SIM_PRIM_SET_MESSAGE_WAITING_INFO_CNF, /**< \brief Confirms a request to set the message waiting information on SIM or USIM \details */
+
+ /* SIM Service Table */
+ CI_SIM_PRIM_GET_SIM_SERVICE_TABLE_REQ, /**< \brief Requests to get the SIM Service Table from SIM or USIM \details The PIN status is required to read this information. If CPHS features are not supported by the handset, this information is unavailable. */
+ CI_SIM_PRIM_GET_SIM_SERVICE_TABLE_CNF, /**< \brief Confirms the request to get the SIM Service Table from SIM or USIM \details If CPHS features are not supported by the handset, this information is unavailable. */
+
+ /* CPHS Customer Service Profile */
+ CI_SIM_PRIM_GET_CUSTOMER_SERVICE_PROFILE_REQ, /**< \brief Requests to get the CPHS customer service profile from SIM or USIM \details The PIN status is required to read this information. If CPHS features are not supported by the handset, this information is unavailable. */
+ CI_SIM_PRIM_GET_CUSTOMER_SERVICE_PROFILE_CNF, /**< \brief Confirms the request and returns the CPHS customer service profile from SIM or USIM. \details If CPHS features are not supported by the handset, this information is unavailable. */
+
+ /* Display Alpha and Icon Identifiers */
+ CI_SIM_PRIM_SIMAT_DISPLAY_INFO_IND, /**< \brief Indicates to the application that text and optionally an icon should be displayed.
+ * The text to be displayed results from a SAT transaction such as SS, SMS, USSD, SS, or send DTMF. \details */
+
+ /* Default Language */
+ CI_SIM_PRIM_GET_DEFAULT_LANGUAGE_REQ, /**< \brief Requests the default language stored on the SIM/USIM card \details */
+ CI_SIM_PRIM_GET_DEFAULT_LANGUAGE_CNF, /**< \brief Confirms the request to get the default language stored on the SIM/USIM card and returns the first entry in the EF_LP file \details Extract from ETSI TS 102.221: "the language code is a pair of alphanumeric characters, as defined in ISO 639 [30].
+ * Each alphanumeric character shall be coded on one byte using the SMS default 7-bit coded alphabet as defined in TS 23.038
+ * ("Man-machine Interface (MMI) of the User Equipment", revision 3.4.0, Doc Number 3GPP TS 22.030)
+ * with bit 8 set to 0.". 'FF FF' means undefined default language. */
+
+ /* Generic SIM commands */
+ CI_SIM_PRIM_GENERIC_CMD_REQ, /**< \brief Requests to send a generic command to the SIM/USIM card
+ * \details The request reflects the structure of a SIM application protocol data unit (APDU),
+ * as defined in ETSI 102.221. The 'class of instruction' element is not controlled by the user, comm. use class 0x0 or 0xa depending on the command.
+ * Note that updating a file using this command only updates the file on the SIM; it does not trigger a REFRESH of the ME memory. */
+ CI_SIM_PRIM_GENERIC_CMD_CNF, /**< \brief Confirms a request to send a generic command to the SIM or USIM \details */
+
+ /* Indication of card type, status and PIN state */
+ CI_SIM_PRIM_CARD_IND, /**< \brief Indicates that the current SIM/USIM status changed \details This indication is sent each time CI_SIM_PRIM_DEVICE_IND is sent. */
+
+ CI_SIM_PRIM_IS_EMERGENCY_NUMBER_REQ, /**< \brief Requests to determine if the specified dial number is an emergency call code \details */
+ CI_SIM_PRIM_IS_EMERGENCY_NUMBER_CNF, /**< \brief Confirms the request to determine if the specified number is an emergency call code \details If a SIM card is present, the EF_ECC SIM card file is searched for the specified number. If a SIM card is not present, a default table of possible emergency call codes is searched for the specified number, as per TS 22.101. */
+
+ CI_SIM_PRIM_SIM_OWNED_IND, /**< \brief Indicates whether the SIM is owned
+ * \details This indication is sent each time a SIM-OK notification is received
+ * from the protocol stack and indicates that the SIM card can be accessed. SIM owned is TRUE if the IMSI did not change
+ * since the last SIM-OK notification. */
+ CI_SIM_PRIM_SIM_CHANGED_IND, /**< \brief Indicates whether the IMSI on the current SIM has changed
+ * \details This indication is sent each time a SIM-OK notification is received
+ * from the protocol stack. */
+ CI_SIM_PRIM_DEVICE_STATUS_REQ, /**< \brief Requests SIM status \details */
+ CI_SIM_PRIM_DEVICE_STATUS_CNF, /**< \brief Confirms the request for the current SIM status \details */
+ CI_SIM_PRIM_READ_MEP_CODES_REQ, /**< \brief Requests the MEP codes for a specified category \details This operation does not require a password.*/
+ CI_SIM_PRIM_READ_MEP_CODES_CNF, /**< \brief Confirms the request and returns the MEP codes for the specified category \details */
+ CI_SIM_PRIM_UDP_LOCK_REQ, /**< \brief Requests an activate, deactivate, or query UDP lock \details An operation can be done on only one category at a time. A password is required for an unlock operation. */
+ CI_SIM_PRIM_UDP_LOCK_CNF, /**< \brief Confirms the UDP lock request \details */
+ CI_SIM_PRIM_UDP_CHANGE_PASSWORD_REQ, /**< \brief Requests to set a new password for a UDP lock \details */
+ CI_SIM_PRIM_UDP_CHANGE_PASSWORD_CNF, /**< \brief Confirms the request to set a new password for a UDP lock \details */
+ CI_SIM_PRIM_UDP_ASL_REQ, /**< \brief Requests to manipulate the UDP authorized SIM list \details */
+ CI_SIM_PRIM_UDP_ASL_CNF, /**< \brief Confirms the request to manipulate the UDP authorized SIM list \details */
+/* Michal Bukai - Virtual SIM support - START */
+ CI_SIM_PRIM_SET_VSIM_REQ, /**< \brief Requests to enable virtual SIM
+ * \details Virtual SIM can be enabled if no SIM is inserted.
+ * An error is sent if the user tried to enable virtual SIM while a SIM is inserted.
+ * The application needs to reset the communication subsystem after receiving a confirmation. */
+ CI_SIM_PRIM_SET_VSIM_CNF, /**< \brief Confirms setting virtual SIM
+ * \details Virtual SIM can be enabled if no SIM is inserted.
+ * An error is sent if the user tried to enable virtual SIM while a SIM is inserted.
+ * The application needs to reset the communication subsystem after receiving a confirmation. */
+ CI_SIM_PRIM_GET_VSIM_REQ, /**< \brief Requests the current setting of the virtual SIM (enabled / disabled) \details*/
+ CI_SIM_PRIM_GET_VSIM_CNF, /**< \brief Confirms the request and returns the current setting of the virtual SIM (enabled / disabled) \details*/
+/* Michal Bukai - Virtual SIM support - END */
+/*Michal Bukai - OTA support for AT&T - START*/
+ CI_SIM_PRIM_CHECK_MMI_STATE_IND, /**< \brief \details NOT SUPPORTED REMOVE FROM API */
+ CI_SIM_PRIM_CHECK_MMI_STATE_RSP, /**< \brief \details NOT SUPPORTED REMOVE FROM API */
+/*Michal Bukai - OTA support for AT&T - END*/
+/*Michal Bukai - BT SAP support - START*/
+ CI_SIM_PRIM_BTSAP_CONNECT_REQ, /**< \brief Requests to start a BT SAP session \details */
+ CI_SIM_PRIM_BTSAP_CONNECT_CNF, /**< \brief Confirms the request to start a BT SAP session \details */
+ CI_SIM_PRIM_BTSAP_DISCONNECT_REQ, /**< \brief Requests to disconnect from a BT SAP session \details */
+ CI_SIM_PRIM_BTSAP_DISCONNECT_CNF, /**< \brief Confirms the request to disconnect from a BT SAP session \details */
+ CI_SIM_PRIM_BTSAP_TRANSFER_APDU_REQ, /**< \brief Requests to transfer APDU to the SIM/USIM \details */
+ CI_SIM_PRIM_BTSAP_TRANSFER_APDU_CNF, /**< \brief Confirms the request to transfer APDU to the SIM/USIM and may return a response APDU from the SIM/USIM \details */
+ CI_SIM_PRIM_BTSAP_TRANSFER_ATR_REQ, /**< \brief Requests to get Answer To Reset data from SIM/USIM \details */
+ CI_SIM_PRIM_BTSAP_TRANSFER_ATR_CNF, /**< \brief Confirms the request to get Answer To Reset data from SIM/USIM \details */
+ CI_SIM_PRIM_BTSAP_SIM_CONTROL_REQ, /**< \brief Requests to control SIM/USIM status, this command can be used to power off, power on or reset the SIM/USIM \details */
+ CI_SIM_PRIM_BTSAP_SIM_CONTROL_CNF, /**< \brief Confirms the SIM control request \details */
+ CI_SIM_PRIM_BTSAP_STATUS_IND, /**< \brief indicates a change in the availably of the subscription module during BT SAP connection \details */
+ CI_SIM_PRIM_BTSAP_STATUS_REQ, /**< \brief Requests the subscription module availability status during BT SAP connection \details */
+ CI_SIM_PRIM_BTSAP_STATUS_CNF, /**< \brief Confirms the request and returns the status of the subscription module during BT SAP connection \details */
+ CI_SIM_PRIM_BTSAP_SET_TRANSPORT_PROTOCOL_REQ, /**< \brief Requests to set transport protocol \details */
+ CI_SIM_PRIM_BTSAP_SET_TRANSPORT_PROTOCOL_CNF, /**< \brief Confirms the request to set transport protocol \details */
+/*Michal Bukai - BT SAP support - END*/
+/*Michal Bukai - Add IMSI to MEP code group - START*/
+ CI_SIM_PRIM_MEP_ADD_IMSI_REQ, /**< \brief Requests to add the current IMSI to MEP SIM /USIM code group
+ * \details This operation requires a password.
+ * This operation requires that SIM/USIM personalization is deactivated.*/
+ CI_SIM_PRIM_MEP_ADD_IMSI_CNF, /**< \brief Confirms the request to add the current IMSI to MEP SIM /USIM code group. \details */
+/*Michal Bukai - Add IMSI to MEP code group - END*/
+/*Michal Bukai - SIM Logic CH - NFC\ISIM support - START*/
+ CI_SIM_PRIM_OPEN_LOGICAL_CHANNEL_REQ, /**< \brief Requests to open a logical channel that will be used to access the UICC application identified by DFname. \details The UICC will open a new logical channel; select the application identified by the DFname, and return a session ID that will be used to identify the new channel.*/
+ CI_SIM_PRIM_OPEN_LOGICAL_CHANNEL_CNF, /**< \brief Confirms the request to open a logical channel and returns the session ID. \details */
+ CI_SIM_PRIM_CLOSE_LOGICAL_CHANNEL_REQ, /**< \brief Requests to close a logical channel. \details */
+ CI_SIM_PRIM_CLOSE_LOGICAL_CHANNEL_CNF, /**< \brief Confirms the request to close a logical channel. \details */
+/*Michal Bukai - SIM Logic CH - NFC\ISIM support support - END*/
+/*Michal Bukai - additional SIMAT primitives - START*/
+ CI_SIM_PRIM_SIMAT_CC_STATUS_IND, /**< \brief Indicates the SIM Application Toolkit (SIMAT) call control status response
+ * \details If call control service in SIMAT is activated, all dialled digit strings, supplementary service control strings and USSD strings are passed to the UICC before the call setup request,
+ * the supplementary service operation or the USSD operation is sent to the network.
+ * The SIMAT has the ability to allow, bar or modify the request.
+ * In addition SIMAT has the ability to replace the request by another operation, for instance call request may be replaced by SS or USSD operation.
+ */
+ CI_SIM_PRIM_SIMAT_SEND_CALL_SETUP_RSP_IND, /**< \brief Indicates the response sent to SIM Application Toolkit (SIMAT) after call setup. \details */
+ CI_SIM_PRIM_SIMAT_SEND_SS_USSD_RSP_IND, /**< \brief Indicates the response sent to SIM Application Toolkit (SIMAT) after SS or USSD operation. \details */
+ CI_SIM_PRIM_SIMAT_SM_CONTROL_STATUS_IND, /**< \brief Indicates the SIM Application Toolkit (SIMAT) short message control status response.
+ \details If SM control service in SIMAT is activated, all MO short messages are passed to the UICC before the short message is sent to the network.
+ * The SIMAT has the ability to allow, bar or modify the destination address.
+ */
+ CI_SIM_PRIM_SIMAT_SEND_SM_RSP_IND, /**< \brief Indicates the response sent to SIM Application Toolkit (SIMAT) after SM operation. \details */
+/*Michal Bukai - additional SIMAT primitives - END*/
+
+/*Michal Bukai - RSAP support - START*/
+ CI_SIM_PRIM_RSAP_CONN_REQ_IND, /**< \brief Request to connect to a remote SIM received from the protocol stack \details */
+ CI_SIM_PRIM_RSAP_CONN_REQ_RSP, /**< \Response to protocol stack request to connect to a remote SIM \details */
+ CI_SIM_PRIM_RSAP_STAT_REQ, /**< \brief Request received from a SAP conversion module to update the RSAP card status.
+ * \details This request is actually an indication from a remote SAP conversion module indicating a status change in the remote connection or card status */
+ CI_SIM_PRIM_RSAP_STAT_CNF, /**< \brief Confirms that the update of the remote card status was received by the protocol stack \details */
+ CI_SIM_PRIM_RSAP_DISCONN_REQ_IND, /**< \brief Request to disconnect from a remote SIM received from the protocol stack \details */
+ CI_SIM_PRIM_RSAP_DISCONN_REQ_RSP, /**< \Response to protocol stack request to disconnect from a remote SIM \details */
+ CI_SIM_PRIM_RSAP_GET_ATR_IND, /**< \brief Request to get ATR from a remote SIM received from the protocol stack \details */
+ CI_SIM_PRIM_RSAP_GET_ATR_RSP, /**< \brief Response from a remote SIM with the ATR APDU \details */
+ CI_SIM_PRIM_RSAP_GET_STATUS_REQ_IND, /**< \brief Request from the protocol stack to get the RSAP connection status.
+ * \details The request is answered by CI_SIM_PRIM_RSAP_CONN_STAT_REQ */
+
+ CI_SIM_PRIM_RSAP_SET_TRAN_P_REQ_IND, /**< \brief Request from the protocol stack to change the transport protocol of the remote SIM \details */
+ CI_SIM_PRIM_RSAP_SET_TRAN_P_REQ_RSP, /**< \brief Response to a protocol stack request to change the transport protocol of the remote SIM.
+ * \details If the requested transport protocol is supported by the remote SIM and by the SAP conversion module,
+ * the requested transport protocol is selected and the remote SIM is reset. If the requested transport protocol is not supported,
+ * SIM status is changed to CARD_NOT_ACC. The request is followed by CI_SIM_PRIM_RSAP_CONN_STAT_REQ, which indicates the new remote SIM status.*/
+ CI_SIM_PRIM_RSAP_SIM_CONTROL_REQ_IND, /**< \brief Request from the protocol stack to control the remote SIM status.
+ * \details This command can be used to power off, power on, or reset the remote SIM */
+ CI_SIM_PRIM_RSAP_SIM_CONTROL_REQ_RSP, /**< \brief Response to a protocol stack request to control the remote SIM status.
+ * \details The response is followed by CI_SIM_PRIM_RSAP_CONN_STAT_REQ, which indicates the new status of the remote SIM.*/
+ CI_SIM_PRIM_RSAP_SIM_SELECT_REQ, /**< \brief Request to select the local or remote SIM \details */
+ CI_SIM_PRIM_RSAP_SIM_SELECT_CNF, /**< \brief Confirms the request to select the local or remote SIM \details */
+ CI_SIM_PRIM_RSAP_STATUS_IND, /**< \brief Indicates that the current SIM/USIM status changed during RSAP connection \details */
+ CI_SIM_PRIM_RSAP_TRANSFER_APDU_IND, /**< \brief Request from the protocol stack to transfer APDU to the remote SIM \details */
+ CI_SIM_PRIM_RSAP_TRANSFER_APDU_RSP, /**< \brief Request from the protocol stack to transfer APDU to the remote SIM.
+ * \details A response APDU is returned if the transfer of APDU is successful.*/
+ /*Michal Bukai - RSAP support - END*/
+
+ CI_SIM_PRIM_DEVICE_RSP, /**< \brief Response to CI_SIM_PRIM_DEVICE_RSP.
+ * \details This response is confirms that the CI_SIM_PRIM_DEVICE_RSP has been received and handled. Specially the SIM clock stop level. This indicates the Comm that D2 can be enabled on SIM driver level.*/
+//ICC ID feature
+ CI_SIM_PRIM_ICCID_IND, /**< \brief Indicates the content of the EF-ICCID file. This indication is sent at init. The EF-ICCID can be accessed even if PIN is required.*/
+ CI_SIM_PRIM_GET_ICCID_REQ, /**< \brief Request to get the content of the EF-ICCID file. Can be sent if ICC is ready.
+ * \details Can be sent when the SIM state is CI_SIM_ST_READY or CI_SIM_ST_INSERTED. Otherwise the request will fail.*/
+
+ CI_SIM_PRIM_GET_ICCID_CNF, /**< \brief Confirmation with the ICC id to the request to get the ICC Id.*/
+//ICC ID feature
+ CI_SIM_PRIM_EAP_AUTHENTICATION_REQ, /**< \brief Requests to exchange EAP packets with the UICC. */
+ CI_SIM_PRIM_EAP_AUTHENTICATION_CNF, /**< \brief Confirms the EAP authentication request and returns the authentication response */
+
+ CI_SIM_EAP_RETRIEVE_PARAMETERS_REQ, /**< \brief Requests to retrieve EAP parameters from the UICC. */
+ CI_SIM_EAP_RETRIEVE_PARAMETERS_CNF, /**< \brief Confirms the request to retrieve EAP parameters and returns the contents of the
+ * \elementary file corresponding to requested parameter.*/
+
+ CI_SIM_PRIM_GET_NUM_UICC_APPLICATIONS_REQ,/**< \brief Requests to get number of applications available on the UICC. */
+ CI_SIM_PRIM_GET_NUM_UICC_APPLICATIONS_CNF,/**< \brief Confirms the request to get number of applications available on the UICC. */
+
+ CI_SIM_PRIM_GET_UICC_APPLICATIONS_INFO_REQ, /**< \brief Requests to get list of applications available on the UICC. */
+ CI_SIM_PRIM_GET_UICC_APPLICATIONS_INFO_CNF, /**< \brief Confirms the request to get list of applications available on the UICC. */
+ /* ADD NEW COMMON PRIMITIVES HERE, BEFORE 'CI_SIM_PRIM_LAST_COMMON_PRIM' */
+ /*2013.12.11, added by Xili for CQ00051618, begin*/
+ CI_SIM_PRIM_ISIM_AID_IND, /**< \brief Indicates the content of the ISIM Aid. This indication is sent at init if it had one. */
+ /*2013.12.11, added by Xili for CQ00051618, end*/
+
+ /* Add by jungle for CQ00057999 on 2014-04-02 Begin */
+ CI_SIM_PRIM_APP_PIN_REQ,
+ CI_SIM_PRIM_APP_PIN_CNF,
+ /* Add by jungle for CQ00057999 on 2014-04-02 End*/
+
+ /*2014.05.08, added by Xili for CQ00060947, begin*/
+ CI_SIM_PRIM_ADMIN_DATA_IND,
+ /*2014.05.08, added by Xili for CQ00060947, end*/
+
+ /*2015.03.19, mod by Xili for adding ECC list indication, CQ00088196 begin*/
+ CI_SIM_PRIM_ECC_LIST_IND,
+ /*2015.03.19, mod by Xili for adding ECC list indication, CQ00088196 end*/
+
+ /* Mod by jungle for CQ00089692 on 2015-04-08 Begin */
+ CI_SIM_PRIM_EXEC_LARGE_CMD_CNF,
+ CI_SIM_PRIM_GENERIC_LARGE_CMD_CNF,
+ /* Mod by jungle for CQ00089692 on 2015-04-08 End */
+
+ CI_SIM_PRIM_UPDATE_COUNT_REQ,
+ CI_SIM_PRIM_UPDATE_COUNT_CNF,
+
+ /* END OF COMMON PRIMITIVES LIST */
+ CI_SIM_PRIM_LAST_COMMON_PRIM
+
+ /* The customer specific extension primitives are added starting from
+ * CI_SIM_PRIM_firstCustPrim = CI_SIM_PRIM_LAST_COMMON_PRIM as the first identifier.
+ * The actual primitive names and IDs are defined in the associated
+ * 'ci_sim_cust_xxx.h' file.
+ */
+
+ /* DO NOT ADD ANY MORE PRIMITIVES HERE */
+
+} _QuecCiSimPrim;
+
+typedef struct
+{
+ uint8_t pin1_num_retries; /**< Number of PIN 1 retries. */
+ uint8_t puk1_num_retries; /**< Number of PUK 1 retries. */
+ uint8_t pin2_num_retries; /**< Number of PIN 2 retries. */
+ uint8_t puk2_num_retries; /**< Number of PUK 2 retries. */
+}QL_SIM_CARD_PIN_INFO;
+
+typedef struct
+{
+ QL_SIM_CARD_TYPE card_type; // SIM card type
+ QL_SIM_CARD_STATE card_state; //SIM card state
+ QL_SIM_CARD_PIN_INFO card_pin_info; // PIN info
+}QL_SIM_CARD_STATUS_INFO;
+
+
+#define QL_SIM_DATA_LEN_MAX 255
+typedef struct
+{
+ uint32_t data_len; /**< Must be set to the number of elements in data. */
+ uint8_t data[QL_SIM_DATA_LEN_MAX]; /**< Data retrieved from the card. */
+}QL_SIM_CARD_FILE_DATA;
+
+typedef enum
+{
+ QL_SIM_FILE_TYPE_UNKNOWN = 0,/**< Unknown file type */
+ QL_SIM_FILE_TYPE_TRANSPARENT = 1,/**< File structure consisting of a sequence of bytes. */
+ QL_SIM_FILE_TYPE_CYCLIC = 2,/**< File structure consisting of a sequence of records, each containing the same fixed size in
+ chronological order. Once all the records have been used, the oldest data is overwritten. */
+ QL_SIM_FILE_TYPE_LINEAR_FIXED = 3, /**< File structure consisting of a sequence of records, each containing the same fixed size. */
+}QL_SIM_FILE_TYPE;
+
+typedef enum
+{
+ QL_SIM_FILE_ACCESS_TYPE_ALWAYS =0,
+ QL_SIM_FILE_ACCESS_TYPE_CHV1 =1,
+ QL_SIM_FILE_ACCESS_TYPE_CHV2 =2,
+ QL_SIM_FILE_ACCESS_TYPE_ADM =3,
+}QL_SIM_FILE_ACCESS_TYPE;
+
+typedef enum
+{
+ QL_SIM_FILE_STATUS_INVALID =0,
+ QL_SIM_FILE_STATUS_EFFECTIVE =1,
+}QL_SIM_FILE_STATUS;
+
+typedef struct
+{
+ QL_SIM_FILE_ACCESS_TYPE read_access;
+ QL_SIM_FILE_ACCESS_TYPE update_access;
+}QL_SIM_FILE_ACCESS_INFO;
+
+typedef struct
+{
+ unsigned int id;
+ QL_SIM_FILE_TYPE type; /**< File type: */
+ QL_SIM_FILE_ACCESS_INFO access; /**< File access conditions: */
+ QL_SIM_FILE_STATUS status; /**< File status: */
+ unsigned int size; /**< Size of transparent files.*/
+ unsigned int record_len; /**< Size of each cyclic or linear fixed file record.*/
+ unsigned int record_count; /**< Number of cyclic or linear fixed file records.*/
+}QL_SIM_FILE_INFO;
+
+typedef struct
+{
+ int sw1;
+ int sw2;
+}QL_SIM_FILE_OPERATION_RET;
+
+typedef struct
+{ // when write, if phonenum is empty, it means to delete this item specified by index
+ int index; // the record index in phone book
+ uint8_t username[32]; // username
+ uint8_t phonenum[24]; // Phone number, it can include '+'*/
+}QL_SIM_PHONE_BOOK_RECORD_INFO;
+
+typedef struct
+{
+ int total; //total number of locations
+ int used; //used number of locations
+}QL_SIM_PHONEBOOK_STATE;
+
+#define QL_SIM_PHONE_BOOK_RECORDS_MAX_COUNT 20
+typedef struct
+{
+ int record_count; //the count of record
+ QL_SIM_PHONE_BOOK_RECORD_INFO record[QL_SIM_PHONE_BOOK_RECORDS_MAX_COUNT]; // the list of record
+}QL_SIM_PHONE_BOOK_RECORDS_INFO;
+
+typedef enum
+{
+ QL_SIM_PHONE_BOOK_STORAGE_DC,
+ QL_SIM_PHONE_BOOK_STORAGE_EN,
+ QL_SIM_PHONE_BOOK_STORAGE_FD,
+ QL_SIM_PHONE_BOOK_STORAGE_LD,
+ QL_SIM_PHONE_BOOK_STORAGE_MC,
+ QL_SIM_PHONE_BOOK_STORAGE_ME,
+ QL_SIM_PHONE_BOOK_STORAGE_MT,
+ QL_SIM_PHONE_BOOK_STORAGE_ON,
+ QL_SIM_PHONE_BOOK_STORAGE_RC,
+ QL_SIM_PHONE_BOOK_STORAGE_SM,
+ QL_SIM_PHONE_BOOK_STORAGE_AP,
+ QL_SIM_PHONE_BOOK_STORAGE_MBDN,
+ QL_SIM_PHONE_BOOK_STORAGE_MN,
+ QL_SIM_PHONE_BOOK_STORAGE_SDN,
+ QL_SIM_PHONE_BOOK_STORAGE_ICI,
+ QL_SIM_PHONE_BOOK_STORAGE_OCI,
+}QL_SIM_PHONE_BOOK_STORAGE;
+
+
+
+typedef enum
+{
+ QL_SIM_CARD_STATUS_UPDATE_EVENT = 0, /**< Card status update event. */
+
+}QL_SIM_NFY_MSG_ID;
+
+typedef void (*QL_SIM_CardStatusIndMsgHandlerFunc_t)
+(
+ QL_SIM_NFY_MSG_ID msg_id,
+ void *pv_data,
+ int pv_data_len,
+ void *contextPtr
+);
+
+
+QL_SIM_ERROR_CODE ql_sim_init();
+
+QL_SIM_ERROR_CODE ql_sim_release();
+
+/* Add callback function if anything changed specified by the mask in QL_LOC_Set_Indications*/
+QL_SIM_ERROR_CODE ql_sim_add_event_handler(QL_SIM_CardStatusIndMsgHandlerFunc_t handlerPtr, void* contextPtr);
+
+/*===========================================================================
+
+ FUNCTION: ql_sim_get_imsi
+
+===========================================================================*/
+/*
+ @brief
+ Function sends a command to the modem to retrieve the IMSI (for 3GPP)
+ or IMSI_M (for 3GPP2) from the SIM in ASCII form
+
+ @return
+ void
+*/
+/*=========================================================================*/
+QL_SIM_ERROR_CODE ql_sim_get_imsi
+(
+ uint8_t *imsi, ///< [OUT] IMSI buffer
+ size_t imsiLen ///< [IN] IMSI buffer length
+);
+
+
+/*===========================================================================
+
+ FUNCTION: ql_sim_get_iccid
+
+===========================================================================*/
+/*
+ @brief
+ Function sends a command to the modem to retrieve the ICCID from
+ SIM in ASCII form
+
+ @return
+ QL_SIM_ERROR_CODE
+*/
+/*=========================================================================*/
+QL_SIM_ERROR_CODE ql_sim_get_iccid
+(
+ uint8_t *iccid, ///< [OUT] ICCID
+ size_t iccidLen ///< [IN] ICCID buffer length
+);
+
+
+/*===========================================================================
+
+ FUNCTION: QL_SIM_GetPhoql_sim_get_phonenumberneNumber
+
+===========================================================================*/
+/*
+ @brief
+ Function sends a command to the modem to retrieve the device phone
+ number from MSISDN (for 3GPP) or MDN (for 3GPP2) from the SIM in
+ ASCII form
+
+ @return
+ QL_SIM_ERROR_CODE
+*/
+/*=========================================================================*/
+QL_SIM_ERROR_CODE ql_sim_get_phonenumber
+(
+ uint8_t *phone_num, ///< [OUT] phone number
+ size_t phoneLen ///< [IN] phone number buffer length
+);
+
+/*===========================================================================
+
+ FUNCTION: ql_sim_get_operator_plmn_list
+
+===========================================================================*/
+/*
+ @brief
+ Function sends multiple record based read commands to the modem
+ to retrieve a list of operator preffered PLMN.
+
+ @note
+ Function should only be called for SIM/USIM
+
+ @return
+ QL_SIM_ERROR_CODE
+*/
+/*=========================================================================*/
+QL_SIM_ERROR_CODE ql_sim_get_operator_plmn_list
+(
+ QL_SIM_PREFERRED_OPERATOR_LIST *pt_info ///< [OUT] Preferred operator list
+);
+
+/*===========================================================================
+
+ FUNCTION: ql_sim_verify_pin
+
+===========================================================================*/
+/*
+ @brief
+ Function sends a command to the modem to verify either PIN1 or PIN2
+
+ @return
+ QL_SIM_ERROR_CODE
+*/
+/*=========================================================================*/
+QL_SIM_ERROR_CODE ql_sim_verify_pin
+(
+ QL_SIM_VERIFY_PIN_INFO *pt_info // [IN] PIN/PIN2
+);
+
+
+/*===========================================================================
+
+ FUNCTION: ql_sim_change_pin
+
+===========================================================================*/
+/*
+ @brief
+ Function sends a command to the modem to change the value of
+ either PIN
+
+ @return
+ QL_SIM_ERROR_CODE
+*/
+/*=========================================================================*/
+QL_SIM_ERROR_CODE ql_sim_change_pin
+(
+ QL_SIM_CHANGE_PIN_INFO *pt_info // [IN] PIN
+);
+
+
+/*===========================================================================
+
+ FUNCTION: ql_sim_unblock_pin
+
+===========================================================================*/
+/*
+ @brief
+ Function sends a command to the modem to unblock a PIN1 or PIN2 that
+ has been blocked
+
+ @return
+ QL_SIM_ERROR_CODE
+*/
+/*=========================================================================*/
+QL_SIM_ERROR_CODE ql_sim_unblock_pin
+(
+ QL_SIM_UNBLOCK_PIN_INFO *pt_info // [IN] input PUK/PUK2 and new PIN/PIN2
+);
+
+/*===========================================================================
+
+ FUNCTION: ql_sim_enable_pin
+
+===========================================================================*/
+/*
+ @brief
+ Function sends a command to the modem to enable PIN
+
+ @return
+ QL_SIM_ERROR_CODE
+*/
+/*=========================================================================*/
+QL_SIM_ERROR_CODE ql_sim_enable_pin
+(
+ QL_SIM_VERIFY_PIN_INFO *pt_info // [IN] PIN
+);
+
+/*===========================================================================
+
+ FUNCTION: ql_sim_disable_pin
+
+===========================================================================*/
+/*
+ @brief
+ Function sends a command to the modem to disable PIN
+
+ @return
+ QL_SIM_ERROR_CODE
+*/
+/*=========================================================================*/
+QL_SIM_ERROR_CODE ql_sim_disable_pin
+(
+ QL_SIM_VERIFY_PIN_INFO *pt_info // [IN] PIN
+);
+
+
+/*===========================================================================
+
+ FUNCTION: ql_sim_get_card_status
+
+===========================================================================*/
+/*
+ @brief
+ Function get sim card status informations
+
+ @return
+ QL_SIM_ERROR_CODE
+*/
+/*=========================================================================*/
+QL_SIM_ERROR_CODE ql_sim_get_card_status
+(
+ QL_SIM_CARD_STATUS_INFO *pt_info ///< [OUT] sim card status info output
+);
+
+
+
+/*===========================================================================
+
+ FUNCTION: ql_sim_get_file_info
+
+===========================================================================*/
+/*
+ @brief
+ Function sends a command to the modem to retrieve the file info
+
+ @return
+ QL_SIM_ERROR_CODE
+*/
+/*=========================================================================*/
+QL_SIM_ERROR_CODE ql_sim_get_file_info
+(
+ unsigned int fileid,
+ QL_SIM_FILE_INFO *file_info, // [OUT] output file info
+ QL_SIM_FILE_OPERATION_RET *operation_ret // [OUT] return the operation status code
+);
+
+/*===========================================================================
+
+ FUNCTION: ql_sim_read_file
+
+===========================================================================*/
+/*
+ @brief
+ Function get the data of a EF file.
+
+ @return
+ QL_SIM_ERROR_CODE
+*/
+/*=========================================================================*/
+QL_SIM_ERROR_CODE ql_sim_read_file
+(
+ unsigned int fileid, // EF file id
+ unsigned int index, // the index of record for a record EF file, the offest of date for a transparent EF file.
+ unsigned int data_max_len, // the max length of output data.
+ QL_SIM_CARD_FILE_DATA *file_data, // [OUT] File data
+ QL_SIM_FILE_OPERATION_RET *operation_ret // [OUT] return the operation status code
+);
+
+/*===========================================================================
+
+ FUNCTION: ql_sim_write_file
+
+===========================================================================*/
+/*
+ @brief
+ Function write data to a EF file.
+
+ @return
+ QL_SIM_ERROR_CODE
+*/
+/*=========================================================================*/
+QL_SIM_ERROR_CODE ql_sim_write_file
+(
+ unsigned int fileid, // EF file id
+ int index, // the index of record for a record EF file, the offest of date for a transparent EF file.
+ QL_SIM_CARD_FILE_DATA *file_data, ///< [IN] File data of the specified one by pt_info
+ QL_SIM_FILE_OPERATION_RET *operation_ret // [OUT] return the operation status code
+);
+
+
+/*===========================================================================
+
+ FUNCTION: ql_sim_read_phonebook_record
+
+===========================================================================*/
+/*
+ @brief
+ Function will get the phone book record.
+
+ @return
+ QL_SIM_ERROR_CODE
+*/
+/*=========================================================================*/
+QL_SIM_ERROR_CODE ql_sim_read_phonebook_record
+(
+ QL_SIM_PHONE_BOOK_STORAGE storage, //IN the storage position of the phone book
+ int start_index, // the start index of records, 0: read record by username.
+ int end_index, // the end index of records
+ uint8_t *username, // the username in a record, it is valid when start_index is 0
+ QL_SIM_PHONE_BOOK_RECORDS_INFO *records // the list of records
+);
+
+
+/*===========================================================================
+
+ FUNCTION: ql_sim_write_phonebook_record
+
+===========================================================================*/
+/*
+ @brief
+ Function will write a record to a phone book.
+
+ @return
+ QL_SIM_ERROR_CODE
+*/
+/*=========================================================================*/
+QL_SIM_ERROR_CODE ql_sim_write_phonebook_record
+(
+ QL_SIM_PHONE_BOOK_STORAGE storage, //IN the storage position of the phone book
+ QL_SIM_PHONE_BOOK_RECORD_INFO *record //IN a record
+);
+
+
+/*===========================================================================*/
+/*
+ @brief
+ Function will return the state of currently selected phonebook
+
+ @return
+ QL_SIM_ERROR_CODE
+*/
+/*=========================================================================*/
+QL_SIM_ERROR_CODE ql_sim_get_phonebook_state(QL_SIM_PHONEBOOK_STATE *state);
+
+
+/*===========================================================================*/
+/*
+ @brief
+ Function will request to select the local or remote SIM
+
+ @return
+ QL_SIM_ERROR_CODE
+*/
+/*=========================================================================*/
+QL_SIM_ERROR_CODE ql_sim_select(UINT service, UINT is_remote);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/mbtk/include/ql/ql_sleep_wakelock.h b/mbtk/include/ql/ql_sleep_wakelock.h
new file mode 100755
index 0000000..e3266d1
--- /dev/null
+++ b/mbtk/include/ql/ql_sleep_wakelock.h
@@ -0,0 +1,31 @@
+#ifndef __QL_SLEEP_WAKELOCK_H__
+#define __QL_SLEEP_WAKELOCK_H__
+#include <stddef.h>
+
+/*
+ * create wakelock, return the file description of the wakelock
+ */
+extern int Ql_SLP_WakeLock_Create(const char *name, size_t len);
+
+/*
+ * lock the wakelock by the file description of the wakelock
+ */
+extern int Ql_SLP_WakeLock_Lock(int fd);
+
+
+/*
+ * unlock the wakelock by the file description of the wakelock
+ */
+extern int Ql_SLP_WakeLock_Unlock(int fd);
+
+/*
+ * destroy the wakelock by the file description of the wakelock
+ */
+extern int Ql_SLP_WakeLock_Destroy(int fd);
+
+/*
+ * Enable/Disable autosleep function
+ */
+extern int Ql_Autosleep_Enable(char enable);
+
+#endif //__QL_SLEEP_WAKELOCK_H__
diff --git a/mbtk/include/ql/ql_sms.h b/mbtk/include/ql/ql_sms.h
new file mode 100755
index 0000000..cf5c872
--- /dev/null
+++ b/mbtk/include/ql/ql_sms.h
@@ -0,0 +1,196 @@
+/*****************************************************************************
+ * Copyright Statement:
+ * --------------------
+ * This software is protected by Copyright and the information contained
+ * herein is confidential. The software may not be copied and the information
+ * contained herein may not be used or disclosed except with the written
+ * permission of Quectel Co., Ltd. 2016
+ *
+ *****************************************************************************/
+/*****************************************************************************
+ *
+ * Filename:
+ * ---------
+ * ql_sms.h
+ *
+ * Project:
+ * --------
+ * OpenLinux
+ *
+ * Description:
+ * ------------
+ * API definition for SMS.
+ *
+ *============================================================================
+ * HISTORY
+ *----------------------------------------------------------------------------
+ * WHO WHEN WHAT
+ *----------------------------------------------------------------------------
+ * Pony.ma 19/09/2019 Create
+ ****************************************************************************/
+
+#ifndef __QL_SMS_H__
+#define __QL_SMS_H__
+
+#include <stdlib.h>
+#include <stdint.h>
+#include <string.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#define MAX_ADDR_LEN 24
+#define FALSE 0
+#define TRUE 1
+
+#define QL_SMS_MIN_LEN 1
+#define MAX_LONGSMS_SEGMENT 8
+#define MAX_SMS_LENGTH (160*4)
+#define SMS_BUF_LEN (MAX_SMS_LENGTH + 32)
+#define MAX_LONGSMS_LENGTH (160*4*MAX_LONGSMS_SEGMENT)
+#define CI_MAX_COUNT_SMS_OF_SIM 50
+
+
+typedef unsigned char UINT8;
+typedef unsigned short UINT16;
+typedef unsigned int UINT32;
+
+typedef enum{
+ QL_SMS_SUCCESS,
+ QL_SMS_GENERIC_FAILURE,
+ QL_SMS_PRAR_ERROR,
+ QL_GET_RESPONSE_ERROR,
+}QL_SMS_ERROR_CODE;
+
+typedef enum
+{
+ QL_SMS_RECV_EVENT = 0, /**< SMS come event. */
+ QL_SMS_RECV_INDEX_EVENT, /**< SMS come event for index. */
+}QL_SMS_NFY_MSG_ID;
+
+typedef enum
+{
+ QL_SMS_MODE_GSM = 0, //GSM
+ QL_SMS_MODE_UCS2 //UCS2
+}QL_SMS_CODE_MODE;
+
+typedef struct
+{
+ char number[32];
+ char body[280]; // 姣忔潯鏀跺埌鐨勭煭淇¢暱搴︽渶澶т负280
+ char time[32];
+ int body_len;
+ QL_SMS_CODE_MODE code_mode;
+ char *pdu_str;
+}QL_SMS_STATUS_INFO;
+
+typedef struct
+{
+ int item;
+ char *name;
+}ql_sms_item;
+
+typedef void (*QL_SMS_StatusIndMsgHandlerFunc_t)
+ (
+ QL_SMS_NFY_MSG_ID msg_id,
+ void *pv_data,
+ int pv_data_len,
+ void *contextPtr
+ );
+
+typedef enum{
+ QL_SMS_ClientInit = 0,
+ QL_SMS_ClientRelease,
+ //QL_SMS_SendSMS,
+ QL_SMS_DeleteSMS,
+ QL_SMS_SearchSMSTextMessage,
+ QL_SMS_SearchSMSPduMessage,
+ QL_SMS_AddSMSEventHandler,
+ QL_SMS_GetSMSCenterAddress,
+ QL_SMS_SetSMSCenterAddress,
+ QL_SMS_SetSaveLocation,
+ QL_SMS_GetSaveLocation,
+ QL_SMS_SetSMSNotSave,
+ QL_SMS_SetSMSMsgMode,
+ QL_SMS_GetSMSMsgMode,
+ QL_SMS_SetSMSCodeMode,
+ QL_SMS_GetSMSCodeMode,
+ QL_SMS_SetSMSReceiveDealmode,
+ QL_SMS_SendTextSMS,
+ QL_SMS_SendPduSMS,
+ QL_SMS_GetSimNum,
+ QL_SMS_GetIndex,
+ QL_SMS_OptionMax,
+}QL_SMS_OPTION;
+
+typedef struct
+{
+ char mem[5];
+ int cur_num; //current sms numbers
+ int max_nums; //Maximum number of messages that can be stored
+}sms_mem_t;
+
+typedef struct
+{
+ sms_mem_t mem1; //messages to be read and deleted from this memory storage.
+ sms_mem_t mem2; //messages will be written and sent to this memory storage.
+ sms_mem_t mem3; //received messages will be placed in this memory storage if routing to PC is not set.
+}ql_sms_mem_info_t;
+
+typedef struct recvmessage_struct{
+ char num[32];
+ char buf[400];
+ int buflen;
+}recvmessage;
+typedef struct{
+ int storage_index; // 存贮索引
+} ql_sms_recv_index_event_t;
+
+
+typedef struct{
+ int sms_index[CI_MAX_COUNT_SMS_OF_SIM];
+ int count;
+} ql_auto_sms_index;
+
+
+
+
+/* init sms client */
+QL_SMS_ERROR_CODE ql_sms_init();
+/* deinit sms clint */
+QL_SMS_ERROR_CODE ql_sms_release();
+/* send message api */
+//QL_SMS_ERROR_CODE ql_sms_send_msg(uint8_t *destNum,uint8_t *data,size_t dataLen,int sms_type);
+/* get smsc api */
+QL_SMS_ERROR_CODE ql_sms_get_sms_center_address(uint8_t *sms_center_addree);
+/* register sms event header api*/
+QL_SMS_ERROR_CODE ql_sms_add_event_handler(QL_SMS_StatusIndMsgHandlerFunc_t handlerPtr, void* contextPtr);
+/* set smsc api */
+QL_SMS_ERROR_CODE ql_sms_set_sms_center_address(unsigned char *destNum);
+/* delete message api */
+QL_SMS_ERROR_CODE ql_sms_delete_msg(size_t index);
+/* set sms storage api */
+QL_SMS_ERROR_CODE ql_sms_set_sms_pref_storage(size_t location);
+/* set sms not storage api */
+QL_SMS_ERROR_CODE ql_sms_set_sms_desave();
+QL_SMS_ERROR_CODE ql_set_sms_msg_mode(int messagemode);
+QL_SMS_ERROR_CODE ql_get_sms_msg_mode(int *messagemode);
+QL_SMS_ERROR_CODE ql_set_sms_code_mode(char* codemode);
+QL_SMS_ERROR_CODE ql_get_sms_code_mode(char *codemode);
+QL_SMS_ERROR_CODE ql_sms_get_sms_pref_storage(ql_sms_mem_info_t *mem_info);
+//QL_SMS_ERROR_CODE ql_search_sms_message(int index, recvmessage* payload);
+QL_SMS_ERROR_CODE ql_search_sms_text_message(int index, recvmessage* payload);
+QL_SMS_ERROR_CODE ql_search_sms_pdu_message(int index, recvmessage* payload);
+QL_SMS_ERROR_CODE ql_set_sms_recive_dealmode(int dealmode);
+QL_SMS_ERROR_CODE ql_sms_send_pdu_msg(uint8_t *phone_num,uint8_t *data,int sms_type);
+QL_SMS_ERROR_CODE ql_sms_send_text_msg(uint8_t *phone_num,uint8_t *data,int sms_type);
+QL_SMS_ERROR_CODE ql_sms_get_sim_num(uint8_t *sim_num);
+QL_SMS_ERROR_CODE ql_get_sms_index( int *sms_msg_info_ptr,int *smsnum);
+QL_SMS_ERROR_CODE ql_sms_list_sms(int stat, int index, char *data);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/mbtk/include/ql/ql_spi.h b/mbtk/include/ql/ql_spi.h
new file mode 100755
index 0000000..d33660b
--- /dev/null
+++ b/mbtk/include/ql/ql_spi.h
@@ -0,0 +1,79 @@
+/**
+ @file
+ ql_spi.h
+
+ @brief
+ This file provides the definitions for spi driver, and declares the
+ API functions.
+
+*/
+/*============================================================================
+ Copyright (c) 2017 Quectel Wireless Solution, Co., Ltd. All Rights Reserved.
+ Quectel Wireless Solution Proprietary and Confidential.
+ =============================================================================*/
+/*===========================================================================
+
+ EDIT HISTORY FOR MODULE
+
+This section contains comments describing changes made to the module.
+Notice that changes are listed in reverse chronological order.
+
+
+WHEN WHO WHAT, WHERE, WHY
+---------- ------------ ----------------------------------------------------
+2019/08/20 Juson create
+=============================================================================*/
+#ifndef __QL_SPI_H__
+#define __QL_SPI_H__
+
+#define SPI_CPHA 0x01
+#define SPI_CPOL 0x02
+
+typedef enum
+{
+ SPIMODE0 = (0|0),
+ SPIMODE1 = (0|SPI_CPHA),
+ SPIMODE2 = (SPI_CPOL|0),
+ SPIMODE3 = (SPI_CPOL|SPI_CPHA),
+}SPI_MODE;
+
+typedef enum
+{
+ S_6_5M = 6500000,
+ S_13M = 13000000,
+ S_26M = 26000000,
+ S_52M = 50000000,
+}SPI_SPEED;
+
+/**
+ * Function: Ql_SPI_Init
+ * Description: spi init
+ * Parameters: dev_name---device name
+ * mode---spi mode
+ * bits---spi per word
+ * speed---spi transfer clock
+ * Return: spi fd
+ **/
+int Ql_SPI_Init(const char *dev_name, SPI_MODE mode, unsigned char bits, SPI_SPEED speed);
+
+/**
+ * Function: Ql_SPI_DeInit
+ * Description: spi deinit
+ * Parameters: fd---spi fd
+ * Return:
+ */
+int Ql_SPI_DeInit(int fd);
+
+/**
+ * Function: Ql_SPI_Write_Read
+ * Description: spi write read function
+ * Parameters: fd---spi fd
+ * w_buf---write buffer
+ * r_buf---read buffer
+ * len---spi transfer length
+ * Return: 0---transfer success
+ * other---failed
+ **/
+int Ql_SPI_Write_Read(int fd, unsigned char *w_buf, unsigned char *r_buf, unsigned int len);
+
+#endif/* __QL_SPI_H__ */
\ No newline at end of file
diff --git a/mbtk/include/ql/ql_tlv_user.h b/mbtk/include/ql/ql_tlv_user.h
new file mode 100755
index 0000000..a4e710a
--- /dev/null
+++ b/mbtk/include/ql/ql_tlv_user.h
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ *
+ * Filename: ql_tlv_user.h
+ *
+ * Description: flash tlv format param config header file.
+ *
+ * When Who Why
+ * 2019/09/28 juson Creation of file
+ *
+ * Notes:
+ *
+ ******************************************************************************/
+#ifndef __QL_TLV_USER_H__
+#define __QL_TLV_USER_H__
+
+typedef enum {
+ SYS_CONFIG_START = 0,
+ SYS_CONFIG_AP_RSTLEVEL_ID,
+ SYS_CONFIG_MODEM_RSTLEVEL_ID,
+ SYS_CONFIG_RECOVERY_ID,
+ SYS_CONFIG_CONSOLE_LOG_ID,
+ SYS_CONFIG_END,
+}SYS_CFG_ID_E;
+
+/* 128bytes */
+typedef struct ql_tlv_struct {
+ SYS_CFG_ID_E type;
+ unsigned int len;
+ char value[120];
+}ql_tlv_t;
+
+int quectel_tlv_write(SYS_CFG_ID_E param_id, ql_tlv_t tlv_data);
+int quectel_tlv_read(SYS_CFG_ID_E param_id, ql_tlv_t *tlv_data);
+int ql_onoff_console_log(unsigned char onoff_flag);
+
+#endif /* __QL_TLV_USER_H__ */
+
+
diff --git a/mbtk/include/ql/ql_uart.h b/mbtk/include/ql/ql_uart.h
new file mode 100755
index 0000000..3808419
--- /dev/null
+++ b/mbtk/include/ql/ql_uart.h
@@ -0,0 +1,89 @@
+/**
+ @file
+ ql_uart.h
+
+ @brief
+ This file provides the definitions for uart, and declares the
+ API functions.
+
+*/
+/*============================================================================
+ Copyright (c) 2017 Quectel Wireless Solution, Co., Ltd. All Rights Reserved.
+ Quectel Wireless Solution Proprietary and Confidential.
+ =============================================================================*/
+/*===========================================================================
+
+ EDIT HISTORY FOR MODULE
+
+This section contains comments describing changes made to the module.
+Notice that changes are listed in reverse chronological order.
+
+
+WHEN WHO WHAT, WHERE, WHY
+---------- ------------ ----------------------------------------------------
+2019/08/20 Juson create
+=============================================================================*/
+
+#ifndef __QL_UART_H__
+#define __QL_UART_H__
+
+typedef enum {
+ FC_NONE = 0, // None Flow Control
+ FC_RTSCTS, // Hardware Flow Control (rtscts)
+ FC_XONXOFF // Software Flow Control (xon/xoff)
+}Enum_FlowCtrl;
+
+typedef enum {
+ PB_NONE = 0, //none parity check
+ PB_ODD, //odd parity check
+ PB_EVEN //even parity check
+}Enum_ParityBit;
+
+typedef enum {
+ DB_CS5 = 5,
+ DB_CS6 = 6,
+ DB_CS7 = 7,
+ DB_CS8 = 8
+}Enum_DataBit;
+
+typedef enum {
+ SB_1 = 1,
+ SB_2 = 2
+}Enum_StopBit;
+
+typedef enum {
+ B_300 = 300,
+ B_600 = 600,
+ B_1200 = 1200,
+ B_2400 = 2400,
+ B_4800 = 4800,
+ B_9600 = 9600,
+ B_19200 = 19200,
+ B_38400 = 38400,
+ B_57600 = 57600,
+ B_115200 = 115200,
+ B_230400 = 230400,
+ B_460800 = 460800,
+ B_921600 = 921600,
+ B_3000000 = 3000000,
+ B_4000000 = 4000000,
+}Enum_BaudRate;
+
+typedef struct {
+ Enum_BaudRate baudrate;
+ Enum_DataBit databit;
+ Enum_StopBit stopbit;
+ Enum_ParityBit parity;
+ Enum_FlowCtrl flowctrl;
+}ST_UARTDCB;
+
+int Ql_UART_Open(const char* port, Enum_BaudRate baudrate, Enum_FlowCtrl flowctrl);
+int Ql_UART_Read(int fd, char* buf, unsigned int buf_len);
+int Ql_UART_Write(int fd, const char* buf, unsigned int buf_len);
+int Ql_UART_SetDCB(int fd, ST_UARTDCB *dcb);
+int Ql_UART_GetDCB(int fd, ST_UARTDCB *dcb);
+int Ql_UART_IoCtl(int fd, unsigned int cmd, void* pValue);
+int Ql_UART_Close(int fd);
+
+#endif /* __QL_UART_H__ */
+
diff --git a/mbtk/include/ql/ql_vcall.h b/mbtk/include/ql/ql_vcall.h
new file mode 100755
index 0000000..c1b0545
--- /dev/null
+++ b/mbtk/include/ql/ql_vcall.h
@@ -0,0 +1,296 @@
+/**
+ *@file ql_voicecall.h
+ *@date 2017-05-02
+ *@author
+ *@brief
+ */
+
+#ifndef __QL_VCALL_H__
+#define __QL_VCALL_H__
+
+#define QL_QMI_VCALL_ECALL_MSD_MAX_LEN 140
+
+
+//--------------------------------------------------------------------------------------------------
+/**
+ * Reference returned by Start function and used by End function
+ */
+//--------------------------------------------------------------------------------------------------
+//typedef struct QL_VCALL_Call* ST_VCALL_CallRef;
+typedef int ST_VCALL_CallRef;
+
+//--------------------------------------------------------------------------------------------------
+/**
+ * SIM identifiers.
+ *
+ */
+//--------------------------------------------------------------------------------------------------
+typedef enum
+{
+ E_QL_VCALL_EXTERNAL_SLOT_1,
+ E_QL_VCALL_EXTERNAL_SLOT_2,
+ E_QL_VCALL_EMBEDDED,
+ E_QL_VCALL_REMOTE,
+ E_QL_VCALL_ID_MAX
+}E_QL_VCALL_ID_T;
+
+//--------------------------------------------------------------------------------------------------
+/**
+ * Voice call establishment states.
+ */
+//--------------------------------------------------------------------------------------------------
+typedef enum
+{
+ E_QL_VCALL_EVENT_ALERTING = 0,
+ ///< Voice call establishment in progress.
+ ///< Far end is now alerting its user (outgoing call).
+
+ E_QL_VCALL_EVENT_CONNECTED = 1,
+ ///< Call has been established, and is media is active.
+
+ E_QL_VCALL_EVENT_TERMINATED = 2,
+ ///< Call has terminated.
+
+ E_QL_VCALL_EVENT_OFFLINE = 3,
+ ///< NO Service available to try establish a voice call.
+
+ E_QL_VCALL_EVENT_BUSY = 4,
+ ///< Remote party (callee) is busy.
+
+ E_QL_VCALL_EVENT_RESOURCE_BUSY = 5,
+ ///< All local connection resources (lines/channels) are in use.
+
+ E_QL_VCALL_EVENT_CALL_END_FAILED = 6,
+ ///< Call ending failed.
+
+ E_QL_VCALL_EVENT_CALL_ANSWER_FAILED = 7,
+ ///< Call answering failed.
+
+ E_QL_VCALL_EVENT_INCOMING = 8
+ ///< Incoming voice call in progress.
+}E_QL_VCALL_EVENT_T;
+
+
+//--------------------------------------------------------------------------------------------------
+/**
+ * Voice call termination reason.
+ */
+//--------------------------------------------------------------------------------------------------
+typedef enum
+{
+ E_QL_VCALL_TERM_NETWORK_FAIL = 0,
+ ///< Network could not complete the call.
+
+ E_QL_VCALL_TERM_BAD_ADDRESS = 1,
+ ///< Remote address could not be resolved.
+
+ E_QL_VCALL_TERM_BUSY = 2,
+ ///< Caller is currently busy and cannot take the call.
+
+ E_QL_VCALL_TERM_LOCAL_ENDED = 3,
+ ///< Local party ended the call.
+
+ E_QL_VCALL_TERM_REMOTE_ENDED = 4,
+ ///< Remote party ended the call.
+
+ E_QL_VCALL_TERM_UNDEFINED = 5
+ ///< Undefined reason.
+}E_QL_VCALL_TerminationReason_t;
+
+
+//--------------------------------------------------------------------------------------------------
+/**
+ * Reference type used by Add/Remove functions for EVENT 'QL_VCALL_State'
+ */
+//--------------------------------------------------------------------------------------------------
+//typedef struct QL_VCALL_StateHandler* QL_VCALL_StateHandlerRef_t;
+typedef int QL_VCALL_StateHandlerRef_t;
+
+
+typedef enum
+{
+ E_QL_VCALL_DIRECTION_MO = 1,
+ E_QL_VCALL_DIRECTION_MT = 2
+}E_QL_VCALL_DIRECTION_T;
+
+typedef enum
+{
+ E_QL_VCALL_STATE_ORIGINATING = 1, //Origination
+ E_QL_VCALL_STATE_INCOMING, //Incoming
+ E_QL_VCALL_STATE_CONVESATION, //Conversation
+ E_QL_VCALL_STATE_CC_IN_PROGRESS, //Call is originating but waiting for call control to complete
+ E_QL_VCALL_STATE_ALERTING, //Alerting
+ E_QL_VCALL_STATE_HOLD, //Hold
+ E_QL_VCALL_STATE_WAITING, //Waiting
+ E_QL_VCALL_STATE_DISCONNECTING, //Disconnecting
+ E_QL_VCALL_STATE_END, //End
+ E_QL_VCALL_STATE_SETUP, //MT call is in setup state in 3GPP
+}E_QL_VCALL_STATE_T;
+
+typedef enum
+{
+ E_QL_VCALL_TYPE_VOICE = 0, //Voice
+ E_QL_VCALL_TYPE_VOICE_FORCED, //Avoid modem call classification
+ E_QL_VCALL_TYPE_VOICE_IP, //Voice over IP
+ E_QL_VCALL_TYPE_VT, //VideoTelephony call over IP
+ E_QL_VCALL_TYPE_VIDEOSHARE , //Videoshare
+ E_QL_VCALL_TYPE_TEST, //Test call
+ E_QL_VCALL_TYPE_OTAPA, //OTAPA
+ E_QL_VCALL_TYPE_STD_OTASP, //Standard OTASP
+ E_QL_VCALL_TYPE_NON_STD_OTASP, //Nonstandard OTASP
+ E_QL_VCALL_TYPE_EMERGENCY, //Emergency
+ E_QL_VCALL_TYPE_SUPS, //Supplementary Service
+ E_QL_VCALL_TYPE_EMERGENCY_IP, //Emergency VoIP
+ E_QL_VCALL_TYPE_ECALL //eCall
+}E_QL_VCALL_TYPE_T;
+
+typedef struct
+{
+ uint8_t call_id;
+ char PhoneNum[20]; ///Telephone number string.
+ E_QL_VCALL_DIRECTION_T e_direct;
+ E_QL_VCALL_STATE_T e_state;
+ E_QL_VCALL_TYPE_T e_type;
+} vcall_info_t;
+
+typedef enum
+{
+ E_QL_VCALL_ECALL_MANUAL = 5,
+ E_QL_VCALL_ECALL_AUTO = 6
+}E_QL_VCALL_ECALL_CAT_T;
+
+typedef enum
+{
+ E_QL_VCALL_ECALL_TEST = 0x01,
+ E_QL_VCALL_ECALL_EMERGENCY = 0x02,
+ E_QL_VCALL_ECALL_RECONFIG = 0x03,
+}E_QL_VCALL_ECALL_VARIANT_T;
+
+
+//--------------------------------------------------------------------------------------------------
+/**
+ * Handler for voice call state changes.
+ *
+ * @param reference
+ * Event voice call object reference.
+ * @param identifier
+ * Identifier of the remote party
+ * @param event
+ * Voice call event.
+ * @param contextPtr
+ */
+//--------------------------------------------------------------------------------------------------
+typedef void (*QL_VCALL_StateHandlerFunc_t)
+(
+ ST_VCALL_CallRef reference,
+ const char* identifier,
+ E_QL_VCALL_STATE_T event,
+ void* contextPtr
+);
+
+//--------------------------------------------------------------------------------------------------
+/**
+ * Add handler function for EVENT 'QL_VCALL_State'
+ *
+ * This event provides information on voice call state changes
+ */
+//--------------------------------------------------------------------------------------------------
+QL_VCALL_StateHandlerRef_t QL_VCALL_AddStateHandler
+(
+ QL_VCALL_StateHandlerFunc_t handlerPtr,
+ ///< [IN]
+
+ void* contextPtr
+ ///< [IN]
+);
+
+//--------------------------------------------------------------------------------------------------
+/**
+ * Remove handler function for EVENT 'QL_VCALL_State'
+ */
+//--------------------------------------------------------------------------------------------------
+void QL_VCALL_RemoveStateHandler
+(
+ QL_VCALL_StateHandlerRef_t addHandlerRef
+ ///< [IN]
+);
+
+//--------------------------------------------------------------------------------------------------
+/**
+ * Start a voice call.
+ *
+ * @return
+ * - Reference to the voice call (to be used later for releasing the voice call)
+ * - NULL if the voice call could not be processed
+ */
+//--------------------------------------------------------------------------------------------------
+ST_VCALL_CallRef QL_VCALL_Start
+(
+ E_QL_VCALL_ID_T simId,
+ const char* DestinationID
+ ///< [IN] Destination identifier for the voice
+);
+
+//--------------------------------------------------------------------------------------------------
+/**
+ * Release a voice call.
+ *
+ * @return
+ * - E_QL_OK if the end of voice call can be processed.
+ * - E_QL_NOT_FOUND if the voice call object reference is not found.
+ */
+//--------------------------------------------------------------------------------------------------
+int QL_VCALL_End
+(
+ ST_VCALL_CallRef reference
+ ///< [IN] Voice call object reference to hang-up.
+);
+
+
+//--------------------------------------------------------------------------------------------------
+/**
+ * Answer to incoming voice call.
+ *
+ * @return
+ * - E_QL_OK if the incoming voice call can be answered
+ * - E_QL_NOT_FOUND if the incoming voice call object reference is not found.
+ */
+//--------------------------------------------------------------------------------------------------
+int QL_VCALL_Answer
+(
+ ST_VCALL_CallRef reference
+ ///< [IN] Incoming voice call object reference to answer.
+);
+
+//--------------------------------------------------------------------------------------------------
+/**
+ * Get the termination reason of a voice call reference.
+ *
+ * @return
+ * - E_QL_OK if the termination reason is got
+ * - E_QL_NOT_FOUND if the incoming voice call object reference is not found.
+ * - E_QL_FAULT if the voice call is not terminated.
+ */
+//--------------------------------------------------------------------------------------------------
+int QL_VCALL_GetTerminationReason
+(
+ ST_VCALL_CallRef reference,
+ ///< [IN] Voice call object reference to read from.
+
+ E_QL_VCALL_TerminationReason_t* reasonPtr
+ ///< [OUT] Termination reason of the voice call.
+);
+
+
+int QL_VCALL_Ecall(E_QL_VCALL_ID_T simId,
+ char* phone_number,
+ char* ecall_msd,
+ E_QL_VCALL_ECALL_CAT_T emer_cat,
+ E_QL_VCALL_ECALL_VARIANT_T eCallModeType,
+ ST_VCALL_CallRef *reference); //call id
+
+int QL_VCALL_UpdateMsd( const char *msd);
+
+
+#endif // __QL_VCALL_H__
+
diff --git a/mbtk/include/ql/ql_voice.h b/mbtk/include/ql/ql_voice.h
new file mode 100755
index 0000000..7d4e038
--- /dev/null
+++ b/mbtk/include/ql/ql_voice.h
@@ -0,0 +1,201 @@
+/**
+ @file
+ ql_voice.h
+
+ @brief
+ This file provides the definitions for voice, and declares the
+ API functions.
+
+*/
+/*============================================================================
+ Copyright (c) 2017 Quectel Wireless Solution, Co., Ltd. All Rights Reserved.
+ Quectel Wireless Solution Proprietary and Confidential.
+ =============================================================================*/
+/*===========================================================================
+
+ EDIT HISTORY FOR MODULE
+
+This section contains comments describing changes made to the module.
+Notice that changes are listed in reverse chronological order.
+
+
+WHEN WHO WHAT, WHERE, WHY
+---------- ------------ ----------------------------------------------------
+14/11/2019 gunner.yang create
+06/01/2020 pony.made add net_state
+18/02/2020 gale.gao Add API: imsd get, wait status get, voice unhold;
+=============================================================================*/
+
+#ifndef __QL_VOICE_H__
+#define __QL_VOICE_H__
+
+#include <stdlib.h>
+#include <stdint.h>
+#include <string.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef enum
+{
+ QL_VOICE_SUCCESS,
+ QL_VOICE_GENERIC_FAILURE,
+ QL_VOICE_RADIO_NOT_AVAILABLE,
+}QL_VOICE_ERROR_CODE;
+
+typedef enum{
+ GSM = 0,
+ GSM_COMPACT,
+ GSM_wEGPRS,
+ UTRAN,
+ UTRAN_wHSDPA,
+ UTRAN_wHSUPA,
+ UTRAN_wHSDPA_HSUPA,
+ E_UTRAN,
+ UTRAN_HSPA_PLUS,
+}QL_REG_STATE;
+
+typedef enum{
+ REASON_INVALID=-1,
+ REASON_UNCONDITIONAL =0,
+ REASON_DEVICE_BUSY =1,
+ REASON_DEVICE_NO_REPLY =2,
+ REASON_DEVICE_UNREACHABLE =3,
+ REASON_DEVICE_ALL_FORWARDING =4,
+ REASON_DEVICE_ALL_CONDITIONAL =5,
+}QL_VOICE_CALL_FW_REASON;
+
+typedef enum{
+ MODE_DISABLE=0,
+ MODE_ENABLE,
+ MODE_QUERY_STATUS,
+ MODE_REGISTRATION,
+ MODE_ERASURE,
+}QL_VOICE_CALL_FW_MODE;
+
+typedef struct
+{
+ int status;
+ int fw_class;
+ char num[20];
+ int type;
+ char subaddr[20];
+ int satype;
+ int time;
+} ql_voice_call_fw_list_t;
+
+typedef enum {
+ QL_CALL_ACTIVE = 0,
+ QL_CALL_HOLDING = 1,
+ QL_CALL_DIALING = 2, /* MO call only */
+ QL_CALL_ALERTING = 3, /* MO call only */
+ QL_CALL_INCOMING = 4, /* MT call only */
+ QL_CALL_WAITING = 5, /* MT call only */
+ QL_CALL_OFFERING = 6, /*MT call offering (call setup)*/
+ QL_CALL_DISCONNECTING = 7, /*call in disconnect procedure*/
+ QL_CALL_DISCONNECTED = 8, /*call is disconnected*/
+} QL_CallState;
+
+typedef struct
+{
+ int idx; /*call index, identification number*/
+ int dir; /*0: mobile originated(MO) call, 1: mobile terminated(MT) call*/
+ int state; /*define in QL_CallState*/
+ char number[20]; /*string type phone number in format specified by <type>*/
+ int type; /*type of address octet in interger format(refer TS24.008 subclause 10.5.4.7)*/
+}ql_voice_call_item;
+
+typedef struct
+{
+ int count;
+ ql_voice_call_item items[16];
+}ql_voice_call_list_t;
+/*
+ callbackfunction prototype
+*/
+typedef void (*QL_VOICE_EventHandlerFunc_t)(QL_CallState voice_flag, char *number,void *contextPtr);
+
+QL_VOICE_ERROR_CODE ql_voice_call_init ();
+QL_VOICE_ERROR_CODE ql_voice_call_release();
+
+/*
+ Register voice call event.
+ -handlerPtr : user_cb
+ -contextPtr : user_cb_data
+*/
+QL_VOICE_ERROR_CODE ql_voice_call_event_register(QL_VOICE_EventHandlerFunc_t handlerPtr, void* contextPtr);
+
+
+/*
+ Phone call.
+ -call_num : dst phone number
+*/
+QL_VOICE_ERROR_CODE ql_voice_call_start(char* call_num);
+
+
+/*
+ Put through.
+*/
+QL_VOICE_ERROR_CODE ql_voice_call_answer();
+QL_VOICE_ERROR_CODE ql_voice_auto_answer(int seconds);
+
+
+/*
+ Hang up.
+*/
+QL_VOICE_ERROR_CODE ql_voice_call_end();
+
+
+/* dfmf call */
+QL_VOICE_ERROR_CODE ql_voice_call_dtmf(char *dtmf,int duration);
+
+/* get voice net state
+ * Just use in call to judge Volte or CS-vioce
+ * regstate:
+ * 7 -> Volte call
+ * else -> CS call
+*/
+QL_VOICE_ERROR_CODE ql_voice_call_get_regstate(int* regstate);
+
+/* set imsd value
+ 1: open votle
+ 0: close votle
+ */
+QL_VOICE_ERROR_CODE ql_voice_call_set_imsd(int imsd);
+
+/* get imsd value
+ 1: open volte
+ 0: close volte
+ */
+QL_VOICE_ERROR_CODE ql_voice_call_get_imsd(int *imsd);
+
+/* set call wait
+ 0: close
+ 1: open */
+QL_VOICE_ERROR_CODE ql_voice_call_set_wait(int wait);
+
+/* get call wait status
+ 0: close
+ 1: open */
+QL_VOICE_ERROR_CODE ql_voice_call_get_wait(int *wait);
+
+/* hold the voice */
+QL_VOICE_ERROR_CODE ql_voice_call_hold();
+
+/* unhold the voice */
+QL_VOICE_ERROR_CODE ql_voice_call_unhold();
+
+QL_VOICE_ERROR_CODE ql_voice_call_fw_set(QL_VOICE_CALL_FW_REASON reason, QL_VOICE_CALL_FW_MODE mode, char *num);
+
+QL_VOICE_ERROR_CODE ql_voice_call_fw_query(QL_VOICE_CALL_FW_REASON reason, ql_voice_call_fw_list_t *resp_data);
+
+/**
+ * get the current call list, same as AT+CLCC
+*/
+QL_VOICE_ERROR_CODE ql_voice_call_get_current_list(ql_voice_call_list_t *resp_data);
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/mbtk/include/ql/ql_wifi.h b/mbtk/include/ql/ql_wifi.h
new file mode 100755
index 0000000..a5f97d7
--- /dev/null
+++ b/mbtk/include/ql/ql_wifi.h
@@ -0,0 +1,652 @@
+/**
+ * @file ql_wifi.h
+ * @brief Quectel Openlinux WiFi public function declarations.
+ *
+ * @note
+ *
+ * @copyright Copyright (c) 2009-2017 @ Quectel Wireless Solutions Co., Ltd.
+ */
+/*================================================================
+ Copyright (c) 2018 Quectel Wireless Solution, Co., Ltd. All Rights Reserved.
+ Quectel Wireless Solution Proprietary and Confidential.
+=================================================================*/
+
+/*=====================================================================
+
+ EDIT HISTORY FOR MODULE
+
+ This section contains comments describing changes made to the module.
+ Notice that changes are listed in reverse chronological order.
+
+ WHEN WHO WHAT, WHERE, WHY
+ ------------ ------- ----------------------------------------
+ 11/20/2011 Paddy Initial creation.
+
+=======================================================================*/
+
+#ifndef __QL_WIFI_H__
+#define __QL_WIFI_H__
+
+#include <stdbool.h>
+#include <netinet/in.h>
+
+#define QL_WIFI_AP_AUTH_OPEN "none"
+#define QL_WIFI_AP_AUTH_WPA_PSK "psk"
+#define QL_WIFI_AP_AUTH_WPA2_PSK "psk2"
+#define QL_WIFI_AP_AUTH_WPA_WPA2_PSK "psk-mixed"
+
+#define QL_WIFI_AP_AUTH_WPA_PAIRWISE_TKIP "tkip"
+#define QL_WIFI_AP_AUTH_WPA_PAIRWISE_AES "aes"
+#define QL_WIFI_AP_AUTH_WPA_PAIRWISE_BOTH "tkip+aes"
+
+#define QL_WIFI_AP_BANDWIDTH_20MHZ "HT20"
+#define QL_WIFI_AP_BANDWIDTH_40MHZ "HT40-"
+#define QL_WIFI_AP_BANDWIDTH_80MHZ "HT40+"
+
+#define QL_WIFI_AP_MODE_80211B "11b"
+#define QL_WIFI_AP_MODE_80211BG "11bg"
+#define QL_WIFI_AP_MODE_80211BGN "11bgn"
+
+
+typedef enum {
+ WIFI_WORK_MODE_E_MIN_ENUM_VAL_V01 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ WIFI_WORK_MODE_AP_V01 = 0,
+ WIFI_WORK_MODE_STA_V01 = 1,
+ WIFI_WORK_MODE_AP_STA_V01 = 2,
+ WIFI_WORK_MODE_AP_AP_V01 = 3,
+ WIFI_WORK_MODE_MAX_V01 = 4,
+ WIFI_WORK_MODE_E_MAX_ENUM_VAL_V01 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}wifi_work_mode_e_v01;
+
+typedef enum {
+ WIFI_IEEE80211_MODE_E_MIN_ENUM_VAL_V01 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ WIFI_MODE_11A_V01 = 0,
+ WIFI_MODE_11AN_V01 = 1,
+ WIFI_MODE_11B_V01 = 2,
+ WIFI_MODE_11BG_V01 = 3,
+ WIFI_MODE_11BGN_V01 = 4,
+ WIFI_MODE_11AC_V01 = 5,
+ WIFI_IEEE80211_MODE_E_MAX_ENUM_VAL_V01 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}wifi_ieee80211_mode_e_v01;;
+
+
+
+typedef enum {
+ WIFI_BANDWIDTH_E_MIN_ENUM_VAL_V01 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ WIFI_BANDWIDTH_20MHZ_V01 = 0,
+ WIFI_BANDWIDTH_40MHZ_V01 = 1,
+ WIFI_BANDWIDTH_80MHZ_V01 = 2,
+ WIFI_BANDWIDTH_160MHZ_V01 = 3,
+ WIFI_BANDWIDTH_MAX_V01 = 4,
+ WIFI_BANDWIDTH_E_MAX_ENUM_VAL_V01 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}wifi_bandwidth_e_v01;
+
+typedef enum {
+ WIFI_AUTH_E_MIN_ENUM_VAL_V01 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ WIFI_AUTH_OPEN_V01 = 0,
+ WIFI_AUTH_WEP_V01 = 1,
+ WIFI_AUTH_WPA_PSK_V01 = 2,
+ WIFI_AUTH_WPA2_PSK_V01 = 3,
+ WIFI_AUTH_WPA_WPA2_PSK_BOTH_V01 = 4,
+ WIFI_AUTH_WPA_V01 = 5,
+ WIFI_AUTH_WPA2_V01 = 6,
+ WIFI_AUTH_WPA_WPA2_BOTH_V01 = 7,
+ WIFI_AUTH_WPS_V01 = 8,
+ WIFI_AUTH_E_MAX_ENUM_VAL_V01 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}wifi_auth_e_v01;
+/**
+ @}
+ */
+
+/** @addtogroup ql_manager_access_msgr_wifi_qmi_enums
+ @{
+ */
+typedef enum {
+ WIFI_WPA_PAIRWISE_E_MIN_ENUM_VAL_V01 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ WIFI_AUTH_WPA_PAIRWISE_TKIP_V01 = 0,
+ WIFI_AUTH_WPA_PAIRWISE_AES_V01 = 1,
+ WIFI_AUTH_WPA_PAIRWISE_BOTH_V01 = 2,
+ WIFI_WPA_PAIRWISE_E_MAX_ENUM_VAL_V01 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}wifi_wpa_pairwise_e_v01;
+
+typedef enum {
+ QL_WIFI_EVENT_ENABLE_STATUS = 0,
+ QL_WIFI_EVENT_DISABLE_STATUS,
+ QL_WIFI_EVENT_AP_STATION,
+ QL_WIFI_EVENT_STA_STATUS,
+ QL_WIFI_EVENT_STA_SCAN_DONE,
+} ql_wifi_event_type_e;
+
+typedef enum {
+ QL_WIFI_STATUS_ENABLE = 0,
+ QL_WIFI_STATUS_DISABLE,
+ QL_WIFI_STATUS_ERR_DRIVER,
+ QL_WIFI_STATUS_ERR_SOFTWARE,
+} ql_wifi_status_e;
+
+typedef enum {
+ QL_WIFI_STATION_DISABLE = 0, /* WiFi station is not enable */
+ QL_WIFI_STATION_CONNECTED, /* WiFi station is connected hotspot */
+ QL_WIFI_STATION_DISCONNECTED /* WiFi station is disconnect hotspot */
+} ql_wifi_station_status_e;
+
+typedef struct {
+ ql_wifi_event_type_e id;
+ union {
+ /* the QL_WIFI_ENABLE_STATUS or QL_WIFI_DISABLE_STATUS event */
+ ql_wifi_status_e status;
+ struct {
+ /*
+ * If connected is true, the station is connected wifi hotspot.
+ * If connected is false, the station is disconnected wifi hotspot.
+ */
+ bool connected;
+ unsigned char mac[6];
+ } ap_sta_info;
+ ql_wifi_station_status_e sta_status;
+ };
+} ql_wifi_event_s;
+
+typedef void (*wifi_event_handle)(ql_wifi_event_s *event, void *arg);
+
+typedef enum {
+ QL_WIFI_WORK_MODE_STA = 0, /* WiFi is in STA Mode */
+ QL_WIFI_WORK_MODE_AP0, /* WiFi is in AP Mode */
+ QL_WIFI_WORK_MODE_AP0_STA, /* WiFi is in AP/STA Mode */
+ QL_WIFI_WORK_MODE_AP0_AP1 /* WiFi is in AP/AP Mode */
+} ql_wifi_work_mode_e;
+
+typedef enum {
+ QL_WIFI_AP_INDEX_AP0 = 0, /* Index 0 of AP/AP-STA/AP-AP Mode */
+ QL_WIFI_AP_INDEX_AP1 /* Index 1 of AP/AP-STA/AP-AP Mode */
+} ql_wifi_ap_index_e;
+
+typedef enum {
+ QL_WIFI_MODE_80211B = 0, /* IEEE 802.11b (2.4 GHz) */
+ QL_WIFI_MODE_80211BG, /* IEEE 802.11bg (2.4 GHz) */
+ QL_WIFI_MODE_80211BGN, /* IEEE 802.11bgn (2.4 GHz) */
+ QL_WIFI_MODE_80211A, /* IEEE 802.11a (5 GHz) */
+ QL_WIFI_MODE_80211AN, /* IEEE 802.11an (5 GHz) */
+ QL_WIFI_MODE_80211AC /* IEEE 802.11ac (5 GHz) */
+} ql_wifi_mode_type_e;
+
+typedef enum {
+ QL_WIFI_BANDWIDTH_HT20 = 0,
+ QL_WIFI_BANDWIDTH_HT40,
+ QL_WIFI_BANDWIDTH_HT80
+} ql_wifi_bandwidth_type_e;
+
+typedef enum {
+ QL_WIFI_SSID_HIDE_DISABLE = 0,
+ QL_WIFI_SSID_HIDE_ENABLE,
+} ql_wifi_ssidhide_type_e;
+
+typedef enum {
+ QL_WIFI_AUTH_OPEN = 0, /* Open */
+ QL_WIFI_AUTH_WPA_PSK, /* WPA Personal */
+ QL_WIFI_AUTH_WPA2_PSK, /* WPA2 Personal */
+ QL_WIFI_AUTH_WPA_WPA2_PSK_BOTH, /* WPA&WPA2 Personal */
+} ql_wifi_auth_e;
+
+typedef enum {
+ QL_WIFI_AUTH_WPA_PAIRWISE_AUTO = 0, /* contain TKIP and AES */
+ QL_WIFI_AUTH_WPA_PAIRWISE_TKIP,
+ QL_WIFI_AUTH_WPA_PAIRWISE_AES
+} ql_wifi_auth_wpa_psk_e;
+
+typedef struct {
+ int auth;
+ union {
+ struct {
+ int default_index;
+ char passwd[4][64];
+ } wep;
+
+ struct {
+ short pairwise;
+ char passwd[64];
+ int group_rekey;
+ } wpa_psk;
+ };
+} ql_wifi_ap_auth_s;
+
+
+typedef enum {
+ WIFI_IDX_AP_0 = 1,
+ WIFI_IDX_AP_1,
+ WIFI_IDX_STA_0
+} wifi_index_e;
+
+typedef enum {
+ WIFI_WORK_MODE_AP = 0,
+ WIFI_WORK_MODE_STA,
+ WIFI_WORK_MODE_AP_STA,
+ WIFI_WORK_MODE_AP_AP,
+ WIFI_WORK_MODE_MAX
+} wifi_work_mode_e;
+
+typedef enum {
+ WIFI_START = 0,
+ WIFI_STOP,
+ WIFI_RESTART,
+} wifi_active_e;
+
+typedef enum {
+ WIFI_MODE_11A = 0,
+ WIFI_MODE_11AN,
+ WIFI_MODE_11B,
+ WIFI_MODE_11BG,
+ WIFI_MODE_11BGN,
+ WIFI_MODE_11AC
+} wifi_ieee80211_mode_e;
+
+typedef enum {
+ WIFI_BANDWIDTH_20MHZ = 0,
+ WIFI_BANDWIDTH_40MHZ,
+ WIFI_BANDWIDTH_80MHZ,
+ WIFI_BANDWIDTH_160MHZ,
+ WIFI_BANDWIDTH_MAX,
+} wifi_bandwidth_e;
+
+typedef enum {
+ WIFI_AUTH_OPEN = 0,
+ WIFI_AUTH_WEP,
+ WIFI_AUTH_WPA_PSK,
+ WIFI_AUTH_WPA2_PSK,
+ WIFI_AUTH_WPA_WPA2_PSK_BOTH,
+ WIFI_AUTH_WPA,
+ WIFI_AUTH_WPA2,
+ WIFI_AUTH_WPA_WPA2_BOTH,
+ WIFI_AUTH_WPS
+} wifi_auth_e;
+
+typedef enum {
+ WIFI_AUTH_WPA_PAIRWISE_TKIP = 0,
+ WIFI_AUTH_WPA_PAIRWISE_AES,
+ WIFI_AUTH_WPA_PAIRWISE_BOTH
+} wifi_wpa_pairwise_e;
+
+typedef enum {
+ WIFI_SSID_HIDE_DISABLE = 0,
+ WIFI_SSID_HIDE_ENABLE
+} wifi_ssid_hide_state_e;
+
+
+struct _auth {
+ unsigned char auth;
+ struct {
+ unsigned char pairwise;
+ unsigned char group_rekey;
+ unsigned char passwd[64];
+ } wpa_psk;
+
+};
+
+
+typedef enum {
+ WIFI_INDEX_E_MIN_ENUM_VAL_V01 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ WIFI_IDX_AP_0_V01 = 1,
+ WIFI_IDX_AP_1_V01 = 2,
+ WIFI_IDX_STA_0_V01 = 3,
+ WIFI_INDEX_E_MAX_ENUM_VAL_V01 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}wifi_index_e_v01;
+
+typedef enum {
+ RTK_WIFI_IEEE80211_MODE_E_MIN_ENUM_VAL_V01 = -2147483647, /**< To force a 32 bit signed enum. Do not change or use*/
+ RTK_WIFI_WORKMODE_11B_V01 = 1,
+ RTK_WIFI_WORKMODE_11BG_V01 = 3,
+ RTK_WIFI_WORKMODE_11BGN_V01 = 11,
+ RTK_WIFI_IEEE80211_MODE_E_MAX_ENUM_VAL_V01 = 2147483647 /**< To force a 32 bit signed enum. Do not change or use*/
+}rtk_wifi_ieee80211_mode_e_v01;
+
+typedef enum {
+ QL_WIFI_AUTH_OPEN_V01 = 0, /* Open */
+ QL_WIFI_SHARED_KEY, /* Shared key */
+ QL_WIFI_AUTO /* Auto */
+} ql_wifi_auth_type_e;
+
+typedef enum {
+ QL_WIFI_ENCRYPT_TKIP = 2, /* TKIP */
+ QL_WIFI_ENCRYPT_AES = 8, /* AES */
+ QL_WIFI_ENCRYPT_TKIP_AES_MIXED = 10 /* TKIP & AES MIXED */
+} ql_wifi_encrypt_mode_e;
+
+typedef enum {
+ QL_WIFI_PSK_DISABLE = 0, /* Encrypt disable */
+ QL_WIFI_PSK_WPA, /* WPA */
+ QL_WIFI_PSK_WPA2, /* WPA2 */
+ QL_WIFI_PSK_WPA_WPA2, /* WPA-WPA2 */
+} ql_wifi_psk_enable_e;
+
+
+
+#define QL_WIFI_MAX_STA_NUM 16
+
+ struct ql_mgmt_client_wifi_work_mode {
+ /*
+ * WiFi work mode support AP, STA, AP+STA, AP-AP
+ */
+ wifi_work_mode_e work_mode;
+ };
+
+ struct ql_mgmt_client_wifi_enable {
+ bool state;
+ };
+
+ struct ql_mgmt_client_wifi_country_code {
+ char country_code[2];
+ };
+
+ struct ql_mgmt_client_wifi_mode {
+ wifi_index_e id;
+ wifi_ieee80211_mode_e mode;
+ };
+
+ struct ql_mgmt_client_wifi_channel {
+ wifi_index_e id;
+ int channel;
+ };
+
+ struct ql_mgmt_client_wifi_essid {
+ wifi_index_e id;
+ char ssid[32];
+ };
+
+ struct ql_mgmt_client_wifi_ssid_hide {
+ wifi_index_e id;
+ wifi_ssid_hide_state_e state;
+ };
+
+ struct ql_mgmt_client_wifi_bandwidth {
+ wifi_index_e id;
+ wifi_bandwidth_e bandwidth;
+ };
+
+ struct ql_mgmt_client_wifi_max_sta {
+ wifi_index_e id;
+ int num;
+ };
+
+
+ struct ql_mgmt_client_wifi_active {
+ wifi_index_e_v01 id;
+ unsigned char action_type;
+ };
+
+ struct ql_mgmt_client_wifi_auth {
+ wifi_index_e id;
+ wifi_auth_e auth;
+ union {
+ struct {
+ int default_index;
+ char password[4][64];
+ } wep;
+ struct {
+ wifi_wpa_pairwise_e pairwise;
+ char password[64];
+ int group_rekey;
+ } wpa_psk;
+ };
+ };
+
+ struct ql_mgmt_client_wifi_rssi {
+ wifi_index_e id;
+ int rssi;
+ };
+
+ struct ql_mgmt_client_wifi_sta_info {
+ int count;
+ struct {
+ int ip;
+ char mac[6];
+ char hostname[32];
+ char ssid[32];
+ int uptime;
+ long long tx_bytes;
+ long long rx_bytes;
+ } sta[QL_WIFI_MAX_STA_NUM];
+ };
+ typedef struct{
+ struct ql_mgmt_client_wifi_enable enable;
+
+
+ }ql_mgmt_client_wifi_s_test;
+
+ typedef struct {
+ union {
+ struct ql_mgmt_client_wifi_work_mode work_mode;
+ struct ql_mgmt_client_wifi_enable enable;
+ struct ql_mgmt_client_wifi_country_code country_code;
+ struct ql_mgmt_client_wifi_mode mode;
+ struct ql_mgmt_client_wifi_channel channel;
+ struct ql_mgmt_client_wifi_essid ssid;
+ struct ql_mgmt_client_wifi_ssid_hide ssid_hide;
+ struct ql_mgmt_client_wifi_bandwidth bandwidth;
+ struct ql_mgmt_client_wifi_max_sta max_sta;
+ struct ql_mgmt_client_wifi_active active;
+ struct ql_mgmt_client_wifi_auth auth;
+ struct ql_mgmt_client_wifi_rssi rssi;
+ struct ql_mgmt_client_wifi_sta_info sta_info;
+ };
+ } ql_mgmt_client_wifi_s;
+
+
+extern int ql_wifi_enable(void);
+
+/**
+ * Disables the WLAN. This function removes the kernel module for the Wi-Fi driver.
+ *
+ * @param None
+ *
+ * @return
+ * On success, 0 is returned. On error, -1 is returned.
+ *
+ */
+extern int ql_wifi_disable(void);
+
+/**
+ * Create thread to enables the WLAN. This function enables the WLAN based on the hostpad or wpa_supplicant
+ * configuration provided. This function inserts the WLAN kernel module and advertises the SSID.
+ *
+ * @param None
+ *
+ * @return
+ * On success, 0 is returned. On error, -1 is returned.
+ *
+ */
+
+
+extern int ql_wifi_status_get(ql_wifi_status_e *status);
+
+/**
+ * Set the WiFi configuration: WiFi work mode configuration.
+ *
+ * @param [in] WiFi work mode
+ *
+ * @return
+ * On success, 0 is returned. On error, -1 is returned.
+ *
+ * @dependencies
+ * ql_wifi_disable is must be disable
+ *
+ */
+
+extern int ql_wifi_ap_ssid_set(ql_wifi_ap_index_e idx, char *ssid);
+
+/**
+ * Get the WiFi configuration: the hotspot ssid mode configuration.
+ *
+ * @param [in] Index of AP mode
+ * @param [out] the hotspot ssid name
+ *
+ * @return
+ * On success, 0 is returned. On error, -1 is returned.
+ *
+ */
+extern int ql_wifi_ap_ssid_get(ql_wifi_ap_index_e idx, char *ssid);
+
+/**
+ * Set the WiFi configuration: hidden hotspot configuration.
+ *
+ * @param [in] Index of AP mode
+ * @param [in] If set true, hidden hotspot
+ * If set false, open hotspot
+ *
+ * @return
+ * On success, 0 is returned. On error, -1 is returned.
+ *
+ */
+extern int ql_wifi_ap_ssid_hide_set(ql_wifi_ap_index_e idx, bool hide);
+
+/**
+ * Get the WiFi configuration: hidden hotspot configuration.
+ *
+ * @param [in] Index of AP mode
+ * @param [in] Get the hotspot hidden status
+ *
+ * @return
+ * On success, 0 is returned. On error, -1 is returned.
+ *
+ */
+extern int ql_wifi_ap_ssid_hide_get(ql_wifi_ap_index_e idx, bool *hide);
+
+/**
+ * Set the WiFi configuration: Operation mode configuration, such as 802.11a/b/n/ac.
+ *
+ * @param [in] Index of AP mode
+ * @param [in] Operation mode
+ *
+ * @return
+ * On success, 0 is returned. On error, -1 is returned.
+ *
+ */
+extern int ql_wifi_ap_mode_set(ql_wifi_ap_index_e idx, ql_wifi_mode_type_e mode);
+
+/**
+ * Get the WiFi configuration: Operation mode configuration, such as 802.11a/b/n/ac.
+ *
+ * @param [in] Index of AP mode
+ * @param [out] Operation mode
+ *
+ * @return
+ * On success, 0 is returned. On error, -1 is returned.
+ *
+ */
+extern int ql_wifi_ap_mode_get(ql_wifi_ap_index_e idx, ql_wifi_mode_type_e *mode);
+
+/**
+ * Set the WiFi configuration: HT or VHT capabilities (20MHz, 40MHz, 80MHz).
+ *
+ * @param [in] Index of AP mode
+ * @param [in] Bandwidth
+ *
+ * @return
+ * On success, 0 is returned. On error, -1 is returned.
+ *
+ * @dependencies
+ * The WiFi Operation mode must be set 802.11bgn/802.11an/802.11ac.
+ */
+extern int ql_wifi_ap_bandwidth_set(ql_wifi_ap_index_e idx, ql_wifi_bandwidth_type_e bandwidth);
+
+/**
+ * Get the WiFi configuration: HT or VHT capabilities (20MHz, 40MHz, 80MHz).
+ *
+ * @param [in] Index of AP mode
+ * @param [Out] Bandwidth
+ *
+ * @return
+ * On success, 0 is returned. On error, -1 is returned.
+ *
+ * @dependencies
+ * The WiFi Operation mode must be set 802.11bgn/802.11an/802.11ac.
+ */
+extern int ql_wifi_ap_bandwidth_get(ql_wifi_ap_index_e idx, ql_wifi_bandwidth_type_e *bandwidth);
+
+/**
+ * Set the WiFi configuration: channel number configuration.
+ *
+ * @param [in] Index of AP mode
+ * @param [in] Channel number
+ *
+ * @return
+ * On success, 0 is returned. On error, -1 is returned.
+ *
+ * @dependencies
+ * 1. if WiFi set 2.4GHz, the channel list:
+ * 0/1/2/3/4/5/6/7/8/9/10/11/12/13/14
+ * 2. if WiFi set 5GHz, the channel list:
+ * 36/40/44/48/52/56/60/64/100/104/108/112/116/120/124/128/132/136/140/144/149/153/157/161/165/175/181
+ */
+extern int ql_wifi_ap_channel_set(ql_wifi_ap_index_e idx, int channel);
+
+/**
+ * Get the WiFi configuration: channel number configuration.
+ *
+ * @param [in] Index of AP mode
+ * @param [out] Channel number
+ *
+ * @return
+ * On success, 0 is returned. On error, -1 is returned.
+ *
+ * @dependencies
+ * 1. if WiFi set 2.4GHz, the channel list:
+ * 0/1/2/3/4/5/6/7/8/9/10/11/12/13/14
+ * 2. if WiFi set 5GHz, the channel list:
+ * 36/40/44/48/52/56/60/64/100/104/108/112/116/120/124/128/132/136/140/144/149/153/157/161/165/175/181
+ */
+extern int ql_wifi_ap_channel_get(ql_wifi_ap_index_e idx, int *channel);
+
+/**
+ * Set the WiFi configuration: IEEE 802.11 specifies two authentication algorithms and WPA/IEEE 802.11i configuration.
+ *
+ * @param [in] Index of AP mode
+ * @param [in] authentication configuration
+ *
+ * @return
+ * On success, 0 is returned. On error, -1 is returned.
+ *
+ */
+extern int ql_wifi_ap_auth_set(ql_wifi_ap_index_e idx, ql_wifi_ap_auth_s *auth);
+
+/**
+ * Get the WiFi configuration: IEEE 802.11 specifies two authentication algorithms and WPA/IEEE 802.11i configuration.
+ *
+ * @param [in] Index of AP mode
+ * @param [out] authentication configuration
+ *
+ * @return
+ * On success, 0 is returned. On error, -1 is returned.
+ *
+ */
+extern int ql_wifi_ap_auth_get(ql_wifi_ap_index_e idx, ql_wifi_ap_auth_s *auth);
+
+/**
+ * Set the WiFi configuration: Maximum number of stations allowed in station table.
+ *
+ * @param [in] Index of AP mode
+ * @param [in] Maximum number of stations
+ *
+ * @return
+ * On success, 0 is returned. On error, -1 is returned.
+ *
+ */
+extern int ql_wifi_ap_max_sta_set(ql_wifi_ap_index_e idx, int max_sta_num);
+
+/**
+ * Get the WiFi configuration: Maximum number of stations allowed in station table.
+ *
+ * @param [in] Index of AP mode
+ * @param [out] Maximum number of stations
+ *
+ * @return
+ * On success, 0 is returned. On error, -1 is returned.
+ *
+ */
+extern int ql_wifi_ap_max_sta_get(ql_wifi_ap_index_e idx, int *max_sta_num);
+
+extern int ql_wifi_set_to_ap(ql_wifi_ap_index_e idx);
+
+extern int ql_wifi_set_to_sta(ql_wifi_ap_index_e idx);
+
+#endif /* end of __QL_WIFI_H__ */
+