Add mbtk/liblynq_lib_v2/ mbtk/libql_lib_v2/

Change-Id: Idbb802cd805b34603ccf65bff9818725a6955e51
diff --git a/mbtk/liblynq_lib_v2/Makefile b/mbtk/liblynq_lib_v2/Makefile
new file mode 100755
index 0000000..e756641
--- /dev/null
+++ b/mbtk/liblynq_lib_v2/Makefile
@@ -0,0 +1,68 @@
+BUILD_ROOT = $(shell pwd)/..
+include $(BUILD_ROOT)/Make.defines
+
+LOCAL_PATH=$(BUILD_ROOT)/lynq_lib_v2
+
+INC_DIR +=
+
+LIB_DIR +=
+
+#LIBS += -llog -lmbtk_lib
+LIBS += -lmbtk_lib -lrilutil -lprop2uci -lmtel -laudio-apu -lcutils -ltinyalsa -lacm -llog -ljson-c -lblobmsg_json
+LIBS += -lmbtk_audio -lmbtk_ril -lmbtk_fota -lmbtk_factory -lmbtk_net -lmbtk_gnss
+
+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
+
+#LOCAL_SRC_FILES = $(wildcard src/*.c) $(wildcard src/*.cpp)
+LOCAL_SRC_FILES = src/lynq_adc.c \
+	src/lynq_alarm.c \
+	src/lynq_data_call.c \
+	src/lynq_fota.c \
+	src/lynq_gpio.c \
+	src/lynq_irq.c \
+	src/lynq_log.c \
+	src/lynq_net_light.c \
+	src/lynq_network.c \
+	src/lynq_sim.c \
+	src/lynq_sleep.c \
+	src/lynq_sms.c \
+	src/lynq_thermal.c \
+	src/lynq_time.c \
+	src/lynq_voice_call.c \
+	src/lynq_chip_id.c \
+    src/lynq_gnss.c
+
+ifeq ($(BUILD_PLATFORM), v2102)
+LOCAL_SRC_FILES += src/lynq_audio.c
+endif
+
+OBJS = $(patsubst %.c, %.o, $(patsubst %.cpp, %.o, $(LOCAL_SRC_FILES)))
+$(info OBJS = $(OBJS))
+
+dtarget := $(OUT_DIR)/lib/liblynq_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/liblynq_lib_v2/src/lynq_adc.c b/mbtk/liblynq_lib_v2/src/lynq_adc.c
new file mode 100755
index 0000000..4317e17
--- /dev/null
+++ b/mbtk/liblynq_lib_v2/src/lynq_adc.c
@@ -0,0 +1,34 @@
+#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 QADC_NONE:
+        {
+            return 0;
+        }
+        case ADC0:
+            adc = MBTK_ADC0;
+            break;
+        case ADC1:
+            adc = MBTK_ADC1;
+            break;
+#if defined(MBTK_PROJECT_T108) || defined(MBTK_PROJECT_L508_X6)
+        case ADC2:
+            adc = MBTK_ADC2;
+            break;
+#endif
+        default:
+            LOGE("Unsupport adc : %d", qadc);
+            return -1;
+    }
+
+    return mbtk_adc_get(adc);
+}
+
diff --git a/mbtk/liblynq_lib_v2/src/lynq_alarm.c b/mbtk/liblynq_lib_v2/src/lynq_alarm.c
new file mode 100755
index 0000000..461a045
--- /dev/null
+++ b/mbtk/liblynq_lib_v2/src/lynq_alarm.c
@@ -0,0 +1,88 @@
+#include <math.h>
+#include <stdlib.h>
+
+#include "mbtk_alarm.h"
+#include "lynq_alarm.h"
+#include "mbtk_str.h"
+
+
+bool rtc_flag = FALSE;
+int lynq_rtc_service_init(void)
+{
+    int ret = 0;
+    if(!rtc_flag)
+    {
+        rtc_flag = TRUE;
+        ret = 1;
+    }
+    else
+    {
+        ret = -1;
+    }
+    return ret;
+}
+
+int lynq_rtc_service_deinit(void)
+{
+    int ret = 0;
+    if(rtc_flag)
+    {
+        rtc_flag = FALSE;
+        ret = 0;
+    }
+    else{
+        ret = -1;
+    }
+
+    return ret;
+}
+
+int lynq_set_wakealarm(unsigned long time_sec,int src_id,int rtc_id,lynq_wakealarm_add_cb wakealarm_notify )
+{
+    UNUSED(time_sec);
+    if(time_sec < 1 || time_sec > pow(2, 28)) {
+        return -1;
+    }
+
+    return -1;
+}
+
+//int lynq_set_poweralarm(unsigned long time_sec)
+int lynq_set_poweralarm(unsigned long time_sec,int src_id)
+{
+    UNUSED(time_sec);
+    if(time_sec < 1 || time_sec > pow(2, 28)) {
+        return -1;
+    }
+    char buf[50] ={0};
+    sprintf(buf, "rtcwake -d rtc0 -s %d -m on &", time_sec);
+    system(buf);
+
+    return 0;
+}
+
+// min:1 max:2^28
+ssize_t wakealarm(char *buffer,int src_id,int rtc_id,lynq_wakealarm_add_cb wakealarm_notify )
+{
+    UNUSED(buffer);
+    if(str_empty(buffer)) {
+        return -1;
+    }
+    return lynq_set_wakealarm(atol(buffer), src_id, rtc_id, wakealarm_notify);
+}
+
+// min:1 max:2^28
+ssize_t poweralarm(char *buffer,int src_id)
+{
+    UNUSED(buffer);
+    if(str_empty(buffer)) {
+        return -1;
+    }
+    return lynq_set_poweralarm(atol(buffer), 0);
+}
+
+ssize_t cancel_wakealarm(int src_id, int rtc_id)
+{
+    return -1;
+}
+
diff --git a/mbtk/liblynq_lib_v2/src/lynq_audio.c b/mbtk/liblynq_lib_v2/src/lynq_audio.c
new file mode 100755
index 0000000..259661e
--- /dev/null
+++ b/mbtk/liblynq_lib_v2/src/lynq_audio.c
@@ -0,0 +1,271 @@
+#include "lynq-qser-audio.h"
+#include "mbtk_type.h"
+#include "mbtk_log.h"
+#include "mbtk_audio2.h"
+
+#define AUDIO_DEV_PLAY "device1"
+#define AUDIO_DEV_RECORDER "device2"
+#define AUDIO_HDL_DEFAULT 0
+
+static _cb_onPlayer play_cb = NULL;
+static int play_hdl = -1;
+
+static _cb_onPlayer recv_cb = NULL;
+static int recv_hdl = -1;
+
+int qser_AudPlayer_Open(char* device, _cb_onPlayer cb_fun)
+{
+    UNUSED(device);
+    UNUSED(cb_fun);
+    if(device == NULL || strcmp(device, AUDIO_DEV_PLAY)) {
+        LOGE("device must be %s for play.", AUDIO_DEV_PLAY);
+        return -1;
+    }
+
+    if(mbtk_audio_wav_init()) {
+        LOGE("mbtk_audio_wav_init() fail.");
+        return -1;
+    }
+
+    play_cb = cb_fun;
+
+    return 0;
+}
+
+int qser_AudPlayer_PlayFrmFile(int hdl, const char *fd, int offset)
+{
+    UNUSED(hdl);
+    UNUSED(fd);
+    UNUSED(offset);
+    if(play_hdl >= 0) {
+        LOGE("Play busy.");
+        if(play_cb) {
+            play_cb(-1);
+        }
+        return -1;
+    }
+
+    if(mbtk_audio_wav_play_start(fd)) {
+        LOGE("mbtk_audio_wav_play_start() fail.");
+        if(play_cb) {
+            play_cb(-2);
+        }
+        return -1;
+    }
+
+    play_hdl = hdl;
+
+    if(play_cb) {
+        play_cb(0);
+    }
+
+    return 0;
+}
+
+int qser_AudPlayer_PlayPcmBuf(const unsigned char *pcm_data, int data_size, int period_size,
+                                int period_count, int num_channels, int sample_rate, int ownerid)
+{
+
+    if(play_hdl >= 0) {
+        LOGE("Play busy.");
+        if(play_cb) {
+            play_cb(-1);
+        }
+        return -1;
+    }
+
+    if(mbtk_audio_wav_stream_play_start(pcm_data, data_size, sample_rate, num_channels)) {
+        LOGE("mbtk_audio_wav_stream_play_start() fail.");
+        if(play_cb) {
+            play_cb(-2);
+        }
+        return -1;
+    }
+
+    play_hdl = AUDIO_HDL_DEFAULT;
+    if(play_cb) {
+        play_cb(0);
+    }
+    return 0;
+}
+
+int qser_AudPlayer_Pause(int hdl)
+{
+    UNUSED(hdl);
+    if((play_hdl != AUDIO_HDL_DEFAULT && hdl != play_hdl) || play_hdl < 0) {
+        LOGE("Play busy or hdl error.");
+        return -1;
+    }
+
+    if(mbtk_audio_wav_play_pause()) {
+        LOGE("mbtk_audio_wav_play_pause() fail.");
+        return -1;
+    }
+
+    return 0;
+}
+
+int qser_AudPlayer_Resume(int hdl)
+{
+    UNUSED(hdl);
+    if((play_hdl != AUDIO_HDL_DEFAULT && hdl != play_hdl) || play_hdl < 0) {
+        LOGE("Play busy or hdl error.");
+        return -1;
+    }
+
+    if(mbtk_audio_wav_play_resume()) {
+        LOGE("mbtk_audio_wav_play_resume() fail.");
+        return -1;
+    }
+
+    return 0;
+}
+
+void qser_AudPlayer_Stop(int hdl)
+{
+    UNUSED(hdl);
+    if((play_hdl != AUDIO_HDL_DEFAULT && hdl != play_hdl) || play_hdl < 0) {
+        LOGE("Play busy or hdl error.");
+        return;
+    }
+
+    if(mbtk_audio_wav_play_stop()) {
+        LOGE("mbtk_audio_wav_play_stop() fail.");
+        return;
+    }
+
+    play_hdl = -1;
+}
+
+
+void qser_AudPlayer_Close(int hdl)
+{
+    UNUSED(hdl);
+
+    if(play_hdl >= 0) {
+        qser_AudPlayer_Stop(hdl);
+    }
+
+    if(mbtk_audio_wav_deinit()) {
+        LOGE("mbtk_audio_wav_deinit() fail.");
+        return;
+    }
+
+    play_cb = NULL;
+}
+
+int qser_AudRecorder_Open(char* device, _cb_onPlayer cb_fun)
+{
+    UNUSED(device);
+    UNUSED(cb_fun);
+    if(device == NULL || strcmp(device, AUDIO_DEV_RECORDER)) {
+        LOGE("device must be %s for recv.", AUDIO_DEV_RECORDER);
+        return -1;
+    }
+
+    if(mbtk_audio_wav_init()) {
+        LOGE("mbtk_audio_wav_init() fail.");
+        return -1;
+    }
+
+    recv_cb = cb_fun;
+
+    return 0;
+}
+
+int qser_AudRecorder_StartRecord(int hdl, const char *fd, int offset)
+{
+    UNUSED(hdl);
+    UNUSED(fd);
+    UNUSED(offset);
+    if(recv_hdl >= 0) {
+        LOGE("Recv busy.");
+        if(recv_cb) {
+            recv_cb(-1);
+        }
+        return -1;
+    }
+
+    if(mbtk_audio_wav_recorder_start(fd, MBTK_AUDIO_SAMPLE_RATE_8000)) {
+        LOGE("mbtk_audio_wav_recorder_start() fail.");
+        if(recv_cb) {
+            recv_cb(-2);
+        }
+        return -1;
+    }
+
+    recv_hdl = hdl;
+    if(recv_cb) {
+        recv_cb(0);
+    }
+    return 0;
+}
+
+int qser_AudRecorder_StartRecord_Custom(char *file, int period_size, int period_count,
+            int num_channels, int sample_rate)
+{
+    return qser_AudRecorder_StartRecord(0, file, 0);
+}
+
+int qser_AudRecorder_Pause(void)
+{
+    if(recv_hdl < 0) {
+        LOGE("Recv busy or hdl error.");
+        return -1;
+    }
+
+    if(mbtk_audio_wav_recorder_pause()) {
+        LOGE("mbtk_audio_wav_recorder_pause() fail.");
+        return -1;
+    }
+    return 0;
+}
+
+int qser_AudRecorder_Resume(void)
+{
+    if(recv_hdl < 0) {
+        LOGE("Recv busy or hdl error.");
+        return -1;
+    }
+
+    if(mbtk_audio_wav_recorder_resume()) {
+        LOGE("mbtk_audio_wav_recorder_resume() fail.");
+        return -1;
+    }
+    return 0;
+}
+
+void qser_AudRecorder_Stop(void)
+{
+    if(recv_hdl < 0) {
+        LOGE("Recv busy or hdl error.");
+        return;
+    }
+
+    if(mbtk_audio_wav_recorder_stop()) {
+        LOGE("mbtk_audio_wav_recorder_stop() fail.");
+        return;
+    }
+
+    recv_hdl = -1;
+}
+
+void qser_AudRecorder_Close(void)
+{
+    if(recv_hdl >= 0) {
+        qser_AudRecorder_Stop();
+    }
+
+    if(mbtk_audio_wav_deinit()) {
+        LOGE("mbtk_audio_wav_deinit() fail.");
+        return;
+    }
+
+    recv_cb = NULL;
+}
+
+void qser_Audio_Deinit(void)
+{
+    // Do nothing...
+}
+
diff --git a/mbtk/liblynq_lib_v2/src/lynq_chip_id.c b/mbtk/liblynq_lib_v2/src/lynq_chip_id.c
new file mode 100755
index 0000000..10e21c9
--- /dev/null
+++ b/mbtk/liblynq_lib_v2/src/lynq_chip_id.c
@@ -0,0 +1,58 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <sys/time.h>
+
+#include <time.h>
+#include "mbtk_info_api.h"
+
+int lynq_get_time_sec(char *time_t)
+{
+    struct timeval tv;
+    int ret=gettimeofday(&tv,NULL);
+    sprintf(time_t, "%ld", tv.tv_sec);
+    return 0;
+}
+
+int lynq_imet_get(char *imei_t)
+{
+    static mbtk_info_handle_t* info_handle = NULL;
+    info_handle = mbtk_info_handle_get();
+    if(!info_handle)
+    {
+        return -1;
+    }
+    
+    int err;
+    err = mbtk_imei_get(info_handle, imei_t);
+    if(err) {
+    //    printf("Error : %d\n", err);
+        return -1;
+    } else {
+   //     printf("IMEI : %s\n", imei_t);
+    }
+    return 0;
+}
+
+
+int lynq_get_chip_id(char *chip_id)
+{
+    char time[50]={0};
+    char imei[50]={0};
+    int ret = 0;
+    lynq_get_time_sec(time);
+    ret = lynq_imet_get(imei);
+    if(!ret)
+    {
+        sprintf(chip_id,"%s%s",imei, time);
+//        printf("%s\n",chip_id );
+    }
+    else{
+        return -1;
+    }
+
+    return 0;
+}
+
+
+
diff --git a/mbtk/liblynq_lib_v2/src/lynq_data_call.c b/mbtk/liblynq_lib_v2/src/lynq_data_call.c
new file mode 100755
index 0000000..73e4692
--- /dev/null
+++ b/mbtk/liblynq_lib_v2/src/lynq_data_call.c
@@ -0,0 +1,867 @@
+#include "lynq-qser-data.h"
+#include "mbtk_type.h"
+#include "mbtk_info_api.h"
+
+#include <pthread.h>
+#include <cutils/properties.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+/****************************DEFINE***************************************/
+#define QSER_RESULT_SUCCESS 0
+#define QSER_RESULT_FAIL -1
+
+#define MBTK_INFO_ERR_CID_EXIST 311
+#define MBTK_INFO_ERR_CID_NO_EXIST 312
+#define MBTK_INFO_ERR_NO_APN 500
+
+#define QSER_APN_NUM 8
+//default  range: 0 - 7
+//AT+CGACT range: 1 - 8
+//1 default IDX, 8 IMS IDX
+#if defined(MBTK_ALL_CID_SUPPORT)
+#if defined(MBTK_SG_SUPPORT)
+#define QSER_PROFILE_IDX_MIN 0
+#else
+#define QSER_PROFILE_IDX_MIN 1
+#endif
+#else
+#define QSER_PROFILE_IDX_MIN 1
+#endif
+#define QSER_PROFILE_IDX_MAX 6
+
+/****************************DEFINE***************************************/
+
+/****************************VARIABLE***************************************/
+mbtk_info_handle_t* qser_info_handle = NULL;
+int qser_info_handle_num = 0;
+static bool inited = FALSE;
+static qser_data_call_evt_cb_t qser_net_status_cb = NULL;
+/****************************VARIABLE***************************************/
+
+/******************************FUNC*****************************************/
+static int qser_apn_info_param_convert(int profile_idx, qser_apn_info_s *new_apn, mbtk_qser_apn_info_s *old_apn)
+{
+    if(new_apn == NULL || old_apn == NULL)
+    {
+        LOGE("[qser_data] qser_apn_info_param_convert apn param is NULL.");
+        return QSER_RESULT_FAIL;
+    }
+
+    memset(new_apn, 0x0, sizeof(qser_apn_info_s));
+    new_apn->profile_idx = old_apn->cid - 1;
+    //get ip type
+    if(old_apn->ip_type == MBTK_IP_TYPE_IPV4V6) // IPV4V6
+    {
+        new_apn->pdp_type = QSER_APN_PDP_TYPE_IPV4V6;
+    }
+    else if(old_apn->ip_type == MBTK_IP_TYPE_IP) // IPV4
+    {
+        new_apn->pdp_type = QSER_APN_PDP_TYPE_IPV4;
+    }
+    else if(old_apn->ip_type == MBTK_IP_TYPE_IPV6) // IPV6
+    {
+        new_apn->pdp_type = QSER_APN_PDP_TYPE_IPV6;
+    }
+    else
+    {
+        new_apn->pdp_type = QSER_APN_PDP_TYPE_PPP;
+    }
+
+    //get apn name
+    if(strlen((char *)old_apn->apn_name) > QSER_APN_NAME_SIZE)
+    {
+        LOGE("[qser_data] apn_nmea length verylong.");
+        return QSER_RESULT_FAIL;
+    }
+    else
+    {
+        if(strlen((char *)old_apn->apn_name) > 0)
+        {
+            memcpy(new_apn->apn_name, old_apn->apn_name,strlen((char *)old_apn->apn_name));
+        }
+    }
+
+    //get apn user
+    if(strlen((char *)old_apn->user_name) > QSER_APN_USERNAME_SIZE)
+    {
+        LOGE("[qser_data] apn_user length verylong.");
+        return QSER_RESULT_FAIL;
+    }
+    else
+    {
+        if(strlen((char *)old_apn->user_name) > 0)
+        {
+            memcpy(new_apn->username, old_apn->user_name, strlen((char *)old_apn->user_name));
+        }
+    }
+
+    //get apn password
+    if(strlen((char *)old_apn->user_pass) > QSER_APN_PASSWORD_SIZE)
+    {
+        LOGE("[qser_data] apn_password length verylong.");
+        return QSER_RESULT_FAIL;
+    }
+    else
+    {
+        if(strlen((char *)old_apn->user_pass) > 0)
+        {
+            memcpy(new_apn->password, old_apn->user_pass, strlen((char *)old_apn->user_pass));
+        }
+    }
+
+    //get apn proto
+    new_apn->auth_proto = (qser_apn_auth_proto_e)old_apn->auth_proto;
+
+    //get apn type
+    if(strlen((char *)old_apn->apn_type) > QSER_APN_PASSWORD_SIZE)
+    {
+        LOGE("[qser_data] apn_type length verylong.");
+        return QSER_RESULT_FAIL;
+    }
+    else
+    {
+        if(strlen((char *)old_apn->apn_type) > 0)
+        {
+            memcpy(new_apn->apn_type, old_apn->apn_type, strlen((char *)old_apn->apn_type));
+        }
+    }
+
+    return QSER_RESULT_SUCCESS;
+}
+
+static void qser_state_init(qser_data_call_state_s *state)
+{
+    if(state != NULL)
+    {
+        state->profile_idx = 0;
+        memset(state->name, 0x0, 16);
+        state->ip_family = QSER_DATA_CALL_TYPE_IPV4V6;
+        state->state = QSER_DATA_CALL_DISCONNECTED;
+        state->err = QSER_DATA_CALL_ERROR_NONE;
+        inet_aton("0.0.0.0", &(state->v4.ip));
+        inet_aton("0.0.0.0", &(state->v4.gateway));
+        inet_aton("0.0.0.0", &(state->v4.pri_dns));
+        inet_aton("0.0.0.0", &(state->v4.sec_dns));
+        inet_pton(AF_INET6, "::", &(state->v6.ip));
+        inet_pton(AF_INET6, "::", &(state->v6.gateway));
+        inet_pton(AF_INET6, "::", &(state->v6.pri_dns));
+        inet_pton(AF_INET6, "::", &(state->v6.sec_dns));
+    }
+}
+
+void qser_wan_net_state_change_cb(const void* data, int data_len)
+{
+    if(data == NULL || data_len == 0)
+    {
+        return;
+    }
+    
+    uint8 *net_data = NULL;
+    net_data = (uint8 *)data;
+
+    if(*net_data > 100 && *net_data < 200)
+    {
+        int idx = *net_data - 101;
+        if(idx <= QSER_PROFILE_IDX_MAX)
+        {
+            qser_data_call_state_s state = {0};
+            qser_state_init(&state);
+            state.profile_idx = idx;
+            state.state = QSER_DATA_CALL_DISCONNECTED;
+            if(qser_net_status_cb != NULL)
+            {
+                qser_net_status_cb(&state);
+            }
+        }
+        else
+        {
+            LOGE("[qser_data] cb fail,idx is %d.", idx);
+        }
+        
+    }
+    else if(*net_data > 200 && *net_data < 220)
+    {
+        LOGE("[qser_data] cid[%d] is open.", *net_data - 201);
+    }
+    else if(*net_data > 220)
+    {
+        LOGE("[qser_data] cid[%d] is reopen.", *net_data - 221);
+        int idx = *net_data - 221;
+        if(idx <= QSER_PROFILE_IDX_MAX)
+        {
+            qser_data_call_state_s state = {0};
+            qser_state_init(&state);
+            state.profile_idx = idx;
+            state.state = QSER_DATA_CALL_CONNECTED;
+            snprintf(state.name, 16, "ccinet%d", idx);
+            if(qser_net_status_cb != NULL)
+            {
+                qser_net_status_cb(&state);
+            }
+        }
+    }
+    else if(*net_data == 1)
+    {
+        LOGE("[qser_data] pdp is open.");
+    }
+    else
+    {
+        LOGE("[qser_data] unkonwn param [%d].", *net_data);
+    }
+}
+
+static void* data_call_async_thread(void* arg)
+{
+    LOGE("[qser_data] entry data_call_async_thread.");
+    qser_data_call_error_e err = QSER_DATA_CALL_ERROR_NONE;
+    
+    qser_data_call_s qser_data_backup = {0};
+    qser_data_call_info_s info = {0};
+    if(arg != NULL)
+    {
+        memcpy(&qser_data_backup, (qser_data_call_s *)arg, sizeof(qser_data_call_s));
+    }
+    else
+    {
+        LOGE("[qser_data] arg is NULL.");
+    }
+
+    qser_data_call_state_s state = {0};
+    qser_state_init(&state);
+    state.profile_idx = qser_data_backup.profile_idx;
+    snprintf(state.name, 16, "ccinet%d", qser_data_backup.profile_idx);
+    state.ip_family = qser_data_backup.ip_family;
+    
+    int ret = qser_data_call_start(&qser_data_backup, &err);
+    if(ret != QSER_RESULT_SUCCESS)
+    {
+        LOGE("[qser_data] qser_data_call_start() fail.");
+        state.err = err;
+    }
+    else
+    {
+        state.state = QSER_DATA_CALL_CONNECTED;
+        ret = qser_data_call_info_get(qser_data_backup.profile_idx, qser_data_backup.ip_family, &info, &err);
+        if(ret != QSER_RESULT_SUCCESS)
+        {
+            LOGE("[qser_data] qser_data_call_info_get() fail.");
+            state.err = err;
+        }
+        else
+        {
+            memcpy(&(state.v4), &(info.v4.addr), sizeof(struct v4_address_status));
+            memcpy(&(state.v6), &(info.v6.addr), sizeof(struct v6_address_status));
+        }
+    }
+  
+    if(qser_net_status_cb != NULL)
+    {
+        qser_net_status_cb(&state);
+    }
+    return NULL;
+}
+
+/******************************FUNC*****************************************/
+
+/****************************API***************************************/
+int qser_data_call_init(qser_data_call_evt_cb_t evt_cb)
+{
+    //UNUSED(evt_cb);
+    if(!inited && qser_info_handle == NULL)
+    {
+        qser_info_handle = mbtk_info_handle_get();
+        if(qser_info_handle)
+        {
+            qser_info_handle_num++;
+            inited = TRUE;
+            mbtk_pdp_state_change_cb_reg(qser_info_handle, qser_wan_net_state_change_cb);
+        }
+        else
+        {
+            LOGE("[qser_data] mbtk_info_handle_get() fail.");
+            return QSER_RESULT_FAIL;
+        }
+    }
+    else
+    {
+        if(!inited)
+        {
+            qser_info_handle_num++;
+            inited = TRUE;
+            mbtk_pdp_state_change_cb_reg(qser_info_handle, qser_wan_net_state_change_cb);
+        }
+    }
+    qser_net_status_cb = evt_cb;
+
+    LOGE("[qser_data] mbtk_info_handle_get() success.");
+    return QSER_RESULT_SUCCESS;
+}
+
+void qser_data_call_destroy(void)
+{
+    if(qser_info_handle)
+    {
+        LOGE("[qser_data] qser_info_handle_num = %d", qser_info_handle_num);
+        if(qser_info_handle_num == 1)
+        { // 最后一个引用,可释放。
+            int ret = mbtk_info_handle_free(&qser_info_handle);
+            if(ret)
+            {
+                LOGE("[qser_data] mbtk_info_handle_free() fail.");
+            }
+            else
+            {
+                qser_info_handle_num = 0;
+                qser_info_handle = NULL;
+                qser_net_status_cb = NULL;
+                inited = FALSE;
+            }
+        } 
+        else
+        {
+            qser_info_handle_num--;
+            qser_net_status_cb = NULL;
+        }
+    }
+    else
+    {
+        LOGE("[qser_data] handle not inited.");
+    }
+}
+
+int qser_data_call_start(qser_data_call_s *data_call, qser_data_call_error_e *err)
+{
+    //UNUSED(data_call);
+    //UNUSED(err);
+    if(data_call == NULL || err == NULL)
+    {
+        LOGE("[qser_data] data_call or err is NULL.");
+        if(err != NULL)
+        {
+            *err = QSER_DATA_CALL_ERROR_INVALID_PARAMS;
+        }
+        return QSER_RESULT_FAIL;
+    }
+    
+    if(qser_info_handle == NULL)
+    {
+        LOGE("[qser_data] handle is NULL.");
+        *err = QSER_DATA_CALL_ERROR_NO_INIT;
+        return QSER_RESULT_FAIL;
+    }
+
+    int ret = -1;
+    ret = mbtk_data_call_start(qser_info_handle, data_call->profile_idx + 1, 0, FALSE, 0);
+    if(ret != 0)
+    {
+        LOGE("[qser_data] mbtk_data_call_start fail.[ret = %d]", ret);
+        if(ret == MBTK_INFO_ERR_CID_EXIST)
+        {
+            *err = QSER_DATA_CALL_ERROR_PDP_ACTIVATE;
+        }
+        else
+        {
+            *err = QSER_DATA_CALL_ERROR_UNKNOWN;
+        }
+        return QSER_RESULT_FAIL;
+    }
+    else
+    {
+        *err = QSER_DATA_CALL_ERROR_NONE;
+    }
+
+    return QSER_RESULT_SUCCESS;
+}
+
+int qser_data_call_start_async(qser_data_call_s *data_call, qser_data_call_error_e *err)
+{
+    //UNUSED(data_call);
+    UNUSED(err);
+    if(data_call == NULL || err == NULL)
+    {
+        LOGE("[qser_data] data_call or err is NULL.");
+        if(err != NULL)
+        {
+            *err = QSER_DATA_CALL_ERROR_INVALID_PARAMS;
+        }
+        return QSER_RESULT_FAIL;
+    }
+    
+    if(qser_info_handle == NULL)
+    {
+        LOGE("[qser_data] handle is NULL.");
+        *err = QSER_DATA_CALL_ERROR_NO_INIT;
+        return QSER_RESULT_FAIL;
+    }
+
+    pthread_attr_t thread_attr;
+    pthread_t data_call_thread_id;
+    pthread_attr_init(&thread_attr);
+    if(pthread_attr_setdetachstate(&thread_attr, PTHREAD_CREATE_DETACHED))
+    {
+        LOGE("[qser_data] pthread_attr_setdetachstate() fail.");
+        *err = QSER_DATA_CALL_ERROR_UNKNOWN;
+        return QSER_RESULT_FAIL;
+    }
+
+    //memcpy(&qser_data_backup, data_call, sizeof(qser_data_call_s));
+    if(pthread_create(&data_call_thread_id, &thread_attr, data_call_async_thread, (void *) data_call))
+    {
+        LOGE("[qser_data] pthread_create() fail.");
+        *err = QSER_DATA_CALL_ERROR_UNKNOWN;
+        return QSER_RESULT_FAIL;
+    }
+    pthread_attr_destroy(&thread_attr);
+    
+    return QSER_RESULT_SUCCESS;
+}
+
+int qser_data_call_stop(char profile_idx, qser_data_call_ip_family_e ip_family, qser_data_call_error_e *err)
+{
+    //UNUSED(profile_idx);
+    UNUSED(ip_family);
+    //UNUSED(err);
+    if(err == NULL)
+    {
+        LOGE("[qser_data] err is NULL.");
+        return QSER_RESULT_FAIL;
+    }
+
+    if(qser_info_handle == NULL)
+    {
+        LOGE("[qser_data] handle is NULL.");
+        *err = QSER_DATA_CALL_ERROR_NO_INIT;
+        return QSER_RESULT_FAIL;
+    }
+
+    int ret = -1;
+    ret = mbtk_data_call_stop(qser_info_handle, profile_idx + 1, 15);
+    if(ret != 0)
+    {
+        LOGE("[qser_data] mbtk_data_call_stop fail.[ret = %d]", ret);
+        if(ret == MBTK_INFO_ERR_CID_NO_EXIST)
+        {
+            *err = QSER_DATA_CALL_ERROR_PDP_NO_ACTIVATE;
+        }
+        else
+        {
+            *err = QSER_DATA_CALL_ERROR_UNKNOWN;
+        }
+        return QSER_RESULT_FAIL;
+    }
+    else
+    {
+        *err = QSER_DATA_CALL_ERROR_NONE;
+    }
+
+    return QSER_RESULT_SUCCESS;
+}
+
+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)
+{
+    //UNUSED(profile_idx);
+    UNUSED(ip_family);
+    //UNUSED(info);
+    //UNUSED(err);
+
+    if(info == NULL || err == NULL)
+    {
+        LOGE("[qser_data] info or err is NULL.");
+        if(err != NULL)
+        {
+            *err = QSER_DATA_CALL_ERROR_INVALID_PARAMS;
+        }
+        return QSER_RESULT_FAIL;
+    }
+
+    if(qser_info_handle == NULL)
+    {
+        LOGE("[qser_data] handle is NULL.");
+        *err = QSER_DATA_CALL_ERROR_NO_INIT;
+        return QSER_RESULT_FAIL;
+    }
+
+    int ret = -1;
+    mbtk_ipv4_info_t ipv4;
+    mbtk_ipv6_info_t ipv6;
+#ifdef QSER_TEST
+    char v4_buff[32] = {0};
+    char v6_buff[128] = {0};
+#endif
+    memset(info, 0, sizeof(qser_data_call_info_s));
+    ret = mbtk_data_call_state_get(qser_info_handle, profile_idx + 1, &ipv4, &ipv6);
+    if(ret != 0)
+    {
+        LOGE("[qser_data] mbtk_data_call_state_get fail.[ret = %d]", ret);
+        if(ret == MBTK_INFO_ERR_CID_NO_EXIST)
+        {
+            *err = QSER_DATA_CALL_ERROR_PDP_NO_ACTIVATE;
+        }
+        else
+        {
+            *err = QSER_DATA_CALL_ERROR_UNKNOWN;
+        }
+        return QSER_RESULT_FAIL;
+    }
+    else
+    {
+        info->profile_idx = profile_idx;
+        if(ipv4.valid)
+        {
+            info->ip_family = QSER_DATA_CALL_TYPE_IPV4;
+            info->v4.state = QSER_DATA_CALL_CONNECTED;
+            sprintf(info->v4.name, "ccinet%d", profile_idx);
+            info->v4.addr.ip.s_addr = ipv4.IPAddr;
+            info->v4.addr.pri_dns.s_addr = ipv4.PrimaryDNS;
+            info->v4.addr.sec_dns.s_addr = ipv4.SecondaryDNS;
+
+#ifdef QSER_TEST
+            //LOGE("[qser_data] IP: %x pri_DNS: %x sec_DNS: %x.", ipv4.IPAddr, ipv4.PrimaryDNS, ipv4.SecondaryDNS);
+            if(inet_ntop(AF_INET, &(info->v4.addr.ip), v4_buff, 32) == NULL) {
+                LOGE("[qser_data] IP error.");
+            } else {
+                LOGE("[qser_data] IP : %s", v4_buff);
+            }
+            if(inet_ntop(AF_INET, &(info->v4.addr.pri_dns), v4_buff, 32) == NULL) {
+                LOGE("[qser_data] PrimaryDNS error.");
+            } else {
+                LOGE("[qser_data] PrimaryDNS : %s", v4_buff);
+            }
+            if(inet_ntop(AF_INET, &(info->v4.addr.sec_dns), v4_buff, 32) == NULL) {
+                LOGE("[qser_data] SecondaryDNS error.");
+            } else {
+                LOGE("[qser_data] SecondaryDNS : %s", v4_buff);
+            }
+#endif
+        }
+
+        if(ipv6.valid)
+        {
+            info->ip_family = QSER_DATA_CALL_TYPE_IPV6;
+            info->v6.state = QSER_DATA_CALL_CONNECTED;
+            sprintf(info->v6.name, "ccinet%d", profile_idx);
+            memcpy(&(info->v6.addr.ip), &(ipv6.IPV6Addr), sizeof(ipv6.IPV6Addr));
+            memcpy(&(info->v6.addr.pri_dns), &(ipv6.PrimaryDNS), sizeof(ipv6.PrimaryDNS));
+            memcpy(&(info->v6.addr.sec_dns), &(ipv6.SecondaryDNS), sizeof(ipv6.SecondaryDNS));
+#ifdef QSER_TEST
+			if(ipv6_2_str(&(info->v6.addr.ip), v6_buff))
+            {
+				LOGE("[qser_data] IP error.");
+			} else {
+				LOGE("[qser_data] IP : %s", v6_buff);
+			}
+			if(ipv6_2_str(&(info->v6.addr.pri_dns), v6_buff))
+            {
+				LOGE("[qser_data] PrimaryDNS error.");
+			} else {
+				LOGE("[qser_data] PrimaryDNS : %s", v6_buff);
+			}
+			if(ipv6_2_str(&(info->v6.addr.sec_dns), v6_buff))
+            {
+				LOGE("[qser_data] SecondaryDNS error.");
+			} else {
+				LOGE("[qser_data] SecondaryDNS : %s", v6_buff);
+            }
+#endif
+        }
+        
+        if(ipv4.valid && ipv6.valid)
+        {
+            info->ip_family = QSER_DATA_CALL_TYPE_IPV4V6;
+        }
+
+        if(!ipv4.valid && !ipv6.valid)
+        {
+            info->v4.state = QSER_DATA_CALL_DISCONNECTED;
+            info->v6.state = QSER_DATA_CALL_DISCONNECTED;
+        }
+    }
+    
+    *err = QSER_DATA_CALL_ERROR_NONE;
+    return QSER_RESULT_SUCCESS;
+}
+
+int qser_apn_set(qser_apn_info_s *apn)
+{
+    //UNUSED(apn);
+    if(qser_info_handle == NULL)
+    {
+        LOGE("[qser_data] handle is NULL.");
+        return QSER_RESULT_FAIL;
+    }
+    
+    if(apn == NULL)
+    {
+        LOGE("[qser_data] apn param is NULL.");
+        return QSER_RESULT_FAIL;
+    }
+
+    int ret = 0;
+    mbtk_qser_apn_info_s apninfo;
+    memset(&apninfo, 0x0, sizeof(mbtk_qser_apn_info_s));
+    apninfo.cid = apn->profile_idx + 1;
+    
+    if(apn->pdp_type == QSER_APN_PDP_TYPE_IPV4)
+    {
+        apninfo.ip_type = MBTK_IP_TYPE_IP;
+    }
+    else if(apn->pdp_type == QSER_APN_PDP_TYPE_IPV6)
+    {
+        apninfo.ip_type = MBTK_IP_TYPE_IPV6;
+    }
+    else if(apn->pdp_type == QSER_APN_PDP_TYPE_IPV4V6)
+    {
+        apninfo.ip_type = MBTK_IP_TYPE_IPV4V6;
+    }
+    else if(apn->pdp_type == QSER_APN_PDP_TYPE_PPP)
+    {
+        apninfo.ip_type = MBTK_IP_TYPE_PPP;
+    }
+    else
+    {
+        LOGE("[qser_data] pdp_type error.");
+        return QSER_RESULT_FAIL;
+    }
+
+    
+    apninfo.req_type = MBTK_APN_REQ_TYPE_SET;
+    apninfo.auth_proto = (mbtk_apn_auth_proto_enum)apn->auth_proto;
+    if(strlen(apn->apn_name))
+    {
+        memcpy(apninfo.apn_name, apn->apn_name, strlen(apn->apn_name));
+    }
+    else
+    {
+        LOGE("[qser_data] apn_name is NULL.");
+        return QSER_RESULT_FAIL;
+    }
+    if(strlen(apn->username))
+    {
+        memcpy(apninfo.user_name, apn->username, strlen(apn->username));
+    }
+    if(strlen(apn->password))
+    {
+        memcpy(apninfo.user_pass, apn->password, strlen(apn->password));
+    }
+    if(strlen(apn->apn_type))
+    {
+        memcpy(apninfo.apn_type, apn->apn_type, strlen(apn->apn_type));
+    }
+    ret = mbtk_qser_apn_set(qser_info_handle, &apninfo, NULL);
+    if(ret != 0)
+    {
+        LOGE("[qser_data] mbtk_qser_apn_set fail.");
+        return QSER_RESULT_FAIL;
+    }
+
+    return QSER_RESULT_SUCCESS;
+}
+
+int qser_apn_get(unsigned char profile_idx, qser_apn_info_s *apn)
+{
+    //UNUSED(profile_idx);
+    //UNUSED(apn);
+    if(qser_info_handle == NULL)
+    {
+        LOGE("[qser_data] handle is NULL.");
+        return QSER_RESULT_FAIL;
+    }
+    
+    if(apn == NULL)
+    {
+        LOGE("[qser_data] apn param is NULL.");
+        return QSER_RESULT_FAIL;
+    }
+
+    //get apn info
+    mbtk_qser_apn_info_s apns[10] = {0};
+    int apn_num = 10;
+    int ret = mbtk_qser_apn_get(qser_info_handle, &apn_num, apns);
+    if(ret != 0)
+    {
+        LOGE("[qser_data] mbtk_apn_get fail. [ret = %d]",ret);
+        return QSER_RESULT_FAIL;
+    }
+    else
+    {
+        int i = 0;
+        for(i = 0; i < apn_num; i++)
+        {
+            if(apns[i].cid == profile_idx + 1)
+            {
+                LOGE("[qser_data] find IDX.");
+                break;
+            }
+        }
+
+        if(i == apn_num)
+        {
+            LOGE("[qser_data] not find IDX.[apn_num = %d]", apn_num);
+            return QSER_RESULT_FAIL;
+        }
+
+        if(qser_apn_info_param_convert(profile_idx, apn, &apns[i]) != 0)
+        {
+            LOGE("[qser_data] qser_apn_info_param_convert fail");
+            return QSER_RESULT_FAIL;
+        }
+    }
+    return QSER_RESULT_SUCCESS;
+}
+
+int qser_apn_add(qser_apn_add_s *apn, unsigned char *profile_idx)
+{
+    //UNUSED(apn);
+    //UNUSED(profile_idx);
+    if(qser_info_handle == NULL)
+    {
+        LOGE("[qser_data] handle is NULL.");
+        return QSER_RESULT_FAIL;
+    }
+    
+    if(apn == NULL || profile_idx == NULL)
+    {
+        LOGE("[qser_data] apn param is NULL.");
+        return QSER_RESULT_FAIL;
+    }
+
+    int ret = 0;
+    unsigned char idx[2] = {0};
+    mbtk_qser_apn_info_s apninfo;
+    memset(&apninfo, 0x0, sizeof(mbtk_qser_apn_info_s));
+    apninfo.cid = 0;
+    
+    if(apn->pdp_type == QSER_APN_PDP_TYPE_IPV4)
+    {
+        apninfo.ip_type = MBTK_IP_TYPE_IP;
+    }
+    else if(apn->pdp_type == QSER_APN_PDP_TYPE_IPV6)
+    {
+        apninfo.ip_type = MBTK_IP_TYPE_IPV6;
+    }
+    else if(apn->pdp_type == QSER_APN_PDP_TYPE_IPV4V6)
+    {
+        apninfo.ip_type = MBTK_IP_TYPE_IPV4V6;
+    }
+    else if(apn->pdp_type == QSER_APN_PDP_TYPE_PPP)
+    {
+        apninfo.ip_type = MBTK_IP_TYPE_PPP;
+    }
+    else
+    {
+        LOGE("[qser_data] pdp_type error.");
+        return QSER_RESULT_FAIL;
+    }
+
+    apninfo.req_type = MBTK_APN_REQ_TYPE_ADD;
+    apninfo.auth_proto = (mbtk_apn_auth_proto_enum)apn->auth_proto;
+    if(strlen(apn->apn_name))
+    {
+        memcpy(apninfo.apn_name, apn->apn_name, strlen(apn->apn_name));
+    }
+
+    if(strlen(apn->username))
+    {
+        memcpy(apninfo.user_name, apn->username, strlen(apn->username));
+    }
+    if(strlen(apn->password))
+    {
+        memcpy(apninfo.user_pass, apn->password, strlen(apn->password));
+    }
+    if(strlen(apn->apn_type))
+    {
+        memcpy(apninfo.apn_type, apn->apn_type, strlen(apn->apn_type));
+    }
+    ret = mbtk_qser_apn_set(qser_info_handle, &apninfo, idx);
+    if(ret != 0)
+    {
+        LOGE("[qser_data] mbtk_qser_apn_set fail.");
+        return QSER_RESULT_FAIL;
+    }
+    *profile_idx = idx[0] - 1;
+    return QSER_RESULT_SUCCESS;
+}
+
+int qser_apn_del(unsigned char profile_idx)
+{
+    int ret = 0;
+
+    //UNUSED(profile_idx);
+    if(qser_info_handle == NULL)
+    {
+        LOGE("[qser_data] handle is NULL.");
+        return QSER_RESULT_FAIL;
+    }
+
+    ret = mbtk_apn_del(qser_info_handle, profile_idx);
+    if(ret < 0)
+    {
+        LOGE("[qser_data] mbtk_apn_del fail!");
+        return QSER_RESULT_FAIL;
+    }
+    return QSER_RESULT_SUCCESS;
+}
+
+int qser_apn_get_list(qser_apn_info_list_s *apn_list)
+{
+    //UNUSED(apn_list);
+
+    if(qser_info_handle == NULL)
+    {
+        LOGE("[qser_data] handle is NULL.");
+        return QSER_RESULT_FAIL;
+    }
+    
+    if(apn_list == NULL)
+    {
+        LOGE("[qser_data] apn_list param is NULL.");
+        return QSER_RESULT_FAIL;
+    }
+
+    mbtk_qser_apn_info_s apns[10] = {0};
+    int apn_num = 10;
+    int ret = mbtk_qser_apn_get(qser_info_handle, &apn_num, apns);
+    if(ret != 0)
+    {
+        if(ret == MBTK_INFO_ERR_NO_APN)
+        {
+            apn_list->cnt = 0;
+            return QSER_RESULT_SUCCESS;
+        }
+        LOGE("[qser_data] mbtk_apn_get fail. [ret = %d]",ret);
+        return QSER_RESULT_FAIL;
+    }
+    else
+    {
+        if(apn_num > 0 && apn_num <= QSER_APN_MAX_LIST)
+        {
+            int i = 0;
+            apn_list->cnt = 0;
+            for(i = 0; i < apn_num; i++)
+            {
+                if(qser_apn_info_param_convert(apns[i].cid - 1, &apn_list->apn[apn_list->cnt], &apns[i]) != 0)
+                {
+                    LOGE("[qser_data] qser_apn_info_param_convert fail");
+                    return QSER_RESULT_FAIL;
+                }
+                apn_list->cnt++;
+            }
+        }
+        else if(apn_num > QSER_APN_MAX_LIST)
+        {
+            LOGE("[qser_data] apn_num overlong");
+            return QSER_RESULT_FAIL;
+        }
+        else
+        {
+            apn_list->cnt = 0;
+        }
+    }
+    return QSER_RESULT_SUCCESS;
+}
+/****************************API***************************************/
+
diff --git a/mbtk/liblynq_lib_v2/src/lynq_fota.c b/mbtk/liblynq_lib_v2/src/lynq_fota.c
new file mode 100755
index 0000000..1ac1b68
--- /dev/null
+++ b/mbtk/liblynq_lib_v2/src/lynq_fota.c
@@ -0,0 +1,111 @@
+#include "lynq-qser-fota.h"
+#include "mbtk_type.h"
+#include "mbtk_fota.h"
+
+
+char addr_buf[128]={0};
+int segment_size =0;
+
+
+int Process_flag = 0;
+
+
+int fota_cb(int status, int percent)
+{
+//    printf("%d: percent: %d%%\n", percent/10, percent);
+    Process_flag = percent/10;
+    return 0;
+}
+
+int lynq_read_process(void)
+{
+    return Process_flag;
+}
+
+int lynq_rock_main(int first_run)
+{
+    UNUSED(first_run);
+    printf("%s, %d", __FUNCTION__, __LINE__);
+    int ret = 0;
+
+    printf("addr_buf:%s, segment_size:%d\n", addr_buf, segment_size);
+    ret = mbtk_fota_init(fota_cb);
+    if(!strcmp(addr_buf, "http"))
+    {
+    
+        ret = mbtk_fota_fw_write_by_url(addr_buf, segment_size,10, 600);
+    }
+    else
+    {
+        ret =mbtk_fota_fw_write(addr_buf, segment_size);
+    }
+
+    if(ret)
+    {
+        printf("lynq_rock_main fail\n");
+        return -1;
+    }
+
+    mbtk_fota_done1(1);
+
+
+    return 0;
+}
+
+int lynq_fota_set_addr_value(char *value,int size)
+{
+    UNUSED(value);
+    UNUSED(size);
+    printf("111%s, %d", __FUNCTION__, __LINE__);
+
+    if(value == NULL)
+    {
+        return -1;
+    }
+
+    memset(addr_buf, 0, sizeof(addr_buf));
+    memcpy(addr_buf, value, strlen(value));
+    segment_size = size;
+
+    printf("addr_buf:%s, value:%s\n", addr_buf, value);
+    printf("segment_size:%d, size:%d\n", segment_size, size);
+
+    return 0;
+}
+
+int lynq_fota_nrestart(void)
+{
+    printf("%s, %d", __FUNCTION__, __LINE__);
+    int ret = 0;
+
+    ret = mbtk_fota_init(fota_cb);
+    if(!strcmp(addr_buf, "http"))
+    {
+        ret = mbtk_fota_fw_write_by_url(addr_buf, segment_size,10, 600);
+    }
+    else
+    {
+        ret =mbtk_fota_fw_write(addr_buf, segment_size);
+    }
+
+    if(ret)
+    {
+        printf("lynq_fota_nrestart fail\n");
+        return -1;
+    }
+
+    return 0;
+}
+
+int lynq_get_upgrade_status(void)
+{
+    printf("%s, %d", __FUNCTION__, __LINE__);
+
+    return mbtk_fota_status();
+}
+
+int lynq_get_reboot_upgrade_status(void)
+{
+    return mbtk_fota_get_asr_reboot_cnt_flag();
+}
+
diff --git a/mbtk/liblynq_lib_v2/src/lynq_gnss.c b/mbtk/liblynq_lib_v2/src/lynq_gnss.c
new file mode 100755
index 0000000..2bb1fc1
--- /dev/null
+++ b/mbtk/liblynq_lib_v2/src/lynq_gnss.c
@@ -0,0 +1,485 @@
+#include <time.h>
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "lynq_gnss.h"
+
+#define QSER_RESULT_SUCCESS 0
+#define QSER_RESULT_FAIL -1
+#define QSER_GNSS_TIMEOUT 5
+
+/**********************************VARIABLE***********************************/
+static bool inited = FALSE;
+static uint32_t qser_h_gnss = 0x5F6F7F8F;
+gnss_handler_func_t qser_gnss_callback = NULL;
+static time_t qser_gnss_time = 0;
+qser_agps_info qser_agps_info_save = {0};
+gnss_async_func_t qser_gnss_async_callback = NULL;
+
+extern long timezone;
+/**********************************VARIABLE***********************************/
+
+/**********************************FUNC***********************************/
+static void qser_gnss_async_set_cb(gnss_async_func_t cb)
+{
+    qser_gnss_async_callback = cb;
+}
+
+static gnss_async_func_t qser_gnss_async_get_cb(void)
+{
+    return qser_gnss_async_callback;
+}
+
+
+static time_t qser_get_timestamp(char *time)
+{
+    char tmp_char[4] = {0};
+    struct tm* tmp_time = (struct tm*)malloc(sizeof(struct tm));
+
+    memset(tmp_time, 0, sizeof(struct tm));
+    memset(tmp_char, 0, sizeof(tmp_char));
+    memcpy(tmp_char, &time[4], 2);
+    tmp_time->tm_sec = atoi(tmp_char);
+    memcpy(tmp_char, &time[2], 2);
+    tmp_time->tm_min = atoi(tmp_char);
+    memcpy(tmp_char, &time[0], 2);
+    tmp_time->tm_hour = atoi(tmp_char);
+    memcpy(tmp_char, &time[6], 2);
+    tmp_time->tm_mday = atoi(tmp_char);
+    memcpy(tmp_char, &time[8], 2);
+    tmp_time->tm_mon = atoi(tmp_char) - 1;
+    memcpy(tmp_char, &time[10], 2);
+    tmp_time->tm_year = 100 + atoi(tmp_char);
+
+    time_t _t = mktime(tmp_time);//按当地时区解析tmp_time
+    //gnss_log("timestamp: %ld\n",_t);
+    tzset();   // 自动设置本地时区
+    _t = _t - timezone;
+    //gnss_log("timestamp: %ld\n",_t);
+
+    free(tmp_time);
+    return _t;
+}
+
+static time_t qser_get_gnss_time_sec(const void *data, int data_len)
+{
+    int i = 0, num = 0;
+    const char *nmea = (const char *)data;
+    char time[15] = {0};
+    char *check_state = NULL;
+
+    //$GNRMC,024142.000,A,3039.364421,N,10403.417935,E,0.051,0.00,030124,,E,A*00
+    check_state = strstr(nmea, "RMC");
+    if(check_state != NULL)
+    {
+        for(i = 0; i < data_len; i++)
+        {
+            if(check_state[i] == ',')
+            {
+                num++;
+                i++;
+                if(num == 1)//get time
+                {
+                    if(check_state[i] >= '0' && check_state[i] <= '9')
+                    {
+                        memcpy(time, check_state + i, 6);
+                        LOGE("[qser_gnss] %s.", time);
+                    }
+                    else
+                    {
+                        qser_gnss_time = 0;
+                        return qser_gnss_time;
+                    }
+                }
+                else if(num == 9)//get date
+                {
+                    if(check_state[i] >= '0' && check_state[i] <= '9')
+                    {
+                        memcpy(time + 6, check_state + i, 6);
+                        LOGE("[qser_gnss] %s.", time);
+                        break;
+                    }
+                    else
+                    {
+                        qser_gnss_time = 0;
+                        return qser_gnss_time;
+                    }
+                }
+                else if(num > 9)
+                {
+                    qser_gnss_time = 0;
+                    return qser_gnss_time;
+                }
+            }
+        }
+
+        qser_gnss_time = qser_get_timestamp(time);
+    }
+
+    return qser_gnss_time;
+}
+
+static void* gnss_async_thread(void* arg)
+{
+    qser_gnss_error_e state = QSER_GNSS_ERROR_SUCCESS;
+    gnss_async_func_t cb = qser_gnss_async_get_cb();
+    int ret = qser_Gnss_Start(qser_h_gnss);
+    if(ret != QSER_RESULT_SUCCESS)
+    {
+        LOGE("[qser_gnss] gnss_async_thread() fail.");
+        state = QSER_GNSS_ERROR_FAIL;
+    }
+
+    if(cb != NULL)
+    {
+        cb(state);
+    }
+    return NULL;
+}
+
+static void gnss_callback(uint32 ind_type, const void* data, uint32 data_len)
+{
+    if(data == NULL || data_len <= 0)
+    {
+        LOGE("[qser_gnss] data is NULL.");
+        return;
+    }
+
+    if(qser_gnss_callback == NULL)
+    {
+        //LOGE("[qser_gnss] qser_gnss_callback is NULL.");
+        return;
+    }
+    
+    if(ind_type == MBTK_GNSS_IND_LOCATION) {
+        if(data_len != sizeof(mbtk_gnss_location_info_t))
+		{
+			LOGE("[qser_gnss] data size error");
+			return;
+		}
+		mbtk_gnss_location_info_t *locl_info = (mbtk_gnss_location_info_t *)data;
+        mopen_location_info_t qser_locl_info;
+        memset(&qser_locl_info, 0x0, sizeof(mopen_location_info_t));
+        qser_locl_info.latitude  = locl_info->latitude;
+        qser_locl_info.longitude = locl_info->longitude;
+        qser_locl_info.altitude  = locl_info->altitude;
+        qser_locl_info.speed     = locl_info->speed;
+        qser_locl_info.bearing   = locl_info->bearing;
+        qser_locl_info.timestamp = locl_info->timestamp;
+        qser_gnss_callback(NULL, E_MT_LOC_MSG_ID_LOCATION_INFO, (void *)(&qser_locl_info), NULL);      
+    } else if(ind_type == MBTK_GNSS_IND_NMEA) {
+        mopen_gnss_nmea_info_t qser_nmea = {0};
+        memset(&qser_nmea, 0x0, sizeof(mopen_gnss_nmea_info_t));
+        qser_nmea.length = data_len;
+        memcpy(qser_nmea.nmea, (char *)data, data_len);
+        qser_nmea.timestamp = qser_get_gnss_time_sec(data, data_len);
+        qser_gnss_callback(NULL, E_MT_LOC_MSG_ID_NMEA_INFO, (void *)(&qser_nmea), NULL);
+    } else {
+        printf("Unknown IND : %d\n", ind_type);
+    }
+}
+
+
+/**********************************FUNC***********************************/
+
+/**********************************API***********************************/
+int qser_Gnss_Init (uint32_t *h_gnss)
+{
+    //UNUSED(h_gnss);
+    gnss_err_enum ret = GNSS_ERR_UNKNOWN;
+
+    if(!inited)
+    {
+        ret = mbtk_gnss_init(gnss_callback);
+        if(ret == GNSS_ERR_OK)
+        {
+            ret = mbtk_gnss_ind_set(MBTK_GNSS_IND_NMEA, QSER_GNSS_TIMEOUT);
+            if(ret == GNSS_ERR_OK)
+            {
+                inited = TRUE;
+            }
+            else
+            {
+                LOGE("[qser_gnss] init mbtk_gnss_ind_set() fail.");
+                return QSER_RESULT_FAIL;
+            }
+        }
+        else
+        {
+            LOGE("[qser_gnss] mbtk_gnss_init() fail.");
+            return QSER_RESULT_FAIL;
+        }
+    }
+    *h_gnss = qser_h_gnss;
+
+    return QSER_RESULT_SUCCESS;
+}
+
+int qser_Gnss_Deinit (uint32_t h_gnss)
+{
+    //UNUSED(h_gnss);
+    if(h_gnss != qser_h_gnss)
+    {
+        LOGE("[qser_gnss] h_gnss is error.");
+        return QSER_RESULT_FAIL;
+    }
+    
+    gnss_err_enum ret = GNSS_ERR_UNKNOWN;
+
+    if(inited)
+    {
+        ret = mbtk_gnss_deinit();
+        if(ret == GNSS_ERR_OK)
+        {
+            inited = FALSE;
+        }
+        else
+        {
+            LOGE("[qser_gnss] mbtk_gnss_init() fail.");
+            return QSER_RESULT_FAIL;
+        }
+    }
+
+    return QSER_RESULT_SUCCESS;
+}
+
+int qser_AddRxIndMsgHandler (gnss_handler_func_t handler_ptr,uint32_t h_gnss)
+{
+    //UNUSED(handler_ptr);
+    //UNUSED(h_gnss);
+    if(h_gnss != qser_h_gnss)
+    {
+        LOGE("[qser_gnss] h_gnss is error.");
+        return QSER_RESULT_FAIL;
+    }
+
+    if(handler_ptr == NULL)
+    {
+        LOGE("[qser_gnss] handler_ptr is NULL.");
+        return QSER_RESULT_FAIL;
+    }
+    
+    qser_gnss_callback = handler_ptr;
+    return QSER_RESULT_SUCCESS;
+}
+
+int qser_Set_Indications (uint32_t h_gnss,e_msg_id_t type)
+{
+    //UNUSED(h_gnss);
+    //UNUSED(type);
+    if(h_gnss != qser_h_gnss)
+    {
+        LOGE("[qser_gnss] h_gnss is error.");
+        return QSER_RESULT_FAIL;
+    }
+
+    gnss_err_enum ret = GNSS_ERR_OK;
+    if(type == E_MT_LOC_MSG_ID_LOCATION_INFO)
+    {
+        ret = mbtk_gnss_ind_set(MBTK_GNSS_IND_LOCATION, QSER_GNSS_TIMEOUT);
+    }
+    else if(type == E_MT_LOC_MSG_ID_NMEA_INFO)
+    {
+        ret = mbtk_gnss_ind_set(MBTK_GNSS_IND_NMEA, QSER_GNSS_TIMEOUT);
+    }
+    else
+    {
+        LOGE("[qser_gnss] type is fail.");
+        return QSER_RESULT_FAIL;
+    }
+
+    if(ret != GNSS_ERR_OK)
+    {
+        LOGE("[qser_gnss] mbtk_gnss_ind_set() fail.");
+        return QSER_RESULT_FAIL;
+    }
+    return QSER_RESULT_SUCCESS;
+}
+
+int qser_Gnss_Set_Async_Callback(gnss_async_func_t cb)
+{
+    qser_gnss_async_set_cb(cb);
+    return QSER_RESULT_SUCCESS;
+}
+
+int qser_Gnss_Start (uint32_t h_gnss)
+{
+    //UNUSED(h_gnss);
+    if(h_gnss != qser_h_gnss)
+    {
+        LOGE("[qser_gnss] h_gnss is error.");
+        return QSER_RESULT_FAIL;
+    }
+
+    gnss_err_enum ret = GNSS_ERR_UNKNOWN;
+
+    ret = mbtk_gnss_open(255, QSER_GNSS_TIMEOUT);
+    if(ret != GNSS_ERR_OK)
+    {
+        LOGE("[qser_gnss] mbtk_gnss_open is error.");
+        return QSER_RESULT_FAIL;
+    }
+    
+    return QSER_RESULT_SUCCESS;
+}
+
+int qser_Gnss_Start_Async(uint32_t h_gnss)
+{
+    //UNUSED(h_gnss);
+    if(h_gnss != qser_h_gnss)
+    {
+        LOGE("[qser_gnss] h_gnss is error.");
+        return QSER_RESULT_FAIL;
+    }
+
+    pthread_attr_t thread_attr;
+    pthread_t gnss_thread_id;
+    pthread_attr_init(&thread_attr);
+    if(pthread_attr_setdetachstate(&thread_attr, PTHREAD_CREATE_DETACHED))
+    {
+        LOGE("[qser_gnss] pthread_attr_setdetachstate() fail.");
+        return QSER_RESULT_FAIL;
+    }
+
+    //memcpy(&qser_data_backup, data_call, sizeof(qser_data_call_s));
+    if(pthread_create(&gnss_thread_id, &thread_attr, gnss_async_thread, NULL))
+    {
+        LOGE("[qser_gnss] pthread_create() fail.");
+        return QSER_RESULT_FAIL;
+    }
+    pthread_attr_destroy(&thread_attr);
+    
+    return QSER_RESULT_SUCCESS;
+}
+
+int qser_Gnss_Stop (uint32_t h_gnss)
+{
+    //UNUSED(h_gnss);
+    if(h_gnss != qser_h_gnss)
+    {
+        LOGE("[qser_gnss] h_gnss is error.");
+        return QSER_RESULT_FAIL;
+    }
+
+    gnss_err_enum ret = GNSS_ERR_UNKNOWN;
+    ret = mbtk_gnss_close(QSER_GNSS_TIMEOUT);
+    if(ret != GNSS_ERR_OK)
+    {
+        LOGE("[qser_gnss] mbtk_gnss_close is error.");
+        return QSER_RESULT_FAIL;
+    }
+    
+    return QSER_RESULT_SUCCESS;
+}
+
+int qser_Gnss_InjectTime (uint32_t h_gnss,LYNQ_INJECT_TIME_INTO_T *time_info)
+{
+    //UNUSED(h_gnss);
+    UNUSED(time_info);
+
+    if(h_gnss != qser_h_gnss)
+    {
+        LOGE("[qser_gnss] h_gnss is error.");
+        return QSER_RESULT_FAIL;
+    }
+    return QSER_RESULT_SUCCESS;
+}
+
+int qser_Gnss_Delete_Aiding_Data (uint32_t h_gnss,DELETE_AIDING_DATA_TYPE_T flags)
+{
+    //UNUSED(h_gnss);
+    //UNUSED(flags);
+    
+    if(h_gnss != qser_h_gnss)
+    {
+        LOGE("[qser_gnss] h_gnss is error.");
+        return QSER_RESULT_FAIL;
+    }
+    return QSER_RESULT_SUCCESS;
+}
+
+int qser_Gnss_Server_Configuration(char *host, char *id, char *password)
+{
+    //UNUSED(host);
+    //UNUSED(id);
+    //UNUSED(password);
+
+    if(!inited)
+    {
+        LOGE("[qser_gnss] api not init.");
+        return QSER_RESULT_FAIL;
+    }
+    
+    if(host != NULL)
+    {
+        memcpy(qser_agps_info_save.host, host, QSER_LEN_MAX);
+    }
+
+    if(id != NULL)
+    {
+        memcpy(qser_agps_info_save.id, id, QSER_LEN_MAX);
+    }
+
+    if(password != NULL)
+    {
+        memcpy(qser_agps_info_save.passwd, password, QSER_LEN_MAX);
+    }
+    return QSER_RESULT_SUCCESS;
+}
+
+int qser_Gnss_download_tle()
+{
+    if(!inited)
+    {
+        LOGE("[qser_gnss] api not init.");
+        return QSER_RESULT_FAIL;
+    }
+    return QSER_RESULT_SUCCESS;
+}
+
+int qser_Gnss_injectEphemeris(uint32_t h_gnss)
+{
+    //UNUSED(h_gnss);
+
+    if(h_gnss != qser_h_gnss)
+    {
+        LOGE("[qser_gnss] h_gnss is error.");
+        return QSER_RESULT_FAIL;
+    }
+    return QSER_RESULT_SUCCESS;
+}
+
+int qser_Gnss_Set_Frequency(uint32_t h_gnss, int frequency)
+{
+    //UNUSED(h_gnss);
+    //UNUSED(frequency);
+
+    if(h_gnss != qser_h_gnss)
+    {
+        LOGE("[qser_gnss] h_gnss is error.");
+        return QSER_RESULT_FAIL;
+    }
+
+    if(frequency != 1 && frequency != 2 && frequency != 5)
+    {
+        LOGE("[qser_gnss] frequency out of range.");
+        return QSER_RESULT_FAIL;
+    }
+
+    gnss_err_enum ret = GNSS_ERR_UNKNOWN;    
+    char param_buf[32] = {0};
+    int  length = 0;
+    length = snprintf(param_buf, 32, "$FREQCFG,%d", frequency);
+    ret = mbtk_gnss_setting(param_buf, QSER_GNSS_TIMEOUT);
+    if(ret != GNSS_ERR_OK)
+    {
+        LOGE("[qser_gnss] mbtk_gnss_setting fail.");
+        return QSER_RESULT_FAIL;
+    }
+    return QSER_RESULT_SUCCESS;
+}
+/**********************************API***********************************/
+
+
diff --git a/mbtk/liblynq_lib_v2/src/lynq_gpio.c b/mbtk/liblynq_lib_v2/src/lynq_gpio.c
new file mode 100755
index 0000000..4dcd694
--- /dev/null
+++ b/mbtk/liblynq_lib_v2/src/lynq_gpio.c
@@ -0,0 +1,339 @@
+#include "mbtk_type.h"
+#include "lynq-gpio.h"
+#include "unistd.h"
+#include "fcntl.h"
+#include "mbtk_log.h"
+
+#include <errno.h>
+static int gpio_export(int gpio)
+{
+    int index=0;
+    int file=-1;
+    int result =-1;
+    char pin_index_buffer[5]= {0};
+
+    char buffer[50];
+    memset(buffer,0,50);
+    sprintf(buffer,"/sys/class/gpio/gpio%d/direction", gpio);
+    if(access(buffer , F_OK) == 0)
+    {
+        LOGD("%d has export.", gpio);
+        return 0;
+    }
+
+    file = open("/sys/class/gpio/export",O_WRONLY);
+    if(file == -1)
+    {
+        LOGE("Open gpio export file fail.");
+        return -1;
+    }
+
+    memset(pin_index_buffer,0,5);
+    sprintf(pin_index_buffer,"%d", gpio);
+    result = write(file,pin_index_buffer,strlen(pin_index_buffer));
+    if(result < 0)
+    {
+        LOGE("Gpio[%d] export fail. err = %d", gpio, errno);
+        close(file);
+        return -1;
+    }
+    close(file);
+
+    return 0;
+}
+
+static int gpio_unexport(int gpio)
+{
+    int index=0;
+    int file=-1;
+    int result =-1;
+    char pin_index_buffer[5]= {0};
+    char buffer[50];
+    memset(buffer,0,50);
+    sprintf(buffer,"/sys/class/gpio/gpio%d/direction", gpio);
+    if(access(buffer , F_OK) == -1)
+    {
+        LOGD("%d not export.", gpio);
+        return 0;
+    }
+
+    file = open("/sys/class/gpio/unexport",O_WRONLY);
+    if(file == -1)
+    {
+        LOGE("Open gpio unexport file fail.");
+        return -1;
+    }
+
+    memset(pin_index_buffer,0,5);
+    sprintf(pin_index_buffer,"%d", gpio);
+    result=write(file,pin_index_buffer,strlen(pin_index_buffer));
+    if(result < 0)
+    {
+        close(file);
+        LOGE("Gpio[%d] unexport fail.", gpio);
+        return -1;
+    }
+    close(file);
+
+    return 0;
+}
+
+static int gpio_direct_get(int gpio, char *value, int value_size)
+{
+    char buffer[50]= {0};
+    int file =-1;
+    int result =-1;
+
+    memset(buffer,0,50);
+    sprintf(buffer,"/sys/class/gpio/gpio%d/direction", gpio);
+    file = open(buffer, O_RDONLY);
+    if(file == -1)
+    {
+        LOGE("Open gpio[%d] direct fail.", gpio);
+        return -1;
+    }
+
+    memset(value, 0x0, value_size);
+    result = read(file,value,value_size);
+    if(result <= 0)
+    {
+        LOGE("Get gpio[%d] direct fail.", gpio);
+        close(file);
+        return -1;
+    }
+    close(file);
+
+    return 0;
+}
+
+
+static int gpio_direct_set(int gpio, char *value)
+{
+    char buffer[50]= {0};
+    int file =-1;
+    int result =-1;
+
+    memset(buffer,0,50);
+    sprintf(buffer,"/sys/class/gpio/gpio%d/direction", gpio);
+    file = open(buffer, O_WRONLY);
+    if(file == -1)
+    {
+        LOGE("Open gpio[%d] direct fail.", gpio);
+        return -1;
+    }
+
+    result = write(file,value,strlen(value));
+    if(result != strlen(value))
+    {
+        LOGE("Set gpio[%d] direct fail.", gpio);
+        close(file);
+        return -1;
+    }
+    close(file);
+
+    return 0;
+}
+
+static int gpio_value_get(int gpio)
+{
+    char buffer[50];
+    char path[10];
+    int file =-1;
+    int result =-1;
+    int value;
+
+    memset(path,0,50);
+    memset(buffer,0,10);
+    sprintf(path,"/sys/class/gpio/gpio%d/value", gpio);
+    file = open(path,O_RDONLY);
+    if(file == -1)
+    {
+        LOGE("Open gpio[%d] fail.", gpio);
+        return -1;
+    }
+    result = read(file,buffer,5);
+    if(result <= 0)
+    {
+        LOGE("Get gpio[%d] value fail", gpio);
+        close(file);
+        return -1;
+    }
+    close(file);
+    value = atoi(buffer);
+    return value;
+}
+
+static int gpio_value_set(int gpio, int value)
+{
+    char buffer[50]= {0};
+    int file =-1;
+    int result =-1;
+
+    memset(buffer,0,50);
+    sprintf(buffer,"/sys/class/gpio/gpio%d/value", gpio);
+    file = open(buffer,O_WRONLY);
+    if(file == -1)
+    {
+        LOGE("Open gpio[%d] value fail.", gpio);
+        return -1;
+    }
+    if(value == 0) {
+        result = write(file,"0",1);
+    } else {
+        result = write(file,"1",1);
+    }
+    if(result != 1)
+    {
+        LOGE("Set gpio[%d] value fail err =%d.", gpio, errno);
+        close(file);
+        return -1;
+    }
+    close(file);
+
+    return 0;
+}
+
+
+int lynq_gpio_init(int gpio, int direction, int value, int pullsel)
+{
+    //UNUSED(gpio);
+    //UNUSED(direction);
+    //UNUSED(value);
+    UNUSED(pullsel);
+
+    if (direction != 1 && direction != 0)
+    {
+        LOGE("[lynq_gpio_init] direction fail.");
+        return -1;
+    }
+
+    if (value != 1 && value != 0)
+    {
+        LOGE("[lynq_gpio_init] value fail.");
+        return -1;
+    }
+
+    if(gpio_export(gpio))
+    {
+        LOGE("[lynq_gpio_init]gpio_export fail.");
+        return -1;
+    }
+
+    if(gpio_direct_set(gpio, direction == 0 ? "in" : "out"))
+    {
+        LOGE("[lynq_gpio_init]gpio_direct_set fail.");
+        return -1;
+    }
+
+    if(direction == 1 && (gpio_value_set(gpio, value) != 0))
+    {
+        LOGE("[lynq_gpio_init]gpio_value_set fail.");
+        return -1;
+    }
+
+
+    return 0;
+}
+
+int lynq_gpio_deinit(int gpio)
+{
+    UNUSED(gpio);
+
+    if(gpio_unexport(gpio))
+    {
+        LOGE("[lynq_gpio_deinit]gpio_unexport fail.");
+        return -1;
+    }
+
+    return 0;
+}
+
+int lynq_gpio_direction_set(int gpio, int direction)
+{
+    //UNUSED(gpio);
+    //UNUSED(direction);
+
+    if(gpio_direct_set(gpio, direction == 0 ? "in" : "out"))
+    {
+        LOGE("[lynq_gpio_direction_set]gpio_direct_set fail.");
+        return -1;
+    }
+
+    return 0;
+}
+
+
+int lynq_gpio_value_set(int gpio, int value)
+{
+    //UNUSED(gpio);
+    //UNUSED(value);
+
+    if(gpio_value_set(gpio, value))
+    {
+        LOGE("[lynq_gpio_value_set]gpio_value_set fail.");
+        return -1;
+    }
+
+    return 0;
+}
+
+int lynq_gpio_value_get(int gpio)
+{
+    //UNUSED(gpio);
+    int ret = -1;
+
+    ret = gpio_value_get(gpio);
+    if (ret == -1)
+    {
+        LOGE("[lynq_gpio_value_get]gpio_value_get fail.");
+        return -1;
+    }
+
+    return ret;
+}
+
+int lynq_gpio_pullsel_set(int gpio, int pullsel)
+{
+    //UNUSED(gpio);
+    //UNUSED(pullsel);
+    int ret = -1;
+    int value_t;
+
+    if (pullsel == 1)
+        value_t = 0;
+    else if (pullsel == 2)
+        value_t = 1;
+    else
+    {
+        LOGE("[lynq_gpio_pullsel_set] value_t fail.");
+        return -1;
+    }
+
+    ret = gpio_value_set(gpio, value_t);
+    if(ret == -1)
+    {
+        LOGE("[lynq_gpio_pullsel_set]gpio_value_set() fail.");
+        return -1;
+    }
+
+    return ret;
+}
+
+
+int lynq_gpio_pullsel_get(int gpio)
+{
+    //UNUSED(gpio);
+    int ret = -1;
+
+    ret = gpio_value_get(gpio);
+    if (ret == -1)
+    {
+        LOGE("[lynq_gpio_pullsel_get]gpio_value_get() fail.");
+        return -1;
+    }
+
+    return ret + 1;
+}
+
+
+
diff --git a/mbtk/liblynq_lib_v2/src/lynq_irq.c b/mbtk/liblynq_lib_v2/src/lynq_irq.c
new file mode 100755
index 0000000..c6050ae
--- /dev/null
+++ b/mbtk/liblynq_lib_v2/src/lynq_irq.c
@@ -0,0 +1,498 @@
+#include "lynq-irq.h"
+#include "mbtk_type.h"
+#include "mbtk_info_api.h"
+#include "mbtk_log.h"
+
+
+#include <ctype.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <pthread.h>
+
+#define _GNU_SOURCE
+
+#include <errno.h>
+#include <fcntl.h>
+#include <limits.h>
+#include <poll.h>
+
+#include <sys/ioctl.h>
+#include <sys/stat.h>
+#include <sys/sysmacros.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+
+struct libirq_info {
+	unsigned int 	line;
+	unsigned int 	type;
+	int 			wake;
+	int				fd;
+	irq_handler 	handler;
+	unsigned int 	used;
+};
+
+struct libirq_context {
+	unsigned int		inited;
+	int					fd;
+	pthread_t 			th;
+	struct libirq_info	info[SC_LIBIRQ_MAX];
+};
+static struct libirq_context irq_ctx = {0};
+
+#define irq_init()			irq_ctx.inited
+#define line_used(l)		irq_ctx.info[l].used
+#define irq_fd(l)			irq_ctx.info[l].fd
+#define libirq_fd()			irq_ctx.fd
+
+static void *libirq_loop(void *arg)
+{
+	unsigned int int_status = 0;
+	int fd = libirq_fd();
+	int ret = 0;
+	int i;
+
+	while(1) {
+	    ret = ioctl(fd, SC_IRQ_GET_STATUS, &int_status);
+		if (ret < 0) {
+			LOGE("libirq_loop get status failed:%d", ret);
+		} else {
+/*			printf("libirq_loop get status :0x%x\n", int_status); */
+		}
+
+		for (i=0; i<SC_LIBIRQ_MAX; i++) {
+			if ((int_status & (1<<i)) && line_used(i) && irq_ctx.info[i].handler) {
+				irq_ctx.info[i].handler();
+
+			    ret = ioctl(fd, SC_IRQ_CLEAR_STATUS, 0);
+				if (ret < 0) {
+					LOGE("libirq_loop clear status failed:%d", ret);
+				}
+			}
+		}
+	}
+
+	return NULL;
+}
+
+static int libirq_init_thread(void)
+{
+	int ret = 0;
+	pthread_attr_t attribute;
+
+    pthread_attr_init(&attribute);
+    pthread_attr_setstacksize(&attribute, 32*1024);
+
+	ret = pthread_create(&irq_ctx.th, &attribute, libirq_loop, NULL);
+	if(ret) {
+		return ret;
+	}
+
+	return 0;
+}
+
+/*
+ *  Add a handler for an interrupt line.
+ *
+ *  line      		:  The interrupt line
+ *  handler         :  Function to be called when the IRQ occurs.
+ *  trig_type		:  rising edge or fallling edge
+ *
+ *  return 0 if succeed, others failed
+ */
+int sc_irq_install(unsigned int line, irq_handler handler, int trig_type)
+{
+	int fd;
+	struct libirq_info *info;
+	char *usr_name;
+	int ret = 0;
+
+	if ((line >= SC_LIBIRQ_MAX) || (handler == NULL) || (trig_type >= SC_LIBIRQ_TYPE_MAX))
+		return -EINVAL;
+
+	if (line_used(line))
+		return -EEXIST;
+
+	ret = asprintf(&usr_name, "%s%d", SC_IRQ_DEV, line);
+	if (ret < 0) {
+		return -ENOMEM;
+	}
+
+	fd = open(usr_name, O_RDWR);
+	if(fd < 0) {
+		free(usr_name);
+		return -ENODEV;
+	}
+	irq_fd(line) = fd;
+	free(usr_name);
+	info = &irq_ctx.info[line];
+	info->line = line;
+	info->type = trig_type;
+	info->handler = handler;
+
+    if (ioctl(fd, SC_IRQ_INSTALL, trig_type) < 0) {
+        return -EPERM;
+    }
+
+	line_used(line) = 1;
+
+	if (!irq_init()) {
+		ret = libirq_init_thread();
+		if (ret) {
+			LOGE("libirq_init_thread, err:%d", ret);
+			return ret;
+		}
+
+		libirq_fd() = fd;
+		irq_init() = 1;
+	}
+
+	return 0;
+}
+
+/*
+ *  free an interrupt allocated with sc_irq_install.
+ *
+ *  line      		:  The interrupt line
+ *
+ *  return 0 if succeed, others failed
+ */
+int sc_irq_uninstall(unsigned int line)
+{
+	int fd;
+
+	if (line >= SC_LIBIRQ_MAX)
+		return -EINVAL;
+
+	if (!line_used(line))
+		return -ENODEV;
+
+    if (ioctl(irq_fd(line), SC_IRQ_UNINSTALL, 0) < 0) {
+        return -EPERM;
+    }
+
+	fd = libirq_fd();
+	if (fd)
+		close(fd);
+
+	line_used(line) = 0;
+
+	return 0;
+}
+
+/*
+ *  set the irq trigger type for an irq.
+ *
+ *  line      		:  The interrupt line
+ *  trig_type		:  edge or level type
+ *
+ *  return 0 if succeed, others failed
+ */
+int sc_irq_set_type(unsigned int line, int trig_type)
+{
+	struct libirq_info *info;
+
+	if ((line >= SC_LIBIRQ_MAX) || (trig_type >= SC_LIBIRQ_TYPE_MAX))
+		return -EINVAL;
+
+	if (!line_used(line))
+		return -EEXIST;
+
+	info = &irq_ctx.info[line];
+	if (info->type != trig_type) {
+	    if (ioctl(irq_fd(line), SC_IRQ_SET_TYPE, trig_type) < 0) {
+			return -EPERM;
+		}
+	}
+
+	info->type = trig_type;
+
+	return 0;
+}
+
+/*
+ *  get the irq trigger type for an irq.
+ *
+ *  line      		:  The interrupt line
+ *  trig_type		:  edge or level type
+ *
+ *  return 0 if succeed, others failed
+ */
+int sc_irq_get_type(unsigned int line, int *trig_type)
+{
+	struct libirq_info *info;
+
+	if ((line >= SC_LIBIRQ_MAX) || !trig_type)
+		return -EINVAL;
+
+	if (!line_used(line))
+		return -EEXIST;
+
+	info = &irq_ctx.info[line];
+	*trig_type = info->type;
+
+	return 0;
+}
+
+/*
+ *  control irq power management wakeup.
+ *
+ *  line      		:  The interrupt line
+ *  en				:  enable/disable power management wakeup
+ *
+ *  return 0 if succeed, others failed
+ */
+int sc_irq_set_wake(unsigned int line, int en)
+{
+	struct libirq_info *info;
+
+	if (line >= SC_LIBIRQ_MAX)
+		return -EINVAL;
+
+	if (!line_used(line))
+		return -EEXIST;
+
+	info = &irq_ctx.info[line];
+	if (info->wake != en) {
+	    if (ioctl(irq_fd(line), SC_IRQ_SET_WAKE, en) < 0) {
+			return -EPERM;
+		}
+	}
+
+	info->wake = en;
+
+	return 0;
+}
+
+/*
+ *  get the irq awake status for an irq.
+ *
+ *  line      		:  The interrupt line
+ *  en				:  enable/disable power management wakeup
+ *
+ *  return 0 if succeed, others failed
+ */
+int sc_irq_get_wake(unsigned int line, int *en)
+{
+	struct libirq_info *info;
+	unsigned int wake;
+
+	if (line >= SC_LIBIRQ_MAX)
+		return -EINVAL;
+
+	if (!line_used(line))
+		return -EEXIST;
+	
+	if (ioctl(irq_fd(line), SC_IRQ_GET_WAKE, &wake) < 0) {
+		return -EPERM;
+	}
+
+	info = &irq_ctx.info[line];
+	info->wake = wake;
+	*en = wake;
+
+	return 0;
+}
+
+
+
+
+/*****************************************
+* @brief:lynq_irq_install
+* @param count [IN]:2
+* @param sum [OUT]:NA
+* @return :success 0, failed other
+* @todo:NA
+* @see:NA
+* @warning:NA
+******************************************/
+
+int lynq_irq_install(int line, irq_handler irq_test_handler, trig_type_e trig_type)
+{
+    int ret;
+    if(trig_type < 0)
+    {
+        return -1;
+    }
+#if defined(MBTK_PROJECT_T108)
+
+    if (trig_type != 0 && trig_type != 1)
+    {
+        LOGE("lynq_irq_install error trig_type:%d", trig_type);
+        return -1;
+    }
+
+    line = line-117;
+
+    if (line < 0)
+    {
+        LOGE("lynq_irq_install error line:%d", line);
+        return -1;
+    }
+
+#endif
+
+    ret = sc_irq_install(line, irq_test_handler, trig_type);
+    if (ret != 0)
+    {
+        LOGE("do_install_irq failed, ret:%d", ret);
+        return ret;
+    }
+    return 0;
+}
+
+
+/*****************************************
+* @brief:lynq_irq_uninstall
+* @param count [IN]:2
+* @param sum [OUT]:NA
+* @return :success 0, failed other
+* @todo:NA
+* @see:NA
+* @warning:NA
+******************************************/
+
+int lynq_irq_uninstall(int line)
+{
+#if defined(MBTK_PROJECT_T108)
+        line = line-117;
+#endif
+
+    int ret;
+    ret = sc_irq_uninstall(line);
+    if (ret != 0)
+    {
+        LOGE("unistall failed, ret:%d", ret);
+        return ret;
+    }
+    LOGI("uninstall irq(%d) ok", line);
+    return 0;
+}
+
+
+/*****************************************
+* @brief:lynq_irq_set_type
+* @param count [IN]:2
+* @param sum [OUT]:NA
+* @return :success 0, failed other
+* @todo:NA
+* @see:NA
+* @warning:NA
+******************************************/
+int lynq_irq_set_type(int line, int trig_type)
+{
+#if defined(MBTK_PROJECT_T108)
+        line = line-117;
+
+    if (trig_type != 0 && trig_type != 1)
+    {
+        LOGE("lynq_irq_set_type error trig_type:%d", trig_type);
+        return -1;
+    }
+#endif
+
+    int ret;
+    if(trig_type < 0)
+    {
+        return -1;
+    }
+    ret = sc_irq_set_type(line, trig_type);
+    if (ret != 0)
+    {
+        LOGE("set_type failed, ret:%d", ret);
+        return ret;
+    }
+    return 0;
+
+}
+
+/*****************************************
+* @brief:lynq_irq_get_type
+* @param count [IN]:1
+* @param sum [OUT]:NA
+* @return :success >= 0, failed other
+* @todo:NA
+* @see:NA
+* @warning:NA
+******************************************/
+int lynq_irq_get_type(int line)
+{
+#if defined(MBTK_PROJECT_T108)
+        line = line-117;
+#endif
+
+    int ret;
+    int trig_type;
+    ret = sc_irq_get_type(line, &trig_type);
+    if (ret != 0)
+    {
+        LOGE("get_type failed, ret:%d", ret);
+        return ret;
+    }
+    LOGI("get_type readback(%d)", trig_type);
+    return trig_type;
+}
+
+
+/*****************************************
+* @brief:lynq_irq_set_wake
+* @param count [IN]:2
+* @param sum [OUT]:NA
+* @return :success 0, failed other
+* @todo:NA
+* @see:NA
+* @warning:NA
+******************************************/
+int lynq_irq_set_wake(int line, int en)
+{
+#if defined(MBTK_PROJECT_T108)
+        line = line-117;
+#endif
+
+    int ret;
+    if((en != 0) && (en != 1))
+    {
+        LOGE("wake_state is not 0 or 1");
+        return -1;
+    }
+
+    ret = sc_irq_set_wake(line, en);
+    if (ret != 0)
+    {
+        LOGE("set_wake failed, ret:%d", ret);
+        return ret;
+    }
+    return 0;
+}
+
+/*****************************************
+* @brief:lynq_irq_get_wake
+* @param count [IN]:1
+* @param sum [OUT]:NA
+* @return :success >= 0, failed other
+* @todo:NA
+* @see:NA
+* @warning:NA
+******************************************/
+int lynq_irq_get_wake(int line)
+{
+#if defined(MBTK_PROJECT_T108)
+        line = line-117;
+#endif
+
+    int ret;
+    int en;
+    ret = sc_irq_get_wake(line, &en);
+    if (ret != 0)
+    {
+        LOGE("get_wake failed, ret:%d", ret);
+        return ret;
+    }
+
+    LOGI("get_wake readback(%d)", en);
+    return en;
+}
+
+
+
diff --git a/mbtk/liblynq_lib_v2/src/lynq_log.c b/mbtk/liblynq_lib_v2/src/lynq_log.c
new file mode 100755
index 0000000..e096f8a
--- /dev/null
+++ b/mbtk/liblynq_lib_v2/src/lynq_log.c
@@ -0,0 +1,494 @@
+#include <stdarg.h>
+#include <sys/un.h>
+#include <sys/socket.h>
+#include "json-c/json.h"
+#include "lynq_deflog.h"
+#include "mbtk_type.h"
+
+#define LOG_CONFIG_PATH     "/etc/mbtk/mbtk_log.json"
+#define SYSLOG_PATCH "syslog"
+#define SYSLOG_NAME "syslog"
+#define SYSLOG_INDEX 0
+
+void lynq_log_configuration_init(const char *log_name)
+{
+    //UNUSED(log_name);
+    mbtk_log_init(SYSLOG_PATCH, log_name);
+}
+
+void lynq_log_global_output(log_level_enum Level,const char *format,...)
+{
+    va_list args;
+    va_start(args,format);
+    mbtk_log(Level, format, args);
+    va_end(args);
+}
+
+const char* lynq_read_log_version()
+{
+    return "LOG-V1.0";
+}
+
+int lynq_syslog_set_file_size(int value)
+{
+//    UNUSED(value);
+    json_object* jsonobj = NULL;
+    json_object* tmpjson = NULL;
+    json_object* datajson = NULL;
+    json_object* listjson = NULL;
+
+    int tmp_int;
+    char* tmp_string = NULL;
+
+    if(value < 1)
+    {
+        value = 1;
+    }
+    else if(value > 100)
+    {
+        value = 100;
+    }
+    value = value*1024;
+
+    jsonobj = json_object_from_file(LOG_CONFIG_PATH);
+    if (NULL == jsonobj) {
+        printf("Can't open config file: %s\n", LOG_CONFIG_PATH);
+        system("echo Can't open config file > /dev/console");
+        return -1;
+    }
+    /***获取data***/
+    json_object_object_get_ex(jsonobj, "buffer_list", &tmpjson);
+    datajson = json_object_array_get_idx(tmpjson, SYSLOG_INDEX);
+    if (NULL == datajson) {
+        json_object_to_file(LOG_CONFIG_PATH, jsonobj);
+        json_object_put(jsonobj);
+        printf("NULL == datajson\n");
+        system("echo NULL == datajson > /dev/console");
+        return -1;
+    }
+
+    json_object_object_get_ex(datajson, "name", &listjson);
+    tmp_string = json_object_get_string(listjson);
+
+    json_object_object_get_ex(datajson, "enable", &listjson);
+    tmp_int = json_object_get_int(listjson);
+
+    if(strcmp(tmp_string, SYSLOG_NAME) != 0 || tmp_int != 1)
+    {
+        json_object_to_file(LOG_CONFIG_PATH, jsonobj);
+        json_object_put(jsonobj);
+        printf("SYSLOG_NAME error, tmp_int != 1\n");
+        system("echo SYSLOG_NAME error, tmp_int != 1 > /dev/console");
+        return -1;
+    }
+
+    json_object_object_add(datajson, "rotate_file_size", json_object_new_int(value));
+
+    /***释放json对象***/
+    json_object_to_file(LOG_CONFIG_PATH, jsonobj);
+    json_object_put(jsonobj);
+    return 0;
+}
+
+int lynq_syslog_get_file_size(void)
+{
+    json_object* jsonobj = NULL;
+    json_object* tmpjson = NULL;
+    json_object* datajson = NULL;
+    json_object* listjson = NULL;
+
+    int tmp_int;
+    char* tmp_string = NULL;
+
+    jsonobj = json_object_from_file(LOG_CONFIG_PATH);
+    if (NULL == jsonobj) {
+        printf("Can't open config file: %s\n", LOG_CONFIG_PATH);
+        return -1;
+    }
+    /***获取data***/
+    json_object_object_get_ex(jsonobj, "buffer_list", &tmpjson);
+    datajson = json_object_array_get_idx(tmpjson, SYSLOG_INDEX);
+    if (NULL == datajson) {
+        json_object_put(jsonobj);
+        return -1;
+    }
+
+    json_object_object_get_ex(datajson, "name", &listjson);
+    tmp_string = json_object_get_string(listjson);
+
+    json_object_object_get_ex(datajson, "enable", &listjson);
+    tmp_int = json_object_get_int(listjson);
+
+    if(strcmp(tmp_string, SYSLOG_NAME) != 0 || tmp_int != 1)
+    {
+        json_object_put(jsonobj);
+        return -1;
+    }
+
+    json_object_object_get_ex(datajson, "rotate_file_size", &listjson);
+    tmp_int = json_object_get_int(listjson);
+
+    /***释放json对象***/
+    json_object_put(jsonobj);
+
+    return tmp_int/1024;
+//    return tmp_int;
+}
+
+int lynq_syslog_set_file_rotate(int value)
+{
+    //UNUSED(value);
+
+    json_object* jsonobj = NULL;
+    json_object* tmpjson = NULL;
+    json_object* datajson = NULL;
+    json_object* listjson = NULL;
+
+    int tmp_int;
+    char* tmp_string = NULL;
+
+    if(value < 0)
+    {
+        value = 0;
+    }
+    else if(value > 99)
+    {
+        value = 99;
+    }
+
+    jsonobj = json_object_from_file(LOG_CONFIG_PATH);
+    if (NULL == jsonobj) {
+        printf("Can't open config file: %s\n", LOG_CONFIG_PATH);
+        return -1;
+    }
+    /***获取data***/
+    json_object_object_get_ex(jsonobj, "buffer_list", &tmpjson);
+    datajson = json_object_array_get_idx(tmpjson, SYSLOG_INDEX);
+    if (NULL == datajson) {
+        json_object_to_file(LOG_CONFIG_PATH, jsonobj);
+        json_object_put(jsonobj);
+        return -1;
+    }
+
+    json_object_object_get_ex(datajson, "name", &listjson);
+    tmp_string = json_object_get_string(listjson);
+
+    json_object_object_get_ex(datajson, "enable", &listjson);
+    tmp_int = json_object_get_int(listjson);
+
+    if(strcmp(tmp_string, SYSLOG_NAME) != 0 || tmp_int != 1)
+    {
+        json_object_to_file(LOG_CONFIG_PATH, jsonobj);
+        json_object_put(jsonobj);
+        return -1;
+    }
+
+    json_object_object_add(datajson, "rotate_file_count", json_object_new_int(value));
+
+    /***释放json对象***/
+    json_object_to_file(LOG_CONFIG_PATH, jsonobj);
+    json_object_put(jsonobj);
+    return 0;
+}
+
+int lynq_syslog_get_file_rotate(void)
+{
+    json_object* jsonobj = NULL;
+    json_object* tmpjson = NULL;
+    json_object* datajson = NULL;
+    json_object* listjson = NULL;
+
+    int tmp_int;
+    char* tmp_string = NULL;
+
+    jsonobj = json_object_from_file(LOG_CONFIG_PATH);
+    if (NULL == jsonobj) {
+        printf("Can't open config file: %s\n", LOG_CONFIG_PATH);
+        return -1;
+    }
+    /***获取data***/
+    json_object_object_get_ex(jsonobj, "buffer_list", &tmpjson);
+    datajson = json_object_array_get_idx(tmpjson, SYSLOG_INDEX);
+    if (NULL == datajson) {
+        json_object_put(jsonobj);
+        return -1;
+    }
+
+    json_object_object_get_ex(datajson, "name", &listjson);
+    tmp_string = json_object_get_string(listjson);
+
+    json_object_object_get_ex(datajson, "enable", &listjson);
+    tmp_int = json_object_get_int(listjson);
+
+    if(strcmp(tmp_string, SYSLOG_NAME) != 0 || tmp_int != 1)
+    {
+        json_object_put(jsonobj);
+        return -1;
+    }
+
+    json_object_object_get_ex(datajson, "rotate_file_count", &listjson);
+    tmp_int = json_object_get_int(listjson);
+
+    /***释放json对象***/
+    json_object_put(jsonobj);
+
+    return tmp_int;
+}
+
+log_level_enum filter_char_to_pri(char c)
+{
+    switch (c) {
+        case 'v':
+            return LOG_VERBOSE;
+        case 'd':
+            return LOG_DEBUG;
+        case 'i':
+            return LOG_INFO;
+        case 'w':
+            return LOG_WARNING;
+        case 'e':
+            return LOG_ERROR;
+        case '*':
+        default:
+            return LOG_LEVEL_MAX;
+    }
+}
+
+char filter_pri_to_char(log_level_enum level)
+{
+    char char_level;
+    switch (level) {
+        case LOG_VERBOSE:
+            char_level = 'v';
+            break;
+        case LOG_DEBUG:
+            char_level = 'd';
+            break;
+        case LOG_INFO:
+            char_level = 'i';
+            break;
+        case LOG_WARNING:
+            char_level = 'w';
+            break;
+        case LOG_ERROR:
+            char_level = 'e';
+            break;
+        case LOG_LEVEL_MAX:
+        default:
+            char_level = '*';
+            break;
+    }
+    return char_level;
+}
+
+int lynq_set_log_level(const char * module_name, log_level_enum level)
+{
+    json_object* jsonobj = NULL;
+    json_object* tmpjson = NULL;
+    json_object* datajson = NULL;
+    json_object* listjson = NULL;
+    json_object* fileterjson = NULL;
+    json_object* fileter_listjson = NULL;
+    json_object* new_fileter = NULL;
+
+    int n = 0, array_length = 0;
+    char* tmp_string = NULL;
+    char level_string[5] = {'\0'};
+
+    jsonobj = json_object_from_file(LOG_CONFIG_PATH);
+    if (NULL == jsonobj) {
+        printf("Can't open config file: %s\n", LOG_CONFIG_PATH);
+        return -1;
+    }
+    /***获取data***/
+    json_object_object_get_ex(jsonobj, "buffer_list", &tmpjson);
+    datajson = json_object_array_get_idx(tmpjson, SYSLOG_INDEX);
+    if (NULL == datajson) {
+        json_object_put(jsonobj);
+        return -1;
+    }
+    
+    json_object_object_get_ex(datajson, "filter_list", &listjson);
+    if (NULL == listjson) {
+        printf("%s %d: object failure!\n", __FUNCTION__, __LINE__);
+        json_object_put(listjson);
+        return -1;
+    }
+    array_length = json_object_array_length(listjson);
+    for (n = 0; n <= array_length; n++) {
+        fileterjson = json_object_array_get_idx(listjson, n);
+        if (NULL == fileterjson) {
+            new_fileter = json_object_new_object();
+            sprintf(level_string, "%c", filter_pri_to_char(level));
+            json_object_object_add(new_fileter, "priority", json_object_new_string(level_string));
+            json_object_object_add(new_fileter, "tag", json_object_new_string(module_name));
+            json_object_array_add(listjson, new_fileter);
+            break;
+        }
+
+        json_object_object_get_ex(fileterjson, "tag", &fileter_listjson);
+        char *str = json_object_get_string(fileter_listjson);
+        if (str) {
+            tmp_string = strdup(str);
+            if(strcmp(module_name, tmp_string) == 0)
+            {
+                sprintf(level_string, "%c", filter_pri_to_char(level));
+                json_object_object_add(fileterjson, "priority", json_object_new_string(level_string));
+                json_object_to_file(LOG_CONFIG_PATH, jsonobj);
+                json_object_put(jsonobj);
+                return 0;
+            }
+        }
+        else
+        {
+            continue;
+        }
+    }
+    /***释放json对象***/
+    json_object_to_file(LOG_CONFIG_PATH, jsonobj);
+    json_object_put(jsonobj);
+
+    return 0;
+}
+
+int lynq_get_log_level(const char * module_name, log_level_enum *level)
+{
+    json_object* jsonobj = NULL;
+    json_object* tmpjson = NULL;
+    json_object* datajson = NULL;
+    json_object* listjson = NULL;
+    json_object* fileterjson = NULL;
+    json_object* fileter_listjson = NULL;
+
+    int n;
+    char* tmp_string = NULL;
+
+    jsonobj = json_object_from_file(LOG_CONFIG_PATH);
+    if (NULL == jsonobj) {
+        printf("Can't open config file: %s\n", LOG_CONFIG_PATH);
+        return -1;
+    }
+    /***获取data***/
+    json_object_object_get_ex(jsonobj, "buffer_list", &tmpjson);
+    datajson = json_object_array_get_idx(tmpjson, SYSLOG_INDEX);
+    if (NULL == datajson) {
+        json_object_put(jsonobj);
+        return -1;
+    }
+
+    json_object_object_get_ex(datajson, "filter_list", &listjson);
+    if (NULL == listjson) {
+        printf("%s %d: object failure!\n", __FUNCTION__, __LINE__);
+        json_object_put(listjson);
+        return -1;
+    }
+
+    for (n = 0 ; n < 5; n++) {
+        fileterjson = json_object_array_get_idx(listjson, n);
+        if (NULL == fileterjson) {
+            printf("the fileterjson exit\n");
+            break;
+        }
+
+        json_object_object_get_ex(fileterjson, "tag", &fileter_listjson);
+        char *str = json_object_get_string(fileter_listjson);
+        if (str) {
+            tmp_string = strdup(str);
+            printf("tag is %s\n", tmp_string);
+            if(strcmp(module_name, tmp_string) == 0)
+            {
+                json_object_object_get_ex(fileterjson, "priority", &fileter_listjson);
+                str = json_object_get_string(fileter_listjson);
+                if (str) {
+                    tmp_string = str[0];
+                    printf("fileter_listjson: %c\n", tmp_string);
+                    *level = filter_char_to_pri(tmp_string);
+                    //get the log level
+                    json_object_put(jsonobj);
+                    return 0;
+                }
+                else
+                {
+                    break;
+                }
+            }
+        }
+        else
+        {
+            continue;
+        }
+    }
+    *level = LOG_UNSET;
+    /***释放json对象***/
+    json_object_put(jsonobj);
+
+    return 0;
+}
+
+int lynq_set_special_log_level(const char * exe_name, const char * module_name, log_level_enum level)
+{
+    UNUSED(exe_name);
+    UNUSED(module_name);
+    UNUSED(level);
+
+
+    return 0;
+}
+
+int lynq_get_special_log_level(const char * exe_name, const char * module_name, log_level_enum *level)
+{
+    UNUSED(exe_name);
+    UNUSED(module_name);
+    UNUSED(level);
+
+
+    return 0;
+}
+
+int lynq_notify_recalc_log_level(pid_t pid)
+{
+    UNUSED(pid);
+    char sendBuff[100]={'\0'};
+    int serverFd,clientFd,addrLen,nwrite,nread;
+    struct sockaddr_un serverAddr,clientAddr;
+
+    unlink("/var/log_client.socket");   /* in case it already exists */
+
+    memset(&clientAddr,0,sizeof(clientAddr));
+    memset(&serverAddr,0,sizeof(serverAddr));
+    clientAddr.sun_family = AF_UNIX;
+    sprintf(clientAddr.sun_path,"%s","/var/log_client.socket");
+
+    if ((clientFd = socket(AF_UNIX,SOCK_STREAM,0)) < 0)
+    {
+        printf("err -1\n");
+        return -1;
+    }
+
+    if (bind(clientFd, (struct sockaddr *)&clientAddr, sizeof(clientAddr)) < 0)
+    {
+        printf("err -2\n");
+        close(clientFd);
+        return -2;
+    }
+
+    serverAddr.sun_family = AF_UNIX;
+    sprintf(serverAddr.sun_path, "/var/log_server.socket");
+    if (connect(clientFd, (struct sockaddr *)&serverAddr, sizeof(serverAddr)) < 0)
+    {
+        printf("err -3\n");
+        close(clientFd);
+        return -3;
+    }
+
+    sprintf(sendBuff,"%s","update");
+    if ((nwrite = write(clientFd, sendBuff, 100)) < 0)
+    {
+        printf("err -4\n");
+        close(clientFd);
+        return -4;
+    }
+
+    close(clientFd);
+    return 0;
+}
\ No newline at end of file
diff --git a/mbtk/liblynq_lib_v2/src/lynq_net_light.c b/mbtk/liblynq_lib_v2/src/lynq_net_light.c
new file mode 100755
index 0000000..ee84b71
--- /dev/null
+++ b/mbtk/liblynq_lib_v2/src/lynq_net_light.c
@@ -0,0 +1,140 @@
+#include "lynq_led.h"
+#include "mbtk_type.h"
+#include "mbtk_log.h"
+#include "mbtk_info_api.h"
+
+/****************************DEFINE***************************************/
+#define QSER_RESULT_FAIL    -1
+#define QSER_RESULT_SUCCESS 0
+/****************************DEFINE***************************************/
+
+/****************************VARIABLE***************************************/
+extern mbtk_info_handle_t* qser_info_handle;
+extern int qser_info_handle_num;
+/****************************VARIABLE***************************************/
+
+
+/******************************FUNC*****************************************/
+static int qser_led_client_init(void)
+{
+    if(qser_info_handle == NULL)
+    {
+        qser_info_handle = mbtk_info_handle_get();
+        if(qser_info_handle)
+        {
+            qser_info_handle_num++;
+        } 
+        else
+        {
+            LOGE("[qser_led] mbtk_info_handle_get() fail.");
+            return QSER_RESULT_FAIL;
+        }
+    }
+    else
+    {
+        qser_info_handle_num++;
+    }
+
+    LOGE("[qser_led] mbtk_info_handle_get() success.");
+    return QSER_RESULT_SUCCESS;
+}
+
+static int qser_led_client_deinit(void)
+{
+    if(qser_info_handle)
+    {
+        LOGE("[qser_led] qser_info_handle_num = %d", qser_info_handle_num);
+        if(qser_info_handle_num == 1)
+        { // 最后一个引用,可释放。
+            int ret = mbtk_info_handle_free(&qser_info_handle);
+            if(ret)
+            {
+                LOGE("[qser_led] mbtk_info_handle_free() fail.");
+                return QSER_RESULT_FAIL;
+            }
+            else
+            {
+                qser_info_handle_num = 0;
+                qser_info_handle = NULL;
+            }
+        } 
+        else
+        {
+            qser_info_handle_num--;
+        }
+    }
+    else
+    {
+        LOGE("[qser_led] handle not inited.");
+        return QSER_RESULT_FAIL;
+    }
+
+    return QSER_RESULT_SUCCESS;
+}
+
+/******************************FUNC*****************************************/
+
+/****************************API***************************************/
+int lynq_set_netled_on(int led_mode)
+{
+    //UNUSED(led_mode);
+
+    if(led_mode != 0 && led_mode != 1)
+    {
+        LOGE("[qser_led]param is fail.");
+        return QSER_RESULT_FAIL;
+    }
+
+    
+    int ret = qser_led_client_init();
+    if(ret != QSER_RESULT_SUCCESS)
+    {
+        LOGE("[qser_led]qser_led_client_init fail.");
+        return QSER_RESULT_FAIL;
+    }
+
+    ret = mbtk_led_set(qser_info_handle, MBTK_LED_TYPE_NET, led_mode);
+    if(ret != 0)
+    {
+        LOGE("[qser_led]mbtk_led_gpio_init fail.");
+        qser_led_client_init();
+        return QSER_RESULT_FAIL;
+    }
+
+    ret = qser_led_client_init();
+    
+    return QSER_RESULT_SUCCESS;
+}
+
+int lynq_set_statusled_on(int led_mode)
+{
+    //UNUSED(led_mode);
+
+    if(led_mode != 0 && led_mode != 1)
+    {
+        LOGE("[qser_led]param is fail.");
+        return QSER_RESULT_FAIL;
+    }
+    
+    int ret = qser_led_client_init();
+    if(ret != QSER_RESULT_SUCCESS)
+    {
+        LOGE("[qser_led]qser_led_client_init fail.");
+        return QSER_RESULT_FAIL;
+    }
+
+    ret = mbtk_led_set(qser_info_handle, MBTK_LED_TYPE_STATUS, led_mode);
+    if(ret != 0)
+    {
+        LOGE("[qser_led]mbtk_led_gpio_init fail.");
+        qser_led_client_init();
+        return QSER_RESULT_FAIL;
+    }
+
+    ret = qser_led_client_init();
+    
+    return QSER_RESULT_SUCCESS;
+}
+/****************************API***************************************/
+
+
diff --git a/mbtk/liblynq_lib_v2/src/lynq_network.c b/mbtk/liblynq_lib_v2/src/lynq_network.c
new file mode 100755
index 0000000..be3816e
--- /dev/null
+++ b/mbtk/liblynq_lib_v2/src/lynq_network.c
@@ -0,0 +1,1225 @@
+#include "lynq_qser_network.h"
+#include "mbtk_type.h"
+#include "mbtk_info_api.h"
+#include "mbtk_log.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+
+
+mbtk_info_handle_t* lynq_nw_info_handle = NULL;
+uint64_t tmp_mode = 0xFF;
+
+nw_client_handle_type g_nw_val = -1;
+
+typedef struct
+{
+    QSER_NW_RxMsgHandlerFunc_t handlerPtr;
+    void* contextPtr;
+} lynq_cust_cb_func;
+
+static lynq_cust_cb_func lynq_func_cb_handle;
+
+static int roaming_pref = 1;  // Open roaming for default.
+
+typedef enum {
+    RADIO_TECH_3GPP = 1, /* 3GPP Technologies - GSM, WCDMA */
+    RADIO_TECH_3GPP2 = 2 /* 3GPP2 Technologies - CDMA */
+} RIL_RadioTechnologyFamily;
+
+
+typedef struct
+{
+    uint8 *lynq_operator_l;
+    uint8 *lynq_operator_s;
+    uint32 lynq_mcc_mnc;
+} lynq_operator_mcc_mnc_t;
+
+static lynq_operator_mcc_mnc_t lynq_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}
+};
+
+#if 0
+//T106的实现
+/*Used to wait for an update signal*/
+int lynq_wait_signalchanges(int *handle)
+{
+    LYDBGLOG("start wait signalchanges info");
+    if(NULL == handle)
+    {
+        LYERRLOG("illegal input");
+        return LYNQ_E_PARAMETER_ANONALY;
+    }
+    wait_urc_signal_changes();
+    LYDBGLOG("get signalchanges");
+    *handle = s_module_wait_urc_id;
+    return RESULT_OK;   
+}
+
+bool is_support_urc(int urc_id)
+{
+    switch(urc_id)
+    {
+        case RIL_UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED:
+        case RIL_UNSOL_RESPONSE_PS_NETWORK_STATE_CHANGED:
+        case RIL_UNSOL_RESPONSE_IMS_NETWORK_STATE_CHANGED:
+        case RIL_UNSOL_SIGNAL_STRENGTH:
+            return true;                
+        default:
+            return false;
+    }    
+}
+
+/*Used to get urc info*/
+int lynq_get_urc_info(const int handle,signalStrength_t *solSigStren,int *slot_id)
+{
+    if(g_module_init_flag != MODULE_RUNNING)
+    {
+        LYERRLOG("%s module state %d error",__func__,g_module_init_flag);
+        return -1;
+    }
+    LYDBGLOG("start get urc info");
+    if(is_support_urc(handle)==false)
+    {
+        LYINFLOG("invalid handle!!!");
+        return -1;
+    }
+    if((handle ==RIL_UNSOL_SIGNAL_STRENGTH && NULL == solSigStren) || 
+        (handle !=RIL_UNSOL_SIGNAL_STRENGTH && NULL == slot_id))
+    {
+        LYINFLOG("incoming solSigStren or slot_id is NULL!!!");
+        return -1;
+    }
+    switch(handle)
+    {        
+        case RIL_UNSOL_SIGNAL_STRENGTH: //1009
+        {
+            LYDBGLOG("get state update to signal info");
+            solSigStren->gw_sig_valid = s_network_urc_solSigStren.gw_sig_valid;
+            solSigStren->rssi = s_network_urc_solSigStren.rssi;
+            solSigStren->wcdma_signalstrength = s_network_urc_solSigStren.wcdma_signalstrength;
+            solSigStren->wcdma_sig_valid = s_network_urc_solSigStren.wcdma_sig_valid;
+            solSigStren->rscp = s_network_urc_solSigStren.rscp;
+            solSigStren->ecno = s_network_urc_solSigStren.ecno;
+            solSigStren->lte_signalstrength = s_network_urc_solSigStren.lte_signalstrength;
+            solSigStren->lte_sig_valid = s_network_urc_solSigStren.lte_sig_valid;
+            solSigStren->rsrp = s_network_urc_solSigStren.rsrp;
+            solSigStren->rsrq = s_network_urc_solSigStren.rsrq;
+            solSigStren->rssnr = s_network_urc_solSigStren.rssnr;
+            solSigStren->nr_sig_valid = s_network_urc_solSigStren.nr_sig_valid;
+            solSigStren->ssRsrp = s_network_urc_solSigStren.ssRsrp;
+            solSigStren->ssRsrq = s_network_urc_solSigStren.ssRsrq;
+            solSigStren->ssSinr = s_network_urc_solSigStren.ssSinr;
+            solSigStren->csiRsrp = s_network_urc_solSigStren.csiRsrp;
+            solSigStren->csiRsrq = s_network_urc_solSigStren.csiRsrq;
+            solSigStren->csiSinr = s_network_urc_solSigStren.csiSinr;
+            break;
+        }
+        default:
+        {
+            *slot_id = s_module_urc_slot_id;
+            LYINFLOG("slot_id = %d",s_module_urc_slot_id);
+        }        
+    }
+    return 0;   
+}
+
+
+void urc_msg_process_voice_reg()
+{
+    if(s_handlerPtr != NULL)
+    {
+        s_handlerPtr(g_nw_val,NW_IND_VOICE_REG_EVENT_IND_FLAG,NULL,0,s_contextPtr);
+    }
+}
+
+void urc_msg_process_data_reg()
+{
+    if(s_handlerPtr != NULL)
+    {
+        s_handlerPtr(g_nw_val,NW_IND_DATA_REG_EVENT_IND_FLAG,NULL,0,s_contextPtr);
+    }  
+}
+
+void urc_msg_process_ims_reg()
+{
+    if(s_handlerPtr != NULL)
+    {
+        s_handlerPtr(g_nw_val,NW_IND_IMS_REG_EVENT_IND_FLAG,NULL,0,s_contextPtr);
+    }
+}
+
+void *new_network_thread_recv(void *context)
+{
+    int handle = -1;  
+    uint32_t ind_flag = 0;
+
+    while (1)
+    {
+        lynq_wait_signalchanges(&handle);
+
+        switch(handle)
+        {
+            case 1002: //RIL_UNSOL_RESPONSE_VOICE_NETWORK_STATE_CHANGED:
+            {
+                urc_msg_process_voice_reg();
+               
+                break;
+            }
+            case 3015://RIL_UNSOL_RESPONSE_PS_NETWORK_STATE_CHANGED:
+            {   
+                urc_msg_process_data_reg();               
+                break;
+            }        
+            case 1009://RIL_UNSOL_SIGNAL_STRENGTH:
+            {   
+                urc_msg_process_signal_strength();
+                break;
+            }
+            case 1037://RIL_UNSOL_RESPONSE_IMS_NETWORK_STATE_CHANGED:
+            {   
+                urc_msg_process_ims_reg();
+                break;
+            }
+        }        
+    }
+    return NULL;
+}
+
+void urc_msg_process_signal_strength()
+{
+    signalStrength_t signalstrength;
+    int slot_id;
+
+    int ret = lynq_get_urc_info(1009,&signalstrength,&slot_id);
+    if (ret == 0)
+    {
+        QSER_NW_SINGNAL_EVENT_IND_T msg_buf;
+        msg_buf.gsm_sig_info_valid = signalstrength.gw_sig_valid;
+        msg_buf.gsm_sig_info.rssi = signalstrength.rssi;
+        msg_buf.wcdma_sig_info_valid = signalstrength.wcdma_sig_valid;
+        msg_buf.wcdma_sig_info.rssi = signalstrength.rscp;
+        msg_buf.wcdma_sig_info.ecio = signalstrength.ecno;
+        msg_buf.tdscdma_sig_info_valid = 0;
+        msg_buf.lte_sig_info_valid = signalstrength.lte_sig_valid;
+        msg_buf.lte_sig_info.rssi = -125;
+        msg_buf.lte_sig_info.rsrp = signalstrength.rsrp;
+        msg_buf.lte_sig_info.rsrq = signalstrength.rsrq;
+        msg_buf.lte_sig_info.snr = signalstrength.rssnr;
+        msg_buf.cdma_sig_info_valid = 0;
+        msg_buf.hdr_sig_info_valid = 0;
+        msg_buf.nr_sig_info_valid = signalstrength.nr_sig_valid;
+        msg_buf.nr_sig_info.ssRsrp = signalstrength.ssRsrp;
+        msg_buf.nr_sig_info.ssRsrq = signalstrength.ssRsrq;
+        msg_buf.nr_sig_info.ssSinr = signalstrength.ssSinr;
+        msg_buf.nr_sig_info.csiRsrp = signalstrength.csiRsrp;
+        msg_buf.nr_sig_info.csiRsrq = signalstrength.csiRsrq;
+        msg_buf.nr_sig_info.csiSinr = signalstrength.csiSinr;
+        void *ind_msg_buf= &msg_buf;
+        if(s_handlerPtr!=NULL)
+        {
+            s_handlerPtr(g_nw_val,NW_IND_SIGNAL_STRENGTH_EVENT_IND_FLAG,ind_msg_buf,sizeof (msg_buf) ,s_contextPtr);
+        }         
+   }   
+}
+
+#endif
+
+
+
+void lynq_signal_state_change_cb(const void* data, int data_len)
+{
+#if 0
+
+/*
+    uint8 *net_data = NULL;
+
+    net_data = (uint8*)data;
+
+    if(data && data_len > 0)
+    {
+        if(*net_data == 0)
+        { // CS
+                printf("CS:act=%d, mode=%d\n", *(net_data + 1), *(net_data + 2));
+        }
+        else
+        { // PS
+                printf("PS[%s]:act=%d, mode=%d\n", *(net_data + 3) == 0 ? "GSM/WCDMA" : "LTE", *(net_data + 1), *(net_data + 2));
+        }
+    }
+    else
+    {
+        printf("NET_CB : NULL");
+    }
+*/
+
+    if(s_handlerPtr != NULL)//数据原样输出
+    {
+        s_handlerPtr(g_nw_val, NW_IND_DATA_REG_EVENT_IND_FLAG, data, data_len, NULL);
+    }
+#endif
+
+    /*
+    data_signal[0] = signal.type;
+    data_signal[1] = signal.rssi;
+    data_signal[2] = signal.rxlev;
+    data_signal[3] = signal.ber;
+    data_signal[4] = signal.rscp;
+    data_signal[5] = signal.ecno;
+    data_signal[6] = signal.rsrq;
+    data_signal[7] = signal.rsrp;
+    */
+
+    uint8 *net_data = NULL;
+    QSER_NW_SINGNAL_EVENT_IND_T msg_buf;
+
+    if(data && data_len > 0)
+    {
+        net_data = (uint8*)data;
+        //printf("net_data[0] => *net_data =%d\n",*net_data);
+        msg_buf.gsm_sig_info_valid = FALSE;
+        msg_buf.lte_sig_info_valid = FALSE;
+        msg_buf.wcdma_sig_info_valid = FALSE;
+
+        if(*net_data == MBTK_RADIO_TECH_GSM || *net_data == MBTK_RADIO_TECH_GSM_COMPACT || \
+           *net_data == MBTK_RADIO_TECH_GSM_EGPRS)              //GSM
+        {
+            msg_buf.gsm_sig_info_valid = TRUE;
+            msg_buf.gsm_sig_info.rssi = *(net_data + 1);
+        }
+        else if(*net_data == MBTK_RADIO_TECH_E_UTRAN)     //LTE
+        {
+            msg_buf.lte_sig_info_valid = TRUE;
+            msg_buf.lte_sig_info.rssi = *(net_data + 1);
+            msg_buf.lte_sig_info.rsrp = *(net_data + 7);//signalstrength.rsrp;
+            msg_buf.lte_sig_info.rsrq = *(net_data + 6);//signalstrength.rsrq;
+            msg_buf.lte_sig_info.snr = 0x7FFFFFFFF; //signalstrength.rssnr;(当前mbtk没有该参数)
+        }
+        else if (*net_data == MBTK_RADIO_TECH_UTRAN || *net_data == MBTK_RADIO_TECH_UTRAN_HSDPA || \
+                 *net_data == MBTK_RADIO_TECH_UTRAN_HSUPA || *net_data == MBTK_RADIO_TECH_UTRAN_HSDPA_HSUPA ||  \
+                 *net_data == MBTK_RADIO_TECH_UTRAN_HSPA )//WCDMA
+        {
+            msg_buf.wcdma_sig_info_valid = TRUE;
+            msg_buf.wcdma_sig_info.rssi = *(net_data + 1);//signalstrength.rssi;
+            msg_buf.wcdma_sig_info.ecio = *(net_data + 5);//signalstrength.ecno;
+        }
+
+        //msg_buf.gsm_sig_info_valid = TRUE;//signalstrength.gw_sig_valid;
+        //msg_buf.gsm_sig_info.rssi = *(net_data + 1);//signalstrength.rssi;
+        //printf("rssi = %d\n", *(net_data + 1));
+        //msg_buf.wcdma_sig_info_valid = TRUE;//.wcdma_sig_valid;
+        //msg_buf.wcdma_sig_info.rssi = *(net_data + 1);//signalstrength.rssi;
+        //printf("rscp = %d\n", *(net_data + 4));
+        //msg_buf.wcdma_sig_info.ecio = *(net_data + 5);//signalstrength.ecno;
+        //printf("ecno = %d\n", *(net_data + 5));
+        //msg_buf.lte_sig_info_valid = TRUE;//signalstrength.lte_sig_valid;
+        //msg_buf.lte_sig_info.rssi = *(net_data + 1);
+        //msg_buf.lte_sig_info.rsrp = *(net_data + 7);//signalstrength.rsrp;
+        //printf("rsrp = %d\n", *(net_data + 7));
+        //msg_buf.lte_sig_info.rsrq = *(net_data + 6);//signalstrength.rsrq;
+        //printf("rsrq = %d\n", *(net_data + 6));
+        //msg_buf.lte_sig_info.snr = 0x7FFFFFFFF; //signalstrength.rssnr;(当前mbtk没有该参数)
+        msg_buf.tdscdma_sig_info_valid = FALSE;
+        msg_buf.cdma_sig_info_valid = FALSE;
+        msg_buf.hdr_sig_info_valid = FALSE;
+        msg_buf.nr_sig_info_valid = FALSE;//(当前mbtk没有该参数)
+        msg_buf.nr_sig_info.ssRsrp = 0;
+        msg_buf.nr_sig_info.ssRsrq = 0;
+        msg_buf.nr_sig_info.ssSinr = 0;
+        msg_buf.nr_sig_info.csiRsrp = 0;
+        msg_buf.nr_sig_info.csiRsrq = 0;
+        msg_buf.nr_sig_info.csiSinr = 0;
+
+        void *ind_msg_buf= &msg_buf;
+        if(lynq_func_cb_handle.handlerPtr != NULL)
+        {
+            lynq_func_cb_handle.handlerPtr(g_nw_val, NW_IND_SIGNAL_STRENGTH_EVENT_IND_FLAG, ind_msg_buf, sizeof (msg_buf), lynq_func_cb_handle.contextPtr);
+            lynq_func_cb_handle.handlerPtr(g_nw_val, NW_IND_VOICE_REG_EVENT_IND_FLAG, NULL, 0, lynq_func_cb_handle.contextPtr);
+            lynq_func_cb_handle.handlerPtr(g_nw_val, NW_IND_DATA_REG_EVENT_IND_FLAG, NULL, 0, lynq_func_cb_handle.contextPtr);
+            lynq_func_cb_handle.handlerPtr(g_nw_val, NW_IND_IMS_REG_EVENT_IND_FLAG, NULL, 0, lynq_func_cb_handle.contextPtr);
+        }
+    }
+    else
+    {
+        LOGE("lynq_nw_state_change_cb : NULL");
+    }
+
+}
+
+
+static uint8 lynq_net_pre_change(bool mbtk_2_lynq,int net_mode)
+{
+    uint8 mbtk_net_pre = 0xFF;
+
+#if 0
+    此参数表在别处使用
+    E_QSER_NW_RADIO_TECH_TD_SCDMA = 1,                                       Y3     1
+    E_QSER_NW_RADIO_TECH_GSM      = 2,    /**<  GSM; only supports voice. */ YL2    0
+    E_QSER_NW_RADIO_TECH_HSPAP    = 3,    /**<  HSPA+. */                      3    1
+    E_QSER_NW_RADIO_TECH_LTE      = 4,    /**<  LTE. */                        4    5
+    E_QSER_NW_RADIO_TECH_EHRPD    = 5,    /**<  EHRPD. */                      3    1
+    E_QSER_NW_RADIO_TECH_EVDO_B   = 6,    /**<  EVDO B. */                   D3     1
+    E_QSER_NW_RADIO_TECH_HSPA     = 7,    /**<  HSPA. */                      3     1
+    E_QSER_NW_RADIO_TECH_HSUPA    = 8,    /**<  HSUPA. */                     3.5   1
+    E_QSER_NW_RADIO_TECH_HSDPA    = 9,    /**<  HSDPA. */                     3.5   1
+    E_QSER_NW_RADIO_TECH_EVDO_A   = 10,   /**<  EVDO A. */                   D3     1
+    E_QSER_NW_RADIO_TECH_EVDO_0   = 11,   /**<  EVDO 0. */                   D3     1
+    E_QSER_NW_RADIO_TECH_1xRTT    = 12,   /**<  1xRTT. */                       2   0
+    E_QSER_NW_RADIO_TECH_IS95B    = 13,   /**<  IS95B. */                       3   0
+    E_QSER_NW_RADIO_TECH_IS95A    = 14,   /**<  IS95A. */                       3   0
+    E_QSER_NW_RADIO_TECH_UMTS     = 15,   /**<  UMTS. */                     L3     1
+    E_QSER_NW_RADIO_TECH_EDGE     = 16,   /**<  EDGE. */                      2.75  0
+    E_QSER_NW_RADIO_TECH_GPRS     = 17,   /**<  GPRS. */                      2.5   0
+    E_QSER_NW_RADIO_TECH_NONE     = 18    /**<  No technology selected. */
+#endif
+    /*
+    0 : GSM only
+    1 : UMTS only
+    2 : GSM/UMTS(auto)
+    3 : GSM/UMTS(GSM preferred)
+    4 : GSM/UMTS(UMTS preferred)
+    5 : LTE only
+    6 : GSM/LTE(auto)
+    7 : GSM/LTE(GSM preferred)
+    8 : GSM/LTE(LTE preferred)
+    9 : UMTS/LTE(auto)
+    10 : UMTS/LTE(UMTS preferred)
+    11 : UMTS/LTE(LTE preferred)
+    12 : GSM/UMTS/LTE(auto)
+    13 : GSM/UMTS/LTE(GSM preferred)
+    14 : GSM/UMTS/LTE(UMTS preferred)
+    15 : GSM/UMTS/LTE(LTE preferred)
+    */
+
+    if(mbtk_2_lynq) 
+    {
+        switch(net_mode)
+        {
+            //使用之前set的tmp_mode的值来进行回显get
+            case QSER_NW_MODE_GSM:
+                mbtk_net_pre = QSER_NW_MODE_GSM;
+                break;
+            case QSER_NW_MODE_WCDMA:
+                mbtk_net_pre = QSER_NW_MODE_WCDMA;
+                break;
+            case QSER_NW_MODE_CDMA:
+                mbtk_net_pre = QSER_NW_MODE_CDMA;
+                break;
+            case QSER_NW_MODE_EVDO:
+                mbtk_net_pre = QSER_NW_MODE_EVDO;
+                break;
+            case QSER_NW_MODE_LTE:
+                mbtk_net_pre = QSER_NW_MODE_LTE;
+                break;
+            case QSER_NW_MODE_TDSCDMA:
+                mbtk_net_pre = QSER_NW_MODE_TDSCDMA;
+                break;
+            default:
+                mbtk_net_pre = 0xFF;
+                break;
+        }
+    } 
+    else 
+   {
+        if(QSER_NW_MODE_GSM == net_mode)
+        {
+            mbtk_net_pre = MBTK_NET_PREF_GSM_ONLY;
+        }
+        else if(QSER_NW_MODE_WCDMA == net_mode)
+        {
+            mbtk_net_pre = MBTK_NET_PREF_UMTS_ONLY;
+        }
+        else if(QSER_NW_MODE_LTE == net_mode)
+        {
+            mbtk_net_pre = MBTK_NET_PREF_LTE_ONLY;
+        }
+        else if((QSER_NW_MODE_GSM | QSER_NW_MODE_WCDMA) == net_mode)
+        {
+            mbtk_net_pre = MBTK_NET_PREF_GSM_UMTS_UMTS_PREF;
+        }
+        else if((QSER_NW_MODE_WCDMA | QSER_NW_MODE_LTE) == net_mode)
+        {
+            mbtk_net_pre = MBTK_NET_PREF_UMTS_LTE_LTE_PREF;
+        }
+        else if((QSER_NW_MODE_GSM | QSER_NW_MODE_LTE) == net_mode)
+        {
+            mbtk_net_pre = MBTK_NET_PREF_GSM_LTE_LTE_PREF;
+        }
+        else if((QSER_NW_MODE_GSM | QSER_NW_MODE_WCDMA | QSER_NW_MODE_LTE) == net_mode)
+        {
+            mbtk_net_pre = MBTK_NET_PREF_GSM_UMTS_LTE_LTE_PREF;
+        }
+        else
+        {
+            mbtk_net_pre = 0xFF;
+        }
+    }
+    return mbtk_net_pre;
+}
+
+int qser_nw_client_init(nw_client_handle_type *ph_nw)
+{
+    //UNUSED(ph_nw);
+
+    if(lynq_nw_info_handle == NULL)
+    {
+        lynq_nw_info_handle = mbtk_info_handle_get();
+        if(lynq_nw_info_handle)
+        {
+            LOGI("creat lynq_nw_info_handle is success");
+            *ph_nw = lynq_nw_info_handle->client_fd;
+            g_nw_val = lynq_nw_info_handle->client_fd;
+        }
+        else
+        {
+            LOGE("creat lynq_nw_info_handle is fail");
+            return -1;
+        }
+    }
+    
+    return 0;
+}
+
+int qser_nw_client_deinit(nw_client_handle_type h_nw)
+{
+    //UNUSED(h_nw);
+    if (h_nw != g_nw_val || g_nw_val == -1)
+    {
+        LOGE("handle NULL");
+        return -1;
+    }
+
+    mbtk_signal_state_change_cb_reg(lynq_nw_info_handle, NULL);
+
+    if(lynq_nw_info_handle)
+    {
+        mbtk_info_handle_free(&lynq_nw_info_handle);
+    }
+    else
+    {
+        LOGE("deinit lynq_nw_info_handle is fail");
+        return -1;
+    }
+
+    return 0;
+}
+
+int qser_nw_set_config(nw_client_handle_type h_nw,QSER_NW_CONFIG_INFO_T *pt_info)
+{
+    //UNUSED(h_nw);
+    //UNUSED(pt_info);
+    if (h_nw != g_nw_val || g_nw_val == -1)
+    {
+        LOGE("handle NULL");
+        return -1;
+    }
+
+    if(lynq_nw_info_handle == NULL)
+    {
+        LOGE("lynq_nw_info_handle == NULL.");
+        return -1;
+    }
+
+    if(pt_info == NULL)
+    {
+        LOGE("pt_info == NULL.");
+        return -1;
+    }
+
+    roaming_pref = pt_info->roaming_pref;
+
+    mbtk_band_info_t band;
+    memset(&band, 0, sizeof(mbtk_band_info_t));
+    tmp_mode = pt_info->preferred_nw_mode;//临时保存一下原本的mode
+
+    //printf("tmp_mode = [%llu]",tmp_mode);
+    band.net_pref = lynq_net_pre_change(FALSE, pt_info->preferred_nw_mode);
+    LOGI("band.net_pref = [%d] ",band.net_pref);
+
+    if(band.net_pref == 0xFF)
+    {
+        LOGE("lynq_net_pre_change() fail.");
+        return -1;
+    }
+
+    if(mbtk_current_band_set(lynq_nw_info_handle, &band))
+    {
+        return -1;
+    }
+
+    return 0;
+}
+
+int qser_nw_get_operator_name(nw_client_handle_type h_nw, QSER_NW_OPERATOR_NAME_INFO_T *pt_info)
+{
+    //UNUSED(h_nw);
+    //UNUSED(pt_info);
+    if (h_nw != g_nw_val || g_nw_val == -1)
+    {
+        LOGE("handle NULL");
+        return -1;
+    }
+
+    if(lynq_nw_info_handle == NULL)
+    {
+        LOGE("lynq_nw_info_handle == NULL.");
+        return -1;
+    }
+
+    if(pt_info == NULL)
+    {
+        LOGE("pt_info == NULL.");
+        return -1;
+    }
+
+    char OperatorFN[128];
+    char OperatorSH[128];
+    char MccMnc[128];
+    mbtk_net_info_t net;
+    if(!mbtk_net_sel_mode_get(lynq_nw_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(lynq_operator_mcc_mnc))
+        {
+            if(lynq_operator_mcc_mnc[i].lynq_mcc_mnc == net.plmn)
+                break;
+            i++;
+        }
+
+        if(i == ARRAY_SIZE(lynq_operator_mcc_mnc))   // No found mcc&mnc
+        {
+            strcpy(OperatorFN, "UNKNOWN");
+            strcpy(OperatorSH, "UNKNOWN");
+            sprintf(MccMnc, "%d", net.plmn);
+        }
+        else
+        {
+            strcpy(OperatorFN, lynq_operator_mcc_mnc[i].lynq_operator_l);
+            strcpy(OperatorSH, lynq_operator_mcc_mnc[i].lynq_operator_s);
+            sprintf(MccMnc, "%d", lynq_operator_mcc_mnc[i].lynq_mcc_mnc);
+        }
+        memset(pt_info->long_eons,0,128);
+        memcpy(pt_info->long_eons,lynq_operator_mcc_mnc[i].lynq_operator_l,strlen(lynq_operator_mcc_mnc[i].lynq_operator_l));
+        memset(pt_info->short_eons,0,128);
+        memcpy(pt_info->short_eons,lynq_operator_mcc_mnc[i].lynq_operator_s,strlen(lynq_operator_mcc_mnc[i].lynq_operator_s));
+        memset(pt_info->mcc,0,4);
+        memset(pt_info->mnc,0,4);
+        sprintf(pt_info->mcc, "%d", (lynq_operator_mcc_mnc[i].lynq_mcc_mnc)/100);
+        sprintf(pt_info->mnc, "%d", (lynq_operator_mcc_mnc[i].lynq_mcc_mnc)%100);
+        //pt_info->act;
+        return 0;
+    }
+
+    return -1;
+}
+
+int qser_nw_get_reg_status(nw_client_handle_type h_nw, QSER_NW_REG_STATUS_INFO_T *pt_info)
+{
+    //UNUSED(h_nw);
+    //UNUSED(pt_info);
+    if (h_nw != g_nw_val || g_nw_val == -1)
+    {
+        LOGE("handle NULL");
+        return -1;
+    }
+
+    if(lynq_nw_info_handle == NULL)
+    {
+        LOGE("lynq_nw_info_handle == NULL.");
+        return -1;
+    }
+
+    if(pt_info == NULL)
+    {
+        LOGE("pt_info == NULL.");
+        return -1;
+    }
+
+    /*VOICE/DATA/IMS*/
+    mbtk_net_reg_info_t reg;
+    int err = mbtk_net_reg_get(lynq_nw_info_handle, &reg);
+    if(err)
+    {
+        LOGE("mbtk_net_reg_get fail.");
+        return -1;
+    }
+    else
+    {
+        memset(pt_info, 0x0, sizeof(QSER_NW_REG_STATUS_INFO_T));
+
+
+        char OperatorFN[128];
+        char OperatorSH[128];
+        char MccMnc[128];
+        mbtk_net_info_t net;
+        if(!mbtk_net_sel_mode_get(lynq_nw_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(lynq_operator_mcc_mnc))
+            {
+                if(lynq_operator_mcc_mnc[i].lynq_mcc_mnc == net.plmn)
+                    break;
+                i++;
+            }
+        
+            if(i == ARRAY_SIZE(lynq_operator_mcc_mnc))   // No found mcc&mnc
+            {
+                strcpy(OperatorFN, "UNKNOWN");
+                strcpy(OperatorSH, "UNKNOWN");
+                sprintf(MccMnc, "%d", net.plmn);
+            }
+            else
+            {
+                sprintf(MccMnc, "%d", lynq_operator_mcc_mnc[i].lynq_mcc_mnc);
+            }
+            sprintf(pt_info->data_registration_details_3gpp.mcc, "%d", (lynq_operator_mcc_mnc[i].lynq_mcc_mnc)/100);
+            sprintf(pt_info->data_registration_details_3gpp.mnc, "%d", (lynq_operator_mcc_mnc[i].lynq_mcc_mnc)%100);
+            sprintf(pt_info->voice_registration_details_3gpp.mcc, "%d", (lynq_operator_mcc_mnc[i].lynq_mcc_mnc)/100);
+            sprintf(pt_info->voice_registration_details_3gpp.mnc, "%d", (lynq_operator_mcc_mnc[i].lynq_mcc_mnc)%100);
+            //pt_info->act;
+        }
+
+        //暂时未知是否其他也被使用,现根据ql模块的传输情况,
+        //只配置3gpp,涉及call,data状态没有对应的匹配的就没有赋值
+
+        pt_info->voice_registration_valid = TRUE;
+        pt_info->voice_registration.deny_reason = 0;
+        pt_info->voice_registration.roaming = 0;
+        pt_info->voice_registration.tech_domain = 0;
+
+
+        pt_info->data_registration_valid = TRUE;
+        pt_info->data_registration.deny_reason = 0;
+        pt_info->data_registration.roaming = 0;
+        pt_info->data_registration.tech_domain = 0;
+
+        if (reg.call_state == 1 || reg.call_state == 5)
+        {
+            pt_info->voice_registration.registration_state = E_QSER_NW_SERVICE_FULL;
+        }
+        else if (reg.call_state == 0 || reg.call_state == 2 || reg.call_state == 3 || reg.call_state == 4)
+        {
+            pt_info->voice_registration.registration_state = E_QSER_NW_SERVICE_NONE;
+        }
+        
+        if (reg.data_state == 1 || reg.data_state == 5)
+        {
+            pt_info->data_registration.registration_state = E_QSER_NW_SERVICE_FULL;
+        }
+        else if (reg.data_state == 0 || reg.data_state == 2 || reg.data_state == 3 || reg.data_state == 4)
+        {
+            pt_info->data_registration.registration_state = E_QSER_NW_SERVICE_NONE;
+        }
+
+
+        pt_info->voice_registration_details_3gpp_valid = TRUE;
+        pt_info->voice_registration_details_3gpp.lac = reg.lac;
+        pt_info->voice_registration_details_3gpp.cid = reg.ci;
+        //补位填0 or 1
+        pt_info->voice_registration_details_3gpp.tech_domain = 1;
+        pt_info->voice_registration_details_3gpp.roaming = 0;
+        pt_info->voice_registration_details_3gpp.forbidden = 0;
+        pt_info->voice_registration_details_3gpp.psc = 0;
+        pt_info->voice_registration_details_3gpp.tac = 0;
+
+        pt_info->data_registration_details_3gpp_valid = TRUE;
+        pt_info->data_registration_details_3gpp.lac = reg.lac;
+        pt_info->data_registration_details_3gpp.cid = reg.ci;
+        //补位填0 or 1
+        pt_info->data_registration_details_3gpp.tech_domain = 1;
+        pt_info->data_registration_details_3gpp.roaming = 0;
+        pt_info->data_registration_details_3gpp.forbidden = 0;
+        pt_info->data_registration_details_3gpp.psc = 0;
+        pt_info->data_registration_details_3gpp.tac = 0;
+
+
+        pt_info->voice_registration_details_3gpp2_valid = FALSE;
+        //pt_info->voice_registration_details_3gpp2
+
+        pt_info->data_registration_details_3gpp2_valid = FALSE;
+        //pt_info->data_registration_details_3gpp2
+
+
+        switch(reg.type)
+        {
+            case MBTK_RADIO_TECH_GSM:
+            case MBTK_RADIO_TECH_GSM_COMPACT:
+            case MBTK_RADIO_TECH_GSM_EGPRS:
+            case MBTK_RADIO_TECH_UTRAN_HSPA:
+            {
+                pt_info->data_registration_details_3gpp.radio_tech = E_QSER_NW_RADIO_TECH_GPRS;
+                pt_info->voice_registration_details_3gpp.radio_tech = E_QSER_NW_RADIO_TECH_GSM;
+                pt_info->data_registration.radio_tech = E_QSER_NW_RADIO_TECH_GPRS;
+                pt_info->voice_registration.radio_tech = E_QSER_NW_RADIO_TECH_GSM;
+                break;
+            }
+            case MBTK_RADIO_TECH_UTRAN:
+            case MBTK_RADIO_TECH_UTRAN_HSDPA:
+            case MBTK_RADIO_TECH_UTRAN_HSUPA:
+            case MBTK_RADIO_TECH_UTRAN_HSDPA_HSUPA:
+            {
+                pt_info->data_registration_details_3gpp.radio_tech = E_QSER_NW_RADIO_TECH_UMTS;
+                pt_info->voice_registration_details_3gpp.radio_tech = E_QSER_NW_RADIO_TECH_UMTS;
+                pt_info->data_registration.radio_tech = E_QSER_NW_RADIO_TECH_UMTS;
+                pt_info->voice_registration.radio_tech = E_QSER_NW_RADIO_TECH_UMTS;
+                break;
+            }
+            case MBTK_RADIO_TECH_E_UTRAN:
+            {
+                pt_info->data_registration_details_3gpp.radio_tech = E_QSER_NW_RADIO_TECH_LTE;
+                pt_info->voice_registration_details_3gpp.radio_tech = E_QSER_NW_RADIO_TECH_LTE;
+                pt_info->data_registration.radio_tech = E_QSER_NW_RADIO_TECH_LTE;
+                pt_info->voice_registration.radio_tech = E_QSER_NW_RADIO_TECH_LTE;
+                break;
+            }
+            default:
+            {
+                pt_info->data_registration_details_3gpp.radio_tech = E_QSER_NW_RADIO_TECH_NONE;
+                pt_info->voice_registration_details_3gpp.radio_tech = E_QSER_NW_RADIO_TECH_NONE;
+                pt_info->data_registration.radio_tech = E_QSER_NW_RADIO_TECH_NONE;
+                pt_info->voice_registration.radio_tech = E_QSER_NW_RADIO_TECH_NONE;
+                pt_info->data_registration.registration_state = E_QSER_NW_SERVICE_NONE;
+                pt_info->voice_registration.registration_state = E_QSER_NW_SERVICE_NONE;
+                break;
+            }
+        }
+    }
+
+    return 0;
+}
+
+int qser_nw_get_signal_strength(nw_client_handle_type h_nw,QSER_NW_SIGNAL_STRENGTH_INFO_T *pt_info)
+{
+    //UNUSED(h_nw);
+    //UNUSED(pt_info);
+    if (h_nw != g_nw_val || g_nw_val == -1)
+    {
+        LOGE("handle NULL");
+        return -1;
+    }
+
+    if(lynq_nw_info_handle == NULL)
+    {
+        LOGE("lynq_nw_info_handle == NULL.");
+        return -1;
+    }
+
+    if(pt_info == NULL)
+    {
+        LOGE("pt_info == NULL.");
+        return -1;
+    }
+
+    int ret;
+    mbtk_signal_info_t signal;
+    ret = mbtk_net_signal_get(lynq_nw_info_handle, &signal);
+    if(ret != 0) {
+        LOGE("mbtk_net_signal_get fail.");
+        return -1;
+    }
+    else
+    {
+        memset(pt_info, 0x0, sizeof(QSER_NW_SIGNAL_STRENGTH_INFO_T));
+        
+        if(signal.type == MBTK_RADIO_TECH_GSM || signal.type == MBTK_RADIO_TECH_GSM_COMPACT || \
+           signal.type == MBTK_RADIO_TECH_GSM_EGPRS)              //GSM
+        {
+            pt_info->gsm_sig_info_valid = TRUE;
+            pt_info->gsm_sig_info.rssi = signal.rssi;
+        }
+        else if(signal.type == MBTK_RADIO_TECH_E_UTRAN)     //LTE
+        {
+            pt_info->lte_sig_info_valid = TRUE;
+            pt_info->lte_sig_info.rsrp = signal.rsrp;
+            pt_info->lte_sig_info.rsrq = signal.rsrq;
+            pt_info->lte_sig_info.snr = 0x7FFFFFFFF;                  //->MBTK接口无该参数(对应参数为rssnr,该值INT_MAX:0x7FFFFFFFF表示无效值),写死值为0x7FFFFFFFF 
+            pt_info->lte_sig_info.rssi = signal.rssi;
+        }
+        else if (signal.type == MBTK_RADIO_TECH_UTRAN || signal.type == MBTK_RADIO_TECH_UTRAN_HSDPA || \
+                 signal.type == MBTK_RADIO_TECH_UTRAN_HSUPA || signal.type == MBTK_RADIO_TECH_UTRAN_HSDPA_HSUPA ||  \
+                 signal.type == MBTK_RADIO_TECH_UTRAN_HSPA )//WCDMA
+        {
+            pt_info->wcdma_sig_info_valid = TRUE;
+            pt_info->wcdma_sig_info.rssi = signal.rssi;
+            pt_info->wcdma_sig_info.ecio = signal.ecno;
+        }
+        else
+        {
+            return -1;
+        }
+        /*
+        pt_info->gsm_sig_info_valid = 1//signal.gw_sig_valid;
+        pt_info->gsm_sig_info.rssi = signal.rssi;//signal.rssi-110;
+        pt_info->wcdma_sig_info_valid = 1//signal.wcdma_sig_valid;
+        pt_info->wcdma_sig_info.rssi = signal.rscp;//signal.wcdma_signalstrength-110;
+        pt_info->wcdma_sig_info.ecio = //signal.ecno/5;
+        pt_info->tdscdma_sig_info_valid = 0;
+        pt_info->lte_sig_info_valid = 1//signal.lte_sig_valid;
+        pt_info->lte_sig_info.rssi = -125;//signal.lte_signalstrength-110;
+        pt_info->lte_sig_info.rsrp = signal.rsrp;//signal.rsrp*(-1);
+        pt_info->lte_sig_info.rsrq = signal.rsrq;//signal.rsrq*(-1);
+        pt_info->lte_sig_info.snr = 0x7FFFFFFFF;//signal.rssnr;
+        pt_info->cdma_sig_info_valid = 0;
+        pt_info->hdr_sig_info_valid = 0;
+        //mbtk 无nr
+        pt_info->nr_sig_info_valid = 0//signal.nr_sig_valid;
+        pt_info->nr_sig_info.ssRsrp = 0//signal.ssRsrp;
+        pt_info->nr_sig_info.ssRsrq = 0//signal.ssRsrq;
+        pt_info->nr_sig_info.ssSinr = 0//signal.ssSinr;
+        pt_info->nr_sig_info.csiRsrp = 0//signal.csiRsrp;
+        pt_info->nr_sig_info.csiRsrq = 0//signal.csiRsrq;
+        pt_info->nr_sig_info.csiSinr = 0//signal.csiSinr;
+        */
+    }
+
+    return 0;
+}
+
+void net_state_change_cb(const void* data, int data_len)
+{
+    printf("Recv event indication : NET REG EVENT\n");
+    if(data && data_len > 0) {
+        const uint8 *ptr = (const uint8*)data;
+        if(*ptr == 0) { // CS
+            printf("CS:act=%d, mode=%d\n", *(ptr + 1), *(ptr + 2));
+        } else { // PS
+            printf("PS[%s]:act=%d, mode=%d\n", *(ptr + 3) == 0 ? "GSM/WCDMA" : "LTE", *(ptr + 1), *(ptr + 2));
+        }
+    } else
+        LOGD("ind is NULL");
+}
+
+
+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);
+
+    if (h_nw != g_nw_val || g_nw_val == -1)
+    {
+        LOGE("handle NULL");
+        return -1;
+    }
+
+    if(lynq_nw_info_handle == NULL)
+    {
+        LOGE("lynq_nw_info_handle == NULL.");
+        return -1;
+    }
+
+    lynq_func_cb_handle.handlerPtr = handlerPtr;
+    lynq_func_cb_handle.contextPtr = contextPtr;
+
+    mbtk_signal_state_change_cb_reg(lynq_nw_info_handle, lynq_signal_state_change_cb);
+    mbtk_net_state_change_cb_reg(lynq_nw_info_handle, net_state_change_cb);
+
+    return 0;
+}
+
+int qser_nw_set_oos_config (nw_client_handle_type h_nw, QSER_NW_OOS_CONFIG_INFO_T *pt_info)
+{
+    //UNUSED(h_nw);
+    //UNUSED(pt_info);
+    if (h_nw != g_nw_val || g_nw_val == -1)
+    {
+        LOGE("handle NULL");
+        return -1;
+    }
+
+    if (pt_info == NULL)
+    {
+        LOGE("QSER_NW_OOS_CONFIG_INFO_T NULL");
+        return -1;
+    }
+
+    uint32 oosPhase_0, oosPhase_1, oosPhase_2;
+    char tmp_type;
+    mbtk_oos_info oos_info;
+
+    memset(&oos_info, 0x00, sizeof(mbtk_oos_info));
+
+
+    tmp_type = pt_info->type;
+
+    if (tmp_type == QSER_NW_OOS_CFG_TYPE_FULL_BAND_SCAN)
+    {//如果没有配置对应的值,例如,10,20
+     //oosPhase_2这个位置没有配置,则使用默认值20,既不限制次数的5s进行一次扫描
+     //同理oosPhase_0,oosPhase_1这个位置没有配置,则使用默认值5,10,既限制次数5次的5s,10s进行一次扫描
+     //输入多少配置多少,可以缺省使用默认值
+        if (pt_info->u.full_band_scan_info.t_min < 0 || pt_info->u.full_band_scan_info.t_step < 0 || pt_info->u.full_band_scan_info.t_max < 0)
+        {
+            LOGE("qser_nw_set_oos_config set time < 0 ");
+            return -1;
+        }
+        else if ((pt_info->u.full_band_scan_info.t_min > 0 && pt_info->u.full_band_scan_info.t_min <= 255) && pt_info->u.full_band_scan_info.t_step == 0 && pt_info->u.full_band_scan_info.t_max == 0)
+        {
+            oosPhase_0 = pt_info->u.full_band_scan_info.t_min;
+            oos_info.mode = 1;
+            oos_info.oosPhase[0] = oosPhase_0;
+        }
+        else if ((pt_info->u.full_band_scan_info.t_min > 0 && pt_info->u.full_band_scan_info.t_min <= 255) && (pt_info->u.full_band_scan_info.t_step > 0 && pt_info->u.full_band_scan_info.t_step <= 255) && pt_info->u.full_band_scan_info.t_max == 0)
+        {
+            oosPhase_0 = pt_info->u.full_band_scan_info.t_min;
+            oosPhase_1 = pt_info->u.full_band_scan_info.t_step;
+            oos_info.mode = 1;
+            oos_info.oosPhase[0] = oosPhase_0;
+            oos_info.oosPhase[1] = oosPhase_1;
+        }
+        else if ((pt_info->u.full_band_scan_info.t_min > 0 && pt_info->u.full_band_scan_info.t_min <= 255) && (pt_info->u.full_band_scan_info.t_step > 0 && pt_info->u.full_band_scan_info.t_step <= 255) && (pt_info->u.full_band_scan_info.t_max > 0 && pt_info->u.full_band_scan_info.t_max <= 255))
+        {
+            oosPhase_0 = pt_info->u.full_band_scan_info.t_min;
+            oosPhase_1 = pt_info->u.full_band_scan_info.t_step;
+            oosPhase_2 = pt_info->u.full_band_scan_info.t_max;
+            oos_info.mode = 1;
+            oos_info.oosPhase[0] = oosPhase_0;
+            oos_info.oosPhase[1] = oosPhase_1;
+            oos_info.oosPhase[2] = oosPhase_2;
+        }
+        else if (pt_info->u.full_band_scan_info.t_min == 0 && pt_info->u.full_band_scan_info.t_step == 0 && pt_info->u.full_band_scan_info.t_max == 0)
+        {
+            oos_info.mode = 0;
+        }
+        else
+        {
+            LOGE("qser_nw_set_oos_config set Format err");
+            return -1;
+        }
+
+        int err = mbtk_oos_set(lynq_nw_info_handle, &oos_info);
+        if (err != 0)
+        {
+            LOGE("qser_nw_set_oos_config mbtk_oos_set err");
+            return -1;
+        }
+    }
+    else if (tmp_type == QSER_NW_OOS_CFG_TYPE_FAST_SCAN)
+    {
+        LOGE("Not currently supported");
+        return -1;
+    }
+    else
+    {
+        LOGE("type is error");
+        return -1;
+    }
+
+    return 0;
+}
+
+int qser_nw_get_oos_config (nw_client_handle_type h_nw, QSER_NW_OOS_CONFIG_INFO_T *pt_info)
+{
+    //UNUSED(h_nw);
+    //UNUSED(pt_info);
+    if (h_nw != g_nw_val || g_nw_val == -1)
+    {
+        LOGE("handle NULL");
+        return -1;
+    }
+
+    mbtk_oos_info oos_info;
+    uint32 oosPhase_0, oosPhase_1, oosPhase_2;
+    char cmd[100] = {0};
+
+    memset(&oos_info, 0x00, sizeof(mbtk_oos_info));
+
+    int err = mbtk_oos_get(lynq_nw_info_handle, &oos_info);
+    if (err != 0)
+    {
+        LOGE("qser_nw_get_oos_config mbtk_oos_get err ");
+        return -1;
+    }
+/*
+    printf("oos_info.mode =[%d] \n",oos_info.mode);
+    printf("oos_info.1 =[%d] \n",oos_info.oosPhase[0]);
+    printf("oos_info.2 =[%d] \n",oos_info.oosPhase[1]);
+    printf("oos_info.3 =[%d] \n",oos_info.oosPhase[2]);
+*/
+    if(oos_info.mode == 0)//关闭状态
+    {
+        pt_info->u.full_band_scan_info.t_min = 0;
+        pt_info->u.full_band_scan_info.t_step = 0;
+        pt_info->u.full_band_scan_info.t_max = 0;
+    }
+    else
+    {
+        pt_info->u.full_band_scan_info.t_min = (int)oos_info.oosPhase[0];
+        pt_info->u.full_band_scan_info.t_step = (int)oos_info.oosPhase[1];
+        pt_info->u.full_band_scan_info.t_max = (int)oos_info.oosPhase[2];
+    }
+    pt_info->type = QSER_NW_OOS_CFG_TYPE_FULL_BAND_SCAN;
+
+
+    if (pt_info == NULL)
+    {
+        LOGE("qser_nw_get_oos_config pt_info is null ");
+        return -1;
+    }
+
+    return 0;
+}
+
+int qser_nw_set_rf_mode (nw_client_handle_type h_nw, E_QSER_NW_RF_MODE_TYPE_T rf_mode)
+{
+    //UNUSED(h_nw);
+    //UNUSED(rf_mode);
+    int ret;
+    mbtk_modem_info_t info;
+
+    if (h_nw != g_nw_val || g_nw_val == -1)
+    {
+        LOGE("handle NULL");
+        return -1;
+    }
+
+    if(lynq_nw_info_handle == NULL)
+    {
+        LOGE("lynq_nw_info_handle == NULL.");
+        return -1;
+    }
+
+/*
+    if (rf_mode == 4)
+    {
+        printf("Flight Mode no Support Now\n");
+        return -1;
+    }
+*/
+    if (rf_mode != 4 && rf_mode != 0 && rf_mode != 1) 
+    {
+        LOGE("mode is error!");
+        return -1;
+    }
+
+    info.fun = rf_mode;
+    info.rst = 0;
+    ret = mbtk_set_modem_fun(lynq_nw_info_handle, &info);
+
+    //ret = mbtk_radio_state_set(lynq_nw_info_handle, rf_mode);
+    if (ret != 0)
+    {
+        LOGE("mbtk_radio_state_set fail.");
+        return -1;
+    }
+    else
+    {
+        LOGI("qser_nw_set_rf_mode is success\n");
+    }
+
+    return 0;
+}
+
+int qser_nw_get_rf_mode (nw_client_handle_type h_nw, E_QSER_NW_RF_MODE_TYPE_T *rf_mode)
+{
+    //UNUSED(h_nw);
+    //UNUSED(rf_mode);
+    int ret;
+    int tmp_rf;
+
+    if (h_nw != g_nw_val || g_nw_val == -1)
+    {
+        LOGE("handle NULL");
+        return -1;
+    }
+
+    if(lynq_nw_info_handle == NULL)
+    {
+        LOGE("lynq_nw_info_handle == NULL.");
+        return -1;
+    }
+
+    ret = mbtk_get_modem_fun(lynq_nw_info_handle, &tmp_rf);
+
+    //ret = mbtk_radio_state_get(lynq_nw_info_handle, &tmp_rf);
+    if (ret != 0)
+    {
+        LOGE("mbtk_radio_state_get fail.");
+        return -1;
+    }
+    else
+    {
+        LOGI("qser_nw_get_rf_mode is success\n");
+        *rf_mode = tmp_rf;
+    }
+
+
+    return 0;
+}
+
+int qser_nw_set_ims_enable(nw_client_handle_type        h_nw, E_QSER_NW_IMS_MODE_TYPE_T ims_mode)
+{
+    int ret = 0;
+
+    if (h_nw != g_nw_val || g_nw_val == -1)
+    {
+        LOGE("handle NULL");
+        return -1;
+    }
+
+    if(lynq_nw_info_handle == NULL)
+    {
+        LOGE("lynq_nw_info_handle == NULL.");
+        return -1;
+    }
+
+    ret = mbtk_net_ims_set(lynq_nw_info_handle, ims_mode);
+    if (ret != 0)
+    {
+        LOGE("mbtk_net_ims_set fail.");
+        return -1;
+    }
+
+    return 0;
+}
+
+int qser_nw_get_ims_reg_status(nw_client_handle_type h_nw, QSER_NW_IMS_REG_STATUS_INFO_T *pt_info)
+{
+    int ret = 0;
+    int tmp_pt;
+
+    if (h_nw != g_nw_val || g_nw_val == -1)
+    {
+        LOGE("handle NULL");
+        return -1;
+    }
+
+    if(lynq_nw_info_handle == NULL)
+    {
+        LOGE("lynq_nw_info_handle == NULL.");
+        return -1;
+    }
+
+    ret = mbtk_net_ims_reg_state_get(lynq_nw_info_handle, &tmp_pt);
+    if (ret != 0)
+    {
+        LOGE("mbtk_net_ims_get fail.");
+        return -1;
+    }
+
+    if (tmp_pt == 0)
+        pt_info->registration_state = E_QSER_NW_IMS_SERVICE_NONE;
+    else if (tmp_pt == 1)
+        pt_info->registration_state = E_QSER_NW_IMS_SERVICE_REGISTERED;
+    else
+    {
+        LOGE("mbtk_net_ims_get value error fail.");
+        return -1;
+    }
+
+    return 0;
+}
+
+
diff --git a/mbtk/liblynq_lib_v2/src/lynq_sim.c b/mbtk/liblynq_lib_v2/src/lynq_sim.c
new file mode 100755
index 0000000..78af51b
--- /dev/null
+++ b/mbtk/liblynq_lib_v2/src/lynq_sim.c
@@ -0,0 +1,746 @@
+#include "lynq_qser_sim.h"
+#include "mbtk_type.h"
+#include "mbtk_info_api.h"
+
+/****************************DEFINE***************************************/
+#define QSER_RESULT_SUCCESS 0
+#define QSER_RESULT_FAIL -1
+
+#define QSER_IMEI_SV_VERSION "01"
+
+/****************************DEFINE***************************************/
+
+/****************************VARIABLE***************************************/
+extern mbtk_info_handle_t* qser_info_handle;
+extern int qser_info_handle_num;
+static bool inited = FALSE;
+static uint qser_h_sim = 0x5F6F7F8F;
+static QSER_SIM_RxMsgHandlerFunc_t qser_sim_state_cb = NULL;
+static bool qser_sim_cb_state = false;
+/****************************VARIABLE***************************************/
+
+/******************************FUNC*****************************************/
+void qser_sim_state_change_cb(const void* data, int data_len)
+{
+    uint8 *ptr = (uint8*)data;
+    LOGE("[qser_sim] SIM state : %d\n", *ptr);
+    QSER_SIM_CARD_STATUS_INFO_T qser_sim_statue = {0};
+    if(*ptr == 0)
+    {
+        qser_sim_statue.e_card_state = QSER_SIM_CARD_STATE_ABSENT;
+    }
+    else if(*ptr == 1)
+    {
+        qser_sim_statue.e_card_state = QSER_SIM_CARD_STATE_PRESENT;
+    }
+    else if(*ptr == 18)
+    {
+        qser_sim_statue.e_card_state = QSER_SIM_CARD_STATE_ABSENT;
+    }
+    else
+    {
+        qser_sim_statue.e_card_state = QSER_SIM_CARD_STATE_UNKNOWN;
+    }
+    if(qser_sim_state_cb != NULL)
+    {
+        qser_sim_state_cb(&qser_sim_statue);
+    }
+}
+
+/******************************FUNC*****************************************/
+
+/****************************API***************************************/
+int qser_sim_client_init(sim_client_handle_type *ph_sim)
+{
+    //UNUSED(ph_sim);
+    if(ph_sim == NULL)
+    {
+        LOGE("[qser_sim] ph_sim is NULL.");
+        return QSER_RESULT_FAIL;
+    }
+
+    if(!inited && qser_info_handle == NULL)
+    {
+        qser_info_handle = mbtk_info_handle_get();
+        if(qser_info_handle)
+        {
+            qser_info_handle_num++;
+            inited = TRUE;
+            //mbtk_pdp_state_change_cb_reg(qser_info_handle, qser_wan_net_state_change_cb);
+        } 
+        else
+        {
+            LOGE("[qser_sim] mbtk_info_handle_get() fail.");
+            return QSER_RESULT_FAIL;
+        }
+    }
+    else
+    {
+        if(!inited)
+        {
+            qser_info_handle_num++;
+            inited = TRUE;
+            //mbtk_pdp_state_change_cb_reg(qser_info_handle, qser_wan_net_state_change_cb);
+        }
+    }
+    *ph_sim = qser_h_sim;
+
+    LOGE("[qser_sim] mbtk_info_handle_get() success.");
+    return QSER_RESULT_SUCCESS;
+}
+
+int qser_sim_getimsi(sim_client_handle_type h_sim, QSER_SIM_APP_ID_INFO_T *pt_info,char *imsi,size_t imsiLen)
+{
+    //UNUSED(h_sim);
+    UNUSED(pt_info);
+    //UNUSED(imsi);
+    //UNUSED(imsiLen);
+
+    if(h_sim != qser_h_sim)
+    {
+        LOGE("[qser_sim] h_sim is error.");
+        return QSER_RESULT_FAIL;
+    }
+
+    if(qser_info_handle == NULL)
+    {
+        LOGE("[qser_sim] handle is NULL.");
+        return QSER_RESULT_FAIL;
+    }
+
+    if(imsi == NULL || imsiLen < 15)
+    {
+        LOGE("[qser_sim] imsi is NULL.");
+        return QSER_RESULT_FAIL;
+    }
+
+    memset(imsi,0,imsiLen);
+    int err = mbtk_imsi_get(qser_info_handle, imsi);
+    if(err)
+    {
+        LOGE("[qser_sim] mbtk_imsi_get is fail.");
+        return QSER_RESULT_FAIL;
+    }
+
+    if(strlen(imsi) > imsiLen)
+    {
+        LOGE("[qser_sim] get datalength out of range.");
+        return QSER_RESULT_FAIL;
+    }
+
+    return QSER_RESULT_SUCCESS;
+}
+
+int qser_sim_geticcid(sim_client_handle_type h_sim,QSER_SIM_SLOT_ID_TYPE_T simId,char *iccid, size_t iccidLen)
+{
+    //UNUSED(h_sim);
+    UNUSED(simId);
+    //UNUSED(iccid);
+    //UNUSED(iccidLen);
+
+    if(h_sim != qser_h_sim)
+    {
+        LOGE("[qser_sim] h_sim is error.");
+        return QSER_RESULT_FAIL;
+    }
+
+    if(qser_info_handle == NULL)
+    {
+        LOGE("[qser_sim] handle is NULL.");
+        return QSER_RESULT_FAIL;
+    }
+
+    if(iccid == NULL || iccidLen < QSER_SIM_ICCID_LEN_MAX)
+    {
+        LOGE("[qser_sim] iccid is NULL.");
+        return QSER_RESULT_FAIL;
+    }
+
+    memset(iccid, 0, iccidLen);
+    int err = mbtk_iccid_get(qser_info_handle, iccid);
+    if(err)
+    {
+        LOGE("[qser_sim] mbtk_iccid_get is fail.");
+        return QSER_RESULT_FAIL;
+    }
+
+    if(strlen(iccid) > iccidLen)
+    {
+        LOGE("[qser_sim] get datalength out of range.");
+        return QSER_RESULT_FAIL;
+    }
+    
+    return QSER_RESULT_SUCCESS;
+}
+
+int qser_sim_getphonenumber(sim_client_handle_type h_sim,QSER_SIM_APP_ID_INFO_T *pt_info, char*phone_num, size_t phoneLen)
+{
+    //UNUSED(h_sim);
+    UNUSED(pt_info);
+    //UNUSED(phone_num);
+    //UNUSED(phoneLen);
+
+    if(h_sim != qser_h_sim)
+    {
+        LOGE("[qser_sim] h_sim is error.");
+        return QSER_RESULT_FAIL;
+    }
+
+    if(qser_info_handle == NULL)
+    {
+        LOGE("[qser_sim] handle is NULL.");
+        return QSER_RESULT_FAIL;
+    }
+
+    if(phone_num == NULL || phoneLen < 11)
+    {
+        LOGE("[qser_sim] phone_num is NULL.");
+        return QSER_RESULT_FAIL;
+    }
+
+    memset(phone_num, 0, phoneLen);
+    int err = mbtk_phone_number_get(qser_info_handle, phone_num);
+    if(err)
+    {
+        LOGE("[qser_sim] mbtk_phone_number_get is fail.");
+        return QSER_RESULT_FAIL;
+    }
+
+    if(strlen(phone_num) > phoneLen)
+    {
+        LOGE("[qser_sim] get datalength out of range.");
+        return QSER_RESULT_FAIL;
+    }
+
+    return QSER_RESULT_SUCCESS;
+}
+
+int qser_sim_verifypin(sim_client_handle_type h_sim,QSER_SIM_VERIFY_PIN_INFO_T *pt_info)
+{
+    //UNUSED(h_sim);
+    //UNUSED(pt_info);
+
+    if(h_sim != qser_h_sim)
+    {
+        LOGE("[qser_sim] h_sim is error.");
+        return QSER_RESULT_FAIL;
+    }
+
+    if(qser_info_handle == NULL)
+    {
+        LOGE("[qser_sim] handle is NULL.");
+        return QSER_RESULT_FAIL;
+    }
+
+    if(pt_info == NULL)
+    {
+        LOGE("[qser_sim] pt_info is NULL.");
+        return QSER_RESULT_FAIL;
+    }
+
+    int err = mbtk_verify_pin(qser_info_handle, pt_info->pin_value);
+    if(err)
+    {
+        LOGE("[qser_sim] mbtk_verify_pin is fail.");
+        return QSER_RESULT_FAIL;
+    }
+    
+    return QSER_RESULT_SUCCESS;
+}
+
+int qser_sim_changepin(sim_client_handle_type h_sim,QSER_SIM_CHANGE_PIN_INFO_T *pt_info)
+{
+    //UNUSED(h_sim);
+    //UNUSED(pt_info);
+
+    if(h_sim != qser_h_sim)
+    {
+        LOGE("[qser_sim] h_sim is error.");
+        return QSER_RESULT_FAIL;
+    }
+
+    if(qser_info_handle == NULL)
+    {
+        LOGE("[qser_sim] handle is NULL.");
+        return QSER_RESULT_FAIL;
+    }
+
+    if(pt_info == NULL)
+    {
+        LOGE("[qser_sim] pt_info is NULL.");
+        return QSER_RESULT_FAIL;
+    }
+
+    mbtk_change_pin_info pin_info = {0};
+    memcpy(pin_info.old_pin_value, pt_info->old_pin_value, pt_info->old_pin_value_len);
+    memcpy(pin_info.new_pin_value, pt_info->new_pin_value, pt_info->new_pin_value_len);
+    int err = mbtk_change_pin(qser_info_handle, &pin_info);
+    if(err)
+    {
+        LOGE("[qser_sim] mbtk_change_pin is fail.");
+        return QSER_RESULT_FAIL;
+    }
+    
+    return QSER_RESULT_SUCCESS;
+}
+
+int qser_sim_unblockpin(sim_client_handle_type h_sim, QSER_SIM_UNBLOCK_PIN_INFO_T *pt_info)
+{
+    //UNUSED(h_sim);
+    //UNUSED(pt_info);
+
+    if(h_sim != qser_h_sim)
+    {
+        LOGE("[qser_sim] h_sim is error.");
+        return QSER_RESULT_FAIL;
+    }
+
+    if(qser_info_handle == NULL)
+    {
+        LOGE("[qser_sim] handle is NULL.");
+        return QSER_RESULT_FAIL;
+    }
+
+    if(pt_info == NULL)
+    {
+        LOGE("[qser_sim] pt_info is NULL.");
+        return QSER_RESULT_FAIL;
+    }
+
+    mbtk_unlock_pin_info puk_pin_info = {0};
+    memcpy(puk_pin_info.pin_value, pt_info->new_pin_value, pt_info->new_pin_value_len);
+    memcpy(puk_pin_info.puk_value, pt_info->puk_value, pt_info->puk_value_len);
+    int err = mbtk_unlock_pin(qser_info_handle, &puk_pin_info);
+    if(err)
+    {
+        LOGE("[qser_sim] mbtk_unlock_pin is fail.");
+        return QSER_RESULT_FAIL;
+    }
+
+    return QSER_RESULT_SUCCESS;
+}
+
+int qser_sim_enablepin(sim_client_handle_type h_sim, QSER_SIM_ENABLE_PIN_INFO_T *pt_info)
+{
+    //UNUSED(h_sim);
+    //UNUSED(pt_info);
+
+    if(h_sim != qser_h_sim)
+    {
+        LOGE("[qser_sim] h_sim is error.");
+        return QSER_RESULT_FAIL;
+    }
+
+    if(qser_info_handle == NULL)
+    {
+        LOGE("[qser_sim] handle is NULL.");
+        return QSER_RESULT_FAIL;
+    }
+
+    if(pt_info == NULL)
+    {
+        LOGE("[qser_sim] pt_info is NULL.");
+        return QSER_RESULT_FAIL;
+    }
+
+    mbtk_enable_pin_info pin_info = {0};
+    memcpy(pin_info.pin_value, pt_info->pin_value, pt_info->pin_value_len);
+    pin_info.enable = 1;
+    int err = mbtk_enable_pin(qser_info_handle, &pin_info);
+    if(err)
+    {
+        LOGE("[qser_sim] mbtk_enable_pin is fail.");
+        return QSER_RESULT_FAIL;
+    }
+    
+    return QSER_RESULT_SUCCESS;
+}
+
+int qser_sim_disablepin(sim_client_handle_type h_sim, QSER_SIM_DISABLE_PIN_INFO_T *pt_info)
+{
+    //UNUSED(h_sim);
+    //UNUSED(pt_info);
+
+    if(h_sim != qser_h_sim)
+    {
+        LOGE("[qser_sim] h_sim is error.");
+        return QSER_RESULT_FAIL;
+    }
+
+    if(qser_info_handle == NULL)
+    {
+        LOGE("[qser_sim] handle is NULL.");
+        return QSER_RESULT_FAIL;
+    }
+
+    if(pt_info == NULL)
+    {
+        LOGE("[qser_sim] pt_info is NULL.");
+        return QSER_RESULT_FAIL;
+    }
+
+    mbtk_enable_pin_info pin_info = {0};
+    memcpy(pin_info.pin_value, pt_info->pin_value, pt_info->pin_value_len);
+    pin_info.enable = 0;
+    int err = mbtk_enable_pin(qser_info_handle, &pin_info);
+    if(err)
+    {
+        LOGE("[qser_sim] mbtk_enable_pin is fail.");
+        return QSER_RESULT_FAIL;
+    }
+    
+    return QSER_RESULT_SUCCESS;
+}
+
+int qser_sim_getcardstatus(sim_client_handle_type h_sim,QSER_SIM_SLOT_ID_TYPE_T simId,QSER_SIM_CARD_STATUS_INFO_T *pt_info)
+{
+    //UNUSED(h_sim);
+    //UNUSED(simId);
+    //UNUSED(pt_info);
+
+    if(h_sim != qser_h_sim)
+    {
+        LOGE("[qser_sim] h_sim is error.");
+        return QSER_RESULT_FAIL;
+    }
+
+    if(qser_info_handle == NULL)
+    {
+        LOGE("[qser_sim] handle is NULL.");
+        return QSER_RESULT_FAIL;
+    }
+
+    if(pt_info == NULL)
+    {
+        LOGE("[qser_sim] pt_info is NULL.");
+        return QSER_RESULT_FAIL;
+    }
+
+    mbtk_sim_state_enum sim;
+    mbtk_sim_card_type_enum sim_card_type;
+    mbtk_pin_puk_last_times qser_last_times = {0};
+    int err = mbtk_sim_state_get(qser_info_handle, &sim);
+    if(err)
+    {
+        LOGE("[qser_sim] mbtk_sim_state_get fail [err = %d].", err);
+        return QSER_RESULT_FAIL;
+    }
+    else
+    {
+        LOGE("[qser_sim] sim = %d.", sim);
+        memset(pt_info, 0x0, sizeof(QSER_SIM_CARD_STATUS_INFO_T));
+        switch (sim)
+        {
+            case 0:                     //ABSENT
+                pt_info->e_card_state = QSER_SIM_CARD_STATE_ABSENT;
+                break;
+            case 1:                     //NOT READY
+                pt_info->e_card_state = QSER_SIM_CARD_STATE_ABSENT;
+                break;
+            case 2:                     //READY
+                pt_info->e_card_state = QSER_SIM_CARD_STATE_PRESENT;
+                break;
+            case 3:                     //SIM PIN
+                pt_info->e_card_state = QSER_SIM_CARD_STATE_PRESENT;
+                break;
+            case 4:                     //SIM PUK
+                pt_info->e_card_state = QSER_SIM_CARD_STATE_PRESENT;
+                break;
+            case 5:                     //NETWORK
+                pt_info->e_card_state = QSER_SIM_CARD_STATE_ERROR_SIM_TECHNICAL_PROBLEMS;
+                break;
+            default:
+                pt_info->e_card_state = QSER_SIM_CARD_STATE_UNKNOWN;
+                break;
+        }
+    }
+    
+    err = mbtk_sim_card_type_get(qser_info_handle, &sim_card_type);
+    if(err)
+    {
+        LOGE("[qser_sim] mbtk_sim_state_get fail [err = %d].", err);
+        return QSER_RESULT_FAIL;
+    }
+    else
+    {
+        if(sim_card_type == 0 || sim_card_type == 2)
+            pt_info->e_card_type = QSER_SIM_CARD_TYPE_ICC;
+        else if(sim_card_type == 1 || sim_card_type == 3)
+            pt_info->e_card_type = QSER_SIM_CARD_TYPE_UICC;
+        else
+            pt_info->e_card_type = QSER_SIM_CARD_TYPE_UNKNOWN;
+    }
+    
+    err = mbtk_pin_last_num_get(qser_info_handle, &qser_last_times);
+    if(err)
+    {
+        LOGE("[qser_sim] mbtk_sim_state_get fail [err = %d].", err);
+        return QSER_RESULT_FAIL;
+    }
+    else
+    {
+        pt_info->card_app_info.app_3gpp.pin1_num_retries = qser_last_times.p1_retry;
+        pt_info->card_app_info.app_3gpp.pin2_num_retries = qser_last_times.p2_retry;
+        pt_info->card_app_info.app_3gpp.puk1_num_retries = qser_last_times.puk1_retry;
+        pt_info->card_app_info.app_3gpp.puk2_num_retries = qser_last_times.puk2_retry;
+    }
+
+    return QSER_RESULT_SUCCESS;
+}
+
+int qser_sim_getimei(sim_client_handle_type h_sim, char *imei)
+{
+    //UNUSED(h_sim);
+    //UNUSED(imei);
+
+    if(h_sim != qser_h_sim)
+    {
+        LOGE("[qser_sim] h_sim is error.");
+        return QSER_RESULT_FAIL;
+    }
+
+    if(qser_info_handle == NULL)
+    {
+        LOGE("[qser_sim] handle is NULL.");
+        return QSER_RESULT_FAIL;
+    }
+
+    if(imei == NULL)
+    {
+        LOGE("[qser_sim] imei is NULL.");
+        return QSER_RESULT_FAIL;
+    }
+
+    int err = mbtk_imei_get(qser_info_handle, imei);
+    if(err)
+    {
+        LOGE("[qser_sim] mbtk_imei_get Error : %d\n", err);
+        return QSER_RESULT_FAIL;
+    }
+    return QSER_RESULT_SUCCESS;
+}
+
+int qser_get_imei_and_sv(sim_client_handle_type h_sim,char *imei, char*sv)
+{
+    //UNUSED(h_sim);
+    //UNUSED(imei);
+    //UNUSED(sv);
+    if(h_sim != qser_h_sim)
+    {
+        LOGE("[qser_sim] h_sim is error.");
+        return QSER_RESULT_FAIL;
+    }
+
+    if(qser_info_handle == NULL)
+    {
+        LOGE("[qser_sim] handle is NULL.");
+        return QSER_RESULT_FAIL;
+    }
+
+    if(imei == NULL || sv == NULL)
+    {
+        LOGE("[qser_sim] param is NULL.");
+        return QSER_RESULT_FAIL;
+    }
+
+    int err = mbtk_imei_get(qser_info_handle, imei);
+    if(err)
+    {
+        LOGE("[qser_sim] mbtk_imei_get Error: %d\n", err);
+        return QSER_RESULT_FAIL;
+    }
+
+    memcpy(sv, QSER_IMEI_SV_VERSION, strlen(QSER_IMEI_SV_VERSION));
+
+    return QSER_RESULT_SUCCESS;
+}
+
+int qser_reset_modem(sim_client_handle_type h_sim)
+{
+    //UNUSED(h_sim);
+
+    if(h_sim != qser_h_sim)
+    {
+        LOGE("[qser_sim] h_sim is error.");
+        return QSER_RESULT_FAIL;
+    }
+
+    if(qser_info_handle == NULL)
+    {
+        LOGE("[qser_sim] handle is NULL.");
+        return QSER_RESULT_FAIL;
+    }
+
+    for(int cid =0; cid < MBTK_APN_CID_MAX; cid++)
+    {
+        mbtk_data_call_stop(qser_info_handle, cid, 1);
+    }
+
+
+    //mbtk_system_reboot(0);
+    mbtk_modem_info_t info;
+    info.fun = MBTK_DEV_MODEM_MIN_FUN;
+    info.rst = 0;
+    int err = mbtk_set_modem_fun(qser_info_handle, &info);
+    if(err)
+    {
+        LOGE("[qser_sim] mbtk_set_modem_fun Error : %d\n", err);
+        return QSER_RESULT_FAIL;
+    }
+
+    info.fun = MBTK_DEV_MODEM_FULL_FUN;
+    err = mbtk_set_modem_fun(qser_info_handle, &info);
+    if(err)
+    {
+        LOGE("[qser_sim] mbtk_set_modem_fun Error : %d\n", err);
+        return QSER_RESULT_FAIL;
+    }
+    return QSER_RESULT_SUCCESS;
+}
+
+int qser_get_version(sim_client_handle_type h_sim, char *buf)
+{
+    //UNUSED(h_sim);
+    //UNUSED(buf);
+
+    if(h_sim != qser_h_sim)
+    {
+        LOGE("[qser_sim] h_sim is error.");
+        return QSER_RESULT_FAIL;
+    }
+
+    if(qser_info_handle == NULL)
+    {
+        LOGE("[qser_sim] handle is NULL.");
+        return QSER_RESULT_FAIL;
+    }
+
+    if(buf == NULL)
+    {
+        LOGE("[qser_sim] buf is NULL.");
+        return QSER_RESULT_FAIL;
+    }
+
+    int err = mbtk_version_get(qser_info_handle, buf);
+    if(err)
+    {
+        LOGE("[qser_sim] mbtk_version_get Error : %d\n", err);
+        return QSER_RESULT_FAIL;
+    }
+    return QSER_RESULT_SUCCESS;
+}
+
+int qser_reset_sim(sim_client_handle_type h_sim)
+{
+    //UNUSED(h_sim);
+
+    if(h_sim != qser_h_sim)
+    {
+        LOGE("[qser_sim] h_sim is error.");
+        return QSER_RESULT_FAIL;
+    }
+
+    if(qser_info_handle == NULL)
+    {
+        LOGE("[qser_sim] handle is NULL.");
+        return QSER_RESULT_FAIL;
+    }
+
+    //mbtk_sim_power_set(0);
+    //sleep(1);
+    //mbtk_sim_power_set(1);
+    mbtk_modem_info_t info;
+    info.fun = MBTK_DEV_MODEM_DISABLE_SIM;
+    info.rst = 0;
+    int err = mbtk_set_modem_fun(qser_info_handle, &info);
+    if(err)
+    {
+        LOGE("[qser_sim] mbtk_set_modem_fun Error : %d\n", err);
+        return QSER_RESULT_FAIL;
+    }
+
+    info.fun = MBTK_DEV_MODEM_FULL_FUN;
+    err = mbtk_set_modem_fun(qser_info_handle, &info);
+    if(err)
+    {
+        LOGE("[qser_sim] mbtk_set_modem_fun Error : %d\n", err);
+        return QSER_RESULT_FAIL;
+    }
+    return QSER_RESULT_SUCCESS;
+}
+
+int qser_sim_addrxmsghandler(QSER_SIM_RxMsgHandlerFunc_t handlerPtr)
+{
+    if(qser_info_handle == NULL)
+    {
+        LOGE("[qser_sim] handle is NULL.");
+        return QSER_RESULT_FAIL;
+    }
+
+    if(handlerPtr == NULL)
+    {
+        LOGE("[qser_sim] param is NULL.");
+        qser_sim_state_cb = NULL;
+        return QSER_RESULT_SUCCESS;
+    }
+
+    qser_sim_state_cb = handlerPtr;
+    if(!qser_sim_cb_state)
+    {
+        int ret = mbtk_sim_state_change_cb_reg(qser_info_handle, qser_sim_state_change_cb);
+        if(ret != 0)
+        {
+            LOGE("[qser_sim] set cb fail.");
+            qser_sim_state_cb = NULL;
+            return QSER_RESULT_FAIL;
+        }
+    }
+
+    return QSER_RESULT_SUCCESS;
+}
+
+
+int qser_sim_client_deinit(sim_client_handle_type h_sim)
+{
+    //UNUSED(h_sim);
+    if(h_sim != qser_h_sim)
+    {
+        LOGE("[qser_sim] h_sim is error.");
+        return QSER_RESULT_FAIL;
+    }
+    
+    if(qser_info_handle)
+    {
+        LOGE("[qser_sim] qser_info_handle_num = %d", qser_info_handle_num);
+        if(qser_info_handle_num == 1)
+        { // 最后一个引用,可释放。
+            int ret = mbtk_info_handle_free(&qser_info_handle);
+            if(ret)
+            {
+                LOGE("[qser_sim] mbtk_info_handle_free() fail.");
+                return QSER_RESULT_FAIL;
+            }
+            else
+            {
+                qser_info_handle_num = 0;
+                qser_info_handle = NULL;
+                qser_sim_state_cb = NULL;
+                inited = FALSE;
+            }
+        } 
+        else
+        {
+            qser_info_handle_num--;
+            qser_sim_state_cb = NULL;
+        }
+    }
+    else
+    {
+        LOGE("[qser_sim] handle not inited.");
+        return QSER_RESULT_FAIL;
+    }
+
+    return QSER_RESULT_SUCCESS;
+}
+/****************************API***************************************/
+
diff --git a/mbtk/liblynq_lib_v2/src/lynq_sleep.c b/mbtk/liblynq_lib_v2/src/lynq_sleep.c
new file mode 100755
index 0000000..8c14793
--- /dev/null
+++ b/mbtk/liblynq_lib_v2/src/lynq_sleep.c
@@ -0,0 +1,694 @@
+#include "lynq-qser-autosuspend.h"
+
+#include <stdio.h>
+#include <unistd.h>
+#include <stddef.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <pthread.h>
+#include <string.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <sys/epoll.h>
+#include <linux/input.h>
+
+#include "mbtk_type.h"
+#include "mbtk_log.h"
+#include "mbtk_info_api.h"
+#include "mbtk_power.h"
+
+/*
+This module is system sleep, the system cannot sleep when the lock exists
+To verify whether it is in sleep state, it is necessary to test the power consumption
+Power management principle, as long as a wakelock lock exists, the system will not enter the Suspend state
+So the name can be arbitrarily chosen to indicate that such a lock is needed so that the system does not sleep
+*/
+#if defined(MBTK_PLATFORM_KERNEL_5)
+#define MTBK_POWERIND           "/system/etc/powerind"      //1806
+#elif defined(MBTK_PLATFORM_KERNEL_3)
+#define MTBK_POWERIND           "/etc/powerind"             //1803
+#endif
+
+static bool call_Off  = FALSE;
+static bool nw_off = FALSE;
+static bool sms_off = FALSE;
+static bool data_off = FALSE;
+
+static pthread_t lpm_t;
+static int edge_t = 0;
+static int epoll_fd_t = -1;
+static int fd_t = -1;
+static int socket_t[2];
+
+typedef struct{
+    qser_lpm_wakeupin_data_t wakeupin;
+    qser_lpm_wakeupout_data_t wakeupout;
+    qser_lpm_Handler_t wakehandle;
+}lynq_wake_t;
+
+static lynq_wake_t lpm_init;
+
+
+typedef struct
+{
+    int fd;
+    char name[64];
+} lock_name;
+
+#define LOCK_MAX_SIZE 129
+
+lock_name lynq_lock_name[LOCK_MAX_SIZE]={0};
+static bool autosleep_enable = FALSE;
+
+static mbtk_info_handle_t* whitelist_info_handle = NULL;
+
+static int powerrind_get()
+{
+    char buffer[4];
+    int ret = 0;
+
+    int fd = open(MTBK_POWERIND, O_RDWR | O_SYNC, 0662);
+    if (fd != -1)
+    {
+        read(fd, buffer, strlen(buffer)+1);
+        close(fd);
+    }
+
+    ret = atoi(buffer);
+
+    return ret;
+}
+
+#if 1
+static int sleep_epoll_deregister(int epoll_fd,int fd )
+{
+    int  ret;
+    do {
+        ret = epoll_ctl( epoll_fd, EPOLL_CTL_DEL, fd, NULL );
+    } while (ret < 0 && errno == EINTR);
+    return ret;
+}
+
+static int sleep_epoll_register(int epoll_fd, int fd)
+{
+    struct epoll_event  ev;
+    int    ret, flags;
+
+    /* important: make the fd non-blocking */
+    flags = fcntl(fd, F_GETFL);
+    fcntl(fd, F_SETFL, flags | O_NONBLOCK);
+
+    ev.events  = EPOLLIN;
+    ev.data.fd = fd;
+    do {
+        ret = epoll_ctl( epoll_fd, EPOLL_CTL_ADD, fd, &ev );
+    } while (ret < 0 && errno == EINTR);
+    
+    return ret;
+}
+#endif
+
+int qser_autosuspend_enable(char enable)
+{
+    //UNUSED(enable);
+
+    if((enable == 1) || enable == '1')
+    {
+        //if(!mbtk_system_sleep())
+        if(!access("/sys/power/autosleep", W_OK))
+        {
+            system("echo mem > /sys/power/autosleep");
+            autosleep_enable = TRUE;
+            return 0;
+        }
+        else
+        {
+            LOGE("/sys/power/autosleep can not write.");
+            return -1;
+        }
+    }
+    else if((enable == 0) || enable == '0')
+    {
+        if(!access("/sys/power/autosleep", W_OK))
+        {
+            system("echo off > /sys/power/autosleep");
+            autosleep_enable = FALSE;
+            return 0;
+        }
+        else
+        {
+            LOGE("/sys/power/autosleep can not write.");
+            return -1;
+        }
+    }
+    else
+    {
+        LOGE("qser_autosuspend_enablecan enable err.");
+        return -1;
+    }
+
+    return 0;
+}
+
+int qser_wakelock_create(const char* name , size_t len)
+{
+    //UNUSED(name);
+    //UNUSED(len);
+    int len_t;
+/*
+    if(!autosleep_enable) {
+        LOGE("Autosleep not enable.");
+        return -1;
+    }
+*/
+    len_t = strlen(name);
+
+    if((name != NULL) && (len < 33) && (len_t < 33))
+    {
+        int i;
+        //name
+        for(i=1 ;i<LOCK_MAX_SIZE;i++)
+        {
+            if(strcmp(lynq_lock_name[i].name, name) == 0)
+            {
+                LOGE("Repeated names.");
+                return -1;
+            }
+        }
+
+        for(i=1 ;i<LOCK_MAX_SIZE;i++)
+        {
+            if(lynq_lock_name[i].fd == 0)
+                break;
+        }
+        
+        if (i >= LOCK_MAX_SIZE)
+        {
+            LOGE("Fd is full.");
+            return -1;
+        }
+
+        memcpy(lynq_lock_name[i].name, name, strlen(name)+1);
+        lynq_lock_name[i].fd = i;
+        return lynq_lock_name[i].fd -1;//Starting from scratch
+    }
+    else
+        return -1;
+
+    return -1;
+}
+
+int qser_wakelock_lock(int fd)
+{
+    //UNUSED(fd);
+/*
+    if(!autosleep_enable) {
+        LOGE("Autosleep not enable.");
+        return -1;
+    }
+*/
+    int i;
+    for(i=1;i<LOCK_MAX_SIZE;i++)
+    {
+        if(lynq_lock_name[i].fd -1 == fd)
+            break;
+    }
+    if(i == LOCK_MAX_SIZE)
+    {
+        LOGE("LOCK_MAX_SIZE is full\n");
+        return -1;
+    }
+
+    if(!access("/sys/power/wake_lock", W_OK))
+    {
+        char cmd[128]={0};
+        sprintf(cmd, "echo %s > /sys/power/wake_lock", lynq_lock_name[i].name);
+        system(cmd);
+        return 0;
+    }
+    else
+    {
+        LOGE("/sys/power/wake_lock can not write.");
+        return -1;
+    }
+
+    return 0;
+}
+
+int qser_wakelock_unlock(int fd)
+{
+    //UNUSED(fd);
+/*
+    if(!autosleep_enable) {
+        LOGE("Autosleep not enable.");
+        return -1;
+    }
+*/
+    int i;
+    for(i=1;i<LOCK_MAX_SIZE;i++)
+    {
+        if(lynq_lock_name[i].fd -1 == fd)
+            break;
+    }
+    if(i == LOCK_MAX_SIZE)
+    {
+        LOGE("LOCK_MAX_SIZE is full\n");
+        return -1;
+    }
+
+    if(!access("/sys/power/wake_unlock", W_OK))
+    {
+        char cmd[128]={0};
+        sprintf(cmd, "echo %s > /sys/power/wake_unlock", lynq_lock_name[i].name);
+        system(cmd);
+        return 0;
+    }
+    else
+    {
+        LOGE("/sys/power/wake_unlock can not write.");
+        return -1;
+    }
+
+    return 0;
+}
+
+int qser_wakelock_destroy(int fd)
+{
+    //UNUSED(fd);
+/*
+    if(!autosleep_enable) {
+        LOGE("Autosleep not enable.");
+        return -1;
+    }
+*/
+    int i;
+    for(i=1;i<LOCK_MAX_SIZE;i++)
+    {
+        if(lynq_lock_name[i].fd -1 == fd)
+        break;
+    }
+
+    if(i == LOCK_MAX_SIZE)
+    {
+        LOGE("LOCK_MAX_SIZE is full\n");
+        return -1;
+    }
+    else
+    {
+        lynq_lock_name[i].fd = 0;
+        memset(lynq_lock_name[i].name, 0, 64);
+        return 0;
+    }
+
+    return 0;
+}
+
+void *threadFunction(void *arg)
+{
+    int pinValue;
+    int i;
+    char buf[8] = {0};
+    struct input_event ev_input = { 0 };
+    const int size = sizeof(struct input_event);
+
+    epoll_fd_t = epoll_create(2);
+/*
+    struct epoll_event event;
+    memset(&event, 0, sizeof(struct epoll_event));
+    event.events = EPOLLIN | EPOLLET;
+    event.data.fd = open("/dev/input/event0", O_RDONLY); // 根据实际情况指定正确的GPIO设备文件名
+
+    fd_t = event.data.fd;
+    if (epoll_ctl(epoll_fd_t, EPOLL_CTL_ADD, event.data.fd, &event) == -1)
+    {
+         LOGE("Failed to add GPIO device file.");
+         return NULL;
+    }
+
+    memset(&event, 0, sizeof(struct epoll_event));
+    event.events = EPOLLIN | EPOLLET;
+    event.data.fd = socket_t[0];
+    LOGE("threadFunction event.data.fd =[%d] ", event.data.fd);
+
+    if (epoll_ctl(epoll_fd_t, EPOLL_CTL_ADD, event.data.fd, &event) == -1)
+    {
+         LOGE("Failed to add GPIO device file.");
+         return NULL;
+    }
+*/
+
+#if defined(MBTK_SG_SUPPORT)
+    fd_t = open("/dev/input/event1", O_RDONLY);
+    LOGI("init sg pthread_event");
+#else
+    fd_t = open("/dev/input/event0", O_RDONLY);
+#endif
+
+    sleep_epoll_register(epoll_fd_t, fd_t);
+    sleep_epoll_register(epoll_fd_t, socket_t[1]);
+
+    while (true)
+    {
+        struct epoll_event events[2];
+        struct epoll_event ev;
+        int cmd = 0;
+
+        int numEvents = epoll_wait(epoll_fd_t, events, 2, -1);
+
+        for (i = 0; i < numEvents; ++i)
+        {
+            if ((events[i].events & EPOLLERR) || (events[i].events & EPOLLHUP))
+            {
+                LOGE("Error on GPIO device.");
+                return NULL;
+            }
+            else if ((events[i].events & EPOLLIN) || (events[i].events & EPOLLET))
+            {
+                //handleInterrupt(events[i].data.fd);
+                if (events[i].data.fd == socket_t[1])
+                {
+                    memset(buf, 0, sizeof(buf));
+                    read(socket_t[1], buf, sizeof(buf));
+                    if (1 == atoi(buf))
+                    {
+                        if(close(fd_t) == 0)
+                            LOGI("close(fd_t)ing");
+
+                        sleep_epoll_deregister(epoll_fd_t, socket_t[1]);
+                        sleep_epoll_deregister(epoll_fd_t, fd_t);
+                        /*
+                        memset(&ev, 0, sizeof(struct epoll_event));
+                        ev.events = EPOLLIN | EPOLLET;
+                        ev.data.fd = socket_t[1];
+                        epoll_ctl( epoll_fd_t, EPOLL_CTL_DEL, ev.data.fd, &ev);
+                        
+                        memset(&ev, 0, sizeof(struct epoll_event));
+                        ev.events = EPOLLIN | EPOLLET;
+                        ev.data.fd = fd_t;
+                        epoll_ctl( epoll_fd_t, EPOLL_CTL_DEL, ev.data.fd, &ev);
+                        */
+                        LOGI("do pthread_exit");
+                        return NULL;
+                    }
+                }
+                else if (events[i].data.fd == fd_t)
+                {
+                    LOGI("go pthread_event");
+                    memset(&ev_input, 0x00, size);
+                    read(fd_t, &ev_input, size);
+                    LOGI("ev_input type = %x, code = %x, value = %x", ev_input.type, ev_input.code,ev_input.value);
+                    if (ev_input.code == 2)
+                    {
+                        LOGI(">>>>ev_input.value = [%d]",ev_input.value);
+                        pinValue = (int)ev_input.value;
+                        edge_t = pinValue;
+                        lpm_init.wakehandle(edge_t);
+                    }
+                }
+                else
+                {
+                    LOGE("Unknown events[i].data.fd = %d", events[i].data.fd);
+                }
+            }
+       }
+    }
+    return NULL;
+}
+
+int qser_lpm_init(qser_lpm_Handler_t qser_lpm_handler, qser_pm_cfg_t *qser_lpm_cfg)
+{
+    //UNUSED(qser_lpm_handler);
+    //UNUSED(qser_lpm_cfg);
+    if (socketpair( AF_LOCAL, SOCK_STREAM, 0, socket_t ) < 0 ) 
+    {
+        LOGE("[qser_lpm_init] could not create thread control socket pair: %s", strerror(errno));
+
+        /*close the control socket pair && Retry again.*/
+        if(socket_t[0] > 0)
+        {
+            close(socket_t[0] );
+            socket_t[0] = -1;
+        }
+        
+        if(socket_t[1] > 0)
+        {
+            close(socket_t[1] );
+            socket_t[1] = -1;
+        }
+        return -1;
+    }
+    lpm_init.wakeupin.wakeupin_pin = qser_lpm_cfg->wakeupin.wakeupin_pin;
+    LOGI(">>pin = %d",lpm_init.wakeupin.wakeupin_pin);
+    lpm_init.wakeupin.wakeupin_edge = qser_lpm_cfg->wakeupin.wakeupin_edge;
+    LOGI(">>edge = %d",lpm_init.wakeupin.wakeupin_edge);
+    edge_t = qser_lpm_cfg->wakeupin.wakeupin_edge;//保留原始状态值 0 or 1
+    lpm_init.wakehandle = qser_lpm_handler;
+
+    pthread_attr_t thread_attr;
+    pthread_attr_init(&thread_attr);
+
+    if(pthread_attr_setdetachstate(&thread_attr, PTHREAD_CREATE_DETACHED))
+    {
+        LOGE("pthread_attr_setdetachstate() fail");
+        return -1;
+    }
+
+    if(pthread_create(&lpm_t, &thread_attr, threadFunction, NULL))
+    //if(pthread_create(&lpm_t, NULL, threadFunction, NULL))
+    {
+        LOGE("qser_lpm_init can't create thread");
+        return -1;
+    }
+
+    pthread_attr_destroy(&thread_attr);
+
+    //if (edge_t != qser_lpm_cfg->wakeupin.wakeupin_edge)//说明有变化,并且和原来的值不相同
+        //qser_lpm_handler(edge_t);
+
+    return 0;
+}
+
+int qser_lpm_deinit(void)
+{
+    char buf[4]={0};
+
+    if (fd_t == -1)
+        return 0;
+
+    if (fd_t != -1)
+    {
+        //char   cmd = 1;
+        strcpy(buf, "1");
+        void*  dummy = NULL;
+        write( socket_t[0], buf, sizeof(buf) );
+        //pthread_join(lpm_t, &dummy);
+
+        sleep(1);
+        // close the control socket pair
+        if(socket_t[0] > 0)
+        {
+            close(socket_t[0] );
+            socket_t[0] = -1;
+        }
+        if(socket_t[1] > 0)
+        {
+            close(socket_t[1] );
+            socket_t[1] = -1;
+        }
+
+        //重置还原
+        fd_t = -1;
+
+    }
+
+    return 0;
+}
+
+/*
+例如AT*POWERIND=31,就相当于设置NETWORK、SIM、SMS、CS CALL、PS DATA变化时都不主动上报,
+其中PS DATA目前暂时不支持,只是保留了这个标志位;
+AP power state: 1~31 means suspend, bitmap: bit0 - NETWORK;bit1 - SIM;bit2 - SMS;bit3 - CS CALL;bit4 - PS DATA
+0 means resume all.
+目标文件"/system/etc/powerind"
+如果bit0-bit3都配置可以采用的值是1-15,如果是当前采用NETWORK SMS CALL 则值的取值是 1 4 8 5 9 12 13
+
+*/
+
+int qser_whitelist_set(char* whitelish)
+{
+    //UNUSED(whitelish);
+    uint32 on = 0;
+    int call_t, nw_t, data_t, sms_t, tmp;
+
+    int len = strlen(whitelish);
+
+    if (len != 4)
+    {
+        LOGE("whitelish num error num=[%d]",len);
+        return -1;
+    }
+
+    tmp = atoi(whitelish);
+
+    call_t = tmp/1000;
+    nw_t = tmp%1000/100;
+    data_t = tmp%1000%100/10;
+    sms_t = tmp%1000%100%10;
+
+    if (call_t == 1)
+        call_Off = TRUE;
+    else
+        call_Off = FALSE;
+
+    if (nw_t == 1)
+        nw_off = TRUE;
+    else
+        nw_off = FALSE;
+
+    if (data_t == 1)
+        data_off = TRUE;
+    else
+        data_off = FALSE;
+
+    if (sms_t == 1)
+        sms_off = TRUE;
+    else
+        sms_off = FALSE;
+
+    if (call_Off == FALSE && nw_off == FALSE && data_off == FALSE && sms_off == FALSE)
+    {
+        on = 29;//0000的情况,所有上报源都屏蔽,SIM的上报会一直被包含在内
+    }
+    else
+    {
+        if (call_Off == TRUE)
+            call_t = 8;
+        else
+            call_t = 0;
+
+        if (nw_off == TRUE)
+            nw_t = 1;
+        else
+            nw_t = 0;
+
+        if (data_off == TRUE)
+            data_t = 16;
+        else
+            data_t = 0;
+
+        if (sms_off == TRUE)
+            sms_t = 4;
+        else
+            sms_t = 0;
+
+        on = 29 - (call_t + nw_t + data_t + sms_t);//SIM的上报会一直被包含在内
+    }
+
+    if(whitelist_info_handle == NULL)
+    {
+        whitelist_info_handle = mbtk_info_handle_get();
+        if(whitelist_info_handle)
+        {
+            LOGI("creat whitelist_info_handle is success");
+        }
+        else
+        {
+            LOGE("creat whitelist_info_handle is fail");
+            return -1;
+        }
+    }
+
+    int err = mbtk_wakeup_state_set(whitelist_info_handle, on);
+    if(err)
+    {
+        LOGE("whitelist_info_handle Error : %d", err);
+        return -1;
+    }
+
+    return 0;
+}
+
+
+int qser_whitelist_get(char* whitelish)
+{
+    //UNUSED(whitelish);
+    char list[10]={0};
+    int call_t, nw_t, data_t, sms_t;
+    int get_tmp;
+
+    get_tmp = powerrind_get();
+    //LOGI(">>>get_tmp: %d",get_tmp);
+
+    //call 8   nw 1   data 16  sms 4    SIM的上报会一直被包含在内
+    switch(get_tmp)
+    {
+        case 0:
+            sprintf(list, "%d%d%d%d", 1, 1, 1, 1);
+            break;
+        case 8:
+            sprintf(list, "%d%d%d%d", 0, 1, 1, 1);
+            break;
+        case 1:
+            sprintf(list, "%d%d%d%d", 1, 0, 1, 1);
+            break;
+        case 16:
+            sprintf(list, "%d%d%d%d", 1, 1, 0, 1);
+            break;
+        case 4:
+            sprintf(list, "%d%d%d%d", 1, 1, 1, 0);
+            break;
+
+        case 9:
+            sprintf(list, "%d%d%d%d", 0, 0, 1, 1);
+            break;
+        case 24:
+            sprintf(list, "%d%d%d%d", 0, 1, 0, 1);
+            break;
+        case 12:
+            sprintf(list, "%d%d%d%d", 0, 1, 1, 0);
+            break;
+        case 17:
+            sprintf(list, "%d%d%d%d", 1, 0, 0, 1);
+            break;
+        case 5:
+            sprintf(list, "%d%d%d%d", 1, 0, 1, 0);
+            break;
+        case 20:
+            sprintf(list, "%d%d%d%d", 1, 1, 0, 0);
+            break;
+
+        case 25:
+            sprintf(list, "%d%d%d%d", 0, 0, 0, 1);
+            break;
+        case 13:
+            sprintf(list, "%d%d%d%d", 0, 0, 1, 0);
+            break;
+        case 28:
+            sprintf(list, "%d%d%d%d", 0, 1, 0, 0);
+            break;
+        case 21:
+            sprintf(list, "%d%d%d%d", 1, 0, 0, 0);
+            break;
+
+        case 29:
+            sprintf(list, "%d%d%d%d", 0, 0, 0, 0);
+            break;
+
+         default :
+            LOGE("qser_whitelist_get is error");
+            break;
+    }
+
+    //LOGI(">>>get list: %s",list);
+    strncpy(whitelish, list, strlen(list));
+
+    if(whitelist_info_handle != NULL)
+    {
+        mbtk_info_handle_free(&whitelist_info_handle);
+        LOGI("deinit whitelist_info_handle is succuess");
+    }
+
+    return 0;
+}
+
diff --git a/mbtk/liblynq_lib_v2/src/lynq_sms.c b/mbtk/liblynq_lib_v2/src/lynq_sms.c
new file mode 100755
index 0000000..ed9c1b3
--- /dev/null
+++ b/mbtk/liblynq_lib_v2/src/lynq_sms.c
@@ -0,0 +1,563 @@
+#include "lynq_qser_sms.h"
+#include "mbtk_type.h"
+#include "mbtk_pdu_sms.h"
+#include "mbtk_info_api.h"
+#include "lynq_sms.h"
+#include "mbtk_log.h"
+
+
+#include <stdio.h>
+#include <stdlib.h>
+
+
+#define TELEPHONE_NUM_MAX 16
+#define MSM_NUMBER_MAX 1024+1
+#define RES_NUM_MIN 128
+
+
+#define DSC_to_msg(DSC) (DSC == 0 ? "Bit7" : (DSC == 1 ? "Bit8" : "UCS2"))
+
+static mbtk_info_handle_t* sms_info_handle = NULL;
+static char sms_center_address[128] = {0};
+
+typedef struct
+{
+    QSER_SMS_RxMsgHandlerFunc_t handlerPtr;
+    void* contextPtr;
+} lynq_sms_cb_func;
+
+static lynq_sms_cb_func lynq_sms_func_cb_handle;
+
+sms_client_handle_type g_sms_val = -1;
+
+
+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);
+
+    if (!strncmp("+CMT:", ptr, 5))//丢弃无用消息
+        return ;
+
+    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));
+    */
+    QSER_SMS_Msg_t* tmp_data = NULL;
+
+    tmp_data = (QSER_SMS_Msg_t*)malloc(sizeof(QSER_SMS_Msg_t));
+    memset(tmp_data,0x00, sizeof(QSER_SMS_Msg_t));
+
+    tmp_data->format = s.DCS;
+    //printf("t数据编码方案: %d\n", tmp_data->format);
+    memcpy(tmp_data->src_addr, s.OA, strlen(s.OA));
+    //printf("t发送方地址: %s\n", tmp_data->src_addr);
+    memcpy(tmp_data->timestamp, s.SCTS, strlen(s.SCTS));
+    //printf("t服务中心时间戳: %s\n", tmp_data->timestamp);
+    tmp_data->sms_data_len = strlen(s.UD);
+    //printf("t消息内容长度: %d\n", tmp_data->sms_data_len);
+    memcpy(tmp_data->sms_data, s.UD, strlen(s.UD));
+    //printf("t消息内容: %s\n", tmp_data->sms_data);
+
+    lynq_sms_func_cb_handle.handlerPtr(tmp_data, NULL);
+
+    free(tmp_data);
+    
+}
+
+
+int qser_sms_client_init(sms_client_handle_type *ph_sms)//out
+{
+    //UNUSED(ph_sms);
+
+    if(sms_info_handle == NULL)
+    {
+        sms_info_handle = mbtk_info_handle_get();
+        if(sms_info_handle)
+        {
+            LOGI("creat sms_info_handle is success");
+            *ph_sms = sms_info_handle->client_fd;
+            g_sms_val = sms_info_handle->client_fd;
+        }
+        else
+        {
+            LOGE("creat sms_info_handle is fail");
+            return -1;
+        }
+    }
+
+    return 0;
+}
+
+int qser_sms_client_deinit(sms_client_handle_type h_sms)//in
+{
+    //UNUSED(h_sms);
+    if (h_sms != g_sms_val || g_sms_val == -1)
+    {
+        LOGE("handle NULL\n");
+        return -1;
+    }
+
+    mbtk_sms_state_change_cb_reg(sms_info_handle, NULL);
+
+    if(sms_info_handle)
+    {
+        mbtk_info_handle_free(&sms_info_handle);
+        LOGI("deinit sms_info_handle is succuess");
+    }
+    else
+    {
+        LOGE("deinit sms_info_handle is fail");
+        return -1;
+    }
+
+    return 0;
+}
+
+int qser_sms_send_sms(sms_client_handle_type h_sms, QSER_sms_info_t *pt_sms_info)//in in 发送短信的内容、目的号码
+{
+    //UNUSED(h_sms);
+    //UNUSED(pt_sms_info);
+    if (h_sms != g_sms_val || g_sms_val == -1)
+    {
+        LOGE("handle NULL");
+        return -1;
+    }
+
+    if (pt_sms_info == NULL)
+    {
+        LOGE("QSER_sms_info_t NULL");
+        return -1;
+    }
+
+    if(sms_info_handle == NULL)
+    {
+        LOGE("qser_sms_send_sms sms_info_handle NULL");
+        return -1;
+    }
+
+    uint8_t *phone_num = NULL, *data = NULL;
+
+    char cmgs[MSM_NUMBER_MAX] = {0};
+    char resp[RES_NUM_MIN] = {0};
+    char pdu_data[512] = {0};
+    char phone_lenth[10] = {0};
+    char mem[10] = {0};
+    char *p = pdu_data;
+    int mode = 0;
+    int err = 0;
+    int i = 0;
+
+    data = pt_sms_info->sms_data;
+
+    phone_num = pt_sms_info->src_addr;
+
+    if (pt_sms_info->format == 0)//7
+        mode = 1;
+    else if (pt_sms_info->format == 1)//8
+        return SMS_ERR;
+    else if (pt_sms_info->format == 2)//USC2
+        mode = 0;
+    else
+        return -1;
+
+    //设置存储器
+/*
+    if (pt_sms_info->storage == 0)
+    {
+        strcpy(mem, "SM");
+    }
+    else if (pt_sms_info->storage == 1)
+    {
+        strcpy(mem, "ME");
+    }
+    else
+    {
+        LOGE("qser_sms_deletefromstorage storage is no Support");
+        return -1;
+    }
+
+    memset(resp, 0, sizeof(resp));
+    err = mbtk_sms_cpms_set(sms_info_handle, mem, resp);
+    if(err) {
+        LOGE("Error : %d", err);
+    } else {
+        LOGI("cpms set success. resp:%s", resp);
+    }
+*/
+    if(data == NULL)
+    {
+        LOGE("qser_sms_send_sms data NULL");
+        return -1;
+    }
+
+    if(phone_num == NULL)
+    {
+        LOGE("qser_sms_send_sms phone_num NULL");
+        return -1;
+    }
+
+    if(strlen(data) > 512 || strlen(data) == 0 || strlen(phone_num) == 0)
+    {
+        LOGE("strlen(telephony_num):%d", strlen(phone_num));
+        LOGE("strlen(msg):%d", strlen(data));
+        return -1;
+    }
+
+    if (mode == 0)// PDU
+    {
+#if 1
+        if (sms_center_address[0] == '\0')
+        {
+            memset(sms_center_address, 0, sizeof(sms_center_address));
+            memcpy(sms_center_address, "+8613800280500", strlen("+8613800280500"));
+        }
+
+        //printf("phone_num:%s\n", phone_num);
+        //printf("sms_center_address:%s\n", sms_center_address);
+        //printf("data:%s\n", data);
+
+        char* pdu = NULL;
+        char* smsc = SCAEncoding(sms_center_address);
+        struct PDUS *pdus = PDUEncoding(sms_center_address,phone_num, data, NULL);
+
+        for (i = 0; i < pdus->count; i++)
+        {
+             LOGI("第 %d 条:", i + 1);
+             LOGI("%s\n", pdus->PDU[i]);
+             pdu = pdus->PDU[i];
+        }
+
+        sprintf(p, "%s",smsc);
+        LOGI("pdu_data:%s", pdu_data);
+        sprintf(p+strlen(p), "%s", pdu);
+        LOGI("pdu_data:%s",pdu_data);
+
+        //sprintf(cmgs,"%d,%s",strlen(pdu_data), pdu_data);
+        int t = strlen(pdu_data);
+        sprintf(cmgs,"%d,%s",(t-18)/2, pdu_data);
+        LOGI("cmgs:%s", cmgs);
+#else
+        char *tmp_t = "0891683108200805F011000D91688189914026F3000800044F60597D";
+        sprintf(cmgs,"%d,%s",19,tmp_t);
+        printf("cmgs:%s\n", cmgs);
+#endif
+
+        memset(resp, 0, sizeof(resp));
+
+        err = mbtk_sms_cmgf_set(sms_info_handle, mode);
+        if(err)
+        {
+           LOGE("cmgf set error : %d", err);
+        }
+        else
+        {
+           LOGI("cmgf set success");
+        }
+
+        err = mbtk_sms_cmgs_set(sms_info_handle, cmgs, resp);
+        if(err)
+        {
+            LOGE("Error : %d", err);
+            return -1;
+        }
+        else
+        {
+            LOGI("cmgs set success . resp:%s", resp);
+        }
+    }
+    else if (mode == 1)   // text
+    {
+        err = mbtk_sms_cmgf_set(sms_info_handle, mode);
+        if(err)
+        {
+           LOGE("cmgf set error : %d", err);
+        }
+        else
+        {
+           LOGI("cmgf set success");
+        }
+
+        sprintf(cmgs,"%s,%s", phone_num, data);
+        LOGI("cmgs:%s", cmgs);
+
+        memset(resp, 0, sizeof(resp));
+
+        err = mbtk_sms_cmgs_set(sms_info_handle, cmgs, resp);
+        if(err)
+        {
+            LOGE("Error : %d", err);
+            return -1;
+        }
+        else
+        {
+            LOGI("cmgs set success . resp:%s", resp);
+        }
+    }
+    else
+    {
+        LOGE("Error : mode");
+        return -1;
+    }
+
+    return 0;
+}
+
+//注册接收新短信
+int qser_sms_addrxmsghandler(QSER_SMS_RxMsgHandlerFunc_t handlerPtr, void* contextPtr)//in sms电话状态回调函数 in 主要是获取 上报 的内容
+{
+    //UNUSED(handlerPtr);
+    //UNUSED(contextPtr);
+
+    if(sms_info_handle == NULL)
+    {
+        LOGE("qser_sms_addrxmsghandler sms_info_handle NULL");
+        return -1;
+    }
+
+    int err = mbtk_sms_cnmi_set(sms_info_handle);
+    if(err)
+    {
+        LOGE("set cnmi fail");
+        return -1;
+    }
+
+    lynq_sms_func_cb_handle.handlerPtr = handlerPtr;
+    lynq_sms_func_cb_handle.contextPtr = contextPtr;
+
+    mbtk_sms_state_change_cb_reg(sms_info_handle, lynq_sms_state_change_cb);
+
+    return 0;
+}
+
+//删除短信
+int qser_sms_deletefromstorage(sms_client_handle_type h_sms, QSER_sms_storage_info_t *pt_sms_storage)//in in 删除短信的信息
+{
+    //UNUSED(h_sms);
+    //UNUSED(pt_sms_storage);
+    char cmgd[128] = {0};
+    int err = 0;
+
+    int t_storage = 0;
+    char mem[10] = {0};
+    char resp[RES_NUM_MIN] = {0};
+
+    if (h_sms != g_sms_val || g_sms_val == -1)
+    {
+        LOGE("handle NULL");
+        return -1;
+    }
+
+    if(pt_sms_storage == NULL)
+    {
+        LOGE("qser_sms_deletefromstorage pt_sms_storage NULL");
+        return -1;
+    }
+
+    if(sms_info_handle == NULL)
+    {
+        LOGE("qser_sms_deletefromstorage sms_info_handle NULL");
+        return -1;
+    }
+/*
+    t_storage = pt_sms_storage->storage; //设置存储器
+
+    if (t_storage == 0)
+    {
+        strncpy(mem, "SM", 2);
+    }
+    else if (t_storage == 1)
+    {
+        strncpy(mem, "ME", 2);
+    }
+    else
+    {
+        LOGE("qser_sms_deletefromstorage storage is no Support");
+        return -1;
+    }
+
+    memset(resp, 0, sizeof(resp));
+    err = mbtk_sms_cpms_set(sms_info_handle, mem, resp);
+    if(err) {
+        LOGE("Error : %d", err);
+    } else {
+        LOGI("cpms set success. resp:%s", resp);
+    }
+*/
+    uint32_t id_x = 0; //若后面其他产品是int类型则用宏控制
+    id_x = pt_sms_storage->storage_idx;//获取idx的值
+
+    if(id_x == -1)      //delete all
+    {
+        memcpy(cmgd, "0,4", strlen("0,4"));
+    }
+    else
+    {
+        sprintf(cmgd,"%d",id_x);
+    }
+
+    LOGI("cmgd:%s", cmgd);
+
+    err = mbtk_sms_cmgd_set(sms_info_handle, cmgd);
+    if(err)
+    {
+        LOGE("qser_sms_deletefromstorage Error : %d", err);
+        return -1;
+    }
+    else
+    {
+        LOGI("qser_sms_deletefromstorage set success");
+    }
+
+    return 0;
+}
+
+//获取短信中心号码
+int qser_sms_getsmscenteraddress( sms_client_handle_type h_sms,QSER_sms_service_center_cfg_t *set_sca_cfg)//in out
+{
+    //UNUSED(h_sms);
+    //UNUSED(set_sca_cfg);
+    char sms_center_addree[254] = {0};
+    int len_t;
+    char *p1, *p2 ,*substr;
+
+    if (h_sms != g_sms_val || g_sms_val == -1)
+    {
+        LOGE("handle NULL");
+        return -1;
+    }
+
+    if (set_sca_cfg == NULL)
+    {
+        LOGE("QSER_sms_service_center_cfg_t NULL");
+        return -1;
+    }
+
+    if(sms_info_handle == NULL)
+    {
+        LOGE("qser_sms_getsmscenteraddress sms_info_handle NULL");
+        return -1;
+    }
+
+    int err = mbtk_sms_csca_get(sms_info_handle, sms_center_addree);
+    if(sms_center_addree[0] == '\0')
+    {
+        LOGE("qser_sms_getsmscenteraddress Error : %d", err);
+        return -1;
+    }
+    else
+    {
+        p1 = strchr(sms_center_addree, '\"');
+        p2 = strrchr(sms_center_addree, '\"');
+        if (p1 && p2 && p2 > p1)
+        {
+            len_t = p2 - p1 - 1;
+            char substr_t[len_t + 1];
+            strncpy(substr_t, p1 + 1, len_t);
+            substr_t[len_t] = '\0';
+
+            substr = substr_t;
+            
+            memcpy(set_sca_cfg->service_center_addr, substr, strlen(substr));
+            memcpy(sms_center_address, substr, strlen(substr));
+
+            LOGI("qser_sms_getsmscenteraddress success");
+        }
+        else
+        {
+            LOGE("String inside double quotes not found");
+            return -1;
+        }
+    }
+
+    return 0;
+}
+
+//设置短信中心号码
+int qser_sms_setsmscenteraddress( sms_client_handle_type h_sms, QSER_sms_service_center_cfg_t *get_sca_cfg)//in in
+{
+    //UNUSED(h_sms);
+    //UNUSED(get_sca_cfg);
+    char *destNum = NULL;
+
+    if (h_sms != g_sms_val || g_sms_val == -1)
+    {
+        LOGE("handle NULL");
+        return -1;
+    }
+
+    if(sms_info_handle == NULL)
+    {
+        LOGE("qser_sms_setsmscenteraddress sms_info_handle NULL");
+        return -1;
+    }
+
+    if(get_sca_cfg == NULL)
+    {
+        LOGE("qser_sms_setsmscenteraddress get_sca_cfg NULL");
+        return -1;
+    }
+
+    destNum = get_sca_cfg->service_center_addr;
+
+    //printf("1destNum:%s\n", destNum);
+    memset(sms_center_address, 0, sizeof(sms_center_address));
+    memcpy(sms_center_address, destNum, strlen(destNum));
+
+    if (destNum == NULL)
+    {
+        LOGE("qser_sms_setsmscenteraddress destNum NULL");
+        return -1;
+    }
+
+    int err = mbtk_sms_csca_set(sms_info_handle, destNum);
+    if(err)
+    {
+        LOGE("Error : %d", err);
+        return -1;
+    }
+    else
+    {
+    //    memset(sms_center_address, 0, sizeof(sms_center_address));
+    //    memcpy(sms_center_address, destNum, strlen(destNum));
+        //printf("destNum:%s\n", destNum);
+        LOGI("qser_sms_setsmscenteraddress success");
+    }
+
+    return 0;
+}
+
+
+//显示删除列表
+int qser_sms_deletefromstoragelist( sms_client_handle_type h_sms, char* del_list)//in out
+{
+    //UNUSED(h_sms);
+    //UNUSED(get_sca_cfg);
+
+    if (h_sms != g_sms_val || g_sms_val == -1)
+    {
+        LOGE("handle NULL");
+        return -1;
+    }
+
+    if(sms_info_handle == NULL)
+    {
+        LOGE("qser_sms_deletefromstoragelist sms_info_handle NULL");
+        return -1;
+    }
+
+    int err = mbtk_sms_cmgd_get(sms_info_handle, del_list);
+    if(err > 0  && err != 300)//MBTK_INFO_ERR_SUCCESS
+    {
+        LOGE("Error : %d", err);
+        return -1;
+    }
+
+    return 0;
+}
+
diff --git a/mbtk/liblynq_lib_v2/src/lynq_thermal.c b/mbtk/liblynq_lib_v2/src/lynq_thermal.c
new file mode 100755
index 0000000..f3e6e3d
--- /dev/null
+++ b/mbtk/liblynq_lib_v2/src/lynq_thermal.c
@@ -0,0 +1,120 @@
+#if 1
+#include "mbtk_type.h"
+#include "mbtk_log.h"
+#include "lynq_qser_thermal.h"
+#include "mbtk_info_api.h"
+
+/****************************DEFINE***************************************/
+#define QSER_RESULT_FAIL    -1
+#define QSER_RESULT_SUCCESS 0
+/****************************DEFINE***************************************/
+
+/****************************VARIABLE***************************************/
+extern mbtk_info_handle_t* qser_info_handle;
+extern int qser_info_handle_num;
+/****************************VARIABLE***************************************/
+
+
+/******************************FUNC*****************************************/
+static int qser_thermal_client_init(void)
+{
+    if(qser_info_handle == NULL)
+    {
+        qser_info_handle = mbtk_info_handle_get();
+        if(qser_info_handle)
+        {
+            qser_info_handle_num++;
+        } 
+        else
+        {
+            LOGE("[qser_thermal] mbtk_info_handle_get() fail.");
+            return QSER_RESULT_FAIL;
+        }
+    }
+    else
+    {
+        qser_info_handle_num++;
+    }
+
+    LOGE("[qser_thermal] mbtk_info_handle_get() success.");
+    return QSER_RESULT_SUCCESS;
+}
+
+static int qser_thermal_client_deinit(void)
+{
+    if(qser_info_handle)
+    {
+        LOGE("[qser_thermal] qser_info_handle_num = %d", qser_info_handle_num);
+        if(qser_info_handle_num == 1)
+        { // 最后一个引用,可释放。
+            int ret = mbtk_info_handle_free(&qser_info_handle);
+            if(ret)
+            {
+                LOGE("[qser_thermal] mbtk_info_handle_free() fail.");
+                return QSER_RESULT_FAIL;
+            }
+            else
+            {
+                qser_info_handle_num = 0;
+                qser_info_handle = NULL;
+            }
+        } 
+        else
+        {
+            qser_info_handle_num--;
+        }
+    }
+    else
+    {
+        LOGE("[qser_thermal] handle not inited.");
+        return QSER_RESULT_FAIL;
+    }
+
+    return QSER_RESULT_SUCCESS;
+}
+
+/******************************FUNC*****************************************/
+
+/****************************API***************************************/
+int get_thermal_zone(int *numbers, int size)
+{
+    if(numbers == NULL || size < 6)
+    {
+        LOGE("[qser_thermal]: numbers is NULL!");
+        return QSER_RESULT_FAIL;
+    }
+    
+    int ret = 0;
+    int thermal = -1;
+    int thermal_num = 0;
+    mbtk_thermal_info_t temp;
+    memset(&temp, 0, sizeof(mbtk_thermal_info_t));
+
+    ret = qser_thermal_client_init();
+    if(ret != QSER_RESULT_SUCCESS)
+    {
+        LOGE("[qser_thermal]qser_led_client_init fail.");
+        return QSER_RESULT_FAIL;
+    }
+    
+    ret = mbtk_temp_get(qser_info_handle, 0, &temp);
+    thermal = temp.ther;
+    if(ret != QSER_RESULT_SUCCESS)
+    {
+        LOGE("[qser_thermal]mbtk_temp_get fail.");
+        qser_thermal_client_deinit();
+        return QSER_RESULT_FAIL;
+    }
+
+    qser_thermal_client_deinit();
+    numbers[thermal_num++] = thermal;
+    for(; thermal_num < size; thermal_num++)
+    {
+        numbers[thermal_num] = 0;
+    }
+
+    return 6;
+}
+/****************************API***************************************/
+
+#endif
diff --git a/mbtk/liblynq_lib_v2/src/lynq_time.c b/mbtk/liblynq_lib_v2/src/lynq_time.c
new file mode 100755
index 0000000..8f432f0
--- /dev/null
+++ b/mbtk/liblynq_lib_v2/src/lynq_time.c
@@ -0,0 +1,318 @@
+#include "lynq_systime.h"
+#include "mbtk_type.h"
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <stdio.h>
+#include <errno.h>
+#include <netdb.h>
+#include <string.h>
+#include <unistd.h>
+#include <time.h>
+#include <netinet/in.h>
+
+#include <cutils/properties.h>
+#include <sys/time.h>
+
+
+#include "mbtk_ntp.h"
+#include "mbtk_net_control.h"
+#include "lynq_systime.h"
+#include "mbtk_type.h"
+
+
+#define MBTK_AT_NTP_LEN_MAX 128
+
+
+
+
+typedef enum {
+    LYNQ_TIME_TYPE_CELL = 0,  //NITZ
+    LYNQ_TIME_TYPE_NTP,
+    LYNQ_TIME_TYPE_GNSS,
+    LYNQ_TIME_TYPE_USER,
+    
+    LYNQ_TIME_TYPE_UNUSE
+} lynq_time_type_enum;
+
+//enable set time from ntp
+int ntp_sync_time(int enable); 
+//enable set time from nitz
+int modem_time_enable(int enable);
+//enable set time from gnss
+int gnss_time_enable(int enable);
+//enable set time from user
+int user_set_time(char* date, char* time);
+// RTC TIME set to system
+int lynq_sync_time_from_rtc(void);
+//check sysytem type
+int lynq_get_time_src_status (time_src_status_s * time_src);
+// system time set to RTC
+int lynq_set_rtc_time(void);
+// get RTC time
+int lynq_get_rtc_time(unsigned long *ulsec);
+
+
+
+//int req_time_set(int type, char *time, int *cme_err);
+static int metis_strptime(char *str_time)
+{
+    printf("%s(), str_time:%s\n", __FUNCTION__, str_time);
+    struct tm stm;
+    char dateTime[30];
+    struct timeval tv;
+    if(strptime(str_time, "%Y-%m-%d %H:%M:%S",&stm) != NULL)
+    {
+        time_t _t = mktime(&stm);
+        tv.tv_sec = _t;
+        if(settimeofday(&tv, NULL)) {
+            printf("Set time fail:%d");
+            return -1;
+        } else {
+            printf("Set time to %s.", str_time);
+            return 0;
+        }
+    } else {
+        printf("Set time fail.");
+        return -1;
+    }
+    return 0;
+}
+
+
+
+static void* ntp_pthread_run(int* ntp_flag)
+{
+    if (mbtk_net_state_get() == MBTK_NET_STATE_OFF) 
+    {
+        printf("Network is disconnected. Set time fail.");
+        if(NULL != ntp_flag)
+       {
+            *ntp_flag = -1;
+       }
+        return NULL;
+    }
+    printf("Network is connected.");
+
+    char time_type[10];
+    while(1){
+        memset(time_type, 0, 10);
+        property_get("persist.mbtk.time_type", time_type, "0");
+    	if(atoi(time_type) == LYNQ_TIME_TYPE_NTP) // NTP time
+    	{
+            char time_str[100] = {0};
+            time_t time = 0;
+            if((time = (time_t)mbtk_at_systime()) == 0) 
+            {
+                printf("NTP client fail!\n");
+                if(NULL != ntp_flag)
+                {
+                     *ntp_flag = -1;
+                }
+                return NULL;
+            }
+            struct tm *tm_t;
+            tm_t = localtime(&time);
+            strftime(time_str,128,"%F %T",tm_t);
+
+            // NTP time
+            metis_strptime(time_str);
+            break;
+    	} else {
+            break;
+    	}
+
+        sleep(64); // Sleep 64s.
+    }
+    if(NULL != ntp_flag)
+    {
+         *ntp_flag = 0;
+    }
+    return NULL;
+}
+
+int set_time_user(char* data_time_str)
+{
+
+    int ret = 0;
+    if(strlen(data_time_str) > 0)
+    {
+        ret = metis_strptime(data_time_str);
+    }
+
+    return ret;
+}
+
+
+//MBTK_TIME_TYPE_CELL = 0,  //NITZ
+//MBTK_TIME_TYPE_NTP,
+//MBTK_TIME_TYPE_GNSS,
+//MBTK_TIME_TYPE_USER
+void set_time_type(int mbtk_time_type)
+{
+    char type_str[10] = {0};
+    sprintf(type_str, "%d", mbtk_time_type);
+    property_set("persist.mbtk.time_type", type_str);
+
+    return;
+}
+
+
+
+
+int ntp_sync_time(int enable)
+{
+    if(0 != enable && 1 != enable)
+    {
+        return -1;
+    }
+    UNUSED(enable);
+    int ntp_status = 0;
+    if(enable)
+    {
+        ntp_pthread_run(&ntp_status);
+        if(ntp_status == 0)
+        {
+            set_time_type(LYNQ_TIME_TYPE_NTP);
+        }
+        else
+        {
+            set_time_type(LYNQ_TIME_TYPE_UNUSE);
+        }
+    }
+    else
+    {
+        set_time_type(LYNQ_TIME_TYPE_UNUSE);
+    }
+
+    return 0;
+}
+
+//enable set time from nitz
+int modem_time_enable(int enable)
+{
+    UNUSED(enable);
+
+    if(enable)
+    {
+        set_time_type(LYNQ_TIME_TYPE_CELL);
+    }
+    else
+    {
+        set_time_type(LYNQ_TIME_TYPE_UNUSE);
+    }
+    return 0;
+}
+
+
+//enable set time from gnss
+int gnss_time_enable(int enable)
+{
+    UNUSED(enable);
+    if(enable)
+    {
+        set_time_type(LYNQ_TIME_TYPE_GNSS);
+    }
+    else
+    {
+        set_time_type(LYNQ_TIME_TYPE_UNUSE);
+    }
+
+    return 0;
+}
+
+
+//enable set time from user
+int user_set_time(char* date, char* time)
+{
+    UNUSED(date);
+    UNUSED(time);
+    if(date == NULL || time == NULL)
+    {
+        return -1;
+    }
+
+    int ret = 0;
+    char time_str[128] ={0};
+    memset(time_str, 0x0, MBTK_AT_NTP_LEN_MAX);
+
+    char *p = time;
+    char *p1 = strstr(p, ":");
+    char *p2 = strstr(p1+1, ":");
+    if(p2 == NULL)
+    {
+        sprintf(time_str, "%s %s:00", date, time);  //2023-11-30 11:30
+        set_time_type(LYNQ_TIME_TYPE_USER);
+        ret = set_time_user(time_str);
+    }else
+    {
+        sprintf(time_str, "%s %s", date, time); //2023-11-30 11:30:31
+        set_time_type(LYNQ_TIME_TYPE_USER);
+        ret = set_time_user(time_str);
+    }
+
+    return ret;
+}
+
+
+//check sysytem type
+int lynq_get_time_src_status (time_src_status_s * time_src)
+{
+    UNUSED(time_src);
+    int type = 0;
+    char time_type[] ={0};
+    property_get("persist.mbtk.time_type", time_type, "0");
+
+    type = atoi(time_type);
+    printf("time_type :%d", type);
+    if(type == LYNQ_TIME_TYPE_NTP)
+    {
+        time_src->ntp = 1;
+        time_src->nitz = 0;
+        time_src->gnss = 0;
+    }
+    else if(type == LYNQ_TIME_TYPE_CELL)
+    {
+        time_src->ntp = 0;
+        time_src->nitz = 1;
+        time_src->gnss = 0;
+    }
+    else if(type == LYNQ_TIME_TYPE_GNSS)
+    {
+        time_src->ntp = 0;
+        time_src->nitz = 0;
+        time_src->gnss = 1;
+    }
+    else if(type == LYNQ_TIME_TYPE_UNUSE)
+    {
+        time_src->ntp = 0;
+        time_src->nitz = 0;
+        time_src->gnss = 0;
+    }
+
+    return 0;
+}
+
+// RTC TIME set to system
+int lynq_sync_time_from_rtc(void)
+{
+    system("hwclock --hctosys");
+    return 0;
+}
+
+// system time set to RTC
+int lynq_set_rtc_time(void)
+{
+//    system("hwclock --systohc");
+    system("hwclock -w rtc0");
+    return 0;
+}
+
+int lynq_get_rtc_time(unsigned long *ulsec)
+{
+    UNUSED(ulsec);
+
+    return 0;
+}
+
+
diff --git a/mbtk/liblynq_lib_v2/src/lynq_voice_call.c b/mbtk/liblynq_lib_v2/src/lynq_voice_call.c
new file mode 100755
index 0000000..9aea174
--- /dev/null
+++ b/mbtk/liblynq_lib_v2/src/lynq_voice_call.c
Binary files differ