Add basic change for v1453
Change-Id: I9497a61bbc3717f66413794a4e7dee0347c0bc33
diff --git a/mbtk/include/lynq/liblog.h b/mbtk/include/lynq/liblog.h
new file mode 100755
index 0000000..840b43d
--- /dev/null
+++ b/mbtk/include/lynq/liblog.h
@@ -0,0 +1,41 @@
+#ifndef __LIBLOG_H__
+#define __LIBLOG_H__
+
+#include <unistd.h>
+#include "mbtk_log.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef enum
+{
+ LOG_UNSET = -1,
+ LOG_VERBOSE = 2,
+ LOG_ERROR = 3,
+ LOG_WARNING = 4,
+ LOG_INFO = 6,
+ LOG_DEBUG = 7,
+ LOG_LEVEL_MAX = 9
+}log_level_enum;
+
+void lynq_log_global_output(log_level_enum Level,const char *format,...);
+void lynq_log_configuration_init(const char *log_name);
+const char* lynq_read_log_version();
+
+//log level api
+int lynq_set_log_level(const char * module_name, log_level_enum level);
+int lynq_get_log_level(const char * module_name, log_level_enum *level);
+int lynq_set_special_log_level(const char * exe_name, const char * module_name, log_level_enum level);
+int lynq_get_special_log_level(const char * exe_name, const char * module_name, log_level_enum *level);
+int lynq_notify_recalc_log_level(pid_t pid);
+int lynq_write_log_to_file_now();
+int lynq_stop_record_log(int value);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif //__LOG_H__
diff --git a/mbtk/include/lynq/liblynq-at-common.h b/mbtk/include/lynq/liblynq-at-common.h
new file mode 100755
index 0000000..5ca8ca8
--- /dev/null
+++ b/mbtk/include/lynq/liblynq-at-common.h
@@ -0,0 +1,14 @@
+#ifndef LIBLYNQ_AT_COMMON_H
+#define LIBLYNQ_AT_COMMON_H 1
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef void ( *lynq_atsvc_incb )( const char *input,const int length);
+typedef void ( *lynq_atsvc_outcb )(char *output, int out_max_size, int mode);
+lynq_atsvc_incb lynq_register_at_common(lynq_atsvc_outcb out_cb);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
\ No newline at end of file
diff --git a/mbtk/include/lynq/libpoweralarm.h b/mbtk/include/lynq/libpoweralarm.h
new file mode 100755
index 0000000..4110fba
--- /dev/null
+++ b/mbtk/include/lynq/libpoweralarm.h
@@ -0,0 +1,36 @@
+/*******************************************************
+*
+* @brief: none
+* @details: add libpoweralarm api
+* @author: l.yang
+* @date: 2023.8.21
+* @version: V1.0
+* @copyright:Copyright (c) MobileTek
+*
+*********************************************/
+
+#ifndef _LYNQ_POWERALARM_
+#define _LYNQ_POWERALARM_
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+typedef int (*lynq_wakealarm_add_cb)(unsigned int src_id, int rtc_id);
+int lynq_rtc_service_init(void);
+int lynq_rtc_service_deinit(void);
+ssize_t poweralarm(char *buffer,int src_id);
+ssize_t wakealarm(char *buffer,int src_id,int rtc_id,lynq_wakealarm_add_cb wakealarm_notify );
+ssize_t cancel_wakealarm(int src_id, int rtc_id);
+
+int lynq_set_wakealarm(unsigned long time_sec,int src_id,int rtc_id,lynq_wakealarm_add_cb wakealarm_notify );
+int lynq_set_poweralarm(unsigned long time_sec,int src_id);
+
+
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+
diff --git a/mbtk/include/lynq/lynq-adc.h b/mbtk/include/lynq/lynq-adc.h
new file mode 100755
index 0000000..a0051cc
--- /dev/null
+++ b/mbtk/include/lynq/lynq-adc.h
@@ -0,0 +1,23 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+// #include <sc_bsp.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef enum ADC_CHANNEL_ENUM
+{
+ QADC_NONE = 0,
+ ADC0 =1,
+ ADC1 =2,
+ ADC2 =3,
+ QADC_END
+}ADC_CHANNEL_E;
+
+int qser_adc_show(ADC_CHANNEL_E qadc);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/mbtk/include/lynq/lynq-gpio.h b/mbtk/include/lynq/lynq-gpio.h
new file mode 100755
index 0000000..39eed04
--- /dev/null
+++ b/mbtk/include/lynq/lynq-gpio.h
@@ -0,0 +1,30 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+//#include <sc_bsp.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define MAX_GPIO_NUM (200)
+// static void *test_gpio_handle[MAX_GPIO_NUM]={NULL};
+
+int lynq_gpio_init(int gpio, int direction, int value, int pullsel);
+
+int lynq_gpio_deinit(int gpio);
+
+int lynq_gpio_direction_set(int gpio, int direction);
+
+int lynq_gpio_value_set(int gpio, int value);
+
+int lynq_gpio_value_get(int gpio);
+
+int lynq_gpio_pullsel_set(int gpio, int pullsel);
+
+int lynq_gpio_pullsel_get(int gpio);
+
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/mbtk/include/lynq/lynq-irq.h b/mbtk/include/lynq/lynq-irq.h
new file mode 100755
index 0000000..4ad03c5
--- /dev/null
+++ b/mbtk/include/lynq/lynq-irq.h
@@ -0,0 +1,177 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdbool.h>
+#include <time.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#include <linux/ioctl.h>
+#include <linux/types.h>
+
+struct sc_irq_info {
+ unsigned int line;
+ unsigned int type;
+};
+
+#define SC_IRQ_IOC_MAGIC 'I'
+
+/*ioctl cmd usd by device*/
+#define SC_IRQ_INSTALL _IOW(SC_IRQ_IOC_MAGIC, 1, char *)
+#define SC_IRQ_SET_TYPE _IOW(SC_IRQ_IOC_MAGIC, 2, char *)
+#define SC_IRQ_SET_WAKE _IOW(SC_IRQ_IOC_MAGIC, 3, char *)
+#define SC_IRQ_GET_WAKE _IOW(SC_IRQ_IOC_MAGIC, 4, char *)
+#define SC_IRQ_UNINSTALL _IOW(SC_IRQ_IOC_MAGIC, 5, char *)
+
+#define SC_IRQ_GET_STATUS _IOW(SC_IRQ_IOC_MAGIC, 6, char *)
+#define SC_IRQ_CLEAR_STATUS _IOW(SC_IRQ_IOC_MAGIC, 7, char *)
+
+#define SC_IRQ_DEV "/dev/sc_irq"
+
+
+
+/*----------------------------------------------------------*/
+struct sc_pm_info {
+ unsigned int sleep_time; /* ms */
+ unsigned int wake_event;
+};
+
+#define SC_PM_WL_EVENT_EXT0 ((unsigned int)1 << 0)
+#define SC_PM_WL_EVENT_EXT1 ((unsigned int)1 << 1)
+#define SC_PM_WL_EVENT_EXT2 ((unsigned int)1 << 2)
+#define SC_PM_WL_EVENT_EXT3 ((unsigned int)1 << 3)
+#define SC_PM_WL_EVENT_EXT4 ((unsigned int)1 << 4)
+#define SC_PM_WL_EVENT_EXT5 ((unsigned int)1 << 5)
+#define SC_PM_WL_EVENT_EXT6 ((unsigned int)1 << 6)
+#define SC_PM_WL_EVENT_EXT7 ((unsigned int)1 << 7)
+
+#define SC_PM_IOC_MAGIC 'P'
+
+/*ioctl cmd usd by device*/
+#define SC_PM_WL_SET _IOW(SC_PM_IOC_MAGIC, 1, char *)
+#define SC_PM_WL_CLEAR _IOW(SC_PM_IOC_MAGIC, 2, char *)
+#define SC_PM_WL_GET _IOW(SC_PM_IOC_MAGIC, 3, char *)
+
+#define SC_PM_DEV "/dev/sc_pm"
+
+
+typedef void (*irq_handler)(void);
+
+#define SC_LIBIRQ_EXT0 (0)
+#define SC_LIBIRQ_EXT1 (1)
+#define SC_LIBIRQ_EXT2 (2)
+#define SC_LIBIRQ_EXT3 (3)
+#define SC_LIBIRQ_EXT4 (4)
+#define SC_LIBIRQ_EXT5 (5)
+#define SC_LIBIRQ_EXT6 (6)
+#define SC_LIBIRQ_EXT7 (7)
+#define SC_LIBIRQ_EXT8 (8)
+#define SC_LIBIRQ_EXT9 (9)
+#define SC_LIBIRQ_EXT10 (10)
+#define SC_LIBIRQ_EXT11 (11)
+#define SC_LIBIRQ_EXT12 (12)
+#define SC_LIBIRQ_EXT13 (13)
+#define SC_LIBIRQ_EXT14 (14)
+#define SC_LIBIRQ_EXT15 (15)
+#define SC_LIBIRQ_MAX (200)
+
+#define SC_LIBIRQ_TYPE_RISING (0)
+#define SC_LIBIRQ_TYPE_FALLING (1)
+#define SC_LIBIRQ_TYPE_LEVEL_HIGH (2)
+#define SC_LIBIRQ_TYPE_LEVEL_LOW (3)
+#define SC_LIBIRQ_TYPE_MAX (4)
+
+/*
+ * Add a handler for an interrupt line.
+ *
+ * line : The interrupt line
+ * handler : Function to be called when the IRQ occurs.
+ * trig_type : rising edge or fallling edge
+ *
+ * return 0 if succeed, others failed
+ */
+int sc_irq_install(unsigned int line, irq_handler handler, int trig_type);
+
+/*
+ * free an interrupt allocated with sc_irq_install.
+ *
+ * line : The interrupt line
+ *
+ * return 0 if succeed, others failed
+ */
+int sc_irq_uninstall(unsigned int line);
+
+/*
+ * set the irq trigger type for an irq.
+ *
+ * line : The interrupt line
+ * trig_type : rising edge or fallling edge
+ *
+ * return 0 if succeed, others failed
+ */
+int sc_irq_set_type(unsigned int line, int trig_type);
+
+/*
+ * get the irq trigger type for an irq.
+ *
+ * line : The interrupt line
+ * trig_type : edge or level type
+ *
+ * return 0 if succeed, others failed
+ */
+int sc_irq_get_type(unsigned int line, int *trig_type);
+
+/*
+ * control irq power management wakeup.
+ *
+ * line : The interrupt line
+ * en : enable/disable power management wakeup
+ *
+ * return 0 if succeed, others failed
+ */
+int sc_irq_set_wake(unsigned int line, int en);
+
+/*
+ * get the irq awake status for an irq.
+ *
+ * line : The interrupt line
+ * en : enable/disable power management wakeup
+ *
+ * return 0 if succeed, others failed
+ */
+int sc_irq_get_wake(unsigned int line, int *en);
+
+typedef enum
+{
+ Rising_edge_trigger = 0,//:上升沿触发
+ Falling_edge_trigger = 1,//:下降沿触发
+ High_level_trigger = 2,//:高电平触发
+ Low_level_trigger = 3,//:低电平触发
+
+}trig_type_e;
+
+
+//int line_gpio[15]={-1,48,49,50,51,52,53,54,119,128,129,-1,131,-1,125};//this is the line match gpio
+int line_gpio[4]={21, 22, 23 ,24};//this is the line match gpio
+
+typedef void (*irq_handler)(void);
+
+int lynq_irq_install(int line, irq_handler irq_handler, trig_type_e trig_type);
+
+int lynq_irq_uninstall(int line);
+
+int lynq_irq_set_type(int line, int trig_type);
+
+int lynq_irq_get_type(int line);
+
+int lynq_irq_set_wake(int line, int en);
+
+int lynq_irq_get_wake(int line);
+
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/mbtk/include/lynq/lynq-qser-audio.h b/mbtk/include/lynq/lynq-qser-audio.h
new file mode 100755
index 0000000..d5a6f20
--- /dev/null
+++ b/mbtk/include/lynq/lynq-qser-audio.h
@@ -0,0 +1,44 @@
+/*******************************************************
+*
+* @brief: Add audio api
+* @details: add liblynq-qser-audio api
+* @author: yu.dong
+* @date: 2023.9.28
+* @version: V1.0
+* @copyright:Copyright (c) MobileTek
+*
+*********************************************/
+#ifndef LYNQ_QSER_AUDIO
+#define LYNQ_QSER_AUDIO
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef void (*_cb_onPlayer)(int);
+
+int qser_AudPlayer_Open(char* device, _cb_onPlayer cb_fun);
+int qser_AudPlayer_PlayFrmFile(int hdl, const char *fd, int offset);
+int qser_AudPlayer_PlayPcmBuf(const unsigned char *pcm_data, int data_size, int period_size,
+ int period_count, int num_channels, int sample_rate, int ownerid);
+int qser_AudPlayer_Pause(int hdl);
+int qser_AudPlayer_Resume(int hdl);
+void qser_AudPlayer_Stop(int hdl);
+void qser_AudPlayer_Close(int hdl);
+
+int qser_AudRecorder_Open(char* device, _cb_onPlayer cb_fun);
+int qser_AudRecorder_StartRecord(int hdl, const char *fd, int offset);
+int qser_AudRecorder_StartRecord_Custom(char *file, int period_size, int period_count,
+ int num_channels, int sample_rate);
+int qser_AudRecorder_Pause(void);
+int qser_AudRecorder_Resume(void);
+void qser_AudRecorder_Stop(void);
+void qser_AudRecorder_Close(void);
+
+void qser_Audio_Deinit(void);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
diff --git a/mbtk/include/lynq/lynq-qser-autosuspend.h b/mbtk/include/lynq/lynq-qser-autosuspend.h
new file mode 100755
index 0000000..118f7ac
--- /dev/null
+++ b/mbtk/include/lynq/lynq-qser-autosuspend.h
@@ -0,0 +1,81 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdlib.h>
+#include <pthread.h>
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define MAX_LOCK_NUM 128
+
+#define E_READ -2
+#define E_WRITE -3
+#define E_TABLE_FULL -4
+#define E_LOCK_EXIST -5
+#define E_INPUT_ERROR -6
+
+typedef enum
+{
+ E_QL_LPM_FALLING = 0, /* Falling, Means wakeupin falling to wakeup the module, or wakeupout falling to wakeup mcu
+. */
+ E_QL_LPM_RISING = 1, /* Rising, Means wakeupin rising to wakeup the module, or wakeupout rising to wakeup mcu.
+*/
+}qser_lpm_edge_t;
+
+typedef int qser_lpm_pin_t;
+
+
+typedef struct{
+ qser_lpm_pin_t wakeupin_pin;
+ qser_lpm_edge_t wakeupin_edge;
+}qser_lpm_wakeupin_data_t;
+
+typedef struct{
+ qser_lpm_pin_t wakeupout_pin;
+ qser_lpm_edge_t wakeupout_edge;
+}qser_lpm_wakeupout_data_t;
+
+
+typedef void (*qser_lpm_Handler_t)
+(
+ qser_lpm_edge_t lpm_edge
+);
+
+typedef struct{
+ qser_lpm_wakeupin_data_t wakeupin;
+ qser_lpm_wakeupout_data_t wakeupout;
+}qser_pm_cfg_t;
+
+
+typedef struct
+{
+ char lock_name[MAX_LOCK_NUM][64];
+ int lock_pid[MAX_LOCK_NUM];
+} LOCK_TABLE;
+
+typedef void (*mbtk_info_callback_func)(const void* data, int data_len);
+
+int read_lock_table(void);
+int qser_lpm_init(qser_lpm_Handler_t qser_lpm_handler, qser_pm_cfg_t *qser_lpm_cfg);
+int qser_lpm_deinit(void);
+int qser_autosuspend_enable(char enable);
+int qser_wakelock_create(const char *name, size_t len);
+int qser_wakelock_lock(int fd);
+int qser_wakelock_unlock(int fd);
+int qser_wakelock_destroy(int fd);
+
+int qser_whitelist_set(char *whitelist);
+int qser_whitelist_get(char *whitelist);
+
+//static void* suspend_timer_thread_run(void* arg);
+//int suspend_timer_timer_init(void);
+int qser_suspend_timer_set(int time, mbtk_info_callback_func cb);
+
+
+#ifdef __cplusplus
+}
+#endif
+
diff --git a/mbtk/include/lynq/lynq-qser-fota.h b/mbtk/include/lynq/lynq-qser-fota.h
new file mode 100755
index 0000000..bbc674c
--- /dev/null
+++ b/mbtk/include/lynq/lynq-qser-fota.h
@@ -0,0 +1,36 @@
+/*******************************************************
+*
+* @brief:
+* @details: add fota upgrade api
+* @author: l.yang
+* @date: 2023.8.3
+* @version: V1.0
+* @copyright:Copyright (c) MobileTek
+*
+*********************************************/
+#ifndef LYNQ_QSER_FOTA
+#define LYNQ_QSER_FOTA
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/*******************************************************************************
+* @brief get reboot upgrade status
+ @param
+ NULL
+ @return
+ if reboot the other system successfully return 1, else return 0
+ *******************************************************************************/
+int lynq_get_reboot_upgrade_status(void);
+int lynq_get_upgrade_status(void);
+int lynq_fota_set_addr_value(char *value,int size);
+int lynq_fota_nrestart(void);
+int lynq_rock_main(int first_run);
+int lynq_read_process(void);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
diff --git a/mbtk/include/lynq/lynq-qser-usb.h b/mbtk/include/lynq/lynq-qser-usb.h
new file mode 100755
index 0000000..97428d4
--- /dev/null
+++ b/mbtk/include/lynq/lynq-qser-usb.h
@@ -0,0 +1,25 @@
+/*******************************************************
+*
+* @brief: Add usb api
+* @details: add liblynq-qser-usb api
+* @author: wz.wang
+* @date: 2024.2.18
+* @version: V1.0
+* @copyright:Copyright (c) MobileTek
+*
+*********************************************/
+#ifndef LYNQ_QSER_USB
+#define LYNQ_QSER_USB
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int qser_get_usb_usermode_net_state(void);
+int qser_get_usb_usermode_adb_state(void);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
diff --git a/mbtk/include/lynq/lynq-qser-voice.h b/mbtk/include/lynq/lynq-qser-voice.h
new file mode 100755
index 0000000..668d6ce
--- /dev/null
+++ b/mbtk/include/lynq/lynq-qser-voice.h
@@ -0,0 +1,218 @@
+/**
+ *@file qser_voice.h
+ *@date 2017-11-30
+ *@author
+ *@brief
+ */
+
+
+#ifndef __LYNQ_QSER_VOICE_H__
+#define __LYNQ_QSER_VOICE_H__
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "mbtk_type.h"
+
+typedef enum
+{
+ E_QSER_VCALL_EXTERNAL_SLOT_1,
+ E_QSER_VCALL_EXTERNAL_SLOT_2,
+ E_QSER_VCALL_EMBEDDED,
+ E_QSER_VCALL_REMOTE,
+ E_QSER_VCALL_ID_MAX
+}E_QSER_VCALL_ID_T;
+
+typedef enum
+{
+ E_QSER_VOICE_CALL_STATE_INCOMING = 0x0000, /**< MT incoming; CC setup. */
+ E_QSER_VOICE_CALL_STATE_DIALING = 0x0001, /**< Dialing state. */
+ E_QSER_VOICE_CALL_STATE_ALERTING = 0x0002, /**< MT call waiting; MO alterting. */
+ E_QSER_VOICE_CALL_STATE_ACTIVE = 0x0003, /**< Call is active. */
+ E_QSER_VOICE_CALL_STATE_HOLDING = 0x0004, /**< Call is on hold. */
+ E_QSER_VOICE_CALL_STATE_END = 0x0005, /**< Call is disconnected. */
+ E_QSER_VOICE_CALL_STATE_WAITING = 0x0006, /**< Call is waiting. */
+}qser_voice_call_state_t;
+
+typedef enum
+{
+ E_QSER_VOICE_CALL_WAITING_VOICE_ENABLED = 0, /**< Voice call waiting enabled. */
+ E_QSER_VOICE_CALL_WAITING_DISABLED = 1, /**< Voice call waiting disabled. */
+}E_QSER_VOICE_CALL_WAITING_SERVICE_T;
+
+typedef struct
+{
+ E_QSER_VOICE_CALL_WAITING_SERVICE_T waiting_service;
+}qser_voice_call_waiting_service_t;
+
+typedef qser_voice_call_state_t E_QSER_VOICE_CALL_STATE_T;
+
+typedef uint32_t voice_client_handle_type;
+
+/* Callback function registered via QSER_Voice_Call_AddStateHandler;
+ This will be called if any stated changed of call_id
+*/
+typedef void (*QSER_VoiceCall_StateHandlerFunc_t)
+(
+ int caLOCAL_C_INCLUDESll_id,
+ char* phone_num,
+ E_QSER_VOICE_CALL_STATE_T state,
+ void *contextPtr
+);
+
+/* Init voice module and return h_voice, this should be called before any other APIs */
+int qser_voice_call_client_init(voice_client_handle_type *ph_voice);
+
+/* DeInit voice module and release resources, this should be called at last */
+int qser_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 qser_voice_call_addstatehandler(voice_client_handle_type h_voice,
+ QSER_VoiceCall_StateHandlerFunc_t handlerPtr,
+ void* contextPtr);
+
+/* Remove callback function, won't receive any notify anymore */
+int qser_voice_call_removestatehandle(voice_client_handle_type h_voice);
+
+/* Start call and return call_id, this can be used in the later */
+int qser_voice_call_start(voice_client_handle_type h_voice,
+ E_QSER_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 QSER_Voice_Call_Start or callback func register via QSER_Voice_Call_AddStateHandler */
+int qser_voice_call_end( voice_client_handle_type h_voice,
+ int call_id); ///< [IN] call id, return by QSER_Voice_Start
+
+/* Answer the call of call_id, which returned by callback func register via QSER_Voice_Call_AddStateHandler */
+int qser_voice_call_answer(voice_client_handle_type h_voice,
+ int call_id );
+
+int qser_voice_call_switch_waiting_or_holding_and_active(voice_client_handle_type h_voice);
+
+//set voice speech volume
+int qser_voice_set_speech_volume(const int volume);
+
+//Get voice speech volume
+int qser_voice_get_speech_volume(int *volume);
+
+//Set voice call waiting
+int qser_voice_call_setwaiting
+(
+ int h_voice,
+ qser_voice_call_waiting_service_t e_service
+);
+
+//Get voice call waiting status
+int qser_voice_call_getwaitingstatus
+(
+ int h_voice,
+ qser_voice_call_waiting_service_t *pe_service
+);
+
+
+int qser_voice_set_dtmf(const char callnum);
+
+/*
+Usage 1 (register callback and wait for new call in, then answer):
+1, QSER_Voice_Call_Client_Init
+2, QSER_Voice_Call_AddStateHandler(pf_cb)
+3, wait for new call arrive, pf_cb will pass the call_id to app.
+4, QSER_Voice_Call_Answer(call_id)
+5, QSER_Voice_Call_End
+6, QSER_Voice_Call_Client_Deinit
+
+
+Usage 2 (call out):
+1, QSER_Voice_Call_Client_Init
+2, QSER_Voice_Call_AddStateHandler(pf_cb)
+3, QSER_Voice_Call_Start
+4, QSER_Voice_Call_End
+5, QSER_Voice_Call_Client_Deinit
+
+
+*/
+
+#ifdef ECALL_SUPPORT
+
+#define QSER_MSD_MAX_LENGTH 140
+
+typedef enum{
+ E_QSER_VOICE_ECALL_SET_NUMBER = 0, /* Set Number */
+ E_QSER_VOICE_ECALL_SET_URI = 1, /* Set Uri */
+}E_QSER_VOICE_ECALL_SET_TYPE_T;
+
+typedef enum{
+ E_QSER_VOICE_ECALL_CAT_MANUAL = 0, /* Manual Emergency eCall */
+ E_QSER_VOICE_ECALL_CAT_AUTO = 1, /* Automatic Emergency eCall */
+}E_QSER_VOICE_ECALL_CATEGORY_T;
+
+
+typedef enum{
+ E_QSER_VOICE_ECALL_TEST = 0, /* Test eCall */
+ E_QSER_VOICE_ECALL_EMERGENCY = 1, /* Emergency eCall */
+ E_QSER_VOICE_ECALL_RECONFIG = 2, /* Reconfiguration eCall */
+}E_QSER_VOICE_ECALL_VARIANT_T;
+
+typedef enum{
+ E_QSER_VOICE_ECALL_IND_SENDING_START = 1,
+ E_QSER_VOICE_ECALL_IND_SENDING_MSD = 2,
+ E_QSER_VOICE_ECALL_IND_LLACK_RECEIVED = 3,
+ E_QSER_VOICE_ECALL_IND_ALACK_POSITIVE_RECEIVED = 4,
+ E_QSER_VOICE_ECALL_IND_ALACK_CLEARDOWN_RECEIVED = 5,
+ E_QSER_VOICE_ECALL_IND_DAILING = 9,
+ E_QSER_VOICE_ECALL_IND_ALERTING = 10,
+ E_QSER_VOICE_ECALL_IND_ACTIVE = 11,
+ E_QSER_VOICE_ECALL_IND_DISCONNECTED = 12,
+ E_QSER_VOICE_ECALL_IND_IMS_ACTIVE = 13,
+ E_QSER_VOICE_ECALL_IND_IMS_DISCONNECTED = 14,
+ E_QSER_VOICE_ECALL_IND_ABNORMAL_HANGUP=15,
+ E_QSER_VOICE_ECALL_IND_IMS_MSD_ACK = 20,
+ E_QSER_VOICE_ECALL_IND_IMS_UPDATE_MSD = 21,
+ E_QSER_VOICE_ECALL_IND_IMS_IN_BAND_TRANSFER = 22,
+ E_QSER_VOICE_ECALL_IND_IMS_MSD_NACK = 23,
+ E_QSER_VOICE_ECALL_IND_IMS_SRVCC = 24,
+ E_QSER_VOICE_ECALL_IND_ONLY_DEREGISTRATION = 31,
+ E_QSER_VOICE_ECALL_IND_MAY_DEREGISTER = 32,
+ E_QSER_VOICE_ECALL_IND_PSAP_CALLBACK_START = 40,
+ E_QSER_VOICE_ECALL_IND_PSAP_CALLBACK_IMS_UPDATE_MSD = 41,
+ E_QSER_VOICE_ECALL_IND_SENDING_START_IN_VOICE=8000,
+ E_QSER_VOICE_ECALL_IND_T2_TIMER_OUT = 9000,
+ E_QSER_VOICE_ECALL_IND_T5_TIMER_OUT = 9001,
+ E_QSER_VOICE_ECALL_IND_T6_TIMER_OUT = 9002,
+ E_QSER_VOICE_ECALL_IND_T7_TIMER_OUT = 9003,
+ E_QSER_VOICE_ECALL_IND_REDIAL_TIMER_OUT = 9004,
+ E_QSER_VOICE_ECALL_IND_AUTO_ANS_TIMER_OUT = 9005,
+ E_QSER_VOICE_ECALL_IND_AUTO_ANS_IMS_TIMER_OUT = 9006,
+ E_QSER_VOICE_ECALL_IND_UNSPECIFIED = 0xffff,
+}E_QSER_VOICE_ECALL_INDICATION_T;
+
+typedef void (*QSER_ECall_IndHandlerFunc_t)
+(
+ int callid,
+ E_QSER_VOICE_ECALL_INDICATION_T ind,
+ void *contextPtr
+);
+
+int qser_voice_set_test_num(voice_client_handle_type* h_voice,E_QSER_VOICE_ECALL_SET_TYPE_T type, const char *test_num, int test_num_length);
+int qser_voice_fast_ecall(voice_client_handle_type* h_voice,
+ int *call_id,
+ E_QSER_VOICE_ECALL_CATEGORY_T cat,
+ E_QSER_VOICE_ECALL_VARIANT_T variant,
+ const char *addr,
+ int addr_length,
+ const unsigned char *msd_data,
+ int msd_length); //msd_length should <= QSER_MSD_MAX_LENGTH
+int qser_voice_set_msd( int callid, const unsigned char *msd_data, int msd_length); // msd_length should <= QSER_MSD_MAX_LENGTH
+int qser_voice_add_ecall_indhandler(voice_client_handle_type* h_voice,
+ QSER_ECall_IndHandlerFunc_t handlerPtr,
+ void* contextPtr);
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // __QSER_VOICE_H__
+
diff --git a/mbtk/include/lynq/lynq_alarm.h b/mbtk/include/lynq/lynq_alarm.h
new file mode 100755
index 0000000..b9a9d02
--- /dev/null
+++ b/mbtk/include/lynq/lynq_alarm.h
@@ -0,0 +1,23 @@
+/*
+* qser_alarm.h
+*
+* QSER alarm header.
+*
+* Author : lb
+* Date : 2023/11/23 10:45:44
+*/
+#ifndef _QSER_ALARM_H
+#define _QSER_ALARM_H
+#include "mbtk_type.h"
+
+typedef int (*lynq_wakealarm_add_cb)(unsigned int src_id, int rtc_id);
+int lynq_rtc_service_init(void);
+int lynq_rtc_service_deinit(void);
+ssize_t poweralarm(char *buffer,int src_id);
+ssize_t wakealarm(char *buffer,int src_id,int rtc_id,lynq_wakealarm_add_cb wakealarm_notify );
+ssize_t cancel_wakealarm(int src_id, int rtc_id);
+
+int lynq_set_wakealarm(unsigned long time_sec,int src_id,int rtc_id,lynq_wakealarm_add_cb wakealarm_notify );
+int lynq_set_poweralarm(unsigned long time_sec,int src_id);
+
+#endif /* _QSER_ALARM_H */
diff --git a/mbtk/include/lynq/lynq_autosuspend.h b/mbtk/include/lynq/lynq_autosuspend.h
new file mode 100755
index 0000000..efd1219
--- /dev/null
+++ b/mbtk/include/lynq/lynq_autosuspend.h
@@ -0,0 +1,37 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <unistd.h>
+#include <dlfcn.h>
+#include <pthread.h>
+#include <stdbool.h>
+#include <time.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+struct time_info_t
+{
+ long sleep_start_time;
+ long wakeup_time;
+};
+
+int lynq_autosleep_enable(void);
+int lynq_autosleep_disable(void);
+int lynq_wait_wakeup_event(long *sleep_start_time, long * wakeup_time);
+
+#ifdef MOBILETEK_TARGET_PLATFORM_T106
+int lynq_set_lpmode(int lp_mode);
+int release_wake_lock(char *name);
+int acquire_wake_lock(int lock, char *name);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/mbtk/include/lynq/lynq_call.h b/mbtk/include/lynq/lynq_call.h
new file mode 100755
index 0000000..3bb398f
--- /dev/null
+++ b/mbtk/include/lynq/lynq_call.h
@@ -0,0 +1,181 @@
+#ifndef LYNQ_CALL_H
+#define LYNQ_CALL_H 1
+#ifdef __cplusplus
+extern "C" {
+#endif
+#define LYNQ_PHONE_NUMBER_MAX 32
+#define INDEX_IS_NUMBER( alpha_char ) \
+ ( ( (alpha_char >= '0') && (alpha_char <= '9') ) ? 1 : 0 )
+#define LYNQ_CALL_MAX 3
+#define LYNQ_CALL_FAIL_VENDOR_CAUSE 64
+#define MAX_IP_LENGTH 128
+#define MAX_VLAN_INFO_LENGTH 32
+#define MAX_SSRC_INFO_LENGTH 10 /*2^32=4294967296, 10 digit*/
+
+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_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 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 struct
+{
+ lynq_last_call_fail_cause_t cause_code;
+ char vendor_cause[LYNQ_CALL_FAIL_VENDOR_CAUSE];
+}lynqLastCallFailCause;
+int lynq_init_call(int uToken);
+int lynq_deinit_call();
+int lynq_call(int *handle,char addr[]);
+int lynq_call_answer();
+int lynq_call_hungup(int*handle);
+int lynq_call_hungup_all();
+int lynq_set_auto_answercall(const int mode);
+int lynq_get_mute_mic(int *status);
+int lynq_set_mute_mic(const int enable);
+int lynq_get_speech_volume(int *volume);
+int lynq_set_speech_volume(const int volume);
+int lynq_incall_record_start(const char* file_path);
+int lynq_incall_record_stop();
+int lynq_set_DTMF(const char callnum);
+int lynq_set_DTMF_volume(const int volume);
+int lynq_get_current_call_state(int *handle, int *call_state,int *toa,int *direction,char addr[]);
+/*lei add for T8TSK-17 2022/7/20*/
+int lynq_switch_waiting_or_holding_and_active(void);
+int lynq_hangup_waiting_or_background(void);
+int lynq_hangup_foreground_resume_background(void);
+
+/* add for T106bug-213 2023/9/18 */
+void lynq_release_wait_call();
+
+/*lei add for API-163/API-164 2023/1/3*/
+/**
+ * @brief wait_call_state_change
+ *
+ * @param handle call_id
+ * @return int
+ */
+int lynq_wait_call_state_change(int *handle);
+/*lei add for API-163/API-164 2023/1/3*/
+/*lei add for T8TSK-17 2022/7/20*/
+
+#ifdef ECALL_SUPPORT
+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_MO_MAX=3,
+ LYNQ_ECALL_CALLBACK = 3, /* Callback eCall */
+ LYNQ_ECALL_VAR_MAX,
+ LYNQ_ECALL_VAR_NONE=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_DAILING = 9,
+ LYNQ_ECALL_ALERTING = 10,
+ 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_SENDING_START_IN_VOICE=8000,
+ 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_set_test_num(LYNQ_ECall_Set_Type type, const char *test_num, int test_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_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);
+#endif
+
+/*Audio Path setting begin*/
+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{
+ Rtp_Ssrc_random = 0,
+ Rtp_Ssrc_specific =1,
+}LYNQ_Rtp_Ssrc_Mode;
+
+/*set*/
+int lynq_set_voice_audio_mode(const LYNQ_Audio_Mode audio_mode);
+int lynq_set_remote_rtp_ip(const char* ip, const int ip_length);
+int lynq_set_vlan_info(const char* vlan_info, const int vlan_info_length);
+int lynq_set_rtp_port(const LYNQ_Rtp_Mode rtp_mode, const int port);
+int lynq_set_rtp_param(const int clock_rate,const int channels,const int latency); //only for client
+int lynq_set_call_rtp_ssrc(const LYNQ_Rtp_Ssrc_Mode ssrc_mode, const unsigned int ssrc);
+
+/*get*/
+LYNQ_Audio_Mode lynq_get_voice_audio_mode();
+int lynq_get_remote_rtp_ip(char* ip, const int ip_length);
+int lynq_get_vlan_info(char* vlan_info, const int vlan_info_length);
+int lynq_get_rtp_port(const LYNQ_Rtp_Mode rtp_mode, int* port);
+int lynq_get_rtp_param(int* clock_rate,int* channels, int* latency);//only for client
+int lynq_get_call_rtp_ssrc(int* ssrc_mod, unsigned int* ssrc);
+/*Audio Path setting end*/
+
+void lynq_set_test_mode(const int test_mode);
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/mbtk/include/lynq/lynq_chip_id.h b/mbtk/include/lynq/lynq_chip_id.h
new file mode 100755
index 0000000..4908ecf
--- /dev/null
+++ b/mbtk/include/lynq/lynq_chip_id.h
@@ -0,0 +1,34 @@
+/**@file lynq-systime.h
+ *
+ * @brief Sync systime form each time source.
+ *
+ * @author sj.zhang
+ *
+ * @date 2023-08-14
+ *
+ * @version V1.0
+ *
+ * @copyright Copyright (c) MobileTek
+ */
+
+#ifndef _LYNQ_CHIP_ID_H_
+#define _LYNQ_CHIP_ID_H_
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/**@brief get chip id.
+*
+* @param void
+*
+* @return
+* 0:success
+* other:failure
+*/
+int lynq_get_chip_id(char *chip_id);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/mbtk/include/lynq/lynq_data.h b/mbtk/include/lynq/lynq_data.h
new file mode 100755
index 0000000..1ee15ba
--- /dev/null
+++ b/mbtk/include/lynq/lynq_data.h
@@ -0,0 +1,82 @@
+#ifndef LYNQ_DATA_H
+#define LYNQ_DATA_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+#define LYNQ_APN_CHANNEL_MAX 10
+#define LYNQ_PDP_TYPE_MAX_LEN 16
+#define LYNQ_IFACE_NAME_MAX_LEN 50
+#define LYNQ_APN_MAX_LEN 50
+#define LYNQ_TYPE_MAX_LEN 50
+#define LYNQ_ADDRESSES_MAX_LEN 100
+#define LYNQ_DNSES_MAX_LEN 256
+#define LYNQ_GATEWAYS_MAX_LEN 50
+#define LYNQ_PCSCF_MAX_LEN 256
+#define LYNQ_APN_TYPE_MAX_LEN 50
+#define LYNQ_PDP_ADDR_MAX_LEN 64
+#define LYNQ_DNS_ADDR_MAX_LEN 256
+#define LYNQ_GETWAYS_ADDR_MAX_LEN 64
+#define LYNQ_POXY_ADDR_MAX_LEN 64
+
+
+typedef struct {
+ int status; /* A RIL_DataCallFailCause, 0 which is PDP_FAIL_NONE if no error */
+ int suggestedRetryTime; /* If status != 0, this fields indicates the suggested retry
+ back-off timer value RIL wants to override the one
+ pre-configured in FW.
+ The unit is miliseconds.
+ The value < 0 means no value is suggested.
+ The value 0 means retry should be done ASAP.
+ The value of INT_MAX(0x7fffffff) means no retry. */
+ int cid; /* Context ID, uniquely identifies this call */
+ int active; /* 0=inactive, 1=active/physical link down, 2=active/physical link up */
+ char type[LYNQ_PDP_TYPE_MAX_LEN]; /* One of the PDP_type values in TS 27.007 section 10.1.1.
+ For example, "IP", "IPV6", "IPV4V6", or "PPP". If status is
+ PDP_FAIL_ONLY_SINGLE_BEARER_ALLOWED this is the type supported
+ such as "IP" or "IPV6" */
+ char ifname[LYNQ_IFACE_NAME_MAX_LEN]; /* The network interface name */
+ char addresses[LYNQ_PDP_ADDR_MAX_LEN]; /* A space-delimited list of addresses with optional "/" prefix length,
+ e.g., "192.0.1.3" or "192.0.1.11/16 2001:db8::1/64".
+ May not be empty, typically 1 IPv4 or 1 IPv6 or
+ one of each. If the prefix length is absent the addresses
+ are assumed to be point to point with IPv4 having a prefix
+ length of 32 and IPv6 128. */
+ char dnses[LYNQ_DNS_ADDR_MAX_LEN]; /* A space-delimited list of DNS server addresses,
+ e.g., "192.0.1.3" or "192.0.1.11 2001:db8::1".
+ May be empty. */
+ char gateways[LYNQ_GETWAYS_ADDR_MAX_LEN]; /* A space-delimited list of default gateway addresses,
+ e.g., "192.0.1.3" or "192.0.1.11 2001:db8::1".
+ May be empty in which case the addresses represent point
+ to point connections. */
+ char pcscf[LYNQ_POXY_ADDR_MAX_LEN]; /* the Proxy Call State Control Function address
+ via PCO(Protocol Configuration Option) for IMS client. */
+ int mtu; /* MTU received from network
+ Value <= 0 means network has either not sent a value or
+ sent an invalid value */
+} lynq_data_call_response_v11_t;
+
+typedef struct
+{
+ int index;
+ char apn[LYNQ_APN_MAX_LEN];
+ char apnType[LYNQ_APN_TYPE_MAX_LEN];
+}lynq_apn_info;
+
+int lynq_init_data(int uToken);
+int lynq_deinit_data();
+int lynq_setup_data_call(int *handle);
+int lynq_deactive_data_call(int *handle);
+int lynq_setup_data_call_sp(int *handle,char *apn,char *apnType,char *user,char *password,char *authType,char *normalProtocol,char *roamingProtocol);
+int lynq_setup_data_call_sp_t106(int *handle,char *apn,char *apnType,char *user,char *password,char *authType,char *normalProtocol,char *roamingProtocol);
+//int lynq_deactive_data_call_sp(int *handle,char *apnType);
+int lynq_get_data_call_list(int *handle,lynq_data_call_response_v11_t *dataCallList);
+int lynq_wait_data_call_state_change(int *handle);
+int lynq_modify_apn_db(const int cmd,char *id,char *mcc,char *mnc,char *apn,char *apntype,char *user,char *password,char *normalprotocol,char *roamingprotocol,char *carrier,char *out);
+int lynq_reset_apn(char *result);
+int lynq_get_apn_table(int *size,lynq_apn_info **list);
+void lynq_release_wait_data_call();
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/mbtk/include/lynq/lynq_deflog.h b/mbtk/include/lynq/lynq_deflog.h
new file mode 100755
index 0000000..fd45185
--- /dev/null
+++ b/mbtk/include/lynq/lynq_deflog.h
@@ -0,0 +1,211 @@
+#ifndef __LYNQ_DEFLOG_H__
+#define __LYNQ_DEFLOG_H__
+#include "liblog.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef void (*LYNQ_WRITE_LOG_PTR)(log_level_enum level, const char *format, ...);
+extern LYNQ_WRITE_LOG_PTR lynq_write_log;
+LYNQ_WRITE_LOG_PTR lynq_log_function_init(const char *log_name);
+
+int lynq_syslog_set_file_size(int value);
+int lynq_syslog_get_file_size(void);
+int lynq_syslog_set_file_rotate(int value);
+int lynq_syslog_get_file_rotate(void);
+
+#ifdef __cplusplus
+}
+#endif
+#define lynq_log_verbose(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 lynq_log_error(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)
+
+#define lynq_log_warning(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 lynq_log_info(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 lynq_log_debug(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 LYVERBLOG(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 LYERRLOG(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)
+
+#define LYWARNLOG(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 LYINFLOG(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 LYDBGLOG(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 lynq_log_verbose(...) do { lynq_write_log(LOG_VERBOSE,__VA_ARGS__);} while (0)
+// #define lynq_log_error(...) do {lynq_write_log(LOG_ERROR,__VA_ARGS__);} while (0)
+// #define lynq_log_warning(...) do {lynq_write_log(LOG_WARNING,__VA_ARGS__);} while (0)
+// #define lynq_log_info(...) do {lynq_write_log(LOG_INFO,__VA_ARGS__);} while (0)
+// #define lynq_log_debug(...) do {lynq_write_log(LOG_DEBUG,__VA_ARGS__);} while (0)
+
+// #define LYVERBLOG(...) do {lynq_write_log(LOG_VERBOSE,__VA_ARGS__);} while (0)
+// #define LYERRLOG(...) do {lynq_write_log(LOG_ERROR,__VA_ARGS__);} while (0)
+// #define LYWARNLOG(...) do {lynq_write_log(LOG_WARNING,__VA_ARGS__);} while(0)
+// #define LYINFLOG(...) do {lynq_write_log(LOG_INFO,__VA_ARGS__);} while (0)
+// #define LYDBGLOG(...) do {lynq_write_log(LOG_DEBUG,__VA_ARGS__);} while (0)
+
+// // just for comcompatibility, do nothing
+// #define LYLOGSET(a) do{;}while(0)
+// #define LYLOGEINIT(Y) do{;}while(0)
+
+// #ifndef ALOGV
+// #define ALOGV(...) do {lynq_write_log(LOG_VERBOSE,__VA_ARGS__);} while (0)
+// #endif
+
+// #ifndef ALOGE
+// #define ALOGE(...) do {lynq_write_log(LOG_ERROR,__VA_ARGS__);} while (0)
+// #endif
+
+// #ifndef ALOGW
+// #define ALOGW(...) do {lynq_write_log(LOG_WARNING,__VA_ARGS__);} while (0)
+// #endif
+
+// #ifndef ALOGI
+// #define ALOGI(...) do {lynq_write_log(LOG_INFO,__VA_ARGS__);} while (0)
+// #endif
+
+// #ifndef ALOGD
+// #define ALOGD(...) do {lynq_write_log(LOG_DEBUG,__VA_ARGS__);} while (0)
+// #endif
+
+#define DEFINE_LYNQ_LIB_LOG(tag) \
+ LYNQ_WRITE_LOG_PTR __attribute__ ((visibility ("hidden"))) lynq_write_log = NULL; \
+ void __attribute__((constructor)) tag##_init() \
+ { \
+ lynq_write_log = lynq_log_function_init(#tag); \
+ }
+
+#define DEFINE_LYNQ_EXE_LOG(tag) \
+ LYNQ_WRITE_LOG_PTR __attribute__ ((visibility ("hidden"))) lynq_write_log = NULL; \
+ void __attribute__((constructor)) tag##_init() \
+ { \
+ lynq_write_log = lynq_log_function_init(#tag); \
+ lynq_log_configuration_init(#tag); \
+ }
+
+#endif //__LYNQ_DEFLOG_H__
diff --git a/mbtk/include/lynq/lynq_gnss.h b/mbtk/include/lynq/lynq_gnss.h
new file mode 100755
index 0000000..893f6a8
--- /dev/null
+++ b/mbtk/include/lynq/lynq_gnss.h
@@ -0,0 +1,120 @@
+/*
+* qser_gnss.h
+*
+* QSER GNSS header file.
+*
+* Author : lb
+* Date : 2023/11/23 11:13:18
+*/
+#ifndef _QSER_GNSS_H
+#define _QSER_GNSS_H
+#include "mbtk_type.h"
+#include "mbtk_gnss.h"
+#include "mbtk_log.h"
+
+typedef unsigned int Uint_t;
+#define MOPEN_GNSS_NMEA_MAX_LENGTH 255 /* NMEA string maximum length. */
+
+#define QSER_LEN_MAX 128
+
+typedef enum
+{
+ E_MT_LOC_MSG_ID_LOCATION_INFO = 1, /**< pv_data = & mopen_location_info_t */
+ E_MT_LOC_MSG_ID_NMEA_INFO = 3, /**< pv_data = & mopen_gnss_nmea_info_t */
+} e_msg_id_t;
+
+typedef enum {
+ QSER_GNSS_ERROR_SUCCESS = 0,
+ QSER_GNSS_ERROR_FAIL,
+} qser_gnss_error_e;
+
+typedef void (*gnss_handler_func_t)
+(
+ Uint_t *h_loc,
+ e_msg_id_t e_msg_id, //消息 ID
+ void *pv_data, //消息内容,取决于 ID,如下说明
+ void *context_ptr //用于区分哪个返回的消息
+)/* lynq_AddRxIndMsgHandler_t*/;
+
+typedef void (*gnss_async_func_t)(qser_gnss_error_e state);
+
+typedef struct
+{
+ char host[QSER_LEN_MAX];
+ char id[QSER_LEN_MAX];
+ char passwd[QSER_LEN_MAX];
+}qser_agps_info;
+
+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.*/
+}mopen_gnss_nmea_info_t; /* Message */
+
+typedef struct
+{
+ 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. */
+}mopen_location_info_t;//功能暂未实现,可不用添加进结构体
+
+typedef struct
+{
+ uint32_t year; // 大于 1980
+ uint32_t month; // 1-12
+ uint32_t day; // 1-31
+ uint32_t hour; // 0-23
+ uint32_t minute; // 0-59
+ uint32_t second; // 0-59
+ uint32_t millisecond; // 0-999
+} LYNQ_INJECT_TIME_INTO_T; /* Message */
+
+typedef enum {
+ DELETE_NOTHING = 0, /*不删除数据*/
+ DELETE_EPHEMERIS = 1, /*删除星历*/
+ DELETE_ALMANAC = 2, /*删除历书*/
+ DELETE_POSITION_TIME = 3, /*删除时间和位置信息. */
+ DELETE_UTC = 4, /*删除 UTC 时间*/
+ DELETE_ALL = 5 /*删除所有*/
+} DELETE_AIDING_DATA_TYPE_T;
+
+int qser_Gnss_Init (uint32_t *h_gnss);
+
+int qser_Gnss_Deinit (uint32_t h_gnss);
+
+int qser_AddRxIndMsgHandler (gnss_handler_func_t handler_ptr,uint32_t h_gnss);
+
+int qser_Set_Indications (uint32_t h_gnss,e_msg_id_t type);
+
+int qser_Gnss_Set_Async_Callback(gnss_async_func_t cb);
+
+int qser_Gnss_Start (uint32_t h_gnss);
+
+int qser_Gnss_Start_Async(uint32_t h_gnss);
+
+int qser_Gnss_Stop (uint32_t h_gnss);
+
+int qser_Gnss_Set_Frequency(uint32_t h_gnss, int frequency);
+
+int qser_Gnss_InjectTime (uint32_t h_gnss,LYNQ_INJECT_TIME_INTO_T *time_info);
+
+int qser_Gnss_Delete_Aiding_Data (uint32_t h_gnss,DELETE_AIDING_DATA_TYPE_T flags);
+
+int qser_Gnss_Server_Configuration(char *host, char *id, char *password);
+
+int qser_Gnss_download_tle();
+
+int qser_Gnss_injectEphemeris(uint32_t h_gnss);
+
+
+#endif /* _QSER_GNSS_H */
diff --git a/mbtk/include/lynq/lynq_led.h b/mbtk/include/lynq/lynq_led.h
new file mode 100755
index 0000000..c95282b
--- /dev/null
+++ b/mbtk/include/lynq/lynq_led.h
@@ -0,0 +1,12 @@
+#ifndef LYNQ_LED_H
+#define LYNQ_LED_H 1
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int lynq_set_netled_on(const int test_mode);
+int lynq_set_statusled_on(const int test_mode);
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/mbtk/include/lynq/lynq_network.h b/mbtk/include/lynq/lynq_network.h
new file mode 100755
index 0000000..e878e6b
--- /dev/null
+++ b/mbtk/include/lynq/lynq_network.h
@@ -0,0 +1,147 @@
+#ifndef LYNQ_NETWORK_H
+#define LYNQ_NETWORK_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+#define MODEM_GEN97 1
+#define CELLINFO_MAX_NUM 10
+#define LY_RECOVER_TIMER_INTERVAL 128
+#define MAX_CELLINFO_ITEM_NUMBER 32
+#define MAX_OOS_CFG_ITEM_NUMBER 32
+/*T800 platform support gsm,wcdma lte,nr */
+typedef struct{
+ int gw_sig_valid; /*1 valid,1 invalid*/
+ int rssi; /* Valid values are (0-31, 99) as defined in TS 27.007 8.5 */
+ int wcdma_sig_valid;/*1 valid,0 invalid*/
+ int wcdma_signalstrength;
+ int rscp; /* The Received Signal Code Power in dBm multipled by -1.
+ * Range : 25 to 120
+ * INT_MAX: 0x7FFFFFFF denotes invalid value.
+ * Reference: 3GPP TS 25.123, section 9.1.1.1 */
+ int ecno; /* Valid values are positive integers. This value is the actual Ec/Io multiplied
+ * by -10. Example: If the actual Ec/Io is -12.5 dB, then this response value
+ * will be 125.*/
+ int lte_sig_valid;/*1 valid,0 invalid*/
+ int lte_signalstrength;
+ int rsrp; /* The current Reference Signal Receive Power in dBm multipled by -1.
+ * Range: 44 to 140 dBm
+ * INT_MAX: 0x7FFFFFFF denotes invalid value.
+ * Reference: 3GPP TS 36.133 9.1.4 */
+ int rsrq; /* The current Reference Signal Receive Quality in dB multiplied by -1.
+ * Range: 20 to 3 dB.
+ * INT_MAX: 0x7FFFFFFF denotes invalid value.
+ * Reference: 3GPP TS 36.133 9.1.7 */
+ int rssnr; /* The current reference signal signal-to-noise ratio in 0.1 dB units.
+ * Range: -200 to +300 (-200 = -20.0 dB, +300 = 30dB).
+ * INT_MAX : 0x7FFFFFFF denotes invalid value.
+ * Reference: 3GPP TS 36.101 8.1.1 */
+ int nr_sig_valid;/*1 valid,0 invalid*/
+ int ssRsrp; /* SS(Synchronization Signal) reference signal received power, multipled by -1.
+ * Reference: 3GPP TS 38.215.
+ * Range [44, 140], INT_MAX means invalid/unreported.*/
+ int ssRsrq; /* SS reference signal received quality, multipled by -1.
+ * Reference: 3GPP TS 38.215.
+ * Range [3, 20], INT_MAX means invalid/unreported.*/
+ int ssSinr; /* SS signal-to-noise and interference ratio.
+ * Reference: 3GPP TS 38.215 section 5.1.*, 3GPP TS 38.133 section 10.1.16.1.
+ * Range [-23, 40], INT_MAX means invalid/unreported.*/
+ int csiRsrp; /* CSI reference signal received power, multipled by -1.
+ * Reference: 3GPP TS 38.215.
+ * Range [44, 140], INT_MAX means invalid/unreported.*/
+ int csiRsrq; /* CSI reference signal received quality, multipled by -1.
+ * Reference: 3GPP TS 38.215.
+ * Range [3, 20], INT_MAX means invalid/unreported.*/
+ int csiSinr; /* CSI signal-to-noise and interference ratio.
+ * Reference: 3GPP TS 138.215 section 5.1.*, 3GPP TS 38.133 section 10.1.16.1.
+ * Range [-23, 40], INT_MAX means invalid/unreported.*/
+}signalStrength_t;
+
+typedef enum {
+ NETWORK_RADIO_ON_TYPE_CFUN_0=0,
+ NETWORK_RADIO_ON_TYPE_NORMAL_MODE=1,
+ NETWORK_RADIO_ON_TYPE_FLIGHT_MODE=4,
+}lynq_network_radio_on_type;
+
+int lynq_network_init(int utoken);
+int lynq_network_deinit(void);
+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(char *OperatorFN,char *OperatorSH,char *MccMnc,char * NetStatus);
+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 preffertype);
+int lynq_query_cell_info(uint64_t cellinfo[CELLINFO_MAX_NUM],int tac[CELLINFO_MAX_NUM],int earfcn[CELLINFO_MAX_NUM],int * realNum);
+int lynq_set_unsol_cell_info_listrate(const int rate);
+int lynq_set_band_mode(const int bandmode);
+int lynq_query_available_bandmode(int availBanMode[]);
+int lynq_radio_on(const lynq_network_radio_on_type type);
+int lynq_query_radio_state(int *radio_state);
+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_wait_signalchanges(int *handle);
+int lynq_get_urc_info(const int handle,signalStrength_t *solSigStren,int *slot_id);
+
+typedef enum {
+ LYNQ_CELL_INFO_TYPE_GSM = 2,
+ LYNQ_CELL_INFO_TYPE_WCDMA = 3,
+ LYNQ_CELL_INFO_TYPE_LTE = 4,
+ LYNQ_CELL_INFO_TYPE_NR = 5
+} lynq_network_cell_info_type;
+
+int lynq_query_serve_cell_info(int serve_cell_info[MAX_CELLINFO_ITEM_NUMBER], int * valid_number);
+
+typedef enum {
+ NETWORK_STATE_BUFFER_TYPE_VOICE_REG,
+ NETWORK_STATE_BUFFER_TYPE_DATA_REG,
+ NETWORK_STATE_BUFFER_TYPE_IMS_REG,
+ NETWORK_STATE_BUFFER_TYPE_MAX,
+}lynq_network_state_buffer_type;
+int lynq_set_state_buffer_valid_period_of_network(lynq_network_state_buffer_type type,int valid_period);
+int lynq_get_state_buffer_valid_period_of_network(lynq_network_state_buffer_type type);
+#ifdef MODEM_GEN97
+/**@brief set or get OOS recover timer interval
+* @param mode [IN] <mode>:
+* 0:set
+* 1:get
+* @param interval [IN] <interval>: the recovery timer interval.
+* field:
+* T1,T2,...,T23:integer value 0~0xFFFFFFFF
+* The length of time in seconds.
+* defualt interval: 20,20,60,60,60,60,90,90,90,90,90,90,180,180,180,180,180,180,360,360,360,360,360
+* @param result [OUT] <result>: the recovery timer interval,when the mode is 1, this parameter is valid.
+
+* @return
+* 0:success
+* other:failure
+*/
+int lynq_oos_recover_timer_interval(int mode, char interval[LY_RECOVER_TIMER_INTERVAL],char result[LY_RECOVER_TIMER_INTERVAL]);
+/**@brief set deep sleep recover timer interval
+
+* @param recovery_threshold [IN] <recovery_threshold>: valid range 2-10 //After performing several rounds of normal recovery, deep sleep mode optimization will be applied
+
+* @param fullband_timer [IN] <fullband_timer>:valid range 90-360 //fullband intervarl length in deep sleep mode
+
+* @param sniffer_timer [IN] <sniffer_timer>:valid range 10-60 // sniffe intervarl length in deep sleep mode.
+
+* @param inactive_mode [IN] <inactive_mode>:
+* 0 Exit inactive mode
+* 1 enter inactive mode
+
+* @return
+* 0:success
+* other:failure
+*/
+int lynq_oos_deep_sleep_recover_timer_interval(int recovery_threshold,int fullband_timer,int sniffer_timer,int inactive_mode);
+#endif
+#if (defined MOBILETEK_TARGET_PLATFORM_T106) || (defined MODEM_GEN97)
+int lynq_set_oos_net_scan_cfg(int config_list[MAX_OOS_CFG_ITEM_NUMBER], int valid_num);
+int lynq_get_oos_net_scan_cfg(int config_list[MAX_OOS_CFG_ITEM_NUMBER], int* valid_num);
+#endif
+void lynq_set_test_mode(const int test_mode);
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/mbtk/include/lynq/lynq_qser_data.h b/mbtk/include/lynq/lynq_qser_data.h
new file mode 100755
index 0000000..f2cff6f
--- /dev/null
+++ b/mbtk/include/lynq/lynq_qser_data.h
@@ -0,0 +1,288 @@
+#ifndef __LYNQ_QSER_DATA_H__
+#define __LYNQ_QSER_DATA_H__
+#ifdef __cplusplus
+extern "C" {
+#endif
+#include <stdbool.h>
+#include <netinet/in.h>
+
+typedef enum {
+ QSER_DATA_CALL_ERROR_NONE = 0,
+ QSER_DATA_CALL_ERROR_INVALID_PARAMS,
+ QSER_DATA_CALL_ERROR_NO_INIT,
+ QSER_DATA_CALL_ERROR_PDP_ACTIVATE,
+ QSER_DATA_CALL_ERROR_PDP_NO_ACTIVATE,
+ QSER_DATA_CALL_ERROR_IDX_NO_EXIST,
+ QSER_DATA_CALL_ERROR_UNKNOWN,
+} qser_data_call_error_e;
+
+typedef enum {
+ QSER_DATA_CALL_DISCONNECTED = 0, /*!< call is disconnected */
+ QSER_DATA_CALL_CONNECTED, /*!< call is connected */
+} qser_data_call_state_e;
+
+typedef enum {
+ QSER_DATA_CALL_TYPE_IPV4 = 0, /*!< IPv4 call. */
+ QSER_DATA_CALL_TYPE_IPV6, /*!< IPv6 call. */
+ QSER_DATA_CALL_TYPE_IPV4V6, /*!< IPv4 and IPv6 call (Only used call start or stop). */
+} qser_data_call_ip_family_e;
+
+typedef enum {
+ QSER_APN_PDP_TYPE_IPV4 = 0,
+ QSER_APN_PDP_TYPE_PPP,
+ QSER_APN_PDP_TYPE_IPV6,
+ QSER_APN_PDP_TYPE_IPV4V6,
+} qser_apn_pdp_type_e;
+
+typedef enum {
+ QSER_APN_AUTH_PROTO_DEFAULT = 0,
+ QSER_APN_AUTH_PROTO_NONE,
+ QSER_APN_AUTH_PROTO_PAP,
+ QSER_APN_AUTH_PROTO_CHAP,
+ QSER_APN_AUTH_PROTO_PAP_CHAP,
+} qser_apn_auth_proto_e;
+
+#define QSER_APN_MAX_LIST 8
+#define QSER_APN_NAME_SIZE 64
+#define QSER_APN_USERNAME_SIZE 32
+#define QSER_APN_PASSWORD_SIZE 32
+#define QSER_APN_TYPE_SIZE 16
+
+struct v4_address_status {
+ struct in_addr ip; /*!< Public IPv4 address. */
+ struct in_addr gateway; /*!< Public IPv4 gateway. */
+ struct in_addr pri_dns; /*!< Primary Domain Name Service IP address. */
+ struct in_addr sec_dns; /*!< Secondary Domain Name Service IP address. */
+};
+
+struct v6_address_status {
+ struct in6_addr ip; /*!< Public IPv6 address. */
+ struct in6_addr gateway; /*!< Public IPv6 gateway. */
+ struct in6_addr pri_dns; /*!< Primary Domain Name Service IPv6 address. */
+ struct in6_addr sec_dns; /*!< Secondary Domain Name Service IPv6 address. */
+};
+
+typedef struct {
+ char profile_idx; /*!< UMTS/CMDA profile ID. */
+ char name[16]; /*!< Interface Name. */
+ qser_data_call_ip_family_e ip_family; /*!< IP version. */
+ qser_data_call_state_e state; /*!< The dial status. */
+ qser_data_call_error_e err; /*!< The Reason code after data call disconnected. */
+ struct v4_address_status v4; /*!< IPv4 information. */
+ struct v6_address_status v6; /*!< IPv6 information. */
+} qser_data_call_state_s;
+
+/*
+ *!< Client callback function used to post event indications.
+ */
+typedef void (*qser_data_call_evt_cb_t)(qser_data_call_state_s *state);
+
+typedef struct {
+ char profile_idx; /*!< UMTS/CMDA profile ID. */
+ bool reconnect; /*!< Whether to re-dial after disconnecting the network. */
+ qser_data_call_ip_family_e ip_family; /*!< IP version. */
+ char cdma_username[QSER_APN_USERNAME_SIZE]; /*!< Username used during data network authentication. */
+ char cdma_password[QSER_APN_PASSWORD_SIZE]; /*!< Password to be used during data network authentication. */
+} qser_data_call_s;
+
+struct pkt_stats {
+ unsigned long pkts_tx; /*!< Number of packets transmitted. */
+ unsigned long pkts_rx; /*!< Number of packets received. */
+ long long bytes_tx; /*!< Number of bytes transmitted. */
+ long long bytes_rx; /*!< Number of bytes received. */
+ unsigned long pkts_dropped_tx; /*!< Number of transmit packets dropped. */
+ unsigned long pkts_dropped_rx; /*!< Number of receive packets dropped. */
+};
+
+struct v4_info {
+ char name[16]; /*!< Interface Name. */
+ qser_data_call_state_e state; /*!< The dial status. */
+ bool reconnect; /*!< re-dial flag. */
+ struct v4_address_status addr; /*!< IPv4 IP Address information. */
+ struct pkt_stats stats; /*!< IPv4 statics */
+};
+
+struct v6_info {
+ char name[16]; /*!< Interface Name. */
+ qser_data_call_state_e state; /*!< The dial status. */
+ bool reconnect; /*!< re-dial flag. */
+ struct v6_address_status addr; /*!< IPv6 IP Address information. */
+ struct pkt_stats stats; /*!< IPv6 statics */
+};
+
+typedef struct {
+ char profile_idx; /*!< UMTS/CDMA profile ID. */
+ qser_data_call_ip_family_e ip_family; /*!< IP version. */
+ struct v4_info v4; /*!< IPv4 information */
+ struct v6_info v6; /*!< IPv6 information */
+} qser_data_call_info_s;
+
+typedef struct {
+ unsigned char profile_idx; /*!< UMTS/CDMA profile ID. range: 0 - 7*/
+ qser_apn_pdp_type_e pdp_type; /*!< Packet Data Protocol (PDP) type specifies the type of data payload
+ exchanged over the airlink when the packet data session is
+ established with this profile. */
+ qser_apn_auth_proto_e auth_proto; /*!< Authentication Protocol. */
+ char apn_name[QSER_APN_NAME_SIZE + 1]; /*!< A string parameter that is a logical name used to select the GGSN
+ and external packet data network. */
+ char username[QSER_APN_USERNAME_SIZE + 1]; /*!< Username used during data network authentication. */
+ char password[QSER_APN_PASSWORD_SIZE + 1]; /*!< Password to be used during data network authentication. */
+ char apn_type[QSER_APN_TYPE_SIZE + 1];
+} qser_apn_info_s;
+
+typedef struct {
+ qser_apn_pdp_type_e pdp_type; /*!< Packet Data Protocol (PDP) type specifies the type of data payload
+ exchanged over the airlink when the packet data session is
+ established with this profile. */
+ qser_apn_auth_proto_e auth_proto; /*!< Authentication Protocol. */
+ char apn_name[QSER_APN_NAME_SIZE + 1]; /*!< A string parameter that is a logical name used to select the GGSN
+ and external packet data network. */
+ char username[QSER_APN_USERNAME_SIZE + 1]; /*!< Username used during data network authentication. */
+ char password[QSER_APN_PASSWORD_SIZE + 1]; /*!< Password to be used during data network authentication. */
+ char apn_type[QSER_APN_TYPE_SIZE + 1];
+} qser_apn_add_s;
+
+typedef struct {
+ int cnt;
+ qser_apn_info_s apn[QSER_APN_MAX_LIST];
+} qser_apn_info_list_s;
+
+
+/**
+ * Initialization data call module, and callback function registered.
+ *
+ * @param [in] evt_cb callback fucntion
+ *
+ * @return
+ * On success, 0 is returned. On error, -1 is returned.
+ *
+ */
+extern int qser_data_call_init(qser_data_call_evt_cb_t evt_cb);
+
+/**
+ * Destroy data call module, and unregister callback funciton
+ *
+ * @param
+ * None
+ *
+ * @return
+ * On success, 0 is returned. On error, -1 is returned.
+ *
+ */
+extern void qser_data_call_destroy(void);
+
+/**
+ * Starts a data call. If profile index is zero, it will call CDMA profile.
+ *
+ * @param [in] data_call The data call parameters
+ * @param [out] error Error code returned by data call
+ *
+ * @return
+ * On success, 0 is returned. On error, -1 is returned.
+ *
+ */
+extern int qser_data_call_start(qser_data_call_s *data_call, qser_data_call_error_e *err);
+
+/**
+ * Starts a data call. If profile index is zero, it will call CDMA profile.
+ *
+ * @param [in] data_call The data call parameters
+ * @param [out] error Error code returned by data call
+ *
+ * @return
+ * On success, 0 is returned. On error, -1 is returned.
+ *
+ */
+extern int qser_data_call_start_async(qser_data_call_s *data_call, qser_data_call_error_e *err);
+
+/**
+ * Stop a data call.
+ *
+ * @param [in] profile_idx UMTS/CDMA profile ID
+ * @param [in] ip_family IP Version
+ * @param [out] error Error code returned by data call
+ *
+ * @return
+ * On success, 0 is returned. On error, -1 is returned.
+ *
+ */
+extern int qser_data_call_stop(char profile_idx, qser_data_call_ip_family_e ip_family, qser_data_call_error_e *err);
+
+/**
+ * Get a data call information.
+ *
+ * @param [in] profile_idx UMTS/CDMA profile ID
+ * @param [in] ip_family IP Version
+ * @param [out] info The Data Call information
+ * @param [out] error Error code returned by data call
+ *
+ * @return
+ * On success, 0 is returned. On error, -1 is returned.
+ *
+ */
+extern int qser_data_call_info_get(char profile_idx,
+ qser_data_call_ip_family_e ip_family,
+ qser_data_call_info_s *info,
+ qser_data_call_error_e *err);
+
+/**
+ * Changes the settings in a configured profile.
+ *
+ * @param [in] apn the profile information.
+ *
+ * @return
+ * On success, 0 is returned. On error, -1 is returned, such apn not exist.
+ *
+ */
+extern int qser_apn_set(qser_apn_info_s *apn);
+
+/**
+ * Retrieves the settings from a configured profile.
+ *
+ * @param [in] profile_idx UMTS/CDMA profile ID
+ * @param [out] apn the profile information.
+ *
+ * @return
+ * On success, 0 is returned. On error, -1 is returned.
+ *
+ */
+extern int qser_apn_get(unsigned char profile_idx, qser_apn_info_s *apn);
+
+/**
+ * Retrieves the settings from a configured profile.
+ *
+ * @param [in] apn the profile information.
+ * @param [out] profile_idx UMTS/CDMA profile ID
+ *
+ * @return
+ * On success, 0 is returned. On error, -1 is returned.
+ *
+ */
+extern int qser_apn_add(qser_apn_add_s *apn, unsigned char *profile_idx);
+
+/**
+ * Delete a configured profile.
+ *
+ * @param [in] profile_idx UMTS/CDMA profile ID
+ *
+ * @return
+ * On success, 0 is returned. On error, -1 is returned.
+ *
+ */
+extern int qser_apn_del(unsigned char profile_idx);
+
+/**
+ * Retrieves the settings from a configured profile list.
+ *
+ * @param [out] apn_list the profile list information.
+ *
+ * @return
+ * On success, 0 is returned. On error, -1 is returned.
+ *
+ */
+extern int qser_apn_get_list(qser_apn_info_list_s *apn_list);
+#ifdef __cplusplus
+}
+#endif
+#endif
+
diff --git a/mbtk/include/lynq/lynq_qser_gnss.h b/mbtk/include/lynq/lynq_qser_gnss.h
new file mode 100755
index 0000000..9eead07
--- /dev/null
+++ b/mbtk/include/lynq/lynq_qser_gnss.h
@@ -0,0 +1,134 @@
+#ifndef __LYNQ_GNSS_H__
+#define __LYNQ_GNSS_H__
+#ifdef __cplusplus
+extern "C" {
+#endif
+struct mbtk_gnss_handle_t
+{
+ int dev_fd;
+ pthread_t uart_pthread;
+ pthread_t gnss_pthread;
+ gnss_handler_func_t gnss_handler_func;
+ int mode; // 0 - stop, 1 - single, 2 - periodic, 3 - start
+ pthread_mutex_t _cond_mutex;
+ int reset_state;
+ int inited;
+ ring_buffer_t ring_buffer;
+ int getap_status;
+ char *rb;
+
+#if TTFF_TEST
+ pthread_t ttff_pid;
+ int location_state;
+#endif
+ /********************
+ save handle's adr
+ phandle = &handle
+ handle = mbtk_gnss_handle
+ *********************/
+ uint32_t *phandle; // handle's adr
+};
+
+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 */
+
+struct login_information /*Used To Stored User Information*/
+{
+ char* host;
+ char* id;
+ char* password;
+};
+
+static struct login_information *login_information_t = NULL;
+
+#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 */
+
+typedef enum
+{
+ LYNQ_POS_MODE_STANDALONE = 0, /**< Mode for running GPS standalone (no assistance). */
+ LYNQ_POS_MODE_MS_BASED = 1, /**< AGPS MS-Based mode. */
+ LYNQ_POS_MODE_MS_ASSISTED = 2, /**< AGPS MS-Assisted mode. */
+}LYNQ_POS_MODE_T;
+
+typedef enum
+{
+ LYNQ_POS_RECURRENCE_PERIODIC = 0, /**< Receive GPS fixes on a recurring basis at a specified period. */
+ LYNQ_POS_RECURRENCE_SINGLE = 1, /**< Request a single-shot GPS fix. */
+}LYNQ_POS_RECURRENCE_T;
+
+struct LYNQ_POS_MODE_INFO_T
+{
+ LYNQ_POS_MODE_T mode; /* Position mode. */
+ LYNQ_POS_RECURRENCE_T recurrence; /* Recurrence */
+};
+
+
+#endif
+typedef struct
+{
+ uint32_t year; // 大于1980
+ uint32_t month; // 1-12
+ uint32_t day; // 1-31
+ uint32_t hour; // 0-23
+ uint32_t minute; // 0-59
+ uint32_t second; // 0-59
+ uint32_t millisecond; // 0-999
+}LYNQ_INJECT_TIME_INTO_T; /* Message */
+
+
+typedef enum {
+ LOC_IND_STATUS_INFO_ON,//E_MT_LOC_MSG_ID_STATUS_INFO = 0,
+ LOC_IND_LOCATION_INFO_ON,//E_MT_LOC_MSG_ID_LOCATION_INFO,
+ LOC_IND_SV_INFO_ON,//E_MT_LOC_MSG_ID_SV_INFO,
+ LOC_IND_NMEA_INFO_ON,//E_MT_LOC_MSG_ID_NMEA_INFO,
+ LOC_IND_CAP_INFO_ON,//E_MT_LOC_MSG_ID_CAPABILITIES_INFO,
+ LOC_IND_AGPS_DATA_CONN_CMD_REQ_ON,//E_MT_LOC_MSG_ID_AGPS_STATUS,
+ LOC_IND_NI_NFY_USER_RESP_REQ_ON,//E_MT_LOC_MSG_ID_NI_NOTIFICATION,
+ LOC_IND_XTRA_DATA_REQ_ON,//E_MT_LOC_MSG_ID_XTRA_REPORT_SERVER,
+}msg_t;
+
+typedef enum {
+ DELETE_NOTHING = 0, /**< Delete nothing. */
+ DELETE_EPHEMERIS = 1, /**< Delete ephemeris data. */
+ DELETE_ALMANAC = 2, /**< Delete almanac data. */
+ DELETE_POSITION_TIME = 3, /**< Delete position and time data. */
+ DELETE_UTC = 4, /**< Delete UTC data. */
+ DELETE_ALL = 5, /**< Delete all location data. */
+}DELETE_AIDING_DATA_TYPE_T;
+
+typedef void ( *lynq_atsvc_incb )( const char *input,const int length);
+typedef void ( *lynq_atsvc_outcb )(char *output, int out_max_size, int mode);
+lynq_atsvc_incb lynq_register_gnss(lynq_atsvc_outcb out_cb);
+
+int qser_Gnss_Init(uint32_t *h_gnss);
+int qser_Gnss_Deinit(uint32_t h_gnss);
+int qser_AddRxIndMsgHandler(gnss_handler_func_t handler_ptr,uint32_t h_gnss);
+int qser_Set_Indications(uint32_t h_gnss,e_msg_id_t type);
+int qser_Gnss_Start(uint32_t h_gnss);
+int qser_Gnss_Stop(uint32_t h_gnss);
+int qser_Gnss_Set_Frequency(uint32_t h_gnss, int frequency);
+int qser_Gnss_Delete_Aiding_Data(uint32_t h_gnss,DELETE_AIDING_DATA_TYPE_T flags);
+int qser_Gnss_Server_Configuration(char *host, char *id, char *password);
+int qser_Gnss_InjectTime(uint32_t h_gnss,LYNQ_INJECT_TIME_INTO_T *time_info);
+int qser_firmware_update(uint32_t h_gnss);
+int qser_Gnss_injectEphemeris(uint32_t h_gnss);
+int qser_Gnss_download_tle();
+#ifdef __cplusplus
+}
+#endif
+
diff --git a/mbtk/include/lynq/lynq_qser_network.h b/mbtk/include/lynq/lynq_qser_network.h
new file mode 100755
index 0000000..f99df6c
--- /dev/null
+++ b/mbtk/include/lynq/lynq_qser_network.h
@@ -0,0 +1,474 @@
+/**
+ *@file QSER_nw.h
+ *@date 2018-02-22
+ *@author
+ *@brief
+ */
+#ifndef __LYNQ_QSER_NETWORK_H__
+#define __LYNQ_QSER_NETWORK_H__
+#ifdef __cplusplus
+extern "C" {
+#endif
+#include "mbtk_type.h"
+
+typedef uint32_t nw_client_handle_type;
+
+
+#define QSER_NW_MODE_NONE 0x00 /**< No network. */
+#define QSER_NW_MODE_GSM 0x01 /**< Include GSM networks. */
+#define QSER_NW_MODE_WCDMA 0x02 /**< Include WCDMA networks. */
+#define QSER_NW_MODE_CDMA 0x04 /**< Include CDMA networks. */
+#define QSER_NW_MODE_EVDO 0x08 /**< Include EVDO networks. */
+#define QSER_NW_MODE_LTE 0x10 /**< Include LTE networks. */
+#define QSER_NW_MODE_TDSCDMA 0x20 /**< Include TDSCDMA networks. */
+
+typedef enum
+{
+ E_QSER_NW_ROAM_STATE_OFF = 0, /**< None, or roaming indicator off. */
+ E_QSER_NW_ROAM_STATE_ON = 1 /**< Roaming indicator on. */
+}E_QSER_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 QSER_NW_MODE_xxxx.*/
+ E_QSER_NW_ROAM_STATE_TYPE_T roaming_pref; /**< Roaming preference.*/
+}QSER_NW_CONFIG_INFO_T;
+
+typedef enum
+{
+ E_QSER_NW_IMS_MODE_OFF = 0, /**< close ims. */
+ E_QSER_NW_IMS_MODE_VOLTE_ENABLE = 1, /**< support volte. */
+}E_QSER_NW_IMS_MODE_TYPE_T;
+
+/** Configures the OOS (out of service) settings that define the MCM network interface. */
+#define QSER_NW_OOS_CFG_TYPE_FAST_SCAN 0x00 /**< fast net scan */
+#define QSER_NW_OOS_CFG_TYPE_FULL_BAND_SCAN 0x01 /**< full band scan */
+
+typedef struct
+{
+ /* Configuration parameters for MCM network fast network scan when OOS (out of service)*/
+ char enable;
+ uint16_t time_interval;
+}QSER_NW_OOS_CONFIG_FAST_SCAN_INFO_T;
+
+typedef struct
+{
+ /* Configuration parameters for MCM network full band network scan when OOS (out of service)*/
+ int t_min;
+ int t_step;
+ int t_num;
+ int t_max;
+}QSER_NW_OOS_CONFIG_FULL_BAND_SCAN_INFO_T;
+
+
+typedef struct
+{
+ char type; /**< QSER_NW_OOS_CFG_TYPE_xxxx.*/
+ union {
+ QSER_NW_OOS_CONFIG_FAST_SCAN_INFO_T fast_can_info; // 00
+ QSER_NW_OOS_CONFIG_FULL_BAND_SCAN_INFO_T full_band_scan_info; // 01
+ } u;
+}QSER_NW_OOS_CONFIG_INFO_T;
+
+//defined for QSER_NW_EventRegister
+#define NW_IND_VOICE_REG_EVENT_IND_FLAG (1 << 0) /**< msg format : QSER_NW_VOICE_REG_EVENT_IND_T */
+#define NW_IND_DATA_REG_EVENT_IND_FLAG (1 << 1) /**< msg format : QSER_NW_DATA_REG_EVENT_IND_T */
+#define NW_IND_SIGNAL_STRENGTH_EVENT_IND_FLAG (1 << 2) /**< msg format : QSER_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 */
+#define NW_IND_IMS_REG_EVENT_IND_FLAG (1 << 5) /**< msg format : NULL */
+
+typedef struct
+{
+ char long_eons[512 + 1]; /**< Long EONS.*/
+ char short_eons[512 + 1]; /**< Short EONS.*/
+ char mcc[10]; /**< Mobile country code.*/
+ char mnc[10]; /**< Mobile network code.*/
+}QSER_NW_OPERATOR_NAME_INFO_T;
+
+typedef enum
+{
+ E_QSER_NW_RADIO_TECH_TD_SCDMA = 1,
+ E_QSER_NW_RADIO_TECH_GSM = 2, /**< GSM; only supports voice. */
+ E_QSER_NW_RADIO_TECH_HSPAP = 3, /**< HSPA+. */
+ E_QSER_NW_RADIO_TECH_LTE = 4, /**< LTE. */
+ E_QSER_NW_RADIO_TECH_EHRPD = 5, /**< EHRPD. */
+ E_QSER_NW_RADIO_TECH_EVDO_B = 6, /**< EVDO B. */
+ E_QSER_NW_RADIO_TECH_HSPA = 7, /**< HSPA. */
+ E_QSER_NW_RADIO_TECH_HSUPA = 8, /**< HSUPA. */
+ E_QSER_NW_RADIO_TECH_HSDPA = 9, /**< HSDPA. */
+ E_QSER_NW_RADIO_TECH_EVDO_A = 10, /**< EVDO A. */
+ E_QSER_NW_RADIO_TECH_EVDO_0 = 11, /**< EVDO 0. */
+ E_QSER_NW_RADIO_TECH_1xRTT = 12, /**< 1xRTT. */
+ E_QSER_NW_RADIO_TECH_IS95B = 13, /**< IS95B. */
+ E_QSER_NW_RADIO_TECH_IS95A = 14, /**< IS95A. */
+ E_QSER_NW_RADIO_TECH_UMTS = 15, /**< UMTS. */
+ E_QSER_NW_RADIO_TECH_EDGE = 16, /**< EDGE. */
+ E_QSER_NW_RADIO_TECH_GPRS = 17, /**< GPRS. */
+ E_QSER_NW_RADIO_TECH_NONE = 18 /**< No technology selected. */
+}E_QSER_NW_RADIO_TECH_TYPE_T;
+
+
+typedef enum
+{
+ E_QSER_NW_TECH_DOMAIN_NONE = 0, /**< None. */
+ E_QSER_NW_TECH_DOMAIN_3GPP = 1, /**< 3GPP. */
+ E_QSER_NW_TECH_DOMAIN_3GPP2 = 2, /**< 3GPP2. */
+}E_QSER_NW_TECH_DOMAIN_TYPE_T;
+
+typedef enum
+{
+ E_QSER_NW_IMSI_UNKNOWN_HLR_DENY_REASON = 1, /**< IMSI unknown in HLR. */
+ E_QSER_NW_ILLEGAL_MS_DENY_REASON = 2, /**< Illegal MS. */
+ E_QSER_NW_IMSI_UNKNOWN_VLR_DENY_REASON = 3, /**< IMSI unknown in VLR. */
+ E_QSER_NW_IMEI_NOT_ACCEPTED_DENY_REASON = 4, /**< IMEI not accepted. */
+ E_QSER_NW_ILLEGAL_ME_DENY_REASON = 5, /**< Illegal ME. */
+ E_QSER_NW_PLMN_NOT_ALLOWED_DENY_REASON = 6, /**< PLMN not allowed. */
+ E_QSER_NW_LA_NOT_ALLOWED_DENY_REASON = 7, /**< Location area not allowed. */
+ E_QSER_NW_ROAMING_NOT_ALLOWED_LA_DENY_REASON = 8, /**< Roaming not allowed in this location area. */
+ E_QSER_NW_NO_SUITABLE_CELLS_LA_DENY_REASON = 9, /**< No suitable cells in location area. */
+ E_QSER_NW_NETWORK_FAILURE_DENY_REASON = 10, /**< Network failure. */
+ E_QSER_NW_MAC_FAILURE_DENY_REASON = 11, /**< MAC failure. */
+ E_QSER_NW_SYNCH_FAILURE_DENY_REASON = 12, /**< Sync failure. */
+ E_QSER_NW_CONGESTION_DENY_REASON = 13, /**< Congestion. */
+ E_QSER_NW_GSM_AUTHENTICATION_UNACCEPTABLE_DENY_REASON = 14, /**< GSM authentication unacceptable. */
+ E_QSER_NW_NOT_AUTHORIZED_CSG_DENY_REASON = 15, /**< Not authorized in this CSG. */
+ E_QSER_NW_SERVICE_OPTION_NOT_SUPPORTED_DENY_REASON = 16, /**< Service option not supported. */
+ E_QSER_NW_REQ_SERVICE_OPTION_NOT_SUBSCRIBED_DENY_REASON = 17, /**< Requested service option not subscribed. */
+ E_QSER_NW_CALL_CANNOT_BE_IDENTIFIED_DENY_REASON = 18, /**< Call cannot be identified. */
+ E_QSER_NW_SEMANTICALLY_INCORRECT_MSG_DENY_REASON = 19, /**< Semantically incorrect message. */
+ E_QSER_NW_INVALID_MANDATORY_INFO_DENY_REASON = 20, /**< Invalid mandatory information. */
+ E_QSER_NW_MSG_TYPE_NON_EXISTENT_DENY_REASON = 21, /**< Message type non-existent or not implemented. */
+ E_QSER_NW_INFO_ELEMENT_NON_EXISTENT_DENY_REASON = 22, /**< Message type not compatible with the protocol state. */
+ E_QSER_NW_CONDITIONAL_IE_ERR_DENY_REASON = 23, /**< Conditional IE error. */
+ E_QSER_NW_MSG_INCOMPATIBLE_PROTOCOL_STATE_DENY_REASON = 24, /**< Message not compatible with the protocol state. */
+ E_QSER_NW_PROTOCOL_ERROR_DENY_REASON = 25, /**< Unspecified protocol error. */
+}E_QSER_NW_DENY_REASON_TYPE_T;
+
+
+typedef enum
+{
+ E_QSER_NW_SERVICE_NONE = 0x0000, /**< Not registered or no data. */
+ E_QSER_NW_SERVICE_LIMITED = 0x0001, /**< Registered; emergency service only. */
+ E_QSER_NW_SERVICE_FULL = 0x0002, /**< Registered, full service. */
+}E_QSER_NW_SERVICE_TYPE_T;
+
+typedef struct
+{
+ E_QSER_NW_TECH_DOMAIN_TYPE_T tech_domain; /**< Technology, used to determine the structure type tech: 0 -- None, 1 -- 3GPP, 2 -- 3GPP2.*/
+ E_QSER_NW_RADIO_TECH_TYPE_T radio_tech; /**< Radio technology; see #nw_radio_tech_t_v01.*/
+ E_QSER_NW_ROAM_STATE_TYPE_T roaming; /**< 0 -- Off, 1 -- Roaming (3GPP2 has extended values).*/
+ E_QSER_NW_DENY_REASON_TYPE_T deny_reason; /**< Set when registration state is #nw_deny_reason_t_v01.*/
+ E_QSER_NW_SERVICE_TYPE_T registration_state; /**< Registration state.*/
+}QSER_NW_COMMON_REG_INFO_T;
+
+
+typedef struct
+{
+ E_QSER_NW_TECH_DOMAIN_TYPE_T tech_domain; /**< Technology, used to determine the structure type tech: 0 -- None, 1 -- 3GPP, 2 -- 3GPP2.*/
+ E_QSER_NW_RADIO_TECH_TYPE_T radio_tech; /**< Radio technology; see #nw_radio_tech_t_v01.*/
+ char mcc[10]; /**< Mobile country code.*/
+ char mnc[10]; /**< Mobile network code.*/
+ E_QSER_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.*/
+}QSER_NW_3GPP_REG_INFO_T;
+
+
+typedef struct
+{
+ E_QSER_NW_TECH_DOMAIN_TYPE_T tech_domain; /**< Technology, used to determine structure type tech: 0 -- None, 1 -- 3GPP, 2 -- 3GPP2.*/
+ E_QSER_NW_RADIO_TECH_TYPE_T radio_tech; /**< Radio technology; see #nw_radio_tech_t_v01.*/
+ char mcc[3+1]; /**< Mobile country code.*/
+ char mnc[3+1]; /**< Mobile network code.*/
+ E_QSER_NW_ROAM_STATE_TYPE_T roaming; /**< Roaming status; see #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 */
+}QSER_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. */
+ QSER_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. */
+ QSER_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. */
+ QSER_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. */
+ QSER_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. */
+ QSER_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. */
+ QSER_NW_3GPP2_REG_INFO_T data_registration_details_3gpp2; /**< Data registration details for 3GPP2. */
+}QSER_NW_REG_STATUS_INFO_T;
+
+typedef enum
+{
+ E_QSER_NW_IMS_SERVICE_NONE = 0x0000, /**< Not registered */
+ E_QSER_NW_IMS_SERVICE_REGISTERED = 0x0001, /**< Registered*/
+}E_QSER_NW_IMS_SERVICE_TYPE_T;
+
+typedef struct
+{
+ E_QSER_NW_IMS_SERVICE_TYPE_T registration_state; /**< Registration state.*/
+}QSER_NW_IMS_REG_STATUS_INFO_T;
+
+typedef struct
+{
+ int8_t rssi; /**< RSSI in dBm. Indicates received signal strength. A signed value; -125 or lower indicates no signal.*/
+}QSER_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.*/
+}QSER_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 */
+}QSER_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.*/
+}QSER_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.*/
+}QSER_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. */
+}QSER_NW_HDR_SIGNAL_INFO_T;
+
+typedef struct
+{
+ int16_t ssRsrp; /* SS(Synchronization Signal) reference signal received power, multipled by -1.
+ * Reference: 3GPP TS 38.215.
+ * Range [44, 140], INT_MAX means invalid/unreported.*/
+ int16_t ssRsrq; /* SS reference signal received quality, multipled by -1.
+ * Reference: 3GPP TS 38.215.
+ * Range [3, 20], INT_MAX means invalid/unreported.*/
+ int16_t ssSinr; /* SS signal-to-noise and interference ratio.
+ * Reference: 3GPP TS 38.215 section 5.1.*, 3GPP TS 38.133 section 10.1.16.1.
+ * Range [-23, 40], INT_MAX means invalid/unreported.*/
+ int16_t csiRsrp; /* CSI reference signal received power, multipled by -1.
+ * Reference: 3GPP TS 38.215.
+ * Range [44, 140], INT_MAX means invalid/unreported.*/
+ int16_t csiRsrq; /* CSI reference signal received quality, multipled by -1.
+ * Reference: 3GPP TS 38.215.
+ * Range [3, 20], INT_MAX means invalid/unreported.*/
+ int16_t csiSinr; /* CSI signal-to-noise and interference ratio.
+ * Reference: 3GPP TS 138.215 section 5.1.*, 3GPP TS 38.133 section 10.1.16.1.
+ * Range [-23, 40], INT_MAX means invalid/unreported.*/
+}QSER_NW_NR_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. */
+ QSER_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. */
+ QSER_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. */
+ QSER_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. */
+ QSER_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. */
+ QSER_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. */
+ QSER_NW_HDR_SIGNAL_INFO_T hdr_sig_info; /**< HDR signal information. */
+ uint8_t nr_sig_info_valid;
+ QSER_NW_NR_SIGNAL_INFO_T nr_sig_info;
+}QSER_NW_SIGNAL_STRENGTH_INFO_T;
+
+
+
+
+
+/* @bridef Callback function registered to QSER_NW_AddRxMsgHandler
+ * map of ind_flag and ind_msg_buf as bellow :
+ * NW_IND_VOICE_REG_EVENT_IND_FLAG : QSER_NW_VOICE_REG_EVENT_IND_T
+ * NW_IND_DATA_REG_EVENT_IND_FLAG : QSER_NW_DATA_REG_EVENT_IND_T
+ * NW_IND_SIGNAL_STRENGTH_EVENT_IND_FLAG : QSER_NW_SINGNAL_EVENT_IND_T
+ * NW_IND_CELL_ACCESS_STATE_CHG_EVENT_IND_FLAG : QSER_NW_CELL_ACCESS_STATE_EVENT_IND_T
+ * NW_IND_NITZ_TIME_UPDATE_EVENT_IND_FLAG : QSER_NW_NITZ_TIME_EVENT_IND_T
+ * */
+typedef void (*QSER_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. */
+ QSER_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. */
+ QSER_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. */
+ QSER_NW_3GPP2_REG_INFO_T registration_details_3gpp2; /**< Voice registration details for 3GPP2. */
+}QSER_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. */
+ QSER_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. */
+ QSER_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. */
+ QSER_NW_3GPP2_REG_INFO_T registration_details_3gpp2; /**< Data registration details for 3GPP2. */
+}QSER_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. */
+ QSER_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. */
+ QSER_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. */
+ QSER_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. */
+ QSER_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. */
+ QSER_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. */
+ QSER_NW_HDR_SIGNAL_INFO_T hdr_sig_info; /**< HDR singal information. */
+
+ uint8_t nr_sig_info_valid;
+ QSER_NW_NR_SIGNAL_INFO_T nr_sig_info;
+}QSER_NW_SINGNAL_EVENT_IND_T;
+
+typedef enum
+{
+ E_QSER_NW_RF_MODE_CFUN_0 = 0, /**< CFUN 0. */
+ E_QSER_NW_RF_MODE_CFUN_1 = 1, /**< CFUN 1. */
+ E_QSER_NW_RF_MODE_FLIGHT = 4, /**< Flight Mode, CFUN 4. */
+}E_QSER_NW_RF_MODE_TYPE_T;
+
+int qser_nw_client_init(nw_client_handle_type *ph_nw);
+
+int qser_nw_client_deinit(nw_client_handle_type h_nw);
+
+int qser_nw_set_config
+(
+ nw_client_handle_type h_nw,
+ QSER_NW_CONFIG_INFO_T *pt_info
+);
+
+int qser_nw_set_ims_enable
+(
+ nw_client_handle_type h_nw,
+ E_QSER_NW_IMS_MODE_TYPE_T ims_mode
+);
+
+int qser_nw_set_oos_config
+(
+ nw_client_handle_type h_nw,
+ QSER_NW_OOS_CONFIG_INFO_T *pt_info
+);
+
+int qser_nw_get_oos_config
+(
+ nw_client_handle_type h_nw,
+ QSER_NW_OOS_CONFIG_INFO_T *pt_info
+);
+
+int qser_nw_event_register
+(
+ nw_client_handle_type h_nw,
+ uint32_t bitmask // bit OR of NW_IND_xxxx_EVENT_ON
+);
+
+int qser_nw_get_operator_name
+(
+ nw_client_handle_type h_nw,
+ QSER_NW_OPERATOR_NAME_INFO_T *pt_info //You should malloc this or may cause stack overflow
+);
+
+int qser_nw_get_reg_status
+(
+ nw_client_handle_type h_nw,
+ QSER_NW_REG_STATUS_INFO_T *pt_info
+);
+
+int qser_nw_get_ims_reg_status
+(
+ nw_client_handle_type h_nw,
+ QSER_NW_IMS_REG_STATUS_INFO_T *pt_info
+);
+
+int qser_nw_get_signal_strength
+(
+ nw_client_handle_type h_nw,
+ QSER_NW_SIGNAL_STRENGTH_INFO_T *pt_info
+);
+
+int qser_nw_add_rx_msg_handler
+(
+ nw_client_handle_type h_nw,
+ QSER_NW_RxMsgHandlerFunc_t handlerPtr,
+ void* contextPtr
+);
+
+int qser_nw_set_rf_mode
+(
+ nw_client_handle_type h_nw,
+ E_QSER_NW_RF_MODE_TYPE_T rf_mode
+);
+
+int qser_nw_get_rf_mode
+(
+ nw_client_handle_type h_nw,
+ E_QSER_NW_RF_MODE_TYPE_T *rf_mode
+);
+
+#ifdef __cplusplus
+}
+#endif
+#endif//__QSER_NW_H__
diff --git a/mbtk/include/lynq/lynq_qser_sim.h b/mbtk/include/lynq/lynq_qser_sim.h
new file mode 100755
index 0000000..f49e611
--- /dev/null
+++ b/mbtk/include/lynq/lynq_qser_sim.h
@@ -0,0 +1,473 @@
+#ifndef __LYNQ_QSER_SIM__
+#define __LYNQ_QSER_SIM__
+#ifdef __cplusplus
+extern "C" {
+#endif
+#include <stdint.h>
+#include "mbtk_type.h"
+
+#define QSER_SIM_IMSI_LEN_MAX 16 /** Maximum length of IMSI data. */
+#define QSER_SIM_ICCID_LEN_MAX 20 /** Maximum length of ICCID data. */
+
+typedef enum
+{
+ E_QSER_SUCCESS = 0, /**< Success. */
+ E_QSER_ERROR_BADPARM = 4, /**< Bad parameter. */
+}E_QSER_ERROR_CODE_T;
+
+typedef uint32_t sim_client_handle_type;
+
+typedef enum
+{
+ QSER_SIM_SLOT_ID_1 = 0xB01, /**< Identify card in slot 1. */
+ QSER_SIM_SLOT_ID_2 = 0xB02, /**< Identify card in slot 2. */
+}QSER_SIM_SLOT_ID_TYPE_T;
+
+typedef enum
+{
+ QSER_SIM_APP_TYPE_UNKNOWN = 0xB00, /**< Unknown application type */
+ QSER_SIM_APP_TYPE_3GPP = 0xB01, /**< Identify the SIM/USIM application on the card. */
+ QSER_SIM_APP_TYPE_3GPP2 = 0xB02, /**< Identify the RUIM/CSIM application on the card. */
+ QSER_SIM_APP_TYPE_ISIM = 0xB03, /**< Identify the ISIM application on the card. */
+}QSER_SIM_APP_TYPE_T;
+
+typedef struct
+{
+ QSER_SIM_SLOT_ID_TYPE_T e_slot_id; /**< Indicates the slot to be used. */
+ QSER_SIM_APP_TYPE_T e_app; /**< Indicates the type of the application. */
+}QSER_SIM_APP_ID_INFO_T; /* Type */
+
+#define QSER_SIM_PIN_LEN_MAX 8 + 1 /** Maximum length of PIN data. */
+
+typedef enum
+{
+ QSER_SIM_PIN_ID_1 = 0xB01, /**< Level 1 user verification. */
+ QSER_SIM_PIN_ID_2 = 0xB02, /**< Level 2 user verification. */
+}QSER_SIM_PIN_ID_TYPE_T;
+
+typedef struct
+{
+ QSER_SIM_APP_ID_INFO_T app_info; /**< Application identification information. */
+ QSER_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[QSER_SIM_PIN_LEN_MAX]; /* Value of the PIN */
+}QSER_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
+{
+ QSER_SIM_APP_ID_INFO_T app_info; /**< Application identification information. */
+ QSER_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[QSER_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[QSER_SIM_PIN_LEN_MAX]; /**< Value of the new PIN as a sequence of ASCII characters. */
+}QSER_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
+{
+ QSER_SIM_APP_ID_INFO_T app_info; /**< Application identification information. */
+ QSER_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[QSER_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[QSER_SIM_PIN_LEN_MAX]; /**< Value of the new PIN as a sequence of ASCII characters. */
+}QSER_SIM_UNBLOCK_PIN_INFO_T;
+
+/** Enables the PIN on an application. */
+typedef QSER_SIM_VERIFY_PIN_INFO_T QSER_SIM_ENABLE_PIN_INFO_T; //Same
+
+/** Disables the PIN of an application, */
+typedef QSER_SIM_VERIFY_PIN_INFO_T QSER_SIM_DISABLE_PIN_INFO_T; //Same
+
+
+typedef enum
+{
+ QSER_SIM_PERSO_FEATURE_TYPE_UNKNOWN = 0xB00, /**< Unknown personalization feature. */
+ QSER_SIM_PERSO_FEATURE_TYPE_3GPP_NETWORK = 0xB01, /**< Featurization based on 3GPP MCC and MNC. */
+ QSER_SIM_PERSO_FEATURE_TYPE_3GPP_NETWORK_SUBSET = 0xB02, /**< Featurization based on 3GPP MCC, MNC, and IMSI digits 6 and 7. */
+ QSER_SIM_PERSO_FEATURE_TYPE_3GPP_SERVICE_PROVIDER = 0xB03, /**< Featurization based on 3GPP MCC, MNC, and GID1. */
+ QSER_SIM_PERSO_FEATURE_TYPE_3GPP_CORPORATE = 0xB04, /**< Featurization based on 3GPP MCC, MNC, GID1, and GID2. */
+ QSER_SIM_PERSO_FEATURE_TYPE_3GPP_SIM = 0xB05, /**< Featurization based on the 3GPP IMSI. */
+ QSER_SIM_PERSO_FEATURE_TYPE_3GPP2_NETWORK_TYPE_1 = 0xB06, /**< Featurization based on 3GPP2 MCC and MNC. */
+ QSER_SIM_PERSO_FEATURE_TYPE_3GPP2_NETWORK_TYPE_2 = 0xB07, /**< Featurization based on 3GPP2 IRM code. */
+ QSER_SIM_PERSO_FEATURE_TYPE_3GPP2_RUIM = 0xB08, /**< Featurization based on 3GPP2 IMSI_M. */
+}QSER_SIM_PERSO_FEATURE_TYPE_T;
+
+typedef enum
+{
+ QSER_SIM_CARD_STATE_UNKNOWN = 0xB01, /**< Card state unknown. */
+ QSER_SIM_CARD_STATE_ABSENT = 0xB02, /**< Card is absent. */
+ QSER_SIM_CARD_STATE_PRESENT = 0xB03, /**< Card is present. */
+ QSER_SIM_CARD_STATE_ERROR_UNKNOWN = 0xB04, /**< Unknown error state. */
+ QSER_SIM_CARD_STATE_ERROR_POWER_DOWN = 0xB05, /**< Power down. */
+ QSER_SIM_CARD_STATE_ERROR_POLL_ERROR = 0xB06, /**< Poll error. */
+ QSER_SIM_CARD_STATE_ERROR_NO_ATR_RECEIVED = 0xB07, /**< Failed to receive an answer to reset. */
+ QSER_SIM_CARD_STATE_ERROR_VOLT_MISMATCH = 0xB08, /**< Voltage mismatch. */
+ QSER_SIM_CARD_STATE_ERROR_PARITY_ERROR = 0xB09, /**< Parity error. */
+ QSER_SIM_CARD_STATE_ERROR_SIM_TECHNICAL_PROBLEMS= 0xB0A, /**< Card returned technical problems. */
+}QSER_SIM_CARD_STATE_TYPE_T; /**< Card state. */
+
+typedef enum
+{
+ QSER_SIM_CARD_TYPE_UNKNOWN = 0xB00, /**< Unidentified card type. */
+ QSER_SIM_CARD_TYPE_ICC = 0xB01, /**< Card of SIM or RUIM type. */
+ QSER_SIM_CARD_TYPE_UICC = 0xB02, /**< Card of USIM or CSIM type. */
+}QSER_SIM_CARD_TYPE_T;
+
+typedef enum
+{
+ QSER_SIM_PROV_STATE_NONE = 0xB00, /**< Nonprovisioning. */
+ QSER_SIM_PROV_STATE_PRI = 0xB01, /**< Primary provisioning subscription. */
+ QSER_SIM_PROV_STATE_SEC = 0xB02, /**< Secondary provisioning subscription. */
+}QSER_SIM_SUBSCRIPTION_TYPE_T;
+
+typedef enum
+{
+ QSER_SIM_APP_STATE_UNKNOWN = 0xB00, /**< Application state unknown. */
+ QSER_SIM_APP_STATE_DETECTED = 0xB01, /**< Detected state. */
+ QSER_SIM_APP_STATE_PIN1_REQ = 0xB02, /**< PIN1 required. */
+ QSER_SIM_APP_STATE_PUK1_REQ = 0xB03, /**< PUK1 required. */
+ QSER_SIM_APP_STATE_INITALIZATING = 0xB04, /**< Initializing. */
+ QSER_SIM_APP_STATE_PERSO_CK_REQ = 0xB05, /**< Personalization control key required. */
+ QSER_SIM_APP_STATE_PERSO_PUK_REQ = 0xB06, /**< Personalization unblock key required. */
+ QSER_SIM_APP_STATE_PERSO_PERMANENTLY_BLOCKED= 0xB07, /**< Personalization is permanently blocked. */
+ QSER_SIM_APP_STATE_PIN1_PERM_BLOCKED = 0xB08, /**< PIN1 is permanently blocked. */
+ QSER_SIM_APP_STATE_ILLEGAL = 0xB09, /**< Illegal application state. */
+ QSER_SIM_APP_STATE_READY = 0xB0A, /**< Application ready state. @newpage */
+}QSER_SIM_APP_STATE_TYPE_T;
+
+typedef enum
+{
+ QSER_SIM_PIN_STATE_UNKNOWN = 0xB01, /**< Unknown PIN state. */
+ QSER_SIM_PIN_STATE_ENABLED_NOT_VERIFIED = 0xB02, /**< PIN required, but has not been verified. */
+ QSER_SIM_PIN_STATE_ENABLED_VERIFIED = 0xB03, /**< PIN required and has been verified. */
+ QSER_SIM_PIN_STATE_DISABLED = 0xB04, /**< PIN not required. */
+ QSER_SIM_PIN_STATE_BLOCKED = 0xB05, /**< PIN verification has failed too many times and is blocked. Recoverable through PUK verification. */
+ QSER_SIM_PIN_STATE_PERMANENTLY_BLOCKED = 0xB06, /**< PUK verification has failed too many times and is not recoverable. */
+}QSER_SIM_PIN_STATE_TYPE_T;
+
+typedef struct
+{
+ QSER_SIM_SUBSCRIPTION_TYPE_T subscription; /**< Type of subscription (i.e., primary, secondary, etc.). */
+ QSER_SIM_APP_STATE_TYPE_T app_state; /**< Current state of the application. */
+ QSER_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. */
+ QSER_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. */
+ QSER_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. */
+}QSER_SIM_CARD_APP_INFO_T;
+
+typedef struct
+{
+ QSER_SIM_CARD_APP_INFO_T app_3gpp; /**< Stores 3GPP application information. */
+ QSER_SIM_CARD_APP_INFO_T app_3gpp2; /**< Stores 3GPP2 application information. */
+ QSER_SIM_CARD_APP_INFO_T app_isim; /**< Stores ISIM application information. */
+}QSER_SIM_CARD_ALL_APP_INFO_T;
+
+typedef struct
+{
+ QSER_SIM_CARD_STATE_TYPE_T e_card_state;/**< Current card and card error state. */
+ QSER_SIM_CARD_TYPE_T e_card_type; /**< Card type. */
+ QSER_SIM_CARD_ALL_APP_INFO_T card_app_info; /**< Stores all relevant application information. */
+}QSER_SIM_CARD_STATUS_INFO_T;
+
+typedef QSER_SIM_CARD_STATUS_INFO_T* QSER_SIM_MsgRef;
+/* Callback function registered to qser_sms_addrxmsghandler, msgRef contains the detail msg infor */
+typedef void (*QSER_SIM_RxMsgHandlerFunc_t)(QSER_SIM_MsgRef msgRef);
+
+
+int qser_sim_client_init(sim_client_handle_type *ph_sim);
+
+int qser_sim_client_deinit(sim_client_handle_type h_sim);
+
+/*===========================================================================
+
+ FUNCTION: qser_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
+*/
+/*=========================================================================*/
+int qser_sim_getimsi(
+ sim_client_handle_type h_sim,
+ QSER_SIM_APP_ID_INFO_T *pt_info, ///< [IN] The SIM identifier info.
+ char *imsi, ///< [OUT] IMSI buffer
+ size_t imsiLen ///< [IN] IMSI buffer length
+);
+
+
+/*===========================================================================
+
+ FUNCTION: qser_sim_geticcid
+
+===========================================================================*/
+/*
+ @brief
+ Function sends a command to the modem to retrieve the ICCID from
+ SIM in ASCII form
+
+ @return
+ int
+*/
+/*=========================================================================*/
+int qser_sim_geticcid
+(
+ sim_client_handle_type h_sim,
+ QSER_SIM_SLOT_ID_TYPE_T simId, ///< [IN] The SIM identifier.
+ char *iccid, ///< [OUT] ICCID
+ size_t iccidLen ///< [IN] ICCID buffer length
+);
+
+
+/*===========================================================================
+
+ FUNCTION: qser_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
+ int
+*/
+/*=========================================================================*/
+int qser_sim_getphonenumber
+(
+ sim_client_handle_type h_sim,
+ QSER_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: qser_sim_verifypin
+
+===========================================================================*/
+/*
+ @brief
+ Function sends a command to the modem to verify either PIN1 or PIN2
+
+ @return
+ int
+*/
+/*=========================================================================*/
+int qser_sim_verifypin
+(
+ sim_client_handle_type h_sim,
+ QSER_SIM_VERIFY_PIN_INFO_T *pt_info ///< [IN] Verify PIN infor
+);
+
+
+/*===========================================================================
+
+ FUNCTION: qser_sim_changepin
+
+===========================================================================*/
+/*
+ @brief
+ Function sends a command to the modem to change the value of
+ either PIN1 or PIN2
+
+ @return
+ int
+*/
+/*=========================================================================*/
+int qser_sim_changepin
+(
+ sim_client_handle_type h_sim,
+ QSER_SIM_CHANGE_PIN_INFO_T *pt_info ///< [IN] Change PIN infor
+);
+
+
+/*===========================================================================
+
+ FUNCTION: qser_sim_unblockpin
+
+===========================================================================*/
+/*
+ @brief
+ Function sends a command to the modem to unblock a PIN1 or PIN2 that
+ has been blocked
+
+ @return
+ int
+*/
+/*=========================================================================*/
+int qser_sim_unblockpin
+(
+ sim_client_handle_type h_sim,
+ QSER_SIM_UNBLOCK_PIN_INFO_T *pt_info ///< [IN] Unblock PIN infor
+);
+
+/*===========================================================================
+
+ FUNCTION: qser_sim_enablepin
+
+===========================================================================*/
+/*
+ @brief
+ Function sends a command to the modem to enable PIN1 or PIN2
+
+ @return
+ int
+*/
+/*=========================================================================*/
+int qser_sim_enablepin
+(
+ sim_client_handle_type h_sim,
+ QSER_SIM_ENABLE_PIN_INFO_T *pt_info ///< [IN] Enable PIN infor
+);
+
+/*===========================================================================
+
+ FUNCTION: qser_sim_disablepin
+
+===========================================================================*/
+/*
+ @brief
+ Function sends a command to the modem to disable PIN1 or PIN2
+
+ @return
+ int
+*/
+/*=========================================================================*/
+int qser_sim_disablepin
+(
+ sim_client_handle_type h_sim,
+ QSER_SIM_DISABLE_PIN_INFO_T *pt_info ///< [IN] Disable PIN infor
+);
+
+
+/*===========================================================================
+
+ FUNCTION: qser_sim_getcardstatus
+
+===========================================================================*/
+/*
+ @brief
+ Function retrieves the server cached card status informations and
+ sends the information to the client
+
+ @return
+ int
+*/
+/*=========================================================================*/
+int qser_sim_getcardstatus
+(
+ sim_client_handle_type h_sim,
+ QSER_SIM_SLOT_ID_TYPE_T simId, ///< [IN] The SIM identifier.
+ QSER_SIM_CARD_STATUS_INFO_T *pt_info ///< [OUT] Cart status infor output
+);
+
+/*===========================================================================
+
+ FUNCTION: qser_sim_getimei
+
+===========================================================================*/
+/*
+ @brief
+ get imei
+
+ @return
+ int
+*/
+/*=========================================================================*/
+int qser_sim_getimei(sim_client_handle_type h_sim, char *imei);
+int qser_get_imei_and_sv(sim_client_handle_type h_sim,char *imei, char*sv);
+
+
+/*===========================================================================
+
+ FUNCTION: qser_get_imei_and_sv
+
+===========================================================================*/
+/*
+ @brief
+ get imei and sv
+
+ @return
+ int
+*/
+/*=========================================================================*/
+int qser_get_imei_and_sv
+(
+ sim_client_handle_type h_sim,
+ char *imei, char*sv
+);
+
+/*===========================================================================
+
+ FUNCTION: qser_reset_modem
+
+===========================================================================*/
+/*
+ @brief
+ reboot modem
+
+ @return
+ int
+*/
+/*=========================================================================*/
+int qser_reset_modem(sim_client_handle_type h_sim);
+
+
+/*===========================================================================
+
+ FUNCTION: qser_reset_modem
+
+===========================================================================*/
+/*
+ @brief
+ reboot modem
+
+ @return
+ int
+*/
+/*=========================================================================*/
+int qser_get_version(sim_client_handle_type h_sim, char *buf);
+
+
+/*===========================================================================
+
+ FUNCTION: qser_reset_modem
+
+===========================================================================*/
+/*
+ @brief
+ reboot modem
+
+ @return
+ int
+*/
+/*=========================================================================*/
+int qser_reset_sim(sim_client_handle_type h_sim);
+
+int qser_sim_addrxmsghandler(QSER_SIM_RxMsgHandlerFunc_t handlerPtr);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
\ No newline at end of file
diff --git a/mbtk/include/lynq/lynq_qser_sms.h b/mbtk/include/lynq/lynq_qser_sms.h
new file mode 100755
index 0000000..7276fca
--- /dev/null
+++ b/mbtk/include/lynq/lynq_qser_sms.h
@@ -0,0 +1,241 @@
+#ifndef LYNQ_QSER_SMS_H
+#define LYNQ_QSER_SMS_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <sys/types.h>
+#include <stdint.h>
+
+#define MIN_MSM_PARAM_NUM 4
+#define MIN_IMS_MSM_PARAM_NUM 6
+#define MIN_WRITMSM_PARAM_NUM 5
+#define MSG_MAX_LEN 1024
+#define TELEPHONNUM_LEN 64
+#define STORAGSMS_MAX_SIZE 128
+#define SMSC_MAX_LEN 22
+#define SMS_NUM_MAX 255
+
+typedef unsigned short uint16_t;
+typedef unsigned int uint32_t;
+typedef uint32_t sms_client_handle_type;
+
+/** Maximum length of an SMS. */
+#define QSER_SMS_MAX_MT_MSG_LENGTH 1440
+
+/** Maximum string length. */
+#define QSER_SMS_MAX_ADDR_LENGTH 252
+
+/** Maximum string length. */
+#define QSER_SMS_MAX_SCA_TYPLENGTH 3
+
+typedef enum
+{
+ QSER_SMS_7BIT = 0,
+ QSER_SMS_8BIT = 1,
+ QSER_SMS_UCS2 = 2,
+ //<2017/12/28-QCM9XOL00004C001-P01-Vicent.Gao, <[SMS] Segment 1==> CharSet to Alpha implementation.>
+ //QSER_SMS_IRA = 3,//just for inside test
+ //>2017/12/28-QCM9XOL00004C001-P01-Vicent.Gao
+
+}QSER_SMS_T;
+
+typedef enum
+{
+ QSER_SMS_MO = 0, ///< SMS mobile terminated message.
+ QSER_SMS_MT = 1, ///< SMS mobile originated message.
+ QSER_SMS_BROADCAST_MT = 2 ///< SMS Cell Broadcast message.
+}QSER_SMS_TYPT;
+
+typedef enum
+{
+ QSER_SMS_STORAGTYPNONE = -1, /**< Message no need to store. */
+ QSER_SMS_STORAGTYPUIM = 0, /**< Message store to UIM. */
+ QSER_SMS_STORAGTYPNV = 1, /**< Message store to NV. */
+ QSER_SMS_STORAGTYPDB = 2, /**< Message store to NV. */
+}QSER_SMS_STORAGTYPT;
+
+typedef enum
+{
+ QSER_SMS_MESSAGMODUNKNOWN = -1, /**< Message type CDMA */
+ QSER_SMS_MESSAGMODCDMA = 0, /**< Message type CDMA */
+ QSER_SMS_MESSAGMODGW = 1, /**< Message type GW. */
+}QSER_SMS_MODTYPT;
+
+typedef struct
+ {
+ uint8_t total_segments; /**< The number of long short message*/
+ uint8_t seg_number; /**< Current number.*/
+ uint8_t referencnumber; /**< referencnumber.*/
+}QSER_sms_user_data_head_t;
+
+typedef struct
+{
+ /* If sms is stored, it won't parse, you need read it by yourself */
+ QSER_SMS_STORAGTYPT storage; ///specify where stored this msg
+
+ QSER_SMS_T format;
+ QSER_SMS_TYPT type;
+ char src_addr[QSER_SMS_MAX_ADDR_LENGTH]; ///Telephone number string.
+ int sms_data_len;
+ char sms_data[QSER_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;
+ QSER_sms_user_data_head_t user_data_head; //long sms user data head info.
+ QSER_SMS_MODTYPT mode; ///specify where stored this msg cdma or gw area
+ uint32_t storage_index; ///storage index, -1 means not store
+} QSER_sms_info_t;
+
+typedef struct
+{
+ QSER_SMS_STORAGTYPT storage;
+ QSER_SMS_MODTYPT mode;
+ uint32_t storage_idx;
+} QSER_sms_storage_info_t;
+
+typedef enum
+{
+ QSER_SMS_UNKNOWN = -1,
+ QSER_SMS_DISCARD = 0x00, /* Incoming messages for this route are discarded by the WMS service without
+ notifying QMI_WMS clients */
+ QSER_SMS_STORAND_NOTIFY = 0x01, /* Incoming messages for this route are stored to the specified device
+ memory, and new message notifications */
+ QSER_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 */
+ QSER_SMS_TRANSFER_AND_ACK = 0x03, /* Incoming messages for this route are transferred to the client, and ACK is
+ sent to the network */
+}QSER_SMS_RECEPTION_ACTION_TYPT;
+
+#define QSER_WMS_MESSAGLENGTH_MAX 255
+
+typedef enum
+ {
+ QSER_WMS_MESSAGCDMA = 0x00, //- 0x00 -- MESSAGCDMA -- CDMA \n
+ QSER_WMS_MESSAGGW_PP = 0x06, //- 0x06 -- MESSAGGW_PP -- GW_PP
+}QSER_WMS_MESSAGTYPE;
+
+
+typedef struct
+ {
+ QSER_WMS_MESSAGTYPE format;
+ uint32_t raw_messaglen; /**< Must be set to # of elements in raw_message */
+ uint8_t raw_message[QSER_WMS_MESSAGLENGTH_MAX]; /**< Raw message data*/
+}QSER_wms_send_raw_message_data_t;
+
+typedef enum
+{
+ QSER_WMS_TL_CAUSCODADDR_VACANT = 0x00,
+ QSER_WMS_TL_CAUSCODADDR_TRANSLATION_FAILURE = 0x01,
+ QSER_WMS_TL_CAUSCODNETWORK_RESOURCSHORTAGE = 0x02,
+ QSER_WMS_TL_CAUSCODNETWORK_FAILURE = 0x03,
+ QSER_WMS_TL_CAUSCODINVALID_TELESERVICID = 0x04,
+ QSER_WMS_TL_CAUSCODNETWORK_OTHER = 0x05,
+ QSER_WMS_TL_CAUSCODNO_PAGRESPONSE = 0x20,
+ QSER_WMS_TL_CAUSCODDEST_BUSY = 0x21,
+ QSER_WMS_TL_CAUSCODNO_ACK = 0x22,
+ QSER_WMS_TL_CAUSCODDEST_RESOURCSHORTAGE = 0x23,
+ QSER_WMS_TL_CAUSCODSMS_DELIVERY_POSTPONED = 0x24,
+ QSER_WMS_TL_CAUSCODDEST_OUT_OF_SERV = 0x25,
+ QSER_WMS_TL_CAUSCODDEST_NOT_AT_ADDR = 0x26,
+ QSER_WMS_TL_CAUSCODDEST_OTHER = 0x27,
+ QSER_WMS_TL_CAUSCODRADIO_IF_RESOURCSHORTAGE = 0x40,
+ QSER_WMS_TL_CAUSCODRADIO_IF_INCOMPATABILITY = 0x41,
+ QSER_WMS_TL_CAUSCODRADIO_IF_OTHER = 0x42,
+ QSER_WMS_TL_CAUSCODENCODING = 0x60,
+ QSER_WMS_TL_CAUSCODSMS_ORIG_DENIED = 0x61,
+ QSER_WMS_TL_CAUSCODSMS_TERM_DENIED = 0x62,
+ QSER_WMS_TL_CAUSCODSUPP_SERV_NOT_SUPP = 0x63,
+ QSER_WMS_TL_CAUSCODSMS_NOT_SUPP = 0x64,
+ QSER_WMS_TL_CAUSCODMISSING_EXPECTED_PARAM = 0x65,
+ QSER_WMS_TL_CAUSCODMISSING_MAND_PARAM = 0x66,
+ QSER_WMS_TL_CAUSCODUNRECOGNIZED_PARAM_VAL = 0x67,
+ QSER_WMS_TL_CAUSCODUNEXPECTED_PARAM_VAL = 0x68,
+ QSER_WMS_TL_CAUSCODUSER_DATA_SIZERR = 0x69,
+ QSER_WMS_TL_CAUSCODGENERAL_OTHER = 0x6A,
+}QSER_WMS_TL_CAUSCODTYPE;
+
+
+
+typedef struct
+ {
+ uint16_t messagid; /* Message ID */
+ uint8_t causcodvalid; /**< Must be set to true if causcode is being passed */
+ QSER_WMS_TL_CAUSCODTYPE causcode;
+}QSER_wms_raw_send_resp_t;
+
+typedef struct
+ {
+ char service_center_addr[QSER_SMS_MAX_ADDR_LENGTH + 1]; /**< Address of the service center.*/
+ uint8_t service_center_addr_typvalid;
+ char service_center_addr_type[QSER_SMS_MAX_SCA_TYPLENGTH + 1]; /**< 129 if the SMSC address does not start with a "+" characte;
+ 145 if the SMSC address starts with a "+" character*/
+}QSER_sms_service_center_cfg_t;
+
+typedef QSER_sms_info_t QSER_SMS_Msg_t;
+typedef QSER_sms_info_t* QSER_SMS_MsgRef;
+
+/* Callback function registered to qser_sms_addrxmsghandler, msgRef contains the detail msg infor */
+typedef void (*QSER_SMS_RxMsgHandlerFunc_t)(QSER_SMS_MsgRef msgRef, void* contextPtr);
+
+/* Init SMS module and return h_sms, this should be called before any othe ones */
+int qser_sms_client_init(sms_client_handle_type *ph_sms);
+
+/* Add callback function, if any new msg arrived, it will notify app */
+int qser_sms_addrxmsghandler(QSER_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 qser_sms_send_sms(sms_client_handle_type h_sms, QSER_sms_info_t *pt_sms_info);
+
+/* DeInit SMS module and release resource, this should be called in the last one. */
+int qser_sms_client_deinit(sms_client_handle_type h_sms);
+
+/* Delete the SMS specified in the pt_sms_storage */
+int qser_sms_deletefromstorage(sms_client_handle_type h_sms, QSER_sms_storage_info_t *pt_sms_storage);
+
+/* Send sms PDU.
+*/
+int qser_sms_send_smspdu( sms_client_handle_type h_sms,
+ QSER_wms_send_raw_message_data_t *raw_messagdata,
+ QSER_wms_raw_send_resp_t *rawresp);
+
+
+/* Get sms center address.
+*/
+int qser_sms_getsmscenteraddress( sms_client_handle_type h_sms,
+ QSER_sms_service_center_cfg_t *set_sca_cfg);
+
+/* Set sms center address.
+*/
+int qser_sms_setsmscenteraddress( sms_client_handle_type h_sms,
+ QSER_sms_service_center_cfg_t *get_sca_cfg);
+
+/*
+Usage 1 (register callback and wait for new sms arrive):
+1, qser_sms_client_init
+2, qser_sms_addrxmsghandler(pf_cb)
+3, wait for sms arrive, pf_cb will pass the detail sms info to app.
+4, qser_sms_client_deinit
+
+
+Usage 2 (Send sms):
+1, qser_sms_client_init
+2, qser_sms_addrxmsghandler(pf_cb)
+3, qser_sms_send_sms
+4, qser_sms_client_deinit
+
+
+Usage 3 (store sms):
+1, qser_sms_client_init
+2, qser_sms_addrxmsghandler(pf_cb)
+3, qser_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 qser_sms_deletefromstorage to delete specified sms, the location can be got from pf_cb.
+6, qser_sms_client_deinit
+*/
+
+#ifdef __cplusplus
+}
+#endif
+#endif
\ No newline at end of file
diff --git a/mbtk/include/lynq/lynq_qser_thermal.h b/mbtk/include/lynq/lynq_qser_thermal.h
new file mode 100755
index 0000000..d776dde
--- /dev/null
+++ b/mbtk/include/lynq/lynq_qser_thermal.h
@@ -0,0 +1,12 @@
+#ifndef _LYNQ_QSER_THERMAL_H_
+#define _LYNQ_QSER_THERMAL_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#define MAX_SIZE 100
+int get_thermal_zone(int *numbers, int size);
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/mbtk/include/lynq/lynq_sim.h b/mbtk/include/lynq/lynq_sim.h
new file mode 100755
index 0000000..8f2849a
--- /dev/null
+++ b/mbtk/include/lynq/lynq_sim.h
@@ -0,0 +1,98 @@
+/*=============================================================================
+# FileName: lynq_sim.h
+# Desc: about SIMAPI
+# Author: lei
+# Version: V2.0
+# LastChange: 2023-03-13
+# History:
+# If you need to use any API under lynq_sim, you must first call the lynq_sim_init() function to initialize these functions.
+=============================================================================*/
+#ifndef __LYNQ_SIM__
+#define __LYNQ_SIM__
+#ifdef __cplusplus
+extern "C" {
+#endif
+#include "mbtk_type.h"
+
+int lynq_get_sim_status(int *card_status);
+int lynq_get_imsi(char buf[]);
+int lynq_sim_init(int utoken);
+int lynq_sim_deinit(void);
+int lynq_enable_pin(char pin[]);
+int lynq_disable_pin(char pin[]);
+int lynq_get_iccid(char buf[]);
+int lynq_query_pin_lock(char *pin,int buf[]);
+int lynq_verify_pin(char *pin);
+int lynq_change_pin(char *old_pin, char *new_pin);
+int lynq_unlock_pin(char *puk, char *pin);
+int lynq_query_phone_number(char buf[]);
+int lynq_switch_card(int slot);
+int lynq_screen(int num);
+int lynq_get_imei(char buf[]);
+int lynq_get_imei_and_sv(char imei[],char sv[]);
+
+/**
+ * @brief Request SIM I/O operation.
+ * This is similar to the TS 27.007 "restricted SIM" operation
+ * where it assumes all of the EF selection will be done by the callee.
+ * @param list type: [IN] list[0]:one of the commands listed for TS 27.007 +CRSM.(command)
+ * type: [IN] list[1]:EF id(fileid)
+ * type: [IN] list[2]:offset(p1)
+ * type: [IN] list[3]:offset(p2)
+ * type: [IN] list[4]:response len,sometimes needn't care(p3)
+ * @param path type: [IN] "pathid" from TS 27.007 +CRSM command.
+ type: [IN] Path is in hex asciii format eg "7f205f70"
+ type: [IN] Path must always be provided.
+ * @param data type: [IN] May be NULL
+ * @param pin2 type: [IN] May be NULL
+ * @param aidPtr type: [IN] AID value, See ETSI 102.221 8.1 and 101.220 4, NULL if no value.
+ * @param sw type: [OUT]
+ * @param simResponse type: [OUT] response
+ * @return int
+ */
+int lynq_req_sim_io(int list[5], char *path, char *data, char *pin2, char *aidPtr, int sw[2], char *simResponse);
+
+/**
+ * @brief
+ * @param options type: [IN] [options] define whether you want to halt, power-off, or reboot the machine.May be NULL
+ * @param time type: [IN] [time] specifies when you want the shutdown to perform.May be NULL
+ * @param message type: [IN] [message] adds a message that announces the shutdown.May be NULL
+ * @return int
+ */
+int lynq_shutdown(char options[], char time[], char message[]);
+
+/**
+ * @brief get currnet version of mobiletek
+ * @param buf type: [out] My Param doc
+ * @return int
+ */
+int lynq_get_version(char buf[]);
+
+/**
+ * @brief sim power on/off
+ *
+ */
+#ifdef MOBILETEK_TARGET_PLATFORM_T106
+int lynq_reset_sim(void);
+#else
+int lynq_sim_power(int mode);
+#endif
+/**
+ * @brief reset modem
+ *
+ */
+int lynq_reset_modem(void);
+
+/**
+ * @brief factory test to both radio on/off
+ *
+ */
+int lynq_factory_radio_state(int num);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/mbtk/include/lynq/lynq_sms.h b/mbtk/include/lynq/lynq_sms.h
new file mode 100755
index 0000000..278278a
--- /dev/null
+++ b/mbtk/include/lynq/lynq_sms.h
@@ -0,0 +1,36 @@
+#ifndef LYNQ_SMS_H
+#define LYNQ_SMS_H 1
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define MIN_MSM_PARAM_NUM 4
+#define MIN_IMS_MSM_PARAM_NUM 6
+#define MIN_WRITE_MSM_PARAM_NUM 5
+#define MSG_MAX_LEN 1024
+#define TELEPHONE_NUM_LEN 64
+#define STORAGE_SMS_MAX_SIZE 128
+#define SMSC_MAX_LEN 22
+#define SMS_NUM_MAX 255
+
+typedef enum
+{
+ SMS_ERR = -1,
+ SMS_OK = 0,
+ SMS_KNONW = 1,
+ SMS_UNKNONW = 2
+}status_SMS;
+
+int lynq_sms_init(int uToken);
+int lynq_sms_deinit(void);
+int lynq_send_sms(char telephony_num[TELEPHONE_NUM_LEN], int charset, char *msg, int msglen);
+int lynq_read_sms(int index,int *status,int *charset,char smsc[SMSC_MAX_LEN],int *smscLen,int *smslen,char message[MSG_MAX_LEN],char teleNum[TELEPHONE_NUM_LEN],int *numLen,int *current,int *total);
+int lynq_get_smsc_address(char service_num[SMSC_MAX_LEN]);
+int lynq_set_smsc_address(const char* service_num);
+int lynq_list_sms(char index_list[SMS_NUM_MAX]);
+int lynq_delete_sms(int index);
+int lynq_wait_receive_new_sms(int *handle);
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/mbtk/include/lynq/lynq_systime.h b/mbtk/include/lynq/lynq_systime.h
new file mode 100755
index 0000000..a9d54d9
--- /dev/null
+++ b/mbtk/include/lynq/lynq_systime.h
@@ -0,0 +1,125 @@
+/**@file lynq-systime.h
+ *
+ * @brief Sync systime form each time source.
+ *
+ * @author sj.zhang
+ *
+ * @date 2023-08-14
+ *
+ * @version V1.0
+ *
+ * @copyright Copyright (c) MobileTek
+ */
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <time.h>
+#include "lynq_uci.h"
+
+#ifndef _LYNQ_SYSTIME_H_
+#define _LYNQ_SYSTIME_H_
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+typedef struct time_source_status
+{
+ int ntp;
+ int nitz;
+ int gnss;
+}time_src_status_s;
+
+#ifdef MOBILETEK_TARGET_PLATFORM_T106
+
+ /**@brief Set the rtc time to the system time.
+ *
+ * @param void
+ *
+ * @return
+ * 0:success
+ * other:failure
+ */
+ int lynq_sync_time_from_rtc(void);
+
+ /**@brief Set the system time to the rtc time.
+ *
+ * @param void
+ *
+ * @return
+ * 0:success
+ * other:failure
+ */
+ int lynq_set_rtc_time(void);
+
+ /**@brief Query the rtc time.
+ *
+ * @param [OUT] ulsec: rtc time, secconds from 1900.1.1 00:00
+ *
+ * @return
+ * 0:success
+ * other:failure
+ */
+ int lynq_get_rtc_time(unsigned long *ulsec);
+#endif
+
+ /**@brief Query the time source status now.
+ *
+ * @param [OUT] ntp, nitz, gnss:
+ * 0: disable
+ * 1: enable
+ *
+ * @return
+ * 0 : success
+ * other:failure
+ */
+ int lynq_get_time_src_status(time_src_status_s *time_src);
+
+ /**@brief Turn sntp on/off
+ *
+ * @param enable [IN] : 0 disenable; 1 enable;
+ *
+ * @return
+ * 0 set success
+ * 1 SNTP_DISENABLE
+ * 2 SNTP_ALREADY_ENABLE
+ */
+ int ntp_sync_time(int enable);
+
+ /**@brief Enable/Disenable sync time from NITZ.
+ *
+ * @param enable [IN] : 0 disenable; 1 enable;
+ *
+ * @return
+ * 0:success
+ * other:failure
+ */
+ int modem_time_enable(int enable);
+
+ /**@brief Enable/Disenable sync time from GNSS.
+ *
+ * @param enable [IN] : 0 disenable; 1 enable;
+ *
+ * @return
+ * 0:success
+ * other:failure
+ */
+ int gnss_time_enable(int enable);
+
+ /**@brief User set systime manually.
+ *
+ * @param enable [IN] : 0 disenable; 1 enable;
+ *
+ * @return
+ * 0:success
+ * other:failure
+ */
+ int user_set_time(char *date, char *time);
+
+ int get_sync_time_result(void );
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/mbtk/include/lynq/lynq_uci.h b/mbtk/include/lynq/lynq_uci.h
new file mode 100755
index 0000000..0a08c31
--- /dev/null
+++ b/mbtk/include/lynq/lynq_uci.h
@@ -0,0 +1,38 @@
+#ifndef _LYNQ_UCI_H_
+#define _LYNQ_UCI_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <uci.h>
+
+#define LYNQ_UCI_MAX_LEN 128
+#define LYNQ_UCI_SUCCESS 0
+#define LYNQ_UCI_ERROR 1
+#define LYNQ_UCI_FILE "lynq_uci"
+#define LYNQ_UCI_RO_FILE "lynq_uci_ro"
+
+//static struct uci_context * ctx = NULL;
+
+int lynq_del(char *option);
+#if UCI_SUPPORT
+ static int uci_get_value(struct uci_option *o, char *out_buf);
+#endif //uci_support
+int lynq_uci_get(const char *arg, char *out_buf);
+
+int lynq_uci_set(const char *arg);
+
+int lynq_add_section(char *section_type, char *section);
+
+int lynq_set_value(char *section, char *key, char *value);
+
+int lynq_get_value(char *file, char *section, char *key, char *tmp);
+
+
+int lynq_load_config(char *filename);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/mbtk/include/lynq/lynq_wifi.h b/mbtk/include/lynq/lynq_wifi.h
new file mode 100755
index 0000000..babf0c3
--- /dev/null
+++ b/mbtk/include/lynq/lynq_wifi.h
@@ -0,0 +1,312 @@
+/*******************************************************
+*
+* @brief: Add wifi api
+* @details: add liblynq-qser-wifi api
+* @author: wz.wang
+* @date: 2024.3.15
+* @version: V1.0
+* @copyright:Copyright (c) MobileTek
+*
+*********************************************/
+/*
+#ifndef LYNQ_QSER_WIFI
+#define LYNQ_QSER_WIFI
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+*/
+
+typedef enum {
+ LYNQ_ERROR = -1,
+ LYNQ_ERR_SUCCESS = 0,
+ LYNQ_ERR_FAIL,
+ LYNQ_ERR_NO_MEMORY,
+ LYNQ_ERR_BADPARAM,
+ LYNQ_ERR_NOT_SUPPORT,
+ LYNQ_ERR_NOT_READY,
+ LYNQ_ERR_NO_DEVICE,
+ LYNQ_ERR_NO_MAC,
+ LYNQ_ERR_IPC,
+ LYNQ_ERR_SOC,
+ LYNQ_ERR_CONDITION,
+ LYNQ_ERR_BUSY,
+ LYNQ_ERR_FIRMWARE_CRASH
+} lynq_wifi_err_code;
+
+
+typedef enum {
+ LYNQ_WIFI_AP_INDEX_AP0 = 0, /* Index 0 of AP/AP-STA/AP-AP Mode */
+ LYNQ_WIFI_AP_INDEX_AP1 /* Index 1 of AP/AP-STA/AP-AP Mode */
+} lynq_wifi_ap_index_e;
+
+typedef enum
+{
+ LYNQ_WIFI_MODE_MIN = -1,
+ LYNQ_WIFI_MODE_80211B = 0,
+ LYNQ_WIFI_MODE_80211BG,
+ LYNQ_WIFI_MODE_80211BGN,
+ LYNQ_WIFI_MODE_80211A,
+ LYNQ_WIFI_MODE_80211AN,
+ LYNQ_WIFI_MODE_80211AC,
+ LYNQ_WIFI_MODE_80211BGNAX_2G,
+ LYNQ_WIFI_AP_MODE_MAX
+} lynq_wifi_mode_type_e;
+
+typedef enum LYNQ_WIFI_BANDWIDTH_ENUM
+{
+ LYNQ_WIFI_BANDWIDTH_MIN = -1,
+ LYNQ_WIFI_BANDWIDTH_HT20 = 0,
+ LYNQ_WIFI_BANDWIDTH_HT40,
+ LYNQ_WIFI_BANDWIDTH_HT80,
+ LYNQ_WIFI_BANDWIDTH_MAX
+} lynq_wifi_bandwidth_type_e;
+
+typedef enum
+{
+ LYNQ_WIFI_AUTH_MIN = -1,
+ LYNQ_WIFI_AUTH_OPEN = 0,
+ LYNQ_WIFI_AUTH_WPA_PSK,
+ LYNQ_WIFI_AUTH_WPA2_PSK, //AES
+ LYNQ_WIFI_AUTH_WPA_WPA2_PSK_BOTH, //TKIP & AES
+ LYNQ_WIFI_AUTH_WPA3_PSK, //AES
+ LYNQ_WIFI_AUTH_WPA2_WPA3_PSK_BOTH, //AES
+ LYNQ_WIFI_AUTH_MAX
+} lynq_wifi_auth_e;
+
+typedef enum
+{
+ LYNQ_WIFI_WORK_MODE_AP0 ,
+ LYNQ_WIFI_WORK_MODE_AP1
+
+} lynq_wifi_work_mode_e;
+
+typedef enum {
+LYNQ_WIFI_EVENT_ENABLE_STATUS = 0, //打开 AP 的回调和 STA 模式连接状态的回调
+LYNQ_WIFI_EVENT_DISABLE_STATUS, //关闭 AP 的回调和 STA 模式连接状态的回调
+LYNQ_WIFI_EVENT_AP_STATION, //输入未使用
+LYNQ_WIFI_EVENT_AP_STA_STATUS, //输入未使用
+LYNQ_WIFI_EVENT_STA_STATUS, //输入未使用
+} lynq_wifi_event_type_e;
+
+typedef enum {
+LYNQ_WIFI_AP_STATUS_NONE = 0, //初始状态
+LYNQ_WIFI_AP_STATUS_IDLE, //打印两次,表示 AP 已关闭
+LYNQ_WIFI_AP_STATUS_ENABLING, //AP 正在开启中
+LYNQ_WIFI_AP_STATUS_ENABLED, //AP 已开启
+LYNQ_WIFI_AP_STATUS_DISABLING, //已移除
+LYNQ_WIFI_AP_STATUS_ERROR //操作异常
+} lynq_wifi_status_e;
+
+typedef enum
+{
+LYNQ_WIFI_AUTH_WPA_PAIRWISE_MIN = -1,
+LYNQ_WIFI_AUTH_WPA_PAIRWISE_AUTO = 0, //TKIP & AES
+LYNQ_WIFI_AUTH_WPA_PAIRWISE_TKIP, //TKIP
+LYNQ_WIFI_AUTH_WPA_PAIRWISE_AES, //AES
+LYNQ_WIFI_AUTH_WPA_PAIRWISE_MAX
+} lynq_wifi_auth_wpa_psk_e;
+
+typedef enum
+{
+LYNQ_WIFI_STA_STATUS_NONE, //初始状态
+LYNQ_WIFI_STA_STATUS_IDLE, //STA 已关闭
+LYNQ_WIFI_STA_STATUS_CONNECTING, //STA 正在连接热点中
+LYNQ_WIFI_STA_STATUS_ASSOCIATED, //STA 已连上热点,正在分配 IP 中
+LYNQ_WIFI_STA_STATUS_CONNECTED, //STA 已连上热点,完成 IP 分配
+LYNQ_WIFI_STA_STATUS_DISCONNECTED, //STA 已从热点断开
+LYNQ_WIFI_STA_STATUS_ERROR //连接报错
+} lynq_wifi_sta_status_e;
+
+typedef enum
+{
+LYNQ_WIFI_REASON_CODE_NONE, //无特殊原因
+LYNQ_WIFI_REASON_CODE_WRONG_KEY, //热点的密码错误
+LYNQ_WIFI_REASON_CODE_AUTH_FAILED, //与热点认证失败
+LYNQ_WIFI_REASON_CODE_CONN_FAILED, //与热点连接失败
+LYNQ_WIFI_REASON_CODE_SET_FAILED, //热点的认证等设置错误
+LYNQ_WIFI_REASON_CODE_DHCP_FAILED //与热点的 DHCP 失败
+} lynq_wifi_reason_code_e;
+
+typedef enum
+{
+LYNQ_WIFI_MAC_ACL_RULE_NONE,
+LYNQ_WIFI_MAC_ACL_RULE_WHITE_LIST,
+LYNQ_WIFI_MAC_ACL_RULE_BLACK_LIST
+} lynq_wifi_mac_acl_rule_e;
+
+typedef struct
+{
+char addr[16]; //连接的 sta 设备 IPv4 的地址
+char macaddr[18]; //连接的 sta 设备 MAC 的地址
+char name[20]; //连接的 sta 设备名称
+char ifname[18]; //对应 AP 核的 wlan 设备
+int uptime; //sta 设备连接的时间,单位:秒
+} lynq_lanhost_t;
+
+
+typedef struct
+{
+ int array_len; //打印连接设备的个数
+ lynq_lanhost_t array[32]; //具体的 sta 信息,参考 lynq_lanhost_t 结构体
+} lynq_lanhost_ts;
+
+typedef struct
+{
+lynq_wifi_auth_e auth; //安全模式。
+lynq_wifi_auth_wpa_psk_e pairwise; //加密方式。
+char passwd[64+1]; //密码
+int group_rekey; //组密钥重新协商间隔。
+}lynq_wifi_ap_auth_t;
+
+
+
+
+
+typedef struct
+{
+char bssid[18];//接入点的 mac
+char essid[33]; //接入点的 SSID
+int signal; //信号强度(dbm)
+unsigned char signal_level; //接入点的信号格(0-4)
+int frequency; //工作频点(Hz)
+unsigned char channel; //接入点的信道
+lynq_wifi_auth_e auth; //接入点的认证信息,参考 lynq_wifi_auth_e 结构体说明
+lynq_wifi_auth_wpa_psk_e cipher; //接入点的加密类型,参考lynq_wifi_auth_wpa_psk_e结构体说明
+}lynq_wifi_sta_scan_info_t;
+
+
+typedef struct
+{
+char ssid[33];
+lynq_wifi_auth_e auth; //安全模式,参考表后说明
+lynq_wifi_auth_wpa_psk_e pairwise; //加密方式
+char passwd[64 + 1]; //密码
+} lynq_wifi_sta_param_t;
+
+typedef struct
+{
+char addr[16]; //IPv4 地址
+char netmask[16]; //子网掩码
+unsigned char subnet_bits; //子网掩码的位数,比如 255.255.255.0 是 24
+char gateway[16]; //网关
+char dnsp[16]; //主要的 DNS
+char dnss[16]; //次要的 DNS
+} lynq_wifi_net_addr_t;
+
+typedef struct
+{
+char addr[48]; //IPv6 地址
+char prefix[48]; //IPv6 子网掩码
+unsigned char prefix_bits; //IPv6 子网掩码的位数
+char gateway[48]; //IPv6 网关
+char dnsp[48]; //IPv6 主要的 DNS
+char dnss[48]; //IPv6 次要的 DNS
+} lynq_wifi_net_addr6_t;
+
+
+typedef struct
+{
+//lynq_wifi_station_status_e sta_status; //用于兼容回调 STA 模式的状态获取,API 获取时不被赋值
+lynq_wifi_sta_status_e status; //sta 的几种状态,参考表后
+char ifname[32]; //作为 sta 设备时名字
+char ap_bssid[18]; //连接的热点 MAC 地址
+//int rssi;
+unsigned char signal_level; //信号格,目前暂未支持
+unsigned char has_addr; //判断是否是 IPv4 地址
+lynq_wifi_net_addr_t addr[48]; // 需 先 判 断has_addr 是否为 1,具体参考 lynq_wifi_net_addr_t 结构体说明。
+unsigned char has_addr6; //判断是否是 IPv6 地址
+lynq_wifi_net_addr6_t addr6; // 需 先 判 断has_addr6 是否为 1,具体参考 lynq_wifi_net_addr6_t结构体说明
+lynq_wifi_reason_code_e reason_code; //错误原因,参考表后
+} lynq_wifi_sta_status_t;
+
+
+typedef struct {
+unsigned long long rx_packets; //对应 ifconfig wlan0-vxd 的 RX packets
+unsigned long long rx_bytes; //对应 ifconfig wlan0-vxd 的 RX bytes
+unsigned long long rx_errors; //对应 ifconfig wlan0-vxd 的 RX errors
+unsigned long long rx_dropped; //对应 ifconfig wlan0-vxd 的 RX dropped
+unsigned long long tx_packets; //对应 ifconfig wlan0-vxd 的 TX packets
+unsigned long long tx_bytes; //对应 ifconfig wlan0-vxd 的 TX bytes
+unsigned long long tx_errors; //对应 ifconfig wlan0-vxd 的 TX errors
+unsigned long long tx_dropped; //对应 ifconfig wlan0-vxd 的 TX dropped
+} lynq_wifi_pkt_stats_t;
+
+
+typedef struct {
+ int cnt; //搜索到的热点总数
+ lynq_wifi_sta_scan_info_t info[50]; //存储的热点信息
+} lynq_wifi_sta_scan_list_t;
+
+
+typedef struct {
+ lynq_wifi_event_type_e id;//事件说明。参考表后结构体说明
+ lynq_wifi_status_e status; //需要id为LYNQ_WIFI_EVENT_AP_STATION时,参考表后结构体说明
+ //lynq_wifi_station_status_e sta_status; //需要id为LYNQ_WIFI_EVENT_STA_STATUS时,STA模式下连接和断开的热点的值
+ lynq_wifi_sta_status_t sta_status_all;//需要id为LYNQ_WIFI_EVENT_STA_STATUS时获取具体的值
+} lynq_wifi_event_s;
+
+typedef struct
+{
+ lynq_wifi_status_e status; //AP状态,详细参考表后
+ char ifname[32]; //网口名
+ char bssid[18]; //AP的bssid
+}lynq_wifi_ap_status_t;
+
+
+
+
+typedef void (*lynq_wifi_event_handle)(lynq_wifi_event_s *event, void *arg);
+typedef void (*lynq_wifi_event_handle_sta)(lynq_wifi_sta_scan_list_t *event);
+
+
+
+int qser_wifi_enable(void);
+int qser_wifi_disable(void);
+int qser_wifi_work_mode_set(lynq_wifi_work_mode_e type);
+int qser_wifi_work_mode_get(lynq_wifi_work_mode_e *type);
+int qser_wifi_ap_ssid_set(lynq_wifi_ap_index_e idx, const char *ssid);
+int qser_wifi_ap_ssid_get(lynq_wifi_ap_index_e idx, char *ssid);
+int qser_wifi_ap_ssid_hide_set(lynq_wifi_ap_index_e idx,bool hide);
+int qser_wifi_ap_ssid_hide_get(lynq_wifi_ap_index_e idx,bool* hide);
+int qser_wifi_ap_mode_set(lynq_wifi_ap_index_e idx, lynq_wifi_mode_type_e mode);
+int qser_wifi_ap_mode_get(lynq_wifi_ap_index_e idx, lynq_wifi_mode_type_e* mode);
+int qser_wifi_ap_bandwidth_set(lynq_wifi_ap_index_e idx, lynq_wifi_bandwidth_type_e bandwidth);
+int qser_wifi_ap_bandwidth_get(lynq_wifi_ap_index_e idx, lynq_wifi_bandwidth_type_e *bandwidth);
+int qser_wifi_ap_channel_set(lynq_wifi_ap_index_e idx,const char* country_code, int channel);
+int qser_wifi_ap_channel_get(lynq_wifi_ap_index_e idx,char* country_code, int* channel);
+int qser_wifi_ap_auth_set(lynq_wifi_ap_index_e idx, lynq_wifi_auth_e auth_mode, const char * auth_passwd);
+int qser_wifi_ap_auth_get(lynq_wifi_ap_index_e idx, lynq_wifi_auth_e *auth_mode, char * auth_passwd);
+int qser_wifi_ap_auth_get_s(lynq_wifi_ap_index_e idx, lynq_wifi_ap_auth_t* auth_mode);
+int qser_wifi_ap_max_sta_set(lynq_wifi_ap_index_e idx, int max_sta_num);
+int qser_wifi_ap_max_sta_get(lynq_wifi_ap_index_e idx, int* max_sta_num);
+int qser_wifi_ap_start(lynq_wifi_ap_index_e idx);
+int qser_wifi_ap_stop(lynq_wifi_ap_index_e idx);
+int qser_wifi_ap_restart(lynq_wifi_ap_index_e idx);
+
+
+int qser_wifi_sta_param_set(lynq_wifi_sta_param_t *param_stat);
+int qser_wifi_sta_param_get(lynq_wifi_sta_param_t *param_stat);
+int qser_wifi_sta_start(void);
+int qser_wifi_sta_stop(void);
+int qser_wifi_sta_get_status(lynq_wifi_sta_status_t *status_stat);
+int qser_wifi_register_handle(lynq_wifi_event_handle event_handle, lynq_wifi_event_handle_sta event_handle_sta, void *arg);
+int qser_wifi_sta_start_scan(void);
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/mbtk/include/mbtk/ds_ASBuffer.h b/mbtk/include/mbtk/ds_ASBuffer.h
new file mode 100755
index 0000000..492b436
--- /dev/null
+++ b/mbtk/include/mbtk/ds_ASBuffer.h
@@ -0,0 +1,268 @@
+/*==============================================================================
+
+ ds_ASBuffer.h
+
+GENERAL DESCRIPTION
+ A buffer class with utility functions for parsing raw bytes.
+
+EXTERNALIZED FUNCTIONS
+
+INITIALIZATION AND SEQUENCING REQUIREMENTS
+
+ Copyright (c) 2014 by Qualcomm Technologies Incorporated. All Rights Reserved.
+==============================================================================*/
+
+/*==============================================================================
+ 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
+-------- --- ----------------------------------------------------------
+04/21/14 ml Created file/Initial version.
+==============================================================================*/
+
+#ifndef __DS_AS_BUFFER_H__
+#define __DS_AS_BUFFER_H__
+
+//#include "comdef.h"
+#include "mbtk_type.h"
+class ASString;
+
+
+/*==============================================================================
+CLASS ASBuffer
+
+DESCRIPTION
+ A buffer class with utility functions for parsing raw bytes.
+==============================================================================*/
+class ASBuffer
+{
+public:
+ /*===========================================================================
+ FUNCTION ASBuffer CONSTRUCTOR
+
+ DESCRIPTION
+ Creates a new ASBuffer.
+
+ DEPENDENCIES
+ capacity - The initial buffer capacity to set.
+
+ SIDE EFFECTS
+ None
+ ===========================================================================*/
+ ASBuffer();
+ ASBuffer(uint32 capacity);
+
+ ASBuffer(ASBuffer &buf);
+ ASBuffer(const ASBuffer &buf);
+ ASBuffer(const uint8* buf, uint32 capacity);
+
+ ~ASBuffer();
+
+
+ ASBuffer& operator=(const ASBuffer &rhs);
+
+ /*============================================================================
+ FUNCTION ASBuffer::content
+
+ DESCRIPTION
+ Returns a pointer to the buffer content
+
+ PARAMETERS
+ None
+
+ DEPENDENCIES
+ None
+
+ SIDE EFFECTS
+ None
+ ============================================================================*/
+ const uint8* content() const;
+
+
+
+ /*============================================================================
+ FUNCTION ASBuffer::non_const_content
+
+ DESCRIPTION
+ Returns a pointer to the buffer content. Use this function ONLY if you need
+ a non-const version and it is guaranteed that the returned pointer will
+ never be modified.
+
+ Note: Workaround function for MD5 auth-int. Otherwise shouldn't be used.
+
+ PARAMETERS
+ None
+
+ DEPENDENCIES
+ None
+
+ SIDE EFFECTS
+ None
+ ============================================================================*/
+ uint8* non_const_content();
+
+
+
+ /*============================================================================
+ FUNCTION ASBuffer::c_str
+
+ DESCRIPTION
+ Returns a pointer to the buffer content. This assumes the buffer content is
+ in c-string format
+
+ PARAMETERS
+ None
+
+ DEPENDENCIES
+ None
+
+ SIDE EFFECTS
+ None
+ ============================================================================*/
+ const char* c_str() const;
+
+
+
+ /*============================================================================
+ FUNCTION ASBuffer::size
+
+ DESCRIPTION
+ Returns the size of the buffer
+
+ PARAMETERS
+ None
+
+ DEPENDENCIES
+ None
+
+ SIDE EFFECTS
+ None
+ ============================================================================*/
+ uint32 size() const;
+
+
+
+ /*============================================================================
+ FUNCTION ASBuffer::empty
+
+ DESCRIPTION
+ Returns true if the buffer is empty
+
+ PARAMETERS
+ None
+
+ DEPENDENCIES
+ None
+
+ SIDE EFFECTS
+ None
+ ============================================================================*/
+ bool empty() const;
+
+
+
+ /*============================================================================
+ FUNCTION ASBuffer::error
+
+ DESCRIPTION
+ Returns true if the buffer is in error status due to internal memory
+ allocation failure.
+
+ This can happen when
+ - Constructor fails to allocate memory for the new buffer
+ - Append requires to resize the buffer but fails
+
+ PARAMETERS
+ None
+
+ DEPENDENCIES
+ None
+
+ SIDE EFFECTS
+ None
+ ============================================================================*/
+ bool error() const;
+
+
+
+ /*============================================================================
+ FUNCTION ASBuffer::append
+
+ DESCRIPTION
+ Appends the given data to the buffer. Returns true if append is successful,
+ false if append fails.
+
+ PARAMETERS
+ [In] append_buffer - The data to append
+ [In] size - The number of bytes to append
+
+ DEPENDENCIES
+ None
+
+ SIDE EFFECTS
+ None
+ ============================================================================*/
+ bool append(const uint8* append_buffer, const uint32 size);
+ bool append(const char append_buffer);
+ bool append(const char* append_buffer);
+ bool append(const char* append_buffer, const uint32 size);
+ bool append(const ASBuffer& append_buffer);
+ bool append(const ASString& append_buffer); // temp
+
+
+ /*============================================================================
+ FUNCTION ASBuffer::clear
+
+ DESCRIPTION
+ Returns true if the buffer is in error status due to internal memory
+ allocation failure.
+
+ This can happen when
+ - Constructor fails to allocate memory for the new buffer
+ - Append requires to resize the buffer but fails
+
+ PARAMETERS
+ None
+
+ DEPENDENCIES
+ None
+
+ SIDE EFFECTS
+ None
+ ============================================================================*/
+ void clear();
+
+
+
+private:
+ /*============================================================================
+ FUNCTION ASBuffer::init
+
+ DESCRIPTION
+ Initialize buffer
+
+ PARAMETERS
+ None
+
+ DEPENDENCIES
+ None
+
+ SIDE EFFECTS
+ None
+ ============================================================================*/
+ void init();
+ bool increment_buffer_capacity(const uint32 req_size);
+
+
+ uint8* buffer; // Buffer object. Memory dynamically allocated as necessary
+ uint32 buffer_size;
+ uint32 buffer_capacity;
+ bool error_status; // true if error, else false
+};
+
+
+
+#endif /* __DS_AS_BUFFER_H__ */
diff --git a/mbtk/include/mbtk/ds_ASString.h b/mbtk/include/mbtk/ds_ASString.h
new file mode 100755
index 0000000..02319ca
--- /dev/null
+++ b/mbtk/include/mbtk/ds_ASString.h
@@ -0,0 +1,265 @@
+/*==============================================================================
+
+ ds_ASString.h
+
+GENERAL DESCRIPTION
+ A string class with utility functions for parsing AS.
+
+EXTERNALIZED FUNCTIONS
+
+INITIALIZATION AND SEQUENCING REQUIREMENTS
+
+ Copyright (c) 2014 by Qualcomm Technologies Incorporated. All Rights Reserved.
+==============================================================================*/
+
+/*==============================================================================
+ 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
+-------- --- ----------------------------------------------------------
+04/21/14 ml Created file/Initial version.
+==============================================================================*/
+#ifndef DS_AS_STRING_H
+#define DS_AS_STRING_H
+
+//#include "comdef.h"
+#include "mbtk_type.h"
+
+/*==============================================================================
+CLASS ASString
+
+DESCRIPTION
+ A string class with utility functions for parsing AS.
+==============================================================================*/
+class ASString
+{
+public:
+ /*===========================================================================
+ FUNCTION ASString CONSTRUCTOR
+
+ DESCRIPTION
+ Creates a new ASString. Default constructor will create an empty string.
+ The other constructors will make a copy of the given string.
+
+ DEPENDENCIES
+ None
+
+ SIDE EFFECTS
+ None
+ ===========================================================================*/
+ ASString();
+ ASString(const char* src);
+ ASString(const char* src, uint32 len);
+
+ // copy constructor
+ ASString(ASString& src);
+ ASString(const ASString& src);
+
+ ~ASString();
+
+
+ ASString& operator=(const ASString& rhs);
+ ASString& operator=(const char* rhs);
+ char operator[](const int index) const;
+ char& operator[](const int index);
+
+
+ /*============================================================================
+ FUNCTION ASString::c_str
+
+ DESCRIPTION
+ Returns the raw c-string
+
+ PARAMETERS
+ None
+
+ DEPENDENCIES
+ None
+
+ SIDE EFFECTS
+ None
+ ============================================================================*/
+ const char* c_str() const;
+
+ /*============================================================================
+ FUNCTION ASString::size
+ FUNCTION ASString::length
+
+ DESCRIPTION
+ Returns the length of the string
+
+ PARAMETERS
+ None
+
+ DEPENDENCIES
+ None
+
+ SIDE EFFECTS
+ None
+ ============================================================================*/
+ uint32 size() const;
+ uint32 length() const;
+
+ /*============================================================================
+ FUNCTION ASString::empty
+
+ DESCRIPTION
+ Returns true if the string is empty or NULL
+
+ PARAMETERS
+ None
+
+ DEPENDENCIES
+ None
+
+ SIDE EFFECTS
+ None
+ ============================================================================*/
+ bool empty() const;
+
+ /*============================================================================
+ FUNCTION ASString::remove_trailing_spaces
+
+ DESCRIPTION
+ Removes all whiltespace, including tabs and newlines, at the end of the string.
+
+ PARAMETERS
+ None
+
+ DEPENDENCIES
+ None
+
+ SIDE EFFECTS
+ None
+ ============================================================================*/
+ void remove_trailing_spaces();
+
+ /*============================================================================
+ FUNCTION ASString::resolve_xml_escapes
+
+ DESCRIPTION
+ Replaces XML escape strings with the corresponding character.
+
+ PARAMETERS
+ None
+
+ DEPENDENCIES
+ None
+
+ SIDE EFFECTS
+ None
+ ============================================================================*/
+ bool resolve_xml_escapes();
+
+ /*============================================================================
+ FUNCTION ASString::to_lower
+
+ DESCRIPTION
+ Converts all characters in the string to lower case.
+
+ PARAMETERS
+ None
+
+ DEPENDENCIES
+ None
+
+ SIDE EFFECTS
+ None
+ ============================================================================*/
+ void to_lower();
+
+ /*============================================================================
+ FUNCTION ASString::limit_cmp
+
+ DESCRIPTION
+ Partial string compare up to len. Returns true if same, else false.
+
+ PARAMETERS
+ [In] cstr - The string to compare
+ [In] len - The number of characters to compare.
+
+ DEPENDENCIES
+ None
+
+ SIDE EFFECTS
+ None
+ ============================================================================*/
+ bool limit_cmp(const char* cstr, const uint32 len) const;
+
+ /*============================================================================
+ FUNCTION ASString::append
+
+ DESCRIPTION
+ Appends the given string to the string it holds.
+
+ PARAMETERS
+ [In] append_str - The string to append
+ [In] len - The number of characters to append
+
+ DEPENDENCIES
+ None
+
+ SIDE EFFECTS
+ None
+ ============================================================================*/
+ void append(const char* append_str);
+ void append(const char* append_str, const uint32 len);
+ void append(const ASString& append_str);
+
+protected:
+ /*============================================================================
+ FUNCTION ASString::copy_string
+
+ DESCRIPTION
+ Partial string compare up to len. Returns true if same, else false.
+
+ PARAMETERS
+ [In] src - The string to copy
+ [In] len - The number of characters to copy
+
+ DEPENDENCIES
+ None
+
+ SIDE EFFECTS
+ None
+ ============================================================================*/
+ void copy_string(const char* src, uint32 len);
+
+ char* str; // C-string object. Memory dynamically allocated as necessary
+};
+
+
+
+/*============================================================================
+FUNCTION operator==
+FUNCTION operator!=
+FUNCTION operator<
+FUNCTION operator>
+
+DESCRIPTION
+ Compares the two strings and returns true/false based on the operator. The
+ comparison will be case insensitive.
+
+PARAMETERS
+ [In] lhs - The string to compare
+ [In] rhs - The other string to compare
+
+DEPENDENCIES
+ None
+
+SIDE EFFECTS
+ None
+============================================================================*/
+bool operator== (const ASString& lhs, const ASString& rhs);
+bool operator!= (const ASString& lhs, const ASString& rhs);
+
+bool operator== (const ASString& lhs, const char* rhs);
+bool operator!= (const ASString& lhs, const char* rhs);
+
+bool operator< (const ASString& lhs, const ASString& rhs);
+bool operator> (const ASString& lhs, const ASString& rhs);
+
+#endif /* DS_AS_STRING_H */
diff --git a/mbtk/include/mbtk/mbtk_adc.h b/mbtk/include/mbtk/mbtk_adc.h
new file mode 100755
index 0000000..27cc783
--- /dev/null
+++ b/mbtk/include/mbtk/mbtk_adc.h
@@ -0,0 +1,50 @@
+/*
+ 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__
+
+#define ADC_DEVICE_802 "/sys/devices/soc.0/d4000000.apb/pxa2xx-i2c.2/i2c-2/2-0030/pm802-bat/adc"
+#define ADC_DEVICE_803 "/sys/kernel/debug/adc"
+#define ADC_DEVICE_PMIC802 "/sys/devices/platform/asr-adc/pm80x_adc"
+#define ADC_DEVICE_AUX "/sys/devices/platform/asr-adc/aux_adc"
+
+/*
+* MBTK ADC define.
+*/
+typedef enum {
+ MBTK_ADC0 = 0, /* ADC 0 */
+ MBTK_ADC1, /* ADC 1 */
+ MBTK_ADC2 /* ADC 2 */
+} mbtk_adc_enum;
+
+
+/*===========================================================================
+FUNCTION mbtk_adc_get
+
+DESCRIPTION:
+ Get ADC's value.
+
+PARAMETERS:
+ adc_dev : Refer to : ADC_DEVICE_802/ADC_DEVICE_803/ADC_DEVICE_PMIC802/ADC_DEVICE_AUX
+ adc [IN]: ADC path, refer to mbtk_adc_enum.
+
+RETURN VALUE:
+ int : ADC value.
+
+===========================================================================*/
+int mbtk_adc_get(const char* adc_dev, mbtk_adc_enum adc);
+int mbtk_adc_close(const char* adc_dev);
+
+
+#endif /* __MBTK_ADC_H__ */
+
diff --git a/mbtk/include/mbtk/mbtk_alarm.h b/mbtk/include/mbtk/mbtk_alarm.h
new file mode 100755
index 0000000..346a0b9
--- /dev/null
+++ b/mbtk/include/mbtk/mbtk_alarm.h
@@ -0,0 +1,43 @@
+/*
+* mbtk_alarm.h
+* MBTK alarm API.
+*
+* Author : lb
+* Date : 2023/11/17 16:20:43
+*/
+#ifndef _MBTK_ALARM_H
+#define _MBTK_ALARM_H
+
+
+/*===========================================================================
+FUNCTION mbtk_wakealarm_set()
+
+DESCRIPTION:
+ Set sleep wake alarm.
+
+PARAMETERS:
+ time_sec [IN]: Sleep wake-up time in second.
+
+RETURN VALUE:
+ int : Return 0 if success, other for failures.
+
+===========================================================================*/
+int mbtk_wakealarm_set(unsigned long time_sec);
+
+/*===========================================================================
+FUNCTION mbtk_poweralarm_set()
+
+DESCRIPTION:
+ Set shutdown alarm clock.
+
+PARAMETERS:
+ time_sec [IN]: Shutdown wake-up time in second.
+
+RETURN VALUE:
+ int : Return 0 if success, other for failures.
+
+===========================================================================*/
+int mbtk_poweralarm_set(unsigned long time_sec);
+
+
+#endif /* _MBTK_ALARM_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..d20d005
--- /dev/null
+++ b/mbtk/include/mbtk/mbtk_audio.h
@@ -0,0 +1,268 @@
+/**
+ * \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;
+
+// 0-Tx_CodecGain, 1-Tx_DSPGain, 2-Rx_CodecGain, 3-Rx_DSPGain
+typedef enum {
+ AUDIO_GAIN_TYPE_TX_CODECGAIN = 0,
+ AUDIO_GAIN_TYPE_TX_DSPGAIN,
+ AUDIO_GAIN_TYPE_RX_CODECGAIN,
+ AUDIO_GAIN_TYPE_RX_DSPGAIN
+} mbtk_audio_gain_type_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);
+void mbtk_audio_ubus_gain_set(mbtk_audio_gain_type_enum type, uint16 *gain, int gain_num);
+void mbtk_audio_ubus_reg_set(int reg_addr, int reg_value);
+
+/**
+ * @brief mbtk_audio_switch_pcm
+ *
+ * @details Turn on/off MSA PCM
+ *
+ * @param param
+ * "param0":UINT32 mode
+ * 0: Turn off MSA PCM
+ * 1: Turn on MSA PCM as NB PCM(i.e. 8KHz sample rate)
+ * 2: Turn on MSA PCM as WB PCM(i.e. 16KHz sample rate)
+ * @return return type
+ */
+void mbtk_audio_switch_pcm(int mode);
+
+/**
+ * @brief mbtk_audio_mode_set
+ *
+ * @details audio_mode_set
+ *
+ * @param param
+ * "param0": UINT32
+ * typedef enum {
+ * AUDIO_MODE_INVALID = -2,
+ * AUDIO_MODE_CURRENT = -1,
+ * AUDIO_MODE_NORMAL = 0,
+ * AUDIO_MODE_RINGTONE = 1,
+ * AUDIO_MODE_IN_CALL = 2,
+ * AUDIO_MODE_IN_COMMUNICATION=3,
+ * AUDIO_MODE_IN_VT_CALL= 4,
+ * AUDIO_MODE_CNT,
+ * AUDIO_MODE_MAX = AUDIO_MODE_CNT-1,
+ * } audio_mode_
+ * @return return type
+ */
+void mbtk_audio_mode_set(int mode);
+
+/**
+ * @brief mbtk_audio_path_enable
+ *
+ * @details first set the audio_mode_set ,then need set it
+ *
+ * @param param
+ * "param0": UINT32
+ * 1: enable
+ * 1: disable
+ * @return return type
+ */
+void mbtk_audio_path_enable(int mode);
+
+int mbtk_audio_get_status(void* hdl);
+
+
+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_audio2.h b/mbtk/include/mbtk/mbtk_audio2.h
new file mode 100755
index 0000000..c17efc2
--- /dev/null
+++ b/mbtk/include/mbtk/mbtk_audio2.h
@@ -0,0 +1,100 @@
+/*
+* mbtk_audio2.h
+*
+* MBTK audio API for asr1806.
+*
+* Author : lb
+* Date : 2023/12/20 10:12:15
+*/
+#ifndef _MBTK_AUDIO2_H
+#define _MBTK_AUDIO2_H
+#include "mbtk_type.h"
+
+#define MBTK_PCM_NB_BUF_SIZE 320
+#define MBTK_PCM_WB_BUF_SIZE 640
+
+typedef void (*mbtk_recorder_callback_func)(void *data, uint32 data_len);
+
+typedef void (*mbtk_audio_pa_switch_func)(bool open);
+
+typedef void (*mbtk_audio_volume_set_func)();
+
+
+typedef enum {
+ MBTK_AUDIO_DIRECTION_OUTPUT = 0, // Play
+ MBTK_AUDIO_DIRECTION_INPUT // Recorder
+} mbtk_audio_direction_enum;
+
+typedef enum {
+ MBTK_AUDIO_SAMPLE_RATE_8000 = 0,
+ MBTK_AUDIO_SAMPLE_RATE_16000
+} mbtk_audio_sample_rate_enum;
+
+int mbtk_audio_pcm_init();
+
+void mbtk_audio_pa_func_set(mbtk_audio_pa_switch_func pa_switch_func);
+
+void mbtk_audio_volume_set_func_set(mbtk_audio_volume_set_func volume_set_func);
+
+int mbtk_audio_pcm_sample_rate_set(mbtk_audio_sample_rate_enum sample_rate);
+
+// Send PCM to location SPK.
+int mbtk_audio_pcm_play_start();
+
+int mbtk_audio_pcm_play_data_send(const void* data,uint32 data_len);
+
+int mbtk_audio_pcm_play_stop();
+
+// Get PCM from location MIC.
+int mbtk_audio_pcm_recorder_start(mbtk_recorder_callback_func recorder_cb);
+
+int mbtk_audio_pcm_recorder_pause();
+
+int mbtk_audio_pcm_recorder_resume();
+
+int mbtk_audio_pcm_recorder_stop();
+
+int mbtk_audio_pcm_deinit();
+
+int mbtk_audio_wav_init();
+
+int mbtk_audio_wav_play_start(const void *wav_file);
+
+int mbtk_audio_wav_stream_play_start(const unsigned char *pcm_data, int data_size, int sample_rate, int num_channels);
+
+int mbtk_audio_wav_play_pause();
+
+int mbtk_audio_wav_play_resume();
+
+int mbtk_audio_wav_play_stop();
+
+int mbtk_audio_wav_recorder_start(const void *wav_file, mbtk_audio_sample_rate_enum sample_rate);
+
+int mbtk_audio_wav_recorder_pause();
+
+int mbtk_audio_wav_recorder_resume();
+
+int mbtk_audio_wav_recorder_stop();
+
+int mbtk_audio_wav_deinit();
+
+// Send PCM to the other end of the voice.
+int mbtk_audio_voice_pcm_playback_start();
+
+// Get PCM from the other end of the voice.
+int mbtk_audio_voice_pcm_record_start();
+
+/**
+ * device: UINT32
+ * 0: earpiece
+ * 1: speaker
+ * 2: headset
+ * enable_state: UINT32
+ * 0: close
+ * 1: open
+ */
+int mbtk_audio_set_loopback_enable_state(int device, int enable_state);
+int mbtk_audio_get_loopback_enable_state(int *device, int *enable_state);
+
+
+#endif /* _MBTK_AUDIO2_H */
diff --git a/mbtk/include/mbtk/mbtk_audio_gain.h b/mbtk/include/mbtk/mbtk_audio_gain.h
new file mode 100755
index 0000000..aa161d3
--- /dev/null
+++ b/mbtk/include/mbtk/mbtk_audio_gain.h
@@ -0,0 +1,89 @@
+/*
+* mbtk_audio_gain.h
+*
+* MBTK audio gain for nvm : /NVM/audio_gain.nvm.
+*
+* Author : lb
+* Date : 2024/3/1 16:04:46
+*/
+#ifndef _MBTK_AUDIO_GAIN_H
+#define _MBTK_AUDIO_GAIN_H
+#include "mbtk_type.h"
+
+#define MBTK_AUDIO_GAIN_ADD_START 0x0108
+#define MBTK_AUDIO_GAIN_MIN -36
+#define MBTK_AUDIO_GAIN_MAX 12
+#define CONFIG_DSPGAIN_MUTE_ON (-100)
+#define CONFIG_DSPGAIN_MUTE_OFF (100)
+
+#define MBTK_AUDIO_GAIN_PATH "/NVM/audio_gain.nvm"
+
+typedef enum
+{
+ CONFIG_DSPGAIN_TX = 0, /* TX: near to far end */
+ CONFIG_DSPGAIN_RX, /* RX: far to near end */
+// CONFIG_DSPGAIN_SIDETONE,
+// CONFIG_DSPGAIN_NUMBER = CONFIG_DSPGAIN_SIDETONE
+} CONFIG_DSPGAIN_Direction;
+
+typedef enum
+{
+ VC_HANDSET = 0,
+ VC_HANDSFREE,
+ VC_HEADSET,
+ VC_HEADPHONE,
+
+ VC_HEAD_NUM
+} AUDIO_PROFILE_ID;
+
+typedef enum
+{
+ AUDIOHAL_SPK_MUTE = 0,
+ AUDIOHAL_SPK_VOL_1,
+ AUDIOHAL_SPK_VOL_2,
+ AUDIOHAL_SPK_VOL_3,
+ AUDIOHAL_SPK_VOL_4,
+ AUDIOHAL_SPK_VOL_5,
+ AUDIOHAL_SPK_VOL_6,
+ AUDIOHAL_SPK_VOL_7,
+ AUDIOHAL_SPK_VOL_8,
+ AUDIOHAL_SPK_VOL_9,
+ AUDIOHAL_SPK_VOL_10,
+ AUDIOHAL_SPK_VOL_QTY //11
+} AUDIOHAL_SPK_LEVEL_T;
+
+typedef struct
+{
+ uint16 PGA_Stage1;
+ uint16 PGA_Stage2;
+ uint16 ADC_DigGain;
+ uint16 SideTone_Gain;
+ uint16 Reserved1;
+ uint16 Reserved2;
+} ACMCodec_GainInT;
+
+typedef struct
+{
+ uint16 DAC_DigGain;
+ uint16 DAC_Gain;
+ uint16 RCV_Gain;
+ uint16 ClassG_Mode;
+ uint16 ClassD_Gain;
+ uint16 Reserved;
+} ACMCodec_GainOutT;
+
+typedef struct{
+ AUDIO_PROFILE_ID Profile_id;
+ uint16 CodecControl;
+ ACMCodec_GainInT Tx_CodecGain; //TX has the same gain for every volume
+ int16 Tx_DSPGain; //TX has the same gain for every volume, High 8bits: WB gain, Low 8bits: NB gain
+ ACMCodec_GainOutT Rx_CodecGain[AUDIOHAL_SPK_VOL_QTY + 1];
+ int16 Rx_DSPGain[AUDIOHAL_SPK_VOL_QTY + 1]; //High 8bits: WB gain, Low 8bits: NB gain
+ int16 Rx_DSPSideToneGain; //High 8bits: WB gain, Low 8bits: NB gain
+} ACMCodec_GainT;
+
+int mbtk_dsp_gain_set(CONFIG_DSPGAIN_Direction dir, int gain);
+
+int mbtk_dsp_gain_get(int *rx_gain, int *tx_gain);
+
+#endif /* _MBTK_AUDIO_GAIN_H */
diff --git a/mbtk/include/mbtk/mbtk_audio_ubus.h b/mbtk/include/mbtk/mbtk_audio_ubus.h
new file mode 100755
index 0000000..f2a6fdc
--- /dev/null
+++ b/mbtk/include/mbtk/mbtk_audio_ubus.h
@@ -0,0 +1,55 @@
+/*
+* mbtk_audio_ubus.h
+*
+* MBTK audio ubus client API header.
+*
+* Author : lb
+* Date : 2024/3/18 16:04:33
+*/
+#ifndef _MBTK_AUDIO_UBUS_H
+#define _MBTK_AUDIO_UBUS_H
+
+
+int mbtk_audio_ubus_init();
+
+int mbtk_audio_ubus_deinit();
+
+/**
+* mode:
+* AUDIO_MODE_INVALID = -2,
+* AUDIO_MODE_CURRENT = -1,
+* AUDIO_MODE_NORMAL = 0,
+* AUDIO_MODE_RINGTONE = 1,
+* AUDIO_MODE_IN_CALL = 2,
+* AUDIO_MODE_IN_COMMUNICATION=3,
+* AUDIO_MODE_IN_VT_CALL= 4,
+* AUDIO_MODE_CNT,
+* AUDIO_MODE_MAX = AUDIO_MODE_CNT-1
+ */
+int mbtk_audio_mode_set(int mode);
+
+/**
+ * device: UINT32
+ * 0: earpiece
+ * 1: speaker
+ * 2: headset
+ */
+int mbtk_audio_loopback_start(int device);
+
+int mbtk_audio_loopback_stop();
+/**
+ * @brief mbtk_audio_dsp_gain_set
+ *
+ * @details dsp gain set
+ *
+ * @param param
+ * type: 0:tx
+ * 0: tx
+ * 1: rx
+ * gain: -36~12 db
+
+ * @return return
+ */
+int mbtk_audio_dsp_gain_set(int type, int gain);
+
+#endif /* _MBTK_AUDIO_UBUS_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.h b/mbtk/include/mbtk/mbtk_device.h
new file mode 100755
index 0000000..f7e7cef
--- /dev/null
+++ b/mbtk/include/mbtk/mbtk_device.h
@@ -0,0 +1,168 @@
+/*
+* mbtk_device.h
+*
+* MBTK device_info partition data header.
+*
+* Author : lb
+* Date : 2023/12/30 11:36:35
+*/
+#ifndef _MBTK_DEVICE_V2_H
+#define _MBTK_DEVICE_V2_H
+//#include "mbtk_type.h"
+
+#define MBTK_DEVICE_INFO_PARTITION_NAME "device_info"
+#define MBTK_DEVICE_INFO_PARTITION_TAG 0x87878787
+#define MBTK_DEVICE_INFO_CURR_VERSION 2
+
+#define MBTK_DEV_INFO_PARTITION_ADDR 0x02A20000
+
+// 78,147,482,134742231
+#define MBTK_BAND_ALL_GSM_DEFAULT 78 // GSM : ASR default.
+#define MBTK_BAND_ALL_WCDMA_DEFAULT 147 // WCDMA : ASR default.
+#define MBTK_BAND_ALL_TDLTE_DEFAULT 482 // TDD-LTE : ASR default.
+#define MBTK_BAND_ALL_FDDLTE_DEFAULT 134742231 // FDD-LTE : ASR default.
+#define MBTK_BAND_ALL_EXT_LTE_DEFAULT 0 // EXT-LTE
+#define MBTK_BAND_ALL_NR_3_DEFAULT 0
+#define MBTK_BAND_ALL_NR_2_DEFAULT 24576 // n78/n79
+#define MBTK_BAND_ALL_NR_1_DEFAULT 256 // n41
+#define MBTK_BAND_ALL_NR_0_DEFAULT 134217877 // n1/n3/n5/n8/n28
+
+#define MBTK_BAND_CN_GSM_DEFAULT 11 // GSM : B3/B8 (PGSM 900/DCS GSM 1800/EGSM 900)
+#define MBTK_BAND_CN_WCDMA_DEFAULT 145 // WCDMA : B1/B5/B8
+#define MBTK_BAND_CN_TDLTE_DEFAULT 482 // TDD-LTE : B34/B38/B39/B40/B41
+#define MBTK_BAND_CN_FDDLTE_DEFAULT 149 // FDD-LTE : B1/B3/B5/B8
+#define MBTK_BAND_CN_EXT_LTE_DEFAULT 0 // EXT-LTE
+#define MBTK_BAND_CN_NR_3_DEFAULT 0
+#define MBTK_BAND_CN_NR_2_DEFAULT 24576 // n78/n79
+#define MBTK_BAND_CN_NR_1_DEFAULT 384 // n40/n41
+#define MBTK_BAND_CN_NR_0_DEFAULT 134217877 // n1/n3/n5/n8/n28
+
+#define MBTK_BAND_EU_GSM_DEFAULT 11 // GSM : B3/B8 (PGSM 900/DCS GSM 1800/EGSM 900)
+#define MBTK_BAND_EU_WCDMA_DEFAULT 145 // WCDMA : B1/B5/B8
+#define MBTK_BAND_EU_TDLTE_DEFAULT 416 // TDD-LTE : B38/B40/B41
+#define MBTK_BAND_EU_FDDLTE_DEFAULT 134742229 // FDD-LTE : B1/B3/B5/B7/B8/B20/B28
+#define MBTK_BAND_EU_EXT_LTE_DEFAULT 0 // EXT-LTE
+#define MBTK_BAND_EU_NR_3_DEFAULT 0
+#define MBTK_BAND_EU_NR_2_DEFAULT 12352 // n71/n77/n78
+#define MBTK_BAND_EU_NR_1_DEFAULT 416 // n38/n40/n41
+#define MBTK_BAND_EU_NR_0_DEFAULT 134742229 // n1/n3/n5/n7/n8/n20/n28
+
+#define MBTK_BAND_SA_GSM_DEFAULT 79 // GSM : B2/B3/B5/B8(GSM 850/PGSM 900/EGSM 900/DCS GSM 1800/PCS GSM 1900)
+#define MBTK_BAND_SA_WCDMA_DEFAULT 155 // WCDMA : B1/B2/B4/B5/B8
+#define MBTK_BAND_SA_TDLTE_DEFAULT 128 // TDD-LTE : B40
+#define MBTK_BAND_SA_FDDLTE_DEFAULT 134217951 // FDD-LTE : B1/B2/B3/B4/B5/B7/B8/B28
+#define MBTK_BAND_SA_EXT_LTE_DEFAULT 2 // EXT-LTE : B66
+#define MBTK_BAND_SA_NR_3_DEFAULT MBTK_BAND_ALL_NR_3_DEFAULT
+#define MBTK_BAND_SA_NR_2_DEFAULT MBTK_BAND_ALL_NR_2_DEFAULT
+#define MBTK_BAND_SA_NR_1_DEFAULT MBTK_BAND_ALL_NR_1_DEFAULT
+#define MBTK_BAND_SA_NR_0_DEFAULT MBTK_BAND_ALL_NR_0_DEFAULT
+
+#define MBTK_DEVICE_INFO_ITEM_STR_BASIC "BASIC"
+#define MBTK_DEVICE_INFO_ITEM_STR_FOTA "FOTA"
+#define MBTK_DEVICE_INFO_ITEM_STR_MODEM "MODEM"
+#define MBTK_DEVICE_INFO_ITEM_STR_LOG "LOG"
+
+#define MBTK_DEVICE_INFO_ITEM_ADDR_BASIC 0x100 // Header is 0x100
+#define MBTK_DEVICE_INFO_ITEM_ADDR_FOTA 0x500 // Basic is 1k
+#define MBTK_DEVICE_INFO_ITEM_ADDR_MODEM 0x900 // Fota is 1k
+#define MBTK_DEVICE_INFO_ITEM_ADDR_LOG 0xD00 // Modem is 1k
+
+#define MBTK_NET_SUPPORT_2G (1)
+#define MBTK_NET_SUPPORT_3G (1<<1)
+#define MBTK_NET_SUPPORT_4G (1<<2)
+#define MBTK_NET_SUPPORT_5G (1<<3)
+
+typedef enum {
+ MBTK_DEVICE_INFO_ITEM_BASIC = 0,
+ MBTK_DEVICE_INFO_ITEM_FOTA,
+ MBTK_DEVICE_INFO_ITEM_MODEM,
+ MBTK_DEVICE_INFO_ITEM_LOG,
+
+ MBTK_DEVICE_INFO_ITEM_NUM
+} mbtk_device_info_item_enum;
+
+typedef struct {
+ mbtk_device_info_item_enum item;
+ uint32 addr;
+} mbtk_device_info_item_header_t;
+
+typedef struct {
+ uint32 tag;
+ uint32 version; // Default : 0x01
+ uint32 item_count;
+ mbtk_device_info_item_header_t item_header[MBTK_DEVICE_INFO_ITEM_NUM];
+} mbtk_device_info_header_t;
+
+typedef enum {
+ MBTK_REBOOT_FLAG_NORMAL = 0,
+ MBTK_REBOOT_FLAG_DOWNLOAD,
+ MBTK_REBOOT_FLAG_POWER_OFF, //Power off and restart
+ MBTK_REBOOT_FLAG_HARDWARE, //Hardware restart
+ MBTK_REBOOT_FLAG_COMMAND, //"reboot" "reboot -f" Command restart
+ MBTK_REBOOT_FLAG_ABNORMAL, //Abnormal restart
+ MBTK_REBOOT_FLAG_UNKNOWN, //unknown restart
+} mbtk_device_info_reboot_flag_enum;
+
+typedef struct {
+ uint8 name[16];
+ uint32 version; // Default : 0x01
+ uint8 project[16]; // T108 / L508_X6
+ uint8 project_cust[16]; // T108_C1 / L508_X6_C1 (Refer to: Custom_Model in blf file.)
+ uint32 ab_support; // 1 for ab
+ mbtk_device_info_reboot_flag_enum reboot_flag;
+ uint8 revision_out[48]; // L508_X6v01.01b04.00
+ uint8 revision_in[64];
+ uint8 build_time[64];
+ uint8 asr_baseline[64];
+} mbtk_device_info_basic_t;
+
+typedef struct {
+ uint8 name[16];
+ uint32 version; // Default : 0x01
+ uint32 state; //
+} mbtk_device_info_fota_t;
+
+typedef enum {
+ MBTK_MODEM_BAND_AREA_ALL,
+ MBTK_MODEM_BAND_AREA_CN,
+ MBTK_MODEM_BAND_AREA_EU,
+ MBTK_MODEM_BAND_AREA_SA
+} mbtk_modem_band_area_enum;
+
+typedef struct {
+ uint8 name[16];
+ uint32 version; // Default : 0x01
+ mbtk_modem_band_area_enum band_area;
+ uint32 net_pref; // Refor to : mbtk_net_pref_enum
+ uint32 net_support; // 1:GSM 2:WCDMA 4:LTE 8:NR
+ uint32 band_gsm;
+ uint32 band_wcdma;
+ uint32 band_tdlte;
+ uint32 band_fddlte;
+ uint32 band_lte_ext;
+ uint32 band_nr_3;
+ uint32 band_nr_2;
+ uint32 band_nr_1;
+ uint32 band_nr_0;
+} mbtk_device_info_modem_t;
+
+typedef struct {
+ uint8 name[16];
+ uint32 version; // Default : 0x01
+ uint32 state; //
+} mbtk_device_info_log_t;
+
+
+/*
+* MBTK_DEVICE_INFO_ITEM_BASIC - mbtk_device_info_basic_t
+* MBTK_DEVICE_INFO_ITEM_FOTA - mbtk_device_info_fota_t
+* MBTK_DEVICE_INFO_ITEM_MODEM - mbtk_device_info_modem_t
+* MBTK_DEVICE_INFO_ITEM_LOG - mbtk_device_info_log_t
+*/
+int mbtk_dev_info_read(mbtk_device_info_item_enum item_type, void *item_ptr, int item_size);
+int mbtk_dev_info_write(mbtk_device_info_item_enum item_type, void *item_ptr, int item_size);
+int mbtk_dev_info_revision_get(char *revision_out, char *revision_in, char *project_cust, char *band_area,
+ char* build_time);
+
+#endif /* _MBTK_DEVICE_V2_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..e3924eb
--- /dev/null
+++ b/mbtk/include/mbtk/mbtk_file.h
@@ -0,0 +1,89 @@
+/*
+*
+*
+* 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);
+
+/*===========================================================================
+FUNCTION file_link()
+
+DESCRIPTION:
+ Create soft link.
+
+PARAMETERS:
+ oldpath [IN]: Local original file,it may not exist.
+ newpath [IN]: Soft link file. If the file exists, it will be replaced.
+
+RETURN VALUE:
+ Return 0 if success,other for error.
+
+===========================================================================*/
+int file_link(const void* oldpath, const void* newpath);
+
+
+#endif /* _MBTK_FILE_H */
diff --git a/mbtk/include/mbtk/mbtk_fota.h b/mbtk/include/mbtk/mbtk_fota.h
new file mode 100755
index 0000000..385da51
--- /dev/null
+++ b/mbtk/include/mbtk/mbtk_fota.h
@@ -0,0 +1,109 @@
+/**
+ @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 __MBTK_FOTA_H__
+#define __MBTK_FOTA_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef enum mbtkabsystem
+{
+ mbtk_sys_A = 0,
+ mbtk_sys_B = 1
+} mbtk_absystem_t;
+
+/*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 mbtk_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 mbtk_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 mbtk_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 mbtk_fota_done(int is_reboot);
+
+int mbtk_fota_done1(int is_reboot);
+
+
+
+int mbtk_fota_status(void);
+
+int mbtk_fota_get_asr_reboot_cnt_flag(void);
+int mbtk_fota_get_active_absys_type(void);
+int mbtk_fota_get_tmp_absys_type(void);
+int mbtk_fota_get_sync_absys_type(void);
+int mbtk_fota_get_mtd_check_type(void);
+
+#ifdef __cplusplus
+}
+#endif
+#endif //__MBTK_FOTA_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..c85c5a1
--- /dev/null
+++ b/mbtk/include/mbtk/mbtk_gnss.h
@@ -0,0 +1,114 @@
+/*
+* mbtk_gnss.h
+*
+* MBTK GNSS API header.
+*
+* Author : lb
+* Date : 2024/7/11 16:14:33
+*/
+#ifndef __MBTK_GNSS_H
+#define __MBTK_GNSS_H
+#include <pthread.h>
+
+#include "mbtk_type.h"
+
+// Refor to : mbtk_gnss_ind_set() gnss_ind
+#define MBTK_GNSS_IND_LOCATION (1) // 1
+#define MBTK_GNSS_IND_NMEA (1 << 1) // 2
+
+// Refor to : mbtk_gnss_open() type
+#define GNSS_PRINT_PORT_UART1 1 // 1
+#define GNSS_PRINT_PORT_USB_NMEA (1<<1) // 2
+#define GNSS_PRINT_PORT_USB_AT (1<<2) // 4
+#define GNSS_PRINT_PORT_TTY_AT (1<<3) // 8
+
+#define MBTK_IND_START_FLAG 0xFF
+#define MBTK_IND_END_FLAG 0xEE
+#define MBTK_IND_LOCATION_TAG "IND_LOC:"
+#define MBTK_IND_NMEA_TAG "IND_NMEA:"
+
+#if 1//MBTK_GNSS_LOCATION_INFO
+#define MBTK_GNSS_LOG_ENABLED 0
+
+#define MAX_NMEA_TOKENS 32
+#define NMEA_RMC_PARAM_NUM 14
+#define NMEA_GGA_PARAM_NUM 15
+
+/** GpsLocation has valid latitude and longitude. */
+#define GNSS_LOCATION_HAS_LAT_LONG 0x00000001
+/** GpsLocation has valid altitude. */
+#define GNSS_LOCATION_HAS_ALTITUDE 0x00000002
+/** GpsLocation has valid speed. */
+#define GNSS_LOCATION_HAS_SPEED 0x00000004
+/** GpsLocation has valid bearing. */
+#define GNSS_LOCATION_HAS_BEARING 0x00000008
+/** GpsLocation has valid timestamp. */
+#define GNSS_LOCATION_HAS_TIMESTAMP 0x00000010
+/** GpsLocation has valid all. */
+#define GNSS_LOCATION_HAS_ALL 0x0000001F
+#endif
+
+typedef uint32 mbtk_gnss_handle;
+
+typedef void (*mbtk_gnss_callback_func)(uint32 ind_type, const void* data, uint32 data_len);
+
+typedef enum {
+ GNSS_ERR_OK,
+ GNSS_ERR_CLI_FULL,
+ GNSS_ERR_UNKNOWN_HANDLE,
+ GNSS_ERR_UNSUPPORT,
+ GNSS_ERR_TIMEOUT,
+ GNSS_ERR_ARG,
+ GNSS_ERR_CHECKSUM,
+ GNSS_ERR_SET_BUSY,
+ GNSS_ERR_DL_FW,
+ GNSS_ERR_OPEN_DEV,
+ GNSS_ERR_FORMAT,
+ GNSS_ERR_BUSY,
+ GNSS_ERR_EPH_GET_FAIL,
+ GNSS_ERR_EPH_INJECT_FAIL,
+
+ GNSS_ERR_UNKNOWN
+} gnss_err_enum;
+
+#if 1//MBTK_GNSS_LOCATION_INFO
+typedef struct {
+ const char* head;
+ const char* end;
+} mbtk_token;
+
+typedef struct {
+ int count;
+ mbtk_token tokens[ MAX_NMEA_TOKENS ];
+} mbtk_nmeatokenizer;
+
+typedef struct {
+ uint32 flags;
+ 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. */
+ int64_t timestamp; /**< Timestamp for the location fix in UTC million-second base. */
+} mbtk_gnss_location_info_t;
+#endif
+
+gnss_err_enum mbtk_gnss_init(mbtk_gnss_callback_func cb);
+
+gnss_err_enum mbtk_gnss_deinit();
+
+gnss_err_enum mbtk_gnss_open(int type, int timeout);
+
+gnss_err_enum mbtk_gnss_close(int timeout);
+
+gnss_err_enum mbtk_gnss_setting(const char *setting_cmd, int timeout);
+
+gnss_err_enum mbtk_gnss_dl(const char *fw_path, int timeout);
+
+gnss_err_enum mbtk_gnss_ind_set(uint32 gnss_ind, int timeout);
+
+gnss_err_enum mbtk_gnss_eph_download(int timeout);
+
+gnss_err_enum mbtk_gnss_eph_inject(int timeout);
+
+#endif /* __MBTK_GNSS_H */
diff --git a/mbtk/include/mbtk/mbtk_gnss_5311.h b/mbtk/include/mbtk/mbtk_gnss_5311.h
new file mode 100755
index 0000000..f9badcd
--- /dev/null
+++ b/mbtk/include/mbtk/mbtk_gnss_5311.h
@@ -0,0 +1,64 @@
+#ifndef __MBTK_GNSS_5311_H__
+#define __MBTK_GNSS_5311_H__
+
+#include "mbtk_log.h"
+
+typedef void (*mbtk_gnss_nmea_func_t)(void *nmea_data, int nmea_data_len);
+
+typedef enum {
+ ASR_GPS_INITIAL_SUCCESS = 0,
+ ASR_GPS_INITIAL_FAILED = 1,
+ ASR_GPS_INITIALED = 2,
+ ASR_GPS_DOWNLOAD_SUCCESS = 3,
+ ASR_GPS_DOWNLOAD_FAIL = 4,
+ ASR_GPS_SEND_DATA_SUCCESS = 5,
+ ASR_GPS_SEND_DATA_FAIL = 6,
+ ASR_GPS_DEINIT_SUCCESS,
+ ASR_GPS_DEINIT_FAIL,
+}USER_CB_STATE_T;
+
+typedef enum
+{
+ MBTK_GNSS_RESULT_SUCCESS = 0,
+ MBTK_GNSS_RESULT_FAIL,
+ MBTK_GNSS_RESULT_OPEN_SUCCESS,
+ MBTK_GNSS_RESULT_OPEN_FAIL,
+ MBTK_GNSS_RESULT_DOWNLOAD_SUCCESS,
+ MBTK_GNSS_RESULT_DOWNLOAD_FAIL,
+ MBTK_GNSS_RESULT_SEND_SUCCESS,
+ MBTK_GNSS_RESULT_SEND_FAIL,
+ MBTK_GNSS_RESULT_CLOSE_SUCCESS,
+ MBTK_GNSS_RESULT_CLOSE_FAIL,
+ MBTK_GNSS_RESULT_TIMEOUT,
+ MBTK_GNSS_RESULT_UNKNOWN_ERROR
+}MBTK_GNSS_5311_RESULT_TYPE;
+
+typedef enum
+{
+ MBTK_GNSS_MSG_LOCATION_INFO = 0,
+ MBTK_GNSS_MSG_NMEA_INFO
+}MBTK_GNSS_MSG_INFO_TYPE;
+
+typedef struct
+{
+ int init;
+ int fd;
+ mbtk_gnss_nmea_func_t callbacks;
+ pthread_t thread;
+ int control[2];
+ MBTK_GNSS_MSG_INFO_TYPE gnss_msg_state;
+}mbtk_gnss_nmea_status;
+
+MBTK_GNSS_5311_RESULT_TYPE mbtk_gnss_init(void);
+MBTK_GNSS_5311_RESULT_TYPE mbtk_gnss_deinit(void);
+MBTK_GNSS_5311_RESULT_TYPE mbtk_gnss_open(void);
+MBTK_GNSS_5311_RESULT_TYPE mbtk_gnss_close(void);
+MBTK_GNSS_5311_RESULT_TYPE mbtk_gnss_sleep(void);
+MBTK_GNSS_5311_RESULT_TYPE mbtk_gnss_wakeup(void);
+MBTK_GNSS_5311_RESULT_TYPE mbtk_gnss_param_config(const char *param_buf, int param_buf_len);
+MBTK_GNSS_5311_RESULT_TYPE mbtk_gnss_get_status(const char *status_buf, int status_buf_len, int *get_status_len);
+MBTK_GNSS_5311_RESULT_TYPE mbtk_gnss_add_nmea_out_func(mbtk_gnss_nmea_func_t cb);
+MBTK_GNSS_5311_RESULT_TYPE mbtk_gnss_set_nmea_out_type(MBTK_GNSS_MSG_INFO_TYPE type);
+MBTK_GNSS_5311_RESULT_TYPE mbtk_gnss_5311_download_tle(char *host, int alam_flag);
+MBTK_GNSS_5311_RESULT_TYPE mbtk_gnss_injectEphemeris(void);
+#endif
\ No newline at end of file
diff --git a/mbtk/include/mbtk/mbtk_gnss_6228.h b/mbtk/include/mbtk/mbtk_gnss_6228.h
new file mode 100755
index 0000000..027eb48
--- /dev/null
+++ b/mbtk/include/mbtk/mbtk_gnss_6228.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_gpio.h b/mbtk/include/mbtk/mbtk_gpio.h
new file mode 100755
index 0000000..9b6a8c1
--- /dev/null
+++ b/mbtk/include/mbtk/mbtk_gpio.h
@@ -0,0 +1,33 @@
+/*
+* mbtk_gpio.h
+*
+* MBTK GPIO process header.
+*
+* Author : lb
+* Date : 2024/6/14 14:57:56
+*/
+#ifndef _MBTK_GPIO_H
+#define _MBTK_GPIO_H
+
+typedef enum {
+ MBTK_GPIO_DIRECT_UNKNOWN,
+ MBTK_GPIO_DIRECT_IN,
+ MBTK_GPIO_DIRECT_OUT
+} mbtk_gpio_direct_t;
+
+mbtk_gpio_direct_t mbtk_gpio_direct_get(int gpio);
+
+int mbtk_gpio_direct_set(int gpio, mbtk_gpio_direct_t dir);
+
+int mbtk_gpio_value_get(int gpio);
+
+int mbtk_gpio_value_set(int gpio, mbtk_gpio_direct_t dir, int value);
+
+int mbtk_gpio_value_set_2(int gpio, int value);
+
+int mbtk_gpio_export(int gpio);
+
+int mbtk_gpio_unexport(int gpio);
+
+
+#endif /* _MBTK_GPIO_H */
diff --git a/mbtk/include/mbtk/mbtk_http.h b/mbtk/include/mbtk/mbtk_http.h
new file mode 100755
index 0000000..bbd0130
--- /dev/null
+++ b/mbtk/include/mbtk/mbtk_http.h
@@ -0,0 +1,367 @@
+/*************************************************************
+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;
+ int file_fd;
+ 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;
+ bool ingnore_cert; //FALSE:need cert
+
+ 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_ingnore_cert_set(int handle_id, int session_id, bool ingnore_cert);
+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..f713273
--- /dev/null
+++ b/mbtk/include/mbtk/mbtk_info_api.h
@@ -0,0 +1,1473 @@
+/*
+*
+* 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"
+#include "mbtk_pdu_sms.h"
+
+#ifndef UNUSED
+#define UNUSED(a) (void)(a)
+#endif
+
+// LOG_DEBUG_LEVEL 7
+#define LOG LOGI
+
+#define RIL_MAX_NUMBER_LEN 40
+#define MBTK_ECALL_MSD_LEN_MAX 600
+
+#define CELL_NUM_MAX 50
+#define APN_STR_MAX 128
+#if (defined(MBTK_AF_SUPPORT) || defined(MBTK_ALL_CID_SUPPORT))
+#define MBTK_APN_CID_MIN 1
+#else
+// 2 - 7
+#define MBTK_APN_CID_MIN 2
+#endif
+#define MBTK_APN_CID_MAX 7
+#define MBTK_DATA_CALL_TIMEOUT_DEFAULT 10 // 10s
+
+#define MBTK_APN_NAME_SIZE 150+1
+#define MBTK_APN_USERNAME_SIZE 127+1
+#define MBTK_APN_PASSWORD_SIZE 127+1
+#define MBTK_APN_TYPE_SIZE 127+1
+
+
+
+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;
+
+typedef enum {
+ MBTK_ECALL_CFG_ITEM_T3 = 0, // ms
+ MBTK_ECALL_CFG_ITEM_T5, // ms
+ MBTK_ECALL_CFG_ITEM_T6, // ms
+ MBTK_ECALL_CFG_ITEM_T7, // ms
+ MBTK_ECALL_CFG_ITEM_TH, // ms
+ MBTK_ECALL_CFG_ITEM_TIMER_CALLBACK, // T9 // 5
+ MBTK_ECALL_CFG_ITEM_TIMER_CLEARDOWN, // T2
+ MBTK_ECALL_CFG_ITEM_TIMER_DEREG, // T10
+ MBTK_ECALL_CFG_ITEM_TIMER_DIAL, // "dial"
+ MBTK_ECALL_CFG_ITEM_TIMER_REDIAL, // "redialtmr"
+ MBTK_ECALL_CFG_ITEM_TIMER_SMS, // "sms" // 10
+ MBTK_ECALL_CFG_ITEM_REDIALCNT, // "redialcnt"
+ MBTK_ECALL_CFG_ITEM_SMSPROCESS, // "smsprocess"
+ MBTK_ECALL_CFG_ITEM_SMSMSDCNT, // "smsmsdcnt"
+
+ MBTK_ECALL_CFG_ITEM_MAX
+} mbtk_ecall_cfg_item_enum;
+
+#define MBTK_ECALL_CFG_T3 (1 << MBTK_ECALL_CFG_ITEM_T3) // ms
+#define MBTK_ECALL_CFG_T5 (1 << MBTK_ECALL_CFG_ITEM_T5) // ms
+#define MBTK_ECALL_CFG_T6 (1 << MBTK_ECALL_CFG_ITEM_T6) // ms
+#define MBTK_ECALL_CFG_T7 (1 << MBTK_ECALL_CFG_ITEM_T7) // ms
+#define MBTK_ECALL_CFG_TH (1 << MBTK_ECALL_CFG_ITEM_TH) // ms
+#define MBTK_ECALL_CFG_TIMER_CALLBACK (1 << MBTK_ECALL_CFG_ITEM_TIMER_CALLBACK) // T9
+#define MBTK_ECALL_CFG_TIMER_CLEARDOWN (1 << MBTK_ECALL_CFG_ITEM_TIMER_CLEARDOWN) // T2
+#define MBTK_ECALL_CFG_TIMER_DEREG (1 << MBTK_ECALL_CFG_ITEM_TIMER_DEREG) // T10
+#define MBTK_ECALL_CFG_TIMER_DIAL (1 << MBTK_ECALL_CFG_ITEM_TIMER_DIAL) // "dial"
+#define MBTK_ECALL_CFG_TIMER_REDIAL (1 << MBTK_ECALL_CFG_ITEM_TIMER_REDIAL) // "redialtmr"
+#define MBTK_ECALL_CFG_TIMER_SMS (1 << MBTK_ECALL_CFG_ITEM_TIMER_SMS) // "sms" // 10
+#define MBTK_ECALL_CFG_REDIALCNT (1 << MBTK_ECALL_CFG_ITEM_REDIALCNT) // "redialcnt"
+#define MBTK_ECALL_CFG_SMSPROCESS (1 << MBTK_ECALL_CFG_ITEM_SMSPROCESS) // "smsprocess"
+#define MBTK_ECALL_CFG_SMSMSDCNT (1 << MBTK_ECALL_CFG_ITEM_SMSMSDCNT) // "smsmsdcnt"
+
+#define MBTK_VOICE_END_REASON_UNKNOWN "0 "
+#define MBTK_VOICE_END_REASON_UNASSIGNED_NUMBER "1 "
+#define MBTK_VOICE_END_REASON_NO_ROUTE_DES "3 "
+#define MBTK_VOICE_END_REASON_CHANNEL_UNACCEPTABLE "6 "
+#define MBTK_VOICE_END_REASON_OPERATOR_DETERMINED_BARRING "8 "
+#define MBTK_VOICE_END_REASON_NORMAL_CALL_CLEARING "16 "
+#define MBTK_VOICE_END_REASON_USER_BUSY "17 "
+#define MBTK_VOICE_END_REASON_NO_USER_RESPONDING "18 "
+#define MBTK_VOICE_END_REASON_USER_ALERTING_NO_ANSWER "19 "
+#define MBTK_VOICE_END_REASON_CALL_REJECTED "21 "
+#define MBTK_VOICE_END_REASON_NUMBER_CHANGED "22 "
+#define MBTK_VOICE_END_REASON_PREEMPTION "25 "
+#define MBTK_VOICE_END_REASON_NON_SELECTED_USER_CLEARING "26 "
+#define MBTK_VOICE_END_REASON_DESTINATION_OUT_OF_ORDER "27 "
+#define MBTK_VOICE_END_REASON_INVALID_NUMBER_FORMAT "28 "
+#define MBTK_VOICE_END_REASON_FACILITY_REJECTED "29 "
+#define MBTK_VOICE_END_REASON_STATUS_ENQUIRY "30 "
+#define MBTK_VOICE_END_REASON_NORMAL_UNSPECIFIED "31 "
+#define MBTK_VOICE_END_REASON_NO_CIRCUIT_AVAILABLE "34 "
+#define MBTK_VOICE_END_REASON_NETWORK_OUT_OF_ORDER "38 "
+#define MBTK_VOICE_END_REASON_TEMPORARY_FAILURE "41 "
+#define MBTK_VOICE_END_REASON_SWITCHING_EQUIPMENT_CONGESTION "42 "
+#define MBTK_VOICE_END_REASON_ACCESS_INFORMATION_DISCARDED "43 "
+#define MBTK_VOICE_END_REASON_REQUESTED_CIRCUIT_UNAVAILABLE "44 "
+#define MBTK_VOICE_END_REASON_RESOURCE_UNAVAILABLE "47 "
+#define MBTK_VOICE_END_REASON_QOS_UNAVAILABLE "49 "
+#define MBTK_VOICE_END_REASON_REQUESTED_FACILITY_NOT_SUBSCRIBED "50 "
+#define MBTK_VOICE_END_REASON_INCOMING_CALLS_BARRED_WITHIN_CUG "55 "
+#define MBTK_VOICE_END_REASON_BEARER_CAPABILITY_NOT_AUTHORIZED "57 "
+#define MBTK_VOICE_END_REASON_BEARER_CAPABILITY_NOT_AVAILABLE "58 "
+#define MBTK_VOICE_END_REASON_SERVICE_NOT_AVAILABLE "63 "
+#define MBTK_VOICE_END_REASON_BEARER_SERVICE_NOT_IMPLEMENTED "65 "
+#define MBTK_VOICE_END_REASON_ACM_MAX_REACHED "68 "
+#define MBTK_VOICE_END_REASON_FACILITY_NOT_IMPLEMENTED "69 "
+#define MBTK_VOICE_END_REASON_ONLY_RDI_BEARER_CAPABILITY_AVAILABLE "70 "
+#define MBTK_VOICE_END_REASON_SERVICE_NOT_IMPLEMENTED "79 "
+#define MBTK_VOICE_END_REASON_INVALID_TRANSACTION_ID "81 "
+#define MBTK_VOICE_END_REASON_USER_NOT_MEMBER_OF_CUG "87 "
+#define MBTK_VOICE_END_REASON_INCOMPATIBLE_DESTINATION "88 "
+#define MBTK_VOICE_END_REASON_INVALID_TRANSIT_NETWORK_SELECTION "91 "
+#define MBTK_VOICE_END_REASON_INCORRECT_MESSAGE "95 "
+#define MBTK_VOICE_END_REASON_INVALID_MANDATORY_INFORMATION "96 "
+#define MBTK_VOICE_END_REASON_MESSAGE_TYPE_NON_EXISTENT "97 "
+#define MBTK_VOICE_END_REASON_MESSAGE_TYPE_WRONG_STATE "98 "
+#define MBTK_VOICE_END_REASON_INFORMATION_ELEMENT_NOT_EXISTENT "99 "
+#define MBTK_VOICE_END_REASON_CONDITIONAL_IE_ERROR "100 "
+#define MBTK_VOICE_END_REASON_MESSAGE_WRONG_STATE "101 "
+#define MBTK_VOICE_END_REASON_RECOVERY_AFTER_TIMER_EXPIRY "102 "
+#define MBTK_VOICE_END_REASON_PROTOCOL_ERROR_UNSPECIFIED "111 "
+#define MBTK_VOICE_END_REASON_INERWORKING_UNSPECIFIED "127 "
+#define MBTK_VOICE_END_REASON_CALL_BARRING "224 "
+#define MBTK_VOICE_END_REASON_FDN_BLOCKED "241 "
+#define MBTK_VOICE_END_REASON_END "end"
+
+
+
+/*
+ 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;
+
+/*
+ 0 : Plmm long character format
+ 1 : Plmn Short character format
+ 2 : Plmn number format
+*/
+typedef enum
+{
+ MBTK_NET_OPERA_FORMAT_LONG_CHAR = 0,
+ MBTK_NET_OPERA_FORMAT_SHORT_CHAR,
+ MBTK_NET_OPERA_FORMAT_NUMBER,
+} mbtk_net_opera_format_enum;
+
+/*
+ 0 : Automatic registration
+ 1 : Manual registration
+ 2 : Forced cancellation
+ 3 : Set format only
+ 4 : Manual registration is performed first, and automatic registration fails
+*/
+typedef enum
+{
+ MBTK_NET_OPERA_REG_MODE_AUTO = 0,
+ MBTK_NET_OPERA_REG_MODE_MANUAL,
+ MBTK_NET_OPERA_REG_MODE_LOGOUT,
+ MBTK_NET_OPERA_REG_MODE_SET_FORMAT,
+ MBTK_NET_OPERA_REG_MODE_MANUAL_AUTO,
+} mbtk_net_opera_reg_mode_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;
+
+ pthread_mutex_t send_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;
+ //add signal by xr
+ mbtk_info_callback_func signal_state_cb;
+
+ mbtk_info_callback_func ecall_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
+ uint32 lte_ext_band; // mbtk_lte_ext_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;
+ uint8 end_reason[128];
+} __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_PIN_DISABLE = 0,
+ MBTK_PIN_ENABLE = 1,
+}mbtk_pin_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 struct {
+ uint8 state; // Must be placed at the forefront.
+
+ mbtk_ipv4_info_t ipv4;
+ mbtk_ipv6_info_t ipv6;
+} __attribute__((packed)) mbtk_pdp_act_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;
+
+
+typedef struct{
+ uint8_t mode;
+ uint32_t oosPhase[3]; //单位为秒
+} mbtk_oos_info;
+
+typedef struct
+{
+ int8 ther;
+} mbtk_thermal_info_t;
+
+/**************led enum*********/
+typedef enum
+{
+ MBTK_LED_TYPE_NET, //set net_led
+ MBTK_LED_TYPE_STATUS //set status_led
+}mbtk_led_type;
+
+typedef enum
+{
+ MBTK_LED_STATUS_CLOSE, //close led
+ MBTK_LED_STATUS_OPEN //open led
+}mbtk_led_status;
+/**************led enum*********/
+
+/**************qser data_call*****************/
+typedef enum {
+ MBTK_APN_REQ_TYPE_SET = 0, // set apn req
+ MBTK_APN_REQ_TYPE_ADD // add apn req
+}mbtk_apn_req_type_enum;
+
+typedef enum {
+ MBTK_APN_AUTH_PROTO_DEFAULT = 0,
+ MBTK_APN_AUTH_PROTO_NONE,
+ MBTK_APN_AUTH_PROTO_PAP,
+ MBTK_APN_AUTH_PROTO_CHAP,
+#if 0
+ MBTK_APN_AUTH_PROTO_PAP_CHAP,
+ //NOT SUPPORT
+#endif
+} mbtk_apn_auth_proto_enum;
+
+typedef struct
+{
+ uint8 urc_id;
+ uint8 urc_data[5];
+} mbtk_ril_ecall_state_info_t;
+
+typedef struct {
+ int cid; /*!< UMTS/CDMA profile ID. range: 0 - 7*/
+ mbtk_ip_type_enum ip_type; /*!< Packet Data Protocol (PDP) type specifies the type of data payload
+ exchanged over the airlink when the packet data session is
+ established with this profile. */
+ mbtk_apn_req_type_enum req_type; /*!< apn req type*/
+ mbtk_apn_auth_proto_enum auth_proto; /*!< Authentication Protocol. */
+ uint8 apn_name[MBTK_APN_NAME_SIZE]; /*!< A string parameter that is a logical name used to select the GGSN
+ and external packet data network. */
+ uint8 user_name[MBTK_APN_USERNAME_SIZE]; /*!< Username used during data network authentication. */
+ uint8 user_pass[MBTK_APN_PASSWORD_SIZE]; /*!< Password to be used during data network authentication. */
+ uint8 apn_type[MBTK_APN_TYPE_SIZE];
+} mbtk_qser_apn_info_s;
+/**************qser data_call*****************/
+
+
+typedef enum {
+ MBTK_ECALL_MSD_ITEM_VERSION = 0,
+ MBTK_ECALL_MSD_ITEM_MSG_ID,
+ MBTK_ECALL_MSD_ITEM_CONTROLTYPE,
+ MBTK_ECALL_MSD_ITEM_VIN,
+ MBTK_ECALL_MSD_ITEM_STORAGETYPE,
+ MBTK_ECALL_MSD_ITEM_TIMESTAMP,
+ MBTK_ECALL_MSD_ITEM_LOCATION,
+ MBTK_ECALL_MSD_ITEM_DIRECTION,
+ MBTK_ECALL_MSD_ITEM_LOCATIONN1,
+ MBTK_ECALL_MSD_ITEM_LOCATIONN2,
+ MBTK_ECALL_MSD_ITEM_NUMBEROFOCCUPANTS,
+ MBTK_ECALL_MSD_ITEM_ADDITIONALDATA,
+ MBTK_ECALL_MSD_ITEM_ALL_IN_ONE,
+ MBTK_ECALL_MSD_ITEM_ASI,
+ MBTK_ECALL_MSD_ITEM_VEHICLE_DIAGNOSTIC,
+ MBTK_ECALL_MSD_ITEM_CRASH_INFO,
+ MBTK_ECALL_MSD_ITEM_GNSS_TYPE
+} mbtk_ecall_msd_item_enum;
+
+typedef struct
+{
+ mbtk_ecall_msd_item_enum item_type;
+
+ uint8 data[64];
+} mbtk_ecall_msd_cfg_info_t;
+
+typedef enum {
+ MBTK_ECALL_ONLY_TYPE_DISABLE = 0,
+ MBTK_ECALL_ONLY_TYPE_ENABLE_ECALL,
+ MBTK_ECALL_ONLY_TYPE_ENABLE_NG_ECALL,
+ MBTK_ECALL_ONLY_TYPE_ENABLE_ALL,
+ MBTK_ECALL_ONLY_TYPE_CONF_NUM,
+ MBTK_ECALL_ONLY_TYPE_NORMAL
+} mbtk_ecall_only_type_enum;
+
+typedef enum {
+ MBTK_ECALL_SIM_TYPE_NO_SUPPORT = 0,
+ MBTK_ECALL_SIM_TYPE_SUPPORT_ECALL,
+ MBTK_ECALL_SIM_TYPE_SUPPORT_ECALL_ONLY
+} mbtk_ecall_sim_type_enum;
+
+typedef struct {
+ mbtk_ecall_only_type_enum active : 8;
+ mbtk_ecall_sim_type_enum sim_type : 8; // Only for GET.
+ uint8 test_num[RIL_MAX_NUMBER_LEN];
+ uint8 reconfig_num[RIL_MAX_NUMBER_LEN];
+} mbtk_ecall_only_info_t;
+
+typedef enum {
+ MBTK_ECALL_DIAL_TYPE_TEST = 0,
+ MBTK_ECALL_DIAL_TYPE_RECONFIG,
+ MBTK_ECALL_DIAL_TYPE_MANUALLY,
+ MBTK_ECALL_DIAL_TYPE_AUTO,
+ MBTK_ECALL_DIAL_TYPE_NOT_ACTIVATED,
+ MBTK_ECALL_DIAL_TYPE_RELEASE
+} mbtk_ecall_dial_type_enum;
+
+typedef enum {
+ MBTK_ECALL_MODE_TYPE_EU = 0,
+ MBTK_ECALL_MODE_TYPE_ERA
+} mbtk_ecall_mode_type_enum;
+
+typedef struct {
+ uint32 type; // mbtk_ecall_cfg_item_enum
+
+#if 0
+ uint32 timer_t3; // ms
+ uint32 timer_t5; // ms
+ uint32 timer_t6; // ms
+ uint32 timer_t7; // ms
+ uint32 timer_th; // ms
+
+ uint32 timer_callback; // s (T9)
+ uint32 timer_cleardown; // s (T2)
+ uint32 timer_dereg; // s (T10)
+ uint32 timer_dial; // s
+ uint32 timer_redialtmr; // s
+ uint32 timer_sms; // s
+
+ uint32 redialcnt;
+ uint32 smsprocess;
+ uint32 smsmsdcnt;
+#else
+ uint8 data_valid[MBTK_ECALL_CFG_ITEM_MAX];
+ uint32 data[MBTK_ECALL_CFG_ITEM_MAX];
+#endif
+} mbtk_ecall_cfg_info_t;
+
+typedef enum {
+ MBTK_ECALL_GAIN_MODE_TX = 0,
+ MBTK_ECALL_GAIN_MODE_RX,
+ MBTK_ECALL_GAIN_MODE_SIDETONE
+} mbtk_ecall_gain_mode_enum;
+
+typedef struct {
+ mbtk_ecall_gain_mode_enum mode;
+
+ int8 gain;
+} mbtk_ecall_gain_info_t;
+
+typedef enum {
+ MBTK_ECALL_URC_ID_ALACK = 0, // AL-ACK signal received (refer to : urc_data)
+ MBTK_ECALL_URC_ID_SYNC_LOST, // eIM lost synchronization with PSAP
+ // (A resynch occurs after the synchronization is lost.)
+ MBTK_ECALL_URC_ID_NACK, // NACK signal received
+ MBTK_ECALL_URC_ID_RESERVED_3,
+ MBTK_ECALL_URC_ID_RESERVED_4,
+ MBTK_ECALL_URC_ID_RESERVED_5, // 5
+ MBTK_ECALL_URC_ID_3GPP_FATAL, // eIM is terminated: fatal error (3GPP Abort function)
+ MBTK_ECALL_URC_ID_CALL_DROP, // eIM is terminated: call drop
+ MBTK_ECALL_URC_ID_GENERIC, // Generic error
+ MBTK_ECALL_URC_ID_MSD_REQ, // PSAP request MSD (Only for PULL modem)
+ MBTK_ECALL_URC_ID_MSD_SEND_START, // 10 : eIM starts sending MSD
+ MBTK_ECALL_URC_ID_INITIATION, // The eIM starts sending the Initiation signal (Only for PUSH modem).
+ // It also indicates that the call setup is completed.
+ MBTK_ECALL_URC_ID_SEND_MSD, // PUSH: SEND_MSD -> MSD_SEND_START
+ // PULL: SEND_MSD -> MSD_REQ -> MSD_SEND_START
+ MBTK_ECALL_URC_ID_SEND_MSD_FULL,// SEND MSD signal received too often, PSAP sync failure assumed
+ MBTK_ECALL_URC_ID_SYNCED_PSAP, // IVS eIM is synced with PSAP
+ MBTK_ECALL_URC_ID_SYNCED_PSAP_EIM, // 15: IVS eIM is synced with PSAP eIM
+ MBTK_ECALL_URC_ID_LLACK, // Link layer ACK received
+ MBTK_ECALL_URC_ID_HLACK, // Higher Layer ACK received (similar to AL-ACK (#0) but without data)
+ MBTK_ECALL_URC_ID_EIM_RESET, // The eIM transmitter idles after a full reset. The eIM transmitter is reset after sync loss
+ // (for example, because of the end of PSAP transmission).
+ MBTK_ECALL_URC_ID_EIM_IDLES, // The eIM transmitter idles after the transmission of the Initiation signal (push mode)
+ MBTK_ECALL_URC_ID_MSD_UPDATE, // 20 : MSD update request is received.
+ MBTK_ECALL_URC_ID_MSD_UPDATE_DONE, // MSD update is done.
+ MBTK_ECALL_URC_ID_MSD_UPDATE_ERR, // MSD update request cannot be processed.
+ MBTK_ECALL_URC_ID_T3_EXPIRED, // T3 expired
+ MBTK_ECALL_URC_ID_T5_EXPIRED, // T5 expired
+ MBTK_ECALL_URC_ID_T6_EXPIRED, // 25 : T6 expired
+ MBTK_ECALL_URC_ID_T7_EXPIRED, // T7 expired
+ MBTK_ECALL_URC_ID_TH_EXPIRED, // TH expired
+ MBTK_ECALL_URC_ID_RESERVED_28,
+ MBTK_ECALL_URC_ID_RESERVED_29,
+ MBTK_ECALL_URC_ID_RESERVED_30, // 30
+ MBTK_ECALL_URC_ID_IVS_EVENT_TIMEOUT,
+ MBTK_ECALL_URC_ID_PSAP_REQ, // Only for ERA
+ MBTK_ECALL_URC_ID_MSD_SEND_FAIL_FOR_NG // NG-eCall fail to transfer MSD
+} mbtk_ecall_urc_id_enum;
+
+
+int ipv6_2_str(const void *ipv6, void *ipv6_str);
+
+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 QSER APN informations.
+*/
+int mbtk_qser_apn_set(mbtk_info_handle_t* handle, mbtk_qser_apn_info_s *apninfo, unsigned char *cid);
+
+/*
+* Set current QSER APN informations.
+*/
+int mbtk_qser_apn_get(mbtk_info_handle_t* handle, int *apn_num, mbtk_qser_apn_info_s 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);
+
+/*
+* Delete apn.
+*/
+int mbtk_apn_del(mbtk_info_handle_t* handle, unsigned char profile_idx);
+
+/*
+* 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 current IMS enable or not.
+*/
+int mbtk_net_ims_get(mbtk_info_handle_t* handle, int* enable);
+
+/*
+* Set IMS enable or not. This function takes effect after starting the device.
+*/
+int mbtk_net_ims_set(mbtk_info_handle_t* handle, int enable);
+
+/*
+* Get current network IMS register state.
+*/
+int mbtk_net_ims_reg_state_get(mbtk_info_handle_t* handle, int* 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);
+
+/*
+* Return sms cmgf.
+*/
+int mbtk_sms_cmgf_get(mbtk_info_handle_t* handle, int *volte_state);
+
+/*
+* Set sms cmgf.
+*
+* volte_state:
+* 0 : PDU mode.
+* 1 : text mode.
+*
+* Restarting takes effect after execution.
+*/
+int mbtk_sms_cmgf_set(mbtk_info_handle_t* handle, int mode);
+
+/*
+* Set sms cmgs.
+*
+if PDU mode (+CMGF=0):
++CMGS=<length><CR>
+PDU is given<ctrl-Z/ESC>
+
+if text mode (+CMGF=1):
++CMGS=<da>[,<toda>]<CR>
+text is entered<ctrl-Z/ESC>
+
+* Restarting takes effect after execution.
+*/
+int mbtk_sms_cmgs_set(mbtk_info_handle_t* handle, char * cmgs, char *resp);
+
+/*
+* Set sms cmgw.
+*
+if text mode (+CMGF=1):
++CMGW=<oa/da>[,<tooa/toda>[,<stat>]]
+<CR>
+text is entered<ctrl-Z/ESC>
+if PDU mode (+CMGF=0):
++CMGW=<length>[,<stat>]<CR>PDU is
+given<ctrl-Z/ESC>
+
+*/
+int mbtk_sms_cmgw_set(mbtk_info_handle_t* handle, char * cmgw, char *resp);
+
+/*
+* Set sms cmgd.
+*
+* +CMGD=<index>[,<delflag>]
+*
+* Restarting takes effect after execution.
+*/
+int mbtk_sms_cmgd_set(mbtk_info_handle_t* handle, char * cmdg);
+
+/*
+* Get sms cmgd.
+*
+* +CMGD: (XXX,XXX)(0-4)
+*
+* Restarting takes effect after execution.
+*/
+int mbtk_sms_cmgd_get(mbtk_info_handle_t* handle, char * cmdg);
+
+/*
+* Set sms cmgl.
+*
+* AT+CMGL[=<stat>]
+*
+* Restarting takes effect after execution.
+*/
+int mbtk_sms_cmgl_set(mbtk_info_handle_t* handle, char * cmgl, char *resp);
+
+/*
+* Return sms csca.
+*/
+int mbtk_sms_csca_get(mbtk_info_handle_t* handle, char *buf);
+
+/*
+* Set sms csca.
+*
+* AT+CSCA=<number> [,<type>]
+*
+* Restarting takes effect after execution.
+*/
+int mbtk_sms_csca_set(mbtk_info_handle_t* handle, char * csca);
+
+/*
+* Set sms csmp.
+*
+* AT+CSMP=[<fo>[,<vp>[,<pid>[,<dcs>]]]]
+*
+* Restarting takes effect after execution.
+*/
+int mbtk_sms_csmp_set(mbtk_info_handle_t* handle, char * csmp);
+
+/*
+* Set sms cscb.
+*
+* AT+CSCB=<[<mode>[,<mids>[,<dcss>]]]>
+*
+* Restarting takes effect after execution.
+*/
+int mbtk_sms_cscb_set(mbtk_info_handle_t* handle, char * cscb);
+
+/*
+* Set sms cnmi.
+*
+at+cnmi=1,2
+
+OK
+if sending fails:
++CMS ERROR: <err>
+*/
+int mbtk_sms_cnmi_set(mbtk_info_handle_t* handle);
+
+/*
+* Set sms cmss.
+*
++CMSS=<index>[,<da>[,<toda>]]
+
+if sending successful:
++CMSS: <mr>
+OK
+if sending fails:
++CMS ERROR: <err>
+*/
+int mbtk_sms_cmss_set(mbtk_info_handle_t* handle, char * cmss, char *resp);
+
+/*
+* Return sms cmgf.
+*/
+int mbtk_sms_cpms_get(mbtk_info_handle_t* handle, char * mem);
+
+/*
+* Set sms cpms.
+*
+* AT+CPMS=<mem1>[,<mem2>[,<mem3>]]
+*
+* Restarting takes effect after execution.
+*/
+int mbtk_sms_cpms_set(mbtk_info_handle_t* handle, char * mem, char* response);
+
+/*
+* Set sms cm.
+*
+* +CMGR=<index>
+
+if PDU mode (+CMGF=0) ��command successful:
++CMGR: <stat>,[<alpha>],<length><CR><LF><pdu>
+OK
+if text mode (+CMGF=1), command successful and SMS-DELIVER:
++CMGR:<stat>,<oa>,[<alpha>],<scts>[,<tooa>,<fo>,<pid>,<dcs
+>, <sca>,<tosca>,<length>]<CR><LF><data>
+OK
+if text mode (+CMGF=1), command successful and SMS-SUBMIT:
++CMGR:
+<stat>,<da>,[<alpha>][,<toda>,<fo>,<pid>,<dcs>,[<vp>],
+<sca>,<tosca>,<length>]<CR><LF><data>
+OK
+otherwise:
++CMS ERROR: <err>
+*
+* Restarting takes effect after execution.
+*/
+int mbtk_sms_cmgr_set(mbtk_info_handle_t* handle, int index, char *resp);
+
+/*
+* 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, mbtk_thermal_info_t* 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);
+
+/*
+* GET PIN STATE
+*/
+int mbtk_get_pin_state(mbtk_info_handle_t* handle, mbtk_pin_state_enum *pin_state);
+
+/*
+*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);
+//Wake-up control
+int mbtk_wakeup_state_set(mbtk_info_handle_t* handle, uint32 wakeup_state);
+//Get the searching interval of OOS
+int mbtk_oos_get(mbtk_info_handle_t* handle, mbtk_oos_info *oos_info);
+//Set the searching interval of OOS
+int mbtk_oos_set(mbtk_info_handle_t* handle, mbtk_oos_info *oos_info);
+
+
+//set dtmf character
+int mbtk_dtmf_send(mbtk_info_handle_t* handle, mbtk_call_dtmf_info_t *dtmf_character);
+int mbtk_ceer_get(mbtk_info_handle_t* handle, void *ceer);
+
+//set led
+int mbtk_led_set(mbtk_info_handle_t* handle, mbtk_led_type type, mbtk_led_status status);
+
+
+/*
+* Set msd item.
+*
+*/
+int mbtk_ecall_msd_item_set(mbtk_info_handle_t* handle, const mbtk_ecall_msd_cfg_info_t *msd_cfg);
+
+/*
+* Generate msd after msd item set.
+*
+*/
+int mbtk_ecall_msd_gen(mbtk_info_handle_t* handle);
+
+/*
+* Set ecall msd.
+*
+*/
+int mbtk_ecall_msd_set(mbtk_info_handle_t* handle, const void* msd);
+
+/*
+* Get ecall msd.
+*
+*/
+int mbtk_ecall_msd_get(mbtk_info_handle_t* handle, void* msd);
+
+
+/*
+* Set ecall msd item.
+*
+*/
+int mbtk_ecall_push(mbtk_info_handle_t* handle);
+
+/*
+* Set ecall only configs.
+*
+*/
+int mbtk_ecall_only_set(mbtk_info_handle_t* handle, const mbtk_ecall_only_info_t* info);
+
+/*
+* Get ecall only configs.
+*
+*/
+int mbtk_ecall_only_get(mbtk_info_handle_t* handle, mbtk_ecall_only_info_t* info);
+
+/*
+* Set ecall network reg.
+*
+*/
+int mbtk_ecall_reg_set(mbtk_info_handle_t* handle, int reg);
+
+/*
+* Start ecall dial start.
+*
+*/
+int mbtk_ecall_dial_start(mbtk_info_handle_t* handle, mbtk_ecall_dial_type_enum type);
+
+/*
+* Get ecall dial state.
+*
+*/
+int mbtk_ecall_dial_state_get(mbtk_info_handle_t* handle, mbtk_ecall_dial_type_enum* type);
+
+/*
+* Set ecall mode.
+*
+*/
+int mbtk_ecall_mode_set(mbtk_info_handle_t* handle, mbtk_ecall_mode_type_enum mode);
+
+/*
+* Get ecall mode.
+*
+*/
+int mbtk_ecall_mode_get(mbtk_info_handle_t* handle, mbtk_ecall_mode_type_enum *mode);
+
+/*
+* Set ecall configs.
+*
+*/
+int mbtk_ecall_cfg_set(mbtk_info_handle_t* handle, const mbtk_ecall_cfg_info_t *cfg);
+
+/*
+* Get ecall configs.
+*
+*/
+int mbtk_ecall_cfg_get(mbtk_info_handle_t* handle, mbtk_ecall_cfg_info_t* cfg);
+
+/*
+* Set ecall sms number.
+*
+*/
+int mbtk_ecall_sms_number_set(mbtk_info_handle_t* handle, const void *number);
+
+/*
+* Get ecall sms number.
+*
+*/
+int mbtk_ecall_sms_number_get(mbtk_info_handle_t* handle, void *number);
+
+/*
+* Set ecall mute speaker.
+*
+*/
+int mbtk_ecall_mute_spk_set(mbtk_info_handle_t* handle, int mute);
+
+/*
+* Set ecall dsp gain.
+*
+*/
+int mbtk_ecall_dsp_gain_set(mbtk_info_handle_t* handle, const mbtk_ecall_gain_info_t *gain_info);
+
+/*
+* 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);
+
+/*
+* Set signal state change callback function.
+*/
+int mbtk_signal_state_change_cb_reg(mbtk_info_handle_t* handle, mbtk_info_callback_func cb);
+
+/*
+* Set ril server state change callback function.
+*/
+int mbtk_ril_server_state_change_reg(mbtk_info_handle_t* handle, mbtk_info_callback_func cb);
+
+int mbtk_ecall_state_change_cb_reg(mbtk_info_handle_t* handle, mbtk_info_callback_func cb);
+
+int mbtk_sms_cnmi_set(mbtk_info_handle_t* handle);
+
+int mbtk_get_modem_version(mbtk_info_handle_t* handle, void *modem_version);
+
+//get fplmn list
+int mbtk_fplmn_get(mbtk_info_handle_t *handle, void *fplmn);
+
+//set fplmn list
+int mbtk_fplmn_set(mbtk_info_handle_t *handle, void *fplmn);
+
+
+#endif /* _MBTK_INFO_API_H */
diff --git a/mbtk/include/mbtk/mbtk_led_control.h b/mbtk/include/mbtk/mbtk_led_control.h
new file mode 100755
index 0000000..7ffe279
--- /dev/null
+++ b/mbtk/include/mbtk/mbtk_led_control.h
@@ -0,0 +1,29 @@
+#ifndef __MBTK_LED_CONTROL_H__
+#define __MBTK_LED_CONTROL_H__
+
+typedef enum
+{
+ MBTK_LED_STATUS_CLOSE = 0, /*close status_led*/
+ MBTK_LED_STATUS_OPEN = 1, /*open status_led*/
+}mbtk_led_status_type;
+
+typedef enum
+{
+ MBTK_LED_STATUS = 0, /*status_led*/
+ MBTK_LED_NET = 1, /*net_led*/
+
+ MBTK_LED_MUM
+}mbtk_led_all;
+
+typedef struct
+{
+ int led_type;
+ int status;
+}led_info_s;
+
+
+int mbtk_led_set(led_info_s led_info);
+
+#endif
+
+
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..acddb7c
--- /dev/null
+++ b/mbtk/include/mbtk/mbtk_log.h
@@ -0,0 +1,178 @@
+#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>
+#include <stdbool.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
+
+#if 0
+#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, 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)
+
+#else
+
+#define LOGV(fmt, args ...) \
+ do{ \
+ mbtk_log(LOG_VERBOSE_LEVEL, "%s()#%d: " fmt, __FUNCTION__, __LINE__, ##args); \
+ } while(0)
+
+#define LOGI(fmt, args...) \
+ do{ \
+ mbtk_log(LOG_INFO_LEVEL, "%s()#%d: " fmt, __FUNCTION__, __LINE__, ##args); \
+ } while(0)
+
+#define LOGD(fmt, args...) \
+ do{ \
+ mbtk_log(LOG_DEBUG_LEVEL, "%s()#%d: " fmt, __FUNCTION__, __LINE__, ##args); \
+ } while(0)
+
+#define LOGW(fmt, args...) \
+ do{ \
+ mbtk_log(LOG_WARN_LEVEL, "%s()#%d: " fmt, __FUNCTION__, __LINE__, ##args); \
+ } while(0)
+
+#define LOGE(fmt, args...) \
+ do{ \
+ mbtk_log(LOG_ERR_LEVEL, "%s()#%d: " fmt, __FUNCTION__, __LINE__, ##args); \
+ } while(0)
+#endif
+
+#endif
+
+#define MBTK_SOURCE_INFO_PRINT(name) \
+ do{ \
+ LOGD("%s : %s(%s)", name, MBTK_BUILD_GIT, MBTK_BUILD_TIME); \
+ printf("%s : %s(%s)\n", name, MBTK_BUILD_GIT, MBTK_BUILD_TIME); \
+ } while(0)
+
+
+void mbtk_debug_open(const char *log_file, bool thread_support);
+
+void mbtk_lib_info_print();
+
+#endif /* MBTK_LOG_INCLUDE */
diff --git a/mbtk/include/mbtk/mbtk_loop_buffer.h b/mbtk/include/mbtk/mbtk_loop_buffer.h
new file mode 100755
index 0000000..314978d
--- /dev/null
+++ b/mbtk/include/mbtk/mbtk_loop_buffer.h
@@ -0,0 +1,34 @@
+/*
+* mbtk_loop_buffer.h
+*
+* MBTK loop buffer header.
+*
+* Author : lb
+* Date : 2024/12/5 19:46:11
+*/
+#ifndef _MBTK_LOOP_BUFFER_H
+#define _MBTK_LOOP_BUFFER_H
+#include "mbtk_type.h"
+
+typedef void mbtk_loop_buff_handle;
+
+mbtk_loop_buff_handle* mbtk_loopbuff_get(int size);
+
+int mbtk_loopbuff_free(mbtk_loop_buff_handle* handle);
+
+int mbtk_loopbuff_write(mbtk_loop_buff_handle* handle, const void *data, int data_len);
+
+int mbtk_loopbuff_read(mbtk_loop_buff_handle* handle, void *data, int data_len);
+
+int mbtk_loopbuff_writen(mbtk_loop_buff_handle* handle, const void *data, int data_len);
+
+int mbtk_loopbuff_readn(mbtk_loop_buff_handle* handle, void *data, int data_len);
+
+// Only for read seek.
+int mbtk_loopbuff_seek(mbtk_loop_buff_handle* handle, int offset);
+
+int mbtk_loopbuff_size(mbtk_loop_buff_handle* handle);
+
+void mbtk_loopbuff_print(mbtk_loop_buff_handle* handle);
+
+#endif /* _MBTK_LOOP_BUFFER_H */
diff --git a/mbtk/include/mbtk/mbtk_lpm.h b/mbtk/include/mbtk/mbtk_lpm.h
new file mode 100755
index 0000000..10e1175
--- /dev/null
+++ b/mbtk/include/mbtk/mbtk_lpm.h
@@ -0,0 +1,38 @@
+#ifndef __MBTK_LPM_H__
+#define __MBTK_LPM_H__
+
+typedef enum
+{
+ E_MBTK_LPM_FALLING = 0, /* Falling, Means wakeupin falling to wakeup the module, or wakeupout falling to wakeup mcu. */
+ E_MBTK_LPM_RISING = 1, /* Rising, Means wakeupin rising to wakeup the module, or wakeupout rising to wakeup mcu. */
+}mbtk_lpm_edge_t;
+
+/* Callback function registered via Mbtk_Lpm_Init();
+ * It will be called when wakeup_in state changed.
+ * lpm_edge: report the wakeup_in state.
+*/
+typedef void (*mbtk_lpm_handler_t)
+(
+ mbtk_lpm_edge_t lpm_edge
+);
+
+/* Init MBTK LPM Init function.
+ * Para:
+ * mbtk_lpm_handler: the callback handler.
+ *
+ * Return value:
+ * 0 --> success
+ * -1 --> failed
+*/
+extern int mbtk_lpm_init(mbtk_lpm_handler_t mbtk_lpm_handler);
+
+/* Deinit MBTK LPM function
+ * Rmmod MBTK_lpm kmod, remove lpm handler.
+ * Return value:
+ * 0 --> success
+ * -1 --> failed
+*/
+extern int mbtk_lpm_deinit(void);
+
+#endif // __MBTK_LPM_H__
+
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_mbedtls.h b/mbtk/include/mbtk/mbtk_mbedtls.h
new file mode 100755
index 0000000..7a11c4e
--- /dev/null
+++ b/mbtk/include/mbtk/mbtk_mbedtls.h
@@ -0,0 +1,106 @@
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @file mbtk_mbedtls.h
+ @brief MBEDTLS API
+*/
+/*-----------------------------------------------------------------------------------------------*/
+
+/*-------------------------------------------------------------------------------------------------
+ Copyright (c) 2024 mobiletek Wireless Solution, Co., Ltd. All Rights Reserved.
+ mobiletek 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
+ -------- --------- -----------------------------------------------------------------
+ 20250409 yq.wang Created .
+-------------------------------------------------------------------------------------------------*/
+#ifndef __MBTK_MBEDTLS_H__
+#define __MBTK_MBEDTLS_H__
+#include <stdbool.h>
+
+#include <mbedtls/ssl.h>
+#include <mbedtls/entropy.h>
+#include <mbedtls/ctr_drbg.h>
+#include <mbedtls/error.h>
+#include <mbedtls/debug.h>
+#include <mbedtls/x509_crt.h>
+#include <mbedtls/pk.h>
+#include <mbedtls/ssl.h>
+#include <mbedtls/net_sockets.h>
+
+#define MBTK_MBEDTLS_SSL_IS_CLIENT MBEDTLS_SSL_IS_CLIENT
+#define MBTK_MBEDTLS_SSL_IS_SERVER MBEDTLS_SSL_IS_SERVER
+
+#define MBTK_MBEDTLS_SSL_TRANSPROT_STREAM MBEDTLS_SSL_TRANSPORT_STREAM
+#define MBTK_MBEDTLS_SSL_TRANSPROT_DATAGRAM MBEDTLS_SSL_TRANSPORT_DATAGRAM
+
+#define MBTK_MBEDTLS_SSL_PRESET_DEFAULT MBEDTLS_SSL_PRESET_DEFAULT
+#define MBTK_MBEDTLS_SSL_PRESET_SUITEB MBEDTLS_SSL_PRESET_SUITEB
+
+#define MBTK_MBEDTLS_SSL_VERIFY_NONE MBEDTLS_SSL_VERIFY_NONE
+#define MBTK_MBEDTLS_SSL_VERIFY_OPTIONAL MBEDTLS_SSL_VERIFY_OPTIONAL
+#define MBTK_MBEDTLS_SSL_VERIFY_REQUIRED MBEDTLS_SSL_VERIFY_REQUIRED
+
+#define MBTK_MBEDTLS_SSL_RENEGOTIATION_ENABLED MBEDTLS_SSL_RENEGOTIATION_ENABLED
+#define MBTK_MBEDTLS_SSL_RENEGOTIATION_DISABLED MBEDTLS_SSL_RENEGOTIATION_DISABLED
+
+#define MBTK_MBEDTLS_SSL_LEGACY_NO_RENEGOTIATION MBEDTLS_SSL_LEGACY_NO_RENEGOTIATION
+#define MBTK_MBEDTLS_SSL_LEGACY_ALLOW_RENEGOTIATION MBEDTLS_SSL_LEGACY_ALLOW_RENEGOTIATION
+#define MBTK_MBEDTLS_SSL_LEGACY_BREAK_HANDSHAKE MBEDTLS_SSL_LEGACY_BREAK_HANDSHAKE
+
+#define MBTK_MBEDTLS_SSL_MINOR_VERSION_2 MBEDTLS_SSL_MINOR_VERSION_2
+#define MBTK_MBEDTLS_SSL_MINOR_VERSION_3 MBEDTLS_SSL_MINOR_VERSION_3
+#define MBTK_MBEDTLS_SSL_MINOR_VERSION_4 MBEDTLS_SSL_MINOR_VERSION_4
+
+#define MBTK_MBEDTLS_SSL_MD_MD5 MBEDTLS_X509_ID_FLAG(MBEDTLS_MD_MD5)
+#define MBTK_MBEDTLS_SSL_MD_SHA1 MBEDTLS_X509_ID_FLAG(MBEDTLS_MD_SHA1)
+#define MBTK_MBEDTLS_SSL_MD_SHA224 MBEDTLS_X509_ID_FLAG(MBEDTLS_MD_SHA224)
+#define MBTK_MBEDTLS_SSL_MD_SHA256 MBEDTLS_X509_ID_FLAG(MBEDTLS_MD_SHA256)
+#define MBTK_MBEDTLS_SSL_MD_SHA384 MBEDTLS_X509_ID_FLAG(MBEDTLS_MD_SHA384)
+
+typedef enum {
+ MBTK_MBEDTLS_SSL_RESULT_SUCCESS = 0,
+ MBTK_MBEDTLS_SSL_RESULT_FAIL
+}mbtk_mbedtls_ssl_result_e;
+
+typedef struct {
+ int fd;
+ mbedtls_entropy_context *entropy;
+ mbedtls_ctr_drbg_context *ctr_drbg;
+ mbedtls_ssl_context *ssl;
+ mbedtls_ssl_config *conf;
+ mbedtls_x509_crt *cacert;
+ mbedtls_x509_crt *clientcert;
+ mbedtls_pk_context *clientkey;
+} mbtk_mbedtls_ssl_info_s;
+
+typedef struct {
+ bool load_cert; /* Whether to load the certificate */
+ const char *ca_file; /* the file with the CA certificate(s) */
+ const char *crt_file; /* the file with the client certificate */
+ const char *key_file; /* the file with the client key */
+ const unsigned char *pers_str; /* Personalized string, distinguish between different application scenarios of random number sequence */
+ int pers_str_size; /* Personalized string length */
+ int type; /* Client/server */
+ int transprot; /* Transport protocol */
+ int preset; /* The default security configuration level */
+ int auth_mode; /* Set the certificate authentication mode for SSL/TLS connections */
+ int renegotiation; /* Enables or disables the session renegotiation function */
+ int allow_legacy; /* Controls whether to enable compatibility support for TLS renegotiation of earlier versions */
+ int min_version; /* minimum protocol version accepted */
+ int max_version; /* maximum protocol version accepted */
+ uint32_t allowed_mds; /* List of allowed hashing algorithms (e.g. SHA-256) */
+}mbtk_mbedtls_ssl_options_s;
+
+mbtk_mbedtls_ssl_result_e mbtk_mbedtls_ssl_options_default(mbtk_mbedtls_ssl_options_s *opt);
+int mbtk_mbedtls_ssl_write(mbedtls_ssl_context *ssl, const unsigned char *buf, size_t len );
+int mbtk_mbedtls_ssl_read(mbedtls_ssl_context *ssl, unsigned char *buf, size_t len );
+mbtk_mbedtls_ssl_result_e mbtk_mbedtls_ssl_init(int fd , mbtk_mbedtls_ssl_options_s *opt, mbtk_mbedtls_ssl_info_s* inter_info);
+mbtk_mbedtls_ssl_result_e mbtk_mbedtls_ssl_deinit(mbtk_mbedtls_ssl_info_s* inter_info);
+
+#endif
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_mtd.h b/mbtk/include/mbtk/mbtk_mtd.h
new file mode 100755
index 0000000..b2935b9
--- /dev/null
+++ b/mbtk/include/mbtk/mbtk_mtd.h
@@ -0,0 +1,28 @@
+/*
+* mbtk_mtd.h
+*
+* MBTK mtd partition utils header.
+*
+* Author : lb
+* Date : 2024/2/26 16:03:50
+*/
+#ifndef _MBTK_MTD_H
+#define _MBTK_MTD_H
+#include "mbtk_type.h"
+
+#define MBTK_PARTITION_NUM_MAX 40
+
+typedef struct {
+ char name[32];
+ char dev[16];
+ uint32 partition_start;
+ uint32 partition_size;
+ uint32 erase_size;
+
+ bool used;
+} mbtk_partition_info_t;
+
+mbtk_partition_info_t* mbtk_partition_get();
+int mbtk_partition_get_by_name(char *partition_name, mbtk_partition_info_t *info);
+
+#endif /* _MBTK_MTD_H */
diff --git a/mbtk/include/mbtk/mbtk_net_control.h b/mbtk/include/mbtk/mbtk_net_control.h
new file mode 100755
index 0000000..2cfe788
--- /dev/null
+++ b/mbtk/include/mbtk/mbtk_net_control.h
@@ -0,0 +1,85 @@
+/*************************************************************
+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;
+
+typedef enum {
+ MBTK_NET_CHANGE_IF, // Interface changed.
+ MBTK_NET_CHANGE_ADDR // Address changed
+} mbtk_net_change_type_t;
+
+typedef enum {
+ MBTK_NET_IF_CHANGE_TYPE_ADD, // Interface add.
+ MBTK_NET_IF_CHANGE_TYPE_DEL // Interface delete.
+} mbtk_net_if_change_type_t;
+
+typedef enum {
+ MBTK_NET_IF_CHANGE_STATE_UP, // Interface up.
+ MBTK_NET_IF_CHANGE_STATE_DOWN // Interface down.
+} mbtk_net_if_change_state_t;
+
+typedef enum {
+ MBTK_NET_ADDR_CHANGE_TYPE_ADD, // Address add.
+ MBTK_NET_ADDR_CHANGE_TYPE_DEL // Address delete.
+} mbtk_net_addr_change_type_t;
+
+typedef struct {
+ int if_index;
+ char if_name[100];
+ mbtk_net_if_change_type_t type;
+ mbtk_net_if_change_state_t state;
+} mbtk_net_if_change_info_t;
+
+typedef struct {
+ int if_index;
+ char if_name[100];
+ mbtk_net_addr_change_type_t type;
+ char addr[100];
+} mbtk_net_addr_change_info_t;
+
+typedef void (*mbtk_net_state_callback_func)(mbtk_net_change_type_t type, const void *data);
+
+/*************************************************************
+ Extern variables
+*************************************************************/
+
+
+/*************************************************************
+ Public Function Declaration
+*************************************************************/
+mbtk_net_state_t mbtk_net_state_get();
+int mbtk_net_enable(bool enable);
+int mbtk_net_monitor_reg(const char* if_name, mbtk_net_state_callback_func state_cb);
+
+#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_openssl.h b/mbtk/include/mbtk/mbtk_openssl.h
new file mode 100755
index 0000000..ab2f7ca
--- /dev/null
+++ b/mbtk/include/mbtk/mbtk_openssl.h
@@ -0,0 +1,82 @@
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @file mbtk_openssl.h
+ @brief OPENSSL API
+*/
+/*-----------------------------------------------------------------------------------------------*/
+
+/*-------------------------------------------------------------------------------------------------
+ Copyright (c) 2024 mobiletek Wireless Solution, Co., Ltd. All Rights Reserved.
+ mobiletek 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
+ -------- --------- -----------------------------------------------------------------
+ 20250410 yq.wang Created .
+-------------------------------------------------------------------------------------------------*/
+#ifndef __MBTK_OPENSSL_H__
+#define __MBTK_OPENSSL_H__
+#include <stdbool.h>
+#include <openssl/ssl.h>
+#include <openssl/err.h>
+
+#define MBTK_OPENSSL_FILETYPE_PEM SSL_FILETYPE_PEM
+#define MBTK_OPENSSL_FILETYPE_ASN1 SSL_FILETYPE_ASN1
+
+#define MBTK_OPENSSL_VERIFY_NONE SSL_VERIFY_NONE
+#define MBTK_OPENSSL_VERIFY_PEER SSL_VERIFY_PEER
+//The following is valid only on the server side
+#define MBTK_OPENSSL_VERIFY_FAIL_IF_NO_PEER_CERT SSL_VERIFY_FAIL_IF_NO_PEER_CERT
+#define MBTK_OPENSSL_VERIFY_CLIENT_ONCE SSL_VERIFY_CLIENT_ONCE
+
+#define MBTK_OPENSSL_INIT_LOAD_SSL_STRINGS OPENSSL_INIT_LOAD_SSL_STRINGS
+#define MBTK_OPENSSL_INIT_LOAD_CRYPTO_STRINGS OPENSSL_INIT_LOAD_CRYPTO_STRINGS
+#define MBTK_OPENSSL_INIT_ADD_ALL_CIPHERS OPENSSL_INIT_ADD_ALL_CIPHERS
+#define MBTK_OPENSSL_INIT_ADD_ALL_DIGESTS OPENSSL_INIT_ADD_ALL_DIGESTS
+#define MBTK_OPENSSL_INIT_NO_LOAD_SSL_STRINGS OPENSSL_INIT_NO_LOAD_SSL_STRINGS
+#define MBTK_OPENSSL_INIT_NO_LOAD_CRYPTO_STRINGS OPENSSL_INIT_NO_LOAD_CRYPTO_STRINGS
+
+#define MBTK_OPENSSL_SAFETY_LEVEL_0 0
+#define MBTK_OPENSSL_SAFETY_LEVEL_1 1
+#define MBTK_OPENSSL_SAFETY_LEVEL_2 2
+#define MBTK_OPENSSL_SAFETY_LEVEL_3 3
+#define MBTK_OPENSSL_SAFETY_LEVEL_4 4
+#define MBTK_OPENSSL_SAFETY_LEVEL_5 5
+
+typedef int (*mbtk_verify_callback)(int preverify_ok, X509_STORE_CTX *x509_ctx);
+
+typedef enum {
+ MBTK_OPENSSL_RESULT_SUCCESS = 0,
+ MBTK_OPENSSL_RESULT_FAIL
+}mbtk_openssl_result_e;
+
+typedef struct {
+ int fd;
+ SSL_CTX *ctx;
+ SSL *ssl;
+} mbtk_openssl_info_s;
+
+typedef struct {
+ bool load_cert; /* Whether to load the certificate */
+ const char *ca_file; /* the file with the CA certificate(s) */
+ const char *crt_file; /* the file with the client certificate */
+ const char *key_file; /* the file with the client key */
+ int ssl_filetype; /* Specifies the encoding format of the certificate file */
+ int verify_mode; /* Verification mode */
+ mbtk_verify_callback verify_cb; /* Custom validation callback functions */
+ uint64_t init_opts; /* The bit mask of the initialization option */
+ int safety_level; /* Set security level(0-5) */
+}mbtk_openssl_options_s;
+
+mbtk_openssl_result_e mbtk_openssl_options_default(mbtk_openssl_options_s *opt);
+int mbtk_openssl_write(SSL *ssl, const void *buf, int len);
+int mbtk_openssl_read(SSL *ssl, void *buf, int len);
+mbtk_openssl_result_e mbtk_openssl_init(int fd, mbtk_openssl_options_s *opt, mbtk_openssl_info_s *inter_info);
+mbtk_openssl_result_e mbtk_openssl_deinit(mbtk_openssl_info_s *inter_info);
+
+#endif
\ No newline at end of file
diff --git a/mbtk/include/mbtk/mbtk_pdu_sms.h b/mbtk/include/mbtk/mbtk_pdu_sms.h
new file mode 100755
index 0000000..83ab0d2
--- /dev/null
+++ b/mbtk/include/mbtk/mbtk_pdu_sms.h
@@ -0,0 +1,431 @@
+//
+// Created by hitmoon on 15-12-9.
+//
+
+#ifndef SMS_SMS_H
+#define SMS_SMS_H
+
+#include <string.h>
+#include "mbtk_utf.h"
+#include "mbtk_type.h"
+
+#define MAX_SMS_NR 32
+
+//typedef int bool;
+
+#define true 1
+#define false 0
+
+enum EnumDCS {
+ BIT7 = 0, // GSM 字符集
+ BIT8 = 1, // ASCII字符集
+ UCS2 = 2 // Unicode 字符集
+};
+
+enum EnumUDL {
+ BIT7UDL = 160,
+ BIT8UDL = 140,
+ UCS2UDL = 70
+};
+
+enum EnumCSMIEI {
+ BIT8MIEI = 0,
+ BIT16MIEI = 8
+};
+
+struct PDUUDH {
+ unsigned int count; // 信息元素数据字节数
+ char IEI; // 信息元素标识
+ char *IED; // 信息元素数据
+};
+
+// 用户数据头
+struct UDHS {
+ int count;
+ struct PDUUDH *UDH;
+};
+
+// 用户数据数组,用于拆分短信
+struct UDS {
+ unsigned int total;
+ char **Data;
+};
+
+// 编码后短信
+struct PDUS {
+ unsigned int count;
+ char **PDU;
+};
+
+struct ByteArray {
+ char *array;
+ unsigned int len;
+};
+
+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:终端设备特定类型
+
+};
+
+/* mbtk sms start */
+
+#define REPLACEMENT_CHAR (UTF32)0x0000FFFD
+#define MAX_UNI_BMP (UTF32)0x0000FFFF
+#define MAX_UNI_UCS2 MAX_UNI_BMP
+#define MAX_UTF16 (UTF32)0x0010FFFF
+#define MAX_UTF32 (UTF32)0x7FFFFFFF
+#define MAX_LEGAL_UTF32 (UTF32)0x0010FFFF
+
+#define MDAPI_TIME_STR_SIZE 22
+#define MDAPI_PHONE_NUMBER_SIZE 32
+#define MDAPI_MAX_PDU_SIZE 512
+#define MAX_CONCATENATED_MSG 32
+#define MAX_7BIT_MSG_LEN 153
+#define MAX_UCS2_MSG_LEN 67
+#define MAX_8BIT_MSG_LEN 268 //134*2
+
+#define SMS_DELIVER 0x00
+#define SMS_DELIVER_REPORT 0x00
+#define SMS_SUBMIT 0x01
+#define SMS_SUBMIT_REPORT 0x01
+#define SMS_STATUS_REPORT 0x02
+#define SMS_STATUS_COMMAND 0x02
+
+
+#define STATUS_SUCCESS 0
+#define STATUS_MEM_EXHAUSTED (-0xC0000)
+#define STATUS_ILLEGAL_UTF8 (-0xC0001)
+#define STATUS_ILLEGAL_UTF16 (-0xC0002)
+#define STATUS_ILLEGAL_UTF32 (-0xC0003)
+#define STATUS_ILLEGAL_UCS2 (-0xC0004)
+#define STATUS_NULL_POINTER (-0x00001)
+
+
+#define SUR_HIGH_START (UTF32)0xD800
+#define SUR_HIGH_END (UTF32)0xDBFF
+#define SUR_LOW_START (UTF32)0xDC00
+#define SUR_LOW_END (UTF32)0xDFFF
+
+
+
+/*
+ * Unix/Linux
+ */
+typedef char kal_int8;
+
+typedef unsigned char kal_uint8;
+
+typedef short kal_int16;
+
+typedef unsigned short kal_uint16;
+
+typedef int kal_int32;
+
+typedef unsigned int kal_uint32;
+
+/**/
+typedef long long kal_int64;
+
+/**/
+typedef unsigned long long kal_uint64;
+
+typedef char kal_char;
+
+
+
+
+enum SMS_VPF_E
+{
+ SMS_VPF_NO_PRESENT = 0x00,
+ SMS_VPF_RESORVED = 0x01,
+ SMS_VPF_RELATIVE = 0x02,
+ SMS_VPF_ABSOLUTE = 0x03,
+ SMS_VPF_INVALID = 0xFF,
+};
+
+
+enum SMS_ADDR_NUM_PLAN
+{
+ SMS_NP_UNKOWN = 0x00,
+ SMS_NP_ISDNTEL = 0x01,
+ SMS_NP_DATA = 0x03,
+ SMS_NP_TELIX = 0x04,
+ SMS_NP_NATIONAL = 0x08,
+ SMS_NP_PRIVATE = 0x09,
+ SMS_NP_RESERVED = 0xFF,
+};
+
+enum SMS_ADDR_TYPE
+{
+ SMS_TON_UNKNOWN = 0,
+ SMS_TON_INTERNATIONAL = 1,
+ SMS_TON_NATIONAL = 2,
+ SMS_TON_NETWORKSPECIFIC = 3,
+ SMS_TON_SUBSCRIBER = 4,
+ SMS_TON_ALPHANUMERIC = 5,
+ SMS_TON_ABBREVIATED = 6,
+ SMS_TON_RESERVED = 7
+};
+
+enum SMS_ADDR_ENCODE_TYPE
+{
+ SMS_ENCODE_SCA = 0,
+ SMS_ENCODE_OADA = 1,
+ SMS_ENCODE_INVALID = 0xFF,
+};
+
+enum MDAPI_RET_e {
+ MDAPI_RET_SUCCESS = 0,
+ MDAPI_RET_ERROR = 1,
+ MDAPI_RET_TIMEOUT = 2,
+ MDAPI_RET_NOT_SUPPORT = 3,
+};
+
+enum MDAPI_SMS_CHARSET_E
+{
+ MDAPI_SMS_CHARSET_GSM_7BIT = 0x00000000,
+ MDAPI_SMS_CHARSET_GSM_8BIT = 0x00000001,
+ MDAPI_SMS_CHARSET_UCS2 = 0x00000002,
+ MDAPI_SMS_CHARSET_INVALID,
+};
+
+enum MDAPI_SMS_POSITION_E
+{
+ MDAPI_SMS_POS_INBOX = 0x00000001,
+ MDAPI_SMS_POS_SENTBOX = 0x00000002,
+ MDAPI_SMS_POS_DRAFBOX = 0x00000003,
+ MDAPI_SMS_POS_OUTBOX = 0x00000004,
+ MDAPI_SMS_POS_INVALID,
+};
+
+/* */
+enum MDAPI_SMS_MSGTYPE_E
+{
+ MDAPI_SMS_NORMAL_MSG = 0x00000000,
+ MDAPI_SMS_MSG_REPORT = 0x00000001,
+ MDAPI_SMS_MMS_ALERT = 0x00000002,
+ MDAPI_SMS_VOICE_MAIL = 0x00000003,
+ MDAPI_SMS_MSGTYPE_INVALID,
+};
+
+typedef struct _mdapi_sms_setting {
+ kal_int8 rd; /* reject duplicate */
+ kal_int8 vpf; /* validity peroid format */
+ kal_int8 srr; /* status report request */
+ kal_int8 rp; /* replay path */
+ kal_int32 validity_period; /* validity peroid */
+} mdapi_sms_settings_t;
+
+typedef struct _mdapi_sms_record {
+ kal_int32 msg_id;
+ kal_int32 is_read;
+ kal_int32 position;
+ kal_int32 result;
+ kal_int32 msg_type;
+ kal_int32 sms_class;
+ kal_int32 total_pack;
+ kal_int32 curr_pack;
+ kal_int32 ref_num;
+ kal_int32 msg_location;
+ kal_int16 charset;
+ kal_char time[MDAPI_TIME_STR_SIZE]; /*YYYY-MM-DD HH:MM:SS*/
+ kal_char phone_number[MDAPI_PHONE_NUMBER_SIZE];
+ kal_char *msg_content;
+} mdapi_sms_record_t;
+
+typedef struct _smsbuf {
+ kal_uint8 *curbyte;
+ kal_uint8 *finalbyte;
+ kal_uint8 *septet_start;
+ kal_uint8 curbit;
+ kal_uint8 smsbuf[512];
+} smsbuf_t;
+
+static const kal_int32 UTF16_HALF_SHIFT = 10; /* used for shifting by 10 bits */
+static const UTF32 UTF16_HALF_BASE = 0x0010000UL;
+static const UTF32 UTF16_HALF_MASK = 0x3FFUL;
+
+static const unsigned char utf8_tailing_bytes[256] = {
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,
+ 3,3,3,3,3,3,3,3,4,4,4,4,5,5,5,5
+};
+
+static const UTF32 utf8_offsets[6] = {
+ 0x00000000UL,
+ 0x00003080UL,
+ 0x000E2080UL,
+ 0x03C82080UL,
+ 0xFA082080UL,
+ 0x80282080UL
+};
+
+#define MAX_OUT_SIZE 512
+#define MAX_PDU_SIZE 512
+
+typedef struct latin1_to_gsm_extable {
+ kal_int8 symbol;
+ kal_uint8 value;
+} Latin1_to_Gsm_ExTable;
+
+
+
+static const UTF8 first_byte_mark[7] = {
+ 0x00,
+ 0x00,
+ 0xC0,
+ 0xE0,
+ 0xF0,
+ 0xF8,
+ 0xFC
+};
+
+
+int smsPduEncode(const char *smsc, const char *da_num, const char *msg, int charset, char *smsc_pdu, char **pdu);
+
+int smsPduDecode(const char *pdu_str, int pdu_len, char *da_num, char *smsc, char *msg, int *charset, int *curr_pack, int *total_pack, char *date);
+
+kal_int32 _mdapi_sms_get_msg_num(const char *msg, int charset, kal_int32 *msg_num, kal_int32 *msg_len);
+
+kal_int32 _mdapi_sms_encode_addr(smsbuf_t *buf, kal_int8 *smsc, kal_int32 type);
+
+kal_int32 _mdapi_sms_encode_pdu(mdapi_sms_record_t *sms,kal_int8 *smsc, mdapi_sms_settings_t *settings, kal_char *start, kal_int32 send_size, kal_uint8 *udh, kal_char *output, kal_int32 out_len, kal_int32 *sca_out_len);
+
+void ArrayToStr(unsigned char *Buff, unsigned int BuffLen, char *OutputStr);
+/* mbtk sms end */
+
+
+// 短信解码
+struct SMS_Struct PDUDecoding(const char *data);
+
+// 短信编码, 自动确定编码方案
+struct PDUS *PDUEncoding(char *SCA, char *DA, char *UDC, struct UDHS *udhs);
+
+// 短信编码真正的工作
+/// 发送方PDU格式(SMS-SUBMIT-PDU)
+/// SCA(Service Center Adress):短信中心,长度1-12
+/// PDU-Type(Protocol Data Unit Type):协议数据单元类型,长度1
+/// MR(Message Reference):消息参考值,为0~255。长度1
+/// DA(Destination Adress):接收方SME的地址,长度2-12
+/// PID(Protocol Identifier):协议标识,长度1
+/// DCS(Data Coding Scheme):编码方案,长度1
+/// VP(Validity Period):有效期,长度为1(相对)或者7(绝对或增强)
+/// UDL(User Data Length):用户数据段长度,长度1
+/// UD(User Data):用户数据,长度0-140
+
+struct PDUS *PDUDoEncoding(char *SCA, char *DA, char *UDC, struct UDHS *udhs, enum EnumDCS DCS);
+
+
+// 服务中心地址解码
+char *SCADecoding(const char *data, int *EndIndex);
+
+// 原始地址解码
+char *OADecoding(const char *data, int index, int *EndIndex);
+
+// 服务中心时间戳解码
+char *SCTSDecoding(const char *data, int index);
+
+// BCD 解码
+int BCDDecoding(const char *data, int index, bool isMSB);
+
+// 用户数据头解码
+struct UDHS *UDHDecoding(const char *data, int index);
+
+// 用户数据解码
+char *UserDataDecoding(const char *data, int index, bool UDHI, enum EnumDCS dcs);
+
+// 7-Bit编码解压缩
+char *BIT7Unpack(const char *data, int index, int Septets, int FillBits);
+
+// 转换GSM字符编码到Unicode编码
+char *BIT7Decoding(char *BIT7Data, unsigned int size);
+
+// 7-Bit序列和Unicode编码是否相同
+int isBIT7Same(u_int16_t UCS2);
+
+// 判断是否是GSM字符串
+int isGSMString(char *Data);
+
+// 用户数据拆分
+struct UDS *UDCSplit(char *UDC, struct UDHS *uhds, enum EnumDCS DCS);
+
+// 获得用户数据头长度
+int getUDHL(struct UDHS *udhs);
+
+// 计算需要的7-Bit编码字节数
+int SeptetsLength(char *source);
+
+// 将7-Bit编码字节数换算成UCS2编码字符数
+int SeptetsToChars(char *source, int index, int septets);
+
+// 在用户数据头中增加长短信信息元素
+struct UDHS *UpdateUDH(struct UDHS *udhs, int CSMMR, int total, int index);
+
+//单条短信编码
+char *SoloPDUEncoding(char *SCA, char *DA, char *UC, struct UDHS *udhs, enum EnumDCS DCS);
+
+// SCA编码
+char *SCAEncoding(char *SCA);
+
+// PDUTYPE 编码
+char *PDUTypeEncoding(bool UDH);
+
+// MR,消息参考值
+char *MREncoding();
+
+//接收方SME地址
+char *DAEncoding(char *DA);
+
+// 协议标识
+char *PIDEncoding();
+
+// 编码方案
+char *DCSEncoding(char *UD, enum EnumDCS DCS);
+
+// 用户数据长度及内容
+char *UDEncoding(char *UD, struct UDHS *udhs, enum EnumDCS DCS);
+
+// 用户数据头编码
+char *UDHEncoding(struct UDHS *udhs, int *UDHL);
+
+// 用户数据内容编码
+char *UDCEncoding(char *UDC, int *UDCL, int UDHL, enum EnumDCS DCS);
+
+// 将UCS2编码字符串转换成7-Bit编码字节 序列
+struct ByteArray *BIT7Encoding(char *UDC, int *Septets);
+
+// 7-Bit编码压缩
+char *BIT7Pack(struct ByteArray *Bit7Array, int UDHL);
+
+void sms_init();
+
+#endif //SMS_SMS_H
diff --git a/mbtk/include/mbtk/mbtk_power.h b/mbtk/include/mbtk/mbtk_power.h
new file mode 100755
index 0000000..70175f8
--- /dev/null
+++ b/mbtk/include/mbtk/mbtk_power.h
@@ -0,0 +1,15 @@
+#ifndef __MBTK_POWER_H__
+#define __MBTK_POWER_H__
+
+#include "mbtk_log.h"
+
+typedef enum{
+ MBTK_POWER_RESULT_SUCCESS = 0,
+ MBTK_POWER_RESULT_GNSS_TIMEOUT,
+ MBTK_POWER_RESULT_GNSS_CLOSE_FAIL,
+ MBTK_POWER_RESULT_NO_SLEEP_NODE,
+ MBTK_POWER_RESULT_UKNOWN_ERROR
+}mbtk_power_result_type;
+
+int mbtk_system_sleep(void);
+#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_ril_api.h b/mbtk/include/mbtk/mbtk_ril_api.h
new file mode 100755
index 0000000..845898f
--- /dev/null
+++ b/mbtk/include/mbtk/mbtk_ril_api.h
@@ -0,0 +1,1646 @@
+/*
+*
+* Data : 2024/07/19 11:24:09
+* Author : LiuBin
+*/
+#ifndef _MBTK_INFO_API_2_H
+#define _MBTK_INFO_API_2_H
+#include <netinet/in.h>
+
+#include "mbtk_type.h"
+#include "mbtk_list.h"
+#include "mbtk_log.h"
+#include "mbtk_utils.h"
+#include "mbtk_pdu_sms.h"
+
+// LOG_DEBUG_LEVEL 7
+#define LOG LOGI
+
+#define MBTK_APN_CID_MIN 1
+#define MBTK_APN_CID_MAX 7
+#define CELL_NUM_MAX 15
+#if 1
+#define APN_STR_MAX 128
+#define APN_NAME_STR_MAX (150+1)
+#else
+#define APN_STR_MAX 64
+#define APN_NAME_STR_MAX (64+1)
+#endif
+#define RIL_PIN_STR_MAX 16
+#define RIL_DATA_CALL_RETRY_MAX 20
+#define RIL_MAX_NUMBER_LEN 40
+#define MBTK_ECALL_MSD_LEN_MAX 600
+
+typedef void mbtk_ril_handle;
+
+typedef void (*mbtk_ril_callback_func)(const void* data, int data_len);
+
+typedef enum
+{
+ ATPORTTYPE_NON = -1,
+ ATPORTTYPE_0 = 0, // /tmp/atcmd_at
+ ATPORTTYPE_1, // /tmp/atcmd_at_1
+ ATPORTTYPE_2, // /tmp/atcmd_at_2
+
+ ATPORTTYPE_NUM,
+
+ MBTK_AT_PORT_DEF = ATPORTTYPE_0, // Generic Port
+ MBTK_AT_PORT_VOICE = ATPORTTYPE_1, // Voice Call Port
+ MBTK_AT_PORT_DATA = ATPORTTYPE_2 // Data Call Port
+} ATPortType_enum;
+
+typedef enum {
+ MBTK_RIL_CID_NUL = 0, // Auto set cid.
+ MBTK_RIL_CID_DEF = MBTK_APN_CID_MIN,
+ MBTK_RIL_CID_1 = MBTK_RIL_CID_DEF,
+ MBTK_RIL_CID_2,
+ MBTK_RIL_CID_3,
+ MBTK_RIL_CID_4,
+ MBTK_RIL_CID_5,
+ MBTK_RIL_CID_6,
+ MBTK_RIL_CID_7 = MBTK_APN_CID_MAX
+} mbtk_ril_cid_enum;
+
+typedef enum {
+ MBTK_RIL_ERR_SUCCESS = 0,
+ MBTK_RIL_ERR_INITED,
+ MBTK_RIL_ERR_NOT_INIT,
+ MBTK_RIL_ERR_PORT, // AT port error.
+ MBTK_RIL_ERR_PORT_NOT_CLOSE, // Has at port not close.
+ MBTK_RIL_ERR_PARAMETER, // Parameter error.
+ MBTK_RIL_ERR_FORMAT, // Packet format error.
+ MBTK_RIL_ERR_SEND_PACK, // Packet send fail.
+ MBTK_RIL_ERR_REQ_UNKNOWN, // Unknown request.
+ MBTK_RIL_ERR_REQ_PARAMETER, // Request parameter error.
+ MBTK_RIL_ERR_UNSUPPORTED, // Unsupported operation.
+ MBTK_RIL_ERR_MEMORY, // Insufficient memory.
+ MBTK_RIL_ERR_IND_FULL, // Register IND fail(FULL).
+ MBTK_RIL_ERR_IND_UNKNOWN, // Register IND fail(Unknown IND).
+ MBTK_RIL_ERR_CID, // CID error.
+ MBTK_RIL_ERR_NET_CONF,
+ MBTK_RIL_ERR_TIMEOUT, // Timeout.
+ MBTK_RIL_ERR_TIME_FORMAT, // Time format error.
+ MBTK_RIL_ERR_DATA_CONNECTED, // Data call is connected.
+ MBTK_RIL_ERR_DATA_DISCONNECTED, // Data call is disconnected.
+
+ MBTK_RIL_ERR_UNKNOWN = 400, // Unknown error.
+ // CME error start index.
+ MBTK_RIL_ERR_CME = 500,
+ MBTK_RIL_ERR_CME_NON = 1000
+} mbtk_ril_err_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_TEMP_TYPE_SOC,
+ MBTK_TEMP_TYPE_RF
+} mbtk_temp_type_enum;
+
+typedef enum {
+ MBTK_TIME_TYPE_CELL = 0, //NITZ
+ MBTK_TIME_TYPE_NTP,
+ MBTK_TIME_TYPE_GNSS,
+ MBTK_TIME_TYPE_USER
+} mbtk_time_type_enum;
+
+typedef enum {
+ MBTK_CLCC = 1,
+ MBTK_CPAS,
+ MBTK_DISCONNECTED,
+} mbtk_call_enum;
+
+
+/*
+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, // EC-GSM-IoT
+
+ MBTK_RADIO_TECH_EUTRAN_PLUS, // NB-IoT(NB-S1 mode)
+ MBTK_RADIO_TECH_EUTRAN_TO_5GCN, // E-UTRAN connected to a 5GCN (NSA)
+ MBTK_RADIO_TECH_NR_TO_5GCN, // NR connected to a 5GCN (SA)
+ MBTK_RADIO_TECH_NGRAN, // NG-RAN (NSA+SA)
+ MBTK_RADIO_TECH_EUTRAN_NR_DUAL_LINK, // dual connectivity of E-UTRA with NR and is connected to an EPS core.
+
+ MBTK_RADIO_TECH_UNKNOWN = 0xFF
+} mbtk_radio_technology_enum;
+
+typedef enum {
+ MBTK_RADIO_STATE_UNKNOWN = -1,
+ MBTK_RADIO_STATE_MINI_FUNC = 0,
+ MBTK_RADIO_STATE_FULL_FUNC,
+ MBTK_RADIO_STATE_DIS_RECV_RF = 3,
+ MBTK_RADIO_STATE_DIS_RF,
+ MBTK_RADIO_STATE_DIS_SIM,
+ MBTK_RADIO_STATE_SEC_RX_OFF
+} mbtk_radio_state_enum;
+
+typedef enum {
+ MBTK_SIM_STATE_UNKNOWN = -1,
+ MBTK_SIM_STATE_ABSENT = 0,
+ MBTK_SIM_STATE_NOT_READY,
+ MBTK_SIM_STATE_READY,
+ MBTK_SIM_STATE_SIM_PIN,
+ MBTK_SIM_STATE_SIM_PUK,
+ MBTK_SIM_STATE_PH_SIMLOCK_PIN,
+ MBTK_SIM_STATE_PH_SIMLOCK_PUK,
+ MBTK_SIM_STATE_PH_FSIM_PIN,
+ MBTK_SIM_STATE_PH_FSIM_PUK,
+ MBTK_SIM_STATE_SIM_PIN2,
+ MBTK_SIM_STATE_SIM_PUK2,
+ MBTK_SIM_STATE_PH_NET_PIN,
+ MBTK_SIM_STATE_PH_NET_PUK,
+ MBTK_SIM_STATE_PH_NETSUB_PIN,
+ MBTK_SIM_STATE_PH_NETSUB_PUK,
+ MBTK_SIM_STATE_PH_SP_PIN,
+ MBTK_SIM_STATE_PH_SP_PUK,
+ MBTK_SIM_STATE_PH_CORP_PIN,
+ MBTK_SIM_STATE_PH_CORP_PUK
+} mbtk_sim_state_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_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;
+
+
+typedef enum {
+ MBTK_ECALL_CFG_ITEM_T3 = 0, // ms
+ MBTK_ECALL_CFG_ITEM_T5, // ms
+ MBTK_ECALL_CFG_ITEM_T6, // ms
+ MBTK_ECALL_CFG_ITEM_T7, // ms
+ MBTK_ECALL_CFG_ITEM_TH, // ms
+ MBTK_ECALL_CFG_ITEM_TIMER_CALLBACK, // T9 // 5
+ MBTK_ECALL_CFG_ITEM_TIMER_CLEARDOWN, // T2
+ MBTK_ECALL_CFG_ITEM_TIMER_DEREG, // T10
+ MBTK_ECALL_CFG_ITEM_TIMER_DIAL, // "dial"
+ MBTK_ECALL_CFG_ITEM_TIMER_REDIAL, // "redialtmr"
+ MBTK_ECALL_CFG_ITEM_TIMER_SMS, // "sms" // 10
+ MBTK_ECALL_CFG_ITEM_REDIALCNT, // "redialcnt"
+ MBTK_ECALL_CFG_ITEM_SMSPROCESS, // "smsprocess"
+ MBTK_ECALL_CFG_ITEM_SMSMSDCNT, // "smsmsdcnt"
+
+ MBTK_ECALL_CFG_ITEM_MAX
+} mbtk_ecall_cfg_item_enum;
+
+#define MBTK_ECALL_CFG_T3 (1 << MBTK_ECALL_CFG_ITEM_T3) // ms
+#define MBTK_ECALL_CFG_T5 (1 << MBTK_ECALL_CFG_ITEM_T5) // ms
+#define MBTK_ECALL_CFG_T6 (1 << MBTK_ECALL_CFG_ITEM_T6) // ms
+#define MBTK_ECALL_CFG_T7 (1 << MBTK_ECALL_CFG_ITEM_T7) // ms
+#define MBTK_ECALL_CFG_TH (1 << MBTK_ECALL_CFG_ITEM_TH) // ms
+#define MBTK_ECALL_CFG_TIMER_CALLBACK (1 << MBTK_ECALL_CFG_ITEM_TIMER_CALLBACK) // T9
+#define MBTK_ECALL_CFG_TIMER_CLEARDOWN (1 << MBTK_ECALL_CFG_ITEM_TIMER_CLEARDOWN) // T2
+#define MBTK_ECALL_CFG_TIMER_DEREG (1 << MBTK_ECALL_CFG_ITEM_TIMER_DEREG) // T10
+#define MBTK_ECALL_CFG_TIMER_DIAL (1 << MBTK_ECALL_CFG_ITEM_TIMER_DIAL) // "dial"
+#define MBTK_ECALL_CFG_TIMER_REDIAL (1 << MBTK_ECALL_CFG_ITEM_TIMER_REDIAL) // "redialtmr"
+#define MBTK_ECALL_CFG_TIMER_SMS (1 << MBTK_ECALL_CFG_ITEM_TIMER_SMS) // "sms" // 10
+#define MBTK_ECALL_CFG_REDIALCNT (1 << MBTK_ECALL_CFG_ITEM_REDIALCNT) // "redialcnt"
+#define MBTK_ECALL_CFG_SMSPROCESS (1 << MBTK_ECALL_CFG_ITEM_SMSPROCESS) // "smsprocess"
+#define MBTK_ECALL_CFG_SMSMSDCNT (1 << MBTK_ECALL_CFG_ITEM_SMSMSDCNT) // "smsmsdcnt"
+
+
+/*
+ 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)
+ 16 : 5GS network
+ 17 : Dual mode(4G/5G, auto)
+ 18 : Dual mode(4G/5G, LTE preferred)
+ 19 : Dual mode(4G/5G, 5GS preferred)
+ 20 : Triple mode(3G/4G/5G, auto)
+ 21 : Triple mode(3G/4G/5G, UMTS preferred)
+ 22 : Triple mode(3G/4G/5G, LTE preferred)
+ 23 : Triple mode(3G/4G/5G, 5GS preferred)
+ 24 : Quadruple mode (2G/3G/4G/5G, auto)
+ 25 : Quadruple mode (2G/3G/4G/5G, GSM preferred)
+ 26 : Quadruple mode (2G/3G/4G/5G, UMTS preferred)
+ 27 : Quadruple mode (2G/3G/4G/5G, LTE preferred)
+ 28 : Quadruple mode (2G/3G/4G/5G, 5GS preferred)
+*/
+typedef enum
+{
+ MBTK_NET_PREF_UNUSE = -1,
+ MBTK_NET_PREF_GSM_ONLY = 0, // 0 : GSM Only
+ MBTK_NET_PREF_UMTS_ONLY, // 1 : 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, // 5 : 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, // 15
+ MBTK_NET_PREF_NR_ONLY, // 16 : NR Only
+ MBTK_NET_PREF_LTE_NR_AUTO,
+ MBTK_NET_PREF_LTE_NR_LTE_PREF,
+ MBTK_NET_PREF_LTE_NR_NR_PREF,
+ MBTK_NET_PREF_UMTS_LTE_NR_AUTO, // 20
+ MBTK_NET_PREF_UMTS_LTE_NR_UMTS_PREF,
+ MBTK_NET_PREF_UMTS_LTE_NR_LTE_PREF,
+ MBTK_NET_PREF_UMTS_LTE_NR_NR_PREF,
+ MBTK_NET_PREF_GSM_UMTS_LTE_NR_AUTO,
+ MBTK_NET_PREF_GSM_UMTS_LTE_NR_GSM_PREF, // 25
+ MBTK_NET_PREF_GSM_UMTS_LTE_NR_UMTS_PREF,
+ MBTK_NET_PREF_GSM_UMTS_LTE_NR_LTE_PREF,
+ MBTK_NET_PREF_GSM_UMTS_LTE_NR_NR_PREF,
+ // Last item.
+ MBTK_NET_PREF_MAX
+} mbtk_net_pref_enum;
+
+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 {
+ int num;
+ mbtk_net_info_t net_info[20];
+} mbtk_net_info_array_t;
+
+typedef struct
+{
+ mbtk_net_pref_enum net_pref; // mbtk_net_pref_enum
+ uint32 gsm_band; // mbtk_gsm_band_enum
+ uint32 umts_band; // mbtk_umts_band_enum
+ uint32 tdlte_band; // mbtk_tdlte_band_enum
+ uint32 fddlte_band; // mbtk_fddlte_band_enum
+ uint32 lte_ext_band; // mbtk_lte_ext_band_enum
+ uint32 nr_3_band;
+ uint32 nr_2_band;
+ uint32 nr_1_band;
+ uint32 nr_0_band;
+} __attribute__((packed)) mbtk_band_info_t;
+
+typedef enum
+{
+ MBTK_CELL_TYPE_GSM = 0,
+ MBTK_CELL_TYPE_UMTS,
+ MBTK_CELL_TYPE_LTE,
+ MBTK_CELL_TYPE_NR
+} mbtk_cell_type_enum;
+
+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 struct {
+ mbtk_ipv4_info_t ipv4;
+ mbtk_ipv6_info_t ipv6;
+} __attribute__((packed)) mbtk_ip_info_t;
+
+typedef struct
+{
+ mbtk_radio_technology_enum type : 8; // 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
+ uint8 ss_rsrq; // 0: ss_rsrq < -43 dB
+ // 1: -43 dB <= ss_rsrq < -42.5 dB
+ // 2: -42.5 dB <= ss_rsrq < -42 dB
+ // ......
+ // 125: 19 dB <= ss_rsrq < 19.5 dB
+ // 126: 19.5 dB <= ss_rsrq < 20 dB
+ // 255: not known or not detectable
+ uint8 ss_rsrp; // 0: ss_rsrp < -156 dBm
+ // 1: -156 dBm <= ss_rsrp < -155 dBm
+ // 2: -155 dBm <= ss_rsrp < -154 dBm
+ // ......
+ // 125: -32 dBm <= ss_rsrp < -31 dBm
+ // 126: -31 dBm <= ss_rsrp
+ // 255: not known or not detectable
+ uint8 ss_sinr; // 0: ss_sinr < -23 dB
+ // 1: -23 dB ss_sinr < -22.5 dB
+ // 2: -22.5 dB ss_sinr < -22 dB
+ // ......
+ // 125: 39 dB ss_sinr < 39.5 dBm
+ // 126: 39.5 dB ss_sinr < 40 dB
+ // 127: 40 dB ss_sinr
+ // 255: not known or not detectable
+} __attribute__((packed)) mbtk_signal_info_t;
+
+
+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
+{
+ mbtk_net_reg_state_enum call_state : 8;// mbtk_net_reg_state_enum
+ mbtk_net_reg_state_enum data_state : 8;// mbtk_net_reg_state_enum
+ mbtk_net_reg_state_enum ims_state : 8;// mbtk_net_reg_state_enum
+ mbtk_radio_technology_enum type : 8; // mbtk_radio_technology_enum
+ uint32 lac;
+ uint64 ci;
+} __attribute__((packed)) mbtk_net_reg_info_t;
+
+typedef enum {
+ MBTK_APN_AUTH_PROTO_DEFAULT = 0,
+ MBTK_APN_AUTH_PROTO_NONE,
+ MBTK_APN_AUTH_PROTO_PAP,
+ MBTK_APN_AUTH_PROTO_CHAP,
+#if 0
+ MBTK_APN_AUTH_PROTO_PAP_CHAP,
+ //NOT SUPPORT
+#endif
+} mbtk_apn_auth_type_enum;
+
+typedef struct {
+ mbtk_ril_cid_enum cid : 8; // 1 - 7
+ mbtk_ip_type_enum ip_type : 8; // mbtk_ip_type_enum
+ mbtk_apn_auth_type_enum auth : 8;
+ uint8 auto_save;
+ uint8 auto_boot_call;
+ uint8 redial_enable; // Support redialing or not.
+ uint8 def_route;
+ uint8 as_dns;
+ uint8 apn[APN_NAME_STR_MAX];
+ uint8 user[APN_STR_MAX];
+ uint8 pass[APN_STR_MAX];
+ uint8 type[APN_NAME_STR_MAX];
+} mbtk_apn_info_t;
+
+#if 0
+typedef struct {
+ mbtk_ril_cid_enum cid : 8; // 1 - 7
+ mbtk_ip_type_enum ip_type : 8; // mbtk_ip_type_enum
+ mbtk_apn_auth_type_enum auth : 8;
+ uint8 auto_save;
+ uint8 auto_boot_call;
+ uint8 apn[APN_STR_MAX];
+} mbtk_apn_get_info_t;
+#endif
+
+typedef struct {
+ mbtk_ril_cid_enum cid_for_def_route;
+ mbtk_ril_cid_enum cid_for_def_dns;
+
+ int num;
+ mbtk_apn_info_t apns[MBTK_APN_CID_MAX];
+} mbtk_apn_info_array_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 p1_retry;
+ uint8 p2_retry;
+ uint8 puk1_retry;
+ uint8 puk2_retry;
+} mbtk_pin_puk_last_times_t;
+
+typedef enum {
+ MBTK_SIM_LOCK_TYPE_DISABLE = 0, // Disable sim lock: [PIN]
+ MBTK_SIM_LOCK_TYPE_ENABLE, // Enable sim lock: [PIN]
+ // MBTK_SIM_LOCK_TYPE_QUERY, // Query sim lock state.
+ MBTK_SIM_LOCK_TYPE_CHANGE = 3, // Change pin : [old PIN][new PIN]
+ MBTK_SIM_LOCK_TYPE_VERIFY_PIN, // Verify pin : [PIN]
+ MBTK_SIM_LOCK_TYPE_VERIFY_PUK // Verify puk : [PUK][new PIN]
+} mbtk_sim_lock_type_enum;
+
+typedef struct {
+ mbtk_sim_lock_type_enum type : 8;
+ uint8 pin1[RIL_PIN_STR_MAX];
+ uint8 pin2[RIL_PIN_STR_MAX];
+ uint8 puk[RIL_PIN_STR_MAX];
+} mbtk_sim_lock_info_t;
+
+typedef struct
+{
+ uint8 format;
+ char name[16];
+}MBTK_SIM_PLMN_INFO_C; //string type
+
+typedef struct
+{
+ uint8 count;
+ MBTK_SIM_PLMN_INFO_C plmn[24];
+} mbtk_plmn_info;
+
+typedef struct
+{
+ // NR server cell:
+ // NR cell:
+ // 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:
+ mbtk_cell_type_enum type:8;
+ uint32 value1;
+ uint32 value2;
+ uint32 value3;
+ uint32 value4;
+ uint32 value5;
+ uint32 value6;
+ uint32 value7;
+ uint32 value8;
+ uint32 value9;
+ uint32 value10;
+ uint32 value11;
+ uint32 value12;
+ uint32 value13;
+ uint32 value14;
+ uint32 value15;
+ uint64 value64_1;
+ uint64 value64_2;
+ uint64 value64_3;
+ uint64 value64_4;
+ uint64 value64_5;
+} __attribute__((packed)) mbtk_cell_info_t;
+
+typedef struct {
+ mbtk_cell_type_enum type;
+ int num;
+ mbtk_cell_info_t cell[CELL_NUM_MAX];
+} mbtk_cell_info_array_t;
+
+typedef enum {
+ MBTK_DATA_CALL_ITEM_STATE_DISABLE = 0,
+ MBTK_DATA_CALL_ITEM_STATE_ENABLE,
+ MBTK_DATA_CALL_ITEM_STATE_NON
+} mbtk_data_call_item_state_enum;
+
+typedef struct {
+ mbtk_data_call_type_enum type : 8;
+ mbtk_ril_cid_enum cid : 8; // 1 - 7
+
+ mbtk_data_call_item_state_enum auto_boot_call : 8; // Will reset proc if necessary.
+
+ mbtk_data_call_item_state_enum def_route : 8; // Will reset proc if necessary.
+
+ mbtk_data_call_item_state_enum as_dns : 8; // Will reset proc if necessary.
+
+ uint16 retry_interval[RIL_DATA_CALL_RETRY_MAX]; // second
+ uint16 timeout; // second
+} mbtk_data_call_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;
+ uint8 end_reason[128];
+} __attribute__((packed)) mbtk_call_info_t;
+
+typedef struct
+{
+ char character;
+ uint32 duration;
+} __attribute__((packed)) mbtk_call_dtmf_info_t;
+
+typedef struct
+{
+ bool running;
+
+ mbtk_cell_info_array_t cell_list;
+} mbtk_cell_pack_info_t;
+
+typedef struct
+{
+ uint16 cid;
+ uint16 action;
+ uint16 reason;
+ uint16 auto_change;
+
+ uint16 ip_info_valid;
+ mbtk_ip_info_t ip_info;
+} mbtk_ril_pdp_state_info_t;
+
+typedef enum {
+ MBTK_NET_REG_TYPE_CALL, // +CREG
+ MBTK_NET_REG_TYPE_DATA_GSM_WCDMA, // +CGREG
+ MBTK_NET_REG_TYPE_DATA_LTE, // +CEREG
+ MBTK_NET_REG_TYPE_DATA_NR, // +C5GREG
+ MBTK_NET_REG_TYPE_IMS
+} mbtk_net_reg_type_enum;
+
+typedef enum {
+ MBTK_RIL_SER_STATE_READY,
+ MBTK_RIL_SER_STATE_EXIT // ril server has exit,should reset ril API.
+} mbtk_ril_ser_state_enum;
+
+typedef struct
+{
+ mbtk_net_reg_type_enum type : 8;
+ mbtk_radio_technology_enum tech : 8;
+ mbtk_net_reg_state_enum reg_state : 8;
+ uint64 tac;
+ uint64 ci;
+} mbtk_ril_net_reg_state_info_t;
+
+typedef struct
+{
+ mbtk_sim_card_type_enum sim_type : 8;
+ mbtk_sim_state_enum sim_state : 8;
+} mbtk_ril_sim_state_info_t;
+
+typedef struct
+{
+ mbtk_radio_state_enum radio_state : 8;
+} mbtk_ril_radio_state_info_t;
+
+typedef struct
+{
+ mbtk_signal_info_t signal_state;
+} mbtk_ril_signal_state_info_t;
+
+typedef struct
+{
+ uint8 urc_id;
+ uint8 urc_data[5];
+} mbtk_ril_ecall_state_info_t;
+
+typedef struct
+{
+ uint16 pdu_len;
+ uint8 pdu[1024];
+} mbtk_ril_sms_state_info_t;
+
+typedef enum
+{
+ MBTK_RIL_CALL_DIR_MO = 0,
+ MBTK_RIL_CALL_DIR_MT
+} mbtk_ril_call_dir_enum;
+
+typedef enum
+{
+ MBTK_RIL_CALL_STATE_ACTIVE = 0,
+ MBTK_RIL_CALL_STATE_HELD,
+ MBTK_RIL_CALL_STATE_DIALING,
+ MBTK_RIL_CALL_STATE_ALERTING,
+ MBTK_RIL_CALL_STATE_INCOMING,
+ MBTK_RIL_CALL_STATE_WAITING,
+ MBTK_RIL_CALL_STATE_OFFERING,
+ MBTK_RIL_CALL_STATE_DISCONNECT
+} mbtk_ril_call_state_enum;
+
+typedef enum
+{
+ MBTK_RIL_CALL_NUM_TYPE_129 = 129,
+ MBTK_RIL_CALL_NUM_TYPE_145 = 145
+} mbtk_ril_call_num_type_enum;
+
+typedef enum {
+ MBTK_ECALL_URC_ID_ALACK = 0, // AL-ACK signal received (refer to : urc_data)
+ MBTK_ECALL_URC_ID_SYNC_LOST, // eIM lost synchronization with PSAP
+ // (A resynch occurs after the synchronization is lost.)
+ MBTK_ECALL_URC_ID_NACK, // NACK signal received
+ MBTK_ECALL_URC_ID_RESERVED_3,
+ MBTK_ECALL_URC_ID_RESERVED_4,
+ MBTK_ECALL_URC_ID_RESERVED_5, // 5
+ MBTK_ECALL_URC_ID_3GPP_FATAL, // eIM is terminated: fatal error (3GPP Abort function)
+ MBTK_ECALL_URC_ID_CALL_DROP, // eIM is terminated: call drop
+ MBTK_ECALL_URC_ID_GENERIC, // Generic error
+ MBTK_ECALL_URC_ID_MSD_REQ, // PSAP request MSD (Only for PULL modem)
+ MBTK_ECALL_URC_ID_MSD_SEND_START, // 10 : eIM starts sending MSD
+ MBTK_ECALL_URC_ID_INITIATION, // The eIM starts sending the Initiation signal (Only for PUSH modem).
+ // It also indicates that the call setup is completed.
+ MBTK_ECALL_URC_ID_SEND_MSD, // PUSH: SEND_MSD -> MSD_SEND_START
+ // PULL: SEND_MSD -> MSD_REQ -> MSD_SEND_START
+ MBTK_ECALL_URC_ID_SEND_MSD_FULL,// SEND MSD signal received too often, PSAP sync failure assumed
+ MBTK_ECALL_URC_ID_SYNCED_PSAP, // IVS eIM is synced with PSAP
+ MBTK_ECALL_URC_ID_SYNCED_PSAP_EIM, // 15: IVS eIM is synced with PSAP eIM
+ MBTK_ECALL_URC_ID_LLACK, // Link layer ACK received
+ MBTK_ECALL_URC_ID_HLACK, // Higher Layer ACK received (similar to AL-ACK (#0) but without data)
+ MBTK_ECALL_URC_ID_EIM_RESET, // The eIM transmitter idles after a full reset. The eIM transmitter is reset after sync loss
+ // (for example, because of the end of PSAP transmission).
+ MBTK_ECALL_URC_ID_EIM_IDLES, // The eIM transmitter idles after the transmission of the Initiation signal (push mode)
+ MBTK_ECALL_URC_ID_MSD_UPDATE, // 20 : MSD update request is received.
+ MBTK_ECALL_URC_ID_MSD_UPDATE_DONE, // MSD update is done.
+ MBTK_ECALL_URC_ID_MSD_UPDATE_ERR, // MSD update request cannot be processed.
+ MBTK_ECALL_URC_ID_T3_EXPIRED, // T3 expired
+ MBTK_ECALL_URC_ID_T5_EXPIRED, // T5 expired
+ MBTK_ECALL_URC_ID_T6_EXPIRED, // 25 : T6 expired
+ MBTK_ECALL_URC_ID_T7_EXPIRED, // T7 expired
+ MBTK_ECALL_URC_ID_TH_EXPIRED, // TH expired
+ MBTK_ECALL_URC_ID_RESERVED_28,
+ MBTK_ECALL_URC_ID_RESERVED_29,
+ MBTK_ECALL_URC_ID_RESERVED_30, // 30
+ MBTK_ECALL_URC_ID_IVS_EVENT_TIMEOUT,
+ MBTK_ECALL_URC_ID_PSAP_REQ, // Only for ERA
+ MBTK_ECALL_URC_ID_MSD_SEND_FAIL_FOR_NG // NG-eCall fail to transfer MSD
+} mbtk_ecall_urc_id_enum;
+
+
+typedef struct{
+ uint8 state; // 0 : Disable; 1 : Enable
+ uint32 oosPhase[3]; //单位为秒
+} mbtk_ril_oos_info_t;
+
+typedef struct
+{
+ uint8 call_id;
+ mbtk_ril_call_dir_enum dir : 8;
+ mbtk_ril_call_state_enum state : 8;
+ mbtk_ril_call_num_type_enum num_type : 8;
+
+ uint8 call_number[100];
+} mbtk_ril_call_state_info_t;
+
+typedef enum {
+ MBTK_ECALL_MSD_VERSION_2 = 2,
+ MBTK_ECALL_MSD_VERSION_3 = 3
+} mbtk_ecall_msd_version_enum;
+
+typedef enum {
+ MBTK_ECALL_MSD_VEHICLE_TYPE_M1 = 1,
+ MBTK_ECALL_MSD_VEHICLE_TYPE_M2,
+ MBTK_ECALL_MSD_VEHICLE_TYPE_M3,
+ MBTK_ECALL_MSD_VEHICLE_TYPE_N1,
+ MBTK_ECALL_MSD_VEHICLE_TYPE_N2,
+ MBTK_ECALL_MSD_VEHICLE_TYPE_N3,
+ MBTK_ECALL_MSD_VEHICLE_TYPE_L1E,
+ MBTK_ECALL_MSD_VEHICLE_TYPE_L2E,
+ MBTK_ECALL_MSD_VEHICLE_TYPE_L3E,
+ MBTK_ECALL_MSD_VEHICLE_TYPE_L4E,
+ MBTK_ECALL_MSD_VEHICLE_TYPE_L5E,
+ MBTK_ECALL_MSD_VEHICLE_TYPE_L6E,
+ MBTK_ECALL_MSD_VEHICLE_TYPE_L7E,
+ MBTK_ECALL_MSD_VEHICLE_TYPE_O,
+ MBTK_ECALL_MSD_VEHICLE_TYPE_R,
+ MBTK_ECALL_MSD_VEHICLE_TYPE_S,
+ MBTK_ECALL_MSD_VEHICLE_TYPE_T,
+ MBTK_ECALL_MSD_VEHICLE_TYPE_G,
+ MBTK_ECALL_MSD_VEHICLE_TYPE_SA,
+ MBTK_ECALL_MSD_VEHICLE_TYPE_SB,
+ MBTK_ECALL_MSD_VEHICLE_TYPE_SC,
+ MBTK_ECALL_MSD_VEHICLE_TYPE_SD,
+ MBTK_ECALL_MSD_VEHICLE_TYPE_OTHER
+} mbtk_ecall_msd_vehicle_type_enum;
+
+
+typedef enum {
+ MBTK_ECALL_MSD_ITEM_VERSION = 0,
+ MBTK_ECALL_MSD_ITEM_MSG_ID,
+ MBTK_ECALL_MSD_ITEM_CONTROLTYPE,
+ MBTK_ECALL_MSD_ITEM_VIN,
+ MBTK_ECALL_MSD_ITEM_STORAGETYPE,
+ MBTK_ECALL_MSD_ITEM_TIMESTAMP,
+ MBTK_ECALL_MSD_ITEM_LOCATION,
+ MBTK_ECALL_MSD_ITEM_DIRECTION,
+ MBTK_ECALL_MSD_ITEM_LOCATIONN1,
+ MBTK_ECALL_MSD_ITEM_LOCATIONN2,
+ MBTK_ECALL_MSD_ITEM_NUMBEROFOCCUPANTS,
+ MBTK_ECALL_MSD_ITEM_ADDITIONALDATA,
+ MBTK_ECALL_MSD_ITEM_ALL_IN_ONE,
+ MBTK_ECALL_MSD_ITEM_ASI,
+ MBTK_ECALL_MSD_ITEM_VEHICLE_DIAGNOSTIC,
+ MBTK_ECALL_MSD_ITEM_CRASH_INFO,
+ MBTK_ECALL_MSD_ITEM_GNSS_TYPE
+} mbtk_ecall_msd_item_enum;
+
+typedef struct
+{
+ mbtk_ecall_msd_item_enum item_type;
+
+ uint8 data[64];
+} mbtk_ecall_msd_cfg_info_t;
+
+typedef struct
+{
+ uint8 msd[MBTK_ECALL_MSD_LEN_MAX];
+} mbtk_ecall_msd_info_t;
+
+typedef enum {
+ MBTK_ECALL_ONLY_TYPE_DISABLE = 0,
+ MBTK_ECALL_ONLY_TYPE_ENABLE_ECALL,
+ MBTK_ECALL_ONLY_TYPE_ENABLE_NG_ECALL,
+ MBTK_ECALL_ONLY_TYPE_ENABLE_ALL,
+ MBTK_ECALL_ONLY_TYPE_CONF_NUM,
+ MBTK_ECALL_ONLY_TYPE_NORMAL
+} mbtk_ecall_only_type_enum;
+
+typedef enum {
+ MBTK_ECALL_SIM_TYPE_NO_SUPPORT = 0,
+ MBTK_ECALL_SIM_TYPE_SUPPORT_ECALL,
+ MBTK_ECALL_SIM_TYPE_SUPPORT_ECALL_ONLY
+} mbtk_ecall_sim_type_enum;
+
+typedef struct {
+ mbtk_ecall_only_type_enum active : 8;
+ mbtk_ecall_sim_type_enum sim_type : 8; // Only for GET.
+ uint8 test_num[RIL_MAX_NUMBER_LEN];
+ uint8 reconfig_num[RIL_MAX_NUMBER_LEN];
+} mbtk_ecall_only_info_t;
+
+typedef enum {
+ MBTK_ECALL_DIAL_TYPE_TEST = 0,
+ MBTK_ECALL_DIAL_TYPE_RECONFIG,
+ MBTK_ECALL_DIAL_TYPE_MANUALLY,
+ MBTK_ECALL_DIAL_TYPE_AUTO,
+ MBTK_ECALL_DIAL_TYPE_NOT_ACTIVATED,
+ MBTK_ECALL_DIAL_TYPE_RELEASE
+} mbtk_ecall_dial_type_enum;
+
+typedef enum {
+ MBTK_ECALL_MODE_TYPE_EU = 0,
+ MBTK_ECALL_MODE_TYPE_ERA
+} mbtk_ecall_mode_type_enum;
+
+typedef enum {
+ MBTK_VOICE_END_REASON_UNKNOWN = 0,
+ MBTK_VOICE_END_REASON_UNASSIGNED_NUMBER,
+ MBTK_VOICE_END_REASON_NO_ROUTE_DES = 3,
+ MBTK_VOICE_END_REASON_CHANNEL_UNACCEPTABLE = 6,
+ MBTK_VOICE_END_REASON_OPERATOR_DETERMINED_BARRING = 8,
+ MBTK_VOICE_END_REASON_NORMAL_CALL_CLEARING = 16,
+ MBTK_VOICE_END_REASON_USER_BUSY,
+ MBTK_VOICE_END_REASON_NO_USER_RESPONDING,
+ MBTK_VOICE_END_REASON_USER_ALERTING_NO_ANSWER,
+ MBTK_VOICE_END_REASON_CALL_REJECTED = 21,
+ MBTK_VOICE_END_REASON_NUMBER_CHANGED,
+ MBTK_VOICE_END_REASON_PREEMPTION = 25,
+ MBTK_VOICE_END_REASON_NON_SELECTED_USER_CLEARING,
+ MBTK_VOICE_END_REASON_DESTINATION_OUT_OF_ORDER,
+ MBTK_VOICE_END_REASON_INVALID_NUMBER_FORMAT,
+ MBTK_VOICE_END_REASON_FACILITY_REJECTED,
+ MBTK_VOICE_END_REASON_STATUS_ENQUIRY,
+ MBTK_VOICE_END_REASON_NORMAL_UNSPECIFIED,
+ MBTK_VOICE_END_REASON_NO_CIRCUIT_AVAILABLE = 34,
+ MBTK_VOICE_END_REASON_NETWORK_OUT_OF_ORDER = 38,
+ MBTK_VOICE_END_REASON_TEMPORARY_FAILURE =41,
+ MBTK_VOICE_END_REASON_SWITCHING_EQUIPMENT_CONGESTION,
+ MBTK_VOICE_END_REASON_ACCESS_INFORMATION_DISCARDED,
+ MBTK_VOICE_END_REASON_REQUESTED_CIRCUIT_UNAVAILABLE,
+ MBTK_VOICE_END_REASON_RESOURCE_UNAVAILABLE = 47,
+ MBTK_VOICE_END_REASON_QOS_UNAVAILABLE = 49,
+ MBTK_VOICE_END_REASON_REQUESTED_FACILITY_NOT_SUBSCRIBED,
+ MBTK_VOICE_END_REASON_INCOMING_CALLS_BARRED_WITHIN_CUG = 55,
+ MBTK_VOICE_END_REASON_BEARER_CAPABILITY_NOT_AUTHORIZED = 57,
+ MBTK_VOICE_END_REASON_BEARER_CAPABILITY_NOT_AVAILABLE,
+ MBTK_VOICE_END_REASON_SERVICE_NOT_AVAILABLE = 63,
+ MBTK_VOICE_END_REASON_BEARER_SERVICE_NOT_IMPLEMENTED = 65,
+ MBTK_VOICE_END_REASON_ACM_MAX_REACHED = 68,
+ MBTK_VOICE_END_REASON_FACILITY_NOT_IMPLEMENTED,
+ MBTK_VOICE_END_REASON_ONLY_RDI_BEARER_CAPABILITY_AVAILABLE,
+ MBTK_VOICE_END_REASON_SERVICE_NOT_IMPLEMENTED = 79,
+ MBTK_VOICE_END_REASON_INVALID_TRANSACTION_ID = 81,
+ MBTK_VOICE_END_REASON_USER_NOT_MEMBER_OF_CUG = 87,
+ MBTK_VOICE_END_REASON_INCOMPATIBLE_DESTINATION = 88,
+ MBTK_VOICE_END_REASON_INVALID_TRANSIT_NETWORK_SELECTION = 91,
+ MBTK_VOICE_END_REASON_INCORRECT_MESSAGE = 95,
+ MBTK_VOICE_END_REASON_INVALID_MANDATORY_INFORMATION,
+ MBTK_VOICE_END_REASON_MESSAGE_TYPE_NON_EXISTENT,
+ MBTK_VOICE_END_REASON_MESSAGE_TYPE_WRONG_STATE,
+ MBTK_VOICE_END_REASON_INFORMATION_ELEMENT_NOT_EXISTENT,
+ MBTK_VOICE_END_REASON_CONDITIONAL_IE_ERROR,
+ MBTK_VOICE_END_REASON_MESSAGE_WRONG_STATE,
+ MBTK_VOICE_END_REASON_RECOVERY_AFTER_TIMER_EXPIRY,
+ MBTK_VOICE_END_REASON_PROTOCOL_ERROR_UNSPECIFIED = 111,
+ MBTK_VOICE_END_REASON_INERWORKING_UNSPECIFIED = 127,
+ MBTK_VOICE_END_REASON_CALL_BARRING = 224,
+ MBTK_VOICE_END_REASON_FDN_BLOCKED = 241,
+ MBTK_VOICE_END_REASON_END
+} mbtk_voice_end_reason_enum;
+
+
+typedef struct {
+ uint32 type; // mbtk_ecall_cfg_item_enum
+
+#if 0
+ uint32 timer_t3; // ms
+ uint32 timer_t5; // ms
+ uint32 timer_t6; // ms
+ uint32 timer_t7; // ms
+ uint32 timer_th; // ms
+
+ uint32 timer_callback; // s (T9)
+ uint32 timer_cleardown; // s (T2)
+ uint32 timer_dereg; // s (T10)
+ uint32 timer_dial; // s
+ uint32 timer_redialtmr; // s
+ uint32 timer_sms; // s
+
+ uint32 redialcnt;
+ uint32 smsprocess;
+ uint32 smsmsdcnt;
+#else
+ uint8 data_valid[MBTK_ECALL_CFG_ITEM_MAX];
+ uint32 data[MBTK_ECALL_CFG_ITEM_MAX];
+#endif
+} mbtk_ecall_cfg_info_t;
+
+typedef enum {
+ MBTK_ECALL_GAIN_MODE_TX = 0,
+ MBTK_ECALL_GAIN_MODE_RX,
+ MBTK_ECALL_GAIN_MODE_SIDETONE
+} mbtk_ecall_gain_mode_enum;
+
+typedef struct {
+ mbtk_ecall_gain_mode_enum mode;
+
+ int8 gain;
+} mbtk_ecall_gain_info_t;
+
+////////////////////////////////////////////////////
+
+char* apn2str(mbtk_ip_type_enum type);
+
+int ipv6_2_str(const void *ipv6, void *ipv6_str);
+
+mbtk_ril_handle* mbtk_ril_open(ATPortType_enum port);
+
+mbtk_ril_err_enum mbtk_ril_close(ATPortType_enum port);
+
+/*
+* Get platform version.
+*/
+mbtk_ril_err_enum mbtk_version_get(mbtk_ril_handle* handle, void *version);
+
+/*
+* Get platform model.
+*/
+mbtk_ril_err_enum mbtk_model_get(mbtk_ril_handle* handle, void *model);
+
+/*
+* Get platform IMEI.
+*/
+mbtk_ril_err_enum mbtk_imei_get(mbtk_ril_handle* handle, void *imei);
+
+/*
+* Get platform SN.
+*/
+mbtk_ril_err_enum mbtk_sn_get(mbtk_ril_handle* handle, void *sn);
+
+/*
+* Get platform MEID.
+*/
+mbtk_ril_err_enum mbtk_meid_get(mbtk_ril_handle* handle, void *meid);
+
+/*
+* Return VoLTE state.
+*/
+mbtk_ril_err_enum mbtk_volte_state_get(mbtk_ril_handle* handle, int *volte_state);
+
+/*
+* Set VoLTE state.
+*
+* volte_state:
+* 0 : Close VoLTE.
+* 1 : Open VoLTE.
+*
+* Restarting takes effect after execution.
+*/
+mbtk_ril_err_enum mbtk_volte_state_set(mbtk_ril_handle* handle, int volte_state);
+
+/*
+* Return radio state.
+*/
+mbtk_ril_err_enum mbtk_radio_state_get(mbtk_ril_handle* handle, mbtk_radio_state_enum *radio_state);
+
+/*
+* Set radio state.
+*
+* Refor to : mbtk_radio_state_enum
+*
+* Restarting takes effect after execution.
+*/
+mbtk_ril_err_enum mbtk_radio_state_set(mbtk_ril_handle* handle, mbtk_radio_state_enum radio_state, bool reset_modem);
+
+/*
+* Get system temperature.
+*
+* type[IN]:
+* 0: Soc temperature.
+* 1: RF temperature.
+* temp[OUT]:
+* temperature in celsius.
+*/
+mbtk_ril_err_enum mbtk_temp_get(mbtk_ril_handle* handle, mbtk_temp_type_enum type, int* temp);
+
+/*
+* Get time type.
+* "23/05/24,06:09:32+32" -> "23/05/24 06:09:32 +32 00"
+*/
+mbtk_ril_err_enum mbtk_cell_time_get(mbtk_ril_handle* handle, char* time_str);
+
+/*
+* Get platform IMSI.
+*/
+mbtk_ril_err_enum mbtk_imsi_get(mbtk_ril_handle* handle, void *imsi);
+
+/*
+* Get platform ICCID.
+*/
+mbtk_ril_err_enum mbtk_iccid_get(mbtk_ril_handle* handle, void *iccid);
+
+/*
+* Get current phone number.
+*/
+mbtk_ril_err_enum mbtk_phone_number_get(mbtk_ril_handle* handle, void *phone_number);
+
+/*
+* Get platform ICCID.
+*/
+mbtk_ril_err_enum mbtk_sim_lock_get(mbtk_ril_handle* handle, int *lock_state);
+
+/*
+* Get platform ICCID.
+*/
+mbtk_ril_err_enum mbtk_sim_lock_set(mbtk_ril_handle* handle, mbtk_sim_lock_info_t *lock_info);
+
+/*
+* Get platform ICCID.
+*/
+mbtk_ril_err_enum mbtk_sim_lock_retry_times_get(mbtk_ril_handle* handle, mbtk_pin_puk_last_times_t *retry_times);
+
+/*
+* Get available network.
+*/
+mbtk_ril_err_enum mbtk_available_net_get(mbtk_ril_handle* handle, mbtk_net_info_array_t *net_array);
+
+/*
+* Set network select mode. (+COPS=...)
+*/
+mbtk_ril_err_enum mbtk_net_sel_mode_set(mbtk_ril_handle* handle, const mbtk_net_info_t *net);
+
+/*
+* Get network select mode. (+COPS?)
+*/
+mbtk_ril_err_enum mbtk_net_sel_mode_get(mbtk_ril_handle* handle, mbtk_net_info_t *net);
+
+/*
+* Get platform support bands.
+*/
+mbtk_ril_err_enum mbtk_support_band_get(mbtk_ril_handle* handle, mbtk_band_info_t *band);
+
+/*
+* Get platform current bands.
+*/
+mbtk_ril_err_enum mbtk_current_band_get(mbtk_ril_handle* handle, mbtk_band_info_t *band);
+
+/*
+* Set platform current bands.
+*/
+mbtk_ril_err_enum mbtk_current_band_set(mbtk_ril_handle* handle, const mbtk_band_info_t *band);
+
+/*
+* Get current cell infomation.
+*/
+mbtk_ril_err_enum mbtk_cell_get(mbtk_ril_handle* handle, mbtk_cell_info_array_t *cell_list);
+
+/*
+* Set cell info.
+*
+* at*CELL=<mode>,<act>,< band>,<freq>,<cellId>
+* at*cell=2,3,,40936,429 //
+* at*cell=0 //
+*
+* Restarting takes effect after execution.
+*/
+mbtk_ril_err_enum mbtk_cell_set(mbtk_ril_handle* handle, char *info, char *response);
+
+/*
+* oos get.
+*/
+mbtk_ril_err_enum mbtk_oos_get(mbtk_ril_handle* handle, mbtk_ril_oos_info_t *oos_info);
+
+/*
+* oos set .
+*/
+mbtk_ril_err_enum mbtk_oos_set(mbtk_ril_handle* handle, const mbtk_ril_oos_info_t *oos_info);
+
+/*
+* Set wakeup state.
+*
+* wakeup_state:(0~31)
+* 0 : means resume all
+* 1~31 means suspend
+* Control the active reporting of some platform modems to reduce wakeup
+*/
+mbtk_ril_err_enum mbtk_wakeup_state_set(mbtk_ril_handle* handle, int wakeup_state);
+
+/*
+* Get current APN informations.
+*/
+mbtk_ril_err_enum mbtk_apn_get(mbtk_ril_handle* handle, mbtk_apn_info_array_t *apns);
+
+/*
+* Set current APN informations.
+*/
+mbtk_ril_err_enum mbtk_apn_set(mbtk_ril_handle* handle, mbtk_apn_info_t *apn);
+
+/*
+* Start data call.
+*/
+mbtk_ril_err_enum mbtk_data_call_start(mbtk_ril_handle* handle, mbtk_ril_cid_enum cid, mbtk_data_call_item_state_enum auto_boot_call,
+ mbtk_data_call_item_state_enum def_route, mbtk_data_call_item_state_enum as_dns, int *retry_interval, int retry_interval_num,
+ int timeout, mbtk_ip_info_t *rsp_info);
+
+/*
+* Stop data call.
+*/
+mbtk_ril_err_enum mbtk_data_call_stop(mbtk_ril_handle* handle, mbtk_ril_cid_enum cid, int timeout);
+
+/*
+* Get data call state.
+*/
+mbtk_ril_err_enum mbtk_data_call_state_get(mbtk_ril_handle* handle, mbtk_ril_cid_enum cid, mbtk_ip_info_t *ip);
+
+/*
+* Get current network signal.
+*/
+mbtk_ril_err_enum mbtk_net_signal_get(mbtk_ril_handle* handle, mbtk_signal_info_t *signal);
+
+/*
+* Get current network register information.
+*/
+mbtk_ril_err_enum mbtk_net_reg_get(mbtk_ril_handle* handle, mbtk_net_reg_info_t *reg);
+
+
+/*
+* Return sms cmgf.
+*/
+mbtk_ril_err_enum mbtk_sms_cmgf_get(mbtk_ril_handle* handle, int *volte_state);
+
+/*
+* Set sms cmgf.
+*
+* volte_state:
+* 0 : PDU mode.
+* 1 : text mode.
+*
+* Restarting takes effect after execution.
+*/
+mbtk_ril_err_enum mbtk_sms_cmgf_set(mbtk_ril_handle* handle, int mode);
+
+/*
+* Set sms cmgs.
+*
+if PDU mode (+CMGF=0):
++CMGS=<length><CR>
+PDU is given<ctrl-Z/ESC>
+
+if text mode (+CMGF=1):
++CMGS=<da>[,<toda>]<CR>
+text is entered<ctrl-Z/ESC>
+
+* Restarting takes effect after execution.
+*/
+mbtk_ril_err_enum mbtk_sms_cmgs_set(mbtk_ril_handle* handle, char * cmgs, char *resp);
+
+/*
+* Set sms cmgw.
+*
+if text mode (+CMGF=1):
++CMGW=<oa/da>[,<tooa/toda>[,<stat>]]
+<CR>
+text is entered<ctrl-Z/ESC>
+if PDU mode (+CMGF=0):
++CMGW=<length>[,<stat>]<CR>PDU is
+given<ctrl-Z/ESC>
+
+*/
+mbtk_ril_err_enum mbtk_sms_cmgw_set(mbtk_ril_handle* handle, char * cmgw, char *resp);
+
+/*
+* Set sms cmgd.
+*
+* +CMGD=<index>[,<delflag>]
+*
+* Restarting takes effect after execution.
+*/
+mbtk_ril_err_enum mbtk_sms_cmgd_set(mbtk_ril_handle* handle, char * cmdg);
+
+/*
+* Get sms cmgd.
+*
+* +CMGD: (XXX,XXX)(0-4)
+*
+* Restarting takes effect after execution.
+*/
+mbtk_ril_err_enum mbtk_sms_cmgd_get(mbtk_ril_handle* handle, char * cmdg);
+
+/*
+* Set sms cmgl.
+*
+* AT+CMGL[=<stat>]
+*
+* Restarting takes effect after execution.
+*/
+mbtk_ril_err_enum mbtk_sms_cmgl_set(mbtk_ril_handle* handle, char * cmgl, char *resp);
+
+/*
+* Return sms csca.
+*/
+mbtk_ril_err_enum mbtk_sms_csca_get(mbtk_ril_handle* handle, char *buf);
+
+/*
+* Set sms csca.
+*
+* AT+CSCA=<number> [,<type>]
+*
+* Restarting takes effect after execution.
+*/
+mbtk_ril_err_enum mbtk_sms_csca_set(mbtk_ril_handle* handle, char * csca);
+
+/*
+* Set sms csmp.
+*
+* AT+CSMP=[<fo>[,<vp>[,<pid>[,<dcs>]]]]
+*
+* Restarting takes effect after execution.
+*/
+mbtk_ril_err_enum mbtk_sms_csmp_set(mbtk_ril_handle* handle, char * csmp);
+
+/*
+* Set sms cscb.
+*
+* AT+CSCB=<[<mode>[,<mids>[,<dcss>]]]>
+*
+* Restarting takes effect after execution.
+*/
+mbtk_ril_err_enum mbtk_sms_cscb_set(mbtk_ril_handle* handle, char * cscb);
+
+/*
+* Set sms cnmi.
+*
+at+cnmi=1,2
+
+OK
+if sending fails:
++CMS ERROR: <err>
+*/
+mbtk_ril_err_enum mbtk_sms_cnmi_set(mbtk_ril_handle* handle);
+
+/*
+* Set sms cmss.
+*
++CMSS=<index>[,<da>[,<toda>]]
+
+if sending successful:
++CMSS: <mr>
+OK
+if sending fails:
++CMS ERROR: <err>
+*/
+mbtk_ril_err_enum mbtk_sms_cmss_set(mbtk_ril_handle* handle, char * cmss, char *resp);
+
+/*
+* Return sms cmgf.
+*/
+mbtk_ril_err_enum mbtk_sms_cpms_get(mbtk_ril_handle* handle, char * mem);
+
+/*
+* Set sms cpms.
+*
+* AT+CPMS=<mem1>[,<mem2>[,<mem3>]]
+*
+* Restarting takes effect after execution.
+*/
+mbtk_ril_err_enum mbtk_sms_cpms_set(mbtk_ril_handle* handle, char * mem, char* response);
+
+/*
+* Set sms cm.
+*
+* +CMGR=<index>
+
+if PDU mode (+CMGF=0) ��command successful:
++CMGR: <stat>,[<alpha>],<length><CR><LF><pdu>
+OK
+if text mode (+CMGF=1), command successful and SMS-DELIVER:
++CMGR:<stat>,<oa>,[<alpha>],<scts>[,<tooa>,<fo>,<pid>,<dcs
+>, <sca>,<tosca>,<length>]<CR><LF><data>
+OK
+if text mode (+CMGF=1), command successful and SMS-SUBMIT:
++CMGR:
+<stat>,<da>,[<alpha>][,<toda>,<fo>,<pid>,<dcs>,[<vp>],
+<sca>,<tosca>,<length>]<CR><LF><data>
+OK
+otherwise:
++CMS ERROR: <err>
+*
+* Restarting takes effect after execution.
+*/
+mbtk_ril_err_enum mbtk_sms_cmgr_set(mbtk_ril_handle* handle, int index, char *resp);
+
+/*
+* Get sim state.
+*/
+mbtk_ril_err_enum mbtk_sim_state_get(mbtk_ril_handle* handle, mbtk_sim_state_enum *sim_state);
+
+/*
+* Get sim card type.
+*/
+mbtk_ril_err_enum mbtk_sim_type_get(mbtk_ril_handle* handle, mbtk_sim_card_type_enum *sim_card_type);
+
+/*
+* Get plmn list
+*/
+mbtk_ril_err_enum mbtk_plmn_list_get(mbtk_ril_handle* handle, mbtk_plmn_info *plmn_list);
+
+/*
+* call_start
+*
+*/
+mbtk_ril_err_enum mbtk_call_start(mbtk_ril_handle* handle, char* phone_number);
+
+/*
+* Answer the phone call.
+*
+*/
+mbtk_ril_err_enum mbtk_call_answer(mbtk_ril_handle* handle);
+
+/*
+* Hang up all call.
+*
+*/
+mbtk_ril_err_enum mbtk_call_hang(mbtk_ril_handle* handle);
+
+/*
+* Hang up a call.
+*
+*/
+mbtk_ril_err_enum mbtk_a_call_hang(mbtk_ril_handle* handle, int phone_id);
+
+/*
+* Hang up waiting or background call.
+*
+*/
+mbtk_ril_err_enum mbtk_waiting_or_background_call_hang(mbtk_ril_handle* handle);
+
+/*
+* Hang up foreground resume background call.
+*
+*/
+mbtk_ril_err_enum mbtk_foreground_resume_background_call_hang(mbtk_ril_handle* handle);
+
+/*
+* Get current call phone number.
+*/
+mbtk_ril_err_enum mbtk_call_reg_get(mbtk_ril_handle* handle, mbtk_call_info_t *reg);
+
+/*
+* Return mute state.
+*/
+mbtk_ril_err_enum mbtk_mute_state_get(mbtk_ril_handle* handle, int *mute_state);
+
+/*
+* Set mute state.
+*
+* mute_state:
+* 0 : of mute.
+* 1 : on mute.
+*
+* Restarting takes effect after execution.
+*/
+mbtk_ril_err_enum mbtk_mute_state_set(mbtk_ril_handle* handle, int mute_state);
+
+/*
+* Set DTMF character.
+*
+*/
+mbtk_ril_err_enum mbtk_dtmf_send(mbtk_ril_handle* handle, mbtk_call_dtmf_info_t *dtmf_character);
+
+mbtk_ril_err_enum mbtk_centric_set(mbtk_ril_handle* handle, int centric);
+
+mbtk_ril_err_enum mbtk_centric_get(mbtk_ril_handle* handle, int *centric);
+
+
+
+/*
+* Set msd item.
+*
+*/
+mbtk_ril_err_enum mbtk_ecall_msd_item_set(mbtk_ril_handle* handle, const mbtk_ecall_msd_cfg_info_t *msd_cfg);
+
+/*
+* Generate msd after msd item set.
+*
+*/
+mbtk_ril_err_enum mbtk_ecall_msd_gen(mbtk_ril_handle* handle);
+
+/*
+* Set ecall msd.
+*
+*/
+mbtk_ril_err_enum mbtk_ecall_msd_set(mbtk_ril_handle* handle, const void* msd);
+
+/*
+* Get ecall msd.
+*
+*/
+mbtk_ril_err_enum mbtk_ecall_msd_get(mbtk_ril_handle* handle, void* msd);
+
+
+/*
+* Set ecall msd item.
+*
+*/
+mbtk_ril_err_enum mbtk_ecall_push(mbtk_ril_handle* handle);
+
+/*
+* Set ecall only configs.
+*
+*/
+mbtk_ril_err_enum mbtk_ecall_only_set(mbtk_ril_handle* handle, const mbtk_ecall_only_info_t* info);
+
+/*
+* Get ecall only configs.
+*
+*/
+mbtk_ril_err_enum mbtk_ecall_only_get(mbtk_ril_handle* handle, mbtk_ecall_only_info_t* info);
+
+/*
+* Set ecall network reg.
+*
+*/
+mbtk_ril_err_enum mbtk_ecall_reg_set(mbtk_ril_handle* handle, int reg);
+
+/*
+* Start ecall dial start.
+*
+*/
+mbtk_ril_err_enum mbtk_ecall_dial_start(mbtk_ril_handle* handle, mbtk_ecall_dial_type_enum type);
+
+/*
+* Get ecall dial state.
+*
+*/
+mbtk_ril_err_enum mbtk_ecall_dial_state_get(mbtk_ril_handle* handle, mbtk_ecall_dial_type_enum* type);
+
+/*
+* Set ecall mode.
+*
+*/
+mbtk_ril_err_enum mbtk_ecall_mode_set(mbtk_ril_handle* handle, mbtk_ecall_mode_type_enum mode);
+
+/*
+* Get ecall mode.
+*
+*/
+mbtk_ril_err_enum mbtk_ecall_mode_get(mbtk_ril_handle* handle, mbtk_ecall_mode_type_enum *mode);
+
+/*
+* Set ecall configs.
+*
+*/
+mbtk_ril_err_enum mbtk_ecall_cfg_set(mbtk_ril_handle* handle, const mbtk_ecall_cfg_info_t *cfg);
+
+/*
+* Get ecall configs.
+*
+*/
+mbtk_ril_err_enum mbtk_ecall_cfg_get(mbtk_ril_handle* handle, mbtk_ecall_cfg_info_t* cfg);
+
+/*
+* Set ecall sms number.
+*
+*/
+mbtk_ril_err_enum mbtk_ecall_sms_number_set(mbtk_ril_handle* handle, const void *number);
+
+/*
+* Get ecall sms number.
+*
+*/
+mbtk_ril_err_enum mbtk_ecall_sms_number_get(mbtk_ril_handle* handle, void *number);
+
+/*
+* Set ecall mute speaker.
+*
+*/
+mbtk_ril_err_enum mbtk_ecall_mute_spk_set(mbtk_ril_handle* handle, int mute);
+
+/*
+* Set ecall dsp gain.
+*
+*/
+mbtk_ril_err_enum mbtk_ecall_dsp_gain_set(mbtk_ril_handle* handle, const mbtk_ecall_gain_info_t *gain_info);
+
+/*
+* Set ril server ready callback function.
+*/
+mbtk_ril_err_enum mbtk_ril_ser_state_change_cb_reg(mbtk_ril_callback_func cb);
+
+/*
+* Set net reg state change callback function.
+*/
+mbtk_ril_err_enum mbtk_net_reg_state_change_cb_reg(mbtk_ril_callback_func cb);
+
+/*
+* Set call state change callback function.
+*/
+mbtk_ril_err_enum mbtk_call_state_change_cb_reg(mbtk_ril_callback_func cb);
+
+/*
+* Set sms state change callback function.
+*/
+mbtk_ril_err_enum mbtk_sms_state_change_cb_reg(mbtk_ril_callback_func cb);
+
+/*
+* Set radio state change callback function.
+*/
+mbtk_ril_err_enum mbtk_radio_state_change_cb_reg(mbtk_ril_callback_func cb);
+
+/*
+* Set sim state change callback function.
+*/
+mbtk_ril_err_enum mbtk_sim_state_change_cb_reg(mbtk_ril_callback_func cb);
+
+/*
+* Set pdp state change callback function.
+*/
+mbtk_ril_err_enum mbtk_pdp_state_change_cb_reg(mbtk_ril_callback_func cb);
+
+/*
+* Set signal state change callback function.
+*/
+mbtk_ril_err_enum mbtk_signal_state_change_cb_reg(mbtk_ril_callback_func cb);
+
+/*
+* Set ecall state change callback function.
+*/
+mbtk_ril_err_enum mbtk_ecall_state_change_cb_reg(mbtk_ril_callback_func cb);
+
+/*
+* get md version
+*/
+int mbtk_get_modem_version(mbtk_ril_handle* handle, void *modem_version);
+
+
+#endif /* _MBTK_INFO_API_2_H */
+
diff --git a/mbtk/include/mbtk/mbtk_rtp.h b/mbtk/include/mbtk/mbtk_rtp.h
new file mode 100755
index 0000000..8786c36
--- /dev/null
+++ b/mbtk/include/mbtk/mbtk_rtp.h
@@ -0,0 +1,31 @@
+/*
+* mbtk_rtp.h
+*
+* MBTK RTP API header.
+*
+* Author : lb
+* Date : 2024/12/2 19:51:25
+*/
+#ifndef _MBTK_RTP_H
+#define _MBTK_RTP_H
+#include "mbtk_type.h"
+
+int mbtk_rtp_init();
+
+int mbtk_rtp_deinit();
+
+int mbtk_rtp_enable(bool enable);
+
+int mbtk_rtp_volume_set(int volume);
+
+int mbtk_rtp_remote_ip_set(const char *ipv4);
+
+int mbtk_rtp_server_port_set(int port);
+
+int mbtk_rtp_client_port_set(int port);
+
+int mbtk_rtp_sample_rate_set(int sample_rate);
+
+int mbtk_rtp_channel_set(int channel);
+
+#endif /* _MBTK_RTP_H */
diff --git a/mbtk/include/mbtk/mbtk_sleep.h b/mbtk/include/mbtk/mbtk_sleep.h
new file mode 100755
index 0000000..c91d92f
--- /dev/null
+++ b/mbtk/include/mbtk/mbtk_sleep.h
@@ -0,0 +1,82 @@
+/*************************************************************
+Description:
+ MBTK sleep head file.
+Author:
+ XiaoRui
+Date:
+ 2024/10/24 20:08:03
+*************************************************************/
+#ifndef _MBTK_SLEEP_H
+#define _MBTK_SLEEP_H
+
+#include <stdio.h>
+#include <time.h>
+#include <sys/time.h>
+#include <unistd.h>
+#include <sys/un.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <errno.h>
+#include <sys/ioctl.h>
+#include <net/if.h>
+#include <string.h>
+#include <fcntl.h>
+#include <signal.h>
+#include <stdlib.h>
+#include <sys/stat.h>
+#include <sys/file.h>
+#include <stddef.h>
+#include <sys/types.h>
+#include <pthread.h>
+#include <sys/epoll.h>
+#include <linux/input.h>
+
+#include "mbtk_type.h"
+
+/*************************************************************
+ Constants and Macros
+*************************************************************/
+typedef void (*mbtk_sleep_callback_func)(const void* data, int data_len);
+
+#define LOCK_MAX_SIZE 129
+#define EPOLL_SIZE_HINT 128
+
+/*
+This module is system sleep, the system cannot sleep when the lock exists
+To verify whether it is in sleep state, it is necessary to test the power consumption
+Power management principle, as long as a wakelock lock exists, the system will not enter the Suspend state
+So the name can be arbitrarily chosen to indicate that such a lock is needed so that the system does not sleep
+*/
+#define MTBK_POWERIND "/system/etc/powerind" //1806
+
+
+/*************************************************************
+ Definitions:enum,struct,union,class
+*************************************************************/
+typedef struct
+{
+ int fd;
+ char name[64];
+} mbtk_lock_name_s;
+
+
+
+/*************************************************************
+ Extern variables
+*************************************************************/
+
+
+/*************************************************************
+ Public Function Declaration
+*************************************************************/
+int mbtk_powerrind_get();
+int mbtk_autosuspend_enable(char enable);
+int mbtk_wakelock_create(const char* name , size_t len);
+int mbtk_wakelock_lock(int fd);
+int mbtk_wakelock_unlock(int fd);
+int mbtk_wakelock_destroy(int fd);
+int mbtk_suspend_timer_set(int time, mbtk_sleep_callback_func cb);
+int mbtk_suspend_timer_cancel(void);
+
+#endif /* _MBTK_SLEEP_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..c56a2c0
--- /dev/null
+++ b/mbtk/include/mbtk/mbtk_sock2.h
@@ -0,0 +1,195 @@
+/*************************************************************
+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"
+#include "mbtk_net_control.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 struct {
+ int state;
+ const char* addr;
+ const char* if_name;
+} mbtk_net_cb_info_s;
+
+typedef struct {
+ mbtk_sock_session sock_fd;
+ int event;
+ mbtk_sock_type sock_type;
+} mbtk_sock_cb_info_s;
+
+typedef void (*mbtk_net_cb_func)(mbtk_sock_handle handle, mbtk_net_cb_info_s *net_info);
+typedef void (*mbtk_sock_cb_func)(mbtk_sock_handle handle, mbtk_sock_cb_info_s *sock_info);
+
+//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
+ char local_address[256]; //Local address
+ int local_port; // Local port
+ int ftp_ssl_support;
+} mbtk_sock_info;
+
+typedef struct
+{
+ char if_name[100];
+ mbtk_net_type net_type;
+ mbtk_net_cb_func net_cb;
+ mbtk_sock_cb_func sock_cb;
+} mbtk_init_info;
+
+#ifdef MBTK_POLARSSL_SUPPORT
+#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
+#endif
+
+/*************************************************************
+ 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,
+ const 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_read_sync(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);
+/*
+* Get TCP RECV buffer data length.
+*/
+int mbtk_sock_tcp_recv_len_get(mbtk_sock_handle handle,mbtk_sock_session session);
+
+
+#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_tcpip.h b/mbtk/include/mbtk/mbtk_tcpip.h
new file mode 100755
index 0000000..0a28c40
--- /dev/null
+++ b/mbtk/include/mbtk/mbtk_tcpip.h
@@ -0,0 +1,99 @@
+/*
+ TCP/IP AT header.
+*/
+/******************************************************************************
+
+ EDIT HISTORY FOR FILE
+
+ WHEN WHO WHAT,WHERE,WHY
+-------- -------- -------------------------------------------------------
+2023/9/24 lb Initial version
+
+******************************************************************************/
+#ifndef _MBTK_TCPIP_H
+#define _MBTK_TCPIP_H
+#include "mbtk_type.h"
+#include "mbtk_sock2.h"
+
+#define MBTK_TCPIP_LINK_MAX 4
+
+typedef enum {
+ MBTK_TCPIP_ERR_SUCCESS,
+ MBTK_TCPIP_ERR_NET_UNAVAILABLE, /* Network unavailable. */
+ MBTK_TCPIP_ERR_NET_HANDLE, /* Network handle error. */
+ MBTK_TCPIP_ERR_ARG, /* Parameter error. */
+ MBTK_TCPIP_ERR_LINK_UNAVAILABLE, /* Link unavailable. */
+ MBTK_TCPIP_ERR_LINK_NOT_CONNECT, /* Link not connect. */
+
+
+
+
+ MBTK_TCPIP_ERR_UNKNOWN
+} mbtk_tcpip_err_enum;
+
+typedef enum {
+ MBTK_TCPIP_TYPE_CLIENT,
+ MBTK_TCPIP_TYPE_SERVER
+} mbtk_tcpip_type_enum;
+
+typedef void (*mbtk_tcpip_net_callback_func)(int state, const char* addr);
+typedef void (*mbtk_tcpip_sock_callback_func)(int link_id, int state);
+typedef void (*mbtk_tcpip_read_callback_func)(int link_id, const char* data, int data_len);
+
+typedef struct {
+ int link_id;
+ char ser_addr[256];
+ int ser_port;
+ mbtk_sock_type prot_type; // TCP/UDP
+ mbtk_tcpip_type_enum tcpip_type; // Only support client.
+ int local_port;
+ bool ack_support;
+ bool ssl_support;
+ bool ignore_cert;
+ uint32 heartbeat_time;
+ uint32 delay_time;
+
+ mbtk_tcpip_read_callback_func read_cb;
+} mbtk_tcpip_info_t;
+
+typedef struct {
+ int link_id;
+ int sock_fd;
+ int state;
+ int recv_data_len;
+} mbtk_tcpip_tcp_state_info_s;
+
+mbtk_tcpip_err_enum mbtk_tcpip_net_open(mbtk_tcpip_net_callback_func net_cb, mbtk_tcpip_sock_callback_func sock_cb);
+mbtk_tcpip_err_enum mbtk_tcpip_net_close();
+mbtk_tcpip_err_enum mbtk_tcpip_sock_open(const mbtk_tcpip_info_t *tcpip_info);
+mbtk_tcpip_err_enum mbtk_tcpip_sock_close(int link_id);
+
+int mbtk_tcpip_send(int link_id, const char* data, int data_len, const char* ser_addr, int ser_port);
+int mbtk_tcpip_read(int link_id, char* buff, int buff_size);
+
+/*
+* Get the data traffic of the specified link. Return -1 if fail.
+*/
+int mbtk_tcpip_data_traffic_get(int link_id);
+
+/*
+* Reset the data traffic of the specified link.
+*/
+mbtk_tcpip_err_enum mbtk_tcpip_data_traffic_reset(int link_id);
+
+/*
+* Return 0 if disconnected, 1 for connected, other for fail.
+*/
+int mbtk_tcpip_link_state_get(int link_id);
+
+/*
+* Get TCP state informations.
+*/
+int mbtk_tcpip_info_get(int link_id, mbtk_tcpip_tcp_state_info_s *state_info);
+
+/*
+* Set socket auto read callback function,NULL for close auto read.
+*/
+void mbtk_tcpip_set_read_cb(int link_id, mbtk_tcpip_read_callback_func read_cb);
+
+#endif /* _MBTK_TCPIP_H */
diff --git a/mbtk/include/mbtk/mbtk_type.h b/mbtk/include/mbtk/mbtk_type.h
new file mode 100755
index 0000000..c7fc885
--- /dev/null
+++ b/mbtk/include/mbtk/mbtk_type.h
@@ -0,0 +1,123 @@
+#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)
+#endif
+
+#ifndef UNUSEDPARAM
+#define UNUSEDPARAM(param) ((void) param)
+#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_utf.h b/mbtk/include/mbtk/mbtk_utf.h
new file mode 100755
index 0000000..6a16ced
--- /dev/null
+++ b/mbtk/include/mbtk/mbtk_utf.h
@@ -0,0 +1,85 @@
+//
+// Created by hitmoon on 15-12-17.
+//
+
+#ifndef SMS_UTF_H
+#define SMS_UTF_H
+
+#include <stddef.h>
+#include <sys/types.h>
+
+typedef unsigned int UTF32;
+/* at least 32 bits */
+typedef unsigned short UTF16;
+/* at least 16 bits */
+typedef unsigned char UTF8;
+/* typically 8 bits */
+typedef unsigned char Boolean; /* 0 or 1 */
+
+/* Some fundamental constants */
+#define UNI_REPLACEMENT_CHAR (UTF32)0x0000FFFD
+#define UNI_MAX_BMP (UTF32)0x0000FFFF
+#define UNI_MAX_UTF16 (UTF32)0x0010FFFF
+#define UNI_MAX_UTF32 (UTF32)0x7FFFFFFF
+#define UNI_MAX_LEGAL_UTF32 (UTF32)0x0010FFFF
+
+typedef enum {
+ conversionOK, /* conversion successful */
+ sourceExhausted, /* partial character in source, but hit end */
+ targetExhausted, /* insuff. room in target for conversion */
+ sourceIllegal /* source sequence is illegal/malformed */
+} ConversionResult;
+
+typedef enum {
+ strictConversion = 0,
+ lenientConversion
+} ConversionFlags;
+
+/* This is for C++ and does no harm in C */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ConversionResult ConvertUTF8toUTF16(
+ const UTF8 **sourceStart, const UTF8 *sourceEnd,
+ UTF16 **targetStart, UTF16 *targetEnd, ConversionFlags flags);
+
+ConversionResult ConvertUTF16toUTF8(
+ const UTF16 **sourceStart, const UTF16 *sourceEnd,
+ UTF8 **targetStart, UTF8 *targetEnd, ConversionFlags flags);
+
+ConversionResult ConvertUTF8toUTF32(
+ const UTF8 **sourceStart, const UTF8 *sourceEnd,
+ UTF32 **targetStart, UTF32 *targetEnd, ConversionFlags flags);
+
+ConversionResult ConvertUTF32toUTF8(
+ const UTF32 **sourceStart, const UTF32 *sourceEnd,
+ UTF8 **targetStart, UTF8 *targetEnd, ConversionFlags flags);
+
+ConversionResult ConvertUTF16toUTF32(
+ const UTF16 **sourceStart, const UTF16 *sourceEnd,
+ UTF32 **targetStart, UTF32 *targetEnd, ConversionFlags flags);
+
+ConversionResult ConvertUTF32toUTF16(
+ const UTF32 **sourceStart, const UTF32 *sourceEnd,
+ UTF16 **targetStart, UTF16 *targetEnd, ConversionFlags flags);
+
+Boolean isLegalUTF8Sequence(const UTF8 *source, const UTF8 *sourceEnd);
+
+#ifdef __cplusplus
+}
+#endif
+
+// 获得下一个char的起始地址
+u_int32_t next_char(unsigned char **string);
+
+const unsigned char *utf32toutf8(wchar_t *source, unsigned char *target, size_t size, int *len);
+
+unsigned char *utf16toutf8(unsigned short *source, unsigned char *target, size_t size, int *len);
+unsigned short *utf8toutf16(unsigned char *source, unsigned short *target, size_t size, int *len);
+
+int utf8len(unsigned char *string);
+int is_acsii(unsigned char *string);
+size_t utf8_get_size(unsigned char *source, size_t num);
+
+#endif //SMS_UTF_H
diff --git a/mbtk/include/mbtk/mbtk_utils.h b/mbtk/include/mbtk/mbtk_utils.h
new file mode 100755
index 0000000..8f9c780
--- /dev/null
+++ b/mbtk/include/mbtk/mbtk_utils.h
@@ -0,0 +1,111 @@
+/*************************************************************
+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);
+
+int app_already_running(const char *pid_file);
+
+void mbtk_system(const void* cmd);
+
+void mbtk_write(int fd,const void *buf, size_t len);
+
+void mbtk_read(int fd,void *buf, size_t len);
+
+void mbtk_close(int fd);
+
+int mbtk_band_2_list(uint32 band, int index, int band_list[]);
+
+uint32 mbtk_list_2_band(int band_list[]);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif /* _MBTK_UTILS_H */
diff --git a/mbtk/include/mbtk/mbtk_version.h b/mbtk/include/mbtk/mbtk_version.h
new file mode 100755
index 0000000..d6720d3
--- /dev/null
+++ b/mbtk/include/mbtk/mbtk_version.h
@@ -0,0 +1,31 @@
+/*
+* mbtk_version.h
+*
+* mbtk_source compilation informations.
+*
+* Author : lb
+* Date : 2024/6/7 16:51:20
+*/
+#ifndef __MBTK_VERSION_H
+#define __MBTK_VERSION_H
+#include "mbtk_type.h"
+
+typedef enum {
+ MBTK_BUILD_DEF_AF_SUPPORT = 0,
+ MBTK_BUILD_DEF_YX_SUPPORT,
+ MBTK_BUILD_DEF_SG_SUPPORT,
+ MBTK_BUILD_DEF_MBTK_ALL_CID_SUPPORT,
+ MBTK_BUILD_DEF_MBTK_GNSS_MODE,
+ MBTK_BUILD_DEF_MBTK_DUMP_SUPPORT,
+
+ MBTK_BUILD_DEF_NUM
+} mbtk_build_define_enum;
+
+typedef struct {
+ char name[64];
+ char value[64];
+} mbtk_build_def_info_t;
+
+void mbtk_build_def_get(char *buff, int buff_len);
+
+#endif /* __MBTK_VERSION_H */
diff --git a/mbtk/include/mbtk/mbtk_wifi_ap.h b/mbtk/include/mbtk/mbtk_wifi_ap.h
new file mode 100755
index 0000000..3c5b53c
--- /dev/null
+++ b/mbtk/include/mbtk/mbtk_wifi_ap.h
@@ -0,0 +1,63 @@
+#include <stdio.h>
+#include <unistd.h>
+#include <string.h>
+
+
+#define SETTING_FILE "/etc/wifi/hostapd.conf"
+#define SETTING_LINE_MAX 64
+#define SETTING_LINE_MAX_LEN 512
+#define SETTING_KEY_MAX_LEN 64
+#define SETTING_VALUE_MAX_LEN 190
+#define SETTING_SPLIT_CHAR '='
+#define ACL_DENY_FILE "/etc/wifi/hostapd.deny"
+#define ACL_ACCEPT_FILE "/etc/wifi/hostapd.accept"
+#define DHCP_PATH "/tmp/dhcp.leases"
+#define DEF_INTERFACE "wlan0"
+
+
+
+
+typedef struct {
+unsigned long long rx_packets;
+unsigned long long rx_bytes;
+unsigned long long rx_errors;
+unsigned long long rx_dropped;
+unsigned long long tx_packets;
+unsigned long long tx_bytes;
+unsigned long long tx_errors;
+unsigned long long tx_dropped;
+} mbtk_wifi_pkt_stats_t;
+
+typedef struct
+{
+char addr[16];
+char macaddr[18];
+char name[20];
+char ifname[18];
+int uptime;
+} mbtk_lanhost_t;
+
+
+typedef struct
+{
+ int array_len;
+ mbtk_lanhost_t array[32];
+} mbtk_lanhost_ts;
+
+
+
+
+int mbtk_wifi_get_setting(const char *path, const char *key, char *value, int value_max_len);
+int mbtk_wifi_set_setting(const char *path, const char *key, const char *value);
+int mbtk_wifi_ap_start(void);
+int mbtk_wifi_ap_stop(void);
+int mbtk_wifi_set_file(const char *path, const char *value);
+int mbtk_wifi_get_file(const char *path, char *value, int value_max_len);
+int mbtk_wifi_get_pkt(mbtk_wifi_pkt_stats_t* pkt_stat);
+int mbtk_wifi_get_dhcp(mbtk_lanhost_ts* lanhost_arr);
+int mbkt_wifi_get_uptime(mbtk_lanhost_ts* lanhost_arr);
+
+
+
+
+
diff --git a/mbtk/include/mbtk/ringbuffer.h b/mbtk/include/mbtk/ringbuffer.h
new file mode 100755
index 0000000..dfe8b4c
--- /dev/null
+++ b/mbtk/include/mbtk/ringbuffer.h
@@ -0,0 +1,138 @@
+#include <inttypes.h>
+#include <stddef.h>
+#include <assert.h>
+/**
+ * @file
+ * Prototypes and structures for the ring buffer module.
+ */
+
+#ifndef RINGBUFFER_H
+#define RINGBUFFER_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#define RING_BUFFER_ASSERT(x) assert(x)
+
+/**
+ * Checks if the buffer_size is a power of two.
+ * Due to the design only <tt> RING_BUFFER_SIZE-1 </tt> items
+ * can be contained in the buffer.
+ * buffer_size must be a power of two.
+*/
+#define RING_BUFFER_IS_POWER_OF_TWO(buffer_size) ((buffer_size & (buffer_size - 1)) == 0)
+
+/**
+ * The type which is used to hold the size
+ * and the indicies of the buffer.
+ */
+typedef size_t ring_buffer_size_t;
+
+/**
+ * Used as a modulo operator
+ * as <tt> a % b = (a & (b − 1)) </tt>
+ * where \c a is a positive index in the buffer and
+ * \c b is the (power of two) size of the buffer.
+ */
+#define RING_BUFFER_MASK(rb) (rb->buffer_mask)
+
+/**
+ * Simplifies the use of <tt>struct ring_buffer_t</tt>.
+ */
+typedef struct ring_buffer_t ring_buffer_t;
+
+/**
+ * Structure which holds a ring buffer.
+ * The buffer contains a buffer array
+ * as well as metadata for the ring buffer.
+ */
+struct ring_buffer_t {
+ /** Buffer memory. */
+ char *buffer;
+ /** Buffer mask. */
+ ring_buffer_size_t buffer_mask;
+ /** Index of tail. */
+ ring_buffer_size_t tail_index;
+ /** Index of head. */
+ ring_buffer_size_t head_index;
+};
+
+/**
+ * Initializes the ring buffer pointed to by <em>buffer</em>.
+ * This function can also be used to empty/reset the buffer.
+ * @param buffer The ring buffer to initialize.
+ * @param buf The buffer allocated for the ringbuffer.
+ * @param buf_size The size of the allocated ringbuffer.
+ */
+void ring_buffer_init(ring_buffer_t *buffer, char *buf, size_t buf_size);
+
+/**
+ * Adds a byte to a ring buffer.
+ * @param buffer The buffer in which the data should be placed.
+ * @param data The byte to place.
+ */
+void ring_buffer_queue(ring_buffer_t *buffer, char data);
+
+/**
+ * Adds an array of bytes to a ring buffer.
+ * @param buffer The buffer in which the data should be placed.
+ * @param data A pointer to the array of bytes to place in the queue.
+ * @param size The size of the array.
+ */
+void ring_buffer_queue_arr(ring_buffer_t *buffer, const char *data, ring_buffer_size_t size);
+
+/**
+ * Returns the oldest byte in a ring buffer.
+ * @param buffer The buffer from which the data should be returned.
+ * @param data A pointer to the location at which the data should be placed.
+ * @return 1 if data was returned; 0 otherwise.
+ */
+uint8_t ring_buffer_dequeue(ring_buffer_t *buffer, char *data);
+
+/**
+ * Returns the <em>len</em> oldest bytes in a ring buffer.
+ * @param buffer The buffer from which the data should be returned.
+ * @param data A pointer to the array at which the data should be placed.
+ * @param len The maximum number of bytes to return.
+ * @return The number of bytes returned.
+ */
+ring_buffer_size_t ring_buffer_dequeue_arr(ring_buffer_t *buffer, char *data, ring_buffer_size_t len);
+/**
+ * Peeks a ring buffer, i.e. returns an element without removing it.
+ * @param buffer The buffer from which the data should be returned.
+ * @param data A pointer to the location at which the data should be placed.
+ * @param index The index to peek.
+ * @return 1 if data was returned; 0 otherwise.
+ */
+uint8_t ring_buffer_peek(ring_buffer_t *buffer, char *data, ring_buffer_size_t index);
+
+
+/**
+ * Returns whether a ring buffer is empty.
+ * @param buffer The buffer for which it should be returned whether it is empty.
+ * @return 1 if empty; 0 otherwise.
+ */
+uint8_t ring_buffer_is_empty(ring_buffer_t *buffer);
+/**
+ * Returns whether a ring buffer is full.
+ * @param buffer The buffer for which it should be returned whether it is full.
+ * @return 1 if full; 0 otherwise.
+ */
+uint8_t ring_buffer_is_full(ring_buffer_t *buffer);
+
+/**
+ * Returns the number of items in a ring buffer.
+ * @param buffer The buffer for which the number of items should be returned.
+ * @return The number of items in the ring buffer.
+ */
+ring_buffer_size_t ring_buffer_num_items(ring_buffer_t *buffer);
+
+void ring_buffer_clean(ring_buffer_t *buffer);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* RINGBUFFER_H */
diff --git a/mbtk/include/mbtk/sta_cli.h b/mbtk/include/mbtk/sta_cli.h
new file mode 100755
index 0000000..f63c407
--- /dev/null
+++ b/mbtk/include/mbtk/sta_cli.h
@@ -0,0 +1,42 @@
+#ifndef STA_CLI_INCLUDE
+#define STA_CLI_INCLUDE
+#include <stdio.h>
+#include <stdbool.h>
+
+typedef enum
+{
+ CMD_ID_NON = 0,
+ CMD_ID_SCAN,
+ CMD_ID_SCAN_RESULTS,
+ CMD_ID_STATUS,
+ CMD_ID_MIB,
+ CMD_ID_RECONFIGURE,
+ CMD_ID_DISCONNECT,
+ CMD_ID_RECONNECT,
+ CMD_ID_SAVE_CONFIG,
+ CMD_ID_GET_NETWORK,
+ CMD_ID_SET_NETWORK,
+ CMD_ID_REMOVE_NETWORK,
+ CMD_ID_ADD_NETWORK,
+ CMD_ID_DISABLE_NETWORK,
+ CMD_ID_ENABLE_NETWORK,
+ CMD_ID_SELECT_NETWORK,
+ CMD_ID_LIST_NETWORKS,
+ CMD_ID_REASSOCIATE,
+ CMD_ID_REATTACH
+}sta_cli_cmd_id_enum;
+
+bool sta_cli_cmd_parse
+(
+ const char *cmd,
+ char *reply,
+ size_t reply_len
+);
+
+int sta_cli_ssid_get(char *ssid);
+int sta_cli_psk_get(char *psk);
+int sta_cli_ssid_set(char *ssid);
+int sta_cli_psk_set(char *psk);
+
+
+#endif /* STA_CLI_INCLUDE */
\ No newline at end of file
diff --git a/mbtk/include/mbtk/sta_ctrl.h b/mbtk/include/mbtk/sta_ctrl.h
new file mode 100755
index 0000000..ae25c99
--- /dev/null
+++ b/mbtk/include/mbtk/sta_ctrl.h
@@ -0,0 +1,43 @@
+#ifndef STA_CTRL_INCLUDE
+#define STA_CTRL_INCLUDE
+
+#include "mbtk_type.h"
+
+#define STA_BUF_SIZE 2048
+
+typedef enum{
+ STA_ERR_SUCCESS,
+ STA_ERR_DRIVER,
+ STA_ERR_TIMEOUT,
+ STA_ERR_UNKNOWN
+} sta_err_enum;
+
+typedef void (*sta_ctrl_msg_cb)(char*);
+
+sta_err_enum
+sta_ctrl_cmd_process
+(
+ const char *cmd,
+ char *cmd_rsp,
+ size_t rsp_len
+);
+
+sta_err_enum
+sta_ctrl_driver_init(bool open);
+
+sta_err_enum
+sta_ctrl_wpa_init
+(
+ const char *conf_file,
+ const char *interface,
+ sta_ctrl_msg_cb cb
+);
+
+sta_err_enum
+sta_ctrl_wpa_deinit
+(
+ void
+);
+
+#endif /* STA_CTRL_INCLUDE */
+
diff --git a/mbtk/include/mbtk/wpa_ctrl.h b/mbtk/include/mbtk/wpa_ctrl.h
new file mode 100755
index 0000000..ee6f6de
--- /dev/null
+++ b/mbtk/include/mbtk/wpa_ctrl.h
@@ -0,0 +1,415 @@
+/*
+ * wpa_supplicant/hostapd control interface library
+ * Copyright (c) 2004-2006, Jouni Malinen <j@w1.fi>
+ *
+ * This software may be distributed under the terms of the BSD license.
+ * See README for more details.
+ */
+
+#ifndef WPA_CTRL_H
+#define WPA_CTRL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* wpa_supplicant control interface - fixed message prefixes */
+
+/** Interactive request for identity/password/pin */
+#define WPA_CTRL_REQ "CTRL-REQ-"
+
+/** Response to identity/password/pin request */
+#define WPA_CTRL_RSP "CTRL-RSP-"
+
+/* Event messages with fixed prefix */
+/** Authentication completed successfully and data connection enabled */
+#define WPA_EVENT_CONNECTED "CTRL-EVENT-CONNECTED "
+/** Disconnected, data connection is not available */
+#define WPA_EVENT_DISCONNECTED "CTRL-EVENT-DISCONNECTED "
+/** Association rejected during connection attempt */
+#define WPA_EVENT_ASSOC_REJECT "CTRL-EVENT-ASSOC-REJECT "
+/** wpa_supplicant is exiting */
+#define WPA_EVENT_TERMINATING "CTRL-EVENT-TERMINATING "
+/** Password change was completed successfully */
+#define WPA_EVENT_PASSWORD_CHANGED "CTRL-EVENT-PASSWORD-CHANGED "
+/** EAP-Request/Notification received */
+#define WPA_EVENT_EAP_NOTIFICATION "CTRL-EVENT-EAP-NOTIFICATION "
+/** EAP authentication started (EAP-Request/Identity received) */
+#define WPA_EVENT_EAP_STARTED "CTRL-EVENT-EAP-STARTED "
+/** EAP method proposed by the server */
+#define WPA_EVENT_EAP_PROPOSED_METHOD "CTRL-EVENT-EAP-PROPOSED-METHOD "
+/** EAP method selected */
+#define WPA_EVENT_EAP_METHOD "CTRL-EVENT-EAP-METHOD "
+/** EAP peer certificate from TLS */
+#define WPA_EVENT_EAP_PEER_CERT "CTRL-EVENT-EAP-PEER-CERT "
+/** EAP TLS certificate chain validation error */
+#define WPA_EVENT_EAP_TLS_CERT_ERROR "CTRL-EVENT-EAP-TLS-CERT-ERROR "
+/** EAP status */
+#define WPA_EVENT_EAP_STATUS "CTRL-EVENT-EAP-STATUS "
+/** EAP authentication completed successfully */
+#define WPA_EVENT_EAP_SUCCESS "CTRL-EVENT-EAP-SUCCESS "
+/** EAP authentication failed (EAP-Failure received) */
+#define WPA_EVENT_EAP_FAILURE "CTRL-EVENT-EAP-FAILURE "
+/** Network block temporarily disabled (e.g., due to authentication failure) */
+#define WPA_EVENT_TEMP_DISABLED "CTRL-EVENT-SSID-TEMP-DISABLED "
+/** Temporarily disabled network block re-enabled */
+#define WPA_EVENT_REENABLED "CTRL-EVENT-SSID-REENABLED "
+/** New scan started */
+#define WPA_EVENT_SCAN_STARTED "CTRL-EVENT-SCAN-STARTED "
+/** New scan results available */
+#define WPA_EVENT_SCAN_RESULTS "CTRL-EVENT-SCAN-RESULTS "
+/** Scan command failed */
+#define WPA_EVENT_SCAN_FAILED "CTRL-EVENT-SCAN-FAILED "
+/** wpa_supplicant state change */
+#define WPA_EVENT_STATE_CHANGE "CTRL-EVENT-STATE-CHANGE "
+/** A new BSS entry was added (followed by BSS entry id and BSSID) */
+#define WPA_EVENT_BSS_ADDED "CTRL-EVENT-BSS-ADDED "
+/** A BSS entry was removed (followed by BSS entry id and BSSID) */
+#define WPA_EVENT_BSS_REMOVED "CTRL-EVENT-BSS-REMOVED "
+/** Change in the signal level was reported by the driver */
+#define WPA_EVENT_SIGNAL_CHANGE "CTRL-EVENT-SIGNAL-CHANGE "
+/** Regulatory domain channel */
+#define WPA_EVENT_REGDOM_CHANGE "CTRL-EVENT-REGDOM-CHANGE "
+
+/** RSN IBSS 4-way handshakes completed with specified peer */
+#define IBSS_RSN_COMPLETED "IBSS-RSN-COMPLETED "
+
+/** Notification of frequency conflict due to a concurrent operation.
+ *
+ * The indicated network is disabled and needs to be re-enabled before it can
+ * be used again.
+ */
+#define WPA_EVENT_FREQ_CONFLICT "CTRL-EVENT-FREQ-CONFLICT "
+/** Frequency ranges that the driver recommends to avoid */
+#define WPA_EVENT_AVOID_FREQ "CTRL-EVENT-AVOID-FREQ "
+/** WPS overlap detected in PBC mode */
+#define WPS_EVENT_OVERLAP "WPS-OVERLAP-DETECTED "
+/** Available WPS AP with active PBC found in scan results */
+#define WPS_EVENT_AP_AVAILABLE_PBC "WPS-AP-AVAILABLE-PBC "
+/** Available WPS AP with our address as authorized in scan results */
+#define WPS_EVENT_AP_AVAILABLE_AUTH "WPS-AP-AVAILABLE-AUTH "
+/** Available WPS AP with recently selected PIN registrar found in scan results
+ */
+#define WPS_EVENT_AP_AVAILABLE_PIN "WPS-AP-AVAILABLE-PIN "
+/** Available WPS AP found in scan results */
+#define WPS_EVENT_AP_AVAILABLE "WPS-AP-AVAILABLE "
+/** A new credential received */
+#define WPS_EVENT_CRED_RECEIVED "WPS-CRED-RECEIVED "
+/** M2D received */
+#define WPS_EVENT_M2D "WPS-M2D "
+/** WPS registration failed after M2/M2D */
+#define WPS_EVENT_FAIL "WPS-FAIL "
+/** WPS registration completed successfully */
+#define WPS_EVENT_SUCCESS "WPS-SUCCESS "
+/** WPS enrollment attempt timed out and was terminated */
+#define WPS_EVENT_TIMEOUT "WPS-TIMEOUT "
+/* PBC mode was activated */
+#define WPS_EVENT_ACTIVE "WPS-PBC-ACTIVE "
+/* PBC mode was disabled */
+#define WPS_EVENT_DISABLE "WPS-PBC-DISABLE "
+
+#define WPS_EVENT_ENROLLEE_SEEN "WPS-ENROLLEE-SEEN "
+
+#define WPS_EVENT_OPEN_NETWORK "WPS-OPEN-NETWORK "
+
+/* WPS ER events */
+#define WPS_EVENT_ER_AP_ADD "WPS-ER-AP-ADD "
+#define WPS_EVENT_ER_AP_REMOVE "WPS-ER-AP-REMOVE "
+#define WPS_EVENT_ER_ENROLLEE_ADD "WPS-ER-ENROLLEE-ADD "
+#define WPS_EVENT_ER_ENROLLEE_REMOVE "WPS-ER-ENROLLEE-REMOVE "
+#define WPS_EVENT_ER_AP_SETTINGS "WPS-ER-AP-SETTINGS "
+#define WPS_EVENT_ER_SET_SEL_REG "WPS-ER-AP-SET-SEL-REG "
+
+/** P2P device found */
+#define P2P_EVENT_DEVICE_FOUND "P2P-DEVICE-FOUND "
+
+/** P2P device lost */
+#define P2P_EVENT_DEVICE_LOST "P2P-DEVICE-LOST "
+
+/** A P2P device requested GO negotiation, but we were not ready to start the
+ * negotiation */
+#define P2P_EVENT_GO_NEG_REQUEST "P2P-GO-NEG-REQUEST "
+#define P2P_EVENT_GO_NEG_SUCCESS "P2P-GO-NEG-SUCCESS "
+#define P2P_EVENT_GO_NEG_FAILURE "P2P-GO-NEG-FAILURE "
+#define P2P_EVENT_GROUP_FORMATION_SUCCESS "P2P-GROUP-FORMATION-SUCCESS "
+#define P2P_EVENT_GROUP_FORMATION_FAILURE "P2P-GROUP-FORMATION-FAILURE "
+#define P2P_EVENT_GROUP_STARTED "P2P-GROUP-STARTED "
+#define P2P_EVENT_GROUP_REMOVED "P2P-GROUP-REMOVED "
+#define P2P_EVENT_CROSS_CONNECT_ENABLE "P2P-CROSS-CONNECT-ENABLE "
+#define P2P_EVENT_CROSS_CONNECT_DISABLE "P2P-CROSS-CONNECT-DISABLE "
+/* parameters: <peer address> <PIN> */
+#define P2P_EVENT_PROV_DISC_SHOW_PIN "P2P-PROV-DISC-SHOW-PIN "
+/* parameters: <peer address> */
+#define P2P_EVENT_PROV_DISC_ENTER_PIN "P2P-PROV-DISC-ENTER-PIN "
+/* parameters: <peer address> */
+#define P2P_EVENT_PROV_DISC_PBC_REQ "P2P-PROV-DISC-PBC-REQ "
+/* parameters: <peer address> */
+#define P2P_EVENT_PROV_DISC_PBC_RESP "P2P-PROV-DISC-PBC-RESP "
+/* parameters: <peer address> <status> */
+#define P2P_EVENT_PROV_DISC_FAILURE "P2P-PROV-DISC-FAILURE"
+/* parameters: <freq> <src addr> <dialog token> <update indicator> <TLVs> */
+#define P2P_EVENT_SERV_DISC_REQ "P2P-SERV-DISC-REQ "
+/* parameters: <src addr> <update indicator> <TLVs> */
+#define P2P_EVENT_SERV_DISC_RESP "P2P-SERV-DISC-RESP "
+#define P2P_EVENT_INVITATION_RECEIVED "P2P-INVITATION-RECEIVED "
+#define P2P_EVENT_INVITATION_RESULT "P2P-INVITATION-RESULT "
+#define P2P_EVENT_FIND_STOPPED "P2P-FIND-STOPPED "
+#define P2P_EVENT_PERSISTENT_PSK_FAIL "P2P-PERSISTENT-PSK-FAIL id="
+#define P2P_EVENT_PRESENCE_RESPONSE "P2P-PRESENCE-RESPONSE "
+#define P2P_EVENT_NFC_BOTH_GO "P2P-NFC-BOTH-GO "
+#define P2P_EVENT_NFC_PEER_CLIENT "P2P-NFC-PEER-CLIENT "
+#define P2P_EVENT_NFC_WHILE_CLIENT "P2P-NFC-WHILE-CLIENT "
+
+/* parameters: <PMF enabled> <timeout in ms> <Session Information URL> */
+#define ESS_DISASSOC_IMMINENT "ESS-DISASSOC-IMMINENT "
+#define P2P_EVENT_REMOVE_AND_REFORM_GROUP "P2P-REMOVE-AND-REFORM-GROUP "
+
+#define INTERWORKING_AP "INTERWORKING-AP "
+#define INTERWORKING_BLACKLISTED "INTERWORKING-BLACKLISTED "
+#define INTERWORKING_NO_MATCH "INTERWORKING-NO-MATCH "
+#define INTERWORKING_ALREADY_CONNECTED "INTERWORKING-ALREADY-CONNECTED "
+#define INTERWORKING_SELECTED "INTERWORKING-SELECTED "
+
+/* Credential block added; parameters: <id> */
+#define CRED_ADDED "CRED-ADDED "
+/* Credential block modified; parameters: <id> <field> */
+#define CRED_MODIFIED "CRED-MODIFIED "
+/* Credential block removed; parameters: <id> */
+#define CRED_REMOVED "CRED-REMOVED "
+
+#define GAS_RESPONSE_INFO "GAS-RESPONSE-INFO "
+/* parameters: <addr> <dialog_token> <freq> */
+#define GAS_QUERY_START "GAS-QUERY-START "
+/* parameters: <addr> <dialog_token> <freq> <status_code> <result> */
+#define GAS_QUERY_DONE "GAS-QUERY-DONE "
+
+#define HS20_SUBSCRIPTION_REMEDIATION "HS20-SUBSCRIPTION-REMEDIATION "
+#define HS20_DEAUTH_IMMINENT_NOTICE "HS20-DEAUTH-IMMINENT-NOTICE "
+
+#define EXT_RADIO_WORK_START "EXT-RADIO-WORK-START "
+#define EXT_RADIO_WORK_TIMEOUT "EXT-RADIO-WORK-TIMEOUT "
+
+/* hostapd control interface - fixed message prefixes */
+#define WPS_EVENT_PIN_NEEDED "WPS-PIN-NEEDED "
+#define WPS_EVENT_NEW_AP_SETTINGS "WPS-NEW-AP-SETTINGS "
+#define WPS_EVENT_REG_SUCCESS "WPS-REG-SUCCESS "
+#define WPS_EVENT_AP_SETUP_LOCKED "WPS-AP-SETUP-LOCKED "
+#define WPS_EVENT_AP_SETUP_UNLOCKED "WPS-AP-SETUP-UNLOCKED "
+#define WPS_EVENT_AP_PIN_ENABLED "WPS-AP-PIN-ENABLED "
+#define WPS_EVENT_AP_PIN_DISABLED "WPS-AP-PIN-DISABLED "
+#define AP_STA_CONNECTED "AP-STA-CONNECTED "
+#define AP_STA_DISCONNECTED "AP-STA-DISCONNECTED "
+
+#define AP_REJECTED_MAX_STA "AP-REJECTED-MAX-STA "
+#define AP_REJECTED_BLOCKED_STA "AP-REJECTED-BLOCKED-STA "
+
+#define AP_EVENT_ENABLED "AP-ENABLED "
+#define AP_EVENT_DISABLED "AP-DISABLED "
+
+#define ACS_EVENT_STARTED "ACS-STARTED "
+#define ACS_EVENT_COMPLETED "ACS-COMPLETED "
+#define ACS_EVENT_FAILED "ACS-FAILED "
+
+#define DFS_EVENT_RADAR_DETECTED "DFS-RADAR-DETECTED "
+#define DFS_EVENT_NEW_CHANNEL "DFS-NEW-CHANNEL "
+#define DFS_EVENT_CAC_START "DFS-CAC-START "
+#define DFS_EVENT_CAC_COMPLETED "DFS-CAC-COMPLETED "
+#define DFS_EVENT_NOP_FINISHED "DFS-NOP-FINISHED "
+
+#define AP_CSA_FINISHED "AP-CSA-FINISHED "
+
+/* BSS command information masks */
+
+#define WPA_BSS_MASK_ALL 0xFFFDFFFF
+#define WPA_BSS_MASK_ID BIT(0)
+#define WPA_BSS_MASK_BSSID BIT(1)
+#define WPA_BSS_MASK_FREQ BIT(2)
+#define WPA_BSS_MASK_BEACON_INT BIT(3)
+#define WPA_BSS_MASK_CAPABILITIES BIT(4)
+#define WPA_BSS_MASK_QUAL BIT(5)
+#define WPA_BSS_MASK_NOISE BIT(6)
+#define WPA_BSS_MASK_LEVEL BIT(7)
+#define WPA_BSS_MASK_TSF BIT(8)
+#define WPA_BSS_MASK_AGE BIT(9)
+#define WPA_BSS_MASK_IE BIT(10)
+#define WPA_BSS_MASK_FLAGS BIT(11)
+#define WPA_BSS_MASK_SSID BIT(12)
+#define WPA_BSS_MASK_WPS_SCAN BIT(13)
+#define WPA_BSS_MASK_P2P_SCAN BIT(14)
+#define WPA_BSS_MASK_INTERNETW BIT(15)
+#define WPA_BSS_MASK_WIFI_DISPLAY BIT(16)
+#define WPA_BSS_MASK_DELIM BIT(17)
+#define WPA_BSS_MASK_FST BIT(21)
+
+
+/* VENDOR_ELEM_* frame id values */
+enum wpa_vendor_elem_frame {
+ VENDOR_ELEM_PROBE_REQ_P2P = 0,
+ VENDOR_ELEM_PROBE_RESP_P2P = 1,
+ VENDOR_ELEM_PROBE_RESP_P2P_GO = 2,
+ VENDOR_ELEM_BEACON_P2P_GO = 3,
+ VENDOR_ELEM_P2P_PD_REQ = 4,
+ VENDOR_ELEM_P2P_PD_RESP = 5,
+ VENDOR_ELEM_P2P_GO_NEG_REQ = 6,
+ VENDOR_ELEM_P2P_GO_NEG_RESP = 7,
+ VENDOR_ELEM_P2P_GO_NEG_CONF = 8,
+ VENDOR_ELEM_P2P_INV_REQ = 9,
+ VENDOR_ELEM_P2P_INV_RESP = 10,
+ VENDOR_ELEM_P2P_ASSOC_REQ = 11,
+ VENDOR_ELEM_P2P_ASSOC_RESP = 12,
+ NUM_VENDOR_ELEM_FRAMES
+};
+
+
+/* wpa_supplicant/hostapd control interface access */
+
+/**
+ * wpa_ctrl_open - Open a control interface to wpa_supplicant/hostapd
+ * @ctrl_path: Path for UNIX domain sockets; ignored if UDP sockets are used.
+ * Returns: Pointer to abstract control interface data or %NULL on failure
+ *
+ * This function is used to open a control interface to wpa_supplicant/hostapd.
+ * ctrl_path is usually /var/run/wpa_supplicant or /var/run/hostapd. This path
+ * is configured in wpa_supplicant/hostapd and other programs using the control
+ * interface need to use matching path configuration.
+ */
+struct wpa_ctrl * wpa_ctrl_open(const char *ctrl_path);
+
+
+/**
+ * wpa_ctrl_close - Close a control interface to wpa_supplicant/hostapd
+ * @ctrl: Control interface data from wpa_ctrl_open()
+ *
+ * This function is used to close a control interface.
+ */
+void wpa_ctrl_close(struct wpa_ctrl *ctrl);
+
+
+/**
+ * wpa_ctrl_request - Send a command to wpa_supplicant/hostapd
+ * @ctrl: Control interface data from wpa_ctrl_open()
+ * @cmd: Command; usually, ASCII text, e.g., "PING"
+ * @cmd_len: Length of the cmd in bytes
+ * @reply: Buffer for the response
+ * @reply_len: Reply buffer length
+ * @msg_cb: Callback function for unsolicited messages or %NULL if not used
+ * Returns: 0 on success, -1 on error (send or receive failed), -2 on timeout
+ *
+ * This function is used to send commands to wpa_supplicant/hostapd. Received
+ * response will be written to reply and reply_len is set to the actual length
+ * of the reply. This function will block for up to two seconds while waiting
+ * for the reply. If unsolicited messages are received, the blocking time may
+ * be longer.
+ *
+ * msg_cb can be used to register a callback function that will be called for
+ * unsolicited messages received while waiting for the command response. These
+ * messages may be received if wpa_ctrl_request() is called at the same time as
+ * wpa_supplicant/hostapd is sending such a message. This can happen only if
+ * the program has used wpa_ctrl_attach() to register itself as a monitor for
+ * event messages. Alternatively to msg_cb, programs can register two control
+ * interface connections and use one of them for commands and the other one for
+ * receiving event messages, in other words, call wpa_ctrl_attach() only for
+ * the control interface connection that will be used for event messages.
+ */
+int wpa_ctrl_request(struct wpa_ctrl *ctrl, const char *cmd, size_t cmd_len,
+ char *reply, size_t *reply_len,
+ void (*msg_cb)(char *msg, size_t len));
+
+
+/**
+ * wpa_ctrl_attach - Register as an event monitor for the control interface
+ * @ctrl: Control interface data from wpa_ctrl_open()
+ * Returns: 0 on success, -1 on failure, -2 on timeout
+ *
+ * This function registers the control interface connection as a monitor for
+ * wpa_supplicant/hostapd events. After a success wpa_ctrl_attach() call, the
+ * control interface connection starts receiving event messages that can be
+ * read with wpa_ctrl_recv().
+ */
+int wpa_ctrl_attach(struct wpa_ctrl *ctrl);
+
+
+/**
+ * wpa_ctrl_detach - Unregister event monitor from the control interface
+ * @ctrl: Control interface data from wpa_ctrl_open()
+ * Returns: 0 on success, -1 on failure, -2 on timeout
+ *
+ * This function unregisters the control interface connection as a monitor for
+ * wpa_supplicant/hostapd events, i.e., cancels the registration done with
+ * wpa_ctrl_attach().
+ */
+int wpa_ctrl_detach(struct wpa_ctrl *ctrl);
+
+
+/**
+ * wpa_ctrl_recv - Receive a pending control interface message
+ * @ctrl: Control interface data from wpa_ctrl_open()
+ * @reply: Buffer for the message data
+ * @reply_len: Length of the reply buffer
+ * Returns: 0 on success, -1 on failure
+ *
+ * This function will receive a pending control interface message. The received
+ * response will be written to reply and reply_len is set to the actual length
+ * of the reply.
+
+ * wpa_ctrl_recv() is only used for event messages, i.e., wpa_ctrl_attach()
+ * must have been used to register the control interface as an event monitor.
+ */
+int wpa_ctrl_recv(struct wpa_ctrl *ctrl, char *reply, size_t *reply_len);
+
+
+/**
+ * wpa_ctrl_pending - Check whether there are pending event messages
+ * @ctrl: Control interface data from wpa_ctrl_open()
+ * Returns: 1 if there are pending messages, 0 if no, or -1 on error
+ *
+ * This function will check whether there are any pending control interface
+ * message available to be received with wpa_ctrl_recv(). wpa_ctrl_pending() is
+ * only used for event messages, i.e., wpa_ctrl_attach() must have been used to
+ * register the control interface as an event monitor.
+ */
+int wpa_ctrl_pending(struct wpa_ctrl *ctrl);
+
+
+/**
+ * wpa_ctrl_get_fd - Get file descriptor used by the control interface
+ * @ctrl: Control interface data from wpa_ctrl_open()
+ * Returns: File descriptor used for the connection
+ *
+ * This function can be used to get the file descriptor that is used for the
+ * control interface connection. The returned value can be used, e.g., with
+ * select() while waiting for multiple events.
+ *
+ * The returned file descriptor must not be used directly for sending or
+ * receiving packets; instead, the library functions wpa_ctrl_request() and
+ * wpa_ctrl_recv() must be used for this.
+ */
+int wpa_ctrl_get_fd(struct wpa_ctrl *ctrl);
+
+char * wpa_ctrl_get_remote_ifname(struct wpa_ctrl *ctrl);
+
+#ifdef ANDROID
+/**
+ * wpa_ctrl_cleanup() - Delete any local UNIX domain socket files that
+ * may be left over from clients that were previously connected to
+ * wpa_supplicant. This keeps these files from being orphaned in the
+ * event of crashes that prevented them from being removed as part
+ * of the normal orderly shutdown.
+ */
+void wpa_ctrl_cleanup(void);
+#endif /* ANDROID */
+
+#ifdef CONFIG_CTRL_IFACE_UDP
+/* Port range for multiple wpa_supplicant instances and multiple VIFs */
+#define WPA_CTRL_IFACE_PORT 9877
+#define WPA_CTRL_IFACE_PORT_LIMIT 50 /* decremented from start */
+#define WPA_GLOBAL_CTRL_IFACE_PORT 9878
+#define WPA_GLOBAL_CTRL_IFACE_PORT_LIMIT 20 /* incremented from start */
+#endif /* CONFIG_CTRL_IFACE_UDP */
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* WPA_CTRL_H */
diff --git a/mbtk/include/mbtk_device_info.h b/mbtk/include/mbtk_device_info.h
new file mode 100755
index 0000000..f03303a
--- /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_T108"
+
+#define MBTK_DEVICES_REVISION "T108v05.04b01_V2.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_v2/fota_info.h b/mbtk/include/ql_v2/fota_info.h
new file mode 100755
index 0000000..59cd6ac
--- /dev/null
+++ b/mbtk/include/ql_v2/fota_info.h
@@ -0,0 +1,26 @@
+#ifndef FOTA_INFO_H_
+#define FOTA_INFO_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+typedef enum
+{
+ SUCCEED = 0,
+ UPDATE,
+ BACKUP,
+ FAILED,
+ WRITEDONE,
+ NEEDSYNC,
+ CANCEL,
+ UNKNOWN_STATUS
+} fota_state_t;
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif //FOTA_INFO_H_
diff --git a/mbtk/include/ql_v2/ql_absys_api.h b/mbtk/include/ql_v2/ql_absys_api.h
new file mode 100755
index 0000000..6896f38
--- /dev/null
+++ b/mbtk/include/ql_v2/ql_absys_api.h
@@ -0,0 +1,149 @@
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @file ql_absys.h
+ @brief
+ This file declare absys interface
+*/
+/*-----------------------------------------------------------------------------------------------*/
+
+/*-------------------------------------------------------------------------------------------------
+ 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
+ -------- --- ----------------------------------------------------------
+ 2021.12.20 jessie.lei Created .
+-------------------------------------------------------------------------------------------------*/
+
+
+#ifndef QL_ABSYS_H_
+#define QL_ABSYS_H_
+
+#include <stdbool.h>
+#include <stdint.h>
+#include <errno.h>
+#include "fota_info.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define PARTITION_NAME_SIZE 16
+
+
+
+//--------------------------------------------------------------------------------------------------
+/**
+ * System ID: The dual system platforms have 2 systems: A and B.
+ *
+ */
+//--------------------------------------------------------------------------------------------------
+typedef enum absystem
+{
+ SYSTEM_A = 0,
+ SYSTEM_B = 1
+} absystem_t;
+
+//--------------------------------------------------------------------------------------------------
+/**
+ * system status
+ */
+//--------------------------------------------------------------------------------------------------
+typedef struct
+{
+ fota_state_t ota_state; ///< the device ota upgrade status
+ bool is_damaged; ///< whether the device have damaged partition
+ uint8_t damaged_partname[PARTITION_NAME_SIZE]; ///< which partition damaged, and tiggered the device A/B system switch
+} sysstatus_t;
+
+//--------------------------------------------------------------------------------------------------
+/**
+ * @brief
+ * get current system status, fota status & A/B partition status.
+ * @Parameter
+ [OUT] sys_state, store the status to this struct for the caller could read current system status.
+ * @return
+ * - On success 0
+ * - On failure -1
+ */
+//--------------------------------------------------------------------------------------------------
+int ql_absys_getstatus(sysstatus_t *sys_state);
+
+//--------------------------------------------------------------------------------------------------
+/**
+ * @brief
+ * get current active system is A or B.
+ * @Parameter
+ [InOut] cur_system, store the current active system info to this enmu.
+ * @return
+ * - On success 0, success to get current active system
+ * - On failure -1, failed to get current active system
+ */
+//--------------------------------------------------------------------------------------------------
+int ql_absys_get_cur_active_part(absystem_t *cur_system);
+
+
+//--------------------------------------------------------------------------------------------------
+/**
+ * @brief
+ * Set flags in fota state file, need the caller do reboot system action atfer this api return 0, then A/B system will be switch atfer reboot.
+ * If fota state is SUCCEED or NEEDSYNC (A/B system is sync), it is okay to switch A/B system, API will be return 0.
+ * If fota state is WRITEDONE (A/B system is not sync), it is okay to switch A/B system and will be set fota state to NEEDSYNC, API will be return 0.
+ * If fota state is UPDATE or BACKUP (A/B system is not sync), indicate the inactive partition is being updated and can not switch A/B, API will be return -2
+ * If fota state is FAILED (A/B system is not sync), indicate the inactive partition was damaged and can not switch A/B, API will be return -3
+ * @Parameter
+ * No parameter
+ * @return
+ * - On success 0 indicate the switch flag was set succeed
+ * - On failure -1 get or set fota state and absys info failed;
+ * -2 indicate the inactive partition was damaged by ota upgrade, could not switch;
+ * -3 indicate the inactive partition is being upgraded or backup is in progress.
+ */
+//--------------------------------------------------------------------------------------------------
+int ql_absys_switch(void);
+
+
+//--------------------------------------------------------------------------------------------------
+/**
+ * @brief
+ * Program a synchronization active slot partition data to non-active partition
+ * @Parameter
+ * No parameter
+ * @return
+ * - On success 0
+ * - On failure -1
+ */
+//--------------------------------------------------------------------------------------------------
+int ql_absys_sync(void);
+
+
+//--------------------------------------------------------------------------------------------------
+/**
+ * @brief
+ * Program a synchronization active slot partition data to non-inactive partition
+ * @Parameter
+ * [IN] cpu_loading_level 0 ql_otad cpuloading 98%
+ * 1 ql_otad cpuloading 55%
+ * 2 ql_otad cpuloading 38%
+ * 3 ql_otad cpuloading 30%
+ * 4 ql_otad cpuloading 25%
+ * 5 ql_otad cpuloading 20%
+ * @return
+ * - On success 0
+ * - On failure -1
+ */
+//--------------------------------------------------------------------------------------------------
+int ql_absys_sync_control(int cpu_loading_level);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif //QL_ABSYS_H_
diff --git a/mbtk/include/ql_v2/ql_adc.h b/mbtk/include/ql_v2/ql_adc.h
new file mode 100755
index 0000000..36136d0
--- /dev/null
+++ b/mbtk/include/ql_v2/ql_adc.h
@@ -0,0 +1,70 @@
+/**
+ @file
+ ql_adc.h
+
+ @brief
+ This file provides the definitions for adc, 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
+---------- ------------ ----------------------------------------------------
+10/12/2021 larry Code normalization
+=============================================================================*/
+
+#ifndef _QL_ADC_H_
+#define _QL_ADC_H_
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ ADC channel enum
+*/
+typedef enum ADC_CHANNEL_ENUM{
+ QADC_NONE = 0, /** Invalid channel*/
+ ADC0 = 1, /** ADC0 channel */
+ ADC1 = 2, /** ADC1 channel */
+ ADC2 = 3, /** ADC2 channel */
+ QADC_END /** Invalid channel*/
+}ADC_CHANNEL_E;
+
+/*========================================================================
+ FUNCTION: ql_adc_show
+=========================================================================*/
+/** @brief
+ This function retrieves the ADC voltage value with the specified
+ ADC channel.
+ Support input vol value:
+ ADC0 : 0V-VBAT_BB
+ ADC1 : 0V-VBAT_BB
+
+ @param[in] qadc, adc channel definitions, one value of ADC_CHANNEL_E.
+
+ @return
+ adc value(mv) on success
+ on failure, the return value is -1;
+*/
+/*=======================================================================*/
+int ql_adc_show(ADC_CHANNEL_E qadc);
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif
diff --git a/mbtk/include/ql_v2/ql_asn1Msd.h b/mbtk/include/ql_v2/ql_asn1Msd.h
new file mode 100755
index 0000000..a59372f
--- /dev/null
+++ b/mbtk/include/ql_v2/ql_asn1Msd.h
@@ -0,0 +1,416 @@
+/** @file asn1Msd.h
+ *
+ * This file contains the declarations of the ASN1 MSD builder.
+ *
+ * Copyright (C) Sierra Wireless Inc.
+ */
+/*================================================================
+ 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
+ ------------ ------- ---------------------------------------
+ 04/12/2018 laurence Init.
+ =================================================================*/
+
+#ifndef _ASN1_MSD_INCLUDE_GUARD_
+#define _ASN1_MSD_INCLUDE_GUARD_
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <string.h>
+
+#ifndef NULL
+#define NULL 0
+#endif
+
+//--------------------------------------------------------------------------------------------------
+// Defines
+//--------------------------------------------------------------------------------------------------
+
+//--------------------------------------------------------------------------------------------------
+/**
+ * Position N-1 and N-2 are delta positions.
+ * Limits as defined in FprEN 15722:2014
+ * These are the max and min values for the msd_VehicleLocationDelta_t members
+ */
+//--------------------------------------------------------------------------------------------------
+#define ASN1_LATITUDE_DELTA_MAX 511
+#define ASN1_LATITUDE_DELTA_MIN -512
+#define ASN1_LONGITUDE_DELTA_MAX 511
+#define ASN1_LONGITUDE_DELTA_MIN -512
+#define ASN1_ECALL_MSD_VERSION_1 1
+#define ASN1_ECALL_MSD_VERSION_2 2
+#define ASN1_ECALL_MSD_VERSION_3 3
+
+
+#define QL_ECALL_MAX_VIN 20
+
+//--------------------------------------------------------------------------------------------------
+// Symbols and enums.
+//--------------------------------------------------------------------------------------------------
+typedef enum
+{
+ QL_ERR_MSD_NONE = 0,
+ QL_ERR_MSD_SUCCESS = QL_ERR_MSD_NONE,
+ QL_ERR_MSD_GENERIC = -(QL_ERR_MSD_NONE+1), /**< MSD Generic ERROR. */
+ QL_ERR_MSD_BADPARM = -(QL_ERR_MSD_NONE+2), /**< MSD Bad parameter ERROR. */
+ QL_ERR_MSD_VERSION = -(QL_ERR_MSD_NONE+3), /**< MSD VERSION ERROR. */
+ QL_ERR_MSD_ISOWMI = -(QL_ERR_MSD_NONE+2), /**< MSD wmi ERROR. */
+ QL_ERR_MSD_ISOVDS = -(QL_ERR_MSD_NONE+4), /**< MSD vds ERROR. */
+ QL_ERR_MSD_ISOVIS_MODELYEAR = -(QL_ERR_MSD_NONE+5), /**< MSD model year ERROR. */
+ QL_ERR_MSD_ISOVIS_SEQPLAN = -(QL_ERR_MSD_NONE+6), /**< MSD seplan ERROR. */
+ QL_ERR_MSD_LATITUDE = -(QL_ERR_MSD_NONE+7), /**< MSD latitude ERROR. */
+ QL_ERR_MSD_LONGITUDE = -(QL_ERR_MSD_NONE+8), /**< MSD longitude ERROR. */
+ QL_ERR_MSD_VEH_DIRECTION = -(QL_ERR_MSD_NONE+9), /**< MSD vehDirection ERROR. */
+ QL_ERR_MSD_VEH_LAT_LOCATION1 = -(QL_ERR_MSD_NONE+10), /**< MSD recentVehLocationN1 latitude ERROR. */
+ QL_ERR_MSD_VEH_LON_LOCATION1 = -(QL_ERR_MSD_NONE+11), /**< MSD recentVehLocationN1 longitude ERROR. */
+ QL_ERR_MSD_VEH_LAT_LOCATION2 = -(QL_ERR_MSD_NONE+12), /**< MSD recentVehLocationN2 latitude ERROR. */
+ QL_ERR_MSD_VEH_LON_LOCATION2 = -(QL_ERR_MSD_NONE+13), /**< MSD recentVehLocationN2 longitude ERROR. */
+ QL_ERR_MSD_VEH_IDENTIFI_NUMBER = -(QL_ERR_MSD_NONE+14), /**< MSD vehIdentification Number ERROR. */
+ QL_ERR_MSD_OPTINAL_DATA_GLONASS = -(QL_ERR_MSD_NONE+15), /**< MSD Optional Data For Era Glonass ERROR. */
+} QL_ERR_MSD_RESULT_E;
+
+//--------------------------------------------------------------------------------------------------
+/**
+ * Enumeration used to specify the type of vehicle.
+ */
+//--------------------------------------------------------------------------------------------------
+typedef enum
+{
+ MSD_VEHICLE_PASSENGER_M1=1, ///< Passenger vehicle (Class M1)
+ MSD_VEHICLE_BUS_M2, ///< Buses and coaches (Class M2)
+ MSD_VEHICLE_BUS_M3, ///< Buses and coaches (Class M3)
+ MSD_VEHICLE_COMMERCIAL_N1, ///< Light commercial vehicles (Class N1)
+ MSD_VEHICLE_HEAVY_N2, ///< Heavy duty vehicles (Class N2)
+ MSD_VEHICLE_HEAVY_N3, ///< Heavy duty vehicles (Class N3)
+ MSD_VEHICLE_MOTORCYCLE_L1E, ///< Motorcycles (Class L1e)
+ MSD_VEHICLE_MOTORCYCLE_L2E, ///< Motorcycles (Class L2e)
+ MSD_VEHICLE_MOTORCYCLE_L3E, ///< Motorcycles (Class L3e)
+ MSD_VEHICLE_MOTORCYCLE_L4E, ///< Motorcycles (Class L4e)
+ MSD_VEHICLE_MOTORCYCLE_L5E, ///< Motorcycles (Class L5e)
+ MSD_VEHICLE_MOTORCYCLE_L6E, ///< Motorcycles (Class L6e)
+ MSD_VEHICLE_MOTORCYCLE_L7E, ///< Motorcycles (Class L7e)
+} MSD_VEHICLE_TYPE_E;
+
+//--------------------------------------------------------------------------------------------------
+/**
+ * Enumeration used to specify the propulsion type.
+ */
+//--------------------------------------------------------------------------------------------------
+typedef enum
+{
+ ECALL_MSD_PROPULSION_TYPE_GASOLINE=0x1,
+ ECALL_MSD_PROPULSION_TYPE_DIESEL=0x2,
+ ECALL_MSD_PROPULSION_TYPE_NATURALGAS=0x4,
+ ECALL_MSD_PROPULSION_TYPE_PROPANE=0x8,
+ ECALL_MSD_PROPULSION_TYPE_ELECTRIC=0x10,
+ ECALL_MSD_PROPULSION_TYPE_HYDROGEN=0x20,
+ ECALL_MSD_PROPULSION_TYPE_OTHER=0x40,
+} ECALL_MSD_PROPULSION_TYPE_E;
+
+//--------------------------------------------------------------------------------------------------
+/**
+ * Enumeration used to specify the type of coordinate system.
+ */
+//--------------------------------------------------------------------------------------------------
+typedef enum
+{
+ MSD_COORDINATE_SYSTEM_TYPE_ABSENT, ///< Coordinate system type is absent
+ MSD_COORDINATE_SYSTEM_TYPE_WGS84, ///< Coordinate system type WGS-84
+ MSD_COORDINATE_SYSTEM_TYPE_PZ90 ///< Coordinate system type PZ-90
+} ECALL_MSD_COORINATE_SYSTEM_TYPE_E;
+
+typedef enum
+{
+ ECALL_SYSTEM_STD_PAN_EUROPEAN, //< PAN-European system.
+ ECALL_SYSTEM_STD_ERA_GLONASS //< ERA-GLONASS system.
+} ECALL_SYSTEM_STD_E;
+//--------------------------------------------------------------------------------------------------
+// Data structures.
+//--------------------------------------------------------------------------------------------------
+
+//--------------------------------------------------------------------------------------------------
+/**
+ * Data structure describing the VIN (Vehicle Identification Number).
+ *
+ */
+//--------------------------------------------------------------------------------------------------
+typedef struct{
+ char isowmi[4];
+ char isovds[7];
+ char isovisModelyear[2];
+ char isovisSeqPlant[8];
+} msd_Vin_t;
+
+/* ControlType */
+//--------------------------------------------------------------------------------------------------
+/**
+ * Data structure describing the main control elements of the MSD.
+ *
+ */
+//--------------------------------------------------------------------------------------------------
+typedef struct {
+ bool automaticActivation;
+ bool testCall;
+ bool positionCanBeTrusted;
+ MSD_VEHICLE_TYPE_E vehType;
+} msd_Control_t;
+
+//--------------------------------------------------------------------------------------------------
+/**
+ * Data structure describing the vehicle propulsion storage type.
+ *
+ */
+//--------------------------------------------------------------------------------------------------
+typedef struct {
+ bool gasolineTankPresent;
+ bool dieselTankPresent;
+ bool compressedNaturalGas;
+ bool liquidPropaneGas;
+ bool electricEnergyStorage;
+ bool hydrogenStorage;
+ bool otherStorage;
+} msd_VehiclePropulsionStorageType_t;
+
+//--------------------------------------------------------------------------------------------------
+/**
+ * Data structure describing the last known vehicle location.
+ *
+ */
+//--------------------------------------------------------------------------------------------------
+typedef struct {
+ int32_t latitude;
+ int32_t longitude;
+} msd_VehicleLocation_t;
+
+//--------------------------------------------------------------------------------------------------
+/**
+ * Data structure describing the location of the vehicle some time before the generation of the data
+ * for the MSD message..
+ *
+ */
+//--------------------------------------------------------------------------------------------------
+typedef struct {
+ int32_t latitudeDelta;
+ int32_t longitudeDelta;
+} msd_VehicleLocationDelta_t;
+
+//--------------------------------------------------------------------------------------------------
+/**
+ * Data structure to gather optional data.
+ *
+ */
+//--------------------------------------------------------------------------------------------------
+typedef struct {
+ uint8_t oidlen;
+ uint8_t dataLen;
+ uint8_t* oid;
+ uint8_t* data;
+} msd_optionalData_t;
+
+//--------------------------------------------------------------------------------------------------
+/**
+ * Data structure describing the MSD without the additional optional data.
+ *
+ */
+//--------------------------------------------------------------------------------------------------
+typedef struct {
+ uint8_t messageIdentifier;
+ msd_Control_t control;
+ msd_Vin_t vehIdentificationNumber;
+ msd_VehiclePropulsionStorageType_t vehPropulsionStorageType;
+ uint32_t timestamp;
+ msd_VehicleLocation_t vehLocation;
+ uint8_t vehDirection;
+ /* Optional */
+ bool recentVehLocationN1Pres;
+ msd_VehicleLocationDelta_t recentVehLocationN1;
+ /* Optional */
+ bool recentVehLocationN2Pres;
+ msd_VehicleLocationDelta_t recentVehLocationN2;
+ /* Optional */
+ bool numberOfPassengersPres;
+ uint8_t numberOfPassengers;
+} msd_Structure_t;
+
+//--------------------------------------------------------------------------------------------------
+/**
+ * Data structure describing the MSD with the additional optional data.
+ *
+ */
+//--------------------------------------------------------------------------------------------------
+typedef struct {
+ msd_Structure_t msdStruct;
+ /* Optional */
+ bool optionalDataPres;
+ msd_optionalData_t optionalData;
+} msd_Message_t;
+
+//--------------------------------------------------------------------------------------------------
+/**
+ * Data structure describing the MSD message.
+ *
+ */
+//--------------------------------------------------------------------------------------------------
+typedef struct {
+ uint8_t version;
+ msd_Message_t msdMsg;
+} msd_t;
+
+
+/* ERA GLONASS specific types for the OptionalData_t parts */
+//--------------------------------------------------------------------------------------------------
+/**
+ * Data structure to gather the ERA GLONASS specific data.
+ *
+ */
+//--------------------------------------------------------------------------------------------------
+
+typedef struct {
+ /*
+ * ERAAdditionalData ::= SEQUENCE {
+ * crashSeverity INTEGER(0..2047) OPTIONAL,
+ * diagnosticResult DiagnosticResult OPTIONAL,
+ * crashInfo CrashInfo OPTIONAL,
+ * coordinateSystemType CoordinateSystemType DEFAULT wgs84,
+ * ...
+ * }
+ */
+ uint8_t msdVersion;
+
+ bool presentCrashSeverity;
+ uint32_t crashSeverity; /* INTEGER(0..2047) OPTIONAL */
+
+ bool presentDiagnosticResult;
+ struct
+ {
+ bool presentMicConnectionFailure;
+ bool micConnectionFailure;
+
+ bool presentMicFailure;
+ bool micFailure;
+
+ bool presentRightSpeakerFailure;
+ bool rightSpeakerFailure;
+
+ bool presentLeftSpeakerFailure;
+ bool leftSpeakerFailure;
+
+ bool presentSpeakersFailure;
+ bool speakersFailure;
+
+ bool presentIgnitionLineFailure;
+ bool ignitionLineFailure;
+
+ bool presentUimFailure;
+ bool uimFailure;
+
+ bool presentStatusIndicatorFailure;
+ bool statusIndicatorFailure;
+
+ bool presentBatteryFailure;
+ bool batteryFailure;
+
+ bool presentBatteryVoltageLow;
+ bool batteryVoltageLow;
+
+ bool presentCrashSensorFailure;
+ bool crashSensorFailure;
+
+ bool presentFirmwareImageCorruption;
+ bool firmwareImageCorruption;
+
+ bool presentCommModuleInterfaceFailure;
+ bool commModuleInterfaceFailure;
+
+ bool presentGnssReceiverFailure;
+ bool gnssReceiverFailure;
+
+ bool presentRaimProblem;
+ bool raimProblem;
+
+ bool presentGnssAntennaFailure;
+ bool gnssAntennaFailure;
+
+ bool presentCommModuleFailure;
+ bool commModuleFailure;
+
+ bool presentEventsMemoryOverflow;
+ bool eventsMemoryOverflow;
+
+ bool presentCrashProfileMemoryOverflow;
+ bool crashProfileMemoryOverflow;
+
+ bool presentOtherCriticalFailures;
+ bool otherCriticalFailures;
+
+ bool presentOtherNotCriticalFailures;
+ bool otherNotCriticalFailures;
+ } diagnosticResult;
+
+ bool presentCrashInfo;
+ struct
+ {
+ bool presentCrashFront;
+ bool crashFront;
+
+ bool presentCrashLeft;
+ bool crashLeft;
+
+ bool presentCrashRight;
+ bool crashRight;
+
+ bool presentCrashRear;
+ bool crashRear;
+
+ bool presentCrashRollover;
+ bool crashRollover;
+
+ bool presentCrashSide;
+ bool crashSide;
+
+ bool presentCrashFrontOrSide;
+ bool crashFrontOrSide;
+
+ bool presentCrashAnotherType;
+ bool crashAnotherType;
+ } crashType;
+
+ bool presentCoordinateSystemTypeInfo;
+ ECALL_MSD_COORINATE_SYSTEM_TYPE_E coordinateSystemType;
+} msd_EraGlonassData_t;
+
+typedef struct ecall ecall_t;
+
+void print_msd_hexstr(uint8_t *msd,uint32_t msd_len);
+
+QL_ERR_MSD_RESULT_E ql_msd_encode
+(
+ uint8_t *pBuiltMsd, //< built MSD
+ uint32_t *pBuiltMsdSize, //< Size of the built MSDvoid
+ ECALL_SYSTEM_STD_E systemStandard,
+ msd_EraGlonassData_t eraGlonassDataObj,
+ msd_t msdContent
+);
+
+bool IsVinValid
+(
+ msd_Vin_t vin
+);
+
+int32_t ConvertDdToDms
+(
+ int32_t ddVal
+);
+
+
+
+#endif // _ASN1_MSD_INCLUDE_GUARD_
diff --git a/mbtk/include/ql_v2/ql_atc.h b/mbtk/include/ql_v2/ql_atc.h
new file mode 100755
index 0000000..6a20d42
--- /dev/null
+++ b/mbtk/include/ql_v2/ql_atc.h
@@ -0,0 +1,98 @@
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @file ql_atc.h
+ @brief AT command API
+*/
+/*-----------------------------------------------------------------------------------------------*/
+
+/*-------------------------------------------------------------------------------------------------
+ Copyright (c) 2019 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
+ -------- --- ----------------------------------------------------------
+ 20191225 stan.li Modify function description.
+ 20191225 solomon.cui Fix possible null pointer dereference.
+ 20190702 stan.li Created .
+-------------------------------------------------------------------------------------------------*/
+
+#ifndef __QL_ATC_H__
+#define __QL_ATC_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define QL_ATC_MAX_REQ_MSG_LEN 513 /**< Maximum request message size. */
+#define QL_ATC_MAX_RESP_MSG_LEN 4097 /**< Maximum response message size. */
+
+typedef void (*ql_atc_async_cb)(int async_index, char *req_buf, char *rsp_buf);
+typedef void (*ql_atc_service_error_cb_f)(int error);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Initialize ATC service.
+ @note You must call this function before other functions can be used in this module.
+ @return Whether the ATC service was successfully intialized.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_atc_init(void);
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief send at command async.
+ @param[in] req_buf At command request content
+ @param[out] async_index Async AT command index
+ @param[in] async_cb Async callback function
+ @return Whether to successfully send the AT command asynchronously
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_atc_send_async(char *req_buf, int *async_index, void *async_cb);
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief send AT command.
+ @param[in] req_buf At command request content
+ @param[in] rsp_buf At command response content
+ @param[in] rsp_len The length of rsp_buf
+ @return Whether to successfully send AT command
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_atc_send(char *req_buf, char *rsp_buf, int rsp_len);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Deinitialize ATC service.
+ @return Whether the DM service was successfully deintialized.
+ @retval QL_ERR_OK successful.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_atc_deinit(void);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif
diff --git a/mbtk/include/ql_v2/ql_audio_cfg.h b/mbtk/include/ql_v2/ql_audio_cfg.h
new file mode 100755
index 0000000..92a56ba
--- /dev/null
+++ b/mbtk/include/ql_v2/ql_audio_cfg.h
@@ -0,0 +1,533 @@
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @file ql_audio_cfg.h
+ @brief audio config API, including audio initlization, audio configuration
+
+ @detailes
+ Quectel AG55x series module AUDIO service.
+
+ @htmlonly
+ <span style="font-weight: bold">History</span>
+ @endhtmlonly
+
+ when | who | what, where, why
+ -------- | --- | ----------------------------------------------------------
+ 2021-11-03 | dameng.lin | Created .
+
+ Copyright (c) 2019 Quectel Wireless Solution, Co., Ltd. All Rights Reserved.
+ Quectel Wireless Solution Proprietary and Confidential.
+-------------------------------------------------------------------------------------------------*/
+#ifndef __QL_AUDIO_CFG_H__
+#define __QL_AUDIO_CFG_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+
+#define QL_AUDIO_STATE_0 0
+#define QL_AUDIO_STATE_1 1
+
+
+/**
+ @brief The audio service error callback function
+ @param error error code.See ql_type.h for details.
+*/
+typedef void (*ql_audio_service_error_cb_f)(int error);
+
+extern ql_audio_service_error_cb_f audio_error_callback;
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function initializes an audio service.
+
+ @retval QL_ERR_OK Successful execution
+ @retval QL_ERR_SERVICE_NOT_READY Audio service not ready. Try again later.
+ @retval Others Failed execution.See ql_type.h for error codes
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_audio_init(void);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function deinitializes audio services.
+
+ @retval QL_ERR_OK Successful
+ @retval QL_ERR_SERVICE_NOT_READY Service is not ready, need to retry
+ @retval Others Failed execution.See ql_type.h for error codes.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_audio_deinit(void);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function sets the value of a mixer.
+
+ @param[in] control the name of the mixer
+ @param[in] val_list the value of the mixer to be set. String type value.Multiple values are separated by spaces.
+
+ @retval QL_ERR_OK Successful execution
+ @retval QL_ERR_INVALID_ARG Failed execution.Invalid arguments
+ @retval Others Failed execution.See ql_type.h for error codes.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_audio_set_mixer_control(const char *control, const char *val_list);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function gets the value of the mixer.
+
+ @param[in] control the name of the mixer
+ @param[out] val_list_buf buffer for storing mixer values
+ @param[in] buf_size the buffer size. Unit:Byte
+
+ @retval QL_ERR_OK Successful execution.
+ @retval QL_ERR_INVALID_ARG Failed execution.Invalid arguments
+ @retval Others Failed execution.See ql_type.h for error codes.
+
+ @note Generally, 64 bytes is enough
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_audio_get_mixer_control(const char *control, char *val_list_buf, uint32_t buf_size);
+
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function sets the microphone gain for voice call uplink.
+
+ @param[in] mic_gain the microphone gain to be set. range:0-65535
+
+ @retval QL_ERR_OK Successful execution
+ @retval QL_ERR_INVALID_ARG Failed execution.Invalid arguments
+ @retval Others errorcode defined by ql_type.h.
+
+ @note The API should be called before a voice call
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_audio_set_tx_voice_mic_gain(int32_t mic_gain);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function gets the microphone gain for voice call uplink.
+
+ @param[out] p_mic_gain the current microphone gain for voice call uplink.
+
+ @retval QL_ERR_OK Successful execution
+ @retval QL_ERR_INVALID_ARG Failed execution.Invalid arguments
+ @retval Others errorcode defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_audio_get_tx_voice_mic_gain(int32_t *p_mic_gain);
+
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function sets the speaker gain for voice call downlink.
+
+ @param[in] spkr_gain the speaker gain to be set. range:0-65535
+
+ @retval QL_ERR_OK Successful execution
+ @retval QL_ERR_INVALID_ARG Failed execution.Invalid arguments
+ @retval Others errorcode defined by ql_type.h.
+
+ @note The API should be called before a voice call
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_audio_set_rx_voice_spkr_gain(int32_t spkr_gain);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function gets the speaker gain for voice call downlink.
+
+ @param[out] p_spkr_gain the current speaker gain for voice call downlink.
+
+ @retval QL_ERR_OK Successful execution
+ @retval QL_ERR_INVALID_ARG Failed execution.Invalid arguments
+ @retval Others errorcode defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_audio_get_rx_voice_spkr_gain(int32_t *p_spkr_gain);
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function sets the mute state of voice call uplink.
+
+ @param[in] mute_state the mute state to be set.
+ QL_AUDIO_STATE_0: unmute, QL_AUDIO_STATE_1: mute
+
+ @retval QL_ERR_OK Successful execution
+ @retval QL_ERR_INVALID_ARG Failed execution.Invalid arguments
+ @retval Others errorcode defined by ql_type.h.
+
+ @note The API should be called during the call
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_audio_set_tx_voice_mute_state(int32_t mute_state);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function gets the mute state of voice call uplink.
+
+ @param[out] p_mute_state the current mute state of voice call uplink. QL_AUDIO_STATE_0 or QL_AUDIO_STATE_1
+
+ @retval QL_ERR_OK Successful execution
+ @retval QL_ERR_INVALID_ARG Failed execution.Invalid arguments
+ @retval Others errorcode defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_audio_get_tx_voice_mute_state(int32_t *p_mute_state);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function sets the mute state of voice call downlink.
+
+ @param[in] mute_state the mute state to be set.
+ QL_AUDIO_STATE_0: unmute, QL_AUDIO_STATE_1: mute
+
+ @retval QL_ERR_OK Successful execution
+ @retval QL_ERR_INVALID_ARG Failed execution.Invalid arguments
+ @retval Others errorcode defined by ql_type.h.
+
+ @note The API should be called during the call
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_audio_set_rx_voice_mute_state(int32_t mute_state);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function gets the mute state of voice call downlink.
+
+ @param[out] p_mute_state the current mute state of voice call downlink. QL_AUDIO_STATE_0 or QL_AUDIO_STATE_1
+
+ @retval QL_ERR_OK Successful execution
+ @retval QL_ERR_INVALID_ARG Failed execution.Invalid arguments
+ @retval Others errorcode defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_audio_get_rx_voice_mute_state(int32_t *p_mute_state);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function sets the uplink volume of a codec.
+
+ @param[in] up_volume the uplink volume to be set. range:0-100
+
+ @retval QL_ERR_OK Successful execution
+ @retval QL_ERR_INVALID_ARG Failed execution.Invalid arguments
+ @retval Others errorcode defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_audio_set_codec_up_vol(int32_t up_volume);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function gets the uplink volume of a codec.
+
+ @param[out] p_up_volume the current uplink volume of codec. range:0-100
+
+ @retval QL_ERR_OK Successful execution
+ @retval QL_ERR_INVALID_ARG Failed execution.Invalid arguments
+ @retval Others errorcode defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_audio_get_codec_up_vol(int32_t *p_up_volume);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function sets the downlink volume of a codec.
+
+ @param[in] down_volume the volume to be set. range:0-100
+
+ @retval QL_ERR_OK Successful execution
+ @retval QL_ERR_INVALID_ARG Failed execution.Invalid arguments
+ @retval Others errorcode defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_audio_set_codec_down_vol(int32_t down_volume);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function gets the downlink volume of a codec.
+
+ @param[out] p_down_volume the current downlink volume of codec. range:0-100
+
+ @retval QL_ERR_OK Successful execution
+ @retval QL_ERR_INVALID_ARG Failed execution.Invalid arguments
+ @retval Others errorcode defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_audio_get_codec_down_vol(int32_t *p_down_volume);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function sets the microphone mute state of a codec.
+
+ @param[in] mute_state the muute state to be set.
+ QL_AUDIO_STATE_0: unmute, QL_AUDIO_STATE_1: mute
+
+ @retval QL_ERR_OK Successful execution
+ @retval QL_ERR_INVALID_ARG Failed execution.Invalid arguments
+ @retval Others errorcode defined by ql_type.h.
+
+ @note The API should be called during the call or audio playback
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_audio_set_codec_mic_mute_state(int32_t mute_state);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function gets the microphone mute state of a codec.
+
+ @param[out] p_mute_state the current microphone mute state of codec. QL_AUDIO_STATE_0 or QL_AUDIO_STATE_1
+
+ @retval QL_ERR_OK Successful execution
+ @retval QL_ERR_INVALID_ARG Failed execution.Invalid arguments
+ @retval Others errorcode defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_audio_get_codec_mic_mute_state(int32_t *p_mute_state);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function sets the speaker mute state of a codec.
+
+ @param[in] mute_state the mute state to be set.
+ QL_AUDIO_STATE_0: unmute, QL_AUDIO_STATE_1: mute
+
+ @retval QL_ERR_OK Successful execution
+ @retval QL_ERR_INVALID_ARG Failed execution.Invalid arguments
+ @retval Others errorcode defined by ql_type.h.
+
+ @note The API should be called during the call or audio playback
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_audio_set_codec_spk_mute_state(int32_t mute_state);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function gets the speaker mute state of a codec.
+
+ @param[out] p_mute_state the current speaker mute state of codec. QL_AUDIO_STATE_0 or QL_AUDIO_STATE_1
+
+ @retval QL_ERR_OK Successful execution
+ @retval QL_ERR_INVALID_ARG Failed execution.Invalid arguments
+ @retval Others errorcode defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_audio_get_codec_spk_mute_state(int32_t *p_mute_state);
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function enables/disables loopback.
+
+ @param[in] enable_state enable/disable the loopback to be set.
+ QL_AUDIO_STATE_0: disable, QL_AUDIO_STATE_1: enable
+
+ @retval QL_ERR_OK Successful execution
+ @retval QL_ERR_INVALID_ARG Failed execution.Invalid arguments
+ @retval Others errorcode defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_audio_set_loopback_enable_state(int32_t enable_state);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief The function gets the loopback state.
+
+ @param[out] p_enable_state the current loopback state. QL_AUDIO_STATE_0 or QL_AUDIO_STATE_1
+
+ @retval QL_ERR_OK Successful execution
+ @retval QL_ERR_INVALID_ARG Failed execution.Invalid arguments
+ @retval Others errorcode defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_audio_get_loopback_enable_state(int32_t *p_enable_state);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function sets the sidetone gain.
+
+ @param[in] sidetone_gain sidetone gain to be set. range: 0-65535
+
+ @retval QL_ERR_OK Successful execution
+ @retval QL_ERR_INVALID_ARG Failed execution.Invalid arguments
+ @retval Others errorcode defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_audio_set_sidetone_gain(int32_t sidetone_gain);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function gets the sidetone gain.
+
+ @param[out] p_sidetone_gain the current sidetone gain. range: 0-65535, default value: 1298
+
+ @retval QL_ERR_OK Successful execution
+ @retval QL_ERR_INVALID_ARG Failed execution.Invalid arguments
+ @retval Others errorcode defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_audio_get_sidetone_gain(int32_t *p_sidetone_gain);
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function sets the voice call manager state. By default, voice call services such as ringtones, ringback
+tones, third-party ringtones and voice stream status control are all implemented by ql_audiod program
+automatically.
+
+ @param[in] manager_state The manager state to be set. Voice call services include ringtones, ringback tones, the third-party
+ringtones and voice stream status control. range: QL_AUDIO_STATE_0 and QL_AUDIO_STATE_1
+
+ @retval QL_ERR_OK Successful execution
+ @retval QL_ERR_INVALID_ARG Failed execution.Invalid arguments
+ @retval Others errorcode defined by ql_type.h.
+
+ @note The voice service, such as call ring, beep tone, will not work during a voice call
+ If the manager_state is set to QL_AUDIO_STATE_1
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_audio_set_voice_call_manager_state(int32_t manager_state);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function gets the voice call manager state.
+
+ @param[out] p_manager_state the current voice call manager state.
+ QL_AUDIO_STATE_0: close, QL_AUDIO_STATE_1:open
+
+ @retval QL_ERR_OK Successful execution
+ @retval QL_ERR_INVALID_ARG Failed execution.Invalid arguments
+ @retval Others errorcode defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_audio_get_voice_call_manager_state(int32_t *p_manager_state);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function sets the voice stream state.
+
+ @param[in] stream_state voice stream state to be set.
+ QL_AUDIO_STATE_0: close, QL_AUDIO_STATE_1:open
+
+ @retval QL_ERR_OK Successful execution
+ @retval QL_ERR_INVALID_ARG Failed execution.Invalid arguments
+ @retval Others errorcode defined by ql_type.h.
+
+ @note After the voice call manager state is set to QL_AUDIO_STATE_1 by calling
+ql_audio_set_voice_call_manager_state(), the service program ql_audiod will not enable voice stream
+while establishing a voice call. In such a case, call ql_audio_set_voice_stream_state() to enable voice
+stream state by setting stream_state to QL_AUDIO_STATE_1, and then the voice stream can be disabled
+by setting stream_state to QL_AUDIO_STATE_0.*/
+/*-----------------------------------------------------------------------------------------------*/
+//int ql_audio_set_voice_stream_state(int32_t stream_state);
+int ql_audio_set_voice_stream_state(int32_t stream_state);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief The function gets the voice stream state.
+
+ @param[out] p_stream_state the current voice stream state. QL_AUDIO_STATE_0 or QL_AUDIO_STATE_1
+
+ @retval QL_ERR_OK Successful execution
+ @retval QL_ERR_INVALID_ARG Failed execution.Invalid arguments
+ @retval Others errorcode defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+//int ql_audio_get_voice_stream_state(int32_t *p_stream_state);
+int ql_audio_get_voice_stream_state(int32_t *p_stream_state);
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function sets the callback function for audio service errors.
+ @param[in] cb The callback function for audio service errors.Only when the audioservice exit abnormally,the callback function is executed.
+ @retval QL_ERR_OK Successful execution
+ @retval QL_ERR_INVALID_ARG Failed execution.Invalid arguments
+ @retval Others errorcode defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_audio_set_service_error_cb(ql_audio_service_error_cb_f cb);
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function switch codec.
+
+ @param[in] codec_switch the which codec to be switch.
+ 0:GSSP 1:internal codec
+
+ @retval QL_ERR_OK Successful execution
+ @retval QL_ERR_INVALID_ARG Failed execution.Invalid arguments
+ @retval Others errorcode defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_audio_set_codec_switch(int32_t codec_switch);
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function gets the tone state.
+
+ @param[out] p_codec_switch which codec has switch.
+
+ @retval QL_ERR_OK Successful execution
+ @retval QL_ERR_INVALID_ARG Failed execution.Invalid arguments
+ @retval Others errorcode defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_audio_get_codec_switch(int32_t *p_codec_switch);
+
+
+typedef struct ql_audio_tone_config_struct
+{
+ int32_t low_fre;
+ int32_t high_fre;
+ int32_t on_duration;
+ int32_t off_duration;
+ int32_t volume;
+ int32_t count;
+}ql_audio_tone_config_t;
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Set tone enable state
+
+ @param[in] low_fre low frequency, range: 100~4000
+ @param[in] high_fre high frequency, range: 100~4000
+ @param[in] on_duration tone play time, unit is millisecond
+ @param[in] off_duration tone pause time, unit is millisecond
+ @param[in] volume tone play volume, range: 0~5000
+ @param[in] count tone play count
+
+ @return QL_ERR_OK - Successful
+ QL_ERR_INVALID_ARG - Invalid arguments
+ Other errorcode defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_audio_set_tone_enable_state(int32_t enable_state,ql_audio_tone_config_t *p_tone_config);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Get tone enable state
+
+ @param[out] p_enable_state tone enable state,
+ QL_AUDIO_STATE_0: close, QL_AUDIO_STATE_1:open
+
+ @return QL_ERR_OK - Successful
+ QL_ERR_INVALID_ARG - Invalid arguments
+ Other errorcode defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_audio_get_tone_enable_state(int32_t *p_enable_state);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
diff --git a/mbtk/include/ql_v2/ql_audio_pcm.h b/mbtk/include/ql_v2/ql_audio_pcm.h
new file mode 100755
index 0000000..0ee2941
--- /dev/null
+++ b/mbtk/include/ql_v2/ql_audio_pcm.h
@@ -0,0 +1,525 @@
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @file ql_audio_pcm.h
+ @brief playback or capture API
+*/
+/*-----------------------------------------------------------------------------------------------*/
+
+/*-------------------------------------------------------------------------------------------------
+ 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
+ -------- --- ----------------------------------------------------------
+ 2021-11-03 dameng.lin Created .
+-------------------------------------------------------------------------------------------------*/
+
+#ifndef __QL_AUDIO_PCM_H
+#define __QL_AUDIO_PCM_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+
+
+typedef int ql_audio_handle_t;
+
+
+typedef enum QL_AUDIO_STREAM_FORMAT_ENUM
+{
+ QL_AUDIO_STREAM_FORMAT_PCM = 1, /**< PCM*/
+ QL_AUDIO_STREAM_FORMAT_MP3, /**< MP3*/
+ QL_AUDIO_STREAM_FORMAT_AMR, /**< AMR*/
+ QL_AUDIO_STREAM_FORMAT_AMRNB, /**< AMR-NB*/
+ QL_AUDIO_STREAM_FORMAT_AMRWB, /**< AMR-WB*/
+}QL_AUDIO_STREAM_FORMAT_E;
+
+
+/**The structure of PCM configuration parameters*/
+typedef struct ql_audio_pcm_config_struct
+{
+ /** Each sound card maintains a hardware buffer to store audio data. The hardware
+ * buffer is divided into several periods. The sound card uses period as a unit to transmit data,
+ * and one period stores some data frames.period_size sets the size of periods in hardware buffer.
+ * When period_size is set to 0,it means that the period size is calculated by the bottom layer to
+ * obtain a default value. If period_size is not 0, the recommended value is 128–960. The larger the
+ * perod_size is, the larger the kernel overhead is
+ */
+ uint32_t period_size;
+ /** period_count indicates the count of period that the data occupies, when the application reads data
+ * from or writes data to the hardware buffer.The size of the data that the application reads from or
+ * writes to the hardware buffer every time equals period_count multiplied by period_size. The hardware
+ * buffer has a maximum of 8 periods by default. The recommended value of period_count is 1–3.
+ */
+ uint32_t period_count;
+ uint32_t num_channels; /**< Number of channels. 1 Mono 2 Stereo*/
+ uint32_t sample_rate; /**< Sampling rate. A PCM interface supports 8000 and 16000,and an I2s interface supports 48000.Unit:Hz*/
+ uint32_t pcm_format; /**< PCM data format.Presently supports 2 only,which means 16-bit little endian format*/
+} ql_audio_pcm_config_t;
+
+#define QL_AUDIO_INVALID_HANDLE ((ql_audio_handle_t)(void *)NULL)
+
+typedef enum
+{
+ QL_AUDIO_STREAM_DIRECTION_PLAYBACK = 0,
+ QL_AUDIO_STREAM_DIRECTION_CAPTURE,
+ QL_AUDIO_STREAM_DIRECTION_MAX
+}QL_AUDIO_STREAM_DIRECTION_E;
+
+
+/**The enumeration of the front end PCM device types*/
+typedef enum QL_AUDIO_FE_PCM_DEV_ENUM
+{
+ QL_AUDIO_FE_PCM_DEV_MIN = -1,
+ QL_AUDIO_FE_PCM_DEV_MULTIMEDIA1 = 0, /**< The first PCM device available for general-purpose audio playback and capturing.*/
+ QL_AUDIO_FE_PCM_DEV_MULTIMEDIA2 = 1, /**< The sencond PCM device available for general-purpose audio playback and capturing.*/
+ QL_AUDIO_FE_PCM_DEV_MULTIMEDIA3 = 2, /**< The third PCM device available for general-purpose audio playback and capturing.*/
+ QL_AUDIO_FE_PCM_DEV_MAX
+} QL_AUDIO_FE_PCM_DEV_E;
+
+
+
+typedef enum QL_AUDIO_BE_DAI_ENUM
+{
+ QL_AUDIO_BE_DAI_MIN = -1,
+ QL_AUDIO_BE_DAI_PLAYBACK_PRI_PCM = 0, /**< Play back audio to the first PCM interface.*/
+ QL_AUDIO_BE_DAI_PLAYBACK_VOICE_TX, /**< play back audio to the voice call uplink*/
+ QL_AUDIO_BE_DAI_CAPTURE_PRI_PCM, /**< Capture audio from the first PCM interface*/
+ QL_AUDIO_BE_DAI_CAPTURE_VOICE_UL, /**< Capture voice stream from voice call uplink*/
+ QL_AUDIO_BE_DAI_CAPTURE_VOICE_DL, /**< Capture voice stream from voice call downlink*/
+ QL_AUDIO_BE_DAI_MAX
+}QL_AUDIO_BE_DAI_E;
+
+#define QL_AUDIO_BE_DAI_MASK_PLAYBACK_PRI_PCM (1 << QL_AUDIO_BE_DAI_PLAYBACK_PRI_PCM)
+#define QL_AUDIO_BE_DAI_MASK_PLAYBACK_VOICE_TX (1 << QL_AUDIO_BE_DAI_PLAYBACK_VOICE_TX)
+#define QL_AUDIO_BE_DAI_MASK_CAPTURE_PRI_PCM (1 << QL_AUDIO_BE_DAI_CAPTURE_PRI_PCM)
+#define QL_AUDIO_BE_DAI_MASK_CAPTURE_VOICE_UL (1 << QL_AUDIO_BE_DAI_CAPTURE_VOICE_UL)
+#define QL_AUDIO_BE_DAI_MASK_CAPTURE_VOICE_DL (1 << QL_AUDIO_BE_DAI_CAPTURE_VOICE_DL)
+
+/**The enumeration of audio playback state*/
+typedef enum QL_AUDIO_PLAYBACK_STATE_ENUM
+{
+ QL_AUDIO_PLAYBACK_STATE_CLOSE = 0, /**< Close*/
+ QL_AUDIO_PLAYBACK_STATE_OPEN, /**< Open*/
+ QL_AUDIO_PLAYBACK_STATE_PREPARE, /**< Ready*/
+ QL_AUDIO_PLAYBACK_STATE_PLAYING, /**< Playing*/
+ QL_AUDIO_PLAYBACK_STATE_FINISHED, /**< Finished*/
+ QL_AUDIO_PLAYBACK_STATE_PAUSE, /**< Pause*/
+ QL_AUDIO_PLAYBACK_STATE_ERROR, /**< Error*/
+} QL_AUDIO_PLAYBACK_STATE_E;
+
+/**The enumeration of audio capture state*/
+typedef enum QL_AUDIO_CAPTURE_STATE_ENUM
+{
+ QL_AUDIO_CAPTURE_STATE_CLOSE = 0, /**< Close*/
+ QL_AUDIO_CAPTURE_STATE_OPEN, /**< Open*/
+ QL_AUDIO_CAPTURE_STATE_PREPARE, /**< Prepare*/
+ QL_AUDIO_CAPTURE_STATE_CAPTURING, /**< Capturing*/
+ QL_AUDIO_CAPTURE_STATE_FINISHED, /**< Finished*/
+ QL_AUDIO_CAPTURE_STATE_PAUSE, /**< Pause*/
+ QL_AUDIO_CAPTURE_STATE_ERROR, /**< Error*/
+} QL_AUDIO_CAPTURE_STATE_E;
+
+
+#define QL_AUDIO_PLAYBACK_NONBLOCK 0
+#define QL_AUDIO_PLAYBACK_BLOCK 1
+
+
+/**
+ @brief The audio capturing state callback function
+ @param handle Recording handle,which is the return value of ql_audio_capture_open().
+ @param params Parameters carried by the callback function
+ @param state The current audio capturing state.
+*/
+typedef int (*ql_audio_capture_state_cb_f)(ql_audio_handle_t handle, void *params, QL_AUDIO_CAPTURE_STATE_E state);
+
+/**
+ @brief The playback state callback function
+ @param handle Playback handle, which is the return value of ql_audio_playback_open().
+ @param params Parameters carried by the callback function.
+ @param state The current playback state.
+*/
+typedef int (*ql_audio_playback_state_cb_f)(ql_audio_handle_t handle, void *params, QL_AUDIO_PLAYBACK_STATE_E state);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function opens the audio context for playback.
+
+ @param[in] fe_pcm_dev Front end PCM device type. defined by QL_AUDIO_FE_PCM_DEV_E
+ @param[in] be_dai_mask Backend digit audio interface mask, support follow:
+ QL_AUDIO_BE_DAI_MASK_PLAYBACK_PRI_PCM Play back audio to the 1 st PCM interface
+ QL_AUDIO_BE_DAI_MASK_PLAYBACK_SEC_PCM Play back audio to the 2 nd PCM interface
+ QL_AUDIO_BE_DAI_MASK_PLAYBACK_PRI_I2S Play back audio to the 1 st I2S interface
+ QL_AUDIO_BE_DAI_MASK_PLAYBACK_SEC_I2S Play back audio to the 2 nd I2S interface
+ QL_AUDIO_BE_DAI_MASK_PLAYBACK_VOICE_TX Play back audio to the voice call uplink
+
+ @retval A_valid_handle Successful execution.
+ @retval QL_AUDIO_INVALID_HANDLE Failed execution.Invalid handle
+ */
+/*-----------------------------------------------------------------------------------------------*/
+ql_audio_handle_t ql_audio_playback_open(QL_AUDIO_FE_PCM_DEV_E fe_pcm_dev, uint32_t be_dai_mask);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function prepares for audio file playback.
+
+ @param[in] handle The handle returned by ql_audio_playback_open().
+ @param[in] file_name The name of the file to be played back.
+ @param[in] pcm_config Pcm config, including sample rate, channel nums,
+ defined by ql_audio_pcm_config_t. Generally, it is NULL.
+ @param[in] playback_state_cb Callback function to report the current playback state
+ The states defined by QL_AUDIO_PLAYBACK_STATE_E
+ @param[in] params Parameters carried by the callback function.
+
+ @retval QL_ERR_OK Successful execution.
+ @retval QL_ERR_INVALID_HANDLE Failed execution. Invalid handle.
+ @retval QL_ERR_INVALID_STATE Failed execution. Invalid state.
+ @retval Others Failed execution. See ql_type.h for error codes.
+
+ @note Before calling this function, call ql_audio_playback_open() first to obtain a handle.
+ If an audio file is expected to be played back, call this function first to prepare for
+ the playback and then ql_audio_playback_play() to start playback.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_audio_playback_file_prepare(ql_audio_handle_t handle,
+ const char *file_name,
+ ql_audio_pcm_config_t *pcm_config,
+ ql_audio_playback_state_cb_f playback_state_cb,
+ void *params);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function prepares for audio stream playback.
+
+ @param[in] handle The API ql_audio_playback_open return results
+ @param[in] pcm_config Pcm config, including sample rate, channel nums,
+ defined by ql_audio_pcm_config_t. If it is NULL, the API use defaule value.
+ @param[in] playback_state_cb Callback function to report the current playback state.
+ @param[in] params Parameters carried by the callback function.
+
+ @retval QL_ERR_OK Successful execution.
+ @retval QL_ERR_INVALID_HANDLE Failed execution. Invalid handle.
+ @retval QL_ERR_INVALID_STATE Failed execution. Invalid state.
+ @retval Others Failed execution. See ql_type.h for error codes.
+
+ @note Before calling this function, call ql_audio_playback_open() first to obtain a handle.
+ If an audio stream is expected to be played back, call this function first to prepare
+ for the audio stream playback and then ql_audio_playback_push_stream() to start playback.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_audio_playback_stream_prepare(ql_audio_handle_t handle,
+ ql_audio_pcm_config_t *pcm_config,
+ ql_audio_playback_state_cb_f playback_state_cb,
+ void *params);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function starts playback of the audio data.
+
+ @param[in] handle The handle returned by ql_audio_playback_open().
+
+ @retval QL_ERR_OK Successful execution.
+ @retval QL_ERR_INVALID_HANDLE Failed execution. Invalid handle.
+ @retval QL_ERR_INVALID_STATE Failed execution. Invalid state.
+ @retval Others Failed execution. See ql_type.h for error codes.
+
+ @note Before calling this function, call ql_audio_playback_file_prepare() first to prepare the audio file
+ to be played back, otherwise the audio data cannot be played back successfully.This function also supports
+ playback of audio stream data. In this case, call ql_audio_playback_stream_prepare() first to prepare
+ the audio stream to be played back, then this function to start playback, and finally
+ ql_audio_playback_push_stream() to play back the audio stream in buffer.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_audio_playback_play(ql_audio_handle_t handle);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function plays back the audio stream in buffer.
+
+ @param[in] handle The handle returned by ql_audio_playback_open().
+ @param[in] stream_buf The buffer that stores the audio stream to be played back.
+ @param[in] buf_size The size of the audio stream to be played back. Unit: Byte.
+
+ @retval QL_ERR_OK Successful execution.
+ @retval QL_ERR_INVALID_HANDLE Failed execution. Invalid handle.
+ @retval QL_ERR_INVALID_STATE Failed execution. Invalid state.
+ @retval Others Failed execution. See ql_type.h for error codes.
+
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_audio_playback_push_stream(ql_audio_handle_t handle, void *stream_buf, uint32_t buf_size);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function pauses the audio playback.
+
+ @param[in] handle The handle returned by ql_audio_playback_open().
+
+ @retval QL_ERR_OK Successful execution.
+ @retval QL_ERR_INVALID_HANDLE Failed execution. Invalid handle.
+ @retval Others Failed execution. See ql_type.h for error codes.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_audio_playback_pause(ql_audio_handle_t handle);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function resumes the audio playback.
+
+ @param[in] handle The handle returned by ql_audio_playback_open().
+
+ @retval QL_ERR_OK Successful execution.
+ @retval QL_ERR_INVALID_HANDLE Failed execution. Invalid handle.
+ @retval Others Failed execution. See ql_type.h for error codes.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_audio_playback_resume(ql_audio_handle_t handle);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function stops the audio playback.
+
+ @param[in] handle The handle returned by ql_audio_playback_open().
+
+ @retval QL_ERR_OK Successful execution.
+ @retval QL_ERR_INVALID_HANDLE Failed execution. Invalid handle.
+ @retval Others Failed execution. See ql_type.h for error codes.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_audio_playback_stop(ql_audio_handle_t handle);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function closes the audio context for playback.
+
+ @param[in] handle The handle returned by ql_audio_playback_open().
+
+ @retval QL_ERR_OK Successful execution.
+ @retval QL_ERR_INVALID_HANDLE Failed execution. Invalid handle.
+ @retval Others Failed execution. See ql_type.h for error codes.
+
+ @Note After an audio playback ends, you must call this function to close the audio context,
+ otherwise subsequent call of ql_audio_playback_open() will fail.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_audio_playback_close(ql_audio_handle_t handle);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function gets the audio playback state.
+
+ @param[in] handle The handle returned by ql_audio_playback_open().
+ @param[out] playback_state the current audio playback state, defined by QL_AUDIO_PLAYBACK_STATE_E
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_audio_playback_get_state(ql_audio_handle_t handle, QL_AUDIO_PLAYBACK_STATE_E *playback_state);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function sets the block flag for audio playback.
+
+ @param[in] handle The handle returned by ql_audio_playback_open().
+ @param[in] flags block flag, including QL_AUDIO_PLAYBACK_NONBLOCK and QL_AUDIO_PLAYBACK_BLOCK
+
+ @retval QL_ERR_OK Successful execution.
+ @retval QL_ERR_INVALID_HANDLE Failed execution. Invalid handle.
+ @retval QL_ERR_INVALID_ARG Illegal argument.
+ @retval QL_ERR_INVALID_STATE Failed execution. Invalid state.
+ @retval Others Failed execution. See ql_type.h for error codes.
+
+ @note Call this function as per the function call sequence below, to make sure the audio playback can be blocked successfully.
+ 1) ql_audio_playback_open()
+ 2) ql_audio_playback_set_block_flag()
+ 3) ql_audio_playback_file_prepare()
+ 4) ql_audio_playback_play()
+ If the audio playback is blocked successfully by calling ql_audio_playback_set_block_flag(), then
+ 1) If you dial a call or there is an incoming call during the audio playback, the playback will pause;
+ after the call is hung up, the playback resumes automatically.
+ 2) During a voice call, no function can be used to realize audio playback. In this case,
+ the call of ql_auido_palyback_file_prepare() will fail, which means audio files cannot be played back.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_audio_playback_set_block_flag(ql_audio_handle_t handle, uint8_t flags);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function opens the audio context for capturing.
+
+ @param[in] fe_pcm_dev Front end PCM device type.
+ @param[in] be_dai_mask Back end DAI mask,support follow:
+ QL_AUDIO_BE_DAI_MASK_CAPTURE_PRI_PCM
+ QL_AUDIO_BE_DAI_MASK_CAPTURE_VOICE_UL
+ QL_AUDIO_BE_DAI_MASK_CAPTURE_VOICE_DL
+
+@retval A_valid_handle Successful execution
+@retval QL_AUDIO_INVALID_HANDLE Failed execution.Invalid handle
+ */
+/*-----------------------------------------------------------------------------------------------*/
+ql_audio_handle_t ql_audio_capture_open(QL_AUDIO_FE_PCM_DEV_E fe_pcm_dev, uint32_t be_dai_mask);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function prepares for audio file capturing.
+
+ @param[in] handle The handle returned by ql_audio_capture_open().
+ @param[in] file_name The name of the audio file to be captured.
+ @param[in] type The format of the audio data in the audio file.
+ @param[in] pcm_config Pcm config, including sample rate, channel nums,
+ defined by ql_audio_pcm_config_t, If it is NULL, the API use defaule value
+ @param[in] capture_state_cb Callback function to report the current audio capturing state.
+ @param[in] params Parameters carried by the callback function.
+
+ @retval QL_ERR_OK Successful execution.
+ @retval QL_ERR_INVALID_HANDLE Failed execution. Invalid handle.
+ @retval QL_ERR_INVALID_STATE Failed execution. Invalid state.
+ @retval Others Failed execution. See ql_type.h for error codes.
+
+ @note Before calling this function, call ql_audio_capture_open() first to obtain a handle.
+ If an audio file is expected to be captured, call this function first to prepare for the audio file
+ capturing and then ql_audio_capture_record() to start capturing.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_audio_capture_file_prepare(ql_audio_handle_t handle,
+ const char *file_name,
+ QL_AUDIO_STREAM_FORMAT_E type,
+ ql_audio_pcm_config_t *pcm_config,
+ ql_audio_capture_state_cb_f capture_state_cb,
+ void *params);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function prepares for audio stream capturing.
+
+ @param[in] handle This function prepares for audio stream capturing.
+ @param[in] pcm_config PCM configuration parameters.
+ @param[in] capture_state_cb Callback function to report the current audio capturing state.
+ @param[in] params Parameters carried by the callback function.
+
+ @retval QL_ERR_OK Successful execution.
+ @retval QL_ERR_INVALID_HANDLE Failed execution. Invalid handle.
+ @retval QL_ERR_INVALID_STATE Failed execution. Invalid state.
+ @retval Others Failed execution. See ql_type.h for error codes.
+
+ @note Before calling this function, call ql_audio_capture_open() first to obtain a handle.
+ If an audio stream is expected to be captured, call this function first to prepare for
+ the audio stream capturing and then ql_audio_capture_push_stream() to start capturing.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_audio_capture_stream_prepare(ql_audio_handle_t handle,
+ ql_audio_pcm_config_t *pcm_config,
+ ql_audio_capture_state_cb_f capture_state_cb,
+ void *params);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function starts to capture the audio data.
+
+ @param[in] handle The handle returned by ql_audio_capture_open().
+
+ @retval QL_ERR_OK Successful execution.
+ @retval QL_ERR_INVALID_HANDLE Failed execution. Invalid handle.
+ @retval QL_ERR_INVALID_STATE Failed execution. Invalid state.
+ @retval Others Failed execution. See ql_type.h for error codes.
+
+ @note Before calling this function, call ql_audio_capture_file_prepare() first to prepare the audio
+ file to be captured, otherwise the audio data cannot be captured successfully.This function also
+ supports capturing of audio stream data. In this case, call ql_audio_capture_stream_prepare()
+ first to prepare the audio stream to be captured, then this function to start capturing,
+ and finally ql_audio_capture_pull_stream() to capture the audio stream in buffer.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_audio_capture_record(ql_audio_handle_t handle);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function captures the audio stream data to the buffer.
+
+ @param[in] handle The handle returned by ql_audio_capture_open().
+ @param[out] stream_buf The buffer that stores the audio stream data to be captured.
+ @param[in] buf_size Buffer size. Unit: Byte.
+
+ @retval QL_ERR_OK Successful execution.
+ @retval QL_ERR_INVALID_HANDLE Failed execution. Invalid handle.
+ @retval Others Failed execution. See ql_type.h for error codes.
+
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_audio_capture_pull_stream(ql_audio_handle_t handle, void *stream_buf, uint32_t buf_size);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function pauses the audio capturing.
+
+ @param[in] handle The handle returned by ql_audio_capture_open().
+
+ @retval QL_ERR_OK Successful execution.
+ @retval QL_ERR_INVALID_HANDLE Failed execution. Invalid handle.
+ @retval Others Failed execution. See ql_type.h for error codes.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_audio_capture_pause(ql_audio_handle_t handle);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function resumes the audio capturing.
+
+ @param[in] handle The handle returned by ql_audio_capture_open().
+
+ @retval QL_ERR_OK Successful execution.
+ @retval QL_ERR_INVALID_HANDLE Failed execution. Invalid handle.
+ @retval Others Failed execution. See ql_type.h for error codes.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_audio_capture_resume(ql_audio_handle_t handle);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function stops the audio capturing.
+
+ @param[in] handle The handle returned by ql_audio_capture_open().
+
+ @retval QL_ERR_OK Successful execution.
+ @retval QL_ERR_INVALID_HANDLE Failed execution. Invalid handle.
+ @retval Others Failed execution. See ql_type.h for error codes.
+
+ @note Calling this function will stop audio capturing regardless of whether the capturing is in
+ progress or paused,and the capturing cannot be resumed after it is stopped.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_audio_capture_stop(ql_audio_handle_t handle);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function closes the audio context for capturing.
+
+ @param[in] handle The handle returned by ql_audio_capture_open().
+
+ @retval QL_ERR_OK Successful execution.
+ @retval QL_ERR_INVALID_HANDLE Failed execution. Invalid handle.
+ @retval Others Failed execution. See ql_type.h for error codes.
+ @note After audio capturing ends, you must call this function to close the audio context,
+ otherwise subsequent call of ql_audio_capture_open() will fail.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_audio_capture_close(ql_audio_handle_t handle);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function gets the current audio capturing state.
+
+ @param[in] handle The handle returned by ql_audio_capture_open().
+ @param[out] capture_state The current audio capturing state.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+void ql_audio_capture_get_state(ql_audio_handle_t handle, QL_AUDIO_CAPTURE_STATE_E *capture_state);
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif
+
diff --git a/mbtk/include/ql_v2/ql_cell_locator.h b/mbtk/include/ql_v2/ql_cell_locator.h
new file mode 100755
index 0000000..af5102a
--- /dev/null
+++ b/mbtk/include/ql_v2/ql_cell_locator.h
@@ -0,0 +1,188 @@
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @file ql_cell_locator.h
+ @brief cell_locator service 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
+ -------- --- ----------------------------------------------------------
+ 20220810 sunshine Created .
+-------------------------------------------------------------------------------------------------*/
+
+#ifndef __QL_CELL_LOCATOR_H__
+#define __QL_CELL_LOCATOR_H__
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+
+
+typedef struct
+{
+ char *ptr;
+ size_t len;
+} curl_rsp_msg_t;
+
+
+
+typedef struct
+{
+ double latitude;
+ double longitude;
+ double altitude;
+} ql_inject_location_t;
+
+typedef struct
+{
+ /*longtitude*/
+ double lon;
+ /*latitude*/
+ double lat;
+ /*accuracy*/
+ unsigned short accuracy;
+
+ char err_msg[256];
+} ql_perform_rsp;
+
+typedef void (*ql_cell_locator_ind_cb_f)(void *msg);
+
+typedef void (*ql_cell_locator_error_cb_f)(int error);
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Initialize the cell_locator client
+ @return
+ QL_ERR_OK - successful
+ QL_ERR_INVALID_ARG - as defined
+ QL_ERR_SERVICE_NOT_READY - service is not ready, need to retry
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_cell_locator_init(void);
+
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief set locator query server and port, server length must be less than 255 bytes.
+ @return
+ QL_ERR_OK - successful
+ QL_ERR_INVALID_ARG - as defined
+ QL_ERR_SERVICE_NOT_READY - service is not ready, need to retry
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_cell_locator_set_server(char *server, uint16_t port);
+
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief set locator query timeout, the value must between 1-300 [seconds]
+ @return
+ QL_ERR_OK - successful
+ QL_ERR_INVALID_ARG - as defined
+ QL_ERR_SERVICE_NOT_READY - service is not ready, need to retry
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_cell_locator_set_timeout(uint16_t 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.
+ @return
+ QL_ERR_OK - successful
+ QL_ERR_INVALID_ARG - as defined
+ QL_ERR_SERVICE_NOT_READY - service is not ready, need to retry
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_cell_locator_set_token(char *token);
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Register cell_locator callback
+ @param[in] cb
+ @return
+ QL_ERR_OK - successful
+ QL_ERR_NOT_INIT - uninitialized
+ QL_ERR_SERVICE_NOT_READY - service is not ready
+ QL_ERR_INVALID_ARG - Invalid arguments
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_cell_locator_set_ind_cb(ql_cell_locator_ind_cb_f cb);
+
+
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Registration server error callback. Currently, only if the server exits abnormally,
+ the callback function will be executed, and the error code is QL_ERR_ABORTED;
+ @param[in] cb Callback function
+ @return
+ QL_ERR_OK - successful
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_cell_locator_set_service_error_cb(ql_cell_locator_error_cb_f cb);
+
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Deinitialize the cell_locator client
+ @return
+ QL_ERR_OK - successful
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_cell_locator_deinit(void);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief cell_locator start
+ @return
+ QL_ERR_OK - successful
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_cell_locator_start(void);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief cell_locator stop
+ @return
+ QL_ERR_OK - successful
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_cell_locator_stop(void);
+
+int ql_cell_locator_perform(ql_perform_rsp *rsp_ptr);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/mbtk/include/ql_v2/ql_data_call.h b/mbtk/include/ql_v2/ql_data_call.h
new file mode 100755
index 0000000..978516b
--- /dev/null
+++ b/mbtk/include/ql_v2/ql_data_call.h
@@ -0,0 +1,528 @@
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @file ql_data_call.h
+ @brief Data service 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
+ -------- --- ----------------------------------------------------------
+ 20181024 tyler.kuang Created .
+-------------------------------------------------------------------------------------------------*/
+
+#ifndef __QL_DATA_CALL_H__
+#define __QL_DATA_CALL_H__
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include "ql_net_common.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef void ql_data_call_param_t;
+
+typedef struct
+{
+ int call_id;
+ char call_name[QL_NET_MAX_NAME_LEN + 1];
+ QL_NET_IP_VER_E ip_ver;
+ QL_NET_DATA_CALL_STATUS_E call_status;
+ char device[QL_NET_MAX_NAME_LEN + 1];
+ uint8_t has_addr; /**< Valid when data call state is connected*/
+ ql_net_addr_t addr;
+ uint8_t has_addr6; /**< Valid when data call state is connected*/
+ ql_net_addr6_t addr6;
+ int call_end_reason_type; /**< Last data call disconnect reason type */
+ int call_end_reason_code; /**< Last data call disconnect reason code */
+} ql_data_call_status_t;
+
+typedef struct
+{
+ int call_id;
+ char call_name[QL_NET_MAX_NAME_LEN + 1];
+} ql_data_call_item_t;
+
+typedef struct
+{
+ QL_NET_IP_VER_E ip_ver;
+ QL_NET_AUTH_PREF_E auth_pref;
+ char apn_name[QL_NET_MAX_APN_NAME_LEN + 1];
+ char username[QL_NET_MAX_APN_USERNAME_LEN + 1];
+ char password[QL_NET_MAX_APN_PASSWORD_LEN + 1];
+} ql_data_call_apn_config_t;
+
+typedef struct
+{
+ uint64_t tx_pkts;
+ uint64_t tx_bytes;
+ uint64_t tx_dropped_pkts;
+ uint64_t rx_pkts;
+ uint64_t rx_bytes;
+ uint64_t rx_dropped_pkts;
+}ql_data_call_pkt_stats_t;
+
+typedef void (*ql_data_call_status_ind_cb_f)(int call_id,
+ QL_NET_DATA_CALL_STATUS_E pre_call_status,
+ ql_data_call_status_t *p_msg);
+
+typedef void (*ql_data_call_service_error_cb_f)(int error);
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Initialize the data call service
+ @return
+ QL_ERR_OK - successful
+ QL_ERR_INVALID_ARG - as defined
+ QL_ERR_UNKNOWN - unknown error, failed to connect to service
+ QL_ERR_SERVICE_NOT_READY - service is not ready, need to retry
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_data_call_init(void);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Create a data call instance
+ @param[in] call_id The unique identifier of the data call instance, specified by the user
+ @param[in] call_name Friendly data call name, specified by the user
+ @param[in] is_background Whether the data call status is maintained by the data call service daemon.
+ If it is 0, the data call instance will be deleted after the data call process exits.
+ @return
+ QL_ERR_OK - successful
+ QL_ERR_INVALID_ARG - as defined
+ QL_ERR_UNKNOWN - unknown error, failed to connect to service
+ QL_ERR_SERVICE_NOT_READY - service is not ready, need to retry
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_data_call_create(int call_id, const char *call_name, int is_background);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Alloc for a data call configuration instance
+ @return
+ NULL - Not enough memory
+ Other - successful
+ */
+/*-----------------------------------------------------------------------------------------------*/
+ql_data_call_param_t *ql_data_call_param_alloc(void);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Initialize the data call configuration instance
+ @param[in] param Point to the data call configuration instance
+ @return
+ QL_ERR_OK - Successful
+ QL_ERR_INVALID_ARG - Invalid arguments
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_data_call_param_init(ql_data_call_param_t *param);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Release the data call configuration instance
+ @param[in] param Point to the data call configuration instance
+ @return
+ QL_ERR_OK - Successful
+ QL_ERR_INVALID_ARG - Invalid arguments
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_data_call_param_free(ql_data_call_param_t *param);
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Bind APN ID, range:1-16
+ @param[in] param Point to the data call configuration instance
+ @param[in] apn_id APN ID, range:1-16
+ @return
+ QL_ERR_OK - Successful
+ QL_ERR_INVALID_ARG - Invalid arguments
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_data_call_param_set_apn_id(ql_data_call_param_t *param, int apn_id);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Get APN name from configuration instance
+ @param[in] param Point to the data call configuration instance
+ @param[out] buf APN ID
+ @return
+ QL_ERR_OK - Successful
+ QL_ERR_INVALID_ARG - Invalid arguments
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_data_call_param_get_apn_id(ql_data_call_param_t *param, int *apn_id);
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Configure APN name
+ @param[in] param Point to the data call configuration instance
+ @param[in] apn_name APN name
+ @return
+ QL_ERR_OK - Successful
+ QL_ERR_INVALID_ARG - Invalid arguments
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_data_call_param_set_apn_name(ql_data_call_param_t *param, const char *apn_name);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Get APN name from configuration instance
+ @param[in] param Point to the data call configuration instance
+ @param[out] buf APN name buffer
+ @param[in] buf_len APN name buffer size
+ @return
+ QL_ERR_OK - Successful
+ QL_ERR_INVALID_ARG - Invalid arguments
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_data_call_param_get_apn_name(ql_data_call_param_t *param, char *buf, int buf_len);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Configure APN user name
+ @param[in] param Point to the data call configuration instance
+ @param[in] user_name APN user name
+ @return
+ QL_ERR_OK - Successful
+ QL_ERR_INVALID_ARG - Invalid arguments
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_data_call_param_set_user_name(ql_data_call_param_t *param, const char *user_name);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Get APN user name from configuration instance
+ @param[in] param Point to the data call configuration instance
+ @param[out] buf APN user name buffer
+ @param[in] buf_len APN user name buffer size
+ @return
+ QL_ERR_OK - Successful
+ QL_ERR_INVALID_ARG - Invalid arguments
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_data_call_param_get_user_name(ql_data_call_param_t *param, char *buf, int buf_len);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Configure APN user password
+ @param[in] param Point to the data call configuration instance
+ @param[in] user_password APN user password
+ @return
+ QL_ERR_OK - Not enough memory
+ QL_ERR_INVALID_ARG - Invalid arguments
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_data_call_param_set_user_password(ql_data_call_param_t *param, const char *user_password);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Get APN user password from configuration instance
+ @param[in] param Point to the data call configuration instance
+ @param[out] buf APN user password buffer
+ @param[in] buf_len APN user password buffer size
+ @return
+ QL_ERR_OK - Not enough memory
+ QL_ERR_INVALID_ARG - Invalid arguments
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_data_call_param_get_user_password(ql_data_call_param_t *param, char *buf, int buf_len);
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Configure the data call authentication method
+ @param[in] param Point to the data call configuration instance
+ @param[in] auth_pref Defined by QL_DATA_CALL_AUTH_PREF_E
+ @return
+ QL_ERR_OK - Successful
+ QL_ERR_INVALID_ARG - Invalid arguments
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_data_call_param_set_auth_pref(ql_data_call_param_t *param, int auth_pref);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Configure the data call authentication method
+ @param[in] param Point to the data call configuration instance
+ @param[out] p_data Store return value
+ @return
+ QL_ERR_OK - Successful
+ QL_ERR_INVALID_ARG - Invalid arguments
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_data_call_param_get_auth_pref(ql_data_call_param_t *param, int *p_data);
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Configure the data call IP version
+ @param[in] param Point to the data call configuration instance
+ @param[in] ip_ver Defined by QL_NET_IP_VER_E
+ @return
+ QL_ERR_OK - Successful
+ QL_ERR_INVALID_ARG - Invalid arguments
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_data_call_param_set_ip_version(ql_data_call_param_t *param, int ip_ver);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Get IP version from configuration instance
+ @param[in] param Point to the data call configuration instance
+ @param[out] p_ver Store return value
+ @return
+ QL_ERR_OK - Successful
+ QL_ERR_INVALID_ARG - Invalid arguments
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_data_call_param_get_ip_version(ql_data_call_param_t *param, int *p_ver);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Configure the data call auto reconnection mode
+ @param[in] param Point to the data call configuration instance
+ @param[in] mode Defined by QL_NET_DATA_CALL_RECONNECT_MODE_E
+ @return
+ QL_ERR_OK - Successful
+ QL_ERR_INVALID_ARG - Invalid arguments
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_data_call_param_set_reconnect_mode(ql_data_call_param_t *param, int reconnect_mode);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Get auto reconnection mode from configuration instance
+ @param[in] param Point to the data call configuration instance
+ @param[out] p_mode Store return value
+ @return
+ QL_ERR_OK - Successful
+ QL_ERR_INVALID_ARG - Invalid arguments
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_data_call_param_get_reconnect_mode(ql_data_call_param_t *param, int *p_mode);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Configure the data call auto reconnection interval
+ @param[in] param Point to the data call configuration instance
+ @param[in] time_list Interval time list in ms
+ @param[in] num Number of time list
+ @return
+ QL_ERR_OK - Successful
+ QL_ERR_INVALID_ARG - Invalid arguments
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_data_call_param_set_reconnect_interval(ql_data_call_param_t *param, int *time_list, int num);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Get auto reconnection interval from configuration instance
+ @param[in] param Point to the data call configuration instance
+ @param[out] time_list Store return value
+ @param[in,out] p_num
+ @return
+ QL_ERR_OK - Successful
+ QL_ERR_INVALID_ARG - Invalid arguments
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_data_call_param_get_reconnect_interval(ql_data_call_param_t *param, int *time_list, int *p_num);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Configure the specified data call instance
+ @param[in] call_id Specify a data call instance
+ @param[in] param Point to the data call configuration instance
+ @return
+ QL_ERR_OK - Successful
+ QL_ERR_INVALID_ARG - Invalid arguments
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_data_call_config(int call_id, ql_data_call_param_t *param);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Get the specified data call configuration instance
+ @param[in] call_id Specify a data call instance
+ @param[in] param Point to the data call configuration instance
+ @return
+ QL_ERR_OK - Successful
+ QL_ERR_INVALID_ARG - Invalid arguments
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_data_call_get_config(int call_id, ql_data_call_param_t *param);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Start data call
+ @param[in] call_id Specify a data call instance
+ @return
+ QL_ERR_OK - successful
+ QL_ERR_NOT_INIT - uninitialized
+ QL_ERR_SERVICE_NOT_READY - service is not ready
+ QL_ERR_INVALID_ARG - Invalid arguments
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_data_call_start(int call_id);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Stop data call
+ @param[in] call_id Specify a data call instance
+ @return
+ QL_ERR_OK - successful
+ QL_ERR_NOT_INIT - uninitialized
+ QL_ERR_SERVICE_NOT_READY - service is not ready
+ QL_ERR_INVALID_ARG - Invalid arguments
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_data_call_stop(int call_id);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Delete a data call instance
+ @param[in] call_id Specify a data call instance
+ @return
+ QL_ERR_OK - successful
+ QL_ERR_NOT_INIT - uninitialized
+ QL_ERR_SERVICE_NOT_READY - service is not ready
+ QL_ERR_INVALID_ARG - Invalid arguments
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_data_call_delete(int call_id);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Get the current data call instance list
+ @param[out] list Data call instance array
+ @param[in,out] list_len, in-> Data call instance array size, out->current data call instance number
+ @return
+ QL_ERR_OK - successful
+ QL_ERR_NOT_INIT - uninitialized
+ QL_ERR_SERVICE_NOT_READY - service is not ready
+ QL_ERR_INVALID_ARG - Invalid arguments
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_data_call_get_list(ql_data_call_item_t *list, int *list_len);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Get the data call status
+ @param[in] call_id Specify a data call instance
+ @param[out] p_sta Point to status instance
+ @return
+ QL_ERR_OK - successful
+ QL_ERR_NOT_INIT - uninitialized
+ QL_ERR_SERVICE_NOT_READY - service is not ready
+ QL_ERR_INVALID_ARG - Invalid arguments
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_data_call_get_status(int call_id, ql_data_call_status_t *p_sta);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Register data call status change event
+ @param[in] cb
+ @return
+ QL_ERR_OK - successful
+ QL_ERR_NOT_INIT - uninitialized
+ QL_ERR_SERVICE_NOT_READY - service is not ready
+ QL_ERR_INVALID_ARG - Invalid arguments
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_data_call_set_status_ind_cb(ql_data_call_status_ind_cb_f cb);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Set APN related configuration.If the apn does not exist, it is automatically created.
+ @param[in] apn_id APN ID, range:1-16
+ @param[in] p_info APN configuration
+ @return
+ QL_ERR_OK - successful
+ QL_ERR_NOT_INIT - uninitialized
+ QL_ERR_SERVICE_NOT_READY - service is not ready
+ QL_ERR_INVALID_ARG - Invalid arguments
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_data_call_set_apn_config(int apn_id, ql_data_call_apn_config_t *p_info);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Set APN related configuration. If the apn does not exist, it is automatically created and
+ the default parameters are set.
+ @param[in] apn_id APN ID, range:1-16
+ @param[out] p_info APN configuration
+ @return
+ QL_ERR_OK - successful
+ QL_ERR_NOT_INIT - uninitialized
+ QL_ERR_SERVICE_NOT_READY - service is not ready
+ QL_ERR_INVALID_ARG - Invalid arguments
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_data_call_get_apn_config(int apn_id, ql_data_call_apn_config_t *p_info);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Set APN related configuration,APN ID:1
+ @param[in] p_info APN configuration
+ @return
+ QL_ERR_OK - successful
+ QL_ERR_NOT_INIT - uninitialized
+ QL_ERR_SERVICE_NOT_READY - service is not ready
+ QL_ERR_INVALID_ARG - Invalid arguments
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_data_call_set_attach_apn_config(ql_data_call_apn_config_t *p_info);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Registration server error callback. Currently, only if the server exits abnormally,
+ the callback function will be executed, and the error code is QL_ERR_ABORTED;
+ @param[in] cb Callback function
+ @return
+ QL_ERR_OK - successful
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_data_call_set_service_error_cb(ql_data_call_service_error_cb_f cb);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Deinitialize the data call service
+ @return
+ QL_ERR_OK - successful
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_data_call_deinit(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/mbtk/include/ql_v2/ql_dm.h b/mbtk/include/ql_v2/ql_dm.h
new file mode 100755
index 0000000..e45910b
--- /dev/null
+++ b/mbtk/include/ql_v2/ql_dm.h
@@ -0,0 +1,622 @@
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @file ql_dm.h
+ @brief device management API
+*/
+/*-----------------------------------------------------------------------------------------------*/
+
+/*-------------------------------------------------------------------------------------------------
+ Copyright (c) 2019 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
+ -------- --- ----------------------------------------------------------
+ 20200316 stan.li Optimize the ql_dm_get_modem_state interface
+ 20191224 stan.li Add radio on/off API
+ 20190625 stan.li Created .
+-------------------------------------------------------------------------------------------------*/
+
+#ifndef __QL_DM_H__
+#define __QL_DM_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define QL_DM_IMEI_MAX_LEN 32
+#define QL_DM_MEID_MAX_LEN 32
+#define QL_DM_FIRMWARE_REV_MAX_LEN 256
+#define QL_DM_NV_ITEM_NAME_MAX_LEN 127
+#define QL_DM_NV_ITEM_VALUE_MAX_LEN 2048
+
+//enable
+#define QL_DM_QOOS_ENABLE_MAX 2
+#define QL_DM_QOOS_ENABLE_MIN 0
+
+//pre_time
+#define QL_DM_QOOS_PRE_TIME_MAX 600
+#define QL_DM_QOOS_PRE_TIME_MIN 1
+
+//sleep_time
+#define QL_DM_QOOS_SLEEP_TIME_MAX (60*60*12)
+#define QL_DM_QOOS_SLEEP_TIME_MIN 1
+
+//acq_time
+#define QL_DM_QOOS_ACQ_TIME_MAX 600
+#define QL_DM_QOOS_ACQ_TIME_MIN 1
+
+//cir_cnt
+#define QL_DM_QOOS_CIR_CNT_MAX 255
+#define QL_DM_QOOS_CIR_CNT_MIN 1
+
+//sleep_step
+#define QL_DM_QOOS_SLEEP_STEP_MAX 60
+#define QL_DM_QOOS_SLEEP_STEP_MIN 0
+
+//acq_step
+#define QL_DM_QOOS_ACQ_STEP_MAX 60
+#define QL_DM_QOOS_ACQ_STEP_MIN 0
+
+//adj_cnt
+#define QL_DM_QOOS_ADJ_CNT_MAX 5
+#define QL_DM_QOOS_ADJ_CNT_MIN 0
+
+//idle_interval
+#define QL_DM_QOOS_IDLE_INTERVAL_MAX 60
+#define QL_DM_QOOS_IDLE_INTERVAL_MIN 1
+
+typedef enum QL_DW_AIR_PLANE_MODE_TYPE_ENUM
+{
+ QL_DM_AIR_PLANE_MODE_UNKNOWN = 0, /**< Radio online. */
+ QL_DM_AIR_PLANE_MODE_ON = 1, /**< Radio power off or unknown. Airplane ON. */
+ QL_DM_AIR_PLANE_MODE_OFF = 2, /**< Radio online. Airplane OFF. */
+ QL_DM_AIR_PLANE_MODE_NA = 3 /**< Radio Unvailable. */
+}QL_DM_AIR_PLANE_MODE_TYPE_E;
+
+/** modified by kin.tan@20210125 start: matching modem state sent by service **/
+typedef enum QL_DM_MODEM_STATE_TYPE_ENUM
+{
+ QL_DM_MODEM_STATE_OFFLINE = 0,
+ QL_DM_MODEM_STATE_ONLINE = 1,
+ QL_DM_MODEM_STATE_UNKNOWN = 2
+}QL_DM_MODEM_STATE_TYPE_E;
+/** modified by kin.tan@20210125 end: matching modem state sent by service **/
+
+typedef enum QL_DM_QOOS_ENABLE_TYPE_ENUM
+{
+ QL_DM_QOOS_ENABLE_STATE_OFF = 0, /**< close QOOS function. */
+ QL_DM_QOOS_ENABLE_STATE_ON_NO_SERVICE = 1, /**< open QOOS function */
+}QL_DM_QOOS_ENABLE_TYPE_E;
+
+/** bind subscription */
+typedef enum QL_DM_BIND_SUB_TYPE_ENUM
+{
+ QL_DM_BIND_SUB_PRIMARY = 0,
+ QL_DM_BIND_SUB_SECONDARY = 1,
+}QL_DM_BIND_SUB_TYPE_E;
+
+/** boot up reason */
+typedef enum QL_DM_BOOT_UP_REASON_ENUM
+{
+ QL_DM_BOOT_UP_INVALID = -1,
+ QL_DM_BOOT_UP_HARD_RESET = 0,
+ QL_DM_BOOT_UP_SMPL = 1,
+ QL_DM_BOOT_UP_RTC = 2,
+ QL_DM_BOOT_UP_DC_CHG = 3,
+ QL_DM_BOOT_UP_USB_CHG = 4,
+ QL_DM_BOOT_UP_PON1 = 5,
+ QL_DM_BOOT_UP_CBLPWR_N = 6,
+ QL_DM_BOOT_UP_KPDPWR_N = 7,
+}QL_DM_BOOT_UP_REASON_E;
+
+/** shutdown reason */
+typedef enum QL_DM_SHUTDOWN_REASON_ENUM
+{
+ QL_DM_SHUTDOWN_INVALID = -1,
+ QL_DM_SHUTDOWN_SOFT = 0,
+ QL_DM_SHUTDOWN_PS_HOLD = 1,
+ QL_DM_SHUTDOWN_PMIC_WD = 2,
+ QL_DM_SHUTDOWN_GP1 = 3,
+ QL_DM_SHUTDOWN_GP2 = 4,
+ QL_DM_SHUTDOWN_KPDPWR_AND_RESIN = 5,
+ QL_DM_SHUTDOWN_RESIN_N = 6,
+ QL_DM_SHUTDOWN_KPDPWR_N = 7,
+}QL_DM_SHUTDOWN_REASON_E;
+
+
+// typedef struct {
+// uint16_t pre_time; /**< the upper limit of the first search time, range is 1 to 600, default value is 180, in seconds. */
+// uint16_t sleep_time; /**< the first sleep time, range is 1 to 43200, default value is 30, in seconds. */
+// uint16_t acq_time; /**< the first search time, range is 1 to 600, default value is 20, in seconds. */
+// uint8_t cir_cnt; /**< the number of sleep->search cycle, range is 5 to 255, default value is 10, in seconds. */
+// uint8_t sleep_step; /**< the sleep time increment, range is 0 to 60, default vaue is 15, in seconds. */
+// uint8_t acq_step; /**< the acq time increment, range is 0 to 60, default value is 0, in seconds. */
+// uint8_t adj_cnt; /**< the adjustment times for sleep-search cylce, range is 0 to 5, default value is 2, in seconds. */
+// uint8_t idle_interval; /**< when the module is registered, check whether the module if offline, range is 1 to 60,default value is 1, in seconds. */
+// }ql_dm_qoos_config_t;
+
+
+typedef struct {
+ char enable;
+ int phase[3];
+}ql_dm_qoos_config_t;
+
+typedef struct
+{
+ uint8_t imei_valid;
+ char imei[QL_DM_IMEI_MAX_LEN + 1]; /**< imei.*/
+ uint8_t imei2_valid;
+ char imei2[QL_DM_IMEI_MAX_LEN + 1]; /**< imei2.*/
+ uint8_t meid_valid;
+ char meid[QL_DM_MEID_MAX_LEN + 1]; /**< meid.*/
+}ql_dm_device_serial_numbers_info_t;
+
+
+typedef void (*ql_dm_air_plane_mode_ind_cb)(QL_DM_AIR_PLANE_MODE_TYPE_E air_plane_mode);
+
+typedef void (*ql_dm_modem_state_ind_cb)(int modem_state);
+
+typedef void (*ql_dm_service_error_cb_f)(int error);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Initialize DM service.
+ @note You must call this function before other functions can be used in this module.
+ @return Whether the DM service was successfully intialized.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_dm_init(void);
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Denitialize DM service.
+ @return Whether the DM service was successfully deintialized.
+ @retval QL_ERR_OK successful.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_dm_deinit(void);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief get device software version.
+ @param[out] soft_ver Return software version
+ @param[in] soft_ver_len The length of soft_ver
+ @return Whether to successfully get the software version
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_dm_get_software_version(char *soft_ver, int soft_ver_len);
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief get modem state.
+ @details QL_DM_MODEM_STATE_ONLINE,if modem starts normally.
+ @details QL_DM_MODEM_STATE_OFFLINE,in modem starts abnormally.
+ @details QL_DM_MODEM_STATE_UNKNOWN,unknown error.
+ @param[out] modem_state The state of modem
+ @return Whether to successfully get the modem state
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_dm_get_modem_state(QL_DM_MODEM_STATE_TYPE_E *modem_state);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief register modem state event.
+ @param[in] cb_func modem state indication callback function
+ @return Whether the modem state event was successfully registered.
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_dm_set_modem_state_change_ind_cb(ql_dm_modem_state_ind_cb cb_func);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief get module temperature.
+ @param[out] temperature The current temperature
+ @return Whether to successfully get the temperature
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_dm_get_temperature(float *temperature);
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief get device serial numbers.
+ @param[out] p_info Pointer that point to ql_dm_device_serial_numbers_info_t
+ @return Whether to successfully get the serial numbers
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_dm_get_device_serial_numbers(ql_dm_device_serial_numbers_info_t *p_info);
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief get device firmware revision identification.
+ @param[out] firmware_rev_id Return device firmware revision id
+ @param[in] firmware_rev_id_len The length of firmware_rev_id
+ @return Whether to successfully get the firmware revision id
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_dm_get_device_firmware_rev_id(char *firmware_rev_id, int firmware_rev_id_len);
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief get air plane mode.
+ @param[out] p_info Pointer that point to QL_DM_AIR_PLANE_MODE_TYPE_E
+ @return Whether to successfully get the air plane mode
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_dm_get_air_plane_mode(QL_DM_AIR_PLANE_MODE_TYPE_E *p_info);
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief set air plane mode.
+ @param[in] air_plane_mode 1:ON, 2:OFF
+ @return Whether to successfully set the air plane mode
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_dm_set_air_plane_mode(QL_DM_AIR_PLANE_MODE_TYPE_E air_plane_mode);
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief register air plane mode event.
+ @param[in] cb_func Air plane mode indication callback function
+ @return Whether the air plane mode event was successfully registered.
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_dm_set_air_plane_mode_ind_cb(ql_dm_air_plane_mode_ind_cb cb_func);
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief get cpu occupancy.
+ @param[out] cpu_occupancy The percentage of cpu occupancy
+ @return Whether to successfully get the cpu occupancy
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_dm_get_cpu_occupancy(float *cpu_occupancy);
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief get mem usage.
+ @param[out] mem_use The percentage of mem usage
+ @return Whether to successfully get the memory usage
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_dm_get_mem_usage(float *mem_use);
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief get NV item value.
+ @param[in] nv_item_name The NV item name that is either NV item id or NV item path
+ @param[out] nv_item_value The NV value buf of nv_item_name
+ param[in] nv_item_value_len The length of nv_item_value
+ param[out] nv_len The real length of nv_item_name
+ @return Whether to successfully get the NV value
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_dm_get_nv_item_value(char *nv_item_name, unsigned char *nv_item_value, int nv_item_value_len,
+ int *nv_len);
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief set NV item value.
+ @param[in] nv_item_name The NV item name that is either NV item id or NV item path
+ @param[in] nv_item_value The NV value of nv_item_name
+ @param[in] nv_item_value_len The length of nv_item_value
+ param[out] nv_len The real length of nv_item_name
+ @return Whether to successfully set the NV value
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_dm_set_nv_item_value(char *nv_item_name, unsigned char *nv_item_value, int nv_item_value_len,
+ int *nv_len);
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief set radio on, its function is the same as at+cfun=1.
+ @return Whether to successfully set the radio on
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_dm_set_radio_on(void);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief set radio off, its function is the same as at+cfun=0.
+ @return Whether to successfully set the radio off
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_dm_set_radio_off(void);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief get modem mem and CPU utilization.
+ @param[out] mem_use The percentage of modem utilization
+ @return Whether to successfully get the modem utilization
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_dm_get_modem_cpu_occupancy(float *cpu_occupancy);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief get modem mem utilization.
+ @param[out] mem_use The percentage of modem utilization
+ @return Whether to successfully get the modem utilization
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_dm_get_modem_mem_usage(float *mem_use);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief get QOOS enable state
+ @param[out] enable The enable state of QOOS
+ @return Whether to successfully get the QOOS enable state
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_dm_get_qoos_enable(char *enable);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief set QOOS enable state
+ @param[in] enable The enable state of QOOS
+ @return Whether to successfully set the QOOS enable state
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_dm_set_qoos_enable(char enable);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief get QOOS configuration
+ @param[out] config The configuration of QOOS
+ @return Whether to successfully get the QOOS configuration
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+//int ql_dm_get_qoos_config(ql_dm_qoos_config_t *config);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief set QOOS configuration
+ @param[in] config The configuration of QOOS
+ @return Whether to successfully set the QOOS configuration
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+//int ql_dm_set_qoos_config(ql_dm_qoos_config_t config);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief get MSSR(Modem SubSysem Reset) level.
+ @param[out] p_level The MSSR level
+ @return Whether to successfully get the MSSR level
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_dm_get_mssr_level(int *p_level);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief set MSSR(Modem SubSysem Reset) level.
+ @param[in] level The MSSR level
+ @return Whether to successfully set the MSSR level
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_dm_set_mssr_level(int level);
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief bind subscription
+ @param[in] sub_type subscription type
+ @return Whether to successfully bind subscription.
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_dm_bind_subscription(QL_DM_BIND_SUB_TYPE_E sub_type);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Registration server error callback. Currently, only if the server exits abnormally,
+ the callback function will be executed, and the error code is QL_ERR_ABORTED;
+ @param[in] cb Callback function
+ @return
+ QL_ERR_OK - successful
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_dm_set_service_error_cb(ql_dm_service_error_cb_f cb);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Get module the last time shutdown reason
+ @param[out] shutdown_reason the shutdown reason
+ @return
+ QL_ERR_OK - successful
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_dm_get_shutdown_reason(QL_DM_SHUTDOWN_REASON_E *shutdown_reason);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Get module this time bootup reason
+ @param[out] bootup_reason the bootup reason
+ @return
+ QL_ERR_OK - successful
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_dm_get_bootup_reason(QL_DM_BOOT_UP_REASON_E *bootup_reason);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief set oos config
+ @param[out] oos param
+ @return
+ QL_ERR_OK - successful
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_dm_set_qoos_config(int p1, int p2, int p3);
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief get oos config
+ @param[out] oos param
+ @return
+ QL_ERR_OK - successful
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_dm_get_qoos_config(int *p1, int *p2, int *p3);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief set oos enable
+ @param[out] oos param
+ @return
+ QL_ERR_OK - successful
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_dm_set_qoos_enable(char enable);
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif
+
diff --git a/mbtk/include/ql_v2/ql_ecall.h b/mbtk/include/ql_v2/ql_ecall.h
new file mode 100755
index 0000000..04b0951
--- /dev/null
+++ b/mbtk/include/ql_v2/ql_ecall.h
@@ -0,0 +1,561 @@
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @file ql_ecall.c
+ @brief Ecall APIs
+*/
+/*-------------------------------------------------------------------------------------------------
+ Copyright (c) 2019 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
+ -------- --- ----------------------------------------------------------
+ 202306xx Lyndsay.Xie Created .
+-------------------------------------------------------------------------------------------------*/
+#ifndef __ECALL_H__
+#define __ECALL_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <string.h>
+#include <time.h>
+#include "ql_asn1Msd.h"
+#include "ql_ms_voice.h"
+#include "ql_type.h"
+// #include "ql_voice.h"
+
+#define ASSERT(condition) \
+ if (!(condition)) { LOGE("Assert Failed: '%s'", #condition);}
+
+//--------------------------------------------------------------------------------------------------
+/**
+ * Unlimited dial attempts for eCall session (used for PAN-European system)
+ */
+//--------------------------------------------------------------------------------------------------
+#define UNLIMITED_DIAL_ATTEMPTS UINT32_MAX
+#define QL_VOICE_MAX_ECALL_MSD (140)
+
+typedef enum
+{
+ QL_ECALL_TX_MODE_PULL = 0, /**< Pull mode (modem/host waits for MSD request from PSAP to send MSD). */
+ QL_ECALL_TX_MODE_PUSH = 1 /**< Push mode (modem/host sends MSD to PSAP right after eCall is connected). */
+} QL_ECALL_MSD_TX_MODE_E;
+
+typedef enum
+{
+ QL_ECALL_RESET_SESSION_NONE = 0,
+ QL_ECALL_RESET_SESSION_AUTOANSWER= 1, /**< Reset the ecall session to allow automatic answering of calls
+ * It can only be enabled once after calling ql_ecall_init() == OK*/
+ QL_ECALL_RESET_SESSION_MAX = 0xff
+
+} QL_ECALL_RESET_SESSION_MODE_E;
+
+typedef struct
+{
+ uint8_t t5_timeout_ms_valid;
+ uint16_t t5_timeout_ms;
+
+ uint8_t t6_timeout_ms_valid;
+ uint16_t t6_timeout_ms;
+
+ uint8_t t7_timeout_ms_valid;
+ uint16_t t7_timeout_ms;
+
+ uint8_t autoAnswer_timeout_ms_valid; // callback
+ uint32_t autoAnswer_timeout_ms; // default 3600000 ms (1 hour)
+
+ uint8_t dialDurationTimer_timout_ms_valid; // dial
+ uint32_t dialDurationTimer_timout_ms;
+
+ uint8_t maxDialAttempts_valid; // redialcnt
+ uint32_t maxDialAttempts;
+
+ uint8_t intervalBetweenAttempts_valid;
+ uint16_t intervalBetweenAttempts;
+
+ uint8_t resetEcallSessionMode_valid;
+ uint8_t resetEcallSessionMode;
+} ql_ecall_config_t;
+
+typedef void (*ql_ecall_user_ind_f)(int ind, void *userdata);
+
+typedef enum{
+ QL_ECALL_MAKE_ECALL_TYPE_TEST = 0,
+ QL_ECALL_MAKE_ECALL_TYPE_RECONFIG = 1,
+ QL_ECALL_MAKE_ECALL_TYPE_MANUAL = 2,
+ QL_ECALL_MAKE_ECALL_TYPE_AUTOMATIC = 3,
+}QL_ECALL_MAKE_ECALL_TYPE;
+
+/** eCall mode */
+typedef enum {
+ QL_ECALL_MODE_NORMAL = 0, /**< eCall enabled normal mode. */
+ QL_ECALL_MODE_ONLY = 1, /**< eCall-only mode. */
+ QL_ECALL_MODE_DEFAULT = 2,
+} QL_ECALL_MODE_E;
+
+typedef enum
+{
+ QL_ECALL_EVENT_SENDING_START = 1,
+ QL_ECALL_EVENT_SENDING_MSD = 2,
+ QL_ECALL_EVENT_LLACK_RECEIVED = 3,
+ QL_ECALL_EVENT_ALLACK_POSITIVE_RECEIVED = 4,
+ QL_ECALL_EVENT_ALLACK_CLEARDOWN_RECEIVED = 5,
+ QL_ECALL_EVENT_ACTIVE = 11,
+ QL_ECALL_EVENT_DISCONNECTED = 12,
+ QL_ECALL_EVENT_ABNORMAL_HANGUP = 15,
+ // QL_ECALL_EVENT_IMS_MSD_ACK = 0x0014,
+ // QL_ECALL_EVENT_IMS_UPDATE_MSD,
+ QL_ECALL_EVENT_ONLY_DEREGISTRATION = 31,
+ QL_ECALL_EVENT_MAY_DEREGISTRATION = 32,
+ QL_ECALL_EVENT_PSAP_CALLBACK_START = 40,
+
+ QL_ECALL_EVENT_ECALL_STARTED = 260,
+ QL_ECALL_EVENT_INCOMING_CALL = 261,
+ QL_ECALL_EVENT_T2_TIMEOUT = 262,
+ QL_ECALL_EVENT_T5_TIMEOUT = 263,
+ QL_ECALL_EVENT_T6_TIMEOUT = 264,
+ QL_ECALL_EVENT_T7_TIMEOUT = 265,
+ QL_ECALL_EVENT_DIAL_DURATION_TIMEOUT = 266,
+ QL_ECALL_EVENT_INTERVAL_TIMEOUT = 267,
+ QL_ECALL_EVENT_AUTO_ANSWER_TIMEOUT = 268,
+
+ // TO DO - add customer app events
+} QL_ECALL_EVENT_E;
+
+// TODO: Will be used potentially. If not remove it!
+// QL_ERR_MSD_RESULT_E QL_Set_MsdMessageData(msd_Message_t *pMsdMsg);
+// QL_ERR_MSD_RESULT_E QL_Set_EraGlonassData(msd_EraGlonassData_t *pEraGlonassData);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Set the system standard.
+ @param[in] system_std system standard which can be set to PAN-European or ERA-GLONASS.
+ @return Whether the system standard was set successfully.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_INVALID_ARG unsupported value.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ecall_set_system_std(ECALL_SYSTEM_STD_E system_std);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Get the system standard.
+ @param[out] system_std pointer to system standard which can be PAN-European or ERA-GLONASS.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+void ql_ecall_get_system_std(ECALL_SYSTEM_STD_E* system_std);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Set the MSD version.
+ @param[in] msd_version MSD version which can be set to ASN1_ECALL_MSD_VERSION_1 or ASN1_ECALL_MSD_VERSION_2
+ @return Whether the MSD version was set successfully.
+ @retval QL_ERR_MSD_SUCCESS successful.
+ @retval QL_ERR_MSD_VERSION unsupported value.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+QL_ERR_MSD_RESULT_E ql_ecall_set_msd_version(uint8_t msd_version);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Get the MSD version.
+ @param[out] msd_version pointer to MSD version.
+ @return Whether the MSD version was get successfully.
+ @retval QL_ERR_MSD_SUCCESS successful.
+ @retval QL_ERR_MSD_VERSION unsupported value.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+QL_ERR_MSD_RESULT_E ql_ecall_get_msd_version(uint8_t* msdVersionPtr);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Sets MSD's testCall field.
+ @param[in] testCall MSD call type: true = Test call false = Emergency
+ */
+/*-----------------------------------------------------------------------------------------------*/
+void ql_ecall_set_msd_call_type(bool testCall);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Gets MSD's testCall field.
+ @param[out] testCall pointer to MSD call type: true = Test call false = Emergency
+ */
+/*-----------------------------------------------------------------------------------------------*/
+void ql_ecall_get_msd_call_type(bool* testCall);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Sets VehicleType.
+ @param[in] vehicleType vehicle type
+ @return Whether the vehicleType was set successfully.
+ @retval QL_ERR_MSD_SUCCESS successful.
+ @retval QL_ERR_MSD_BADPARM unsupported value.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+QL_ERR_MSD_RESULT_E ql_ecall_set_msd_vehicle_type(uint8_t vehicleType);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Gets VehicleType.
+ @param[out] vehicleType pointer to vehicle type
+ @return Whether the vehicleType was get successfully.
+ @retval QL_ERR_MSD_SUCCESS successful.
+ @retval QL_ERR_MSD_BADPARM unsupported value.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+QL_ERR_MSD_RESULT_E ql_ecall_get_msd_vehicle_type(uint8_t* vehicleType);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Sets Vehicle Identification Number
+ @param[in] vin vehicle identification number
+ @return Whether the vehicle identification number was set successfully.
+ @retval QL_ERR_MSD_SUCCESS successful.
+ @retval QL_ERR_MSD_VEH_IDENTIFI_NUMBER unsupported value.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+QL_ERR_MSD_RESULT_E ql_ecall_set_msd_vin(msd_Vin_t vin);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Gets Vehicle Identification Number
+ @param[out] vin pointer to vehicle identification number
+ @return Whether the vehicle identification number was get successfully.
+ @retval QL_ERR_MSD_SUCCESS successful.
+ @retval QL_ERR_MSD_VEH_IDENTIFI_NUMBER unsupported value.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+QL_ERR_MSD_RESULT_E ql_ecall_get_msd_vin(msd_Vin_t* vin);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Sets Propulsion Type.
+ @param[in] PropulsionType propulsion type.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+void ql_ecall_set_msd_propulsion_type(uint8_t PropulsionType);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Gets Propulsion Type.
+ @param[out] PropulsionType pointer to propulsion type.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+void ql_ecall_get_msd_propulsion_type(uint8_t* PropulsionType);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Sets number of passangers.
+ @param[in] numberOfPassengers number of passangers.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+void ql_ecall_set_msd_passengers_count(uint8_t numberOfPassengers);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Sets vehicle location.
+ @param[in] isTrusted true if the position can be trusted, false otherwise.
+ @param[in] latitude latitude of vehicle's location.
+ @param[in] longitude longitude of vehicle's location.
+ @param[in] direction direction of vehicle's location.
+ @return Whether the vehicle location was set successfully.
+ @retval QL_ERR_MSD_SUCCESS successful.
+ @retval QL_ERR_MSD_LATITUDE latitude unsupported value.
+ @retval QL_ERR_MSD_LONGITUDE longitude unsupported value.
+ @retval QL_ERR_MSD_VEH_DIRECTION direction unsupported value.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+QL_ERR_MSD_RESULT_E ql_ecall_set_msd_position(bool isTrusted, int32_t latitude, int32_t longitude, int32_t direction);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Set the position Delta N-1 from position set in ql_ecall_set_msd_position() transmitted by the MSD.
+ @param[in] latitudeN2 latitude delta from position set in ql_ecall_set_msd_position().
+ @param[in] longitudeN2 longitude delta from position set in ql_ecall_set_msd_position().
+ @return Whether the vehicle location delta was set successfully.
+ @retval QL_ERR_MSD_SUCCESS successful.
+ @retval QL_ERR_MSD_LATITUDE delta latitude unsupported value.
+ @retval QL_ERR_MSD_LONGITUDE delta longitude unsupported value.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+QL_ERR_MSD_RESULT_E ql_ecall_set_msd_position_n1(int32_t latitudeDeltaN1, int32_t longitudeDeltaN1);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Set the position Delta N-2 from position set in ql_ecall_set_msd_position() transmitted by the MSD.
+ @param[in] latitudeN2 latitude delta from position set in ql_ecall_set_msd_position_n1().
+ @param[in] longitudeN2 longitude delta from position set in ql_ecall_set_msd_position_n1().
+ @return Whether the vehicle location delta was set successfully.
+ @retval QL_ERR_MSD_SUCCESS successful.
+ @retval QL_ERR_MSD_LATITUDE delta latitude unsupported value.
+ @retval QL_ERR_MSD_LONGITUDE delta longitude unsupported value.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+QL_ERR_MSD_RESULT_E ql_ecall_set_msd_position_n2(int32_t latitudeDeltaN2, int32_t longitudeDeltaN2);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Set MSD TX Mode.
+ @param[in] tx_mode Transmission MSD mode, 0 - PULL, 1 - PUSH.
+ @return Whether the transmission MSD mode was set successfully.
+ @retval QL_ERR_MSD_SUCCESS successful.
+ @retval QL_ERR_MSD_BADPARM unsupported value.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+QL_ERR_MSD_RESULT_E ql_ecall_set_msd_tx_mode(QL_ECALL_MSD_TX_MODE_E tx_mode);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Get MSD TX Mode.
+ @param[out] tx_mode Pointer to transmission MSD mode, 0 - PULL, 1 - PUSH.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+void ql_ecall_get_msd_tx_mode(QL_ECALL_MSD_TX_MODE_E* tx_mode);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Set the minimum interval value between dial attempts. Available for both manual and test modes.
+ @param[in] pause the minimum interval value in seconds.
+ @retval ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ecall_set_interval_between_dial_attempts(uint16_t pause);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Get the minimum interval value between dial attempts.
+ @param[out] pause pointer to the minimum interval value in seconds.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+void ql_ecall_get_interval_between_dial_attempts(uint16_t* pause);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Initialize MSD to default values.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+void ql_ecall_msd_init(void);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Start a test eCall session.
+ @return Whether the test ecall was started successfully.
+ @retval QL_ERR_MSD_SUCCESS successful.
+ @retval QL_ERR_MSD_BADPARM unsupported value.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_INVALID_ARG invalid argument.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ecall_start_test(int sim_id);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Start a manual eCall session.
+ @return Whether the manually triggered ecall was started successfully.
+ @retval QL_ERR_MSD_SUCCESS successful.
+ @retval QL_ERR_MSD_BADPARM unsupported value.
+ @retval Other MSD error code defined by QL_ERR_MSD_RESULT_E.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_INVALID_ARG invalid argument.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ecall_start_manual(int sim_id);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Start an automatic eCall session.
+ @return Whether the automatically triggered ecall was started successfully.
+ @retval QL_ERR_MSD_SUCCESS successful.
+ @retval QL_ERR_MSD_BADPARM unsupported value.
+ @retval Other MSD error code defined by QL_ERR_MSD_RESULT_E.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_INVALID_ARG invalid argument.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ecall_start_automatic(int sim_id);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Initializes ecall service.
+ @return Whether the ecall service was initialized successfully.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ecall_init(void);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Deinitializes ecall service.
+ @return Whether the ecall service was deinitialized successfully.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ecall_deinit(void);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Sets ecall User indication callback.
+ @param[in] cb call back handler.
+ @param[in] userdata user data.
+ @return void
+ */
+/*-----------------------------------------------------------------------------------------------*/
+void ql_ecall_set_user_ind_cb(ql_ecall_user_ind_f cb, void *userdata);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Dials eCall.
+ @param[in] sim_id sim id.
+ @param[in] p_info eCall info.
+ @param[out] p_id call id.
+ @return Whether a eCall was successfully dialed.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_INVALID_ARG invalid argument.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ecall_dial(int sim_id, const ql_voice_ecall_info_t* const p_info, uint32_t* const p_id);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Hangs up eCall.
+ @return Whether the eCall was successfully hung up.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_INVALID_ARG invalid argument.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ecall_hangup(void);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Updates eCall MSD with raw data.
+ @param[in] msd Minimum Set of Data.
+ @param[in] msd_len Length of Minimum Set of Data.
+ @return Whether the eCall MSD was successfully updated.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_INVALID_ARG invalid argument.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ecall_update_msd_raw(const uint8_t* msd, uint32_t msd_len);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Updates eCall MSD.
+ @return Whether the eCall MSD was successfully updated.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_INVALID_ARG invalid argument.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ecall_update_msd(void);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Pushes eCall MSD.
+ @param[out] state eCall state.
+ @return Whether the eCall MSD was successfully pushed.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_INVALID_ARG invalid argument.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ecall_push_msd(void);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Setting ecall test number. Number will be saved on the modem side.
+ @param[in] number test number
+ @return
+ QL_ERR_OK - successful
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ecall_set_test_number(int sim_id, const char* number);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Setting ecall test number. Number will be saved on the modem side.
+ @param[in] number test number
+ @return
+ QL_ERR_OK - successful
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ecall_reset_test_number(int sim_id, const char* number);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Reset IVS during ecall session and switch to voice.
+ @return
+ QL_ERR_OK - successful
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ecall_reset_ivs(int sim_id);
+
+#if 0
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Starts ecall session.
+ @return
+ QL_ERR_OK - successful
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ecall_make_ecall(int sim_id, QL_ECALL_MAKE_ECALL_TYPE ecall_type);
+#endif
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Deregister from Network.
+ @return Whether a request was executed.
+ @retval QL_ERR_OK successful.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ecall_terminate_nw_registration(void);
+
+void ql_ecall_set_config_info(ql_ecall_config_t ecall_context_info);
+
+void ql_ecall_get_config_info(ql_ecall_config_t* ecall_context_info);
+
+int ql_ecall_set_ecall_only_mode(bool ecall_only_value);
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ECALL_H__ */
diff --git a/mbtk/include/ql_v2/ql_fota.h b/mbtk/include/ql_v2/ql_fota.h
new file mode 100755
index 0000000..b07cbaf
--- /dev/null
+++ b/mbtk/include/ql_v2/ql_fota.h
@@ -0,0 +1,124 @@
+/**
+ @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
+---------- ------------ ----------------------------------------------------
+25/11/2021 jessie.lei create
+=============================================================================*/
+#ifndef __QL_FOTA_H__
+#define __QL_FOTA_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "fota_info.h"
+
+
+/*
+ * callback function define, used to get upgrade state and rate of process
+ */
+typedef int(*ql_fota_cb_f)(int state, int percent);
+
+
+/*******************************************************************************
+* @brief fota initialize
+ @param
+ @return
+ if success return 0, else return -1
+ *******************************************************************************/
+int ql_fota_init(void);
+
+
+/*******************************************************************************
+* @brief fota de-initialize
+ @param
+ @return
+ if success return 0, else return -1
+ *******************************************************************************/
+int ql_fota_deinit(void);
+
+
+/*******************************************************************************
+* @brief set fota callback
+ @param
+ cb: callback function
+ @return
+ if success return 0, else return -1
+ *******************************************************************************/
+int ql_fota_set_cb(ql_fota_cb_f cb);
+
+
+/*******************************************************************************
+* @brief fota initialize
+ @param
+ otasize: The OTA firmware size
+ @return
+ if success return 0, else return -1
+ *******************************************************************************/
+int ql_fota_start(unsigned int otasize);
+
+
+/*******************************************************************************
+* @brief write fota firmware data
+ @param
+ buffer: The buffer
+ size : Data length in buffer
+ @return
+ if success return 0, else return -1
+ *******************************************************************************/
+int ql_fota_write(unsigned char *buffer, unsigned int size);
+
+
+/*******************************************************************************
+* @brief get fota state
+ @param
+ state: fota state, refer to fota_state_t
+ @return
+ if success return 0, else return -1
+ *******************************************************************************/
+int ql_fota_get_state(fota_state_t *state);
+
+
+/*******************************************************************************
+* @brief set fota state
+ @param
+ state: fota state, refer to fota_state_t
+ @return
+ if success return 0, else return -1
+ *******************************************************************************/
+int ql_fota_set_state(fota_state_t state);
+
+
+/*******************************************************************************
+* @brief finish fota process
+ @param
+ @return
+ if success return 0, else return -1
+ *******************************************************************************/
+int ql_fota_done(void);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif //__QL_FOTA_H__
diff --git a/mbtk/include/ql_v2/ql_fota_api.h b/mbtk/include/ql_v2/ql_fota_api.h
new file mode 100755
index 0000000..1db2142
--- /dev/null
+++ b/mbtk/include/ql_v2/ql_fota_api.h
@@ -0,0 +1,91 @@
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @file ql_fwupdate.h
+ @brief
+ This file declare OTA upgrade interface
+*/
+/*-----------------------------------------------------------------------------------------------*/
+
+/*-------------------------------------------------------------------------------------------------
+ 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
+ -------- --- ----------------------------------------------------------
+ 20211125 Jessie.lei Created .
+-------------------------------------------------------------------------------------------------*/
+
+
+#ifndef QL_FOTA_API_H_
+#define QL_FOTA_API_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdbool.h>
+#include <stdint.h>
+#include <errno.h>
+#include "fota_info.h"
+
+typedef enum
+{
+ E_NO_ERROR=0,
+ E_FOTA_INIT_FAILED=1,
+ E_UPDATE_PACKAGE_NOEXIST=2,
+ E_WRITE_SEG_FAILED=3,
+} fota_exit_code_t;
+
+//--------------------------------------------------------------------------------------------------
+/**
+ * upgrade info
+ */
+//--------------------------------------------------------------------------------------------------
+typedef struct
+{
+ unsigned int percentage; ///< the upgrade progress
+ fota_state_t ota_state; ///< the device ota upgrade status
+ fota_exit_code_t exit_code; ///< the fota process
+} update_info_t;
+
+
+//--------------------------------------------------------------------------------------------------
+/**
+ * @brief
+ * This function starts ota upgrade to flash partition.
+ * @Parameter
+ * [IN] package_path, the location of quectel_AB_OTA.img.
+ * @return
+ * - On success 0 indicate the upgrad is succeed
+ * - On failure -1 indicate *package_path is invalid or failed to set fota start state.
+ * Otherwise, it returns a positve number, the exit code of update, one of
+ * the enum fota_exit_code_t.
+ */
+//--------------------------------------------------------------------------------------------------
+int ql_abfota_start_update(const char *package_path);
+
+
+//--------------------------------------------------------------------------------------------------
+/**
+ * @brief
+ * get the upgrade progress
+ * @Parameter
+ * [InOut] upgrade_info, store the fota progress & state info
+ * @return
+ * - On success 0
+ * - On failure -1
+ */
+//--------------------------------------------------------------------------------------------------
+int ql_abfota_get_update_status(update_info_t * update_info);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif //QL_FOTA_API_H_
diff --git a/mbtk/include/ql_v2/ql_fota_common.h b/mbtk/include/ql_v2/ql_fota_common.h
new file mode 100755
index 0000000..1a0cb90
--- /dev/null
+++ b/mbtk/include/ql_v2/ql_fota_common.h
@@ -0,0 +1,48 @@
+
+/**
+ @file
+ ql_fota_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_FOTA_COMMON_H
+#define __QL_FOTA_COMMON_H
+
+#include <stdint.h>
+
+#define QL_OTAD_CLIENT_INIT_CNT_MAX 20
+
+#define QL_OTAD_SEND_MSG_TIMEOUT (3 * 1000)
+
+typedef void (*ql_otad_service_error_cb_f)(int error);
+
+int ql_otad_client_init(void);
+int ql_otad_client_release(void);
+int ql_otad_send_msg_sync(int32_t msg_id,
+ void *p_req_msg_data,
+ uint32_t req_msg_data_len,
+ void *p_resp_msg_data,
+ uint32_t resp_msg_data_len,
+ uint32_t timeout);
+
+#endif /* __QL_FOTA_COMMON_H */
diff --git a/mbtk/include/ql_v2/ql_fota_log.h b/mbtk/include/ql_v2/ql_fota_log.h
new file mode 100755
index 0000000..11a84f2
--- /dev/null
+++ b/mbtk/include/ql_v2/ql_fota_log.h
@@ -0,0 +1,56 @@
+/**
+ @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
+
+#include <ql_sys_log.h>
+
+#define QL_LOG_DEBUG(fmt, ...) do{ \
+ ql_sys_log_print(QL_SYS_LOG_ID_SYSTEM, QL_SYS_LOG_DEBUG, QL_SYS_LOG_TAG, "[%s_%d]:"fmt, __FUNCTION__, __LINE__, ##__VA_ARGS__);\
+}while(0)
+
+#define QL_LOG_INFO(fmt, ...) do{ \
+ ql_sys_log_print(QL_SYS_LOG_ID_SYSTEM, QL_SYS_LOG_INFO, QL_SYS_LOG_TAG, "[%s_%d]:"fmt, __FUNCTION__, __LINE__, ##__VA_ARGS__);\
+}while(0)
+
+#define QL_LOG_WARN(fmt, ...) do{ \
+ ql_sys_log_print(QL_SYS_LOG_ID_SYSTEM, QL_SYS_LOG_WARN, QL_SYS_LOG_TAG, "[%s_%d]:"fmt, __FUNCTION__, __LINE__, ##__VA_ARGS__);\
+}while(0)
+
+#define QL_LOG_ERROR(fmt, ...) do{ \
+ ql_sys_log_print(QL_SYS_LOG_ID_SYSTEM, QL_SYS_LOG_ERROR, QL_SYS_LOG_TAG, "[%s_%d]:"fmt, __FUNCTION__, __LINE__, ##__VA_ARGS__);\
+}while(0)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
\ No newline at end of file
diff --git a/mbtk/include/ql_v2/ql_gnss.h b/mbtk/include/ql_v2/ql_gnss.h
new file mode 100755
index 0000000..ca67bba
--- /dev/null
+++ b/mbtk/include/ql_v2/ql_gnss.h
@@ -0,0 +1,439 @@
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @file ql_gnss.h
+ @brief GNSS service API
+*/
+/*-----------------------------------------------------------------------------------------------*/
+
+/*-------------------------------------------------------------------------------------------------
+ Copyright (c) 2024 mobiletek Wireless Solution, Co., Ltd. All Rights Reserved.
+ mobiletek 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
+ -------- --------- -----------------------------------------------------------------
+ 20241022 yq.wang Created .
+-------------------------------------------------------------------------------------------------*/
+
+
+#ifndef __QL_GNSS_H__
+#define __QL_GNSS_H__
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+typedef enum {
+ /** Cold Start Gnss*/
+ QL_GNSS_COLD_START = 0,
+ /** Warm Start Gnss */
+ QL_GNSS_WARM_START,
+ /** Hot Start Gnss*/
+ QL_GNSS_HOT_START,
+}QL_GNSS_START_MODE_E;
+
+typedef enum
+{
+ /** gnss engine is off */
+ QL_GNSS_ENGINE_STATE_OFF = 0,
+ /** gnss engine is on */
+ QL_GNSS_ENGINE_STATE_ON = 1,
+}QL_GNSS_ENGINE_STATE_E;
+
+typedef enum
+{
+ QL_GNSS_EPH_DATA_GPS = 0x01,
+ QL_GNSS_EPH_DATA_BDS = 0x02,
+ QL_GNSS_EPH_DATA_GLO = 0x04,
+ QL_GNSS_EPH_DATA_GAL = 0x08,
+ QL_GNSS_EPH_DATA_QZSS = 0x10,
+}QL_GNSS_EPH_DATA_E;
+
+typedef enum
+{
+ GPS_ONLY = 0x01,
+ BDS_ONLY = 0x02,
+ GPS_BDS = 0x03,
+ GLONASS_ONLY = 0x04,
+ GPS_GLONASS = 0x05,
+ BDS_GLONASS = 0x06,
+ GPS_BDS_GLONASS = 0x07,
+ GPS_SBAS_QZSS = 0x08, /* GPS+SBAS+QZSS */
+ GPS_BDS_GALILEO_SBAS_QZSS = 0x11, /* GPS+BDS+GAL+SBAS+QZSS */
+ GPS_GLONASS_GALILEO_SBAS_QZSS = 0x101 /* Not currently supported */
+} QL_GNSS_CONSTELLATION_MASK_E;
+
+typedef enum
+{
+ QL_GNSS_NMEA_VERSION_V30, /* NMEA 3.0 */
+ QL_GNSS_NMEA_VERSION_V41 /* NMEA 4.1 */
+}QL_GNSS_NMEA_VERSION_ID_E;
+
+typedef enum
+{
+ QL_GNSS_MSG_MIN = 0, /* GNSS MIN MSG */
+ QL_GNSS_NMEA_MSG, /* GNSS NMEA DATA */
+ QL_GNSS_STATUS_MSG, /* GNSS NMEA DATA */
+ QL_GNSS_MSG_MAX /* GNSS MAX MSG */
+}QL_GNSS_IND_MSG_ID_E;
+
+/**
+ * gnss state definition
+ */
+typedef enum
+{
+ QL_GNSS_STATUS_UNDEFINE = 0u, /* Undefined state */
+ QL_GNSS_STATUS_FOTA_START, /* Fota init state */
+ QL_GNSS_STATUS_FOTA_REQ, /* Fota state req */
+ QL_GNSS_STATUS_FOTA_ING, /* Fota progressing */
+ QL_GNSS_STATUS_FOTA_BOOT, /* Fota bootloader */
+ QL_GNSS_STATUS_FOTA_FIRM, /* Fota firmware */
+ QL_GNSS_STATUS_FOTA_END, /* Fota end */
+ QL_GNSS_STATUS_WORKING, /* GNSS working */
+ QL_GNSS_STATUS_MAX, /* Max state */
+}QL_GNSS_STATUS_E;
+
+
+typedef struct
+{
+ char *ptr;
+ size_t len;
+} curl_rsp_msg_t;
+
+typedef struct
+{
+ uint8_t msg_id;
+ uint32_t time;
+ char nmea_sentence[128];
+} nmea_srv_ind_msg;
+
+typedef struct
+{
+ uint8_t msg_id;
+ QL_GNSS_STATUS_E g_status;
+} gnss_status_ind_msg;
+
+typedef struct
+{
+ double latitude;
+ double longitude;
+ double altitude;
+} ql_inject_location_t;
+
+
+typedef struct
+{
+ uint8_t mask;
+ struct
+ {
+ uint8_t gga_nmea_len; /* GGA */
+ char gga_sent[128];
+ }gga_sentences;
+
+ struct
+ {
+ uint8_t rmc_nmea_len; /* RMC */
+ char rmc_sent[128];
+ }rmc_sentences;
+
+ uint8_t gpgsv_lines;
+ struct
+ {
+ uint8_t nmea_sentences_len; /* GPGSV */
+ char gsv_sent[128];
+ }gpgsv_sentences[4];
+
+ uint8_t bdgsv_lines;
+ struct
+ {
+ uint32_t gsv_lines;
+ uint8_t nmea_sentences_len; /* BD/GBGSV */
+ char gsv_sent[128];
+ }bdgsv_sentences[4];
+
+} nmeasrc_sentences;
+
+typedef void (*ql_gnss_ind_cb_f)(void *msg);
+
+typedef void (*ql_gnss_error_cb_f)(int error);
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Initialize the gnss client
+ @return
+ QL_ERR_OK - successful
+ QL_ERR_INVALID_ARG - as defined
+ QL_ERR_SERVICE_NOT_READY - service is not ready, need to retry
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_gnss_init(void);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Deinitialize the gnss client
+ @return
+ QL_ERR_OK - successful
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_gnss_deinit(void);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Start gnss
+ @return
+ QL_ERR_OK - successful
+ QL_ERR_NOT_INIT - uninitialized
+ QL_ERR_SERVICE_NOT_READY - service is not ready
+ QL_ERR_INVALID_ARG - Invalid arguments
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_gnss_start(void);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Stop gnss
+ @return
+ QL_ERR_OK - successful
+ QL_ERR_NOT_INIT - uninitialized
+ QL_ERR_SERVICE_NOT_READY - service is not ready
+ QL_ERR_INVALID_ARG - Invalid arguments
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_gnss_stop(void);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Set gnss start mode
+ @param[in] mask Gnss start mode
+ @return
+ QL_ERR_OK - successful
+ QL_ERR_NOT_INIT - uninitialized
+ QL_ERR_SERVICE_NOT_READY - service is not ready
+ QL_ERR_INVALID_ARG - Invalid arguments
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_gnss_set_start_mode(QL_GNSS_START_MODE_E mask);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Get gnss nmea
+ @param[in] nmea_str
+ @return
+ QL_ERR_OK - successful
+ QL_ERR_NOT_INIT - uninitialized
+ QL_ERR_SERVICE_NOT_READY - service is not ready
+ QL_ERR_INVALID_ARG - Invalid arguments
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_gnss_qgpsgnmea(nmeasrc_sentences *nmea_str);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Set gnss qgpscfg
+ @param[in] enable
+ @param[in] str
+ @param[in] len
+ @return
+ QL_ERR_OK - successful
+ QL_ERR_NOT_INIT - uninitialized
+ QL_ERR_SERVICE_NOT_READY - service is not ready
+ QL_ERR_INVALID_ARG - Invalid arguments
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_gnss_set_qgpscfg(uint32_t enable, char *str, uint32_t len);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Get engine state
+ @param[out] state on/ff
+ @return
+ QL_ERR_OK - successful
+ QL_ERR_NOT_INIT - uninitialized
+ QL_ERR_SERVICE_NOT_READY - service is not ready
+ QL_ERR_INVALID_ARG - Invalid arguments
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_gnss_get_engine_state(QL_GNSS_ENGINE_STATE_E *state);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Set Constellation .
+ @param[in] mask GPS/GLO/BDS/GAL/QZSS/SBAS
+ @return
+ QL_ERR_OK - successful
+ QL_ERR_NOT_INIT - uninitialized
+ QL_ERR_SERVICE_NOT_READY - service is not ready
+ QL_ERR_INVALID_ARG - Invalid arguments
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_gnss_set_constellation(QL_GNSS_CONSTELLATION_MASK_E mask);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Get Constellation
+ @param[out] mask GPS/GLO/BDS/GAL/QZSS/SBAS
+ @return
+ QL_ERR_OK - successful
+ QL_ERR_NOT_INIT - uninitialized
+ QL_ERR_SERVICE_NOT_READY - service is not ready
+ QL_ERR_INVALID_ARG - Invalid arguments
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_gnss_get_constellation(QL_GNSS_CONSTELLATION_MASK_E *mask);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Set nmea type
+ @param[in] mask type
+ @return
+ QL_ERR_OK - successful
+ QL_ERR_NOT_INIT - uninitialized
+ QL_ERR_SERVICE_NOT_READY - service is not ready
+ QL_ERR_INVALID_ARG - Invalid arguments
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_gnss_set_nmea_type(uint32_t mask);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Get nmea version
+ @param[out] version nmea version
+ @return
+ QL_ERR_OK - successful
+ QL_ERR_NOT_INIT - uninitialized
+ QL_ERR_SERVICE_NOT_READY - service is not ready
+ QL_ERR_INVALID_ARG - Invalid arguments
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_gnss_get_nmea_version(QL_GNSS_NMEA_VERSION_ID_E *version);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Set nmea version
+ @param[in] version nmea version
+ @return
+ QL_ERR_OK - successful
+ QL_ERR_NOT_INIT - uninitialized
+ QL_ERR_SERVICE_NOT_READY - service is not ready
+ QL_ERR_INVALID_ARG - Invalid arguments
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_gnss_set_nmea_version(QL_GNSS_NMEA_VERSION_ID_E version);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Set gnss agnss mode
+ @param[in] mask Gnss agnss mode
+ @return
+ QL_ERR_OK - successful
+ QL_ERR_NOT_INIT - uninitialized
+ QL_ERR_SERVICE_NOT_READY - service is not ready
+ QL_ERR_INVALID_ARG - Invalid arguments
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_gnss_set_agnss_mode(uint32_t mask);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Inject agnss data
+ @param[in] data agnss data
+ @return
+ QL_ERR_OK - successful
+ QL_ERR_NOT_INIT - uninitialized
+ QL_ERR_SERVICE_NOT_READY - service is not ready
+ QL_ERR_INVALID_ARG - Invalid arguments
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_gnss_inject_agnss_data(void);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Inject UTC time to GNSS Engine.
+ @param[in] timestamp ,unit: ms
+ @return Whether to successfully Start Gnss
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_FAILED Start Gnss Failed
+ @retval Other error code defined by ql_gnss.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_gnss_inject_utc_time(uint64_t timestamp);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Set gnss suspend
+ @return
+ QL_ERR_OK - successful
+ QL_ERR_NOT_INIT - uninitialized
+ QL_ERR_SERVICE_NOT_READY - service is not ready
+ QL_ERR_INVALID_ARG - Invalid arguments
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_gnss_suspend(void);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Set gnss resume
+ @return
+ QL_ERR_OK - successful
+ QL_ERR_NOT_INIT - uninitialized
+ QL_ERR_SERVICE_NOT_READY - service is not ready
+ QL_ERR_INVALID_ARG - Invalid arguments
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_gnss_resume(void);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Register gnss callback
+ @param[in] cb
+ @return
+ QL_ERR_OK - successful
+ QL_ERR_NOT_INIT - uninitialized
+ QL_ERR_SERVICE_NOT_READY - service is not ready
+ QL_ERR_INVALID_ARG - Invalid arguments
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_gnss_set_ind_cb(ql_gnss_ind_cb_f cb);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Registration server error callback. Currently, only if the server exits abnormally,
+ the callback function will be executed, and the error code is QL_ERR_ABORTED;
+ @param[in] cb Callback function
+ @return
+ QL_ERR_OK - successful
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_gnss_set_service_error_cb(ql_gnss_error_cb_f cb);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/mbtk/include/ql_v2/ql_gpio.h b/mbtk/include/ql_v2/ql_gpio.h
new file mode 100755
index 0000000..144d363
--- /dev/null
+++ b/mbtk/include/ql_v2/ql_gpio.h
@@ -0,0 +1,445 @@
+/*****************************************************************************
+* 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
+ *----------------------------------------------------------------------------
+ * Larry.Zhang 24/09/2021 Create.
+ ****************************************************************************/
+
+#ifndef __QL_GPIO_H__
+#define __QL_GPIO_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* GPIO MAP */
+typedef enum{
+ PINNAME_BEGIN = -1,
+
+ /* GPIO1 ~ GPIO8 */
+ PINNAME_GPIO_117 = 117, /* GPIO1 */
+ PINNAME_GPIO_118 = 118, /* GPIO2 */
+ PINNAME_GPIO_120 = 120, /* GPIO3 */
+ PINNAME_GPIO_122 = 122, /* GPIO4 */
+ PINNAME_GPIO_38 = 38, /* GPIO5 */
+ PINNAME_GPIO_39 = 39, /* GPIO6 */
+ PINNAME_GPIO_37 = 37, /* GPIO7 */
+ PINNAME_GPIO_40 = 40, /* GPIO8 */
+
+ /* The follow pins are not use as GPIO by defaut, please contract Quectel for support */
+
+ /* WLAN */
+ PINNAME_GPIO_58 = 58, /* SDIO1_CMD */
+ PINNAME_GPIO_59 = 59, /* SDIO1_CLK */
+ PINNAME_GPIO_57 = 57, /* SDIO1_DATA0 */
+ PINNAME_GPIO_56 = 56, /* SDIO1_DATA1 */
+ PINNAME_GPIO_55 = 55, /* SDIO1_DATA2 */
+ PINNAME_GPIO_48 = 48, /* SDIO1_DATA3 */
+ PINNAME_GPIO_19 = 19, /* WLAN_EN */
+ PINNAME_GPIO_43 = 43, /* WLAN_SLP_CLK */
+ PINNAME_GPIO_123 = 123, /* WLAN_PWR_EN */
+ PINNAME_GPIO_11 = 11, /* BT_EN */
+ PINNAME_GPIO_127 = 127, /* WLAN_WAKE */
+ PINNAME_GPIO_125 = 125, /* RESERVED */
+
+ /* I2C */
+ PINNAME_GPIO_50 = 50, /* I2C1_SDA */
+ PINNAME_GPIO_49 = 49, /* I2C1_SCL */
+ PINNAME_GPIO_42 = 42, /* I2C2_SDA */
+ PINNAME_GPIO_41 = 41, /* I2C2_SCL */
+
+ /* UART */
+ PINNAME_GPIO_32 = 32, /* MAIN_CTS */
+ PINNAME_GPIO_31 = 31, /* MAIN_RTS */
+ PINNAME_GPIO_51 = 51, /* MAIN_RXD */
+ PINNAME_GPIO_52 = 52, /* MAIN_TXD */
+ PINNAME_GPIO_54 = 54, /* BT_TXD */
+ PINNAME_GPIO_47 = 47, /* BT_CTS */
+ PINNAME_GPIO_53 = 53, /* BT_RXD */
+ PINNAME_GPIO_46 = 46, /* BT_RTS */
+ PINNAME_GPIO_45 = 45, /* GNSS_TXD */
+ PINNAME_GPIO_44 = 44, /* GNSS_RXD */
+
+ /* SPI */
+ PINNAME_GPIO_23 = 23, /* SPI1_DOUT */
+ PINNAME_GPIO_24 = 24, /* SPI1_DIN */
+ PINNAME_GPIO_22 = 22, /* SPI1_CS */
+ PINNAME_GPIO_21 = 21, /* SPI1_CLK */
+ PINNAME_GPIO_34 = 34, /* SPI2_CS */
+ PINNAME_GPIO_35 = 35, /* SPI2_DIN */
+ PINNAME_GPIO_36 = 36, /* SPI2_DOUT */
+ PINNAME_GPIO_33 = 33, /* SPI2_CLK */
+
+ PINNAME_END = 127
+}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, /** GPIO input direction */
+ PINDIRECTION_OUT = 1 /** GPIO output direction */
+}ENUM_PIN_DIRECTION;
+
+typedef enum{
+ PINLEVEL_LOW = 0, /** GPIO low level */
+ PINLEVEL_HIGH = 1 /** GPIO high level */
+}ENUM_PIN_LEVEL;
+
+typedef enum{
+ PINPULLSEL_DISABLE = 0, /** Disable pull selection */
+ PINPULLSEL_PULLDOWN = 1, /**pull down */
+ PINPULLSEL_PULLUP = 2 /**pull up */
+}ENUM_PIN_PULLSEL;
+
+/****************************************************************************
+ * GPIO Config Items
+ ***************************************************************************/
+typedef struct{
+ ENUM_PINNAME pin_name; /** GPIO pin_name arrey*/
+ ENUM_PIN_DIRECTION pin_direction; /** GPIO pinDirection arrey*/
+ ENUM_PIN_LEVEL pin_level; /** GPIO pinLevel arrey*/
+ ENUM_PIN_PULLSEL pin_pullSel; /** GPIO pinPullSel arrey*/
+}st_gpio_config;
+
+//------------------------------------------------------------------------------
+/**
+ * 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_EINT_TYPE;
+
+/*****************************************************************
+* 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_PIN_DIRECTION.
+* level:
+* The initial level of GPIO, one value of ENUM_PIN_LEVEL.
+* pullSel:
+* Pull selection, one value of ENUM_PIN_PULLSEL.
+* 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_PIN_DIRECTION dir,
+ ENUM_PIN_LEVEL level,
+ ENUM_PIN_PULLSEL 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_set_level
+*
+* 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_PIN_LEVEL.
+* 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_set_level(ENUM_PINNAME pin_name, ENUM_PIN_LEVEL level);
+
+/*****************************************************************
+* Function: ql_gpio_get_level
+*
+* 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_get_level(ENUM_PINNAME pin_name);
+
+/*****************************************************************
+* Function: ql_gpio_set_direction
+*
+* 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_PIN_DIRECTION.
+* 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_set_direction(ENUM_PINNAME pin_name, ENUM_PIN_DIRECTION dir);
+
+/*****************************************************************
+* Function: ql_gpio_get_direction
+*
+* 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_get_direction(ENUM_PINNAME pin_name);
+
+
+/*****************************************************************
+* Function: ql_gpio_set_pull_selection
+*
+* Description:
+* This function sets the pull selection of the specified GPIO.
+*
+* Parameters:
+* pin_name:
+* Pin name, one value of ENUM_PINNAME.
+* ENUM_PIN_PULLSEL:
+* Pull selection, one value of ENUM_PIN_PULLSEL.
+* 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_set_pull_selection(ENUM_PINNAME pin_name, ENUM_PIN_PULLSEL 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 no pull
+* 1 pull down
+* 3 pull up
+*****************************************************************/
+int ql_gpio_get_pull_selection(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:
+* pin_name:
+* EINT pin name, one value of ENUM_PINNAME.
+*
+* level:
+* The EINT level value, one value of ENUM_PIN_LEVEL.
+* 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_EINT_TYPE 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);
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+Function: ql_set_gpio_function
+*
+* Description:
+* set pin function.
+*
+* Parameters:
+* pin_name:
+* EINT pin name, one value of ENUM_PINNAME.
+* func:
+* pin function,value range from 0 to 7
+*
+* Return:
+* RES_OK, this function succeeds.
+* else failed to execute the function.
+*/
+/*-----------------------------------------------------------------------------------------------*/
+int ql_set_gpio_function(ENUM_PINNAME pin_name,unsigned int func);
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/*Function: ql_get_gpio_function
+*
+* Description:
+* get pin function.
+*
+* Parameters:
+* pin_name:
+* EINT pin name, one value of ENUM_PINNAME.
+*
+* Return:
+* return 0-7, this function succeeds.
+* else failed to execute the function.
+*/
+/*-----------------------------------------------------------------------------------------------*/
+int ql_get_gpio_function(ENUM_PINNAME pin_name);
+
+/*-----------------------------------------------------------------------------------------------*/
+/*Function: ql_check_pin_function_status
+*
+* Description:
+* Check whether the pin is gpio function.
+*
+* Parameters:
+* pin_name:
+* EINT pin name, one value of ENUM_PINNAME.
+*
+* Return:
+* return 1, this pin is gpio function.
+* return 0, this pin is not gpio function.
+* else failed to execute the function.
+*/
+/*-----------------------------------------------------------------------------------------------*/
+int ql_check_pin_function_status(ENUM_PINNAME pin_name);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // __QL_GPIO_H__
diff --git a/mbtk/include/ql_v2/ql_gpio_internal.h b/mbtk/include/ql_v2/ql_gpio_internal.h
new file mode 100755
index 0000000..a00a3c0
--- /dev/null
+++ b/mbtk/include/ql_v2/ql_gpio_internal.h
@@ -0,0 +1,335 @@
+#ifndef __QL_GPIO_INTERNAL_H
+#define __QL_GPIO_INTERNAL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "ql_gpio.h"
+
+typedef enum{
+ INTERNAL_BEGIN = -1,
+ INTERNAL_GPIO_10 = 10,
+ INTERNAL_GPIO_11 = 11,
+ INTERNAL_GPIO_19 = 19,
+ INTERNAL_GPIO_21 = 21,
+ INTERNAL_GPIO_22 = 22,
+ INTERNAL_GPIO_23 = 23,
+ INTERNAL_GPIO_24 = 24,
+ INTERNAL_GPIO_25 = 25,
+ INTERNAL_GPIO_26 = 26,
+ INTERNAL_GPIO_27 = 27,
+ INTERNAL_GPIO_31 = 31,
+ INTERNAL_GPIO_32 = 32,
+ INTERNAL_GPIO_33 = 33,
+ INTERNAL_GPIO_34 = 34,
+ INTERNAL_GPIO_35 = 35,
+ INTERNAL_GPIO_36 = 36,
+ INTERNAL_GPIO_37 = 37,
+ INTERNAL_GPIO_38 = 38,
+ INTERNAL_GPIO_39 = 39,
+ INTERNAL_GPIO_40 = 40,
+ INTERNAL_GPIO_43 = 43,
+ INTERNAL_GPIO_48 = 48,
+ INTERNAL_GPIO_49 = 49,
+ INTERNAL_GPIO_50 = 50,
+ INTERNAL_GPIO_51 = 51,
+ INTERNAL_GPIO_52 = 52,
+ INTERNAL_GPIO_53 = 53,
+ INTERNAL_GPIO_54 = 54,
+ INTERNAL_GPIO_55 = 55,
+ INTERNAL_GPIO_56 = 56,
+ INTERNAL_GPIO_57 = 57,
+ INTERNAL_GPIO_58 = 58,
+ INTERNAL_GPIO_59 = 59,
+ INTERNAL_GPIO_99 = 99,
+ INTERNAL_GPIO_117 = 117,
+ INTERNAL_GPIO_118 = 118,
+ INTERNAL_GPIO_119 = 119,
+ INTERNAL_GPIO_120 = 120,
+ INTERNAL_GPIO_122 = 122,
+ INTERNAL_GPIO_123 = 123,
+ INTERNAL_GPIO_126 = 126,
+ INTERNAL_END = 127
+}INTERNAL_ENUM_PINNAME;
+
+
+/*****************************************************************
+* 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 INTERNAL_ENUM_PINNAME.
+* dir:
+* The initial direction of GPIO, one value of ENUM_PIN_DIRECTION.
+* level:
+* The initial level of GPIO, one value of ENUM_PIN_LEVEL.
+* pullSel:
+* Pull selection, one value of ENUM_PIN_PULLSEL.
+* 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(INTERNAL_ENUM_PINNAME pin_name,
+ ENUM_PIN_DIRECTION dir,
+ ENUM_PIN_LEVEL level,
+ ENUM_PIN_PULLSEL 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 INTERNAL_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(INTERNAL_ENUM_PINNAME pin_name );
+
+/*****************************************************************
+* Function: __ql_gpio_set_level
+*
+* Description:
+* This function sets the level of the specified GPIO.
+*
+* Parameters:
+* pin_name:
+* Pin name, one value of INTERNAL_ENUM_PINNAME.
+* level:
+* The initial level of GPIO, one value of ENUM_PIN_LEVEL.
+* 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_set_level(INTERNAL_ENUM_PINNAME pin_name, ENUM_PIN_LEVEL level);
+
+/*****************************************************************
+* Function: __ql_gpio_get_level
+*
+* Description:
+* This function gets the level of the specified GPIO.
+*
+* Parameters:
+* pin_name:
+* Pin name, one value of INTERNAL_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_get_level(INTERNAL_ENUM_PINNAME pin_name);
+
+/*****************************************************************
+* Function: __ql_gpio_set_direction
+*
+* Description:
+* This function sets the direction of the specified GPIO.
+*
+* Parameters:
+* pin_name:
+* Pin name, one value of INTERNAL_ENUM_PINNAME.
+* dir:
+* The initial direction of GPIO, one value of ENUM_PIN_DIRECTION.
+* 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_set_direction(INTERNAL_ENUM_PINNAME pin_name, ENUM_PIN_DIRECTION dir);
+
+/*****************************************************************
+* Function: __ql_gpio_get_direction
+*
+* Description:
+* This function gets the direction of the specified GPIO.
+*
+* Parameters:
+* pin_name:
+* Pin name, one value of INTERNAL_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_get_direction(INTERNAL_ENUM_PINNAME pin_name);
+
+
+/*****************************************************************
+* Function: __ql_gpio_set_pull_selection
+*
+* Description:
+* This function sets the pull selection of the specified GPIO.
+*
+* Parameters:
+* pin_name:
+* Pin name, one value of INTERNAL_ENUM_PINNAME.
+* ENUM_PIN_PULLSEL:
+* Pull selection, one value of ENUM_PIN_PULLSEL.
+* 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_set_pull_selection(INTERNAL_ENUM_PINNAME pin_name, ENUM_PIN_PULLSEL 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 INTERNAL_ENUM_PINNAME.
+* Return:
+* 0 no pull
+* 1 pull down
+* 3 pull up
+*****************************************************************/
+int __ql_gpio_get_pull_selection(INTERNAL_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 INTERNAL_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(INTERNAL_ENUM_PINNAME pin_name);
+
+//------------------------------------------------------------------------------
+/*
+* Function: __ql_eint_enable
+*
+* Description:
+* Set the interrupt sense mode, and enable interrupt.
+*
+* Parameters:
+* eint_pin_name:
+* EINT pin name, one value of INTERNAL_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(INTERNAL_ENUM_PINNAME eint_pin_name, ENUM_EINT_TYPE 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 INTERNAL_ENUM_PINNAME that has
+* the interrupt function.
+*
+* Return:
+* RES_OK, this function succeeds.
+* else failed to execute the function.
+*/
+//------------------------------------------------------------------------------
+int __ql_eint_disable(INTERNAL_ENUM_PINNAME eint_pin_name);
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+Function: __ql_set_gpio_function
+*
+* Description:
+* set pin function.
+*
+* Parameters:
+* pin_name:
+* EINT pin name, one value of INTERNAL_ENUM_PINNAME.
+* func:
+* pin function,value range from 0 to 7
+*
+* Return:
+* RES_OK, this function succeeds.
+* else failed to execute the function.
+*/
+/*-----------------------------------------------------------------------------------------------*/
+int __ql_set_gpio_function(INTERNAL_ENUM_PINNAME pin_name,unsigned int func);
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/*Function: __ql_get_gpio_function
+*
+* Description:
+* get pin function.
+*
+* Parameters:
+* pin_name:
+* EINT pin name, one value of INTERNAL_ENUM_PINNAME.
+*
+* Return:
+* return 0-7, this function succeeds.
+* else failed to execute the function.
+*/
+/*-----------------------------------------------------------------------------------------------*/
+int __ql_get_gpio_function(INTERNAL_ENUM_PINNAME pin_name);
+
+/*-----------------------------------------------------------------------------------------------*/
+/*Function: __ql_check_pin_function_status
+*
+* Description:
+* Check whether the pin is gpio function.
+*
+* Parameters:
+* pin_name:
+* EINT pin name, one value of INTERNAL_ENUM_PINNAME.
+*
+* Return:
+* return 1, this pin is gpio function.
+* return 0, this pin is not gpio function.
+* else failed to execute the function.
+*/
+/*-----------------------------------------------------------------------------------------------*/
+int __ql_check_pin_function_status(INTERNAL_ENUM_PINNAME pin_name);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/mbtk/include/ql_v2/ql_lanhost.h b/mbtk/include/ql_v2/ql_lanhost.h
new file mode 100755
index 0000000..66f28dd
--- /dev/null
+++ b/mbtk/include/ql_v2/ql_lanhost.h
@@ -0,0 +1,105 @@
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @file ql_lanhost.h
+ @brief LANHOST 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
+ -------- --- ----------------------------------------------------------
+ 20191016 tyler.kuang Created .
+-------------------------------------------------------------------------------------------------*/
+
+#ifndef __QL_LANHOST_H__
+#define __QL_LANHOST_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#include "ql_net_common.h"
+
+
+typedef void (*ql_lanhost_ind_cb_f)(QL_LANHOST_EVENT_TYPE_E event_type, ql_lanhost_t *p_host);
+
+typedef void (*ql_lanhost_service_error_cb_f)(int error);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Initialize the lanhost service
+ @return
+ QL_ERR_OK - successful
+ QL_ERR_INVALID_ARG - as defined
+ QL_ERR_UNKNOWN - unknown error, failed to connect to service
+ QL_ERR_SERVICE_NOT_READY - service is not ready, need to retry
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_lanhost_init(void);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Get all lanhost list, the maximum of lanhost is defined by QL_NET_MAX_LANHOST_NUM
+ @param[out] list Lanhost array
+ @param[in,out] list_len, in-> array size, out->current instance number
+ @return
+ QL_ERR_OK - successful
+ QL_ERR_INVALID_ARG - as defined
+ QL_ERR_UNKNOWN - unknown error, failed to connect to service
+ QL_ERR_SERVICE_NOT_READY - service is not ready, need to retry
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_lanhost_get_list(ql_lanhost_t *list, int *list_len);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Register lanhost status change event
+ @param[in] cb
+ @return
+ QL_ERR_OK - successful
+ QL_ERR_NOT_INIT - uninitialized
+ QL_ERR_SERVICE_NOT_READY - service is not ready
+ QL_ERR_INVALID_ARG - Invalid arguments
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_lanhost_set_ind_cb(ql_lanhost_ind_cb_f cb);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Registration server error callback. Currently, only if the server exits abnormally,
+ the callback function will be executed, and the error code is QL_ERR_ABORTED;
+ @param[in] cb Callback function
+ @return
+ QL_ERR_OK - successful
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_lanhost_set_service_error_cb(ql_lanhost_service_error_cb_f cb);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Deinitialize the lanhost service
+ @return
+ QL_ERR_OK - successful
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_lanhost_deinit(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/mbtk/include/ql_v2/ql_lpm.h b/mbtk/include/ql_v2/ql_lpm.h
new file mode 100755
index 0000000..376c4b4
--- /dev/null
+++ b/mbtk/include/ql_v2/ql_lpm.h
@@ -0,0 +1,45 @@
+/*
+ *@file ql_lpm.h
+ *@date 2020-04-01
+ *@author gale
+ *@brief the function is suitable for this product:
+*/
+
+#ifndef __QL_LPM_H__
+#define __QL_LPM_H__
+
+typedef enum
+{
+ E_QL_LPM_FALLING = 0, /* Falling, Means wakeupin falling to wakeup the module, or wakeupout falling to wakeup mcu. */
+ E_QL_LPM_RISING = 1, /* Rising, Means wakeupin rising to wakeup the module, or wakeupout rising to wakeup mcu. */
+}ql_lpm_edge_t;
+
+/* Callback function registered via QL_Lpm_Init();
+ * It will be called when wakeup_in state changed.
+ * lpm_edge: report the wakeup_in state.
+*/
+typedef void (*ql_lpm_handler_t)
+(
+ ql_lpm_edge_t lpm_edge
+);
+
+/* Init QL LPM Init function.
+ * Para:
+ * ql_lpm_handler: the callback handler.
+ *
+ * Return value:
+ * 0 --> success
+ * -1 --> failed
+*/
+extern int ql_lpm_init(ql_lpm_handler_t ql_lpm_handler);
+
+/* Deinit QL LPM function
+ * Rmmod ql_lpm kmod, remove lpm handler.
+ * Return value:
+ * 0 --> success
+ * -1 --> failed
+*/
+extern int ql_lpm_deinit(void);
+
+#endif // __QL_LPM_H__
+
diff --git a/mbtk/include/ql_v2/ql_ms_data_call.h b/mbtk/include/ql_v2/ql_ms_data_call.h
new file mode 100755
index 0000000..02d45fe
--- /dev/null
+++ b/mbtk/include/ql_v2/ql_ms_data_call.h
@@ -0,0 +1,495 @@
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @file ql_data_call.h
+ @brief Data service 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
+ -------- --- ----------------------------------------------------------
+ 20181024 tyler.kuang Created .
+-------------------------------------------------------------------------------------------------*/
+
+#ifndef __QL_MS_DATA_CALL_H__
+#define __QL_MS_DATA_CALL_H__
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include "ql_data_call.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Initialize the data call service
+ @return
+ QL_ERR_OK - successful
+ QL_ERR_INVALID_ARG - as defined
+ QL_ERR_UNKNOWN - unknown error, failed to connect to service
+ QL_ERR_SERVICE_NOT_READY - service is not ready, need to retry
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_data_call_init(void);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Create a data call instance
+ @param[in] call_id The unique identifier of the data call instance, specified by the user
+ @param[in] call_name Friendly data call name, specified by the user
+ @param[in] is_background Whether the data call status is maintained by the data call service daemon.
+ If it is 0, the data call instance will be deleted after the data call process exits.
+ @return
+ QL_ERR_OK - successful
+ QL_ERR_INVALID_ARG - as defined
+ QL_ERR_UNKNOWN - unknown error, failed to connect to service
+ QL_ERR_SERVICE_NOT_READY - service is not ready, need to retry
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_data_call_create(int call_id, const char *call_name, int is_background);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Alloc for a data call configuration instance
+ @return
+ NULL - Not enough memory
+ Other - successful
+ */
+/*-----------------------------------------------------------------------------------------------*/
+ql_data_call_param_t *ql_ms_data_call_param_alloc(void);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Initialize the data call configuration instance
+ @param[in] param Point to the data call configuration instance
+ @return
+ QL_ERR_OK - Successful
+ QL_ERR_INVALID_ARG - Invalid arguments
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_data_call_param_init(ql_data_call_param_t *param);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Release the data call configuration instance
+ @param[in] param Point to the data call configuration instance
+ @return
+ QL_ERR_OK - Successful
+ QL_ERR_INVALID_ARG - Invalid arguments
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_data_call_param_free(ql_data_call_param_t *param);
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Bind APN ID, range:1-16
+ @param[in] param Point to the data call configuration instance
+ @param[in] apn_id APN ID, range:1-16
+ @return
+ QL_ERR_OK - Successful
+ QL_ERR_INVALID_ARG - Invalid arguments
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_data_call_param_set_apn_id(ql_data_call_param_t *param, int apn_id);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Get APN name from configuration instance
+ @param[in] param Point to the data call configuration instance
+ @param[out] buf APN ID
+ @return
+ QL_ERR_OK - Successful
+ QL_ERR_INVALID_ARG - Invalid arguments
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_data_call_param_get_apn_id(ql_data_call_param_t *param, int *apn_id);
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Configure APN name
+ @param[in] param Point to the data call configuration instance
+ @param[in] apn_name APN name
+ @return
+ QL_ERR_OK - Successful
+ QL_ERR_INVALID_ARG - Invalid arguments
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_data_call_param_set_apn_name(ql_data_call_param_t *param, const char *apn_name);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Get APN name from configuration instance
+ @param[in] param Point to the data call configuration instance
+ @param[out] buf APN name buffer
+ @param[in] buf_len APN name buffer size
+ @return
+ QL_ERR_OK - Successful
+ QL_ERR_INVALID_ARG - Invalid arguments
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_data_call_param_get_apn_name(ql_data_call_param_t *param, char *buf, int buf_len);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Configure APN user name
+ @param[in] param Point to the data call configuration instance
+ @param[in] user_name APN user name
+ @return
+ QL_ERR_OK - Successful
+ QL_ERR_INVALID_ARG - Invalid arguments
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_data_call_param_set_user_name(ql_data_call_param_t *param, const char *user_name);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Get APN user name from configuration instance
+ @param[in] param Point to the data call configuration instance
+ @param[out] buf APN user name buffer
+ @param[in] buf_len APN user name buffer size
+ @return
+ QL_ERR_OK - Successful
+ QL_ERR_INVALID_ARG - Invalid arguments
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_data_call_param_get_user_name(ql_data_call_param_t *param, char *buf, int buf_len);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Configure APN user password
+ @param[in] param Point to the data call configuration instance
+ @param[in] user_password APN user password
+ @return
+ QL_ERR_OK - Not enough memory
+ QL_ERR_INVALID_ARG - Invalid arguments
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_data_call_param_set_user_password(ql_data_call_param_t *param, const char *user_password);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Get APN user password from configuration instance
+ @param[in] param Point to the data call configuration instance
+ @param[out] buf APN user password buffer
+ @param[in] buf_len APN user password buffer size
+ @return
+ QL_ERR_OK - Not enough memory
+ QL_ERR_INVALID_ARG - Invalid arguments
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_data_call_param_get_user_password(ql_data_call_param_t *param, char *buf, int buf_len);
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Configure the data call authentication method
+ @param[in] param Point to the data call configuration instance
+ @param[in] auth_pref Defined by QL_DATA_CALL_AUTH_PREF_E
+ @return
+ QL_ERR_OK - Successful
+ QL_ERR_INVALID_ARG - Invalid arguments
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_data_call_param_set_auth_pref(ql_data_call_param_t *param, int auth_pref);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Configure the data call authentication method
+ @param[in] param Point to the data call configuration instance
+ @param[out] p_data Store return value
+ @return
+ QL_ERR_OK - Successful
+ QL_ERR_INVALID_ARG - Invalid arguments
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_data_call_param_get_auth_pref(ql_data_call_param_t *param, int *p_data);
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Configure the data call IP version
+ @param[in] param Point to the data call configuration instance
+ @param[in] ip_ver Defined by QL_NET_IP_VER_E
+ @return
+ QL_ERR_OK - Successful
+ QL_ERR_INVALID_ARG - Invalid arguments
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_data_call_param_set_ip_version(ql_data_call_param_t *param, int ip_ver);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Get IP version from configuration instance
+ @param[in] param Point to the data call configuration instance
+ @param[out] p_ver Store return value
+ @return
+ QL_ERR_OK - Successful
+ QL_ERR_INVALID_ARG - Invalid arguments
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_data_call_param_get_ip_version(ql_data_call_param_t *param, int *p_ver);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Configure the data call auto reconnection mode
+ @param[in] param Point to the data call configuration instance
+ @param[in] mode Defined by QL_NET_DATA_CALL_RECONNECT_MODE_E
+ @return
+ QL_ERR_OK - Successful
+ QL_ERR_INVALID_ARG - Invalid arguments
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_data_call_param_set_reconnect_mode(ql_data_call_param_t *param, int reconnect_mode);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Get auto reconnection mode from configuration instance
+ @param[in] param Point to the data call configuration instance
+ @param[out] p_mode Store return value
+ @return
+ QL_ERR_OK - Successful
+ QL_ERR_INVALID_ARG - Invalid arguments
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_data_call_param_get_reconnect_mode(ql_data_call_param_t *param, int *p_mode);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Configure the data call auto reconnection interval
+ @param[in] param Point to the data call configuration instance
+ @param[in] time_list Interval time list in ms
+ @param[in] num Number of time list
+ @return
+ QL_ERR_OK - Successful
+ QL_ERR_INVALID_ARG - Invalid arguments
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_data_call_param_set_reconnect_interval(ql_data_call_param_t *param, int *time_list, int num);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Get auto reconnection interval from configuration instance
+ @param[in] param Point to the data call configuration instance
+ @param[out] time_list Store return value
+ @param[in,out] p_num
+ @return
+ QL_ERR_OK - Successful
+ QL_ERR_INVALID_ARG - Invalid arguments
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_data_call_param_get_reconnect_interval(ql_data_call_param_t *param, int *time_list, int *p_num);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Configure the data call sim id
+ @param[in] param Point to the data call configuration instance
+ @param[in] sim_id Store return value
+ @return
+ QL_ERR_OK - Successful
+ QL_ERR_INVALID_ARG - Invalid arguments
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_data_call_param_set_sim_id(ql_data_call_param_t *param, int sim_id);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Get the data call sim id from configuration instance
+ @param[in] param Point to the data call configuration instance
+ @param[out] p_sim_id Store return value
+ @return
+ QL_ERR_OK - Successful
+ QL_ERR_INVALID_ARG - Invalid arguments
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_data_call_param_get_sim_id(ql_data_call_param_t *param, int *p_sim_id);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Configure the specified data call instance
+ @param[in] call_id Specify a data call instance
+ @param[in] param Point to the data call configuration instance
+ @return
+ QL_ERR_OK - Successful
+ QL_ERR_INVALID_ARG - Invalid arguments
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_data_call_config(int call_id, ql_data_call_param_t *param);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Get the specified data call configuration instance
+ @param[in] call_id Specify a data call instance
+ @param[in] param Point to the data call configuration instance
+ @return
+ QL_ERR_OK - Successful
+ QL_ERR_INVALID_ARG - Invalid arguments
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_data_call_get_config(int call_id, ql_data_call_param_t *param);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Start data call
+ @param[in] call_id Specify a data call instance
+ @return
+ QL_ERR_OK - successful
+ QL_ERR_NOT_INIT - uninitialized
+ QL_ERR_SERVICE_NOT_READY - service is not ready
+ QL_ERR_INVALID_ARG - Invalid arguments
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_data_call_start(int call_id);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Stop data call
+ @param[in] call_id Specify a data call instance
+ @return
+ QL_ERR_OK - successful
+ QL_ERR_NOT_INIT - uninitialized
+ QL_ERR_SERVICE_NOT_READY - service is not ready
+ QL_ERR_INVALID_ARG - Invalid arguments
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_data_call_stop(int call_id);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Delete a data call instance
+ @param[in] call_id Specify a data call instance
+ @return
+ QL_ERR_OK - successful
+ QL_ERR_NOT_INIT - uninitialized
+ QL_ERR_SERVICE_NOT_READY - service is not ready
+ QL_ERR_INVALID_ARG - Invalid arguments
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_data_call_delete(int call_id);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Get the current data call instance list
+ @param[out] list Data call instance array
+ @param[in,out] list_len, in-> Data call instance array size, out->current data call instance number
+ @return
+ QL_ERR_OK - successful
+ QL_ERR_NOT_INIT - uninitialized
+ QL_ERR_SERVICE_NOT_READY - service is not ready
+ QL_ERR_INVALID_ARG - Invalid arguments
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_data_call_get_list(ql_data_call_item_t *list, int *list_len);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Get the data call status
+ @param[in] call_id Specify a data call instance
+ @param[out] p_sta Point to status instance
+ @return
+ QL_ERR_OK - successful
+ QL_ERR_NOT_INIT - uninitialized
+ QL_ERR_SERVICE_NOT_READY - service is not ready
+ QL_ERR_INVALID_ARG - Invalid arguments
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_data_call_get_status(int call_id, ql_data_call_status_t *p_sta);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Register data call status change event
+ @param[in] cb
+ @return
+ QL_ERR_OK - successful
+ QL_ERR_NOT_INIT - uninitialized
+ QL_ERR_SERVICE_NOT_READY - service is not ready
+ QL_ERR_INVALID_ARG - Invalid arguments
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_data_call_set_status_ind_cb(ql_data_call_status_ind_cb_f cb);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Set APN related configuration.If the apn does not exist, it is automatically created.
+ @param[in] sim_id SIM ID, range:1-2
+ @param[in] apn_id APN ID, range:1-16
+ @param[in] p_info APN configuration
+ @return
+ QL_ERR_OK - successful
+ QL_ERR_NOT_INIT - uninitialized
+ QL_ERR_SERVICE_NOT_READY - service is not ready
+ QL_ERR_INVALID_ARG - Invalid arguments
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_data_call_set_apn_config(int sim_id, int apn_id, ql_data_call_apn_config_t *p_info);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Set APN related configuration. If the apn does not exist, it is automatically created and
+ the default parameters are set.
+ @param[in] sim_id SIM ID, range:1-2
+ @param[in] apn_id APN ID, range:1-16
+ @param[out] p_info APN configuration
+ @return
+ QL_ERR_OK - successful
+ QL_ERR_NOT_INIT - uninitialized
+ QL_ERR_SERVICE_NOT_READY - service is not ready
+ QL_ERR_INVALID_ARG - Invalid arguments
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_data_call_get_apn_config(int sim_id, int apn_id, ql_data_call_apn_config_t *p_info);
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Registration server error callback. Currently, only if the server exits abnormally,
+ the callback function will be executed, and the error code is QL_ERR_ABORTED;
+ @param[in] cb Callback function
+ @return
+ QL_ERR_OK - successful
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_data_call_set_service_error_cb(ql_data_call_service_error_cb_f cb);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Deinitialize the data call service
+ @return
+ QL_ERR_OK - successful
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_data_call_deinit(void);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/mbtk/include/ql_v2/ql_ms_dm.h b/mbtk/include/ql_v2/ql_ms_dm.h
new file mode 100755
index 0000000..b25c38f
--- /dev/null
+++ b/mbtk/include/ql_v2/ql_ms_dm.h
@@ -0,0 +1,436 @@
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @file ql_dm.h
+ @brief device management API
+*/
+/*-----------------------------------------------------------------------------------------------*/
+
+/*-------------------------------------------------------------------------------------------------
+ Copyright (c) 2021 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
+ -------- --- ----------------------------------------------------------
+ 20200316 stan.li Optimize the ql_dm_get_modem_state interface
+ 20191224 stan.li Add radio on/off API
+ 20190625 stan.li Created .
+-------------------------------------------------------------------------------------------------*/
+
+#ifndef __QL_MS_DM_H__
+#define __QL_MS_DM_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "ql_type.h"
+#include "ql_dm.h"
+
+typedef void (*ql_ms_dm_air_plane_mode_ind_cb)(int sim_id, QL_DM_AIR_PLANE_MODE_TYPE_E air_plane_mode);
+typedef void (*ql_ms_dm_modem_state_ind_cb)(int statue);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Initialize DM service.
+ @note You must call this function before other functions can be used in this module.
+ @return Whether the DM service was successfully intialized.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_dm_init(void);
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Deinitialize DM service.
+ @return Whether the DM service was successfully deintialized.
+ @retval QL_ERR_OK successful.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_dm_deinit(void);
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief get device software version.
+ @param[out] soft_ver Return software version
+ @param[in] soft_ver_len The length of soft_ver
+ @return Whether to successfully get the software version
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_dm_get_software_version(char *soft_ver, int soft_ver_len);
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief get modem state.
+ @details QL_DM_MODEM_STATE_ONLINE,if modem starts normally.
+ @details QL_DM_MODEM_STATE_OFFLINE,in modem starts abnormally.
+ @details QL_DM_MODEM_STATE_UNKNOWN,unknown error.
+ @param[out] modem_state The state of modem
+ @return Whether to successfully get the modem state
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_dm_get_modem_state(QL_DM_MODEM_STATE_TYPE_E *modem_state);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief register modem state event.
+ @param[in] cb_func modem state indication callback function
+ @return Whether the modem state event was successfully registered.
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_dm_set_modem_state_change_ind_cb(ql_dm_modem_state_ind_cb cb_func);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief get module temperature.
+ @param[out] temperature The current temperature
+ @return Whether to successfully get the temperature
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_dm_get_temperature(float *temperature);
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief get device serial numbers.
+ @param[out] p_info Pointer that point to ql_dm_device_serial_numbers_info_t
+ @return Whether to successfully get the serial numbers
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_dm_get_device_serial_numbers(ql_dm_device_serial_numbers_info_t *p_info);
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief get device firmware revision identification.
+ @param[out] firmware_rev_id Return device firmware revision id
+ @param[in] firmware_rev_id_len The length of firmware_rev_id
+ @return Whether to successfully get the firmware revision id
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_dm_get_device_firmware_rev_id(char *firmware_rev_id, int firmware_rev_id_len);
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief get air plane mode.
+ @param[in] sim id number
+ @param[out] p_info Pointer that point to QL_DM_AIR_PLANE_MODE_TYPE_E
+ @return Whether to successfully get the air plane mode
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_dm_get_air_plane_mode(int sim_id, QL_DM_AIR_PLANE_MODE_TYPE_E *p_info);
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief set air plane mode.
+ @param[in] sim id number
+ @param[in] air_plane_mode 1:ON, 2:OFF
+ @return Whether to successfully set the air plane mode
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_dm_set_air_plane_mode(int sim_id, QL_DM_AIR_PLANE_MODE_TYPE_E air_plane_mode);
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief register air plane mode event.
+ @param[in] sim_id Sim id number
+ @param[in] cb_func Air plane mode indication callback function
+ @return Whether the air plane mode event was successfully registered.
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_dm_set_air_plane_mode_ind_cb(int sim_id, ql_ms_dm_air_plane_mode_ind_cb cb_func);
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief get cpu occupancy.
+ @param[out] cpu_occupancy The percentage of cpu occupancy
+ @return Whether to successfully get the cpu occupancy
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_dm_get_cpu_occupancy(float *cpu_occupancy);
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief get mem usage.
+ @param[out] mem_use The percentage of mem usage
+ @return Whether to successfully get the memory usage
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_dm_get_mem_usage(float *mem_use);
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief get NV item value.
+ @param[in] sim id number
+ @param[in] nv_item_name The NV item name that is either NV item id or NV item path
+ @param[out] nv_item_value The nv value buf of nv_item_name
+ param[in] nv_item_value_len The length of nv_item_value
+ param[out] nv_len The real length of nv_item_name
+ @return Whether to successfully get the NV value
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_dm_get_nv_item_value(char *nv_item_name, unsigned char *nv_item_value, int nv_item_value_len, int *nv_len);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief set NV item value.
+ @param[in] sim id number
+ @param[in] nv_item_name The NV item name that is either NV item id or NV item path
+ @param[in] nv_item_value The NV value of nv_item_name
+ @param[in] nv_item_value_len The length of nv_item_value
+ param[out] nv_len The real length of nv_item_name
+ @return Whether to successfully set the NV value
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_dm_set_nv_item_value(char *nv_item_name, unsigned char *nv_item_value, int nv_item_value_len, int *nv_len);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief set radio on, its function is the same as at+cfun=1.
+ @param[in] sim id number
+ @return Whether to successfully set the radio on
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_dm_set_radio_on(int sim_id);
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief set radio off, its function is the same as at+cfun=0.
+ @param[in] sim id number
+ @return Whether to successfully set the radio off
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_dm_set_radio_off(int sim_id);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief get modem CPU utilization.
+ @param[out] mem_use The percentage of modem utilization
+ @return Whether to successfully get the modem utilization
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_dm_get_modem_cpu_occupancy(float *cpu_occupancy);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief get modem mem utilization.
+ @param[out] mem_use The percentage of modem utilization
+ @return Whether to successfully get the modem utilization
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_dm_get_modem_mem_usage(float *mem_use);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief get QOOS enable state
+ @param[in] sim id number
+ @param[out] enable The enable state of QOOS
+ @return Whether to successfully get the QOOS enable state
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_dm_get_qoos_enable(int sim_id, QL_DM_QOOS_ENABLE_TYPE_E *enable);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief set QOOS enable state
+ @param[in] sim id number
+ @param[in] enable The enable state of QOOS
+ @return Whether to successfully set the QOOS enable state
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_dm_set_qoos_enable(int sim_id, QL_DM_QOOS_ENABLE_TYPE_E enable);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief get QOOS configuration
+ @param[in] sim id number
+ @param[out] config The configuration of QOOS
+ @return Whether to successfully get the QOOS configuration
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_dm_get_qoos_config(int sim_id, ql_dm_qoos_config_t *config);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief set QOOS configuration
+ @param[in] sim id number
+ @param[in] config The configuration of QOOS
+ @return Whether to successfully set the QOOS configuration
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_dm_set_qoos_config(int sim_id, char enable ,int p1, int p2, int p3);
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief get MSSR(Modem SubSysem Reset) level.
+ @param[out] p_level The MSSR level
+ @return Whether to successfully get the MSSR level
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_dm_get_mssr_level(int *p_level);
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief set MSSR(Modem SubSysem Reset) level.
+ @param[in] level The MSSR level
+ @return Whether to successfully set the MSSR level
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_dm_set_mssr_level(int level);
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Registration server error callback. Currently, only if the server exits abnormally,
+ the callback function will be executed, and the error code is QL_ERR_ABORTED;
+ @param[in] cb Callback function
+ @return
+ QL_ERR_OK - successful
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_dm_set_service_error_cb(ql_dm_service_error_cb_f cb);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif
+
diff --git a/mbtk/include/ql_v2/ql_ms_nw.h b/mbtk/include/ql_v2/ql_ms_nw.h
new file mode 100755
index 0000000..4ff5463
--- /dev/null
+++ b/mbtk/include/ql_v2/ql_ms_nw.h
@@ -0,0 +1,459 @@
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @file ql_ms_nw.h
+ @brief network registration service API, support Dual Sim Dual Active(DSDA).
+*/
+/*-----------------------------------------------------------------------------------------------*/
+
+/*-------------------------------------------------------------------------------------------------
+ Copyright (c) 2021 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
+ -------- --- ----------------------------------------------------------
+ 20200518 rambo.shan Add WEA and ETWS alert indication.
+ 20191225 stan.li Modify function description.
+ 20191202 stan.li change the name of ql_nw_pref_nwmode_roming_info_t
+ 20190528 stan.li Created .
+-------------------------------------------------------------------------------------------------*/
+
+#ifndef __QL_MS_NW_H__
+#define __QL_MS_NW_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "ql_type.h"
+#include "ql_nw.h"
+
+typedef void (*ql_ms_nw_voice_reg_ind_cb)(int sim_id, ql_nw_reg_status_info_t *p_info);
+
+typedef void (*ql_ms_nw_data_reg_ind_cb)(int sim_id, ql_nw_reg_status_info_t *p_info);
+
+typedef void (*ql_ms_nw_signal_strength_ind_cb)(int sim_id, ql_nw_signal_strength_info_t *p_info, QL_NW_SIGNAL_STRENGTH_LEVEL_E level);
+
+typedef void (*ql_ms_nw_cell_access_status_ind_cb)(int sim_id, QL_NW_CELL_ACCESS_STATE_TYPE_E status);
+
+typedef void (*ql_ms_nw_nitz_time_update_ind_cb)(int sim_id, ql_nw_nitz_time_info_t *p_info);
+
+typedef void (*ql_ms_nw_network_scan_async_cb)(int sim_id, int async_index, ql_nw_scan_result_list_info_t *p_info);
+
+typedef void (*ql_ms_nw_wea_reg_ind_cb)(int sim_id, ql_nw_wea_alert_info_t *p_info);
+
+typedef void (*ql_ms_nw_etws_reg_ind_cb)(int sim_id, ql_nw_etws_alert_info_t *p_info);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Initialize NW service.
+ @note You must call this function before other functions can be used in this module.
+ @return Whether the NW service was successfully intialized.
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_nw_init(void);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Deinitializes NW service.
+ @return Whether the NW service was deinitialized successfully.
+ @retval QL_ERR_OK successful.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_nw_deinit(void);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief scan network status.
+ @param[in] sim id number
+ @param[out] async_index The index of request msg
+ @param[in] async_cb The callback function of request msg
+ @return Whether to successfully trigger the network scan operation
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_nw_network_scan(int sim_id, int *async_index, ql_ms_nw_network_scan_async_cb async_cb);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief set power mode.
+ @param[in] sim id number
+ @param[in] lower_mode, defined by QL_NW_LOWER_POWER_MASK_XXX
+ @return Whether to successfully set the power mode
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_nw_set_power_mode(int sim_id, uint8_t lower_mode);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief set perferred NW mode and roaming indicator.
+ @param[in] sim id number
+ @param[in] p_info Pointer that point to ql_nw_pref_nwmode_roaming_info_t
+ @return Whether to successfully set nwmode and roaming
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_nw_set_pref_nwmode_roaming(int sim_id, ql_nw_pref_nwmode_roaming_info_t *p_info);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief get perferred NW mode and roaming indicator.
+ @param[in] sim id number
+ @param[out] p_info Pointer that point to ql_nw_pref_nwmode_roaming_info_t
+ @return Whether to successfully get nwmode and roaming
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_nw_get_pref_nwmode_roaming(int sim_id, ql_nw_pref_nwmode_roaming_info_t *p_info);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief get mobile operator name.
+ @param[in] sim id number
+ @param[out] p_info Pointer that point to ql_nw_mobile_operator_name_info_t
+ @return Whether to successfully get the mobile operator name
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_nw_get_mobile_operator_name(int sim_id, ql_nw_mobile_operator_name_info_t *p_info);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief get cell information.
+ @param[in] sim id number
+ @param[out] p_info Pointer that point to ql_nw_cell_info_t
+ @return Whether to successfully get the cell information
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_nw_get_cell_info(int sim_id, ql_nw_cell_info_t *p_info);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief get voice registration status.
+ @param[in] sim id number
+ @param[out] p_info Pointer that point to ql_nw_reg_status_info_t
+ @return Whether to successfully get the voice registration status
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_nw_get_voice_reg_status(int sim_id, ql_nw_reg_status_info_t *p_info);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief get data registration status.
+ @param[in] sim id number
+ @param[out] p_info Pointer that point to ql_nw_reg_status_info_t
+ @return Whether to successfully get the data registration status
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_nw_get_data_reg_status(int sim_id, ql_nw_reg_status_info_t *p_info);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief get current signal strength.
+ @param[in] sim id number
+ @param[out] p_info Pointer that point to ql_nw_signal_strength_info_t
+ @param[out] p_level: signal strength level
+ @return Whether to successfully get the signal strength
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_nw_get_signal_strength(int sim_id, ql_nw_signal_strength_info_t *p_info, QL_NW_SIGNAL_STRENGTH_LEVEL_E* p_level);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief get current cell acccess status.
+ @param[in] sim id number
+ @param[out] p_info Pointer that point to QL_NW_CELL_ACCESS_STATE_TYPE_E
+ @return Whether to successfully get the cell access status
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_nw_get_cell_access_status(int sim_id, QL_NW_CELL_ACCESS_STATE_TYPE_E *p_info);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief get network time.
+ @param[in] sim id number
+ @param[out] p_info Pointer that point to ql_nw_nitz_time_info_t
+ @return Whether to successfully get the network time
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_nw_get_nitz_time_info(int sim_id, ql_nw_nitz_time_info_t *p_info);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief register voice registration event.
+ @param[in] sim id number
+ @param[in] cb_func Voice registration indication callback function
+ @return Whether the voice registration event was successfully registered.
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_nw_set_voice_reg_ind_cb(int sim_id, ql_ms_nw_voice_reg_ind_cb cb_func);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief register data registration event.
+ @param[in] sim id number
+ @param[in] cb_func Data registration indication callback function
+ @return Whether the data registration event was successfully registered.
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_nw_set_data_reg_ind_cb(int sim_id, ql_ms_nw_data_reg_ind_cb cb_func);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief register signal strength event.
+ @param[in] sim id number
+ @param[in] cb_func Signal strength indication callback function
+ @return Whether the signal strength event was successfully registered
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_nw_set_signal_strength_ind_cb(int sim_id, ql_ms_nw_signal_strength_ind_cb cb_func);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief register cell access status event.
+ @param[in] sim id number
+ @param[in] cb_func Cell access status indication callback function
+ @return Whether the cell access status event was successfully registered
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_nw_set_cell_access_status_ind_cb(int sim_id, ql_ms_nw_cell_access_status_ind_cb cb_func);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief register network time event.
+ @param[in] sim id number
+ @param[in] cb_func nitz time update indication callback function
+ @return Whether the network time event was successfully registered
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_nw_set_nitz_time_update_ind_cb(int sim_id, ql_ms_nw_nitz_time_update_ind_cb cb_func);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief register wea alert event.
+ @param[in] sim id number
+ @param[in] cb_func wea alert indication callback function
+ @return Whether the network time event was successfully registered
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_nw_set_wea_alert_ind_cb(int sim_id, ql_ms_nw_wea_reg_ind_cb cb_func);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief register etws alert event.
+ @param[in] sim id number
+ @param[in] cb_func etws alert indication callback function
+ @return Whether the network time event was successfully registered
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_nw_set_etws_alert_ind_cb(int sim_id, ql_ms_nw_etws_reg_ind_cb cb_func);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief set wea alert config.
+ @param[in] sim id number
+ @param[in] item Items to set.
+ @param[in] p_info Pointer that point to ql_nw_wea_config_t.
+ @return Whether to successfully set the wea config.
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_nw_set_wea_config(int sim_id, int item, ql_nw_wea_config_t *p_info);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Gets wea config.
+ @param[in] sim id number
+ @param[out] p_config wea config.
+ @return Whether the wea config was successfully obtained.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_INVALID_ARG invalid argument.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_nw_get_wea_config(int sim_id, ql_nw_wea_config_t *p_config);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief set etws alert config.
+ @param[in] sim id number
+ @param[in] etws config.
+ @return Whether to successfully set the etws config.
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_nw_set_etws_config(int sim_id, uint8_t enable_etws);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief get etws alert config.
+ @param[in] sim id number
+ @param[out] p_enable_etws Pointer.
+ @return Whether to successfully set the etws config.
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_nw_get_etws_config(int sim_id, uint8_t* p_enable_etws);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief get high capability subscription.
+ @param[in] sim id number
+ @param[out] p_high_cap pointer that point to QL_NW_BIND_SUB_TYPE_E
+ @return Whether the high capability subscription was successfully obtained.
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_nw_get_high_cap_sub(QL_NW_BIND_SUB_TYPE_E *p_high_cap);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief set the SIM card index that can uniquely register to the 5G network.
+ the main difference between high and non-high capability subscription is that high capability
+ subscription can register to 5G network while non-high capability subscription can only
+ register to LTE or GSM.
+ @param[in] sim id number
+ @param[in] high_cap high capability subscription
+ @return Whether to successfully set the high capability subscription.
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_nw_set_high_cap_sub(QL_NW_BIND_SUB_TYPE_E high_cap);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Registration server error callback. Currently, only if the server exits abnormally,
+ the callback function will be executed, and the error code is QL_ERR_ABORTED;
+ @param[in] sim id number
+ @param[in] cb Callback function
+ @return
+ QL_ERR_OK - successful
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_nw_set_service_error_cb(ql_nw_service_error_cb_f cb);
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif
+
diff --git a/mbtk/include/ql_v2/ql_ms_sim.h b/mbtk/include/ql_v2/ql_ms_sim.h
new file mode 100755
index 0000000..01dc771
--- /dev/null
+++ b/mbtk/include/ql_v2/ql_ms_sim.h
@@ -0,0 +1,369 @@
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @file ql_ms_sim.h
+ @brief subscriber identity module service API, support Dual Sim Dual Active(DSDA).
+*/
+/*-----------------------------------------------------------------------------------------------*/
+
+/*-------------------------------------------------------------------------------------------------
+ Copyright (c) 2021 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
+ -------- --- ----------------------------------------------------------
+ 20200720 solomon.cui Created .
+-------------------------------------------------------------------------------------------------*/
+#ifndef __QL_MS_SIM_H__
+#define __QL_MS_SIM_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "ql_type.h"
+#include "ql_sim.h"
+
+typedef void (*ql_ms_sim_card_status_cb_f)(int sim_id, ql_sim_card_info_t *p_info);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Initializes SIM service.
+ @note You must call this function before other functions can be used in this module.
+ @return Whether the SIM service was intialized successfully.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_sim_init(void);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Deinitializes SIM service.
+ @return Whether the SIM service was deintialized successfully.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_sim_deinit(void);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Gets the IMSI (for 3GPP) or IMSI_M (for 3GPP2) from the SIM in ASCII form.
+ @param [in] sim_id sim_id to be used.
+ @param [in] app_type Application type.
+ @param [out] imsi Buffer to fill IMSI data.
+ @param [in] imsi_len Buffer length.
+ @return Whether the IMSI was successfully obtained.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_sim_get_imsi(int sim_id, QL_SIM_APP_TYPE_E app_type, char *imsi, int imsi_len);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Retrieves the Integrated Circuit Card ID (ICCID) stored on the card.
+ @param [in] sim_id sim_id to be used.
+ @param [out] iccid Buffer to fill ICCID data.
+ @param [in] iccid_len Buffer length.
+ @return Whether the ICCID was successfully obtained.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_sim_get_iccid(int sim_id, char *iccid, int iccid_len);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Retrieves the device phone number stored on the card.
+ @param [in] sim_id sim_id to be used.
+ @param [in] app_type Application type.
+ @param [out] phone_num Buffer to fill phone number.
+ @param [in] phone_num_len Buffer length.
+ @return Whether the phone number was successfully retrieved.
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_sim_get_phone_num(int sim_id, QL_SIM_APP_TYPE_E app_type,
+ char *phone_num, int phone_num_len);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Retrieves the preferred operators stored on the card.
+ @param [in] sim_id sim_id to be used.
+ @param [in] list Buffer to hold operators
+ @note This function is only supported by 3GPP applications.
+ @return Whether the preferred operators were successfully retrieved.
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_sim_get_operators(int sim_id, ql_sim_operator_list_t *list);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Enables the PIN on an application.
+ @param [in] sim_id sim_id to be used.
+ @param [in] app_type Application type.
+ @param [in] pin PIN to be used.
+ @param [in] pin_value PIN value. NULL terminated.
+ @return Whether the PIN was successfully enabled.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_sim_enable_pin(int sim_id, QL_SIM_APP_TYPE_E app_type,
+ QL_SIM_PIN_E pin, const char *pin_value);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Disables the PIN on an application.
+ @param [in] sim_id sim_id to be used.
+ @param [in] app_type Application type.
+ @param [in] pin PIN to be used.
+ @param [in] pin_value PIN value. NULL terminated.
+ @return Whether the PIN was successfully disabled.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_sim_disable_pin(int sim_id, QL_SIM_APP_TYPE_E app_type,
+ QL_SIM_PIN_E pin, const char *pin_value);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Verifies the PIN value of an application.
+ @param [in] sim_id sim_id to be used.
+ @param [in] app_type Application type.
+ @param [in] pin PIN to be used.
+ @param [in] pin_value PIN value. NULL terminated.
+ @note PIN must be enabled before calling this function.
+ @return Whether the PIN was successfully verified.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_sim_verify_pin(int sim_id, QL_SIM_APP_TYPE_E app_type,
+ QL_SIM_PIN_E pin, const char *pin_value);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Changes the PIN value of an application.
+ @param [in] sim_id sim_id to be used.
+ @param [in] app_type Application type.
+ @param [in] pin PIN to be used.
+ @param [in] old_pin_value Old PIN value. NULL terminated.
+ @param [in] new_pin_value New PIN value. NULL terminated.
+ @return Whether the PIN was successfully changed.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_sim_change_pin(int sim_id, QL_SIM_APP_TYPE_E app_type,
+ QL_SIM_PIN_E pin, const char *old_pin_value, const char *new_pin_value);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Unblocks a blocked PIN using the PUK code.
+ @param [in] sim_id sim_id to be used.
+ @param [in] app_type Application type.
+ @param [in] pin PIN to be used.
+ @param [in] puk_value PUK value. NULL terminated.
+ @param [in] pin_value New PIN value. NULL terminated.
+ @note The user must pass PUK1 to unblock PIN1 or PUK2 to unblock PIN2.
+ @return Whether the PIN was successfully unblocked.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_sim_unblock_pin(int sim_id, QL_SIM_APP_TYPE_E app_type,
+ QL_SIM_PIN_E pin, const char *puk_value, const char *pin_value);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Retrieves the card info stored on a card.
+ @param [in] sim_id sim_id to be used.
+ @param [out] p_info Pointer of ql_ms_sim_card_info_t.
+ @return Whether the card info was successfully retrieved.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_sim_get_card_info(int sim_id, ql_sim_card_info_t *p_info);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Reads data from a specific file on a specified application on the card.
+ @param [in] sim_id sim_id to be used.
+ @param [in] app_type Application type.
+ @param [inout] p_file Pointer of ql_ms_sim_file_t.
+ @return Whether the file was successfully read.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_sim_read_file(int sim_id, QL_SIM_APP_TYPE_E app_type, ql_sim_file_t *p_file);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Writes data to a specific file on a specified application on the card.
+ @param [in] sim_id sim_id to be used.
+ @param [in] app_type Application type.
+ @param [in] p_file Pointer of ql_ms_sim_file_t
+ @note The type of file is determined by the record number field,
+ which indicates a transparent file when zero and a record-based file otherwise.
+ @return Whether the file was successfully written.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_sim_write_file(int sim_id, QL_SIM_APP_TYPE_E app_type, ql_sim_file_t *p_file);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Retrieves the info of a specific file on a specified application on the card.
+ @param [in] sim_id sim_id to be used.
+ @param [in] app_type Application type.
+ @param [inout] p_info Pointer of ql_ms_sim_file_info_t.
+ @return Whether the file info was successfully retrieved.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_sim_get_file_info(int sim_id, QL_SIM_APP_TYPE_E app_type,
+ ql_sim_file_info_t *p_info);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Reads phone book on a specified application on the card.
+ @param [in] sim_id sim_id to be used.
+ @param [in] app_type Spplication type.
+ @param [in] pb_path Phone book path. NULL terminated.
+ @param [in] record_idx Record index to read. Starts from 1.
+ @param [out] p_record Pointer of ql_ms_sim_phone_book_record_t.
+ @return Whether the phone book record was successfully retrieved.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_sim_read_phone_book(int sim_id, QL_SIM_APP_TYPE_E app_type,
+ const char *pb_path, uint8_t record_idx,
+ ql_sim_phone_book_record_t *p_record);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Writes phone book on a specified application on the card.
+ @param [in] sim_id sim_id to be used.
+ @param [in] app_type Application type.
+ @param [in] pb_path Phone book path. NULL terminated.
+ @param [in] record_idx Record index to write. Starts from 1.
+ @param [in] p_record Pointer of ql_ms_sim_phone_book_record_t.
+ @note If p_record->name[0] = 0 and p_record->number[0] = 0, record will be deleted.
+ @return Whether the phone book record was successfully saved.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_sim_write_phone_book(int sim_id, QL_SIM_APP_TYPE_E app_type,
+ const char *pb_path, uint8_t record_idx,
+ ql_sim_phone_book_record_t *p_record);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Opens a logical channel on a UICC card.
+ @param [in] sim_id sim_id to be used.
+ @param [out] channel_id Channel opened.
+ @return Whether the logical channel was successfully opened.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_sim_open_logical_channel(int sim_id, uint8_t *channel_id);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Closes a logical channel on a UICC card.
+ @param [in] sim_id sim_id to be used.
+ @param [in] channel_id Channel to be closed.
+ @return Whether the logical channel was successfully closed.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_sim_close_logical_channel(int sim_id, uint8_t channel_id);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Sends an APDU to the card.
+ @param [in] sim_id sim_id to be used.
+ @param [in] channel_id Channel to be used.
+ @param [inout] p_apdu Pointer of ql_ms_sim_apdu_t.
+ @note You must call ql_ms_sim_open_logical_channel before sending an APDU.
+ @return Whether the APDU was successfully sent.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_sim_send_apdu(int sim_id, uint8_t channel_id, ql_sim_apdu_t *p_apdu);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Sets SIM card status callback handler
+ @param [in] sim_id sim_id to be used.
+ @param[in] cb call back handler.
+ @return Whether the card status callback handler was successfully set.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_sim_set_card_status_cb(int sim_id, ql_ms_sim_card_status_cb_f cb);
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Registration server error callback. Currently, only if the server exits abnormally,
+ the callback function will be executed, and the error code is QL_ERR_ABORTED;
+ @param[in] cb Callback function
+ @return
+ QL_ERR_OK - successful
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_sim_set_service_error_cb(ql_sim_service_error_cb_f cb);
+
+int ql_ms_sim_switch_slot(int sim_id, QL_SIM_PHY_SLOT_E phy_slot);
+int ql_ms_sim_get_active_slots(int sim_id, ql_sim_active_slots_t *p_active_slots);
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif
+
diff --git a/mbtk/include/ql_v2/ql_ms_sms.h b/mbtk/include/ql_v2/ql_ms_sms.h
new file mode 100755
index 0000000..c4f90c4
--- /dev/null
+++ b/mbtk/include/ql_v2/ql_ms_sms.h
@@ -0,0 +1,206 @@
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @file ql_ms_sms.h
+ @brief short message service API, support Dual Sim Dual Active(DSDA).
+*/
+/*-----------------------------------------------------------------------------------------------*/
+
+/*-------------------------------------------------------------------------------------------------
+ Copyright (c) 2021 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
+ -------- --- ----------------------------------------------------------
+ 2021069 Stan.li Created.
+-------------------------------------------------------------------------------------------------*/
+#ifndef __QL_MS_SMS_H__
+#define __QL_MS_SMS_H__
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "ql_type.h"
+#include "ql_sms.h"
+
+
+typedef void (*ql_ms_sms_msg_async_cb_f)(int sim_id, int id, int result);
+typedef void (*ql_ms_sms_msg_recv_cb_f)(int sim_id, ql_sms_msg_t *p_msg, ql_sms_timestamp_t *timestamp,
+ ql_sms_user_data_head_t *head);
+typedef void (*ql_ms_sms_pdu_async_cb_f)(int sim_id, int id, int result);
+typedef void (*ql_ms_sms_pdu_recv_cb_f)(int sim_id, ql_sms_pdu_t *p_pdu);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Initializes SMS service.
+ @return Whether the SMS service was initialized successfully.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_sms_init(void);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Deinitializes SMS service.
+ @return Whether the SMS service was deinitialized successfully.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_sms_deinit(void);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Sets the service center address.
+ @param[in] sim id number
+ @param[in] addr service center address.
+ @param[in] len service center address length.
+ @return Whether the service center address was set successfully.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_INVALID_ARG invalid argument.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_sms_set_service_center_addr(int sim_id, char *addr, int len);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Gets the service center address.
+ @param[in] sim id number
+ @param[out] addr service center address.
+ @param[in] len service center address length.
+ @return Whether the service center address was successfully obtained.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_INVALID_ARG invalid argument.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_sms_get_service_center_addr(int sim_id, char *addr, int len);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Sends message synchronously.
+ @param[in] sim id number
+ @param[in] p_msg pointer to ql_ms_sms_msg_t.
+ @return Whether the message was successfully sent synchronously.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_INVALID_ARG invalid argument.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_sms_send_msg(int sim_id, ql_sms_msg_t *p_msg);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Sends message asynchronously.
+ @param[in] sim id number
+ @param[in] p_msg pointer to ql_ms_sms_msg_t
+ @param[out] id id for this async operation
+ @param[in] cb async callback
+ @return Whether the message was successfully sent asynchronously.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_INVALID_ARG invalid argument.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_sms_send_msg_async(int sim_id, ql_sms_msg_t *p_msg, int *id, ql_ms_sms_msg_async_cb_f cb);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Sets SMS message reception callback hanlder.
+ @param[in] sim id number
+ @param[in] cb message reception callback handler.
+ @return Whether the message reception callback hanlder was set successfully.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_INVALID_ARG invalid argument.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_sms_set_msg_recv_cb(int sim_id, ql_ms_sms_msg_recv_cb_f cb);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Sends PDU synchronously.
+ @param[in] sim id number
+ @param[in] p_pdu SMS PDU.
+ @return Whether the PDU was successfully sent synchronously.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_INVALID_ARG invalid argument.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_sms_send_pdu(int sim_id, ql_sms_pdu_t *p_pdu);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Sends PDU asynchronously.
+ @param[in] sim id number
+ @param[in] p_pdu sms pdu.
+ @param[out] id id for this async operation.
+ @param[in] cb async callback.
+ @return Whether the PDU was successfully sent asynchronously.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_INVALID_ARG invalid argument.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_sms_send_pdu_async(int sim_id, ql_sms_pdu_t *p_pdu, int *id, ql_ms_sms_pdu_async_cb_f cb);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Sets SMS PDU reception callback hanlder.
+ @param[in] sim id number
+ @param[in] cb PDU reception callback handler.
+ @return Whether the PDU reception callback hanlder was set successfully.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_INVALID_ARG invalid argument.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_sms_set_pdu_recv_cb(int sim_id, ql_ms_sms_pdu_recv_cb_f cb);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Registration server error callback. Currently, only if the server exits abnormally,
+ the callback function will be executed, and the error code is QL_ERR_ABORTED;
+ @param[in] cb Callback function
+ @return
+ QL_ERR_OK - successful
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_sms_set_service_error_cb(ql_sms_service_error_cb_f cb);
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif
+
diff --git a/mbtk/include/ql_v2/ql_ms_voice.h b/mbtk/include/ql_v2/ql_ms_voice.h
new file mode 100755
index 0000000..54707e5
--- /dev/null
+++ b/mbtk/include/ql_v2/ql_ms_voice.h
@@ -0,0 +1,428 @@
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @file ql_ms_voice.h
+ @brief Voice service DSDA API.
+*/
+/*-----------------------------------------------------------------------------------------------*/
+
+/*-------------------------------------------------------------------------------------------------
+ Copyright (c) 2019 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
+ -------- --- ----------------------------------------------------------
+ 20210622 Rambo.shan Created, Added Voice DSDA API.
+-------------------------------------------------------------------------------------------------*/
+
+#ifndef __QL_MS_VOICE_H__
+#define __QL_MS_VOICE_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+#include "ql_voice.h"
+
+typedef void (*ql_ms_voice_ecall_status_cb_f)(int sim_id, uint32_t id,
+ QL_VOICE_ECALL_MSD_TRANS_STATUS_E status);
+
+typedef void (*ql_ms_voice_ecall_event_cb_f)(int sim_id, ql_voice_ecall_event_t *p_event);
+
+typedef void (*ql_ms_voice_call_cb_f)(int sim_id, ql_voice_record_array_t *p_arr);
+
+/** voice dtmf event callback */
+typedef void (*ql_ms_voice_dtmf_cb_f)(int sim_id, uint32_t id, QL_VOICE_DTMF_EVENT_E event,
+ char *digits, int len); /**< len: length of digits */
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Initializes voice service.
+ @return Whether the voice service was initialized successfully.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_voice_init(void);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Deinitializes voice service.
+ @return Whether the voice service was deinitialized successfully.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_voice_deinit(void);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Dials a call.
+ @param[in] num phone number to dial.
+ @param[in] len length of phone number, should be less than
+ or euqnal to QL_VOICE_MAX_PHONE_NUMBER.
+ @param[out] id call id.
+ @return Whether a voice call was successfully dialed.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_INVALID_ARG invalid argument.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_voice_dial(int sim_id, char *num, int len, uint32_t *id);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Cancels dialing with given id.
+ @param[in] id call id returned from dial.
+ @return Whether the voice call was successfully cancelled.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_INVALID_ARG invalid argument.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_voice_cancel_dial(int sim_id, uint32_t id);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief hangup all dialing.
+ @return Whether all voice call were successfully hangup.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_INVALID_ARG invalid argument.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_voice_hangup_all(int sim_id);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Answers the call.
+ @param[in] id call id returned from dial.
+ @return Whether the voice call was successfully answered.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_INVALID_ARG invalid argument.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_voice_answer(int sim_id, uint32_t id);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Hangs up the call.
+ @param[in] id call id returned from dial.
+ @return Whether the voice call was successfully hung up.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_INVALID_ARG invalid argument.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_voice_hangup(int sim_id, uint32_t id);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Holds the call when mutil calls is activated.
+ @param[in] id call id returned from dial.
+ @return Whether the voice call was successfully held.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_INVALID_ARG invalid argument.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_voice_hold(int sim_id, uint32_t id);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Releases the call from hold when mutil calls is activated.
+ @param[in] id call id returned from dial.
+ @return Whether the voice call was successfully unheld.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_INVALID_ARG invalid argument.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_voice_unhold(int sim_id, uint32_t id);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Gets call records.
+ @param[in] p_arr pointer to ql_voice_record_array_t.
+ @return Whether the call records were successfully obtained.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_INVALID_ARG invalid argument.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_voice_get_records(int sim_id, ql_voice_record_array_t *p_arr);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Registers or Unregisters forwarding.
+ @param[in] reg 0 - unregister, 1 - register.
+ @param[in] cond forwarding condition.
+ @param[in] num phone number.
+ @param[in] len length of phone numebr.
+ @return Whether the voice call forward was registered or unregistered successfully.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_INVALID_ARG invalid argument.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_voice_forwarding(int sim_id, int reg, QL_VOICE_FW_COND_E cond, char *num, int len);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Gets forwarding status.
+ @param[in] cond forwarding condition.
+ @param[out] p_status pointer to ql_voice_fw_status_t.
+ @return Whether the voice call forward status was successfully obtained.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_INVALID_ARG invalid argument.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_voice_get_forwarding_status(int sim_id, QL_VOICE_FW_COND_E cond, ql_voice_fw_status_t *p_status);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Enables or disables call waiting.
+ @param[in] enable 0 - disable, other - enable.
+ @return Whether the voice call waiting was enabled or disabled successfully.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_INVALID_ARG invalid argument.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_voice_waiting(int sim_id, int enable);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Gets call waiting status.
+ @param[out] enabled 0 - waiting is disabled, 1 - waiting is enabled.
+ @return Whether the voice call waiting status was successfully obtained.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_INVALID_ARG invalid argument.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_voice_get_waiting_status(int sim_id, int *enabled);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Enables or disables auto answer.
+ @param[in] enable 0 - disable, other - enable.
+ @param[in] sec wait this `sec' seconds before auto answer.
+ @return Whether the voice call autoanswer was enabled or disabled successfully.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_INVALID_ARG invalid argument.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_voice_autoanswer(int sim_id, int enable, uint32_t sec);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Sends a DTMF(Dual Tone Multi Frequency) character over the call ID.
+ @param[in] id call id returned from dial.
+ @param[in] c DTMF character to be sent. Valid DTMF characters are 0-9, A-D, '*', '#'.
+ @return Whether a DTMF character was successfully sent.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_INVALID_ARG invalid argument.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_voice_send_dtmf_char(int sim_id, uint32_t id, char c);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Sets voice call callback handler.
+ @param[in] cb call back handler.
+ @return Whether the voice call callback handler was successfully set.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_INVALID_ARG invalid argument.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_voice_set_call_cb(int sim_id, ql_ms_voice_call_cb_f cb);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Sets voice dtmf callback handler.
+ @param[in] cb call back handler.
+ @return Whether the voice call DTMF repcetion callback handler was successfully set.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_INVALID_ARG invalid argument.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_voice_set_dtmf_cb(int sim_id, ql_ms_voice_dtmf_cb_f cb);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Dials eCall.
+ @param[in] p_info eCall info.
+ @return Whether a eCall was successfully dialed.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_INVALID_ARG invalid argument.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_voice_ecall_dial(int sim_id, ql_voice_ecall_info_t *p_info);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Hangs up eCall.
+ @return Whether the eCall was successfully hung up.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_INVALID_ARG invalid argument.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_voice_ecall_hangup(int sim_id);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Updates eCall MSD.
+ @param[in] msd Minimum Set of Data.
+ @param[in] msd_len Length of Minimum Set of Data.
+ @return Whether the eCall MSD was successfully updated.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_INVALID_ARG invalid argument.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_voice_ecall_update_msd(int sim_id, const uint8_t *msd, uint32_t msd_len);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Pushes eCall MSD.
+ @param[out] state eCall state.
+ @return Whether the eCall MSD was successfully pushed.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_INVALID_ARG invalid argument.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_voice_ecall_push_msd(int sim_id, QL_VOICE_ECALL_STATE_E *state);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Gets eCall config.
+ @param[in] p_config eCall config.
+ @return Whether the eCall config was successfully obtained.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_INVALID_ARG invalid argument.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_voice_ecall_get_config(int sim_id, ql_voice_ecall_config_t *p_config);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Sets eCall config.
+ @param[in] item Items to set.
+ @param[in] p_config eCall config.
+ @return Whether the eCall config was successfully set.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_INVALID_ARG invalid argument.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_voice_ecall_set_config(int sim_id, int item, ql_voice_ecall_config_t *p_config);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Sets eCall event callback handler.
+ @param[in] cb call back handler.
+ @return Whether the eCall event callback handler was successfully set.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_INVALID_ARG invalid argument.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_voice_ecall_set_event_cb(int sim_id, ql_ms_voice_ecall_event_cb_f cb);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Sets eCall status callback handler.
+ @param[in] cb call back handler.
+ @return Whether the eCall status callback handler was successfully set.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_INVALID_ARG invalid argument.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_voice_ecall_set_status_cb(int sim_id, ql_ms_voice_ecall_status_cb_f cb);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Registration server error callback. Currently, only if the server exits abnormally,
+ the callback function will be executed, and the error code is QL_ERR_ABORTED;
+ @param[in] cb Callback function
+ @return
+ QL_ERR_OK - successful
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_ms_voice_set_service_error_cb(ql_voice_service_error_cb_f cb);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __QL_VOICE_H__ */
+
diff --git a/mbtk/include/ql_v2/ql_net_common.h b/mbtk/include/ql_v2/ql_net_common.h
new file mode 100755
index 0000000..b6071d8
--- /dev/null
+++ b/mbtk/include/ql_v2/ql_net_common.h
@@ -0,0 +1,151 @@
+#ifndef __QL_NET_COMMON_H__
+#define __QL_NET_COMMON_H__
+
+#include <stdint.h>
+/** Maximum length of the APN name. */
+#define QL_NET_MAX_APN_NAME_LEN 150
+
+/** Maximum length of the APN user name. */
+#define QL_NET_MAX_APN_USERNAME_LEN 127
+
+/** Maximum length of the password. */
+#define QL_NET_MAX_APN_PASSWORD_LEN 127
+
+/** Maximum address length. */
+#define QL_NET_MAX_ADDR_LEN 46
+
+// 1 - 7 (ASR 1806)
+#define QL_NET_MAX_DATA_CALL_NUM 7
+
+/** Maximum lenth of the device name. */
+#define QL_NET_MAX_NAME_LEN 32
+#define QL_NET_MAX_RECONNECT_INTERVAL_LEN 20
+#define QL_NET_MAX_APN_ID QL_NET_MAX_DATA_CALL_NUM
+#define QL_NET_USB_DEV_MAX_NUM QL_NET_MAX_DATA_CALL_NUM
+
+#define QL_NET_MAX_LANHOST_NUM 18
+#define QL_NET_MAX_LANHOST_NAME_LEN 64
+
+typedef enum {
+ QL_NET_DATA_CALL_STATUS_MIN = -1,
+ QL_NET_DATA_CALL_STATUS_NONE = 0x0, /**< Call state is NONE */
+ QL_NET_DATA_CALL_STATUS_CREATED = 0x1, /**< Call state was created */
+ QL_NET_DATA_CALL_STATUS_IDLE = 0x2, /**< Call state is IDLE. */
+ QL_NET_DATA_CALL_STATUS_CONNECTING = 0x3, /**< Call is connecting. */
+ QL_NET_DATA_CALL_STATUS_PARTIAL_V4_CONNECTED = 0x4, /**< V4V6 mode, V4 is connected. */
+ QL_NET_DATA_CALL_STATUS_PARTIAL_V6_CONNECTED = 0x5, /**< V4V6 mode, V6 is connected. */
+ QL_NET_DATA_CALL_STATUS_CONNECTED = 0x6, /**< Call is connected. */
+ QL_NET_DATA_CALL_STATUS_DISCONNECTED = 0x7, /**< Call is disconnected. */
+ QL_NET_DATA_CALL_STATUS_ERROR = 0x8, /**< Error ocurred */
+ QL_NET_DATA_CALL_STATUS_DELETED = 0x9, /**< Data Call was deleted */
+ QL_NET_DATA_CALL_STATUS_MAX
+} QL_NET_DATA_CALL_STATUS_E;
+
+#define IS_QL_NET_DATA_CALL_STATUS_VALID(status) \
+ ((status)>QL_NET_DATA_CALL_STATUS_MIN && (status)<QL_NET_DATA_CALL_STATUS_MAX)
+
+typedef enum {
+ QL_NET_DATA_CALL_RECONNECT_MODE_MIN = -1,
+ QL_NET_DATA_CALL_RECONNECT_DISABLE = 0x0,
+ QL_NET_DATA_CALL_RECONNECT_NORMAL = 0x1, /**< Normal mode, interval defined by reconnect_interval[0] in sec */
+ QL_NET_DATA_CALL_RECONNECT_MODE_1 = 0x2, /**< Mode 1, time interval list defined by reconnect_interval in sec,
+ if the time interval list is T1,T2,T3...Tn, the reconnection interval is T1,T2,T3...Tn,Tn,Tn...Tn */
+ QL_NET_DATA_CALL_RECONNECT_MODE_2 = 0x3, /**< Mode 2, time interval list defined by reconnect_interval in sec,
+ if the time interval list is T1,T2,T3...Tn, the reconnection interval is T1,T2,T3..Tn,T1,T2,T3..Tn,T1.. */
+ QL_NET_DATA_CALL_RECONONECT_MODE_MAX
+} QL_NET_DATA_CALL_RECONNECT_MODE_E;
+
+#define IS_QL_NET_DATA_CALL_RECONNECT_MODE_VALID(mode) \
+ ((mode)>QL_NET_DATA_CALL_RECONNECT_MODE_MIN && (mode)<QL_NET_DATA_CALL_RECONONECT_MODE_MAX)
+
+typedef enum {
+ QL_NET_IP_VER_MIN = -0,
+ QL_NET_IP_VER_V4 = 0x1,
+ QL_NET_IP_VER_V6 = 0x2,
+ QL_NET_IP_VER_V4V6 = 0x3,
+ QL_NET_IP_VER_MAX
+} QL_NET_IP_VER_E;
+
+#define IS_QL_NET_IP_VER_VALID(ver) \
+ ((ver)>QL_NET_IP_VER_MIN && (ver)<QL_NET_IP_VER_MAX)
+
+typedef enum {
+ QL_NET_AUTH_PREF_MIN = -1,
+ QL_NET_AUTH_PREF_PAP_CHAP_NOT_ALLOWED = 0,
+ QL_NET_AUTH_PREF_PAP_ONLY_ALLOWED = 1,
+ QL_NET_AUTH_PREF_CHAP_ONLY_ALLOWED = 2,
+ QL_NET_AUTH_PREF_PAP_CHAP_BOTH_ALLOWED = 3,
+ QL_NET_AUTH_PREF_MAX
+} QL_NET_AUTH_PREF_E;
+
+#define IS_QL_NET_AUTH_PREF_VALID(pref) \
+ ((pref)>QL_NET_AUTH_PREF_MIN && (pref)<QL_NET_AUTH_PREF_MAX)
+
+typedef enum {
+ QL_NET_USB_DEV_TYPE_MIN = 0,
+ QL_NET_USB_DEV_TYPE_ECM = 1,
+ QL_NET_USB_DEV_TYPE_NCM = 2,
+ QL_NET_USB_DEV_TYPE_RNDIS = 3,
+ QL_NET_USB_DEV_TYPE_MBIM = 4,
+ QL_NET_USB_DEV_TYPE_MAX
+} QL_NET_USB_DEV_TYPE_E;
+
+typedef enum {
+ QL_NET_USB_DEV_STATUS_MIN = -1,
+ QL_NET_USB_DEV_STATUS_NONE = 0,
+ QL_NET_USB_DEV_STATUS_LINKDOWN = 1,
+ QL_NET_USB_DEV_STATUS_LINKUP = 2,
+ QL_NET_USB_DEV_STATUS_MAX
+} QL_NET_USB_DEV_STATUS_E;
+
+typedef enum {
+ QL_NET_NF_CMD_FORMAT_MIN = -1,
+ QL_NET_NF_CMD_FORMAT_COMMON = 0,
+ QL_NET_NF_CMD_FORMAT_JSON = 1,
+ QL_NET_NF_CMD_FORMAT_MAX
+} QL_NET_NF_CMD_FORMAT_E;
+
+typedef enum {
+ QL_LANHOST_EVENT_ADD = 0,
+ QL_LANHOST_EVENT_DEL,
+ QL_LANHOST_EVENT_UPDATE,
+} QL_LANHOST_EVENT_TYPE_E;
+
+typedef struct {
+ char device[QL_NET_MAX_NAME_LEN];
+ QL_NET_USB_DEV_TYPE_E type;
+ QL_NET_USB_DEV_STATUS_E status;
+ int8_t inst_id;
+} ql_net_usb_dev_t;
+
+typedef struct {
+ char addr[QL_NET_MAX_ADDR_LEN]; /**< IPV4 address format string */
+ char netmask[QL_NET_MAX_ADDR_LEN]; /**< Subnet mask, format */
+ uint8_t subnet_bits; /**< Subnet mask bit number, exp:
+ 255.255.255.0 is 24, 255.255.0.0 is 16 */
+ char gateway[QL_NET_MAX_ADDR_LEN]; /**< Gateway, IPV4 address*/
+ char dnsp[QL_NET_MAX_ADDR_LEN]; /**< Primary DNS server address. */
+ char dnss[QL_NET_MAX_ADDR_LEN]; /**< Secondary DNS server address. */
+} ql_net_addr_t;
+
+typedef struct
+{
+ char addr[QL_NET_MAX_ADDR_LEN]; /**< IPV6 address format string */
+ char prefix[QL_NET_MAX_ADDR_LEN];
+ int32_t prefix_bits;
+ char gateway[QL_NET_MAX_ADDR_LEN]; /**< Gateway address. */
+ char dnsp[QL_NET_MAX_ADDR_LEN]; /**< Primary DNS server address. */
+ char dnss[QL_NET_MAX_ADDR_LEN]; /**< Secondary DNS server address. */
+} ql_net_addr6_t;
+
+typedef struct
+{
+ char addr[QL_NET_MAX_ADDR_LEN]; /**< IPV4 address format string */
+ char macaddr[18]; /**< MAC address, format: XX:XX:XX:XX:XX:XX */
+ char name[QL_NET_MAX_LANHOST_NAME_LEN]; /**< hostname */
+ char ifname[QL_NET_MAX_NAME_LEN]; /**< device name */
+ int uptime; /**< online time in sec */
+} ql_lanhost_t;
+
+#endif
+
diff --git a/mbtk/include/ql_v2/ql_net_usb_dev.h b/mbtk/include/ql_v2/ql_net_usb_dev.h
new file mode 100755
index 0000000..427c88b
--- /dev/null
+++ b/mbtk/include/ql_v2/ql_net_usb_dev.h
@@ -0,0 +1,190 @@
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @file ql_net_usb_dev.h
+ @brief USB net device 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
+ -------- --- ----------------------------------------------------------
+ 20190709 tyler.kuang Created .
+-------------------------------------------------------------------------------------------------*/
+
+#ifndef __QL_NET_USB_DEV_H__
+#define __QL_NET_USB_DEV_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#include "ql_net_common.h"
+
+
+typedef void (*ql_net_usb_dev_ind_cb_f)(const char *device,
+ QL_NET_USB_DEV_STATUS_E pre_status,
+ ql_net_usb_dev_t *p_dev);
+
+typedef void (*ql_net_usb_dev_service_error_cb_f)(int error);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Initialize the USB net device service
+ @return
+ QL_ERR_OK - successful
+ QL_ERR_INVALID_ARG - as defined
+ QL_ERR_UNKNOWN - unknown error, failed to connect to service
+ QL_ERR_SERVICE_NOT_READY - service is not ready, need to retry
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_net_usb_dev_init(void);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Get USB network device status
+ @param[in] device Device name, such as ecm0, rndis0..
+ @param[out] p_dev Return device status information
+ @return
+ QL_ERR_OK - successful
+ QL_ERR_INVALID_ARG - as defined
+ QL_ERR_UNKNOWN - unknown error, failed to connect to service
+ QL_ERR_SERVICE_NOT_READY - service is not ready, need to retry
+ QL_ERR_INTERFACE_NOT_FOUND - device does not exist
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_net_usb_dev_get_status(const char *device, ql_net_usb_dev_t *p_dev);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Get all USB network device list
+ @param[out] list USB network device array
+ @param[in,out] list_len, in-> array size, out->current instance number
+ @return
+ QL_ERR_OK - successful
+ QL_ERR_INVALID_ARG - as defined
+ QL_ERR_UNKNOWN - unknown error, failed to connect to service
+ QL_ERR_SERVICE_NOT_READY - service is not ready, need to retry
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_net_usb_dev_get_list(ql_net_usb_dev_t *list, int *list_len);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Set USB network device MTU. If it does not currently exist, then set it after the device
+ appears.
+ @param[in] device Device name, such as ecm0, rndis0..
+ @param[in] mtu MTU
+ @return
+ QL_ERR_OK - successful
+ QL_ERR_INVALID_ARG - as defined
+ QL_ERR_UNKNOWN - unknown error, failed to connect to service
+ QL_ERR_SERVICE_NOT_READY - service is not ready, need to retry
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_net_usb_dev_set_mtu(const char *device, int mtu);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Get USB network device MTU
+ @param[in] device Device name, such as ecm0, rndis0..
+ @param[out] p_mtu Reutn device MTU
+ @return
+ QL_ERR_OK - successful
+ QL_ERR_INVALID_ARG - as defined
+ QL_ERR_UNKNOWN - unknown error, failed to connect to service
+ QL_ERR_SERVICE_NOT_READY - service is not ready, need to retry
+ QL_ERR_INTERFACE_NOT_FOUND - device does not exist
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_net_usb_dev_get_mtu(const char *device, int *p_mtu);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Set USB network device MAC address. If it does not currently exist, then set it after the device
+ appears.
+ @param[in] device Device name, such as ecm0, rndis0..
+ @param[in] macaddr MAC address, format: XX:XX:XX:XX:XX:XX
+ @return
+ QL_ERR_OK - successful
+ QL_ERR_INVALID_ARG - as defined
+ QL_ERR_UNKNOWN - unknown error, failed to connect to service
+ QL_ERR_SERVICE_NOT_READY - service is not ready, need to retry
+ QL_ERR_INTERFACE_NOT_FOUND - device does not exist
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_net_usb_dev_set_macaddr(const char *device, const char *macaddr);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Get USB network device MAC address
+ @param[in] device Device name, such as ecm0, rndis0..
+ @param[out] macaddr_buf Return MAC address
+ @param[in] buf_len Buffer size
+ @return
+ QL_ERR_OK - successful
+ QL_ERR_INVALID_ARG - as defined
+ QL_ERR_UNKNOWN - unknown error, failed to connect to service
+ QL_ERR_SERVICE_NOT_READY - service is not ready, need to retry
+ QL_ERR_INTERFACE_NOT_FOUND - device does not exist
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_net_usb_dev_get_macaddr(const char *device, char *macaddr_buf, int buf_len);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Register USB network device status change event
+ @param[in] cb
+ @return
+ QL_ERR_OK - successful
+ QL_ERR_NOT_INIT - uninitialized
+ QL_ERR_SERVICE_NOT_READY - service is not ready
+ QL_ERR_INVALID_ARG - Invalid arguments
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_net_usb_dev_set_ind_cb(ql_net_usb_dev_ind_cb_f cb);
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Registration server error callback. Currently, only if the server exits abnormally,
+ the callback function will be executed, and the error code is QL_ERR_ABORTED;
+ @param[in] cb Callback function
+ @return
+ QL_ERR_OK - successful
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_net_usb_dev_set_service_error_cb(ql_net_usb_dev_service_error_cb_f cb);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Deinitialize the USB net device service
+ @return
+ QL_ERR_OK - successful
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_net_usb_dev_deinit(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/mbtk/include/ql_v2/ql_nf.h b/mbtk/include/ql_v2/ql_nf.h
new file mode 100755
index 0000000..d07a524
--- /dev/null
+++ b/mbtk/include/ql_v2/ql_nf.h
@@ -0,0 +1,135 @@
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @file ql_nf.h
+ @brief Network framework 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
+ -------- --- ----------------------------------------------------------
+ 20181024 tyler.kuang Created .
+-------------------------------------------------------------------------------------------------*/
+
+#ifndef __QL_NF_H__
+#define __QL_NF_H__
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include "ql_net_common.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct {
+ char name[QL_NET_MAX_NAME_LEN];
+ char ifname[QL_NET_MAX_NAME_LEN];
+ char pre_status[16];
+ char status[16];
+ uint8_t has_addr;
+ ql_net_addr_t addr;
+ uint8_t has_addr6;
+ ql_net_addr6_t addr6;
+} ql_nf_interface_status_t;
+
+typedef void (*ql_nf_interface_status_ind_cb_f)(ql_nf_interface_status_t *p_msg);
+
+typedef void (*ql_nf_service_error_cb_f)(int error);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Initialize network service
+ @return
+ QL_ERR_OK - successful
+ QL_ERR_INVALID_ARG - as defined
+ QL_ERR_UNKNOWN - unknown error, failed to connect to service
+ QL_ERR_SERVICE_NOT_READY - service is not ready, need to retry
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_nf_init(void);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Send a command and wait for a response
+ @param[in] cmd Command
+ @param[out] resp_buf Response
+ @param[in] resp_len Response buffer length
+ @return
+ QL_ERR_OK - successful
+ QL_ERR_INVALID_ARG - as defined
+ QL_ERR_UNKNOWN - unknown error, failed to connect to service
+ QL_ERR_SERVICE_NOT_READY - service is not ready, need to retry
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_nf_cmd(const char *cmd, char *resp_buf, int resp_len);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Send a command and wait for a response
+ @param[in] cmd Command
+ @param[out] resp_buf Response
+ @param[in] resp_len Response buffer length
+ @return
+ QL_ERR_OK - successful
+ QL_ERR_INVALID_ARG - as defined
+ QL_ERR_UNKNOWN - unknown error, failed to connect to service
+ QL_ERR_SERVICE_NOT_READY - service is not ready, need to retry
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_nf_cmd_json(const char *cmd, char *resp_buf, int resp_len);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Register NF interface status change event event
+ @param[in] cb
+ @return
+ QL_ERR_OK - successful
+ QL_ERR_NOT_INIT - uninitialized
+ QL_ERR_SERVICE_NOT_READY - service is not ready
+ QL_ERR_INVALID_ARG - Invalid arguments
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_nf_set_interface_status_ind_cb(ql_nf_interface_status_ind_cb_f cb);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Registration server error callback. Currently, only if the server exits abnormally,
+ the callback function will be executed, and the error code is QL_ERR_ABORTED;
+ @param[in] cb Callback function
+ @return
+ QL_ERR_OK - successful
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_nf_set_service_error_cb(ql_nf_service_error_cb_f cb);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Deinitialize the data call service
+ @return
+ QL_ERR_OK - successful
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_nf_deinit(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/mbtk/include/ql_v2/ql_nslookup.h b/mbtk/include/ql_v2/ql_nslookup.h
new file mode 100755
index 0000000..9874c04
--- /dev/null
+++ b/mbtk/include/ql_v2/ql_nslookup.h
@@ -0,0 +1,30 @@
+/**
+ *@file quectel_nslookup.h
+ *@date 2017-07-05
+ *@author running.qian
+ *@brief Simple DNS Reslove
+ */
+#ifndef _QUECTEL_NSLOOKUP_H_
+#define _QUECTEL_NSLOOKUP_H_
+
+#include <arpa/inet.h>
+
+typedef enum {
+ QUERY_IPV4_E,
+ QUERY_IPV6_E
+} QUERY_IP_TYPE;
+
+
+typedef struct {
+ int addr_cnt;//must be set 0 when call QL_nslookup
+ struct in_addr addr[5];
+
+ int addr6_cnt;//must be set 0 when call QL_nslookup
+ struct in6_addr addr6[5];
+} hostaddr_info_u;
+
+/**
+ * Perform a DNS query by sending a packet
+ */
+void ql_nslookup(char *host, char *dns_server_ip, QUERY_IP_TYPE ip_type, hostaddr_info_u *resolved_addr);
+#endif
diff --git a/mbtk/include/ql_v2/ql_nw.h b/mbtk/include/ql_v2/ql_nw.h
new file mode 100755
index 0000000..d0504e0
--- /dev/null
+++ b/mbtk/include/ql_v2/ql_nw.h
@@ -0,0 +1,885 @@
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @file ql_nw.h
+ @brief network registration API
+*/
+/*-----------------------------------------------------------------------------------------------*/
+
+/*-------------------------------------------------------------------------------------------------
+ Copyright (c) 2024 mobiletek Wireless Solution, Co., Ltd. All Rights Reserved.
+ mobiletek 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
+ -------- --------- -----------------------------------------------------------------
+ 20241022 yq.wang Created .
+-------------------------------------------------------------------------------------------------*/
+
+
+#ifndef __QL_NW_H__
+#define __QL_NW_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#define QL_NW_MODE_NONE 0x00 /**< No network. */
+#define QL_NW_MODE_GSM 0x01 /**< Include GSM networks. */
+#define QL_NW_MODE_WCDMA 0x02 /**< Include WCDMA networks. */
+#define QL_NW_MODE_CDMA 0x04 /**< Include CDMA networks. */
+#define QL_NW_MODE_EVDO 0x08 /**< Include EVDO networks. */
+#define QL_NW_MODE_LTE 0x10 /**< Include LTE networks. */
+#define QL_NW_MODE_TDSCDMA 0x20 /**< Include TDSCDMA networks. */
+#define QL_NW_MODE_NR5G 0x40 /**< Include NR5G networks. */
+#define QL_NW_MODE_PRL 0x10000 /**< Give preference according to the preferred roaming list. */
+
+#define QL_NW_NR5G_SO_NONE 0X00 /**< No service option */
+#define QL_NW_NR5G_SO_TDD 0X01 /**< Include service option TDD, Time Division Duplex */
+#define QL_NW_NR5G_SO_SUB6 0X02 /**< Include service option SUB6, 5G frequency, SUB_6GHz */
+#define QL_NW_NR5G_SO_MMWAVE 0X04 /**< Include service option MMWARE, 5G frequency, 30~300GHz */
+#define QL_NW_NR5G_SO_NSA 0X08 /**< Include service option NSA, Non_Stand Alone, 5G base station and 4G core network */
+#define QL_NW_NR5G_SO_SA 0X10 /**< Include service option SA, Stan Alone, 5G base station and 5G core network */
+
+#define QL_NW_LOWER_POWER_MASK_DISABLE 0x00
+#define QL_NW_LOWER_POWER_MASK_NORMAL 0x01
+#define QL_NW_LOWER_POWER_MASK_NETWORK 0x02
+#define QL_NW_LOWER_POWER_MASK_SIM 0x04
+#define QL_NW_LOWER_POWER_MASK_SMS 0x08
+#define QL_NW_LOWER_POWER_MASK_VOICE 0x10
+
+#define QL_NW_NITZ_BUF_LEN 30
+#define QL_NW_SCAN_MAX_LIST_NUM 40
+#define QL_NW_MAX_GSM_CELL_INFO_NUM 20
+#define QL_NW_MAX_UMTS_CELL_INFO_NUM 20
+#define QL_NW_MAX_LTE_CELL_INFO_NUM 20
+
+#define QL_NW_MAX_WEA_ALERT_LENGTH_V01 512
+#define QL_NW_MAX_ETWS_ALERT_LENGTH_V01 256
+
+typedef enum QL_NW_SIGNAL_STRENGTH_LEVEL_ENUM
+{
+ QL_NW_SIGNAL_STRENGTH_LEVEL_MIN = -1,
+ QL_NW_SIGNAL_STRENGTH_LEVEL_NONE = 0, /**< none or unknown signal strength level */
+ QL_NW_SIGNAL_STRENGTH_LEVEL_POOR = 1, /**< poor signal strength level */
+ QL_NW_SIGNAL_STRENGTH_LEVEL_MODERATE = 2, /**< moderate signal strength level */
+ QL_NW_SIGNAL_STRENGTH_LEVEL_GOOD = 3, /**< good signal strength level */
+ QL_NW_SIGNAL_STRENGTH_LEVEL_GREAT = 4, /**< great signal strength level */
+ QL_NW_SIGNAL_STRENGTH_LEVEL_MAX
+}QL_NW_SIGNAL_STRENGTH_LEVEL_E;
+
+typedef enum QL_NW_ROAM_STATE_TYPE_ENUM
+{
+ QL_NW_ROAM_STATE_OFF = 0, /**< None, or roaming indicator off. */
+ QL_NW_ROAM_STATE_ON = 1 /**< Roaming indicator on. */
+}QL_NW_ROAM_STATE_TYPE_E;
+
+typedef enum QL_NW_NETWORK_STATUS_TYPE_ENUM
+{
+ QL_NW_NETWORK_STATUS_NONE = 0, /**< Network status not available. */
+ QL_NW_NETWORK_STATUS_CURRENT_SERVING = 1, /**< Current serving network. */
+ QL_NW_NETWORK_STATUS_PREFERRED = 2, /**< Preferred network. */
+ QL_NW_NETWORK_STATUS_NOT_PREFERRED = 3, /**< Not the preferred network. */
+ QL_NW_NETWORK_STATUS_AVAILABLE = 4, /**< Service available. */
+ QL_NW_NETWORK_STATUS_FORBIDDEN = 5 /**< Forbidden service. */
+}QL_NW_NETWORK_STATUS_TYPE_E;
+
+typedef enum QL_NW_RADIO_TECH_TYPE_ENUM
+{
+ QL_NW_RADIO_TECH_TD_SCDMA = 1,
+ QL_NW_RADIO_TECH_GSM = 2, /**< GSM; only supports voice. */
+ QL_NW_RADIO_TECH_HSPAP = 3, /**< HSPA+. */
+ QL_NW_RADIO_TECH_LTE = 4, /**< LTE. */
+ QL_NW_RADIO_TECH_EHRPD = 5, /**< EHRPD. */
+ QL_NW_RADIO_TECH_EVDO_B = 6, /**< EVDO B. */
+ QL_NW_RADIO_TECH_HSPA = 7, /**< HSPA. */
+ QL_NW_RADIO_TECH_HSUPA = 8, /**< HSUPA. */
+ QL_NW_RADIO_TECH_HSDPA = 9, /**< HSDPA. */
+ QL_NW_RADIO_TECH_EVDO_A = 10, /**< EVDO A. */
+ QL_NW_RADIO_TECH_EVDO_0 = 11, /**< EVDO 0. */
+ QL_NW_RADIO_TECH_1xRTT = 12, /**< 1xRTT. */
+ QL_NW_RADIO_TECH_IS95B = 13, /**< IS95B. */
+ QL_NW_RADIO_TECH_IS95A = 14, /**< IS95A. */
+ QL_NW_RADIO_TECH_UMTS = 15, /**< UMTS. */
+ QL_NW_RADIO_TECH_EDGE = 16, /**< EDGE. */
+ QL_NW_RADIO_TECH_GPRS = 17, /**< GPRS. */
+ QL_NW_RADIO_TECH_NR5G = 18, /**< NR5G. */
+ QL_NW_RADIO_TECH_NONE = 19 /**< No technology selected. */
+}QL_NW_RADIO_TECH_TYPE_E;
+
+typedef enum QL_NW_TECH_DOMAIN_TYPE_ENUM
+{
+ QL_NW_TECH_DOMAIN_NONE = 0, /**< None. */
+ QL_NW_TECH_DOMAIN_3GPP = 1, /**< 3GPP. */
+ QL_NW_TECH_DOMAIN_3GPP2 = 2, /**< 3GPP2. */
+}QL_NW_TECH_DOMAIN_TYPE_E;
+
+typedef enum QL_NW_DENY_REASON_TYPE_ENUM
+{
+ QL_NW_IMSI_UNKNOWN_IN_HSS_DENY_REASON = 2, /**< IMSI unknown in HSS */
+ QL_NW_ILLEGAL_UE_DENY_REASON = 3, /**< Illegal UE */
+ QL_NW_IMEI_NOT_ACCEPTED_DENY_REASON = 5, /**< IMEI not accepted */
+ QL_NW_ILLEGAL_ME_DENY_REASON = 6, /**< Illegal ME */
+ QL_NW_EPS_SERVICES_NOT_ALLOWED_DENY_REASON = 7, /**< EPS services not allowed */
+ QL_NW_EPS_SERVICES_AND_NON_EPS_SERVICES_NOT_ALLOWED_DENY_REASON = 8, /**< EPS services and non-EPS services not allowed */
+ QL_NW_UE_ID_CANNOT_BE_DERIVED_BY_THE_NETWORK_DENY_REASON = 9, /**< UE identifity cannot be derived by the network */
+ QL_NW_IMPLICITY_DETACHED_DENY_REASON = 10, /**< Implicitly detached */
+ QL_NW_PLMN_NOT_ALLOWED_DENY_REASON = 11, /**< PLMN not allowed */
+ QL_NW_TRACKING_AREA_NOT_ALLOWED_DENY_REASON = 12, /**< Tracking area not allowed */
+ QL_NW_ROAMING_NOT_ALLOWED_IN_THIS_TRACNING_AREA_DENY_REASON = 13, /**< Roaming not allowed in this tracking area */
+ QL_NW_EPS_SERVICES_NOT_ALLOWED_IN_THIS_PLMN_DENY_REASON = 14, /**< EPS services not allowed in this PLMN */
+ QL_NW_NO_SUITALBE_CELLS_IN_TRACKING_AREA_DENY_REASON = 15, /**< No suitable cells in tracking area */
+ QL_NW_MSC_TEMPORARILY_NOT_REACHABLE_DENY_REASON = 16, /**< MSC temporarily not reachable */
+ QL_NW_NETWORK_FAILURE_DENY_REASON = 17, /**< Network failure */
+ QL_NW_CS_DOMAIN_NOT_AVAILABLE_DENY_REASON = 18, /**< CS domain not available */
+ QL_NW_EMS_FAILURE_DENY_REASON = 19, /**< ESM failure */
+ QL_NW_MAC_FAILURE_DENY_REASON = 20, /**< MAC failure */
+ QL_NW_SYNC_FAILURE_DENY_REASON = 21, /**< Synch failure */
+ QL_NW_CONGESTION_DENY_REASON = 22, /**< Congestion */
+ QL_NW_UE_SECURITY_CAPABILITIES_MISMATCH_DENY_REASON = 23, /**< UE security capabilities mismatch */
+ QL_NW_SECURITY_MODE_REJECTED_DENY_REASON = 24, /**< Security mode rejected, unspecified */
+ QL_NW_NOT_AUTHORIZED_FOR_THIS_CSG_DENY_REASON = 25, /**< Not authorized for this CSG */
+ QL_NW_NON_EPS_AUTHENTICATION_UNCACCEPTABLE_DENY_REASON = 26, /**< Non-EPS authentication unacceptable */
+ QL_NW_REQUESTED_SERVICE_OPTION_NOT_AUTHORIZED_IN_THIS_PLMN_DENY_REASON = 35, /**< Requested service option not authorized in this PLMN */
+ QL_NW_CS_SERVICE_TEMPORARILY_NOT_AVAILABLE_DENY_REASON = 39, /**< CS service temporarily not available */
+ QL_NW_NO_ESP_BEARER_CONTEXT_ACTIVATED_DENY_REASON = 40, /**< No EPS bearer context activated */
+ QL_NW_SEMAMTICALLY_INCORRECT_MESSAGE_DENY_REASON = 95, /**< Semantically incorrect message. */
+ QL_NW_INVALID_MANDATORY_INFORMATION_DENY_REASON = 96, /**< Invalid mandatory information. */
+ QL_NW_MESSAGE_TYPE_NON_EXISTENT_OR_NOT_IMPLEMENTED_DENY_REASON = 97, /**< Message type non-existent or not implemented. */
+ QL_NW_MESSAGE_TYPE_NOT_COMPATIBLE_WITH_PROTOCAL_STATE_DENY_REASON = 98, /**< Message type not compatible with protocol state. */
+ QL_NW_INFORMATION_ELEMENT_NON_EXISTENT_OR_NOT_IMPLEMENTED_DENY_REASON = 99, /**< Information element non-existent or not implemented. */
+ QL_NW_CONDITIONAL_IE_ERROR_DENY_REASON = 100, /**< Conditional IE error. */
+ QL_NW_MESSAGE_NOT_COMPATIBLE_WITH_PROTOCAL_STATE_DENY_REASON = 101, /**< Message not compatible with protocol state. */
+}QL_NW_DENY_REASON_TYPE_E;
+
+typedef enum QL_NW_SERVICE_TYPE_ENUM
+{
+ QL_NW_SERVICE_NONE = 0, /**< Not registered or no data. */
+ QL_NW_SERVICE_LIMITED = 1, /**< Registered; emergency service only. */
+ QL_NW_SERVICE_FULL = 2, /**< Registered, full service. */
+}QL_NW_SERVICE_TYPE_E;
+
+typedef enum QL_NW_SELECTION_TYPE_ENUM
+{
+ QL_NW_SELECTION_AUTOMATIC = 0, /**< Automatic network selection. */
+ QL_NW_SELECTION_MANUAL = 1, /**< Manual network selection. */
+}QL_NW_SELECTION_TYPE_E;
+
+typedef enum QL_NW_CELL_ACCESS_STATE_TYPE_ENUM
+{
+ QL_NW_CELL_ACCESS_NONE = 0, /**< Unknown cell access state. */
+ QL_NW_CELL_ACCESS_NORMAL_ONLY = 1, /**< Cell access is allowed for normal calls only. */
+ QL_NW_CELL_ACCESS_EMERGENCY_ONLY = 2, /**< Cell access is allowed for emergency calls only. */
+ QL_NW_CELL_ACCESS_NO_CALLS = 3, /**< Cell access is not allowed for any call type. */
+ QL_NW_CELL_ACCESS_ALL_CALLS = 4, /**< Cell access is allowed for all call types. */
+}QL_NW_CELL_ACCESS_STATE_TYPE_E;
+
+/** wea config items */
+typedef enum
+{
+ QL_NW_WEA_CONFIG_PRESIDENTIAL_ALERT = (1 << 0),
+ QL_NW_WEA_CONFIG_EXTREME_ALERT = (1 << 1),
+ QL_NW_WEA_CONFIG_SEVERE_ALERT = (1 << 2),
+ QL_NW_WEA_CONFIG_AMBER_ALERT = (1 << 3),
+ QL_NW_WEA_CONFIG_PUBLIC_SAFETY_ALERT = (1 << 4),
+ QL_NW_WEA_CONFIG_STATE_LOCAL_TEST_ALERT = (1 << 5),
+ QL_NW_WEA_CONFIG_RMT_ALERT = (1 << 6),
+ QL_NW_WEA_CONFIG_EXERCISE_ALERT = (1 << 7),
+ QL_NW_WEA_CONFIG_CMSP_DEFINED_ALERT = (1 << 8),
+ QL_NW_WEA_CONFIG_SPANISH_ALERT = (1 << 9),
+} QL_NW_WEA_CONFIG_E;
+
+/** bind subscription */
+typedef enum QL_NW_BIND_SUB_TYPE_ENUM
+{
+ QL_NW_BIND_SUB_PRIMARY = 0,
+ QL_NW_BIND_SUB_SECONDARY = 1,
+}QL_NW_BIND_SUB_TYPE_E;
+
+typedef struct
+{
+ uint64_t preferred_nw_mode; /**< Preferred network mode for connections; a bitmask of QL_NW_MODE_xxxx.*/
+ QL_NW_ROAM_STATE_TYPE_E preferred_roaming; /**< Roaming preference. 0 -- None, or roaming indicator off, 1 -- roaming indicator on*/
+}ql_nw_pref_nwmode_roaming_info_t;
+
+typedef struct
+{
+ char nitz_time[QL_NW_NITZ_BUF_LEN + 1]; /**< format: YY/MM/DD,HH:MM:SS'+/-'TZ,daylight, Here TZ multiplied by 4*/
+ uint64_t abs_time; /**< 0 means invalid */
+ int8_t leap_sec; /**< 0 means invalid */
+}ql_nw_nitz_time_info_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_nw_mobile_operator_name_info_t;
+
+typedef struct
+{
+ ql_nw_mobile_operator_name_info_t operator_name; /**< Operator name.*/
+ QL_NW_NETWORK_STATUS_TYPE_E network_status; /**< Network status.*/
+ QL_NW_RADIO_TECH_TYPE_E rat; /**< Radio technology.*/
+}ql_nw_scan_entry_info_t;
+
+typedef struct
+{
+ uint32_t entry_len; /**< Must be set to the number of elements in entry. */
+ ql_nw_scan_entry_info_t entry[QL_NW_SCAN_MAX_LIST_NUM]; /**< Scan entry.*/
+}ql_nw_scan_result_list_info_t;
+
+typedef struct
+{
+ QL_NW_TECH_DOMAIN_TYPE_E tech_domain; /**< Technology domain: 0 -- None, 1 -- 3GPP, 2 -- 3GPP2.*/
+ QL_NW_RADIO_TECH_TYPE_E radio_tech; /**< Radio technology; see #QL_NW_RADIO_TECH_TYPE_E.*/
+ QL_NW_ROAM_STATE_TYPE_E roaming; /**< 0 -- Off, 1 -- Roaming (3GPP2 has extended values).*/
+ QL_NW_DENY_REASON_TYPE_E deny_reason; /**< Set when registration state is #QL_NW_DENY_REASON_TYPE_E, please refer to 3GPP 24301 SPEC ANNEX A chapter*/
+ QL_NW_SERVICE_TYPE_E reg_state; /**< Registration state.*/
+ char mcc[3+1]; /**< Mobile country code.*/
+ char mnc[3+1]; /**< Mobile network code.*/
+ 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.*/
+ 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 */
+
+ uint16_t nr5g_svc_opt; /**< NR5G service option or type, defined by QL_NW_NR5G_SO_XXX */
+ uint16_t nr5g_pci; /**< NR5G physical Cell ID */
+ uint64_t nr5g_cid; /**< NR5G SA Cell ID */
+ uint32_t nr5g_tac; /**< NR5G tac info */
+
+ uint8_t endc_available; /**< EUTRA-NR Dual Connectivity */
+
+}ql_nw_reg_status_info_t;
+
+typedef struct
+{
+ QL_NW_SELECTION_TYPE_E 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.*/
+ QL_NW_RADIO_TECH_TYPE_E rat; /**< Radio technology.*/
+}ql_nw_pref_net_t;
+
+typedef struct
+{
+ int8_t rssi; /**< RSSI in dBm. Indicates received signal strength. A signed value; -125 or lower indicates no signal.*/
+}ql_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_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_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_nw_lte_signal_info_t;
+
+typedef struct
+{
+ int16_t rsrq; /**< Current RSRQ in dBm, as measured by L1.*/
+ 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_nw_nr5g_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_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_nw_hdr_signal_info_t;
+
+typedef struct
+{
+ uint8_t has_gsm; /**< Must be set to TRUE if gsm_sig_info is being passed. */
+ ql_nw_gsm_signal_info_t gsm; /**< GSM signal information. */
+ uint8_t has_wcdma; /**< Must be set to TRUE if wcdma_sig_info is being passed. */
+ ql_nw_wcdma_signal_info_t wcdma; /**< WCDMA signal information. */
+ uint8_t has_tdscdma; /**< Must be set to TRUE if tdscdma_sig_info is being passed. */
+ ql_nw_tdscdma_signal_info_t tdscdma; /**< TDSCDMA signal information. */
+ uint8_t has_lte; /**< Must be set to TRUE if lte_sig_info is being passed. */
+ ql_nw_lte_signal_info_t lte; /**< LTE signal information. */
+ uint8_t has_nr5g; /**< Must be set to TRUE if nr5g_sig_info is being passed. */
+ ql_nw_nr5g_signal_info_t nr5g; /**< NR5G signal information. */
+ uint8_t has_cdma; /**< Must be set to TRUE if cdma_sig_info is being passed. */
+ ql_nw_cdma_signal_info_t cdma; /**< CDMA signal information. */
+ uint8_t has_hdr; /**< Must be set to TRUE if hdr_sig_info is being passed. */
+ ql_nw_hdr_signal_info_t hdr; /**< HDR signal information. */
+}ql_nw_signal_strength_info_t;
+
+typedef struct
+{
+ uint32_t cid; /**< Cell ID, (0 indicates information is not represent).*/
+ char plmn[3]; /**< MCC/MNC inforamtion code.(This field should be ignored when cid is not present). */
+ uint16_t lac; /**< Location area code.(This field should be ignord when cid is not present). */
+ uint16_t arfcn; /**< Absolute RF channel number. */
+ uint8_t bsic; /**< Base station identity code. (0 indicates information is not present). */
+ int16_t rssi; /**< Received signal strength indicator in dBm.*/
+}ql_nw_gsm_info_t;;
+
+typedef struct
+{
+ uint32_t cid; /**< Cell ID (0 indicates information is not present). */
+ uint32_t lcid; /**< UTRAN Cell ID (0 indicates information is not present). */
+ char plmn[3]; /**< MCC/MNC information code.(This field should be ignored when cid is not present). */
+ uint16_t lac; /**< Location area code. (This field should be ignored when cid is not present). */
+ uint16_t uarfcn; /**< UTRA absolute RF channel number. */
+ uint16_t psc; /**< Primary scrambling code. */
+ int16_t rssi; /**< Received signal strength indicator in dBm.*/
+}ql_nw_umts_info_t;
+
+typedef struct
+{
+ uint32_t cid; /**< Global cell ID in the system information block (0 indicates information is not present). */
+ char plmn[3]; /**< MCC/MNC information code.(This filed should be ignored when cid is not present). */
+ uint16_t tac; /**< Tracing area code (This field should be ignored when cid is not present). */
+ uint16_t pci; /**< Physical cell ID. Range: 0 to 503. */
+ uint32_t earfcn; /**< E-UTRA absolute radio frequency channel number of the cell. RANGE: 0 TO 65535. */
+ int16_t rssi; /**< Received signal strength indicator in dBm.*/
+}ql_nw_lte_info_t;
+
+typedef struct {
+
+ uint64_t cid; /**< Global cell ID in the system information block (0 indicates information is not present). */
+ char plmn[3]; /**< MCC/MNC information coded(This field should be ignored when cid is not present.) */
+ uint32_t tac; /**< Tracking area code (This field should be ignored when cid is not present). */
+ uint16_t pci; /**< Physical cell ID. Range: 0 to 503.*/
+ uint32_t arfcn; /**< UTRA absolute radio frequency channel number of the cell. Range: 0 to 65535.*/
+ int16_t rsrq; /**< Current RSRQ in units of 0.1 dB, as measured by L1.*/
+ int16_t rsrp; /**< Current RSRP in units of 0.1 dB, as measured by L1.*/
+ int16_t snr; /**< Current SNR in dBm, as measured by L1.*/
+}ql_nw_nr5g_info_t;
+
+typedef struct
+{
+ uint16_t sid; /**< System ID. */
+ uint16_t nid; /**< Network ID. */
+ uint16_t bid; /**< Base station ID. */
+ uint16_t refpn; /**< Reference PN. */
+ uint32_t base_lat; /**< Latitude of the current base station in units of 0.25 sec. */
+ uint32_t base_long; /**< Longitude of the current base station in units of 0.25 sec. */
+ int16_t rssi; /**< Received signal strength indicator in dBm. */
+}ql_nw_cdma_info_t;
+
+typedef struct
+{
+ QL_NW_RADIO_TECH_TYPE_E serving_rat;
+ uint8_t gsm_info_valid; /**< Must be set to true if gsm_info is being passed */
+ uint8_t gsm_info_len; /**< Must be set to the number of elements in entry*/
+ ql_nw_gsm_info_t gsm_info[QL_NW_MAX_GSM_CELL_INFO_NUM]; /**< GSM cell information (Serving and neighbor. */
+ uint8_t umts_info_valid; /**< Must be set to true if umts_info is being passed */
+ uint8_t umts_info_len; /**< Must be set to the number of elements in entry*/
+ ql_nw_umts_info_t umts_info[QL_NW_MAX_UMTS_CELL_INFO_NUM];/**< UMTS cell information (Serving and neighbor). */
+ uint8_t lte_info_valid; /**< Must be set to true if lte_info is being passed */
+ uint8_t lte_info_len; /**< Must be set to the number of elements in entry*/
+ ql_nw_lte_info_t lte_info[QL_NW_MAX_LTE_CELL_INFO_NUM]; /**< LTE cell information (Serving and neighbor). */
+ uint8_t nr5g_info_valid; /**< Must be set to true if nr5g_info is being passed */
+ ql_nw_nr5g_info_t nr5g_info; /**< NR5G cell information (Serving). */
+ uint8_t cdma_info_valid; /**< Must be set to true if cdma_info is being passed */
+ ql_nw_cdma_info_t cdma_info; /**< CDMA cell information (Serving). */
+}ql_nw_cell_info_t;
+
+typedef struct
+{
+ uint8_t Presidential_alert; /**< Enable Presidential_alert: 0 -- Disable(can't Disable); 1 -- Enable */
+ uint8_t Extreme_alert; /**< Enable or disable Extreme_alert: 0 -- Disable; 1 -- Enable */
+ uint8_t Severe_alert; /**< Enable or disable Severe_alert: 0 -- Disable; 1 -- Enable */
+ uint8_t Amber_alert; /**< Enable or disable Amber_alert: 0 -- Disable; 1 -- Enable */
+ uint8_t PublicSafety_alert; /**< Enable or disable PublicSafety_alert: 0 -- Disable; 1 -- Enable */
+ uint8_t StateLocalTest_alert; /**< Enable or disable StateLocalTest_alert: 0 -- Disable; 1 -- Enable */
+ uint8_t RMT_alert; /**< Enable or disable RMT_alert: 0 -- Disable; 1 -- Enable */
+ uint8_t Exercise_alert; /**< Enable or disable Exercise_alert: 0 -- Disable; 1 -- Enable */
+ uint8_t CMSPDefined_alert; /**< Enable or disable CMSPDefined_alert: 0 -- Disable; 1 -- Enable */
+ uint8_t Spanish_alert; /**< Enable or disable Spanish_alert: 0 -- Disable; 1 -- Enable */
+}ql_nw_wea_config_t;
+
+typedef struct
+{
+ uint8_t wea_alert_info_valid;
+ char wea_alert_info[QL_NW_MAX_WEA_ALERT_LENGTH_V01];
+}ql_nw_wea_alert_info_t;
+
+typedef struct
+{
+ uint8_t etws_primary_info_valid;
+ char etws_primary_info[QL_NW_MAX_ETWS_ALERT_LENGTH_V01];
+ uint8_t etws_secondary_info_valid;
+ char etws_secondary_info[QL_NW_MAX_ETWS_ALERT_LENGTH_V01];
+}ql_nw_etws_alert_info_t;
+
+typedef void (*ql_nw_voice_reg_ind_cb)(ql_nw_reg_status_info_t *p_info);
+
+typedef void (*ql_nw_data_reg_ind_cb)(ql_nw_reg_status_info_t *p_info);
+
+typedef void (*ql_nw_signal_strength_ind_cb)(ql_nw_signal_strength_info_t *p_info, QL_NW_SIGNAL_STRENGTH_LEVEL_E level);
+
+typedef void (*ql_nw_cell_access_status_ind_cb)(QL_NW_CELL_ACCESS_STATE_TYPE_E status);
+
+typedef void (*ql_nw_nitz_time_update_ind_cb)(ql_nw_nitz_time_info_t *p_info);
+
+typedef void (*ql_nw_network_scan_async_cb)(int async_index, ql_nw_scan_result_list_info_t *p_info);
+
+typedef void (*ql_nw_wea_reg_ind_cb)(ql_nw_wea_alert_info_t *p_info);
+
+typedef void (*ql_nw_etws_reg_ind_cb)(ql_nw_etws_alert_info_t *p_info);
+
+typedef void (*ql_nw_service_error_cb_f)(int error);
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Initialize NW service.
+ @note You must call this function before other functions can be used in this module.
+ @return Whether the NW service was successfully intialized.
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_nw_init(void);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Deinitializes NW service.
+ @return Whether the NW service was deinitialized successfully.
+ @retval QL_ERR_OK successful.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_nw_deinit(void);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief scan network status.
+ @param[out] async_index The index of request msg
+ @param[in] async_cb The callback function of request msg
+ @return Whether to successfully trigger the network scan operation
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_nw_network_scan(int *async_index, ql_nw_network_scan_async_cb async_cb);
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief set power mode.
+ @param[in] lower_mode, defined by QL_NW_LOWER_POWER_MASK_XXX
+ @return Whether to successfully set the power mode
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_nw_set_power_mode(uint8_t lower_mode);
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief set perferred NW mode and roaming indicator.
+ @param[in] p_info Pointer that point to ql_nw_pref_nwmode_roaming_info_t
+ @return Whether to successfully set nwmode and roaming
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_nw_set_pref_nwmode_roaming(ql_nw_pref_nwmode_roaming_info_t *p_info);
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief get perferred NW mode and roaming indicator.
+ @param[out] p_info Pointer that point to ql_nw_pref_nwmode_roaming_info_t
+ @return Whether to successfully get nwmode and roaming
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_nw_get_pref_nwmode_roaming(ql_nw_pref_nwmode_roaming_info_t *p_info);
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief get mobile operator name.
+ @param[out] p_info Pointer that point to ql_nw_mobile_operator_name_info_t
+ @return Whether to successfully get the mobile operator name
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_nw_get_mobile_operator_name(ql_nw_mobile_operator_name_info_t *p_info);
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief get cell information.
+ @param[out] p_info Pointer that point to ql_nw_cell_info_t
+ @return Whether to successfully get the cell information
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_nw_get_cell_info(ql_nw_cell_info_t *p_info);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief get voice registration status.
+ @param[out] p_info Pointer that point to ql_nw_reg_status_info_t
+ @return Whether to successfully get the voice registration status
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_nw_get_voice_reg_status(ql_nw_reg_status_info_t *p_info);
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief get data registration status.
+ @param[out] p_info Pointer that point to ql_nw_reg_status_info_t
+ @return Whether to successfully get the data registration status
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_nw_get_data_reg_status(ql_nw_reg_status_info_t *p_info);
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief get current signal strength.
+ @param[out] p_info Pointer that point to ql_nw_signal_strength_info_t
+ @param[out] p_level: signal strength level
+ @return Whether to successfully get the signal strength
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_nw_get_signal_strength(ql_nw_signal_strength_info_t *p_info, QL_NW_SIGNAL_STRENGTH_LEVEL_E* p_level);
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief get current cell acccess status.
+ @param[out] p_info Pointer that point to QL_NW_CELL_ACCESS_STATE_TYPE_E
+ @return Whether to successfully get the cell access status
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_nw_get_cell_access_status(QL_NW_CELL_ACCESS_STATE_TYPE_E *p_info);
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief get network time.
+ @param[out] p_info Pointer that point to ql_nw_nitz_time_info_t
+ @return Whether to successfully get the network time
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_nw_get_nitz_time_info(ql_nw_nitz_time_info_t *p_info);
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief register voice registration event.
+ @param[in] cb_func Voice registration indication callback function
+ @return Whether the voice registration event was successfully registered.
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_nw_set_voice_reg_ind_cb(ql_nw_voice_reg_ind_cb cb_func);
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief register data registration event.
+ @param[in] cb_func Data registration indication callback function
+ @return Whether the data registration event was successfully registered.
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_nw_set_data_reg_ind_cb(ql_nw_data_reg_ind_cb cb_func);
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief register signal strength event.
+ @param[in] cb_func Signal strength indication callback function
+ @return Whether the signal strength event was successfully registered
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_nw_set_signal_strength_ind_cb(ql_nw_signal_strength_ind_cb cb_func);
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief register cell access status event.
+ @param[in] cb_func Cell access status indication callback function
+ @return Whether the cell access status event was successfully registered
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_nw_set_cell_access_status_ind_cb(ql_nw_cell_access_status_ind_cb cb_func);
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief register network time event.
+ @param[in] cb_func nitz time update indication callback function
+ @return Whether the network time event was successfully registered
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_nw_set_nitz_time_update_ind_cb(ql_nw_nitz_time_update_ind_cb cb_func);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief register wea alert event.
+ @param[in] cb_func wea alert indication callback function
+ @return Whether the network time event was successfully registered
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_nw_set_wea_alert_ind_cb(ql_nw_wea_reg_ind_cb cb_func);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief register etws alert event.
+ @param[in] cb_func etws alert indication callback function
+ @return Whether the network time event was successfully registered
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_nw_set_etws_alert_ind_cb(ql_nw_etws_reg_ind_cb cb_func);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief set wea alert config.
+ @param[in] item Items to set.
+ @param[in] p_info Pointer that point to ql_nw_wea_config_t.
+ @return Whether to successfully set the wea config.
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_nw_set_wea_config(int item, ql_nw_wea_config_t *p_info);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Gets wea config.
+ @param[out] p_config wea config.
+ @return Whether the wea config was successfully obtained.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_INVALID_ARG invalid argument.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_nw_get_wea_config(ql_nw_wea_config_t *p_config);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief set etws alert config.
+ @param[in] etws config.
+ @return Whether to successfully set the etws config.
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_nw_set_etws_config(uint8_t enable_etws);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief get etws alert config.
+ @param[out] p_enable_etws Pointer.
+ @return Whether to successfully set the etws config.
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_nw_get_etws_config(uint8_t* p_enable_etws);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief bind subscription
+ @param[in] sub_type subscription type
+ @return Whether to successfully bind subscription.
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_nw_bind_subscription(QL_NW_BIND_SUB_TYPE_E sub_type);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief get high capability subscription.
+ @param[out] p_high_cap pointer that point to QL_NW_BIND_SUB_TYPE_E
+ @return Whether the high capability subscription was successfully obtained.
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_nw_get_high_cap_sub(QL_NW_BIND_SUB_TYPE_E *p_high_cap);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief set the SIM card index that can uniquely register to the 5G network.
+ the main difference between high and non-high capability subscription is that high capability
+ subscription can register to 5G network while non-high capability subscription can only
+ register to LTE or GSM.
+ @param[in] high_cap high capability subscription
+ @return Whether to successfully set the high capability subscription.
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_nw_set_high_cap_sub(QL_NW_BIND_SUB_TYPE_E high_cap);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Disable NR5G, NR5G_SA and NR5G_NSA can be disabled individually or together.
+ @param[in] opt_mask Option mask value. Value:
+ 0 - Do not disable NR5G
+ QL_NW_NR5G_SO_SA - Disable NR5G SA
+ QL_NW_NR5G_SO_NSA - Disable NR5G NSA
+ @return Whether to successfully disable NR5G mode.
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_NOT_INIT uninitialized
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready
+ @retval QL_ERR_INVALID_ARG Invalid arguments
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_nw_disable_nr5g(uint16_t opt_mask);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Registration server error callback. Currently, only if the server exits abnormally,
+ the callback function will be executed, and the error code is QL_ERR_ABORTED;
+ @param[in] cb Callback function
+ @return
+ QL_ERR_OK - successful
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_nw_set_service_error_cb(ql_nw_service_error_cb_f cb);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/mbtk/include/ql_v2/ql_sim.h b/mbtk/include/ql_v2/ql_sim.h
new file mode 100755
index 0000000..bb9f471
--- /dev/null
+++ b/mbtk/include/ql_v2/ql_sim.h
@@ -0,0 +1,642 @@
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @file ql_sim.h
+ @brief SIM service API
+*/
+/*-----------------------------------------------------------------------------------------------*/
+
+/*-------------------------------------------------------------------------------------------------
+ Copyright (c) 2024 mobiletek Wireless Solution, Co., Ltd. All Rights Reserved.
+ mobiletek 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
+ -------- --------- -----------------------------------------------------------------
+ 20241022 yq.wang Created .
+-------------------------------------------------------------------------------------------------*/
+
+#ifndef __QL_SIM_H__
+#define __QL_SIM_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+
+#define QL_SIM_IMSI_LENGTH 16 /**< Maximum length of IMSI data. */
+#define QL_SIM_ICCID_LENGTH 20 /**< Maximum length of ICCID data. */
+#define QL_SIM_PUK_LENGTH 8 /**< Maximum length of PUK data. */
+#define QL_SIM_NUM_OPERATOR_MAX 24 /**< Maximum number of operators */
+#define QL_SIM_PATH_MAX 20 /**< Maximum length of a full file path in ASCII format. */
+#define QL_SIM_DATA_MAX 4096 /**< Maximum size of data to be read/written. */
+#define QL_SIM_PIN_MAX 8 /**< Maximum length of PIN data. */
+#define QL_SIM_MAX_NUM_CARDS 2 /**< Maximum number of cards. */
+#define QL_SIM_PHONE_NUMBER_MAX 82 /**< Maximum phone number length. */
+#define QL_SIM_MCC_LENGHT 3 /**< Length of the MCC. */
+#define QL_SIM_MNC_MAX 3 /**< Maximum length of the MNC. */
+
+#define QL_SIM_PHONE_BOOK_NAME_MAX 15 /**< Maximum length of phone book user name. */
+#define QL_SIM_PHONE_BOOK_NUMBER_MAX 25 /**< Maximum length of phone book number. */
+
+#define QL_SIM_APDU_DATA_MAX 1024 /**< Maximum number of APDU data. */
+
+#define QL_SIM_PB_DEFAULT_PATH "3F007F106F3A" /**< Default phone book path. */
+
+/** Ligcial slot */
+/**> Currently only one active slot is supported, so slot should be always QL_SIM_SLOT_1.*/
+typedef enum
+{
+ QL_SIM_SLOT_INVALID = 0x000, /**< Invalid slot. */
+ QL_SIM_SLOT_1 = 0xB01, /**< Identify card in slot 1. */
+ QL_SIM_SLOT_2 = 0xB02, /**< Identify card in slot 2. */
+} QL_SIM_SLOT_E;
+
+/** Physical slot */
+typedef enum
+{
+ QL_SIM_PHY_SLOT_INVALID = 0x000, /**< Invalid slot. */
+ QL_SIM_PHY_SLOT_1 = 0xB01, /**< Identify card in slot 1. */
+ QL_SIM_PHY_SLOT_2 = 0xB02, /**< Identify card in slot 2. */
+} QL_SIM_PHY_SLOT_E;
+
+
+typedef enum
+{
+ QL_SIM_PIN_1 = 0xB01, /**< Level 1 user verification. */
+ QL_SIM_PIN_2 = 0xB02, /**< Level 2 user verification. */
+} QL_SIM_PIN_E;
+
+
+/** Application Type */
+typedef enum
+{
+ QL_SIM_APP_TYPE_UNKNOWN = 0xB00, /**< Unknown application type */
+ QL_SIM_APP_TYPE_3GPP = 0xB01, /**< Identify the SIM/USIM application on the card. */
+ QL_SIM_APP_TYPE_3GPP2 = 0xB02, /**< Identify the RUIM/CSIM application on the card. */
+ QL_SIM_APP_TYPE_ISIM = 0xB03, /**< Identify the ISIM application on the card. */
+} QL_SIM_APP_TYPE_E;
+
+typedef struct
+{
+ char mcc[QL_SIM_MCC_LENGHT]; /**< MCC value in ASCII characters.*/
+ uint8_t mnc_len; /**< The number of elements in the MNC, 2 or 3. */
+ char mnc[QL_SIM_MNC_MAX]; /**< MNC value in ASCII characters.*/
+} ql_sim_operator_t;
+
+typedef struct
+{
+ int len; /**< Length of actual operators */
+ ql_sim_operator_t operators[QL_SIM_NUM_OPERATOR_MAX];
+} ql_sim_operator_list_t;
+
+typedef enum {
+ /** Card state unknown. */
+ QL_SIM_CARD_STATE_UNKNOWN = 0xB01,
+ /** Card is absent. */
+ QL_SIM_CARD_STATE_ABSENT = 0xB02,
+ /** Card is present. */
+ QL_SIM_CARD_STATE_PRESENT = 0xB03,
+ /** Unknown error state. */
+ QL_SIM_CARD_STATE_ERROR_UNKNOWN = 0xB04,
+ /** Power down. */
+ QL_SIM_CARD_STATE_ERROR_POWER_DOWN = 0xB05,
+ /** Poll error. */
+ QL_SIM_CARD_STATE_ERROR_POLL_ERROR = 0xB06,
+ /** Failed to receive an answer to reset. */
+ QL_SIM_CARD_STATE_ERROR_NO_ATR_RECEIVED = 0xB07,
+ /** Voltage mismatch. */
+ QL_SIM_CARD_STATE_ERROR_VOLT_MISMATCH = 0xB08,
+ /** Parity error. */
+ QL_SIM_CARD_STATE_ERROR_PARITY_ERROR = 0xB09,
+ /** Card returned technical problems. */
+ QL_SIM_CARD_STATE_ERROR_SIM_TECHNICAL_PROBLEMS = 0xB0A,
+} QL_SIM_CARD_STATE_E; /**< Card state. */
+
+typedef enum {
+ QL_SIM_SUBSCRIPTION_NONE = 0xB00, /**< Nonprovisioning. */
+ QL_SIM_SUBSCRIPTION_PRI = 0xB01, /**< Primary provisioning subscription. */
+ QL_SIM_SUBSCRIPTION_SEC = 0xB02, /**< Secondary provisioning subscription. */
+} QL_SIM_SUBSCRIPTION_E;
+
+typedef enum
+{
+ QL_SIM_CARD_TYPE_UNKNOWN = 0xB00, /**< Unidentified card type. */
+ QL_SIM_CARD_TYPE_ICC = 0xB01, /**< Card of SIM or RUIM type. */
+ QL_SIM_CARD_TYPE_UICC = 0xB02, /**< Card of USIM or CSIM type. */
+} QL_SIM_CARD_TYPE_E;
+
+typedef enum {
+ QL_SIM_APP_STATE_UNKNOWN = 0xB00, /**< Application state unknown. */
+ QL_SIM_APP_STATE_DETECTED = 0xB01, /**< Detected state. */
+ QL_SIM_APP_STATE_PIN1_REQ = 0xB02, /**< PIN1 required. */
+ QL_SIM_APP_STATE_PUK1_REQ = 0xB03, /**< PUK1 required. */
+ QL_SIM_APP_STATE_INITALIZATING = 0xB04, /**< Initializing. */
+ QL_SIM_APP_STATE_PERSO_CK_REQ = 0xB05, /**< Personalization control key required. */
+ QL_SIM_APP_STATE_PERSO_PUK_REQ = 0xB06, /**< Personalization unblock key required. */
+ QL_SIM_APP_STATE_PERSO_PERMANENTLY_BLOCKED = 0xB07, /**< Personalization is permanently blocked. */
+ QL_SIM_APP_STATE_PIN1_PERM_BLOCKED = 0xB08, /**< PIN1 is permanently blocked. */
+ QL_SIM_APP_STATE_ILLEGAL = 0xB09, /**< Illegal application state. */
+ QL_SIM_APP_STATE_READY = 0xB0A, /**< Application ready state. */
+} QL_SIM_APP_STATE_E;
+
+typedef enum {
+ /** Unknown personalization feature. */
+ QL_SIM_PERSO_FEATURE_UNKNOWN = 0xB00,
+ /** Featurization based on 3GPP MCC and MNC. */
+ QL_SIM_PERSO_FEATURE_3GPP_NETWORK = 0xB01,
+ /** Featurization based on 3GPP MCC, MNC, and IMSI digits 6 and 7. */
+ QL_SIM_PERSO_FEATURE_3GPP_NETWORK_SUBSET = 0xB02,
+ /** Featurization based on 3GPP MCC, MNC, and GID1. */
+ QL_SIM_PERSO_FEATURE_3GPP_SERVICE_PROVIDER = 0xB03,
+ /** Featurization based on 3GPP MCC, MNC, GID1, and GID2. */
+ QL_SIM_PERSO_FEATURE_3GPP_CORPORATE = 0xB04,
+ /** Featurization based on the 3GPP IMSI. */
+ QL_SIM_PERSO_FEATURE_3GPP_SIM = 0xB05,
+ /** Featurization based on 3GPP2 MCC and MNC. */
+ QL_SIM_PERSO_FEATURE_3GPP2_NETWORK_TYPE_1 = 0xB06,
+ /** Featurization based on 3GPP2 IRM code. */
+ QL_SIM_PERSO_FEATURE_3GPP2_NETWORK_TYPE_2 = 0xB07,
+ /** Featurization based on 3GPP2 IMSI_M. */
+ QL_SIM_PERSO_FEATURE_3GPP2_RUIM = 0xB08,
+} QL_SIM_PERSO_FEATURE_E;
+
+typedef enum {
+ /** Unknown PIN state. */
+ QL_SIM_PIN_STATE_UNKNOWN = 0xB01,
+ /** PIN required, but has not been verified. */
+ QL_SIM_PIN_STATE_ENABLED_NOT_VERIFIED = 0xB02,
+ /** PIN required and has been verified. */
+ QL_SIM_PIN_STATE_ENABLED_VERIFIED = 0xB03,
+ /** PIN not required. */
+ QL_SIM_PIN_STATE_DISABLED = 0xB04,
+ /** PIN verification has failed too many times and is blocked. Recoverable through PUK verification. */
+ QL_SIM_PIN_STATE_BLOCKED = 0xB05,
+ /** PUK verification has failed too many times and is not recoverable. */
+ QL_SIM_PIN_STATE_PERMANENTLY_BLOCKED = 0xB06,
+ } QL_SIM_PIN_STATE_E;
+
+typedef struct {
+ /** Type of subscription (i.e., primary, secondary, etc.). */
+ QL_SIM_SUBSCRIPTION_E subscription; /**nonsupport*/
+ /** Current state of the application. */
+ QL_SIM_APP_STATE_E app_state;
+ /** Current personalization state and feature enabled. */
+ QL_SIM_PERSO_FEATURE_E perso_feature; /**nonsupport*/
+ /** Number of personalization retries. */
+ uint8_t perso_retries; /**nonsupport*/
+ /** Number of personalization unblock retries. */
+ uint8_t perso_unblock_retries; /**nonsupport*/
+ /** Current PIN 1 state. */
+ QL_SIM_PIN_STATE_E pin1_state; /**nonsupport*/
+ /** Number of PIN 1 retries. */
+ uint8_t pin1_num_retries;
+ /** Number of PUK 1 retries. */
+ uint8_t puk1_num_retries;
+ /** Current PIN 2 state. */
+ QL_SIM_PIN_STATE_E pin2_state; /**nonsupport*/
+ /** Number of PIN 2 retries. */
+ uint8_t pin2_num_retries;
+ /** Number of PUK 2 retries. */
+ uint8_t puk2_num_retries;
+}ql_sim_app_info_t; /* Type */
+
+typedef struct
+{
+ QL_SIM_CARD_STATE_E state;
+ QL_SIM_CARD_TYPE_E type;
+ ql_sim_app_info_t app_3gpp; /**< Stores 3GPP application information. */
+ ql_sim_app_info_t app_3gpp2; /**< Stores 3GPP2 application information. */
+ ql_sim_app_info_t app_isim; /**< Stores ISIM application information. */
+} ql_sim_card_info_t;
+
+typedef struct {
+ uint32_t path_len; /**< Must be set to the number of elements in the path. */
+ char path[QL_SIM_PATH_MAX]; /**< File path in ASCII characters. */
+ /** Offset is only required for write transparent file access where data length is indicated.*/
+ uint16_t offset;
+ /** Index of records involved in file access. A record index of 0 indicates transparent file access.*/
+ uint8_t record_idx;
+
+ /* == filled by caller when writing file == */
+ uint32_t data_len; /**< When reading file, it's the length of file data been read.
+ When writing file, it's the length of file data to be written. */
+ uint8_t data[QL_SIM_DATA_MAX];
+} ql_sim_file_t; /* Type */
+
+typedef enum {
+ QL_SIM_FILE_TYPE_UNKNOWN = 0xB00, /**< Unknown file type */
+ QL_SIM_FILE_TYPE_TRANSPARENT = 0xB01, /**< File structure consisting of a sequence of bytes. */
+ QL_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. */
+ QL_SIM_FILE_TYPE_LINEAR_FIXED = 0xB03, /**< File structure consisting of a sequence of records,
+ each containing the same fixed size. */
+} QL_SIM_FILE_TYPE_E;
+
+
+typedef struct {
+ /* == filled by caller == */
+ uint32_t path_len; /**< Must be set to the number of elements in the path. */
+ char path[QL_SIM_PATH_MAX]; /**< File path in ASCII characters. */
+
+ /* == filled by callee == */
+ QL_SIM_FILE_TYPE_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_sim_file_info_t; /* Type */
+
+typedef struct
+{
+ /** User name. Null-terminated */
+ char name[QL_SIM_PHONE_BOOK_NAME_MAX];
+ /** Phone number, a '+' can also be preappended to the number. Null-terminated. */
+ char number[QL_SIM_PHONE_BOOK_NUMBER_MAX];
+} ql_sim_phone_book_record_t;
+
+typedef struct
+{
+ uint32_t req_apdu_len; /**< Request APDU data length. */
+ uint8_t req_apdu[QL_SIM_APDU_DATA_MAX]; /**< Request APDU data. */
+
+ uint32_t resp_apdu_len; /**< Response APDU data length. */
+ uint8_t resp_apdu[QL_SIM_APDU_DATA_MAX]; /**< Response APDU data. */
+} ql_sim_apdu_t;
+
+typedef void (*ql_sim_card_status_cb_f)(QL_SIM_SLOT_E slot, ql_sim_card_info_t *p_info);
+
+typedef struct
+{
+ int active_slots_len;
+ QL_SIM_PHY_SLOT_E active_slots[QL_SIM_MAX_NUM_CARDS];
+} ql_sim_active_slots_t;
+
+typedef void (*ql_sim_service_error_cb_f)(int error);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Initializes SIM service.
+ @note You must call this function before other functions can be used in this module.
+ @return Whether the SIM service was intialized successfully.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_sim_init(void);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Deinitializes SIM service.
+ @return Whether the SIM service was deintialized successfully.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_sim_deinit(void);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Gets the IMSI (for 3GPP) or IMSI_M (for 3GPP2) from the SIM in ASCII form.
+ @param [in] slot Slot to be used.
+ @param [in] app_type Application type.
+ @param [out] imsi Buffer to fill IMSI data.
+ @param [in] imsi_len Buffer length.
+ @return Whether the IMSI was successfully obtained.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_sim_get_imsi(QL_SIM_SLOT_E slot, QL_SIM_APP_TYPE_E app_type, char *imsi, int imsi_len);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Retrieves the Integrated Circuit Card ID (ICCID) stored on the card.
+ @param [in] slot Slot to be used.
+ @param [out] iccid Buffer to fill ICCID data.
+ @param [in] iccid_len Buffer length.
+ @return Whether the ICCID was successfully obtained.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_sim_get_iccid(QL_SIM_SLOT_E slot, char *iccid, int iccid_len);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Retrieves the device phone number stored on the card.
+ @param [in] slot Slot to be used.
+ @param [in] app_type Application type.
+ @param [out] phone_num Buffer to fill phone number.
+ @param [in] phone_num_len Buffer length.
+ @return Whether the phone number was successfully retrieved.
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_sim_get_phone_num(QL_SIM_SLOT_E slot, QL_SIM_APP_TYPE_E app_type,
+ char *phone_num, int phone_num_len);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Retrieves the preferred operators stored on the card.
+ @param [in] slot Slot to be used.
+ @param [in] list Buffer to hold operators
+ @note This function is only supported by 3GPP applications.
+ @return Whether the preferred operators were successfully retrieved.
+ @retval QL_ERR_OK successful
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry
+ @retval Other error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_sim_get_operators(QL_SIM_SLOT_E slot, ql_sim_operator_list_t *list);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Enables the PIN on an application.
+ @param [in] slot Slot to be used.
+ @param [in] app_type Application type.
+ @param [in] pin PIN to be used.
+ @param [in] pin_value PIN value. NULL terminated.
+ @return Whether the PIN was successfully enabled.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_sim_enable_pin(QL_SIM_SLOT_E slot, QL_SIM_APP_TYPE_E app_type,
+ QL_SIM_PIN_E pin, const char *pin_value);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Disables the PIN on an application.
+ @param [in] slot Slot to be used.
+ @param [in] app_type Application type.
+ @param [in] pin PIN to be used.
+ @param [in] pin_value PIN value. NULL terminated.
+ @return Whether the PIN was successfully disabled.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_sim_disable_pin(QL_SIM_SLOT_E slot, QL_SIM_APP_TYPE_E app_type,
+ QL_SIM_PIN_E pin, const char *pin_value);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Verifies the PIN value of an application.
+ @param [in] slot Slot to be used.
+ @param [in] app_type Application type.
+ @param [in] pin PIN to be used.
+ @param [in] pin_value PIN value. NULL terminated.
+ @note PIN must be enabled before calling this function.
+ @return Whether the PIN was successfully verified.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_sim_verify_pin(QL_SIM_SLOT_E slot, QL_SIM_APP_TYPE_E app_type,
+ QL_SIM_PIN_E pin, const char *pin_value);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Changes the PIN value of an application.
+ @param [in] slot Slot to be used.
+ @param [in] app_type Application type.
+ @param [in] pin PIN to be used.
+ @param [in] old_pin_value Old PIN value. NULL terminated.
+ @param [in] new_pin_value New PIN value. NULL terminated.
+ @return Whether the PIN was successfully changed.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_sim_change_pin(QL_SIM_SLOT_E slot, QL_SIM_APP_TYPE_E app_type,
+ QL_SIM_PIN_E pin, const char *old_pin_value, const char *new_pin_value);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Unblocks a blocked PIN using the PUK code.
+ @param [in] slot Slot to be used.
+ @param [in] app_type Application type.
+ @param [in] pin PIN to be used.
+ @param [in] puk_value PUK value. NULL terminated.
+ @param [in] pin_value New PIN value. NULL terminated.
+ @note The user must pass PUK1 to unblock PIN1 or PUK2 to unblock PIN2.
+ @return Whether the PIN was successfully unblocked.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_sim_unblock_pin(QL_SIM_SLOT_E slot, QL_SIM_APP_TYPE_E app_type,
+ QL_SIM_PIN_E pin, const char *puk_value, const char *pin_value);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Retrieves the card info stored on a card.
+ @param [in] slot Slot to be used.
+ @param [out] p_info Pointer of ql_sim_card_info_t.
+ @return Whether the card info was successfully retrieved.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_sim_get_card_info(QL_SIM_SLOT_E slot, ql_sim_card_info_t *p_info);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Reads data from a specific file on a specified application on the card.
+ @param [in] slot Slot to be used.
+ @param [in] app_type Application type.
+ @param [inout] p_file Pointer of ql_sim_file_t.
+ @return Whether the file was successfully read.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_sim_read_file(QL_SIM_SLOT_E slot, QL_SIM_APP_TYPE_E app_type, ql_sim_file_t *p_file);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Writes data to a specific file on a specified application on the card.
+ @param [in] slot Slot to be used.
+ @param [in] app_type Application type.
+ @param [in] p_file Pointer of ql_sim_file_t
+ @note The type of file is determined by the record number field,
+ which indicates a transparent file when zero and a record-based file otherwise.
+ @return Whether the file was successfully written.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_sim_write_file(QL_SIM_SLOT_E slot, QL_SIM_APP_TYPE_E app_type, ql_sim_file_t *p_file);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Retrieves the info of a specific file on a specified application on the card.
+ @param [in] slot Slot to be used.
+ @param [in] app_type Application type.
+ @param [inout] p_info Pointer of ql_sim_file_info_t.
+ @return Whether the file info was successfully retrieved.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_sim_get_file_info(QL_SIM_SLOT_E slot, QL_SIM_APP_TYPE_E app_type,
+ ql_sim_file_info_t *p_info);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Reads phone book on a specified application on the card.
+ @param [in] slot Slot to be used.
+ @param [in] app_type Spplication type.
+ @param [in] pb_path Phone book path. NULL terminated.
+ @param [in] record_idx Record index to read. Starts from 1.
+ @param [out] p_record Pointer of ql_sim_phone_book_record_t.
+ @return Whether the phone book record was successfully retrieved.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_sim_read_phone_book(QL_SIM_SLOT_E slot, QL_SIM_APP_TYPE_E app_type,
+ const char *pb_path, uint8_t record_idx,
+ ql_sim_phone_book_record_t *p_record);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Writes phone book on a specified application on the card.
+ @param [in] slot Slot to be used.
+ @param [in] app_type Application type.
+ @param [in] pb_path Phone book path. NULL terminated.
+ @param [in] record_idx Record index to write. Starts from 1.
+ @param [in] p_record Pointer of ql_sim_phone_book_record_t.
+ @note If p_record->name[0] = 0 and p_record->number[0] = 0, record will be deleted.
+ @return Whether the phone book record was successfully saved.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_sim_write_phone_book(QL_SIM_SLOT_E slot, QL_SIM_APP_TYPE_E app_type,
+ const char *pb_path, uint8_t record_idx,
+ ql_sim_phone_book_record_t *p_record);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Opens a logical channel on a UICC card.
+ @param [in] slot Slot to be used.
+ @param [out] channel_id Channel opened.
+ @return Whether the logical channel was successfully opened.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_sim_open_logical_channel(QL_SIM_SLOT_E slot, uint8_t *channel_id);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Closes a logical channel on a UICC card.
+ @param [in] slot Slot to be used.
+ @param [in] channel_id Channel to be closed.
+ @return Whether the logical channel was successfully closed.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_sim_close_logical_channel(QL_SIM_SLOT_E slot, uint8_t channel_id);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Sends an APDU to the card.
+ @param [in] slot Slot to be used.
+ @param [in] channel_id Channel to be used.
+ @param [inout] p_apdu Pointer of ql_sim_apdu_t.
+ @note You must call ql_sim_open_logical_channel before sending an APDU.
+ @return Whether the APDU was successfully sent.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_sim_send_apdu(QL_SIM_SLOT_E slot, uint8_t channel_id, ql_sim_apdu_t *p_apdu);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Sets SIM card status callback handler
+ @param[in] cb call back handler.
+ @return Whether the card status callback handler was successfully set.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_sim_set_card_status_cb(ql_sim_card_status_cb_f cb);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Switches slot.
+ @param [in] log_slot Logical slot to be switched.
+ @param [in] phy_slot Physical slot to be switched.
+ @return Whether the slot was successfully switched.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_sim_switch_slot(QL_SIM_SLOT_E log_slot, QL_SIM_PHY_SLOT_E phy_slot);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Gets active slots.
+ @param [Out] p_active_slots Active slots.
+ @return Whether the active slots were successfully obtained.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_sim_get_active_slots(ql_sim_active_slots_t *p_active_slots);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Registration server error callback. Currently, only if the server exits abnormally,
+ the callback function will be executed, and the error code is QL_ERR_ABORTED;
+ @param[in] cb Callback function
+ @return
+ QL_ERR_OK - successful
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_sim_set_service_error_cb(ql_sim_service_error_cb_f cb);
+
+//int ql_sim_switch_slot(QL_SIM_SLOT_E log_slot, QL_SIM_PHY_SLOT_E phy_slot);
+//int ql_sim_get_active_slots(ql_sim_active_slots_t *p_active_slots);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __QL_SIM_H__ */
+
diff --git a/mbtk/include/ql_v2/ql_sleep_wakelock.h b/mbtk/include/ql_v2/ql_sleep_wakelock.h
new file mode 100755
index 0000000..71e58ae
--- /dev/null
+++ b/mbtk/include/ql_v2/ql_sleep_wakelock.h
@@ -0,0 +1,33 @@
+#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_v2/ql_sms.h b/mbtk/include/ql_v2/ql_sms.h
new file mode 100755
index 0000000..df12ba8
--- /dev/null
+++ b/mbtk/include/ql_v2/ql_sms.h
@@ -0,0 +1,276 @@
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @file ql_sms.h
+ @brief SMS service API.
+*/
+/*-----------------------------------------------------------------------------------------------*/
+
+/*-------------------------------------------------------------------------------------------------
+ Copyright (c) 2019 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
+ -------- --- ----------------------------------------------------------
+ 20200107 solomon.cui Add GSM-7bit and ISO 8859-1 conversion.
+ 20191225 solomon.cui Modify fucntion description.
+ 20191017 solomon.cui Free async reponse not user data.
+ 20190815 solomon.cui Add service type for sending message.
+ 20190627 solomon.cui Support asynchronously send msg and pdu
+ 20190625 solomon.cui Convert timestamp frome hex to dec.
+ 20190614 solomon.cui Created .
+-------------------------------------------------------------------------------------------------*/
+#include <stdint.h>
+
+#define QL_SMS_MAX_SEND_MSG_LENGTH 1440 /**< Maximum length of an sending SMS (9*160). */
+#define QL_SMS_MAX_SEND_PDU_LENGTH 255 /**< Maximum length of an sms PDU. */
+#define QL_SMS_MAX_RECV_MSG_LENGTH 160 /**< Maximum length of an recv SMS. */
+#define QL_SMS_MAX_ADDR_LENGTH 252 /**< Maximum length of SCA addr. */
+
+/** The SMS message format. */
+typedef enum
+{
+ QL_SMS_MSG_FORMAT_GSM_7BIT = 0,
+ QL_SMS_MSG_FORMAT_BINARY_DATA = 1,
+ QL_SMS_MSG_FORMAT_UCS2 = 2,
+} QL_SMS_MSG_FORMAT_E;
+
+/** */
+typedef enum {
+ QL_SMS_PRIMARY_SUBSCRIPTION = 0,
+ QL_SMS_SECONDARY_SUBSCRIPTION = 1,
+} QL_SMS_SUBSCRIPTION_E;
+
+
+/** The SMS message structure. */
+typedef struct
+{
+ QL_SMS_MSG_FORMAT_E format;
+ char addr[QL_SMS_MAX_ADDR_LENGTH + 1]; /**< Source or destinamtion address. */
+ int content_size;
+ char content[QL_SMS_MAX_SEND_MSG_LENGTH];
+} ql_sms_msg_t;
+
+typedef struct
+{
+ uint8_t year; /**< Year. since 2000. e.g. 19 means 2019 */
+ uint8_t month; /**< Month.*/
+ uint8_t day; /**< Day.*/
+ uint8_t hours; /**< Hour. 00 ~ 23 */
+ uint8_t minutes; /**< Minutes.*/
+ uint8_t seconds; /**< Seconds.*/
+ /**
+ * The Time Zone indicates the difference, expressed in quarters of an hour,
+ * between the local time and GMT.
+ * */
+ uint8_t timezone;
+} ql_sms_timestamp_t;
+
+typedef struct
+{
+
+ uint8_t valid; /**< Indicate whether following is valid, 1 - valid; 0 - invalid; */
+ uint8_t total_seg; /**< The number of long message segment*/
+ uint8_t cur_seg_num; /**< Current number.*/
+ uint8_t ref_num; /**< reference number.*/
+} ql_sms_user_data_head_t;
+
+typedef void (*ql_sms_msg_async_cb_f)(int id, int result);
+typedef void (*ql_sms_msg_recv_cb_f)(ql_sms_msg_t *p_msg, ql_sms_timestamp_t *timestamp,
+ ql_sms_user_data_head_t *head);
+
+/** The SMS PDU format. */
+typedef enum
+{
+ QL_SMS_PDU_FORMAT_CDMA = 0,
+ QL_SMS_PDU_FORMAT_GW_PP = 6,
+} QL_SMS_PDU_FORMAT_E;
+
+/** The SMS PDU structure. */
+typedef struct
+{
+ QL_SMS_PDU_FORMAT_E format;
+ int content_size;
+ char content[QL_SMS_MAX_SEND_PDU_LENGTH];
+} ql_sms_pdu_t;
+
+
+typedef void (*ql_sms_pdu_async_cb_f)(int id, int result);
+typedef void (*ql_sms_pdu_recv_cb_f)(ql_sms_pdu_t *p_pdu);
+typedef void (*ql_sms_service_error_cb_f)(int error);
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Initializes SMS service.
+ @return Whether the SMS service was initialized successfully.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_sms_init(void);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Deinitializes SMS service.
+ @return Whether the SMS service was deinitialized successfully.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_sms_deinit(void);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Sets the service center address.
+ @param[in] addr service center address.
+ @param[in] len service center address length.
+ @return Whether the service center address was set successfully.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_INVALID_ARG invalid argument.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_sms_set_service_center_addr(char *addr, int len);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Gets the service center address.
+ @param[out] addr service center address.
+ @param[in] len service center address length.
+ @return Whether the service center address was successfully obtained.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_INVALID_ARG invalid argument.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_sms_get_service_center_addr(char *addr, int len);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Sends message synchronously.
+ @param[in] p_msg pointer to ql_sms_msg_t.
+ @return Whether the message was successfully sent synchronously.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_INVALID_ARG invalid argument.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_sms_send_msg(ql_sms_msg_t *p_msg);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Sends message asynchronously.
+ @param[in] p_msg pointer to ql_sms_msg_t
+ @param[out] id id for this async operation
+ @param[in] cb async callback
+ @return Whether the message was successfully sent asynchronously.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_INVALID_ARG invalid argument.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_sms_send_msg_async(ql_sms_msg_t *p_msg, int *id, ql_sms_msg_async_cb_f cb);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Sets SMS message reception callback hanlder.
+ @param[in] cb message reception callback handler.
+ @return Whether the message reception callback hanlder was set successfully.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_INVALID_ARG invalid argument.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_sms_set_msg_recv_cb(ql_sms_msg_recv_cb_f cb);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Sends PDU synchronously.
+ @param[in] p_pdu SMS PDU.
+ @return Whether the PDU was successfully sent synchronously.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_INVALID_ARG invalid argument.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_sms_send_pdu(ql_sms_pdu_t *p_pdu);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Sends PDU asynchronously.
+ @param[in] p_pdu sms pdu.
+ @param[out] id id for this async operation.
+ @param[in] cb async callback.
+ @return Whether the PDU was successfully sent asynchronously.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_INVALID_ARG invalid argument.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_sms_send_pdu_async(ql_sms_pdu_t *p_pdu, int *id, ql_sms_pdu_async_cb_f cb);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Sets SMS PDU reception callback hanlder.
+ @param[in] cb PDU reception callback handler.
+ @return Whether the PDU reception callback hanlder was set successfully.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_INVALID_ARG invalid argument.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_sms_set_pdu_recv_cb(ql_sms_pdu_recv_cb_f cb);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Registration server error callback. Currently, only if the server exits abnormally,
+ the callback function will be executed, and the error code is QL_ERR_ABORTED;
+ @param[in] cb Callback function
+ @return
+ QL_ERR_OK - successful
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_sms_set_service_error_cb(ql_sms_service_error_cb_f cb);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Binds the current control point to a specific subscription.
+ @param[in] sub Subscription type.
+ @return Whether the subscription was successfully bound.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_INVALID_ARG invalid argument.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_sms_bind_subscription(QL_SMS_SUBSCRIPTION_E sub);
+
+
diff --git a/mbtk/include/ql_v2/ql_test_utils.h b/mbtk/include/ql_v2/ql_test_utils.h
new file mode 100755
index 0000000..b62663e
--- /dev/null
+++ b/mbtk/include/ql_v2/ql_test_utils.h
@@ -0,0 +1,129 @@
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @file test_utils.h
+ @brief Test related interface definition
+*/
+/*-----------------------------------------------------------------------------------------------*/
+
+/*-------------------------------------------------------------------------------------------------
+ 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
+ -------- --- ----------------------------------------------------------
+ 20190508 tyler.kuang Created .
+-------------------------------------------------------------------------------------------------*/
+
+#ifndef __TEST_UTILS_H__
+#define __TEST_UTILS_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+
+typedef void (*item_handler_f)(void);
+
+#define T_ARRAY_SIZE(items) (sizeof(items)/sizeof(items[0]))
+
+typedef struct
+{
+ const char *name;
+ item_handler_f handle;
+} t_item_t;
+
+typedef struct
+{
+ const char *name;
+ int item_len;
+ t_item_t *item_list;
+} t_module_t;
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Read a int value from stdin
+ @param[out] val, Return read data
+ @return
+ 0 - successful
+ 1 - read an enter
+ -1 - invalid input
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int t_get_int(int *val);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Read a uint32 value from stdin
+ @param[out] val, Return read data
+ @return
+ 0 - successful
+ 1 - read an enter
+ -1 - invalid input
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int t_get_hex(uint32_t *val);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Read a char value from stdin
+ @param[out] val, Return read data
+ @return
+ 0 - successful
+ 1 - read an enter
+ -1 - invalid input
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int t_get_char(int *val);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Read a string value from stdin
+ @param[out] val, Return read data
+ @return
+ 0 - successful
+ 1 - read an enter
+ -1 - invalid input
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int t_get_string(char *str_buf, int str_len);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Read a list of int values from stdin
+ @param[out] val, Return read datas
+ @param[out&in] val, Input buffer length, output the number of read
+ @return
+ 0 - successful
+ 1 - read an enter
+ -1 - invalid input
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int t_get_int_list(int *dat_buf, int *dat_len);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Read a list of float values from stdin
+ @param[out] val, Return read datas
+ @param[out&in] val, Input buffer length, output the number of read
+ @return
+ 0 - successful
+ 1 - read an enter
+ -1 - invalid input
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int t_get_float_list(float *dat_buf, int *dat_len);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/mbtk/include/ql_v2/ql_type.h b/mbtk/include/ql_v2/ql_type.h
new file mode 100755
index 0000000..704f2bb
--- /dev/null
+++ b/mbtk/include/ql_v2/ql_type.h
@@ -0,0 +1,197 @@
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @file ql_type.h
+ @brief This is the public header file which defines data type
+*/
+/*-----------------------------------------------------------------------------------------------*/
+
+/*-------------------------------------------------------------------------------------------------
+ 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
+ -------- --- ----------------------------------------------------------
+ 20181024 tyler.kuang Created .
+-------------------------------------------------------------------------------------------------*/
+
+#ifndef __QL_TYPE_H__
+#define __QL_TYPE_H__
+#include <stdint.h>
+
+typedef int ql_err_t ;
+
+#define QL_DEVICE_NAME_MAX_LEN 32
+
+#define QL_EID_BASE 1000
+#define QL_EID_EXTEND 10000
+
+
+#define QL_ERR_OK 0 /* Success */
+#define QL_ERR_FAILED (-(QL_EID_BASE+1)) /* Failed */
+#define QL_ERR_INTERNAL (-(QL_EID_BASE+2)) /* Internal error */
+#define QL_ERR_UNKNOWN (-(QL_EID_BASE+3)) /* Unknown error */
+#define QL_ERR_GENERIC (-(QL_EID_BASE+4)) /* General error */
+#define QL_ERR_DISABLED (-(QL_EID_BASE+5)) /* Disabled */
+#define QL_ERR_UNSUPPORTED (-(QL_EID_BASE+6)) /* Unspported */
+#define QL_ERR_OP_UNSUPPORTED (-(QL_EID_BASE+7)) /* Operation is not supported */
+#define QL_ERR_INTERNAL_EXTENDED (-(QL_EID_BASE+8)) /* Extended internal error */
+#define QL_ERR_BUNDLING_UNSPPORTED (-(QL_EID_BASE+9)) /* Bundling is not supported */
+#define QL_ERR_INVALID_ARG (-(QL_EID_BASE+10)) /* Invalid argument */
+#define QL_ERR_INVALID_INDEX (-(QL_EID_BASE+11)) /* Invalid index */
+#define QL_ERR_INVALID_REQUEST (-(QL_EID_BASE+12)) /* Invalid request */
+#define QL_ERR_INVALID_STATE (-(QL_EID_BASE+13)) /* Invalid state */
+#define QL_ERR_INVALID_ID (-(QL_EID_BASE+14)) /* Invalid ID */
+#define QL_ERR_INVALID_MSG_ID (-(QL_EID_BASE+15)) /* Invalid message id */
+#define QL_ERR_INVALID_HANDLE (-(QL_EID_BASE+16)) /* Invalid handle */
+#define QL_ERR_INVALID_PROFILE (-(QL_EID_BASE+17)) /* Invalid profile */
+#define QL_ERR_INVALID_PINID (-(QL_EID_BASE+18)) /* Invalid PIN ID */
+#define QL_ERR_INVALID_CALL_ID (-(QL_EID_BASE+19)) /* Invalid call id */
+#define QL_ERR_INVALID_TX_ID (-(QL_EID_BASE+20)) /* Invalid Tx ID */
+#define QL_ERR_INVALID_DATA_FORMAT (-(QL_EID_BASE+21)) /* Invalid data format */
+#define QL_ERR_INVALID_MSG_FORMAT (-(QL_EID_BASE+22)) /* Invalid message format */
+#define QL_ERR_INVALID_TRANSITION (-(QL_EID_BASE+23)) /* Invalid transition */
+#define QL_ERR_INVALID_IP_FAMILY (-(QL_EID_BASE+24)) /* Invalid ip family */
+#define QL_ERR_INVALID_OPERATION (-(QL_EID_BASE+25)) /* Invalid operation */
+#define QL_ERR_INVALID_CMD (-(QL_EID_BASE+26)) /* Invalid command */
+#define QL_ERR_INVALID_TYPE (-(QL_EID_BASE+27)) /* Invalid type */
+#define QL_ERR_DENIED (-(QL_EID_BASE+28)) /* Operation or access was denied */
+#define QL_ERR_RESTRICTED (-(QL_EID_BASE+29)) /* Resouce is restricted */
+#define QL_ERR_NO_MEM (-(QL_EID_BASE+30)) /* Memory is not enough */
+#define QL_ERR_MEM (-(QL_EID_BASE+31)) /* Memory error */
+#define QL_ERR_BUF_OVERFLOW (-(QL_EID_BASE+32)) /* BUffer overflow */
+#define QL_ERR_TIMEOUT (-(QL_EID_BASE+33)) /* Timeout */
+#define QL_ERR_NOT_INIT (-(QL_EID_BASE+34)) /* Not initialized */
+#define QL_ERR_ABORTED (-(QL_EID_BASE+35)) /* Action was aborted */
+#define QL_ERR_NETWORK_ABORTED (-(QL_EID_BASE+36)) /* Network was aborted */
+#define QL_ERR_RESOURCE_EXHAUSTED (-(QL_EID_BASE+37)) /* Resource have been exhausted */
+#define QL_ERR_RESOUCE_IN_USE (-(QL_EID_BASE+38)) /* Resouce in use */
+#define QL_ERR_RESOUCE_NOT_ENOUGH (-(QL_EID_BASE+39)) /* Insufficient resources */
+#define QL_ERR_UNABORTABLE_TRANSACTION (-(QL_EID_BASE+40)) /* Unabortable transaction */
+#define QL_ERR_INCORRECT_PIN (-(QL_EID_BASE+41)) /* Incorrect PIN */
+#define QL_ERR_NO_NETWORK_FOUND (-(QL_EID_BASE+42)) /* No network found */
+#define QL_ERR_CALL_FAILED (-(QL_EID_BASE+43)) /* Call failed */
+#define QL_ERR_OUT_OF_CALL (-(QL_EID_BASE+44)) /* Out of call */
+#define QL_ERR_NOT_PROVISIONED (-(QL_EID_BASE+45)) /* Not provisioned */
+#define QL_ERR_MISSING_ARG (-(QL_EID_BASE+46)) /* Missing argument */
+#define QL_ERR_ARG_TOO_LONG (-(QL_EID_BASE+47)) /* Argument is too long */
+#define QL_ERR_DEVICE_NOT_READY (-(QL_EID_BASE+48)) /* Device is not ready */
+#define QL_ERR_OP_DEVICE_UNSUPPORTED (-(QL_EID_BASE+49)) /* OP device is not supported */
+#define QL_ERR_DEVICE_NO_MEM (-(QL_EID_BASE+50)) /* Device memory is not enough */
+#define QL_ERR_DEVICE_MEM (-(QL_EID_BASE+51)) /* Device memory error */
+#define QL_ERR_DEVICE_IN_USE (-(QL_EID_BASE+52)) /* Device in use */
+#define QL_ERR_OP_NETWORK_UNSUPPORTED (-(QL_EID_BASE+53)) /* OP network is not supported */
+#define QL_ERR_NO_EFFECT (-(QL_EID_BASE+54)) /* No effect */
+#define QL_ERR_AUTH_FAILED (-(QL_EID_BASE+55)) /* Authentication failed */
+#define QL_ERR_AUTH_LOCK (-(QL_EID_BASE+56)) /* Authentication lock error */
+#define QL_ERR_PIN_BLOCKED (-(QL_EID_BASE+57)) /* PIN is blocked */
+#define QL_ERR_PIN_PERM_BLOCKED (-(QL_EID_BASE+58)) /* PIN is permanently blocked */
+#define QL_ERR_SIM_NOT_INIT (-(QL_EID_BASE+59)) /* SIM is not initialized */
+#define QL_ERR_SIM_NOT_FOUND (-(QL_EID_BASE+60)) /* SIM was not found */
+#define QL_ERR_REQUESTED_NUM_UNSUPPORTED (-(QL_EID_BASE+61)) /* Requested number is not supported */
+#define QL_ERR_INTERFACE_NOT_FOUND (-(QL_EID_BASE+62)) /* Interface was not found */
+#define QL_ERR_FILE_NOT_FOUND (-(QL_EID_BASE+63)) /* File was not found */
+#define QL_ERR_SERVICE_NOT_FOUND (-(QL_EID_BASE+64)) /* service was not found */
+#define QL_ERR_NO_ENTRY (-(QL_EID_BASE+65)) /* No entry */
+#define QL_ERR_NETWORK_NOT_READY (-(QL_EID_BASE+66)) /* Network is not ready */
+#define QL_ERR_SERVICE_NOT_READY (-(QL_EID_BASE+67)) /* Service is not ready */
+#define QL_ERR_CAUSE_CODE (-(QL_EID_BASE+68)) /* Cause code error */
+#define QL_ERR_MSG_NOT_SENT (-(QL_EID_BASE+69)) /* Message was not sent */
+#define QL_ERR_MSG_DELIVERY_FAILURE (-(QL_EID_BASE+70)) /* Message delivery failure */
+#define QL_ERR_MSG_BLOCKED (-(QL_EID_BASE+71)) /* Message was blocked */
+#define QL_ERR_ENCODING (-(QL_EID_BASE+72)) /* Encoding error */
+#define QL_ERR_DECODING (-(QL_EID_BASE+73)) /* Decoding error */
+#define QL_ERR_SESSION_INVALID_TYPE (-(QL_EID_BASE+74)) /* Invalid session type */
+#define QL_ERR_SESSION_INACTIVE (-(QL_EID_BASE+75)) /* Session is inactive */
+#define QL_ERR_SESSION_INVALID (-(QL_EID_BASE+76)) /* Session is invalid */
+#define QL_ERR_SESSION_OWNERSHIP (-(QL_EID_BASE+77)) /* Session ownership error */
+#define QL_ERR_SMSC_ADDR (-(QL_EID_BASE+78)) /* Short message service center address error */
+#define QL_ERR_INFO_UNAVAILABLE (-(QL_EID_BASE+79)) /* Information is not available */
+#define QL_ERR_SEGMENT_TOO_LONG (-(QL_EID_BASE+80)) /* Segment is too long */
+#define QL_ERR_SEGMENT_ORDER (-(QL_EID_BASE+81)) /* Segment order error */
+#define QL_ERR_MISMATCH (-(QL_EID_BASE+82)) /* Something mismatch */
+#define QL_ERR_ACK_NOT_SENT (-(QL_EID_BASE+83)) /* Acknowledgement was not sent */
+#define QL_ERR_INTERNAL_TIMEOUT (-(QL_EID_BASE+84)) /* Internal timeout */
+#define QL_ERR_FDN_RESTRICT (-(QL_EID_BASE+85)) /* Fixed dialing number restrict error */
+#define QL_ERR_NO_RADIO (-(QL_EID_BASE+86)) /* No radio */
+#define QL_ERR_INVALID_PB_TYPE (-(QL_EID_BASE+87)) /* Invalid phonebook type */
+#define QL_ERR_PB_NOT_READY (-(QL_EID_BASE+88)) /* Phonebook not ready */
+#define QL_ERR_PB_ACCESS_RESTRICTED (-(QL_EID_BASE+89)) /* Phonebook access is restricted */
+#define QL_ERR_SUPS_FAILURE_CAUSE (-(QL_EID_BASE+90)) /* SUPS failure cause */
+#define QL_ERR_NV_NO_FILE (-(QL_EID_BASE+91)) /* NV file not exist */
+#define QL_ERR_NV_FS_NOT_SUPPORTED (-(QL_EID_BASE+92)) /* NV file system not supported */
+#define QL_ERR_NV_BAD_SIZE (-(QL_EID_BASE+93)) /* NV bad buffer size */
+#define QL_ERR_NV_BAD_BUF (-(QL_EID_BASE+94)) /* NV buffer is NULL*/
+#define QL_ERR_TARGET_EXIST (-(QL_EID_BASE+95)) /* Target exists */
+#define QL_ERR_TARGET_NOT_EXIST (-(QL_EID_BASE+96)) /* Target does not exist */
+#define QL_ERR_NO_PERMISSION (-(QL_EID_BASE+97)) /* No permission */
+#define QL_ERR_MODEM_OFFLINE (-(QL_EID_BASE+98)) /* Modem subsystem is offline */
+#define QL_ERR_SERVICE_ABORT (-(QL_EID_BASE+99)) /* Service abort */
+#define QL_ERR_CHANNEL_OUT_OF_RANGE (-(QL_EID_BASE+100)) /* Sim logical channel out of range */
+#define QL_ERR_APDU_FORMAT (-(QL_EID_BASE+101)) /* Sim apdu format error */
+#define QL_ERR_INVALID_PIN_TYPE (-(QL_EID_BASE+102)) /* Sim invalid pin type */
+
+#define QL_ERR_RIL_RADIO_NOT_AVAILABLE (-(QL_EID_BASE+1001)) /* If radio did not start or is resetting */
+#define QL_ERR_RIL_GENERIC_FAILURE (-(QL_EID_BASE+1002))
+#define QL_ERR_RIL_PASSWORD_INCORRECT (-(QL_EID_BASE+1003)) /* for PIN/PIN2 methods only! */
+#define QL_ERR_RIL_SIM_PIN2 (-(QL_EID_BASE+1004)) /* Operation requires SIM PIN2 to be entered */
+#define QL_ERR_RIL_SIM_PUK2 (-(QL_EID_BASE+1005)) /* Operation requires SIM PUK2 to be entered */
+#define QL_ERR_RIL_REQUEST_NOT_SUPPORTED (-(QL_EID_BASE+1006))
+#define QL_ERR_RIL_CANCELLED (-(QL_EID_BASE+1007))
+#define QL_ERR_RIL_OP_NOT_ALLOWED_DURING_VOICE_CALL (-(QL_EID_BASE+1008)) /* data ops are not allowed during voice call on a Class C GPRS device */
+#define QL_ERR_RIL_OP_NOT_ALLOWED_BEFORE_REG_TO_NW (-(QL_EID_BASE+1009)) /* data ops are not allowed before device registers in network */
+#define QL_ERR_RIL_SMS_SEND_FAIL_RETRY (-(QL_EID_BASE+1010)) /* fail to send sms and need retry */
+#define QL_ERR_RIL_SIM_ABSENT (-(QL_EID_BASE+1011)) /* fail to set the location where CDMA subscription
+ shall be retrieved because of SIM or RUIM card absent */
+#define QL_ERR_RIL_SUBSCRIPTION_NOT_AVAILABLE (-(QL_EID_BASE+1012)) /* fail to find CDMA subscription from specified location */
+#define QL_ERR_RIL_MODE_NOT_SUPPORTED (-(QL_EID_BASE+1013)) /* HW does not support preferred network type */
+#define QL_ERR_RIL_FDN_CHECK_FAILURE (-(QL_EID_BASE+1014)) /* command failed because recipient is not on FDN list */
+#define QL_ERR_RIL_ILLEGAL_SIM_OR_ME (-(QL_EID_BASE+1015)) /* network selection failed due to illegal SIM or ME */
+#define QL_ERR_RIL_MISSING_RESOURCE (-(QL_EID_BASE+1016)) /* no logical channel available */
+#define QL_ERR_RIL_NO_SUCH_ELEMENT (-(QL_EID_BASE+1017)) /* application not found on SIM */
+#define QL_ERR_RIL_DIAL_MODIFIED_TO_USSD (-(QL_EID_BASE+1018)) /* DIAL request modified to USSD */
+#define QL_ERR_RIL_DIAL_MODIFIED_TO_SS (-(QL_EID_BASE+1019)) /* DIAL request modified to SS */
+#define QL_ERR_RIL_DIAL_MODIFIED_TO_DIAL (-(QL_EID_BASE+1020)) /* DIAL request modified to DIAL with different data */
+#define QL_ERR_RIL_USSD_MODIFIED_TO_DIAL (-(QL_EID_BASE+1021)) /* USSD request modified to DIAL */
+#define QL_ERR_RIL_USSD_MODIFIED_TO_SS (-(QL_EID_BASE+1022)) /* USSD request modified to SS */
+#define QL_ERR_RIL_USSD_MODIFIED_TO_USSD (-(QL_EID_BASE+1023)) /* USSD request modified to different USSD request */
+#define QL_ERR_RIL_SS_MODIFIED_TO_DIAL (-(QL_EID_BASE+1024)) /* SS request modified to DIAL */
+#define QL_ERR_RIL_SS_MODIFIED_TO_USSD (-(QL_EID_BASE+1025)) /* SS request modified to USSD */
+#define QL_ERR_RIL_SUBSCRIPTION_NOT_SUPPORTED (-(QL_EID_BASE+1026)) /* Subscription not supported by RIL */
+#define QL_ERR_RIL_SS_MODIFIED_TO_SS (-(QL_EID_BASE+1027)) /* SS request modified to different SS request */
+#define QL_ERR_RIL_LCE_NOT_SUPPORTED (-(QL_EID_BASE+1028)) /* LCE service not supported(36 in RILConstants.java) */
+#define QL_ERR_RIL_DIAL_STRING_TOO_LONG (-(QL_EID_BASE+1029))
+#define QL_ERR_RIL_TEXT_STRING_TOO_LONG (-(QL_EID_BASE+1030))
+#define QL_ERR_RIL_SIM_MEM_FULL (-(QL_EID_BASE+1031))
+#define QL_ERR_RIL_CALL_BARRED (-(QL_EID_BASE+1032)) /* command failed because call barred */
+#define QL_ERR_RIL_EXTERNAL_APP_CAUSE_BEGIN (-(QL_EID_BASE+1033))
+#define QL_ERR_RIL_BT_SAP_UNDEFINED (-(QL_EID_BASE+1034))
+#define QL_ERR_RIL_BT_SAP_NOT_ACCESSIBLE (-(QL_EID_BASE+1035))
+#define QL_ERR_RIL_BT_SAP_CARD_REMOVED (-(QL_EID_BASE+1036))
+#define QL_ERR_RIL_BT_SAP_UIM_NOT_INSERTED (-(QL_EID_BASE+1037))
+#define QL_ERR_RIL_BT_SAP_ERROR_NO_REASON_DEFINED (-(QL_EID_BASE+1038))
+#define QL_ERR_RIL_BT_SAP_ALREADY_POWERED_OFF (-(QL_EID_BASE+1039))
+#define QL_ERR_RIL_BT_SAP_ALREADY_POWERED_ON (-(QL_EID_BASE+1040))
+#define QL_ERR_RIL_VERIFICATION_FAILED (-(QL_EID_BASE+1041))
+#define QL_ERR_RIL_REBOOT_REQUEST (-(QL_EID_BASE+1042))
+#define QL_ERR_RIL_HOLD_FAILED_CAUSED_BY_TERMINATED (-(QL_EID_BASE+1043))
+#define QL_ERR_RIL_POWER_ON_UIM_NOT_READY (-(QL_EID_BASE+1044))
+#define QL_ERR_RIL_UIM_EF_NOT_EXIST (-(QL_EID_BASE+1045))
+
+typedef enum
+{
+ QL_SIM_MIN = 0,
+ QL_SIM_1 = 1,
+ QL_SIM_2 = 2,
+ QL_SIM_MAX
+}QL_SIM_ID_E;
+
+#define QL_IS_SIM_VALID(sim_id) ((sim_id)>QL_SIM_MIN && (sim_id)<QL_SIM_MAX)
+
+#endif
+
diff --git a/mbtk/include/ql_v2/ql_voice.h b/mbtk/include/ql_v2/ql_voice.h
new file mode 100755
index 0000000..0882a66
--- /dev/null
+++ b/mbtk/include/ql_v2/ql_voice.h
@@ -0,0 +1,1069 @@
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @file ql_voice.h
+ @brief Voice service API.
+*/
+/*-----------------------------------------------------------------------------------------------*/
+
+/*-------------------------------------------------------------------------------------------------
+ Copyright (c) 2019 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
+ -------- --- ----------------------------------------------------------
+ 20210622 Rambo.shan Added Voice DSDA API.
+ 20210203 Rambo.shan Added Voice bind API for DSDA.
+ 20210104 Rambo.shan Added DTMF event indication.
+ 20200928 Rambo.shan Added eCall set option of T3.
+ 20200907 Rambo.shan Added SETUP voice state.
+ 20200622 Rambo.shan Add eCall auto answer function
+ 20191225 solomon.cui Modify fucntion description.
+ 20191111 solomon.cui Add eCall APIs.
+ 20190815 solomon.cui Add service type for sending message.
+ 20190625 solomon.cui Created.
+-------------------------------------------------------------------------------------------------*/
+#include <stdint.h>
+
+#define QL_VOICE_MAX_PHONE_NUMBER (82)
+#define QL_VOICE_MAX_RECORDS (8)
+#define QL_VOICE_MAX_DTMF_LENGTH (20)
+#define QL_VOICE_MAX_FW_DETAIL_LENGTH (13)
+#define QL_VOICE_MAX_ECALL_MSD (140)
+
+typedef enum
+{
+ QL_VOICE_STATE_INCOMING = 0x0000, /**< Call is incoming. */
+ QL_VOICE_STATE_DIALING = 0x0001, /**< Dialing state. */
+ QL_VOICE_STATE_ALERTING = 0x0002, /**< Alterting. */
+ QL_VOICE_STATE_ACTIVE = 0x0003, /**< Call is active. */
+ QL_VOICE_STATE_HOLDING = 0x0004, /**< Call is on hold. */
+ QL_VOICE_STATE_END = 0x0005, /**< Call is disconnected. */
+ QL_VOICE_STATE_WAITING = 0x0006, /**< Call is waiting. */
+ QL_VOICE_STATE_SETUP = 0x0007, /**< MT Call is in Setup state in 3GPP. */
+} QL_VOICE_STATE_E;
+
+typedef enum
+{
+ QL_VOICE_TECH_NONE = 0, /**< None. */
+ QL_VOICE_TECH_3GPP = 1, /**< 3GPP. */
+ QL_VOICE_TECH_3GPP2 = 2, /**< 3GPP2. */
+} QL_VOICE_TECH_E;
+
+typedef enum
+{
+ QL_VOICE_DIR_MO = 0, /**< Mobile originated call */
+ QL_VOICE_DIR_MT = 1, /**< Mobile terminated call */
+} QL_VOICE_DIR_E;
+
+typedef enum
+{
+ VOICE_CALL_EVENT,
+ VOICE_MUTE_EVENT,
+ VOICE_DTMF_EVENT,
+ VOICE_ECALL_EVENT,
+ VOICE_ECALL_STATUS,
+} VOICE_EVENT_E;
+
+typedef enum
+{
+ QL_VOICE_END_REASON_NONE = 0,
+ QL_VOICE_END_REASON_OFFLINE = 1,
+ QL_VOICE_END_REASON_CDMA_LOCK = 2,
+ QL_VOICE_END_REASON_NO_SRV = 3,
+ QL_VOICE_END_REASON_FADE = 4,
+ QL_VOICE_END_REASON_INTERCEPT = 5,
+ QL_VOICE_END_REASON_REORDER = 6,
+ QL_VOICE_END_REASON_REL_NORMAL = 7,
+ QL_VOICE_END_REASON_REL_SO_REJ = 8,
+ QL_VOICE_END_REASON_INCOM_CALL = 9,
+ QL_VOICE_END_REASON_ALERT_STOP = 10,
+ QL_VOICE_END_REASON_CLIENT_END = 11,
+ QL_VOICE_END_REASON_ACTIVATION = 12,
+ QL_VOICE_END_REASON_MC_ABORT = 13,
+ QL_VOICE_END_REASON_MAX_ACCESS_PROBE = 14,
+ QL_VOICE_END_REASON_PSIST_N = 15,
+ QL_VOICE_END_REASON_UIM_NOT_PRESENT = 16,
+ QL_VOICE_END_REASON_ACC_IN_PROG = 17,
+ QL_VOICE_END_REASON_ACC_FAIL = 18,
+ QL_VOICE_END_REASON_RETRY_ORDER = 19,
+ QL_VOICE_END_REASON_CCS_NOT_SUPPORTED_BY_BS = 20,
+ QL_VOICE_END_REASON_NO_RESPONSE_FROM_BS = 21,
+ QL_VOICE_END_REASON_REJECTED_BY_BS = 22,
+ QL_VOICE_END_REASON_INCOMPATIBLE = 23,
+ QL_VOICE_END_REASON_ACCESS_BLOCK = 24,
+ QL_VOICE_END_REASON_ALREADY_IN_TC = 25,
+ QL_VOICE_END_REASON_EMERGENCY_FLASHED = 26,
+ QL_VOICE_END_REASON_USER_CALL_ORIG_DURING_GPS = 27,
+ QL_VOICE_END_REASON_USER_CALL_ORIG_DURING_SMS = 28,
+ QL_VOICE_END_REASON_USER_CALL_ORIG_DURING_DATA = 29,
+ QL_VOICE_END_REASON_REDIR_OR_HANDOFF = 30,
+ QL_VOICE_END_REASON_ACCESS_BLOCK_ALL = 31,
+ QL_VOICE_END_REASON_OTASP_SPC_ERR = 32,
+ QL_VOICE_END_REASON_IS707B_MAX_ACC = 33,
+ QL_VOICE_END_REASON_ACC_FAIL_REJ_ORD = 34,
+ QL_VOICE_END_REASON_ACC_FAIL_RETRY_ORD = 35,
+ QL_VOICE_END_REASON_TIMEOUT_T42 = 36,
+ QL_VOICE_END_REASON_TIMEOUT_T40 = 37,
+ QL_VOICE_END_REASON_SRV_INIT_FAIL = 38,
+ QL_VOICE_END_REASON_T50_EXP = 39,
+ QL_VOICE_END_REASON_T51_EXP = 40,
+ QL_VOICE_END_REASON_RL_ACK_TIMEOUT = 41,
+ QL_VOICE_END_REASON_BAD_FL = 42,
+ QL_VOICE_END_REASON_TRM_REQ_FAIL = 43,
+ QL_VOICE_END_REASON_TIMEOUT_T41 = 44,
+ QL_VOICE_END_REASON_INCOM_REJ = 45,
+ QL_VOICE_END_REASON_SETUP_REJ = 46,
+ QL_VOICE_END_REASON_NETWORK_END = 47,
+ QL_VOICE_END_REASON_NO_FUNDS = 48,
+ QL_VOICE_END_REASON_NO_GW_SRV = 49,
+ QL_VOICE_END_REASON_NO_CDMA_SRV = 50,
+ QL_VOICE_END_REASON_NO_FULL_SRV = 51,
+ QL_VOICE_END_REASON_MAX_PS_CALLS = 52,
+ QL_VOICE_END_REASON_UNKNOWN_SUBSCRIBER = 53,
+ QL_VOICE_END_REASON_ILLEGAL_SUBSCRIBER = 54,
+ QL_VOICE_END_REASON_BEARER_SERVICE_NOT_PROVISIONED = 55,
+ QL_VOICE_END_REASON_TELE_SERVICE_NOT_PROVISIONED = 56,
+ QL_VOICE_END_REASON_ILLEGAL_EQUIPMENT = 57,
+ QL_VOICE_END_REASON_CALL_BARRED = 58,
+ QL_VOICE_END_REASON_ILLEGAL_SS_OPERATION = 59,
+ QL_VOICE_END_REASON_SS_ERROR_STATUS = 60,
+ QL_VOICE_END_REASON_SS_NOT_AVAILABLE = 61,
+ QL_VOICE_END_REASON_SS_SUBSCRIPTION_VIOLATION = 62,
+ QL_VOICE_END_REASON_SS_INCOMPATIBILITY = 63,
+ QL_VOICE_END_REASON_FACILITY_NOT_SUPPORTED = 64,
+ QL_VOICE_END_REASON_ABSENT_SUBSCRIBER = 65,
+ QL_VOICE_END_REASON_SHORT_TERM_DENIAL = 66,
+ QL_VOICE_END_REASON_LONG_TERM_DENIAL = 67,
+ QL_VOICE_END_REASON_SYSTEM_FAILURE = 68,
+ QL_VOICE_END_REASON_DATA_MISSING = 69,
+ QL_VOICE_END_REASON_UNEXPECTED_DATA_VALUE = 70,
+ QL_VOICE_END_REASON_PWD_REGISTRATION_FAILURE = 71,
+ QL_VOICE_END_REASON_NEGATIVE_PWD_CHECK = 72,
+ QL_VOICE_END_REASON_NUM_OF_PWD_ATTEMPTS_VIOLATION = 73,
+ QL_VOICE_END_REASON_POSITION_METHOD_FAILURE = 74,
+ QL_VOICE_END_REASON_UNKNOWN_ALPHABET = 75,
+ QL_VOICE_END_REASON_USSD_BUSY = 76,
+ QL_VOICE_END_REASON_REJECTED_BY_USER = 77,
+ QL_VOICE_END_REASON_REJECTED_BY_NETWORK = 78,
+ QL_VOICE_END_REASON_DEFLECTION_TO_SERVED_SUBSCRIBER = 79,
+ QL_VOICE_END_REASON_SPECIAL_SERVICE_CODE = 80,
+ QL_VOICE_END_REASON_INVALID_DEFLECTED_TO_NUMBER = 81,
+ QL_VOICE_END_REASON_MPTY_PARTICIPANTS_EXCEEDED = 82,
+ QL_VOICE_END_REASON_RESOURCES_NOT_AVAILABLE = 83,
+ QL_VOICE_END_REASON_UNASSIGNED_NUMBER = 84,
+ QL_VOICE_END_REASON_NO_ROUTE_TO_DESTINATION = 85,
+ QL_VOICE_END_REASON_CHANNEL_UNACCEPTABLE = 86,
+ QL_VOICE_END_REASON_OPERATOR_DETERMINED_BARRING = 87,
+ QL_VOICE_END_REASON_NORMAL_CALL_CLEARING = 88,
+ QL_VOICE_END_REASON_USER_BUSY = 89,
+ QL_VOICE_END_REASON_NO_USER_RESPONDING = 90,
+ QL_VOICE_END_REASON_USER_ALERTING_NO_ANSWER = 91,
+ QL_VOICE_END_REASON_CALL_REJECTED = 92,
+ QL_VOICE_END_REASON_NUMBER_CHANGED = 93,
+ QL_VOICE_END_REASON_PREEMPTION = 94,
+ QL_VOICE_END_REASON_DESTINATION_OUT_OF_ORDER = 95,
+ QL_VOICE_END_REASON_INVALID_NUMBER_FORMAT = 96,
+ QL_VOICE_END_REASON_FACILITY_REJECTED = 97,
+ QL_VOICE_END_REASON_RESP_TO_STATUS_ENQUIRY = 98,
+ QL_VOICE_END_REASON_NORMAL_UNSPECIFIED = 99,
+ QL_VOICE_END_REASON_NO_CIRCUIT_OR_CHANNEL_AVAILABLE = 100,
+ QL_VOICE_END_REASON_NETWORK_OUT_OF_ORDER = 101,
+ QL_VOICE_END_REASON_TEMPORARY_FAILURE = 102,
+ QL_VOICE_END_REASON_SWITCHING_EQUIPMENT_CONGESTION = 103,
+ QL_VOICE_END_REASON_ACCESS_INFORMATION_DISCARDED = 104,
+ QL_VOICE_END_REASON_REQUESTED_CIRCUIT_OR_CHANNEL_NOT_AVAILABLE = 105,
+ QL_VOICE_END_REASON_RESOURCES_UNAVAILABLE_OR_UNSPECIFIED = 106,
+ QL_VOICE_END_REASON_QOS_UNAVAILABLE = 107,
+ QL_VOICE_END_REASON_REQUESTED_FACILITY_NOT_SUBSCRIBED = 108,
+ QL_VOICE_END_REASON_INCOMING_CALLS_BARRED_WITHIN_CUG = 109,
+ QL_VOICE_END_REASON_BEARER_CAPABILITY_NOT_AUTH = 110,
+ QL_VOICE_END_REASON_BEARER_CAPABILITY_UNAVAILABLE = 111,
+ QL_VOICE_END_REASON_SERVICE_OPTION_NOT_AVAILABLE = 112,
+ QL_VOICE_END_REASON_ACM_LIMIT_EXCEEDED = 113,
+ QL_VOICE_END_REASON_BEARER_SERVICE_NOT_IMPLEMENTED = 114,
+ QL_VOICE_END_REASON_REQUESTED_FACILITY_NOT_IMPLEMENTED = 115,
+ QL_VOICE_END_REASON_ONLY_DIGITAL_INFORMATION_BEARER_AVAILABLE = 116,
+ QL_VOICE_END_REASON_SERVICE_OR_OPTION_NOT_IMPLEMENTED = 117,
+ QL_VOICE_END_REASON_INVALID_TRANSACTION_IDENTIFIER = 118,
+ QL_VOICE_END_REASON_USER_NOT_MEMBER_OF_CUG = 119,
+ QL_VOICE_END_REASON_INCOMPATIBLE_DESTINATION = 120,
+ QL_VOICE_END_REASON_INVALID_TRANSIT_NW_SELECTION = 121,
+ QL_VOICE_END_REASON_SEMANTICALLY_INCORRECT_MESSAGE = 122,
+ QL_VOICE_END_REASON_INVALID_MANDATORY_INFORMATION = 123,
+ QL_VOICE_END_REASON_MESSAGE_TYPE_NON_IMPLEMENTED = 124,
+ QL_VOICE_END_REASON_MESSAGE_TYPE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE = 125,
+ QL_VOICE_END_REASON_INFORMATION_ELEMENT_NON_EXISTENT = 126,
+ QL_VOICE_END_REASON_CONDITONAL_IE_ERROR = 127,
+ QL_VOICE_END_REASON_MESSAGE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE = 128,
+ QL_VOICE_END_REASON_RECOVERY_ON_TIMER_EXPIRED = 129,
+ QL_VOICE_END_REASON_PROTOCOL_ERROR_UNSPECIFIED = 130,
+ QL_VOICE_END_REASON_INTERWORKING_UNSPECIFIED = 131,
+ QL_VOICE_END_REASON_OUTGOING_CALLS_BARRED_WITHIN_CUG = 132,
+ QL_VOICE_END_REASON_NO_CUG_SELECTION = 133,
+ QL_VOICE_END_REASON_UNKNOWN_CUG_INDEX = 134,
+ QL_VOICE_END_REASON_CUG_INDEX_INCOMPATIBLE = 135,
+ QL_VOICE_END_REASON_CUG_CALL_FAILURE_UNSPECIFIED = 136,
+ QL_VOICE_END_REASON_CLIR_NOT_SUBSCRIBED = 137,
+ QL_VOICE_END_REASON_CCBS_POSSIBLE = 138,
+ QL_VOICE_END_REASON_CCBS_NOT_POSSIBLE = 139,
+ QL_VOICE_END_REASON_IMSI_UNKNOWN_IN_HLR = 140,
+ QL_VOICE_END_REASON_ILLEGAL_MS = 141,
+ QL_VOICE_END_REASON_IMSI_UNKNOWN_IN_VLR = 142,
+ QL_VOICE_END_REASON_IMEI_NOT_ACCEPTED = 143,
+ QL_VOICE_END_REASON_ILLEGAL_ME = 144,
+ QL_VOICE_END_REASON_PLMN_NOT_ALLOWED = 145,
+ QL_VOICE_END_REASON_LOCATION_AREA_NOT_ALLOWED = 146,
+ QL_VOICE_END_REASON_ROAMING_NOT_ALLOWED_IN_THIS_LOCATION_AREA = 147,
+ QL_VOICE_END_REASON_NO_SUITABLE_CELLS_IN_LOCATION_AREA = 148,
+ QL_VOICE_END_REASON_NETWORK_FAILURE = 149,
+ QL_VOICE_END_REASON_MAC_FAILURE = 150,
+ QL_VOICE_END_REASON_SYNCH_FAILURE = 151,
+ QL_VOICE_END_REASON_NETWORK_CONGESTION = 152,
+ QL_VOICE_END_REASON_GSM_AUTHENTICATION_UNACCEPTABLE = 153,
+ QL_VOICE_END_REASON_SERVICE_NOT_SUBSCRIBED = 154,
+ QL_VOICE_END_REASON_SERVICE_TEMPORARILY_OUT_OF_ORDER = 155,
+ QL_VOICE_END_REASON_CALL_CANNOT_BE_IDENTIFIED = 156,
+ QL_VOICE_END_REASON_INCORRECT_SEMANTICS_IN_MESSAGE = 157,
+ QL_VOICE_END_REASON_MANDATORY_INFORMATION_INVALID = 158,
+ QL_VOICE_END_REASON_ACCESS_STRATUM_FAILURE = 159,
+ QL_VOICE_END_REASON_INVALID_SIM = 160,
+ QL_VOICE_END_REASON_WRONG_STATE = 161,
+ QL_VOICE_END_REASON_ACCESS_CLASS_BLOCKED = 162,
+ QL_VOICE_END_REASON_NO_RESOURCES = 163,
+ QL_VOICE_END_REASON_INVALID_USER_DATA = 164,
+ QL_VOICE_END_REASON_TIMER_T3230_EXPIRED = 165,
+ QL_VOICE_END_REASON_NO_CELL_AVAILABLE = 166,
+ QL_VOICE_END_REASON_ABORT_MSG_RECEIVED = 167,
+ QL_VOICE_END_REASON_RADIO_LINK_LOST = 168,
+ QL_VOICE_END_REASON_TIMER_T303_EXPIRED = 169,
+ QL_VOICE_END_REASON_CNM_MM_REL_PENDING = 170,
+ QL_VOICE_END_REASON_ACCESS_STRATUM_REJ_RR_REL_IND = 171,
+ QL_VOICE_END_REASON_ACCESS_STRATUM_REJ_RR_RANDOM_ACCESS_FAILURE = 172,
+ QL_VOICE_END_REASON_ACCESS_STRATUM_REJ_RRC_REL_IND = 173,
+ QL_VOICE_END_REASON_ACCESS_STRATUM_REJ_RRC_CLOSE_SESSION_IND = 174,
+ QL_VOICE_END_REASON_ACCESS_STRATUM_REJ_RRC_OPEN_SESSION_FAILURE = 175,
+ QL_VOICE_END_REASON_ACCESS_STRATUM_REJ_LOW_LEVEL_FAIL = 176,
+ QL_VOICE_END_REASON_ACCESS_STRATUM_REJ_LOW_LEVEL_FAIL_REDIAL_NOT_ALLOWED = 177,
+ QL_VOICE_END_REASON_ACCESS_STRATUM_REJ_LOW_LEVEL_IMMED_RETRY = 178,
+ QL_VOICE_END_REASON_ACCESS_STRATUM_REJ_ABORT_RADIO_UNAVAILABLE = 179,
+ QL_VOICE_END_REASON_SERVICE_OPTION_NOT_SUPPORTED = 180,
+ QL_VOICE_END_REASON_AS_REJ_LRRC_UL_DATA_CNF_FAILURE_TXN = 181,
+ QL_VOICE_END_REASON_AS_REJ_LRRC_UL_DATA_CNF_FAILURE_HO = 182,
+ QL_VOICE_END_REASON_AS_REJ_LRRC_UL_DATA_CNF_FAILURE_CONN_REL = 183,
+ QL_VOICE_END_REASON_AS_REJ_LRRC_UL_DATA_CNF_FAILURE_RLF = 184,
+ QL_VOICE_END_REASON_AS_REJ_LRRC_UL_DATA_CNF_FAILURE_CTRL_NOT_CONN = 185,
+ QL_VOICE_END_REASON_AS_REJ_LRRC_CONN_EST_SUCCESS = 186,
+ QL_VOICE_END_REASON_AS_REJ_LRRC_CONN_EST_FAILURE = 187,
+ QL_VOICE_END_REASON_AS_REJ_LRRC_CONN_EST_FAILURE_ABORTED = 188,
+ QL_VOICE_END_REASON_AS_REJ_LRRC_CONN_EST_FAILURE_ACCESS_BARRED = 189,
+ QL_VOICE_END_REASON_AS_REJ_LRRC_CONN_EST_FAILURE_CELL_RESEL = 190,
+ QL_VOICE_END_REASON_AS_REJ_LRRC_CONN_EST_FAILURE_CONFIG_FAILURE = 191,
+ QL_VOICE_END_REASON_AS_REJ_LRRC_CONN_EST_FAILURE_TIMER_EXPIRED = 192,
+ QL_VOICE_END_REASON_AS_REJ_LRRC_CONN_EST_FAILURE_LINK_FAILURE = 193,
+ QL_VOICE_END_REASON_AS_REJ_LRRC_CONN_EST_FAILURE_NOT_CAMPED = 194,
+ QL_VOICE_END_REASON_AS_REJ_LRRC_CONN_EST_FAILURE_SI_FAILURE = 195,
+ QL_VOICE_END_REASON_AS_REJ_LRRC_CONN_EST_FAILURE_CONN_REJECT = 196,
+ QL_VOICE_END_REASON_AS_REJ_LRRC_CONN_REL_NORMAL = 197,
+ QL_VOICE_END_REASON_AS_REJ_LRRC_CONN_REL_RLF = 198,
+ QL_VOICE_END_REASON_AS_REJ_LRRC_CONN_REL_CRE_FAILURE = 199,
+ QL_VOICE_END_REASON_AS_REJ_LRRC_CONN_REL_OOS_DURING_CRE = 200,
+ QL_VOICE_END_REASON_AS_REJ_LRRC_CONN_REL_ABORTED = 201,
+ QL_VOICE_END_REASON_AS_REJ_LRRC_CONN_REL_SIB_READ_ERROR = 202,
+ QL_VOICE_END_REASON_AS_REJ_LRRC_CONN_REL_ABORTED_IRAT_SUCCESS = 203,
+ QL_VOICE_END_REASON_AS_REJ_LRRC_RADIO_LINK_FAILURE = 204,
+ QL_VOICE_END_REASON_AS_REJ_DETACH_WITH_REATTACH_LTE_NW_DETACH = 205,
+ QL_VOICE_END_REASON_AS_REJ_DETACH_WITH_OUT_REATTACH_LTE_NW_DETACH = 206,
+ QL_VOICE_END_REASON_BAD_REQ_WAIT_INVITE = 207,
+ QL_VOICE_END_REASON_BAD_REQ_WAIT_REINVITE = 208,
+ QL_VOICE_END_REASON_INVALID_REMOTE_URI = 209,
+ QL_VOICE_END_REASON_REMOTE_UNSUPP_MEDIA_TYPE = 210,
+ QL_VOICE_END_REASON_PEER_NOT_REACHABLE = 211,
+ QL_VOICE_END_REASON_NETWORK_NO_RESP_TIME_OUT = 212,
+ QL_VOICE_END_REASON_NETWORK_NO_RESP_HOLD_FAIL = 213,
+ QL_VOICE_END_REASON_DATA_CONNECTION_LOST = 214,
+ QL_VOICE_END_REASON_UPGRADE_DOWNGRADE_REJ = 215,
+ QL_VOICE_END_REASON_SIP_403_FORBIDDEN = 216,
+ QL_VOICE_END_REASON_NO_NETWORK_RESP = 217,
+ QL_VOICE_END_REASON_UPGRADE_DOWNGRADE_FAILED = 218,
+ QL_VOICE_END_REASON_UPGRADE_DOWNGRADE_CANCELLED = 219,
+ QL_VOICE_END_REASON_SSAC_REJECT = 220,
+ QL_VOICE_END_REASON_THERMAL_EMERGENCY = 221,
+ QL_VOICE_END_REASON_1XCSFB_SOFT_FAILURE = 222,
+ QL_VOICE_END_REASON_1XCSFB_HARD_FAILURE = 223,
+ QL_VOICE_END_REASON_CONNECTION_EST_FAILURE = 224,
+ QL_VOICE_END_REASON_CONNECTION_FAILURE = 225,
+ QL_VOICE_END_REASON_RRC_CONN_REL_NO_MT_SETUP = 226,
+ QL_VOICE_END_REASON_ESR_FAILURE = 227,
+ QL_VOICE_END_REASON_MT_CSFB_NO_RESPONSE_FROM_NW = 228,
+ QL_VOICE_END_REASON_BUSY_EVERYWHERE = 229,
+ QL_VOICE_END_REASON_ANSWERED_ELSEWHERE = 230,
+ QL_VOICE_END_REASON_RLF_DURING_CC_DISCONNECT = 231,
+ QL_VOICE_END_REASON_TEMP_REDIAL_ALLOWED = 232,
+ QL_VOICE_END_REASON_PERM_REDIAL_NOT_NEEDED = 233,
+ QL_VOICE_END_REASON_MERGED_TO_CONFERENCE = 234,
+ QL_VOICE_END_REASON_LOW_BATTERY = 235,
+ QL_VOICE_END_REASON_CALL_DEFLECTED = 236,
+ QL_VOICE_END_REASON_RTP_RTCP_TIMEOUT = 237,
+ QL_VOICE_END_REASON_RINGING_RINGBACK_TIMEOUT = 238,
+ QL_VOICE_END_REASON_REG_RESTORATION = 239,
+ QL_VOICE_END_REASON_CODEC_ERROR = 240,
+ QL_VOICE_END_REASON_UNSUPPORTED_SDP = 241,
+ QL_VOICE_END_REASON_RTP_FAILURE = 242,
+ QL_VOICE_END_REASON_QoS_FAILURE = 243,
+ QL_VOICE_END_REASON_MULTIPLE_CHOICES = 244,
+ QL_VOICE_END_REASON_MOVED_PERMANENTLY = 245,
+ QL_VOICE_END_REASON_MOVED_TEMPORARILY = 246,
+ QL_VOICE_END_REASON_USE_PROXY = 247,
+ QL_VOICE_END_REASON_ALTERNATE_SERVICE = 248,
+ QL_VOICE_END_REASON_ALTERNATE_EMERGENCY_CALL = 249,
+ QL_VOICE_END_REASON_UNAUTHORIZED = 250,
+ QL_VOICE_END_REASON_PAYMENT_REQUIRED = 251,
+ QL_VOICE_END_REASON_METHOD_NOT_ALLOWED = 252,
+ QL_VOICE_END_REASON_NOT_ACCEPTABLE = 253,
+ QL_VOICE_END_REASON_PROXY_AUTHENTICATION_REQUIRED = 254,
+ QL_VOICE_END_REASON_GONE = 255,
+ QL_VOICE_END_REASON_REQUEST_ENTITY_TOO_LARGE = 256,
+ QL_VOICE_END_REASON_REQUEST_URI_TOO_LARGE = 257,
+ QL_VOICE_END_REASON_UNSUPPORTED_URI_SCHEME = 258,
+ QL_VOICE_END_REASON_BAD_EXTENSION = 259,
+ QL_VOICE_END_REASON_EXTENSION_REQUIRED = 260,
+ QL_VOICE_END_REASON_INTERVAL_TOO_BRIEF = 261,
+ QL_VOICE_END_REASON_CALL_OR_TRANS_DOES_NOT_EXIST = 262,
+ QL_VOICE_END_REASON_LOOP_DETECTED = 263,
+ QL_VOICE_END_REASON_TOO_MANY_HOPS = 264,
+ QL_VOICE_END_REASON_ADDRESS_INCOMPLETE = 265,
+ QL_VOICE_END_REASON_AMBIGUOUS = 266,
+ QL_VOICE_END_REASON_REQUEST_TERMINATED = 267,
+ QL_VOICE_END_REASON_NOT_ACCEPTABLE_HERE = 268,
+ QL_VOICE_END_REASON_REQUEST_PENDING = 269,
+ QL_VOICE_END_REASON_UNDECIPHERABLE = 270,
+ QL_VOICE_END_REASON_SERVER_INTERNAL_ERROR = 271,
+ QL_VOICE_END_REASON_NOT_IMPLEMENTED = 272,
+ QL_VOICE_END_REASON_BAD_GATEWAY = 273,
+ QL_VOICE_END_REASON_SERVER_TIME_OUT = 274,
+ QL_VOICE_END_REASON_VERSION_NOT_SUPPORTED = 275,
+ QL_VOICE_END_REASON_MESSAGE_TOO_LARGE = 276,
+ QL_VOICE_END_REASON_DOES_NOT_EXIST_ANYWHERE = 277,
+ QL_VOICE_END_REASON_SESS_DESCR_NOT_ACCEPTABLE = 278,
+ QL_VOICE_END_REASON_SRVCC_END_CALL = 279,
+ QL_VOICE_END_REASON_INTERNAL_ERROR = 280,
+ QL_VOICE_END_REASON_SERVER_UNAVAILABLE = 281,
+ QL_VOICE_END_REASON_PRECONDITION_FAILURE = 282,
+ QL_VOICE_END_REASON_DRVCC_IN_PROG = 283,
+ QL_VOICE_END_REASON_DRVCC_END_CALL = 284,
+ QL_VOICE_END_REASON_CS_HARD_FAILURE = 285,
+ QL_VOICE_END_REASON_CS_ACQ_FAILURE = 286,
+ QL_VOICE_END_REASON_FALLBACK_TO_CS = 287,
+ QL_VOICE_END_REASON_DEAD_BATTERY = 288,
+ QL_VOICE_END_REASON_HO_NOT_FEASIBLE = 289,
+ QL_VOICE_END_REASON_PDN_DISCONNECTED = 290,
+ QL_VOICE_END_REASON_REJECTED_ELSEWHERE = 291,
+ QL_VOICE_END_REASON_CALL_PULLED = 292,
+ QL_VOICE_END_REASON_CALL_PULL_OUT_OF_SYNC = 293,
+ QL_VOICE_END_REASON_HOLD_RESUME_FAILED = 294,
+ QL_VOICE_END_REASON_HOLD_RESUME_CANCELED = 295,
+ QL_VOICE_END_REASON_REINVITE_COLLISION = 296,
+ QL_VOICE_END_REASON_1XCSFB_MSG_INVAILD = 297,
+ QL_VOICE_END_REASON_1XCSFB_MSG_IGNORE = 298,
+ QL_VOICE_END_REASON_1XCSFB_FAIL_ACQ_FAIL = 299,
+ QL_VOICE_END_REASON_1XCSFB_FAIL_CALL_REL_REL_ORDER = 300,
+ QL_VOICE_END_REASON_1XCSFB_FAIL_CALL_REL_REORDER = 301,
+ QL_VOICE_END_REASON_1XCSFB_FAIL_CALL_REL_INTERCEPT_ORDER = 302,
+ QL_VOICE_END_REASON_1XCSFB_FAIL_CALL_REL_NORMAL = 303,
+ QL_VOICE_END_REASON_1XCSFB_FAIL_CALL_REL_SO_REJ = 304,
+ QL_VOICE_END_REASON_1XCSFB_FAIL_CALL_REL_OTASP_SPC_ERR = 305,
+ QL_VOICE_END_REASON_1XCSFB_FAILURE_SRCH_TT_FAIL = 306,
+ QL_VOICE_END_REASON_1XCSFB_FAILURE_TCH_INIT_FAIL = 307,
+ QL_VOICE_END_REASON_1XCSFB_FAILURE_FAILURE_USER_CALL_END = 308,
+ QL_VOICE_END_REASON_1XCSFB_FAILURE_FAILURE_RETRY_EXHAUST = 309,
+ QL_VOICE_END_REASON_1XCSFB_FAILURE_FAILURE_CALL_REL_REG_REJ = 310,
+ QL_VOICE_END_REASON_1XCSFB_FAILURE_FAILURE_CALL_REL_NW_REL_ODR = 311,
+ QL_VOICE_END_REASON_1XCSFB_HO_FAILURE = 312,
+ QL_VOICE_END_REASON_EMM_REJ_TIMER_T3417_EXT_EXP = 313,
+ QL_VOICE_END_REASON_EMM_REJ_TIMER_T3417_EXP = 314,
+ QL_VOICE_END_REASON_EMM_REJ_SERVICE_REQ_FAILURE_LTE_NW_REJECT = 315,
+ QL_VOICE_END_REASON_EMM_REJ_SERVICE_REQ_FAILURE_CS_DOMAIN_NOT_AVAILABLE = 316,
+ QL_VOICE_END_REASON_EMM_REJ = 317,
+} QL_VOICE_END_REASON_E;
+
+typedef struct
+{
+ uint32_t id;
+ char number[QL_VOICE_MAX_PHONE_NUMBER + 1];
+ QL_VOICE_STATE_E state;
+ QL_VOICE_TECH_E tech;
+ QL_VOICE_DIR_E dir;
+ QL_VOICE_END_REASON_E end_reason;
+} ql_voice_record_t;
+
+typedef struct
+{
+ int len; /**< length of records */
+ ql_voice_record_t records[QL_VOICE_MAX_RECORDS];
+} ql_voice_record_array_t;
+
+typedef void (*ql_voice_call_cb_f)(ql_voice_record_array_t *p_arr);
+
+typedef enum
+{
+ QL_VOICE_DTMF_EVENT_REV_BURST = 0x00, /**< Sends a CDMA-burst DTMF \n */
+ QL_VOICE_DTMF_EVENT_REV_START_CONT = 0x01, /**< Starts a continuous DTMF tone \n */
+ QL_VOICE_DTMF_EVENT_REV_STOP_CONT = 0x02, /**< Stops a continuous DTMF tone \n */
+ QL_VOICE_DTMF_EVENT_FWD_BURST = 0x03, /**< Received a CDMA-burst DTMF message \n */
+ QL_VOICE_DTMF_EVENT_FWD_START_CONT = 0x04, /**< Received a start-continuous DTMF tone order \n */
+ QL_VOICE_DTMF_EVENT_FWD_STOP_CONT = 0x05, /**< Received a stop-continuous DTMF tone order \n */
+ QL_VOICE_DTMF_EVENT_IP_INCOMING_DTMF_START = 0x06, /**< Received an IP-start continuous DTMF message \n */
+ QL_VOICE_DTMF_EVENT_IP_INCOMING_DTMF_STOP = 0x07, /**< Received an IP-stop continuous DTMF message */
+} QL_VOICE_DTMF_EVENT_E;
+
+/** voice dtmf event callback */
+typedef void (*ql_voice_dtmf_cb_f)(uint32_t id, QL_VOICE_DTMF_EVENT_E event,
+ char *digits, int len); /**< len: length of digits */
+
+/** forwarding condition */
+typedef enum
+{
+ QL_VOICE__FW_COND_UNCONDITIONALLY = 0, /**< Unconditional call forwarding. */
+ QL_VOICE__FW_COND_MOBILEBUSY = 1, /**< Forward when the mobile device is busy. */
+ QL_VOICE__FW_COND_NOREPLY = 2, /**< Forward when there is no reply. */
+ QL_VOICE__FW_COND_UNREACHABLE = 3, /**< Forward when the call is unreachable. */
+ QL_VOICE__FW_COND_ALLFORWARDING = 4, /**< All forwarding(0-3).*/
+ QL_VOICE__FW_COND_ALLCONDITIONAL = 5, /**< All conditional forwarding(1-3). */
+} QL_VOICE_FW_COND_E;
+
+typedef enum
+{
+ QL_VOICE_FW_TYPE_VOICE = 0, /**< Forwarding Voice. */
+ QL_VOICE_FW_TYPE_DATA = 1, /**< Forwarding Data. */
+ QL_VOICE_FW_TYPE_VOICE_DATA = 2, /**< Forwarding voice and data. */
+} QL_VOICE_FW_TYPE_E;
+
+/** */
+typedef enum {
+ QL_VOICE_PRIMARY_SUBSCRIPTION = 0,
+ QL_VOICE_SECONDARY_SUBSCRIPTION = 1,
+} QL_VOICE_SUBSCRIPTION_E;
+
+typedef struct
+{
+ int enabled;
+ int len; /**< length of details */
+ struct {
+ QL_VOICE_FW_TYPE_E type;
+ char number[QL_VOICE_MAX_PHONE_NUMBER + 1];
+ } details[QL_VOICE_MAX_FW_DETAIL_LENGTH];
+} ql_voice_fw_status_t;
+
+typedef enum
+{
+ QL_VOICE_ECALL_TYPE_TEST = 1, /**< Test eCall */
+ QL_VOICE_ECALL_TYPE_EMERGENCY = 2, /**< Emergency eCall */
+ QL_VOICE_ECALL_TYPE_RECONFIG = 3, /**< Reconfig eCall */
+} QL_VOICE_ECALL_TYPE_E;
+
+typedef struct
+{
+ uint32_t msd_len; /**< Length of Minimum Set of Data */
+ uint8_t msd[QL_VOICE_MAX_ECALL_MSD]; /**< Minimum Set of Data */
+ QL_VOICE_ECALL_TYPE_E type; /**< eCall type */
+ int auto_trigger; /**< 0 - Manually trigger eCall
+ 1 - Automatically trigger eCall */
+ char test_number[QL_VOICE_MAX_PHONE_NUMBER]; /**< Test number */
+} ql_voice_ecall_info_t;
+
+/** eCall state */
+typedef enum {
+ QL_VOICE_ECALL_STATE_NONE = -1,
+ QL_VOICE_ECALL_STATE_INACTIVE = 0,
+ QL_VOICE_ECALL_STATE_ORIGINATING_CALL = 1,
+ QL_VOICE_ECALL_STATE_IN_CALL_TRANSMITTING = 2, /**< ECALL APP TRANSMITTING */
+ QL_VOICE_ECALL_STATE_WAITING_FOR_AL_ACK = 3,
+ QL_VOICE_ECALL_STATE_IN_CALL = 4,
+ QL_VOICE_ECALL_STATE_IDLE_ALLOW_MT_ECALL = 5,
+} QL_VOICE_ECALL_STATE_E;
+
+/** eCall mode */
+typedef enum {
+ QL_VOICE_ECALL_MODE_NORMAL = 0, /**< eCall enabled normal mode. */
+ QL_VOICE_ECALL_MODE_ONLY = 1, /**< eCall-only mode. */
+ QL_VOICE_ECALL_MODE_DEFAULT = 2,
+} QL_VOICE_ECALL_MODE_E;
+
+/** eCall configuration */
+typedef struct
+{
+ uint8_t enable; /**< Enable or disable ecall: 0 -- Disable; 1 -- Enable */
+ uint8_t voice_mute; /**< 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 */
+ QL_VOICE_ECALL_MODE_E mode; /**< The Ecall mode. */
+ uint8_t report_event; /**< Enable or disable to report ecall event info.
+ 0 - Disable;
+ 1 - Enable */
+ uint16_t start_timer; /**< The timer of IVS waiting for "START". T5 */
+ uint16_t hack_timer; /**< The timer of IVS waiting for "HACK". T6 */
+ uint16_t trans_timer; /**< The timer of MSD transmission. T7 */
+ uint8_t fail_redial; /**< The dial fail times. */
+ uint8_t drop_redial; /**< The ecall abnormal disconnenct redial times. */
+ uint16_t cleardown_timer; /**< The timer of IVS waiting for "ClearDown". T2 */
+ uint16_t init_timer; /**< The timer of IVS waiting for "InitIATION". T3 */
+ uint16_t nad_reg_timer; /**< The timer of IVS waiting for "NAD Registration". T9*/
+ uint16_t nad_dereg_timer; /**< The timer of IVS waiting for "NAD Deregistration". T10*/
+ uint8_t standard; /**< The ecall system standard.
+ 0 - EU;
+ 1 - ERA_GLONASS */
+ uint16_t era_glonass_redial; /**< The timer of era glonass redial times.*/
+ uint16_t auto_answer; /**< The timer of AUTO ANSWER times.*/
+} ql_voice_ecall_config_t;
+
+/** eCall config items */
+typedef enum
+{
+ QL_VOICE_ECALL_CONFIG_ENABLE = (1 << 0),
+ QL_VOICE_ECALL_CONFIG_VOICE_MUTE = (1 << 1),
+ QL_VOICE_ECALL_CONFIG_MODE = (1 << 2),
+ QL_VOICE_ECALL_CONFIG_REPORT_EVENT = (1 << 3),
+ QL_VOICE_ECALL_CONFIG_START_TIMER = (1 << 4),
+ QL_VOICE_ECALL_CONFIG_HACK_TIMER = (1 << 5),
+ QL_VOICE_ECALL_CONFIG_TRANS_TIMER = (1 << 6),
+ QL_VOICE_ECALL_CONFIG_FAIL_REDIAL = (1 << 7),
+ QL_VOICE_ECALL_CONFIG_DROP_REDIAL = (1 << 8),
+ QL_VOICE_ECALL_CONFIG_CLEARDOWN_TIMER = (1 << 9),
+ QL_VOICE_ECALL_CONFIG_INIT_TIMER = (1 << 10),
+ QL_VOICE_ECALL_CONFIG_NAD_REG_TIMER = (1 << 11),
+ QL_VOICE_ECALL_CONFIG_NAD_DEREG_TIMER = (1 << 12),
+ QL_VOICE_ECALL_CONFIG_STANDARD = (1 << 13),
+ QL_VOICE_ECALL_CONFIG_ERA_GLONASS_REDIAL = (1 << 14),
+ QL_VOICE_ECALL_CONFIG_AUTO_ANSWER = (1 << 15),
+} QL_VOICE_ECALL_CONFIG_E;
+
+/** eCall MSD transmission status */
+typedef enum {
+ QL_VOICE_ECALL_MSD_TRANS_STATUS_NONE = -1, /**< NONE */
+ QL_VOICE_ECALL_MSD_TRANS_STATUS_SUCCESS = 0, /**< Success */
+ QL_VOICE_ECALL_MSD_TRANS_STATUS_FAILURE = 1, /**< Generic failure */
+} QL_VOICE_ECALL_MSD_TRANS_STATUS_E;
+
+typedef void (*ql_voice_ecall_status_cb_f)(uint32_t id,
+ QL_VOICE_ECALL_MSD_TRANS_STATUS_E status);
+
+typedef enum {
+ QL_VOICE_ECALL_EVENT_FAIL_NONE = 0,
+ /**< NONE*/
+ QL_VOICE_ECALL_EVENT_FAIL_TIMEOUT = 1,
+ /**< Wait for START timeout. */
+ QL_VOICE_ECALL_EVENT_FAIL_HACK_TIMEOUT = 2,
+ /**< Wait for HACK timeout. */
+ QL_VOICE_ECALL_EVENT_FAIL_MSD_TRANS_TIMEOUT = 3,
+ /**< MSD transmission timeout. */
+ QL_VOICE_ECALL_EVENT_FAIL_IVS_RESET_TIMEOUT = 4,
+ /**< IVS reset. */
+ QL_VOICE_ECALL_EVENT_FAIL_CLEAR_DOWN_FALLBACK_TIMEOUT = 5,
+ /**< clear down fallback timeout. */
+ QL_VOICE_ECALL_EVENT_FAIL_IVS_INITIATION_TIMEOUT = 6,
+ /**< IVS initiation timeout. */
+} QL_VOICE_ECALL_EVENT_FAIL_E;
+
+typedef enum {
+ QL_VOICE_ECALL_EVENT_PROCESS_IVS_NONE = 0,
+ /**< NONE*/
+ QL_VOICE_ECALL_EVENT_PROCESS_IVS_START_RECEIVED_MSD = 1,
+ /**< IVS Link Layer receives START message and starts to send MSD */
+ QL_VOICE_ECALL_EVENT_PROCESS_IVS_NACK_RECEIVED = 2,
+ /**< IVS Link Layer receives NACK message. */
+ QL_VOICE_ECALL_EVENT_PROCESS_IVS_ACK_RECEIVED = 3,
+ /**< IVS Link Layer receives the first LACK message. */
+ QL_VOICE_ECALL_EVENT_PROCESS_IVS_TX_COMPLETED = 4,
+ /**< IVS MSD transmission is complete. */
+ QL_VOICE_ECALL_EVENT_PROCESS_IVS_HLACK_RECEIVED = 5,
+ /**< IVS Link Layer receives first HACK message. */
+} QL_VOICE_ECALL_EVENT_PROCESS_E;
+
+typedef enum {
+ QL_VOICE_ECALL_EVENT_MSDUPADTE_NONE = -1,
+ /**< NONE */
+ QL_VOICE_ECALL_EVENT_MSDUPDATE_IVS_UPDATING_MSD = 0,
+ /**< Indicates MSD has been updated. */
+ QL_VOICE_ECALL_EVENT_MSDUPDATE_PSAP_REQURE_UPDATE_MSD = 1,
+ /**< Indicate to update MSD in 5 seconds. */
+ QL_VOICE_ECALL_EVENT_MSDUPDATE_IVS_UPDATE_MSD_TIMEOUT = 2,
+ /**< Indicate timeout of updating MSD and module starts to transfer the old MSD. */
+} QL_VOICE_ECALL_EVENT_MSDUPDATE_E;
+
+typedef enum {
+ QL_VOICE_ECALL_EVENT_ESTABLISH_NONE = -1,
+ /**< NONE */
+ QL_VOICE_ECALL_EVENT_ESTABLISH_SUCCESS = 0,
+ /**< Establish eCall successfully. */
+ QL_VOICE_ECALL_EVENT_ESTABLISH_FAIL = 1,
+ /**< Establish eCall fails. */
+} QL_VOICE_ECALL_EVENT_ESTABLISH_E;
+
+typedef struct {
+ uint8_t ori_remainder_times;
+ /**< Originate fail remainder times*/
+
+ uint16_t time;
+ /**< The minimum time duration between the previous call attempt */
+} ql_voice_ecall_event_originate_fail_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_voice_ecall_event_drop_redial_t; /* Type */
+
+typedef enum {
+ QL_VOICE_ECALL_EVENT_EXTEND_STATE_NONE = -1,
+ /**< NONE*/
+ QL_VOICE_ECALL_EVENT_EXTEND_STATE_START_RECV_SYN = 0,
+ /**< eCall start recevied synchronization. */
+ QL_VOICE_ECALL_EVENT_EXTEND_STATE_T9_TIMEOUT = 1,
+ /**< eCall T9 TIMEOUT. */
+ QL_VOICE_ECALL_EVENT_EXTEND_STATE_T10_TIMEOUT = 2,
+ /**< eCall T10 TIMEOUT. */
+ QL_VOICE_ECALL_EVENT_EXTEND_STATE_IVS_ALACK_RECEIVED = 3,
+ /**< IVS receives ALACK message. */
+ QL_VOICE_ECALL_EVENT_EXTEND_STATE_IVS_LLACK_RECEIVED = 4,
+ /**< IVS receives LLACK message. */
+ QL_VOICE_ECALL_EVENT_EXTEND_STATE_STOPPED = 5,
+ /**< IVS receives STOPPED message. */
+ QL_VOICE_ECALL_EVENT_EXTEND_STATE_ANSWERING_INCOMING_PSAP_ECALL = 6,
+ /**< IVS AUTO ANSWERING INCOMING PSAP ECALL. */
+ QL_VOICE_ECALL_EVENT_EXTEND_STATE_CLEARDOWN_RECEIVED = 7,
+ /**< IVS receives CLEARDOWN message. */
+ QL_VOICE_ECALL_EVENT_EXTEND_STATE_CALLBACK_TIMEOUT = 8,
+ /**< eCall CALLBACK TIMEOUT. */
+ QL_VOICE_ECALL_EVENT_IVS_NORMAL_CLEARING = 9,
+ /**< eCall IVS NORAML CLEATING. */
+ QL_VOICE_ECALL_EVENT_IVS_ABNORMAL_CLEARING = 10,
+ /**< eCall IVS ABNORAML CLEATING. */
+} QL_VOICE_ECALL_EVENT_EXTEND_STATE_E;
+
+/** eCall event */
+typedef struct
+{
+ QL_VOICE_ECALL_EVENT_FAIL_E fail;
+ /**< Event of eCall Failed.*/
+ QL_VOICE_ECALL_EVENT_PROCESS_E process;
+ /**< Event of eCall process.*/
+ QL_VOICE_ECALL_EVENT_MSDUPDATE_E msdupdate;
+ /**< Event of ecall msd update.*/
+ QL_VOICE_ECALL_EVENT_ESTABLISH_E establish;
+ /**< Event of eCall establish.*/
+ uint16_t hack_code;
+ /**< Event of eCall hack code.*/
+ ql_voice_ecall_event_originate_fail_redial_t ori_redial;
+ /**< Event of originate fail and redial.*/
+ ql_voice_ecall_event_drop_redial_t drop_redial;
+ /**< Event of drop and redial.*/
+ QL_VOICE_ECALL_EVENT_EXTEND_STATE_E extend_state;
+ /**< Event of eCall other state.*/
+} ql_voice_ecall_event_t;
+
+typedef void (*ql_voice_ecall_event_cb_f)(ql_voice_ecall_event_t *p_event);
+
+typedef void (*ql_voice_service_error_cb_f)(int error);
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Initializes voice service.
+ @return Whether the voice service was initialized successfully.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_voice_init(void);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Deinitializes voice service.
+ @return Whether the voice service was deinitialized successfully.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_voice_deinit(void);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Dials a call.
+ @param[in] num phone number to dial.
+ @param[in] len length of phone number, should be less than
+ or euqnal to QL_VOICE_MAX_PHONE_NUMBER.
+ @param[out] id call id.
+ @return Whether a voice call was successfully dialed.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_INVALID_ARG invalid argument.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_voice_dial(char *num, int len, uint32_t *id);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Cancels dialing with given id.
+ @param[in] id call id returned from dial.
+ @return Whether the voice call was successfully cancelled.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_INVALID_ARG invalid argument.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_voice_cancel_dial(uint32_t id);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief hangup all dialing.
+ @return Whether all voice call were successfully hangup.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_INVALID_ARG invalid argument.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_voice_hangup_all(void);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Answers the call.
+ @param[in] id call id returned from dial.
+ @return Whether the voice call was successfully answered.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_INVALID_ARG invalid argument.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_voice_answer(uint32_t id);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Hangs up the call.
+ @param[in] id call id returned from dial.
+ @return Whether the voice call was successfully hung up.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_INVALID_ARG invalid argument.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_voice_hangup(uint32_t id);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Holds the call when mutil calls is activated.
+ @param[in] id call id returned from dial.
+ @return Whether the voice call was successfully held.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_INVALID_ARG invalid argument.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_voice_hold(uint32_t id);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Releases the call from hold when mutil calls is activated.
+ @param[in] id call id returned from dial.
+ @return Whether the voice call was successfully unheld.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_INVALID_ARG invalid argument.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_voice_unhold(uint32_t id);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Gets call records.
+ @param[in] p_arr pointer to ql_voice_record_array_t.
+ @return Whether the call records were successfully obtained.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_INVALID_ARG invalid argument.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_voice_get_records(ql_voice_record_array_t *p_arr);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Registers or Unregisters forwarding.
+ @param[in] reg 0 - unregister, 1 - register.
+ @param[in] cond forwarding condition.
+ @param[in] num phone number.
+ @param[in] len length of phone numebr.
+ @return Whether the voice call forward was registered or unregistered successfully.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_INVALID_ARG invalid argument.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_voice_forwarding(int reg, QL_VOICE_FW_COND_E cond, char *num, int len);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Gets forwarding status.
+ @param[in] cond forwarding condition.
+ @param[out] p_status pointer to ql_voice_fw_status_t.
+ @return Whether the voice call forward status was successfully obtained.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_INVALID_ARG invalid argument.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_voice_get_forwarding_status(QL_VOICE_FW_COND_E cond, ql_voice_fw_status_t *p_status);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Enables or disables call waiting.
+ @param[in] enable 0 - disable, other - enable.
+ @return Whether the voice call waiting was enabled or disabled successfully.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_INVALID_ARG invalid argument.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_voice_waiting(int enable);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Gets call waiting status.
+ @param[out] enabled 0 - waiting is disabled, 1 - waiting is enabled.
+ @return Whether the voice call waiting status was successfully obtained.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_INVALID_ARG invalid argument.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_voice_get_waiting_status(int *enabled);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Enables or disables auto answer.
+ @param[in] enable 0 - disable, other - enable.
+ @param[in] sec wait this `sec' seconds before auto answer.
+ @return Whether the voice call autoanswer was enabled or disabled successfully.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_INVALID_ARG invalid argument.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_voice_autoanswer(int enable, uint32_t sec);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Sends a DTMF(Dual Tone Multi Frequency) character over the call ID.
+ @param[in] id call id returned from dial.
+ @param[in] c DTMF character to be sent. Valid DTMF characters are 0-9, A-D, '*', '#'.
+ @return Whether a DTMF character was successfully sent.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_INVALID_ARG invalid argument.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_voice_send_dtmf_char(uint32_t id, char c);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Sets voice call callback handler.
+ @param[in] cb call back handler.
+ @return Whether the voice call callback handler was successfully set.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_INVALID_ARG invalid argument.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_voice_set_call_cb(ql_voice_call_cb_f cb);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Sets voice dtmf callback handler.
+ @param[in] cb call back handler.
+ @return Whether the voice call DTMF repcetion callback handler was successfully set.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_INVALID_ARG invalid argument.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_voice_set_dtmf_cb(ql_voice_dtmf_cb_f cb);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Dials eCall.
+ @param[in] p_info eCall info.
+ @return Whether a eCall was successfully dialed.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_INVALID_ARG invalid argument.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_voice_ecall_dial(ql_voice_ecall_info_t *p_info);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Hangs up eCall.
+ @return Whether the eCall was successfully hung up.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_INVALID_ARG invalid argument.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_voice_ecall_hangup(void);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Updates eCall MSD.
+ @param[in] msd Minimum Set of Data.
+ @param[in] msd_len Length of Minimum Set of Data.
+ @return Whether the eCall MSD was successfully updated.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_INVALID_ARG invalid argument.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_voice_ecall_update_msd(const uint8_t *msd, uint32_t msd_len);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Pushes eCall MSD.
+ @param[out] state eCall state.
+ @return Whether the eCall MSD was successfully pushed.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_INVALID_ARG invalid argument.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_voice_ecall_push_msd(QL_VOICE_ECALL_STATE_E *state);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Gets eCall config.
+ @param[in] p_config eCall config.
+ @return Whether the eCall config was successfully obtained.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_INVALID_ARG invalid argument.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_voice_ecall_get_config(ql_voice_ecall_config_t *p_config);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Sets eCall config.
+ @param[in] item Items to set.
+ @param[in] p_config eCall config.
+ @return Whether the eCall config was successfully set.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_INVALID_ARG invalid argument.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_voice_ecall_set_config(int item, ql_voice_ecall_config_t *p_config);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Sets eCall event callback handler.
+ @param[in] cb call back handler.
+ @return Whether the eCall event callback handler was successfully set.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_INVALID_ARG invalid argument.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_voice_ecall_set_event_cb(ql_voice_ecall_event_cb_f cb);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Sets eCall status callback handler.
+ @param[in] cb call back handler.
+ @return Whether the eCall status callback handler was successfully set.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_INVALID_ARG invalid argument.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_voice_ecall_set_status_cb(ql_voice_ecall_status_cb_f cb);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Registration server error callback. Currently, only if the server exits abnormally,
+ the callback function will be executed, and the error code is QL_ERR_ABORTED;
+ @param[in] cb Callback function
+ @return
+ QL_ERR_OK - successful
+ Other - error code defined by ql_type.h
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_voice_set_service_error_cb(ql_voice_service_error_cb_f cb);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Binds the current control point to a specific subscription.
+ @param[in] sub Subscription type.
+ @return Whether the subscription was successfully bound.
+ @retval QL_ERR_OK successful.
+ @retval QL_ERR_INVALID_ARG invalid argument.
+ @retval QL_ERR_UNKNOWN unknown error, failed to connect to service.
+ @retval QL_ERR_SERVICE_NOT_READY service is not ready, need to retry.
+ @retval Other error code defined by ql_type.h.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_voice_bind_subscription(QL_VOICE_SUBSCRIPTION_E sub);
+
diff --git a/mbtk/include/ql_v2/ql_wifi.h b/mbtk/include/ql_v2/ql_wifi.h
new file mode 100755
index 0000000..90c6424
--- /dev/null
+++ b/mbtk/include/ql_v2/ql_wifi.h
@@ -0,0 +1,1172 @@
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @file ql_wifi.h
+ @brief Wi-Fi service API
+
+ @detailes
+ Quectel series module Wi-Fi service.
+
+ @htmlonly
+ <span style="font-weight: bold">History</span>
+ @endhtmlonly
+
+ when | who | what, where, why
+ -------- | --- | ----------------------------------------------------------
+ 2020-04-03 | ewen.li | Created .
+ 2021-11-08 | ewen.li | Add Wi-Fi P2P API and callback function .
+
+ Copyright (c) 2019 Quectel Wireless Solution, Co., Ltd. All Rights Reserved.
+ Quectel Wireless Solution Proprietary and Confidential.
+-------------------------------------------------------------------------------------------------*/
+#ifndef __QL_WIFI_H__
+#define __QL_WIFI_H__
+
+#include "ql_wifi_common.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Wi-Fi enable status callback function.
+
+ @param[in] pre_status: The previous Wi-Fi enable status.
+ @param[in] status: The current Wi-Fi enable status.
+
+ @retval void
+ */
+/*-----------------------------------------------------------------------------------------------*/
+typedef void (*ql_wifi_enable_status_ind_cb_f)(QL_WIFI_ENABLE_STATUS_E pre_status, QL_WIFI_ENABLE_STATUS_E status);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief AP mode status callback function.
+
+ @param[in] pre_status: The previous AP mode status.
+ @param[in] p_msg: The current AP mode status information.
+
+ @retval void
+ */
+/*-----------------------------------------------------------------------------------------------*/
+typedef void (*ql_wifi_ap_status_ind_cb_f)(QL_WIFI_AP_INDEX_E index, QL_WIFI_AP_STATUS_E pre_status, ql_wifi_ap_status_t *p_msg);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief STA mode status callback function.
+
+ @param[in] pre_status: The previous STA mode status.
+ @param[in] p_msg: The current STA mode status information.
+
+ @retval void
+ */
+/*-----------------------------------------------------------------------------------------------*/
+typedef void (*ql_wifi_sta_status_ind_cb_f)(QL_WIFI_STA_STATUS_E pre_status, ql_wifi_sta_status_t *p_msg);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief STA scan results callback function.
+
+ @param[in] p_msg: The information list of external hotspots.
+
+ @retval void
+ */
+/*-----------------------------------------------------------------------------------------------*/
+typedef void (*ql_wifi_sta_scan_result_ind_cb_f)(ql_wifi_sta_scan_result_t *p_msg);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This is a callback function for status of connection between AP and STA device.
+
+ @param[in] index: The index of AP mode.
+ @param[in] p_msg: The status of connection between AP and STA device.
+
+ @retval void
+ */
+/*-----------------------------------------------------------------------------------------------*/
+typedef void (*ql_wifi_ap_sta_connect_ind_cb_f)(QL_WIFI_AP_INDEX_E index, ql_wifi_sta_connect_status_t *p_msg);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Wi-Fi service error callback function.
+
+ @param[in] error: Error code.
+
+ @retval void
+ */
+/*-----------------------------------------------------------------------------------------------*/
+typedef void (*ql_wifi_service_error_cb_f)(int error);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This is a callback function for status of P2P enable.
+
+ @param[in] pre_status: The previous P2P enable status.
+ @param[in] status: The current P2P enable status.
+
+ @retval void
+ */
+/*-----------------------------------------------------------------------------------------------*/
+typedef void (*ql_wifi_p2p_enable_status_ind_cb_f)(QL_WIFI_P2P_ENABLE_STATUS_E pre_status, QL_WIFI_P2P_ENABLE_STATUS_E status);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief The found p2p device callback function.
+
+ @param[in] p_msg: The information of p2p device
+
+ @retval void
+ */
+/*-----------------------------------------------------------------------------------------------*/
+typedef void (*ql_wifi_p2p_dev_found_ind_cb_f)(ql_wifi_p2p_found_dev_info_t *p_msg);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief Peer p2p device requesting connection callback function.
+
+ @param[in] p_msg: The information of peer p2p device
+
+ @retval void
+ */
+/*-----------------------------------------------------------------------------------------------*/
+typedef void (*ql_wifi_p2p_peer_dev_req_ind_cb_f)(ql_wifi_p2p_req_peer_dev_info_t *pmsg);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief P2P status callback function.
+
+ @param[in] pre_status: The previous P2P status.
+ @param[in] status: The current P2P status information.
+
+ @retval void
+ */
+/*-----------------------------------------------------------------------------------------------*/
+typedef void (*ql_wifi_p2p_status_ind_cb_f)(QL_WIFI_P2P_STATUS_E pre_status, ql_wifi_p2p_status_t *p_msg);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function initializes Wi-Fi service.
+
+ @retval QL_ERR_OK: Successful execution.
+ @retval QL_ERR_SERVICE_NOT_READY: Wi-Fi service is not ready. It is recommended to try again.
+ @retval Other value: Failed execution. See ql_type.h for the error code.
+
+ @note Before other Wi-Fi APIs are used, this function must be called to initialize the Wi-Fi service.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_wifi_init(void);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function deinitializes Wi-Fi service.
+
+ @retval QL_ERR_OK: Successful execution.
+ Other value: Failed execution. See ql_type.h for the error code.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_wifi_deinit(void);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function sets the country code of wlan driver
+
+ @param[in] country_code: The country code to be set. The country code cannot exceed 2 bytes and is not empty. For example, CN represents China.
+
+ @retval QL_ERR_OK: Successful execution.
+ @retval QL_ERR_NOT_INIT: Failed execution. The Wi-Fi service is not initialized.
+ @retval QL_ERR_SERVICE_ABORT: Failed execution due to Wi-Fi service error.
+ @retval QL_ERR_INVALID_ARG: Failed execution due to illegal parameter.
+ @retval Other value: Failed execution. See ql_type.h for the error code.
+
+ @note Before calling the ql_wifi_enable(), call this function firstly to set country code,
+ If this function is not called, The country code "CN" will be used by default.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_wifi_country_code_set(const char *country_code);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function gets the country code of wlan driver.
+
+ @param[out] country_code_buf: The buffer for storing the current country code. The buffer size is recommended to be 3 bytes.
+ @param[in] The length of buffer.
+
+ @retval QL_ERR_OK: Successful execution.
+ @retval QL_ERR_NOT_INIT: Failed execution. The Wi-Fi service is not initialized.
+ @retval QL_ERR_SERVICE_ABORT: Failed execution due to Wi-Fi service error.
+ @retval QL_ERR_INVALID_ARG: Failed execution due to illegal parameter.
+ @retval Other value: Failed execution. See ql_type.h for the error code.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_wifi_country_code_get(char *country_code_buf, int buf_len);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function enables Wi-Fi function.
+
+ @retval QL_ERR_OK: Successful execution.
+ @retval QL_ERR_NOT_INIT: Failed execution. The Wi-Fi service is not initialized.
+ @retval QL_ERR_SERVICE_ABORT: Failed execution due to Wi-Fi service error.
+ @retval Other value: Failed execution. See ql_type.h for the error code.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_wifi_enable(void);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function disables Wi-Fi function.
+
+ @retval QL_ERR_OK: Successful execution.
+ @retval QL_ERR_NOT_INIT: Failed execution. The Wi-Fi service is not initialized.
+ @retval QL_ERR_SERVICE_ABORT: Failed execution due to Wi-Fi service error.
+ @retval Other value: Failed execution. See ql_type.h for the error code.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_wifi_disable(void);
+
+
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function set bridge function.
+
+ @retval QL_ERR_OK: Successful execution.
+ @retval QL_ERR_NOT_INIT: Failed execution. The Wi-Fi service is not initialized.
+ @retval QL_ERR_SERVICE_ABORT: Failed execution due to Wi-Fi service error.
+ @retval Other value: Failed execution. See ql_type.h for the error code.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_wifi_set_bridge(char *bridge);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function registers Wi-Fi enable status callback function.
+
+ @param[in] cb: The Wi-Fi enable status callback function.
+
+ @retval QL_ERR_OK: Successful execution.
+ @retval QL_ERR_NOT_INIT: Failed execution. The Wi-Fi service is not initialized.
+ @retval QL_ERR_SERVICE_ABORT: Failed execution due to Wi-Fi service error.
+ @retval Other value: Failed execution. See ql_type.h for the error code.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_wifi_set_enable_status_ind_cb(ql_wifi_enable_status_ind_cb_f cb);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function sets the Wi-Fi working mode.
+
+ @param[in] mode: The Wi-Fi working mode to be set.
+
+ @retval QL_ERR_OK: Successful execution.
+ @retval QL_ERR_NOT_INIT: Failed execution. The Wi-Fi service is not initialized.
+ @retval QL_ERR_SERVICE_ABORT: Failed execution due to Wi-Fi service error.
+ @retval QL_ERR_INVALID_ARG: Failed execution due to illegal parameter.
+ @retval Other value: Failed execution. See ql_type.h for the error code.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_wifi_work_mode_set(QL_WIFI_WORK_MODE_E mode);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function gets the current Wi-Fi working mode.
+
+ @param[out] p_mode: The current Wi-Fi working mode.
+
+ @retval QL_ERR_OK: Successful execution.
+ @retval QL_ERR_NOT_INIT: Failed execution. The Wi-Fi service is not initialized.
+ @retval QL_ERR_SERVICE_ABORT: Failed execution due to Wi-Fi service error.
+ @retval QL_ERR_INVALID_ARG: Failed execution due to illegal parameter.
+ @retval Other value: Failed execution. See ql_type.h for the error code.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_wifi_work_mode_get(QL_WIFI_WORK_MODE_E *p_mode);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function sets the SSID in AP mode.
+
+ @param[in] idx: The index of AP mode.
+ @param[in] ssid: The SSID to be set. It should be within 32 bytes and is not empty.
+
+ @retval QL_ERR_OK: Successful execution.
+ @retval QL_ERR_NOT_INIT: Failed execution. The Wi-Fi service is not initialized.
+ @retval QL_ERR_SERVICE_ABORT: Failed execution due to Wi-Fi service error.
+ @retval QL_ERR_INVALID_ARG: Failed execution due to illegal parameter.
+ @retval Other value: Failed execution. See ql_type.h for the error code.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_wifi_ap_ssid_set(QL_WIFI_AP_INDEX_E idx, const char *ssid);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function gets the SSID in AP mode.
+
+ @param[in] idx: The index of AP mode.
+ @param[out] ssid_buf: The buffer for storing the current SSID, the buffer size is recommended to be 33 bytes.
+ @param[in] buf_len: The length of the buffer.
+
+ @retval QL_ERR_OK: Successful execution.
+ @retval QL_ERR_NOT_INIT: Failed execution. The Wi-Fi service is not initialized.
+ @retval QL_ERR_SERVICE_ABORT: Failed execution due to Wi-Fi service error.
+ @retval QL_ERR_INVALID_ARG: Failed execution due to illegal parameter.
+ @retval Other value: Failed execution. See ql_type.h for the error code.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_wifi_ap_ssid_get(QL_WIFI_AP_INDEX_E idx, char *ssid_buf, int buf_len);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function sets the SSID hiding status in AP mode.
+
+ @param[in] idx: The index of AP mode.
+ @param[in] ssid_hidden: The SSID hiding status to be set.
+ 0: The SSID is not hidden.
+ 1: The SSID is hidden.
+
+ @retval QL_ERR_OK: Successful execution.
+ @retval QL_ERR_NOT_INIT: Failed execution. The Wi-Fi service is not initialized.
+ @retval QL_ERR_SERVICE_ABORT: Failed execution due to Wi-Fi service error.
+ @retval QL_ERR_INVALID_ARG: Failed execution due to illegal parameter.
+ @retval Other value: Failed execution. See ql_type.h for the error code.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_wifi_ap_ssid_hidden_set(QL_WIFI_AP_INDEX_E idx, int ssid_hidden);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function gets the SSID hiding status in AP mode.
+
+ @param[in] idx: The index of AP mode.
+ @param[out] p_ssid_hidden: The current SSID hiding status in AP mode.
+
+ @retval QL_ERR_OK: Successful execution.
+ @retval QL_ERR_NOT_INIT: Failed execution. The Wi-Fi service is not initialized.
+ @retval QL_ERR_SERVICE_ABORT: Failed execution due to Wi-Fi service error.
+ @retval QL_ERR_INVALID_ARG: Failed execution due to illegal parameter.
+ @retval Other value: Failed execution. See ql_type.h for the error code.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_wifi_ap_ssid_hidden_get(QL_WIFI_AP_INDEX_E idx, int *p_ssid_hidden);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function sets the working protocol mode in AP mode.
+
+ @param[in] idx: The index of AP mode.
+ @param[in] mode: The working protocol mode to be set.
+
+ @retval QL_ERR_OK: Successful execution.
+ @retval QL_ERR_NOT_INIT: Failed execution. The Wi-Fi service is not initialized.
+ @retval QL_ERR_SERVICE_ABORT: Failed execution due to Wi-Fi service error.
+ @retval QL_ERR_INVALID_ARG: Failed execution due to illegal parameter.
+ @retval Other value: Failed execution. See ql_type.h for the error code.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_wifi_ap_mode_set(QL_WIFI_AP_INDEX_E idx, QL_WIFI_AP_MODE_TYPE_E mode);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function gets the working protocol mode in AP mode.
+
+ @param[in] idx: The index of AP mode.
+ @param[out] p_mode: The current working protocol mode in AP mode.
+
+ @retval QL_ERR_OK: Successful execution.
+ @retval QL_ERR_NOT_INIT: Failed execution. The Wi-Fi service is not initialized.
+ @retval QL_ERR_SERVICE_ABORT: Failed execution due to Wi-Fi service error.
+ @retval QL_ERR_INVALID_ARG: Failed execution due to illegal parameter.
+ @retval Other value: Failed execution. See ql_type.h for the error code.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_wifi_ap_mode_get(QL_WIFI_AP_INDEX_E idx, QL_WIFI_AP_MODE_TYPE_E *p_mode);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function sets the bandwidth in AP mode.
+
+ @param[in] idx: The index of AP mode.
+ @param[in] bandwidth: The bandwidth to be set.
+
+ @retval QL_ERR_OK: Successful execution.
+ @retval QL_ERR_NOT_INIT: Failed execution. The Wi-Fi service is not initialized.
+ @retval QL_ERR_SERVICE_ABORT: Failed execution due to Wi-Fi service error.
+ @retval QL_ERR_INVALID_ARG: Failed execution due to illegal parameter.
+ @retval Other value: Failed execution. See ql_type.h for the error code.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_wifi_ap_bandwidth_set(QL_WIFI_AP_INDEX_E idx, QL_WIFI_BANDWIDTH_E bandwidth);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function gets the bandwidth in AP mode.
+
+ @param[in] idx: The index of AP mode.
+ @param[out] p_bandwidth: The current bandwidth in AP mode.
+
+ @retval QL_ERR_OK: Successful execution.
+ @retval QL_ERR_NOT_INIT: Failed execution. The Wi-Fi service is not initialized.
+ @retval QL_ERR_SERVICE_ABORT: Failed execution due to Wi-Fi service error.
+ @retval QL_ERR_INVALID_ARG: Failed execution due to illegal parameter.
+ @retval Other value: Failed execution. See ql_type.h for the error code.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_wifi_ap_bandwidth_get(QL_WIFI_AP_INDEX_E idx, QL_WIFI_BANDWIDTH_E *p_bandwidth);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function sets the channel in AP mode.
+
+ @param[in] idx: The index of AP mode.
+ @param[in] channel: The channel to be set.
+ 0: Adaptive
+ 1/2/3/4/5/6/7/8/9/10/11/12/13/14: 2.4G channel.
+ 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: 5GHZ channel.
+
+ @retval QL_ERR_OK: Successful execution.
+ @retval QL_ERR_NOT_INIT: Failed execution. The Wi-Fi service is not initialized.
+ @retval QL_ERR_SERVICE_ABORT: Failed execution due to Wi-Fi service error.
+ @retval QL_ERR_INVALID_ARG: Failed execution due to illegal parameter.
+ @retval Other value: Failed execution. See ql_type.h for the error code.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_wifi_ap_channel_set(QL_WIFI_AP_INDEX_E idx, int channel);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function gets the channel in AP mode.
+
+ @param[in] idx: The index of AP mode.
+ @param[out] p_channel: The currently-used channel in AP mode.
+
+ @retval QL_ERR_OK: Successful execution.
+ @retval QL_ERR_NOT_INIT: Failed execution. The Wi-Fi service is not initialized.
+ @retval QL_ERR_SERVICE_ABORT: Failed execution due to Wi-Fi service error.
+ @retval QL_ERR_INVALID_ARG: Failed execution due to illegal parameter.
+ @retval Other value: Failed execution. See ql_type.h for the error code.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_wifi_ap_channel_get(QL_WIFI_AP_INDEX_E idx, int *p_channel);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function sets the maximum number of terminal connections in AP mode.
+
+ @param[in] idx: The index of AP mode.
+ @param[in] max_sta_num: The maximum number of terminal connections in AP mode to be set. Range: 1~32.
+
+ @retval QL_ERR_OK: Successful execution.
+ @retval QL_ERR_NOT_INIT: Failed execution. The Wi-Fi service is not initialized.
+ @retval QL_ERR_SERVICE_ABORT: Failed execution due to Wi-Fi service error.
+ @retval QL_ERR_INVALID_ARG: Failed execution due to illegal parameter.
+ @retval Other value: Failed execution. See ql_type.h for the error code.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_wifi_ap_max_sta_num_set(QL_WIFI_AP_INDEX_E idx, int max_sta_num);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function gets the maximum number of terminal connections in AP mode.
+
+ @param[in] idx: The index of AP mode.
+ @param[out] p_max_sta_num: The current maximum number of terminal connections in AP mode.
+
+ @retval QL_ERR_OK: Successful execution.
+ @retval QL_ERR_NOT_INIT: Failed execution. The Wi-Fi service is not initialized.
+ @retval QL_ERR_SERVICE_ABORT: Failed execution due to Wi-Fi service error.
+ @retval QL_ERR_INVALID_ARG: Failed execution due to illegal parameter.
+ @retval Other value: Failed execution. See ql_type.h for the error code.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_wifi_ap_max_sta_num_get(QL_WIFI_AP_INDEX_E idx, int *p_max_sta_num);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function sets the country code in AP mode.
+
+ @param[in] idx: The index of AP mode.
+ @param[in] country_code: The country code to be set. The country code cannot exceed 2 bytes and is not empty. For example, CN represents China.
+
+ @retval QL_ERR_OK: Successful execution.
+ @retval QL_ERR_NOT_INIT: Failed execution. The Wi-Fi service is not initialized.
+ @retval QL_ERR_SERVICE_ABORT: Failed execution due to Wi-Fi service error.
+ @retval QL_ERR_INVALID_ARG: Failed execution due to illegal parameter.
+ @retval Other value: Failed execution. See ql_type.h for the error code.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_wifi_ap_country_code_set(QL_WIFI_AP_INDEX_E idx, const char *country_code);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function gets the country code in AP mode.
+
+ @param[in] idx: The index of AP mode.
+ @param[out] country_code_buf: The buffer for storing the current country code. The buffer size is recommended to be 3 bytes.
+ @param[in] The length of buffer.
+
+ @retval QL_ERR_OK: Successful execution.
+ @retval QL_ERR_NOT_INIT: Failed execution. The Wi-Fi service is not initialized.
+ @retval QL_ERR_SERVICE_ABORT: Failed execution due to Wi-Fi service error.
+ @retval QL_ERR_INVALID_ARG: Failed execution due to illegal parameter.
+ @retval Other value: Failed execution. See ql_type.h for the error code.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_wifi_ap_country_code_get(QL_WIFI_AP_INDEX_E idx, char *country_code_buf, int buf_len);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function sets the AP isolation state.
+
+ @param[in] idx: The index of AP mode.
+ @param[in] isolate: AP isolation status to be set.
+ 0: AP is not isolated.
+ 1: AP is isolated.
+
+ @retval QL_ERR_OK: Successful execution.
+ @retval QL_ERR_NOT_INIT: Failed execution. The Wi-Fi service is not initialized.
+ @retval QL_ERR_SERVICE_ABORT: Failed execution due to Wi-Fi service error.
+ @retval QL_ERR_INVALID_ARG: Failed execution due to illegal parameter.
+ @retval Other value: Failed execution. See ql_type.h for the error code.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_wifi_ap_isolate_set(QL_WIFI_AP_INDEX_E idx, int isolate);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function gets the AP isolation state.
+
+ @param[in] idx: The index of AP mode.
+ @param[out] p_isolate: The current AP isolation status.
+ 0: AP is not isolated.
+ 1: AP is isolated.
+
+ @retval QL_ERR_OK: Successful execution.
+ @retval QL_ERR_NOT_INIT: Failed execution. The Wi-Fi service is not initialized.
+ @retval QL_ERR_SERVICE_ABORT: Failed execution due to Wi-Fi service error.
+ @retval QL_ERR_INVALID_ARG: Failed execution due to illegal parameter.
+ @retval Other value: Failed execution. See ql_type.h for the error code.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_wifi_ap_isolate_get(QL_WIFI_AP_INDEX_E idx, int *p_isolate);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function sets MAC address access rules in AP mode.
+
+ @param[in] idx: The index of AP mode.
+ @param[in] acl_rule: MAC address access rules to be set.
+
+ @retval QL_ERR_OK: Successful execution.
+ @retval QL_ERR_NOT_INIT: Failed execution. The Wi-Fi service is not initialized.
+ @retval QL_ERR_SERVICE_ABORT: Failed execution due to Wi-Fi service error.
+ @retval QL_ERR_INVALID_ARG: Failed execution due to illegal parameter.
+ @retval Other value: Failed execution. See ql_type.h for the error code.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_wifi_ap_mac_acl_rule_set(QL_WIFI_AP_INDEX_E idx, QL_WIFI_MAC_ACL_RULE_E acl_rule);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function gets MAC address access rules in AP mode.
+
+ @param[in] idx: The index of AP mode.
+ @param[out] p_acl_rule: The current MAC address access rules.
+
+ @retval QL_ERR_OK: Successful execution.
+ @retval QL_ERR_NOT_INIT: Failed execution. The Wi-Fi service is not initialized.
+ @retval QL_ERR_SERVICE_ABORT: Failed execution due to Wi-Fi service error.
+ @retval QL_ERR_INVALID_ARG: Failed execution due to illegal parameter.
+ @retval Other value: Failed execution. See ql_type.h for the error code.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_wifi_ap_mac_acl_rule_get(QL_WIFI_AP_INDEX_E idx, QL_WIFI_MAC_ACL_RULE_E *p_acl_rule);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function adds or deletes the specified MAC address for the current MAC address access rule.
+
+ @param[in] idx: The index of AP mode.
+ @param[in] cmd: MAC address operation command.
+ @param[in] macaddr: MAC address to be added or deleted., The format of MAC address
+ must be %02X:%02X:%02X:%02X:%02X:%02X, For example: 1A:2B:3C:4D:56:78.
+
+ @retval QL_ERR_OK: Successful execution.
+ @retval QL_ERR_NOT_INIT: Failed execution. The Wi-Fi service is not initialized.
+ @retval QL_ERR_SERVICE_ABORT: Failed execution due to Wi-Fi service error.
+ @retval QL_ERR_INVALID_ARG: Failed execution due to illegal parameter.
+ @retval Other value: Failed execution. See ql_type.h for the error code.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_wifi_ap_acl_mac_set(QL_WIFI_AP_INDEX_E idx, QL_WIFI_ACL_MAC_CMD_E cmd, const char *macaddr);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function gets all MAC addresses in the current MAC address access rule.
+
+ @param[in] idx: The index of AP mode.
+ @param[out] p_mac_list: MAC address list.
+
+ @retval QL_ERR_OK: Successful execution.
+ @retval QL_ERR_NOT_INIT: Failed execution. The Wi-Fi service is not initialized.
+ @retval QL_ERR_SERVICE_ABORT: Failed execution due to Wi-Fi service error.
+ @retval QL_ERR_INVALID_ARG: Failed execution due to illegal parameter.
+ @retval Other value: Failed execution. See ql_type.h for the error code.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_wifi_ap_acl_mac_get(QL_WIFI_AP_INDEX_E idx, ql_wifi_acl_mac_list_t *p_mac_list);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function sets the authentication in AP mode.
+
+ @param[in] idx: The index of AP mode.
+ @param[in] p_auth: The authentication information to be set.
+
+ @retval QL_ERR_OK: Successful execution.
+ @retval QL_ERR_NOT_INIT: Failed execution. The Wi-Fi service is not initialized.
+ @retval QL_ERR_SERVICE_ABORT: Failed execution due to Wi-Fi service error.
+ @retval QL_ERR_INVALID_ARG: Failed execution due to illegal parameter.
+ @retval Other value: Failed execution. See ql_type.h for the error code.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_wifi_ap_auth_set(QL_WIFI_AP_INDEX_E idx, ql_wifi_ap_auth_t *p_auth);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function gets the authentication information in AP mode.
+
+ @param[in] idx: The index of AP mode.
+ @param[out] p_auth: The current authentication information.
+
+ @retval QL_ERR_OK: Successful execution.
+ @retval QL_ERR_NOT_INIT: Failed execution. The Wi-Fi service is not initialized.
+ @retval QL_ERR_SERVICE_ABORT: Failed execution due to Wi-Fi service error.
+ @retval QL_ERR_INVALID_ARG: Failed execution due to illegal parameter.
+ @retval Other value: Failed execution. See ql_type.h for the error code.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_wifi_ap_auth_get(QL_WIFI_AP_INDEX_E idx, ql_wifi_ap_auth_t *p_auth);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function registers the AP mode status callback function.
+
+ @param[in] cb: The AP mode status callback function.
+
+ @retval QL_ERR_OK: Successful execution.
+ @retval QL_ERR_NOT_INIT: Failed execution. The Wi-Fi service is not initialized.
+ @retval QL_ERR_SERVICE_ABORT: Failed execution due to Wi-Fi service error.
+ @retval Other value: Failed execution. See ql_type.h for the error code.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_wifi_ap_set_status_ind_cb(ql_wifi_ap_status_ind_cb_f cb);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function starts the AP function.
+
+ @param[in] index: The index of AP mode.
+
+ @retval QL_ERR_OK: Successful execution.
+ @retval QL_ERR_NOT_INIT: Failed execution. The Wi-Fi service is not initialized.
+ @retval QL_ERR_SERVICE_ABORT: Failed execution due to Wi-Fi service error.
+ @retval QL_ERR_INVALID_ARG: Failed execution due to illegal parameter.
+ @retval Other value: Failed execution. See ql_type.h for the error code.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_wifi_ap_start(QL_WIFI_AP_INDEX_E index);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function stops the AP function.
+
+ @param[in] index: The index of AP mode.
+
+ @retval QL_ERR_OK: Successful execution.
+ @retval QL_ERR_NOT_INIT: Failed execution. The Wi-Fi service is not initialized.
+ @retval QL_ERR_SERVICE_ABORT: Failed execution due to Wi-Fi service error.
+ @retval QL_ERR_INVALID_ARG: Failed execution due to illegal parameter.
+ @retval Other value: Failed execution. See ql_type.h for the error code.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_wifi_ap_stop(QL_WIFI_AP_INDEX_E index);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function gets the AP mode status information.
+
+ @param[in] index: The index of AP mode.
+ @param[out] p_sta: The current AP mode status information.
+
+ @retval QL_ERR_OK: Successful execution.
+ @retval QL_ERR_NOT_INIT: Failed execution. The Wi-Fi service is not initialized.
+ @retval QL_ERR_SERVICE_ABORT: Failed execution due to Wi-Fi service error.
+ @retval QL_ERR_INVALID_ARG: Failed execution due to illegal parameter.
+ @retval Other value: Failed execution. See ql_type.h for the error code.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_wifi_ap_get_status(QL_WIFI_AP_INDEX_E index, ql_wifi_ap_status_t *p_sta);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function sets the SSID in STA mode.
+
+ @param[in] ssid: The SSID to be set. The SSID cannot exceed 32 bytes and is not empty.
+
+ @retval QL_ERR_OK: Successful execution.
+ @retval QL_ERR_NOT_INIT: Failed execution. The Wi-Fi service is not initialized.
+ @retval QL_ERR_SERVICE_ABORT: Failed execution due to Wi-Fi service error.
+ @retval QL_ERR_INVALID_ARG: Failed execution due to illegal parameter.
+ @retval Other value: Failed execution. See ql_type.h for the error code.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_wifi_sta_ssid_set(const char *ssid);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function gets the SSID in STA mode.
+
+ @param[out] ssid_buf: The buffer for storing the current SSID.
+ @param[in] buf_len: The length of the buffer.
+
+ @retval QL_ERR_OK: Successful execution.
+ @retval QL_ERR_NOT_INIT: Failed execution. The Wi-Fi service is not initialized.
+ @retval QL_ERR_SERVICE_ABORT: Failed execution due to Wi-Fi service error.
+ @retval QL_ERR_INVALID_ARG: Failed execution due to illegal parameter.
+ @retval Other value: Failed execution. See ql_type.h for the error code.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_wifi_sta_ssid_get(char *ssid_buf, int buf_len);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function sets the authentication in STA mode.
+
+ @param[in] p_auth: The authentication information to be set.
+
+ @retval QL_ERR_OK: Successful execution.
+ @retval QL_ERR_NOT_INIT: Failed execution. The Wi-Fi service is not initialized.
+ @retval QL_ERR_SERVICE_ABORT: Failed execution due to Wi-Fi service error.
+ @retval QL_ERR_INVALID_ARG: Failed execution due to illegal parameter.
+ @retval Other value: Failed execution. See ql_type.h for the error code.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_wifi_sta_auth_set(ql_wifi_sta_auth_t *p_auth);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function gets the authentication information in STA mode.
+
+ @param[out] p_auth: The current authentication information.
+
+ @retval QL_ERR_OK: Successful execution.
+ @retval QL_ERR_NOT_INIT: Failed execution. The Wi-Fi service is not initialized.
+ @retval QL_ERR_SERVICE_ABORT: Failed execution due to Wi-Fi service error.
+ @retval QL_ERR_INVALID_ARG: Failed execution due to illegal parameter.
+ @retval Other value: Failed execution. See ql_type.h for the error code.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_wifi_sta_auth_get(ql_wifi_sta_auth_t *p_auth);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function registers the STA mode status callback function.
+
+ @param[in] cb: The STA mode status callback function.
+
+ @retval QL_ERR_OK: Successful execution.
+ @retval QL_ERR_NOT_INIT: Failed execution. The Wi-Fi service is not initialized.
+ @retval QL_ERR_SERVICE_ABORT: Failed execution due to Wi-Fi service error.
+ @retval Other value: Failed execution. See ql_type.h for the error code.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_wifi_sta_set_status_ind_cb(ql_wifi_sta_status_ind_cb_f cb);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function starts the STA function.
+
+ @retval QL_ERR_OK: Successful execution.
+ @retval QL_ERR_NOT_INIT: Failed execution. The Wi-Fi service is not initialized.
+ @retval QL_ERR_SERVICE_ABORT: Failed execution due to Wi-Fi service error.
+ @retval Other value: Failed execution. See ql_type.h for the error code.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_wifi_sta_start(void);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function stops the STA function.
+
+ @retval QL_ERR_OK: Successful execution.
+ @retval QL_ERR_NOT_INIT: Failed execution. The Wi-Fi service is not initialized.
+ @retval QL_ERR_SERVICE_ABORT: Failed execution due to Wi-Fi service error.
+ @retval Other value: Failed execution. See ql_type.h for the error code.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_wifi_sta_stop(void);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function gets the STA mode status information.
+
+ @param[out] p_sta: The current STA mode status information.
+
+ @retval QL_ERR_OK: Successful execution.
+ @retval QL_ERR_NOT_INIT: Failed execution. The Wi-Fi service is not initialized.
+ @retval QL_ERR_SERVICE_ABORT: Failed execution due to Wi-Fi service error.
+ @retval QL_ERR_INVALID_ARG: Failed execution due to illegal parameter.
+ @retval Other value: Failed execution. See ql_type.h for the error code.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_wifi_sta_get_status(ql_wifi_sta_status_t *p_sta);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function scans for external hotspots in STA mode.
+
+ @retval QL_ERR_OK: Successful execution.
+ @retval QL_ERR_NOT_INIT: Failed execution. The Wi-Fi service is not initialized.
+ @retval QL_ERR_SERVICE_ABORT: Failed execution due to Wi-Fi service error.
+ @retval Other value: Failed execution. See ql_type.h for the error code.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_wifi_sta_start_scan(void);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function registers the scan result callback function.
+
+ @param[in] cb: The scan result callback function.
+
+ @retval QL_ERR_OK: Successful execution.
+ @retval QL_ERR_NOT_INIT: Failed execution. The Wi-Fi service is not initialized.
+ @retval QL_ERR_SERVICE_ABORT: Failed execution due to Wi-Fi service error.
+ @retval Other value: Failed execution. See ql_type.h for the error code.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_wifi_sta_set_scan_result_ind_cb(ql_wifi_sta_scan_result_ind_cb_f cb);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function registers the callback function for status of connection between AP and STA device.
+
+ @param[in] cb: The callback function for status of connection between AP and STA device.
+
+ @retval QL_ERR_OK: Successful execution.
+ @retval QL_ERR_NOT_INIT: Failed execution. The Wi-Fi service is not initialized.
+ @retval QL_ERR_SERVICE_ABORT: Failed execution due to Wi-Fi service error.
+ @retval Other value: Failed execution. See ql_type.h for the error code.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_wifi_set_ap_sta_connect_ind_cb(ql_wifi_ap_sta_connect_ind_cb_f cb);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function registers the Wi-Fi service error callback function.
+
+ @param[in] cb: Wi-Fi service error callback function, executed only when the Wi-Fi service exits abnormally.
+
+ @retval QL_ERR_OK: Successful execution.
+ @retval QL_ERR_NOT_INIT: Failed execution. The Wi-Fi service is not initialized.
+ @retval QL_ERR_SERVICE_ABORT: Failed execution due to Wi-Fi service error.
+ @retval Other value: Failed execution. See ql_type.h for the error code.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_wifi_set_service_error_cb(ql_wifi_service_error_cb_f cb);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function sets the P2P device name.
+
+ @param[in] dev_name: The device name to be set.
+
+ @retval QL_ERR_OK: Successful execution.
+ @retval QL_ERR_NOT_INIT: Failed execution. The Wi-Fi service is not initialized.
+ @retval QL_ERR_SERVICE_ABORT: Failed execution due to Wi-Fi service error.
+ @retval QL_ERR_INVALID_ARG: Failed execution due to illegal parameter.
+ @retval Other value: Failed execution. See ql_type.h for the error code.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_wifi_p2p_dev_name_set(const char *dev_name);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function gets the P2P device name.
+
+ @param[out] dev_name_buf: The buffer for storing the current device name.
+ @param[in] buf_len: The length of the buffer.
+
+ @retval QL_ERR_OK: Successful execution.
+ @retval QL_ERR_NOT_INIT: Failed execution. The Wi-Fi service is not initialized.
+ @retval QL_ERR_SERVICE_ABORT: Failed execution due to Wi-Fi service error.
+ @retval QL_ERR_INVALID_ARG: Failed execution due to illegal parameter.
+ @retval Other value: Failed execution. See ql_type.h for the error code.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_wifi_p2p_dev_name_get(char *dev_name_buf, int buf_len);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function sets the P2P device type.
+
+ @param[in] dev_type: The device type to be set.
+
+ @retval QL_ERR_OK: Successful execution.
+ @retval QL_ERR_NOT_INIT: Failed execution. The Wi-Fi service is not initialized.
+ @retval QL_ERR_SERVICE_ABORT: Failed execution due to Wi-Fi service error.
+ @retval QL_ERR_INVALID_ARG: Failed execution due to illegal parameter.
+ @retval Other value: Failed execution. See ql_type.h for the error code.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_wifi_p2p_dev_type_set(const char *dev_type);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function gets the P2P device type.
+
+ @param[out] dev_type_buf: The buffer for storing the current device type.
+ @param[in] buf_len: The length of the buffer.
+
+ @retval QL_ERR_OK: Successful execution.
+ @retval QL_ERR_NOT_INIT: Failed execution. The Wi-Fi service is not initialized.
+ @retval QL_ERR_SERVICE_ABORT: Failed execution due to Wi-Fi service error.
+ @retval QL_ERR_INVALID_ARG: Failed execution due to illegal parameter.
+ @retval Other value: Failed execution. See ql_type.h for the error code.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_wifi_p2p_dev_type_get(char *dev_type_buf, int buf_len);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function sets the operating class and operating channel in P2P mode.
+
+ @param[in] oper_class: The operating class to be set.
+ @param[in] oper_channel: The operating channel to be set.
+
+ @retval QL_ERR_OK: Successful execution.
+ @retval QL_ERR_NOT_INIT: Failed execution. The Wi-Fi service is not initialized.
+ @retval QL_ERR_SERVICE_ABORT: Failed execution due to Wi-Fi service error.
+ @retval QL_ERR_INVALID_ARG: Failed execution due to illegal parameter.
+ @retval Other value: Failed execution. See ql_type.h for the error code.
+
+ @note The operating class and operating channel can determine the center frequency,
+ The following are the corresponding values.
+ --------------------------------------------------------------------------------------------
+ | oper_class | oper_channel | frequency | channel spacing |
+ |-------------------------------------------------------------------------------------------
+ | 81 | 1-13 | 2407 + 5 * oper_channel | 25MHz |
+ | 82 | 14 | 2414 + 5 * oper_channel | 25MHz |
+ | 115 | 36,40,44,48 | 5000 + 5 * oper_channel | 20MHz |
+ | 116 | 36,44 | 5000 + 5 * oper_channel | 40MHz |
+ | 117 | 40,48 | 5000 + 5 * oper_channel | 40MHz |
+ | 124 | 149,153,157,161 | 5000 + 5 * oper_channel | 20MHz |
+ | 125 | 149,153,157,161,165 | 5000 + 5 * oper_channel | 20MHz |
+ | 126 | 149,157 | 5000 + 5 * oper_channel | 40MHz |
+ | 127 | 153,161 | 5000 + 5 * oper_channel | 40MHz |
+ --------------------------------------------------------------------------------------------
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_wifi_p2p_oper_class_channel_set(int oper_class, int oper_channel);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function gets the operating class and operating channel in P2P mode.
+
+ @param[out] p_oper_class: The currently-used operating class in p2p mode.
+ @param[out] p_oper_channel: The currently-used operating channel in p2p mode.
+
+ @retval QL_ERR_OK: Successful execution.
+ @retval QL_ERR_NOT_INIT: Failed execution. The Wi-Fi service is not initialized.
+ @retval QL_ERR_SERVICE_ABORT: Failed execution due to Wi-Fi service error.
+ @retval QL_ERR_INVALID_ARG: Failed execution due to illegal parameter.
+ @retval Other value: Failed execution. See ql_type.h for the error code.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_wifi_p2p_oper_class_channel_get(int *p_oper_class, int *p_oper_channel);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function sets the suffix of ssid.
+
+ @param[in] ssid_postfix: The suffix of ssid to be set.
+
+ @retval QL_ERR_OK: Successful execution.
+ @retval QL_ERR_NOT_INIT: Failed execution. The Wi-Fi service is not initialized.
+ @retval QL_ERR_SERVICE_ABORT: Failed execution due to Wi-Fi service error.
+ @retval QL_ERR_INVALID_ARG: Failed execution due to illegal parameter.
+ @retval Other value: Failed execution. See ql_type.h for the error code.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_wifi_p2p_ssid_postfix_set(const char *ssid_postfix);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function gets the suffix of ssid.
+
+ @param[out] ssid_postfix_buf: The buffer for storing the current suffix of ssid.
+ @param[in] buf_len: The length of the buffer.
+
+ @retval QL_ERR_OK: Successful execution.
+ @retval QL_ERR_NOT_INIT: Failed execution. The Wi-Fi service is not initialized.
+ @retval QL_ERR_SERVICE_ABORT: Failed execution due to Wi-Fi service error.
+ @retval QL_ERR_INVALID_ARG: Failed execution due to illegal parameter.
+ @retval Other value: Failed execution. See ql_type.h for the error code.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_wifi_p2p_ssid_postfix_get(char *ssid_postfix_buf, int buf_len);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function registers the P2P enable status callback function.
+
+ @param[in] cb: P2P enable status callback function.
+
+ @retval QL_ERR_OK: Successful execution.
+ @retval QL_ERR_NOT_INIT: Failed execution. The Wi-Fi service is not initialized.
+ @retval QL_ERR_SERVICE_ABORT: Failed execution due to Wi-Fi service error.
+ @retval Other value: Failed execution. See ql_type.h for the error code.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_wifi_p2p_set_enable_status_ind_cb(ql_wifi_p2p_enable_status_ind_cb_f cb);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function enables P2P function.
+
+ @retval QL_ERR_OK: Successful execution.
+ @retval QL_ERR_NOT_INIT: Failed execution. The Wi-Fi service is not initialized.
+ @retval QL_ERR_SERVICE_ABORT: Failed execution due to Wi-Fi service error.
+ @retval Other value: Failed execution. See ql_type.h for the error code.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_wifi_p2p_enable(void);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function disables P2P function.
+
+ @retval QL_ERR_OK: Successful execution.
+ @retval QL_ERR_NOT_INIT: Failed execution. The Wi-Fi service is not initialized.
+ @retval QL_ERR_SERVICE_ABORT: Failed execution due to Wi-Fi service error.
+ @retval Other value: Failed execution. See ql_type.h for the error code.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_wifi_p2p_disable(void);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function registers the found p2p device callback function.
+
+ @param[in] cb: The found p2p device callback function.
+
+ @retval QL_ERR_OK: Successful execution.
+ @retval QL_ERR_NOT_INIT: Failed execution. The Wi-Fi service is not initialized.
+ @retval QL_ERR_SERVICE_ABORT: Failed execution due to Wi-Fi service error.
+ @retval Other value: Failed execution. See ql_type.h for the error code.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_wifi_p2p_set_dev_found_ind_cb(ql_wifi_p2p_dev_found_ind_cb_f cb);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function start finding P2P device.
+
+ @retval QL_ERR_OK: Successful execution.
+ @retval QL_ERR_NOT_INIT: Failed execution. The Wi-Fi service is not initialized.
+ @retval QL_ERR_SERVICE_ABORT: Failed execution due to Wi-Fi service error.
+ @retval Other value: Failed execution. See ql_type.h for the error code.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_wifi_p2p_dev_find_start(void);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function stop finding P2P device.
+
+ @retval QL_ERR_OK: Successful execution.
+ @retval QL_ERR_NOT_INIT: Failed execution. The Wi-Fi service is not initialized.
+ @retval QL_ERR_SERVICE_ABORT: Failed execution due to Wi-Fi service error.
+ @retval Other value: Failed execution. See ql_type.h for the error code.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_wifi_p2p_dev_find_stop(void);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function gets P2P mode status information.
+
+ @param[out] p_status: The current P2P mode status information.
+
+ @retval QL_ERR_OK: Successful execution.
+ @retval QL_ERR_NOT_INIT: Failed execution. The Wi-Fi service is not initialized.
+ @retval QL_ERR_SERVICE_ABORT: Failed execution due to Wi-Fi service error.
+ @retval QL_ERR_INVALID_ARG: Failed execution due to illegal parameter.
+ @retval Other value: Failed execution. See ql_type.h for the error code.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_wifi_p2p_get_status(ql_wifi_p2p_status_t *p_status);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function registers the P2P status callback function.
+
+ @param[in] cb: The P2P status callback function.
+
+ @retval QL_ERR_OK: Successful execution.
+ @retval QL_ERR_NOT_INIT: Failed execution. The Wi-Fi service is not initialized.
+ @retval QL_ERR_SERVICE_ABORT: Failed execution due to Wi-Fi service error.
+ @retval Other value: Failed execution. See ql_type.h for the error code.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_wifi_p2p_set_status_ind_cb(ql_wifi_p2p_status_ind_cb_f cb);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function registers peer p2p device requesting connection callback function.
+
+ @param[in] cb: Peer p2p device requesting connection callback function.
+
+ @retval QL_ERR_OK: Successful execution.
+ @retval QL_ERR_NOT_INIT: Failed execution. The Wi-Fi service is not initialized.
+ @retval QL_ERR_SERVICE_ABORT: Failed execution due to Wi-Fi service error.
+ @retval Other value: Failed execution. See ql_type.h for the error code.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_wifi_p2p_set_peer_dev_req_ind_cb(ql_wifi_p2p_peer_dev_req_ind_cb_f cb);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function establishes a P2P connection.
+
+ @param[in] macaddr: The MAC address of peer P2P device.
+ @param[in] wps_method: key words: "pbc", "pin" and pin_code, The pin_code is a string that
+ dynamically generated random from peer display.
+ @param[in] go_intent: Degree of desire to be GO, range: 0-15.
+
+ @retval QL_ERR_OK: Successful execution.
+ @retval QL_ERR_NOT_INIT: Failed execution. The Wi-Fi service is not initialized.
+ @retval QL_ERR_SERVICE_ABORT: Failed execution due to Wi-Fi service error.
+ @retval QL_ERR_INVALID_ARG: Failed execution due to illegal parameter.
+ @retval Other value: Failed execution. See ql_type.h for the error code.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_wifi_p2p_connect(const char *macaddr, const char *method, int go_intent);
+
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @brief This function disconnects a P2P connection
+
+ @retval QL_ERR_OK: Successful execution.
+ @retval QL_ERR_NOT_INIT: Failed execution. The Wi-Fi service is not initialized.
+ @retval QL_ERR_SERVICE_ABORT: Failed execution due to Wi-Fi service error.
+ @retval Other value: Failed execution. See ql_type.h for the error code.
+ */
+/*-----------------------------------------------------------------------------------------------*/
+int ql_wifi_p2p_disconnect(void);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
diff --git a/mbtk/include/ql_v2/ql_wifi_common.h b/mbtk/include/ql_v2/ql_wifi_common.h
new file mode 100755
index 0000000..1a67e60
--- /dev/null
+++ b/mbtk/include/ql_v2/ql_wifi_common.h
@@ -0,0 +1,435 @@
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @file ql_wifi_common.h
+ @brief Wi-Fi common data struct
+
+ @detailes
+ Quectel series module Wi-Fi service.
+
+ @htmlonly
+ <span style="font-weight: bold">History</span>
+ @endhtmlonly
+
+ when | who | what, where, why
+ -------- | --- | ----------------------------------------------------------
+ 2020-04-03 | ewen.li | Created .
+ 2021-11-08 | ewen.li | Add Wi-Fi P2P data structure .
+
+ Copyright (c) 2019 Quectel Wireless Solution, Co., Ltd. All Rights Reserved.
+ Quectel Wireless Solution Proprietary and Confidential.
+-------------------------------------------------------------------------------------------------*/
+#ifndef __QL_WIFI_COMMON_H__
+#define __QL_WIFI_COMMON_H__
+
+#include "ql_net_common.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define QL_WIFI_MAX_STA_NUM (32) /**< Maximum number of external STA device that can be connected in AP mode */
+#define QL_WIFI_MAX_ACL_MAC_CNT (32) /**< Maximum number of MAC address that can be set by access rule */
+#define QL_WIFI_MAX_SCAN_INFO_CNT (60) /**< Maximum number of AP information that can be scanned in STA mode */
+#define QL_WIFI_MAX_LONG_MSG_LEN_V01 4096
+#define IS_VALID_QL_WIFI_SSID_HIDDEN(hidden) ((0 == hidden) || (1 == hidden))
+#define IS_VALID_QL_WIFI_ISOLATE(isolate) ((0 == isolate) || (1 == isolate))
+#define IS_VALID_QL_WIFI_MAX_STA_NUM(max_sta) ((1 <= max_sta) && (QL_WIFI_MAX_STA_NUM >= max_sta))
+
+typedef enum QL_WIFI_WORK_MODE_ENUM
+{
+ QL_WIFI_WORK_MODE_MIN = -1,
+ QL_WIFI_WORK_MODE_STA = 0, /**< STA mode */
+ QL_WIFI_WORK_MODE_AP0, /**< Single AP mode */
+ QL_WIFI_WORK_MODE_MAX
+} QL_WIFI_WORK_MODE_E;
+#define IS_VALID_QL_WIFI_WORK_MODE(mode) ((mode>QL_WIFI_WORK_MODE_MIN) && (mode<QL_WIFI_WORK_MODE_MAX))
+
+typedef enum QL_WIFI_INDEX_ENUM
+{
+ QL_WIFI_AP_INDEX_MIN = -1,
+ QL_WIFI_AP_INDEX_AP0 = 0, /**< Index of hotspot 0 */
+ QL_WIFI_AP_INDEX_MAX
+} QL_WIFI_AP_INDEX_E;
+#define IS_VALID_QL_WIFI_INDEX(idx) ((idx>QL_WIFI_AP_INDEX_MIN) && (idx<QL_WIFI_AP_INDEX_MAX))
+
+typedef enum
+{
+ QL_WIFI_SUB_REASON_NONE = 0,
+ QL_WIFI_SUB_REASON_WRONG_KEY = 1,
+ QL_WIFI_SUB_REASON_AUTH_FAILED = 2,
+ QL_WIFI_SUB_REASON_NO_PSK_AVAILABLE = 3,
+ QL_WIFI_SUB_REASON_CONN_FAILED = 4,
+
+ QL_WIFI_SUB_REASON_P2P_GRP_REM_SILENT = 5,
+ QL_WIFI_SUB_REASON_P2P_GRP_REM_FORMATION_FAILED = 6,
+ QL_WIFI_SUB_REASON_P2P_GRP_REM_REQUESTED = 7,
+ QL_WIFI_SUB_REASON_P2P_GRP_REM_IDLE_TIMEOUT= 8,
+ QL_WIFI_SUB_REASON_P2P_GRP_REM_UNAVAILABLE = 9,
+ QL_WIFI_SUB_REASON_P2P_GRP_REM_GO_ENDING_SESSION = 10,
+ QL_WIFI_SUB_REASON_P2P_GRP_REM_PSK_FAILURE = 11,
+ QL_WIFI_SUB_REASON_P2P_GRP_REM_FREQ_CONFLICT = 12,
+ QL_WIFI_SUB_REASON_P2P_GRP_REM_GO_LEAVE_CHANNEL = 13,
+
+ QL_WIFI_SUB_REASON_P2P_FAIL_BASE = 15,
+ QL_WIFI_SUB_REASON_P2P_FAIL_INFO_CURRENTLY_UNAVAILABLE = 16,
+ QL_WIFI_SUB_REASON_P2P_FAIL_INCOMPATIBLE_PARAMS = 17,
+ QL_WIFI_SUB_REASON_P2P_FAIL_LIMIT_REACHED = 18,
+ QL_WIFI_SUB_REASON_P2P_FAIL_INVALID_PARAMS = 19,
+ QL_WIFI_SUB_REASON_P2P_FAIL_UNABLE_TO_ACCOMMODATE = 20,
+ QL_WIFI_SUB_REASON_P2P_FAIL_PREV_PROTOCOL_ERROR = 21,
+ QL_WIFI_SUB_REASON_P2P_FAIL_NO_COMMON_CHANNELS = 22,
+ QL_WIFI_SUB_REASON_P2P_FAIL_UNKNOWN_GROUP = 23,
+ QL_WIFI_SUB_REASON_P2P_FAIL_BOTH_GO_INTENT_15 = 24,
+ QL_WIFI_SUB_REASON_P2P_FAIL_INCOMPATIBLE_PROV_METHOD = 25,
+ QL_WIFI_SUB_REASON_P2P_FAIL_REJECTED_BY_USER = 26,
+ QL_WIFI_SUB_REASON_P2P_FAIL_TIMEOUT = 27,
+
+ QL_WIFI_SUB_REASON_UNKNOW
+} QL_WIFI_SUB_REASON_CODE_E;
+
+typedef enum
+{
+ /**< Reason codes (IEEE Std 802.11-2016, 9.4.1.7, Table 9-45) */
+ QL_WIFI_REASON_SUCCEED = 0,
+ QL_WIFI_REASON_UNSPECIFIED = 1,
+ QL_WIFI_REASON_PREV_AUTH_NOT_VALID = 2,
+ QL_WIFI_REASON_DEAUTH_LEAVING = 3,
+ QL_WIFI_REASON_DISASSOC_DUE_TO_INACTIVITY = 4,
+ QL_WIFI_REASON_DISASSOC_AP_BUSY = 5,
+ QL_WIFI_REASON_CLASS2_FRAME_FROM_NONAUTH_STA = 6,
+ QL_WIFI_REASON_CLASS3_FRAME_FROM_NONASSOC_STA = 7,
+ QL_WIFI_REASON_DISASSOC_STA_HAS_LEFT = 8,
+ QL_WIFI_REASON_STA_REQ_ASSOC_WITHOUT_AUTH = 9,
+ QL_WIFI_REASON_PWR_CAPABILITY_NOT_VALID = 10,
+ QL_WIFI_REASON_SUPPORTED_CHANNEL_NOT_VALID = 11,
+ QL_WIFI_REASON_BSS_TRANSITION_DISASSOC = 12,
+ QL_WIFI_REASON_INVALID_IE = 13,
+ QL_WIFI_REASON_MICHAEL_MIC_FAILURE = 14,
+ QL_WIFI_REASON_4WAY_HANDSHAKE_TIMEOUT = 15,
+ QL_WIFI_REASON_GROUP_KEY_UPDATE_TIMEOUT = 16,
+ QL_WIFI_REASON_IE_IN_4WAY_DIFFERS = 17,
+ QL_WIFI_REASON_GROUP_CIPHER_NOT_VALID = 18,
+ QL_WIFI_REASON_PAIRWISE_CIPHER_NOT_VALID = 19,
+ QL_WIFI_REASON_AKMP_NOT_VALID = 20,
+ QL_WIFI_REASON_UNSUPPORTED_RSN_IE_VERSION = 21,
+ QL_WIFI_REASON_INVALID_RSN_IE_CAPAB = 22,
+ QL_WIFI_REASON_IEEE_802_1X_AUTH_FAILED = 23,
+ QL_WIFI_REASON_CIPHER_SUITE_REJECTED = 24,
+ QL_WIFI_REASON_TDLS_TEARDOWN_UNREACHABLE = 25,
+ QL_WIFI_REASON_TDLS_TEARDOWN_UNSPECIFIED = 26,
+ QL_WIFI_REASON_SSP_REQUESTED_DISASSOC = 27,
+ QL_WIFI_REASON_NO_SSP_ROAMING_AGREEMENT = 28,
+ QL_WIFI_REASON_BAD_CIPHER_OR_AKM = 29,
+ QL_WIFI_REASON_NOT_AUTHORIZED_THIS_LOCATION = 30,
+ QL_WIFI_REASON_SERVICE_CHANGE_PRECLUDES_TS = 31,
+ QL_WIFI_REASON_UNSPECIFIED_QOS_REASON = 32,
+ QL_WIFI_REASON_NOT_ENOUGH_BANDWIDTH = 33,
+ QL_WIFI_REASON_DISASSOC_LOW_ACK = 34,
+ QL_WIFI_REASON_EXCEEDED_TXOP = 35,
+ QL_WIFI_REASON_STA_LEAVING = 36,
+ QL_WIFI_REASON_END_TS_BA_DLS = 37,
+ QL_WIFI_REASON_UNKNOWN_TS_BA = 38,
+ QL_WIFI_REASON_TIMEOUT = 39,
+ QL_WIFI_REASON_PEERKEY_MISMATCH = 45,
+ QL_WIFI_REASON_AUTHORIZED_ACCESS_LIMIT_REACHED = 46,
+ QL_WIFI_REASON_EXTERNAL_SERVICE_REQUIREMENTS = 47,
+ QL_WIFI_REASON_INVALID_FT_ACTION_FRAME_COUNT = 48,
+ QL_WIFI_REASON_INVALID_PMKID = 49,
+ QL_WIFI_REASON_INVALID_MDE = 50,
+ QL_WIFI_REASON_INVALID_FTE = 51,
+ QL_WIFI_REASON_MESH_PEERING_CANCELLED = 52,
+ QL_WIFI_REASON_MESH_MAX_PEERS = 53,
+ QL_WIFI_REASON_MESH_CONFIG_POLICY_VIOLATION = 54,
+ QL_WIFI_REASON_MESH_CLOSE_RCVD = 55,
+ QL_WIFI_REASON_MESH_MAX_RETRIES = 56,
+ QL_WIFI_REASON_MESH_CONFIRM_TIMEOUT = 57,
+ QL_WIFI_REASON_MESH_INVALID_GTK = 58,
+ QL_WIFI_REASON_MESH_INCONSISTENT_PARAMS = 59,
+ QL_WIFI_REASON_MESH_INVALID_SECURITY_CAP = 60,
+ QL_WIFI_REASON_MESH_PATH_ERROR_NO_PROXY_INFO = 61,
+ QL_WIFI_REASON_MESH_PATH_ERROR_NO_FORWARDING_INFO = 62,
+ QL_WIFI_REASON_MESH_PATH_ERROR_DEST_UNREACHABLE = 63,
+ QL_WIFI_REASON_MAC_ADDRESS_ALREADY_EXISTS_IN_MBSS = 64,
+ QL_WIFI_REASON_MESH_CHANNEL_SWITCH_REGULATORY_REQ = 65,
+ QL_WIFI_REASON_MESH_CHANNEL_SWITCH_UNSPECIFIED = 66,
+
+ /**< Reason codes (Quectel extentions) */
+ QL_WIFI_REASON_SSID_NOT_FOUND = 10000,
+ QL_WIFI_REASON_P2P_GO_NEG_FAILURE = 10001,
+ QL_WIFI_REASON_P2P_GROUP_REMOVED = 10002
+} QL_WIFI_REASON_CODE_E;
+
+typedef enum QL_WIFI_AP_MODE_TYPE_ENUM
+{
+ QL_WIFI_AP_MODE_MIN = -1,
+ QL_WIFI_AP_MODE_80211B = 0, /**< IEEE 802.11b (2.4 GHz) */
+ QL_WIFI_AP_MODE_80211BG, /**< IEEE 802.11bg (2.4 GHz) */
+ QL_WIFI_AP_MODE_80211BGN, /**< IEEE 802.11bgn (2.4 GHz) */
+ QL_WIFI_AP_MODE_80211AX_2G, /**< IEEE 802.11ax (2.4 GHz) */
+ QL_WIFI_AP_MODE_MAX
+} QL_WIFI_AP_MODE_TYPE_E;
+#define IS_VALID_QL_WIFI_AP_MODE(mode) ((mode > QL_WIFI_AP_MODE_MIN) && (mode < QL_WIFI_AP_MODE_MAX))
+
+typedef enum QL_WIFI_BANDWIDTH_ENUM
+{
+ QL_WIFI_BANDWIDTH_MIN = -1,
+ QL_WIFI_BANDWIDTH_20MHZ = 0, /**< 20MHZ */
+ QL_WIFI_BANDWIDTH_40MHZ, /**< 40MHZ */
+ QL_WIFI_BANDWIDTH_80MHZ, /**< 80MHZ */
+ QL_WIFI_BANDWIDTH_160MHZ, /**< 160MHZ */
+ QL_WIFI_BANDWIDTH_MAX
+} QL_WIFI_BANDWIDTH_E;
+#define IS_VALID_QL_WIFI_BANDWIDTH(bandwidth) ((bandwidth > QL_WIFI_BANDWIDTH_MIN) && (bandwidth < QL_WIFI_BANDWIDTH_MAX))
+
+typedef enum QL_WIFI_AUTH_ENUM
+{
+ QL_WIFI_AUTH_MIN = -1,
+ QL_WIFI_AUTH_OPEN = 0, /**< OPEN */
+ QL_WIFI_AUTH_WEP, /**< WEP */
+ QL_WIFI_AUTH_WPA_PSK, /**< WPA Personal */
+ QL_WIFI_AUTH_WPA2_PSK, /**< WPA2 Personal */
+ QL_WIFI_AUTH_WPA3_PSK, /**< WPA3 Personal */
+ QL_WIFI_AUTH_WPA_WPA2_PSK_BOTH, /**< WPA&WPA2 Personal */
+ QL_WIFI_AUTH_WPA2_WPA3_PSK_BOTH, /**< WPA2&WPA3 Personal */
+ QL_WIFI_AUTH_WPA_WPA2_WPA3_PSK_ALL, /**< WPA&WPA2&WPA3 Personal */
+ QL_WIFI_AUTH_MAX
+} QL_WIFI_AUTH_E;
+#define IS_VALID_QL_WIFI_AUTH(auth) ((auth > QL_WIFI_AUTH_MIN) && (auth < QL_WIFI_AUTH_MAX))
+
+typedef enum QL_WIFI_AUTH_WPA_PSK_ENUM
+{
+ QL_WIFI_AUTH_WPA_PAIRWISE_MIN = -1,
+ QL_WIFI_AUTH_WPA_PAIRWISE_AUTO = 0, /**< TKIP and AES */
+ QL_WIFI_AUTH_WPA_PAIRWISE_TKIP, /**< TKIP */
+ QL_WIFI_AUTH_WPA_PAIRWISE_AES, /**< AES */
+ QL_WIFI_AUTH_WPA_PAIRWISE_MAX
+} QL_WIFI_AUTH_WPA_PSK_E;
+#define IS_VALID_QL_WIFI_AUTH_WPA_PSK(pairwise) ((pairwise > QL_WIFI_AUTH_WPA_PAIRWISE_MIN) && (pairwise < QL_WIFI_AUTH_WPA_PAIRWISE_MAX))
+
+typedef enum QL_WIFI_STATUS_ENUM
+{
+ QL_WIFI_STATUS_DISABLED = 0, /**< Wi-Fi is disabled */
+ QL_WIFI_STATUS_ENABLED, /**< Wi-Fi is enabled */
+ QL_WIFI_STATUS_ERROR /**< An error occurs in enabling Wi-Fi */
+} QL_WIFI_ENABLE_STATUS_E;
+
+typedef enum QL_WIFI_MAC_RULE_ENUM
+{
+ QL_WIFI_MAC_ACL_RULE_MIN = -1,
+ QL_WIFI_MAC_ACL_RULE_NONE = 0, /**< No rules */
+ QL_WIFI_MAC_ACL_RULE_BLACK, /**< Blacklist */
+ QL_WIFI_MAC_ACL_RULE_WHITE, /**< Whitelist */
+ QL_WIFI_MAC_ACL_RULE_MAX
+} QL_WIFI_MAC_ACL_RULE_E;
+#define IS_VALID_QL_WIFI_ACL_RULE(acl_rule) ((acl_rule > QL_WIFI_MAC_ACL_RULE_MIN) && (acl_rule < QL_WIFI_MAC_ACL_RULE_MAX))
+
+typedef enum QL_WIFI_STA_STATUS_ENUM
+{
+ QL_WIFI_STA_STATUS_NONE, /**< The corresponding Wi-Fi working mode is not set */
+ QL_WIFI_STA_STATUS_IDLE, /**< The corresponding Wi-Fi working mode is set, but the STA function is not enabled */
+ QL_WIFI_STA_STATUS_CONNECTING, /**< Connecting to AP */
+ QL_WIFI_STA_STATUS_ASSOCIATED, /**< Connected to AP, but no IP address is assigned */
+ QL_WIFI_STA_STATUS_CONNECTED, /**< Connected to the AP and an IP address is assigned */
+ QL_WIFI_STA_STATUS_DISCONNECTED, /**< Disconnected from AP */
+ QL_WIFI_STA_STATUS_ERROR /**< Error status */
+} QL_WIFI_STA_STATUS_E;
+
+typedef enum QL_WIFI_AP_STATUS_ENUM
+{
+ QL_WIFI_AP_STATUS_NONE, /**< The corresponding Wi-Fi working mode is not set */
+ QL_WIFI_AP_STATUS_IDLE, /**< The corresponding Wi-Fi working mode is set, but the AP function is not enabled */
+ QL_WIFI_AP_STATUS_ENABLING, /**< This status indication is not currently supported */
+ QL_WIFI_AP_STATUS_ENABLED, /**< After the AP function is successfully enabled, this status indication will be activated */
+ QL_WIFI_AP_STATUS_DISABLING, /**< This status indication is not currently supported */
+ QL_WIFI_AP_STATUS_ERROR /**< Error status */
+} QL_WIFI_AP_STATUS_E;
+
+typedef struct ql_wifi_ind_ap_status_struct
+{
+ QL_WIFI_AP_STATUS_E status; /**< The status of AP mode */
+ char ifname[32]; /**< Linux network interface name, such as wlan0, wlan1, etc */
+ char bssid[18]; /**< BSSID, basic service set identifier */
+}ql_wifi_ap_status_t;
+
+typedef struct {
+
+ /* Mandatory */
+ int32_t msg_id;
+
+ /* Mandatory */
+ int32_t result;
+
+ /* Mandatory */
+ uint32_t msg_data_len; /**< Must be set to # of elements in msg_data */
+ uint8_t msg_data[4096];
+}ql_ipc_wifi_rsp_msg_v01; /* Message */
+
+/** Message; */
+typedef struct {
+
+ /* Mandatory */
+ int32_t msg_id;
+
+ /* Mandatory */
+ uint32_t msg_data_len; /**< Must be set to # of elements in msg_data */
+ uint8_t msg_data[];
+}ql_ipc_wifi_req_msg_v01; /* Message */
+typedef struct ql_wifi_sta_status_struct
+{
+ QL_WIFI_STA_STATUS_E status; /**< The status of STA mode */
+ char ifname[32]; /**< Linux network interface name, such as wlan0, wlan1, etc */
+ char ap_bssid[18]; /**< BSSID, basic service set identifier */
+ int rssi; /**< The signal strength when the STA device is connected to the hotspot. Unit: dBm. -9999 indicates the invalid value */
+ uint8_t has_addr; /**< Whether it is an IPv4 address or not */
+ ql_net_addr_t addr; /**< IPv4 address. ql_net_addr_t is defined in the header file ql_net_common.h */
+ uint8_t has_addr6; /**< Whether it is an IPv6 address or not */
+ ql_net_addr6_t addr6; /**< IPv6 address. ql_net_addr6_t is defined in the header file ql_net_common.h */
+ QL_WIFI_REASON_CODE_E reason_code; /**< STA error reason code */
+ QL_WIFI_SUB_REASON_CODE_E sub_reason_code; /**< STA error sub-reason code */
+} ql_wifi_sta_status_t;
+
+typedef struct
+{
+ int is_connected; /**< Connection status. 1 means connected; 0 means disconnected */
+ char macaddr[18]; /**< MAC address of STA device */
+}ql_wifi_sta_connect_status_t;
+
+typedef struct ql_wifi_sta_scan_info_struct
+{
+ char bssid[18]; /**< BSSID, basic service set identifier */
+ char essid[33]; /**< ESSID, extended service set identifier */
+ int signal; /**< Signal strength. Unit: dBm */
+ int frequency; /**< The current operating frequency. Unit: Hz */
+ QL_WIFI_AUTH_E auth;
+} ql_wifi_sta_scan_info_t;
+
+typedef struct ql_wifi_sta_scan_list_struct
+{
+ int cnt; /**< Number of external hotspots scanned */
+ ql_wifi_sta_scan_info_t info[QL_WIFI_MAX_SCAN_INFO_CNT]; /**< Information of scanned external hotspots */
+}ql_wifi_sta_scan_list_t;
+
+typedef struct ql_wifi_sta_scan_result_struct
+{
+ int scan_is_busy;/**< Whether scan is busy, 1 means busy, 0 means idle */
+ ql_wifi_sta_scan_list_t scan_list; /**< The list of scan result */
+}ql_wifi_sta_scan_result_t;
+
+typedef struct
+{
+ QL_WIFI_AUTH_E auth; /**< Authentication type */
+ union
+ {
+ /**< wep authentication information */
+ struct
+ {
+ int default_index; /**< WEP configuration index */
+ char passwd[4][64]; /**< WEP password */
+ } wep;
+
+ /**< wpa_psk authentication information */
+ struct
+ {
+ QL_WIFI_AUTH_WPA_PSK_E pairwise; /**< Encryption type */
+ char passwd[64]; /**< WPA_PSK password */
+ int group_rekey; /**< Group key update period */
+ } wpa_psk;
+ }info;
+} ql_wifi_ap_auth_t;
+
+typedef struct
+{
+ QL_WIFI_AUTH_E auth; /**< Authentication type */
+ union
+ {
+ /**< wep authentication information */
+ struct
+ {
+ char passwd[64]; /**< WEP password */
+ } wep;
+
+ /**< wpa_psk authentication information */
+ struct
+ {
+ QL_WIFI_AUTH_WPA_PSK_E pairwise; /**< Encryption type */
+ char passwd[64]; /**< WPA_PSK password */
+ } wpa_psk;
+ }info;
+} ql_wifi_sta_auth_t;
+
+typedef struct
+{
+ char macaddr[18]; /**< MAC address. The format is: %02X:%02X:%02X:%02X:%02X:%02X. For example: 2F:3F:4F:5F:6F:7F */
+}ql_wifi_mac_addr_t;
+
+typedef struct
+{
+ int cnt; /**< Number of MAC addresses, the maximum value is 32 */
+ ql_wifi_mac_addr_t addr[QL_WIFI_MAX_ACL_MAC_CNT]; /**< MAC address list */
+}ql_wifi_acl_mac_list_t;
+
+typedef enum
+{
+ QL_WIFI_ACL_MAC_CMD_DEL = 0, /**< Delete the MAC address */
+ QL_WIFI_ACL_MAC_CMD_ADD /**< Add the MAC address */
+}QL_WIFI_ACL_MAC_CMD_E;
+
+typedef enum
+{
+ QL_WIFI_P2P_ROLE_NONE = 0, /**< No role */
+ QL_WIFI_P2P_ROLE_CLI, /**< client role */
+ QL_WIFI_P2P_ROLE_GO /**< group owner role */
+}QL_WIFI_P2P_ROLE_E;
+
+typedef enum
+{
+ QL_WIFI_P2P_EN_STATUS_DISABLED = 0, /**< Wi-Fi P2P is disabled */
+ QL_WIFI_P2P_EN_STATUS_ENABLED, /**< Wi-Fi P2P is enabled */
+ QL_WIFI_P2P_EN_STATUS_ERROR /**< An error occurs in enabling Wi-Fi P2P */
+}QL_WIFI_P2P_ENABLE_STATUS_E;
+
+typedef enum
+{
+ QL_WIFI_P2P_STATUS_IDLE = 0, /**< Initial status */
+ QL_WIFI_P2P_STATUS_CONNECTING, /**< P2P is connecting peer p2p device, including p2p role negotiation */
+ QL_WIFI_P2P_STATUS_ASSOCIATED, /**< P2P client connected with peer P2P device but no IP address is assigned */
+ QL_WIFI_P2P_STATUS_CONNECTED, /**< P2P GO or client connected with peer P2P device, and an IP address is assigned */
+ QL_WIFI_P2P_STATUS_DISCONNECTED, /**< P2P disconnected */
+ QL_WIFI_P2P_STATUS_ERROR, /**< Error status */
+}QL_WIFI_P2P_STATUS_E;
+
+typedef struct
+{
+ int is_found; /**< Found or Lost, 1 means P2P deivce found; 0 means P2P device lost */
+ char macaddr[18]; /**< MAC address of P2P device */
+ char dev_type[32]; /**< Type of P2P device */
+ char dev_name[32]; /**< Name of P2P device */
+}ql_wifi_p2p_found_dev_info_t;
+
+typedef struct
+{
+ char macaddr[18]; /**< MAC address of peer P2P device */
+}ql_wifi_p2p_req_peer_dev_info_t;
+
+typedef struct
+{
+ QL_WIFI_P2P_STATUS_E status; /**< The status of P2P */
+ QL_WIFI_P2P_ROLE_E role; /**< The role of P2P */
+ int freq; /**< The frequency of P2P */
+ char ssid[33]; /**< The ssid of GO */
+ char passwd[64]; /**< The passwd of ssid */
+ char pin_code[9]; /**< Dynamically generated random from local display */
+ char ifname[32]; /**< Linux network interface name, such as p2p0 */
+ uint8_t has_addr; /**< Whether it is an IPv4 address or not */
+ ql_net_addr_t addr; /**< IPv4 address. ql_net_addr_t is defined in the header file ql_net_common.h */
+ uint8_t has_addr6; /**< Whether it is an IPv6 address or not */
+ ql_net_addr6_t addr6; /**< IPv6 address. ql_net_addr6_t is defined in the header file ql_net_common.h */
+ QL_WIFI_REASON_CODE_E reason_code; /**< reason code */
+ QL_WIFI_SUB_REASON_CODE_E sub_reason_code; /**< sub-reason code */
+} ql_wifi_p2p_status_t;
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
diff --git a/mbtk/include/ql_v2/ql_wifi_internal.h b/mbtk/include/ql_v2/ql_wifi_internal.h
new file mode 100755
index 0000000..6a58fac
--- /dev/null
+++ b/mbtk/include/ql_v2/ql_wifi_internal.h
@@ -0,0 +1,312 @@
+/*-----------------------------------------------------------------------------------------------*/
+/**
+ @file ql_wifi_internal.h
+ @brief WIFI internal define
+*/
+/*-----------------------------------------------------------------------------------------------*/
+
+/*-------------------------------------------------------------------------------------------------
+ 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
+ -------- --- -------------------------------------------uint8_t---------------
+ 2020-11-09 tyler.kuang Created .
+-------------------------------------------------------------------------------------------------*/
+
+#ifndef __QL_WIFI_INTERNAL_H__
+#define __QL_WIFI_INTERNAL_H__
+#include <stdint.h>
+#include "ql_wifi_common.h"
+
+#define QL_WIFI_SRV_READY_FLAG "/tmp/ql_wifi_service_ready.flag"
+typedef struct
+{
+ int msg_id;
+ int msg_req_size;
+ int msg_rsp_size;
+} ql_wifi_msg_t;
+
+typedef enum
+{
+ QL_WIFI_REQ_MSG_ID_IM = 0,
+ QL_WIFI_REQ_MSG_ID_SET_ENABLE,
+ QL_WIFI_REQ_MSG_ID_GET_STATUS,
+ QL_WIFI_REQ_MSG_ID_SET_CFG,
+ QL_WIFI_REQ_MSG_ID_GET_CFG,
+ QL_WIFI_REQ_MSG_ID_SET_AP_CFG,
+ QL_WIFI_REQ_MSG_ID_GET_AP_CFG,
+ QL_WIFI_REQ_MSG_ID_START_AP,
+ QL_WIFI_REQ_MSG_ID_GET_AP_STATUS,
+ QL_WIFI_REQ_MSG_ID_SET_STA_CFG,
+ QL_WIFI_REQ_MSG_ID_GET_STA_CFG,
+ QL_WIFI_REQ_MSG_ID_START_STA,
+ QL_WIFI_REQ_MSG_ID_GET_STA_STATUS,
+ QL_WIFI_REQ_MSG_ID_STA_START_SCAN,
+ QL_WIFI_REQ_MSG_ID_P2P_SET_CFG,
+ QL_WIFI_REQ_MSG_ID_P2P_GET_CFG,
+ QL_WIFI_REQ_MSG_ID_P2P_ENABLE,
+ QL_WIFI_REQ_MSG_ID_P2P_DEV_FIND,
+ QL_WIFI_REQ_MSG_ID_P2P_CONNECT,
+ QL_WIFI_REQ_MSG_ID_P2P_DISCONNECT,
+ QL_WIFI_REQ_MSG_ID_P2P_GET_STATUS,
+ QL_WIFI_REQ_MSG_ID_EVENT_REG,
+ QL_WIFI_IND_MSG_ID_WIFI_STATUS,
+ QL_WIFI_IND_MSG_ID_WIFI_AP_STATUS,
+ QL_WIFI_IND_MSG_ID_WIFI_STA_STATUS,
+ QL_WIFI_IND_MSG_ID_WIFI_STA_SCAN_RESULT,
+ QL_WIFI_IND_MSG_ID_WIFI_AP_STA_CONNECT,
+ QL_WIFI_IND_MSG_ID_WIFI_P2P_ENABLE_STATUS,
+ QL_WIFI_IND_MSG_ID_WIFI_P2P_DEV_FOUND,
+ QL_WIFI_IND_MSG_ID_WIFI_P2P_PEER_DEV_REQ,
+ QL_WIFI_IND_MSG_ID_WIFI_P2P_STATUS
+} QL_WIFI_REQ_MSG_ID_E;
+
+typedef struct {
+ uint8_t is_enable;
+}ql_wifi_req_msg_set_wifi_enable_t;
+
+typedef struct {
+ QL_WIFI_ENABLE_STATUS_E status;
+}ql_wifi_rsp_msg_get_wifi_status_t;
+
+typedef struct {
+ uint8_t work_mode_valid;
+ QL_WIFI_WORK_MODE_E work_mode;
+ uint8_t country_code_valid;
+ uint8_t bridge_code_valid;
+ char country_code[3];
+ char bridge[50];
+} ql_wifi_req_msg_set_wifi_cfg_t;
+
+typedef struct {
+ QL_WIFI_WORK_MODE_E work_mode;
+ char country_code[3];
+} ql_wifi_rsp_msg_get_wifi_cfg_t;
+
+typedef struct{
+ QL_WIFI_AP_INDEX_E idx;
+ uint8_t ssid_valid;
+ char ssid[33];
+ uint8_t mode_valid;
+ QL_WIFI_AP_MODE_TYPE_E mode;
+ uint8_t auth_valid;
+ ql_wifi_ap_auth_t auth;
+ uint8_t channel_valid;
+ uint16_t channel;
+ uint8_t bandwidth_valid;
+ QL_WIFI_BANDWIDTH_E bandwidth;
+ uint8_t max_sta_valid;
+ uint8_t max_sta;
+ uint8_t isolate_valid;
+ uint8_t isolate;
+ uint8_t ssid_hidden_valid;
+ uint8_t ssid_hidden;
+ uint8_t country_code_valid;
+ char country_code[3];
+ uint8_t acl_rule_valid;
+ QL_WIFI_MAC_ACL_RULE_E acl_rule;
+ uint8_t acl_mac_valid;
+ QL_WIFI_ACL_MAC_CMD_E cmd;
+ char macaddr[18];
+} ql_wifi_req_msg_set_wifi_ap_cfg_t;
+
+typedef struct
+{
+ QL_WIFI_AP_INDEX_E idx;
+} ql_wifi_req_msg_get_wifi_ap_cfg_t;
+
+typedef struct{
+ QL_WIFI_AP_INDEX_E idx;
+ char ssid[33];
+ char country_code[3];
+ QL_WIFI_AP_MODE_TYPE_E mode;
+ ql_wifi_ap_auth_t auth;
+ uint16_t channel;
+ QL_WIFI_BANDWIDTH_E bandwidth;
+ uint8_t max_sta;
+ uint8_t isolate;
+ uint8_t ssid_hidden;
+ QL_WIFI_MAC_ACL_RULE_E acl_rule;
+ ql_wifi_acl_mac_list_t mac_list;
+} ql_wifi_rsp_msg_get_wifi_ap_cfg_t;
+
+typedef struct {
+ QL_WIFI_AP_INDEX_E idx;
+ uint8_t is_start;
+}ql_wifi_req_msg_start_wifi_ap_t;
+
+typedef struct {
+ QL_WIFI_AP_INDEX_E idx;
+}ql_wifi_req_msg_get_wifi_ap_status_t;
+
+typedef struct {
+ ql_wifi_ap_status_t status;
+}ql_wifi_rsp_msg_get_wifi_ap_status_t;
+
+typedef struct {
+ uint8_t ssid_valid;
+ char ssid[33];
+ uint8_t auth_valid;
+ ql_wifi_ap_auth_t auth;
+} ql_wifi_req_msg_set_wifi_sta_cfg_t;
+
+typedef struct {
+ char ssid[33];
+ ql_wifi_sta_auth_t auth;
+} ql_wifi_rsp_msg_get_wifi_sta_cfg_t;
+
+typedef struct {
+ uint8_t is_start;
+} ql_wifi_req_msg_start_wifi_sta_t;
+
+typedef struct {
+ ql_wifi_sta_status_t status;
+} ql_wifi_rsp_msg_get_wifi_sta_status_t;
+
+typedef struct {
+ uint8_t is_enable;
+}ql_wifi_req_msg_p2p_enable_t;
+
+typedef struct{
+ uint8_t dev_name_valid;
+ char dev_name[32];
+ uint8_t dev_type_valid;
+ char dev_type[32];
+ uint8_t oper_class_channel_valid;
+ int oper_class;
+ int oper_channel;
+ uint8_t ssid_postfix_valid;
+ char ssid_postfix[32];
+} ql_wifi_req_msg_p2p_set_cfg_t;
+
+typedef struct{
+ char dev_name[32];
+ char dev_type[32];
+ char ssid_postfix[32];
+ int oper_class;
+ int oper_channel;
+} ql_wifi_req_msg_p2p_get_cfg_t;
+
+typedef struct {
+ uint8_t is_find;
+}ql_wifi_req_msg_p2p_dev_find_t;
+
+typedef struct {
+ char macaddr[18];
+ char method[9];
+ int go_intent;
+}ql_wifi_req_msg_p2p_connect_t;
+
+typedef struct {
+ ql_wifi_p2p_status_t status;
+} ql_wifi_rsp_msg_p2p_get_status_t;
+
+typedef struct {
+ uint8_t wifi_valid;
+ uint8_t wifi;
+ uint8_t wifi_ap_valid;
+ uint8_t wifi_ap;
+ uint8_t wifi_sta_valid;
+ uint8_t wifi_sta;
+ uint8_t wifi_sta_scan_vaild;
+ uint8_t wifi_sta_scan;
+ uint8_t wifi_ap_sta_connect_valid;
+ uint8_t wifi_ap_sta_connect;
+ uint8_t wifi_p2p_enable_status_valid;
+ uint8_t wifi_p2p_enable_status;
+ uint8_t wifi_p2p_dev_found_valid;
+ uint8_t wifi_p2p_dev_found;
+ uint8_t wifi_p2p_peer_dev_req_valid;
+ uint8_t wifi_p2p_peer_dev_req;
+ uint8_t wifi_p2p_status_valid;
+ uint8_t wifi_p2p_status;
+}ql_wifi_req_msg_event_reg_t;
+
+typedef struct {
+ QL_WIFI_ENABLE_STATUS_E pre_status;
+ QL_WIFI_ENABLE_STATUS_E status;
+} ql_wifi_ind_msg_wifi_status_t;
+
+typedef struct {
+ QL_WIFI_AP_INDEX_E index;
+ QL_WIFI_AP_STATUS_E pre_status;
+ ql_wifi_ap_status_t status;
+} ql_wifi_ind_msg_wifi_ap_status_t;
+
+typedef struct {
+ QL_WIFI_STA_STATUS_E pre_status;
+ ql_wifi_sta_status_t status;
+} ql_wifi_ind_msg_wifi_sta_status_t;
+
+typedef struct {
+ ql_wifi_sta_scan_result_t scan_result;
+} ql_wifi_ind_msg_wifi_sta_scan_result_t;
+
+typedef struct {
+ QL_WIFI_AP_INDEX_E index;
+ ql_wifi_sta_connect_status_t conn_status;
+}ql_wifi_ind_msg_wifi_ap_sta_connect_status_t;
+
+typedef struct {
+ QL_WIFI_P2P_ENABLE_STATUS_E pre_status;
+ QL_WIFI_P2P_ENABLE_STATUS_E status;
+} ql_wifi_ind_msg_wifi_p2p_enable_status_t;
+
+typedef struct {
+ ql_wifi_p2p_found_dev_info_t dev_info;
+}ql_wifi_ind_msg_wifi_p2p_dev_found_t;
+
+typedef struct {
+ ql_wifi_p2p_req_peer_dev_info_t dev_info;
+}ql_wifi_ind_msg_wifi_p2p_peer_dev_req_t;
+
+typedef struct {
+ QL_WIFI_P2P_STATUS_E pre_status;
+ ql_wifi_p2p_status_t status;
+}ql_wifi_ind_msg_wifi_p2p_status_t;
+
+
+static ql_wifi_msg_t ql_wifi_msgs[] =
+{
+ {QL_WIFI_REQ_MSG_ID_SET_ENABLE, sizeof(ql_wifi_req_msg_set_wifi_enable_t), 0},
+ {QL_WIFI_REQ_MSG_ID_GET_STATUS, 0, sizeof(ql_wifi_rsp_msg_get_wifi_status_t)},
+ {QL_WIFI_REQ_MSG_ID_SET_CFG, sizeof(ql_wifi_req_msg_set_wifi_cfg_t), 0},
+ {QL_WIFI_REQ_MSG_ID_GET_CFG, 0, sizeof(ql_wifi_rsp_msg_get_wifi_cfg_t)},
+ {QL_WIFI_REQ_MSG_ID_SET_AP_CFG, sizeof(ql_wifi_req_msg_set_wifi_ap_cfg_t), 0},
+ {QL_WIFI_REQ_MSG_ID_GET_AP_CFG, sizeof(ql_wifi_req_msg_get_wifi_ap_cfg_t), sizeof(ql_wifi_rsp_msg_get_wifi_ap_cfg_t)},
+ {QL_WIFI_REQ_MSG_ID_START_AP, sizeof(ql_wifi_req_msg_start_wifi_ap_t), 0},
+ {QL_WIFI_REQ_MSG_ID_GET_AP_STATUS, sizeof(ql_wifi_req_msg_get_wifi_ap_status_t), sizeof(ql_wifi_rsp_msg_get_wifi_ap_status_t)},
+ {QL_WIFI_REQ_MSG_ID_SET_STA_CFG, sizeof(ql_wifi_req_msg_set_wifi_sta_cfg_t), 0},
+ {QL_WIFI_REQ_MSG_ID_GET_STA_CFG, 0, sizeof(ql_wifi_rsp_msg_get_wifi_sta_cfg_t)},
+ {QL_WIFI_REQ_MSG_ID_START_STA, sizeof(ql_wifi_req_msg_start_wifi_sta_t), 0},
+ {QL_WIFI_REQ_MSG_ID_GET_STA_STATUS, 0, sizeof(ql_wifi_rsp_msg_get_wifi_sta_status_t)},
+ {QL_WIFI_REQ_MSG_ID_STA_START_SCAN, 0, 0},
+ {QL_WIFI_REQ_MSG_ID_P2P_SET_CFG, sizeof(ql_wifi_req_msg_p2p_set_cfg_t), 0},
+ {QL_WIFI_REQ_MSG_ID_P2P_GET_CFG, 0, sizeof(ql_wifi_req_msg_p2p_get_cfg_t)},
+ {QL_WIFI_REQ_MSG_ID_P2P_ENABLE, sizeof(ql_wifi_req_msg_p2p_enable_t), 0},
+ {QL_WIFI_REQ_MSG_ID_P2P_DEV_FIND, sizeof(ql_wifi_req_msg_p2p_dev_find_t), 0},
+ {QL_WIFI_REQ_MSG_ID_P2P_CONNECT, sizeof(ql_wifi_req_msg_p2p_connect_t), 0},
+ {QL_WIFI_REQ_MSG_ID_P2P_DISCONNECT, 0, 0},
+ {QL_WIFI_REQ_MSG_ID_P2P_GET_STATUS, 0, sizeof(ql_wifi_rsp_msg_p2p_get_status_t)},
+ {QL_WIFI_REQ_MSG_ID_EVENT_REG, sizeof(ql_wifi_req_msg_event_reg_t), 0},
+ {QL_WIFI_IND_MSG_ID_WIFI_STATUS, sizeof(ql_wifi_ind_msg_wifi_status_t), 0},
+ {QL_WIFI_IND_MSG_ID_WIFI_AP_STATUS, sizeof(ql_wifi_ind_msg_wifi_ap_status_t), 0},
+ {QL_WIFI_IND_MSG_ID_WIFI_STA_STATUS, sizeof(ql_wifi_ind_msg_wifi_sta_status_t), 0},
+ {QL_WIFI_IND_MSG_ID_WIFI_STA_SCAN_RESULT, sizeof(ql_wifi_ind_msg_wifi_sta_scan_result_t), 0},
+ {QL_WIFI_IND_MSG_ID_WIFI_AP_STA_CONNECT, sizeof(ql_wifi_ind_msg_wifi_ap_sta_connect_status_t), 0},
+ {QL_WIFI_IND_MSG_ID_WIFI_P2P_ENABLE_STATUS, sizeof(ql_wifi_ind_msg_wifi_p2p_enable_status_t), 0},
+ {QL_WIFI_IND_MSG_ID_WIFI_P2P_DEV_FOUND, sizeof(ql_wifi_ind_msg_wifi_p2p_dev_found_t), 0},
+ {QL_WIFI_IND_MSG_ID_WIFI_P2P_PEER_DEV_REQ, sizeof(ql_wifi_ind_msg_wifi_p2p_peer_dev_req_t), 0},
+ {QL_WIFI_IND_MSG_ID_WIFI_P2P_STATUS, sizeof(ql_wifi_ind_msg_wifi_p2p_status_t), 0}
+};
+
+
+#endif
+