Add basic change for v1453
Change-Id: I9497a61bbc3717f66413794a4e7dee0347c0bc33
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
+