Add master branch change.
Change-Id: I8892b7102753d29fefb4e23a7a7cc67c01157560
diff --git a/build.sh b/build.sh
index 51fe09e..d84fdc4 100755
--- a/build.sh
+++ b/build.sh
@@ -21,6 +21,37 @@
fi
export BUILD_BRANCH=`git branch | grep "*" | cut -d " " -f 2`
+BUILD_PROJECT_TEMP=`cat build_version | grep PROJECT | cut -d '=' -f 2`
+echo "BUILD_PROJECT_TEMP=$BUILD_PROJECT_TEMP"
+
+if [ "$BUILD_PLATFORM" == "asr1803" ];then
+ if [ "`echo $BUILD_PROJECT_TEMP | cut -c 1-4`" == "L509" ];then
+ export BUILD_PROJECT=L509
+ elif [ "`echo $BUILD_PROJECT_TEMP | cut -c 1-4`" == "L508" ];then
+ export BUILD_PROJECT=L508
+ elif [ "`echo $BUILD_PROJECT_TEMP | cut -c 1-6`" == "PN1803" ];then
+ export BUILD_PROJECT=PN1803
+ else
+ echo "Unknown BUILD_PROJECT:$BUILD_PROJECT_TEMP"
+ exit 1
+ fi
+else
+ if [ "`echo $BUILD_PROJECT_TEMP | cut -c 1-4`" == "L509" ];then
+ export BUILD_PROJECT=L509
+ elif [ "`echo $BUILD_PROJECT_TEMP | cut -c 1-4`" == "L508" ];then
+ export BUILD_PROJECT=L508
+ elif [ "`echo $BUILD_PROJECT_TEMP | cut -c 1-6`" == "PN1803" ];then
+ export BUILD_PROJECT=PN1803
+ elif [ "`echo $BUILD_PROJECT_TEMP | cut -c 1-4`" == "T108" ];then
+ export BUILD_PROJECT=T108
+ elif [ "`echo $BUILD_PROJECT_TEMP | cut -c 1-7`" == "L508_X6" ];then
+ export BUILD_PROJECT=L508_X6
+ else
+ echo "Unknown BUILD_PROJECT:$BUILD_PROJECT_TEMP"
+ exit 1
+ fi
+fi
+
cd $ROOT_DIR
export STAGING_DIR=
@@ -71,10 +102,10 @@
# Copy All Bin Files.
#cp -f out/bin/* $ROOTFS_DIR/bin
- cp -f out/bin/at $ROOTFS_DIR/bin
- cp -f out/bin/mbtk_ril $ROOTFS_DIR/bin
- cp -f out/bin/mbtk_logd $ROOTFS_DIR/bin
- cp -f out/bin/mbtk_adbd $ROOTFS_DIR/bin
+ [ -f out/bin/at ] && cp -f out/bin/at $ROOTFS_DIR/bin
+ [ -f out/bin/mbtk_rild ] && cp -f out/bin/mbtk_rild $ROOTFS_DIR/bin
+ [ -f out/bin/mbtk_logd ] && cp -f out/bin/mbtk_logd $ROOTFS_DIR/bin
+ [ -f out/bin/mbtk_adbd ] && cp -f out/bin/mbtk_adbd $ROOTFS_DIR/bin
[ -f out/bin/device_info_generate ] && cp -f out/bin/device_info_generate $ROOTFS_DIR
[ -f out/bin/device_info ] && cp -f out/bin/device_info $ROOTFS_DIR/bin
else
diff --git a/config b/config
index ae69276..aecb651 100755
--- a/config
+++ b/config
@@ -4,6 +4,12 @@
# Custom YX support?
CONFIG_YX_SUPPORT=n
+#Custom SG support?
+CONFIG_SG_SUPPORT=n
+
+#set all apn cid support?
+CONFIG_MBTK_ALL_CID_SUPPORT=n
+
# MBTK gnss mode (gnss_5311 / gnss_6228)
CONFIG_MBTK_GNSS_MODE=gnss_5311
diff --git a/mbtk/Make.defines b/mbtk/Make.defines
index 8f82632..fd8ec51 100755
--- a/mbtk/Make.defines
+++ b/mbtk/Make.defines
@@ -32,6 +32,7 @@
$(info BUILD_LIB_TYPE=$(BUILD_LIB_TYPE))
$(info BUILD_PLATFORM=$(BUILD_PLATFORM))
$(info BUILD_BRANCH=$(BUILD_BRANCH))
+$(info BUILD_PROJECT=$(BUILD_PROJECT))
$(info ROOT=$(ROOT))
$(info CC=$(CC))
$(info AR=$(AR))
@@ -65,26 +66,35 @@
-D_GNU_SOURCE
#$(info TOPDIR=$(TOPDIR))
-BUILD_PROJECT=$(shell cat $(ROOT)/../build_version | grep PROJECT | cut -d '=' -f 2)
-$(info BUILD_PROJECT=$(BUILD_PROJECT))
+# BUILD_PROJECT=$(shell cat $(ROOT)/../build_version | grep PROJECT | cut -d '=' -f 2)
+#$(info BUILD_PROJECT=$(BUILD_PROJECT))
#BUILD_PROJECT_X=$(shell ${BUILD_PROJECT:0:4})
#BUILD_PROJECT_X=$(shell echo $(BUILD_PROJECT) | cut -c 1-4)
#$(info BUILD_PROJECT_X=$(BUILD_PROJECT_X))
+# 1806
ifeq ($(BUILD_PLATFORM), asr1806)
DEFINE += -DMBTK_PLATFORM_ASR1806
-ifeq ($(shell echo $(BUILD_PROJECT) | cut -c 1-7), L508_X6)
-$(info BUILD_PROJECT=L508_X6)
+ifeq ($(BUILD_PROJECT), L508_X6)
DEFINE += -DMBTK_PROJECT_L508_X6
else
-ifeq ($(shell echo $(BUILD_PROJECT) | cut -c 1-4), T108)
-$(info BUILD_PROJECT=T108)
+ifeq ($(BUILD_PROJECT), T108)
DEFINE += -DMBTK_PROJECT_T108
else
+ifeq ($(BUILD_PROJECT), L508)
+DEFINE += -DMBTK_PROJECT_L508
+else
+ifeq ($(BUILD_PROJECT), L509)
+DEFINE += -DMBTK_PROJECT_L509
+else
$(info BUILD_PROJECT=Unknown)
endif
endif
+endif
+endif
+
+# 1803
else
DEFINE += -DMBTK_POLARSSL_SUPPORT
@@ -94,17 +104,16 @@
DEFINE += -DMBTK_PLATFORM_ASR1803
-ifeq ($(shell echo $(BUILD_PROJECT) | cut -c 1-4), L508)
-$(info BUILD_PROJECT=L508)
+ifeq ($(BUILD_PROJECT), L508)
DEFINE += -DMBTK_PROJECT_L508
else
-ifeq ($(shell echo $(BUILD_PROJECT) | cut -c 1-4), L509)
-$(info BUILD_PROJECT=L509)
+ifeq ($(BUILD_PROJECT), L509)
DEFINE += -DMBTK_PROJECT_L509
else
-ifeq ($(shell echo $(BUILD_PROJECT) | cut -c 1-6), PN1803)
-$(info BUILD_PROJECT=PN1803)
+ifeq ($(BUILD_PROJECT), PN1803)
DEFINE += -DMBTK_PROJECT_PN1803
+else
+$(info BUILD_PROJECT=Unknown)
endif
endif
endif
@@ -122,6 +131,19 @@
DEFINE += -DMBTK_YX_SUPPORT
endif
+MBTK_SG_SUPPORT=$(shell cat $(ROOT)/config | grep CONFIG_SG_SUPPORT | cut -d '=' -f 2)
+$(info MBTK_SG_SUPPORT=$(MBTK_SG_SUPPORT))
+ifeq ($(MBTK_SG_SUPPORT), y)
+DEFINE += -DMBTK_SG_SUPPORT
+DEFINE += -DMBTK_ALL_CID_SUPPORT
+endif
+
+MBTK_ALL_CID_SUPPORT=$(shell cat $(ROOT)/config | grep CONFIG_MBTK_ALL_CID_SUPPORT | cut -d '=' -f 2)
+$(info MBTK_ALL_CID_SUPPORT=$(MBTK_ALL_CID_SUPPORT))
+ifeq ($(MBTK_ALL_CID_SUPPORT), y)
+DEFINE += -DMBTK_ALL_CID_SUPPORT
+endif
+
MBTK_GNSS_MODE=$(shell cat $(ROOT)/config | grep CONFIG_MBTK_GNSS_MODE | cut -d '=' -f 2)
$(info MBTK_GNSS_MODE=$(MBTK_GNSS_MODE))
ifeq ($(MBTK_GNSS_MODE), gnss_6228)
diff --git a/mbtk/Makefile b/mbtk/Makefile
index bab37fe..2d3d708 100755
--- a/mbtk/Makefile
+++ b/mbtk/Makefile
@@ -11,6 +11,9 @@
# Build bin file.
DIRS += device_info_generate mbtk_adbd mbtk_rild mbtk_logd
+# Build test file.
+DIRS += test
+
all:
@echo $(ROOT)
@echo $(CC)
diff --git a/mbtk/include/lynq/liblog.h b/mbtk/include/lynq/liblog.h
index 7d13802..0f511ce 100755
--- a/mbtk/include/lynq/liblog.h
+++ b/mbtk/include/lynq/liblog.h
@@ -11,12 +11,12 @@
typedef enum
{
LOG_UNSET = -1,
- LOG_VERBOSE = 0,
- LOG_ERROR,
- LOG_WARNING,
- LOG_INFO,
- LOG_DEBUG,
- LOG_LEVEL_MAX
+ LOG_VERBOSE = 8,
+ LOG_ERROR = 3,
+ LOG_WARNING = 4,
+ LOG_INFO = 6,
+ LOG_DEBUG = 7,
+ LOG_LEVEL_MAX = 9
}log_level_enum;
void lynq_log_global_output(log_level_enum Level,const char *format,...);
diff --git a/mbtk/include/lynq/lynq-qser-data.h b/mbtk/include/lynq/lynq-qser-data.h
index 1140e86..ba4711f 100755
--- a/mbtk/include/lynq/lynq-qser-data.h
+++ b/mbtk/include/lynq/lynq-qser-data.h
@@ -9,6 +9,11 @@
typedef enum {
QSER_DATA_CALL_ERROR_NONE = 0,
QSER_DATA_CALL_ERROR_INVALID_PARAMS,
+ QSER_DATA_CALL_ERROR_NO_INIT,
+ QSER_DATA_CALL_ERROR_PDP_ACTIVATE,
+ QSER_DATA_CALL_ERROR_PDP_NO_ACTIVATE,
+ QSER_DATA_CALL_ERROR_IDX_NO_EXIST,
+ QSER_DATA_CALL_ERROR_UNKNOWN,
} qser_data_call_error_e;
typedef enum {
diff --git a/mbtk/include/mbtk/mbtk_info_api.h b/mbtk/include/mbtk/mbtk_info_api.h
index f5b6c4d..95ac439 100755
--- a/mbtk/include/mbtk/mbtk_info_api.h
+++ b/mbtk/include/mbtk/mbtk_info_api.h
@@ -22,7 +22,7 @@
#define CELL_NUM_MAX 50
#define APN_STR_MAX 128
-#ifdef MBTK_AF_SUPPORT
+#if (defined(MBTK_AF_SUPPORT) || defined(MBTK_ALL_CID_SUPPORT))
#define MBTK_APN_CID_MIN 1
#else
// 2 - 7
diff --git a/mbtk/liblynq_lib/src/lynq_data_call.c b/mbtk/liblynq_lib/src/lynq_data_call.c
index 88f2074..095b41a 100755
--- a/mbtk/liblynq_lib/src/lynq_data_call.c
+++ b/mbtk/liblynq_lib/src/lynq_data_call.c
@@ -5,15 +5,23 @@
#include <pthread.h>
#include <cutils/properties.h>
#include <string.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 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)
+#define QSER_PROFILE_IDX_MIN 0
+#else
#define QSER_PROFILE_IDX_MIN 1
+#endif
#define QSER_PROFILE_IDX_MAX 6
/****************************DEFINE***************************************/
@@ -27,10 +35,94 @@
static bool qser_apn_info_state[QSER_APN_NUM] = {0};
static char qser_apn_add_save_state[QSER_APN_NUM + 1] = {0};
static qser_data_call_s qser_data_backup;
+#if defined(MBTK_ALL_CID_SUPPORT)
+static int qser_apn_default_idx = -1;
+#else
+static int qser_apn_default_idx = 0xFF;
+#endif
int now_idx = 0;
/****************************VARIABLE***************************************/
/******************************FUNC*****************************************/
+#if defined(MBTK_ALL_CID_SUPPORT)
+int qser_route_config(int profile_idx)
+{
+ char buf[1024] = {0};
+ char dns[128] = {0};
+ int offset = 0;
+ int fd = -1;
+ mbtk_ipv4_info_t ipv4;
+ mbtk_ipv6_info_t ipv6;
+ sprintf(buf, "route add default dev ccinet%d", profile_idx -1);
+ system(buf);
+
+ int ret = mbtk_data_call_state_get(qser_info_handle, profile_idx, &ipv4, &ipv6);
+ if(ret != 0)
+ return -1;
+ else
+ {
+ memset(buf, 0x0, 1024);
+ memset(dns, 0x0, 128);
+ offset = sprintf(buf, "search lan\n");
+ if(ipv4.valid)
+ {
+ if(inet_ntop(AF_INET, &(ipv4.PrimaryDNS), dns, 32) == NULL) {
+ LOGD("PrimaryDNS error.");
+ } else {
+ LOGD("PrimaryDNS : %s", dns);
+ }
+ offset += sprintf(buf + offset, "nameserver %s\n", dns);
+ memset(dns, 0x0, 128);
+ if(inet_ntop(AF_INET, &(ipv4.SecondaryDNS), dns, 32) == NULL) {
+ LOGD("SecondaryDNS error.");
+ } else {
+ LOGD("SecondaryDNS : %s", dns);
+ }
+ offset += sprintf(buf + offset, "nameserver %s\n", dns);
+ }
+ if(ipv6.valid)
+ {
+ memset(dns, 0x0, 128);
+ if(ipv6_2_str(&(ipv6.PrimaryDNS), dns))
+ {
+ LOGD("PrimaryDNS error.");
+ } else {
+ LOGD("PrimaryDNS : %s", dns);
+ }
+ offset += sprintf(buf + offset, "nameserver %s\n", dns);
+ memset(dns, 0x0, 128);
+ if(ipv6_2_str(&(ipv6.SecondaryDNS), dns))
+ {
+ LOGD("SecondaryDNS error.");
+ } else {
+ LOGD("SecondaryDNS : %s", dns);
+ }
+ offset += sprintf(buf + offset, "nameserver %s\n", dns);
+ }
+
+ if(offset > 0)
+ {
+ fd = open("/tmp/resolv.conf", O_WRONLY | O_TRUNC);
+ if(fd < 0)
+ {
+ LOGD("mbtk_route_config : open fail.");
+ return -1;
+ }
+
+ ret = write(fd, buf, offset);
+ if(ret < 0)
+ {
+ LOGD("mbtk_route_config : write fail.");
+ }
+
+ close(fd);
+ }
+ }
+
+ return 0;
+}
+#endif
+
char qser_get_apn_profile_idx(void)
{
char i = 0;
@@ -276,6 +368,14 @@
LOGE("[qser_data_call] idx no open.");
continue;
}
+
+#if defined(MBTK_ALL_CID_SUPPORT)
+ if(qser_apn_add_save_state[apns[i].cid - 1] == '2')
+ {
+ qser_apn_default_idx = apns[i].cid - 1;
+ }
+#endif
+
if(qser_apn_info_param_convert(apns[i].cid - 1, &qser_apn_info[apns[i].cid - 1], &apns[i]) != 0)
{
LOGE("[qser_data_call] qser_apn_info_param_convert fail");
@@ -341,14 +441,14 @@
if(qser_info_handle == NULL)
{
LOGE("[qser_data_call] handle is NULL.");
- *err = QSER_DATA_CALL_ERROR_INVALID_PARAMS;
+ *err = QSER_DATA_CALL_ERROR_NO_INIT;
return QSER_RESULT_FAIL;
}
if(qser_check_profile_idx(data_call->profile_idx) < 0)
{
LOGE("[qser_data_call] profile_idx is invalid.");
- *err = QSER_DATA_CALL_ERROR_INVALID_PARAMS;
+ *err = QSER_DATA_CALL_ERROR_IDX_NO_EXIST;
return QSER_RESULT_FAIL;
}
@@ -357,7 +457,14 @@
if(ret != 0)
{
LOGE("[qser_data_call] mbtk_data_call_start fail.[ret = %d]", ret);
- *err = QSER_DATA_CALL_ERROR_INVALID_PARAMS;
+ 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
@@ -366,6 +473,14 @@
}
now_idx = data_call->profile_idx;
+
+#if defined(MBTK_ALL_CID_SUPPORT)
+ if(qser_apn_default_idx == data_call->profile_idx)
+ {
+ qser_route_config(qser_apn_default_idx + 1);
+ }
+#endif
+
return QSER_RESULT_SUCCESS;
}
@@ -386,14 +501,14 @@
if(qser_info_handle == NULL)
{
LOGE("[qser_data_call] handle is NULL.");
- *err = QSER_DATA_CALL_ERROR_INVALID_PARAMS;
+ *err = QSER_DATA_CALL_ERROR_NO_INIT;
return QSER_RESULT_FAIL;
}
if(qser_check_profile_idx(data_call->profile_idx) < 0)
{
LOGE("[qser_data_call] profile_idx is invalid.");
- *err = QSER_DATA_CALL_ERROR_INVALID_PARAMS;
+ *err = QSER_DATA_CALL_ERROR_IDX_NO_EXIST;
return QSER_RESULT_FAIL;
}
@@ -403,7 +518,7 @@
if(pthread_attr_setdetachstate(&thread_attr, PTHREAD_CREATE_DETACHED))
{
LOGE("[qser_data_call] pthread_attr_setdetachstate() fail.");
- *err = QSER_DATA_CALL_ERROR_INVALID_PARAMS;
+ *err = QSER_DATA_CALL_ERROR_UNKNOWN;
return QSER_RESULT_FAIL;
}
@@ -411,7 +526,7 @@
if(pthread_create(&data_call_thread_id, &thread_attr, data_call_async_thread, NULL))
{
LOGE("[qser_data_call] pthread_create() fail.");
- *err = QSER_DATA_CALL_ERROR_INVALID_PARAMS;
+ *err = QSER_DATA_CALL_ERROR_UNKNOWN;
return QSER_RESULT_FAIL;
}
pthread_attr_destroy(&thread_attr);
@@ -434,14 +549,14 @@
if(qser_info_handle == NULL)
{
LOGE("[qser_data_call] handle is NULL.");
- *err = QSER_DATA_CALL_ERROR_INVALID_PARAMS;
+ *err = QSER_DATA_CALL_ERROR_NO_INIT;
return QSER_RESULT_FAIL;
}
if(qser_check_profile_idx(profile_idx) < 0)
{
LOGE("[qser_data_call] profile_idx is invalid.");
- *err = QSER_DATA_CALL_ERROR_INVALID_PARAMS;
+ *err = QSER_DATA_CALL_ERROR_IDX_NO_EXIST;
return QSER_RESULT_FAIL;
}
@@ -450,7 +565,14 @@
if(ret != 0)
{
LOGE("[qser_data_call] mbtk_data_call_stop fail.[ret = %d]", ret);
- *err = QSER_DATA_CALL_ERROR_INVALID_PARAMS;
+ 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
@@ -483,14 +605,14 @@
if(qser_info_handle == NULL)
{
LOGE("[qser_data_call] handle is NULL.");
- *err = QSER_DATA_CALL_ERROR_INVALID_PARAMS;
+ *err = QSER_DATA_CALL_ERROR_NO_INIT;
return QSER_RESULT_FAIL;
}
if(qser_check_profile_idx(profile_idx) < 0)
{
LOGE("[qser_data_call] profile_idx is invalid.");
- *err = QSER_DATA_CALL_ERROR_INVALID_PARAMS;
+ *err = QSER_DATA_CALL_ERROR_IDX_NO_EXIST;
return QSER_RESULT_FAIL;
}
@@ -506,7 +628,14 @@
if(ret != 0)
{
LOGE("[qser_data_call] mbtk_data_call_state_get fail.[ret = %d]", ret);
- *err = QSER_DATA_CALL_ERROR_INVALID_PARAMS;
+ 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
@@ -517,10 +646,12 @@
info->ip_family = QSER_DATA_CALL_TYPE_IPV4;
info->v4.state = QSER_DATA_CALL_CONNECTED;
sprintf(info->v4.name, "ccinet%d", profile_idx);
- memcpy(&(info->v4.addr.ip), &(ipv4.IPAddr), 32);
- memcpy(&(info->v4.addr.pri_dns), &(ipv4.PrimaryDNS), 32);
- memcpy(&(info->v4.addr.sec_dns), &(ipv4.SecondaryDNS), 32);
+ 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_call] 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_call] IP error.");
} else {
@@ -544,9 +675,9 @@
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), 128);
- memcpy(&(info->v6.addr.pri_dns), &(ipv6.PrimaryDNS), 128);
- memcpy(&(info->v6.addr.sec_dns), &(ipv6.SecondaryDNS), 128);
+ 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))
{
@@ -612,11 +743,13 @@
return QSER_RESULT_FAIL;
}
+#if 0
if(memcmp(apn->apn_type, "iot_default", strlen("iot_default")) == 0)
{
LOGE("[qser_data_call] iot_default is exist.");
return QSER_RESULT_FAIL;
}
+#endif
int ret = -1;
char mbtk_auth[32]={0};
@@ -765,6 +898,15 @@
return QSER_RESULT_FAIL;
}
+ if(memcmp(apn->apn_type, "iot_default", strlen("iot_default")) == 0)
+ {
+ if(qser_apn_default_idx > -1)
+ {
+ LOGE("[qser_data_call] iot_default is exist.");
+ return QSER_RESULT_FAIL;
+ }
+ }
+
int ret = 0;
char idx = qser_get_apn_profile_idx();
if(idx >= 8)
@@ -791,7 +933,18 @@
return QSER_RESULT_FAIL;
}
*profile_idx = idx;
- qser_apn_add_save_state[idx] = '1';
+#if defined(MBTK_ALL_CID_SUPPORT)
+ if(memcmp(apn->apn_type, "iot_default", strlen("iot_default")) == 0)
+ {
+ qser_apn_add_save_state[idx] = '2';
+ qser_apn_default_idx = idx;
+ }
+ else
+#endif
+ {
+ qser_apn_add_save_state[idx] = '1';
+ }
+
property_set("persist.qser.datacall.apn", qser_apn_add_save_state);
}
return QSER_RESULT_SUCCESS;
@@ -814,6 +967,14 @@
qser_apn_info_state[profile_idx] = FALSE;
qser_apn_add_save_state[profile_idx] = '0';
+
+#if defined(MBTK_ALL_CID_SUPPORT)
+ if(profile_idx == qser_apn_default_idx)
+ {
+ qser_apn_default_idx = -1;
+ }
+#endif
+
property_set("persist.qser.datacall.apn", qser_apn_add_save_state);
return QSER_RESULT_SUCCESS;
}
diff --git a/mbtk/liblynq_lib/src/lynq_log.c b/mbtk/liblynq_lib/src/lynq_log.c
index 6e3885a..65ffc31 100755
--- a/mbtk/liblynq_lib/src/lynq_log.c
+++ b/mbtk/liblynq_lib/src/lynq_log.c
@@ -1,5 +1,6 @@
+#include <stdarg.h>
#include "json/json.h"
-#include "liblog.h"
+#include "lynq_deflog.h"
#include "mbtk_type.h"
#define LOG_CONFIG_PATH "/etc/mbtk/mbtk_log.json"
@@ -15,9 +16,15 @@
void lynq_log_global_output(log_level_enum Level,const char *format,...)
{
- UNUSED(Level);
- UNUSED(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)
diff --git a/mbtk/mbtk_rild/inc/info_data.h b/mbtk/mbtk_rild/inc/info_data.h
index ffc0aea..a8e8c3f 100755
--- a/mbtk/mbtk_rild/inc/info_data.h
+++ b/mbtk/mbtk_rild/inc/info_data.h
@@ -50,6 +50,7 @@
INFO_URC_MSG_SIM_STATE,
INFO_URC_MSG_PDP_STATE,
INFO_URC_MSG_SMS_STATE,
+ INFO_URC_MSG_SET_BAND,
INFO_URC_MSG_NET_STATE_LOG // Save Network state into file.
} info_urc_msg_id_enum;
diff --git a/mbtk/mbtk_rild/src/main.c b/mbtk/mbtk_rild/src/main.c
index eeabc7c..5812948 100755
--- a/mbtk/mbtk_rild/src/main.c
+++ b/mbtk/mbtk_rild/src/main.c
@@ -321,7 +321,7 @@
urc_msg_distribute(false, INFO_URC_MSG_PDP_STATE, &data_pdp, sizeof(uint8));
} else if(strStartsWith(s, "+CGEV: EPS PDN ACT ")) { // +CGEV: EPS PDN ACT <cid>
//apn_state_set(atoi(s + 19), true);
-#ifdef MBTK_AF_SUPPORT
+#if (defined(MBTK_AF_SUPPORT) || defined(MBTK_ALL_CID_SUPPORT))
//data[0] = (uint8)1;
//data[1] = (uint8)atoi(s + 19);
#else
diff --git a/mbtk/mbtk_rild/src/mbtk_info_server.c b/mbtk/mbtk_rild/src/mbtk_info_server.c
index 2659aaf..81633e1 100755
--- a/mbtk/mbtk_rild/src/mbtk_info_server.c
+++ b/mbtk/mbtk_rild/src/mbtk_info_server.c
@@ -23,6 +23,16 @@
#include "cust_info.h"
#include "mbtk_device.h"
+typedef struct {
+ bool band_set_success;
+
+ mbtk_modem_band_area_enum band_area;
+ uint32 band_gsm;
+ uint32 band_wcdma;
+ uint32 band_tdlte;
+ uint32 band_fddlte;
+} band_set_info_t;
+
static int sock_listen_fd = -1;
static int epoll_fd = -1;
static list_node_t *sock_client_list = NULL;
@@ -32,6 +42,7 @@
static mbtk_queue_node_t urc_queue;
static pthread_cond_t urc_cond;
static pthread_mutex_t urc_mutex;
+static band_set_info_t band_set_info;
static mbtk_band_info_t band_support;
net_info_t net_info;
@@ -5094,7 +5105,7 @@
int timeout = pack->data[2];
//mbtk wyq for data_call_ex add end
-#ifdef MBTK_AF_SUPPORT
+#if (defined(MBTK_AF_SUPPORT) || defined(MBTK_ALL_CID_SUPPORT))
if(cid == 1)
{
char dev[20] = {0};
@@ -6154,6 +6165,34 @@
}
break;
}
+ case INFO_URC_MSG_SET_BAND:
+ {
+ mbtk_band_info_t band;
+ int cme_err = MBTK_INFO_ERR_CME_NON;
+
+ band.net_pref = MBTK_NET_PREF_GSM_UMTS_LTE_LTE_PREF; // 15
+ band.gsm_band = band_set_info.band_gsm;
+ band.umts_band = band_set_info.band_wcdma;
+ band.tdlte_band = band_set_info.band_tdlte;
+ band.fddlte_band = band_set_info.band_fddlte;
+ if(req_band_set(&band, &cme_err) || cme_err != MBTK_INFO_ERR_CME_NON)
+ {
+ LOG("Set band fail.");
+ }
+ else // Set band success.
+ {
+ band_set_info.band_set_success = TRUE;
+ if(band_set_info.band_area == MBTK_MODEM_BAND_AREA_CN) {
+ property_set("persist.mbtk.band_config", "CN");
+ } else if(band_set_info.band_area == MBTK_MODEM_BAND_AREA_EU) {
+ property_set("persist.mbtk.band_config", "EU");
+ } else {
+ property_set("persist.mbtk.band_config", "ALL");
+ }
+ LOG("Set band success.");
+ }
+ break;
+ }
case INFO_URC_MSG_NET_STATE_LOG:
{
// Get network state and signal.
@@ -6393,83 +6432,48 @@
*/
static void* band_config_thread()
{
- int err = -1;
- ATResponse *p_response = NULL;
-
-#if 0
- mbtk_cust_info_t cust_info;
-retry:
- memset(&cust_info, 0x0, sizeof(mbtk_cust_info_t));
- if(!custom_partition_read("cust_info", &cust_info)) {
- if(cust_info.band_type == 1) { // CN
- // GSM : B3/B8
- // WCDMA : B1/B5/B8
- // TDD-LTE : B34/B38/B39/B40/B41
- // FDD-LTE : B1/B3/B5/B8
- err = at_send_command("AT*BAND=15,11,145,482,149", &p_response);
- } else if(cust_info.band_type == 2) { // EU
- // GSM : B3/B8
- // WCDMA : B1/B5/B8
- // TDD-LTE : B38/B40/B41
- // FDD-LTE : B1/B3/B5/B7/B8/B20/B28
- err = at_send_command("AT*BAND=15,11,145,416,134742229", &p_response);
- } else {
- err = at_send_command("AT*BAND=15,78,147,482,134742231", &p_response);
- }
- } else {
- err = at_send_command("AT*BAND=15,78,147,482,134742231", &p_response);
- }
-
- if ((err < 0) || (p_response == NULL) || (p_response->success == 0))
- {
- LOGE("*BAND exec error, will retry in 3s.");
- sleep(3);
- goto retry;
- }
-
- LOGD("Set Band Success.");
- property_set("persist.mbtk.band_config", "ALL");
-#else
mbtk_device_info_modem_t info_modem;
+ memset(&band_set_info, 0, sizeof(band_set_info_t));
memset(&info_modem, 0, sizeof(mbtk_device_info_modem_t));
- if(mbtk_dev_info_read(MBTK_DEVICE_INFO_ITEM_MODEM, &info_modem, sizeof(mbtk_device_info_modem_t))) {
+ band_set_info.band_set_success = FALSE;
+ if(mbtk_dev_info_read(MBTK_DEVICE_INFO_ITEM_MODEM, &(info_modem), sizeof(mbtk_device_info_modem_t))) {
LOGD("mbtk_dev_info_read(MODEM) fail, use default band.");
-retry_default:
- err = at_send_command("AT*BAND=15,78,147,482,134742231", &p_response);
- if ((err < 0) || (p_response == NULL) || (p_response->success == 0))
- {
- LOGE("*BAND exec error, will retry in 3s.");
- sleep(3);
- goto retry_default;
- }
-
- property_set("persist.mbtk.band_config", "ALL");
+ band_set_info.band_area = MBTK_MODEM_BAND_AREA_ALL;
+ band_set_info.band_gsm = MBTK_BAND_ALL_GSM_DEFAULT;
+ band_set_info.band_wcdma = MBTK_BAND_ALL_WCDMA_DEFAULT;
+ band_set_info.band_tdlte = MBTK_BAND_ALL_TDLTE_DEFAULT;
+ band_set_info.band_fddlte = MBTK_BAND_ALL_FDDLTE_DEFAULT;
} else {
- char cmd[128] = {0};
- snprintf(cmd, 128, "AT*BAND=15,%d,%d,%d,%d", info_modem.band_gsm,
- info_modem.band_wcdma, info_modem.band_tdlte, info_modem.band_fddlte);
-retry_by_dev:
- err = at_send_command(cmd, &p_response);
- if ((err < 0) || (p_response == NULL) || (p_response->success == 0))
- {
- LOGE("*BAND exec error, will retry in 3s.");
- sleep(3);
- goto retry_by_dev;
- }
+ band_set_info.band_area = info_modem.band_area;
+ band_set_info.band_gsm = info_modem.band_gsm;
+ band_set_info.band_wcdma = info_modem.band_wcdma;
+ band_set_info.band_tdlte = info_modem.band_tdlte;
+ band_set_info.band_fddlte = info_modem.band_fddlte;
+ }
- if(info_modem.band_area == MBTK_MODEM_BAND_AREA_CN) {
- property_set("persist.mbtk.band_config", "CN");
- } else if(info_modem.band_area == MBTK_MODEM_BAND_AREA_EU) {
- property_set("persist.mbtk.band_config", "EU");
+ bool is_first = TRUE;
+ while(!band_set_info.band_set_success) {
+ info_urc_msg_t *urc = (info_urc_msg_t*)malloc(sizeof(info_urc_msg_t));
+ if(!urc)
+ {
+ LOG("malloc() fail[%d].", errno);
+ break;
} else {
- property_set("persist.mbtk.band_config", "ALL");
+ urc->msg = INFO_URC_MSG_SET_BAND;
+ urc->data = NULL;
+ urc->data_len = 0;
+ send_pack_to_queue(NULL, urc);
+
+ if(is_first) {
+ is_first = FALSE;
+ } else {
+ LOGE("*BAND exec error, will retry in 3s.");
+ }
+ sleep(3);
}
}
- LOGD("Set Band Success.");
-#endif
-
- at_response_free(p_response);
+ LOGD("Set Band thread exit.");
return NULL;
}
diff --git a/mbtk/test/Makefile b/mbtk/test/Makefile
index d1a9726..89ccbdf 100755
--- a/mbtk/test/Makefile
+++ b/mbtk/test/Makefile
@@ -7,13 +7,8 @@
LIB_DIR +=
-LIBS += -lmbtk_lib -llynq_lib -lql_lib -lmbtk_mqtt_lib -laudio-apu -lcutils -ltinyalsa -lacm -lubus -lubox
-
-ifeq ($(BUILD_PLATFORM), asr1803)
-LIBS += -lpolarssl
-else
-LIBS += -lmbtk_audio_lib
-endif
+LIBS += -lmbtk_lib -llynq_lib -lql_lib -lmbtk_mqtt -laudio-apu -lcutils -ltinyalsa -lacm -lubus -lubox -lmbtk_fota -lmbtk_audio -lmbtk_ril -lmbtk_factory -lmbtk_net -lmbtk_gnss -lmbtk_http -lmbtk_ftp -lmbtk_tcpip \
+ -lmbtk_coap
CFLAGS +=
diff --git a/mbtk/test/asr1806/qser_data_call_test.c b/mbtk/test/asr1806/qser_data_call_test.c
old mode 100644
new mode 100755
index 5d6ba59..42ee643
--- a/mbtk/test/asr1806/qser_data_call_test.c
+++ b/mbtk/test/asr1806/qser_data_call_test.c
@@ -144,7 +144,8 @@
else
{
printf("cnt: %d.\n", apn_list.cnt);
- for(int i = 0; i < apn_list.cnt; i++)
+ int i = 0;
+ for(i = 0; i < apn_list.cnt; i++)
{
printf("APN : %d, %d, %s, %s, %s, %d, %s.\n", apn_list.apn[i].profile_idx, apn_list.apn[i].pdp_type, apn_list.apn[i].apn_name, apn_list.apn[i].username, apn_list.apn[i].password, apn_list.apn[i].auth_proto, apn_list.apn[i].apn_type);
}
@@ -426,7 +427,11 @@
if(!err) {
printf("cid : %d, ip_type : %d\n", info.profile_idx, info.ip_family);
if(info.v4.state) {
- printf("%s: %s, %s, %s\n", info.v4.name, inet_ntoa(info.v4.addr.ip), inet_ntoa(info.v4.addr.pri_dns), inet_ntoa(info.v4.addr.sec_dns));
+ LOGE("[qser_data_call] IP: 0x%08x pri_DNS: 0x%08x sec_DNS: 0x%08x.", info.v4.addr.ip.s_addr, info.v4.addr.pri_dns.s_addr, info.v4.addr.sec_dns.s_addr);
+ //printf("%s: %s, %s, %s\n", info.v4.name, inet_ntoa(info.v4.addr.ip), inet_ntoa(info.v4.addr.pri_dns), inet_ntoa(info.v4.addr.sec_dns));
+ printf("%s: %s ", info.v4.name, inet_ntoa(info.v4.addr.ip));
+ printf("%s ", inet_ntoa(info.v4.addr.pri_dns));
+ printf("%s\n", inet_ntoa(info.v4.addr.sec_dns));
} else {
printf("IPV4 not available.\n");
}
diff --git a/mbtk/test/lynq_log_test.c b/mbtk/test/lynq_log_test.c
index fe749ec..b611e3f 100755
--- a/mbtk/test/lynq_log_test.c
+++ b/mbtk/test/lynq_log_test.c
@@ -99,6 +99,7 @@
}
case 6://test write log
{
+ puts(lynq_read_log_version());
for(i=0;i<10;i++)
{
LYVERBLOG("LYNQ: Test LYVERBLOG\n");
@@ -106,6 +107,13 @@
LYWARNLOG("LYNQ: Test LYWARNLOG\n");
LYINFLOG("LYNQ: Test LYINFLOG\n");
LYDBGLOG("LYNQ: Test LYDBGLOG\n");
+ lynq_log_global_output(LOG_VERBOSE, "LOG_VERBOSE test");
+ lynq_log_global_output(LOG_ERROR, "LOG_ERROR test");
+ lynq_log_global_output(LOG_WARNING, "LOG_WARNING test");
+ lynq_log_global_output(LOG_INFO, "LOG_INFO test");
+ lynq_log_global_output(LOG_DEBUG, "LOG_DEBUG test");
+ lynq_log_global_output(LOG_UNSET, "LOG_UNSET test");
+ lynq_log_global_output(LOG_LEVEL_MAX, "LOG_LEVEL_MAX test");
}
printf("test write log end\n");