Add T106 header file.
Change-Id: I139abf126f194dc011d5cdf531722152f90a1e90
diff --git a/mbtk/Makefile b/mbtk/Makefile
index d8d1d7d..c48ccf1 100755
--- a/mbtk/Makefile
+++ b/mbtk/Makefile
@@ -1,7 +1,7 @@
ROOT = $(shell pwd)/..
include Make.defines
-DIRS = mbtk_lib mbtk_mqtt lynq_lib ql_lib qser_lib mbtk_adbd mbtk_logd mbtk_ril
+DIRS = mbtk_lib mbtk_mqtt lynq_lib ql_lib mbtk_adbd mbtk_logd mbtk_ril
ifeq ($(BUILD_PLATFORM), asr1806)
DIRS += mbtk_audio_lib
diff --git a/mbtk/include/lynq/liblog.h b/mbtk/include/lynq/liblog.h
new file mode 100755
index 0000000..d1ca261
--- /dev/null
+++ b/mbtk/include/lynq/liblog.h
@@ -0,0 +1,36 @@
+#ifndef __LIBLOG_H__
+#define __LIBLOG_H__
+
+#include <unistd.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef enum
+{
+ LOG_UNSET = -1,
+ LOG_VERBOSE = 0,
+ LOG_ERROR,
+ LOG_WARNING,
+ LOG_INFO,
+ LOG_DEBUG,
+ LOG_LEVEL_MAX
+}log_level_enum;
+
+void lynq_log_global_output(log_level_enum Level,const char *format,...);
+void lynq_log_configuration_init(const char *log_name);
+const char* lynq_read_log_version();
+
+//log level api
+int lynq_set_log_level(const char * module_name, log_level_enum level);
+int lynq_get_log_level(const char * module_name, log_level_enum *level);
+int lynq_set_special_log_level(const char * exe_name, const char * module_name, log_level_enum level);
+int lynq_get_special_log_level(const char * exe_name, const char * module_name, log_level_enum *level);
+int lynq_notify_recalc_log_level(pid_t pid);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif //__LOG_H__
diff --git a/mbtk/include/lynq/liblynq-at-common.h b/mbtk/include/lynq/liblynq-at-common.h
new file mode 100755
index 0000000..5ca8ca8
--- /dev/null
+++ b/mbtk/include/lynq/liblynq-at-common.h
@@ -0,0 +1,14 @@
+#ifndef LIBLYNQ_AT_COMMON_H
+#define LIBLYNQ_AT_COMMON_H 1
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef void ( *lynq_atsvc_incb )( const char *input,const int length);
+typedef void ( *lynq_atsvc_outcb )(char *output, int out_max_size, int mode);
+lynq_atsvc_incb lynq_register_at_common(lynq_atsvc_outcb out_cb);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
\ No newline at end of file
diff --git a/mbtk/include/lynq/lynq-adc.h b/mbtk/include/lynq/lynq-adc.h
new file mode 100755
index 0000000..0af4d5d
--- /dev/null
+++ b/mbtk/include/lynq/lynq-adc.h
@@ -0,0 +1,22 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef enum ADC_CHANNEL_ENUM
+{
+ QADC_NONE = 0,
+ ADC0 =1,
+ ADC1 =2,
+ ADC2 =3,
+ QADC_END
+}ADC_CHANNEL_E;
+
+int qser_adc_show(ADC_CHANNEL_E qadc);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/mbtk/include/lynq/lynq-gpio.h b/mbtk/include/lynq/lynq-gpio.h
new file mode 100755
index 0000000..5af9f50
--- /dev/null
+++ b/mbtk/include/lynq/lynq-gpio.h
@@ -0,0 +1,29 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define MAX_GPIO_NUM (200)
+static void *test_gpio_handle[MAX_GPIO_NUM]={NULL};
+
+int lynq_gpio_init(int gpio, int direction, int value, int pullsel);
+
+int lynq_gpio_deinit(int gpio);
+
+int lynq_gpio_direction_set(int gpio, int direction);
+
+int lynq_gpio_value_set(int gpio, int value);
+
+int lynq_gpio_value_get(int gpio);
+
+int lynq_gpio_pullsel_set(int gpio, int pullsel);
+
+int lynq_gpio_pullsel_get(int gpio);
+
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/mbtk/include/lynq/lynq-irq.h b/mbtk/include/lynq/lynq-irq.h
new file mode 100755
index 0000000..36fd9ed
--- /dev/null
+++ b/mbtk/include/lynq/lynq-irq.h
@@ -0,0 +1,29 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+int line_gpio[15]={-1,48,49,50,51,52,53,54,119,128,129,-1,131,-1,125};//this is the line match gpio
+
+typedef void (*irq_handler)(void);
+
+int lynq_irq_install(int line, irq_handler irq_handler, int trig_type);
+
+int lynq_irq_uninstall(int line);
+
+int lynq_irq_set_type(int line, int trig_type);
+
+int lynq_irq_get_type(int line);
+
+int lynq_irq_set_wake(int line, int en);
+
+int lynq_irq_get_wake(int line);
+
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/mbtk/include/qser/qser_audio.h b/mbtk/include/lynq/lynq-qser-audio.h
similarity index 61%
rename from mbtk/include/qser/qser_audio.h
rename to mbtk/include/lynq/lynq-qser-audio.h
index 8bad8e2..93e78c9 100755
--- a/mbtk/include/qser/qser_audio.h
+++ b/mbtk/include/lynq/lynq-qser-audio.h
@@ -1,41 +1,40 @@
-/*
-* qser_audio.h
+/*******************************************************
*
-* QSER audio header file.
+* @brief: Add audio api
+* @details: add liblynq-qser-audio api
+* @author: yu.dong
+* @date: 2023.9.28
+* @version: V1.0
+* @copyright:Copyright (c) MobileTek
*
-* Author : lb
-* Date : 2023/11/23 10:52:01
-*/
-#ifndef _QSER_AUDIO_H
-#define _QSER_AUDIO_H
-#include "mbtk_type.h"
+*********************************************/
+#ifndef LYNQ_QSER_AUDIO
+#define LYNQ_QSER_AUDIO
+
+#ifdef __cplusplus
+extern "C" {
+#endif
typedef void (*_cb_onPlayer)(int);
int qser_AudPlayer_Open(char* device, _cb_onPlayer cb_fun);
-
int qser_AudPlayer_PlayFrmFile(int hdl, const char *fd, int offset);
-
int qser_AudPlayer_Pause(int hdl);
-
int qser_AudPlayer_Resume(int hdl);
-
void qser_AudPlayer_Stop(int hdl);
-
void qser_AudPlayer_Close(int hdl);
int qser_AudRecorder_Open(char* device, _cb_onPlayer cb_fun);
-
int qser_AudRecorder_StartRecord(int hdl, const char *fd, int offset);
-
int qser_AudRecorder_Pause(void);
-
int qser_AudRecorder_Resume(void);
-
void qser_AudRecorder_Stop(void);
-
void qser_AudRecorder_Close(void);
void qser_Audio_Deinit(void);
-#endif /* _QSER_AUDIO_H */
+#ifdef __cplusplus
+}
+#endif
+#endif
+
diff --git a/mbtk/include/lynq/lynq-qser-autosuspend.h b/mbtk/include/lynq/lynq-qser-autosuspend.h
new file mode 100755
index 0000000..8ea9c01
--- /dev/null
+++ b/mbtk/include/lynq/lynq-qser-autosuspend.h
@@ -0,0 +1,71 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdlib.h>
+#include <pthread.h>
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define MAX_LOCK_NUM 128
+
+#define E_READ -2
+#define E_WRITE -3
+#define E_TABLE_FULL -4
+#define E_LOCK_EXIST -5
+#define E_INPUT_ERROR -6
+
+typedef enum
+{
+ E_QL_LPM_FALLING = 0, /* Falling, Means wakeupin falling to wakeup the module, or wakeupout falling to wakeup mcu
+. */
+ E_QL_LPM_RISING = 1, /* Rising, Means wakeupin rising to wakeup the module, or wakeupout rising to wakeup mcu.
+*/
+}qser_lpm_edge_t;
+
+typedef int qser_lpm_pin_t;
+
+
+typedef struct{
+ qser_lpm_pin_t wakeupin_pin;
+ qser_lpm_edge_t wakeupin_edge;
+}qser_lpm_wakeupin_data_t;
+
+typedef struct{
+ qser_lpm_pin_t wakeupout_pin;
+ qser_lpm_edge_t wakeupout_edge;
+}qser_lpm_wakeupout_data_t;
+
+
+typedef void (*qser_lpm_Handler_t)
+(
+ qser_lpm_edge_t lpm_edge
+);
+
+typedef struct{
+ qser_lpm_wakeupin_data_t wakeupin;
+ qser_lpm_wakeupout_data_t wakeupout;
+}qser_pm_cfg_t;
+
+
+typedef struct
+{
+ char lock_name[MAX_LOCK_NUM][64];
+} LOCK_TABLE;
+
+int read_lock_table(void);
+int qser_lpm_init(qser_lpm_Handler_t qser_lpm_handler, qser_pm_cfg_t *qser_lpm_cfg);
+int qser_lpm_deinit(void);
+int qser_autosuspend_enable(char enable);
+int qser_wakelock_create(const char *name, size_t len);
+int qser_wakelock_lock(int fd);
+int qser_wakelock_unlock(int fd);
+int qser_wakelock_destroy(int fd);
+
+
+#ifdef __cplusplus
+}
+#endif
+
diff --git a/mbtk/include/lynq/lynq-qser-data.h b/mbtk/include/lynq/lynq-qser-data.h
new file mode 100755
index 0000000..c84ab21
--- /dev/null
+++ b/mbtk/include/lynq/lynq-qser-data.h
@@ -0,0 +1,272 @@
+#ifndef __LYNQ_QSER_DATA_H__
+#define __LYNQ_QSER_DATA_H__
+#ifdef __cplusplus
+extern "C" {
+#endif
+#include <stdbool.h>
+#include <netinet/in.h>
+
+typedef enum {
+ QSER_DATA_CALL_ERROR_NONE = 0,
+ QSER_DATA_CALL_ERROR_INVALID_PARAMS,
+} qser_data_call_error_e;
+
+typedef enum {
+ QSER_DATA_CALL_DISCONNECTED = 0, /*!< call is disconnected */
+ QSER_DATA_CALL_CONNECTED, /*!< call is connected */
+} qser_data_call_state_e;
+
+typedef enum {
+ QSER_DATA_CALL_TYPE_IPV4 = 0, /*!< IPv4 call. */
+ QSER_DATA_CALL_TYPE_IPV6, /*!< IPv6 call. */
+ QSER_DATA_CALL_TYPE_IPV4V6, /*!< IPv4 and IPv6 call (Only used call start or stop). */
+} qser_data_call_ip_family_e;
+
+typedef enum {
+ QSER_APN_PDP_TYPE_IPV4 = 0,
+ QSER_APN_PDP_TYPE_PPP,
+ QSER_APN_PDP_TYPE_IPV6,
+ QSER_APN_PDP_TYPE_IPV4V6,
+} qser_apn_pdp_type_e;
+
+typedef enum {
+ QSER_APN_AUTH_PROTO_DEFAULT = 0,
+ QSER_APN_AUTH_PROTO_NONE,
+ QSER_APN_AUTH_PROTO_PAP,
+ QSER_APN_AUTH_PROTO_CHAP,
+ QSER_APN_AUTH_PROTO_PAP_CHAP,
+} qser_apn_auth_proto_e;
+
+#define QSER_APN_MAX_LIST 8
+#define QSER_APN_NAME_SIZE 150
+#define QSER_APN_USERNAME_SIZE 127
+#define QSER_APN_PASSWORD_SIZE 127
+
+struct v4_address_status {
+ struct in_addr ip; /*!< Public IPv4 address. */
+ struct in_addr gateway; /*!< Public IPv4 gateway. */
+ struct in_addr pri_dns; /*!< Primary Domain Name Service IP address. */
+ struct in_addr sec_dns; /*!< Secondary Domain Name Service IP address. */
+};
+
+struct v6_address_status {
+ struct in6_addr ip; /*!< Public IPv6 address. */
+ struct in6_addr gateway; /*!< Public IPv6 gateway. */
+ struct in6_addr pri_dns; /*!< Primary Domain Name Service IPv6 address. */
+ struct in6_addr sec_dns; /*!< Secondary Domain Name Service IPv6 address. */
+};
+
+typedef struct {
+ char profile_idx; /*!< UMTS/CMDA profile ID. */
+ char name[16]; /*!< Interface Name. */
+ qser_data_call_ip_family_e ip_family; /*!< IP version. */
+ qser_data_call_state_e state; /*!< The dial status. */
+ qser_data_call_error_e err; /*!< The Reason code after data call disconnected. */
+ union {
+ struct v4_address_status v4; /*!< IPv4 information. */
+ struct v6_address_status v6; /*!< IPv6 information. */
+ };
+} qser_data_call_state_s;
+
+/*
+ *!< Client callback function used to post event indications.
+ */
+typedef void (*qser_data_call_evt_cb_t)(qser_data_call_state_s *state);
+
+typedef struct {
+ char profile_idx; /*!< UMTS/CMDA profile ID. */
+ bool reconnect; /*!< Whether to re-dial after disconnecting the network. */
+ qser_data_call_ip_family_e ip_family; /*!< IP version. */
+ char cdma_username[QSER_APN_USERNAME_SIZE]; /*!< Username used during data network authentication. */
+ char cdma_password[QSER_APN_PASSWORD_SIZE]; /*!< Password to be used during data network authentication. */
+} qser_data_call_s;
+
+struct pkt_stats {
+ unsigned long pkts_tx; /*!< Number of packets transmitted. */
+ unsigned long pkts_rx; /*!< Number of packets received. */
+ long long bytes_tx; /*!< Number of bytes transmitted. */
+ long long bytes_rx; /*!< Number of bytes received. */
+ unsigned long pkts_dropped_tx; /*!< Number of transmit packets dropped. */
+ unsigned long pkts_dropped_rx; /*!< Number of receive packets dropped. */
+};
+
+struct v4_info {
+ char name[16]; /*!< Interface Name. */
+ qser_data_call_state_e state; /*!< The dial status. */
+ bool reconnect; /*!< re-dial flag. */
+ struct v4_address_status addr; /*!< IPv4 IP Address information. */
+ struct pkt_stats stats; /*!< IPv4 statics */
+};
+
+struct v6_info {
+ char name[16]; /*!< Interface Name. */
+ qser_data_call_state_e state; /*!< The dial status. */
+ bool reconnect; /*!< re-dial flag. */
+ struct v6_address_status addr; /*!< IPv6 IP Address information. */
+ struct pkt_stats stats; /*!< IPv6 statics */
+};
+
+typedef struct {
+ char profile_idx; /*!< UMTS/CDMA profile ID. */
+ qser_data_call_ip_family_e ip_family; /*!< IP version. */
+ struct v4_info v4; /*!< IPv4 information */
+ struct v6_info v6; /*!< IPv6 information */
+} qser_data_call_info_s;
+
+typedef struct {
+ unsigned char profile_idx; /*!< UMTS/CDMA profile ID. */
+ qser_apn_pdp_type_e pdp_type; /*!< Packet Data Protocol (PDP) type specifies the type of data payload
+ exchanged over the airlink when the packet data session is
+ established with this profile. */
+ qser_apn_auth_proto_e auth_proto; /*!< Authentication Protocol. */
+ char apn_name[QSER_APN_NAME_SIZE]; /*!< A string parameter that is a logical name used to select the GGSN
+ and external packet data network. */
+ char username[QSER_APN_USERNAME_SIZE]; /*!< Username used during data network authentication. */
+ char password[QSER_APN_PASSWORD_SIZE]; /*!< Password to be used during data network authentication. */
+ char apn_type[QSER_APN_NAME_SIZE];
+} qser_apn_info_s;
+
+typedef struct {
+ qser_apn_pdp_type_e pdp_type; /*!< Packet Data Protocol (PDP) type specifies the type of data payload
+ exchanged over the airlink when the packet data session is
+ established with this profile. */
+ qser_apn_auth_proto_e auth_proto; /*!< Authentication Protocol. */
+ char apn_name[QSER_APN_NAME_SIZE]; /*!< A string parameter that is a logical name used to select the GGSN
+ and external packet data network. */
+ char username[QSER_APN_USERNAME_SIZE]; /*!< Username used during data network authentication. */
+ char password[QSER_APN_PASSWORD_SIZE]; /*!< Password to be used during data network authentication. */
+ char apn_type[QSER_APN_NAME_SIZE];
+} qser_apn_add_s;
+
+typedef struct {
+ int cnt;
+ qser_apn_info_s apn[QSER_APN_MAX_LIST];
+} qser_apn_info_list_s;
+
+
+/**
+ * Initialization data call module, and callback function registered.
+ *
+ * @param [in] evt_cb callback fucntion
+ *
+ * @return
+ * On success, 0 is returned. On error, -1 is returned.
+ *
+ */
+extern int qser_data_call_init(qser_data_call_evt_cb_t evt_cb);
+
+/**
+ * Destroy data call module, and unregister callback funciton
+ *
+ * @param
+ * None
+ *
+ * @return
+ * On success, 0 is returned. On error, -1 is returned.
+ *
+ */
+extern void qser_data_call_destroy(void);
+
+/**
+ * Starts a data call. If profile index is zero, it will call CDMA profile.
+ *
+ * @param [in] data_call The data call parameters
+ * @param [out] error Error code returned by data call
+ *
+ * @return
+ * On success, 0 is returned. On error, -1 is returned.
+ *
+ */
+extern int qser_data_call_start(qser_data_call_s *data_call, qser_data_call_error_e *err);
+
+/**
+ * Stop a data call.
+ *
+ * @param [in] profile_idx UMTS/CDMA profile ID
+ * @param [in] ip_family IP Version
+ * @param [out] error Error code returned by data call
+ *
+ * @return
+ * On success, 0 is returned. On error, -1 is returned.
+ *
+ */
+extern int qser_data_call_stop(char profile_idx, qser_data_call_ip_family_e ip_family, qser_data_call_error_e *err);
+
+/**
+ * Get a data call information.
+ *
+ * @param [in] profile_idx UMTS/CDMA profile ID
+ * @param [in] ip_family IP Version
+ * @param [out] info The Data Call information
+ * @param [out] error Error code returned by data call
+ *
+ * @return
+ * On success, 0 is returned. On error, -1 is returned.
+ *
+ */
+extern int qser_data_call_info_get(char profile_idx,
+ qser_data_call_ip_family_e ip_family,
+ qser_data_call_info_s *info,
+ qser_data_call_error_e *err);
+
+/**
+ * Changes the settings in a configured profile.
+ *
+ * @param [in] apn the profile information.
+ *
+ * @return
+ * On success, 0 is returned. On error, -1 is returned, such apn not exist.
+ *
+ */
+extern int qser_apn_set(qser_apn_info_s *apn);
+
+/**
+ * Retrieves the settings from a configured profile.
+ *
+ * @param [in] profile_idx UMTS/CDMA profile ID
+ * @param [out] apn the profile information.
+ *
+ * @return
+ * On success, 0 is returned. On error, -1 is returned.
+ *
+ */
+extern int qser_apn_get(unsigned char profile_idx, qser_apn_info_s *apn);
+
+/**
+ * Retrieves the settings from a configured profile.
+ *
+ * @param [in] apn the profile information.
+ * @param [out] profile_idx UMTS/CDMA profile ID
+ *
+ * @return
+ * On success, 0 is returned. On error, -1 is returned.
+ *
+ */
+extern int qser_apn_add(qser_apn_add_s *apn, unsigned char *profile_idx);
+
+/**
+ * Delete a configured profile.
+ *
+ * @param [in] profile_idx UMTS/CDMA profile ID
+ *
+ * @return
+ * On success, 0 is returned. On error, -1 is returned.
+ *
+ */
+extern int qser_apn_del(unsigned char profile_idx);
+
+/**
+ * Retrieves the settings from a configured profile list.
+ *
+ * @param [out] apn_list the profile list information.
+ *
+ * @return
+ * On success, 0 is returned. On error, -1 is returned.
+ *
+ */
+extern int qser_apn_get_list(qser_apn_info_list_s *apn_list);
+#ifdef __cplusplus
+}
+#endif
+#endif
+
diff --git a/mbtk/include/lynq/lynq-qser-fota.h b/mbtk/include/lynq/lynq-qser-fota.h
new file mode 100755
index 0000000..34be9aa
--- /dev/null
+++ b/mbtk/include/lynq/lynq-qser-fota.h
@@ -0,0 +1,26 @@
+/*******************************************************
+*
+* @brief:
+* @details: add fota upgrade api
+* @author: l.yang
+* @date: 2023.8.3
+* @version: V1.0
+* @copyright:Copyright (c) MobileTek
+*
+*********************************************/
+#ifndef LYNQ_QSER_FOTA
+#define LYNQ_QSER_FOTA
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int lynq_get_upgrade_status(void);
+int lynq_fota_set_addr_value(char *value,int size);
+int lynq_fota_nrestart(void);
+int lynq_rock_main(int first_run);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
diff --git a/mbtk/include/lynq/lynq-qser-voice.h b/mbtk/include/lynq/lynq-qser-voice.h
new file mode 100755
index 0000000..8748ae3
--- /dev/null
+++ b/mbtk/include/lynq/lynq-qser-voice.h
@@ -0,0 +1,139 @@
+/**
+ *@file qser_voice.h
+ *@date 2017-11-30
+ *@author
+ *@brief
+ */
+
+
+#ifndef __LYNQ_QSER_VOICE_H__
+#define __LYNQ_QSER_VOICE_H__
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "mbtk_type.h"
+
+typedef enum
+{
+ E_QSER_VCALL_EXTERNAL_SLOT_1,
+ E_QSER_VCALL_EXTERNAL_SLOT_2,
+ E_QSER_VCALL_EMBEDDED,
+ E_QSER_VCALL_REMOTE,
+ E_QSER_VCALL_ID_MAX
+}E_QSER_VCALL_ID_T;
+
+typedef enum
+{
+ E_QSER_VOICE_CALL_STATE_INCOMING = 0x0000, /**< MT incoming; CC setup. */
+ E_QSER_VOICE_CALL_STATE_DIALING = 0x0001, /**< Dialing state. */
+ E_QSER_VOICE_CALL_STATE_ALERTING = 0x0002, /**< MT call waiting; MO alterting. */
+ E_QSER_VOICE_CALL_STATE_ACTIVE = 0x0003, /**< Call is active. */
+ E_QSER_VOICE_CALL_STATE_HOLDING = 0x0004, /**< Call is on hold. */
+ E_QSER_VOICE_CALL_STATE_END = 0x0005, /**< Call is disconnected. */
+ E_QSER_VOICE_CALL_STATE_WAITING = 0x0006, /**< Call is waiting. */
+}qser_voice_call_state_t;
+
+typedef enum
+{
+ E_QSER_VOICE_CALL_WAITING_VOICE_ENABLED = 0, /**< Voice call waiting enabled. */
+ E_QSER_VOICE_CALL_WAITING_DISABLED = 1, /**< Voice call waiting disabled. */
+}E_QSER_VOICE_CALL_WAITING_SERVICE_T;
+
+typedef struct
+{
+ E_QSER_VOICE_CALL_WAITING_SERVICE_T waiting_service;
+}qser_voice_call_waiting_service_t;
+
+typedef qser_voice_call_state_t E_QSER_VOICE_CALL_STATE_T;
+
+typedef uint32_t voice_client_handle_type;
+
+/* Callback function registered via QSER_Voice_Call_AddStateHandler;
+ This will be called if any stated changed of call_id
+*/
+typedef void (*QSER_VoiceCall_StateHandlerFunc_t)
+(
+ int caLOCAL_C_INCLUDESll_id,
+ char* phone_num,
+ E_QSER_VOICE_CALL_STATE_T state,
+ void *contextPtr
+);
+
+/* Init voice module and return h_voice, this should be called before any other APIs */
+int qser_voice_call_client_init(voice_client_handle_type *ph_voice);
+
+/* DeInit voice module and release resources, this should be called at last */
+int qser_voice_call_client_deinit(voice_client_handle_type h_voice);
+
+/* Add callback function, if any call state changed, handlerPtr will be called to notify App */
+int qser_voice_call_addstatehandler(voice_client_handle_type h_voice,
+ QSER_VoiceCall_StateHandlerFunc_t handlerPtr,
+ void* contextPtr);
+
+/* Remove callback function, won't receive any notify anymore */
+int qser_voice_call_removestatehandle(voice_client_handle_type h_voice);
+
+/* Start call and return call_id, this can be used in the later */
+int qser_voice_call_start(voice_client_handle_type h_voice,
+ E_QSER_VCALL_ID_T simId,
+ char* phone_number, ///< [IN] Destination identifier for the voice
+ int *call_id); ///< [OUT] call id
+
+/* End call of call_id, which returned by QSER_Voice_Call_Start or callback func register via QSER_Voice_Call_AddStateHandler */
+int qser_voice_call_end( voice_client_handle_type h_voice,
+ int call_id); ///< [IN] call id, return by QSER_Voice_Start
+
+/* Answer the call of call_id, which returned by callback func register via QSER_Voice_Call_AddStateHandler */
+int qser_voice_call_answer(voice_client_handle_type h_voice,
+ int call_id );
+
+int qser_voice_call_switch_waiting_or_holding_and_active(voice_client_handle_type h_voice);
+
+//set voice speech volume
+int qser_voice_set_speech_volume(const int volume);
+
+//Get voice speech volume
+int qser_voice_get_speech_volume(int *volume);
+
+//Set voice call waiting
+int qser_voice_call_setwaiting
+(
+ int h_voice,
+ qser_voice_call_waiting_service_t e_service
+);
+
+//Get voice call waiting status
+int qser_voice_call_getwaitingstatus
+(
+ int h_voice,
+ qser_voice_call_waiting_service_t *pe_service
+);
+
+
+/*
+Usage 1 (register callback and wait for new call in, then answer):
+1, QSER_Voice_Call_Client_Init
+2, QSER_Voice_Call_AddStateHandler(pf_cb)
+3, wait for new call arrive, pf_cb will pass the call_id to app.
+4, QSER_Voice_Call_Answer(call_id)
+5, QSER_Voice_Call_End
+6, QSER_Voice_Call_Client_Deinit
+
+
+Usage 2 (call out):
+1, QSER_Voice_Call_Client_Init
+2, QSER_Voice_Call_AddStateHandler(pf_cb)
+3, QSER_Voice_Call_Start
+4, QSER_Voice_Call_End
+5, QSER_Voice_Call_Client_Deinit
+
+
+*/
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // __QSER_VOICE_H__
+
diff --git a/mbtk/include/qser/qser_alarm.h b/mbtk/include/lynq/lynq_alarm.h
similarity index 100%
rename from mbtk/include/qser/qser_alarm.h
rename to mbtk/include/lynq/lynq_alarm.h
diff --git a/mbtk/include/lynq/lynq_audio_api.h b/mbtk/include/lynq/lynq_audio_api.h
deleted file mode 100755
index 44a3278..0000000
--- a/mbtk/include/lynq/lynq_audio_api.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
-*
-* Data : 2022/10/27 17:26:46
-* Author : LuoJian
-*/
-#ifndef _LYNQ_AUDIO_API_H
-#define _LYNQ_AUDIO_API_H
-#ifdef MBTK_PLATFORM_ASR1803
-#include "mbtk_audio.h"
-#endif
-
-//播放音频文件
-int lynq_media_play_audio(const char *path);
-
-//停止播放音频文件
-void lynq_media_stop_audio(void);
-
-//录制音频文件
-int lynq_media_rec_audio(const char *path);
-
-//停止录制音频文件
-void lynq_media_rec_stop_audio(void);
-
-//获取功放音量
-//volume (0~100)
-int lynq_get_spk_volume(int* volume);
-
-//设置功放音量。
-int lynq_set_spk_volume(const int volume);
-
-//获取麦克风音量
-int lynq_get_mic_volume(int* volume);
-
-//设置麦克风音量
-int lynq_set_mic_volume(const int volume);
-
-#ifdef MBTK_PLATFORM_ASR1803
-int lynq_audio_ubus_client_init(mbtk_audio_client_handle_type *ph_audio, mbtk_dtmf_cb cb);
-
-int lynq_audio_ubus_client_deinit(mbtk_audio_client_handle_type h_audio);
-#endif
-
-#endif /* _LYNQ_AUDIO_API_H */
-
diff --git a/mbtk/include/lynq/lynq_autosuspend.h b/mbtk/include/lynq/lynq_autosuspend.h
new file mode 100755
index 0000000..efd1219
--- /dev/null
+++ b/mbtk/include/lynq/lynq_autosuspend.h
@@ -0,0 +1,37 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <unistd.h>
+#include <dlfcn.h>
+#include <pthread.h>
+#include <stdbool.h>
+#include <time.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+struct time_info_t
+{
+ long sleep_start_time;
+ long wakeup_time;
+};
+
+int lynq_autosleep_enable(void);
+int lynq_autosleep_disable(void);
+int lynq_wait_wakeup_event(long *sleep_start_time, long * wakeup_time);
+
+#ifdef MOBILETEK_TARGET_PLATFORM_T106
+int lynq_set_lpmode(int lp_mode);
+int release_wake_lock(char *name);
+int acquire_wake_lock(int lock, char *name);
+#endif
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/mbtk/include/lynq/lynq_call.h b/mbtk/include/lynq/lynq_call.h
new file mode 100755
index 0000000..3bb398f
--- /dev/null
+++ b/mbtk/include/lynq/lynq_call.h
@@ -0,0 +1,181 @@
+#ifndef LYNQ_CALL_H
+#define LYNQ_CALL_H 1
+#ifdef __cplusplus
+extern "C" {
+#endif
+#define LYNQ_PHONE_NUMBER_MAX 32
+#define INDEX_IS_NUMBER( alpha_char ) \
+ ( ( (alpha_char >= '0') && (alpha_char <= '9') ) ? 1 : 0 )
+#define LYNQ_CALL_MAX 3
+#define LYNQ_CALL_FAIL_VENDOR_CAUSE 64
+#define MAX_IP_LENGTH 128
+#define MAX_VLAN_INFO_LENGTH 32
+#define MAX_SSRC_INFO_LENGTH 10 /*2^32=4294967296, 10 digit*/
+
+typedef enum {
+ LYNQ_CALL_FAIL_UNOBTAINABLE_NUMBER = 1,
+ LYNQ_CALL_FAIL_NORMAL = 16,
+ LYNQ_CALL_FAIL_BUSY = 17,
+ LYNQ_CALL_FAIL_CONGESTION = 34,
+ LYNQ_CALL_FAIL_ACM_LIMIT_EXCEEDED = 68,
+ LYNQ_CALL_FAIL_CALL_BARRED = 240,
+ LYNQ_CALL_FAIL_FDN_BLOCKED = 241,
+ LYNQ_CALL_FAIL_IMSI_UNKNOWN_IN_VLR = 242,
+ LYNQ_CALL_FAIL_IMEI_NOT_ACCEPTED = 243,
+ LYNQ_CALL_FAIL_DIAL_MODIFIED_TO_USSD = 244, /* STK Call Control */
+ LYNQ_CALL_FAIL_DIAL_MODIFIED_TO_SS = 245,
+ LYNQ_CALL_FAIL_DIAL_MODIFIED_TO_DIAL = 246,
+ LYNQ_CALL_FAIL_CDMA_LOCKED_UNTIL_POWER_CYCLE = 1000,
+ LYNQ_CALL_FAIL_CDMA_DROP = 1001,
+ LYNQ_CALL_FAIL_CDMA_INTERCEPT = 1002,
+ LYNQ_CALL_FAIL_CDMA_REORDER = 1003,
+ LYNQ_CALL_FAIL_CDMA_SO_REJECT = 1004,
+ LYNQ_CALL_FAIL_CDMA_RETRY_ORDER = 1005,
+ LYNQ_CALL_FAIL_CDMA_ACCESS_FAILURE = 1006,
+ LYNQ_CALL_FAIL_CDMA_PREEMPTED = 1007,
+ LYNQ_CALL_FAIL_CDMA_NOT_EMERGENCY = 1008, /* For non-emergency number dialed
+ during emergency callback mode */
+ LYNQ_CALL_FAIL_CDMA_ACCESS_BLOCKED = 1009, /* CDMA network access probes blocked */
+ LYNQ_CALL_FAIL_ERROR_UNSPECIFIED = 0xffff
+} lynq_last_call_fail_cause_t;
+typedef struct
+{
+ lynq_last_call_fail_cause_t cause_code;
+ char vendor_cause[LYNQ_CALL_FAIL_VENDOR_CAUSE];
+}lynqLastCallFailCause;
+int lynq_init_call(int uToken);
+int lynq_deinit_call();
+int lynq_call(int *handle,char addr[]);
+int lynq_call_answer();
+int lynq_call_hungup(int*handle);
+int lynq_call_hungup_all();
+int lynq_set_auto_answercall(const int mode);
+int lynq_get_mute_mic(int *status);
+int lynq_set_mute_mic(const int enable);
+int lynq_get_speech_volume(int *volume);
+int lynq_set_speech_volume(const int volume);
+int lynq_incall_record_start(const char* file_path);
+int lynq_incall_record_stop();
+int lynq_set_DTMF(const char callnum);
+int lynq_set_DTMF_volume(const int volume);
+int lynq_get_current_call_state(int *handle, int *call_state,int *toa,int *direction,char addr[]);
+/*lei add for T8TSK-17 2022/7/20*/
+int lynq_switch_waiting_or_holding_and_active(void);
+int lynq_hangup_waiting_or_background(void);
+int lynq_hangup_foreground_resume_background(void);
+
+/* add for T106bug-213 2023/9/18 */
+void lynq_release_wait_call();
+
+/*lei add for API-163/API-164 2023/1/3*/
+/**
+ * @brief wait_call_state_change
+ *
+ * @param handle call_id
+ * @return int
+ */
+int lynq_wait_call_state_change(int *handle);
+/*lei add for API-163/API-164 2023/1/3*/
+/*lei add for T8TSK-17 2022/7/20*/
+
+#ifdef ECALL_SUPPORT
+typedef enum{
+ LYNQ_ECALL_SET_NUMBER = 0, /* Set Number */
+ LYNQ_ECALL_SET_URI = 1, /* Set Uri */
+}LYNQ_ECall_Set_Type;
+
+typedef enum{
+ LYNQ_EMER_CAT_MANUAL_ECALL = 0, /* Manual Emergency eCall */
+ LYNQ_EMER_CAT_AUTO_ECALL = 1, /* Automatic Emergency eCall */
+}LYNQ_ECall_Category;
+
+typedef enum{
+ LYNQ_ECALL_TEST = 0, /* Test eCall */
+ LYNQ_ECALL_EMERGENCY = 1, /* Emergency eCall */
+ LYNQ_ECALL_RECONFIG = 2, /* Reconfiguration eCall */
+ LYNQ_ECALL_MO_MAX=3,
+ LYNQ_ECALL_CALLBACK = 3, /* Callback eCall */
+ LYNQ_ECALL_VAR_MAX,
+ LYNQ_ECALL_VAR_NONE=LYNQ_ECALL_VAR_MAX,
+}LYNQ_ECall_Variant;
+
+typedef enum{
+ LYNQ_ECALL_SENDING_START = 1,
+ LYNQ_ECALL_SENDING_MSD = 2,
+ LYNQ_ECALL_LLACK_RECEIVED = 3,
+ LYNQ_ECALL_ALACK_POSITIVE_RECEIVED = 4,
+ LYNQ_ECALL_ALACK_CLEARDOWN_RECEIVED = 5,
+ LYNQ_ECALL_DAILING = 9,
+ LYNQ_ECALL_ALERTING = 10,
+ LYNQ_ECALL_ACTIVE = 11,
+ LYNQ_ECALL_DISCONNECTED = 12,
+ LYNQ_ECALL_IMS_ACTIVE = 13,
+ LYNQ_ECALL_IMS_DISCONNECTED = 14,
+ LYNQ_ECALL_ABNORMAL_HANGUP=15,
+ LYNQ_ECALL_IMS_MSD_ACK = 20,
+ LYNQ_ECALL_IMS_UPDATE_MSD = 21,
+ LYNQ_ECALL_IMS_IN_BAND_TRANSFER = 22,
+ LYNQ_ECALL_IMS_MSD_NACK = 23,
+ LYNQ_ECALL_IMS_SRVCC = 24,
+ LYNQ_ECALL_ONLY_DEREGISTRATION = 31,
+ LYNQ_ECALL_MAY_DEREGISTER = 32,
+ LYNQ_ECALL_PSAP_CALLBACK_START = 40,
+ LYNQ_ECALL_PSAP_CALLBACK_IMS_UPDATE_MSD = 41,
+ LYNQ_ECALL_SENDING_START_IN_VOICE=8000,
+ LYNQ_ECALL_T2_TIMER_OUT = 9000,
+ LYNQ_ECALL_T5_TIMER_OUT = 9001,
+ LYNQ_ECALL_T6_TIMER_OUT = 9002,
+ LYNQ_ECALL_T7_TIMER_OUT = 9003,
+ LYNQ_ECALL_REDIAL_TIMER_OUT = 9004,
+ LYNQ_ECALL_AUTO_ANS_TIMER_OUT = 9005,
+ LYNQ_ECALL_AUTO_ANS_IMS_TIMER_OUT = 9006,
+ LYNQ_ECALL_UNSPECIFIED = 0xffff,
+}LYNQ_ECall_Indication;
+
+int lynq_set_test_num(LYNQ_ECall_Set_Type type, const char *test_num, int test_num_length);
+int lynq_fast_ecall(int* handle, LYNQ_ECall_Category lynq_ecall_cat, LYNQ_ECall_Variant lynq_ecall_variant, const char *addr, int addr_length, const unsigned char *msd_data, int msd_length);
+int lynq_set_msd(int* handle, const unsigned char *msd_data, int msd_length);
+int lynq_set_ivs(int enable);
+int lynq_ivs_push_msd();
+int lynq_wait_ecall_indication(int* handle, LYNQ_ECall_Indication *eCall_Indication);
+#endif
+
+/*Audio Path setting begin*/
+typedef enum{
+ AUDIO_MODE_CODEC = 0, /* Codec */
+ AUDIO_MODE_RTP = 1, /* RTP */
+}LYNQ_Audio_Mode;
+
+typedef enum{
+ RTP_CLIENT = 0,
+ RTP_SERVER =1,
+ RTP_MODE_MAX
+}LYNQ_Rtp_Mode;
+
+typedef enum{
+ Rtp_Ssrc_random = 0,
+ Rtp_Ssrc_specific =1,
+}LYNQ_Rtp_Ssrc_Mode;
+
+/*set*/
+int lynq_set_voice_audio_mode(const LYNQ_Audio_Mode audio_mode);
+int lynq_set_remote_rtp_ip(const char* ip, const int ip_length);
+int lynq_set_vlan_info(const char* vlan_info, const int vlan_info_length);
+int lynq_set_rtp_port(const LYNQ_Rtp_Mode rtp_mode, const int port);
+int lynq_set_rtp_param(const int clock_rate,const int channels,const int latency); //only for client
+int lynq_set_call_rtp_ssrc(const LYNQ_Rtp_Ssrc_Mode ssrc_mode, const unsigned int ssrc);
+
+/*get*/
+LYNQ_Audio_Mode lynq_get_voice_audio_mode();
+int lynq_get_remote_rtp_ip(char* ip, const int ip_length);
+int lynq_get_vlan_info(char* vlan_info, const int vlan_info_length);
+int lynq_get_rtp_port(const LYNQ_Rtp_Mode rtp_mode, int* port);
+int lynq_get_rtp_param(int* clock_rate,int* channels, int* latency);//only for client
+int lynq_get_call_rtp_ssrc(int* ssrc_mod, unsigned int* ssrc);
+/*Audio Path setting end*/
+
+void lynq_set_test_mode(const int test_mode);
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/mbtk/include/lynq/lynq_call_api.h b/mbtk/include/lynq/lynq_call_api.h
deleted file mode 100755
index 889875f..0000000
--- a/mbtk/include/lynq/lynq_call_api.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
-*
-* Data : 2022/11/07 16:57:28
-* Author : HanZhiyu
-*/
-
-#ifdef MBTK_PLATFORM_ASR1803
-#include "mbtk_audio.h"
-#endif
-
-typedef enum {
- LYNQ_CALL_FAIL_UNOBTAINABLE_NUMBER = 1,
- LYNQ_CALL_FAIL_NORMAL = 16,
- LYNQ_CALL_FAIL_BUSY = 17,
- LYNQ_CALL_FAIL_CONGESTION = 34,
- LYNQ_CALL_FAIL_ACM_LIMIT_EXCEEDED = 68,
- LYNQ_CALL_FAIL_LYNQ_CALL_BARRED = 240,
- LYNQ_CALL_FAIL_FDN_BLOCKED = 241,
- LYNQ_CALL_FAIL_IMSI_UNKNOWN_IN_VLR = 242,
- LYNQ_CALL_FAIL_IMEI_NOT_ACCEPTED = 243,
- LYNQ_CALL_FAIL_DIAL_MODIFIED_TO_USSD = 244, /* STK LYNQ_CALL Control */
- LYNQ_CALL_FAIL_DIAL_MODIFIED_TO_SS = 245,
- LYNQ_CALL_FAIL_DIAL_MODIFIED_TO_DIAL = 246,
- LYNQ_CALL_FAIL_CDMA_LOCKED_UNTIL_POWER_CYCLE = 1000,
- LYNQ_CALL_FAIL_CDMA_DROP = 1001,
- LYNQ_CALL_FAIL_CDMA_INTERCEPT = 1002,
- LYNQ_CALL_FAIL_CDMA_REORDER = 1003,
- LYNQ_CALL_FAIL_CDMA_SO_REJECT = 1004,
- LYNQ_CALL_FAIL_CDMA_RETRY_ORDER = 1005,
- LYNQ_CALL_FAIL_CDMA_ACCESS_FAILURE = 1006,
- LYNQ_CALL_FAIL_CDMA_PREEMPTED = 1007,
- LYNQ_CALL_FAIL_CDMA_NOT_EMERGENCY = 1008, /* For non-emergency number dialed
- during emergency callback mode */
- LYNQ_CALL_FAIL_CDMA_ACCESS_BLOCKED = 1009, /* CDMA network access probes blocked */
- LYNQ_CALL_FAIL_ERROR_UNSPECIFIED = 0xffff
-} lynq_last_call_fail_cause_t;
-
-typedef enum{
- AUDIO_MODE_CODEC = 0, /* Codec */
- AUDIO_MODE_RTP = 1, /* RTP */
-}LYNQ_Audio_Mode;
-
-typedef enum{
- RTP_CLIENT = 0, /*客户端,从远端拉文件到本地播放*/
-RTP_SERVER =1, /*服务器端,推文件到远端播放*/
-RTP_MODE_MAX
-}LYNQ_Rtp_Mode;
-
-typedef enum{
- LYNQ_CALL_ACTIVE,
- LYNQ_CALL_HOLDING,
- LYNQ_CALL_DIALING,
- LYNQ_CALL_ALERTING,
- LYNQ_CALL_INCOMING,
- LYNQ_CALL_WAITING,
- LYNQ_CALL_OFFERING,
-}LYNQ_Call_State;
-
-int lynq_init_call(int uToken);
-int lynq_deinit_call(void);
-int lynq_call(int *handle, char addr[]);
-int lynq_call_answer();
-int lynq_call_hungup_all();
-int lynq_call_hungup(int *handle);
-int lynq_hangup_waiting_or_background(void);
-int lynq_switch_waiting_or_holding_and_active(void);
-int lynq_hangup_foreground_resume_background(void);
-int lynq_wait_incoming_call(void *incoming_call_cb);
-int lynq_get_mute_mic (int *status);
-int lynq_set_mute_mic(const int enable);
-int lynq_set_DTMF(const char callnum);
-int lynq_get_current_call_state(int *handle,int *call_state,int*toa,int *direction,char addr[]);
-//void lynq_audio_volume_cb(int volume);
-int lynq_set_speech_volume(const int volume);
-int lynq_get_speech_volume(int * volume);
diff --git a/mbtk/include/lynq/lynq_data.h b/mbtk/include/lynq/lynq_data.h
new file mode 100755
index 0000000..1ee15ba
--- /dev/null
+++ b/mbtk/include/lynq/lynq_data.h
@@ -0,0 +1,82 @@
+#ifndef LYNQ_DATA_H
+#define LYNQ_DATA_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+#define LYNQ_APN_CHANNEL_MAX 10
+#define LYNQ_PDP_TYPE_MAX_LEN 16
+#define LYNQ_IFACE_NAME_MAX_LEN 50
+#define LYNQ_APN_MAX_LEN 50
+#define LYNQ_TYPE_MAX_LEN 50
+#define LYNQ_ADDRESSES_MAX_LEN 100
+#define LYNQ_DNSES_MAX_LEN 256
+#define LYNQ_GATEWAYS_MAX_LEN 50
+#define LYNQ_PCSCF_MAX_LEN 256
+#define LYNQ_APN_TYPE_MAX_LEN 50
+#define LYNQ_PDP_ADDR_MAX_LEN 64
+#define LYNQ_DNS_ADDR_MAX_LEN 256
+#define LYNQ_GETWAYS_ADDR_MAX_LEN 64
+#define LYNQ_POXY_ADDR_MAX_LEN 64
+
+
+typedef struct {
+ int status; /* A RIL_DataCallFailCause, 0 which is PDP_FAIL_NONE if no error */
+ int suggestedRetryTime; /* If status != 0, this fields indicates the suggested retry
+ back-off timer value RIL wants to override the one
+ pre-configured in FW.
+ The unit is miliseconds.
+ The value < 0 means no value is suggested.
+ The value 0 means retry should be done ASAP.
+ The value of INT_MAX(0x7fffffff) means no retry. */
+ int cid; /* Context ID, uniquely identifies this call */
+ int active; /* 0=inactive, 1=active/physical link down, 2=active/physical link up */
+ char type[LYNQ_PDP_TYPE_MAX_LEN]; /* One of the PDP_type values in TS 27.007 section 10.1.1.
+ For example, "IP", "IPV6", "IPV4V6", or "PPP". If status is
+ PDP_FAIL_ONLY_SINGLE_BEARER_ALLOWED this is the type supported
+ such as "IP" or "IPV6" */
+ char ifname[LYNQ_IFACE_NAME_MAX_LEN]; /* The network interface name */
+ char addresses[LYNQ_PDP_ADDR_MAX_LEN]; /* A space-delimited list of addresses with optional "/" prefix length,
+ e.g., "192.0.1.3" or "192.0.1.11/16 2001:db8::1/64".
+ May not be empty, typically 1 IPv4 or 1 IPv6 or
+ one of each. If the prefix length is absent the addresses
+ are assumed to be point to point with IPv4 having a prefix
+ length of 32 and IPv6 128. */
+ char dnses[LYNQ_DNS_ADDR_MAX_LEN]; /* A space-delimited list of DNS server addresses,
+ e.g., "192.0.1.3" or "192.0.1.11 2001:db8::1".
+ May be empty. */
+ char gateways[LYNQ_GETWAYS_ADDR_MAX_LEN]; /* A space-delimited list of default gateway addresses,
+ e.g., "192.0.1.3" or "192.0.1.11 2001:db8::1".
+ May be empty in which case the addresses represent point
+ to point connections. */
+ char pcscf[LYNQ_POXY_ADDR_MAX_LEN]; /* the Proxy Call State Control Function address
+ via PCO(Protocol Configuration Option) for IMS client. */
+ int mtu; /* MTU received from network
+ Value <= 0 means network has either not sent a value or
+ sent an invalid value */
+} lynq_data_call_response_v11_t;
+
+typedef struct
+{
+ int index;
+ char apn[LYNQ_APN_MAX_LEN];
+ char apnType[LYNQ_APN_TYPE_MAX_LEN];
+}lynq_apn_info;
+
+int lynq_init_data(int uToken);
+int lynq_deinit_data();
+int lynq_setup_data_call(int *handle);
+int lynq_deactive_data_call(int *handle);
+int lynq_setup_data_call_sp(int *handle,char *apn,char *apnType,char *user,char *password,char *authType,char *normalProtocol,char *roamingProtocol);
+int lynq_setup_data_call_sp_t106(int *handle,char *apn,char *apnType,char *user,char *password,char *authType,char *normalProtocol,char *roamingProtocol);
+//int lynq_deactive_data_call_sp(int *handle,char *apnType);
+int lynq_get_data_call_list(int *handle,lynq_data_call_response_v11_t *dataCallList);
+int lynq_wait_data_call_state_change(int *handle);
+int lynq_modify_apn_db(const int cmd,char *id,char *mcc,char *mnc,char *apn,char *apntype,char *user,char *password,char *normalprotocol,char *roamingprotocol,char *carrier,char *out);
+int lynq_reset_apn(char *result);
+int lynq_get_apn_table(int *size,lynq_apn_info **list);
+void lynq_release_wait_data_call();
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/mbtk/include/lynq/lynq_deflog.h b/mbtk/include/lynq/lynq_deflog.h
new file mode 100755
index 0000000..3fecfc7
--- /dev/null
+++ b/mbtk/include/lynq/lynq_deflog.h
@@ -0,0 +1,73 @@
+#ifndef __LYNQ_DEFLOG_H__
+#define __LYNQ_DEFLOG_H__
+#include "liblog.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef void (*LYNQ_WRITE_LOG_PTR)(log_level_enum level, const char *format, ...);
+extern LYNQ_WRITE_LOG_PTR lynq_write_log;
+LYNQ_WRITE_LOG_PTR lynq_log_function_init(const char *log_name);
+
+int lynq_syslog_set_file_size(int value);
+int lynq_syslog_get_file_size(void);
+int lynq_syslog_set_file_rotate(int value);
+int lynq_syslog_get_file_rotate(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#define lynq_log_verbose(...) do { lynq_write_log(LOG_VERBOSE,__VA_ARGS__);} while (0)
+#define lynq_log_error(...) do {lynq_write_log(LOG_ERROR,__VA_ARGS__);} while (0)
+#define lynq_log_warning(...) do {lynq_write_log(LOG_WARNING,__VA_ARGS__);} while (0)
+#define lynq_log_info(...) do {lynq_write_log(LOG_INFO,__VA_ARGS__);} while (0)
+#define lynq_log_debug(...) do {lynq_write_log(LOG_DEBUG,__VA_ARGS__);} while (0)
+
+#define LYVERBLOG(...) do {lynq_write_log(LOG_VERBOSE,__VA_ARGS__);} while (0)
+#define LYERRLOG(...) do {lynq_write_log(LOG_ERROR,__VA_ARGS__);} while (0)
+#define LYWARNLOG(...) do {lynq_write_log(LOG_WARNING,__VA_ARGS__);} while(0)
+#define LYINFLOG(...) do {lynq_write_log(LOG_INFO,__VA_ARGS__);} while (0)
+#define LYDBGLOG(...) do {lynq_write_log(LOG_DEBUG,__VA_ARGS__);} while (0)
+
+// just for comcompatibility, do nothing
+#define LYLOGSET(a) do{;}while(0)
+#define LYLOGEINIT(Y) do{;}while(0)
+
+#ifndef ALOGV
+#define ALOGV(...) do {lynq_write_log(LOG_VERBOSE,__VA_ARGS__);} while (0)
+#endif
+
+#ifndef ALOGE
+#define ALOGE(...) do {lynq_write_log(LOG_ERROR,__VA_ARGS__);} while (0)
+#endif
+
+#ifndef ALOGW
+#define ALOGW(...) do {lynq_write_log(LOG_WARNING,__VA_ARGS__);} while (0)
+#endif
+
+#ifndef ALOGI
+#define ALOGI(...) do {lynq_write_log(LOG_INFO,__VA_ARGS__);} while (0)
+#endif
+
+#ifndef ALOGD
+#define ALOGD(...) do {lynq_write_log(LOG_DEBUG,__VA_ARGS__);} while (0)
+#endif
+
+#define DEFINE_LYNQ_LIB_LOG(tag) \
+ LYNQ_WRITE_LOG_PTR __attribute__ ((visibility ("hidden"))) lynq_write_log = NULL; \
+ void __attribute__((constructor)) tag##_init() \
+ { \
+ lynq_write_log = lynq_log_function_init(#tag); \
+ }
+
+#define DEFINE_LYNQ_EXE_LOG(tag) \
+ LYNQ_WRITE_LOG_PTR __attribute__ ((visibility ("hidden"))) lynq_write_log = NULL; \
+ void __attribute__((constructor)) tag##_init() \
+ { \
+ lynq_write_log = lynq_log_function_init(#tag); \
+ lynq_log_configuration_init(#tag); \
+ }
+
+#endif //__LYNQ_DEFLOG_H__
diff --git a/mbtk/include/lynq/lynq_ecall_api.h b/mbtk/include/lynq/lynq_ecall_api.h
deleted file mode 100755
index 58b6e41..0000000
--- a/mbtk/include/lynq/lynq_ecall_api.h
+++ /dev/null
@@ -1,71 +0,0 @@
-#ifndef LYNQ_ECALL_H
-#define LYNQ_ECALL_H
-#include "mbtk_type.h"
-#include "mbtk_log.h"
-
-typedef uint32 ecall_handle_type;
-
-typedef enum{
- LYNQ_ECALL_SET_NUMBER = 0, /* Set Number */
- LYNQ_ECALL_SET_URI = 1, /* Set Uri */
-}LYNQ_ECall_Set_Type;
-
-typedef enum{
- LYNQ_EMER_CAT_MANUAL_ECALL = 0, /* Manual Emergency eCall */
- LYNQ_EMER_CAT_AUTO_ECALL = 1, /* Automatic Emergency eCall */
-}LYNQ_ECall_Category;
-
-typedef enum{
- LYNQ_ECALL_TEST = 0, /* Test eCall */
- LYNQ_ECALL_EMERGENCY = 1, /* Emergency eCall */
- LYNQ_ECALL_RECONFIG = 2, /* Reconfiguration eCall */
- LYNQ_ECALL_VAR_MAX,
-}LYNQ_ECall_Variant;
-
-typedef enum{
- LYNQ_ECALL_SENDING_START = 1,
- LYNQ_ECALL_SENDING_MSD = 2,
- LYNQ_ECALL_LLACK_RECEIVED = 3,
- LYNQ_ECALL_ALACK_POSITIVE_RECEIVED = 4,
- LYNQ_ECALL_ALACK_CLEARDOWN_RECEIVED = 5,
- LYNQ_ECALL_ACTIVE = 11,
- LYNQ_ECALL_DISCONNECTED = 12,
- LYNQ_ECALL_IMS_ACTIVE = 13,
- LYNQ_ECALL_IMS_DISCONNECTED = 14,
- LYNQ_ECALL_ABNORMAL_HANGUP=15,
- LYNQ_ECALL_IMS_MSD_ACK = 20,
- LYNQ_ECALL_IMS_UPDATE_MSD = 21,
- LYNQ_ECALL_IMS_IN_BAND_TRANSFER = 22,
- LYNQ_ECALL_IMS_MSD_NACK = 23,
- LYNQ_ECALL_IMS_SRVCC = 24,
- LYNQ_ECALL_ONLY_DEREGISTRATION = 31,
- LYNQ_ECALL_MAY_DEREGISTER = 32,
- LYNQ_ECALL_PSAP_CALLBACK_START = 40,
- LYNQ_ECALL_PSAP_CALLBACK_IMS_UPDATE_MSD = 41,
- LYNQ_ECALL_T2_TIMER_OUT = 9000,
- LYNQ_ECALL_T5_TIMER_OUT = 9001,
- LYNQ_ECALL_T6_TIMER_OUT = 9002,
- LYNQ_ECALL_T7_TIMER_OUT = 9003,
- LYNQ_ECALL_REDIAL_TIMER_OUT = 9004,
- LYNQ_ECALL_AUTO_ANS_TIMER_OUT = 9005,
- LYNQ_ECALL_AUTO_ANS_IMS_TIMER_OUT = 9006,
- LYNQ_ECALL_UNSPECIFIED = 0xffff,
-}LYNQ_ECall_Indication;
-
-int lynq_ecall_init(ecall_handle_type *handle);
-int lynq_ecall_deinit(ecall_handle_type handle);
-int lynq_set_test_num(LYNQ_ECall_Set_Type type, const char *test_num, int test_num_length);
-int lynq_set_reconf_num(LYNQ_ECall_Set_Type type, const char *reconf_num, int reconf_num_length);
-int lynq_fast_ecall(int* handle,
- LYNQ_ECall_Category lynq_ecall_cat,
- LYNQ_ECall_Variant lynq_ecall_variant,
- const char *addr, int addr_length,
- const unsigned char *msd_data, int msd_length);
-int lynq_make_ecall(int* handle, LYNQ_ECall_Variant type);
-int lynq_set_msd(int* handle, const unsigned char *msd_data, int msd_length);
-int lynq_set_ivs(int enable);
-int lynq_ivs_push_msd();
-int lynq_wait_ecall_indication(int* handle, LYNQ_ECall_Indication *eCall_Indication);
-int lynq_ecall_hungup(int handle);
-
-#endif
diff --git a/mbtk/include/lynq/lynq_gnss.h b/mbtk/include/lynq/lynq_gnss.h
index 679039b..6e2827a 100755
--- a/mbtk/include/lynq/lynq_gnss.h
+++ b/mbtk/include/lynq/lynq_gnss.h
@@ -1,121 +1,69 @@
-#ifndef __MBTK_LYNQ_GNSS_H__
-#define __MBTK_LYNQ_GNSS_H__
+/*
+* qser_gnss.h
+*
+* QSER GNSS header file.
+*
+* Author : lb
+* Date : 2023/11/23 11:13:18
+*/
+#ifndef _QSER_GNSS_H
+#define _QSER_GNSS_H
+#include "mbtk_type.h"
+
+typedef unsigned int Uint_t;
typedef enum
{
- E_LYNQ_LOC_MSG_ID_STATUS_INFO = 0,
- E_LYNQ_LOC_MSG_ID_LOCATION_INFO,
- E_LYNQ_LOC_MSG_ID_SV_INFO,
- E_LYNQ_LOC_MSG_ID_NMEA_INFO,
- E_LYNQ_LOC_MSG_ID_CAPABILITIES_INFO,
- E_LYNQ_LOC_MSG_ID_AGPS_STATUS,
- E_LYNQ_LOC_MSG_ID_NI_NOTIFICATION,
- E_LYNQ_LOC_MSG_ID_XTRA_REPORT_SERVER,
-}E_LYNQ_LOC_MSG_ID_T;
+ E_MT_LOC_MSG_ID_LOCATION_INFO, /**< pv_data = & mopen_location_info_t */
+ E_MT_LOC_MSG_ID_NMEA_INFO, /**< pv_data = & mopen_gnss_nmea_info_t */
+} e_msg_id_t;
-#define LYNQ_LOC_NMEA_MAX_LENGTH 255 /** NMEA string maximum length. */
+typedef void (*gnss_handler_func_t)
+(
+ Uint_t *h_loc,
+ e_msg_id_t e_msg_id, //消息 ID
+ void *pv_data, //消息内容,取决于 ID,如下说明
+ void *context_ptr //用于区分哪个返回的消息
+)/* lynq_AddRxIndMsgHandler_t*/;
+
typedef struct
{
- int64_t timestamp; /**< System Timestamp, marked for when got the nmea data */
- int length; /**< NMEA string length. */
- char nmea[LYNQ_LOC_NMEA_MAX_LENGTH + 1]; /**< NMEA string.*/
-}LYNQ_LOC_NMEA_INFO_T; /* Message */
+ uint32_t year; // 大于 1980
+ uint32_t month; // 1-12
+ uint32_t day; // 1-31
+ uint32_t hour; // 0-23
+ uint32_t minute; // 0-59
+ uint32_t second; // 0-59
+ uint32_t millisecond; // 0-999
+} LYNQ_INJECT_TIME_INTO_T; /* Message */
-/* callback function register to lynq_gnss_rx_ind_msg_handler
- e_msg_id: which kind of msg can be received depend on the bit_mask set in QL_LOC_Set_Indications;
- pv_data: depend on the e_msg_id type.
-*/
-typedef void (*lynq_gnss_rx_ind_msg_handler_t)
-(
- uint32 h_loc,
- E_LYNQ_LOC_MSG_ID_T e_msg_id,
- void *pv_data,
- void *contextPtr
-);
+typedef enum {
+ DELETE_NOTHING = 0, /*不删除数据*/
+ DELETE_EPHEMERIS = 1, /*删除星历*/
+ DELETE_ALMANAC = 2, /*删除历书*/
+ DELETE_POSITION_TIME = 3, /*删除时间和位置信息. */
+ DELETE_UTC = 4, /*删除 UTC 时间*/
+ DELETE_ALL = 5 /*删除所有*/
+} DELETE_AIDING_DATA_TYPE_T;
-/**
- * @brief function description
- *
- * @details detailed description
- *
- * @param param
- *
- * @return return type
- */
-int lynq_gnss_init(void);
-/**
- * @brief function description
- *
- * @details detailed description
- *
- * @param param
- *
- * @return return type
- */
-int lynq_gnss_deinit(void);
+int qser_Gnss_Init (uint32_t *h_gnss);
-/**
- * @brief function description
- *
- * @details detailed description
- *
- * @param param
- *
- * @return return type
- */
-int lynq_gnss_callback_reg(lynq_gnss_rx_ind_msg_handler_t handlerPtr);
+int qser_Gnss_Deinit (uint32_t h_gnss);
-/**
- * @brief function description
- *
- * @details detailed description
- *
- * @param param
- *
- * @return return type
- */
-int lynq_gnss_start(void);
-/**
- * @brief function description
- *
- * @details detailed description
- *
- * @param param
- *
- * @return return type
- */
-int lynq_gnss_stop(void);
+int qser_AddRxIndMsgHandler (gnss_handler_func_t handler_ptr,uint32_t h_gnss);
-/**
- * @brief function description
- *
- * @details detailed description
- *
- * @param param
- *
- * @return return type
- */
-int lynq_gnss_agps_dataconnopen(void);
-/**
- * @brief function description
- *
- * @details detailed description
- *
- * @param param
- *
- * @return return type
- */
-int lynq_gnss_dev_reset(void);
+int qser_Set_Indications (uint32_t h_gnss,e_msg_id_t type);
-/**
- * @brief function description
- *
- * @details detailed description
- *
- * @param param
- *
- * @return return type
- */
-int lynq_gnss_enable_glonass(void);
+int qser_Gnss_Start (uint32_t h_gnss);
-#endif
+int qser_Gnss_Stop (uint32_t h_gnss);
+
+int qser_Gnss_InjectTime (uint32_t h_gnss,LYNQ_INJECT_TIME_INTO_T *time_info);
+
+int qser_Gnss_Delete_Aiding_Data (uint32_t h_gnss,DELETE_AIDING_DATA_TYPE_T flags);
+
+int qser_Gnss_download_tle();
+
+int qser_Gnss_injectEphemeris(uint32_t h_gnss);
+
+#endif /* _QSER_GNSS_H */
diff --git a/mbtk/include/lynq/lynq_led.h b/mbtk/include/lynq/lynq_led.h
new file mode 100755
index 0000000..c95282b
--- /dev/null
+++ b/mbtk/include/lynq/lynq_led.h
@@ -0,0 +1,12 @@
+#ifndef LYNQ_LED_H
+#define LYNQ_LED_H 1
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int lynq_set_netled_on(const int test_mode);
+int lynq_set_statusled_on(const int test_mode);
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/mbtk/include/lynq/lynq_net_api.h b/mbtk/include/lynq/lynq_net_api.h
deleted file mode 100755
index 30f8837..0000000
--- a/mbtk/include/lynq/lynq_net_api.h
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
-*
-* Data : 2022/10/21 16:00:28
-* Author : LiuBin
-*/
-#ifndef _LYNQ_NET_API_H
-#define _LYNQ_NET_API_H
-#include "mbtk_info_api.h"
-
-typedef enum {
- RADIO_TECH_3GPP = 1, /* 3GPP Technologies - GSM, WCDMA */
- RADIO_TECH_3GPP2 = 2 /* 3GPP2 Technologies - CDMA */
-} RIL_RadioTechnologyFamily;
-
-typedef struct
-{
- int rssi; // 0: 113 dBm or less
- // 1: 111 dBm
- // 2...30: 109 dBm...53 dBm
- // 31: 51 dBm or greater
- // 99: not known or not detectable
- int ber; // 0...7 as RXQUAL values in the table in 3GPP TS 45.008 [20] subclause 8.2.4
- // 99 not known or not detectable
- int gsm_sig_valid;
- int rxlev;// 0:rssi < -110 dBm
- // 1: -110 dBm <= rssi < -109 dBm
- // 2: -109 dBm <= rssi < -108 dBm
- // ......
- // 61: -50 dBm <= rssi < -49 dBm
- // 62: -49 dBm <= rssi < -48 dBm
- // 63: -48 dBm <= rssi
- // 99: not known or not detectable
- int umts_sig_valid;
- int rscp; // 0: rscp < -120 dBm
- // 1: -120 dBm <= rscp < -119 dBm
- // 2: -119 dBm <= rscp < -118 dBm
- // ......
- // 94: -27 dBm <= rscp < -26 dBm
- // 95: -26 dBm <= rscp < -25 dBm
- // 96: - 25 dBm <= rscp
- // 255: not known or not detectable
- int ecno; // 0: Ec/Io < -24 dB
- // 1: -24 dB <= Ec/Io < -23.5 dB
- // 2: -23.5 dB <= Ec/Io < -23 dB
- // ......
- // 47: -1 dB <= Ec/Io < -0.5 dB
- // 48: -0.5 dB <= Ec/Io < 0 dB
- // 49: 0 dB <= Ec/Io
- // 255: not known or not detectable
- int lte_sig_valid;
- int rsrq; // 0: rsrq < -19.5 dB
- // 1: -19.5 dB <= rsrq < -19 dB
- // 2: -19 dB <= rsrq < -18.5 dB
- // ......
- // 32: -4 dB <= rsrq < -3.5 dB
- // 33: -3.5 dB <= rsrq < -3 dB
- // 34: -3 dB <= rsrq
- // 255: not known or not detectable
- int rsrp; // 0: rsrp < -140 dBm
- // 1: -140 dBm <= rsrp < -139 dBm
- // 2: -139 dBm <= rsrp < -138 dBm
- // ......
- // 95: -46 dBm <= rsrp < -45 dBm
- // 96: -45 dBm <= rsrp < -44 dBm
- // 97: -44 dBm <= rsrp
- // 255: not known or not detectable
-} signalStrength_t;
-
-typedef enum {
- ZONE_NUM_SOC = 0,
- ZONE_NUM_RF
-} ZONE_NUM;
-
-int lynq_network_init(int uToken);
-
-int lynq_network_deinit(void);
-
-int lynq_get_version(char buf[]);
-
-int lynq_get_imei(char buf[]);
-
-int lynq_get_sn(char buf[]);
-
-int lynq_shutdown(char options[]);
-
-int lynq_time_set(mbtk_time_type_enum time_type, char* time_str);
-
-int lynq_get_zone_tmp(ZONE_NUM num, int *temp);
-
-int lynq_get_sim_status(int *card_status);
-
-int lynq_get_imsi(char buf[]);
-
-int lynq_get_iccid(char buf[]);
-
-int lynq_query_phone_number(char buf[]);
-
-int lynq_sim_power (int mode);
-
-int lynq_query_operater(char *OperatorFN,char *OperatorSH,char *MccMnc);
-
-int lynq_query_network_selection_mode (int *netselMode);
-
-int lynq_set_network_selection_mode(const char *mode, const char* mccmnc);
-
-int lynq_query_available_network(list_node_t** net_list);
-
-int lynq_query_registration_state(const char *type, int* regState,int *imsRegState,char * LAC,char *CID,int *netType,int * radioTechFam,int *netRejected);
-
-int lynq_query_prefferred_networktype (int *preNetType);
-
-int lynq_set_prefferred_networktype (const int preNetType);
-
-int lynq_set_band_mode(int gsm_band, int umts_band, int tdlte_band, int fddlte_band);
-
-int lynq_query_available_bandmode (int *gsm_band, int *umts_band, int *tdlte_band, int *fddlte_band);
-
-int lynq_radio_on (const int data);
-
-int lynq_query_radio_tech (int* radioTech);
-
-int lynq_solicited_signal_strength (signalStrength_t *solSigStren);
-
-int lynq_set_ims (const int ims_mode);
-
-int lynq_init_cell(void);
-
-int lynq_deinit_cell(void);
-
-int lynq_query_cell_info(int *type, list_node_t **cell_list);
-
-void lynq_set_cell_info(char *mem);
-
-/*
-* Set specific APN informations.
-*
-* cid : 2-7
-*/
-int lynq_apn_set(int cid, mbtk_ip_type_enum ip_type, const void* apn_name,
- const void *user_name, const void *user_pass, const void *auth);
-
-/*
-* Get current all APN informations.
-*/
-int lynq_apn_get(int *apn_num, mbtk_apn_info_t apns[]);
-
-/*
-* Start data call.
-*/
-int lynq_data_call_start(int cid, int timeout);
-
-/*
-* Stop data call.
-*/
-int lynq_data_call_stop(int cid, int timeout);
-
-/*
-* Query data call state.
-*/
-int lynq_data_call_query(int cid, mbtk_ipv4_info_t *ipv4, mbtk_ipv6_info_t *ipv6);
-
-/*
-*Get native ip and free port
-*/
-int lynq_get_ip_and_port(char *ipBuf_out,int *port,int iptype);
-
-#endif /* _LYNQ_NET_API_H */
diff --git a/mbtk/include/lynq/lynq_network.h b/mbtk/include/lynq/lynq_network.h
new file mode 100755
index 0000000..e878e6b
--- /dev/null
+++ b/mbtk/include/lynq/lynq_network.h
@@ -0,0 +1,147 @@
+#ifndef LYNQ_NETWORK_H
+#define LYNQ_NETWORK_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+#define MODEM_GEN97 1
+#define CELLINFO_MAX_NUM 10
+#define LY_RECOVER_TIMER_INTERVAL 128
+#define MAX_CELLINFO_ITEM_NUMBER 32
+#define MAX_OOS_CFG_ITEM_NUMBER 32
+/*T800 platform support gsm,wcdma lte,nr */
+typedef struct{
+ int gw_sig_valid; /*1 valid,1 invalid*/
+ int rssi; /* Valid values are (0-31, 99) as defined in TS 27.007 8.5 */
+ int wcdma_sig_valid;/*1 valid,0 invalid*/
+ int wcdma_signalstrength;
+ int rscp; /* The Received Signal Code Power in dBm multipled by -1.
+ * Range : 25 to 120
+ * INT_MAX: 0x7FFFFFFF denotes invalid value.
+ * Reference: 3GPP TS 25.123, section 9.1.1.1 */
+ int ecno; /* Valid values are positive integers. This value is the actual Ec/Io multiplied
+ * by -10. Example: If the actual Ec/Io is -12.5 dB, then this response value
+ * will be 125.*/
+ int lte_sig_valid;/*1 valid,0 invalid*/
+ int lte_signalstrength;
+ int rsrp; /* The current Reference Signal Receive Power in dBm multipled by -1.
+ * Range: 44 to 140 dBm
+ * INT_MAX: 0x7FFFFFFF denotes invalid value.
+ * Reference: 3GPP TS 36.133 9.1.4 */
+ int rsrq; /* The current Reference Signal Receive Quality in dB multiplied by -1.
+ * Range: 20 to 3 dB.
+ * INT_MAX: 0x7FFFFFFF denotes invalid value.
+ * Reference: 3GPP TS 36.133 9.1.7 */
+ int rssnr; /* The current reference signal signal-to-noise ratio in 0.1 dB units.
+ * Range: -200 to +300 (-200 = -20.0 dB, +300 = 30dB).
+ * INT_MAX : 0x7FFFFFFF denotes invalid value.
+ * Reference: 3GPP TS 36.101 8.1.1 */
+ int nr_sig_valid;/*1 valid,0 invalid*/
+ int ssRsrp; /* SS(Synchronization Signal) reference signal received power, multipled by -1.
+ * Reference: 3GPP TS 38.215.
+ * Range [44, 140], INT_MAX means invalid/unreported.*/
+ int ssRsrq; /* SS reference signal received quality, multipled by -1.
+ * Reference: 3GPP TS 38.215.
+ * Range [3, 20], INT_MAX means invalid/unreported.*/
+ int ssSinr; /* SS signal-to-noise and interference ratio.
+ * Reference: 3GPP TS 38.215 section 5.1.*, 3GPP TS 38.133 section 10.1.16.1.
+ * Range [-23, 40], INT_MAX means invalid/unreported.*/
+ int csiRsrp; /* CSI reference signal received power, multipled by -1.
+ * Reference: 3GPP TS 38.215.
+ * Range [44, 140], INT_MAX means invalid/unreported.*/
+ int csiRsrq; /* CSI reference signal received quality, multipled by -1.
+ * Reference: 3GPP TS 38.215.
+ * Range [3, 20], INT_MAX means invalid/unreported.*/
+ int csiSinr; /* CSI signal-to-noise and interference ratio.
+ * Reference: 3GPP TS 138.215 section 5.1.*, 3GPP TS 38.133 section 10.1.16.1.
+ * Range [-23, 40], INT_MAX means invalid/unreported.*/
+}signalStrength_t;
+
+typedef enum {
+ NETWORK_RADIO_ON_TYPE_CFUN_0=0,
+ NETWORK_RADIO_ON_TYPE_NORMAL_MODE=1,
+ NETWORK_RADIO_ON_TYPE_FLIGHT_MODE=4,
+}lynq_network_radio_on_type;
+
+int lynq_network_init(int utoken);
+int lynq_network_deinit(void);
+int lynq_query_operater(char *OperatorFN,char *OperatorSH,char *MccMnc);
+int lynq_query_network_selection_mode(int *netselMode);
+int lynq_set_network_selection_mode(const char *mode,const char* mccmnc);
+int lynq_query_available_network(char *OperatorFN,char *OperatorSH,char *MccMnc,char * NetStatus);
+int lynq_query_registration_state(const char *type,int* regState,int* imsRegState,char * LAC,char * CID,int *netType,int *radioTechFam,int *netRejected);
+int lynq_query_prefferred_networktype(int *preNetType);
+int lynq_set_prefferred_networktype(const int preffertype);
+int lynq_query_cell_info(uint64_t cellinfo[CELLINFO_MAX_NUM],int tac[CELLINFO_MAX_NUM],int earfcn[CELLINFO_MAX_NUM],int * realNum);
+int lynq_set_unsol_cell_info_listrate(const int rate);
+int lynq_set_band_mode(const int bandmode);
+int lynq_query_available_bandmode(int availBanMode[]);
+int lynq_radio_on(const lynq_network_radio_on_type type);
+int lynq_query_radio_state(int *radio_state);
+int lynq_query_radio_tech(int* radioTech);
+int lynq_solicited_signal_strength(signalStrength_t *solSigStren);
+int lynq_set_ims(const int ims_mode);
+int lynq_wait_signalchanges(int *handle);
+int lynq_get_urc_info(const int handle,signalStrength_t *solSigStren,int *slot_id);
+
+typedef enum {
+ LYNQ_CELL_INFO_TYPE_GSM = 2,
+ LYNQ_CELL_INFO_TYPE_WCDMA = 3,
+ LYNQ_CELL_INFO_TYPE_LTE = 4,
+ LYNQ_CELL_INFO_TYPE_NR = 5
+} lynq_network_cell_info_type;
+
+int lynq_query_serve_cell_info(int serve_cell_info[MAX_CELLINFO_ITEM_NUMBER], int * valid_number);
+
+typedef enum {
+ NETWORK_STATE_BUFFER_TYPE_VOICE_REG,
+ NETWORK_STATE_BUFFER_TYPE_DATA_REG,
+ NETWORK_STATE_BUFFER_TYPE_IMS_REG,
+ NETWORK_STATE_BUFFER_TYPE_MAX,
+}lynq_network_state_buffer_type;
+int lynq_set_state_buffer_valid_period_of_network(lynq_network_state_buffer_type type,int valid_period);
+int lynq_get_state_buffer_valid_period_of_network(lynq_network_state_buffer_type type);
+#ifdef MODEM_GEN97
+/**@brief set or get OOS recover timer interval
+* @param mode [IN] <mode>:
+* 0:set
+* 1:get
+* @param interval [IN] <interval>: the recovery timer interval.
+* field:
+* T1,T2,...,T23:integer value 0~0xFFFFFFFF
+* The length of time in seconds.
+* defualt interval: 20,20,60,60,60,60,90,90,90,90,90,90,180,180,180,180,180,180,360,360,360,360,360
+* @param result [OUT] <result>: the recovery timer interval,when the mode is 1, this parameter is valid.
+
+* @return
+* 0:success
+* other:failure
+*/
+int lynq_oos_recover_timer_interval(int mode, char interval[LY_RECOVER_TIMER_INTERVAL],char result[LY_RECOVER_TIMER_INTERVAL]);
+/**@brief set deep sleep recover timer interval
+
+* @param recovery_threshold [IN] <recovery_threshold>: valid range 2-10 //After performing several rounds of normal recovery, deep sleep mode optimization will be applied
+
+* @param fullband_timer [IN] <fullband_timer>:valid range 90-360 //fullband intervarl length in deep sleep mode
+
+* @param sniffer_timer [IN] <sniffer_timer>:valid range 10-60 // sniffe intervarl length in deep sleep mode.
+
+* @param inactive_mode [IN] <inactive_mode>:
+* 0 Exit inactive mode
+* 1 enter inactive mode
+
+* @return
+* 0:success
+* other:failure
+*/
+int lynq_oos_deep_sleep_recover_timer_interval(int recovery_threshold,int fullband_timer,int sniffer_timer,int inactive_mode);
+#endif
+#if (defined MOBILETEK_TARGET_PLATFORM_T106) || (defined MODEM_GEN97)
+int lynq_set_oos_net_scan_cfg(int config_list[MAX_OOS_CFG_ITEM_NUMBER], int valid_num);
+int lynq_get_oos_net_scan_cfg(int config_list[MAX_OOS_CFG_ITEM_NUMBER], int* valid_num);
+#endif
+void lynq_set_test_mode(const int test_mode);
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/mbtk/include/lynq/lynq_qser_network.h b/mbtk/include/lynq/lynq_qser_network.h
new file mode 100755
index 0000000..e7727c2
--- /dev/null
+++ b/mbtk/include/lynq/lynq_qser_network.h
@@ -0,0 +1,425 @@
+/**
+ *@file QSER_nw.h
+ *@date 2018-02-22
+ *@author
+ *@brief
+ */
+#ifndef __LYNQ_QSER_NETWORK_H__
+#define __LYNQ_QSER_NETWORK_H__
+#ifdef __cplusplus
+extern "C" {
+#endif
+#include "mbtk_type.h"
+
+typedef uint32_t nw_client_handle_type;
+
+
+#define QSER_NW_MODE_NONE 0x00 /**< No network. */
+#define QSER_NW_MODE_GSM 0x01 /**< Include GSM networks. */
+#define QSER_NW_MODE_WCDMA 0x02 /**< Include WCDMA networks. */
+#define QSER_NW_MODE_CDMA 0x04 /**< Include CDMA networks. */
+#define QSER_NW_MODE_EVDO 0x08 /**< Include EVDO networks. */
+#define QSER_NW_MODE_LTE 0x10 /**< Include LTE networks. */
+#define QSER_NW_MODE_TDSCDMA 0x20 /**< Include TDSCDMA networks. */
+
+typedef enum
+{
+ E_QSER_NW_ROAM_STATE_OFF = 0, /**< None, or roaming indicator off. */
+ E_QSER_NW_ROAM_STATE_ON = 1 /**< Roaming indicator on. */
+}E_QSER_NW_ROAM_STATE_TYPE_T;
+
+/** Configures the settings that define the MCM network interface. */
+typedef struct
+{
+ /* Configuration parameters for MCM network registration Network registration details Technology dependent network registration details */
+ uint64_t preferred_nw_mode; /**< Preferred network mode for connections; a bitmask of QSER_NW_MODE_xxxx.*/
+ E_QSER_NW_ROAM_STATE_TYPE_T roaming_pref; /**< Roaming preference.*/
+}QSER_NW_CONFIG_INFO_T;
+
+/** Configures the OOS (out of service) settings that define the MCM network interface. */
+#define QSER_NW_OOS_CFG_TYPE_FAST_SCAN 0x00 /**< fast net scan */
+#define QSER_NW_OOS_CFG_TYPE_FULL_BAND_SCAN 0x01 /**< full band scan */
+
+typedef struct
+{
+ /* Configuration parameters for MCM network fast network scan when OOS (out of service)*/
+ char enable;
+ uint16_t time_interval;
+}QSER_NW_OOS_CONFIG_FAST_SCAN_INFO_T;
+
+typedef struct
+{
+ /* Configuration parameters for MCM network full band network scan when OOS (out of service)*/
+ int t_min;
+ int t_step;
+ int t_num;
+ int t_max;
+}QSER_NW_OOS_CONFIG_FULL_BAND_SCAN_INFO_T;
+
+
+typedef struct
+{
+ char type; /**< QSER_NW_OOS_CFG_TYPE_xxxx.*/
+ union {
+ QSER_NW_OOS_CONFIG_FAST_SCAN_INFO_T fast_can_info; // 00
+ QSER_NW_OOS_CONFIG_FULL_BAND_SCAN_INFO_T full_band_scan_info; // 01
+ } u;
+}QSER_NW_OOS_CONFIG_INFO_T;
+
+//defined for QSER_NW_EventRegister
+#define NW_IND_VOICE_REG_EVENT_IND_FLAG (1 << 0) /**< msg format : QSER_NW_VOICE_REG_EVENT_IND_T */
+#define NW_IND_DATA_REG_EVENT_IND_FLAG (1 << 1) /**< msg format : QSER_NW_DATA_REG_EVENT_IND_T */
+#define NW_IND_SIGNAL_STRENGTH_EVENT_IND_FLAG (1 << 2) /**< msg format : QSER_NW_SINGNAL_EVENT_IND_T */
+
+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.*/
+}QSER_NW_OPERATOR_NAME_INFO_T;
+
+typedef enum
+{
+ E_QSER_NW_RADIO_TECH_TD_SCDMA = 1,
+ E_QSER_NW_RADIO_TECH_GSM = 2, /**< GSM; only supports voice. */
+ E_QSER_NW_RADIO_TECH_HSPAP = 3, /**< HSPA+. */
+ E_QSER_NW_RADIO_TECH_LTE = 4, /**< LTE. */
+ E_QSER_NW_RADIO_TECH_EHRPD = 5, /**< EHRPD. */
+ E_QSER_NW_RADIO_TECH_EVDO_B = 6, /**< EVDO B. */
+ E_QSER_NW_RADIO_TECH_HSPA = 7, /**< HSPA. */
+ E_QSER_NW_RADIO_TECH_HSUPA = 8, /**< HSUPA. */
+ E_QSER_NW_RADIO_TECH_HSDPA = 9, /**< HSDPA. */
+ E_QSER_NW_RADIO_TECH_EVDO_A = 10, /**< EVDO A. */
+ E_QSER_NW_RADIO_TECH_EVDO_0 = 11, /**< EVDO 0. */
+ E_QSER_NW_RADIO_TECH_1xRTT = 12, /**< 1xRTT. */
+ E_QSER_NW_RADIO_TECH_IS95B = 13, /**< IS95B. */
+ E_QSER_NW_RADIO_TECH_IS95A = 14, /**< IS95A. */
+ E_QSER_NW_RADIO_TECH_UMTS = 15, /**< UMTS. */
+ E_QSER_NW_RADIO_TECH_EDGE = 16, /**< EDGE. */
+ E_QSER_NW_RADIO_TECH_GPRS = 17, /**< GPRS. */
+ E_QSER_NW_RADIO_TECH_NONE = 18 /**< No technology selected. */
+}E_QSER_NW_RADIO_TECH_TYPE_T;
+
+
+typedef enum
+{
+ E_QSER_NW_TECH_DOMAIN_NONE = 0, /**< None. */
+ E_QSER_NW_TECH_DOMAIN_3GPP = 1, /**< 3GPP. */
+ E_QSER_NW_TECH_DOMAIN_3GPP2 = 2, /**< 3GPP2. */
+}E_QSER_NW_TECH_DOMAIN_TYPE_T;
+
+typedef enum
+{
+ E_QSER_NW_IMSI_UNKNOWN_HLR_DENY_REASON = 1, /**< IMSI unknown in HLR. */
+ E_QSER_NW_ILLEGAL_MS_DENY_REASON = 2, /**< Illegal MS. */
+ E_QSER_NW_IMSI_UNKNOWN_VLR_DENY_REASON = 3, /**< IMSI unknown in VLR. */
+ E_QSER_NW_IMEI_NOT_ACCEPTED_DENY_REASON = 4, /**< IMEI not accepted. */
+ E_QSER_NW_ILLEGAL_ME_DENY_REASON = 5, /**< Illegal ME. */
+ E_QSER_NW_PLMN_NOT_ALLOWED_DENY_REASON = 6, /**< PLMN not allowed. */
+ E_QSER_NW_LA_NOT_ALLOWED_DENY_REASON = 7, /**< Location area not allowed. */
+ E_QSER_NW_ROAMING_NOT_ALLOWED_LA_DENY_REASON = 8, /**< Roaming not allowed in this location area. */
+ E_QSER_NW_NO_SUITABLE_CELLS_LA_DENY_REASON = 9, /**< No suitable cells in location area. */
+ E_QSER_NW_NETWORK_FAILURE_DENY_REASON = 10, /**< Network failure. */
+ E_QSER_NW_MAC_FAILURE_DENY_REASON = 11, /**< MAC failure. */
+ E_QSER_NW_SYNCH_FAILURE_DENY_REASON = 12, /**< Sync failure. */
+ E_QSER_NW_CONGESTION_DENY_REASON = 13, /**< Congestion. */
+ E_QSER_NW_GSM_AUTHENTICATION_UNACCEPTABLE_DENY_REASON = 14, /**< GSM authentication unacceptable. */
+ E_QSER_NW_NOT_AUTHORIZED_CSG_DENY_REASON = 15, /**< Not authorized in this CSG. */
+ E_QSER_NW_SERVICE_OPTION_NOT_SUPPORTED_DENY_REASON = 16, /**< Service option not supported. */
+ E_QSER_NW_REQ_SERVICE_OPTION_NOT_SUBSCRIBED_DENY_REASON = 17, /**< Requested service option not subscribed. */
+ E_QSER_NW_CALL_CANNOT_BE_IDENTIFIED_DENY_REASON = 18, /**< Call cannot be identified. */
+ E_QSER_NW_SEMANTICALLY_INCORRECT_MSG_DENY_REASON = 19, /**< Semantically incorrect message. */
+ E_QSER_NW_INVALID_MANDATORY_INFO_DENY_REASON = 20, /**< Invalid mandatory information. */
+ E_QSER_NW_MSG_TYPE_NON_EXISTENT_DENY_REASON = 21, /**< Message type non-existent or not implemented. */
+ E_QSER_NW_INFO_ELEMENT_NON_EXISTENT_DENY_REASON = 22, /**< Message type not compatible with the protocol state. */
+ E_QSER_NW_CONDITIONAL_IE_ERR_DENY_REASON = 23, /**< Conditional IE error. */
+ E_QSER_NW_MSG_INCOMPATIBLE_PROTOCOL_STATE_DENY_REASON = 24, /**< Message not compatible with the protocol state. */
+ E_QSER_NW_PROTOCOL_ERROR_DENY_REASON = 25, /**< Unspecified protocol error. */
+}E_QSER_NW_DENY_REASON_TYPE_T;
+
+
+typedef enum
+{
+ E_QSER_NW_SERVICE_NONE = 0x0000, /**< Not registered or no data. */
+ E_QSER_NW_SERVICE_LIMITED = 0x0001, /**< Registered; emergency service only. */
+ E_QSER_NW_SERVICE_FULL = 0x0002, /**< Registered, full service. */
+}E_QSER_NW_SERVICE_TYPE_T;
+
+typedef struct
+{
+ E_QSER_NW_TECH_DOMAIN_TYPE_T tech_domain; /**< Technology, used to determine the structure type tech: 0 -- None, 1 -- 3GPP, 2 -- 3GPP2.*/
+ E_QSER_NW_RADIO_TECH_TYPE_T radio_tech; /**< Radio technology; see #nw_radio_tech_t_v01.*/
+ E_QSER_NW_ROAM_STATE_TYPE_T roaming; /**< 0 -- Off, 1 -- Roaming (3GPP2 has extended values).*/
+ E_QSER_NW_DENY_REASON_TYPE_T deny_reason; /**< Set when registration state is #nw_deny_reason_t_v01.*/
+ E_QSER_NW_SERVICE_TYPE_T registration_state; /**< Registration state.*/
+}QSER_NW_COMMON_REG_INFO_T;
+
+
+typedef struct
+{
+ E_QSER_NW_TECH_DOMAIN_TYPE_T tech_domain; /**< Technology, used to determine the structure type tech: 0 -- None, 1 -- 3GPP, 2 -- 3GPP2.*/
+ E_QSER_NW_RADIO_TECH_TYPE_T radio_tech; /**< Radio technology; see #nw_radio_tech_t_v01.*/
+ char mcc[3+1]; /**< Mobile country code.*/
+ char mnc[3+1]; /**< Mobile network code.*/
+ E_QSER_NW_ROAM_STATE_TYPE_T roaming; /**< 0 -- Off, 1 -- Roaming (3GPP2 has extended values).*/
+ uint8_t forbidden; /**< Forbidden: 0 -- No, 1 -- Yes.*/
+ uint32_t cid; /**< Cell ID for the registered 3GPP system.*/
+ uint16_t lac; /**< Locatin area code for the registered 3GPP system.*/
+ uint16_t psc; /**< Primary scrambling code (WCDMA only); 0 -- None.*/
+ uint16_t tac; /**< Tracking area code information for LTE.*/
+}QSER_NW_3GPP_REG_INFO_T;
+
+
+typedef struct
+{
+ E_QSER_NW_TECH_DOMAIN_TYPE_T tech_domain; /**< Technology, used to determine structure type tech: 0 -- None, 1 -- 3GPP, 2 -- 3GPP2.*/
+ E_QSER_NW_RADIO_TECH_TYPE_T radio_tech; /**< Radio technology; see #nw_radio_tech_t_v01.*/
+ char mcc[3+1]; /**< Mobile country code.*/
+ char mnc[3+1]; /**< Mobile network code.*/
+ E_QSER_NW_ROAM_STATE_TYPE_T roaming; /**< Roaming status; see #nw_roam_state_t_v01.*/
+ uint8_t forbidden; /**< Forbidden: 0 -- No, 1 -- Yes.*/
+ uint8_t inPRL; /**< 0 -- Not in PRL, 1 -- In PRL.*/
+ uint8_t css; /**< Concurrent services supported: 0 -- No, 1 -- Yes.*/
+ uint16_t sid; /**< CDMA system ID.*/
+ uint16_t nid; /**< CDMA network ID.*/
+ uint16_t bsid; /**< Base station ID. @newpagetable */
+}QSER_NW_3GPP2_REG_INFO_T;
+
+/** Gets the status associated with the connection of \<id\>. */
+typedef struct
+{
+ uint8_t voice_registration_valid; /**< Must be set to TRUE if voice_registration is being passed. */
+ QSER_NW_COMMON_REG_INFO_T voice_registration; /**< Voice registration. */
+
+ uint8_t data_registration_valid; /**< Must be set to TRUE if data_registration is being passed. */
+ QSER_NW_COMMON_REG_INFO_T data_registration; /**< Data registration. */
+
+ uint8_t voice_registration_details_3gpp_valid; /**< Must be set to TRUE if voice_registration_details_3gpp is being passed. */
+ QSER_NW_3GPP_REG_INFO_T voice_registration_details_3gpp; /**< Voice registration details for 3GPP. */
+
+ uint8_t data_registration_details_3gpp_valid; /**< Must be set to TRUE if data_registration_details_3gpp is being passed. */
+ QSER_NW_3GPP_REG_INFO_T data_registration_details_3gpp; /**< Data registration details for 3GPP. */
+
+ uint8_t voice_registration_details_3gpp2_valid; /**< Must be set to TRUE if voice_registration_details_3gpp2 is being passed. */
+ QSER_NW_3GPP2_REG_INFO_T voice_registration_details_3gpp2; /**< Voice registration details for 3GPP2. */
+
+ uint8_t data_registration_details_3gpp2_valid; /**< Must be set to TRUE if data_registration_details_3gpp2 is being passed. */
+ QSER_NW_3GPP2_REG_INFO_T data_registration_details_3gpp2; /**< Data registration details for 3GPP2. */
+}QSER_NW_REG_STATUS_INFO_T;
+
+
+typedef struct
+{
+ int8_t rssi; /**< RSSI in dBm. Indicates received signal strength. A signed value; -125 or lower indicates no signal.*/
+}QSER_NW_GSM_SIGNAL_INFO_T;
+
+
+typedef struct
+{
+ int8_t rssi; /**< RSSI in dBm. Indicates forward link pilot Ec. A signed value; -125 or lower indicates no signal.*/
+ int16_t ecio; /**< Ec/Io value representing negative 0.5 dB increments, e.g., 2 equals -1 dbm.*/
+}QSER_NW_WCDMA_SIGNAL_INFO_T;
+
+typedef struct
+{
+ int8_t rssi; /**< RSSI in dBm. Indicates forward link pilot Ec. a signed value; -125 or lower indicates no signal.*/
+ int8_t rscp; /**< RSCP in dBm.*/
+ int16_t ecio; /**< Ec/Io value representing negative 0.5 dB increments, e.g., 2 equals -1 dbm.*/
+ int8_t sinr; /**< Measured SINR in dB. @newpagetable */
+}QSER_NW_TDSCDMA_SIGNAL_INFO_T;
+
+typedef struct
+{
+ int8_t rssi; /**< RSSI in dBm. Indicates forward link pilot Ec. A signed value; -125 or lower indicates no signal.*/
+ int8_t rsrq; /**< RSRQ value in dB (signed integer value), as measured by L1. Range: -3 to -20 (-3 equals -3 dB, -20 equals -20 dB).*/
+ int16_t rsrp; /**< Current RSRP in dBm, as measured by L1. Range: -44 to -140 (-44 equals -44 dBm, -140 equals -140 dBm).*/
+ int16_t snr; /**< SNR level as a scaled integer in units of 0.1 dB; e.g., -16 dB has a value of -160 and 24.6 dB has a value of 246.*/
+}QSER_NW_LTE_SIGNAL_INFO_T;
+
+typedef struct
+{
+ int8_t rssi; /**< RSSI in dBm. Indicates forward link pilot Power (AGC) + Ec/Io. A signed value; -125 or lower indicates no signal.*/
+ int16_t ecio; /**< Ec/Io value representing negative 0.5 dB increments, e.g., 2 equals -1 dbm.*/
+}QSER_NW_CDMA_SIGNAL_INFO_T;
+
+typedef struct
+{
+ int8_t rssi; /**< RSSI in dBm. Indicates forward link pilot Power (AGC) + Ec/Io. A signed value; -125 or lower indicates no signal.*/
+ int16_t ecio; /**< Ec/Io value representing negative 0.5 dB increments, e.g., 2 equals -1 dbm.*/
+ int8_t sinr; /**< SINR level.*/
+ int32_t io; /**< Received IO in dBm. */
+}QSER_NW_HDR_SIGNAL_INFO_T;
+
+typedef struct
+{
+ int16_t ssRsrp; /* SS(Synchronization Signal) reference signal received power, multipled by -1.
+ * Reference: 3GPP TS 38.215.
+ * Range [44, 140], INT_MAX means invalid/unreported.*/
+ int16_t ssRsrq; /* SS reference signal received quality, multipled by -1.
+ * Reference: 3GPP TS 38.215.
+ * Range [3, 20], INT_MAX means invalid/unreported.*/
+ int16_t ssSinr; /* SS signal-to-noise and interference ratio.
+ * Reference: 3GPP TS 38.215 section 5.1.*, 3GPP TS 38.133 section 10.1.16.1.
+ * Range [-23, 40], INT_MAX means invalid/unreported.*/
+ int16_t csiRsrp; /* CSI reference signal received power, multipled by -1.
+ * Reference: 3GPP TS 38.215.
+ * Range [44, 140], INT_MAX means invalid/unreported.*/
+ int16_t csiRsrq; /* CSI reference signal received quality, multipled by -1.
+ * Reference: 3GPP TS 38.215.
+ * Range [3, 20], INT_MAX means invalid/unreported.*/
+ int16_t csiSinr; /* CSI signal-to-noise and interference ratio.
+ * Reference: 3GPP TS 138.215 section 5.1.*, 3GPP TS 38.133 section 10.1.16.1.
+ * Range [-23, 40], INT_MAX means invalid/unreported.*/
+}QSER_NW_NR_SIGNAL_INFO_T;
+
+
+/** Gets signal strength information. */
+typedef struct
+{
+ uint8_t gsm_sig_info_valid; /**< Must be set to TRUE if gsm_sig_info is being passed. */
+ QSER_NW_GSM_SIGNAL_INFO_T gsm_sig_info; /**< GSM signal information. */
+ uint8_t wcdma_sig_info_valid; /**< Must be set to TRUE if wcdma_sig_info is being passed. */
+ QSER_NW_WCDMA_SIGNAL_INFO_T wcdma_sig_info; /**< WCDMA signal information. */
+ uint8_t tdscdma_sig_info_valid; /**< Must be set to TRUE if tdscdma_sig_info is being passed. */
+ QSER_NW_TDSCDMA_SIGNAL_INFO_T tdscdma_sig_info; /**< TDSCDMA signal information. */
+ uint8_t lte_sig_info_valid; /**< Must be set to TRUE if lte_sig_info is being passed. */
+ QSER_NW_LTE_SIGNAL_INFO_T lte_sig_info; /**< LTE signal information. */
+ uint8_t cdma_sig_info_valid; /**< Must be set to TRUE if cdma_sig_info is being passed. */
+ QSER_NW_CDMA_SIGNAL_INFO_T cdma_sig_info; /**< CDMA signal information. */
+ uint8_t hdr_sig_info_valid; /**< Must be set to TRUE if hdr_sig_info is being passed. */
+ QSER_NW_HDR_SIGNAL_INFO_T hdr_sig_info; /**< HDR signal information. */
+ uint8_t nr_sig_info_valid;
+ QSER_NW_NR_SIGNAL_INFO_T nr_sig_info;
+}QSER_NW_SIGNAL_STRENGTH_INFO_T;
+
+
+
+
+
+/* @bridef Callback function registered to QSER_NW_AddRxMsgHandler
+ * map of ind_flag and ind_msg_buf as bellow :
+ * NW_IND_VOICE_REG_EVENT_IND_FLAG : QSER_NW_VOICE_REG_EVENT_IND_T
+ * NW_IND_DATA_REG_EVENT_IND_FLAG : QSER_NW_DATA_REG_EVENT_IND_T
+ * NW_IND_SIGNAL_STRENGTH_EVENT_IND_FLAG : QSER_NW_SINGNAL_EVENT_IND_T
+ * NW_IND_CELL_ACCESS_STATE_CHG_EVENT_IND_FLAG : QSER_NW_CELL_ACCESS_STATE_EVENT_IND_T
+ * NW_IND_NITZ_TIME_UPDATE_EVENT_IND_FLAG : QSER_NW_NITZ_TIME_EVENT_IND_T
+ * */
+typedef void (*QSER_NW_RxMsgHandlerFunc_t)(
+ nw_client_handle_type h_nw,
+ uint32_t ind_flag,
+ void *ind_msg_buf,
+ uint32_t ind_msg_len,
+ void *contextPtr
+);
+
+
+/** Indication message; Indication for the corresponding registered event flag NW_IND_VOICE_REG_EVENT_IND_FLAG */
+typedef struct {
+
+ uint8_t registration_valid; /**< Must be set to TRUE if voice_registration is being passed. */
+ QSER_NW_COMMON_REG_INFO_T registration; /**< Voice registration. */
+
+ uint8_t registration_details_3gpp_valid; /**< Must be set to TRUE if voice_registration_details_3gpp is being passed. */
+ QSER_NW_3GPP_REG_INFO_T registration_details_3gpp; /**< Voice registration details for 3GPP. */
+
+ uint8_t registration_details_3gpp2_valid; /**< Must be set to TRUE if voice_registration_details_3gpp2 is being passed. */
+ QSER_NW_3GPP2_REG_INFO_T registration_details_3gpp2; /**< Voice registration details for 3GPP2. */
+}QSER_NW_VOICE_REG_EVENT_IND_T;
+
+/** Indication message; Indication for the corresponding registered event flag NW_IND_DATA_REG_EVENT_IND_FLAG */
+typedef struct {
+
+ uint8_t registration_valid; /**< Must be set to TRUE if data_registration is being passed. */
+ QSER_NW_COMMON_REG_INFO_T registration; /**< Data registration. */
+
+ uint8_t registration_details_3gpp_valid; /**< Must be set to TRUE if data_registration_details_3gpp is being passed. */
+ QSER_NW_3GPP_REG_INFO_T registration_details_3gpp; /**< Data registration details for 3GPP. */
+
+ uint8_t registration_details_3gpp2_valid; /**< Must be set to TRUE if data_registration_details_3gpp2 is being passed. */
+ QSER_NW_3GPP2_REG_INFO_T registration_details_3gpp2; /**< Data registration details for 3GPP2. */
+}QSER_NW_DATA_REG_EVENT_IND_T;
+
+
+/** Indication message; Indication for the corresponding registered event flag NW_IND_SIGNAL_STRENGTH_EVENT_IND_FLAG */
+typedef struct {
+ uint8_t gsm_sig_info_valid; /**< Must be set to TRUE if gsm_sig_info is being passed. */
+ QSER_NW_GSM_SIGNAL_INFO_T gsm_sig_info; /**< GSM singal information. */
+
+ uint8_t wcdma_sig_info_valid; /**< Must be set to TRUE if wcdma_sig_info is being passed. */
+ QSER_NW_WCDMA_SIGNAL_INFO_T wcdma_sig_info; /**< WCDMA singal information. */
+
+ uint8_t tdscdma_sig_info_valid; /**< Must be set to TRUE if tdscdma_sig_info is being passed. */
+ QSER_NW_TDSCDMA_SIGNAL_INFO_T tdscdma_sig_info; /**< TDSCDMA singal information. */
+
+ uint8_t lte_sig_info_valid; /**< Must be set to TRUE if lte_sig_info is being passed. */
+ QSER_NW_LTE_SIGNAL_INFO_T lte_sig_info; /**< LTE singal information. */
+
+ uint8_t cdma_sig_info_valid; /**< Must be set to TRUE if cdma_sig_info is being passed. */
+ QSER_NW_CDMA_SIGNAL_INFO_T cdma_sig_info; /**< CDMA singal information. */
+
+ uint8_t hdr_sig_info_valid; /**< Must be set to TRUE if hdr_sig_info is being passed. */
+ QSER_NW_HDR_SIGNAL_INFO_T hdr_sig_info; /**< HDR singal information. */
+
+ uint8_t nr_sig_info_valid;
+ QSER_NW_NR_SIGNAL_INFO_T nr_sig_info;
+}QSER_NW_SINGNAL_EVENT_IND_T;
+
+
+int qser_nw_client_init(nw_client_handle_type *ph_nw);
+
+int qser_nw_client_deinit(nw_client_handle_type h_nw);
+
+int qser_nw_set_config
+(
+ nw_client_handle_type h_nw,
+ QSER_NW_CONFIG_INFO_T *pt_info
+);
+
+int qser_nw_set_oos_config
+(
+ nw_client_handle_type h_nw,
+ QSER_NW_OOS_CONFIG_INFO_T *pt_info
+);
+
+int qser_nw_get_oos_config
+(
+ nw_client_handle_type h_nw,
+ QSER_NW_OOS_CONFIG_INFO_T *pt_info
+);
+
+int qser_nw_event_register
+(
+ nw_client_handle_type h_nw,
+ uint32_t bitmask // bit OR of NW_IND_xxxx_EVENT_ON
+);
+
+int qser_nw_get_operator_name
+(
+ nw_client_handle_type h_nw,
+ QSER_NW_OPERATOR_NAME_INFO_T *pt_info //You should malloc this or may cause stack overflow
+);
+
+int qser_nw_get_reg_status
+(
+ nw_client_handle_type h_nw,
+ QSER_NW_REG_STATUS_INFO_T *pt_info
+);
+
+int qser_nw_get_signal_strength
+(
+ nw_client_handle_type h_nw,
+ QSER_NW_SIGNAL_STRENGTH_INFO_T *pt_info
+);
+
+int qser_nw_add_rx_msg_handler
+(
+ nw_client_handle_type h_nw,
+ QSER_NW_RxMsgHandlerFunc_t handlerPtr,
+ void* contextPtr
+);
+
+#ifdef __cplusplus
+}
+#endif
+#endif//__QSER_NW_H__
diff --git a/mbtk/include/lynq/lynq_qser_sim.h b/mbtk/include/lynq/lynq_qser_sim.h
new file mode 100755
index 0000000..bf2782a
--- /dev/null
+++ b/mbtk/include/lynq/lynq_qser_sim.h
@@ -0,0 +1,384 @@
+#ifndef __LYNQ_QSER_SIM__
+#define __LYNQ_QSER_SIM__
+#ifdef __cplusplus
+extern "C" {
+#endif
+#include <stdint.h>
+#include "mbtk_type.h"
+
+#define QSER_SIM_IMSI_LEN_MAX 16 /** Maximum length of IMSI data. */
+#define QSER_SIM_ICCID_LEN_MAX 20 /** Maximum length of ICCID data. */
+
+typedef enum
+{
+ E_QSER_SUCCESS = 0, /**< Success. */
+ E_QSER_ERROR_BADPARM = 4, /**< Bad parameter. */
+}E_QSER_ERROR_CODE_T;
+
+typedef uint32_t sim_client_handle_type;
+
+typedef enum
+{
+ QSER_SIM_SLOT_ID_1 = 0xB01, /**< Identify card in slot 1. */
+ QSER_SIM_SLOT_ID_2 = 0xB02, /**< Identify card in slot 2. */
+}QSER_SIM_SLOT_ID_TYPE_T;
+
+typedef enum
+{
+ QSER_SIM_APP_TYPE_UNKNOWN = 0xB00, /**< Unknown application type */
+ QSER_SIM_APP_TYPE_3GPP = 0xB01, /**< Identify the SIM/USIM application on the card. */
+ QSER_SIM_APP_TYPE_3GPP2 = 0xB02, /**< Identify the RUIM/CSIM application on the card. */
+ QSER_SIM_APP_TYPE_ISIM = 0xB03, /**< Identify the ISIM application on the card. */
+}QSER_SIM_APP_TYPE_T;
+
+typedef struct
+{
+ QSER_SIM_SLOT_ID_TYPE_T e_slot_id; /**< Indicates the slot to be used. */
+ QSER_SIM_APP_TYPE_T e_app; /**< Indicates the type of the application. */
+}QSER_SIM_APP_ID_INFO_T; /* Type */
+
+#define QSER_SIM_PIN_LEN_MAX 8 /** Maximum length of PIN data. */
+
+typedef enum
+{
+ QSER_SIM_PIN_ID_1 = 0xB01, /**< Level 1 user verification. */
+ QSER_SIM_PIN_ID_2 = 0xB02, /**< Level 2 user verification. */
+}QSER_SIM_PIN_ID_TYPE_T;
+
+typedef struct
+{
+ QSER_SIM_APP_ID_INFO_T app_info; /**< Application identification information. */
+ QSER_SIM_PIN_ID_TYPE_T pin_id; /**< PIN ID. */
+ uint32_t pin_value_len; /**< Must be set to the number of elements in pin_value. */
+ char pin_value[QSER_SIM_PIN_LEN_MAX]; /* Value of the PIN */
+}QSER_SIM_VERIFY_PIN_INFO_T;
+
+/** Changes the PIN value of an application. The application must pass both the
+ new and the old values of the PIN to complete the operation.
+ The same PIN can be used by multiple sessions (i.e., the PIN is shared
+ between GSM and RUIM in an ICC card). The PIN is automatically verified
+ for all the sessions when the command is executed. */
+typedef struct
+{
+ QSER_SIM_APP_ID_INFO_T app_info; /**< Application identification information. */
+ QSER_SIM_PIN_ID_TYPE_T pin_id; /**< PIN ID. */
+ uint32_t old_pin_value_len; /**< Must be set to the number of elements in old_pin_value. */
+ char old_pin_value[QSER_SIM_PIN_LEN_MAX]; /**< Value of the old PIN as a sequence of ASCII characters. */
+ uint32_t new_pin_value_len; /**< Must be set to the number of elements in new_pin_value. */
+ char new_pin_value[QSER_SIM_PIN_LEN_MAX]; /**< Value of the new PIN as a sequence of ASCII characters. */
+}QSER_SIM_CHANGE_PIN_INFO_T;
+
+/** Unblocks a blocked PIN using the PUK code. The client must pass PUK1 to unblock PIN1 or PUK2 to unblock PIN2.
+ The same PIN can be used by multiple sessions (i.e., the PIN is shared between GSM and RUIM in an ICC card).
+ The PIN is automatically verified for all the sessions when the command is executed. */
+typedef struct
+{
+ QSER_SIM_APP_ID_INFO_T app_info; /**< Application identification information. */
+ QSER_SIM_PIN_ID_TYPE_T pin_id; /**< PIN ID. */
+ uint32_t puk_value_len; /**< Must be set to the number of elements in puk_value. */
+ char puk_value[QSER_SIM_PIN_LEN_MAX]; /**< Value of the PUK as a sequence of ASCII characters. */
+ uint32_t new_pin_value_len; /**< Must be set to the number of elements in new_pin_value. */
+ char new_pin_value[QSER_SIM_PIN_LEN_MAX]; /**< Value of the new PIN as a sequence of ASCII characters. */
+}QSER_SIM_UNBLOCK_PIN_INFO_T;
+
+/** Enables the PIN on an application. */
+typedef QSER_SIM_VERIFY_PIN_INFO_T QSER_SIM_ENABLE_PIN_INFO_T; //Same
+
+/** Disables the PIN of an application, */
+typedef QSER_SIM_VERIFY_PIN_INFO_T QSER_SIM_DISABLE_PIN_INFO_T; //Same
+
+
+typedef enum
+{
+ QSER_SIM_PERSO_FEATURE_TYPE_UNKNOWN = 0xB00, /**< Unknown personalization feature. */
+ QSER_SIM_PERSO_FEATURE_TYPE_3GPP_NETWORK = 0xB01, /**< Featurization based on 3GPP MCC and MNC. */
+ QSER_SIM_PERSO_FEATURE_TYPE_3GPP_NETWORK_SUBSET = 0xB02, /**< Featurization based on 3GPP MCC, MNC, and IMSI digits 6 and 7. */
+ QSER_SIM_PERSO_FEATURE_TYPE_3GPP_SERVICE_PROVIDER = 0xB03, /**< Featurization based on 3GPP MCC, MNC, and GID1. */
+ QSER_SIM_PERSO_FEATURE_TYPE_3GPP_CORPORATE = 0xB04, /**< Featurization based on 3GPP MCC, MNC, GID1, and GID2. */
+ QSER_SIM_PERSO_FEATURE_TYPE_3GPP_SIM = 0xB05, /**< Featurization based on the 3GPP IMSI. */
+ QSER_SIM_PERSO_FEATURE_TYPE_3GPP2_NETWORK_TYPE_1 = 0xB06, /**< Featurization based on 3GPP2 MCC and MNC. */
+ QSER_SIM_PERSO_FEATURE_TYPE_3GPP2_NETWORK_TYPE_2 = 0xB07, /**< Featurization based on 3GPP2 IRM code. */
+ QSER_SIM_PERSO_FEATURE_TYPE_3GPP2_RUIM = 0xB08, /**< Featurization based on 3GPP2 IMSI_M. */
+}QSER_SIM_PERSO_FEATURE_TYPE_T;
+
+typedef enum
+{
+ QSER_SIM_CARD_STATE_UNKNOWN = 0xB01, /**< Card state unknown. */
+ QSER_SIM_CARD_STATE_ABSENT = 0xB02, /**< Card is absent. */
+ QSER_SIM_CARD_STATE_PRESENT = 0xB03, /**< Card is present. */
+ QSER_SIM_CARD_STATE_ERROR_UNKNOWN = 0xB04, /**< Unknown error state. */
+ QSER_SIM_CARD_STATE_ERROR_POWER_DOWN = 0xB05, /**< Power down. */
+ QSER_SIM_CARD_STATE_ERROR_POLL_ERROR = 0xB06, /**< Poll error. */
+ QSER_SIM_CARD_STATE_ERROR_NO_ATR_RECEIVED = 0xB07, /**< Failed to receive an answer to reset. */
+ QSER_SIM_CARD_STATE_ERROR_VOLT_MISMATCH = 0xB08, /**< Voltage mismatch. */
+ QSER_SIM_CARD_STATE_ERROR_PARITY_ERROR = 0xB09, /**< Parity error. */
+ QSER_SIM_CARD_STATE_ERROR_SIM_TECHNICAL_PROBLEMS= 0xB0A, /**< Card returned technical problems. */
+}QSER_SIM_CARD_STATE_TYPE_T; /**< Card state. */
+
+typedef enum
+{
+ QSER_SIM_CARD_TYPE_UNKNOWN = 0xB00, /**< Unidentified card type. */
+ QSER_SIM_CARD_TYPE_ICC = 0xB01, /**< Card of SIM or RUIM type. */
+ QSER_SIM_CARD_TYPE_UICC = 0xB02, /**< Card of USIM or CSIM type. */
+}QSER_SIM_CARD_TYPE_T;
+
+typedef enum
+{
+ QSER_SIM_PROV_STATE_NONE = 0xB00, /**< Nonprovisioning. */
+ QSER_SIM_PROV_STATE_PRI = 0xB01, /**< Primary provisioning subscription. */
+ QSER_SIM_PROV_STATE_SEC = 0xB02, /**< Secondary provisioning subscription. */
+}QSER_SIM_SUBSCRIPTION_TYPE_T;
+
+typedef enum
+{
+ QSER_SIM_APP_STATE_UNKNOWN = 0xB00, /**< Application state unknown. */
+ QSER_SIM_APP_STATE_DETECTED = 0xB01, /**< Detected state. */
+ QSER_SIM_APP_STATE_PIN1_REQ = 0xB02, /**< PIN1 required. */
+ QSER_SIM_APP_STATE_PUK1_REQ = 0xB03, /**< PUK1 required. */
+ QSER_SIM_APP_STATE_INITALIZATING = 0xB04, /**< Initializing. */
+ QSER_SIM_APP_STATE_PERSO_CK_REQ = 0xB05, /**< Personalization control key required. */
+ QSER_SIM_APP_STATE_PERSO_PUK_REQ = 0xB06, /**< Personalization unblock key required. */
+ QSER_SIM_APP_STATE_PERSO_PERMANENTLY_BLOCKED= 0xB07, /**< Personalization is permanently blocked. */
+ QSER_SIM_APP_STATE_PIN1_PERM_BLOCKED = 0xB08, /**< PIN1 is permanently blocked. */
+ QSER_SIM_APP_STATE_ILLEGAL = 0xB09, /**< Illegal application state. */
+ QSER_SIM_APP_STATE_READY = 0xB0A, /**< Application ready state. @newpage */
+}QSER_SIM_APP_STATE_TYPE_T;
+
+typedef enum
+{
+ QSER_SIM_PIN_STATE_UNKNOWN = 0xB01, /**< Unknown PIN state. */
+ QSER_SIM_PIN_STATE_ENABLED_NOT_VERIFIED = 0xB02, /**< PIN required, but has not been verified. */
+ QSER_SIM_PIN_STATE_ENABLED_VERIFIED = 0xB03, /**< PIN required and has been verified. */
+ QSER_SIM_PIN_STATE_DISABLED = 0xB04, /**< PIN not required. */
+ QSER_SIM_PIN_STATE_BLOCKED = 0xB05, /**< PIN verification has failed too many times and is blocked. Recoverable through PUK verification. */
+ QSER_SIM_PIN_STATE_PERMANENTLY_BLOCKED = 0xB06, /**< PUK verification has failed too many times and is not recoverable. */
+}QSER_SIM_PIN_STATE_TYPE_T;
+
+typedef struct
+{
+ QSER_SIM_SUBSCRIPTION_TYPE_T subscription; /**< Type of subscription (i.e., primary, secondary, etc.). */
+ QSER_SIM_APP_STATE_TYPE_T app_state; /**< Current state of the application. */
+ QSER_SIM_PERSO_FEATURE_TYPE_T perso_feature; /**< Current personalization state and feature enabled. */
+ uint8_t perso_retries; /**< Number of personalization retries. */
+ uint8_t perso_unblock_retries; /**< Number of personalization unblock retries. */
+ QSER_SIM_PIN_STATE_TYPE_T pin1_state; /**< Current PIN 1 state. */
+ uint8_t pin1_num_retries; /**< Number of PIN 1 retries. */
+ uint8_t puk1_num_retries; /**< Number of PUK 1 retries. */
+ QSER_SIM_PIN_STATE_TYPE_T pin2_state; /**< Current PIN 2 state. */
+ uint8_t pin2_num_retries; /**< Number of PIN 2 retries. */
+ uint8_t puk2_num_retries; /**< Number of PUK 2 retries. */
+}QSER_SIM_CARD_APP_INFO_T;
+
+typedef struct
+{
+ QSER_SIM_CARD_APP_INFO_T app_3gpp; /**< Stores 3GPP application information. */
+ QSER_SIM_CARD_APP_INFO_T app_3gpp2; /**< Stores 3GPP2 application information. */
+ QSER_SIM_CARD_APP_INFO_T app_isim; /**< Stores ISIM application information. */
+}QSER_SIM_CARD_ALL_APP_INFO_T;
+
+typedef struct
+{
+ QSER_SIM_CARD_STATE_TYPE_T e_card_state;/**< Current card and card error state. */
+ QSER_SIM_CARD_TYPE_T e_card_type; /**< Card type. */
+ QSER_SIM_CARD_ALL_APP_INFO_T card_app_info; /**< Stores all relevant application information. */
+}QSER_SIM_CARD_STATUS_INFO_T;
+
+int qser_sim_client_init(sim_client_handle_type *ph_sim);
+
+int qser_sim_client_deinit(sim_client_handle_type h_sim);
+
+/*===========================================================================
+
+ FUNCTION: qser_sim_getimsi
+
+===========================================================================*/
+/*
+ @brief
+ Function sends a command to the modem to retrieve the IMSI (for 3GPP)
+ or IMSI_M (for 3GPP2) from the SIM in ASCII form
+
+ @return
+ void
+*/
+/*=========================================================================*/
+int qser_sim_getimsi(
+ sim_client_handle_type h_sim,
+ QSER_SIM_APP_ID_INFO_T *pt_info, ///< [IN] The SIM identifier info.
+ char *imsi, ///< [OUT] IMSI buffer
+ size_t imsiLen ///< [IN] IMSI buffer length
+);
+
+
+/*===========================================================================
+
+ FUNCTION: qser_sim_geticcid
+
+===========================================================================*/
+/*
+ @brief
+ Function sends a command to the modem to retrieve the ICCID from
+ SIM in ASCII form
+
+ @return
+ int
+*/
+/*=========================================================================*/
+int qser_sim_geticcid
+(
+ sim_client_handle_type h_sim,
+ QSER_SIM_SLOT_ID_TYPE_T simId, ///< [IN] The SIM identifier.
+ char *iccid, ///< [OUT] ICCID
+ size_t iccidLen ///< [IN] ICCID buffer length
+);
+
+
+/*===========================================================================
+
+ FUNCTION: qser_sim_getphonenumber
+
+===========================================================================*/
+/*
+ @brief
+ Function sends a command to the modem to retrieve the device phone
+ number from MSISDN (for 3GPP) or MDN (for 3GPP2) from the SIM in
+ ASCII form
+
+ @return
+ int
+*/
+/*=========================================================================*/
+int qser_sim_getphonenumber
+(
+ sim_client_handle_type h_sim,
+ QSER_SIM_APP_ID_INFO_T *pt_info, ///< [IN] The SIM identifier.
+ char *phone_num, ///< [OUT] phone number
+ size_t phoneLen ///< [IN] phone number buffer length
+);
+
+/*===========================================================================
+
+ FUNCTION: qser_sim_verifypin
+
+===========================================================================*/
+/*
+ @brief
+ Function sends a command to the modem to verify either PIN1 or PIN2
+
+ @return
+ int
+*/
+/*=========================================================================*/
+int qser_sim_verifypin
+(
+ sim_client_handle_type h_sim,
+ QSER_SIM_VERIFY_PIN_INFO_T *pt_info ///< [IN] Verify PIN infor
+);
+
+
+/*===========================================================================
+
+ FUNCTION: qser_sim_changepin
+
+===========================================================================*/
+/*
+ @brief
+ Function sends a command to the modem to change the value of
+ either PIN1 or PIN2
+
+ @return
+ int
+*/
+/*=========================================================================*/
+int qser_sim_changepin
+(
+ sim_client_handle_type h_sim,
+ QSER_SIM_CHANGE_PIN_INFO_T *pt_info ///< [IN] Change PIN infor
+);
+
+
+/*===========================================================================
+
+ FUNCTION: qser_sim_unblockpin
+
+===========================================================================*/
+/*
+ @brief
+ Function sends a command to the modem to unblock a PIN1 or PIN2 that
+ has been blocked
+
+ @return
+ int
+*/
+/*=========================================================================*/
+int qser_sim_unblockpin
+(
+ sim_client_handle_type h_sim,
+ QSER_SIM_UNBLOCK_PIN_INFO_T *pt_info ///< [IN] Unblock PIN infor
+);
+
+/*===========================================================================
+
+ FUNCTION: qser_sim_enablepin
+
+===========================================================================*/
+/*
+ @brief
+ Function sends a command to the modem to enable PIN1 or PIN2
+
+ @return
+ int
+*/
+/*=========================================================================*/
+int qser_sim_enablepin
+(
+ sim_client_handle_type h_sim,
+ QSER_SIM_ENABLE_PIN_INFO_T *pt_info ///< [IN] Enable PIN infor
+);
+
+/*===========================================================================
+
+ FUNCTION: qser_sim_disablepin
+
+===========================================================================*/
+/*
+ @brief
+ Function sends a command to the modem to disable PIN1 or PIN2
+
+ @return
+ int
+*/
+/*=========================================================================*/
+int qser_sim_disablepin
+(
+ sim_client_handle_type h_sim,
+ QSER_SIM_DISABLE_PIN_INFO_T *pt_info ///< [IN] Disable PIN infor
+);
+
+
+/*===========================================================================
+
+ FUNCTION: qser_sim_getcardstatus
+
+===========================================================================*/
+/*
+ @brief
+ Function retrieves the server cached card status informations and
+ sends the information to the client
+
+ @return
+ int
+*/
+/*=========================================================================*/
+int qser_sim_getcardstatus
+(
+ sim_client_handle_type h_sim,
+ QSER_SIM_SLOT_ID_TYPE_T simId, ///< [IN] The SIM identifier.
+ QSER_SIM_CARD_STATUS_INFO_T *pt_info ///< [OUT] Cart status infor output
+);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
\ No newline at end of file
diff --git a/mbtk/include/lynq/lynq_qser_sms.h b/mbtk/include/lynq/lynq_qser_sms.h
new file mode 100755
index 0000000..7276fca
--- /dev/null
+++ b/mbtk/include/lynq/lynq_qser_sms.h
@@ -0,0 +1,241 @@
+#ifndef LYNQ_QSER_SMS_H
+#define LYNQ_QSER_SMS_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <sys/types.h>
+#include <stdint.h>
+
+#define MIN_MSM_PARAM_NUM 4
+#define MIN_IMS_MSM_PARAM_NUM 6
+#define MIN_WRITMSM_PARAM_NUM 5
+#define MSG_MAX_LEN 1024
+#define TELEPHONNUM_LEN 64
+#define STORAGSMS_MAX_SIZE 128
+#define SMSC_MAX_LEN 22
+#define SMS_NUM_MAX 255
+
+typedef unsigned short uint16_t;
+typedef unsigned int uint32_t;
+typedef uint32_t sms_client_handle_type;
+
+/** Maximum length of an SMS. */
+#define QSER_SMS_MAX_MT_MSG_LENGTH 1440
+
+/** Maximum string length. */
+#define QSER_SMS_MAX_ADDR_LENGTH 252
+
+/** Maximum string length. */
+#define QSER_SMS_MAX_SCA_TYPLENGTH 3
+
+typedef enum
+{
+ QSER_SMS_7BIT = 0,
+ QSER_SMS_8BIT = 1,
+ QSER_SMS_UCS2 = 2,
+ //<2017/12/28-QCM9XOL00004C001-P01-Vicent.Gao, <[SMS] Segment 1==> CharSet to Alpha implementation.>
+ //QSER_SMS_IRA = 3,//just for inside test
+ //>2017/12/28-QCM9XOL00004C001-P01-Vicent.Gao
+
+}QSER_SMS_T;
+
+typedef enum
+{
+ QSER_SMS_MO = 0, ///< SMS mobile terminated message.
+ QSER_SMS_MT = 1, ///< SMS mobile originated message.
+ QSER_SMS_BROADCAST_MT = 2 ///< SMS Cell Broadcast message.
+}QSER_SMS_TYPT;
+
+typedef enum
+{
+ QSER_SMS_STORAGTYPNONE = -1, /**< Message no need to store. */
+ QSER_SMS_STORAGTYPUIM = 0, /**< Message store to UIM. */
+ QSER_SMS_STORAGTYPNV = 1, /**< Message store to NV. */
+ QSER_SMS_STORAGTYPDB = 2, /**< Message store to NV. */
+}QSER_SMS_STORAGTYPT;
+
+typedef enum
+{
+ QSER_SMS_MESSAGMODUNKNOWN = -1, /**< Message type CDMA */
+ QSER_SMS_MESSAGMODCDMA = 0, /**< Message type CDMA */
+ QSER_SMS_MESSAGMODGW = 1, /**< Message type GW. */
+}QSER_SMS_MODTYPT;
+
+typedef struct
+ {
+ uint8_t total_segments; /**< The number of long short message*/
+ uint8_t seg_number; /**< Current number.*/
+ uint8_t referencnumber; /**< referencnumber.*/
+}QSER_sms_user_data_head_t;
+
+typedef struct
+{
+ /* If sms is stored, it won't parse, you need read it by yourself */
+ QSER_SMS_STORAGTYPT storage; ///specify where stored this msg
+
+ QSER_SMS_T format;
+ QSER_SMS_TYPT type;
+ char src_addr[QSER_SMS_MAX_ADDR_LENGTH]; ///Telephone number string.
+ int sms_data_len;
+ char sms_data[QSER_SMS_MAX_MT_MSG_LENGTH]; ///SMS content, data format depends on format
+ char timestamp[21]; ///Message time stamp (in text mode). string format: "yy/MM/dd,hh:mm:ss+/-TimeZone"
+ uint8_t user_data_head_valid; //indicate whether long sms. TRUE-long sms; FALSE-short message;
+ QSER_sms_user_data_head_t user_data_head; //long sms user data head info.
+ QSER_SMS_MODTYPT mode; ///specify where stored this msg cdma or gw area
+ uint32_t storage_index; ///storage index, -1 means not store
+} QSER_sms_info_t;
+
+typedef struct
+{
+ QSER_SMS_STORAGTYPT storage;
+ QSER_SMS_MODTYPT mode;
+ uint32_t storage_idx;
+} QSER_sms_storage_info_t;
+
+typedef enum
+{
+ QSER_SMS_UNKNOWN = -1,
+ QSER_SMS_DISCARD = 0x00, /* Incoming messages for this route are discarded by the WMS service without
+ notifying QMI_WMS clients */
+ QSER_SMS_STORAND_NOTIFY = 0x01, /* Incoming messages for this route are stored to the specified device
+ memory, and new message notifications */
+ QSER_SMS_TRANSFER_ONLY = 0x02, /* Incoming messages for this route are transferred to the client, and the
+ client is expected to send ACK to the network */
+ QSER_SMS_TRANSFER_AND_ACK = 0x03, /* Incoming messages for this route are transferred to the client, and ACK is
+ sent to the network */
+}QSER_SMS_RECEPTION_ACTION_TYPT;
+
+#define QSER_WMS_MESSAGLENGTH_MAX 255
+
+typedef enum
+ {
+ QSER_WMS_MESSAGCDMA = 0x00, //- 0x00 -- MESSAGCDMA -- CDMA \n
+ QSER_WMS_MESSAGGW_PP = 0x06, //- 0x06 -- MESSAGGW_PP -- GW_PP
+}QSER_WMS_MESSAGTYPE;
+
+
+typedef struct
+ {
+ QSER_WMS_MESSAGTYPE format;
+ uint32_t raw_messaglen; /**< Must be set to # of elements in raw_message */
+ uint8_t raw_message[QSER_WMS_MESSAGLENGTH_MAX]; /**< Raw message data*/
+}QSER_wms_send_raw_message_data_t;
+
+typedef enum
+{
+ QSER_WMS_TL_CAUSCODADDR_VACANT = 0x00,
+ QSER_WMS_TL_CAUSCODADDR_TRANSLATION_FAILURE = 0x01,
+ QSER_WMS_TL_CAUSCODNETWORK_RESOURCSHORTAGE = 0x02,
+ QSER_WMS_TL_CAUSCODNETWORK_FAILURE = 0x03,
+ QSER_WMS_TL_CAUSCODINVALID_TELESERVICID = 0x04,
+ QSER_WMS_TL_CAUSCODNETWORK_OTHER = 0x05,
+ QSER_WMS_TL_CAUSCODNO_PAGRESPONSE = 0x20,
+ QSER_WMS_TL_CAUSCODDEST_BUSY = 0x21,
+ QSER_WMS_TL_CAUSCODNO_ACK = 0x22,
+ QSER_WMS_TL_CAUSCODDEST_RESOURCSHORTAGE = 0x23,
+ QSER_WMS_TL_CAUSCODSMS_DELIVERY_POSTPONED = 0x24,
+ QSER_WMS_TL_CAUSCODDEST_OUT_OF_SERV = 0x25,
+ QSER_WMS_TL_CAUSCODDEST_NOT_AT_ADDR = 0x26,
+ QSER_WMS_TL_CAUSCODDEST_OTHER = 0x27,
+ QSER_WMS_TL_CAUSCODRADIO_IF_RESOURCSHORTAGE = 0x40,
+ QSER_WMS_TL_CAUSCODRADIO_IF_INCOMPATABILITY = 0x41,
+ QSER_WMS_TL_CAUSCODRADIO_IF_OTHER = 0x42,
+ QSER_WMS_TL_CAUSCODENCODING = 0x60,
+ QSER_WMS_TL_CAUSCODSMS_ORIG_DENIED = 0x61,
+ QSER_WMS_TL_CAUSCODSMS_TERM_DENIED = 0x62,
+ QSER_WMS_TL_CAUSCODSUPP_SERV_NOT_SUPP = 0x63,
+ QSER_WMS_TL_CAUSCODSMS_NOT_SUPP = 0x64,
+ QSER_WMS_TL_CAUSCODMISSING_EXPECTED_PARAM = 0x65,
+ QSER_WMS_TL_CAUSCODMISSING_MAND_PARAM = 0x66,
+ QSER_WMS_TL_CAUSCODUNRECOGNIZED_PARAM_VAL = 0x67,
+ QSER_WMS_TL_CAUSCODUNEXPECTED_PARAM_VAL = 0x68,
+ QSER_WMS_TL_CAUSCODUSER_DATA_SIZERR = 0x69,
+ QSER_WMS_TL_CAUSCODGENERAL_OTHER = 0x6A,
+}QSER_WMS_TL_CAUSCODTYPE;
+
+
+
+typedef struct
+ {
+ uint16_t messagid; /* Message ID */
+ uint8_t causcodvalid; /**< Must be set to true if causcode is being passed */
+ QSER_WMS_TL_CAUSCODTYPE causcode;
+}QSER_wms_raw_send_resp_t;
+
+typedef struct
+ {
+ char service_center_addr[QSER_SMS_MAX_ADDR_LENGTH + 1]; /**< Address of the service center.*/
+ uint8_t service_center_addr_typvalid;
+ char service_center_addr_type[QSER_SMS_MAX_SCA_TYPLENGTH + 1]; /**< 129 if the SMSC address does not start with a "+" characte;
+ 145 if the SMSC address starts with a "+" character*/
+}QSER_sms_service_center_cfg_t;
+
+typedef QSER_sms_info_t QSER_SMS_Msg_t;
+typedef QSER_sms_info_t* QSER_SMS_MsgRef;
+
+/* Callback function registered to qser_sms_addrxmsghandler, msgRef contains the detail msg infor */
+typedef void (*QSER_SMS_RxMsgHandlerFunc_t)(QSER_SMS_MsgRef msgRef, void* contextPtr);
+
+/* Init SMS module and return h_sms, this should be called before any othe ones */
+int qser_sms_client_init(sms_client_handle_type *ph_sms);
+
+/* Add callback function, if any new msg arrived, it will notify app */
+int qser_sms_addrxmsghandler(QSER_SMS_RxMsgHandlerFunc_t handlerPtr, void* contextPtr);
+
+/* Send sms, you just need to fill format/src_addr/sms_data_len/sms_data,
+ if format is UCS2, the data should be Unicode-BE format.
+*/
+int qser_sms_send_sms(sms_client_handle_type h_sms, QSER_sms_info_t *pt_sms_info);
+
+/* DeInit SMS module and release resource, this should be called in the last one. */
+int qser_sms_client_deinit(sms_client_handle_type h_sms);
+
+/* Delete the SMS specified in the pt_sms_storage */
+int qser_sms_deletefromstorage(sms_client_handle_type h_sms, QSER_sms_storage_info_t *pt_sms_storage);
+
+/* Send sms PDU.
+*/
+int qser_sms_send_smspdu( sms_client_handle_type h_sms,
+ QSER_wms_send_raw_message_data_t *raw_messagdata,
+ QSER_wms_raw_send_resp_t *rawresp);
+
+
+/* Get sms center address.
+*/
+int qser_sms_getsmscenteraddress( sms_client_handle_type h_sms,
+ QSER_sms_service_center_cfg_t *set_sca_cfg);
+
+/* Set sms center address.
+*/
+int qser_sms_setsmscenteraddress( sms_client_handle_type h_sms,
+ QSER_sms_service_center_cfg_t *get_sca_cfg);
+
+/*
+Usage 1 (register callback and wait for new sms arrive):
+1, qser_sms_client_init
+2, qser_sms_addrxmsghandler(pf_cb)
+3, wait for sms arrive, pf_cb will pass the detail sms info to app.
+4, qser_sms_client_deinit
+
+
+Usage 2 (Send sms):
+1, qser_sms_client_init
+2, qser_sms_addrxmsghandler(pf_cb)
+3, qser_sms_send_sms
+4, qser_sms_client_deinit
+
+
+Usage 3 (store sms):
+1, qser_sms_client_init
+2, qser_sms_addrxmsghandler(pf_cb)
+3, qser_sms_setroutelist (Notice: class-0 not allowed to store, class-2 must be stored to UIM)
+4, pf_cb will be called when new sms arrived, and tell you where the sms stored
+5, you can call qser_sms_deletefromstorage to delete specified sms, the location can be got from pf_cb.
+6, qser_sms_client_deinit
+*/
+
+#ifdef __cplusplus
+}
+#endif
+#endif
\ No newline at end of file
diff --git a/mbtk/include/lynq/lynq_sim.h b/mbtk/include/lynq/lynq_sim.h
new file mode 100755
index 0000000..8f2849a
--- /dev/null
+++ b/mbtk/include/lynq/lynq_sim.h
@@ -0,0 +1,98 @@
+/*=============================================================================
+# FileName: lynq_sim.h
+# Desc: about SIMAPI
+# Author: lei
+# Version: V2.0
+# LastChange: 2023-03-13
+# History:
+# If you need to use any API under lynq_sim, you must first call the lynq_sim_init() function to initialize these functions.
+=============================================================================*/
+#ifndef __LYNQ_SIM__
+#define __LYNQ_SIM__
+#ifdef __cplusplus
+extern "C" {
+#endif
+#include "mbtk_type.h"
+
+int lynq_get_sim_status(int *card_status);
+int lynq_get_imsi(char buf[]);
+int lynq_sim_init(int utoken);
+int lynq_sim_deinit(void);
+int lynq_enable_pin(char pin[]);
+int lynq_disable_pin(char pin[]);
+int lynq_get_iccid(char buf[]);
+int lynq_query_pin_lock(char *pin,int buf[]);
+int lynq_verify_pin(char *pin);
+int lynq_change_pin(char *old_pin, char *new_pin);
+int lynq_unlock_pin(char *puk, char *pin);
+int lynq_query_phone_number(char buf[]);
+int lynq_switch_card(int slot);
+int lynq_screen(int num);
+int lynq_get_imei(char buf[]);
+int lynq_get_imei_and_sv(char imei[],char sv[]);
+
+/**
+ * @brief Request SIM I/O operation.
+ * This is similar to the TS 27.007 "restricted SIM" operation
+ * where it assumes all of the EF selection will be done by the callee.
+ * @param list type: [IN] list[0]:one of the commands listed for TS 27.007 +CRSM.(command)
+ * type: [IN] list[1]:EF id(fileid)
+ * type: [IN] list[2]:offset(p1)
+ * type: [IN] list[3]:offset(p2)
+ * type: [IN] list[4]:response len,sometimes needn't care(p3)
+ * @param path type: [IN] "pathid" from TS 27.007 +CRSM command.
+ type: [IN] Path is in hex asciii format eg "7f205f70"
+ type: [IN] Path must always be provided.
+ * @param data type: [IN] May be NULL
+ * @param pin2 type: [IN] May be NULL
+ * @param aidPtr type: [IN] AID value, See ETSI 102.221 8.1 and 101.220 4, NULL if no value.
+ * @param sw type: [OUT]
+ * @param simResponse type: [OUT] response
+ * @return int
+ */
+int lynq_req_sim_io(int list[5], char *path, char *data, char *pin2, char *aidPtr, int sw[2], char *simResponse);
+
+/**
+ * @brief
+ * @param options type: [IN] [options] define whether you want to halt, power-off, or reboot the machine.May be NULL
+ * @param time type: [IN] [time] specifies when you want the shutdown to perform.May be NULL
+ * @param message type: [IN] [message] adds a message that announces the shutdown.May be NULL
+ * @return int
+ */
+int lynq_shutdown(char options[], char time[], char message[]);
+
+/**
+ * @brief get currnet version of mobiletek
+ * @param buf type: [out] My Param doc
+ * @return int
+ */
+int lynq_get_version(char buf[]);
+
+/**
+ * @brief sim power on/off
+ *
+ */
+#ifdef MOBILETEK_TARGET_PLATFORM_T106
+int lynq_reset_sim(void);
+#else
+int lynq_sim_power(int mode);
+#endif
+/**
+ * @brief reset modem
+ *
+ */
+int lynq_reset_modem(void);
+
+/**
+ * @brief factory test to both radio on/off
+ *
+ */
+int lynq_factory_radio_state(int num);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/mbtk/include/lynq/lynq_sms.h b/mbtk/include/lynq/lynq_sms.h
new file mode 100755
index 0000000..0d346a6
--- /dev/null
+++ b/mbtk/include/lynq/lynq_sms.h
@@ -0,0 +1,28 @@
+#ifndef LYNQ_SMS_H
+#define LYNQ_SMS_H 1
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define MIN_MSM_PARAM_NUM 4
+#define MIN_IMS_MSM_PARAM_NUM 6
+#define MIN_WRITE_MSM_PARAM_NUM 5
+#define MSG_MAX_LEN 1024
+#define TELEPHONE_NUM_LEN 64
+#define STORAGE_SMS_MAX_SIZE 128
+#define SMSC_MAX_LEN 22
+#define SMS_NUM_MAX 255
+
+int lynq_sms_init(int uToken);
+int lynq_sms_deinit(void);
+int lynq_send_sms(char telephony_num[TELEPHONE_NUM_LEN], int charset, char *msg, int msglen);
+int lynq_read_sms(int index,int *status,int *charset,char smsc[SMSC_MAX_LEN],int *smscLen,int *smslen,char message[MSG_MAX_LEN],char teleNum[TELEPHONE_NUM_LEN],int *numLen,int *current,int *total);
+int lynq_get_smsc_address(char service_num[SMSC_MAX_LEN]);
+int lynq_set_smsc_address(const char* service_num);
+int lynq_list_sms(char index_list[SMS_NUM_MAX]);
+int lynq_delete_sms(int index);
+int lynq_wait_receive_new_sms(int *handle);
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/mbtk/include/lynq/lynq_sms_api.h b/mbtk/include/lynq/lynq_sms_api.h
deleted file mode 100755
index cedf230..0000000
--- a/mbtk/include/lynq/lynq_sms_api.h
+++ /dev/null
@@ -1,73 +0,0 @@
-#ifndef LYNQ_SMS_QPI_H
-#define LYNQ_SMS_QPI_H
-/*
-*
-* Data : 2022/11/29
-* Author : LuoJian
-*/
-
-#include "mbtk_type.h"
-
-#define TELEPHONE_NUM_MAX 16
-#define MSM_NUMBER_MAX 1024+1
-#define RES_NUM_MIN 128
-
-
-enum EnumDCS {
- BIT7 = 0, // GSM ×Ö·û¼¯
- BIT8 = 1, // ASCII×Ö·û¼¯
- UCS2 = 2 // Unicode ×Ö·û¼¯
-};
-
-struct PDUUDH {
- unsigned int count; // ÐÅÏ¢ÔªËØÊý¾Ý×Ö½ÚÊý
- char IEI; // ÐÅÏ¢ÔªËØ±êʶ
- char *IED; // ÐÅÏ¢ÔªËØÊý¾Ý
-};
-
-// Óû§Êý¾ÝÍ·
-struct UDHS {
- int count;
- struct PDUUDH *UDH;
-};
-
-struct SMS_Struct {
- char *SCA; // ·þÎñÖÐÐĵØÖ·
- char *OA; // ·¢ËÍ·½µØÖ·
- char *SCTS; // ·þÎñÖÐÐÄʱ¼ä´Á
- struct UDHS *UDH; // Óû§Êý¾ÝÍ·
- char *UD; // Óû§Êý¾Ý
-
- bool RP; // Ó¦´ð·¾¶
- bool UDHI; // Óû§Êý¾ÝÍ·±êʶ
- bool SRI; // ״̬±¨¸æÖ¸Ê¾
- bool MMS; // ¸ü¶àÐÅÏ¢·¢ËÍ
- int MTI; // ÐÅÏ¢ÀàÐÍָʾ
-
- char PID; // PID ÐÒé±êʶ
-
- enum EnumDCS DCS; // Êý¾Ý±àÂë·½°¸
- bool TC; // Îı¾Ñ¹Ëõָʾ 0£º δѹËõ 1£ºÑ¹Ëõ
- int MC; // ÏûÏ¢ÀàÐÍ -1£º ÎÞ 1£ºÒƶ¯Éè±¸ÌØ¶¨ÀàÐÍ 2£ºSIMÌØ¶¨ÀàÐÍ 3£ºÖÕ¶ËÉè±¸ÌØ¶¨ÀàÐÍ
-
-};
-
-extern struct SMS_Struct PDUDecoding(const char *data);
-#define DSC_to_msg(DSC) (DSC == 0 ? "Bit7" : (DSC == 1 ? "Bit8" : "UCS2"))
-
-
-
-int lynq_init_sms(int uToken);
-int lynq_deinit_sms(void);
-int lynq_delete_sms(int index);
-int lynq_wait_receive_new_sms(int *handle);
-int lynq_send_sms(char *telephony_num, int state, char *msg);
-int lynq_list_sms(int stat, int index, char *data);
-int lynq_query_sms_storage_status(void);
-
-void lynq_sms_state_change_cb(const void* data, int data_len);
-
-int lynq_get_smsc_address(char *serviceNumber);
-int lynq_set_smsc_address(const char* service_num);
-
-#endif
diff --git a/mbtk/include/lynq/lynq_systime.h b/mbtk/include/lynq/lynq_systime.h
new file mode 100755
index 0000000..f1d4805
--- /dev/null
+++ b/mbtk/include/lynq/lynq_systime.h
@@ -0,0 +1,122 @@
+/**@file lynq-systime.h
+ *
+ * @brief Sync systime form each time source.
+ *
+ * @author sj.zhang
+ *
+ * @date 2023-08-14
+ *
+ * @version V1.0
+ *
+ * @copyright Copyright (c) MobileTek
+ */
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <time.h>
+
+#ifndef _LYNQ_SYSTIME_H_
+#define _LYNQ_SYSTIME_H_
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+typedef struct time_source_status
+{
+ int ntp;
+ int nitz;
+ int gnss;
+}time_src_status_s;
+
+#ifdef MOBILETEK_TARGET_PLATFORM_T106
+
+ /**@brief Set the rtc time to the system time.
+ *
+ * @param void
+ *
+ * @return
+ * 0:success
+ * other:failure
+ */
+ int lynq_sync_time_from_rtc(void);
+
+ /**@brief Set the system time to the rtc time.
+ *
+ * @param void
+ *
+ * @return
+ * 0:success
+ * other:failure
+ */
+ int lynq_set_rtc_time(void);
+
+ /**@brief Query the rtc time.
+ *
+ * @param [OUT] ulsec: rtc time, secconds from 1900.1.1 00:00
+ *
+ * @return
+ * 0:success
+ * other:failure
+ */
+ int lynq_get_rtc_time(unsigned long *ulsec);
+#endif
+
+ /**@brief Query the time source status now.
+ *
+ * @param [OUT] ntp, nitz, gnss:
+ * 0: disable
+ * 1: enable
+ *
+ * @return
+ * 0 : success
+ * other:failure
+ */
+ int lynq_get_time_src_status(time_src_status_s *time_src);
+
+ /**@brief Turn sntp on/off
+ *
+ * @param enable [IN] : 0 disenable; 1 enable;
+ *
+ * @return
+ * 0 set success
+ * 1 SNTP_DISENABLE
+ * 2 SNTP_ALREADY_ENABLE
+ */
+ int ntp_sync_time(int enable);
+
+ /**@brief Enable/Disenable sync time from NITZ.
+ *
+ * @param enable [IN] : 0 disenable; 1 enable;
+ *
+ * @return
+ * 0:success
+ * other:failure
+ */
+ int modem_time_enable(int enable);
+
+ /**@brief Enable/Disenable sync time from GNSS.
+ *
+ * @param enable [IN] : 0 disenable; 1 enable;
+ *
+ * @return
+ * 0:success
+ * other:failure
+ */
+ int gnss_time_enable(int enable);
+
+ /**@brief User set systime manually.
+ *
+ * @param enable [IN] : 0 disenable; 1 enable;
+ *
+ * @return
+ * 0:success
+ * other:failure
+ */
+ int user_set_time(char *date, char *time);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/mbtk/include/mbtk/mbtk_info_api.h b/mbtk/include/mbtk/mbtk_info_api.h
index 411f309..fe4268d 100755
--- a/mbtk/include/mbtk/mbtk_info_api.h
+++ b/mbtk/include/mbtk/mbtk_info_api.h
@@ -11,6 +11,7 @@
#include "mbtk_list.h"
#include "mbtk_log.h"
#include "mbtk_utils.h"
+#include "mbtk_pdu_sms.h"
#ifndef UNUSED
#define UNUSED(a) (void)(a)
@@ -624,6 +625,163 @@
int mbtk_radio_state_set(mbtk_info_handle_t* handle, int radio_state);
/*
+* Return sms cmgf.
+*/
+int mbtk_sms_cmgf_get(mbtk_info_handle_t* handle, int *volte_state);
+
+/*
+* Set sms cmgf.
+*
+* volte_state:
+* 0 : PDU mode.
+* 1 : text mode.
+*
+* Restarting takes effect after execution.
+*/
+int mbtk_sms_cmgf_set(mbtk_info_handle_t* handle, int mode);
+
+/*
+* Set sms cmgs.
+*
+if PDU mode (+CMGF=0):
++CMGS=<length><CR>
+PDU is given<ctrl-Z/ESC>
+
+if text mode (+CMGF=1):
++CMGS=<da>[,<toda>]<CR>
+text is entered<ctrl-Z/ESC>
+
+* Restarting takes effect after execution.
+*/
+int mbtk_sms_cmgs_set(mbtk_info_handle_t* handle, char * cmgs, char *resp);
+
+/*
+* Set sms cmgw.
+*
+if text mode (+CMGF=1):
++CMGW=<oa/da>[,<tooa/toda>[,<stat>]]
+<CR>
+text is entered<ctrl-Z/ESC>
+if PDU mode (+CMGF=0):
++CMGW=<length>[,<stat>]<CR>PDU is
+given<ctrl-Z/ESC>
+
+*/
+int mbtk_sms_cmgw_set(mbtk_info_handle_t* handle, char * cmgw, char *resp);
+
+/*
+* Set sms cmgd.
+*
+* +CMGD=<index>[,<delflag>]
+*
+* Restarting takes effect after execution.
+*/
+int mbtk_sms_cmgd_set(mbtk_info_handle_t* handle, char * cmdg);
+
+/*
+* Set sms cmgl.
+*
+* AT+CMGL[=<stat>]
+*
+* Restarting takes effect after execution.
+*/
+int mbtk_sms_cmgl_set(mbtk_info_handle_t* handle, char * cmgl, char *resp);
+
+/*
+* Return sms csca.
+*/
+int mbtk_sms_csca_get(mbtk_info_handle_t* handle, char *buf);
+
+/*
+* Set sms csca.
+*
+* AT+CSCA=<number> [,<type>]
+*
+* Restarting takes effect after execution.
+*/
+int mbtk_sms_csca_set(mbtk_info_handle_t* handle, char * csca);
+
+/*
+* Set sms csmp.
+*
+* AT+CSMP=[<fo>[,<vp>[,<pid>[,<dcs>]]]]
+*
+* Restarting takes effect after execution.
+*/
+int mbtk_sms_csmp_set(mbtk_info_handle_t* handle, char * csmp);
+
+/*
+* Set sms cscb.
+*
+* AT+CSCB=<[<mode>[,<mids>[,<dcss>]]]>
+*
+* Restarting takes effect after execution.
+*/
+int mbtk_sms_cscb_set(mbtk_info_handle_t* handle, char * cscb);
+
+/*
+* Set sms cnmi.
+*
+at+cnmi=1,2
+
+OK
+if sending fails:
++CMS ERROR: <err>
+*/
+int mbtk_sms_cnmi_set(mbtk_info_handle_t* handle);
+
+/*
+* Set sms cmss.
+*
++CMSS=<index>[,<da>[,<toda>]]
+
+if sending successful:
++CMSS: <mr>
+OK
+if sending fails:
++CMS ERROR: <err>
+*/
+int mbtk_sms_cmss_set(mbtk_info_handle_t* handle, char * cmss, char *resp);
+
+/*
+* Return sms cmgf.
+*/
+int mbtk_sms_cpms_get(mbtk_info_handle_t* handle, char * mem);
+
+/*
+* Set sms cpms.
+*
+* AT+CPMS=<mem1>[,<mem2>[,<mem3>]]
+*
+* Restarting takes effect after execution.
+*/
+int mbtk_sms_cpms_set(mbtk_info_handle_t* handle, char * mem, char* response);
+
+/*
+* Set sms cm.
+*
+* +CMGR=<index>
+
+if PDU mode (+CMGF=0) ��command successful:
++CMGR: <stat>,[<alpha>],<length><CR><LF><pdu>
+OK
+if text mode (+CMGF=1), command successful and SMS-DELIVER:
++CMGR:<stat>,<oa>,[<alpha>],<scts>[,<tooa>,<fo>,<pid>,<dcs
+>, <sca>,<tosca>,<length>]<CR><LF><data>
+OK
+if text mode (+CMGF=1), command successful and SMS-SUBMIT:
++CMGR:
+<stat>,<da>,[<alpha>][,<toda>,<fo>,<pid>,<dcs>,[<vp>],
+<sca>,<tosca>,<length>]<CR><LF><data>
+OK
+otherwise:
++CMS ERROR: <err>
+*
+* Restarting takes effect after execution.
+*/
+int mbtk_sms_cmgr_set(mbtk_info_handle_t* handle, int index, char *resp);
+
+/*
* Get sim state.
*/
int mbtk_sim_state_get(mbtk_info_handle_t* handle, mbtk_sim_state_enum *sim_state);
diff --git a/mbtk/mbtk_lib/inc/mbtk_pdu_sms.h b/mbtk/include/mbtk/mbtk_pdu_sms.h
similarity index 100%
rename from mbtk/mbtk_lib/inc/mbtk_pdu_sms.h
rename to mbtk/include/mbtk/mbtk_pdu_sms.h
diff --git a/mbtk/mbtk_lib/inc/mbtk_utf.h b/mbtk/include/mbtk/mbtk_utf.h
old mode 100644
new mode 100755
similarity index 100%
rename from mbtk/mbtk_lib/inc/mbtk_utf.h
rename to mbtk/include/mbtk/mbtk_utf.h
diff --git a/mbtk/include/qser/qser_adc.h b/mbtk/include/qser/qser_adc.h
deleted file mode 100755
index faa1cf3..0000000
--- a/mbtk/include/qser/qser_adc.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
-* qser_adc.h
-*
-* QSER adc header file.
-*
-* Author : lb
-* Date : 2023/11/23 11:03:26
-*/
-#ifndef _QSER_ADC_H
-#define _QSER_ADC_H
-#include "mbtk_type.h"
-
-typedef enum ADC_CHANNEL
-{
- QADC_NONE = 0, //标志位 0 正常模式
- ADC0 = 1, //指定 ADC0 通道
- ADC1 = 2, //指定 ADC1 通道
- ADC2 = 3, //指定 ADC2 通道
- QADC_END //枚举结束标志
-} ADC_CHANNEL_E;
-
-int qser_adc_show(ADC_CHANNEL_E qadc);
-
-#endif /* _QSER_ADC_H */
diff --git a/mbtk/include/qser/qser_data_call.h b/mbtk/include/qser/qser_data_call.h
deleted file mode 100755
index fbeddad..0000000
--- a/mbtk/include/qser/qser_data_call.h
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
-* qser_data_call.h
-*
-* QSER data call header file.
-*
-* Author : lb
-* Date : 2023/11/23 13:32:37
-*/
-#ifndef _QSER_DATA_CALL_H
-#define _QSER_DATA_CALL_H
-#include "mbtk_type.h"
-
-#define QSER_APN_MAX_LIST 8
-#define QSER_APN_NAME_SIZE 150
-#define QSER_APN_USERNAME_SIZE 127
-#define QSER_APN_PASSWORD_SIZE 127
-
-typedef enum {
- QSER_DATA_CALL_ERROR_NONE = 0,
- QSER_DATA_CALL_ERROR_INVALID_PARAMS,
-} qser_data_call_error_e;
-
-typedef enum {
- QSER_DATA_CALL_TYPE_IPV4 = 0, /*!< IPv4 call. */
- QSER_DATA_CALL_TYPE_IPV6, /*!< IPv6 call. */
- QSER_DATA_CALL_TYPE_IPV4V6, /*!< IPv4 and IPv6 call (Only used call start or stop). */
-} qser_data_call_ip_family_e;
-
-typedef enum {
- QSER_APN_PDP_TYPE_IPV4 = 0,
- QSER_APN_PDP_TYPE_PPP,
- QSER_APN_PDP_TYPE_IPV6,
- QSER_APN_PDP_TYPE_IPV4V6,
-} qser_apn_pdp_type_e;
-
-typedef enum {
- QSER_APN_AUTH_PROTO_DEFAULT = 0,
- QSER_APN_AUTH_PROTO_NONE,
- QSER_APN_AUTH_PROTO_PAP,
- QSER_APN_AUTH_PROTO_CHAP,
- QSER_APN_AUTH_PROTO_PAP_CHAP,
-} qser_apn_auth_proto_e;
-
-typedef struct {
- char profile_idx; /*!< UMTS/CMDA profile ID. */
- bool reconnect; /*!< Whether to re-dial after disconnecting the network.*/
- qser_data_call_ip_family_e ip_family; /*!< IP version. */
- char cdma_username[QSER_APN_USERNAME_SIZE]; /*!< Username used during data network authentication. */
- char cdma_password[QSER_APN_PASSWORD_SIZE]; /*!< Password to be used during data network authentication. */
-} qser_data_call_s;
-
-struct v4_info {
- char name[16]; /*!< Interface Name. */
- qser_data_call_state_e state; /*!< The dial status. */
- bool reconnect; /*!< re-dial flag. */
- struct v4_address_status addr; /*!< IPv4 IP Address information. */
- struct pkt_stats stats; /*!< IPv4 statics */
-};
-
-struct v6_info {
- char name[16]; /*!< Interface Name. */
- qser_data_call_state_e state; /*!< The dial status. */
- bool reconnect; /*!< re-dial flag. */
- struct v6_address_status addr; /*!< IPv6 IP Address information. */
- struct pkt_stats stats; /*!< IPv6 statics */
-};
-
-typedef struct {
- char profile_idx; /*!< UMTS/CDMA profile ID. */
- qser_data_call_ip_family_e ip_family; /*!< IP version. */
- struct v4_info v4; /*!< IPv4 information */
- struct v6_info v6; /*!< IPv6 information */
-} qser_data_call_info_s;
-
-typedef struct {
- unsigned char profile_idx; /*!< UMTS/CDMA profile ID. */
- qser_apn_pdp_type_e pdp_type; /*!< Packet Data Protocol (PDP) type specifies the type of data payload exchanged over the airlink when the packet data session is established with this profile. */
- qser_apn_auth_proto_e auth_proto; /*!< Authentication Protocol. */
- char apn_name[QSER_APN_NAME_SIZE]; /*!< A string parameter that is a logical name used to select the GGSN and external packet data network. */
- char username[QSER_APN_USERNAME_SIZE]; /*!< Username used during data network authentication. */
- char password[QSER_APN_PASSWORD_SIZE]; /*!< Password to be used during data network authentication. */
- char apn_type[QSER_APN_NAME_SIZE]; /*The primary key of the apn table, cannot insert two apn information with the same apn_type*/
-} qser_apn_info_s;
-
-typedef struct {
- qser_apn_pdp_type_e pdp_type; /*!< Packet Data Protocol (PDP) type specifies the type of data payload exchanged over the airlink when the packet data session is established with this profile. */
- qser_apn_auth_proto_e auth_proto; /*!< Authentication Protocol. */
- char apn_name[QSER_APN_NAME_SIZE]; /*!< A string parameter that is a logical name used to select the GGSN and external packet data network. */
- char username[QSER_APN_USERNAME_SIZE]; /*!< Username used during data network authentication. */
- char password[QSER_APN_PASSWORD_SIZE]; /*!< Password to be used during data network authentication. */
- char apn_type[QSER_APN_NAME_SIZE]; /*The primary key of the apn table, cannot insert two apn information with the same apn_type*/
-} qser_apn_add_s;
-
-typedef struct {
- int cnt; /*apn[] 数组中有效 apn 的数目 */
- qser_apn_info_s apn[QSER_APN_MAX_LIST];
-} qser_apn_info_list_s;
-
-typedef void (*qser_data_call_evt_cb_t)(qser_data_call_state_s *state);
-
-int qser_data_call_init(qser_data_call_evt_cb_t evt_cb);
-
-void qser_data_call_destroy(void);
-
-int qser_data_call_start(qser_data_call_s *data_call, qser_data_call_error_e *err);
-
-int qser_data_call_stop(char profile_idx, qser_data_call_ip_family_e ip_family, qser_data_call_error_e *err);
-
-int qser_data_call_info_get(char profile_idx,qser_data_call_ip_family_e ip_family,qser_data_call_info_s *info,qser_data_call_error_e *err);
-
-int qser_apn_set(qser_apn_info_s *apn);
-
-int qser_apn_get(unsigned char profile_idx, qser_apn_info_s *apn);
-
-int qser_apn_add(qser_apn_add_s *apn, unsigned char *profile_idx);
-
-int qser_apn_del(unsigned char profile_idx);
-
-int qser_apn_get_list(qser_apn_info_list_s *apn_list);
-
-#endif /* _QSER_DATA_CALL_H */
diff --git a/mbtk/include/qser/qser_fota.h b/mbtk/include/qser/qser_fota.h
deleted file mode 100755
index 7425d21..0000000
--- a/mbtk/include/qser/qser_fota.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
-* qser_fota.h
-*
-* QSER Fota header file.
-*
-* Author : lb
-* Date : 2023/11/23 11:09:33
-*/
-#ifndef _QSER_FOTA_H
-#define _QSER_FOTA_H
-#include "mbtk_type.h"
-
-int lynq_rock_main(int first_run);
-
-int lynq_fota_set_addr_value(char *value,int size);
-
-int lynq_fota_nrestart(void);
-
-int lynq_get_upgrade_status(void);
-
-
-#endif /* _QSER_FOTA_H */
diff --git a/mbtk/include/qser/qser_gnss.h b/mbtk/include/qser/qser_gnss.h
deleted file mode 100755
index 6e2827a..0000000
--- a/mbtk/include/qser/qser_gnss.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
-* qser_gnss.h
-*
-* QSER GNSS header file.
-*
-* Author : lb
-* Date : 2023/11/23 11:13:18
-*/
-#ifndef _QSER_GNSS_H
-#define _QSER_GNSS_H
-#include "mbtk_type.h"
-
-typedef unsigned int Uint_t;
-
-typedef enum
-{
- E_MT_LOC_MSG_ID_LOCATION_INFO, /**< pv_data = & mopen_location_info_t */
- E_MT_LOC_MSG_ID_NMEA_INFO, /**< pv_data = & mopen_gnss_nmea_info_t */
-} e_msg_id_t;
-
-typedef void (*gnss_handler_func_t)
-(
- Uint_t *h_loc,
- e_msg_id_t e_msg_id, //消息 ID
- void *pv_data, //消息内容,取决于 ID,如下说明
- void *context_ptr //用于区分哪个返回的消息
-)/* lynq_AddRxIndMsgHandler_t*/;
-
-typedef struct
-{
- uint32_t year; // 大于 1980
- uint32_t month; // 1-12
- uint32_t day; // 1-31
- uint32_t hour; // 0-23
- uint32_t minute; // 0-59
- uint32_t second; // 0-59
- uint32_t millisecond; // 0-999
-} LYNQ_INJECT_TIME_INTO_T; /* Message */
-
-typedef enum {
- DELETE_NOTHING = 0, /*不删除数据*/
- DELETE_EPHEMERIS = 1, /*删除星历*/
- DELETE_ALMANAC = 2, /*删除历书*/
- DELETE_POSITION_TIME = 3, /*删除时间和位置信息. */
- DELETE_UTC = 4, /*删除 UTC 时间*/
- DELETE_ALL = 5 /*删除所有*/
-} DELETE_AIDING_DATA_TYPE_T;
-
-int qser_Gnss_Init (uint32_t *h_gnss);
-
-int qser_Gnss_Deinit (uint32_t h_gnss);
-
-int qser_AddRxIndMsgHandler (gnss_handler_func_t handler_ptr,uint32_t h_gnss);
-
-int qser_Set_Indications (uint32_t h_gnss,e_msg_id_t type);
-
-int qser_Gnss_Start (uint32_t h_gnss);
-
-int qser_Gnss_Stop (uint32_t h_gnss);
-
-int qser_Gnss_InjectTime (uint32_t h_gnss,LYNQ_INJECT_TIME_INTO_T *time_info);
-
-int qser_Gnss_Delete_Aiding_Data (uint32_t h_gnss,DELETE_AIDING_DATA_TYPE_T flags);
-
-int qser_Gnss_download_tle();
-
-int qser_Gnss_injectEphemeris(uint32_t h_gnss);
-
-#endif /* _QSER_GNSS_H */
diff --git a/mbtk/include/qser/qser_log.h b/mbtk/include/qser/qser_log.h
deleted file mode 100755
index b77736e..0000000
--- a/mbtk/include/qser/qser_log.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
-* qser_log.h
-*
-* QSER Log Header File.
-*
-* Author : lb
-* Date : 2023/11/23 11:43:21
-*/
-#ifndef _QSER_LOG_H
-#define _QSER_LOG_H
-#include "mbtk_type.h"
-
-typedef enum
-{
- LOG_VERBOSE = 0,
- LOG_ERROR,
- LOG_WARNING,
- LOG_INFO,
- LOG_DEBUG,
- LOG_LEVEL_MAX
-} log_level_enum;
-
-void lynq_log_configuration_init(const char *log_name);
-
-void lynq_log_global_output(log_level_enum Level,const char *format,...);
-
-int lynq_syslog_set_file_size(int value);
-
-int lynq_syslog_get_file_size(void);
-
-int lynq_syslog_set_file_rotate(int value);
-
-int lynq_syslog_get_file_rotate(void);
-
-int lynq_set_log_level(const char * module_name, log_level_enum level);
-
-int lynq_get_log_level(const char * module_name, log_level_enum *level);
-
-int lynq_set_special_log_level(const char * exe_name, const char * module_name, log_level_enum level);
-
-int lynq_get_special_log_level(const char * exe_name, const char * module_name, log_level_enum *level);
-
-int lynq_notify_recalc_log_level(pid_t pid);
-
-void lynq_log_debug(const char *format,...);
-
-void lynq_log_info(const char *format,...);
-
-void lynq_log_warning(const char *format,...);
-
-void lynq_log_error(const char *format,...);
-
-void lynq_log_verbose(const char *format,...);
-
-#endif /* _QSER_LOG_H */
diff --git a/mbtk/include/qser/qser_net_light.h b/mbtk/include/qser/qser_net_light.h
deleted file mode 100755
index d58968d..0000000
--- a/mbtk/include/qser/qser_net_light.h
+++ /dev/null
@@ -1,17 +0,0 @@
-/*
-* qser_net_light.h
-*
-* QSER network light control API.
-*
-* Author : lb
-* Date : 2023/11/23 13:09:47
-*/
-#ifndef _QSER_NET_LIGHT_H
-#define _QSER_NET_LIGHT_H
-#include "mbtk_type.h"
-
-int lynq_set_netled_on(int led_mode);
-
-int lynq_set_statusled_on(int led_mode);
-
-#endif /* _QSER_NET_LIGHT_H */
diff --git a/mbtk/include/qser/qser_network.h b/mbtk/include/qser/qser_network.h
deleted file mode 100755
index 2bcaa7a..0000000
--- a/mbtk/include/qser/qser_network.h
+++ /dev/null
@@ -1,301 +0,0 @@
-/*
-* qser_network.h
-*
-* QSER network API.
-*
-* Author : lb
-* Date : 2023/11/23 13:59:44
-*/
-#ifndef _QSER_NETWORK_H
-#define _QSER_NETWORK_H
-#include "mbtk_type.h"
-
-typedef uint32_t nw_client_handle_type;
-
-#define QSER_NW_MODE_NONE 0x00 /**< No network. */
-#define QSER_NW_MODE_GSM 0x01 /**< Include GSM networks. */
-#define QSER_NW_MODE_WCDMA 0x02 /**< Include WCDMA networks. */
-#define QSER_NW_MODE_CDMA 0x04 /**< Include CDMA networks. */
-#define QSER_NW_MODE_EVDO 0x08 /**< Include EVDO networks. */
-#define QSER_NW_MODE_LTE 0x10 /**< Include LTE networks. */
-#define QSER_NW_MODE_TDSCDMA 0x20 /**< Include TDSCDMA networks. */
-#define NW_IND_VOICE_REG_EVENT_IND_FLAG (1 << 0) /**< msg format : QSER_NW_VOICE_REG_EVENT_IND_T */
-#define NW_IND_DATA_REG_EVENT_IND_FLAG (1 << 1) /**< msg format : QSER_NW_DATA_REG_EVENT_IND_T */
-#define NW_IND_SIGNAL_STRENGTH_EVENT_IND_FLAG (1 << 2) /**< msg format : QSER_NW_SINGNAL_EVENT_IND_T */
-#define QSER_NW_OOS_CFG_TYPE_FAST_SCAN 0x00 /**< fast net scan */
-#define QSER_NW_OOS_CFG_TYPE_FULL_BAND_SCAN 0x01 /**< full band scan */
-
-
-typedef enum
-{
- E_QSER_NW_ROAM_STATE_OFF = 0, /**< None, or roaming indicator off. */
- E_QSER_NW_ROAM_STATE_ON = 1 /**< Roaming indicator on. */
-} E_QSER_NW_ROAM_STATE_TYPE_T; // (Not Support Now)
-
-/** Configures the settings that define the MCM network interface. */
-typedef struct
-{
- /* Configuration parameters for MCM network registration Network registration details Technology
- dependent network registration details */
- uint64_t preferred_nw_mode; /**< Preferred network mode for
- connections; a bitmask of QSER_NW_MODE_xxxx.*/
- E_QSER_NW_ROAM_STATE_TYPE_T roaming_pref; /**< Roaming preference.*/
-} QSER_NW_CONFIG_INFO_T;
-
-typedef 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.*/
-} QSER_NW_OPERATOR_NAME_INFO_T;
-
-typedef enum
-{
- E_QSER_NW_TECH_DOMAIN_NONE = 0, /**< None. */
- E_QSER_NW_TECH_DOMAIN_3GPP = 1, /**< 3GPP. */
- E_QSER_NW_TECH_DOMAIN_3GPP2 = 2, /**< 3GPP2. */
-} E_QSER_NW_TECH_DOMAIN_TYPE_T;
-
-typedef enum
-{
- E_QSER_NW_IMSI_UNKNOWN_HLR_DENY_REASON = 1, /**< IMSI unknown in HLR. */
- E_QSER_NW_ILLEGAL_MS_DENY_REASON = 2, /**< Illegal MS. */
- E_QSER_NW_IMSI_UNKNOWN_VLR_DENY_REASON = 3, /**< IMSI unknown in VLR. */
- E_QSER_NW_IMEI_NOT_ACCEPTED_DENY_REASON = 4, /**< IMEI not accepted. */
- E_QSER_NW_ILLEGAL_ME_DENY_REASON = 5, /**< Illegal ME. */
- E_QSER_NW_PLMN_NOT_ALLOWED_DENY_REASON = 6, /**< PLMN not allowed. */
- E_QSER_NW_LA_NOT_ALLOWED_DENY_REASON = 7, /**< Location area not allowed. */
- E_QSER_NW_ROAMING_NOT_ALLOWED_LA_DENY_REASON = 8, /**< Roaming not allowed in this location area. */
- E_QSER_NW_NO_SUITABLE_CELLS_LA_DENY_REASON = 9, /**< No suitable cells in location area. */
- E_QSER_NW_NETWORK_FAILURE_DENY_REASON = 10, /**< Network failure. */
- E_QSER_NW_MAC_FAILURE_DENY_REASON = 11, /**< MAC failure. */
- E_QSER_NW_SYNCH_FAILURE_DENY_REASON = 12, /**< Sync failure. */
- E_QSER_NW_CONGESTION_DENY_REASON = 13, /**< Congestion. */
- E_QSER_NW_GSM_AUTHENTICATION_UNACCEPTABLE_DENY_REASON = 14, /**< GSM authentication unacceptable. */
- E_QSER_NW_NOT_AUTHORIZED_CSG_DENY_REASON = 15, /**< Not authorized in this CSG. */
- E_QSER_NW_SERVICE_OPTION_NOT_SUPPORTED_DENY_REASON = 16, /**< Service option not supported. */
- E_QSER_NW_REQ_SERVICE_OPTION_NOT_SUBSCRIBED_DENY_REASON = 17, /**< Requested service option not subscribed. */
- E_QSER_NW_CALL_CANNOT_BE_IDENTIFIED_DENY_REASON = 18, /**< Call cannot be identified. */
- E_QSER_NW_SEMANTICALLY_INCORRECT_MSG_DENY_REASON = 19, /**< Semantically incorrect message. */
- E_QSER_NW_INVALID_MANDATORY_INFO_DENY_REASON = 20, /**< Invalid mandatory information. */
- E_QSER_NW_MSG_TYPE_NON_EXISTENT_DENY_REASON = 21, /**< Message type non-existent or not implemented. */
- E_QSER_NW_INFO_ELEMENT_NON_EXISTENT_DENY_REASON = 22, /**< Message type not compatible with the protocol state. */
- E_QSER_NW_CONDITIONAL_IE_ERR_DENY_REASON = 23, /**< Conditional IE error. */
- E_QSER_NW_MSG_INCOMPATIBLE_PROTOCOL_STATE_DENY_REASON = 24, /**< Message not compatible with the protocol state. */
- E_QSER_NW_PROTOCOL_ERROR_DENY_REASON = 25, /**< Unspecified protocol error. */
-} E_QSER_NW_DENY_REASON_TYPE_T;
-
-typedef enum
-{
- E_QSER_NW_SERVICE_NONE = 0x0000, /**< Not registered or no data. */
- E_QSER_NW_SERVICE_LIMITED = 0x0001, /**< Registered; emergency service only. */
- E_QSER_NW_SERVICE_FULL = 0x0002, /**< Registered, full service. */
-} E_QSER_NW_SERVICE_TYPE_T;
-
-typedef enum
-{
- E_QSER_NW_RADIO_TECH_TD_SCDMA = 1,
- E_QSER_NW_RADIO_TECH_GSM = 2, /**< GSM; only supports voice. */
- E_QSER_NW_RADIO_TECH_HSPAP = 3, /**< HSPA+. */
- E_QSER_NW_RADIO_TECH_LTE = 4, /**< LTE. */
- E_QSER_NW_RADIO_TECH_EHRPD = 5, /**< EHRPD. */
- E_QSER_NW_RADIO_TECH_EVDO_B = 6, /**< EVDO B. */
- E_QSER_NW_RADIO_TECH_HSPA = 7, /**< HSPA. */
- E_QSER_NW_RADIO_TECH_HSUPA = 8, /**< HSUPA. */
- E_QSER_NW_RADIO_TECH_HSDPA = 9, /**< HSDPA. */
- E_QSER_NW_RADIO_TECH_EVDO_A = 10, /**< EVDO A. */
- E_QSER_NW_RADIO_TECH_EVDO_0 = 11, /**< EVDO 0. */
- E_QSER_NW_RADIO_TECH_1xRTT = 12, /**< 1xRTT. */
- E_QSER_NW_RADIO_TECH_IS95B = 13, /**< IS95B. */
- E_QSER_NW_RADIO_TECH_IS95A = 14, /**< IS95A. */
- E_QSER_NW_RADIO_TECH_UMTS = 15, /**< UMTS. */
- E_QSER_NW_RADIO_TECH_EDGE = 16, /**< EDGE. */
- E_QSER_NW_RADIO_TECH_GPRS = 17, /**< GPRS. */
- E_QSER_NW_RADIO_TECH_NONE = 18 /**< No technology selected. */
-} E_QSER_NW_RADIO_TECH_TYPE_T;
-
-typedef struct
-{
- E_QSER_NW_TECH_DOMAIN_TYPE_T tech_domain; /**< Technology, used to determine the structure type tech: 0 -- None, 1 -- 3GPP, 2 -- 3GPP2.*/
- E_QSER_NW_RADIO_TECH_TYPE_T radio_tech; /**< Radio technology; see #nw_radio_tech_t_v01.*/
- E_QSER_NW_ROAM_STATE_TYPE_T roaming; /**< 0 -- Off, 1 -- Roaming (3GPP2 has extended values).*/
- E_QSER_NW_DENY_REASON_TYPE_T deny_reason; /**< Set when registration state is #nw_deny_reason_t_v01.*/
- E_QSER_NW_SERVICE_TYPE_T registration_state; /**< Registration state.*/
-}QSER_NW_COMMON_REG_INFO_T;
-
-typedef struct
-{
- E_QSER_NW_TECH_DOMAIN_TYPE_T tech_domain; /**< Technology, used to determine the structure type tech: 0 -- None, 1 -- 3GPP, 2 -- 3GPP2.*/
- E_QSER_NW_RADIO_TECH_TYPE_T radio_tech; /**< Radio technology; see#nw_radio_tech_t_v01.*/
- char mcc[3+1]; /**< Mobile country code.*/
- char mnc[3+1]; /**< Mobile network code.*/
- E_QSER_NW_ROAM_STATE_TYPE_T roaming; /**< 0 -- Off, 1 -- Roaming (3GPP2 has extended values).*/
- uint8_t forbidden; /**< Forbidden: 0 -- No, 1 -- Yes.*/
- uint32_t cid; /**< Cell ID for the registered 3GPP system.*/
- uint16_t lac; /**< Locatin area code for the registered 3GPP system.*/
- uint16_t psc; /**< Primary scrambling code (WCDMA only); 0 -- None.*/
- uint16_t tac; /**< Tracking area code information for LTE.*/
-}QSER_NW_3GPP_REG_INFO_T;
-
-typedef struct
-{
- E_QSER_NW_TECH_DOMAIN_TYPE_T tech_domain; /**< Technology, used to determine structure type tech: 0 -- None, 1 -- 3GPP, 2 -- 3GPP2.*/
- E_QSER_NW_RADIO_TECH_TYPE_T radio_tech; /**< Radio technology; see#nw_radio_tech_t_v01.*/
- char mcc[3+1]; /**< Mobile country code.*/
- char mnc[3+1]; /**< Mobile network code.*/
- E_QSER_NW_ROAM_STATE_TYPE_T roaming; /**< Roaming status; see#nw_roam_state_t_v01.*/
- uint8_t forbidden; /**< Forbidden: 0 -- No, 1 -- Yes.*/
- uint8_t inPRL; /**< 0 -- Not in PRL, 1 -- In PRL.*/
- uint8_t css; /**< Concurrent services supported: 0 -- No, 1 -- Yes.*/
- uint16_t sid; /**< CDMA system ID.*/
- uint16_t nid; /**< CDMA network ID.*/
- uint16_t bsid; /**< Base station ID. @newpagetable */
-}QSER_NW_3GPP2_REG_INFO_T;
-
-/** Gets the status associated with the connection of \<id\>. */
-typedef struct
-{
- uint8_t voice_registration_valid; /**< Must be set to TRUE if voice_registration is being passed. */
- QSER_NW_COMMON_REG_INFO_T voice_registration; /**< Voice registration. */
- uint8_t data_registration_valid; /**< Must be set to TRUE if data_registration is being passed. */
- QSER_NW_COMMON_REG_INFO_T data_registration; /**< Data registration. */
- uint8_t voice_registration_details_3gpp_valid; /**< Must be set to TRUE if voice_registration_details_3gpp is being passed. */
- QSER_NW_3GPP_REG_INFO_T voice_registration_details_3gpp; /**< Voice registration details for 3GPP. */(Not Support Now)
- uint8_t data_registration_details_3gpp_valid; /**< Must be set to TRUE if data_registration_details_3gpp is being passed. */
- QSER_NW_3GPP_REG_INFO_T data_registration_details_3gpp; /**< Data registration details for 3GPP. */(Not Support Now)
- uint8_t voice_registration_details_3gpp2_valid; /**< Must be set to TRUE if voice_registration_details_3gpp2 is being passed. */
- QSER_NW_3GPP2_REG_INFO_T voice_registration_details_3gpp2; /**< Voice registration details for 3GPP2. */(Not Support Now)
- uint8_t data_registration_details_3gpp2_valid; /**< Must be set to TRUE if data_registration_details_3gpp2 is being passed. */
- QSER_NW_3GPP2_REG_INFO_T data_registration_details_3gpp2; /**< Data registration details for 3GPP2. */(Not Support Now)
-}QSER_NW_REG_STATUS_INFO_T;
-
-typedef struct
-{
- int8_t rssi; /**< RSSI in dBm. Indicates received signal strength. A signed value;-125 or lower indicates no signal.*/
-}QSER_NW_GSM_SIGNAL_INFO_T;
-
-typedef struct
-{
- int8_t rssi; /**< RSSI in dBm. Indicates forward link pilot Ec. A signed value; -125 or lower indicates no signal.*/
- int16_t ecio; /**< Ec/Io value representing negative 0.5 dB increments, e.g., 2 equals -1 dbm.*/
-}QSER_NW_WCDMA_SIGNAL_INFO_T;
-
-typedef struct
-{
- int8_t rssi; /**< RSSI in dBm. Indicates forward link pilot Ec. a signed value; -125 or lower indicates no signal.*/
- int8_t rscp; /**< RSCP in dBm.*/
- int16_t ecio; /**< Ec/Io value representing negative 0.5 dB increments, e.g., 2 equals -1 dbm.*/
- int8_t sinr; /**< Measured SINR in dB. @newpagetable */
-}QSER_NW_TDSCDMA_SIGNAL_INFO_T;
-
-typedef struct
-{
- int8_t rssi; /**< RSSI in dBm. Indicates forward link pilot Ec. A signed value; -125 or lower indicates no signal.*/
- int8_t rsrq; /**< RSRQ value in dB (signed integer value), as measured by L1.Range: -3 to -20 (-3 equals -3 dB, -20 equals -20 dB).*/
- int16_t rsrp; /**< Current RSRP in dBm, as measured by L1. Range: -44 to -140 (-44 equals -44 dBm, -140 equals -140 dBm).*/
- int16_t snr; /**< SNR level as a scaled integer in units of 0.1 dB; e.g., -16 dB has a value of -160 and 24.6 dB has a value of 246.*/
-}QSER_NW_LTE_SIGNAL_INFO_T;
-
-typedef struct
-{
- int8_t rssi; /**< RSSI in dBm. Indicates forward link pilot Power (AGC) + Ec/Io. A signed value; -125 or lower indicates no signal.*/
- int16_t ecio; /**< Ec/Io value representing negative 0.5 dB increments, e.g., 2 equals -1 dbm.*/
-}QSER_NW_CDMA_SIGNAL_INFO_T;
-
-typedef struct
-{
- int8_t rssi; /**< RSSI in dBm. Indicates forward link pilot Power (AGC) + Ec/Io. A signed value; -125 or lower indicates no signal.*/
- int16_t ecio; /**< Ec/Io value representing negative 0.5 dB increments, e.g., 2 equals -1 dbm.*/
- int8_t sinr; /**< SINR level.*/
- int32_t io; /**< Received IO in dBm. */
-}QSER_NW_HDR_SIGNAL_INFO_T;
-
-typedef struct
-{
- int16_t ssRsrp; /* SS(Synchronization Signal) reference signal received power, multipled by -1. * Reference: 3GPP TS 38.215. * Range [44, 140], INT_MAX means invalid/unreported.*/
- int16_t ssRsrq; /* SS reference signal received quality, multipled by -1. * Reference: 3GPP TS 38.215. * Range [3, 20], INT_MAX means invalid/unreported.*/
- int16_t ssSinr; /* SS signal-to-noise and interference ratio. * Reference: 3GPP TS 38.215 section 5.1.*, 3GPP TS 38.133 section 10.1.16.1. * Range [-23, 40], INT_MAX means invalid/unreported.*/
- int16_t csiRsrp; /* CSI reference signal received power, multipled by -1. * Reference: 3GPP TS 38.215. * Range [44, 140], INT_MAX means invalid/unreported.*/
- int16_t csiRsrq; /* CSI reference signal received quality, multipled by -1. * Reference: 3GPP TS 38.215. * Range [3, 20], INT_MAX means invalid/unreported.*/
- int16_t csiSinr; /* CSI signal-to-noise and interference ratio. * Reference: 3GPP TS 138.215 section 5.1.*, 3GPP TS 38.133 section 10.1.16.1. * Range [-23, 40], INT_MAX means invalid/unreported.*/
-}QSER_NW_NR_SIGNAL_INFO_T;
-
-/** Gets signal strength information. */
-typedef struct
-{
- uint8_t gsm_sig_info_valid; /**< Must be set to TRUE if gsm_sig_info is being passed. */
- QSER_NW_GSM_SIGNAL_INFO_T gsm_sig_info; /**< GSM signal information. */
- uint8_t wcdma_sig_info_valid; /**< Must be set to TRUE if wcdma_sig_info is being passed. */
- QSER_NW_WCDMA_SIGNAL_INFO_T wcdma_sig_info; /**< WCDMA signal information. */
- uint8_t tdscdma_sig_info_valid; /**< Must be set to TRUE if tdscdma_sig_info is being passed. */
- QSER_NW_TDSCDMA_SIGNAL_INFO_T tdscdma_sig_info; /**< TDSCDMA signal information. */
- uint8_t lte_sig_info_valid; /**< Must be set to TRUE if lte_sig_info is being passed. */
- QSER_NW_LTE_SIGNAL_INFO_T lte_sig_info; /**< LTE signal information. */
- uint8_t cdma_sig_info_valid; /**< Must be set to TRUE if cdma_sig_info is being passed. */
- QSER_NW_CDMA_SIGNAL_INFO_T cdma_sig_info; /**< CDMA signal information. */
- uint8_t hdr_sig_info_valid; /**< Must be set to TRUE if hdr_sig_info is being passed. */
- QSER_NW_HDR_SIGNAL_INFO_T hdr_sig_info; /**< HDR signal information. */
- uint8_t nr_sig_info_valid;
- QSER_NW_NR_SIGNAL_INFO_T nr_sig_info;
-}QSER_NW_SIGNAL_STRENGTH_INFO_T;
-
-/* @bridef Callback function registered to QSER_NW_add_rx_msg_handler * map of ind_flag and ind_msg_buf as bellow : * NW_IND_VOICE_REG_EVENT_IND_FLAG : QSER_NW_VOICE_REG_EVENT_IND_T
-* NW_IND_DATA_REG_EVENT_IND_FLAG : QSER_NW_DATA_REG_EVENT_IND_T
-* NW_IND_SIGNAL_STRENGTH_EVENT_IND_FLAG : QSER_NW_SINGNAL_EVENT_IND_T
-* */
-typedef void (*QSER_NW_RxMsgHandlerFunc_t)(
- nw_client_handle_type h_nw,
- uint32_t ind_flag,
- void *ind_msg_buf,
- uint32_t ind_msg_len,
- void *contextPtr
-);
-
-typedef struct
-{
- /* Configuration parameters for MCM network fast network scan when OOS (out of service)*/
- char enable; /* 0 or 1*/
- uint16_t time_interval; /*unit is second, value range: [1,65535], valid when enable equal 1*/
-}QSER_NW_OOS_CONFIG_FAST_SCAN_INFO_T;
-
-typedef struct
-{
- /* Configuration parameters for MCM network full band network scan when OOS (out of
- service)*/
- /*t_min t_step t_num t_max unit is second, value range: all are zero OR all are between[1, 65535], if
- t_min < t_max, time interval will be t_max*/
- int t_min;
- int t_step;
- int t_num;
- int t_max;
-}QSER_NW_OOS_CONFIG_FULL_BAND_SCAN_INFO_T;
-
-typedef struct
-{
- char type; /**< QSER_NW_OOS_CFG_TYPE_xxxx.*/
- union {
- QSER_NW_OOS_CONFIG_FAST_SCAN_INFO_T fast_can_info;
- QSER_NW_OOS_CONFIG_FULL_BAND_SCAN_INFO_T full_band_scan_info;
- } u;
-}QSER_NW_OOS_CONFIG_INFO_T;
-
-int qser_nw_client_init(nw_client_handle_type *ph_nw);
-
-int qser_nw_client_deinit(nw_client_handle_type h_nw);
-
-int qser_nw_set_config(nw_client_handle_type h_nw,QSER_NW_CONFIG_INFO_T *pt_info);
-
-int qser_nw_get_operator_name(nw_client_handle_type h_nw, QSER_NW_OPERATOR_NAME_INFO_T *pt_info);
-
-int qser_nw_get_reg_status(nw_client_handle_type h_nw, QSER_NW_REG_STATUS_INFO_T *pt_info);
-
-int qser_nw_get_signal_strength(nw_client_handle_type h_nw,QSER_NW_SIGNAL_STRENGTH_INFO_T *pt_info);
-
-int qser_nw_add_rx_msg_handler (nw_client_handle_type h_nw, QSER_NW_RxMsgHandlerFunc_t handlerPtr);
-
-int qser_nw_set_oos_config (nw_client_handle_type h_nw, QSER_NW_OOS_CONFIG_INFO_T *pt_info);
-
-int qser_nw_get_oos_config (nw_client_handle_type h_nw, QSER_NW_OOS_CONFIG_INFO_T *pt_info);
-
-#endif /* _QSER_NETWORK_H */
diff --git a/mbtk/include/qser/qser_sim.h b/mbtk/include/qser/qser_sim.h
deleted file mode 100755
index 8b13789..0000000
--- a/mbtk/include/qser/qser_sim.h
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/mbtk/include/qser/qser_sleep.h b/mbtk/include/qser/qser_sleep.h
deleted file mode 100755
index 820ccdb..0000000
--- a/mbtk/include/qser/qser_sleep.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
-* qser_sleep.h
-*
-* QSER auto sleep API.
-*
-* Author : lb
-* Date : 2023/11/23 13:18:26
-*/
-#ifndef _QSER_SLEEP_H
-#define _QSER_SLEEP_H
-#include "mbtk_type.h"
-
-int qser_autosuspend_enable(char enable);
-
-int qser_wakelock_create(const char* name , size_t len);
-
-int qser_wakelock_lock(int fd);
-
-int qser_wakelock_unlock(int fd);
-
-int qser_wakelock_destroy(int fd);
-
-#endif /* _QSER_SLEEP_H */
diff --git a/mbtk/include/qser/qser_time.h b/mbtk/include/qser/qser_time.h
deleted file mode 100755
index b0429e9..0000000
--- a/mbtk/include/qser/qser_time.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
-* qser_time.h
-*
-* QSER time header file.
-*
-* Author : lb
-* Date : 2023/11/23 13:26:11
-*/
-#ifndef _QSER_TIME_H
-#define _QSER_TIME_H
-#include "mbtk_type.h"
-
-typedef struct time_source_status
-{
- int ntp;
- int nitz;
- int gnss;
-} time_src_status_s;
-
-int ntp_sync_time(int enable);
-
-int modem_time_enable(int enable);
-
-int gnss_time_enable(int enable);
-
-int user_set_time(char* date, char* time);
-
-int lynq_sync_time_from_rtc(void);
-
-int lynq_get_time_src_status (time_src_status_s * time_src);
-
-int lynq_set_rtc_time(void);
-
-int lynq_get_rtc_time(unsigned long *ulsec);
-
-#endif /* _QSER_TIME_H */
diff --git a/mbtk/lynq_lib/src/lynq_adc.c b/mbtk/lynq_lib/src/lynq_adc.c
new file mode 100755
index 0000000..ae40db6
--- /dev/null
+++ b/mbtk/lynq_lib/src/lynq_adc.c
@@ -0,0 +1,25 @@
+#include "lynq-adc.h"
+#include "mbtk_type.h"
+#include "mbtk_adc.h"
+#include "mbtk_log.h"
+
+int qser_adc_show(ADC_CHANNEL_E qadc)
+{
+ UNUSED(qadc);
+
+ mbtk_adc_enum adc = MBTK_ADC0;
+ switch(qadc) {
+ case ADC0:
+ adc = MBTK_ADC0;
+ break;
+ case ADC1:
+ adc = MBTK_ADC1;
+ break;
+ default:
+ LOGE("Unsupport adc : %d", qadc);
+ return -1;
+ }
+
+ return mbtk_adc_get(adc);
+}
+
diff --git a/mbtk/qser_lib/src/qser_alarm.c b/mbtk/lynq_lib/src/lynq_alarm.c
similarity index 92%
rename from mbtk/qser_lib/src/qser_alarm.c
rename to mbtk/lynq_lib/src/lynq_alarm.c
index 537171d..2419ac0 100755
--- a/mbtk/qser_lib/src/qser_alarm.c
+++ b/mbtk/lynq_lib/src/lynq_alarm.c
@@ -1,5 +1,5 @@
#include "mbtk_alarm.h"
-#include "qser/qser_alarm.h"
+#include "lynq_alarm.h"
int lynq_set_wakealarm(unsigned long time_sec)
{
diff --git a/mbtk/lynq_lib/src/lynq_audio.c b/mbtk/lynq_lib/src/lynq_audio.c
index f783f5f..7cdb9be 100755
--- a/mbtk/lynq_lib/src/lynq_audio.c
+++ b/mbtk/lynq_lib/src/lynq_audio.c
@@ -1,363 +1,97 @@
-/**
- * \file lynq_audio_api.c
- * \brief A Documented file.
- *
- * Detailed description
- * \Author: luojian
- * \Version: 1.0.0
- * \Date: 2022-10-27
- */
-#include <fcntl.h>
-#include <stdint.h>
-#include <limits.h>
-#include <termios.h>
-#include <stdarg.h>
-#include <dirent.h>
-#include <sys/stat.h>
-#include <sys/statfs.h>
-#include <sys/types.h>
-#include <string.h>
-#include <unistd.h>
-#include <pthread.h>
-#include <time.h>
-#include <sys/ioctl.h>
-#include <stdio.h>
-#include <signal.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <pthread.h>
-
-#include "mbtk_log.h"
+#include "lynq-qser-audio.h"
#include "mbtk_type.h"
+#include "mbtk_log.h"
-#ifdef MBTK_PLATFORM_ASR1803
-
-#include "mbtk_audio.h"
-
-static int rec_fd = 0;
-static int play_fd = 0;
-static mbtk_audio_handle play_hdl = NULL;
-static mbtk_audio_handle record_hdl = NULL;
-int volume_size = 0;
-pthread_t paly_thread;
-
-
-void dtmf_cb(char dtmf)
+int qser_AudPlayer_Open(char* device, _cb_onPlayer cb_fun)
{
- printf("%s:%c\n", __FUNCTION__, dtmf);
-}
-
-void audio_volume_cb(int volume)
-{
- volume_size = volume;
- printf("%s:%d\n", __FUNCTION__, volume);
-}
-
-int lynq_memscpy
-(
- void *dst,
- int dst_size,
- const void *src,
- int src_size
-)
-{
- if(dst_size == 0 || src_size == 0 || dst == NULL || src == NULL)
- {
- return 0;
- }
- else
- {
- return memcpy( dst, src,src_size);
- }
-} /* dsatutil_free_memory() */
-
-static int lynq_get_path_name ( const char* path_name,char* path )
-{
- int i=0;
- int last = -1;
- int len = strlen ( path_name );
- if ( len > 0 )
- {
- for ( i=len - 1; i >= 0; i-- )
- {
- if ( path_name[i] == '/' )
- {
- last = i;
- break;
- }
- }
- if ( i != -1 )
- {
- lynq_memscpy ( path, ( i + 1 ) * sizeof ( char ), path_name, ( i + 1 ) * sizeof ( char ) );
- printf ( "mbtk_get_path %s", path );
- return 0;
- }
- }
- return -1;
-}
-
-int lynq_create_audio_dir(const char *dirname)
-{
- DIR *p_dir;
- int res = -1, i = 0;;
- char str[512];
- strncpy(str, dirname, 512);
- int len=strlen(str);
-
- if(NULL == (p_dir = opendir((const char *)dirname)))
- {
- for(i=0; i<len; i++ )
- {
- if( str[i]=='/' )
- {
- str[i] = '\0';
- if( access(str,0)!=0 )
- {
- if(mkdir(dirname, 0777) == 0)
- {
- res = 0;
- }
- else
- {
- fprintf(stderr, "create audio dir error \n");
- res = -1;
- }
- }
- str[i]='/';
- }
- }
- if( len>0 && access(str,0)!=0 )
- {
- if(mkdir(dirname, 0777) == 0)
- {
- res = 0;
- }
- else
- {
- fprintf(stderr, "create audio dir error \n");
- res = -1;
- }
- }
- }
- else
- {
- closedir(p_dir);
- res = 0;
- }
- return res;
-}
-
-void lynq_record_cb_func(int cb_result, char* databuf, unsigned int len)
-{
- int rc;
- // printf("lynq_record_cb_func() len:%d, rec_fd:%d\n", len, rec_fd);
- if(NULL == databuf)
- {
- printf("NULL == databuf\n");
- }
-
- if(NULL != databuf && len > 0 && rec_fd > 0)
- {
- //for debug:save into file
- rc = write(rec_fd, databuf, len);
- if (rc < 0) {
- printf("%s: error writing to file!\n", __FUNCTION__);
- } else if (rc < len) {
- printf("%s: wrote less the buffer size!\n", __FUNCTION__);
- }
- }
-}
-#else
-
-#endif
-
-int lynq_media_rec_audio(const char *path)
-{
-#ifdef MBTK_PLATFORM_ASR1803
- int ret = 0;
- char audio_dir[50] ={0};
- char audio_wav[10] = {0};
- lynq_get_path_name(path, audio_dir);
- printf("path:%s, audio_dir:%s\n", path, audio_dir);
-
- record_hdl = mbtk_audio_open(MBTK_AUTIO_TYPE_IN, 1, 8000, NULL);
- if (record_hdl == 0)
- {
- printf("AudRecorder open error\n");
- return -1;
- }
-
- lynq_create_audio_dir(audio_dir);
- rec_fd = open(path, O_RDWR|O_CREAT|O_TRUNC, 0644);
- if (rec_fd <= 0)
- {
- printf("file open error\n");
- goto err;
- }
-
- if(-1 == mbtk_audio_record(record_hdl, lynq_record_cb_func, NULL))
- {
- printf("file write error\n");
- goto err;
- }
+ UNUSED(device);
+ UNUSED(cb_fun);
return 0;
-// sleep(10);
-err:
-// Ql_AudRecorder_Close();
- if(rec_fd > 0)
- {
- close(rec_fd);
- rec_fd = 0;
- }
-
- return -1;
-#else
-
- return -1;
-#endif
}
-
-
-//停止录制音频文件
-void lynq_media_rec_stop_audio(void)
+int qser_AudPlayer_PlayFrmFile(int hdl, const char *fd, int offset)
{
-#ifdef MBTK_PLATFORM_ASR1803
-// sleep(10);
- mbtk_audio_close(record_hdl);
- if(rec_fd > 0)
- {
- close(rec_fd);
- rec_fd = 0;
- }
-#else
-
-#endif
-}
-
-#ifdef MBTK_PLATFORM_ASR1803
-//播放音频文件
-int lynq_media_play_audio_thread_handle(void *argv)
-{
- char databuf[1024];
- int size;
-
- char *path = (char *)argv;
- printf("lynq_media_play_audio() start \npath:%s\n",path);
- LOGI("%s %d", __FUNCTION__, __LINE__);
- play_hdl = mbtk_audio_open(MBTK_AUTIO_TYPE_OUT, 1, 8000, NULL);
- if(NULL == play_hdl)
- printf("mbtk_audio_open fail\n");
-
- play_fd = open(path, O_RDWR);
- if (play_fd <= 0)
- {
- printf("file open error\n");
- goto err;
- }
- memset(databuf, 0, sizeof(databuf));
- while(0 < (size = read(play_fd, databuf, sizeof(databuf))))
- {
- if(-1 == mbtk_audio_play_stream(play_hdl, databuf, size))
- break;
- }
- printf("aplay Stream end \n");
-
-err:
- if(play_fd > 0)
- {
- close(play_fd);
- play_fd = 0;
- }
-
- pthread_exit(&paly_thread);
- mbtk_audio_close(play_hdl);
- return 0;
-}
-#endif
-
-//创建线程播放音频文件
-int lynq_media_play_audio(const char *path)
-{
-#ifdef MBTK_PLATFORM_ASR1803
- int ret = pthread_create(&paly_thread, NULL, lynq_media_play_audio_thread_handle, (void *)path);
- if (ret != 0) {
- printf("create thread failed!\n");
- return -1;
- }
-
- pthread_detach(paly_thread);
- return 0;
-#else
+ UNUSED(hdl);
+ UNUSED(fd);
+ UNUSED(offset);
return 0;
-#endif
}
-
-//停止播放音频文件
-void lynq_media_stop_audio(void)
+int qser_AudPlayer_Pause(int hdl)
{
-#ifdef MBTK_PLATFORM_ASR1803
- printf("lynq_media_stop_audio()----\n");
- if(play_fd > 0)
- {
- int ret = pthread_cancel(paly_thread);
- if (ret != 0) {
- printf("cancle paly_thread fail\n");
- return ;
- }
- close(play_fd);
- play_fd = 0;
- }
- mbtk_audio_close(play_hdl);
-#else
+ UNUSED(hdl);
-#endif
-}
-
-#ifdef MBTK_PLATFORM_ASR1803
-int lynq_audio_ubus_client_init(mbtk_audio_client_handle_type *ph_audio, mbtk_dtmf_cb cb)
-{
- if(rec_fd > 0 || play_fd > 0)
- {
- printf("rec or play need close\n");
- return -1;
- }
- return mbtk_audio_ubus_client_init(ph_audio, cb);
-}
-
-int lynq_audio_ubus_client_deinit(mbtk_audio_client_handle_type h_audio)
-{
- if(rec_fd > 0 || play_fd > 0)
- {
- printf("rec or play need close\n");
- return -1;
- }
- return mbtk_audio_ubus_client_deinit(h_audio);
-}
-#endif
-
-int lynq_get_spk_volume(int * volume)
-{
-#ifdef MBTK_PLATFORM_ASR1803
- mbtk_audio_ubus_volume_get(audio_volume_cb);
- *volume = volume_size;
- return 0;
-#else
return 0;
-#endif
+}
+
+int qser_AudPlayer_Resume(int hdl)
+{
+ UNUSED(hdl);
+
+ return 0;
+}
+
+void qser_AudPlayer_Stop(int hdl)
+{
+ UNUSED(hdl);
+
+ return 0;
}
-int lynq_set_spk_volume(const int volume)
+void qser_AudPlayer_Close(int hdl)
{
-#ifdef MBTK_PLATFORM_ASR1803
- mbtk_audio_ubus_volume_set(volume);
+ UNUSED(hdl);
+
return 0;
-#else
+}
+
+
+int qser_AudRecorder_Open(char* device, _cb_onPlayer cb_fun)
+{
+ UNUSED(device);
+ UNUSED(cb_fun);
+
+
return 0;
-#endif
+}
+
+int qser_AudRecorder_StartRecord(int hdl, const char *fd, int offset)
+{
+ UNUSED(hdl);
+ UNUSED(fd);
+ UNUSED(offset);
+
+
+ return 0;
+}
+
+int qser_AudRecorder_Pause(void)
+{
+
+ return 0;
+}
+
+int qser_AudRecorder_Resume(void)
+{
+
+ return 0;
+}
+
+void qser_AudRecorder_Stop(void)
+{
+
+}
+
+void qser_AudRecorder_Close(void)
+{
+
+}
+
+void qser_Audio_Deinit(void)
+{
+
}
diff --git a/mbtk/lynq_lib/src/lynq_call_api.c b/mbtk/lynq_lib/src/lynq_call_api.c
deleted file mode 100755
index ccab09f..0000000
--- a/mbtk/lynq_lib/src/lynq_call_api.c
+++ /dev/null
@@ -1,458 +0,0 @@
-#include "lynq/lynq_call_api.h"
-#include "mbtk_info_api.h"
-
-static mbtk_info_handle_t* info_handle = NULL;
-int lynq_volume_size = 0;
-#ifdef MBTK_PLATFORM_ASR1803
-mbtk_audio_client_handle_type lynq_dtmf_handle;
-#endif
-mbtk_call_info_t lynq_reg[5]={0};
-int *handle_ptr=null;
-void (*incoming_call_cb_p)(int x)=NULL;
-void lynq_call_state_change_cb(const void* data, int data_len)
-{
- mbtk_call_info_t *reg = (mbtk_call_info_t *)data;
- switch (reg->call_wait)
- {
- case MBTK_CLCC:
- {
- lynq_reg[reg->dir1].dir1 = reg->dir1;
- lynq_reg[reg->dir1].dir = reg->dir;
- lynq_reg[reg->dir1].state = reg->state;
- lynq_reg[reg->dir1].mode = reg->mode;
- lynq_reg[reg->dir1].mpty = reg->mpty;
- memset(lynq_reg[reg->dir1].phone_number,0,strlen(reg->phone_number));
- memcpy(lynq_reg[reg->dir1].phone_number,reg->phone_number,strlen(reg->phone_number));
- lynq_reg[reg->dir1].type = reg->type;
- printf("\r\nRING : %d, %d, %d, %d, %d, %s, %d, %d\r\n", reg->dir1, reg->dir, reg->state, reg->mode, reg->mpty, reg->phone_number, reg->type,strlen(reg->phone_number));
- if(handle_ptr != null)
- {
- if(*handle_ptr != reg->dir1)
- {
- *handle_ptr = reg->dir1;
- printf("reg->dir1 : %d\r\n handle=%d\n", reg->dir1,*handle_ptr);
- handle_ptr = NULL;
- }
- }
- if(reg->dir == 1)
- (*incoming_call_cb_p)(reg->dir1);
- break;
- }
- case MBTK_DISCONNECTED:
- memset(&(lynq_reg[reg->disconnected_id]),0,sizeof(lynq_reg[reg->disconnected_id]));
- printf("\r\nRING : call dis connected: %d!\r\n", reg->disconnected_id);
- printf("phone number : %s",lynq_reg[reg->disconnected_id].phone_number);
- lynq_set_mute_mic(0);
- break;
- case MBTK_CPAS:
- printf("\r\nCALL : Call state = %d\r\n", reg->pas);
- /*
- MBTK_CALL_RADY, //MT allows commands from TA/TE
- MBTK_CALL_UNAVAILABLE, //MT does not allow commands from TA/TE
- MBTK_CALL_UNKNOWN, //MT is not guaranteed to respond to instructions
- MBTK_CALL_RINGING, //MT is ready for commands from TA/TE, but the ringer is active
- MBTK_CALL_PROGRESS, //MT is ready for commands from TA/TE, but a call is in progress
- MBTK_CALL_ASLEEP, //MT is unable to process commands from TA/TE because it is in a low functionality state
- MBTK_CALL_ACTIVE,
- */
- switch (reg->pas)
- {
- case MBTK_CALL_RADY:
- printf("CALL: call READY\r\n");
- break;
- case MBTK_CALL_UNAVAILABLE:
- printf("CALL: call unavaliable\r\n");
- break;
- case MBTK_CALL_UNKNOWN:
- printf("CALL: call unknown\r\n");
- break;
- case MBTK_CALL_RINGING:
- printf("CALL: call ringing\r\n");
- break;
- case MBTK_CALL_PROGRESS:
- printf("CALL: call progress\r\n");
- break;
- case MBTK_CALL_ASLEEP:
- printf("CALL: call asleep\r\n");
- break;
- case MBTK_CALL_ACTIVE:
- printf("CALL: call active\r\n");
- break;
- default:
- printf("\r\n");
- break;
- }
- break;
- default:
- printf("\r\nRING : None call_wait = %d\r\n", reg->call_wait);
- break;
- }
- /*
- if(reg->call_wait == ) //CLCC
- {
- printf("\r\nRING : %d, %d, %d, %d, %d, %s, %d\r\n", reg->dir1, reg->dir, reg->state, reg->mode, reg->mpty, reg->phone_number, reg->type);
- }
- else if(reg->call_wait == 2) //Disconnected
- {
- printf("\r\nRING : call dis connected!\r\n");
- }
- else
- {
- printf("\r\nRING : None\r\n");
- }
- */
-}
-
-#ifdef MBTK_PLATFORM_ASR1803
-void lynq_dtmf_cb(char dtmf)
-{
- printf("%s:%c\n", __FUNCTION__, dtmf);
-}
-#endif
-
-int lynq_init_call(int uToken)
-{
- UNUSED(uToken);
-#ifdef MBTK_PLATFORM_ASR1803
- mbtk_audio_ubus_client_init(&lynq_dtmf_handle, lynq_dtmf_cb);
-#endif
- if(info_handle == NULL)
- {
- info_handle = mbtk_info_handle_get();
- if(info_handle)
- {
- int err = mbtk_call_state_change_cb_reg(info_handle, lynq_call_state_change_cb);
- if(err) {
- return -1;
- } else {
- return 0;
- }
- }
- }
-
- return -1;
-}
-
-int lynq_deinit_call(void)
-{
- if(info_handle)
- {
- return mbtk_info_handle_free(&info_handle);
- }
- else
- {
- return -1;
- }
-}
-
-int lynq_call(int *handle, char addr[])
-{
- if(info_handle == NULL)
- {
- return -1;
- }
- if(strlen(addr)>=90)
- {
- printf("\ninput phone number over load!\n");
- return -1;
- }
- char *buf = addr;
- int err = mbtk_call_start(info_handle, buf);
- if(err) {
- return -1;
- } else {
- handle_ptr = handle;
- return 0;
- }
-}
-
-int lynq_call_answer()
-{
- if(info_handle == NULL)
- {
- return -1;
- }
- int err = mbtk_call_answer(info_handle);
- if(err) {
- return -1;
- } else {
- return 0;
- }
-}
-
-int lynq_call_hungup_all()
-{
- if(info_handle == NULL)
- {
- return -1;
- }
- int err = mbtk_call_hang(info_handle);
- if(err) {
- return -1;
- } else {
- return 0;
- }
-}
-
-int lynq_call_hungup(int *handle)
-{
- if(info_handle == NULL)
- {
- return -1;
- }
- int err = mbtk_a_call_hang(info_handle, *handle);
- if(err) {
- return -1;
- } else {
- return 0;
- }
-}
-
-int lynq_hangup_waiting_or_background(void)
-{
- if(info_handle == NULL)
- {
- return -1;
- }
- int err = mbtk_waiting_or_background_call_hang(info_handle);
- if(err) {
- return -1;
- } else {
- return 0;
- }
-}
-
-int lynq_hangup_foreground_resume_background(void)
-{
- if(info_handle == NULL)
- {
- return -1;
- }
- int err = mbtk_foreground_resume_background_call_hang(info_handle);
- if(err) {
- return -1;
- } else {
- return 0;
- }
-}
-
-int lynq_switch_waiting_or_holding_and_active(void)
-{
- if(info_handle == NULL)
- {
- return -1;
- }
- int err = mbtk_call_answer(info_handle);
- if(err) {
- return -1;
- } else {
- return 0;
- }
-}
-
-int lynq_wait_incoming_call(void *incoming_call_cb)
-{
- if(incoming_call_cb == NULL)
- return -1;
- incoming_call_cb_p = incoming_call_cb;
- return 0;
-}
-
-int lynq_get_mute_mic (int *status)
-{
- if(status == NULL)
- {
- return -1;
- }
- int err = mbtk_mute_state_get(info_handle, status);
- if(err) {
- return -1;
- } else {
- return 0;
- }
-}
-
-int lynq_set_mute_mic(const int enable)
-{
- if(info_handle == NULL)
- {
- return -1;
- }
- int err = mbtk_mute_state_set(info_handle, enable);
- if(err) {
- return -1;
- } else {
- return 0;
- }
-}
-
-int lynq_set_DTMF(const char callnum)
-{
- //0......9 A B C D * #
- if(info_handle == NULL)
- {
- return -1;
- }
- char callnum_default[17]="0123456789ABCD*#";
- if((strchr(callnum_default,callnum))==NULL)
- {
- printf("please input 0123456789ABCD*#\n");
- return -1;
- }
- mbtk_call_dtmf_info_t dtmf_character;
- dtmf_character.character = callnum;
- dtmf_character.duration = 500;
- int err = mbtk_dtmf_send(info_handle, &dtmf_character);
- if(err) {
- return -1;
- } else {
- return 0;
- }
-}
-
-int lynq_get_current_call_state(int *handle,int *call_state,int*toa,int *direction,char addr[])
-{
- int flag=0;
- int i;
- for (i = 0; i < 5; i++)
- {
- if(lynq_reg[i].dir1 == *handle)
- {
- *direction = lynq_reg[i].dir;
- *toa = lynq_reg[i].type;
- memset(addr,0,sizeof(addr));
- memcpy(addr, lynq_reg[i].phone_number, strlen(lynq_reg[i].phone_number));
- int len = strlen(lynq_reg[i].phone_number);
- addr[len]='\0';
- switch (lynq_reg[i].state)
- {
- case MBTK_ACTIVE:
- *call_state = LYNQ_CALL_ACTIVE;
- break;
- case MBTK_HELD:
- *call_state = LYNQ_CALL_HOLDING;
- break;
- case MBTK_DIALING:
- *call_state = LYNQ_CALL_DIALING;
- break;
- case MBTK_ALERTING:
- *call_state = LYNQ_CALL_ALERTING;
- break;
- case MBTK_INCOMING:
- *call_state = LYNQ_CALL_INCOMING;
- break;
- case MBTK_WAITING:
- *call_state = LYNQ_CALL_WAITING;
- break;
- case MBTK_OFFERING:
- *call_state = LYNQ_CALL_OFFERING;
- break;
- default:
- break;
- }
- flag = 1;
- break;
- }
- }
- if(flag == 0)
- {
- return -1;
- }
- return 0;
-
- /*
- if(info_handle == NULL)
- {
- return -1;
- }
- int err = mbtk_call_reg_get(info_handle, ®);
- if(err) {
- return -1;
- } else {
- printf("CLCC : %d, %d, %d, %d, %d, %s, %d", reg.dir1, reg.dir, reg.state, reg.mode, reg.mpty, reg.phone_number, reg.type);
- *direction = reg.dir;
- *toa = reg.type;
- memcpy(addr, reg.phone_number, strlen(reg.phone_number));
- switch (reg.state)
- {
- case MBTK_ACTIVE:
- *call_state = LYNQ_CALL_ACTIVE;
- break;
- case MBTK_HELD:
- *call_state = LYNQ_CALL_HOLDING;
- break;
- case MBTK_DIALING:
- *call_state = LYNQ_CALL_DIALING;
- break;
- case MBTK_ALERTING:
- *call_state = LYNQ_CALL_ALERTING;
- break;
- case MBTK_INCOMING:
- *call_state = LYNQ_CALL_INCOMING;
- break;
- case MBTK_WAITING:
- *call_state = LYNQ_CALL_WAITING;
- break;
- case MBTK_OFFERING:
- *call_state = LYNQ_CALL_OFFERING;
- break;
- default:
- break;
- }
- return 0;
- }
- */
-
-}
-
-
-#ifdef MBTK_PLATFORM_ASR1803
-void lynq_audio_volume_cb(int volume)
-{
- lynq_volume_size = volume;
- if(lynq_volume_size <= 0 || lynq_volume_size > 100)
- {
-
- }
- else
- {
- //printf("%s:%d\n", __FUNCTION__, volume);
- printf("%s:%d\n", __FUNCTION__, lynq_volume_size);
- }
-}
-#endif
-
-int lynq_set_speech_volume(const int volume)
-{
-
-#ifdef MBTK_PLATFORM_ASR1803
- if(volume <= 0 || volume >= 101)
- {
- printf("input error\n");
- return -1;
- }
- else
- {
- int set_volume = 0;
- set_volume = volume;
- mbtk_audio_ubus_volume_set(set_volume);
- return 0;
- }
-#else
-
- return 0;
-#endif
-}
-
-int lynq_get_speech_volume(int * volume)
-{
-#ifdef MBTK_PLATFORM_ASR1803
- mbtk_audio_ubus_volume_get(lynq_audio_volume_cb);
- sleep(1);
- *volume = lynq_volume_size;
- return 0;
-#else
-
- return 0;
-#endif
-}
\ No newline at end of file
diff --git a/mbtk/qser_lib/src/qser_data_call.c b/mbtk/lynq_lib/src/lynq_data_call.c
similarity index 95%
rename from mbtk/qser_lib/src/qser_data_call.c
rename to mbtk/lynq_lib/src/lynq_data_call.c
index e6d07e8..fae8e3f 100755
--- a/mbtk/qser_lib/src/qser_data_call.c
+++ b/mbtk/lynq_lib/src/lynq_data_call.c
@@ -1,4 +1,5 @@
-#include "qser/qser_data_call.h"
+#include "lynq-qser-data.h"
+#include "mbtk_type.h"
int qser_data_call_init(qser_data_call_evt_cb_t evt_cb)
diff --git a/mbtk/qser_lib/src/qser_fota.c b/mbtk/lynq_lib/src/lynq_fota.c
similarity index 84%
rename from mbtk/qser_lib/src/qser_fota.c
rename to mbtk/lynq_lib/src/lynq_fota.c
index 43ee6e0..049bc08 100755
--- a/mbtk/qser_lib/src/qser_fota.c
+++ b/mbtk/lynq_lib/src/lynq_fota.c
@@ -1,5 +1,5 @@
-#include "qser/qser_fota.h"
-
+#include "lynq-qser-fota.h"
+#include "mbtk_type.h"
int lynq_rock_main(int first_run)
{
diff --git a/mbtk/lynq_lib/src/lynq_gnss.c b/mbtk/lynq_lib/src/lynq_gnss.c
index 19c2d42..d86124c 100755
--- a/mbtk/lynq_lib/src/lynq_gnss.c
+++ b/mbtk/lynq_lib/src/lynq_gnss.c
@@ -1,212 +1,79 @@
-/**
- * \file gnss_test.c
- * \brief A Documented file.
- *
- * Detailed description
- * \Author: Sniper <e190@163.com>
- * \Version: 1.0.0
- * \Date: 2022-03-26
- */
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <pthread.h>
-#include <errno.h>
-#include <termios.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <signal.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <pthread.h>
-#include <termios.h>
-#include <sys/ioctl.h>
-#include "mbtk_type.h"
-#include "lynq/lynq_gnss.h"
+#include "lynq_gnss.h"
-#ifdef MBTK_GNSS_6228
-#include "mbtk_gnss_6228.h"
-
-static mbtk_gnss_client_handle _gnss_handle = 0;
-
-#else
-
-#endif
-
-
-static lynq_gnss_rx_ind_msg_handler_t handler_ptr = NULL;
-
-#ifdef MBTK_GNSS_6228
-void lynq_gnss_handler_function
-(
- mbtk_gnss_client_handle h_loc,
- int e_msg_id,
- void *pv_data,
- void *context_ptr
-)
+int qser_Gnss_Init (uint32_t *h_gnss)
{
- if(NULL == handler_ptr)
- return;
+ UNUSED(h_gnss);
- if(E_LYNQ_LOC_MSG_ID_NMEA_INFO == e_msg_id) {
- handler_ptr(h_loc, e_msg_id, pv_data, context_ptr);
- } else {
- }
-}
-//该函数用于进行GNSS初始化
-int lynq_gnss_init(void)
-{
- int ret=0;
-
- ret = mbtk_gnss_client_init(&_gnss_handle);
- if(ret < 0) {
- printf("mopen_gnss_client_init FAIL. ret:%d\n",ret);
- return -1;
- }
-
- return 0;
-}
-
-//该函数用于取消GNSS初始化
-int lynq_gnss_deinit(void)
-{
- int ret;
- if(0 == _gnss_handle) {
- return -1;
- }
-
- ret = mbtk_gnss_client_deinit(_gnss_handle);
- if(ret < 0) {
- printf("mopen_gnss_client_deinit FAIL. ret:%d\n",ret);
- return -1;
- }
-
- _gnss_handle = 0;
return 0;
}
-//该函数用于GNSS回调函数初始化
-
-int lynq_gnss_callback_reg(lynq_gnss_rx_ind_msg_handler_t handlerPtr)
+int qser_Gnss_Deinit (uint32_t h_gnss)
{
- int ret;
-
- if(0 == _gnss_handle) {
- return -1;
- }
- mbtk_gnss_print_version(_gnss_handle);
-
- ret = mbtk_gnss_add_rx_msg_handler(_gnss_handle, lynq_gnss_handler_function);
- if(0 == ret && handlerPtr)
- handler_ptr = handlerPtr;
- else
- return -1;
- return 0;
-}
-
-//该函数用于启动GNSS。
-int lynq_gnss_start(void)
-{
- if(0 == _gnss_handle) {
- return -1;
- }
-
- mbtk_gnss_set_mode(_gnss_handle, 0);
- return mbtk_gnss_set_mode(_gnss_handle, 3);
-}
-
-//该函数用于关闭GNSS。
-int lynq_gnss_stop(void)
-{
- if(0 == _gnss_handle) {
- return -1;
- }
-
- return mbtk_gnss_set_mode(_gnss_handle, 0);
-}
+ UNUSED(h_gnss);
-int lynq_gnss_agps_dataconnopen(void)
-{
- int ret;
-
- ret = mbtk_gnss_download_tle();
- if(ret)
- {
- printf("%s: download injects failed!!\n", __FUNCTION__);
- return -1;
- }
- return mbtk_gnss_injects_aidpos(_gnss_handle);
-}
-
-int lynq_gnss_dev_reset(void)
-{
- int ret = 0;
- if(_gnss_handle < 0)
- {
- return -1;
- }
- ret = mbtk_gnss_dev_reset(_gnss_handle, 0, 0);
- return ret;
-}
-
-int lynq_gnss_enable_glonass(void)
-{
- mbtk_gnss_firmware_update();
return 0;
}
-#else
-//该函数用于进行GNSS初始化
-int lynq_gnss_init(void)
-{
- return 0;
+int qser_AddRxIndMsgHandler (gnss_handler_func_t handler_ptr,uint32_t h_gnss)
+{
+ UNUSED(handler_ptr);
+ UNUSED(h_gnss);
+
+
+ return 0;
}
-//该函数用于取消GNSS初始化
-int lynq_gnss_deinit(void)
+int qser_Set_Indications (uint32_t h_gnss,e_msg_id_t type)
+{
+ UNUSED(h_gnss);
+ UNUSED(type);
+
+
+ return 0;
+}
+
+int qser_Gnss_Start (uint32_t h_gnss)
+{
+ UNUSED(h_gnss);
+
+ return 0;
+}
+
+int qser_Gnss_Stop (uint32_t h_gnss)
+{
+ UNUSED(h_gnss);
+
+ return 0;
+}
+
+int qser_Gnss_InjectTime (uint32_t h_gnss,LYNQ_INJECT_TIME_INTO_T *time_info)
+{
+ UNUSED(h_gnss);
+ UNUSED(time_info);
+
+ return 0;
+}
+
+int qser_Gnss_Delete_Aiding_Data (uint32_t h_gnss,DELETE_AIDING_DATA_TYPE_T flags)
+{
+ UNUSED(h_gnss);
+ UNUSED(flags);
+
+ return 0;
+}
+
+int qser_Gnss_download_tle()
{
return 0;
}
-//该函数用于GNSS回调函数初始化
-
-int lynq_gnss_callback_reg(lynq_gnss_rx_ind_msg_handler_t handlerPtr)
+int qser_Gnss_injectEphemeris(uint32_t h_gnss)
{
- UNUSED(handlerPtr);
+ UNUSED(h_gnss);
-
- return 0;
-}
-
-//该函数用于启动GNSS。
-int lynq_gnss_start(void)
-{
- return 0;
-}
-
-//该函数用于关闭GNSS。
-int lynq_gnss_stop(void)
-{
- return 0;
-}
-
-
-int lynq_gnss_agps_dataconnopen(void)
-{
return 0;
}
-int lynq_gnss_dev_reset(void)
-{
- return 0;
-}
-
-int lynq_gnss_enable_glonass(void)
-{
- return 0;
-}
-#endif
\ No newline at end of file
diff --git a/mbtk/qser_lib/src/qser_gpio.c b/mbtk/lynq_lib/src/lynq_gpio.c
similarity index 96%
rename from mbtk/qser_lib/src/qser_gpio.c
rename to mbtk/lynq_lib/src/lynq_gpio.c
index 1b1c3de..ef1c522 100755
--- a/mbtk/qser_lib/src/qser_gpio.c
+++ b/mbtk/lynq_lib/src/lynq_gpio.c
@@ -1,4 +1,5 @@
#include "mbtk_type.h"
+#include "lynq-gpio.h"
int lynq_gpio_init(int gpio, int direction, int value, int pullsel)
{
diff --git a/mbtk/qser_lib/src/qser_irq.c b/mbtk/lynq_lib/src/lynq_irq.c
similarity index 91%
rename from mbtk/qser_lib/src/qser_irq.c
rename to mbtk/lynq_lib/src/lynq_irq.c
index 4cf5c15..ea63736 100755
--- a/mbtk/qser_lib/src/qser_irq.c
+++ b/mbtk/lynq_lib/src/lynq_irq.c
@@ -1,4 +1,5 @@
-
+#include "lynq-irq.h"
+#include "mbtk_type.h"
int lynq_irq_install(int line, irq_handler irq_test_handler, int trig_type)
{
diff --git a/mbtk/qser_lib/src/qser_log.c b/mbtk/lynq_lib/src/lynq_log.c
similarity index 96%
rename from mbtk/qser_lib/src/qser_log.c
rename to mbtk/lynq_lib/src/lynq_log.c
index 131e869..7824d3f 100755
--- a/mbtk/qser_lib/src/qser_log.c
+++ b/mbtk/lynq_lib/src/lynq_log.c
@@ -1,4 +1,5 @@
-#include "qser/qser_log.h"
+#include "liblog.h"
+#include "mbtk_type.h"
void lynq_log_configuration_init(const char *log_name)
diff --git a/mbtk/lynq_lib/src/lynq_net_api.c b/mbtk/lynq_lib/src/lynq_net_api.c
deleted file mode 100755
index f2195e0..0000000
--- a/mbtk/lynq_lib/src/lynq_net_api.c
+++ /dev/null
@@ -1,708 +0,0 @@
-#include "lynq/lynq_net_api.h"
-
-static mbtk_info_handle_t* info_handle = NULL;
-
-typedef struct
-{
- uint8 *operator_l;
- uint8 *operator_s;
- uint32 mcc_mnc;
-} operator_mcc_mnc_t;
-
-static operator_mcc_mnc_t operator_mcc_mnc[] =
-{
- {"China Mobile","CMCC",46000},
- {"China Unicom","CU",46001},
- {"China Mobile","CMCC",46002},
- {"China Telecom","CT",46003},
- {"China Mobile","CMCC",46004},
- {"China Telecom","CT",46005},
- {"China Unicom","CU",46006},
- {"China Mobile","CMCC",46007},
- {"China Mobile","CMCC",46008},
- {"China Unicom","CU",46009},
- {"China Telecom","CT",46011}
-};
-
-int lynq_network_init(int uToken)
-{
- UNUSED(uToken);
- if(info_handle == NULL)
- {
- info_handle = mbtk_info_handle_get();
- if(info_handle)
- {
- return 0;
- }
- }
-
- return -1;
-}
-
-int lynq_network_deinit(void)
-{
- if(info_handle)
- {
- return mbtk_info_handle_free(&info_handle);
- }
- else
- {
- return -1;
- }
-}
-
-int lynq_get_version(char buf[])
-{
- if(info_handle == NULL || buf == NULL)
- {
- return -1;
- }
-
- int err = mbtk_version_get(info_handle, buf);
- if(err) {
- return -1;
- } else {
- return 0;
- }
-}
-
-int lynq_get_imei(char buf[])
-{
- if(info_handle == NULL || buf == NULL)
- {
- return -1;
- }
-
- int err = mbtk_imei_get(info_handle, buf);
- if(err) {
- return -1;
- } else {
- return 0;
- }
-}
-
-int lynq_get_sn(char buf[])
-{
- if(info_handle == NULL || buf == NULL)
- {
- return -1;
- }
-
- int err = mbtk_sn_get(info_handle, buf);
- if(err) {
- return -1;
- } else {
- return 0;
- }
-}
-
-int lynq_get_zone_tmp(ZONE_NUM num, int *temp)
-{
- if(info_handle == NULL || temp == NULL)
- {
- return -1;
- }
-
- return mbtk_temp_get(info_handle, num, temp);
-}
-
-int lynq_shutdown(char options[])
-{
- if(options == NULL)
- {
- return -1;
- }
-
- if(!strcmp(options, "reboot")) {
- return mbtk_system_reboot(0);
- } else if(!strcmp(options, "poweroff")) {
- return mbtk_system_reboot(1);
- } else if(!strcmp(options, "halt")) {
- return mbtk_system_reboot(2);
- } else {
- return -1;
- }
- return 0;
-}
-
-int lynq_time_set(mbtk_time_type_enum time_type, char* time_str)
-{
- if(info_handle == NULL)
- {
- return -1;
- }
-
- return mbtk_time_set(info_handle, time_type, time_str);
-}
-
-int lynq_get_sim_status(int *card_status)
-{
- if(info_handle == NULL || card_status == NULL)
- {
- return -1;
- }
-
- mbtk_sim_state_enum sim;
- int err = mbtk_sim_state_get(info_handle, &sim);
- if(err) {
- return -1;
- } else {
- *card_status = sim;
- return 0;
- }
-}
-
-int lynq_get_imsi(char buf[])
-{
- if(info_handle == NULL || buf == NULL)
- {
- return -1;
- }
-
- int err = mbtk_imsi_get(info_handle, buf);
- if(err) {
- return -1;
- } else {
- return 0;
- }
-}
-
-int lynq_get_iccid(char buf[])
-{
- if(info_handle == NULL || buf == NULL)
- {
- return -1;
- }
-
- int err = mbtk_iccid_get(info_handle, buf);
- if(err) {
- return -1;
- } else {
- return 0;
- }
-}
-
-int lynq_query_phone_number(char buf[])
-{
- if(info_handle == NULL || buf == NULL)
- {
- return -1;
- }
-
- int err = mbtk_phone_number_get(info_handle, buf);
- if(err) {
- return -1;
- } else {
- return 0;
- }
-}
-
-int lynq_sim_power (int mode)
-{
- if(mode != 0 && mode != 1)
- {
- return -1;
- }
-
- return mbtk_sim_power_set(mode);
-}
-
-int lynq_query_operater(char *OperatorFN,char *OperatorSH,char *MccMnc)
-{
- if(info_handle == NULL || OperatorFN == NULL || OperatorSH == NULL || MccMnc == NULL)
- {
- return -1;
- }
-
- mbtk_net_info_t net;
- if(!mbtk_net_sel_mode_get(info_handle, &net) && net.plmn > 0)
- {
- // printf("Net : %d, %d, %d\n", net.net_sel_mode, net.net_type, net.plmn);
- int i = 0;
- while(i < ARRAY_SIZE(operator_mcc_mnc))
- {
- if(operator_mcc_mnc[i].mcc_mnc == net.plmn)
- break;
- i++;
- }
-
- if(i == ARRAY_SIZE(operator_mcc_mnc)) // No found mcc&mnc
- {
- strcpy(OperatorFN, "UNKNOWN");
- strcpy(OperatorSH, "UNKNOWN");
- sprintf(MccMnc, "%d", net.plmn);
- }
- else
- {
- strcpy(OperatorFN, operator_mcc_mnc[i].operator_l);
- strcpy(OperatorSH, operator_mcc_mnc[i].operator_s);
- sprintf(MccMnc, "%d", operator_mcc_mnc[i].mcc_mnc);
- }
- return 0;
- }
-
- return -1;
-}
-
-int lynq_query_network_selection_mode (int *netselMode)
-{
- if(info_handle == NULL || netselMode == NULL)
- {
- return -1;
- }
-
- mbtk_net_info_t net;
- if(!mbtk_net_sel_mode_get(info_handle, &net))
- {
- // printf("Net : %d, %d, %d\n", net.net_sel_mode, net.net_type, net.plmn);
- *netselMode = net.net_sel_mode;
- return 0;
- }
-
- return -1;
-}
-
-int lynq_set_network_selection_mode(const char *mode, const char* mccmnc)
-{
- if(info_handle == NULL || str_empty(mode))
- {
- return -1;
- }
-
- mbtk_net_info_t net;
- net.net_type = 0xFF;
- if(!strcmp(mode, "Auto"))
- {
- net.net_sel_mode = 0;
- net.plmn = 0;
- }
- else if(!strcmp(mode, "Manual") && !str_empty(mccmnc))
- {
- net.net_sel_mode = 1;
- net.plmn = (uint32)atoi(mccmnc);
- }
- else
- {
- return -1;
- }
- if(!mbtk_net_sel_mode_set(info_handle, &net))
- {
- return 0;
- }
-
- return -1;
-}
-
-int lynq_query_available_network(list_node_t** net_list)
-{
- if(info_handle == NULL)
- {
- return -1;
- }
-
- return mbtk_available_net_get(info_handle, net_list);
-}
-
-int lynq_query_registration_state(const char *type, int* regState,int *imsRegState,char * LAC,char *CID,int *netType,int * radioTechFam,int *netRejected)
-{
- if(info_handle == NULL || str_empty(type) || regState == NULL || imsRegState == NULL
- || LAC == NULL || CID == NULL || netType == NULL || radioTechFam == NULL || netRejected == NULL)
- {
- return -1;
- }
- mbtk_net_reg_info_t reg;
- int err = mbtk_net_reg_get(info_handle, ®);
- if(err) {
- *netRejected = err;
- return -1;
- } else {
- //printf("REG : %d, %d, %d, %04x, %08o\n", reg.state, reg.type, reg.ims_reg, reg.lac, reg.ci);
- // Voice/Data/IMS
- if(strcmp("Voice", type) == 0) {
- *regState = reg.call_state;
- } else if(strcmp("Data", type) == 0) {
- *regState = reg.data_state;
- } else if(strcmp("IMS", type) == 0) {
- *imsRegState = reg.ims_state;
- } else {
- return -1;
- }
-
- if(reg.call_state != MBTK_NET_REG_STATE_NON || reg.data_state != MBTK_NET_REG_STATE_NON || reg.ims_state != MBTK_NET_REG_STATE_NON) {
- sprintf(LAC, "%04x", reg.lac);
- sprintf(CID, "%08o", reg.ci);
- *netType = reg.type;
- *radioTechFam = RADIO_TECH_3GPP;
- }
- return 0;
- }
-}
-
-int lynq_query_prefferred_networktype (int *preNetType)
-{
- if(info_handle == NULL || preNetType == NULL)
- {
- return -1;
- }
-
- mbtk_band_info_t band;
- int err = mbtk_current_band_get(info_handle, &band);
- if(err) {
- return -1;
- } else {
- //printf("Band : %d, %d, %d, %d, %d\n", band.net_pref, band.gsm_band, band.umts_band, band.tdlte_band, band.fddlte_band);
- *preNetType = band.net_pref;
- return 0;
- }
-}
-
-int lynq_set_prefferred_networktype (const int preNetType)
-{
-
- if(info_handle == NULL)
- {
- return -1;
- }
- if(preNetType < 0 || preNetType > 15)
- {
- return -2;
- }
- mbtk_band_info_t band;
- memset(&band, 0, sizeof(mbtk_band_info_t));
- band.net_pref = preNetType;
- int err = mbtk_current_band_set(info_handle, &band);
- if(err) {
- return -1;
- } else {
- return 0;
- }
-}
-
-int lynq_set_band_mode(int gsm_band, int umts_band, int tdlte_band, int fddlte_band)
-{
- if(info_handle == NULL)
- {
- return -1;
- }
-
- mbtk_band_info_t band;
- band.net_pref = 0xFF; // No change network pref.
- band.gsm_band = (uint16)gsm_band;
- band.umts_band = (uint16)umts_band;
- band.tdlte_band = (uint32)tdlte_band;
- band.fddlte_band = (uint32)fddlte_band;
- int err = mbtk_current_band_set(info_handle, &band);
- if(err) {
- return -1;
- } else {
- return 0;
- }
-}
-
-int lynq_query_available_bandmode (int *gsm_band, int *umts_band, int *tdlte_band, int *fddlte_band)
-{
- if(info_handle == NULL || gsm_band == NULL || umts_band == NULL || tdlte_band == NULL || fddlte_band == NULL)
- {
- return -1;
- }
-
- mbtk_band_info_t band;
- int err = mbtk_support_band_get(info_handle, &band);
- if(err) {
- return -1;
- } else {
- //printf("Band : %d, %d, %d, %d, %d\n", band.net_pref, band.gsm_band, band.umts_band, band.tdlte_band, band.fddlte_band);
- *gsm_band = band.gsm_band;
- *umts_band = band.umts_band;
- *tdlte_band = band.tdlte_band;
- *fddlte_band = band.fddlte_band;
- return 0;
- }
-}
-
-int lynq_radio_on (const int data)
-{
- if(info_handle == NULL || (data != 0 && data != 1))
- {
- return -1;
- }
-
- int err = mbtk_radio_state_set(info_handle, data);
- if(err) {
- return -1;
- } else {
- return 0;
- }
-}
-
-int lynq_query_radio_tech (int* radioTech)
-{
- if(info_handle == NULL || radioTech == NULL)
- {
- return -1;
- }
-
- int err = mbtk_radio_state_get(info_handle, radioTech);
- if(err) {
- return -1;
- } else {
- return 0;
- }
-}
-
-int lynq_solicited_signal_strength (signalStrength_t *solSigStren)
-{
- if(info_handle == NULL || solSigStren == NULL)
- {
- return -1;
- }
-
- mbtk_signal_info_t signal;
- int err = mbtk_net_signal_get(info_handle, &signal);
- if(err) {
- return -1;
- } else {
- memset(solSigStren, 0, sizeof(signalStrength_t));
- switch(mbtk_net_type_get(signal.type))
- {
- case MBTK_NET_TYPE_GSM:
- solSigStren->gsm_sig_valid = 1;
- break;
- case MBTK_NET_TYPE_UMTS:
- solSigStren->umts_sig_valid = 1;
- break;
- case MBTK_NET_TYPE_LTE:
- solSigStren->lte_sig_valid = 1;
- break;
- default:
- break;
- }
- solSigStren->rssi = signal.rssi;
- solSigStren->ber = signal.ber;
- solSigStren->rxlev = signal.rxlev;
- solSigStren->rscp = signal.rscp;
- solSigStren->ecno = signal.ecno;
- solSigStren->rsrq = signal.rsrq;
- solSigStren->rsrp = signal.rsrp;
- return 0;
- }
-}
-
-int lynq_set_ims (const int ims_mode)
-{
- if(info_handle == NULL || (ims_mode != 0 && ims_mode != 1))
- {
- return -1;
- }
-
- int err = mbtk_volte_state_set(info_handle, ims_mode);
- if(err) {
- return -1;
- } else {
- return 0;
- }
-}
-
-int lynq_init_cell(void)
-{
- if(info_handle == NULL)
- {
- info_handle = mbtk_info_handle_get();
- if(info_handle)
- {
- printf("creat info_handle is success\n");
- }
- else{
- printf("creat info_handle is fail\n");
- return -1;
- }
- }
-
- return 0;
-}
-
-int lynq_deinit_cell(void)
-{
- if(info_handle)
- {
- return mbtk_info_handle_free(&info_handle);
- }
- else
- {
- return -1;
- }
-}
-
-/*
-* Get current cell infomation.
-*/
-int lynq_query_cell_info(int *type, list_node_t **cell_list)
-{
- if(info_handle == NULL || type == NULL)
- {
- return -1;
- }
-
- return mbtk_cell_get(info_handle, type, cell_list);
-}
-
-/*
-* set current cell infomation.
-*/
-void lynq_set_cell_info(char *mem)
-{
- if(info_handle == NULL || mem == NULL)
- {
- return -1;
- }
-
- char resp[1024] = {0};
- mbtk_cell_set(info_handle, mem, resp);
-
- return ;
-}
-
-/*
-* Set specific APN informations.
-*
-* cid : 2-7
-*/
-int lynq_apn_set(int cid, mbtk_ip_type_enum ip_type, const void* apn_name,
- const void *user_name, const void *user_pass, const void *auth)
-{
- if(info_handle == NULL || str_empty(apn_name))
- {
- return -1;
- }
-
- return mbtk_apn_set(info_handle, cid, ip_type, apn_name, user_name, user_pass, auth);
-}
-
-/*
-* Get current all APN informations.
-*/
-int lynq_apn_get(int *apn_num, mbtk_apn_info_t apns[])
-{
- if(info_handle == NULL || apn_num == NULL || apns == NULL)
- {
- return -1;
- }
-
- return mbtk_apn_get(info_handle, apn_num, apns);
-}
-
-/*
-* Start data call.
-*/
-int lynq_data_call_start(int cid, int timeout)
-{
- if(info_handle == NULL)
- {
- return -1;
- }
-
- return mbtk_data_call_start(info_handle, cid, 0, FALSE, timeout);
-}
-
-/*
-* Stop data call.
-*/
-int lynq_data_call_stop(int cid, int timeout)
-{
- if(info_handle == NULL)
- {
- return -1;
- }
-
- return mbtk_data_call_stop(info_handle, cid, timeout);
-}
-
-/*
-* Query data call state.
-*/
-int lynq_data_call_query(int cid, mbtk_ipv4_info_t *ipv4, mbtk_ipv6_info_t *ipv6)
-{
- if(info_handle == NULL || ipv4 == NULL || ipv6 == NULL)
- {
- return -1;
- }
-
- return mbtk_data_call_state_get(info_handle, cid, ipv4, ipv6);
-}
-
-/*
- * Get the native ip and free port.
- */
-int lynq_get_ip_and_port(char *ipBuf_out,int *port,int iptype)
-{
- char psz_port_cmd[128];
- int i=0;
-
- *port = rand() % (60000 - 50000 + 1) + 50000;
- sprintf(psz_port_cmd, "netstat -an | grep :%d > /dev/null", *port);
-
- char ipBuf[32] = "";
- FILE *fstream=NULL;
-
- char buff[1024];
- char iptype_str[8];
- memset(buff,0,sizeof(buff));
- /*eth0????eth1?docker0?em1?lo?*/
- if(iptype == 1)
- {
-
- if(NULL==(fstream=popen("ifconfig ccinet0 | grep \"inet6 addr: 2\" | awk '{print $3}'","r")))
- {
- snprintf(ipBuf, 39, "%s","0:0:0:0:0:0:0:0");
- }
- if(NULL!=fgets(buff, sizeof(buff), fstream))
- {
- snprintf(ipBuf, 39, "%s",buff);
- }
- else
- {
- snprintf(ipBuf, 39, "%s","0:0:0:0:0:0:0:0");
- pclose(fstream);
- }
- }
- else if(iptype == 0)
- {
- if(NULL==(fstream=popen("ifconfig ccinet0 | grep \"inet addr:\" | awk \'{print $2}\' | cut -c 6-","r")))
- {
- snprintf(ipBuf, 18, "%s","0.0.0.0");
- }
- if(NULL!=fgets(buff, sizeof(buff), fstream))
- {
- snprintf(ipBuf, 18, "%s",buff);
- }
- else
- {
- snprintf(ipBuf, 18, "%s","0.0.0.0");
- pclose(fstream);
- }
- }
- else
- {
- return -1;
- }
- pclose(fstream);
-
- printf("ip:%s\n", ipBuf);
- memcpy(ipBuf_out, ipBuf, 32);
- return 0;
-}
-
-int lynq_get_modem_fun(MBTK_DEV_MODEM_FUNCTION *fun)
-{
- if(info_handle == NULL)
- {
- return -1;
- }
-
- int err = mbtk_get_modem_fun(info_handle, fun);
- if(err) {
- return -1;
- } else {
- return 0;
- }
-}
diff --git a/mbtk/qser_lib/src/qser_net_light.c b/mbtk/lynq_lib/src/lynq_net_light.c
similarity index 78%
rename from mbtk/qser_lib/src/qser_net_light.c
rename to mbtk/lynq_lib/src/lynq_net_light.c
index 9613377..34394af 100755
--- a/mbtk/qser_lib/src/qser_net_light.c
+++ b/mbtk/lynq_lib/src/lynq_net_light.c
@@ -1,4 +1,5 @@
-#include "qser/qser_net_light.h"
+#include "lynq_led.h"
+#include "mbtk_type.h"
int lynq_set_netled_on(int led_mode)
{
diff --git a/mbtk/qser_lib/src/qser_network.c b/mbtk/lynq_lib/src/lynq_network.c
similarity index 91%
rename from mbtk/qser_lib/src/qser_network.c
rename to mbtk/lynq_lib/src/lynq_network.c
index 6892129..5212da5 100755
--- a/mbtk/qser_lib/src/qser_network.c
+++ b/mbtk/lynq_lib/src/lynq_network.c
@@ -1,4 +1,4 @@
-#include "qser/qser_network.h"
+#include "lynq_qser_network.h"
int qser_nw_client_init(nw_client_handle_type *ph_nw)
{
@@ -46,10 +46,11 @@
return 0;
}
-int qser_nw_add_rx_msg_handler (nw_client_handle_type h_nw, QSER_NW_RxMsgHandlerFunc_t handlerPtr)
+int qser_nw_add_rx_msg_handler (nw_client_handle_type h_nw, QSER_NW_RxMsgHandlerFunc_t handlerPtr, void* contextPtr)
{
UNUSED(h_nw);
UNUSED(handlerPtr);
+ UNUSED(contextPtr);
return 0;
}
diff --git a/mbtk/qser_lib/src/qser_sim.c b/mbtk/lynq_lib/src/lynq_sim.c
similarity index 96%
rename from mbtk/qser_lib/src/qser_sim.c
rename to mbtk/lynq_lib/src/lynq_sim.c
index 8d5762d..6bb6ed1 100755
--- a/mbtk/qser_lib/src/qser_sim.c
+++ b/mbtk/lynq_lib/src/lynq_sim.c
@@ -1,3 +1,5 @@
+#include "lynq_qser_sim.h"
+#include "mbtk_type.h"
int qser_sim_client_init(sim_client_handle_type *ph_sim)
{
diff --git a/mbtk/qser_lib/src/qser_sleep.c b/mbtk/lynq_lib/src/lynq_sleep.c
similarity index 87%
rename from mbtk/qser_lib/src/qser_sleep.c
rename to mbtk/lynq_lib/src/lynq_sleep.c
index b0cc807..59a363f 100755
--- a/mbtk/qser_lib/src/qser_sleep.c
+++ b/mbtk/lynq_lib/src/lynq_sleep.c
@@ -1,4 +1,5 @@
-#include "qser/qser_sleep.h"
+#include "lynq-qser-autosuspend.h"
+#include "mbtk_type.h"
int qser_autosuspend_enable(char enable)
{
diff --git a/mbtk/qser_lib/src/qser_sms.c b/mbtk/lynq_lib/src/lynq_sms.c
similarity index 94%
rename from mbtk/qser_lib/src/qser_sms.c
rename to mbtk/lynq_lib/src/lynq_sms.c
index 55a8bcf..5699e52 100755
--- a/mbtk/qser_lib/src/qser_sms.c
+++ b/mbtk/lynq_lib/src/lynq_sms.c
@@ -1,4 +1,5 @@
-
+#include "lynq_qser_sms.h"
+#include "mbtk_type.h"
int qser_sms_client_init(sms_client_handle_type *ph_sms)
{
diff --git a/mbtk/lynq_lib/src/lynq_sms_api.c b/mbtk/lynq_lib/src/lynq_sms_api.c
deleted file mode 100755
index 4fa4007..0000000
--- a/mbtk/lynq_lib/src/lynq_sms_api.c
+++ /dev/null
@@ -1,291 +0,0 @@
-#include "lynq/lynq_sms_api.h"
-#include "mbtk_info_api.h"
-
-
-static mbtk_info_handle_t* info_handle = NULL;
-
-
-void lynq_sms_state_change_cb(const void* data, int data_len)
-{
- LOGV("sms_state_change_cb()----------start\n");
- uint8 *ptr = (uint8*)data;
- printf("3sms_state_change_cb() : %s\n", ptr);
-
- struct SMS_Struct s = PDUDecoding(ptr);
- printf("服务中心地址: %s\n", s.SCA);
- printf("发送方地址: %s\n", s.OA);
- printf("服务中心时间戳: %s\n", s.SCTS);
- printf("消息内容: %s\n", s.UD);
- printf("数据编码方案: %s\n", DSC_to_msg(s.DCS));
-}
-
-
-int lynq_init_sms(int uToken)
-{
- UNUSED(uToken);
- if(info_handle == NULL)
- {
- info_handle = mbtk_info_handle_get();
- if(info_handle)
- {
- printf("creat info_handle is success\n");
- }
- else{
- printf("creat info_handle is fail\n");
- return -1;
- }
- }
-
- return 0;
-}
-
-int lynq_deinit_sms(void)
-{
- if(info_handle)
- {
- return mbtk_info_handle_free(&info_handle);
- }
- else
- {
- return -1;
- }
-}
-
-
-/*
-*AT+CMGS="10086", CMGS TEST // Send a SMS
-> CMGS TEST
-+CMGS: 17
-OK
-*/
-/*
-int charset: send sms mode
- 0:pdu, 1:text
-
-*/
-
-int lynq_send_sms(char *telephony_num, int state, char *msg)
-{
- if(info_handle == NULL || msg == NULL || telephony_num == NULL)
- {
- return -1;
- }
-
- char cmgs[MSM_NUMBER_MAX] = {0};
- char resp[RES_NUM_MIN] = {0};
- int mode = 0;
- int err = 0;
- if(strlen(msg) > 512 || strlen(msg) == 0 || strlen(telephony_num) == 0)
- {
- printf("strlen(telephony_num):%d\n", strlen(telephony_num));
- printf("strlen(msg):%d\n", strlen(msg));
- return -1;
- }
-
- if(state) // text
- {
- mode = 1;
- }
-
- err = mbtk_sms_cmgf_set(info_handle, mode);
- if(err) {
- printf("cmgf set error : %d\n", err);
- } else {
- printf("cmgf set success\n");
- }
-
- sprintf(cmgs,"%s,%s",telephony_num, msg);
- printf("cmgs:%s\n", cmgs);
-
-/* char *ptr = strstr(cmd, "cmgs,"); //CMGS="10086",hf
- if(ptr != NULL)
- {
- ptr = strstr(cmd, ",");
- ptr++;
- memset(cmgs, 0, sizeof(cmgs));
- memcpy(cmgs, ptr, strlen(ptr));
- printf("1cmgs:%s, strlen(cmgs):%d\n", cmgs, strlen(cmgs));
- }
-*/
-
- memset(resp, 0, sizeof(resp));
-
- err = mbtk_sms_cmgs_set(info_handle, cmgs, resp);
- if(err) {
- printf("Error : %d\n", err);
- return -1;
- } else {
- printf("cmgs set success . resp:%s\n", resp);
- }
-
- return 0;
-}
-
-int lynq_wait_receive_new_sms(int *handle)
-{
- if(info_handle == NULL)
- {
- return -1;
- }
-
- int ret = mbtk_sms_cnmi_set(info_handle);
- if(ret)
- {
- printf("set cnmi fail\n");
- return -1;
- }
-
- mbtk_sms_state_change_cb_reg(info_handle, lynq_sms_state_change_cb);
- return 0;
-}
-
-/*
- AT+CMGD=<index>[,<delflag>]
-
- Deletes message based on index
- node:
- index is -1, delete all message
- delflag set 4
-*/
-int lynq_delete_sms(int index)
-{
- char cmgd[128] = {0};
- int err = 0;
-
- if(index == -1) //delete all
- {
- memcpy(cmgd, ",4", strlen(",4"));
- }
- else
- {
- sprintf(cmgd,"%d",index);
- }
-
- printf("cmgd:%s\n", cmgd);
-
- err = mbtk_sms_cmgd_set(info_handle, cmgd);
- if(err) {
- printf("lynq_delete_sms Error : %d\n", err);
- return -1;
- } else {
- printf("lynq_delete_sms set success\n");
- }
-
- return 0;
-}
-
-
-/*
-function: lynq_list_sms
-stat:0:pud, 1:text
-index: 0, list index;
- > 0,
-
-*/
-int lynq_list_sms(int stat, int index, char *data)
-{
- if(info_handle == NULL)
- {
- return -1;
- }
-
- char cmgs[MSM_NUMBER_MAX] = {0};
- int mode = 0;
- int err = 0;
-
- if(stat) // text
- {
- mode = 1;
- }
-
- err = mbtk_sms_cmgf_set(info_handle, mode);
- if(err) {
- printf("cmgf set error : %d\n", err);
- } else {
- printf("cmgf set success\n");
- }
-
-
- char cmgl[128] = {0};
- char resp[1024+1] ={0};
- sprintf(cmgl,"%d,%s", index, data);
-/*
- char *ptr = strstr(cmd, "cmgl,"); // AT+CMGL[=<stat>]
- if(ptr != NULL)
- {
- ptr = strstr(cmd, ",");
- ptr++;
- memset(cmgl, 0, sizeof(cmgl));
- memcpy(cmgl, ptr, strlen(ptr));
- printf("0cmgl:%s\n", cmgl);
- }
-*/
- memset(resp, 0, sizeof(resp));
- err = mbtk_sms_cmgl_set(info_handle, cmgl, resp);
- if(err) {
- printf("lynq_list_sms Error : %d\n", err);
- return -1;
- } else {
- printf("cmgl set success, reg:%s\n",resp);
- }
-
- return 0;
-}
-
-
-int lynq_query_sms_storage_status(void)
-{
- char mem[128] = {0};
- int err = mbtk_sms_cpms_get(info_handle, mem);
- if(err) {
- printf("cpms query is fail Error : %d\n", err);
- return -1;
- } else {
- printf("cpms query is success : %s\n", mem);
- }
-
- return 0;
-}
-
-
-int lynq_get_smsc_address(char *serviceNumber)
-{
- char csca[128] = {0};
- if(info_handle == NULL || serviceNumber == NULL)
- {
- return -1;
- }
-
- int err = mbtk_sms_csca_get(info_handle, serviceNumber);
- if(err) {
- printf("lynq_get_smsc_address Error : %d\n", err);
- return err;
- } else {
- printf("lynq_get_smsc_address success\n");
- }
-
- return 0;
-}
-
-
-int lynq_set_smsc_address(const char* service_num)
-{
- if(info_handle == NULL || service_num == NULL)
- {
- return -1;
- }
-
- int err = mbtk_sms_csca_set(info_handle, service_num);
- if(err) {
- printf("Error : %d\n", err);
- return err;
- } else {
- printf("lynq_set_smsc_address success\n");
- }
- return 0;
-}
-
-
-
-
-
diff --git a/mbtk/qser_lib/src/qser_time.c b/mbtk/lynq_lib/src/lynq_time.c
similarity index 92%
rename from mbtk/qser_lib/src/qser_time.c
rename to mbtk/lynq_lib/src/lynq_time.c
index f6d0cd0..ce3d3ec 100755
--- a/mbtk/qser_lib/src/qser_time.c
+++ b/mbtk/lynq_lib/src/lynq_time.c
@@ -1,4 +1,5 @@
-#include "qser/qser_time.h"
+#include "lynq_systime.h"
+#include "mbtk_type.h"
int ntp_sync_time(int enable)
{
diff --git a/mbtk/qser_lib/src/qser_voice_call.c b/mbtk/lynq_lib/src/lynq_voice_call.c
similarity index 95%
rename from mbtk/qser_lib/src/qser_voice_call.c
rename to mbtk/lynq_lib/src/lynq_voice_call.c
index 794f8a4..8c891d4 100755
--- a/mbtk/qser_lib/src/qser_voice_call.c
+++ b/mbtk/lynq_lib/src/lynq_voice_call.c
Binary files differ
diff --git a/mbtk/qser_lib/Makefile b/mbtk/qser_lib/Makefile
deleted file mode 100755
index cc7956f..0000000
--- a/mbtk/qser_lib/Makefile
+++ /dev/null
@@ -1,70 +0,0 @@
-ROOT = $(shell pwd)/../..
-include ../Make.defines
-
-LOCAL_PATH=$(BUILD_ROOT)/qser_lib
-
-INC_DIR += -I$(BUILD_ROOT)/mbtk_lib/inc
-
-LIB_DIR +=
-
-LIBS += -llog -lubus -lubox -lblobmsg_json -lrilutil -lmbtk_lib
-
-CFLAGS += -shared -Wl,-shared,-Bsymbolic
-
-DEFINE +=
-
-MY_FILES_PATH:=$(LOCAL_PATH)/src
-#ifeq ($(CONFIG_MBTK_QL_SUPPORT),y)
-#MY_FILES_PATH += $(LOCAL_PATH)/ql
-#endif
-
-#ifeq ($(CONFIG_MBTK_PLATFORM),linux)
-#MY_FILES_PATH += $(LOCAL_PATH)/platform/linux
-#endif
-
-#MY_FILES_SUFFIX:=%.c %.cpp
-#My_All_Files := $(foreach src_path,$(MY_FILES_PATH), $(shell find "$(src_path)" -type f))
-#MY_SRC_LIST := $(filter $(MY_FILES_SUFFIX),$(My_All_Files))
-#MY_SRC_LIST := $(MY_SRC_LIST:$(LOCAL_PATH)/%=%)
-
-#LOCAL_SRC_FILES = $(wildcard src/*.c) $(wildcard src/*.cpp)
-LOCAL_SRC_FILES = src/qser_adc.c \
- src/qser_alarm.c \
- src/qser_audio.c \
- src/qser_fota.c \
- src/qser_gnss.c \
- src/qser_gpio.c \
- src/qser_log.c \
- src/qser_net_light.c \
- src/qser_sleep.c \
- src/qser_time.c
-
-# LOCAL_SRC_FILES += src/qser_data_call.c \
- src/qser_irq.c \
- src/qser_network.c \
- src/qser_sim.c \
- src/qser_sms.c \
- src/qser_voice_call.c
-
-
-$(info LOCAL_SRC_FILES = $(LOCAL_SRC_FILES))
-
-OBJS = $(patsubst %.c, %.o, $(patsubst %.cpp, %.o, $(LOCAL_SRC_FILES)))
-$(info OBJS = $(OBJS))
-
-dtarget := $(OUT_DIR)/lib/libqser_lib.so
-
-all: $(dtarget)
-
-$(dtarget): $(OBJS)
- $(CC) $(CFLAGS) $(LIB_DIR) $(LIBS) $(OBJS) -o $@
-
-%.o:%.c
- $(CC) $(CFLAGS) $(INC_DIR) $(DEFINE) -c $< -o $@
-
-%.o:%.cpp
- $(CC) $(CFLAGS) $(INC_DIR) $(DEFINE) -c $< -o $@
-
-clean:
- rm -f $(OBJS) $(dtarget)
-
diff --git a/mbtk/qser_lib/src/qser_adc.c b/mbtk/qser_lib/src/qser_adc.c
deleted file mode 100755
index 8efeb03..0000000
--- a/mbtk/qser_lib/src/qser_adc.c
+++ /dev/null
@@ -1,9 +0,0 @@
-#include "qser/qser_adc.h"
-
-int qser_adc_show(ADC_CHANNEL_E qadc)
-{
- UNUSED(qadc);
-
- return 0;
-}
-
diff --git a/mbtk/qser_lib/src/qser_audio.c b/mbtk/qser_lib/src/qser_audio.c
deleted file mode 100755
index 426dadb..0000000
--- a/mbtk/qser_lib/src/qser_audio.c
+++ /dev/null
@@ -1,95 +0,0 @@
-#include "qser/qser_audio.h"
-
-int qser_AudPlayer_Open(char* device, _cb_onPlayer cb_fun)
-{
- UNUSED(device);
- UNUSED(cb_fun);
-
- return 0;
-}
-
-int qser_AudPlayer_PlayFrmFile(int hdl, const char *fd, int offset)
-{
- UNUSED(hdl);
- UNUSED(fd);
- UNUSED(offset);
-
- return 0;
-}
-
-int qser_AudPlayer_Pause(int hdl)
-{
- UNUSED(hdl);
-
- return 0;
-}
-
-int qser_AudPlayer_Resume(int hdl)
-{
- UNUSED(hdl);
-
- return 0;
-}
-
-void qser_AudPlayer_Stop(int hdl)
-{
- UNUSED(hdl);
-
- return 0;
-}
-
-
-void qser_AudPlayer_Close(int hdl)
-{
- UNUSED(hdl);
-
- return 0;
-}
-
-
-int qser_AudRecorder_Open(char* device, _cb_onPlayer cb_fun)
-{
- UNUSED(device);
- UNUSED(cb_fun);
-
-
- return 0;
-}
-
-int qser_AudRecorder_StartRecord(int hdl, const char *fd, int offset)
-{
- UNUSED(hdl);
- UNUSED(fd);
- UNUSED(offset);
-
-
- return 0;
-}
-
-int qser_AudRecorder_Pause(void)
-{
-
- return 0;
-}
-
-int qser_AudRecorder_Resume(void)
-{
-
- return 0;
-}
-
-void qser_AudRecorder_Stop(void)
-{
-
-}
-
-void qser_AudRecorder_Close(void)
-{
-
-}
-
-void qser_Audio_Deinit(void)
-{
-
-}
-
diff --git a/mbtk/qser_lib/src/qser_gnss.c b/mbtk/qser_lib/src/qser_gnss.c
deleted file mode 100755
index d10c800..0000000
--- a/mbtk/qser_lib/src/qser_gnss.c
+++ /dev/null
@@ -1,79 +0,0 @@
-#include "qser/qser_gnss.h"
-
-int qser_Gnss_Init (uint32_t *h_gnss)
-{
- UNUSED(h_gnss);
-
-
- return 0;
-}
-
-int qser_Gnss_Deinit (uint32_t h_gnss)
-{
- UNUSED(h_gnss);
-
-
- return 0;
-}
-
-int qser_AddRxIndMsgHandler (gnss_handler_func_t handler_ptr,uint32_t h_gnss)
-{
- UNUSED(handler_ptr);
- UNUSED(h_gnss);
-
-
- return 0;
-}
-
-int qser_Set_Indications (uint32_t h_gnss,e_msg_id_t type)
-{
- UNUSED(h_gnss);
- UNUSED(type);
-
-
- return 0;
-}
-
-int qser_Gnss_Start (uint32_t h_gnss)
-{
- UNUSED(h_gnss);
-
- return 0;
-}
-
-int qser_Gnss_Stop (uint32_t h_gnss)
-{
- UNUSED(h_gnss);
-
- return 0;
-}
-
-int qser_Gnss_InjectTime (uint32_t h_gnss,LYNQ_INJECT_TIME_INTO_T *time_info)
-{
- UNUSED(h_gnss);
- UNUSED(time_info);
-
- return 0;
-}
-
-int qser_Gnss_Delete_Aiding_Data (uint32_t h_gnss,DELETE_AIDING_DATA_TYPE_T flags)
-{
- UNUSED(h_gnss);
- UNUSED(flags);
-
- return 0;
-}
-
-int qser_Gnss_download_tle()
-{
-
- return 0;
-}
-
-int qser_Gnss_injectEphemeris(uint32_t h_gnss)
-{
- UNUSED(h_gnss);
-
- return 0;
-}
-
diff --git a/mbtk/test/lynq_gnss_test.c b/mbtk/test/lynq_gnss_test.c
deleted file mode 100755
index 9ba5185..0000000
--- a/mbtk/test/lynq_gnss_test.c
+++ /dev/null
@@ -1,179 +0,0 @@
-/**
- * \file gnss_test.c
- * \brief A Documented file.
- *
- * Detailed description
- * \Author: Sniper <e190@163.com>
- * \Version: 1.0.0
- * \Date: 2022-03-26
- */
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <pthread.h>
-#include <errno.h>
-#include <termios.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <signal.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <pthread.h>
-#include <termios.h>
-#include <sys/ioctl.h>
-#include "mbtk_type.h"
-#include "lynq/lynq_gnss.h"
-//#include "mbtk_gnss.h"
-
-void gnss_handler_cb
-(
- uint32 h_loc,
- int e_msg_id,
- void *pv_data,
- void *context_ptr
-) {
- printf("e_msg_id=%d\n", e_msg_id);
- switch(e_msg_id)
- {
- case E_LYNQ_LOC_MSG_ID_STATUS_INFO:
- break;
- case E_LYNQ_LOC_MSG_ID_LOCATION_INFO:
- break;
- case E_LYNQ_LOC_MSG_ID_SV_INFO:
- break;
- case E_LYNQ_LOC_MSG_ID_NMEA_INFO:
- {
- LYNQ_LOC_NMEA_INFO_T *pt_nmea = (LYNQ_LOC_NMEA_INFO_T *)pv_data;
-
- printf("NMEA info: timestamp=%lld, length=%d, nmea=%s\n",
- pt_nmea->timestamp, pt_nmea->length, pt_nmea->nmea);
- break;
- }
- case E_LYNQ_LOC_MSG_ID_CAPABILITIES_INFO:
- break;
- case E_LYNQ_LOC_MSG_ID_AGPS_STATUS:
- break;
- case E_LYNQ_LOC_MSG_ID_NI_NOTIFICATION:
- break;
- case E_LYNQ_LOC_MSG_ID_XTRA_REPORT_SERVER:
- break;
- }
-}
-#if 1
-int main(int argc, char *argv[])
-{
- int ret;
-
- ret = lynq_gnss_enable_glonass();
- if(ret < 0) {
- printf("lynq_gnss_init FAIL. ret:%d\n",ret);
- return -1;
- }
-
- ret = lynq_gnss_init();
- if(ret < 0) {
- printf("lynq_gnss_init FAIL. ret:%d\n",ret);
- return -1;
- }
-
- lynq_gnss_callback_reg(gnss_handler_cb);
-
- ret = lynq_gnss_agps_dataconnopen();
- if(ret < 0) {
- printf("lynq_gnss_agps_dataconnopen FAIL. ret:%d\n", ret);
- return -1;
- }
-
- ret = lynq_gnss_start();
- if(ret < 0) {
- printf("lynq_gnss_start FAIL. ret:%d\n",ret);
- return -1;
- }
- sleep(10);
- ret = lynq_gnss_stop();
- if(ret < 0) {
- printf("lynq_gnss_stop FAIL. ret:%d\n",ret);
- return -1;
- }
- ret = lynq_gnss_deinit();
- if(ret < 0) {
- printf("lynq_gnss_deinit FAIL. ret:%d\n",ret);
- return -1;
- }
- return 0;
-}
-
-#else
-
-int main(int argc, char *argv[])
-{
- int ret;
- int opt;
- char dev_file[12] = {0};
-
- while(1)
- {
- printf("=========gnss main=========\n"
- "\t0 exit\n"
- "\t1 gnss init\n"
- "\t2 gnss add callback function\n"
- "\t3 gnss start\n"
- "\t4 gnss stop\n"
- "\t5 gnss deinit\n"
- "\t6 agps down\n"
- "please input operator: >> ");
- scanf("%d", &opt);
- switch (opt)
- {
- case 0:
- printf("main exit\n");
- return 0;
- case 1:
- ret = lynq_gnss_init();
- if(ret < 0)
- {
- printf("lynq_gnss_init FAIL. ret:%d\n",ret);
- return -1;
- }
- opt = 0;
- break;
- case 2:
- {
-
- lynq_gnss_callback_reg(gnss_handler_cb);
- break;
- }
- case 3:
- {
- lynq_gnss_start();
- break;
- }
- case 4:
- {
- lynq_gnss_stop();
- break;
- }
- case 5:
- {
- lynq_gnss_deinit();
- break;
- }
- case 6:
- {
- ret = lynq_gnss_agps_dataconnopen();
- if(ret < 0)
- {
- printf("lynq_gnss_agps_dataconnopen FAIL. ret:%d\n", ret);
- return -1;
- }
- break;
- }
- default:
- break;
- }
- }
-
- return 0;
-}
-#endif
diff --git a/mbtk/test/lynq_sms_test.c b/mbtk/test/lynq_sms_test.c
deleted file mode 100755
index e16893d..0000000
--- a/mbtk/test/lynq_sms_test.c
+++ /dev/null
@@ -1,126 +0,0 @@
-/**
- * \file dtmf_test.c
- * \brief A Documented file.
- *
- * Detailed description
- * \Author: jinLuo
- * \Version: 1.0.0
- * \Date: 2022-12-1
- */
-
-/******************************************************************************\
- * Include files
-\******************************************************************************/
-#include <pthread.h>
-#include <time.h>
-#include <sys/ioctl.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <string.h>
-#include <stdio.h>
-#include <signal.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <stdlib.h>
-#include <poll.h>
-#include <stdlib.h>
-
-#include <sys/ioctl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include "lynq/lynq_sms_api.h"
-
-
-int main(int argc, char *argv[])
-{
- char operator[20];
- int opt;
- int ret, uToken;
- char serNum[50] = {0};
-
- while(1)
- {
- printf("=========audio main=========\n"
- "\t0 exit\n"
- "\t1 sms init\n"
- "\t2 send sms\n"
- "\t3 wait receive new sms\n"
- "\t4 delete sms(int index);\n"
- "\t5 list sms\n"
- "\t6 query sms storage status\n"
- "\t7 query service number\n"
- "\t8 set service number\n"
- "\t9 deinit sms\n"
- "operator: >> ");
- fgets(operator, sizeof(operator), stdin);
- fflush(stdin);
- opt = atoi(operator);
- switch (opt)
- {
- case 0:
- printf("main exit\n");
- return 0;
- case 1:
- lynq_init_sms(uToken);
- break;
- case 2:
- printf("please input volume (0~1): \n");
- fgets(operator, sizeof(operator), stdin);
- fflush(stdin);
- opt = atoi(operator);
- if(opt)
- {
- lynq_send_sms("15775590631", 1, "nihaoma,wohenhao"); //text mode
- }
- else{
- lynq_send_sms("29", 0, "0891683108200805F011000D91685177550996F70008A80E4F60597D5417FF1F62115F88597D"); //pud mode
- }
- break;
- case 3:
- lynq_wait_receive_new_sms(&uToken);
- break;
- case 4:
- printf("please input volume (0~100): \n");
- fgets(operator, sizeof(operator), stdin);
- fflush(stdin);
- opt = atoi(operator);
- lynq_delete_sms(opt);
- break;
- case 5:
- printf("please input index (0~50): \n");
- fgets(operator, sizeof(operator), stdin);
- fflush(stdin);
- opt = atoi(operator);
- lynq_list_sms(1, opt, "ALL" );
- //opt : 0 ; Query all stored SMS messages
- //opt : > 0 ; Gets the content of the SMS message starting from the index number
- break;
- case 6:
- lynq_query_sms_storage_status();
- break;
- case 7:
- ret = lynq_get_smsc_address(serNum);
- if(!ret)
- printf("get_smsc:%s\n", serNum);
- break;
- case 8:
- printf("please input service num: \n");
- fgets(operator, sizeof(operator), stdin);
- fflush(stdin);
- ret= lynq_set_smsc_address(operator);
- break;
- case 9:
- lynq_deinit_sms();
- break;
- default:
- break;
- }
- }
-
- return 0;
-}
diff --git a/mbtk/test/mbtk_info_test.c b/mbtk/test/mbtk_info_test.c
index 73a7050..7be5f8f 100755
--- a/mbtk/test/mbtk_info_test.c
+++ b/mbtk/test/mbtk_info_test.c
@@ -12,7 +12,8 @@
#include <signal.h>
#include "mbtk_info_api.h"
-#include "lynq/lynq_sms_api.h"
+
+#define DSC_to_msg(DSC) (DSC == 0 ? "Bit7" : (DSC == 1 ? "Bit8" : "UCS2"))
//#include "lynq_net_api.h"
diff --git a/mbtk/test/tcp_test.c b/mbtk/test/tcp_test.c
new file mode 100755
index 0000000..51daace
--- /dev/null
+++ b/mbtk/test/tcp_test.c
@@ -0,0 +1,176 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <errno.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <netinet/in.h>
+#include <pthread.h>
+#include <sys/epoll.h>
+#include <string.h>
+#include <fcntl.h>
+#include <signal.h>
+
+#include "mbtk_tcpip.h"
+#include "mbtk_log.h"
+
+
+static void help()
+{
+ printf("\n************************************************************************\n");
+ printf("net_open: Open network.\n");
+ printf("net_close: Close network.\n");
+ printf("link_open <link_id> <ser_addr> <ser_port> <loc_port> <TCP/UDP> <CLI/SER> <ack> <ssl> <ignore_cert> <heartbeat_time> <delay_time> <read_cb>: Open link.\n");
+ printf("link_close <link_id>: Close link.\n");
+ printf("send <link_id> <data>:Send data.\n");
+ printf("recv <link_id> <len>:Recv data.\n");
+ printf("traffic_reset <link_id>:Traffic reset.\n");
+ printf("traffic_get <link_id>:Traffic get.\n");
+ printf("state_get <link_id>:Link state get.\n");
+ printf("tcp_info <link_id>:TCP information state get.\n");
+ printf("\n************************************************************************\n");
+}
+
+static void sig_process(int sig)
+{
+ LOGI("I got signal %d\n", sig);
+ switch(sig)
+ {
+ case SIGINT: // Ctrl + C
+ {
+ LOGI("Exit by SIGINT.\n");
+ mbtk_tcpip_err_enum err = mbtk_tcpip_net_close();
+ if(err == MBTK_TCPIP_ERR_SUCCESS) {
+ printf("Net close success.\n");
+ } else {
+ printf("Net close fail:%d\n", err);
+ }
+ exit(0);
+ }
+ case SIGQUIT: // Ctrl + \ (类似 SIGINT ,但要产生core文件)
+ {
+ LOGI("Exit by SIGQUIT.\n");
+ mbtk_tcpip_err_enum err = mbtk_tcpip_net_close();
+ if(err == MBTK_TCPIP_ERR_SUCCESS) {
+ printf("Net close success.\n");
+ } else {
+ printf("Net close fail:%d\n", err);
+ }
+ exit(0);
+ }
+ case SIGTERM:// 默认kill (同 SIGKILL ,但 SIGKILL 不可捕获)
+ {
+ LOGI("Exit by SIGTERM.\n");
+ mbtk_tcpip_err_enum err = mbtk_tcpip_net_close();
+ if(err == MBTK_TCPIP_ERR_SUCCESS) {
+ printf("Net close success.\n");
+ } else {
+ printf("Net close fail:%d\n", err);
+ }
+ exit(0);
+ }
+ case SIGTSTP:// Ctrl + Z (同 SIGSTOP ,但 SIGSTOP 不可捕获)
+ {
+ LOGI("Exit by SIGTSTP.\n");
+ exit(0);
+ }
+ case SIGSEGV: // 如空指针
+ {
+ LOGI("Exit by SIGSEGV.\n");
+ exit(0);
+ }
+ default:
+ {
+ LOGI("Unknown sig:%d\n",sig);
+ break;
+ }
+ }
+}
+
+void tcpip_print_tcp_info(mbtk_tcpip_tcp_state_info_s *info)
+{
+ printf("Link - %d\n", info->link_id);
+ printf("fd - %d\n", info->sock_fd);
+ printf("State - %d\n", info->state);
+ printf("Recv data length - %d\n", info->recv_data_len);
+}
+
+void tcpip_read_cb(int link_id, const char* data, int data_len)
+{
+ printf("\nRECV(%d-%d):%s\n", link_id, data_len, data);
+}
+
+void tcpip_net_callback_func(int state, const char* addr)
+{
+ if(state) {
+ printf("Net conncect, IP : %s\n", addr);
+ } else {
+ printf("Net disconnect.\n");
+ }
+}
+
+
+int main(int argc, char *argv[])
+{
+
+
+ printf(">>>>>>>>>>>START TCP TEST>>>>>>>>>>>>>\r\n");
+ mbtk_tcpip_err_enum err;
+
+ mbtk_tcpip_info_t info;
+ memset(&info, 0x0, sizeof(mbtk_tcpip_info_t));
+ char *ip = "www.chaixiongfeng.group";
+ strcpy(&info.ser_addr,ip);
+ info.link_id=1;
+ info.ser_port =45002;
+ info.prot_type = MBTK_SOCK_TCP;
+ info.tcpip_type = MBTK_TCPIP_TYPE_CLIENT;
+ info.read_cb = NULL;
+
+
+ err = mbtk_tcpip_sock_open((const mbtk_tcpip_info_t*)(&info));
+ if(err == MBTK_TCPIP_ERR_SUCCESS) {
+ printf("Link open success.\n");
+ } else {
+ printf("Link open fail:%d\n", err);
+ return 0;
+ }
+
+ while(1)
+ {
+ char *data="stargcharge connect\r\n";
+ int len = mbtk_tcpip_send(1, data, strlen(data), NULL, 0);
+ if(len == strlen(data))
+ {
+ printf("Send success:%d.\n", len);
+ }
+ else
+ {
+ printf("Send fail:%d/%d\n", len, strlen(data));
+ }
+
+ char buff[128];
+ len = mbtk_tcpip_read(1, buff, 128);
+ if(len > 0)
+ {
+ printf("RECV[%d]:%s\n", len, buff);
+ }
+ else
+ {
+ printf("RECV fail:%d\n", len);
+ }
+
+ err = mbtk_tcpip_sock_close(1);
+ if(err == MBTK_TCPIP_ERR_SUCCESS)
+ {
+ printf("Link close success.\n");
+ }
+ else
+ {
+ printf("Link close fail:%d\n", err);
+ }
+ sleep(5);
+ }
+}
+
+