Merge "Revert "[Bugfix][ZXW-303][IRQ]fix irq 4 install fail""
diff --git a/allbins/zx297520v3/prj_vehicle/config_dc_4Gb/partition.bin b/allbins/zx297520v3/prj_vehicle/config_dc_4Gb/partition.bin
index 38be3b4..371de96 100755
--- a/allbins/zx297520v3/prj_vehicle/config_dc_4Gb/partition.bin
+++ b/allbins/zx297520v3/prj_vehicle/config_dc_4Gb/partition.bin
Binary files differ
diff --git a/allbins/zx297520v3/prj_vehicle/config_dc_4Gb/partition.ini b/allbins/zx297520v3/prj_vehicle/config_dc_4Gb/partition.ini
index 03e1552..fa377c3 100755
--- a/allbins/zx297520v3/prj_vehicle/config_dc_4Gb/partition.ini
+++ b/allbins/zx297520v3/prj_vehicle/config_dc_4Gb/partition.ini
@@ -69,37 +69,37 @@
partition_name=caprootfs
partition_type=nand
partition_addr=0x05900000
-partition_size=0x02000000
+partition_size=0x02800000
[Partition11]
partition_name=caprootfs2
partition_type=nand
-partition_addr=0x07900000
-partition_size=0x02000000
+partition_addr=0x08100000
+partition_size=0x02800000
[Partition12]
partition_name=capuserdata
partition_type=nand
-partition_addr=0x09900000
-partition_size=0x04100000
+partition_addr=0x0A900000
+partition_size=0x02800000
[Partition13]
partition_name=oem
partition_type=nand
-partition_addr=0x0DA00000
+partition_addr=0x0D100000
partition_size=0x06400000
[Partition14]
partition_name=oem2
partition_type=nand
-partition_addr=0x13E00000
+partition_addr=0x13500000
partition_size=0x06400000
[Partition15]
partition_name=oemdata
partition_type=nand
-partition_addr=0x1A200000
-partition_size=0x07400000
+partition_addr=0x19900000
+partition_size=0x07C00000
[Partition16]
partition_name=ddr
diff --git a/ap/app/zte_comm/at_ctl/src/atconfig/ps_normal.c b/ap/app/zte_comm/at_ctl/src/atconfig/ps_normal.c
index dec4edf..d2479c9 100755
--- a/ap/app/zte_comm/at_ctl/src/atconfig/ps_normal.c
+++ b/ap/app/zte_comm/at_ctl/src/atconfig/ps_normal.c
@@ -22,6 +22,11 @@
//bsim
#include <openssl/aes.h>
+//>>>sj.zhang add @2023-10-08 for fix the issue of timezone.
+#define _XOPEN_SOURCE
+extern long timezone;
+//>>>sj.zhang add @2023-10-08 for fix the issue of timezone end.
+
typedef struct
{
unsigned int pubKeyRsaE[32];
@@ -162,7 +167,10 @@
set_tm.tm_mon = set_tm.tm_mon - 1;
time_tv.tv_sec = mktime(&set_tm);
- time_tv.tv_sec = time_tv.tv_sec + time_zone * 3600 / 4;
+//>>>sj.zhang add @2023-10-08 for fix the issue of timezone.
+ tzset();
+ time_tv.tv_sec = time_tv.tv_sec - timezone;
+//>>>sj.zhang add @2023-10-08 for fix the issue of timezone end.
if (0 != settimeofday(&time_tv, NULL))
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/conf/distro/vehicle_dc.conf b/cap/zx297520v3/sources/meta-zxic-custom/conf/distro/vehicle_dc.conf
index 56c0ee4..15ba171 100755
--- a/cap/zx297520v3/sources/meta-zxic-custom/conf/distro/vehicle_dc.conf
+++ b/cap/zx297520v3/sources/meta-zxic-custom/conf/distro/vehicle_dc.conf
@@ -164,6 +164,7 @@
liblynq-qser-gnss \
liblynq-qser-fota \
liblynq-systime \
+ liblynq-led \
"
zxic_lib += "${@bb.utils.contains('CONFIG_TEL_API_SUPPORT', 'RIL', 'libril libreference-ril', 'libtelsvr', d)}"
@@ -227,8 +228,10 @@
msm-svr \
player-demo \
lynq-ril-service \
+ lynq-led-demo \
lynq-qser-sim-demo \
lynq-qser-sms-demo \
+ lynq-led-sev \
uci \
gdb \
mobiletek-tester-rdit \
@@ -297,7 +300,7 @@
RAT_CONFIG_C2K_SUPPORT = "no"
MTK_MULTI_SIM_SUPPORT = "dsds"
TARGET_PLATFORM = "T106"
-MTK_LED_SUPPORT = "no"
+MTK_LED_SUPPORT = "yes"
#support lynq_atsvc [hong.liu add for lynq atsvc on 2022.12.1]
LYNQ_ATSVC_SUPPORT = "yes"
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/conf/distro/vehicle_dc_ref.conf b/cap/zx297520v3/sources/meta-zxic-custom/conf/distro/vehicle_dc_ref.conf
index 2ba0f08..85278a4 100755
--- a/cap/zx297520v3/sources/meta-zxic-custom/conf/distro/vehicle_dc_ref.conf
+++ b/cap/zx297520v3/sources/meta-zxic-custom/conf/distro/vehicle_dc_ref.conf
@@ -187,6 +187,7 @@
liblynq-qser-network \
liblynq-qser-gnss \
liblynq-qser-fota \
+ liblynq-qser-audio \
libpoweralarm \
liblynq-systime \
liblynq-autosuspend \
@@ -195,6 +196,8 @@
liblynq-gpio \
liblynq-irq \
liblynq-at-common \
+ liblynq-led \
+ liblynq-adc \
"
zxic_lib += "${@bb.utils.contains('CONFIG_TEL_API_SUPPORT', 'RIL', 'libril', 'libtelsvr', d)}"
@@ -256,6 +259,8 @@
msm-svr \
player-demo \
lynq-ril-service \
+ lynq-led-demo \
+ lynq-led-sev \
uci \
gdb \
mobiletek-tester-rdit \
@@ -275,6 +280,8 @@
lynq-gpio-demo \
lynq-irq-demo \
lynq-gnss-update \
+ lynq-audio-demo \
+ lynq-adc-demo \
"
zxic_app_open += "${@bb.utils.contains('CONFIG_TEL_API_SUPPORT', 'RIL', 'rild', '', d)}"
@@ -337,7 +344,7 @@
RAT_CONFIG_C2K_SUPPORT = "no"
MTK_MULTI_SIM_SUPPORT = "dsds"
TARGET_PLATFORM = "T106"
-MTK_LED_SUPPORT = "no"
+MTK_LED_SUPPORT = "yes"
#support lynq_atsvc [hong.liu add for lynq atsvc on 2022.12.1]
LYNQ_ATSVC_SUPPORT = "yes"
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/conf/lynq_base.conf b/cap/zx297520v3/sources/meta-zxic-custom/conf/lynq_base.conf
index 9cc2d8b..0e4d57d 100755
--- a/cap/zx297520v3/sources/meta-zxic-custom/conf/lynq_base.conf
+++ b/cap/zx297520v3/sources/meta-zxic-custom/conf/lynq_base.conf
@@ -3,7 +3,7 @@
RAT_CONFIG_C2K_SUPPORT = "no"
MTK_MULTI_SIM_SUPPORT = "dsds"
TARGET_PLATFORM = "T106"
-MTK_LED_SUPPORT = "no"
+MTK_LED_SUPPORT = "yes"
#support lynq_atsvc [hong.liu add for lynq atsvc on 2022.12.1]
LYNQ_ATSVC_SUPPORT = "yes"
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/liblynq-adc/liblynq-adc.bb b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/liblynq-adc/liblynq-adc.bb
new file mode 100755
index 0000000..bd5e36d
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/liblynq-adc/liblynq-adc.bb
@@ -0,0 +1,51 @@
+#inherit externalsrc package
+
+DESCRIPTION = "liblynq-adc"
+LICENSE = "CLOSED"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=4f60c98fa94e02f659ef5939f67fa8ae"
+
+DEPENDS += "liblynq-log libbsp"
+#inherit workonsrc
+WORKONSRC = "${TOPDIR}/../src/lynq/lib/liblynq-adc/"
+FILESEXTRAPATHS_prepend :="${TOPDIR}/../src/lynq/lib/:"
+SRC_URI = " \
+ file://liblynq-adc\
+ "
+
+SRC-DIR = "${S}/../liblynq-adc"
+TARGET_CC_ARCH += "${LDFLAGS}"
+BB_INCLUDE_ADD = "--sysroot=${STAGING_DIR_HOST}"
+BB_LDFLAGS_ADD = "--sysroot=${STAGING_DIR_HOST} -Wl,--hash-style=gnu"
+#Parameters passed to do_compile()
+FILES_${PN} = "${base_libdir}/*.so "
+
+FILES_${PN}-dev = "/test \
+ ${includedir}"
+
+FILES_${PN}-doc = "/doc"
+
+FILES_${PN}-dbg ="${base_bindir}/.debug \
+ ${base_libdir}/.debug \
+ ${base_sbindir}/.debug"
+
+INSANE_SKIP_${PN} += "already-stripped"
+INSANE_SKIP_${PN} += "installed-vs-shipped"
+
+#INHIBIT_PACKAGE_STRIP = "1"
+do_compile () {
+ oe_runmake all -C ${SRC-DIR} ROOT=${STAGING_DIR_HOST} OFLAGS="--sysroot=${STAGING_DIR_HOST} -Os -Wl,--hash-style=gnu"
+}
+
+do_install () {
+ oe_runmake install -C ${SRC-DIR} ROOT=${D}
+
+ if [ -d "${WORKONSRC}" ] ; then
+ install -d ${D}${includedir}/
+ cp -af ${SRC-DIR}/include/ ${D}${includedir}/
+ fi
+}
+
+addtask bachclean
+do_bachclean () {
+ oe_runmake clean
+}
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/liblynq-led/liblynq-led.bb b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/liblynq-led/liblynq-led.bb
new file mode 100755
index 0000000..fcbf6a6
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/liblynq-led/liblynq-led.bb
@@ -0,0 +1,54 @@
+#inherit externalsrc package
+
+DESCRIPTION = "lynq led"
+LICENSE = "CLOSED"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=b1e07e8d88e26263e71d3a9e2aa9a2ff"
+DEPENDS += "libpal gstreamer1.0 glib-2.0 libapn liblynq-log libvendor-ril liblynq-shm libbinder liblynq-uci"
+#inherit workonsrc
+WORKONSRC = "${TOPDIR}/../src/lynq/lib/liblynq-led"
+FILESEXTRAPATHS_prepend :="${TOPDIR}/../src/lynq/lib/:"
+SRC_URI = " \
+ file://liblynq-led \
+ "
+
+SRC-DIR = "${S}/../liblynq-led"
+TARGET_CC_ARCH += "${LDFLAGS}"
+BB_INCLUDE_ADD = "--sysroot=${STAGING_DIR_HOST}"
+BB_LDFLAGS_ADD = "--sysroot=${STAGING_DIR_HOST} -Wl,--hash-style=gnu"
+#Parameters passed to do_compile()
+EXTRA_OEMAKE = "'RAT_CONFIG_C2K_SUPPORT = ${RAT_CONFIG_C2K_SUPPORT}'\
+ 'MTK_MULTI_SIM_SUPPORT = ${MTK_MULTI_SIM_SUPPORT}'\
+ 'TARGET_PLATFORM = ${TARGET_PLATFORM}'"
+
+FILES_${PN} = "${base_libdir}/*.so \
+ ${base_bindir}\
+ ${base_sbindir} \
+ /etc/dbus-1/system.d/"
+FILES_${PN}-dev = "/test \
+ ${includedir}"
+FILES_${PN}-doc = "/doc"
+FILES_${PN}-dbg ="${base_bindir}/.debug \
+ ${base_libdir}/.debug \
+ ${base_sbindir}/.debug"
+INSANE_SKIP_${PN} += "already-stripped"
+INSANE_SKIP_${PN} += "installed-vs-shipped"
+#INHIBIT_PACKAGE_STRIP = "1"
+do_compile () {
+ if [ "${PACKAGE_ARCH}" = "cortexa7hf-vfp-vfpv4-neon" ]; then
+ oe_runmake all -C ${SRC-DIR} ROOT=${STAGING_DIR_HOST} OFLAGS="--sysroot=${STAGING_DIR_HOST} -Os -mfpu=neon-vfpv4 -mhard-float -Wl,--hash-style=gnu -DTELEPHONYWARE"
+ elif [ "${PACKAGE_ARCH}" = "cortexa7hf-neon-vfpv4" ]; then
+ oe_runmake all -C ${SRC-DIR} ROOT=${STAGING_DIR_HOST} OFLAGS="--sysroot=${STAGING_DIR_HOST} -Os -mfpu=neon-vfpv4 -mhard-float -Wl,--hash-style=gnu -DTELEPHONYWARE"
+ elif [ "${PACKAGE_ARCH}" = "cortexa53hf-neon-fp-armv8" ]; then
+ oe_runmake all -C ${SRC-DIR} ROOT=${STAGING_DIR_HOST} OFLAGS="--sysroot=${STAGING_DIR_HOST} -Os -mfpu=neon-vfpv4 -mhard-float -Wl,--hash-style=gnu -DTELEPHONYWARE -mhard-float -mfpu=neon-fp-armv8 -mfloat-abi=hard -mcpu=cortex-a53 -mtune=cortex-a53"
+ else
+ oe_runmake all -C ${SRC-DIR} ROOT=${STAGING_DIR_HOST} OFLAGS="--sysroot=${STAGING_DIR_HOST} -Os -Wl,--hash-style=gnu -DTELEPHONYWARE"
+ fi
+}
+
+do_install() {
+ oe_runmake install -C ${SRC-DIR} ROOT=${D}
+ if [ -d "${WORKONSRC}" ] ; then
+ install -d ${D}${includedir}
+ cp -af ${SRC-DIR}/include/libled/ ${D}${includedir}/libled
+ fi
+}
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/liblynq-qser-audio/liblynq-qser-audio.bb b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/liblynq-qser-audio/liblynq-qser-audio.bb
new file mode 100755
index 0000000..59d21db
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/liblynq-qser-audio/liblynq-qser-audio.bb
@@ -0,0 +1,58 @@
+#inherit externalsrc package
+
+DESCRIPTION = "liblynq-qser-audio.so "
+SECTION = "base"
+#LICENSE = "Mobiletek""
+LICENSE = "CLOSED"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=4f60c98fa94e02f659ef5939f67fa8ae"
+DEPENDS += "bootchart liblynq-log libupi-ab openssl libmedia"
+
+#inherit workonsrc
+WORKONSRC = "${TOPDIR}/../src/lynq/lib/liblynq-qser-audio/"
+
+FILESEXTRAPATHS_prepend :="${TOPDIR}/../src/lynq/lib/:"
+SRC_URI = " \
+ file://liblynq-qser-audio \
+ "
+
+SRC-DIR = "${S}/../liblynq-qser-audio"
+TARGET_CC_ARCH += "${LDFLAGS}"
+BB_INCLUDE_ADD = "--sysroot=${STAGING_DIR_HOST}"
+BB_LDFLAGS_ADD = "--sysroot=${STAGING_DIR_HOST} -Wl,--hash-style=gnu"
+
+#Parameters passed to do_compile()
+
+FILES_${PN} = "${base_libdir}/*.so "
+
+
+FILES_${PN}-dev = "/test \
+ ${includedir}"
+
+FILES_${PN}-doc = "/doc"
+
+FILES_${PN}-dbg ="${base_bindir}/.debug \
+ ${base_libdir}/.debug \
+ ${base_sbindir}/.debug"
+
+INSANE_SKIP_${PN} += "already-stripped"
+INSANE_SKIP_${PN} += "installed-vs-shipped"
+
+
+#INHIBIT_PACKAGE_STRIP = "1"
+do_compile () {
+ oe_runmake all -C ${SRC-DIR} ROOT=${STAGING_DIR_HOST} OFLAGS="--sysroot=${STAGING_DIR_HOST} -Os -Wl,--hash-style=gnu"
+}
+
+do_install () {
+ oe_runmake install -C ${SRC-DIR} ROOT=${D}
+
+ if [ -d "${WORKONSRC}" ] ; then
+ install -d ${D}${includedir}/
+ cp -af ${SRC-DIR}/include/ ${D}${includedir}/
+ fi
+}
+
+addtask bachclean
+do_bachclean () {
+ oe_runmake clean
+}
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/liblynq-qser-gnss/liblynq-qser-gnss.bb b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/liblynq-qser-gnss/liblynq-qser-gnss.bb
index 469ee92..8dcdfb7 100755
--- a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/liblynq-qser-gnss/liblynq-qser-gnss.bb
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/liblynq-qser-gnss/liblynq-qser-gnss.bb
@@ -3,7 +3,7 @@
DESCRIPTION = "liblynq-qser-gnss"
LICENSE = "CLOSED"
LIC_FILES_CHKSUM = "file://LICENSE;md5=3f86c7f456a6d0bbeca155e65084eee1"
-DEPENDS += "liblynq-log libxml2"
+DEPENDS += "liblynq-log libxml2 liblynq-uci libsctel libbsp"
#inherit workonsrc
WORKONSRC = "${TOPDIR}/../src/lynq/lib/liblynq-qser-gnss/"
FILESEXTRAPATHS_prepend :="${TOPDIR}/../src/lynq/lib/:"
@@ -38,18 +38,19 @@
#INHIBIT_PACKAGE_STRIP = "1"
do_compile () {
- oe_runmake all -C ${SRC-DIR} ROOT=${STAGING_DIR_HOST} OFLAGS="--sysroot=${STAGING_DIR_HOST} -Os -Wl,--hash-style=gnu -DTELEPHONYWARE"
+ oe_runmake all -C ${SRC-DIR} ROOT=${STAGING_DIR_HOST} OFLAGS="--sysroot=${STAGING_DIR_HOST} -Os -Wl,--hash-style=gnu -DTELEPHONYWARE"
}
do_install () {
oe_runmake install -C ${SRC-DIR} ROOT=${D}
-
+
if [ -d "${WORKONSRC}" ] ; then
install -d ${D}${includedir}/
cp -raf ${SRC-DIR}/include/ ${D}${includedir}/
install -d ${D}/data/gnss_update
- install -m 644 ${WORKONSRC}UC6228CI-R3.2.10.100Build8019_mfg.pkg ${D}/data/gnss_update
+ install -m 644 ${WORKONSRC}UC6228CI-R3.2.10.100Build8019_mfg.pkg ${D}/data/gnss_update
install -m 644 ${WORKONSRC}bootloader_r3.0.0_build6773_uartboot_921600.pkg ${D}/data/gnss_update
+ install -m 644 ${WORKONSRC}agps.conf ${D}/data/gnss_update
ln -sf ./UC6228CI-R3.2.10.100Build8019_mfg.pkg ${D}/data/gnss_update/firmware.pkg
ln -sf ./bootloader_r3.0.0_build6773_uartboot_921600.pkg ${D}/data/gnss_update/bootloader.pkg
fi
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-adc-demo/files/LICENSE b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-adc-demo/files/LICENSE
new file mode 100755
index 0000000..cb88533
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-adc-demo/files/LICENSE
@@ -0,0 +1,31 @@
+Copyright Statement:
+
+This software/firmware and related documentation ("Mobiletek Software") are
+protected under relevant copyright laws. The information contained herein is
+confidential and proprietary to Mobiletek Inc. and/or its licensors. Without
+the prior written permission of Mobiletek inc. and/or its licensors, any
+reproduction, modification, use or disclosure of Mobiletek Software, and
+information contained herein, in whole or in part, shall be strictly
+prohibited.
+
+Mobiletek Inc. (C) 2015. All rights reserved.
+
+BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
+THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("Mobiletek SOFTWARE")
+RECEIVED FROM Mobiletek AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER
+ON AN "AS-IS" BASIS ONLY. Mobiletek EXPRESSLY DISCLAIMS ANY AND ALL
+WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
+WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
+NONINFRINGEMENT. NEITHER DOES Mobiletek PROVIDE ANY WARRANTY WHATSOEVER WITH
+RESPECT TO THE SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY,
+INCORPORATED IN, OR SUPPLIED WITH THE Mobiletek SOFTWARE, AND RECEIVER AGREES
+TO LOOK ONLY TO SUCH THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO.
+RECEIVER EXPRESSLY ACKNOWLEDGES THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO
+OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES CONTAINED IN Mobiletek
+SOFTWARE. Mobiletek SHALL ALSO NOT BE RESPONSIBLE FOR ANY Mobiletek SOFTWARE
+RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
+STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND Mobiletek'S
+ENTIRE AND CUMULATIVE LIABILITY WITH RESPECT TO THE Mobiletek SOFTWARE
+RELEASED HEREUNDER WILL BE, AT Mobiletek'S OPTION, TO REVISE OR REPLACE THE
+Mobiletek SOFTWARE AT ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE
+CHARGE PAID BY RECEIVER TO Mobiletek FOR SUCH Mobiletek SOFTWARE AT ISSUE.
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-adc-demo/files/lynq-adc-demo.cpp b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-adc-demo/files/lynq-adc-demo.cpp
new file mode 100755
index 0000000..7fca094
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-adc-demo/files/lynq-adc-demo.cpp
@@ -0,0 +1,49 @@
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <include/lynq-adc.h>
+
+void handle_adc(const char* adc_name, int adc_type)
+{
+ if (adc_name == NULL)
+ {
+ printf("Error: adc_name is a null pointer\n");
+ return;
+ }
+ int adc_value = qser_adc_show(adc_type);
+ if (adc_value < 0)
+ {
+ printf("Error: Failed to get the value of %s\n", adc_name);
+ return;
+ }
+ printf("%s value: %d mV\n", adc_name, adc_value);
+}
+
+int main(int argc, char *argv[])
+{
+ if (argc != 2)
+ {
+ printf("Usage: %s <ADC0|ADC1|ADC2>\n", argv[0]);
+ return -1;
+ }
+
+ if (strcmp(argv[1], "ADC0") == 0)
+ {
+ handle_adc("ADC0", ADC0);
+ }
+ else if (strcmp(argv[1], "ADC1") == 0)
+ {
+ handle_adc("ADC1", ADC1);
+ }
+ else if (strcmp(argv[1], "ADC2") == 0)
+ {
+ handle_adc("ADC2", ADC2);
+ }
+ else
+ {
+ printf("Please enter valid parameters: ADC0|ADC1|ADC2\n");
+ return -1;
+ }
+
+ return 0;
+}
diff --git a/cap/zx297520v3/src/lynq/packages/apps/lynq-systime-demo/makefile b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-adc-demo/files/makefile
similarity index 70%
copy from cap/zx297520v3/src/lynq/packages/apps/lynq-systime-demo/makefile
copy to cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-adc-demo/files/makefile
index 890f85a..8e2ac82 100755
--- a/cap/zx297520v3/src/lynq/packages/apps/lynq-systime-demo/makefile
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-adc-demo/files/makefile
@@ -1,58 +1,49 @@
-SHELL = /bin/sh
-RM = rm -f
-
-LOCAL_CFLAGS := -Wall \
- -std=gnu++14 \
- -g -Os \
- -flto \
- -fpermissive \
-
-ifeq ($(strip $(TARGET_PLATFORM)), T106)
-LOCAL_CFLAGS += -DBINDER_IPC_32BIT=1 -DHAVE_ENDIAN_H -DHAVE_PTHREADS -DHAVE_SYS_UIO_H -DHAVE_POSIX_FILEMAP -DHAVE_STRLCPY -DHAVE_PRCTL -DHAVE_MEMSET16 -DHAVE_MEMSET32 -DANDROID_SMP=0
-endif
-
-ifeq ($(strip $(TARGET_PLATFORM)), T106)
-LOCAL_CFLAGS += -DMOBILETEK_TARGET_PLATFORM_T106
-endif
-
-LOCAL_CFLAGS += -Wno-error=format-security
-
-LOCAL_PATH = .
-
-LOCAL_C_INCLUDES = \
- -I. \
- -I$(LOCAL_PATH)/include/ \
- -I$(ROOT)$(includedir)/ \
- -I$(ROOT)$(includedir)/include/ \
-
-
-
-LOCAL_LIBS := \
- -L. \
- -ldl \
- -lstdc++ \
- -lpthread \
- -llynq-systime \
-
-
-
-SOURCES = lynq_systime_demo.cpp
-
-EXECUTABLE = lynq-systime-demo
-
-OBJECTS=$(SOURCES:.cpp=.o)
-
-OBJECTS_TOOL=$(SOURCES_TOOL:.cpp=.o)
-all: $(EXECUTABLE)
-
-$(EXECUTABLE): $(OBJECTS)
- $(CXX) $(OBJECTS) $(LOCAL_LIBS) $(LOCAL_CFLAGS) $(LOCAL_C_INCLUDES) -o $@
-
-%.o : %.cpp
- $(CXX) $(LOCAL_C_INCLUDES) $(LOCAL_CFLAGS) $(LOCAL_LIBS) -o $@ -c $<
-
-.PHONY: clean
-clean:
- $(RM) $(OBJECTS) $(EXECUTABLE)
- $(RM) $(OBJECTS_TOOL) $(EXECUTABLE)
-
+SHELL = /bin/sh
+RM = rm -rf
+
+LOCAL_CFLAGS := -Wall \
+ -std=gnu++14 \
+ -g -Os \
+ -flto \
+ -fpermissive \
+
+ifeq ($(strip $(TARGET_PLATFORM)), T106)
+LOCAL_CFLAGS += -DBINDER_IPC_32BIT=1 -DHAVE_ENDIAN_H -DHAVE_PTHREADS -DHAVE_SYS_UIO_H -DHAVE_POSIX_FILEMAP -DHAVE_STRLCPY -DHAVE_PRCTL -DHAVE_MEMSET16 -DHAVE_MEMSET32 -DANDROID_SMP=0
+endif
+
+LOCAL_CFLAGS += -Werror=format-security
+
+$(warning ################# rock ROOT: $(ROOT),includedir:$(includedir),)
+
+LOCAL_PATH = .
+
+LOCAL_C_INCLUDES = \
+ -I. \
+ -I$(LOCAL_PATH)/include/ \
+ -I$(ROOT)$(includedir)/ \
+
+LOCAL_LIBS := \
+ -L. \
+ -ldl \
+ -lstdc++ \
+ -llynq-adc \
+
+SOURCES = lynq-adc-demo.cpp
+
+EXECUTABLE = lynq-adc-demo
+
+OBJECTS=$(SOURCES:.cpp=.o)
+
+all: $(EXECUTABLE)
+
+$(EXECUTABLE): $(OBJECTS)
+ $(CXX) $(OBJECTS) $(LOCAL_LIBS) $(LOCAL_CFLAGS) $(LOCAL_C_INCLUDES) -o $@
+
+%.o : %.cpp
+ $(CXX) $(LOCAL_C_INCLUDES) $(LOCAL_CFLAGS) $(LOCAL_LIBS) -o $@ -c $<
+
+.PHONY: clean
+clean:
+ $(RM) $(OBJECTS) $(EXECUTABLE)
+ $(RM) $(OBJECTS_TOOL) $(EXECUTABLE)
+
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-adc-demo/lynq-adc-demo.bb b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-adc-demo/lynq-adc-demo.bb
new file mode 100644
index 0000000..edcbbe4
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-adc-demo/lynq-adc-demo.bb
@@ -0,0 +1,29 @@
+#inherit externalsrc package
+#inherit externalsrc package systemd
+DESCRIPTION = "lynq-adc-demo"
+LICENSE = "CLOSED"
+LICENSE = "CLOSED"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=b1e07e8d88e26263e71d3a9e2aa9a2ff"
+SRC_URI = "file://lynq-adc-demo.cpp \
+ file://makefile \
+"
+DEPENDS += "liblynq-adc"
+
+SRC-DIR = "${S}/../lynq-adc-demo"
+FILES_${PN} += "${bindir}/"
+TARGET_CC_ARCH += "${LDFLAGS}"
+SYSTEMD_PACKAGES = "${PN}"
+S = "${WORKDIR}"
+#INHIBIT_PACKAGE_STRIP = "1"
+do_compile () {
+ if test "${PACKAGE_ARCH}" = "cortexa7hf-vfp-vfpv4-neon" || test "${PACKAGE_ARCH}" = "cortexa7hf-neon-vfpv4"; then
+ oe_runmake all ROOT=${STAGING_DIR_HOST} OFLAGS="--sysroot=${STAGING_DIR_HOST} -mhard-float"
+ else
+ oe_runmake all ROOT=${STAGING_DIR_HOST} OFLAGS="--sysroot=${STAGING_DIR_HOST}"
+ fi
+}
+
+do_install() {
+ install -d ${D}${bindir}/
+ install -m 0755 ${S}/lynq-adc-demo ${D}${bindir}/
+}
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-audio-demo/files/LICENSE b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-audio-demo/files/LICENSE
new file mode 100755
index 0000000..cb88533
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-audio-demo/files/LICENSE
@@ -0,0 +1,31 @@
+Copyright Statement:
+
+This software/firmware and related documentation ("Mobiletek Software") are
+protected under relevant copyright laws. The information contained herein is
+confidential and proprietary to Mobiletek Inc. and/or its licensors. Without
+the prior written permission of Mobiletek inc. and/or its licensors, any
+reproduction, modification, use or disclosure of Mobiletek Software, and
+information contained herein, in whole or in part, shall be strictly
+prohibited.
+
+Mobiletek Inc. (C) 2015. All rights reserved.
+
+BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
+THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("Mobiletek SOFTWARE")
+RECEIVED FROM Mobiletek AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER
+ON AN "AS-IS" BASIS ONLY. Mobiletek EXPRESSLY DISCLAIMS ANY AND ALL
+WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
+WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
+NONINFRINGEMENT. NEITHER DOES Mobiletek PROVIDE ANY WARRANTY WHATSOEVER WITH
+RESPECT TO THE SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY,
+INCORPORATED IN, OR SUPPLIED WITH THE Mobiletek SOFTWARE, AND RECEIVER AGREES
+TO LOOK ONLY TO SUCH THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO.
+RECEIVER EXPRESSLY ACKNOWLEDGES THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO
+OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES CONTAINED IN Mobiletek
+SOFTWARE. Mobiletek SHALL ALSO NOT BE RESPONSIBLE FOR ANY Mobiletek SOFTWARE
+RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
+STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND Mobiletek'S
+ENTIRE AND CUMULATIVE LIABILITY WITH RESPECT TO THE Mobiletek SOFTWARE
+RELEASED HEREUNDER WILL BE, AT Mobiletek'S OPTION, TO REVISE OR REPLACE THE
+Mobiletek SOFTWARE AT ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE
+CHARGE PAID BY RECEIVER TO Mobiletek FOR SUCH Mobiletek SOFTWARE AT ISSUE.
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-audio-demo/files/lynq-audio-demo.cpp b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-audio-demo/files/lynq-audio-demo.cpp
new file mode 100755
index 0000000..eb557f6
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-audio-demo/files/lynq-audio-demo.cpp
@@ -0,0 +1,138 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <include/lynq-qser-audio.h>
+
+extern sc_audio_handle_t playback_handle;
+
+void player_cmd_proc(char *cmdstr)
+{
+ if (strcmp(cmdstr, "P\n") == 0)
+ {
+ qser_AudPlayer_Pause(playback_handle);
+ }
+ else if (strcmp(cmdstr, "R\n") == 0)
+ {
+ qser_AudPlayer_Resume(playback_handle);
+ }
+ else if (strcmp(cmdstr, "T\n") == 0)
+ {
+ qser_AudPlayer_Stop(playback_handle);
+ }
+ else
+ {
+ printf("Unknown command: %s", cmdstr);
+ }
+}
+
+void capture_cmd_proc(char *cmdstr)
+{
+ if (strcmp(cmdstr, "P\n") == 0)
+ {
+ qser_AudRecorder_Pause();
+ }
+ else if (strcmp(cmdstr, "R\n") == 0)
+ {
+ qser_AudRecorder_Resume();
+ }
+ else if (strcmp(cmdstr, "T\n") == 0)
+ {
+ qser_AudRecorder_Stop();
+ }
+ else
+ {
+ printf("Unknown command: %s", cmdstr);
+ }
+}
+
+int main(int argc, char *argv[])
+{
+ if (argc < 3)
+ {
+ printf("Usage: %s <play|recd> <file>\n", argv[0]);
+ return 1;
+ }
+
+ const char *action = argv[1];
+ const char *file = argv[2];
+
+ int g_audio_owner_id = 0;
+ char player_device[] = "device1";
+ char recorder_device[] = "device2";
+ char cmdstr[256];
+
+ _cb_onPlayer cb_fun = [](int result)
+ {
+ if (result == 0)
+ {
+ printf("Audio recorder opened successfully.\n");
+ }
+ else
+ {
+ printf("Failed to open audio recorder, error code: %d\n", result);
+ }
+ };
+
+ if (strcmp(action, "play") == 0)
+ {
+ int player_open_result = qser_AudPlayer_Open(player_device, cb_fun);
+ if (player_open_result != 0)
+ {
+ printf("Failed to open audio player.\n");
+ return 1;
+ }
+
+ qser_AudPlayer_PlayFrmFile(g_audio_owner_id, file, 0);
+
+ while (1)
+ {
+ printf("Please input a player command (P/R/T/exit) :\n");
+ if (fgets(cmdstr, sizeof(cmdstr), stdin) != NULL)
+ {
+ if (strcmp(cmdstr, "exit\n") == 0)
+ {
+ qser_AudPlayer_Close(playback_handle);
+ break;
+ }
+ player_cmd_proc(cmdstr);
+ }
+ }
+
+ qser_AudPlayer_Close(playback_handle);
+ }
+ else if (strcmp(action, "recd") == 0)
+ {
+ int recorder_open_result = qser_AudRecorder_Open(recorder_device, cb_fun);
+ if (recorder_open_result != 0) {
+ printf("Failed to open audio recorder.\n");
+ return 1;
+ }
+
+ qser_AudRecorder_StartRecord(g_audio_owner_id, file, 0);
+
+ while (1)
+ {
+ printf("Please input a player command (P/R/T/exit) :\n");
+ if (fgets(cmdstr, sizeof(cmdstr), stdin) != NULL)
+ {
+ if (strcmp(cmdstr, "exit\n") == 0)
+ {
+ qser_AudRecorder_Close();
+ break;
+ }
+ capture_cmd_proc(cmdstr);
+ }
+ }
+ qser_AudRecorder_Close();
+ }
+ else
+ {
+ printf("Unknown action: %s\n", action);
+ return 1;
+ }
+
+ qser_Audio_Deinit();
+
+ return 0;
+}
diff --git a/cap/zx297520v3/src/lynq/packages/apps/lynq-systime-demo/makefile b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-audio-demo/files/makefile
similarity index 74%
copy from cap/zx297520v3/src/lynq/packages/apps/lynq-systime-demo/makefile
copy to cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-audio-demo/files/makefile
index 890f85a..c37eeaa 100755
--- a/cap/zx297520v3/src/lynq/packages/apps/lynq-systime-demo/makefile
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-audio-demo/files/makefile
@@ -1,58 +1,51 @@
-SHELL = /bin/sh
-RM = rm -f
-
-LOCAL_CFLAGS := -Wall \
- -std=gnu++14 \
- -g -Os \
- -flto \
- -fpermissive \
-
-ifeq ($(strip $(TARGET_PLATFORM)), T106)
-LOCAL_CFLAGS += -DBINDER_IPC_32BIT=1 -DHAVE_ENDIAN_H -DHAVE_PTHREADS -DHAVE_SYS_UIO_H -DHAVE_POSIX_FILEMAP -DHAVE_STRLCPY -DHAVE_PRCTL -DHAVE_MEMSET16 -DHAVE_MEMSET32 -DANDROID_SMP=0
-endif
-
-ifeq ($(strip $(TARGET_PLATFORM)), T106)
-LOCAL_CFLAGS += -DMOBILETEK_TARGET_PLATFORM_T106
-endif
-
-LOCAL_CFLAGS += -Wno-error=format-security
-
-LOCAL_PATH = .
-
-LOCAL_C_INCLUDES = \
- -I. \
- -I$(LOCAL_PATH)/include/ \
- -I$(ROOT)$(includedir)/ \
- -I$(ROOT)$(includedir)/include/ \
-
-
-
-LOCAL_LIBS := \
- -L. \
- -ldl \
- -lstdc++ \
- -lpthread \
- -llynq-systime \
-
-
-
-SOURCES = lynq_systime_demo.cpp
-
-EXECUTABLE = lynq-systime-demo
-
-OBJECTS=$(SOURCES:.cpp=.o)
-
-OBJECTS_TOOL=$(SOURCES_TOOL:.cpp=.o)
-all: $(EXECUTABLE)
-
-$(EXECUTABLE): $(OBJECTS)
- $(CXX) $(OBJECTS) $(LOCAL_LIBS) $(LOCAL_CFLAGS) $(LOCAL_C_INCLUDES) -o $@
-
-%.o : %.cpp
- $(CXX) $(LOCAL_C_INCLUDES) $(LOCAL_CFLAGS) $(LOCAL_LIBS) -o $@ -c $<
-
-.PHONY: clean
-clean:
- $(RM) $(OBJECTS) $(EXECUTABLE)
- $(RM) $(OBJECTS_TOOL) $(EXECUTABLE)
-
+SHELL = /bin/sh
+RM = rm -f
+
+LOCAL_CFLAGS := -Wall \
+ -std=gnu++14 \
+ -g -Os \
+ -flto \
+ -fpermissive \
+
+ifeq ($(strip $(TARGET_PLATFORM)), T106)
+LOCAL_CFLAGS += -DBINDER_IPC_32BIT=1 -DHAVE_ENDIAN_H -DHAVE_PTHREADS -DHAVE_SYS_UIO_H -DHAVE_POSIX_FILEMAP -DHAVE_STRLCPY -DHAVE_PRCTL -DHAVE_MEMSET16 -DHAVE_MEMSET32 -DANDROID_SMP=0
+endif
+
+LOCAL_CFLAGS += -Werror=format-security
+
+$(warning ################# rock ROOT: $(ROOT),includedir:$(includedir),)
+
+LOCAL_PATH = .
+
+LOCAL_C_INCLUDES = \
+ -I. \
+ -I$(LOCAL_PATH)/include/ \
+ -I$(ROOT)$(includedir)/ \
+
+
+LOCAL_LIBS := \
+ -L. \
+ -ldl \
+ -lstdc++ \
+ -lpthread \
+ -llynq-qser-audio \
+
+SOURCES = lynq-audio-demo.cpp
+
+EXECUTABLE = lynq-audio-demo
+
+OBJECTS=$(SOURCES:.cpp=.o)
+
+all: $(EXECUTABLE)
+
+$(EXECUTABLE): $(OBJECTS)
+ $(CXX) $(OBJECTS) $(LOCAL_LIBS) $(LOCAL_CFLAGS) $(LOCAL_C_INCLUDES) -o $@
+
+%.o : %.cpp
+ $(CXX) $(LOCAL_C_INCLUDES) $(LOCAL_CFLAGS) $(LOCAL_LIBS) -o $@ -c $<
+
+.PHONY: clean
+clean:
+ $(RM) $(OBJECTS) $(EXECUTABLE)
+ $(RM) $(OBJECTS_TOOL) $(EXECUTABLE)
+
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-audio-demo/lynq-audio-demo.bb b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-audio-demo/lynq-audio-demo.bb
new file mode 100644
index 0000000..2260b19
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-audio-demo/lynq-audio-demo.bb
@@ -0,0 +1,31 @@
+#inherit externalsrc package
+#inherit externalsrc package systemd
+DESCRIPTION = "lynq-audio-demo"
+LICENSE = "CLOSED"
+LICENSE = "CLOSED"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=b1e07e8d88e26263e71d3a9e2aa9a2ff"
+SRC_URI = "file://lynq-audio-demo.cpp \
+ file://makefile \
+"
+DEPENDS += "liblynq-qser-audio"
+
+SRC-DIR = "${S}/../lynq-audio-demo"
+FILES_${PN} += "${bindir}/"
+TARGET_CC_ARCH += "${LDFLAGS}"
+SYSTEMD_PACKAGES = "${PN}"
+S = "${WORKDIR}"
+#INHIBIT_PACKAGE_STRIP = "1"
+do_compile () {
+ if test "${PACKAGE_ARCH}" = "cortexa7hf-vfp-vfpv4-neon" || test "${PACKAGE_ARCH}" = "cortexa7hf-neon-vfpv4"; then
+ oe_runmake all ROOT=${STAGING_DIR_HOST} OFLAGS="--sysroot=${STAGING_DIR_HOST} -mhard-float"
+ else
+ oe_runmake all ROOT=${STAGING_DIR_HOST} OFLAGS="--sysroot=${STAGING_DIR_HOST}"
+ fi
+}
+
+
+do_install() {
+
+ install -d ${D}${bindir}/
+ install -m 0755 ${S}/lynq-audio-demo ${D}${bindir}/
+}
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-autosuspend/files/autosuspend_wakeup_count.c b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-autosuspend/files/autosuspend_wakeup_count.c
index 85fbc84..b1d03ff 100755
--- a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-autosuspend/files/autosuspend_wakeup_count.c
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-autosuspend/files/autosuspend_wakeup_count.c
@@ -235,13 +235,26 @@
}
#endif
-static int suspend_ctrl(char *wakeup_count,int wakeup_count_len)
+#ifdef MOBILETEK_TARGET_PLATFORM_T106
+int t106_early_suspend(void)
{
+ RLOGD("t106_early_suspend start\n");
+ system("/etc/init.d/syslog stop");
+ return 0;
+}
+void t106_early_resume(void)
+{
+ RLOGD("t106_early_resume start\n");
+ system("/etc/init.d/syslog start");
+ return NULL;
+}
+#endif
- char buf[80];
- int ret = 0;
#ifdef MOBILETEK_SUSPEND_CFG
+int t800_early_suspend(char *wakeup_count, int wakeup_count_len)
+{
+ char buf[80];
system("echo \"Sys standby mode\" >/dev/console");
// sleep(1);
system("echo 7 | emdlogger_ctrl");
@@ -278,6 +291,63 @@
return -1;
}
}
+ return 0;
+}
+
+void t800_early_resume(bool success)
+{
+ system("hwclock -s");
+ RLOGD("TIME: rtc to sys\n");
+ if (!success)
+ {
+
+ system("mdlogctl start");
+
+ system("echo 8 | emdlogger_ctrl");
+
+ usleep(200000);
+ ALOGI("Log on with failure\n");
+ return ;
+ }
+
+ if (lynq_screen(1) != 0) // notify ril for screen on
+ {
+ ALOGI("lynq_screen on fail\n");
+ }
+
+ system("mdlogctl start");
+
+ system("echo 8 | emdlogger_ctrl");
+ usleep(300000); //delay 2s for ril handling screen on,at least 70ms
+
+ return NULL;
+}
+#endif
+
+
+static int suspend_ctrl(char *wakeup_count,int wakeup_count_len)
+{
+
+
+ char buf[80];
+ int ret = 0;
+#ifdef MOBILETEK_SUSPEND_CFG
+ ret = t800_early_suspend(char *wakeup_count, wakeup_count_len);
+ if(ret != 0)
+ {
+ ALOGD("t800_early_suspend fail\n");
+ return -1;
+ }
+#endif
+
+
+#ifdef MOBILETEK_TARGET_PLATFORM_T106
+ ret = t106_early_suspend();
+ if(ret != 0)
+ {
+ ALOGD("t106_early_suspend fail\n");
+ return -1;
+ }
#endif
system("echo \"autosuspend:Sys suspend\" >/dev/console");
@@ -297,35 +367,14 @@
char buf[80];
long sleeptime = 0;
+
#ifdef MOBILETEK_SUSPEND_CFG
- system("hwclock -s");
- RLOGD("TIME: rtc to sys\n");
- if (!success)
- {
+ t800_early_resume(bool success);
+#endif
- system("mdlogctl start");
- system("echo 8 | emdlogger_ctrl");
-
- usleep(200000);
- ALOGI("Log on with failure\n");
- return ;
- }
-
-
- if (lynq_screen(1) != 0) // notify ril for screen on
- {
- ALOGI("lynq_screen on fail\n");
-
- }
-
- system("mdlogctl start");
-
-// sleep(1);
-
- system("echo 8 | emdlogger_ctrl");
-
- usleep(300000); //delay 2s for ril handling screen on,at least 70ms
+#ifdef MOBILETEK_TARGET_PLATFORM_T106
+ t106_early_resume();
#endif
pthread_mutex_lock(&time_info_mutex);
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-led-demo/lynq-led-demo.bb b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-led-demo/lynq-led-demo.bb
new file mode 100755
index 0000000..a598b6a
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-led-demo/lynq-led-demo.bb
@@ -0,0 +1,41 @@
+#inherit externalsrc package
+
+DESCRIPTION = "lynq led demo"
+LICENSE = "CLOSED"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=b1e07e8d88e26263e71d3a9e2aa9a2ff"
+DEPENDS += "liblynq-uci liblynq-led"
+#inherit workonsrc
+WORKONSRC = "${TOPDIR}/../src/lynq/packages/apps/lynq-led-demo"
+FILESEXTRAPATHS_prepend :="${TOPDIR}/../src/lynq/packages/apps:"
+SRC_URI = " \
+ file://lynq-led-demo \
+ "
+
+SRC-DIR = "${S}/../lynq-led-demo"
+TARGET_CC_ARCH += "${LDFLAGS}"
+
+#Parameters passed to do_compile()
+EXTRA_OEMAKE = "'RAT_CONFIG_C2K_SUPPORT = ${RAT_CONFIG_C2K_SUPPORT}'\
+ 'MTK_MULTI_SIM_SUPPORT = ${MTK_MULTI_SIM_SUPPORT}'\
+ 'TARGET_PLATFORM = ${TARGET_PLATFORM}'"
+
+EXTRA_OEMAKE += "'LYNQ_CONFIG_VERSION = ${LYNQ_CONFIG_VERSION}' \
+ 'LYNQ_CONFIG_SW_VERSION = ${LYNQ_CONFIG_SW_VERSION}'"
+
+#INHIBIT_PACKAGE_STRIP = "1"
+do_compile () {
+ if [ "${PACKAGE_ARCH}" = "cortexa7hf-vfp-vfpv4-neon" ]; then
+ oe_runmake all -C ${SRC-DIR} ROOT=${STAGING_DIR_HOST} OFLAGS="--sysroot=${STAGING_DIR_HOST} -Os -mfpu=neon-vfpv4 -mhard-float -Wl,--hash-style=gnu -DTELEPHONYWARE"
+ elif [ "${PACKAGE_ARCH}" = "cortexa7hf-neon-vfpv4" ]; then
+ oe_runmake all -C ${SRC-DIR} ROOT=${STAGING_DIR_HOST} OFLAGS="--sysroot=${STAGING_DIR_HOST} -Os -mfpu=neon-vfpv4 -mhard-float -Wl,--hash-style=gnu -DTELEPHONYWARE"
+ elif [ "${PACKAGE_ARCH}" = "cortexa53hf-neon-fp-armv8" ]; then
+ oe_runmake all -C ${SRC-DIR} ROOT=${STAGING_DIR_HOST} OFLAGS="--sysroot=${STAGING_DIR_HOST} -Os -mfpu=neon-vfpv4 -mhard-float -Wl,--hash-style=gnu -DTELEPHONYWARE -mhard-float -mfpu=neon-fp-armv8 -mfloat-abi=hard -mcpu=cortex-a53 -mtune=cortex-a53"
+ else
+ oe_runmake all -C ${SRC-DIR} ROOT=${STAGING_DIR_HOST} OFLAGS="--sysroot=${STAGING_DIR_HOST} -Os -Wl,--hash-style=gnu -DTELEPHONYWARE"
+ fi
+}
+
+do_install() {
+ install -d ${D}${bindir}/
+ install -m 0755 ${SRC-DIR}/lynq-led-demo ${D}${bindir}/
+}
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-led-sev/lynq-led-sev.bb b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-led-sev/lynq-led-sev.bb
new file mode 100755
index 0000000..1c8d0a8
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-led-sev/lynq-led-sev.bb
@@ -0,0 +1,51 @@
+#inherit externalsrc package
+
+DESCRIPTION = "lynq led sev"
+LICENSE = "CLOSED"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=b1e07e8d88e26263e71d3a9e2aa9a2ff"
+DEPENDS += "liblynq-uci"
+#inherit workonsrc
+WORKONSRC = "${TOPDIR}/../src/lynq/framework/lynq-led-sev"
+FILESEXTRAPATHS_prepend :="${TOPDIR}/../src/lynq/framework/:"
+SRC_URI = " \
+ file://lynq-led-sev \
+ "
+
+SRC-DIR = "${S}/../lynq-led-sev"
+TARGET_CC_ARCH += "${LDFLAGS}"
+SYSTEMD_PACKAGES = "${PN}"
+SYSTEMD_SERVICE_${PN} = "lynq_led_sev.service"
+FILES_${PN} += "${systemd_unitdir}/system/lynq_led_sev.service"
+FILES_${PN} += "/system/etc/tele/ring ${bindir}"
+#Parameters passed to do_compile()
+EXTRA_OEMAKE = "'RAT_CONFIG_C2K_SUPPORT = ${RAT_CONFIG_C2K_SUPPORT}'\
+ 'MTK_MULTI_SIM_SUPPORT = ${MTK_MULTI_SIM_SUPPORT}'\
+ 'TARGET_PLATFORM = ${TARGET_PLATFORM}'\
+ 'MTK_LED_SUPPORT = ${MTK_LED_SUPPORT}'\
+ 'TARGET_PLATFORM = ${TARGET_PLATFORM}'"
+EXTRA_OEMAKE += "'MOBILETEK_RIL_CFG = ${MOBILETEK_RIL_CFG}'"
+
+EXTRA_OEMAKE += "'MOBILETEK_FOTA_CFG = ${MOBILETEK_FOTA_CFG}'"
+
+#INHIBIT_PACKAGE_STRIP = "1"
+do_compile () {
+ if test "${PACKAGE_ARCH}" = "cortexa7hf-vfp-vfpv4-neon" || test "${PACKAGE_ARCH}" = "cortexa7hf-neon-vfpv4"; then
+ oe_runmake all -C ${SRC-DIR} ROOT=${STAGING_DIR_HOST} OFLAGS="--sysroot=${STAGING_DIR_HOST} -mhard-float"
+ else
+ oe_runmake all -C ${SRC-DIR} ROOT=${STAGING_DIR_HOST} OFLAGS="--sysroot=${STAGING_DIR_HOST}"
+ fi
+}
+
+do_install() {
+ install -d ${D}${bindir}/
+ install -m 0755 ${SRC-DIR}/lynq-led-sev ${D}${bindir}/
+ if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
+ install -d ${D}${systemd_unitdir}/system/
+ install -m 0644 ${B}/lynq_led_sev.service ${D}${systemd_unitdir}/system
+ else
+ install -d ${D}${sysconfdir}/init.d
+ install -m 0755 ${SRC-DIR}/lynq-led-sev.sh ${D}${sysconfdir}/init.d/lynq-led-sev.sh
+ install -d ${D}${sysconfdir}/rcS.d
+ ln -s ../init.d/lynq-led-sev.sh ${D}${sysconfdir}/rcS.d/S23lynq-led-sev
+ fi
+}
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-qser-network-demo/files/lynq-qser-network-demo.cpp b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-qser-network-demo/files/lynq-qser-network-demo.cpp
index 8ef97ca..0b1dd7d 100755
--- a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-qser-network-demo/files/lynq-qser-network-demo.cpp
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-qser-network-demo/files/lynq-qser-network-demo.cpp
@@ -21,6 +21,10 @@
int (*qser_nw_get_reg_status_p)(nw_client_handle_type h_nw, QSER_NW_REG_STATUS_INFO_T *pt_info);
int (*qser_nw_add_rx_msg_handler_p)(nw_client_handle_type h_nw, QSER_NW_RxMsgHandlerFunc_t handlerPtr,void* contextPtr);
int (*qser_nw_get_signal_strength_p)(nw_client_handle_type h_nw,QSER_NW_SIGNAL_STRENGTH_INFO_T *pt_info);
+int (*qser_nw_set_oos_config_p)(nw_client_handle_type h_nw, QSER_NW_OOS_CONFIG_INFO_T *pt_info);
+int (*qser_nw_get_oos_config_p)(nw_client_handle_type h_nw, QSER_NW_OOS_CONFIG_INFO_T *pt_info);
+
+
int getFunc()
{
@@ -40,6 +44,9 @@
qser_nw_get_reg_status_p = (int (*)(nw_client_handle_type h_nw, QSER_NW_REG_STATUS_INFO_T *pt_info))dlsym(handle_network,"qser_nw_get_reg_status");
qser_nw_get_signal_strength_p = (int (*)(nw_client_handle_type h_nw, QSER_NW_SIGNAL_STRENGTH_INFO_T *pt_info))dlsym(handle_network,"qser_nw_get_signal_strength");
qser_nw_add_rx_msg_handler_p = (int (*)(nw_client_handle_type h_nw, QSER_NW_RxMsgHandlerFunc_t handlerPtr,void* contextPtr))dlsym(handle_network,"qser_nw_add_rx_msg_handler");
+ qser_nw_get_oos_config_p = (int (*)(nw_client_handle_type h_nw, QSER_NW_OOS_CONFIG_INFO_T *pt_info))dlsym(handle_network,"qser_nw_get_oos_config");
+ qser_nw_set_oos_config_p = (int (*)(nw_client_handle_type h_nw, QSER_NW_OOS_CONFIG_INFO_T *pt_info))dlsym(handle_network,"qser_nw_set_oos_config");
+
if(qser_nw_client_deinit_p==NULL || qser_nw_client_init_p==NULL || qser_nw_set_config_p ==NULL ||
qser_nw_get_operator_name_p == NULL || qser_nw_get_reg_status_p ==NULL || qser_nw_add_rx_msg_handler_p==NULL)
@@ -78,7 +85,11 @@
{3, "qser_nw_get_reg_status"},
{4, "qser_nw_add_rx_msg_handler"},
{5, "qser_nw_get_signal_strength"},
- {6, "qser_nw_client_deinit"},
+ {6, "qser_nw_set_oos_config"},
+ {7, "qser_nw_get_oos_config"},
+ {8, "qser_nw_client_deinit"},
+
+
{-1, "quit"}
};
@@ -424,7 +435,7 @@
break;
}
- case 6://"qser_nw_client_deinit"
+ case 8://"qser_nw_client_deinit"
{
ret = qser_nw_client_deinit_p(h_nw);
printf("qser_nw_client_deinit ret = %d\n", ret);
@@ -475,7 +486,76 @@
}
break;
}
-
+ case 7 :
+ {
+ QSER_NW_OOS_CONFIG_INFO_T t_info;
+ int type = 0;
+ printf("please input you want query oos config's type (0: fast network scan config; 1: full band network scan config ) : \n");
+ scanf("%d", &type);
+ t_info.type = type;
+ ret = qser_nw_get_oos_config_p(h_nw, &t_info);
+ printf("qser_nw_get_oos_config, ret=%d\n", ret);
+ if(ret==0)
+ {
+ if(t_info.type == QSER_NW_OOS_CFG_TYPE_FULL_BAND_SCAN)
+ {
+ printf("qser_nw_get_oos_config t_min = %d\n"
+ " t_step = %d\n"
+ " t_num = %d\n"
+ " t_max = %d\n",
+ t_info.u.full_band_scan_info.t_min, t_info.u.full_band_scan_info.t_step,
+ t_info.u.full_band_scan_info.t_num, t_info.u.full_band_scan_info.t_max);
+ }
+ else if(t_info.type == QSER_NW_OOS_CFG_TYPE_FAST_SCAN)
+ {
+ printf("qser_nw_get_oos_config enable = %d\n"
+ " time_interval = %d\n",
+ t_info.u.fast_can_info.enable, t_info.u.fast_can_info.time_interval);
+ }
+ else
+ {
+ printf("qser_nw_get_oos_config tyep is %d, ret is ok",t_info.type);
+ }
+
+ }
+ break;
+ }
+ case 6 :
+ {
+ QSER_NW_OOS_CONFIG_INFO_T t_info;
+ int type = 0;
+ printf("please input you want set oos config's type (0: fast network scan config; 1: full band network scan config ) : \n");
+ scanf("%d", &type);
+ t_info.type = type;
+ if(t_info.type == QSER_NW_OOS_CFG_TYPE_FULL_BAND_SCAN)
+ {
+ printf("please input t_min: \n");
+ scanf("%d", &(t_info.u.full_band_scan_info.t_min));
+ printf("please input t_step: \n");
+ scanf("%d", &(t_info.u.full_band_scan_info.t_step));
+ printf("please input t_num: \n");
+ scanf("%d", &(t_info.u.full_band_scan_info.t_num));
+ printf("please input t_max: \n");
+ scanf("%d", &(t_info.u.full_band_scan_info.t_max));
+ ret = qser_nw_set_oos_config_p(h_nw, &t_info);
+ printf("qser_nw_get_oos_config, ret=%d\n", ret);
+ }
+ else if(t_info.type==QSER_NW_OOS_CFG_TYPE_FAST_SCAN)
+ {
+ printf("please input enable: \n");
+ scanf("%d", &(t_info.u.fast_can_info.enable));
+ printf("please input time_interval: \n");
+ scanf("%d", &(t_info.u.fast_can_info.time_interval));
+ ret = qser_nw_set_oos_config_p(h_nw, &t_info);
+ printf("qser_nw_get_oos_config, ret=%d\n", ret);
+ }
+ else
+ {
+ ret = qser_nw_set_oos_config_p(h_nw, &t_info);
+ printf("qser_nw_get_oos_config, ret=%d\n", ret);
+ }
+ break;
+ }
default:
{
show_group_help(&t_nw_test);
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-qser-network-demo/files/lynq_qser_network.h b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-qser-network-demo/files/lynq_qser_network.h
index b65e428..4083e13 100755
--- a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-qser-network-demo/files/lynq_qser_network.h
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-qser-network-demo/files/lynq_qser_network.h
@@ -35,6 +35,37 @@
E_QSER_NW_ROAM_STATE_TYPE_T roaming_pref; /**< Roaming preference.*/
}QSER_NW_CONFIG_INFO_T;
+/** Configures the OOS (out of service) settings that define the MCM network interface. */
+#define QSER_NW_OOS_CFG_TYPE_FAST_SCAN 0x00 /**< fast net scan */
+#define QSER_NW_OOS_CFG_TYPE_FULL_BAND_SCAN 0x01 /**< full band scan */
+
+typedef struct
+{
+ /* Configuration parameters for MCM network fast network scan when OOS (out of service)*/
+ char enable;
+ uint16_t time_interval;
+}QSER_NW_OOS_CONFIG_FAST_SCAN_INFO_T;
+
+typedef struct
+{
+ /* Configuration parameters for MCM network full band network scan when OOS (out of service)*/
+ int t_min;
+ int t_step;
+ int t_num;
+ int t_max;
+}QSER_NW_OOS_CONFIG_FULL_BAND_SCAN_INFO_T;
+
+
+typedef struct
+{
+ char type; /**< QSER_NW_OOS_CFG_TYPE_xxxx.*/
+ union {
+ QSER_NW_OOS_CONFIG_FAST_SCAN_INFO_T fast_can_info; // 00
+ QSER_NW_OOS_CONFIG_FULL_BAND_SCAN_INFO_T full_band_scan_info; // 01
+ } u;
+}QSER_NW_OOS_CONFIG_INFO_T;
+
+
//defined for QSER_NW_EventRegister
#define NW_IND_VOICE_REG_EVENT_IND_FLAG (1 << 0) /**< msg format : QSER_NW_VOICE_REG_EVENT_IND_T */
@@ -346,6 +377,18 @@
QSER_NW_CONFIG_INFO_T *pt_info
);
+int qser_nw_set_oos_config
+(
+ nw_client_handle_type h_nw,
+ QSER_NW_OOS_CONFIG_INFO_T *pt_info
+);
+
+int qser_nw_get_oos_config
+(
+ nw_client_handle_type h_nw,
+ QSER_NW_OOS_CONFIG_INFO_T *pt_info
+);
+
int qser_nw_event_register
(
nw_client_handle_type h_nw,
diff --git a/cap/zx297520v3/src/lynq/packages/apps/lynq-systime-demo/lynq_systime_demo.cpp b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-systime-demo/files/lynq_systime_demo.cpp
similarity index 100%
rename from cap/zx297520v3/src/lynq/packages/apps/lynq-systime-demo/lynq_systime_demo.cpp
rename to cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-systime-demo/files/lynq_systime_demo.cpp
diff --git a/cap/zx297520v3/src/lynq/packages/apps/lynq-systime-demo/makefile b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-systime-demo/files/makefile
similarity index 95%
rename from cap/zx297520v3/src/lynq/packages/apps/lynq-systime-demo/makefile
rename to cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-systime-demo/files/makefile
index 890f85a..91b38a1 100755
--- a/cap/zx297520v3/src/lynq/packages/apps/lynq-systime-demo/makefile
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-systime-demo/files/makefile
@@ -1,5 +1,5 @@
SHELL = /bin/sh
-RM = rm -f
+RM = rm -rf
LOCAL_CFLAGS := -Wall \
-std=gnu++14 \
@@ -23,7 +23,7 @@
-I. \
-I$(LOCAL_PATH)/include/ \
-I$(ROOT)$(includedir)/ \
- -I$(ROOT)$(includedir)/include/ \
+
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-systime-demo/lynq-systime-demo.bb b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-systime-demo/lynq-systime-demo.bb
index 8649a79..b726e50 100644
--- a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-systime-demo/lynq-systime-demo.bb
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-systime-demo/lynq-systime-demo.bb
@@ -2,19 +2,18 @@
#inherit externalsrc package systemd
DESCRIPTION = "lynq-systime-demo"
LICENSE = "CLOSED"
-LICENSE = "CLOSED"
LIC_FILES_CHKSUM = "file://LICENSE;md5=b1e07e8d88e26263e71d3a9e2aa9a2ff"
DEPENDS += "liblynq-systime"
-#inherit workonsrc
-WORKONSRC = "${TOPDIR}/../src/lynq/packages/apps/lynq-systime-demo"
-FILESEXTRAPATHS_prepend :="${TOPDIR}/../src/lynq/packages/apps:"
-SRC_URI = " \
- file://lynq-systime-demo \
- "
-SRC-DIR = "${S}/../lynq-systime-demo"
+SRC_URI = "file://lynq_systime_demo.cpp \
+ file://makefile \
+ "
+SRC-DIR = "${S}/../"
+
+FILES_${PN} += "${bindir}/"
TARGET_CC_ARCH += "${LDFLAGS}"
SYSTEMD_PACKAGES = "${PN}"
+
#Parameters passed to do_compile()
EXTRA_OEMAKE = "'TARGET_PLATFORM = ${TARGET_PLATFORM}'"
diff --git a/cap/zx297520v3/sources/meta-zxic/conf/pub_esdk.inc b/cap/zx297520v3/sources/meta-zxic/conf/pub_esdk.inc
index b66ac77..8b7ec5a 100755
--- a/cap/zx297520v3/sources/meta-zxic/conf/pub_esdk.inc
+++ b/cap/zx297520v3/sources/meta-zxic/conf/pub_esdk.inc
@@ -7,6 +7,7 @@
ZXIC_ZX297520V3_CFLAGS += "-I${BSPDIR}/pub/project/zx297520v3/include/drv "
ZXIC_ZX297520V3_CFLAGS += "-I${BSPDIR}/pub/project/zx297520v3/include/nv "
ZXIC_ZX297520V3_CFLAGS += "-D_CHIP_ZX297520V3 -DCPU_SHIFT=0 -D_USE_VEHICLE_DC -D_USE_ZXIC_DEBUG_INFO"
+ZXIC_ZX297520V3_CFLAGS += "${@bb.utils.contains('DISTRO_FEATURES', 'vehicle_dc_ref', '-D_USE_VEHICLE_DC_REF', '', d)}"
ZXIC_EXTRA_CFLAGS += "${@bb.utils.contains('MACHINE', 'zx297520v3', '${ZXIC_ZX297520V3_CFLAGS}', '', d)}"
diff --git a/cap/zx297520v3/sources/meta-zxic/recipes-app/sntp/sntp.bb b/cap/zx297520v3/sources/meta-zxic/recipes-app/sntp/sntp.bb
index 2b9fe3c..21f207e 100755
--- a/cap/zx297520v3/sources/meta-zxic/recipes-app/sntp/sntp.bb
+++ b/cap/zx297520v3/sources/meta-zxic/recipes-app/sntp/sntp.bb
@@ -49,7 +49,7 @@
if ${@bb.utils.contains('DISTRO_FEATURES','sysvinit','true','false',d)}; then
install -Dm 0755 ${WORKDIR}/sntp.sysvinit ${D}${sysconfdir}/init.d/sntp
install -d ${D}${sysconfdir}/rcS.d
- ln -s ../init.d/sntp ${D}${sysconfdir}/rcS.d/S22sntp
+ #ln -s ../init.d/sntp ${D}${sysconfdir}/rcS.d/S22sntp
fi
#install elfs
@@ -72,4 +72,4 @@
SYSTEMD_SERVICE_${PN} = "sntp.service"
SYSTEMD_AUTO_ENABLE_${PN} = "enable"
-RDEPENDS_${PN} = " libnvram libsoftap libsofttimer"
\ No newline at end of file
+RDEPENDS_${PN} = " libnvram libsoftap libsofttimer"
diff --git a/cap/zx297520v3/sources/meta-zxic/recipes-kernel/linux/files/zx297520v3/linux-5_10-vehicle_dc_ref-normal-defconfig b/cap/zx297520v3/sources/meta-zxic/recipes-kernel/linux/files/zx297520v3/linux-5_10-vehicle_dc_ref-normal-defconfig
index b4b886e..6c84688 100755
--- a/cap/zx297520v3/sources/meta-zxic/recipes-kernel/linux/files/zx297520v3/linux-5_10-vehicle_dc_ref-normal-defconfig
+++ b/cap/zx297520v3/sources/meta-zxic/recipes-kernel/linux/files/zx297520v3/linux-5_10-vehicle_dc_ref-normal-defconfig
@@ -1975,24 +1975,22 @@
# CONFIG_SND_SOC_ZX29_TI3100 is not set
#dongyu@modify for codec start
# CONFIG_SND_SOC_ZX29_NAU8810 is not set
-# CONFIG_SND_SOC_ZX29_TI3104 is not set
+CONFIG_SND_SOC_ZX29_TI3104=y
# CONFIG_SND_SOC_ZX29_ES8374 is not set
# CONFIG_SND_SOC_ZX29_ES8312 is not set
# CONFIG_SND_SOC_ZX29_AK4940 is not set
# CONFIG_SND_SOC_ZX29_MAX9867 is not set
# CONFIG_SND_SOC_ZX29_ES8311 is not set
-CONFIG_SND_SOC_ZX29_ES8311=y
CONFIG_SND_SOC_ZX_VOICE=y
CONFIG_SND_SOC_ZX297520V3=y
CONFIG_SND_SOC_ZX_I2S=y
CONFIG_SND_SOC_ZX_PCM=y
# CONFIG_SND_SOC_ZX_TDM is not set
# CONFIG_SND_SOC_TLV320AIC31XX is not set
-CONFIG_SND_SOC_NAU8810=y
-# CONFIG_SND_SOC_TLV320AIC3X is not set
+# CONFIG_SND_SOC_NAU8810 is not set
+CONFIG_SND_SOC_TLV320AIC3X=y
# CONFIG_SND_SOC_MAX9867 is not set
# CONFIG_SND_SOC_ES8311 is not set
-CONFIG_SND_SOC_ES8311=y
#dongyu@modify for codec end
CONFIG_SND_EXTRA_CTRL=y
CONFIG_USE_TOP_I2S0=y
diff --git a/cap/zx297520v3/src/lynq/framework/lynq-led-sev/lynq-led-sev.sh b/cap/zx297520v3/src/lynq/framework/lynq-led-sev/lynq-led-sev.sh
new file mode 100755
index 0000000..a5f0230
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/framework/lynq-led-sev/lynq-led-sev.sh
@@ -0,0 +1,39 @@
+#!/bin/sh
+#
+# Run the daemon
+#
+
+DAEMON="lynq-led-sev"
+PIDFILE="/var/run/$DAEMON.pid"
+EXEC="/usr/bin/lynq-led-sev"
+EXEC_ARGS=""
+
+
+start() {
+ echo -n "Starting $DAEMON... "
+ start-stop-daemon --no-close -S -b -m -p $PIDFILE -x $EXEC -- $EXEC_ARGS
+ [ $? -eq 0 ] && echo "OK" || echo "ERROR"
+}
+
+stop() {
+ echo -n "Stopping $DAEMON... "
+ start-stop-daemon -K -p $PIDFILE
+ [ $? -eq 0 ] && echo "OK" || echo "ERROR"
+}
+
+restart() {
+ stop
+ start
+}
+
+case "$1" in
+ start|stop|restart)
+ "$1"
+ ;;
+ *)
+ echo "Usage: $0 {start|stop|restart}"
+ exit 1
+esac
+
+exit $?
+
diff --git a/cap/zx297520v3/src/lynq/framework/lynq-led-sev/lynq_led_sev.c b/cap/zx297520v3/src/lynq/framework/lynq-led-sev/lynq_led_sev.c
new file mode 100755
index 0000000..6f6f916
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/framework/lynq-led-sev/lynq_led_sev.c
@@ -0,0 +1,32 @@
+#include <stdio.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <strings.h>
+#include<stdlib.h>
+#include <include/lynq_uci.h>
+
+
+#define BUF_LEN 8
+#define GPIO_LED 100
+#define LYNQ_UCI_SECTION "lynq_led"
+#define LYNQ_UCI_KEY "lynq_statusled_on"
+
+
+int main(int argc, const char *argv[])
+{
+ char led_enable[BUF_LEN] = "";
+ char com_val[GPIO_LED] = "";
+
+ system("/usr/bin/lynq-default");
+ lynq_get_value(LYNQ_UCI_FILE, LYNQ_UCI_SECTION, LYNQ_UCI_KEY, led_enable);
+ if(atoi(led_enable))
+ {
+ sprintf(com_val, "echo %d > /sys/class/gpio/gpio127/value",led_enable);
+ system("echo 127 > /sys/class/gpio/export");
+ system("echo out > /sys/class/gpio/gpio127/direction");//92 net_Status,127 status
+ system(com_val);
+ }
+
+ return 0;
+}
diff --git a/cap/zx297520v3/src/lynq/framework/lynq-led-sev/lynq_led_sev.service b/cap/zx297520v3/src/lynq/framework/lynq-led-sev/lynq_led_sev.service
new file mode 100755
index 0000000..bea06a6
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/framework/lynq-led-sev/lynq_led_sev.service
@@ -0,0 +1,17 @@
+[Unit]
+Description=lynq ril service
+After=mtkfusionrild.service
+Requires=mtkfusionrild.service
+
+[Service]
+StandardOutput=kmsg+console
+Type=simple
+RemainAfterExit=no
+ExecStart=/usr/bin/lynq-led-sev
+Restart=always
+User=root
+Group=root
+
+[Install]
+Alias=rilsvc
+WantedBy=multi-user.target
\ No newline at end of file
diff --git a/cap/zx297520v3/src/lynq/framework/lynq-led-sev/makefile b/cap/zx297520v3/src/lynq/framework/lynq-led-sev/makefile
new file mode 100755
index 0000000..4e83c2b
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/framework/lynq-led-sev/makefile
@@ -0,0 +1,46 @@
+SHELL = /bin/sh
+RM = rm -f
+
+LOCAL_CFLAGS := -Wall \
+ -g -Os \
+ -flto \
+ -fpermissive \
+ -fPIC \
+
+ifeq ($(strip $(TARGET_PLATFORM)), T106)
+LOCAL_CFLAGS += -DBINDER_IPC_32BIT=1 -DHAVE_ENDIAN_H -DHAVE_PTHREADS -DHAVE_SYS_UIO_H -DHAVE_POSIX_FILEMAP -DHAVE_STRLCPY -DHAVE_PRCTL -DHAVE_MEMSET16 -DHAVE_MEMSET32 -DANDROID_SMP=0
+endif
+
+LOCAL_CFLAGS += -DLYNQ_SW_INSIDE_VERSION=\"$(LYNQ_CONFIG_VERSION)\"
+LOCAL_CFLAGS += -DLYNQ_SW_VERSION=\"$(LYNQ_CONFIG_SW_VERSION)\"
+
+LOCAL_PATH = .
+
+LOCAL_C_INCLUDES = \
+ -I. \
+
+
+
+
+
+LOCAL_LIBS := \
+ -L. \
+ -ldl \
+ -llynq-uci \
+
+SOURCES = $(wildcard *.c)
+
+EXECUTABLE = lynq-led-sev
+
+OBJECTS=$(SOURCES:.c=.o)
+all: $(EXECUTABLE)
+
+$(EXECUTABLE): $(OBJECTS)
+ $(CXX) $(OBJECTS) $(LOCAL_LIBS) $(LOCAL_CFLAGS) $(LOCAL_C_INCLUDES) -o $@
+
+%.o : %.c
+ $(CC) $(LOCAL_C_INCLUDES) $(LOCAL_CFLAGS) $(LOCAL_LIBS) -o $@ -c $<
+
+.PHONY: clean
+clean:
+ $(RM) $(OBJECTS) $(EXECUTABLE)
diff --git a/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/common.cpp b/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/common.cpp
index e63b046..36d9e01 100755
--- a/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/common.cpp
+++ b/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/common.cpp
@@ -101,6 +101,10 @@
/*Warren add for SZZT 2021/11/14 end*/
+#define LED_ON 4
+#define LYNQ_UCI_SECTION "lynq_led"
+#define LYNQ_UCI_KEY "lynq_netled_on"
+
/*hq add for key information output start 2022/03/01*/
// extern int lynq_output_LINFO_enable =0;
@@ -576,6 +580,10 @@
RLOGD("[slot%d]updateCardStatusV6: sim card message is null", slot);
}
#ifdef LED_SUPPORT
+ char netled_on[LED_ON] = "";
+ lynq_get_value(LYNQ_UCI_FILE, LYNQ_UCI_SECTION, LYNQ_UCI_KEY, netled_on);
+ if(!atoi(netled_on))
+ return ;
mbtk_netled_state_update(GPIO_NETLED_REFLASH_NORMAL);
#endif
}
@@ -605,6 +613,10 @@
regCodeToServiceState(request, atoi(code), slot);
}
#ifdef LED_SUPPORT
+ char netled_on[LED_ON] = "";
+ lynq_get_value(LYNQ_UCI_FILE, LYNQ_UCI_SECTION, LYNQ_UCI_KEY, netled_on);
+ if(!atoi(netled_on))
+ return ;
mbtk_netled_state_update(GPIO_NETLED_REFLASH_NORMAL);
#endif
}
@@ -627,6 +639,10 @@
/*Warren change for SZZT 2021//11/14 end*/
}
#ifdef LED_SUPPORT
+ char netled_on[LED_ON] = "";
+ lynq_get_value(LYNQ_UCI_FILE, LYNQ_UCI_SECTION, LYNQ_UCI_KEY, netled_on);
+ if(!atoi(netled_on))
+ return ;
mbtk_netled_state_update(GPIO_NETLED_REFLASH_NORMAL);
#endif
}
diff --git a/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/led/led.cpp b/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/led/led.cpp
index a252764..0a10645 100755
--- a/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/led/led.cpp
+++ b/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/led/led.cpp
@@ -24,7 +24,13 @@
*************************************************************/
#define GPIO_NETLED_CONNECT_REFLASH_TIMER 200
#define GPIO_NETLED_CREG_REFLASH_TIMER 800
+#ifndef MOBILETEK_TARGET_PLATFORM_T106
#define MBTK_GPIO_NETLED_N 77
+#else
+#define MBTK_GPIO_LED 100
+#define MBTK_GPIO_NETLED_N 92
+#define MBTK_GPIO_STATUSLED_N 127
+#endif
/*************************************************************
Extern Function Declaration
@@ -495,6 +501,18 @@
void mbtk_gpio_write_output(int gpio_port, int value)
{
+#ifdef MOBILETEK_TARGET_PLATFORM_T106
+ char com_exp[MBTK_GPIO_LED] = "";
+ char com_dir[MBTK_GPIO_LED] = "";
+ char com_val[MBTK_GPIO_LED] = "";
+ sprintf(com_exp, "echo %d > /sys/class/gpio/export", gpio_port);
+ sprintf(com_dir, "echo out > /sys/class/gpio/gpio%d/direction", gpio_port);
+ sprintf(com_val, "echo %d > /sys/class/gpio/gpio%d/value", value, gpio_port);
+
+ system(com_exp);//92 net_Status,127 status
+ system(com_dir);
+ system(com_val);
+#else
if(value==1)
{
system("echo 255 > /sys/class/leds/led9515:green:cellular-radio/brightness");
@@ -503,6 +521,7 @@
{
system("echo 0 > /sys/class/leds/led9515:green:cellular-radio/brightness");
}
+#endif
}
/*=============================================
diff --git a/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/ril.cpp b/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/ril.cpp
index c23afae..76f99b3 100755
--- a/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/ril.cpp
+++ b/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/ril.cpp
@@ -3801,6 +3801,7 @@
s_registerCalled = 1;
sendRequestToMd(RIL_REQUEST_RADIO_POWER, get_default_sim_all_except_data());
+ initCoditions();
pthread_mutex_lock(&s_InitMutex);
if(utils::is_support_dsds()) {
@@ -3813,7 +3814,7 @@
}
}
pthread_mutex_unlock(&s_InitMutex);
- initCoditions();
+ //initCoditions();
// New rild impl calls RIL_startEventLoop() first
// old standalone impl wants it here.
diff --git a/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/stateManager/stateManager.cpp b/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/stateManager/stateManager.cpp
index d4f3ce3..291fea2 100755
--- a/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/stateManager/stateManager.cpp
+++ b/cap/zx297520v3/src/lynq/framework/lynq-ril-service/src/stateManager/stateManager.cpp
@@ -49,10 +49,13 @@
#include <liblog/lynq_deflog.h>
#ifdef LED_SUPPORT
#include "led.h"
+#include <include/lynq_uci.h>
#endif
#undef LOG_TAG
#define LOG_TAG "DEMO_MANAGER"
-
+ #define LED_ON 4
+ #define LYNQ_UCI_SECTION "lynq_led"
+ #define LYNQ_UCI_KEY "lynq_netled_on"
//RIL_REQUEST_DEVICE_IDENTITY
int getDeviceIdentity(int argc, char **argv, RIL_SOCKET_ID socket_id, RequestInfo *pRI)
{
@@ -103,6 +106,10 @@
int screen_state= atoi(argv[1]);
p.writeInt32(screen_state);
#ifdef LED_SUPPORT
+ char netled_on[LED_ON] = "";
+ lynq_get_value(LYNQ_UCI_FILE, LYNQ_UCI_SECTION, LYNQ_UCI_KEY, netled_on);
+ if(!atoi(netled_on))
+ return -1;
mbtk_netled_state_update(screen_state==0 ? GPIO_NETLED_AP_GOINGSLEEP : GPIO_NETLED_AP_WAKEUP);
usleep(wait_led_update_effective_timer_ms*1000);
#endif
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-adc/LICENSE b/cap/zx297520v3/src/lynq/lib/liblynq-adc/LICENSE
new file mode 100644
index 0000000..cb88533
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-adc/LICENSE
@@ -0,0 +1,31 @@
+Copyright Statement:
+
+This software/firmware and related documentation ("Mobiletek Software") are
+protected under relevant copyright laws. The information contained herein is
+confidential and proprietary to Mobiletek Inc. and/or its licensors. Without
+the prior written permission of Mobiletek inc. and/or its licensors, any
+reproduction, modification, use or disclosure of Mobiletek Software, and
+information contained herein, in whole or in part, shall be strictly
+prohibited.
+
+Mobiletek Inc. (C) 2015. All rights reserved.
+
+BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
+THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("Mobiletek SOFTWARE")
+RECEIVED FROM Mobiletek AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER
+ON AN "AS-IS" BASIS ONLY. Mobiletek EXPRESSLY DISCLAIMS ANY AND ALL
+WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
+WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
+NONINFRINGEMENT. NEITHER DOES Mobiletek PROVIDE ANY WARRANTY WHATSOEVER WITH
+RESPECT TO THE SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY,
+INCORPORATED IN, OR SUPPLIED WITH THE Mobiletek SOFTWARE, AND RECEIVER AGREES
+TO LOOK ONLY TO SUCH THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO.
+RECEIVER EXPRESSLY ACKNOWLEDGES THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO
+OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES CONTAINED IN Mobiletek
+SOFTWARE. Mobiletek SHALL ALSO NOT BE RESPONSIBLE FOR ANY Mobiletek SOFTWARE
+RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
+STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND Mobiletek'S
+ENTIRE AND CUMULATIVE LIABILITY WITH RESPECT TO THE Mobiletek SOFTWARE
+RELEASED HEREUNDER WILL BE, AT Mobiletek'S OPTION, TO REVISE OR REPLACE THE
+Mobiletek SOFTWARE AT ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE
+CHARGE PAID BY RECEIVER TO Mobiletek FOR SUCH Mobiletek SOFTWARE AT ISSUE.
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-adc/include/lynq-adc.h b/cap/zx297520v3/src/lynq/lib/liblynq-adc/include/lynq-adc.h
new file mode 100644
index 0000000..95f55be
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-adc/include/lynq-adc.h
@@ -0,0 +1,23 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sc_bsp.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef enum ADC_CHANNEL_ENUM
+{
+ QADC_NONE = 0,
+ ADC0 =1,
+ ADC1 =2,
+ ADC2 =3,
+ QADC_END
+}ADC_CHANNEL_E;
+
+int qser_adc_show(ADC_CHANNEL_E qadc);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-adc/lynq-adc.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-adc/lynq-adc.cpp
new file mode 100755
index 0000000..b392fca
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-adc/lynq-adc.cpp
@@ -0,0 +1,88 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sc_bsp.h>
+#include <errno.h>
+#include "lynq-adc.h"
+#include "liblog/lynq_deflog.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define ADC0_NODES "/sys/kernel/debug/pmu_zx29/adc0"
+#define ADC1_NODES "/sys/kernel/debug/pmu_zx29/adc1"
+#define ADC2_NODES "/sys/kernel/debug/pmu_zx29/adc2"
+
+/********************************************************************
+* @brief: qser_adc_show, function to read ADC value from specific channel
+* @param qadc [IN]: ADC_CHANNEL_E, the ADC channel to read from
+* @return : int, the read ADC value, or error code if failed
+* @todo: NA
+* @see: NA
+* @warning: NA
+*********************************************************************/
+int qser_adc_show(ADC_CHANNEL_E qadc)
+{
+ int adc_value;
+ char cmd[1024];
+ char cmd_ret[1024];
+ FILE *fp;
+ switch(qadc)
+ {
+ case QADC_NONE:
+ {
+ LYERRLOG("function %s line %d\n", __FUNCTION__, __LINE__);
+ return 0;
+ }
+ case ADC0:
+ {
+ LYDBGLOG("function %s line %d\n", __FUNCTION__, __LINE__);
+ sprintf(cmd, "cat %s", ADC0_NODES);
+ break;
+ }
+ case ADC1:
+ {
+ LYDBGLOG("function %s line %d\n", __FUNCTION__, __LINE__);
+ sprintf(cmd, "cat %s", ADC1_NODES);
+ break;
+ }
+ case ADC2:
+ {
+ LYDBGLOG("function %s line %d\n", __FUNCTION__, __LINE__);
+ sprintf(cmd, "cat %s", ADC2_NODES);
+ break;
+ }
+ default:
+ {
+ LYERRLOG("input error\n");
+ return -1;
+ }
+ }
+ if((fp = popen(cmd,"r")) == NULL)
+ {
+ LYERRLOG("popen error: %s", strerror(errno));
+ return -1;
+ }
+ if((fread(cmd_ret,sizeof(cmd_ret),1,fp))<0)
+ {
+ LYERRLOG("fread fail: %s", strerror(errno));
+ fclose(fp);
+ return -1;
+ }
+ fclose(fp);
+ adc_value = atoi(cmd_ret);
+ if (adc_value < 0 || adc_value > 12000)
+ {
+ LYERRLOG("bad adc value %s!", cmd_ret);
+ return -1;
+ }
+ return adc_value;
+}
+
+DEFINE_LYNQ_LIB_LOG(LYNQ_ADC)
+
+#ifdef __cplusplus
+}
+#endif
+
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-adc/makefile b/cap/zx297520v3/src/lynq/lib/liblynq-adc/makefile
new file mode 100644
index 0000000..d8447e6
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-adc/makefile
@@ -0,0 +1,61 @@
+SHELL = /bin/sh
+RM = rm -rf
+
+LOCAL_CFLAGS := -Wall \
+ -std=gnu++14 \
+ -g -Os \
+ -flto \
+ -fPIC \
+ -fpermissive \
+
+$(warning ################# lynq qser autosuspend API ROOT: $(ROOT),includedir:$(includedir))
+LOCAL_PATH = .
+
+LOCAL_C_INCLUDES = \
+ -I. \
+ -I$(LOCAL_PATH)/include/ \
+ -I$(LOCAL_PATH)/ \
+ -I$(ROOT)$(includedir)/logger \
+ -I$(ROOT)$(includedir)/liblog \
+
+LOCAL_LIBS := \
+ -L. \
+ -lstdc++ \
+ -lcutils \
+ -lutils \
+ -llynq-log \
+ -lbsp \
+
+
+SOURCES = $(wildcard *.cpp)
+
+EXECUTABLE = liblynq-adc.so
+
+OBJECTS=$(SOURCES:.cpp=.o)
+
+
+.PHONY: build clean install pack_rootfs
+all: build
+$(EXECUTABLE): $(OBJECTS)
+ $(CXX) -shared -Wl,--no-undefined $(OBJECTS) $(LOCAL_LIBS) $(LOCAL_CFLAGS) $(LOCAL_C_INCLUDES) -o $@
+
+%.o : %.cpp
+ $(CXX) $(LOCAL_C_INCLUDES) $(LOCAL_CFLAGS) $(LOCAL_LIBS) -o $@ -c $<
+
+build: $(EXECUTABLE)
+ $(warning ########## build $(EXECUTABLE) ##########)
+install:
+ mkdir -p $(ROOT)$(base_libdir)/
+ install $(EXECUTABLE) $(ROOT)$(base_libdir)/
+ mkdir -p $(ROOT)$(includedir)/$(NAME)/sdk
+pack_rootfs:
+ mkdir -p $(PACK_INITRAMFS_TO)$(base_libdir)/
+ cp -af $(EXECUTABLE) $(PACK_INITRAMFS_TO)$(base_libdir)/
+ $(CROSS)strip $(PACK_INITRAMFS_TO)$(base_libdir)/$(EXECUTABLE)
+ mkdir -p $(PACK_TO)$(base_libdir)/
+ cp -af $(EXECUTABLE) $(PACK_TO)$(base_libdir)/
+ $(CROSS)strip $(PACK_TO)$(base_libdir)/$(EXECUTABLE)
+.PHONY: clean
+clean:
+ $(RM) $(OBJECTS) $(EXECUTABLE)
+ -find . -name "*.o" -delete
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-at-common/liblynq-at-common.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-at-common/liblynq-at-common.cpp
index cacdf2d..ccb8eaa 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-at-common/liblynq-at-common.cpp
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-at-common/liblynq-at-common.cpp
@@ -24,21 +24,21 @@
void lynq_response_ok()
{
- char *str = "OK\n";
+ char *str = "OK\r\n";
handle_output(str, strlen(str), Response);
}
void lynq_response_error(int error_code)
{
char str[32] = {0};
- sprintf(str, "+CME ERROR: %d\n", error_code);
+ sprintf(str, "+CME ERROR: %d\r\n", error_code);
handle_output(str, strlen(str), Response);
}
void lynq_handle_version()
{
char buf[64] = {0};
- sprintf(buf,"%s\n",LYNQ_SW_INSIDE_VERSION);
+ sprintf(buf,"+CGIR:%s\r\n",LYNQ_SW_INSIDE_VERSION);
handle_output(buf, strlen(buf), Response);
lynq_response_ok();
return;
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-at-factory/gpio_T106.conf b/cap/zx297520v3/src/lynq/lib/liblynq-at-factory/gpio_T106.conf
index 5133ad0..28dfd24 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-at-factory/gpio_T106.conf
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-at-factory/gpio_T106.conf
@@ -1,4 +1,4 @@
platform:T106
total:49
-gpio:16,17,18,20,25,26,27,28,29,30,31,32,35,36,37,38,39,40,41,42,45,46,48,52,53,54,64,72,73,74,75,76,77,84,87,88,89,90,91,92,119,120,121,122,123,124,127,128,129,130,131,132,
+gpio:16,17,18,25,26,27,28,29,30,31,32,35,36,37,38,39,40,41,42,45,46,48,52,53,54,66,67,68,69,70,71,84,87,88,89,90,91,92,119,120,121,122,123,124,127,128,129,130,131,132,
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-at-factory/liblynq-at-factory.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-at-factory/liblynq-at-factory.cpp
index b82cb42..ed8ca40 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-at-factory/liblynq-at-factory.cpp
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-at-factory/liblynq-at-factory.cpp
@@ -42,14 +42,14 @@
void lynq_response_ok()
{
- char *str = "OK\n";
+ char *str = "OK\r\n";
handle_output(str, strlen(str), Response);
}
void lynq_response_error(int error_code)
{
char str[32] = {0};
- sprintf(str, "+CME ERROR: %d\n", error_code);
+ sprintf(str, "+CME ERROR: %d\r\n", error_code);
handle_output(str, strlen(str), Response);
}
@@ -92,7 +92,7 @@
fp=popen(lynq_adc_dev, "r");
fgets(lynq_adc_buf,sizeof(lynq_adc_buf),fp);
- sprintf(flag,"%s %s", "ADC:", lynq_adc_buf);
+ sprintf(flag,"%s %s\r\n", "+ADC:", lynq_adc_buf);
if(handle_output != NULL)
{
handle_output(flag, strlen(flag), Response);
@@ -159,7 +159,7 @@
}
else
{
- handle_output("input error\r\n", strlen("input error\r\n"), Response);
+ handle_output("+GPIO:input error\r\n", strlen("input error\r\n"), Response);
return -1;
}
}
@@ -175,13 +175,13 @@
if(k >= total_length)
{
bzero(res,64);
- sprintf(res,"GPIO%d input error\r\n",num);
+ sprintf(res,"+GPIO:GPIO%d input error\r\n",num);
handle_output(res, strlen(res), Response);
}
}
if (lynq_gpio_arr == NULL)
{
- handle_output("input all gpio not exist\r\n", strlen("input all gpio not exist\r\n"), Response);
+ handle_output("+GPIO:input all gpio not exist\r\n", strlen("input all gpio not exist\r\n"), Response);
return -1;
}
return size;
@@ -249,21 +249,8 @@
{
int ret;
int value;
- if(test_gpio_handle[50] != NULL)
- {
- ret = sc_gpio_uninit(test_gpio_handle[50]);
- if(ret)
- {
- ALOGE("uninit 50 fail\n");
- return -1;
- }
- }
- test_gpio_handle[50] = sc_gpio_init(50, 0, 0, 0);
- if(test_gpio_handle[50] == NULL)
- {
- ALOGE("init 50 fail\n");
- return -1;
- }
+
+
for(int m = 0; m < total_length; m++)
{
if(test_gpio_handle[lynq_gpio_arr[m]] != NULL)
@@ -285,6 +272,7 @@
ret = sc_gpio_value_get(test_gpio_handle[50], &value);
if(ret)
{
+ ALOGE("RET = %d, value = %d\n",ret,value);
return -1;
}
if(value != status)
@@ -297,13 +285,17 @@
int all_gpio_uninit(int total_length, int lynq_gpio_total_arr[256])
{
int ret;
- ret = sc_gpio_uninit(test_gpio_handle[50]);
- if(ret)
+ if(test_gpio_handle[50] != NULL)
{
- return -1;
- ALOGE("uninit 50 fail\n");
+ ret = sc_gpio_uninit(test_gpio_handle[50]);
+ if(ret)
+ {
+ ALOGE("uninit 50 fail\n");
+ return -1;
+ }
+ test_gpio_handle[50] = NULL;
}
- test_gpio_handle[50] = NULL;
+
for(int m = 0; m < total_length; m++)
{
ret = sc_gpio_uninit(test_gpio_handle[lynq_gpio_total_arr[m]]);
@@ -338,6 +330,12 @@
ALOGE("Don't have this platform gpio configure\n");
return;
}
+ test_gpio_handle[50] = sc_gpio_init(50, 0, 0, 0);
+ ALOGE("50 youm:%p\n",test_gpio_handle[50]);
+ if(test_gpio_handle[50] == NULL)
+ {
+ ALOGE("uninit 50 fail\n");
+ }
ALOGD("start function %s line %d input %s\n", __FUNCTION__, __LINE__, input);
input = input + strlen("gpio");
if((valid_length = lynq_gpio_analysis(input, lynq_gpio_arr, lynq_gpio_total_arr, total_length)) < 0)
@@ -346,7 +344,7 @@
return;
}
ALOGE("The Valid count:%d\n",valid_length);
- for(i=0; i < sizeof(lynq_gpio_arr)/sizeof(int); i++)
+ for(i=0; i < valid_length; i++)
{
for(j=0;j<3;j++)
{
@@ -357,7 +355,7 @@
if (need_int == 1)
{
- ret = set_all_gpio_status_and_check(lynq_gpio_total_arr, 0, total_length);
+ ret = set_all_gpio_status_and_check(lynq_gpio_arr, 0, valid_length);
if (ret == 1)
{
ALOGE("can't pull up or pull down gpio-50\n");
@@ -374,7 +372,7 @@
lynq_response_error(100);
return;
}
- ALOGD("finsh configure function %s line %d input %s\n", __FUNCTION__, __LINE__, input);
+ ALOGD("finsh configure function\n");
}
lynq_gpio_low = 0;
@@ -382,25 +380,26 @@
for(int n=0;n<3;n++)
{
- ret = sc_gpio_value_set(test_gpio_handle[lynq_gpio_arr[1]], 1);
+ ret = sc_gpio_value_set(test_gpio_handle[lynq_gpio_arr[i]], 1);
+ usleep(10000);
ret = sc_gpio_value_get(test_gpio_handle[50], &value);
if(ret)
{
- ALOGD("sc_gpio_value_get");
+ ALOGE("sc_gpio_value_get\n");
}
if(value == 1)
{
- ALOGD("high function %s line %d input %s\n", __FUNCTION__, __LINE__, input);
+ ALOGE("high function is OK,input %d\n",lynq_gpio_arr[i]);
lynq_gpio_high = 1;
lynq_gpio_test_env_error = 0;
break;
}
else
{
- ALOGD("high function %s line %d input %s num %d\n", __FUNCTION__, __LINE__, input,lynq_gpio_arr[i]);
+ ALOGE("high function is Fail, input %d\n",lynq_gpio_arr[i]);
if(i == 0 && j == 0)
{
- lynq_gpio_test_env_error = set_all_gpio_status_and_check(lynq_gpio_total_arr, 1, total_length) == 0 ? 0 : 1;
+ lynq_gpio_test_env_error = set_all_gpio_status_and_check(lynq_gpio_arr, 1, valid_length) == 0 ? 0 : 1;
}
}
}
@@ -409,8 +408,9 @@
ret = sc_gpio_value_set(test_gpio_handle[lynq_gpio_arr[i]], 0);
if(ret)
{
- ALOGD("sc_gpio_value_set gpio%d fail\n",lynq_gpio_arr[i]);
+ ALOGE("sc_gpio_value_set gpio%d fail\n",lynq_gpio_arr[i]);
}
+ usleep(10000);
ret = sc_gpio_value_get(test_gpio_handle[50], &value);
if(ret)
{
@@ -418,22 +418,22 @@
}
if(value == 0)
{
- ALOGD("*low function %s line %d input %s\n", __FUNCTION__, __LINE__, input);
+ ALOGE("low function is OK,input %d\n",lynq_gpio_arr[i]);
lynq_gpio_low = 1;
}
else
{
- ALOGE("low function fail %s line %d input %s num %d\n", __FUNCTION__, __LINE__, input,lynq_gpio_arr[i]);
+ ALOGE("low function is fail,input %d\n",lynq_gpio_arr[i]);
}
bzero(lynq_show_gpio_state, 64);
if((lynq_gpio_low != 1) || (lynq_gpio_high != 1))
{
- ALOGE("fail function %s line %d input %s\n", __FUNCTION__, __LINE__, input);
+ ALOGE("total fail function,input %d\n",lynq_gpio_arr[i]);
}
else
{
- ALOGD("success function %s line %d input %s\n", __FUNCTION__, __LINE__, input);
- sprintf(lynq_show_gpio_state,"gpio%d\n",lynq_gpio_arr[i]);
+ ALOGE("success function,input:%d\n",lynq_gpio_arr[i]);
+ sprintf(lynq_show_gpio_state,"+GPIO:%d\r\n",lynq_gpio_arr[i]);
handle_output(lynq_show_gpio_state, strlen(lynq_show_gpio_state), Response);
break; // do not retry when pass
}
@@ -446,7 +446,7 @@
if (j >= 3 )
{
lynq_gpio_beta_state = 0;
- sprintf(lynq_show_gpio_state,"[gpio%d][result]:FAIL \n",lynq_gpio_arr[i]);
+ sprintf(lynq_show_gpio_state,"+GPIO:%d FAIL\r\n",lynq_gpio_arr[i]);
handle_output(lynq_show_gpio_state, strlen(lynq_show_gpio_state), Response);
}
} // for(i=0; i < sizeof(lynq_gpio_arr)/sizeof(lynq_gpio_arr[0]); i++)
@@ -454,17 +454,17 @@
if(lynq_gpio_test_env_error == 1)
{
ALOGE("tool error\n");
- handle_output("tool error\n", strlen("tool error\n"), Response);
+ handle_output("+GPIO:tool error\r\n", strlen("+GPIO:tool error\r\n"), Response);
}
if(lynq_gpio_beta_state == 1)
{
- ALOGD("total success function %s line %d input %s\n", __FUNCTION__, __LINE__, input);
+ ALOGD("total success function\n");
lynq_response_ok();
}
else
{
- ALOGE("total fail function %s line %d input %s\n", __FUNCTION__, __LINE__, input);
+ ALOGE("total fail function\n");
lynq_response_error(100);
}
ret = all_gpio_uninit(total_length, lynq_gpio_total_arr);
@@ -546,7 +546,7 @@
}
}
- handle_output("can't receive correct data", strlen("can't receive correct data"), Response);
+ handle_output("+RMII:can't receive correct data\r\n", strlen("+RMII:can't receive correct data\r\n"), Response);
return -1;
}
@@ -558,14 +558,14 @@
sprintf(lynq_set_rgmii_arr,"echo 1,0x03,0x8800,0xc834 > /sys/devices/platform/soc/1307000.gmac/mdio_test");
if(system(lynq_set_rgmii_arr))
{
- handle_output("Please checkout network_line", strlen("Please checkout network_line"), Response);
+ handle_output("+RMII:Please checkout network_line\r\n", strlen("+RMII:Please checkout network_line\r\n"), Response);
return -1;
}
bzero(lynq_set_rgmii_arr, 128);
sprintf(lynq_set_rgmii_arr,"echo 1,0x01,0x0,0xa000 > /sys/devices/platform/soc/1307000.gmac/mdio_test");
if(system(lynq_set_rgmii_arr))
{
- handle_output("Please checkout network_line", strlen("Please checkout network_line"), Response);
+ handle_output("+RMII:Please checkout network_line\r\n", strlen("+RMII:Please checkout network_line\r\n"), Response);
return -1;
}
@@ -627,7 +627,6 @@
int raw_socket = -1;
char buf_init[1024];
char buf_recv[1472];
- char flag[256]={0};
struct sockaddr_in ser_addr;
struct sockaddr_in cli_addr;
struct sockaddr_ll raw_addr;
@@ -653,7 +652,7 @@
socketfd = rgmii_socket_init(&ser_addr,ser_ip);
if(socketfd < 0)
{
- handle_output("init_failed", strlen("init_failed"), Response);
+ ALOGE("init_failed\n");
lynq_response_error(2);
return;
}
@@ -661,7 +660,7 @@
raw_socket = socket(AF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
if(raw_socket < 0)
{
- handle_output("raw_socket init_failed", strlen("raw_socket init_failed"), Response);
+ ALOGE("raw_socket init_failed\n");
lynq_response_error(2);
return;
}
@@ -673,7 +672,7 @@
ret = bind(raw_socket, (struct sockaddr*)&raw_addr, sizeof(raw_addr));//bind network interface card
if(ret < 0)
{
- handle_output("bind raw_socket init_failed", strlen("bind raw_socket init_failed"), Response);
+ ALOGE("bind raw_socket init_failed\n");
lynq_response_error(3);
return;
}
@@ -726,8 +725,7 @@
}
else
{
- sprintf(flag,"sent %d, success %d\n", check_count, check_ok_count);
- handle_output(flag, strlen(flag), Response);
+ ALOGE("sent %d, success %d\r\n", check_count, check_ok_count);
lynq_response_error(100);
}
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-led/LICENSE b/cap/zx297520v3/src/lynq/lib/liblynq-led/LICENSE
new file mode 100755
index 0000000..605b7ea
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-led/LICENSE
@@ -0,0 +1,31 @@
+Copyright Statement:
+
+This software/firmware and related documentation ("MobileTek Software") are
+protected under relevant copyright laws. The information contained herein is
+confidential and proprietary to MobileTek Inc. and/or its licensors. Without
+the prior written permission of MobileTek inc. and/or its licensors, any
+reproduction, modification, use or disclosure of MobileTek Software, and
+information contained herein, in whole or in part, shall be strictly
+prohibited.
+
+MobileTek Inc. (C) 2015. All rights reserved.
+
+BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
+THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MobileTek SOFTWARE")
+RECEIVED FROM MobileTek AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER
+ON AN "AS-IS" BASIS ONLY. MobileTek EXPRESSLY DISCLAIMS ANY AND ALL
+WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
+WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
+NONINFRINGEMENT. NEITHER DOES MobileTek PROVIDE ANY WARRANTY WHATSOEVER WITH
+RESPECT TO THE SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY,
+INCORPORATED IN, OR SUPPLIED WITH THE MobileTek SOFTWARE, AND RECEIVER AGREES
+TO LOOK ONLY TO SUCH THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO.
+RECEIVER EXPRESSLY ACKNOWLEDGES THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO
+OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES CONTAINED IN MobileTek
+SOFTWARE. MobileTek SHALL ALSO NOT BE RESPONSIBLE FOR ANY MobileTek SOFTWARE
+RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
+STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MobileTek'S
+ENTIRE AND CUMULATIVE LIABILITY WITH RESPECT TO THE MobileTek SOFTWARE
+RELEASED HEREUNDER WILL BE, AT MobileTek'S OPTION, TO REVISE OR REPLACE THE
+MobileTek SOFTWARE AT ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE
+CHARGE PAID BY RECEIVER TO MobileTek FOR SUCH MobileTek SOFTWARE AT ISSUE.
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-led/include/libled/lynq_led.h b/cap/zx297520v3/src/lynq/lib/liblynq-led/include/libled/lynq_led.h
new file mode 100755
index 0000000..c95282b
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-led/include/libled/lynq_led.h
@@ -0,0 +1,12 @@
+#ifndef LYNQ_LED_H
+#define LYNQ_LED_H 1
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int lynq_set_netled_on(const int test_mode);
+int lynq_set_statusled_on(const int test_mode);
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-led/lynq_led.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-led/lynq_led.cpp
new file mode 100755
index 0000000..66ff18d
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-led/lynq_led.cpp
@@ -0,0 +1,32 @@
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <log/log.h>
+#include "liblog/lynq_deflog.h"
+#include <include/lynq_uci.h>
+#include "lynq_led.h"
+
+#define BUF_LEN 258
+#define LYNQ_UCI_SECTION "lynq_led"
+#define LYNQ_UCI_KEY "lynq_statusled_on"
+#define LYNQ_UCI_STATUSLED_KEY "lynq_netled_on"
+
+int lynq_set_netled_on(int led_mode)
+{
+ char buf_netled[BUF_LEN] = "";
+
+ sprintf(buf_netled,"%s.%s.%s=%d", LYNQ_UCI_FILE, LYNQ_UCI_SECTION, LYNQ_UCI_STATUSLED_KEY, led_mode);
+ lynq_uci_set(buf_netled);
+
+ return 0;
+}
+
+int lynq_set_statusled_on(int led_mode)
+{
+ char buf_statusled[BUF_LEN] = "";
+
+ sprintf(buf_statusled,"%s.%s.%s=%d", LYNQ_UCI_FILE, LYNQ_UCI_SECTION, LYNQ_UCI_KEY, led_mode);
+ lynq_uci_set(buf_statusled);
+
+ return 0;
+}
\ No newline at end of file
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-led/makefile b/cap/zx297520v3/src/lynq/lib/liblynq-led/makefile
new file mode 100755
index 0000000..d670bd5
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-led/makefile
@@ -0,0 +1,76 @@
+SHELL = /bin/sh
+RM = rm -f
+
+LOCAL_CFLAGS := -Wall \
+ -std=c++11 \
+ -g -Os \
+ -flto \
+ -DRIL_SHLIB \
+ -DATCI_PARSE \
+ -fPIC \
+ -DKEEP_ALIVE \
+ -DECALL_SUPPORT \
+ -fpermissive \
+
+
+ifeq ($(strip $(TARGET_PLATFORM)), T106)
+LOCAL_CFLAGS += -DBINDER_IPC_32BIT=1 -DHAVE_ENDIAN_H -DHAVE_PTHREADS -DHAVE_SYS_UIO_H -DHAVE_POSIX_FILEMAP -DHAVE_STRLCPY -DHAVE_PRCTL -DHAVE_MEMSET16 -DHAVE_MEMSET32 -DANDROID_SMP=0
+endif
+
+$(warning ################# lynq data demo ROOT: $(ROOT),includedir:$(includedir))
+LOCAL_PATH = .
+
+LOCAL_C_INCLUDES = \
+ -I. \
+ -I$(LOCAL_PATH)/include/libled \
+ -I$(ROOT)$(includedir)/logger \
+ -I$(ROOT)$(includedir)/liblog \
+ -I$(ROOT)$(includedir)/vendor-ril \
+ -I$(ROOT)$(includedir)/lynq_shm \
+
+
+LOCAL_LIBS := \
+ -L. \
+ -ldl \
+ -lstdc++ \
+ -llog \
+ -lcutils \
+ -lutils \
+ -lbinder \
+ -lpthread \
+ -llynq-log \
+ -llynq-shm \
+ -llynq-uci \
+
+SOURCES = $(wildcard *.cpp)
+
+EXECUTABLE = liblynq-led.so
+
+OBJECTS=$(SOURCES:.cpp=.o)
+
+
+.PHONY: build clean install pack_rootfs
+all: build
+$(EXECUTABLE): $(OBJECTS)
+ $(CXX) -shared -Wl,--no-undefined $(OBJECTS) $(LOCAL_LIBS) $(LOCAL_CFLAGS) $(LOCAL_C_INCLUDES) -o $@
+
+%.o : %.cpp
+ $(CXX) $(LOCAL_C_INCLUDES) $(LOCAL_CFLAGS) $(LOCAL_LIBS) -o $@ -c $<
+
+build: $(EXECUTABLE)
+ $(warning ########## build $(EXECUTABLE) ##########)
+install:
+ mkdir -p $(ROOT)$(base_libdir)/
+ install $(EXECUTABLE) $(ROOT)$(base_libdir)/
+ mkdir -p $(ROOT)$(includedir)/$(NAME)/sdk
+pack_rootfs:
+ mkdir -p $(PACK_INITRAMFS_TO)$(base_libdir)/
+ cp -af $(EXECUTABLE) $(PACK_INITRAMFS_TO)$(base_libdir)/
+ $(CROSS)strip $(PACK_INITRAMFS_TO)$(base_libdir)/$(EXECUTABLE)
+ mkdir -p $(PACK_TO)$(base_libdir)/
+ cp -af $(EXECUTABLE) $(PACK_TO)$(base_libdir)/
+ $(CROSS)strip $(PACK_TO)$(base_libdir)/$(EXECUTABLE)
+.PHONY: clean
+clean:
+ $(RM) $(OBJECTS) $(EXECUTABLE)
+ -find . -name "*.o" -delete
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-network/include/lynq_network/lynq_network.h b/cap/zx297520v3/src/lynq/lib/liblynq-network/include/lynq_network/lynq_network.h
index 462df68..e878e6b 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-network/include/lynq_network/lynq_network.h
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-network/include/lynq_network/lynq_network.h
@@ -7,6 +7,7 @@
#define CELLINFO_MAX_NUM 10
#define LY_RECOVER_TIMER_INTERVAL 128
#define MAX_CELLINFO_ITEM_NUMBER 32
+#define MAX_OOS_CFG_ITEM_NUMBER 32
/*T800 platform support gsm,wcdma lte,nr */
typedef struct{
int gw_sig_valid; /*1 valid,1 invalid*/
@@ -134,6 +135,10 @@
*/
int lynq_oos_deep_sleep_recover_timer_interval(int recovery_threshold,int fullband_timer,int sniffer_timer,int inactive_mode);
#endif
+#if (defined MOBILETEK_TARGET_PLATFORM_T106) || (defined MODEM_GEN97)
+int lynq_set_oos_net_scan_cfg(int config_list[MAX_OOS_CFG_ITEM_NUMBER], int valid_num);
+int lynq_get_oos_net_scan_cfg(int config_list[MAX_OOS_CFG_ITEM_NUMBER], int* valid_num);
+#endif
void lynq_set_test_mode(const int test_mode);
#ifdef __cplusplus
}
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-network/lynq_network.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-network/lynq_network.cpp
index dc16ae4..6a1b35b 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-network/lynq_network.cpp
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-network/lynq_network.cpp
@@ -25,6 +25,8 @@
/*in CR AUTO00207414, in modem, 23G detach need 10s, 5g ims detach need 5s, so set length to 12s */
#define WAIT_TIME_LENGTH_FOR_SET_PREFFERRED_NETWORK_TYPE (12)
+#define MAX_AT_INT_RSP_NUM 32
+
using ::android::Parcel;
@@ -1240,42 +1242,6 @@
return RESULT_OK;
}
-int lynq_radio_on(const lynq_network_radio_on_type type)
-{
- if(g_module_init_flag != MODULE_RUNNING)
- {
- LYERRLOG("%s module state %d error",__func__,g_module_init_flag);
- return LYNQ_E_CONFLICT;
- }
- if (type != NETWORK_RADIO_ON_TYPE_CFUN_0 && type != NETWORK_RADIO_ON_TYPE_NORMAL_MODE && type!=NETWORK_RADIO_ON_TYPE_FLIGHT_MODE)
- {
- LYERRLOG("%s parameter %d error",__func__,type);
- return LYNQ_E_PARAMETER_ANONALY;
- }
-
- Parcel* p=NULL;
- int ret;
-
- if(type==NETWORK_RADIO_ON_TYPE_CFUN_0)
- {
- ret=lynq_send_common_request(p,g_wait_time,RIL_REQUEST_OEM_HOOK_RAW,1,"%s","AT+CFUN=0");
- }
- else
- {
- ret=lynq_send_common_request(p,65,RIL_REQUEST_RADIO_POWER,1,"%d",(type==NETWORK_RADIO_ON_TYPE_NORMAL_MODE));
- }
-
- if(ret!=RESULT_OK)
- {
- LYERRLOG("%s call lynq_send_common_request failure, ret is %d",__func__,ret);
- return ret;
- }
-
- LYINFLOG("%s set %d suc",__func__,type);
- delete p;
- return RESULT_OK;
-}
-
const char * lynq_get_raw_data(Parcel* &p, int* data_len)
{
int32_t len;
@@ -1305,6 +1271,136 @@
return data;
}
+int GetIntArrayInRespString(Parcel* &p, const char* tagString, int int_array_in_resp[MAX_AT_INT_RSP_NUM], int* valid_num)
+{
+ int bfind=false;
+ const char* data;
+ int data_len;
+ char* data_str;
+ char* start;
+ int length;
+ int i;
+ int num_start;
+ int ret=RESULT_OK;
+ int pos = p->dataPosition();
+ data = lynq_get_raw_data(p,&data_len);
+ p->setDataPosition(pos);
+ if(data==NULL || data_len == 0)
+ {
+ LYERRLOG("%s lynq_get_raw_data NULL or data_len is 0",__func__);
+ return LYNQ_E_INNER_ERROR;
+ }
+ data_str = (char*) calloc(1,data_len+1);
+ if (NULL == data_str)
+ {
+ LYERRLOG("%s alloc mem error, data_len is %d",__func__,data_len+1);
+ return LYNQ_E_MALLOC_ERROR;
+ }
+ memmove(data_str, data, data_len);
+ data_str[data_len]='\0';
+ LYINFLOG("%s return string is %s",__func__,data_str);
+ start = strstr(data_str,tagString);
+ int local_valid_num=0;
+ if(start!=NULL)
+ {
+ start=start+strlen(tagString);
+ length=strlen(start);
+ for(i=0; i<length;i++)
+ {
+ if((!bfind) && (start[i] >= '0') && (start[i] <= '9'))
+ {
+ bfind=true;
+ num_start=i;
+ }
+ else if(bfind && ((start[i] < '0') || (start[i] > '9')))
+ {
+ start[i]='\0';
+ int_array_in_resp[local_valid_num]=atoi(start+num_start);
+ local_valid_num++;
+ bfind=false;
+ }
+ }
+ }
+ else
+ {
+ LYERRLOG("%s can't find tag string",__func__,tagString);
+ ret=LYNQ_E_INNER_ERROR;
+ }
+
+ if(local_valid_num ==0)
+ {
+ LYERRLOG("%s can't find integer",__func__);
+ }
+ *valid_num = local_valid_num;
+ LYINFLOG("%s ret is %d valid num is %d ",__func__,ret,*valid_num);
+ free(data_str);
+ return ret;
+}
+
+int get_ret_code_for_hook(Parcel* &p)
+{
+ int ret;
+ int int_array_in_resp[MAX_AT_INT_RSP_NUM];
+ int valid_num;
+
+ ret=GetIntArrayInRespString(p,"OK",int_array_in_resp,&valid_num);
+
+ if(ret!=RESULT_OK)
+ {
+ ret=GetIntArrayInRespString(p,"ERROR",int_array_in_resp,&valid_num);
+ if(ret==RESULT_OK && valid_num > 0)
+ {
+ ret=int_array_in_resp[0];
+ }
+ else
+ {
+ ret=LYNQ_E_INNER_ERROR;
+ }
+ }
+ return ret;
+}
+
+int lynq_radio_on(const lynq_network_radio_on_type type)
+{
+ if(g_module_init_flag != MODULE_RUNNING)
+ {
+ LYERRLOG("%s module state %d error",__func__,g_module_init_flag);
+ return LYNQ_E_CONFLICT;
+ }
+ if (type != NETWORK_RADIO_ON_TYPE_CFUN_0 && type != NETWORK_RADIO_ON_TYPE_NORMAL_MODE && type!=NETWORK_RADIO_ON_TYPE_FLIGHT_MODE)
+ {
+ LYERRLOG("%s parameter %d error",__func__,type);
+ return LYNQ_E_PARAMETER_ANONALY;
+ }
+
+ Parcel* p=NULL;
+ int ret;
+
+ if(type==NETWORK_RADIO_ON_TYPE_CFUN_0)
+ {
+ ret=lynq_send_common_request(p,g_wait_time,RIL_REQUEST_OEM_HOOK_RAW,1,"%s","AT+CFUN=0");
+ }
+ else
+ {
+ ret=lynq_send_common_request(p,65,RIL_REQUEST_RADIO_POWER,1,"%d",(type==NETWORK_RADIO_ON_TYPE_NORMAL_MODE));
+ }
+
+ if(ret!=RESULT_OK)
+ {
+ LYERRLOG("%s call lynq_send_common_request failure, ret is %d",__func__,ret);
+ return ret;
+ }
+
+ if(type==NETWORK_RADIO_ON_TYPE_CFUN_0)
+ {
+ ret=get_ret_code_for_hook(p);
+ }
+
+ LYINFLOG("%s set %d ret is %d",__func__,type,ret);
+ delete p;
+ return RESULT_OK;
+}
+
int lynq_query_radio_state(int *radio_state)
{
if(g_module_init_flag != MODULE_RUNNING)
@@ -1324,66 +1420,33 @@
{
LYERRLOG("%s call lynq_send_common_request failure, ret is %d",__func__,ret);
return ret;
- }
+ }
- int bfind=false;
- const char* data;
- int data_len;
- char* data_str;
- char* start;
- int length;
- int i;
- int num_start;
- data = lynq_get_raw_data(p,&data_len);
- if(data==NULL || data_len == 0)
+ int int_array_in_resp[MAX_AT_INT_RSP_NUM];
+ int valid_num;
+
+ ret=GetIntArrayInRespString(p,"CFUN",int_array_in_resp,&valid_num);
+
+ if(ret==RESULT_OK && valid_num > 0)
{
- LYERRLOG("%s lynq_get_raw_data NULL or data_len is 0",__func__);
- delete p;
- return LYNQ_E_INNER_ERROR;
+ *radio_state=int_array_in_resp[0];
}
- data_str = (char*) calloc(1,data_len+1);
- if (NULL == data_str)
+ else
{
- LYERRLOG("%s alloc mem error, data_len is %d",__func__,data_len+1);
- delete p;
- return LYNQ_E_MALLOC_ERROR;
+ ret=GetIntArrayInRespString(p,"ERROR",int_array_in_resp,&valid_num);
+ if(ret==RESULT_OK && valid_num > 0)
+ {
+ ret=int_array_in_resp[0];
+ }
+ else
+ {
+ ret=LYNQ_E_INNER_ERROR;
+ }
}
- memmove(data_str, data, data_len);
- data_str[data_len]='\0';
- LYINFLOG("%s return string is %s",__func__,data_str);
- start = strstr(data_str,"CFUN");
- if(start!=NULL)
- {
- start=start+4;
- length=strlen(start);
- for(i=0; i<length;i++)
- {
- if((!bfind) && (start[i] >= '0') && (start[i] <= '9'))
- {
- bfind=true;
- num_start=i;
- }
- else if(bfind && ((start[i] < '0') || (start[i] > '9')))
- {
- start[i]='\0';
- break;
- }
- }
- if(bfind)
- {
- (*radio_state) = atoi(start+num_start);
- LYINFLOG("%s, radio state is %s %d",__func__,start+num_start,*radio_state);
- free(data_str);
- delete p;
- return RESULT_OK;
- }
- }
- LYERRLOG("%s return string %s no cfun or no digit",__func__,data_str);
- free(data_str);
+
delete p;
- return LYNQ_E_INNER_ERROR;
-}
-
+ return ret;
+}
int lynq_query_radio_tech(int* radioTech)
{
if(g_module_init_flag != MODULE_RUNNING)
@@ -1734,7 +1797,151 @@
return RESULT_OK;
}
-#ifdef MODEM_GEN97
+#ifdef MOBILETEK_TARGET_PLATFORM_T106
+
+int lynq_set_oos_net_scan_cfg_fast(int t_fast_scan_enable, int t_fast_scan_interval)
+{
+ if(! (
+ (t_fast_scan_enable==0) ||
+ (t_fast_scan_enable == 1 &&
+ t_fast_scan_interval > 0 && t_fast_scan_interval <= 65535 )
+ ) )
+ {
+ LYERRLOG("%s paramter %d %d error!",__func__, t_fast_scan_enable, t_fast_scan_interval);
+ return LYNQ_E_PARAMETER_ANONALY;
+ }
+
+ Parcel* p=NULL;
+ int ret=lynq_send_common_request(p,g_wait_time,RIL_REQUEST_OEM_HOOK_RAW,1,"%s,%d,%d","AT+ZSET=\"FAST_FREQ_SCAN\"",t_fast_scan_enable,t_fast_scan_interval);
+
+ if(ret!=RESULT_OK)
+ {
+ LYERRLOG("%s call lynq_send_common_request failure, ret is %d",__func__,ret);
+ return ret;
+ }
+
+ ret=get_ret_code_for_hook(p);
+
+ LYINFLOG("%s %d %d ret is %d",__func__,t_fast_scan_enable,t_fast_scan_interval,ret);
+ delete p;
+ return ret;
+}
+
+int lynq_get_oos_net_scan_cfg_fast(int* t_fast_scan_enable, int* t_fast_scan_interval)
+{
+ Parcel* p=NULL;
+ int ret=lynq_send_common_request(p,g_wait_time,RIL_REQUEST_OEM_HOOK_RAW,1,"%s","AT+ZSET=\"FAST_FREQ_SCAN\"");
+
+ if(ret!=RESULT_OK)
+ {
+ LYERRLOG("%s call lynq_send_common_request failure, ret is %d",__func__,ret);
+ return ret;
+ }
+
+ int int_array_in_resp[MAX_AT_INT_RSP_NUM];
+ int valid_num;
+
+ ret=GetIntArrayInRespString(p,"FAST_FREQ_SCAN",int_array_in_resp,&valid_num);
+
+ if(ret==RESULT_OK && valid_num > 1)
+ {
+ *t_fast_scan_enable = int_array_in_resp[0];
+ *t_fast_scan_interval = int_array_in_resp[1];
+ }
+ else
+ {
+ ret=GetIntArrayInRespString(p,"ERROR",int_array_in_resp,&valid_num);
+ if(ret==RESULT_OK && valid_num > 0)
+ {
+ ret=int_array_in_resp[0];
+ }
+ else
+ {
+ ret=LYNQ_E_INNER_ERROR;
+ }
+ }
+
+ delete p;
+ return ret;
+}
+
+
+int lynq_set_oos_net_scan_cfg_full_band(int t_full_band_min, int t_full_band_step, int t_full_band_num, int t_full_band_max)
+{
+ if(! (
+ (t_full_band_min==0 && t_full_band_step ==0 && t_full_band_num ==0 && t_full_band_max ==0) ||
+ (t_full_band_min > 0 && t_full_band_min <= 65535 &&
+ t_full_band_step > 0 && t_full_band_step <= 65535 &&
+ t_full_band_num > 0 && t_full_band_num <= 65535 &&
+ t_full_band_max > 0 && t_full_band_max <= 65535 )
+ ) )
+ {
+ LYERRLOG("%s paramter %d %d %d %d error!",__func__, t_full_band_min, t_full_band_step, t_full_band_num, t_full_band_max);
+ return LYNQ_E_PARAMETER_ANONALY;
+ }
+
+ Parcel* p=NULL;
+ int ret=lynq_send_common_request(p,g_wait_time,RIL_REQUEST_OEM_HOOK_RAW,1,"%s,%d,%d,%d,%d","AT+ZSET=\"FREQ_SCAN\"",t_full_band_min,t_full_band_step,t_full_band_num,t_full_band_max);
+
+ if(ret!=RESULT_OK)
+ {
+ LYERRLOG("%s call lynq_send_common_request failure, ret is %d",__func__,ret);
+ return ret;
+ }
+
+ ret=get_ret_code_for_hook(p);
+
+ LYINFLOG("%s %d %d %d %d ret is %d",__func__,t_full_band_min,t_full_band_step,t_full_band_num,t_full_band_max,ret);
+ delete p;
+ return ret;
+}
+
+int lynq_get_oos_net_scan_cfg_full_band(int* t_full_band_min, int* t_full_band_step, int* t_full_band_num, int* t_full_band_max)
+{
+ Parcel* p=NULL;
+ int ret=lynq_send_common_request(p,g_wait_time,RIL_REQUEST_OEM_HOOK_RAW,1,"%s","AT+ZSET=\"FREQ_SCAN\"");
+
+ if(ret!=RESULT_OK)
+ {
+ LYERRLOG("%s call lynq_send_common_request failure, ret is %d",__func__,ret);
+ return ret;
+ }
+
+ int int_array_in_resp[MAX_AT_INT_RSP_NUM];
+ int valid_num;
+
+ ret=GetIntArrayInRespString(p,"FREQ_SCAN",int_array_in_resp,&valid_num);
+
+ if(ret==RESULT_OK && valid_num > 1)
+ {
+ *t_full_band_min = int_array_in_resp[0];
+ *t_full_band_step = int_array_in_resp[1];
+ *t_full_band_num = int_array_in_resp[2];
+ *t_full_band_max = int_array_in_resp[3];
+ }
+ else
+ {
+ ret=GetIntArrayInRespString(p,"ERROR",int_array_in_resp,&valid_num);
+ if(ret==RESULT_OK && valid_num > 0)
+ {
+ ret=int_array_in_resp[0];
+ }
+ else
+ {
+ ret=LYNQ_E_INNER_ERROR;
+ }
+ }
+
+ LYINFLOG("%s ret is %d",__func__,ret);
+ delete p;
+ return ret;
+}
+
+
+#define OOS_NET_SCAN_CFG_TYPE_FAST 0
+#define OOS_NET_SCAN_CFG_TYPE_FULL_BAND 1
+
+#elif defined(MODEM_GEN97)
/**@brief parse at response,return error code,and the response
* @param response [IN] <response>:original at response,This parameter must be a character array.
@@ -1959,7 +2166,98 @@
}
-DEFINE_LYNQ_LIB_LOG(LYNQ_NETWORK)
+#endif
+
+#if (defined MOBILETEK_TARGET_PLATFORM_T106) || (defined MODEM_GEN97)
+
+int lynq_set_oos_net_scan_cfg(int config_list[MAX_OOS_CFG_ITEM_NUMBER], int valid_num)
+{
+ if(g_module_init_flag != MODULE_RUNNING)
+ {
+ LYERRLOG("%s module state %d error",__func__,g_module_init_flag);
+ return LYNQ_E_CONFLICT;
+ }
+
+#ifdef MOBILETEK_TARGET_PLATFORM_T106
+ if(valid_num < 1)
+ {
+ LYERRLOG("%s paramter valid_num %d error!",__func__,valid_num);
+ return LYNQ_E_PARAMETER_ANONALY;
+ }
+
+ if(config_list[0] == OOS_NET_SCAN_CFG_TYPE_FAST)
+ {
+ if(valid_num <3 )
+ {
+ LYERRLOG("%s paramter valid_num %d error!",__func__, valid_num);
+ return LYNQ_E_PARAMETER_ANONALY;
+ }
+ return lynq_set_oos_net_scan_cfg_fast(config_list[1],config_list[2]);
+ }
+ else if (config_list[0] == OOS_NET_SCAN_CFG_TYPE_FULL_BAND)
+ {
+ if(valid_num <5 )
+ {
+
+ LYERRLOG("%s paramter valid_num %d error!",__func__, valid_num);
+ return LYNQ_E_PARAMETER_ANONALY;
+ }
+ return lynq_set_oos_net_scan_cfg_full_band(config_list[1],config_list[2],config_list[3],config_list[4]);
+ }
+ else
+ {
+ LYERRLOG("%s paramter type %d error!",__func__, config_list[0]);
+ return LYNQ_E_PARAMETER_ANONALY;
+ }
+
+#else
+ if(valid_num < 4)
+ {
+ LYERRLOG("%s paramter valid_num %d error!",__func__,valid_num);
+ return LYNQ_E_PARAMETER_ANONALY;
+ }
+ return lynq_oos_deep_sleep_recover_timer_interval(config_list[0],config_list[1],config_list[2],config_list[3]);
+#endif
+}
+
+
+int lynq_get_oos_net_scan_cfg(int config_list[MAX_OOS_CFG_ITEM_NUMBER], int* valid_num)
+{
+ if(g_module_init_flag != MODULE_RUNNING)
+ {
+ LYERRLOG("%s module state %d error",__func__,g_module_init_flag);
+ return LYNQ_E_CONFLICT;
+ }
+
+#ifdef MOBILETEK_TARGET_PLATFORM_T106
+
+ if(NULL == valid_num || NULL == config_list)
+ {
+ LYERRLOG("%s there is parameter is NULL",__func__);
+ return LYNQ_E_PARAMETER_ANONALY;
+ }
+
+
+ if(config_list[0] == OOS_NET_SCAN_CFG_TYPE_FAST)
+ {
+ *valid_num=2;
+ return lynq_get_oos_net_scan_cfg_fast(&(config_list[0]),&(config_list[1]));
+ }
+ else if (config_list[0] == OOS_NET_SCAN_CFG_TYPE_FULL_BAND)
+ {
+ *valid_num=4;
+ return lynq_get_oos_net_scan_cfg_full_band(&(config_list[0]),&(config_list[1]),&(config_list[2]),&(config_list[3]));
+ }
+ else
+ {
+ LYERRLOG("%s paramter type %d error!",__func__, config_list[0]);
+ return LYNQ_E_PARAMETER_ANONALY;
+ }
+#else
+ return LYNQ_E_PARAMETER_ANONALY;
+#endif
+}
#endif
+DEFINE_LYNQ_LIB_LOG(LYNQ_NETWORK)
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-network/makefile b/cap/zx297520v3/src/lynq/lib/liblynq-network/makefile
index cf6f538..5505037 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-network/makefile
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-network/makefile
@@ -15,6 +15,9 @@
LOCAL_CFLAGS += -DBINDER_IPC_32BIT=1 -DHAVE_ENDIAN_H -DHAVE_PTHREADS -DHAVE_SYS_UIO_H -DHAVE_POSIX_FILEMAP -DHAVE_STRLCPY -DHAVE_PRCTL -DHAVE_MEMSET16 -DHAVE_MEMSET32 -DANDROID_SMP=0
endif
+ifeq ($(strip $(TARGET_PLATFORM)), T106)
+ LOCAL_CFLAGS += -DMOBILETEK_TARGET_PLATFORM_T106
+endif
$(warning ################# lynq network demo ROOT: $(ROOT),includedir:$(includedir))
LOCAL_PATH = .
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-audio/LICENSE b/cap/zx297520v3/src/lynq/lib/liblynq-qser-audio/LICENSE
new file mode 100644
index 0000000..605b7ea
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-audio/LICENSE
@@ -0,0 +1,31 @@
+Copyright Statement:
+
+This software/firmware and related documentation ("MobileTek Software") are
+protected under relevant copyright laws. The information contained herein is
+confidential and proprietary to MobileTek Inc. and/or its licensors. Without
+the prior written permission of MobileTek inc. and/or its licensors, any
+reproduction, modification, use or disclosure of MobileTek Software, and
+information contained herein, in whole or in part, shall be strictly
+prohibited.
+
+MobileTek Inc. (C) 2015. All rights reserved.
+
+BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
+THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MobileTek SOFTWARE")
+RECEIVED FROM MobileTek AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER
+ON AN "AS-IS" BASIS ONLY. MobileTek EXPRESSLY DISCLAIMS ANY AND ALL
+WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
+WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
+NONINFRINGEMENT. NEITHER DOES MobileTek PROVIDE ANY WARRANTY WHATSOEVER WITH
+RESPECT TO THE SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY,
+INCORPORATED IN, OR SUPPLIED WITH THE MobileTek SOFTWARE, AND RECEIVER AGREES
+TO LOOK ONLY TO SUCH THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO.
+RECEIVER EXPRESSLY ACKNOWLEDGES THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO
+OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES CONTAINED IN MobileTek
+SOFTWARE. MobileTek SHALL ALSO NOT BE RESPONSIBLE FOR ANY MobileTek SOFTWARE
+RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
+STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MobileTek'S
+ENTIRE AND CUMULATIVE LIABILITY WITH RESPECT TO THE MobileTek SOFTWARE
+RELEASED HEREUNDER WILL BE, AT MobileTek'S OPTION, TO REVISE OR REPLACE THE
+MobileTek SOFTWARE AT ISSUE, OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE
+CHARGE PAID BY RECEIVER TO MobileTek FOR SUCH MobileTek SOFTWARE AT ISSUE.
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-audio/include/lynq-qser-audio.h b/cap/zx297520v3/src/lynq/lib/liblynq-qser-audio/include/lynq-qser-audio.h
new file mode 100644
index 0000000..cc37b2e
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-audio/include/lynq-qser-audio.h
@@ -0,0 +1,45 @@
+/*******************************************************
+*
+* @brief: Add audio api
+* @details: add liblynq-qser-audio api
+* @author: yu.dong
+* @date: 2023.9.28
+* @version: V1.0
+* @copyright:Copyright (c) MobileTek
+*
+*********************************************/
+#ifndef LYNQ_QSER_AUDIO
+#define LYNQ_QSER_AUDIO
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "sc_audio.h"
+
+sc_audio_handle_t playback_handle = SC_AUDIO_INVALID_HANDLE;
+sc_audio_handle_t capture_handle = SC_AUDIO_INVALID_HANDLE;
+
+typedef void (*_cb_onPlayer)(int);
+
+int qser_AudPlayer_Open(char* device, _cb_onPlayer cb_fun);
+int qser_AudPlayer_PlayFrmFile(int hdl, const char *fd, int offset);
+int qser_AudPlayer_Pause(int hdl);
+int qser_AudPlayer_Resume(int hdl);
+void qser_AudPlayer_Stop(int hdl);
+void qser_AudPlayer_Close(int hdl);
+
+int qser_AudRecorder_Open(char* device, _cb_onPlayer cb_fun);
+int qser_AudRecorder_StartRecord(int hdl, const char *fd, int offset);
+int qser_AudRecorder_Pause(void);
+int qser_AudRecorder_Resume(void);
+void qser_AudRecorder_Stop(void);
+void qser_AudRecorder_Close(void);
+
+void qser_Audio_Deinit(void);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-audio/lynq-qser-audio.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-qser-audio/lynq-qser-audio.cpp
new file mode 100644
index 0000000..70b4e43
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-audio/lynq-qser-audio.cpp
@@ -0,0 +1,546 @@
+#include <stdint.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "liblog/lynq_deflog.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "sc_audio.h"
+#include "lynq-qser-audio.h"
+
+#define AUDIO_INIT_MAX_TRY_CNT 100
+
+#define SC_AUDIO_BE_DAI_MIN -1
+#define SC_AUDIO_STREAM_FORMAT_INVALID 0
+
+/********************************************************************
+* @brief: _cb_onPlayer, typedef for a callback function that is called
+ when an audio operation is performed
+* @param int [IN]: The result of the audio operation, 0 if successful, non-zero if failed
+* @return : void
+* @todo: NA
+* @see: NA
+* @warning: NA
+*********************************************************************/
+typedef void (*_cb_onPlayer)(int);
+
+/********************************************************************
+* @brief: playback_state_cb, callback function that is called when the audio playback state changes
+* @param handle [IN]: sc_audio_handle_t, the handle of the audio device
+* @param params [IN]: void*, parameters for the callback function
+* @param state [IN]: sc_audio_playback_state_e, the current state of audio playback
+* @return : int, 0 if successful, non-zero if failed
+* @todo: NA
+* @see: NA
+* @warning: NA
+*********************************************************************/
+int playback_state_cb (sc_audio_handle_t handle, void *params, sc_audio_playback_state_e state)
+{
+ LYINFLOG("playback_state_cb handle:0x%lx state:%d\n", handle, state);
+ return 0;
+}
+
+/********************************************************************
+* @brief: capture_state_cb, callback function that is called when the audio capture state changes
+* @param handle [IN]: sc_audio_handle_t, the handle of the audio device
+* @param params [IN]: void*, parameters for the callback function
+* @param state [IN]: sc_audio_capture_state_e, the current state of audio capture
+* @return : int, 0 if successful, non-zero if failed
+* @todo: NA
+* @see: NA
+* @warning: NA
+*********************************************************************/
+int capture_state_cb (sc_audio_handle_t handle, void *params, sc_audio_capture_state_e state)
+{
+ LYINFLOG("capture_state_cb handle:0x%lx state:%d\n", handle, state);
+
+ return 0;
+}
+
+/********************************************************************
+* @brief: get_device_enum, function to convert a device string to its corresponding enum
+* @param device [IN]: const char*, the name of the device
+* @return : sc_audio_fe_pcm_dev_e, the enum corresponding to the device name
+* @todo: NA
+* @see: NA
+* @warning: NA
+*********************************************************************/
+sc_audio_fe_pcm_dev_e get_device_enum(const char* device)
+{
+ if (strcmp(device, "device1") == 0)
+ {
+ return SC_AUDIO_FE_PCM_DEV_MULTIMEDIA1;
+ }
+ else if (strcmp(device, "device2") == 0)
+ {
+ return SC_AUDIO_FE_PCM_DEV_MULTIMEDIA2;
+ }
+ else
+ {
+ return SC_AUDIO_INVALID_HANDLE;
+ }
+}
+
+/********************************************************************
+* @brief: qser_AudPlayer_Open, open the audio device for playback
+* @param device [IN]: char* device, the audio device to be opened for playback
+* @param cb_fun [IN]: _cb_onPlayer, callback function to be called when the audio device is opened
+* @return : int, 0 if successful, non-zero if failed
+* @todo: NA
+* @see: NA
+* @warning: NA
+*********************************************************************/
+int qser_AudPlayer_Open(char* device, _cb_onPlayer cb_fun)
+{
+ int ret = SC_ERR_SUCCESS;
+ int retry_cnt = 0;
+ int audio_is_init = 0;
+
+ sc_audio_fe_pcm_dev_e device_enum = get_device_enum(device); // Convert device string to enum
+
+ while (AUDIO_INIT_MAX_TRY_CNT > retry_cnt)
+ {
+ ret = sc_audio_init();
+ if (SC_ERR_NOT_READY == ret)
+ {
+ LYINFLOG("audio service is not ready, try again, try count = %d\n", (retry_cnt + 1));
+ usleep(200 * 1000);
+ retry_cnt++;
+ }
+ else if (SC_ERR_SUCCESS == ret)
+ {
+ LYINFLOG("Success to initialize audio service\n");
+ audio_is_init = 1;
+ break;
+ }
+ else
+ {
+ LYINFLOG("Failed to initialize audio service, ret = %d\n", ret);
+ break;
+ }
+ }
+ if (1 != audio_is_init)
+ {
+ LYINFLOG("Failed to initialize audio service\n");
+ if (cb_fun != NULL)
+ {
+ cb_fun(-1);
+ }
+ return -1;
+ }
+
+ sc_audio_handle_t device_handle = sc_audio_playback_open(device_enum, SC_AUDIO_FE_PCM_DEV_MIN, SC_AUDIO_OWNER_ID_PLAYER);
+ if (SC_AUDIO_INVALID_HANDLE == device_handle)
+ {
+ LYINFLOG("Failed to open device: %s\n", device);
+ if (cb_fun != NULL)
+ {
+ cb_fun(-1);
+ }
+ return -1;
+ }
+
+ if (cb_fun != NULL)
+ {
+ cb_fun(0);
+ }
+ return 0;
+}
+
+/********************************************************************
+* @brief: qser_AudPlayer_PlayFrmFile, play audio from file
+* @param hdl [IN]: int, handle for the audio device or stream
+* @param fd [IN]: const char*, file descriptor of the audio file
+* @param offset [IN]: int, offset in the audio file
+* @return : success 0, failed -1
+* @todo: NA
+* @see: NA
+* @warning: NA
+*********************************************************************/
+int qser_AudPlayer_PlayFrmFile(int hdl, const char *fd, int offset)
+{
+ int error_line;
+ sc_audio_pcm_config_t pcm_config;
+ int ret = 0;
+ sc_audio_owner_id owner_id = hdl;
+
+ if(NULL== fd || 0 == strlen(fd))
+ {
+ error_line = __LINE__;
+ goto exit;
+ }
+
+ playback_handle = sc_audio_playback_open(SC_AUDIO_FE_PCM_DEV_MULTIMEDIA2,SC_AUDIO_FE_PCM_DEV_MIN,owner_id);
+ if (SC_AUDIO_INVALID_HANDLE == playback_handle)
+ {
+ error_line = __LINE__;
+ goto exit;
+ }
+
+ if(strlen(fd))
+ {
+ ret = sc_audio_playback_file_prepare(playback_handle, fd, NULL, playback_state_cb, NULL);
+ if (SC_ERR_SUCCESS != ret)
+ {
+ error_line = __LINE__;
+ goto exit;
+ }
+ }
+
+ ret = sc_audio_playback_play(playback_handle);
+ if (SC_ERR_SUCCESS != ret)
+ {
+ error_line = __LINE__;
+ goto exit;
+ }
+
+ return 0;
+exit:
+ LYINFLOG("qser_AudPlayer_PlayFrmFile error_line=%d\n",error_line);
+ return -1;
+}
+
+/********************************************************************
+* @brief: qser_AudPlayer_Pause, pause the audio playback
+* @param hdl [IN]: int, handle for the audio device or stream
+* @return : success 0, failed -1
+* @todo: NA
+* @see: NA
+* @warning: NA
+*********************************************************************/
+int qser_AudPlayer_Pause(int hdl)
+{
+ if (SC_AUDIO_INVALID_HANDLE == playback_handle)
+ {
+ LYINFLOG("qser_AudPlayer_Pause handle is invalid.\n");
+ return -1;
+ }
+ if( sc_audio_playback_pause(playback_handle))
+ {
+ LYINFLOG("qser_AudPlayer_Pause sc_audio_playback_pause fail.\n");
+ return -1;
+ }
+ return 0;
+}
+
+/********************************************************************
+* @brief: qser_AudPlayer_Resume, resume the audio playback
+* @param hdl [IN]: int, handle for the audio device or stream
+* @return : success 0, failed -1
+* @todo: NA
+* @see: NA
+* @warning: NA
+*********************************************************************/
+int qser_AudPlayer_Resume(int hdl)
+{
+ if (SC_AUDIO_INVALID_HANDLE == playback_handle)
+ {
+ LYINFLOG("qser_AudPlayer_Resume handle is invalid.\n");
+ return -1;
+ }
+ if( sc_audio_playback_resume(playback_handle))
+ {
+ LYINFLOG("qser_AudPlayer_Resume sc_audio_playback_resume fail.\n");
+ return -1;
+ }
+ return 0;
+}
+
+/********************************************************************
+* @brief: qser_AudPlayer_Stop, stop the audio playback
+* @param hdl [IN]: int, handle for the audio device or stream
+* @return : void
+* @todo: NA
+* @see: NA
+* @warning: NA
+*********************************************************************/
+void qser_AudPlayer_Stop(int hdl)
+{
+ if (SC_AUDIO_INVALID_HANDLE == playback_handle)
+ {
+ LYINFLOG("qser_AudPlayer_Stop handle is invalid.\n");
+ return;
+ }
+
+ if( sc_audio_playback_stop(playback_handle))
+ {
+ LYINFLOG("qser_AudPlayer_Stop sc_audio_playback_stop fail.\n");
+ return;
+ }
+}
+
+/********************************************************************
+* @brief: qser_AudPlayer_Close, close the audio playback
+* @param hdl [IN]: int, handle for the audio device or stream
+* @return : void
+* @todo: NA
+* @see: NA
+* @warning: NA
+*********************************************************************/
+void qser_AudPlayer_Close(int hdl)
+{
+ if (SC_AUDIO_INVALID_HANDLE == playback_handle)
+ {
+ LYINFLOG("qser_AudPlayer_Close handle is invalid.\n");
+ return;
+ }
+ if( sc_audio_playback_stop(playback_handle))
+ {
+ LYINFLOG("qser_AudPlayer_Close sc_audio_playback_stop fail.\n");
+ return;
+ }
+ if( sc_audio_playback_close(playback_handle))
+ {
+ LYINFLOG("qser_AudPlayer_Close sc_audio_playback_close fail.\n");
+ return;
+ }
+
+ playback_handle = SC_AUDIO_INVALID_HANDLE;
+}
+
+/********************************************************************
+* @brief: qser_AudRecorder_Open, open the audio device for recording
+* @param device [IN]: char* device, the audio device to be opened for recording
+* @param cb_fun [IN]: _cb_onPlayer, callback function to be called when the audio device is opened
+* @return : int, 0 if successful, non-zero if failed
+* @todo: NA
+* @see: NA
+* @warning: NA
+*********************************************************************/
+int qser_AudRecorder_Open(char* device, _cb_onPlayer cb_fun)
+{
+ int ret = SC_ERR_SUCCESS;
+ int retry_cnt = 0;
+ int audio_is_init = 0;
+
+ sc_audio_fe_pcm_dev_e device_enum = get_device_enum(device); // Convert device string to enum
+
+ while (AUDIO_INIT_MAX_TRY_CNT > retry_cnt)
+ {
+ ret = sc_audio_init();
+ if (SC_ERR_NOT_READY == ret)
+ {
+ LYINFLOG("audio service is not ready, try again, try count = %d\n", (retry_cnt + 1));
+ usleep(200 * 1000);
+ retry_cnt++;
+ }
+ else if (SC_ERR_SUCCESS == ret)
+ {
+ LYINFLOG("Success to initialize audio service\n");
+ audio_is_init = 1;
+ break;
+ }
+ else
+ {
+ LYINFLOG("Failed to initialize audio service, ret = %d\n", ret);
+ break;
+ }
+ }
+ if (1 != audio_is_init)
+ {
+ LYINFLOG("Failed to initialize audio service\n");
+ if (cb_fun != NULL)
+ {
+ cb_fun(-1);
+ }
+ return -1;
+ }
+
+ sc_audio_handle_t device_handle = sc_audio_playback_open(device_enum, SC_AUDIO_FE_PCM_DEV_MIN, SC_AUDIO_OWNER_ID_PLAYER);
+ if (SC_AUDIO_INVALID_HANDLE == device_handle)
+ {
+ LYINFLOG("Failed to open device: %s\n", device);
+ if (cb_fun != NULL)
+ {
+ cb_fun(-1);
+ }
+ return -1;
+ }
+
+ if (cb_fun != NULL)
+ {
+ cb_fun(0);
+ }
+ return 0;
+}
+
+/********************************************************************
+* @brief: qser_AudRecorder_StartRecord, play a file with capture
+* @param hdl [IN]: int, handle for the audio device or stream
+* @param fd [IN]: const char*, file descriptor of the audio file
+* @param offset [IN]: int, offset in the audio file
+* @return : int, 0 if successful, -1 if failed
+* @todo: NA
+* @see: NA
+* @warning: NA
+*********************************************************************/
+int qser_AudRecorder_StartRecord(int hdl, const char *fd, int offset)
+{
+ int error_line;
+ sc_audio_pcm_config_t pcm_config;
+ int ret = 0;
+ sc_audio_owner_id owner_id = hdl;
+
+ if(NULL== fd || 0 == strlen(fd))
+ {
+ error_line = __LINE__;
+ goto exit;
+ }
+
+ capture_handle = sc_audio_capture_open(SC_AUDIO_FE_PCM_DEV_MULTIMEDIA1,SC_AUDIO_BE_DAI_MIN);
+ if (SC_AUDIO_INVALID_HANDLE == capture_handle)
+ {
+ error_line = __LINE__;
+ goto exit;
+ }
+
+ memset(&pcm_config, 0, sizeof(sc_audio_pcm_config_t));
+
+ ret = sc_audio_capture_file_prepare(capture_handle, fd, SC_AUDIO_STREAM_FORMAT_INVALID, NULL, capture_state_cb, NULL);
+ if (SC_ERR_SUCCESS != ret)
+ {
+ error_line = __LINE__;
+ goto exit;
+ }
+
+ ret = sc_audio_capture_record(capture_handle);
+ if (SC_ERR_SUCCESS != ret)
+ {
+ error_line = __LINE__;
+ goto exit;
+ }
+
+ return 0;
+exit:
+ LYINFLOG("qser_AudRecorder_StartRecord error_line=%d\n",error_line);
+ return -1;
+}
+
+/********************************************************************
+* @brief: qser_AudRecorder_Pause, pause the audio capture
+* @return : int, 0 if successful, -1 if failed
+* @todo: NA
+* @see: NA
+* @warning: NA
+*********************************************************************/
+int qser_AudRecorder_Pause(void)
+{
+ if (SC_AUDIO_INVALID_HANDLE == capture_handle)
+ {
+ LYINFLOG("qser_AudRecorder_Pause capture_handle is invalid.\n");
+ return -1;
+ }
+ if( sc_audio_capture_pause(capture_handle))
+ {
+ LYINFLOG("qser_AudRecorder_Pause sc_audio_capture_pause fail.\n");
+ return -1;
+ }
+ return 0;
+}
+
+/********************************************************************
+* @brief: qser_AudRecorder_Resume, resume the audio capture
+* @return : int, 0 if successful, -1 if failed
+* @todo: NA
+* @see: NA
+* @warning: NA
+*********************************************************************/
+int qser_AudRecorder_Resume(void)
+{
+ if (SC_AUDIO_INVALID_HANDLE == capture_handle)
+ {
+ LYINFLOG("qser_AudRecorder_Resume capture_handle is invalid.\n");
+ return -1;
+ }
+ if( sc_audio_capture_resume(capture_handle))
+ {
+ LYINFLOG("qser_AudRecorder_Resume sc_audio_capture_resume fail.\n");
+ return -1;
+ }
+ return 0;
+}
+
+/********************************************************************
+* @brief: qser_AudRecorder_Stop, stop the audio capture
+* @return : void
+* @todo: NA
+* @see: NA
+* @warning: NA
+*********************************************************************/
+void qser_AudRecorder_Stop(void)
+{
+ if (SC_AUDIO_INVALID_HANDLE == capture_handle)
+ {
+ LYINFLOG("qser_AudRecorder_Stop capture_handle is invalid.\n");
+ return;
+ }
+ if( sc_audio_capture_stop(capture_handle))
+ {
+ LYINFLOG("qser_AudRecorder_Stop sc_audio_capture_stop fail.\n");
+ return;
+ }
+}
+
+/********************************************************************
+* @brief: qser_AudRecorder_Close, close the audio capture
+* @return : void
+* @todo: NA
+* @see: NA
+* @warning: NA
+*********************************************************************/
+void qser_AudRecorder_Close(void)
+{
+ if (SC_AUDIO_INVALID_HANDLE == capture_handle)
+ {
+ LYINFLOG("qser_AudRecorder_Close capture_handle is invalid.\n");
+ return;
+ }
+ if( sc_audio_capture_stop(capture_handle))
+ {
+ LYINFLOG("qser_AudRecorder_Close sc_audio_capture_stop fail.\n");
+ return;
+ }
+ if( sc_audio_capture_close(capture_handle))
+ {
+ LYINFLOG("qser_AudRecorder_Close sc_audio_capture_close fail.\n");
+ return;
+ }
+
+ capture_handle = SC_AUDIO_INVALID_HANDLE;
+}
+
+/********************************************************************
+* @brief: qser_Audio_Deinit, deinitialize the audio system, stop and close any active playback or capture,
+ and uninitialize the audio system
+* @return : void
+* @todo: NA
+* @see: NA
+* @warning: NA
+*********************************************************************/
+void qser_Audio_Deinit(void)
+{
+ if(SC_AUDIO_INVALID_HANDLE != playback_handle)
+ {
+ sc_audio_playback_stop(playback_handle);
+ sc_audio_playback_close(playback_handle);
+ playback_handle = SC_AUDIO_INVALID_HANDLE;
+ }
+
+ if(SC_AUDIO_INVALID_HANDLE != capture_handle)
+ {
+ sc_audio_capture_stop(capture_handle);
+ sc_audio_capture_close(capture_handle);
+ capture_handle = SC_AUDIO_INVALID_HANDLE;
+ }
+
+ sc_audio_uninit();
+}
+
+DEFINE_LYNQ_LIB_LOG(LYNQ_AUDIO)
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-audio/makefile b/cap/zx297520v3/src/lynq/lib/liblynq-qser-audio/makefile
new file mode 100644
index 0000000..cef3517
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-audio/makefile
@@ -0,0 +1,48 @@
+SHELL = /bin/sh
+RM = rm -f
+
+LOCAL_CFLAGS := -Wall \
+ -std=gnu++14 \
+ -g -Os \
+ -flto \
+ -fPIC \
+ -fpermissive \
+
+LOCAL_PATH = .
+
+LOCAL_C_INCLUDES = \
+ -I. \
+ -I$(LOCAL_PATH)/include \
+ -I$(LOCAL_PATH)/ \
+ -I$(ROOT)$(includedir)/logger \
+ -I$(ROOT)$(includedir)/liblog \
+
+LOCAL_LIBS := \
+ -L. \
+ -ldl \
+ -lstdc++ \
+ -llynq-log \
+ -lmedia \
+
+SOURCES = lynq-qser-audio.cpp
+LIBRARY = liblynq-qser-audio.so
+
+OBJECTS=$(SOURCES:.cpp=.o)
+
+all: $(LIBRARY)
+
+$(LIBRARY): $(OBJECTS)
+ $(CXX) -shared -o $@ $(OBJECTS) $(LOCAL_LIBS) $(LOCAL_CFLAGS) $(LOCAL_C_INCLUDES)
+
+%.o : %.cpp
+ $(CXX) $(LOCAL_C_INCLUDES) $(LOCAL_CFLAGS) $(LOCAL_LIBS) -fPIC -c $<
+
+install:
+ mkdir -p $(ROOT)$(base_libdir)/
+ install $(LIBRARY) $(ROOT)$(base_libdir)/
+ mkdir -p $(ROOT)$(includedir)/$(NAME)/sdk
+
+clean:
+ $(RM) $(OBJECTS) $(LIBRARY)
+
+
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-data/lynq-qser-data.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-qser-data/lynq-qser-data.cpp
index b5b2f6c..85767bc 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-qser-data/lynq-qser-data.cpp
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-data/lynq-qser-data.cpp
@@ -411,6 +411,11 @@
sum_node = sum_node->next;
continue;
}
+ else if(strcmp((char *)xmlGetProp(sum_node, "apn_type"), apn->apn_type) == 0)
+ {
+ LYERRLOG("apntype already exists\n");
+ goto FAILED;
+ }
node_num++;
sum_node = sum_node->next;
}
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/agps.conf b/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/agps.conf
new file mode 100755
index 0000000..71ed385
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/agps.conf
@@ -0,0 +1,2 @@
+ ID1: IcoeTempID1Expire20231031
+ Base 64 PW: YVoyWXNXcWp0RFRqVXlVeQ==
\ No newline at end of file
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/include/lynq_qser_gnss.h b/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/include/lynq_qser_gnss.h
index d69af22..1fe5ab3 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/include/lynq_qser_gnss.h
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/include/lynq_qser_gnss.h
@@ -115,6 +115,8 @@
int qser_Gnss_Delete_Aiding_Data(uint32_t h_gnss,DELETE_AIDING_DATA_TYPE_T flags);
int qser_Gnss_InjectTime(uint32_t h_gnss,LYNQ_INJECT_TIME_INTO_T *time_info);
int qser_firmware_update(uint32_t* ph_gnss);
+int qser_Gnss_injectEphemeris(uint32_t h_gnss);
+int qser_Gnss_download_tle();
#ifdef __cplusplus
}
#endif
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/include/mbtk_gnss_internal.h b/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/include/mbtk_gnss_internal.h
index dfced9c..ce124b2 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/include/mbtk_gnss_internal.h
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/include/mbtk_gnss_internal.h
@@ -2,12 +2,12 @@
#include <stdint.h>
#ifndef __MBTK_GNSS_H__
#define __MBTK_GNSS_H__
+#include <sc_bsp.h>
#include "ringbuffer.h"
#ifdef __cplusplus
extern "C" {
#endif
-
/*
GGA: GNSS 定位数据
$GNGGA,,,,,,0,00,99.99,,,,,,*56
@@ -271,13 +271,14 @@
};
-
+#define MAX_GPIO_NUM 144
+static void *test_gpio_handle[MAX_GPIO_NUM]={NULL};
static struct mopen_gnss_device_info_t mopen_gnss_device_info;
static struct mbtk_gnss_handle_t *mbtk_gnss_handle = NULL;
static int firmware_extren_state = 0;
static char g_no_sv = 0;// 参与定位的卫星数量
-
+extern int gpio21_value;
int mopen_gnss_get_nmea_config(uint32 h_gnss);
int mopen_gnss_get_ant_state_info(uint32 h_gnss);
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/include/mbtk_http.h b/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/include/mbtk_http.h
new file mode 100755
index 0000000..c1c6e9e
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/include/mbtk_http.h
@@ -0,0 +1,364 @@
+/*************************************************************
+Description:
+ MBTK HTTP Header file.
+Author:
+ LiuBin
+Date:
+ 2020/4/29 17:25:55
+*************************************************************/
+#ifndef _MBTK_HTTP_2_H
+#define _MBTK_HTTP_2_H
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include <stdio.h>
+#include "mbtk_type.h"
+//#include "mbtk_sock2.h"
+
+
+/*************************************************************
+ Constants and Macros
+*************************************************************/
+#define MBTK_HTTP_URI_MAX 512
+#define MBTK_HTTP_HOST_MAX 50
+#define MBTK_HTTP_URL_MAX (MBTK_HTTP_URI_MAX + MBTK_HTTP_HOST_MAX)
+#define MBTK_HTTP_PORT_DEF 80
+#define MBTK_HTTPS_PORT_DEF 443
+#define HTTP_HANDLE_MAX 3
+#define HTTP_SESSION_MAX 5
+#define HTTP_REQUEST_HEADER_MAX 30
+#define HTTP_RESPONSE_HEADER_MAX 30
+#define HTTP_CONTENT_LEN_MAX 1024
+#define HTTP_MSG_LEN_MAX 1024
+
+#define HTTP_IPC_MSG_PATH "/dev"
+#define HTTP_IPC_MSG_ID 'H'
+
+/*************************************************************
+ Definitions:enum,struct,union,class
+*************************************************************/
+typedef enum {
+ HTTP_VERSION_1_0 = 0,
+ HTTP_VERSION_1_1,
+ HTTP_VERSION_2,
+ HTTP_VERSION_3
+} mbtk_http_version_enum;
+
+typedef enum {
+ HTTP_OPTION_HEAD = 0,
+ HTTP_OPTION_GET,
+ HTTP_OPTION_POST,
+ HTTP_OPTION_PUT,
+ HTTP_OPTION_DELETE,
+ HTTP_OPTION_OPTIONS,
+ HTTP_OPTION_TRACE,
+ HTTP_OPTION_CONNECT,
+ HTTP_OPTION_LINK,
+ HTTP_OPTION_UNLINK
+} mbtk_http_option_enum;
+
+#if 0
+typedef enum {
+ HTTP_HEADER_GENERAL = 0,
+ HTTP_HEADER_REQUEST,
+ HTTP_HEADER_RESPONSE,
+ HTTP_HEADER_ENTITY,
+ HTTP_HEADER_OTHERS
+} mbtk_http_header_type_e;
+
+typedef enum {
+ // General field start.
+ HTTP_HEADER_INDEX_CACHE_CONTROL = 0,
+ HTTP_HEADER_INDEX_CONNECTION,
+ HTTP_HEADER_INDEX_DATE,
+ HTTP_HEADER_INDEX_PRAGMA,
+ HTTP_HEADER_INDEX_TRAILER,
+ HTTP_HEADER_INDEX_TRANSFER_ENCODING,
+ HTTP_HEADER_INDEX_UPGRADE,
+ HTTP_HEADER_INDEX_VIA,
+ HTTP_HEADER_INDEX_WARNING,
+ // General field end.
+ // Request field start.
+ HTTP_HEADER_INDEX_ACCEPT,
+ HTTP_HEADER_INDEX_ACCEPT_CHARSET,
+ HTTP_HEADER_INDEX_ACCEPT_ENCODING,
+ HTTP_HEADER_INDEX_ACCEPT_LANGUAGE,
+ HTTP_HEADER_INDEX_AUTHORIZATION,
+ HTTP_HEADER_INDEX_EXPECT,
+ HTTP_HEADER_INDEX_FROM,
+ HTTP_HEADER_INDEX_HOST,
+ HTTP_HEADER_INDEX_IF_MATCH,
+ HTTP_HEADER_INDEX_IF_MODIFIED_SINCE,
+ HTTP_HEADER_INDEX_IF_NONE_MATCH,
+ HTTP_HEADER_INDEX_IF_RANGE,
+ HTTP_HEADER_INDEX_IF_UNMODIFIED_SINCE,
+ HTTP_HEADER_INDEX_MAX_FORWARDS,
+ HTTP_HEADER_INDEX_PROXY_AUTHORIZATION,
+ HTTP_HEADER_INDEX_RANGE,
+ HTTP_HEADER_INDEX_REFERER,
+ HTTP_HEADER_INDEX_TE,
+ HTTP_HEADER_INDEX_USER_AGENT,
+ // Request field end.
+ // Response field start.
+ HTTP_HEADER_INDEX_ACCEPT_RANGES,
+ HTTP_HEADER_INDEX_AGE,
+ HTTP_HEADER_INDEX_ETAG,
+ HTTP_HEADER_INDEX_LOCATION,
+ HTTP_HEADER_INDEX_PROXY_AUTHENTICATE,
+ HTTP_HEADER_INDEX_RETRY_AFTER,
+ HTTP_HEADER_INDEX_SERVER,
+ HTTP_HEADER_INDEX_VARY,
+ HTTP_HEADER_INDEX_WWW_AUTHENTICATE,
+ // Response field end.
+ // Entity field start.
+ HTTP_HEADER_INDEX_ALLOW,
+ HTTP_HEADER_INDEX_CONTENT_ENCODING,
+ HTTP_HEADER_INDEX_CONTENT_LANGUAGE,
+ HTTP_HEADER_INDEX_CONTENT_LENGTH,
+ HTTP_HEADER_INDEX_CONTENT_LOCATION,
+ HTTP_HEADER_INDEX_CONTENT_MD5,
+ HTTP_HEADER_INDEX_CONTENT_RANGE,
+ HTTP_HEADER_INDEX_CONTENT_TYPE,
+ HTTP_HEADER_INDEX_EXPIRES,
+ HTTP_HEADER_INDEX_LAST_MODIFIED,
+ // Entity field end.
+ // Other field start.
+ HTTP_HEADER_INDEX_SET_COOKIE,
+ HTTP_HEADER_INDEX_COOKIE,
+ HTTP_HEADER_INDEX_X_FRAME_OPTIONS,
+ HTTP_HEADER_INDEX_X_XSS_PROTECTION,
+ HTTP_HEADER_INDEX_DNT,
+ HTTP_HEADER_INDEX_P3P
+ // Other field end.
+} mbtk_http_header_index_e;
+#endif
+
+typedef enum {
+ HTTP_SESSION_STATE_NON = 0,
+ HTTP_SESSION_STATE_CONN,
+ HTTP_SESSION_STATE_WRITE_HEADER,
+ HTTP_SESSION_STATE_WRITE_CONTENT,
+ HTTP_SESSION_STATE_WRITE_END,
+ HTTP_SESSION_STATE_READ_HEADER,
+ HTTP_SESSION_STATE_READ_CONTENT,
+ HTTP_SESSION_STATE_READ_END
+} http_session_state_e;
+
+typedef enum {
+ MBTK_HTTP_STATE_CODE_200 = 200,
+ MBTK_HTTP_STATE_CODE_204 = 204,
+ MBTK_HTTP_STATE_CODE_206 = 206,
+ MBTK_HTTP_STATE_CODE_301 = 301,
+ MBTK_HTTP_STATE_CODE_302 = 302,
+ MBTK_HTTP_STATE_CODE_303 = 303,
+ MBTK_HTTP_STATE_CODE_304 = 304,
+ MBTK_HTTP_STATE_CODE_307 = 307,
+ MBTK_HTTP_STATE_CODE_400 = 400,
+ MBTK_HTTP_STATE_CODE_401 = 401,
+ MBTK_HTTP_STATE_CODE_403 = 403,
+ MBTK_HTTP_STATE_CODE_404 = 404,
+ MBTK_HTTP_STATE_CODE_500 = 500,
+ MBTK_HTTP_STATE_CODE_503 = 503
+} mbtk_http_state_code_e;
+
+typedef enum {
+ MBTK_HTTP_DATA_NON = 0,
+ MBTK_HTTP_DATA_HEADER,
+ MBTK_HTTP_DATA_CONTENT,
+ MBTK_HTTP_DATA_COMPLETE
+} mbtk_http_data_type_enum;
+
+typedef void (*mbtk_http_data_callback_func)(
+ int session_id, mbtk_http_data_type_enum type,
+ void *data,int data_len);
+
+typedef struct mbtk_http_header {
+ char name[30];
+ char *value;
+} mbtk_http_header_t;
+
+typedef struct {
+ int header_cnt;
+ mbtk_http_header_t *req_h[HTTP_REQUEST_HEADER_MAX];
+
+ int content_len; // Post content lenght
+ int content_len_send; // Post content lenght for send.
+ char *content;
+} mbtk_http_session_req_t;
+
+typedef struct {
+ int state_code;
+ mbtk_http_version_enum version;
+
+ int content_length;
+ bool is_chunked;
+ int header_cnt;
+ mbtk_http_header_t *rsp_h[HTTP_RESPONSE_HEADER_MAX];
+} mbtk_http_session_rsp_t;
+
+typedef struct mbtk_http_session{
+ int handle_id;
+ int id;
+ int sock_fd;
+ FILE *sock_file;
+ http_session_state_e state;
+ char host[MBTK_HTTP_HOST_MAX + 1];
+ mbtk_http_option_enum option;
+ mbtk_http_version_enum version;
+ char uri[MBTK_HTTP_URI_MAX + 1];
+ int port;
+ bool is_ssl;
+
+ mbtk_http_session_req_t req;
+ mbtk_http_session_rsp_t rsp;
+} mbtk_http_session_t;
+
+typedef struct mbtk_http_handle{
+ int id;
+ bool show_rsp_header;
+ mbtk_http_data_callback_func data_cb;
+
+ int session_cnt;
+ mbtk_http_session_t *session[HTTP_SESSION_MAX];
+} mbtk_http_handle_t;
+
+#if 0
+typedef enum {
+ HTTP_MSG_SESSION_CREATE_REQ,
+ HTTP_MSG_SESSION_CREATE_RSP,
+ HTTP_MSG_SESSION_FREE_REQ,
+ HTTP_MSG_SESSION_FREE_RSP,
+ HTTP_MSG_SESSION_URL_SET_REQ,
+ HTTP_MSG_SESSION_URL_SET_RSP,
+ HTTP_MSG_SESSION_HEAD_SET_REQ,
+ HTTP_MSG_SESSION_HEAD_SET_RSP,
+ HTTP_MSG_SESSION_CONTENT_SET_REQ,
+ HTTP_MSG_SESSION_CONTENT_SET_RSP,
+ HTTP_MSG_SESSION_ACTION_REQ,
+ HTTP_MSG_SESSION_ACTION_RSP,
+ HTTP_MSG_SESSION_CONTENT_SEND_REQ,
+ HTTP_MSG_SESSION_CONTENT_SEND_RSP
+} mbtk_http_msg_type_enum;
+#endif
+
+typedef enum {
+ HTTP_MSG_SESSION_CREATE,
+ HTTP_MSG_SESSION_FREE,
+ HTTP_MSG_SESSION_HEAD_SET,
+ HTTP_MSG_SESSION_CONTENT_SET,
+ HTTP_MSG_SESSION_ACTION,
+ HTTP_MSG_SESSION_CONTENT_SEND,
+ HTTP_MSG_HANDLE_EXIT
+} mbtk_http_msg_type_enum;
+
+typedef enum {
+ MBTK_HTTP_ERR_SUCCESS,
+ MBTK_HTTP_ERR_UNKNOWN
+} mbtk_http_err_enum;
+
+typedef struct {
+ mbtk_http_msg_type_enum type;
+ int int_arg1;
+ int int_arg2;
+ char str_small[30];
+ char str_large[HTTP_MSG_LEN_MAX];
+} mbtk_http_msg_req_t;
+
+typedef struct {
+ mbtk_http_msg_type_enum type;
+ mbtk_http_err_enum err;
+
+ mbtk_http_data_type_enum data_type;
+ int buff_len;
+ char buff[HTTP_MSG_LEN_MAX];
+} mbtk_http_msg_rsp_t;
+
+/*************************************************************
+ Extern variables
+*************************************************************/
+#if 0
+const mbtk_http_header_field_t mbtk_http_headers[] = {
+ {HTTP_HEADER_INDEX_CACHE_CONTROL, HTTP_HEADER_GENERAL,"Cache-Control"},
+ {HTTP_HEADER_INDEX_CONNECTION, HTTP_HEADER_GENERAL,"Connection"},
+ {HTTP_HEADER_INDEX_DATE, HTTP_HEADER_GENERAL,"Date"},
+ {HTTP_HEADER_INDEX_PRAGMA, HTTP_HEADER_GENERAL,"Pragma"},
+ {HTTP_HEADER_INDEX_TRAILER, HTTP_HEADER_GENERAL,"Trailer"},
+ {HTTP_HEADER_INDEX_TRANSFER_ENCODING, HTTP_HEADER_GENERAL,"Transfer-Encoding"},
+ {HTTP_HEADER_INDEX_UPGRADE, HTTP_HEADER_GENERAL,"Upgrade"},
+ {HTTP_HEADER_INDEX_VIA, HTTP_HEADER_GENERAL,"Via"},
+ {HTTP_HEADER_INDEX_WARNING, HTTP_HEADER_GENERAL,"Warning"},
+ {HTTP_HEADER_INDEX_ACCEPT, HTTP_HEADER_REQUEST,"Accept"},
+ {HTTP_HEADER_INDEX_ACCEPT_CHARSET, HTTP_HEADER_REQUEST,"Accept-Charset"},
+ {HTTP_HEADER_INDEX_ACCEPT_ENCODING, HTTP_HEADER_REQUEST,"Accept-Encoding"},
+ {HTTP_HEADER_INDEX_ACCEPT_LANGUAGE, HTTP_HEADER_REQUEST,"Accept-Language"},
+ {HTTP_HEADER_INDEX_AUTHORIZATION, HTTP_HEADER_REQUEST,"Authorization"},
+ {HTTP_HEADER_INDEX_EXPECT, HTTP_HEADER_REQUEST,"Expect"},
+ {HTTP_HEADER_INDEX_FROM, HTTP_HEADER_REQUEST,"From"},
+ {HTTP_HEADER_INDEX_HOST, HTTP_HEADER_REQUEST,"Host"},
+ {HTTP_HEADER_INDEX_IF_MATCH, HTTP_HEADER_REQUEST,"If-Match"},
+ {HTTP_HEADER_INDEX_IF_MODIFIED_SINCE, HTTP_HEADER_REQUEST,"If-Modified-Since"},
+ {HTTP_HEADER_INDEX_IF_NONE_MATCH, HTTP_HEADER_REQUEST,"If-None-Match"},
+ {HTTP_HEADER_INDEX_IF_RANGE, HTTP_HEADER_REQUEST,"If-Range"},
+ {HTTP_HEADER_INDEX_IF_UNMODIFIED_SINCE, HTTP_HEADER_REQUEST,"If-Unmodified-Since"},
+ {HTTP_HEADER_INDEX_MAX_FORWARDS, HTTP_HEADER_REQUEST,"Max-Forwards"},
+ {HTTP_HEADER_INDEX_PROXY_AUTHORIZATION, HTTP_HEADER_REQUEST,"Proxy-Authorization"},
+ {HTTP_HEADER_INDEX_RANGE, HTTP_HEADER_REQUEST,"Range"},
+ {HTTP_HEADER_INDEX_REFERER, HTTP_HEADER_REQUEST,"Referer"},
+ {HTTP_HEADER_INDEX_TE, HTTP_HEADER_REQUEST,"TE"},
+ {HTTP_HEADER_INDEX_USER_AGENT, HTTP_HEADER_REQUEST,"User-Agent"},
+ {HTTP_HEADER_INDEX_ACCEPT_RANGES, HTTP_HEADER_RESPONSE,"Accept-Ranges"},
+ {HTTP_HEADER_INDEX_AGE, HTTP_HEADER_RESPONSE,"Age"},
+ {HTTP_HEADER_INDEX_ETAG, HTTP_HEADER_RESPONSE,"ETag"},
+ {HTTP_HEADER_INDEX_LOCATION, HTTP_HEADER_RESPONSE,"Location"},
+ {HTTP_HEADER_INDEX_PROXY_AUTHENTICATE, HTTP_HEADER_RESPONSE,"Proxy-Authenticate"},
+ {HTTP_HEADER_INDEX_RETRY_AFTER, HTTP_HEADER_RESPONSE,"Retry-After"},
+ {HTTP_HEADER_INDEX_SERVER, HTTP_HEADER_RESPONSE,"Server"},
+ {HTTP_HEADER_INDEX_VARY, HTTP_HEADER_RESPONSE,"Vary"},
+ {HTTP_HEADER_INDEX_WWW_AUTHENTICATE, HTTP_HEADER_RESPONSE,"WWW-Authenticate"},
+ {HTTP_HEADER_INDEX_ALLOW, HTTP_HEADER_ENTITY,"Allow"},
+ {HTTP_HEADER_INDEX_CONTENT_ENCODING, HTTP_HEADER_ENTITY,"Content-Encoding"},
+ {HTTP_HEADER_INDEX_CONTENT_LANGUAGE, HTTP_HEADER_ENTITY,"Content-Language"},
+ {HTTP_HEADER_INDEX_CONTENT_LENGTH, HTTP_HEADER_ENTITY,"Content-Length"},
+ {HTTP_HEADER_INDEX_CONTENT_LOCATION, HTTP_HEADER_ENTITY,"Content-Location"},
+ {HTTP_HEADER_INDEX_CONTENT_MD5, HTTP_HEADER_ENTITY,"Content-MD5"},
+ {HTTP_HEADER_INDEX_CONTENT_RANGE, HTTP_HEADER_ENTITY,"Content-Range"},
+ {HTTP_HEADER_INDEX_CONTENT_TYPE, HTTP_HEADER_ENTITY,"Content-Type"},
+ {HTTP_HEADER_INDEX_EXPIRES, HTTP_HEADER_ENTITY,"Expires"},
+ {HTTP_HEADER_INDEX_LAST_MODIFIED, HTTP_HEADER_ENTITY,"Last-Modified"},
+ {HTTP_HEADER_INDEX_SET_COOKIE, HTTP_HEADER_OTHERS,"Set-Cookie"},
+ {HTTP_HEADER_INDEX_COOKIE, HTTP_HEADER_OTHERS,"Cookie"},
+ {HTTP_HEADER_INDEX_X_FRAME_OPTIONS, HTTP_HEADER_OTHERS,"X-Frame-Options"},
+ {HTTP_HEADER_INDEX_X_XSS_PROTECTION, HTTP_HEADER_OTHERS,"X-XSS-Protection"},
+ {HTTP_HEADER_INDEX_DNT, HTTP_HEADER_OTHERS,"DNT"},
+ {HTTP_HEADER_INDEX_P3P, HTTP_HEADER_OTHERS,"P3P"}
+};
+#endif
+/*************************************************************
+ Public Function Declaration
+*************************************************************/
+int mbtk_http_handle_get(bool show_rsp_header,mbtk_http_data_callback_func data_cb);
+int mbtk_http_handle_free(int handle_id);
+int mbtk_http_session_create(int handle_id, mbtk_http_option_enum option,
+ mbtk_http_version_enum version);
+int mbtk_http_session_option_reset(int handle_id, int session_id, mbtk_http_option_enum option);
+int mbtk_http_session_free(int handle_id,int session_id);
+int mbtk_http_session_url_set(int handle_id,int session_id,void *url);
+int mbtk_http_session_head_add(int handle_id,int session_id,
+ char *name, char *value);
+int mbtk_http_session_content_set(int handle_id,int session_id,
+ char *content,uint32 content_len);
+int mbtk_http_session_start(int handle_id,int session_id);
+int mbtk_http_session_content_send(int handle_id,int session_id,
+ char *data,int data_len);
+const mbtk_http_session_t* mbtk_http_session_get(int handle_id,int session_id);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _MBTK_HTTP_2_H */
+
+
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/include/mbtk_http_base.h b/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/include/mbtk_http_base.h
new file mode 100755
index 0000000..e8ae710
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/include/mbtk_http_base.h
@@ -0,0 +1,44 @@
+#include <cstdio>
+#include <sys/socket.h>
+#include <sys/types.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <netdb.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int mbtk_http_init();
+int mbtk_http_deinit();
+int mbtk_http_open
+(
+ //bool is_ssl,
+ //bool ingnore_cert,
+ const void *host,
+ int *port
+);
+int mbtk_http_read
+(
+ int sock_fd,
+ void *buf,
+ uint16_t len,
+ int timeout_ms
+);
+
+int mbtk_http_read_line
+(
+ int sock_fd,
+ void *buf,
+ uint16_t len
+);
+int mbtk_http_write
+(
+ int sock_fd,
+ void *buf,
+ uint16_t len
+);
+int mbtk_http_close(int sock_fd);
+
+#ifdef __cplusplus
+}
+#endif
\ No newline at end of file
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/include/mbtk_type.h b/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/include/mbtk_type.h
new file mode 100755
index 0000000..c5fc1a0
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/include/mbtk_type.h
@@ -0,0 +1,127 @@
+#ifndef MBTK_TYPE_INCLUDE
+#define MBTK_TYPE_INCLUDE
+#include <stdio.h>
+#include <stdbool.h>
+#include <sys/types.h>
+
+#ifndef MBTK_PLATFORM_LINUX
+#define MBTK_PLATFORM_LINUX
+#endif
+
+#ifndef MBTK_PLATFORM_QCOMM
+//#define MBTK_PLATFORM_QCOMM
+#endif
+
+#define MBTK_SUCCESS 0
+#define MBTK_FAILE (-1)
+
+#ifndef UNUSED
+#define UNUSED(param) ((void) param)
+#define UNUSEDPARAM UNUSED
+#endif
+
+#ifndef TRUE
+#define TRUE 1 /* Boolean true value. */
+#endif
+
+#ifndef true
+#define true 1 /* Boolean true value. */
+#endif
+
+#ifndef FALSE
+#define FALSE 0 /* Boolean false value. */
+#endif
+
+#ifndef false
+#define false 0 /* Boolean false value. */
+#endif
+
+
+#ifndef NULL
+#define NULL 0
+#endif
+
+
+#ifndef null
+#define null 0
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+/**
+ * Compiler-digit : 16
+ * char : 1 (%c)
+ * char* : 2
+ * short int : 2
+ * int : 2 (%d)
+ * unsigned int : 2 (%u)
+ * float : 4 (%f)
+ * double : 8 (%f)
+ * long : 4
+ * unsigned long : 4
+ * long long : 8
+ * unsigned long long : 8
+ *
+ *
+ * Compiler-digit : 32
+ * char : 1
+ * char* : 4
+ * short int : 2
+ * int : 4
+ * unsigned int : 4
+ * float : 4
+ * double : 8
+ * long : 4
+ * unsigned long : 4
+ * long long : 8
+ * unsigned long long : 8
+ *
+ *
+ * Compiler-digit : 64
+ * char : 1
+ * char* : 8
+ * short int : 2
+ * int : 4
+ * unsigned int : 4
+ * float : 4
+ * double : 8
+ * long : 8
+ * unsigned long : 8
+ * long long : 8
+ * unsigned long long : 8
+ */
+typedef unsigned char boolean; /* Boolean value type. */
+// typedef unsigned char bool; /* Boolean value type. */
+typedef unsigned long long uint64; /* Unsigned 64 bit value */
+typedef unsigned long long uint64_t; /* Unsigned 64 bit value */
+typedef unsigned int uint32; /* Unsigned 32 bit value */
+typedef unsigned int uint32_t; /* Unsigned 32 bit value */
+typedef unsigned short uint16; /* Unsigned 16 bit value */
+typedef unsigned short uint16_t;
+typedef unsigned char uint8; /* Unsigned 8 bit value */
+typedef unsigned char uint8_t;
+typedef signed long long int64; /* Signed 64 bit value */
+typedef signed long long sint64; /* Signed 64 bit value */
+typedef signed int int32; /* Signed 32 bit value */
+typedef signed int sint32; /* Signed 32 bit value */
+typedef signed short int16; /* Signed 16 bit value */
+typedef signed short sint16; /* Signed 16 bit value */
+typedef signed char int8; /* Signed 8 bit value */
+typedef signed char sint8; /* Signed 8 bit value */
+typedef unsigned char byte; /* byte type */
+
+
+typedef struct
+{
+ char *buffer;
+ int size;
+ int size_max;
+}mbtk_buffer_t;
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* MBTK_TYPE_INCLUDE */
+
+
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/makefile b/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/makefile
index b18390b..0f99e4f 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/makefile
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/makefile
@@ -11,8 +11,7 @@
ifeq ($(strip $(TARGET_PLATFORM)), T106)
LOCAL_CFLAGS += -DBINDER_IPC_32BIT=1 -DHAVE_ENDIAN_H -DHAVE_PTHREADS -DHAVE_SYS_UIO_H -DHAVE_POSIX_FILEMAP -DHAVE_STRLCPY -DHAVE_PRCTL -DHAVE_MEMSET16 -DHAVE_MEMSET32 -DANDROID_SMP=0
endif
-
-$(warning ################# lynq qser sms demo ROOT: $(ROOT),includedir:$(includedir))
+$(warning lynq qser gnss demo ROOT = $(ROOT), includedir = $(includedir))
LOCAL_PATH = .
LOCAL_C_INCLUDES = \
@@ -21,17 +20,21 @@
-I$(ROOT)$(includedir)/logger \
-I$(ROOT)$(includedir)/liblog \
-I$(ROOT)$(includedir)/libxml2 \
+ -I$(ROOT)$(includedir)\
LOCAL_LIBS := \
-L. \
-lstdc++ \
- -llog \
+ -llog \
-lcutils \
-lutils \
-lpthread \
-llynq-log \
-lxml2 \
+ -llynq-uci \
+ -lsctel \
+ -lbsp \
SOURCES = $(wildcard *.c wildcard *.h src/*.cpp)
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/src/lynq_qser_gnss.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/src/lynq_qser_gnss.cpp
index 735f467..1c4f1bc 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/src/lynq_qser_gnss.cpp
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/src/lynq_qser_gnss.cpp
@@ -34,6 +34,7 @@
#include "mbtk_gnss_internal.h"
#include "ringbuffer.h"
#include "lynq_qser_gnss.h"
+#include "include/lynq_uci.h"
DEFINE_LYNQ_LIB_LOG(LYNQ_QSER_GNSS)
#ifdef __cplusplus
extern "C" {
@@ -41,6 +42,8 @@
int ret;
LYNQ_INJECT_TIME_INTO_T time_test;
+int g_gnss_sync_enable_flag = 0;
+int g_gnss_sync_done = 0;
int qser_Gnss_Init(uint32_t *h_gnss)
{
@@ -129,15 +132,32 @@
lynq_gnss_get_aidinfo(h_gnss);
return 0;
}
-
int qser_Gnss_Start(uint32_t h_gnss)
{
struct mbtk_gnss_handle_t *gnss_handle = (struct mbtk_gnss_handle_t *)h_gnss;
+
+ char gnss_sync_enable[24] = "";
+ lynq_get_value("lynq_uci", "lynq_sync_time", "lynq_gnss_sync_time_enable" , gnss_sync_enable);
+ g_gnss_sync_enable_flag = atoi(gnss_sync_enable);
+ g_gnss_sync_done = 0;
+
lynq_open_gps(1);
- ret = set_baudrate(gnss_handle->dev_fd, B9600);
- if(-1 == ret)
+ ALOGE("GNSS_VALUE: %d\n",gpio21_value);
+ if(gpio21_value == 1)
{
- return -2;
+ ret = set_baudrate(gnss_handle->dev_fd, B115200);
+ if(-1 == ret)
+ {
+ return -2;
+ }
+ }
+ else if(gpio21_value == 0)
+ {
+ ret = set_baudrate(gnss_handle->dev_fd, B9600);
+ if(-1 == ret)
+ {
+ return -2;
+ }
}
return 0;
}
@@ -233,6 +253,28 @@
return 0;
}
+int qser_Gnss_download_tle()
+{
+ int ret;
+ ret = mopen_gnss_download_tle();
+ if(ret < 0)
+ {
+ return -1;
+ }
+ return 0;
+}
+
+int qser_Gnss_injectEphemeris(uint32_t h_gnss)
+{
+ int ret;
+ ret = mopen_gnss_injects_aidpos(h_gnss);
+ if(ret < 0)
+ {
+ return -1;
+ }
+ return 0;
+}
+
void atsvc_incb_entity(char *input,int length);
int lynq_at_cgps(int at_type,int gnss_state_type);
int lynq_at_cgpsnmea(int at_type,int gnss_state_type);
@@ -424,10 +466,22 @@
return -1;
}
lynq_open_gps(1);
- ret = set_baudrate(tty_fd, B9600);
- if(-1 == ret)
+
+ if(gpio21_value == 1)
{
- return -1;
+ ret = set_baudrate(tty_fd, B115200);
+ if(-1 == ret)
+ {
+ return -2;
+ }
+ }
+ else if(gpio21_value == 0)
+ {
+ ret = set_baudrate(tty_fd, B9600);
+ if(-1 == ret)
+ {
+ return -2;
+ }
}
}
else
@@ -445,14 +499,14 @@
char cgpsnmea_at_res[64]={};
if (at_type == 0)
{
- strncpy(cgpsnmea_at_res,"+CGPSNMEA:(0,1)\r\n",64);
+ sprintf(cgpsnmea_at_res,"+CGPSNMEA:(0,1)\r\n");
atsvc_gnss_outcb(cgpsnmea_at_res,strlen(cgpsnmea_at_res),0);
return 0;
}
else if(at_type == 1)
{
bzero(cgpsnmea_at_res,64);
- sprintf(cgpsnmea_at_res,"+CGPSNMEA:<%d>",at_gpsnmea_status);
+ sprintf(cgpsnmea_at_res,"+CGPSNMEA:<%d>\r\n",at_gpsnmea_status);
atsvc_gnss_outcb(cgpsnmea_at_res,strlen(cgpsnmea_at_res),0);
return 0;
}
@@ -465,7 +519,7 @@
}
else
{
- strncpy(cgpsnmea_at_res,"+CGPSNMEA: same status\r\n",64);
+ sprintf(cgpsnmea_at_res,"+CGPSNMEA: same status\r\n");
atsvc_gnss_outcb(cgpsnmea_at_res,strlen(cgpsnmea_at_res),0);
return -1;
}
@@ -504,22 +558,21 @@
int res = 0;
int income_at_type = 0;
int gnss_state_type = -1;
- char at_cmd[128]={0};
+ //char at_cmd[128]={0};
char gnss_at_cmd[64] = {0};
char parse_atcmd[128] = {0};
if(NULL == input)
{
- strncpy(gnss_at_cmd,"+CME ERROR: 100\r\n",64);
+ sprintf(gnss_at_cmd,"+CME ERROR: 100\r\n");
atsvc_gnss_outcb(gnss_at_cmd,strlen(gnss_at_cmd),0);
return;
}
- bzero(at_cmd,128);
- strncpy(at_cmd,input,strlen(input));
- res = gnss_at_cmd_parse(at_cmd,parse_atcmd,&gnss_state_type,&income_at_type);
+
+ res = gnss_at_cmd_parse(input,parse_atcmd,&gnss_state_type,&income_at_type);
if (res != 0)
{
ALOGE("parse at cmd error");
- strncpy(gnss_at_cmd,"+CME ERROR: 100\r\n",64);
+ sprintf(gnss_at_cmd,"+CME ERROR: 100\r\n");
atsvc_gnss_outcb(gnss_at_cmd,strlen(gnss_at_cmd),0);
return;
}
@@ -529,7 +582,7 @@
res = lynq_at_cgps(income_at_type,gnss_state_type);
if (res != 0)
{
- strncpy(gnss_at_cmd,"+CME ERROR: 100\r\n",64);
+ sprintf(gnss_at_cmd,"+CME ERROR: 100\r\n");
atsvc_gnss_outcb(gnss_at_cmd,strlen(gnss_at_cmd),0);
return;
}
@@ -539,12 +592,12 @@
res = lynq_at_cgpsnmea(income_at_type,gnss_state_type);
if (res != 0)
{
- strncpy(gnss_at_cmd,"+CME ERROR: 100\r\n",64);
+ sprintf(gnss_at_cmd,"+CME ERROR: 100\r\n");
atsvc_gnss_outcb(gnss_at_cmd,strlen(gnss_at_cmd),0);
return;
}
}
- strncpy(gnss_at_cmd,"ok\r\n",64);
+ sprintf(gnss_at_cmd,"OK\r\n");
atsvc_gnss_outcb(gnss_at_cmd,strlen(gnss_at_cmd),0);
return;
}
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/src/mbtk_gnss.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/src/mbtk_gnss.cpp
index cffc6a9..a9a0b67 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/src/mbtk_gnss.cpp
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/src/mbtk_gnss.cpp
@@ -1,4 +1,3 @@
-
#include <stdio.h>
#include <string.h>
#include <strings.h>
@@ -18,11 +17,66 @@
#include <sys/time.h>
#include <liblog/lynq_deflog.h>
#include "mbtk_gnss_internal.h"
+#include "mbtk_http.h"
+#include "mbtk_type.h"
#include "ringbuffer.h"
#ifdef __cplusplus
extern "C" {
#endif
+#define _XOPEN_SOURCE
+#define NMEA_RMC "RMC"
+extern long timezone;
+extern int g_gnss_sync_enable_flag;
+extern int g_gnss_sync_done;
+
+typedef int (*sc_rtc_time_get_cb)(unsigned int src_id, unsigned long ulsec);
+extern int sc_rtc_timer_init(void);
+extern int sc_rtc_timer_uninit(void);
+extern int sc_rtc_time_set(int srcid);
+
+static inline int update_system_time(time_t timestamp)
+{
+ struct timeval tv;
+ int ret = gettimeofday(&tv, NULL);
+ int srcid = -1;
+ if (ret == -1) {
+ perror("gettimeofday");
+ return -1;
+ }
+ if (tv.tv_sec == timestamp)
+ {
+ return 0;
+ }
+ printf("Now: %ld\n", tv.tv_sec);
+ tv.tv_sec = timestamp;
+ tv.tv_usec = 0;
+ ret = settimeofday(&tv, NULL);
+ if (ret == -1) {
+ perror("settimeofday");
+ return -1;
+ }
+ //set system time to rtc.
+ if ((srcid = sc_rtc_timer_init()) <= 0)
+ {
+ gnss_log("%s %d error: sc_rtc_timer_init fail!\n", __func__, __LINE__);
+ return -1;
+ }
+ ret = sc_rtc_time_set(srcid);
+ if (ret != 0)
+ {
+ gnss_log("%s %d error: sc_rtc_time_set fail!\n", __func__, __LINE__);
+ return -1;
+ }
+ ret = sc_rtc_timer_uninit();
+ if (0 != ret)
+ {
+ LYERRLOG("uninit failed \n");
+ gnss_log("%s %d error: dc_rtc_timer_uninit fail!\n", __func__, __LINE__);
+ return -1;
+ }
+ return ret;
+}
struct mbtk_gnss_handle_t
{
@@ -178,14 +232,17 @@
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);
+ 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);
- free(tmp_time);
+ //gnss_log("timestamp: %ld\n",_t);
+ tzset();
+ _t = _t - timezone;
+ //gnss_log("timestamp: %ld\n",_t);
+ free(tmp_time);
return _t;
}
/**
@@ -449,7 +506,17 @@
handle->gnss_handler_func((uint32)handle, E_MT_LOC_MSG_ID_LOCATION_INFO, &mopen_location_info, NULL);
memset(&mopen_location_info, 0, sizeof(mopen_location_info));
}
-
+ //set system time.
+ if (g_gnss_sync_enable_flag == 1 && g_gnss_sync_done == 0)
+ {
+ if( strncmp(data+3,NMEA_RMC,strlen(NMEA_RMC)) == 0 && data[17] == 'A')
+ {
+ if (update_system_time(nmea_info.timestamp) == 0)
+ {
+ g_gnss_sync_done = 1;
+ }
+ }
+ }
return;
}
@@ -664,7 +731,7 @@
{
return -1;
}
- printf("send cmd: %s\n", &buf[size]);
+ ALOGD("send cmd: %s\n", &buf[size]);
size += size_written;
if(size_written != size_to_wr)
{
@@ -847,13 +914,19 @@
return -1;
}
-#define GPS_DEV "/sys/devices/soc.0/d4000000.apb/mbtk-dev-op/gps_power"
-
+int gpio21_value = -1;
int lynq_open_gps(int state)
{
- char cmd[128] = "echo '86' > /sys/class/gpio/export && cd /sys/class/gpio/gpio86";
int ret;
+ /*when in Eur,GPIO21 value is 1; in CN,GPIO21 value is 0. so use it to determined CN or Eur*/
+ test_gpio_handle[21] = sc_gpio_init(21,0,0,0);
+ ret = sc_gpio_value_get(test_gpio_handle[21],&gpio21_value);
+ if(ret)
+ {
+ ALOGE("gpio21 value get error\n");
+ }
+ /*in Eur,need set GPIO15 and 84 value; in CN,need set GPIO86 value*/
if(0 == state)
{
nmea_state = 0;
@@ -865,36 +938,79 @@
}
usleep(10000);
}
- ret = exec_cmd(cmd,NULL);
- if(0 != ret)
+
+ if(gpio21_value == 1)
{
- printf("stop fail %x\n", ret);
+ test_gpio_handle[15] = sc_gpio_init(15,1,0,0);
+ test_gpio_handle[84] = sc_gpio_init(84,1,0,0);
+ ret = sc_gpio_value_set(test_gpio_handle[15],0);
+ if(ret)
+ {
+ ALOGE("gpio15 set value 0 error\n");
+ }
+ usleep(10000);
+ ret = sc_gpio_value_set(test_gpio_handle[84],0);
+ if(ret)
+ {
+ ALOGE("gpio84 set value 0 error\n");
+ }
}
- char cmd2[128] = "echo '0' > /sys/class/gpio/gpio86/value && echo '86' > /sys/class/gpio/unexport";
- ret = exec_cmd(cmd2,NULL);
- if(0 != ret)
+
+ else if(gpio21_value == 0)
{
- printf("stop fail %x\n", ret);
- }
+ test_gpio_handle[86] = sc_gpio_init(86,1,0,0);
+ ret = sc_gpio_value_set(test_gpio_handle[86],0);
+ if(ret)
+ {
+ ALOGE("gpio86 set value 0 error\n");
+ }
+ }
+
}
- if(1 == state)
+ else if(1 == state)
{
nmea_state = 1;
+ if(gpio21_value == 1)
+ {
+ test_gpio_handle[15] = sc_gpio_init(15,1,0,0);
+ test_gpio_handle[84] = sc_gpio_init(84,1,0,0);
+ ret = sc_gpio_value_set(test_gpio_handle[15],1);
+ if(ret)
+ {
+ ALOGE("gpio15 set value 1 error\n");
+ }
+ usleep(10000);
+ ret = sc_gpio_value_set(test_gpio_handle[84],1);
+ if(ret)
+ {
+ ALOGE("gpio84 set value 1 error\n");
+ }
+ }
+ else if(gpio21_value == 0)
+ {
+ test_gpio_handle[86] = sc_gpio_init(86,1,0,0);
+ ret = sc_gpio_value_set(test_gpio_handle[86],1);
+ if(ret)
+ {
+ ALOGE("gpio86 set value 1 error\n");
+ }
+ }
+ }
- ret = exec_cmd(cmd,NULL);
- if(0 != ret)
- {
- printf("start fail %x\n", ret);
- return -1;
- }
- char cmd3[128] = "echo '1' > /sys/class/gpio/gpio86/value && echo '86' > /sys/class/gpio/unexport";
- ret = exec_cmd(cmd3,NULL);
- if(0 != ret)
- {
- printf("start fail %x\n", ret);
- return -1;
- }
+ sc_gpio_uninit(test_gpio_handle[21]);
+ test_gpio_handle[21] = NULL;
+ if(gpio21_value == 1)
+ {
+ sc_gpio_uninit(test_gpio_handle[15]);
+ sc_gpio_uninit(test_gpio_handle[84]);
+ test_gpio_handle[15] = NULL;
+ test_gpio_handle[84] = NULL;
+ }
+ else if(gpio21_value == 0)
+ {
+ sc_gpio_uninit(test_gpio_handle[86]);
+ test_gpio_handle[86] = NULL;
}
return 0;
}
@@ -920,26 +1036,9 @@
}
memset(mbtk_gnss_handle, 0, sizeof(struct mbtk_gnss_handle_t));
memset(&mopen_gnss_device_info, 0, sizeof(mopen_gnss_device_info));
- sleep(1);
lynq_open_gps(0);
mbtk_gnss_handle->dev_fd = mopen_gnss_open(MBTK_GNSS_DEV, 0);
- ret = auto_set_uart_baudrate(mbtk_gnss_handle->dev_fd);
- if(-1 == ret) {
- ret = -2;
- goto err;
- } else if (B9600 == ret) {
- ret = mopen_uart_change(mbtk_gnss_handle->dev_fd, 1);
- if(ret)
- {
- printf("GNSS Uart set B115200 error\n");
- mopen_gnss_close(mbtk_gnss_handle->dev_fd);
- return -1;
- }
- }
-
- printf("Gnss Config Uart Baudrate Successful.\n");
-
mbtk_gnss_handle->rb = (char*)malloc(MBTK_UART_RECV_BUFFER_SIZE);
if(NULL == mbtk_gnss_handle->rb)
{
@@ -997,7 +1096,6 @@
{
int ret;
struct mbtk_gnss_handle_t *gnss_handle = (struct mbtk_gnss_handle_t *)h_gnss;
-
if(h_gnss == NULL)
{
gnss_log("ARG error or not inited.");
@@ -1025,10 +1123,13 @@
printf("GNSS close init error\n");
return -1;
}
-
firmware_extren_state = 0;
- if (gnss_handle->rb) free(gnss_handle->rb);
- free((void *)h_gnss);
+ if (gnss_handle->rb)
+ {
+ free(gnss_handle->rb);
+ }
+ free(mbtk_gnss_handle);
+ mbtk_gnss_handle = NULL;
return 0;
}
@@ -1198,12 +1299,196 @@
return 0;
}
-#define AGNSS_TLE_FILE "/tmp/agnss_tle"
+#define AGNSS_TLE_FILE "/mnt/userdata/agnss_tle"
+static void http_data_cb_func(
+ int session_id, mbtk_http_data_type_enum type,
+ void *data,int data_len)
+{
+ static int agnss_fd = 0;
+ int ret = 0;
+ if(type == MBTK_HTTP_DATA_HEADER) {
+ printf("Header(%d):%s\n", data_len, (char*)data);
+ if(agnss_fd > 0)
+ return;
+ unlink(AGNSS_TLE_FILE);
+ agnss_fd = open(AGNSS_TLE_FILE, O_RDWR|O_CREAT|O_TRUNC, 0644);
+ if (agnss_fd <= 0)
+ printf("file open error\n");
+ printf("agnss file open: %d\n", agnss_fd);
+ } else if(type == MBTK_HTTP_DATA_CONTENT) {
+ printf("http Data(%d)\n", data_len);
+ ret = write(agnss_fd, (char*)data, data_len);
+ if (ret < 0) {
+ printf("%s: error writing to file!\n", __FUNCTION__);
+ } else if (ret < data_len) {
+ printf("%s: wrote less the buffer size!\n", __FUNCTION__);
+ }
+ } else {
+ printf(">>>>>Complete<<<<<\n");
+ if(agnss_fd <= 0)
+ return;
+ close(agnss_fd);
+ agnss_fd = 0;
+ }
+}
-#define AGNSS_CONFIG_FILE "/etc/mbtk/gps.conf"
+static int gnss_http_requst(char *id, char *pw)
+{
+ char tmp[128] = {0};
+
+ int http_handle = mbtk_http_handle_get(TRUE, http_data_cb_func);
+ if(http_handle < 0)
+ {
+ printf("mbtk_http_handle_get() fail.");
+ return -1;
+ }
+ int http_session = mbtk_http_session_create(http_handle, HTTP_OPTION_POST, HTTP_VERSION_1_1);
+ if(http_handle < 0)
+ {
+ printf("mbtk_http_session_create() fail.");
+ return -2;
+ }
+ if(mbtk_http_session_url_set(http_handle, http_session, "http://unicore-api.rx-networks.cn/rxn-api/locationApi/rtcm")) {
+ printf("mbtk_http_session_url_set() fail.\n");
+ return -3;
+ }
+
+ char* post_data = "[{\"rtAssistance\":{\"format\":\"rtcm\",\"msgs\":[\"GPS:2NAF\",\"BDS:2NAF\",\"QZS:2NAF\"]}}]\r\n";
+
+ mbtk_http_session_head_add(http_handle, http_session, \
+ "Host", "unicore-api.rx-networks.cn");
+
+ sprintf(tmp, "RXN-BASIC cId=%s,mId=Unicore,dId=12-23-34-45-58,pw=%s", id, pw);
+ mbtk_http_session_head_add(http_handle, http_session, \
+ "Authorization", tmp);
+
+ mbtk_http_session_head_add(http_handle, http_session, \
+ "Content-Type", "application/json");
+
+ mbtk_http_session_head_add(http_handle, http_session, \
+ "Accept", "application/octet-stream");
+ mbtk_http_session_content_set(http_handle, http_session,
+ post_data, strlen(post_data));
+
+ if(mbtk_http_session_start(http_handle, http_session)) {
+ printf("mbtk_http_session_start() fail.\n");
+ return -4;
+ }
+ if(mbtk_http_handle_free(http_handle))
+ {
+ printf("mbtk_http_handle_free() fail.");
+ return -5;
+ }
+
+ return 0;
+}
+
+/**********************************
+
+ ID1: TempID1Expire20221031
+ Base 64 PW1: RlJYdkFTNE9DWXJhN2ZWTA==
+**************************************/
+#define AGNSS_CONFIG_FILE "/data/gnss_update/agps.conf"
+
+/**
+ * @brief mopen_gnss_download_tle
+ *
+ * @details 下载星历数据
+ * (卫星星历,又称为两行轨道数据(TLE,Two-Line Orbital Element))
+ * 保存到文件:AGNSS_TLE_FILE
+ * @param param
+ *
+ * @return return type
+ */
+int mopen_gnss_download_tle(void)
+{
+ FILE *fp;
+ char StrLine[64];
+ char _id[28] = {0};
+ char _passwd[28] = {0};
+ int i;
+ if((fp = fopen(AGNSS_CONFIG_FILE, "r")) == NULL)
+ {
+ printf("open %s error!\n", AGNSS_CONFIG_FILE);
+ return -1;
+ }
+
+ while (!feof(fp))
+ {
+ memset(StrLine, 0, 64);
+ fgets(StrLine, 64, fp);
+ gnss_log("%s\n", StrLine);
+ i = strstr_n(StrLine, ": ");
+ if(i && strstr_n(StrLine, "ID"))
+ {
+ memcpy(_id, &StrLine[i + 1], strlen(StrLine) - i - 2);
+ printf("%s\n",_id);
+ }
+ else if( i && strstr_n(StrLine, "Base 64"))
+ {
+ memcpy(_passwd, &StrLine[i + 1], strlen(StrLine) - i - 1);
+ printf("%s\n",_passwd);
+ }
+ }
+ fclose(fp);
+ gnss_log("%s : %s[%d], %s[%d]\n", __FUNCTION__, _id, strlen(_id), _passwd, strlen(_passwd));
+ return gnss_http_requst(_id, _passwd);
+}
+
+/**
+ * @brief mopen_gnss_injects_aidpos
+ *
+ * @details 注入星历, 128 bytes
+ *
+ * @param param
+ *
+ * @return return type
+ */
+int mopen_gnss_injects_aidpos(uint32 h_gnss)
+{
+ int ret;
+ int agnss_fd = 0;
+ int size = 0;
+
+ if(0 == h_gnss)
+ {
+ printf("%s handler invalid.\n", __func__);
+ return -1;
+ }
+
+ agnss_fd = open(AGNSS_TLE_FILE, O_RDWR);
+ if (agnss_fd <= 0)
+ {
+ printf("%s open file FAIL. errno:%d\n", __FUNCTION__, errno);
+ return -1;
+ }
+ char* databuf = (char*)malloc(128);
+ if(databuf == NULL)
+ {
+ gnss_log("%s malloc() fail.", __FUNCTION__);
+ return -1;
+ }
+ memset(databuf, 0, 128);
+ while(0 < (size = read(agnss_fd, databuf, 128)))
+ {
+ gnss_log("%s Write[%d]\r\n", __FUNCTION__, size);
+ ret = lynq_gnss_send_cmd(h_gnss, databuf, size);
+ if(ret < 0)
+ {
+ printf("%s send cmd FAIL. ret:%d\n", __FUNCTION__, ret);
+ break;
+ }
+ memset(databuf, 0, 128);
+ }
+ close(agnss_fd);
+ free(databuf);
+ lynq_gnss_get_aidinfo(h_gnss);
+
+ return 0;
+}
/**
@@ -1267,9 +1552,11 @@
{
if(fgets(buffer, 256, pipe))
{
+ result[0] = buffer[0];
memset(buffer, 0, sizeof(buffer));
}
}
+
pclose(pipe);
return 0;
}
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/src/mbtk_http.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/src/mbtk_http.cpp
new file mode 100755
index 0000000..1963359
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/src/mbtk_http.cpp
@@ -0,0 +1,1370 @@
+/*************************************************************
+Description:
+ MBTK HTTP c file.
+Author:
+
+Date:
+
+*************************************************************/
+#include <stdio.h>
+#include <stdlib.h>
+#include <ctype.h>
+#include <string.h>
+#include <log/log.h>
+#include <liblog/lynq_deflog.h>
+#include "mbtk_http_base.h"
+#include "mbtk_http.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+/*************************************************************
+ Constants and Macros
+*************************************************************/
+
+/*************************************************************
+ Variables:local
+*************************************************************/
+static mbtk_http_handle_t http_handles[HTTP_HANDLE_MAX] =
+{
+ {
+ .id = -1,
+ .data_cb = NULL,
+ .session_cnt = 0,
+ .session = {NULL}
+ }
+};
+
+/*************************************************************
+ Variables:public
+*************************************************************/
+
+
+/*************************************************************
+ Local Function Declaration
+*************************************************************/
+
+
+/*************************************************************
+ Local Function Definitions
+*************************************************************/
+static void http_session_free(mbtk_http_session_t *session)
+{
+ if(session)
+ {
+ if(session->req.header_cnt > 0)
+ {
+ int index;
+ for(index = 0; index < HTTP_REQUEST_HEADER_MAX; index++)
+ {
+ if(session->req.req_h[index] != NULL)
+ {
+ if(session->req.req_h[index]->value)
+ free(session->req.req_h[index]->value);
+ free(session->req.req_h[index]);
+ session->req.req_h[index] = NULL;
+ }
+ }
+ session->req.header_cnt = 0;
+ }
+
+ if(session->req.content)
+ {
+ free(session->req.content);
+ session->req.content = NULL;
+ }
+
+ if(session->rsp.header_cnt > 0)
+ {
+ int index;
+ for(index = 0; index < HTTP_REQUEST_HEADER_MAX; index++)
+ {
+ if(session->rsp.rsp_h[index] != NULL)
+ {
+ if(session->rsp.rsp_h[index]->value)
+ free(session->rsp.rsp_h[index]->value);
+ free(session->rsp.rsp_h[index]);
+ session->rsp.rsp_h[index] = NULL;
+ }
+ }
+ session->rsp.header_cnt = 0;
+ }
+
+ free(session);
+ }
+}
+
+static int http_session_close(mbtk_http_session_t *session)
+{
+ if(session)
+ {
+ if(session->sock_fd > 0)
+ {
+ if(mbtk_http_close(session->sock_fd))
+ {
+ RLOGD("mbtk_http_close() fail.");
+ return -1;
+ }
+ session->sock_fd = -1;
+ }
+
+ session->state = HTTP_SESSION_STATE_NON;
+
+ return 0;
+ }
+
+ return -1;
+}
+
+
+static bool http_handle_check(int handle_id)
+{
+ if(handle_id < 0 || handle_id >= HTTP_HANDLE_MAX
+ || http_handles[handle_id].id < 0)
+ {
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+static bool http_session_check(int handle_id, int session_id)
+{
+ if(handle_id < 0 || handle_id >= HTTP_HANDLE_MAX
+ || http_handles[handle_id].id < 0
+ || http_handles[handle_id].id != handle_id)
+ {
+ return FALSE;
+ }
+
+ if(session_id < 0 || session_id >= HTTP_SESSION_MAX
+ || http_handles[handle_id].session[session_id] == NULL
+ || http_handles[handle_id].session[session_id]->id != session_id)
+ {
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+static bool http_is_space_char(char ch)
+{
+ if(ch == ' ' || ch == '\r' || ch == '\t' || ch == '\n')
+ return TRUE;
+
+ return FALSE;
+}
+
+static bool http_str_empty(char *str)
+{
+ if(str == NULL || strlen(str) == 0)
+ return TRUE;
+
+ return FALSE;
+}
+
+
+static int http_url_parse
+(
+ void* url,
+ void *host,
+ void *uri,
+ int *port,
+ bool *is_ssl
+)
+{
+ if(strlen(url) == 0)
+ {
+ return -1;
+ }
+ char *url_ptr = (char*)url;
+ char *host_ptr = (char*)host;
+
+ RLOGD("URL[%d]:%s",strlen(url_ptr),url_ptr);
+
+ if(!memcmp(url_ptr,"https://",8))
+ {
+ *is_ssl = TRUE;
+ url_ptr += 8;
+ }
+ else if(!memcmp(url_ptr,"http://",7))
+ {
+ *is_ssl = FALSE;
+ url_ptr += 7;
+ }
+ else
+ {
+ *is_ssl = FALSE;
+ }
+
+ // ptr point to host.
+ while(*url_ptr)
+ {
+ if(*url_ptr == ':' || *url_ptr == '/') // Host end
+ break;
+ if(http_is_space_char(*url_ptr))
+ {
+ url_ptr++;
+ continue;
+ }
+ *host_ptr++ = *url_ptr++;
+ }
+
+ // "www.baidu.com"
+ if(*url_ptr == '\0') // No port and uri
+ {
+ if(*is_ssl)
+ {
+ *port = MBTK_HTTPS_PORT_DEF;
+ }
+ else
+ {
+ *port = MBTK_HTTP_PORT_DEF;
+ }
+ memcpy(uri,"/",1);
+
+ RLOGD("HTTP parse success:'%s','%s', %d, %d",(char*)host,(char*)uri,*port,*is_ssl);
+ return 0;
+ }
+ else
+ {
+ //LOGI("Host end with:%x",*url_ptr);
+ if(*url_ptr == ':') // Port exist.
+ {
+ *port = atoi(url_ptr + 1);
+
+ // Point to '/' or NULL
+ while(*url_ptr && *url_ptr != '/')
+ {
+ url_ptr++;
+ }
+
+ // "www.baidu.com:80"
+ if(*url_ptr == '\0') // No uri
+ {
+ if(*port == 0)
+ {
+ if(*is_ssl)
+ {
+ *port = MBTK_HTTPS_PORT_DEF;
+ }
+ else
+ {
+ *port = MBTK_HTTP_PORT_DEF;
+ }
+ }
+ memcpy(uri,"/",1);
+
+ RLOGD("HTTP parse success:'%s','%s', %d, %d",(char*)host,(char*)uri,*port,*is_ssl);
+ return 0;
+ }
+ }
+
+ // "www.baidu.com/xxx" or "www.baidu.com:80/xxx"
+ // Now,url_ptr point to '/'
+ if(*url_ptr != '/')
+ {
+ RLOGD("URI must start with '/'.");
+ return -1;
+ }
+
+ //LOGI("URL3[%d]:%s",strlen(url_ptr),url_ptr);
+
+ memcpy(uri,url_ptr,strlen(url_ptr));
+
+ if(*port == 0)
+ {
+ if(*is_ssl)
+ {
+ *port = MBTK_HTTPS_PORT_DEF;
+ }
+ else
+ {
+ *port = MBTK_HTTP_PORT_DEF;
+ }
+ }
+
+ RLOGD("HTTP parse success:'%s','%s', %d, %d",(char*)host,(char*)uri,*port,*is_ssl);
+ return 0;
+ }
+}
+
+static int http_session_req_head_add(mbtk_http_session_t *session,bool replace,
+ char *name, char *value)
+{
+ if(session == NULL || value == NULL)
+ return -1;
+
+ RLOGD("Add request header - %s:%s",name,value);
+
+ int i = 0;
+ while(i < HTTP_REQUEST_HEADER_MAX)
+ {
+ if(session->req.req_h[i]
+ && !strncasecmp(session->req.req_h[i]->name,name,strlen(name))) // Is change value
+ {
+ break;
+ }
+ i++;
+ }
+
+ if(i == HTTP_REQUEST_HEADER_MAX) // Should add new header.
+ {
+ i = 0;
+ while(i < HTTP_REQUEST_HEADER_MAX)
+ {
+ if(session->req.req_h[i] == NULL) // Find NULL request.
+ {
+ session->req.req_h[i] = (mbtk_http_header_t*)malloc(sizeof(mbtk_http_header_t));
+ if(session->req.req_h[i] == NULL)
+ {
+ RLOGD("malloc() fail.");
+ return -1;
+ }
+
+ memset(session->req.req_h[i],0x0,sizeof(mbtk_http_header_t));
+ memcpy(session->req.req_h[i]->name, name, strlen(name));
+ session->req.req_h[i]->value = NULL;
+ session->req.header_cnt++;
+ break;
+ }
+ i++;
+ }
+ }
+ else // Is change value
+ {
+ if(!replace)
+ {
+ RLOGD("Found this header[%s],no replace.",name);
+ return 0;
+ }
+ }
+
+ if(i == HTTP_REQUEST_HEADER_MAX)
+ {
+ RLOGD("Request header is full.");
+ return -1;
+ }
+
+ if(session->req.req_h[i]->value)
+ {
+ free(session->req.req_h[i]->value);
+ }
+ session->req.req_h[i]->value = (char*)malloc(strlen(value) + 1);
+ if(session->req.req_h[i]->value == NULL)
+ {
+ RLOGD("malloc() fail.");
+ return -1;
+ }
+ memset(session->req.req_h[i]->value,0x0,strlen(value) + 1);
+ memcpy(session->req.req_h[i]->value,value,strlen(value));
+
+ return 0;
+}
+
+#if 0
+static int http_session_rsp_head_add(mbtk_http_session_t *session,
+ char *name, char *value)
+{
+ if(session == NULL || value == NULL)
+ return -1;
+
+ int i = 0;
+ while(i < HTTP_REQUEST_HEADER_MAX)
+ {
+ if(session->rsp.rsp_h[i] == NULL) // Find NULL request.
+ {
+ session->rsp.rsp_h[i] = (mbtk_http_header_t*)malloc(sizeof(mbtk_http_header_t));
+ if(session->rsp.rsp_h[i] == NULL)
+ {
+ RLOGD("malloc() fail.");
+ return -1;
+ }
+
+ memcpy(session->rsp.rsp_h[i]->name,name,strlen(name));
+ session->rsp.rsp_h[i]->value = (char*)malloc(strlen(value) + 1);
+ if(session->rsp.rsp_h[i]->value == NULL)
+ {
+ RLOGD("malloc() fail.");
+ return -1;
+ }
+ memset(session->rsp.rsp_h[i]->value,0x0,strlen(value) + 1);
+ memcpy(session->rsp.rsp_h[i]->value,value,strlen(value));
+
+ session->rsp.header_cnt++;
+ return 0;
+ }
+ i++;
+ }
+
+ return -1;
+}
+#endif
+
+static char* http_option_str_get(mbtk_http_option_enum option)
+{
+ switch(option)
+ {
+ case HTTP_OPTION_HEAD:
+ return "HEAD";
+ case HTTP_OPTION_GET:
+ return "GET";
+ case HTTP_OPTION_POST:
+ return "POST";
+ case HTTP_OPTION_PUT:
+ return "PUT";
+ case HTTP_OPTION_DELETE:
+ return "DELETE";
+ case HTTP_OPTION_OPTIONS:
+ return "OPTIONS";
+ case HTTP_OPTION_TRACE:
+ return "TRACE";
+ case HTTP_OPTION_CONNECT:
+ return "CONNECT";
+ case HTTP_OPTION_LINK:
+ return "LINK";
+ case HTTP_OPTION_UNLINK:
+ return "UNLINK";
+ default:
+ return "";
+ }
+}
+
+static char* http_version_str_get(mbtk_http_version_enum version)
+{
+ switch(version)
+ {
+ case HTTP_VERSION_1_0:
+ return "1.0";
+ case HTTP_VERSION_1_1:
+ return "1.1";
+ case HTTP_VERSION_2:
+ return "2";
+ case HTTP_VERSION_3:
+ return "3";
+ default:
+ return "";
+ }
+}
+
+static char* http_header_find(mbtk_http_session_t *session,char* name)
+{
+ int i = 0;
+ while(i < HTTP_REQUEST_HEADER_MAX)
+ {
+ if(session->req.req_h[i] &&
+ !strncasecmp(session->req.req_h[i]->name,name,strlen(name)))
+ {
+ return session->req.req_h[i]->value;
+ }
+
+ i++;
+ }
+ return NULL;
+}
+
+static int http_header_str_get(mbtk_http_header_t *header,char *header_str,int header_str_len)
+{
+ if(header == NULL || header->value == NULL
+ || header_str == NULL)
+ return 0;
+
+ int len = 0;
+ len = snprintf(header_str,header_str_len,"%s: %s\r\n",
+ header->name, header->value);
+
+ return len;
+}
+
+static mbtk_http_version_enum http_version_get_by_str(char *version_str)
+{
+ if(!memcmp(version_str,"1.0",3))
+ return HTTP_VERSION_1_0;
+ else if(!memcmp(version_str,"1.1",3))
+ return HTTP_VERSION_1_1;
+ else if(!memcmp(version_str,"2",1))
+ return HTTP_VERSION_2;
+ else if(!memcmp(version_str,"3",1))
+ return HTTP_VERSION_3;
+ else
+ return HTTP_VERSION_1_1;
+}
+
+static int http_header_read(mbtk_http_session_t *session)
+{
+#define BUFFER_SIZE 2048
+ char line[BUFFER_SIZE];
+ char *ptr = NULL;
+ int len = 0;
+ while((len = mbtk_http_read_line(session->sock_fd,line,BUFFER_SIZE)) > 0)
+ {
+ if(!memcmp(line,"\r\n",2))
+ {
+ RLOGD("Read empty line.");
+ break;
+ }
+
+ // Delete "\r\n"
+ ptr = line + len - 1; // Point to last char.
+ while(http_is_space_char(*ptr))
+ {
+ *ptr = '\0';
+ len--;
+ ptr--;
+ }
+
+ RLOGD("LINE:%s",line);
+
+ if(http_handles[session->handle_id].show_rsp_header &&
+ http_handles[session->handle_id].data_cb)
+ {
+ http_handles[session->handle_id].data_cb(session->id,
+ MBTK_HTTP_DATA_HEADER,line,len);
+ }
+
+ if(!memcmp(line,"HTTP/",5)) // "HTTP/1.1 200 OK"
+ {
+ session->rsp.state_code = atoi(line + 9);
+ session->rsp.version = http_version_get_by_str(line + 5);
+ }
+ else // Is response header item.
+ {
+ if(!strncasecmp(line,"Content-Length",14))
+ {
+ ptr = line + 14;
+ while(ptr && !isdigit(*ptr))
+ {
+ ptr++;
+ }
+
+ if(ptr)
+ {
+ session->rsp.content_length = atol(ptr);
+ }
+ }
+ else if(!strncasecmp(line,"Transfer-Encoding",17))
+ {
+ ptr = line + 17;
+ while(ptr && !isalpha(*ptr))
+ {
+ ptr++;
+ }
+
+ if(ptr && !memcmp(ptr,"chunked",7))
+ {
+ session->rsp.is_chunked = TRUE;
+ }
+ }
+ }
+ }
+#undef BUFFER_SIZE
+
+ RLOGD("RSP:HTTP/%s %d, is_chunked:%d,Content-Length:%d",http_version_str_get(session->rsp.version),
+ session->rsp.state_code,session->rsp.is_chunked,session->rsp.content_length);
+
+ return 0;
+}
+
+static int http_session_start_write(mbtk_http_session_t *session)
+{
+ RLOGD("Start HTTP write.");
+
+#define BUFFER_SIZE 1024
+ session->state = HTTP_SESSION_STATE_WRITE_HEADER;
+ char buff[BUFFER_SIZE];
+ int len = 0;
+ int index = 0;
+ len += snprintf(buff + len,BUFFER_SIZE - len,"%s %s HTTP/%s\r\n",
+ http_option_str_get(session->option),
+ session->uri,
+ http_version_str_get(session->version));
+
+ // if no set "Host",should set default host.
+ char *host = http_header_find(session,"Host");
+ if(!host)
+ {
+ len += snprintf(buff + len,BUFFER_SIZE - len,"Host: %s\r\n", session->host);
+ }
+
+ if(mbtk_http_write(session->sock_fd,buff,len) != len)
+ {
+ RLOGD("mbtk_http_write() fail.");
+ return -1;
+ }
+
+ char header_str[BUFFER_SIZE];
+ int header_str_len = 0;
+ while(index < HTTP_REQUEST_HEADER_MAX)
+ {
+ if(session->req.req_h[index] &&
+ (header_str_len = http_header_str_get(session->req.req_h[index], header_str, BUFFER_SIZE)) > 0)
+ {
+ if(mbtk_http_write(session->sock_fd,header_str,header_str_len) != header_str_len)
+ {
+ RLOGD("mbtk_http_write() fail.");
+ return -1;
+ }
+ }
+ index++;
+ }
+
+ // Write request header success.
+ RLOGD("HTTP write header complete.");
+
+#undef BUFFER_SIZE
+
+ // Write "\r\n"
+ if(mbtk_http_write(session->sock_fd,"\r\n",2) != 2)
+ {
+ RLOGD("mbtk_http_write() fail.");
+ return -1;
+ }
+
+ RLOGD("Start write HTTPsession->option. %d", session->option);
+ if(session->option == HTTP_OPTION_POST)
+ {
+ session->state = HTTP_SESSION_STATE_WRITE_CONTENT;
+ RLOGD("Start write HTTP content data.");
+
+ if(session->req.content && session->req.content_len > 0)
+ {
+ if(mbtk_http_write(session->sock_fd,session->req.content,session->req.content_len) != session->req.content_len)
+ {
+ RLOGD("mbtk_http_write() fail.");
+ return -1;
+ }
+
+ session->state = HTTP_SESSION_STATE_WRITE_END;
+ }
+ }
+ else
+ {
+ session->state = HTTP_SESSION_STATE_WRITE_END;
+
+ RLOGD("HTTP write complete.");
+ }
+ return 0;
+}
+
+/*static int http_session_read_by_chunk(mbtk_http_session_t *session)
+{
+#undef BUFFER_SIZE
+#define BUFFER_SIZE 2048
+ http_chunk_code chunk_code;
+ http_chunker_t chunker;
+ char read_buf[BUFFER_SIZE + 1];
+ int read_len = 0;
+ char chunk_buf[BUFFER_SIZE + 1];
+ int chunk_len;
+ http_chunk_init(&chunker);
+ while(TRUE)
+ {
+ read_len = mbtk_http_read(session->sock_fd,read_buf,BUFFER_SIZE,3000);
+ //read_len = mbtk_http_read_line(session->sock_file,read_buf,BUFFER_SIZE);
+ if(read_len <= 0)
+ {
+ RLOGD("Read fail.");
+ return -1;
+ }
+
+ chunk_code = http_chunk_parse(&chunker, read_buf, read_len, chunk_buf, &chunk_len);
+ if(chunk_code > CHUNKE_OK) // Fail.
+ {
+ RLOGD("http_chunk_parse() fail[err - %d].",chunk_code);
+ return -1;
+ }
+
+ RLOGD("Read chunk_len:%d",chunk_len);
+ chunk_buf[chunk_len] = '\0';
+
+ if(http_handles[session->handle_id].data_cb)
+ http_handles[session->handle_id].data_cb(session->id,
+ MBTK_HTTP_DATA_CONTENT,chunk_buf,chunk_len);
+
+ if(CHUNKE_STOP == chunk_code)
+ {
+ if(http_handles[session->handle_id].data_cb)
+ http_handles[session->handle_id].data_cb(session->id,
+ MBTK_HTTP_DATA_COMPLETE,NULL,0);
+
+ break;
+ }
+ }
+
+ RLOGD("Chunk read success.");
+
+ return 0;
+}*/
+
+static int http_session_read_by_length(mbtk_http_session_t *session)
+{
+#undef BUFFER_SIZE
+#define BUFFER_SIZE 2048
+ char read_buf[BUFFER_SIZE + 1];
+ int read_len = 0;
+ int64 read_count = 0;
+ while(TRUE)
+ {
+ memset(read_buf,0x0,BUFFER_SIZE + 1);
+ read_len = mbtk_http_read(session->sock_fd,read_buf,BUFFER_SIZE,3000);
+ if(read_len <= 0)
+ {
+ RLOGD("Read fail.");
+ return -1;
+ }
+
+ if(read_count + read_len >= session->rsp.content_length) // Read data complete.
+ {
+ if(http_handles[session->handle_id].data_cb)
+ {
+ http_handles[session->handle_id].data_cb(session->id,
+ MBTK_HTTP_DATA_CONTENT,read_buf,session->rsp.content_length - read_count);
+
+ http_handles[session->handle_id].data_cb(session->id,
+ MBTK_HTTP_DATA_COMPLETE,NULL,0);
+ }
+ break;
+ }
+
+ if(http_handles[session->handle_id].data_cb)
+ http_handles[session->handle_id].data_cb(session->id,
+ MBTK_HTTP_DATA_CONTENT,read_buf,read_len);
+
+ read_count += read_len;
+ }
+
+ return 0;
+}
+
+static int http_session_read_by_general(mbtk_http_session_t *session)
+{
+#undef BUFFER_SIZE
+#define BUFFER_SIZE 2048
+ char read_buf[BUFFER_SIZE + 1];
+ int read_len = 0;
+ while(TRUE)
+ {
+ read_len = mbtk_http_read(session->sock_fd,read_buf,BUFFER_SIZE,1000);
+ if(read_len <= 0)
+ {
+ if(read_len == -2 || read_len == 0) // Timeout or end
+ break;
+
+ RLOGD("Read end[read_len - %d].",read_len);
+ //return -1;
+ break;
+ }
+
+ read_buf[read_len] = '\0';
+
+ if(http_handles[session->handle_id].data_cb)
+ http_handles[session->handle_id].data_cb(session->id,
+ MBTK_HTTP_DATA_CONTENT,read_buf,read_len);
+ }
+
+ if(http_handles[session->handle_id].data_cb)
+ http_handles[session->handle_id].data_cb(session->id,
+ MBTK_HTTP_DATA_COMPLETE,NULL,0);
+
+ return 0;
+}
+
+static int http_session_start_read(mbtk_http_session_t *session)
+{
+ RLOGD("Start HTTP read.");
+ int result = 0;
+// usleep(500000);
+ session->state = HTTP_SESSION_STATE_READ_HEADER;
+ if(http_header_read(session))
+ {
+ result = -1;
+ goto read_end;
+ }
+
+ if(session->option != HTTP_OPTION_HEAD)
+ {
+ session->state = HTTP_SESSION_STATE_READ_CONTENT;
+ /*if(session->rsp.is_chunked)
+ {
+ if(http_session_read_by_chunk(session))
+ {
+ result = -1;
+ goto read_end;
+ }
+ }*/
+ if(session->rsp.content_length > 0)
+ {
+ if(http_session_read_by_length(session))
+ {
+ result = -1;
+ goto read_end;
+ }
+ }
+ else
+ {
+ if(http_session_read_by_general(session))
+ {
+ result = -1;
+ goto read_end;
+ }
+ }
+ }
+ else
+ {
+ if(http_handles[session->handle_id].data_cb)
+ http_handles[session->handle_id].data_cb(session->id,
+ MBTK_HTTP_DATA_COMPLETE,NULL,0);
+ }
+
+read_end:
+ session->state = HTTP_SESSION_STATE_READ_END;
+
+ RLOGD("HTTP request complete[result - %d].",result);
+ if(http_session_close(session))
+ {
+ return -1;
+ }
+
+#if 0
+ // Free session after HTTP request complete.
+ http_session_free(session);
+ http_handles[handle_id].session[session_id] = NULL;
+ http_handles[handle_id].session_cnt--;
+#endif
+
+ return result;
+}
+
+static bool http_session_req_check(mbtk_http_session_t *session)
+{
+ if(session == NULL || session->port == 0 ||
+ strlen(session->host) == 0)
+ {
+ RLOGD("Session not set host or port.");
+ return FALSE;
+ }
+
+ if(session->option != HTTP_OPTION_HEAD &&
+ session->option != HTTP_OPTION_POST &&
+ session->option != HTTP_OPTION_GET)
+ {
+ RLOGD("Only support HEAD/GET/POST");
+ return FALSE;
+ }
+
+#if 0
+ if(session->version != HTTP_VERSION_1_0 &&
+ session->version != HTTP_VERSION_1_1)
+ {
+ RLOGD("Only support HTTP 1.0/1.1");
+ return FALSE;
+ }
+#endif
+
+ if(session->option == HTTP_OPTION_POST)
+ {
+ char *value = NULL;
+ value = http_header_find(session, "Content-Length");
+ if(!value)
+ {
+ RLOGD("POST must set 'Content-Length'");
+ return FALSE;
+ }
+ if(session->req.content_len != atoi(value))
+ {
+ RLOGD("POST 'Content-Length' error.");
+ return FALSE;
+ }
+
+ value = http_header_find(session, "Content-Type");
+ if(!value)
+ {
+ RLOGD("POST must set 'Content-Type'");
+ return FALSE;
+ }
+ }
+
+ return TRUE;
+}
+
+
+/*************************************************************
+ Public Function Definitions
+*************************************************************/
+int mbtk_http_handle_get(bool show_rsp_header,mbtk_http_data_callback_func data_cb)
+{
+ int index = 0;
+ int i = 0;
+ for(; index < HTTP_HANDLE_MAX; index++)
+ {
+ if(http_handles[index].id < 0) // Find free handle
+ {
+ break;
+ }
+ }
+
+ if(index == HTTP_HANDLE_MAX)
+ {
+ RLOGD("HTTP Handle is full.");
+ return -1;
+ }
+
+ memset(&(http_handles[index]),0x0,sizeof(mbtk_http_handle_t));
+ http_handles[index].id = index;
+ http_handles[index].show_rsp_header = show_rsp_header;
+ http_handles[index].data_cb = data_cb;
+ http_handles[index].session_cnt = 0;
+ for(i = 0; i < HTTP_SESSION_MAX; i++)
+ {
+ http_handles[index].session[i] = NULL;
+ }
+
+ if(mbtk_http_init())
+ {
+ RLOGD("mbtk_http_init() fail.");
+ return -1;
+ }
+
+ return http_handles[index].id;
+}
+
+int mbtk_http_handle_free(int handle_id)
+{
+ int i = 0;
+ if(!http_handle_check(handle_id))
+ {
+ RLOGD("Handle error.");
+ return -1;
+ }
+
+ http_handles[handle_id].id = -1;
+ http_handles[handle_id].data_cb = NULL;
+ if(http_handles[handle_id].session_cnt > 0)
+ {
+ for(i = 0; i < HTTP_SESSION_MAX; i++)
+ {
+ if(http_handles[handle_id].session[i] != NULL)
+ {
+ if(http_handles[handle_id].session[i]->state != HTTP_SESSION_STATE_NON)
+ {
+ if(http_session_close(http_handles[handle_id].session[i]))
+ {
+ return -1;
+ }
+ }
+
+ http_session_free(http_handles[handle_id].session[i]);
+ http_handles[handle_id].session[i] = NULL;
+ }
+ }
+
+ http_handles[handle_id].session_cnt = 0;
+ }
+
+ if(mbtk_http_deinit())
+ {
+ RLOGD("mbtk_http_deinit() fail.");
+ return -1;
+ }
+
+ return 0;
+}
+
+int mbtk_http_session_create(int handle_id, mbtk_http_option_enum option,
+ mbtk_http_version_enum version)
+{
+ int handle_index = 0;
+ int session_index = 0;
+ if(!http_handle_check(handle_id))
+ {
+ RLOGD("Handle error.");
+ return -1;
+ }
+
+ for(; handle_index < HTTP_HANDLE_MAX; handle_index++)
+ {
+ if(http_handles[handle_index].id == handle_id) // Find handle
+ {
+ break;
+ }
+ }
+
+ if(handle_index == HTTP_HANDLE_MAX)
+ {
+ RLOGD("No found handle[handle - %d].",handle_id);
+ return -1;
+ }
+
+ if(http_handles[handle_index].session_cnt >= HTTP_SESSION_MAX)
+ {
+ RLOGD("Session is full.");
+ return -1;
+ }
+
+ for(; session_index < HTTP_SESSION_MAX; session_index++)
+ {
+ if(http_handles[handle_index].session[session_index] == NULL) // Find first NULL session
+ {
+ break;
+ }
+ }
+
+ if(session_index == HTTP_SESSION_MAX)
+ {
+ RLOGD("Session is full.");
+ return -1;
+ }
+
+ mbtk_http_session_t* session = (mbtk_http_session_t*)malloc(sizeof(mbtk_http_session_t));
+ if(session == NULL)
+ {
+ RLOGD("malloc() fail.");
+ return -1;
+ }
+ memset(session,0x0,sizeof(mbtk_http_session_t));
+ session->sock_fd = -1;
+ session->sock_file = NULL;
+ session->handle_id = handle_id;
+ session->id = session_index;
+ session->state = HTTP_SESSION_STATE_NON;
+ session->is_ssl = FALSE;
+ session->version = version;
+ session->option = option;
+ session->req.content_len = 0;
+ session->req.content_len_send = 0;
+ session->rsp.is_chunked = FALSE;
+ session->rsp.content_length = 0;
+ session->rsp.header_cnt = 0;
+ http_handles[handle_index].session[session_index] = session;
+ http_handles[handle_index].session_cnt++;
+
+ return session->id;
+}
+
+int mbtk_http_session_option_reset(int handle_id, int session_id, mbtk_http_option_enum option)
+{
+ if(!http_session_check(handle_id,session_id))
+ {
+ RLOGD("Session error.");
+ return -1;
+ }
+
+ mbtk_http_session_t *session = http_handles[handle_id].session[session_id];
+ if(session->state != HTTP_SESSION_STATE_NON)
+ {
+ RLOGD("Session state error.[%d]",session->state);
+ return -1;
+ }
+
+ session->option = option;
+ return 0;
+}
+
+int mbtk_http_session_free(int handle_id,int session_id)
+{
+ if(!http_session_check(handle_id,session_id))
+ {
+ RLOGD("Session error.");
+ return -1;
+ }
+
+ mbtk_http_session_t *session = http_handles[handle_id].session[session_id];
+ if(session->state != HTTP_SESSION_STATE_NON)
+ {
+ if(http_session_close(session))
+ {
+ return -1;
+ }
+ }
+
+ http_session_free(session);
+ http_handles[handle_id].session[session_id] = NULL;
+ http_handles[handle_id].session_cnt--;
+ return 0;
+}
+
+int mbtk_http_session_url_set(int handle_id,int session_id,void *url)
+{
+ if(!http_session_check(handle_id,session_id))
+ {
+ RLOGD("Session error.");
+ return -1;
+ }
+
+ mbtk_http_session_t *session = http_handles[handle_id].session[session_id];
+ if(session->state == HTTP_SESSION_STATE_NON)
+ return http_url_parse(url, session->host,session->uri,&(session->port),&(session->is_ssl));
+ else
+ {
+ RLOGD("Currenr session is process[state - %d].",session->state);
+ return -1;
+ }
+}
+
+int mbtk_http_session_head_add(int handle_id,int session_id,
+ char *name, char *value)
+{
+ if(!http_session_check(handle_id,session_id))
+ {
+ RLOGD("Session error.");
+ return -1;
+ }
+
+ if(http_str_empty(name) || http_str_empty(value))
+ {
+ RLOGD("Param error.");
+ return -1;
+ }
+
+ mbtk_http_session_t *session = http_handles[handle_id].session[session_id];
+ if(session->state == HTTP_SESSION_STATE_NON)
+ {
+ int result = http_session_req_head_add(session,TRUE,name,value);
+ if(!result && !strncasecmp(name,"Content-Length",14))
+ {
+ session->req.content_len = atoi(value);
+ }
+ return result;
+ }
+ else
+ {
+ RLOGD("Currenr session is process[state - %d].",session->state);
+ return -1;
+ }
+}
+
+int mbtk_http_session_content_set(int handle_id,int session_id,
+ char *content,uint32 content_len)
+{
+ if(!http_session_check(handle_id,session_id))
+ {
+ RLOGD("Session error.");
+ return -1;
+ }
+
+ if(content_len <= 0 || content_len > HTTP_CONTENT_LEN_MAX)
+ {
+ RLOGD("Content lenght error[%d].",content_len);
+ return -1;
+ }
+
+ mbtk_http_session_t *session = http_handles[handle_id].session[session_id];
+ if(session->state == HTTP_SESSION_STATE_NON)
+ {
+ if(session->option != HTTP_OPTION_POST)
+ {
+ RLOGD("Content only for post.");
+ return -1;
+ }
+
+ if(session->req.content)
+ {
+ free(session->req.content);
+ session->req.content_len = 0;
+ }
+
+ session->req.content = (char*)malloc(content_len);
+ if(session->req.content == NULL)
+ {
+ RLOGD("malloc() fail.");
+ return -1;
+ }
+
+ char *content_type = NULL;
+ if(strlen(content) == content_len) //
+ {
+ content_type = "text/plain";
+ }
+ else
+ {
+ content_type = "application/octet-stream";
+ }
+
+ if(http_session_req_head_add(session, FALSE, "Content-Type", content_type))
+ {
+ RLOGD("Set 'Content-Type' fail.");
+ return -1;
+ }
+
+ memcpy(session->req.content,content,content_len);
+ session->req.content_len = content_len;
+
+ char len_str[20] = {0};
+ snprintf(len_str,20,"%d",content_len);
+ if(http_session_req_head_add(session,FALSE,"Content-Length",len_str))
+ {
+ RLOGD("Set 'Content-Length' fail.");
+ return -1;
+ }
+
+
+ return 0;
+ }
+ else
+ {
+ RLOGD("Currenr session is process[state - %d].",session->state);
+ return -1;
+ }
+}
+
+int mbtk_http_session_start(int handle_id,int session_id)
+{
+ if(!http_session_check(handle_id,session_id))
+ {
+ printf("Session error.");
+ return -1;
+ }
+
+ mbtk_http_session_t *session = http_handles[handle_id].session[session_id];
+ if(session->state == HTTP_SESSION_STATE_NON)
+ {
+ if(!http_session_req_check(session))
+ {
+ printf("http_session_req_check() fail.");
+ return -1;
+ }
+
+ // Must set "Connection" for post.
+ if(session->option == HTTP_OPTION_POST)
+ {
+ if(http_session_req_head_add(session,FALSE,"Connection","KeepAlive"))
+ {
+ printf("Set 'Content-Length' fail.");
+ return -1;
+ }
+ }
+
+ printf("HTTP request start.\n");
+ printf("host:%s\n, port:%d\n, uri:%s\n",session->host,session->port,session->uri);
+ printf("is_ssl:%d\n, version:%d\n, option:%d\n, content_len:%d\n",session->is_ssl,
+ session->version,session->option,session->req.content_len);
+
+ int sock_fd = mbtk_http_open(session->host,&(session->port));//session->is_ssl,TRUE,
+ if(sock_fd < 0)
+ {
+ printf("open fail\n");
+ return -1;
+ }
+ session->sock_fd = sock_fd;
+// int fd = mbtk_sock_fd_get(sock_fd);
+// if(fd < 0) {
+// LOGE("mbtk_sock_fd_get() fail.");
+// return -1;
+// }
+ // session->sock_file = fdopen(sock_fd,"r");
+ session->state = HTTP_SESSION_STATE_CONN;
+
+// if(!session->sock_file) {
+// LOGE("fdopen() fail.");
+// return -1;
+// }
+
+ printf("HTTP connected.");
+
+ if(http_session_start_write(session))
+ {
+ return -1;
+ }
+
+ if(session->state == HTTP_SESSION_STATE_WRITE_END)
+ {
+ if(http_session_start_read(session))
+ {
+ return -1;
+ }
+ }
+ else
+ {
+ printf("Waitting post content data...");
+ }
+
+ return 0;
+ }
+ else
+ {
+ printf("Currenr session is process[state - %d].",session->state);
+ return -1;
+ }
+}
+
+int mbtk_http_session_content_send(int handle_id,int session_id,
+ char *data,int data_len)
+{
+ if(!http_session_check(handle_id,session_id))
+ {
+ RLOGD("Session error.");
+ return -1;
+ }
+
+ if(data_len <= 0 || data_len > HTTP_CONTENT_LEN_MAX)
+ {
+ RLOGD("Content lenght error[%d].",data_len);
+ return -1;
+ }
+
+ RLOGD("Post send:%d - %s",data_len,data);
+
+ mbtk_http_session_t *session = http_handles[handle_id].session[session_id];
+ if(session->state == HTTP_SESSION_STATE_WRITE_CONTENT)
+ {
+ if(session->option != HTTP_OPTION_POST)
+ {
+ RLOGD("Content only for post.");
+ return -1;
+ }
+
+ if(session->req.content || session->req.content_len <= 0)
+ {
+ RLOGD("This post not spit package.");
+ return -1;
+ }
+
+ // Discard excess data.
+ if(session->req.content_len_send + data_len > session->req.content_len)
+ data_len = session->req.content_len - session->req.content_len_send;
+
+ if(data_len != mbtk_http_write(session->sock_fd,data,data_len))
+ {
+ return -1;
+ }
+
+ session->req.content_len_send += data_len;
+
+ RLOGD("HTTP post data send: %d / %d",session->req.content_len_send,
+ session->req.content_len);
+
+ // Post data send complete.
+ if(session->req.content_len_send >= session->req.content_len)
+ {
+ session->state = HTTP_SESSION_STATE_WRITE_END;
+
+ RLOGD("HTTP write complete.");
+ if(http_session_start_read(session))
+ {
+ return -1;
+ }
+ }
+
+ return 0;
+ }
+ else
+ {
+ RLOGD("Currenr session state error[%d].",session->state);
+ return -1;
+ }
+}
+
+const mbtk_http_session_t* mbtk_http_session_get(int handle_id,int session_id)
+{
+ if(!http_session_check(handle_id,session_id))
+ {
+ RLOGD("Session error.");
+ return NULL;
+ }
+
+ return http_handles[handle_id].session[session_id];
+}
+
+#ifdef __cplusplus
+}
+#endif
\ No newline at end of file
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/src/mbtk_http_base.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/src/mbtk_http_base.cpp
new file mode 100755
index 0000000..607a199
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-gnss/src/mbtk_http_base.cpp
@@ -0,0 +1,240 @@
+#include <sys/epoll.h>
+#include <string.h>
+#include <log/log.h>
+#include <liblog/lynq_deflog.h>
+//#include "mbtk_log.h"
+#include "mbtk_http_base.h"
+#include "mbtk_http.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+static bool http_sock_inited = FALSE;
+static int http_handle = -1;
+static int http_fd = -1;
+//static void http_sock_cb_func(int handle, int fd, int event);
+
+/*static mbtk_init_info =
+{
+ MBTK_NET_LINUX,
+ NULL,
+ http_sock_cb_func
+} http_init_info;*/
+
+
+
+/*static void http_sock_cb_func(int handle, int fd, int event)
+{
+ if(http_handle == handle && http_fd == fd) {
+ if(event & EPOLLIN) { // READ
+
+ } else if(event & EPOLLRDHUP) { // Close
+
+ } else {
+ RLOGD("Unknown event:%x",event);
+ }
+ }
+}*/
+
+int mbtk_sock_open()
+{
+
+ return 0;
+}
+
+int mbtk_http_init()
+{
+ if(http_sock_inited) {
+ RLOGD("HTTP has inited.");
+ return -1;
+ }
+
+ http_handle = socket(AF_INET,SOCK_STREAM,0);
+ if(http_handle < 0)
+ {
+ RLOGD("mbtk_sock_init() fail.");
+ return -1;
+ }
+
+ http_sock_inited = TRUE;
+ return 0;
+}
+
+int mbtk_http_deinit()
+{
+ if(!http_sock_inited) {
+ RLOGD("HTTP not inited.");
+ return -1;
+ }
+
+ close(http_handle);
+ http_handle = -1;
+ http_sock_inited = FALSE;
+ return 0;
+}
+
+
+int mbtk_http_open
+(
+ const void *host,
+ int *port
+)
+{
+ struct addrinfo server;
+ struct addrinfo* serverInfo;
+ int ret;
+
+ server.ai_family = AF_INET;
+ server.ai_socktype = SOCK_STREAM;
+ server.ai_protocol = IPPROTO_TCP;
+ server.ai_flags = AI_PASSIVE;
+ char portStr[6];
+ snprintf(portStr, sizeof(portStr), "%d", *port);
+ memset(&server, 0, sizeof(server));
+ ret = getaddrinfo(host, portStr, &server, &serverInfo);
+ if (ret != 0)
+ {
+ printf("ret = %s\n",gai_strerror(ret));
+ printf("getaddrinfo error: \n");
+ return -1;
+ }
+ ret = connect(http_handle, serverInfo->ai_addr, serverInfo->ai_addrlen);
+ if(ret < 0)
+ {
+ printf("connect fail http_handle:%d\n",http_handle);
+ close(http_handle);
+ freeaddrinfo(serverInfo);
+ return -1;
+ }
+ printf("http_handle: %d\n",http_handle);
+ return http_handle;
+}
+
+/*=============================================
+FUNCTION
+ mbtk_http_read
+
+DESCRIPTION
+ read content from socket.
+
+DEPENDENCIES
+ None
+
+PARAMETERS
+ *buf Store read content.
+ len the length of Content.
+ timeout Set timeout
+
+RETURN VALUE
+ Length of read content
+
+SIDE EFFECTS
+ None
+=============================================*/
+int mbtk_http_read
+(
+ int sock_fd,
+ void *buf,
+ uint16_t len,
+ int timeout_ms
+)
+{
+ sleep(timeout_ms / 1000);
+ int read_len = recv(sock_fd, buf, len, 0);
+ if(read_len < 0)
+ {
+ return -1;
+ }
+ else
+ {
+ return read_len;
+ }
+}
+
+
+int mbtk_http_read_line
+(
+ int sock_fd,
+ void *buf,
+ uint16_t len
+)
+{
+ if(sock_fd > 0) {
+ char *buf_ptr = (char*)buf;
+ char read_buf[1];
+ int read_len = 0;
+ while(TRUE) {
+ if(recv(sock_fd, read_buf, 1, 0) == 1) {
+ *buf_ptr++ = read_buf[0];
+ read_len++;
+
+ if(read_buf[0] == '\n' || read_len >= len) {
+ return read_len;
+ }
+ } else {
+ return -1;
+ }
+ }
+ }
+
+
+ return -1;
+}
+
+
+/*=============================================
+FUNCTION
+ mbtk_http_write
+
+DESCRIPTION
+ Write content to socket.
+
+DEPENDENCIES
+ None
+
+PARAMETERS
+ *buf Content to be transferred
+ len the length of Content.
+
+RETURN VALUE
+ Length of written content
+
+SIDE EFFECTS
+ None
+=============================================*/
+int mbtk_http_write(int sock_fd, void *buf, uint16_t len)
+{
+ RLOGD("Write[%d]:%s",len,(char*)buf);
+ return send(sock_fd, buf, len, 0);
+}
+
+/*=============================================
+FUNCTION
+ mbtk_http_close
+
+DESCRIPTION
+ close HTTP service.
+
+DEPENDENCIES
+ None
+
+PARAMETERS
+ *err Error number
+
+RETURN VALUE
+ TURE or FALSE
+
+SIDE EFFECTS
+ None
+=============================================*/
+int mbtk_http_close(int sock_fd)
+{
+
+ close(sock_fd);
+ sock_fd = -1;
+ return 0;
+}
+
+#ifdef __cplusplus
+}
+#endif
\ No newline at end of file
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-network/include/lynq_qser_network.h b/cap/zx297520v3/src/lynq/lib/liblynq-qser-network/include/lynq_qser_network.h
index b65e428..0e571fa 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-qser-network/include/lynq_qser_network.h
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-network/include/lynq_qser_network.h
@@ -35,6 +35,35 @@
E_QSER_NW_ROAM_STATE_TYPE_T roaming_pref; /**< Roaming preference.*/
}QSER_NW_CONFIG_INFO_T;
+/** Configures the OOS (out of service) settings that define the MCM network interface. */
+#define QSER_NW_OOS_CFG_TYPE_FAST_SCAN 0x00 /**< fast net scan */
+#define QSER_NW_OOS_CFG_TYPE_FULL_BAND_SCAN 0x01 /**< full band scan */
+
+typedef struct
+{
+ /* Configuration parameters for MCM network fast network scan when OOS (out of service)*/
+ char enable;
+ uint16_t time_interval;
+}QSER_NW_OOS_CONFIG_FAST_SCAN_INFO_T;
+
+typedef struct
+{
+ /* Configuration parameters for MCM network full band network scan when OOS (out of service)*/
+ int t_min;
+ int t_step;
+ int t_num;
+ int t_max;
+}QSER_NW_OOS_CONFIG_FULL_BAND_SCAN_INFO_T;
+
+
+typedef struct
+{
+ char type; /**< QSER_NW_OOS_CFG_TYPE_xxxx.*/
+ union {
+ QSER_NW_OOS_CONFIG_FAST_SCAN_INFO_T fast_can_info; // 00
+ QSER_NW_OOS_CONFIG_FULL_BAND_SCAN_INFO_T full_band_scan_info; // 01
+ } u;
+}QSER_NW_OOS_CONFIG_INFO_T;
//defined for QSER_NW_EventRegister
#define NW_IND_VOICE_REG_EVENT_IND_FLAG (1 << 0) /**< msg format : QSER_NW_VOICE_REG_EVENT_IND_T */
@@ -346,6 +375,18 @@
QSER_NW_CONFIG_INFO_T *pt_info
);
+int qser_nw_set_oos_config
+(
+ nw_client_handle_type h_nw,
+ QSER_NW_OOS_CONFIG_INFO_T *pt_info
+);
+
+int qser_nw_get_oos_config
+(
+ nw_client_handle_type h_nw,
+ QSER_NW_OOS_CONFIG_INFO_T *pt_info
+);
+
int qser_nw_event_register
(
nw_client_handle_type h_nw,
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-qser-network/lynq_qser_network.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-qser-network/lynq_qser_network.cpp
index 0a32515..b1539a7 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-qser-network/lynq_qser_network.cpp
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-qser-network/lynq_qser_network.cpp
@@ -273,6 +273,101 @@
return RESULT_OK;
}
+int qser_nw_set_oos_config( nw_client_handle_type h_nw,QSER_NW_OOS_CONFIG_INFO_T *pt_info
+)
+{
+ if(NULL == pt_info)
+ {
+ LYERRLOG("invalid client parameters incoming");
+ return RESULT_ERROR;
+ }
+
+ if(h_nw != g_ph_hw || h_nw == INVALID_CLIENT_HANDLE)
+ {
+ LYERRLOG("h_nw not right %d %d",h_nw,g_ph_hw);
+ return RESULT_ERROR;
+ }
+
+ int config_list[MAX_OOS_CFG_ITEM_NUMBER];
+ int valid_num;
+
+ if(pt_info->type==QSER_NW_OOS_CFG_TYPE_FAST_SCAN)
+ {
+ config_list[0]=QSER_NW_OOS_CFG_TYPE_FAST_SCAN;
+ config_list[1]=pt_info->u.fast_can_info.enable;
+ config_list[2]=pt_info->u.fast_can_info.time_interval;
+ return lynq_set_oos_net_scan_cfg(config_list, 3);
+ }
+ else if(pt_info->type==QSER_NW_OOS_CFG_TYPE_FULL_BAND_SCAN)
+ {
+ config_list[0]=QSER_NW_OOS_CFG_TYPE_FULL_BAND_SCAN;
+ config_list[1]=pt_info->u.full_band_scan_info.t_min;
+ config_list[2]=pt_info->u.full_band_scan_info.t_step;
+ config_list[3]=pt_info->u.full_band_scan_info.t_num;
+ config_list[4]=pt_info->u.full_band_scan_info.t_max;
+ return lynq_set_oos_net_scan_cfg(config_list, 5);
+ }
+ else
+ {
+ LYERRLOG("invalid client parameters %d incoming", pt_info->type);
+ return RESULT_ERROR;
+ }
+}
+
+int qser_nw_get_oos_config( nw_client_handle_type h_nw, QSER_NW_OOS_CONFIG_INFO_T *pt_info)
+{
+ if(NULL == pt_info)
+ {
+ LYERRLOG("invalid client parameters incoming");
+ return RESULT_ERROR;
+ }
+
+ if(h_nw != g_ph_hw || h_nw == INVALID_CLIENT_HANDLE)
+ {
+ LYERRLOG("h_nw not right %d %d",h_nw,g_ph_hw);
+ return RESULT_ERROR;
+ }
+
+ int config_list[MAX_OOS_CFG_ITEM_NUMBER];
+ int valid_num;
+ int ret;
+
+ if(pt_info->type==QSER_NW_OOS_CFG_TYPE_FAST_SCAN)
+ {
+ config_list[0]=QSER_NW_OOS_CFG_TYPE_FAST_SCAN;
+ ret=lynq_get_oos_net_scan_cfg(config_list, &valid_num);
+ if(ret==RESULT_OK || valid_num > 1)
+ {
+ pt_info->u.fast_can_info.enable=config_list[0];
+ pt_info->u.fast_can_info.time_interval=config_list[1];
+ return RESULT_OK;
+ }
+ LYERRLOG("type %d invalid return value %d %d",pt_info->type,ret,valid_num);
+ return RESULT_ERROR;
+ }
+ else if(pt_info->type==QSER_NW_OOS_CFG_TYPE_FULL_BAND_SCAN)
+ {
+ config_list[0]=QSER_NW_OOS_CFG_TYPE_FULL_BAND_SCAN;
+ ret=lynq_get_oos_net_scan_cfg(config_list, &valid_num);
+ if(ret==RESULT_OK || valid_num > 3)
+ {
+ pt_info->u.full_band_scan_info.t_min=config_list[0];
+ pt_info->u.full_band_scan_info.t_step=config_list[1];
+ pt_info->u.full_band_scan_info.t_num=config_list[2];
+ pt_info->u.full_band_scan_info.t_max=config_list[3];
+ return RESULT_OK;
+ }
+ LYERRLOG("type %d invalid return value %d %d",pt_info->type,ret,valid_num);
+ return RESULT_ERROR;
+ }
+ else
+ {
+ LYERRLOG("invalid client parameters %d incoming", pt_info->type);
+ return RESULT_ERROR;
+ }
+
+}
+
/*To Do*/
int qser_nw_event_register(nw_client_handle_type h_nw,uint32_t bitmask)
{
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-sim/makefile b/cap/zx297520v3/src/lynq/lib/liblynq-sim/makefile
index 5e40ec5..d28dbcb 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-sim/makefile
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-sim/makefile
@@ -14,7 +14,7 @@
ifeq ($(strip $(TARGET_PLATFORM)), T106)
-LOCAL_CFLAGS += -DBINDER_IPC_32BIT=1 -DHAVE_ENDIAN_H -DHAVE_PTHREADS -DHAVE_SYS_UIO_H -DHAVE_POSIX_FILEMAP -DHAVE_STRLCPY -DHAVE_PRCTL -DHAVE_MEMSET16 -DHAVE_MEMSET32 -DANDROID_SMP=0
+LOCAL_CFLAGS += -DBINDER_IPC_32BIT=1 -DHAVE_ENDIAN_H -DHAVE_PTHREADS -DHAVE_SYS_UIO_H -DHAVE_POSIX_FILEMAP -DHAVE_STRLCPY -DHAVE_PRCTL -DHAVE_MEMSET16 -DHAVE_MEMSET32 -DANDROID_SMP=0 -DMOBILETEK_TARGET_PLATFORM_T106
endif
$(warning ################# lynq sim ROOT: $(ROOT),includedir:$(includedir))
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-sim/src/lynq_sim.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-sim/src/lynq_sim.cpp
index 433764a..a32d152 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-sim/src/lynq_sim.cpp
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-sim/src/lynq_sim.cpp
@@ -788,6 +788,29 @@
return;
}
+#ifdef MOBILETEK_TARGET_PLATFORM_T106
+
+int lynq_reset_modem(void)
+{
+ if(g_lynq_sim_init_flag == 0)
+ {
+ return -1;
+ }
+
+ Parcel p;
+ int res = lynq_send_common_request(&p,RIL_REQUEST_RESET_RADIO,0,1,"");
+
+ if(res != 0)
+ {
+ RLOGD("function %s execute error", __FUNCTION__);
+ return res;
+ }
+
+ return res;
+
+}
+
+#else
int lynq_reset_modem(void)
{
if(g_lynq_sim_init_flag == 0)
@@ -814,7 +837,7 @@
RLOGD("function %s ret %d",__FUNCTION__, ret);
return ret;
}
-
+#endif
/**
* @brief handle shutdown buf
* @param options type: [IN]My Param doc
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-systime/lynq_systime.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-systime/lynq_systime.cpp
index 690c0d0..d898f9d 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-systime/lynq_systime.cpp
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-systime/lynq_systime.cpp
@@ -364,8 +364,7 @@
}
sprintf(buf, "%s.%s.%s=%d", LYNQ_UCI_FILE, LYNQ_SYNC_TIME_SECTION, LYNQ_MODEM_TIME_KEY, enable);
ret = lynq_uci_set(buf);
- if (ret == 4)
- ret = 0;
+
return ret;
}
@@ -389,8 +388,7 @@
}
sprintf(buf, "%s.%s.%s=%d", LYNQ_UCI_FILE, LYNQ_SYNC_TIME_SECTION, LYNQ_GNSS_TIME_KEY, enable);
ret = lynq_uci_set(buf);
- if (ret == 4)
- ret = 0;
+
return ret;
}
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-uci/lynq_uci.config b/cap/zx297520v3/src/lynq/lib/liblynq-uci/lynq_uci.config
index f77fd37..b3eb4bc 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-uci/lynq_uci.config
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-uci/lynq_uci.config
@@ -9,7 +9,7 @@
option gateway '192.168.11.1'
config lynq_sync_time_rw 'lynq_sync_time'
- option lynq_modem_sync_time_enable '0'
+ option lynq_modem_sync_time_enable '1'
option lynq_gnss_sync_time_enable '0'
config lynq_autosuspend 'lynq_autosuspend'
option auto_enable '0'
@@ -27,3 +27,6 @@
config rndis_status 'rndis'
option status '0'
+
+config lynq_led_rw 'lynq_led'
+ option lynq_statusled_on '0'
\ No newline at end of file
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-uci/src/lynq_uci.c b/cap/zx297520v3/src/lynq/lib/liblynq-uci/src/lynq_uci.c
index b557c08..a50eed1 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-uci/src/lynq_uci.c
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-uci/src/lynq_uci.c
@@ -5,7 +5,6 @@
#define UCI_SUPPORT 1
int lynq_del(char *option)
{
- printf("this is lynq uci module,fun:%s,line:%d\n",__FUNCTION__,__LINE__);
#if UCI_SUPPORT
int ret;
char buf[LYNQ_UCI_MAX_LEN];
@@ -30,7 +29,6 @@
#if UCI_SUPPORT
static int uci_get_value(struct uci_option *o, char *out_buf)
{
- printf("this is lynq uci module,fun:%s,line:%d\n",__FUNCTION__,__LINE__);
#if UCI_SUPPORT
struct uci_element *e;
const char *delimiter = " ";
@@ -61,7 +59,6 @@
#endif //#if UCI_SUPPORT
int lynq_uci_get(const char *arg, char *out_buf)
{
- printf("this is lynq uci module,fun:%s,line:%d\n",__FUNCTION__,__LINE__);
#if UCI_SUPPORT
struct uci_context *ctx;
struct uci_element *e;
@@ -115,7 +112,6 @@
int lynq_uci_set(const char *arg)
{
- printf("this is lynq uci module,fun:%s,line:%d\n",__FUNCTION__,__LINE__);
#if UCI_SUPPORT
struct uci_context *ctx;
struct uci_element *e;
@@ -173,7 +169,6 @@
int lynq_add_section(char *section_type, char *section)//rita add @2021.7.30 for adding section
{
- printf("this is lynq uci module,fun:%s,line:%d\n",__FUNCTION__,__LINE__);
#if UCI_SUPPORT
char buf[128] = "";
sprintf(buf,"lynq_uci.%s=%s", section, section_type);
@@ -187,7 +182,6 @@
int lynq_set_value(char *section, char *key, char *value)//rita add @2021.7.30 for setting value
{
- printf("this is lynq uci module,fun:%s,line:%d\n",__FUNCTION__,__LINE__);
#if UCI_SUPPORT
char buf[LYNQ_UCI_MAX_LEN] = "";
@@ -202,7 +196,6 @@
int lynq_get_value(char *file, char *section, char *key, char *tmp)//rita add @2021.7.30 for getting value
{
- printf("this is lynq uci module,fun:%s,line:%d\n",__FUNCTION__,__LINE__);
#if UCI_SUPPORT
char buf[LYNQ_UCI_MAX_LEN] = "";
int ret = 0;
diff --git a/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/lynq.h b/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/lynq.h
index 0862651..a096d09 100755
--- a/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/lynq.h
+++ b/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/lynq.h
@@ -23,6 +23,8 @@
#define LYNQ_LIST_SMS LYNQ_SMS + 5
#define LYNQ_DELETE_SMS LYNQ_SMS + 6
#define LYNQ_WAIT_SMS LYNQ_SMS + 7
+#define LYNQ_GET_SMSC_ADDRESS LYNQ_SMS + 8
+#define LYNQ_SET_SMSC_ADDRESS LYNQ_SMS + 9
#define LYNQ_NETWORK LYNQ_BASE + 30
#define LYNQ_NETWORK_INIT LYNQ_NETWORK + 1
diff --git a/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/req_commands.h b/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/req_commands.h
index 2151052..7254719 100755
--- a/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/req_commands.h
+++ b/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/req_commands.h
@@ -11,6 +11,8 @@
{"LYNQ_LIST_SMS",list_sms, "list short message", LYNQ_LIST_SMS},
{"LYNQ_DELETE_SMS",delete_sms, "delete short messsage", LYNQ_DELETE_SMS},
{"LYNQ_WAIT_SMS",wait_sms, "wait short messsage", LYNQ_WAIT_SMS},
+ {"LYNQ_GET_SMSC_ADDRESS",get_smsc_address, "get smsc address", LYNQ_GET_SMSC_ADDRESS},
+ {"LYNQ_SET_SMSC_ADDRESS",set_smsc_address, "set smsc address", LYNQ_SET_SMSC_ADDRESS},
//NETWORK
{"LYNQ_NETWORK_INIT",init_network, "init the network lib", LYNQ_NETWORK_INIT},
{"LYNQ_NETWORK_DEINIT",deinit_network, "deinit the network lib", LYNQ_NETWORK_DEINIT},
diff --git a/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/sim.cpp b/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/sim.cpp
index ab1e4e7..cc1e461 100755
--- a/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/sim.cpp
+++ b/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/sim.cpp
@@ -47,7 +47,8 @@
char iccid[SIM_BUF] = "";
ret = lynq_get_iccid(iccid);
printf("%s%d\n",TEST_RESULT,ret);
- printf("[%s-%d] ICCID:%d\n", __FUNCTION__, __LINE__, iccid);
+ if(!ret)
+ printf("[%s-%d] ICCID:%s\n", __FUNCTION__, __LINE__, iccid);
return ret;
}
@@ -189,6 +190,15 @@
return ret;
}
+int reset_modem(int argc, char *argv[], int sp_test)
+{
+ printf("[%s][%d] enter!\n",__FUNCTION__,__LINE__);
+ char buf[128] = "";
+ int ret = -1;
+ ret = lynq_reset_modem();
+ printf("%s%d\n",TEST_RESULT,ret);
+ return ret;
+}
//qser api
sim_client_handle_type ph_sim;
diff --git a/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/sim.h b/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/sim.h
index 93fd530..ce6a254 100755
--- a/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/sim.h
+++ b/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/sim.h
@@ -17,6 +17,7 @@
int query_phone_number_test(int argc, char *argv[], int sp_test);
int deinit_sim(int argc, char *argv[], int sp_test);
int get_version(int argc, char *argv[], int sp_test);
+int reset_modem(int argc, char *argv[], int sp_test);
//QSER SIM
int qser_init_sim(int argc, char *argv[], int sp_test);
diff --git a/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/sms.cpp b/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/sms.cpp
index 819fd38..c78a285 100755
--- a/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/sms.cpp
+++ b/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/sms.cpp
@@ -82,6 +82,30 @@
return ret;
}
+int get_smsc_address(int argc, char *argv[], int sp_test)
+{
+ printf("[%s][%d] enter!\n",__FUNCTION__,__LINE__);
+ int ret = -1;
+ //int handle = atoi(argv[1]);
+ char service_num[22] = "";
+ ret = lynq_get_smsc_address(service_num);
+ printf("%s%d\n",TEST_RESULT,ret);
+ printf("LYNQ_GET_SMSC_ADDRESS: %s\n", service_num);
+ return ret;
+}
+
+int set_smsc_address(int argc, char *argv[], int sp_test)
+{
+ printf("[%s][%d] enter!\n",__FUNCTION__,__LINE__);
+ int ret = -1;
+ //int handle = atoi(argv[1]);
+ char service_num[22] = "";
+ strncpy(service_num, argv[1], 22);
+ ret = lynq_set_smsc_address(service_num);
+ printf("%s%d\n",TEST_RESULT,ret);
+ return ret;
+}
+
//QSER API
sms_client_handle_type ph_sms;
int qser_init_sms(int argc, char *argv[], int sp_test)
diff --git a/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/sms.h b/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/sms.h
index 8dcb735..307ff56 100755
--- a/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/sms.h
+++ b/cap/zx297520v3/src/lynq/packages/apps/Mobiletek_Tester_RDIT/sms.h
@@ -6,7 +6,8 @@
int list_sms(int argc, char *argv[], int sp_test);
int delete_sms(int argc, char *argv[], int sp_test);
int wait_sms(int argc, char *argv[], int sp_test);
-
+int get_smsc_address(int argc, char *argv[], int sp_test);
+int set_smsc_address(int argc, char *argv[], int sp_test);
//QSER SMS
int qser_init_sms(int argc, char *argv[], int sp_test);
int qser_deinit_sms(int argc, char *argv[], int sp_test);
diff --git a/cap/zx297520v3/src/lynq/packages/apps/lynq-led-demo/lynq_led-demo.c b/cap/zx297520v3/src/lynq/packages/apps/lynq-led-demo/lynq_led-demo.c
new file mode 100755
index 0000000..706aa6f
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/packages/apps/lynq-led-demo/lynq_led-demo.c
@@ -0,0 +1,24 @@
+#include <stdio.h>
+#include <strings.h>
+#include<stdlib.h>
+#include <include/lynq_uci.h>
+
+
+
+
+int main(int argc, const char *argv[])
+{
+ int ret = 0;
+ ret = lynq_set_netled_on(1);
+ if(ret){
+ printf("[%s-%d] lynq_set_netled_on error\n", __FUNCTION__, __LINE__);
+ return -1;
+ }
+ ret = lynq_set_statusled_on(1);
+ if(ret){
+ printf("[%s-%d] lynq_set_statusled_on error\n", __FUNCTION__, __LINE__);
+ return -1;
+ }
+
+ return 0;
+}
diff --git a/cap/zx297520v3/src/lynq/packages/apps/lynq-led-demo/makefile b/cap/zx297520v3/src/lynq/packages/apps/lynq-led-demo/makefile
new file mode 100755
index 0000000..bfab13c
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/packages/apps/lynq-led-demo/makefile
@@ -0,0 +1,48 @@
+SHELL = /bin/sh
+RM = rm -f
+
+LOCAL_CFLAGS := -Wall \
+ -g -Os \
+ -flto \
+ -fpermissive \
+ -fPIC \
+
+ifeq ($(strip $(TARGET_PLATFORM)), T106)
+LOCAL_CFLAGS += -DBINDER_IPC_32BIT=1 -DHAVE_ENDIAN_H -DHAVE_PTHREADS -DHAVE_SYS_UIO_H -DHAVE_POSIX_FILEMAP -DHAVE_STRLCPY -DHAVE_PRCTL -DHAVE_MEMSET16 -DHAVE_MEMSET32 -DANDROID_SMP=0
+endif
+
+LOCAL_CFLAGS += -DLYNQ_SW_INSIDE_VERSION=\"$(LYNQ_CONFIG_VERSION)\"
+LOCAL_CFLAGS += -DLYNQ_SW_VERSION=\"$(LYNQ_CONFIG_SW_VERSION)\"
+
+LOCAL_PATH = .
+
+LOCAL_C_INCLUDES = \
+ -I. \
+
+
+
+
+
+LOCAL_LIBS := \
+ -L. \
+ -ldl \
+ -lpthread \
+ -llynq-uci \
+ -llynq-led \
+
+SOURCES = $(wildcard *.c)
+
+EXECUTABLE = lynq-led-demo
+
+OBJECTS=$(SOURCES:.c=.o)
+all: $(EXECUTABLE)
+
+$(EXECUTABLE): $(OBJECTS)
+ $(CXX) $(OBJECTS) $(LOCAL_LIBS) $(LOCAL_CFLAGS) $(LOCAL_C_INCLUDES) -o $@
+
+%.o : %.c
+ $(CC) $(LOCAL_C_INCLUDES) $(LOCAL_CFLAGS) $(LOCAL_LIBS) -o $@ -c $<
+
+.PHONY: clean
+clean:
+ $(RM) $(OBJECTS) $(EXECUTABLE)
diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/arch/arm/boot/dts/zx297520v3-pinctrl.dtsi b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/arch/arm/boot/dts/zx297520v3-pinctrl.dtsi
index 3da6c4e..f9f558d 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/arch/arm/boot/dts/zx297520v3-pinctrl.dtsi
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/arch/arm/boot/dts/zx297520v3-pinctrl.dtsi
@@ -346,7 +346,7 @@
};
sc_ext_int10: sc_ext_int10 {
- pins = "EXT_INT10";
+ pins = "GPIO129"; /*jb.qi add for EXT_INIT10 success*/
function = "EXT_INT10";
bias-disable;
};
diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/arch/arm/boot/dts/zx297520v3-vehicle_dc_ref.dts b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/arch/arm/boot/dts/zx297520v3-vehicle_dc_ref.dts
index f2fef72..da48fcc 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/arch/arm/boot/dts/zx297520v3-vehicle_dc_ref.dts
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/arch/arm/boot/dts/zx297520v3-vehicle_dc_ref.dts
@@ -130,14 +130,14 @@
// status = "okay";
};
&codec_ti3104 {
-// status = "okay";
+ status = "okay";
};
&zx29_ti3104 {
pinctrl-0 = <&i2s0_pins>;
-// status = "okay";
+ status = "okay";
};
&codec_nau8810 {
- status = "okay";
+// status = "okay";
};
&zx29_nau8810 {
pinctrl-0 = <&i2s0_pins>;
@@ -155,11 +155,11 @@
// status = "okay";
};
&codec_es8311 {
- status = "okay";
+// status = "okay";
};
&zx29_es8311 {
pinctrl-0 = <&i2s0_pins>;
- status = "okay";
+// status = "okay";
};
&gmac {
port-nums = <1>;
diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/arch/arm/boot/dts/zx297520v3.dtsi b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/arch/arm/boot/dts/zx297520v3.dtsi
index 24faec9..b5d4bc6 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/arch/arm/boot/dts/zx297520v3.dtsi
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/arch/arm/boot/dts/zx297520v3.dtsi
@@ -488,13 +488,13 @@
codec_ti3104: ti3104@18 {
compatible = "ti,tlv320aic3104";
reg = <0x18>;
- reset-gpios = <&bgpio 122 GPIO_ACTIVE_HIGH>;/*RST*/
+ //reset-gpios = <&bgpio 119 GPIO_ACTIVE_HIGH>;/*RST*/
ai3x-micbias-vg = <MICBIAS_2_0V>;
- clocks = <&clkc CLKOUT1_CLK>;
+ clocks = <&clkc CLKOUT2_CLK>;
clock-names = "clk_out";
pinctrl-names = "clk_out","reset_gpio122";
- pinctrl-0 = <&clk1_func_pins>;
+ pinctrl-0 = <&clk2_func_pins>;
pinctrl-1 = <&codec_reset_pins>;
status = "disabled";
};
diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/sound/soc/codecs/tlv320aic3x.c b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/sound/soc/codecs/tlv320aic3x.c
index 4f01cbc..09ef085 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/sound/soc/codecs/tlv320aic3x.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/sound/soc/codecs/tlv320aic3x.c
@@ -1018,6 +1018,15 @@
struct aic3x_priv *info = dev_get_drvdata(dev);
struct device_node *np = dev->of_node;
+ #if 1
+ unsigned tmp;
+ void __iomem *reg_base;
+ reg_base = ioremap(0x13B000+0x94 ,4);
+ tmp = ioread32(reg_base);
+ tmp |= (1<<0)|(1<<2);
+ iowrite32(tmp,reg_base);
+ #endif
+
dev_info(dev, "%s:start!\n", __func__);
if(dev == NULL){
@@ -1059,7 +1068,7 @@
clk = of_clk_get_by_name(np, "clk_out");
if (IS_ERR(clk)) {
- dev_err(dev, "Could not get clk_out\n");
+ dev_err(dev, "Could not get clk_out0\n");
ret = PTR_ERR(clk);
goto err_put_pinctrl;
}
@@ -1203,7 +1212,7 @@
regmap_read(info->regmap, AIC3X_PAGE_SELECT, &pre_page);
regmap_write(info->regmap, AIC3X_PAGE_SELECT, 0);
- for (i = regmin; i < regmax; i++) {
+ for (i = regmin; i <= regmax; i++) {
//val = snd_soc_component_read(info->component, i);
regmap_read(info->regmap, i, &val);
@@ -1260,6 +1269,7 @@
if( ret == 0)
{
dev_info(dev, "reg_read start\n");
+ /*
if(param1 > 1){
dev_err(dev, "reg_read param invalidate fail,param1=%d \n",param1);
return -1;
@@ -1268,10 +1278,14 @@
if(param2 > regmax){
dev_err(dev, "reg_read param invalidate fail,param2=%d \n",param2);
return -1;
- }
-
+ }
+ */
-
+ if(param1 < 0 || param1 > 109){
+ dev_err(dev, "reg_read param invalidate fail,param1=%d \n",param1);
+ return -1;
+ }
+
regmap_read(info->regmap, AIC3X_PAGE_SELECT, &pre_page);
regmap_write(info->regmap, AIC3X_PAGE_SELECT, regpage);
@@ -1295,6 +1309,8 @@
//u32 offset = param1;
//u32 mask = param2;
dev_info(dev, "reg_write start\n");
+
+ /*
if(param1 > 1){
dev_err(dev, "reg_write param invalidate fail,param1=%d \n",param1);
return -1;
@@ -1303,9 +1319,14 @@
if(param2 > regmax){
dev_err(dev, "reg_write param invalidate fail,param1=%d \n",param1);
return -1;
- }
+ }
+ */
-
+ if(param1 < 0 || param1 > 109){
+ dev_err(dev, "reg_write param invalidate fail,param1=%d \n",param1);
+ return -1;
+ }
+
regmap_read(info->regmap, AIC3X_PAGE_SELECT, &pre_page);
regmap_write(info->regmap, AIC3X_PAGE_SELECT, regpage);
@@ -1846,13 +1867,15 @@
.name = "tlv320aic3x-hifi",
.playback = {
.stream_name = "Playback",
- .channels_min = 2,
+ //.channels_min = 2,
+ .channels_min = 1,
.channels_max = 2,
.rates = AIC3X_RATES,
.formats = AIC3X_FORMATS,},
.capture = {
.stream_name = "Capture",
- .channels_min = 2,
+ //.channels_min = 2,
+ .channels_min = 1,
.channels_max = 2,
.rates = AIC3X_RATES,
.formats = AIC3X_FORMATS,},
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/at_ctl/src/atconfig/ps_normal.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/at_ctl/src/atconfig/ps_normal.c
index caac23e..83a78d5 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/at_ctl/src/atconfig/ps_normal.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/at_ctl/src/atconfig/ps_normal.c
@@ -22,6 +22,11 @@
//bsim
#include <openssl/aes.h>
+//>>>sj.zhang add @2023-10-08 for fix the issue of timezone.
+#define _XOPEN_SOURCE
+extern long timezone;
+//>>>sj.zhang add @2023-10-08 for fix the issue of timezone end.
+
typedef struct
{
unsigned int pubKeyRsaE[32];
@@ -115,13 +120,13 @@
void *p[5] = {&timeinfo.time_zone,&timeinfo.sav_time,temp1,temp2,timeinfo.univer_time};
int time_zone = 0;
- //>>>sj.zhang add @2023-08-10 for systime NITZ sync enable/disenable.
+//>>>sj.zhang add @2023-08-10 for systime NITZ sync enable/disenable.
if(0 != system("uci get lynq_uci.lynq_sync_time.lynq_modem_sync_time_enable | grep -E \'^1$\'"))
{
at_print(AT_ERR,"zmmi_auto_act: nitz disenabled. \n");
return AT_END;
}
- //>>>sj.zhang add @2023-08-10 end.
+//>>>sj.zhang add @2023-08-10 end.
sc_cfg_get("sntp_time_set_mode", mode, sizeof(mode));
if(strcmp(mode, "manual") == 0)
@@ -158,7 +163,10 @@
set_tm.tm_mon = set_tm.tm_mon - 1;
time_tv.tv_sec = mktime(&set_tm);
- time_tv.tv_sec = time_tv.tv_sec + time_zone * 3600 /4;
+//>>>sj.zhang add @2023-10-08 for fix the issue of timezone.
+ tzset();
+ time_tv.tv_sec = time_tv.tv_sec - timezone;
+//>>>sj.zhang add @2023-10-08 for fix the issue of timezone end.
if (0 != settimeofday(&time_tv,NULL))
diff --git a/update_version.sh b/update_version.sh
index f536468..e7bbf67 100644
--- a/update_version.sh
+++ b/update_version.sh
@@ -1,8 +1,8 @@
#!/bin/bash
#export LYNQ_VERSION="T106_lynq_version_ap_build_sh"
-LYNQ_AP_VERSION="T106CN-ZS03.V2.01.01.02P50U04.AP.08.06"
-LYNQ_CAP_INSIDE_VERSION="CAP.08.06"
-LYNQ_CAP_VERSION="CAP.08.06"
+LYNQ_AP_VERSION="T106CN-ZS03.V2.01.01.02P50U04.AP.08.07"
+LYNQ_CAP_INSIDE_VERSION="CAP.08.07"
+LYNQ_CAP_VERSION="CAP.08.07"
COMMIT_ID="$(git rev-parse HEAD)"
LYNQ_SW_INSIDE_VERSION="LYNQ_CONFIG_VERSION = \"${LYNQ_AP_VERSION}_${LYNQ_CAP_INSIDE_VERSION}\""