Merge "[Feature][ZXW-100]optimize powerkey times during the DL phase"
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 2d4c6b1..03d43eb 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
@@ -115,6 +115,14 @@
 	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.

+	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.

+

     sc_cfg_get("sntp_time_set_mode", mode, sizeof(mode));

 	if(strcmp(mode, "manual") == 0)

 	{

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 5de1db2..d5acc77 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
@@ -163,6 +163,7 @@
         liblynq-qser-network \
         liblynq-qser-gnss \
         liblynq-qser-fota \
+        liblynq-systime \
 	"
 
 zxic_lib += "${@bb.utils.contains('CONFIG_TEL_API_SUPPORT', 'RIL', 'libril libreference-ril', 'libtelsvr', d)}"
@@ -231,6 +232,7 @@
         lynq-qser-fota-demo \
         lynq-qser-gnss-demo \
         lynq-qser-network-demo \
+        lynq-systime-demo \
 	"
 
 zxic_app_open += "${@bb.utils.contains('CONFIG_TEL_API_SUPPORT', 'RIL', 'rild', '', d)}"
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 e1ad73d..23bac63 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
@@ -191,6 +191,8 @@
         liblynq-qser-network \
         liblynq-qser-gnss \
         liblynq-qser-fota \
+        libpoweralarm \
+        liblynq-systime \
 	"
 
 zxic_lib += "${@bb.utils.contains('CONFIG_TEL_API_SUPPORT', 'RIL', 'libril', 'libtelsvr', d)}"
@@ -258,7 +260,9 @@
         lynq-qser-fota-demo \
         lynq-qser-gnss-demo \
         lynq-qser-network-demo \
-	"
+        poweralarm-demo \
+        lynq-systime-demo \
+        "
 
 zxic_app_open += "${@bb.utils.contains('CONFIG_TEL_API_SUPPORT', 'RIL', 'rild', '', d)}"
 zxic_app_open += "${@bb.utils.contains('CONFIG_TEL_API_SUPPORT', 'BL', 'tel-svr', '', d)}"
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/liblynq-systime/liblynq-systime.bb b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/liblynq-systime/liblynq-systime.bb
new file mode 100644
index 0000000..da64aad
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/liblynq-systime/liblynq-systime.bb
@@ -0,0 +1,64 @@
+#inherit externalsrc package
+
+DESCRIPTION = "liblynq-systime"
+LICENSE = "CLOSED"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=b1e07e8d88e26263e71d3a9e2aa9a2ff"
+DEPENDS += "${@bb.utils.contains('TARGET_PLATFORM', 'T106', "libsctel", '', d)} liblynq-uci liblynq-log"
+#inherit workonsrc
+WORKONSRC = "${TOPDIR}/../src/lynq/lib/liblynq-systime/"
+FILESEXTRAPATHS_prepend :="${TOPDIR}/../src/lynq/lib/:"
+SRC_URI = " \
+          file://liblynq-systime \
+          "
+
+SRC-DIR = "${S}/../liblynq-systime"
+
+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 = "'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"
+	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"
+	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 -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"
+	fi
+}
+
+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/libpoweralarm/libpoweralarm.bb b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/libpoweralarm/libpoweralarm.bb
new file mode 100755
index 0000000..0867686
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/libpoweralarm/libpoweralarm.bb
@@ -0,0 +1,58 @@
+#inherit externalsrc package
+DESCRIPTION = "libpoweralarm.so "
+SECTION = "base"
+#LICENSE = "Mobiletek""
+LICENSE = "CLOSED"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=d759532d295a4ec07250edf931caef80"
+DEPENDS += "bootchart  liblynq-log libsctel "
+
+#inherit workonsrc
+WORKONSRC = "${TOPDIR}/../src/lynq/lib/libpoweralarm/"
+
+FILESEXTRAPATHS_prepend :="${TOPDIR}/../src/lynq/lib/:"
+SRC_URI = " \
+          file://libpoweralarm \
+          "
+SRC-DIR = "${S}/../libpoweralarm"
+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 \
+               ${base_bindir}\
+               ${base_sbindir}"
+
+
+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 -DTELEPHONYWARE"
+}
+
+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/lynq-systime-demo/lynq-systime-demo.bb b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-systime-demo/lynq-systime-demo.bb
new file mode 100644
index 0000000..ca07a8a
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-systime-demo/lynq-systime-demo.bb
@@ -0,0 +1,36 @@
+#inherit externalsrc package
+#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"
+TARGET_CC_ARCH += "${LDFLAGS}"
+SYSTEMD_PACKAGES = "${PN}"
+#Parameters passed to do_compile()
+EXTRA_OEMAKE = "'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-systime-demo ${D}${bindir}/
+}
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/poweralarm-demo/files/poweralarm-demo.cpp b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/poweralarm-demo/files/poweralarm-demo.cpp
new file mode 100755
index 0000000..199106b
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/poweralarm-demo/files/poweralarm-demo.cpp
@@ -0,0 +1,186 @@
+#include <stdlib.h>

+#include <stdio.h>

+#include <string.h>

+#include <sys/types.h>

+#include <unistd.h>

+#include <dlfcn.h>

+#include <stdint.h>

+

+typedef struct

+{

+    int  cmdIdx;

+    char *funcName;

+} st_api_test_case;

+    

+//for server test

+st_api_test_case at_api_testcases[] = 

+{

+    {0,   "print_help"},

+    {1,   "poweralarm"},

+    {2,   "wakealarm"},

+    {3,   "cancel_wakealarm"},

+    {4,   "lynq_set_poweralarm"},

+    {5,   "lynq_set_wakealarm"},

+    {-1,    NULL}

+};

+

+

+int (*poweralarm)(char *buffer);

+int (*wakealarm)(char *buffer);

+int (*cancel_wakealarm)();

+int (*lynq_set_poweralarm)(unsigned long time_sec);

+int (*lynq_set_wakealarm)(unsigned long time_sec);

+

+void *dlHandle_poweralarm = NULL;

+

+

+void print_help(void)

+{

+    int i;

+    printf("Supported test cases:\n");

+    for(i = 0; ; i++)

+    {

+        if(at_api_testcases[i].cmdIdx == -1)

+        {

+            break;

+        }

+        printf("%d:\t%s\n", at_api_testcases[i].cmdIdx, at_api_testcases[i].funcName);

+    }

+}

+

+int main(int argc,char *argv[])

+{

+

+    int flag = 0; 

+    int cmdIdx = 0;

+    printf("Enter main function\n");

+    

+    const char *dlHandle_Path_poweralarm = "/lib/libpoweralarm.so";

+    dlHandle_poweralarm = dlopen(dlHandle_Path_poweralarm, RTLD_NOW);

+    if (dlHandle_poweralarm == NULL) 

+    {

+        printf("dlopen dlHandle_fota failed: %s\n", dlerror());

+        return -1;

+    }

+

+    poweralarm = (int (*)(char *buffer))dlsym(dlHandle_poweralarm, "poweralarm");

+    if(poweralarm == NULL)

+    {

+        printf("poweralarm is null\n");

+        return -1;

+    }

+

+   wakealarm = (int (*)(char *buffer))dlsym(dlHandle_poweralarm, "wakealarm");

+    if(wakealarm == NULL)

+    {

+        printf("wakealarm is null\n");

+        return -1;

+    }

+    lynq_set_poweralarm = (int (*)(unsigned long))dlsym(dlHandle_poweralarm,"lynq_set_poweralarm");

+    if(lynq_set_poweralarm == NULL)

+    {

+        printf("lynq_set_poweralarm is null\n");

+        return -1;

+    }

+    lynq_set_wakealarm = (int (*)(unsigned long))dlsym(dlHandle_poweralarm,"lynq_set_wakealarm");

+    if(lynq_set_wakealarm == NULL)

+    {

+        printf("lynq_set_wakealarm is null\n");

+        return -1;

+    }

+    

+    cancel_wakealarm = (int (*)())dlsym(dlHandle_poweralarm, "cancel_wakealarm");

+     if(cancel_wakealarm == NULL)

+    {

+        printf("cancel_wakealarm is null\n");

+        return -1;

+    }

+    print_help();

+    while(1)

+    {

+        printf("\nplease input cmd index(-1 exit): ");

+        scanf("%d", &cmdIdx);

+        if(cmdIdx == -1)

+        {

+            break;

+        }

+        switch(cmdIdx)

+        {   

+            case 0:

+                print_help();

+                break;

+            case 1:

+                {

+                    int ret = 0;

+                    char tmp_time[32] = {0};

+                    printf("Set poweralarm time,e.g: 60 (seconds)\n");

+                    scanf("%s",tmp_time);

+                    ret = poweralarm(tmp_time);

+                    if(ret != 0)

+                    {

+                        printf("set poweralarm failed\n");

+                        return -1;

+                    }

+                break;

+                }

+            case 2:

+                {

+                    int ret = 0;

+                    char tmp_time[32]={0};

+                    printf("Set wakealarm time ,e.g: 60 (seconds)\n");

+                    scanf("%s",tmp_time);

+                    ret = wakealarm(tmp_time);

+                    if(ret != 0)

+                    {

+                        printf("set poweralarm failed\n");

+                        return -1;

+                    }

+                    break;

+                }

+             case 3:

+                {

+                    int ret = 0;

+                    ret = cancel_wakealarm();

+                    if(ret != 0)

+                    {

+                        printf("Cancel_wakealarm failed!!!");

+                        return -1;

+                    }

+                    break;

+                }

+             case 4:

+                { 

+                   int ret = 0; 

+                   unsigned long time_sec = 0;

+                   printf("Input time_sec you want poweralarm,e.g:60 (seconds)\n");

+                   scanf("%lu",&time_sec);

+                   ret =lynq_set_poweralarm(time_sec);

+                   if(ret != 0)

+                   {

+                        printf("lynq_set_poweralarm failed\n");

+                        return -1;

+                   }

+

+                }

+            case 5:

+                { 

+                   int ret = 0; 

+                   unsigned long time_sec = 0;

+                   printf("Input time_sec you want poweralarm,e.g:60 (seconds)\n");

+                   scanf("%lu",&time_sec);

+                   ret =lynq_set_wakealarm(time_sec);

+                   if(ret != 0)

+                   {

+                        printf("lynq_set_wakealarm failed\n");

+                        return -1;

+                   }

+               }

+                

+            default:

+                break;

+        }

+    }

+    return 0;

+

+}

+

diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/poweralarm-demo/poweralarm-demo.bb b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/poweralarm-demo/poweralarm-demo.bb
new file mode 100644
index 0000000..978dd0b
--- /dev/null
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/poweralarm-demo/poweralarm-demo.bb
@@ -0,0 +1,33 @@
+# Package summary
+SUMMARY = "poweralarm-demo"
+# License, for example MIT
+LICENSE = "MIT"
+# License checksum file is always required
+LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
+		  
+SRC_URI = " file://poweralarm-demo.cpp"
+
+SRC-DIR = "${S}/../poweralarm-demo"
+TARGET_CC_ARCH += "${LDFLAGS}"
+
+#Parameters passed to do_compile()
+EXTRA_OEMAKE = "'TARGET_PLATFORM = ${TARGET_PLATFORM}'\"
+EXTRA_OEMAKE += "'MOBILETEK_RIL_CFG = ${MOBILETEK_RIL_CFG}'"
+
+LOCAL_C_INCLUDES = "-I."
+
+LOCAL_LIBS = "-L. -ldl -lstdc++"
+
+#INHIBIT_PACKAGE_STRIP = "1"
+S = "${WORKDIR}"
+
+#INHIBIT_PACKAGE_STRIP = "1"
+do_compile () {
+
+	${CXX} -Wall poweralarm-demo.cpp ${LOCAL_LIBS} ${LOCAL_C_INCLUDES} -o poweralarm-demo
+}
+
+do_install() {
+	install -d ${D}${bindir}/
+	install -m 0755 ${S}/poweralarm-demo ${D}${bindir}/
+}
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-call/lynq_call.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-call/lynq_call.cpp
index bee6e5e..9525e75 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-call/lynq_call.cpp
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-call/lynq_call.cpp
@@ -808,7 +808,6 @@
        return LYNQ_E_CONFLICT;

     }      

     lynq_call_hungup_all();  

-    lynq_set_voice_audio_mode(AUDIO_MODE_CODEC);

     g_module_init_flag = MODULE_SWITCHING;

     lynq_close_all_urc_socket_thread();

     lynq_close_all_rc_socket_thread();    

diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-systime/LICENSE b/cap/zx297520v3/src/lynq/lib/liblynq-systime/LICENSE
new file mode 100755
index 0000000..605b7ea
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-systime/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-systime/include/lynq_systime.h b/cap/zx297520v3/src/lynq/lib/liblynq-systime/include/lynq_systime.h
new file mode 100755
index 0000000..001edda
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-systime/include/lynq_systime.h
@@ -0,0 +1,123 @@
+/**@file lynq-systime.h

+ *

+ * @brief Sync systime form each time source.

+ *

+ * @author sj.zhang

+ *

+ * @date 2023-08-14

+ *

+ * @version V1.0

+ *

+ * @copyright Copyright (c) MobileTek

+ */

+#include <stdio.h>

+#include <string.h>

+#include <stdlib.h>

+#include <time.h>

+#include <include/lynq_uci.h>

+

+#ifndef _LYNQ_SYSTIME_H_

+#define _LYNQ_SYSTIME_H_

+

+#ifdef __cplusplus

+extern "C"

+{

+#endif

+

+typedef struct time_source_status

+{

+    int ntp;

+    int nitz;

+    int gnss;

+}time_src_status_s;

+

+#ifdef MOBILETEK_TARGET_PLATFORM_T106

+

+    /**@brief Set the rtc time to the system time.

+     *

+     * @param void

+     *

+     * @return

+     *      0:success

+     *      other:failure

+     */

+    int lynq_sync_time_from_rtc(void);

+

+    /**@brief Set the system time to the rtc time.

+     *

+     * @param void

+     *

+     * @return

+     *      0:success

+     *      other:failure

+     */

+    int lynq_set_rtc_time(void);

+

+    /**@brief Query the rtc time.

+     *

+     * @param [OUT] ulsec: rtc time, secconds from 1900.1.1 00:00

+     *

+     * @return

+     *      0:success

+     *      other:failure

+     */

+    int lynq_get_rtc_time(unsigned long *ulsec);

+#endif

+

+    /**@brief Query the time source status now.

+     *

+     * @param [OUT] ntp, nitz, gnss:

+     *        0: disable

+     *        1: enable

+     *

+     * @return

+     *      0 : success

+     *      other:failure

+     */

+    int lynq_get_time_src_status(time_src_status_s *time_src);

+

+    /**@brief Turn sntp on/off

+     *

+     * @param enable [IN] : 0  disenable; 1 enable;

+     *

+     * @return

+     *    0 set success

+     *    1 SNTP_DISENABLE

+     *    2 SNTP_ALREADY_ENABLE

+     */

+    int ntp_sync_time(int enable);

+

+    /**@brief Enable/Disenable sync time from NITZ.

+     *

+     * @param enable [IN] : 0  disenable; 1 enable;

+     *

+     * @return

+     *      0:success

+     *      other:failure

+     */

+    int modem_time_enable(int enable);

+

+    /**@brief Enable/Disenable sync time from GNSS.

+     *

+     * @param enable [IN] : 0  disenable; 1 enable;

+     *

+     * @return

+     *      0:success

+     *      other:failure

+     */

+    int gnss_time_enable(int enable);

+

+    /**@brief User set systime manually.

+     *

+     * @param enable [IN] : 0  disenable; 1 enable;

+     *

+     * @return

+     *      0:success

+     *      other:failure

+     */

+    int user_set_time(char *date, char *time);

+

+#ifdef __cplusplus

+}

+#endif

+#endif

diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-systime/lynq_systime.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-systime/lynq_systime.cpp
new file mode 100755
index 0000000..6b7351b
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-systime/lynq_systime.cpp
@@ -0,0 +1,382 @@
+/**@file lynq-systime.cpp

+ *

+ * @brief Sync systime form different time source.

+ *

+ * @author sj.zhang

+ *

+ * @date 2023-08-15

+ *

+ * @version V1.0

+ *

+ * @copyright Copyright (c) MobileTek

+ */

+#include <stdio.h>

+#include <string.h>

+#include <stdlib.h>

+#include <time.h>

+#include <unistd.h>

+#include <include/lynq_uci.h>

+#include "liblog/lynq_deflog.h"

+#include "lynq_systime.h"

+

+#ifdef __cplusplus

+extern "C"

+{

+#endif

+

+#define USER_LOG_TAG "LYNQ_SYSTIME"

+#define LOG_LEVEL 4

+

+#define LYNQ_SYNC_TIME_SECTION "lynq_sync_time"

+#define LYNQ_MODEM_TIME_KEY "lynq_modem_sync_time_enable"

+#define LYNQ_GNSS_TIME_KEY "lynq_gnss_sync_time_enable"

+#define BUF_LEN 258

+#define TIME_BUF 100

+#define SYNC_TIME_SUCCESS 0

+#define NTP_ALREADY_ENABLE 1

+#define NTP_ALREADY_DISABLE 2

+

+#define OPEN_ERROR 7

+#define ERROR_PARA 8

+

+#ifdef MOBILETEK_TARGET_PLATFORM_T106

+#define NTP_RESTART_BUF "/etc/init.d/sntp restart"

+#define NTP_STOP_BUF "/etc/init.d/sntp stop"

+#define NTP_START_BUF "/etc/init.d/sntp start"

+#define PGREP_NTP_DARMON "pgrep -x /usr/bin/sntp"

+#define SET_RTC() lynq_set_rtc_time()

+#else

+#define NTP_RESTART_BUF "systemctl restart ntpd"

+#define NTP_STOP_BUF "systemctl stop ntpd"

+#define NTP_START_BUF "systemctl start ntpd"

+#define PGREP_NTP_DARMON "pgrep ntpd"

+#define SET_RTC() system("hwclock -w -f /dev/rtc0")

+#endif

+

+#ifdef MOBILETEK_TARGET_PLATFORM_T106

+    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);

+extern int sc_rtc_time_get(int srcid, sc_rtc_time_get_cb rtc_notify);

+

+char sync_from_rtc_cb_flag = 1;

+char rtc_time_get_cb_flag = 1;

+static unsigned long s_rtc_sec = 0;

+

+static int sync_from_rtc_cb(unsigned int src_id, unsigned long ulsec)

+{

+    LYLOGSET(LOG_LEVEL);

+    LYLOGEINIT(USER_LOG_TAG);

+    LYDBGLOG("[%s][%d] enter.\n", __FUNCTION__, __LINE__);

+    sync_from_rtc_cb_flag = 1;

+    struct tm rtc_time = {0};

+    time_t tmp = 0;

+    char command[100] = "";

+    tmp = (time_t)ulsec;

+    rtc_time = *localtime(&tmp);

+

+    LYINFLOG("RTC time now is: %d-%d-%d,%d:%d:%d\n",

+             rtc_time.tm_year + 1900, rtc_time.tm_mon + 1, rtc_time.tm_mday, rtc_time.tm_hour, rtc_time.tm_min, rtc_time.tm_sec);

+    snprintf(command, sizeof(command), "date --set=\'@%lu\' ", ulsec);

+    system(command);

+    sync_from_rtc_cb_flag = 0;

+    return 0;

+}

+

+static int rtc_time_get_cb(unsigned int src_id, unsigned long ulsec)

+{

+    LYLOGSET(LOG_LEVEL);

+    LYLOGEINIT(USER_LOG_TAG);

+    LYDBGLOG("[%s][%d] enter.\n", __FUNCTION__, __LINE__);

+    rtc_time_get_cb_flag = 1;

+    s_rtc_sec = ulsec;

+    struct tm rtc_time = {0};

+    time_t tmp = 0;

+    tmp = (time_t)ulsec;

+    rtc_time = *localtime(&tmp);

+    LYINFLOG("RTC time now is: %d-%d-%d,%d:%d:%d\n",

+             rtc_time.tm_year + 1900, rtc_time.tm_mon + 1, rtc_time.tm_mday, rtc_time.tm_hour, rtc_time.tm_min, rtc_time.tm_sec);

+    rtc_time_get_cb_flag = 0;

+    return 0;

+}

+

+int lynq_sync_time_from_rtc(void)

+{

+    LYLOGSET(LOG_LEVEL);

+    LYLOGEINIT(USER_LOG_TAG);

+    LYDBGLOG("[%s][%d] enter.\n", __FUNCTION__, __LINE__);

+    int ret = -1;

+    int srcid = -1;

+    int i = 0;

+    if ((srcid = sc_rtc_timer_init()) <= 0)

+    {

+        LYERRLOG("rtc_timer_demo:rtc_timer_init fail!\n");

+        return -1;

+    }

+    ret = sc_rtc_time_get(srcid, sync_from_rtc_cb);

+    if (ret != 0)

+    {

+        LYERRLOG("sc_rtc_time_get failed !\n");

+        sc_rtc_timer_uninit();

+        return -1;

+    }

+

+    // Wait for the callback function to finish executing. But 5 seconds tops.

+    for (i = 25; i > 0; i--)

+    {

+        if (sync_from_rtc_cb_flag == 0)

+            break;

+        usleep(200000);

+    }

+

+    if (sync_from_rtc_cb_flag != 0)

+    {

+        LYERRLOG("rtc_get_time_cb failed\n");

+        sc_rtc_timer_uninit();

+        return -1;

+    }

+    LYINFLOG("sync from rtc success\n");

+    ret = sc_rtc_timer_uninit();

+    if (0 != ret)

+    {

+        LYERRLOG("uninit failed \n");

+        return -1;

+    }

+    return 0;

+}

+

+int lynq_set_rtc_time(void)

+{

+    LYLOGSET(LOG_LEVEL);

+    LYLOGEINIT(USER_LOG_TAG);

+    LYDBGLOG("[%s][%d] enter.\n", __FUNCTION__, __LINE__);

+    int ret = -1;

+    int srcid = -1;

+    if ((srcid = sc_rtc_timer_init()) <= 0)

+    {

+        LYERRLOG("rtc_timer_demo:rtc_timer_init fail!\n");

+        return -1;

+    }

+    ret = sc_rtc_time_set(srcid);

+    if (ret != 0)

+    {

+        LYERRLOG("sc_rtc_time_set failed !\n");

+        return -1;

+    }

+    ret = sc_rtc_timer_uninit();

+    if (0 != ret)

+    {

+        LYERRLOG("uninit failed \n");

+        return -1;

+    }

+    return 0;

+}

+

+int lynq_get_rtc_time(unsigned long *ulsec)

+{

+    LYLOGSET(LOG_LEVEL);

+    LYLOGEINIT(USER_LOG_TAG);

+    LYDBGLOG("[%s][%d] enter.\n", __FUNCTION__, __LINE__);

+    int ret = -1;

+    int srcid = -1;

+    int i = 0;

+    if (NULL == ulsec)

+    {

+        LYERRLOG("NULL parameter!\n");

+        return ERROR_PARA;

+    }

+    if ((srcid = sc_rtc_timer_init()) <= 0)

+    {

+        LYERRLOG("rtc_timer_demo:rtc_timer_init fail!\n");

+        return -1;

+    }

+    ret = sc_rtc_time_get(srcid, rtc_time_get_cb);

+    if (ret != 0)

+    {

+        LYERRLOG("sc_rtc_time_get failed !\n");

+        sc_rtc_timer_uninit();

+        return -1;

+    }

+

+    // Wait for the callback function to finish executing. But 5 seconds tops.

+    for (i = 25; i > 0; i--)

+    {

+        if (rtc_time_get_cb_flag == 0)

+            break;

+        usleep(200000);

+    }

+    if (rtc_time_get_cb_flag != 0)

+    {

+        LYERRLOG("rtc_get_time_cb failed\n");

+        sc_rtc_timer_uninit();

+        return -1;

+    }

+    *ulsec = s_rtc_sec;

+    ret = sc_rtc_timer_uninit();

+    if (0 != ret)

+    {

+        LYERRLOG("uninit failed \n");

+        return -1;

+    }

+    return 0;

+}

+#endif

+

+int lynq_get_time_src_status(time_src_status_s *time_src)

+{

+    LYLOGSET(LOG_LEVEL);

+    LYLOGEINIT(USER_LOG_TAG);

+    LYDBGLOG("[%s][%d] enter.\n", __FUNCTION__, __LINE__);

+    char nitz_enable[8] = "";

+    char gnss_enable[8] = "";

+    char buf[BUF_LEN] = "";

+    if (NULL == time_src)

+    {

+        LYERRLOG("NULL parameter!\n");

+        return ERROR_PARA;

+    }

+    // get ntp status.

+    int ret = system(PGREP_NTP_DARMON);

+    if (0 == ret)

+    {

+        time_src->ntp = 1;

+    }

+    else

+    {

+        time_src->ntp = 0;

+    }

+

+    // get nitz status

+    sprintf(buf, "%s.%s.%s", LYNQ_UCI_FILE, LYNQ_SYNC_TIME_SECTION, LYNQ_MODEM_TIME_KEY);

+    lynq_uci_get(buf, nitz_enable);

+    time_src->nitz = atoi(nitz_enable);

+

+    // get gnss status

+    sprintf(buf, "%s.%s.%s", LYNQ_UCI_FILE, LYNQ_SYNC_TIME_SECTION, LYNQ_GNSS_TIME_KEY);

+    lynq_uci_get(buf, gnss_enable);

+    time_src->gnss = atoi(gnss_enable);

+

+    return 0;

+}

+

+const char *lynq_read_version()

+{

+    return "SYSTIME_V1.0";

+}

+

+int user_set_time(char *date, char *time)

+{

+    LYLOGSET(LOG_LEVEL);

+    LYLOGEINIT(USER_LOG_TAG);

+    LYDBGLOG("[%s][%d] enter.\n", __FUNCTION__, __LINE__);

+    char cmd_buf[TIME_BUF] = "";

+    if (NULL == date || NULL == time)

+    {

+        LYERRLOG("NULL parameter!\n");

+        return ERROR_PARA;

+    }

+

+    // set systime

+    snprintf(cmd_buf, sizeof(cmd_buf), "date -s %s+%s", date, time);

+    system(cmd_buf);

+

+    // set RTC by macrofunction

+    SET_RTC();

+    return 0;

+}

+

+int ntp_sync_time(int enable)

+{

+    LYLOGSET(LOG_LEVEL);

+    LYLOGEINIT(USER_LOG_TAG);

+    LYDBGLOG("[%s][%d] enter.\n", __FUNCTION__, __LINE__);

+    if (enable != 0 && enable != 1)

+    {

+        LYERRLOG("Parameter error! Only 0/1 allowed.\n");

+        return ERROR_PARA;

+    }

+    int ret = system(PGREP_NTP_DARMON);

+    if (0 == ret)

+    {

+        if (enable)

+        {

+            system(NTP_RESTART_BUF);

+            return NTP_ALREADY_ENABLE;

+        }

+        else

+        {

+            system(NTP_STOP_BUF);

+            return SYNC_TIME_SUCCESS;

+        }

+    }

+    else

+    {

+        if (enable)

+        {

+            // Only one time source is allowed to run simultaneously.

+            modem_time_enable(0);

+            gnss_time_enable(0);

+            system(NTP_START_BUF);

+            return SYNC_TIME_SUCCESS;

+        }

+        else

+        {

+            return NTP_ALREADY_DISABLE;

+        }

+    }

+}

+

+int modem_time_enable(int enable)

+{

+    LYLOGSET(LOG_LEVEL);

+    LYLOGEINIT(USER_LOG_TAG);

+    LYDBGLOG("[%s][%d] enter.\n", __FUNCTION__, __LINE__);

+    char buf[BUF_LEN] = "";

+    int ret = 0;

+    if (enable != 0 && enable != 1)

+    {

+        LYERRLOG("Parameter error! Only 0/1 allowed.\n");

+        return ERROR_PARA;

+    }

+    if (enable)

+    {

+        // Only one time source is allowed to run simultaneously.

+        ntp_sync_time(0);

+        gnss_time_enable(0);

+    }

+    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;

+}

+

+int gnss_time_enable(int enable)

+{

+    LYLOGSET(LOG_LEVEL);

+    LYLOGEINIT(USER_LOG_TAG);

+    LYDBGLOG("[%s][%d] enter.\n", __FUNCTION__, __LINE__);

+    char buf[BUF_LEN] = "";

+    int ret = 0;

+    if (enable != 0 && enable != 1)

+    {

+        LYERRLOG("Parameter error! Only 0/1 allowed.\n");

+        return ERROR_PARA;

+    }

+    if (enable)

+    {

+        // Only one time source is allowed to run simultaneously.

+        ntp_sync_time(0);

+        modem_time_enable(0);

+    }

+    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;

+}

+

+#ifdef __cplusplus

+}

+#endif

diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-systime/makefile b/cap/zx297520v3/src/lynq/lib/liblynq-systime/makefile
new file mode 100755
index 0000000..758315f
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-systime/makefile
@@ -0,0 +1,75 @@
+SHELL = /bin/sh

+RM = rm -f

+

+LOCAL_CFLAGS := -Wall \

+                -std=gnu++14 \

+                -g -Os \

+                -flto \

+                -fPIC \

+                -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 += $(CFLAGS)

+$(warning ################# rock ROOT: $(ROOT),includedir:$(includedir),)

+

+LOCAL_PATH   = .

+

+LOCAL_C_INCLUDES = \

+  -I. \

+  -I$(LOCAL_PATH)/include \

+  -I$(ROOT)$(includedir)/logger \

+  -I$(ROOT)$(includedir)/liblog \

+  -I$(ROOT)$(includedir) \

+

+

+LOCAL_LIBS := \

+    -L. \

+    -ldl \

+    -lstdc++ \

+    -lpthread \

+    -lsctel \

+    -llynq-uci \

+    -llynq-log \

+

+

+SOURCES = $(wildcard *.cpp)

+

+EXECUTABLE = liblynq-systime.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)

+

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 3ac501d..f77fd37 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,8 @@
         option gateway '192.168.11.1'

 

 config  lynq_sync_time_rw  'lynq_sync_time'

-

+        option lynq_modem_sync_time_enable '0'

+        option lynq_gnss_sync_time_enable '0'

 config  lynq_autosuspend  'lynq_autosuspend'

         option auto_enable '0'

         option debug '1'

diff --git a/cap/zx297520v3/src/lynq/lib/libpoweralarm/LICENSE b/cap/zx297520v3/src/lynq/lib/libpoweralarm/LICENSE
new file mode 100644
index 0000000..7ac229e
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/lib/libpoweralarm/LICENSE
@@ -0,0 +1,31 @@
+Copyright Statement:
+
+This software/firmware and related documentation ("MediaTek 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 MediaTek 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 MEDIATEK 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/libpoweralarm/include/libpoweralarm.h b/cap/zx297520v3/src/lynq/lib/libpoweralarm/include/libpoweralarm.h
new file mode 100755
index 0000000..54191a6
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/lib/libpoweralarm/include/libpoweralarm.h
@@ -0,0 +1,30 @@
+/*******************************************************

+* 

+* @brief:   none

+* @details:  add libpoweralarm api

+* @author:   l.yang

+* @date:     2023.8.21

+* @version:  V1.0

+* @copyright:Copyright (c) MobileTek 

+*

+*********************************************/

+

+#ifndef _LYNQ_POWERALARM_

+#define _LYNQ_POWERALARM_

+#ifdef __cplusplus

+    extern "C" {

+#endif

+

+ssize_t poweralarm(char * buffer);

+ssize_t wakealarm(char *buffer);

+ssize_t cancel_wakealarm(void);

+int lynq_set_wakealarm(unsigned long  time_sec);

+int lynq_set_poweralarm(unsigned long time_sec);

+

+

+#ifdef __cplusplus

+}

+#endif

+#endif

+

+

diff --git a/cap/zx297520v3/src/lynq/lib/libpoweralarm/libpoweralarm.cpp b/cap/zx297520v3/src/lynq/lib/libpoweralarm/libpoweralarm.cpp
new file mode 100755
index 0000000..945e0a4
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/lib/libpoweralarm/libpoweralarm.cpp
@@ -0,0 +1,274 @@
+/*******************************************************

+* 

+* @brief:    none

+* @details:      Add  wakealrm and poweralarm api code 

+* @author:    l.yang

+* @date:    2023.8.17

+* @version:    V1.0

+* @copyright:    Copyright (c) MobileTek 

+*

+*********************************************/

+

+#include<stdio.h>

+#include<stdlib.h>

+#include<unistd.h>

+#include<stdbool.h>

+#include<log/log.h>

+#include "liblog/lynq_deflog.h"

+#include <include/libpoweralarm.h>

+#include <pthread.h>

+

+

+#ifdef __cplusplus

+extern "C" {

+#endif

+

+#define USER_LOG_TAG "LYNQ_POWERALARM"

+

+

+static int wk_rtc_id = 1;

+static int pw_rtc_id = 2;

+static int wk_srcid = 0;

+

+typedef int (*sc_rtc_timer_exp_cb)(unsigned int src_id, int rtc_id);

+extern int sc_rtc_timer_init(void);

+extern int sc_rtc_timer_uninit(void );

+extern int sc_rtc_timer_add(int srcid, int rtc_id, unsigned long ulSec, sc_rtc_timer_exp_cb rtc_notify);

+extern int sc_rtc_timer_del(int srcid, int rtc_id);

+

+

+

+/*****************************************

+* @brief:sc_rtc_timer_add_cb

+* @param count [IN]:src_id, rtc_id,

+* @param sum [OUT]:NA

+* @return :0

+* @todo:

+* @see:NA

+* @warning:

+******************************************/

+int sc_rtc_timer_add_cb(unsigned int src_id, int rtc_id)

+{

+    return 0;

+}

+

+

+/*****************************************

+* @brief:Set wakealarm time

+* @param count [IN]:buffer,

+* @param sum [OUT]:NA

+* @return :success 0, failed -1

+* @todo:

+* @see:NA

+* @warning:

+******************************************/

+ssize_t wakealarm(char *buffer)

+{

+    unsigned long  time_sec = 0;

+    int ret = 0;

+    

+    LYLOGSET(LOG_INFO);

+    LYLOGEINIT(USER_LOG_TAG);

+    

+    if(buffer == NULL)

+    {

+        LYINFLOG("Bad input parameter,exit!!!!");

+        return -1;

+    }

+

+    time_sec = atoll(buffer);

+    

+    LYINFLOG("Set  wakealarm   %lu seconds ",time_sec);

+    wk_srcid = sc_rtc_timer_init();

+    if (wk_srcid <= 0)

+    {

+        LYINFLOG("rtc_timer_init fail!");

+        return -1;

+    }

+    ret = sc_rtc_timer_add(wk_srcid, wk_rtc_id, time_sec, sc_rtc_timer_add_cb);

+    if(ret < 0)

+    {

+        LYINFLOG("Add  rtc timer failed!!!!");

+        return -1;

+    }

+    

+    LYINFLOG("Set wakealarm success !!!");

+

+    ret = sc_rtc_timer_uninit();

+    if(ret != 0)

+    {

+        LYINFLOG("Deinit failed");

+    }

+    

+    return 0;

+

+}

+

+

+/*****************************************

+* @brief:set poweralarm time 

+* @param count [IN]:buffer,

+* @param sum [OUT]:NA

+* @return :success 0, failed -1

+* @todo:

+* @see:NA

+* @warning:

+******************************************/

+ssize_t poweralarm(char *buffer)

+{

+    int srcid = 0;

+    unsigned long  time_sec = 0;

+    int ret = 0;

+    

+    LYLOGSET(LOG_INFO);

+    LYLOGEINIT(USER_LOG_TAG);

+    

+    if(buffer == NULL)

+    {

+        LYINFLOG("Bad input parameter,exit!!!!");

+        return -1;

+    }

+

+    time_sec = atoll(buffer);

+    

+    LYINFLOG("Set poweralarm %lu seconds",time_sec);

+    srcid = sc_rtc_timer_init();

+    if (srcid <= 0)

+    {

+        LYINFLOG("rtc_timer_init fail!");

+        return -1;

+    }

+    ret = sc_rtc_timer_add(srcid, pw_rtc_id, time_sec, sc_rtc_timer_add_cb);

+    if(ret < 0)

+    {

+        LYINFLOG("Add  rtc timer failed!!!!");

+        return -1;

+    }

+    

+    LYINFLOG("Set poweralarm success !!!");

+

+    ret = sc_rtc_timer_uninit();

+    if(ret != 0)

+    {

+        LYINFLOG("Deinit failed");

+    }

+    

+    return 0;

+

+}

+

+/**********************************************

+* @brief:cancel_wakealarm,

+* @param count [IN]:void

+* @param sum [OUT]:NA

+* @return :success 0, failed -1

+* @todo:

+* @see:NA

+* @warning:

+********************************************/

+ssize_t cancel_wakealarm(void)

+{

+    int ret = 0;

+

+    LYINFLOG("Enter cancel_wakealarm ");

+    ret = sc_rtc_timer_del(wk_srcid, wk_rtc_id);

+    if(ret < 0)

+    {

+        LYINFLOG("Del wakealarm failed!!!");

+        return -1;

+    }

+

+    return 0;

+    

+}

+

+

+/*****************************************

+* @brief:lynq_set_poweralarm

+* @param count [IN]:unsigned long time_sec

+* @param sum [OUT]:NA

+* @return :success 0, failed -1

+* @todo:

+* @see:NA

+* @warning:

+******************************************/

+int  lynq_set_poweralarm(unsigned long time_sec)

+{

+    LYLOGSET(LOG_INFO);

+    LYLOGEINIT(USER_LOG_TAG);

+    int ret = 0;

+    int srcid = 0;

+    LYINFLOG("lynq_set_poweralarm %lu seconds",time_sec);

+    srcid = sc_rtc_timer_init();

+    if (srcid <= 0)

+    {

+        LYINFLOG("rtc_timer_init fail!");

+        return -1;

+    }

+    ret = sc_rtc_timer_add(srcid, pw_rtc_id, time_sec, sc_rtc_timer_add_cb);

+    if(ret < 0)

+    {

+        LYINFLOG("Add  rtc timer failed!!!!");

+        return -1;

+    }

+    

+    LYINFLOG("Set poweralarm success !!!");

+

+    ret = sc_rtc_timer_uninit();

+    if(ret != 0)

+    {

+        LYINFLOG("Deinit failed");

+    }

+    

+    return 0;

+

+}

+

+

+/*****************************************

+* @brief:lynq_set_wakealarm

+* @param count [IN]:unsigned long  time_sec

+* @param sum [OUT]:NA

+* @return :success 0, failed -1

+* @todo:

+* @see:NA

+* @warning:

+******************************************/

+int lynq_set_wakealarm(unsigned long  time_sec)

+{

+    int ret = 0;

+    

+    LYLOGSET(LOG_INFO);

+    LYLOGEINIT(USER_LOG_TAG);

+    

+    LYINFLOG("lynq_set_wakealarm   %lu seconds ",time_sec);

+    wk_srcid = sc_rtc_timer_init();

+    if (wk_srcid <= 0)

+    {

+        LYINFLOG("rtc_timer_init fail!");

+        return -1;

+    }

+    ret = sc_rtc_timer_add(wk_srcid, wk_rtc_id, time_sec, sc_rtc_timer_add_cb);

+    if(ret < 0)

+    {

+        LYINFLOG("Add  rtc timer failed!!!!");

+        return -1;

+    }

+    

+    LYINFLOG("Set wakealarm success !!!");

+

+    ret = sc_rtc_timer_uninit();

+    if(ret != 0)

+    {

+        LYINFLOG("Deinit failed!!!");

+    }

+    

+    return 0;

+

+}

+

+

+#ifdef __cplusplus

+}

+#endif

+

diff --git a/cap/zx297520v3/src/lynq/lib/libpoweralarm/makefile b/cap/zx297520v3/src/lynq/lib/libpoweralarm/makefile
new file mode 100755
index 0000000..fc6916f
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/lib/libpoweralarm/makefile
@@ -0,0 +1,75 @@
+SHELL = /bin/sh

+RM = rm -f

+

+LOCAL_CFLAGS := -Wall \

+                -std=gnu++14 \

+                -g -Os \

+                -flto \

+                -fPIC \

+                -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 ################# rock ROOT: $(ROOT),includedir:$(includedir),)

+

+LOCAL_PATH   = .

+

+LOCAL_C_INCLUDES = \

+  -I. \

+  -I$(LOCAL_PATH)/include \

+  -I$(ROOT)$(includedir)/logger \

+  -I$(ROOT)$(includedir)/liblog \

+  -I$(ROOT)$(includedir)/glib-2.0 \

+  -I$(ROOT)$(libdir)/glib-2.0/include \

+  -I$(ROOT)$(includedir)  \

+

+

+

+LOCAL_LIBS := \

+    -L. \

+    -ldl \

+    -lstdc++ \

+    -llynq-log \

+	-lsctel \

+

+

+SOURCES = $(wildcard *.cpp)

+

+EXECUTABLE = libpoweralarm.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)

+

diff --git a/cap/zx297520v3/src/lynq/packages/apps/lynq-systime-demo/lynq_systime_demo.cpp b/cap/zx297520v3/src/lynq/packages/apps/lynq-systime-demo/lynq_systime_demo.cpp
new file mode 100755
index 0000000..d0fffcf
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/packages/apps/lynq-systime-demo/lynq_systime_demo.cpp
@@ -0,0 +1,252 @@
+/**@File lynq-systime-demo.cpp

+ *

+ * @Brief As a example for liblynq-systime.

+ *

+ * @Author sj.zhang

+ *

+ * @Date 2023-08-15

+ *

+ * @Version V1.0

+ *

+ * @copyright Copyright (c) MobileTek

+ */

+#include <stdio.h>

+#include <dlfcn.h>

+#include <string.h>

+#include <stdlib.h>

+#include <time.h>

+

+typedef struct time_source_status

+{

+    int ntp;

+    int nitz;

+    int gnss;

+} time_src_status_s;

+

+#ifdef MOBILETEK_TARGET_PLATFORM_T106

+int (*lynq_sync_time_from_rtc)(void);

+int (*lynq_set_rtc_time)(void);

+int (*lynq_get_rtc_time)(unsigned long *ulsec);

+

+#endif

+void *dlHandle_systime = NULL;

+int (*modem_time_enable)(int enable);

+int (*gnss_time_enable)(int enable);

+int (*ntp_sync_time)(int enable);

+int (*user_set_time)(char *date, char *time);

+int (*lynq_get_time_src_status)(time_src_status_s *time_src);

+

+int lynq_ntp_sync_demo(int argc, char *argv[])

+{

+    int ret = -1;

+    if (argc != 3)

+    {

+        printf("Parameter number wrong !\n");

+        dlclose(dlHandle_systime);

+        return -1;

+    }

+    ntp_sync_time = (int (*)(int enable))dlsym(dlHandle_systime, "ntp_sync_time");

+    if (NULL == ntp_sync_time)

+    {

+        fprintf(stderr, "Failed to dlsym function ntp_sync_time : %s\n", dlerror());

+        dlclose(dlHandle_systime);

+        return -1;

+    }

+    ret = ntp_sync_time(atoi(argv[2]));

+    switch (ret)

+    {

+    case 0:

+        printf("set success!\n");

+        break;

+    case 1:

+        printf("NTP_ALREADY_ENABLE!\n");

+        break;

+    case 2:

+        printf("NTP_ALREADY_DISENABLE!\n");

+        break;

+    default:

+        break;

+    }

+    return ret;

+}

+

+int lynq_modem_sync_demo(int argc, char *argv[])

+{

+    int ret = -1;

+    if (argc != 3)

+    {

+        printf("Parameter number wrong !\n");

+        dlclose(dlHandle_systime);

+        return -1;

+    }

+    modem_time_enable = (int (*)(int enable))dlsym(dlHandle_systime, "modem_time_enable");

+    if (NULL == modem_time_enable)

+    {

+        fprintf(stderr, "Failed to dlsym function modem_time_enable: %s\n", dlerror());

+        dlclose(dlHandle_systime);

+        return -1;

+    }

+    ret = modem_time_enable(atoi(argv[2]));

+    printf("ret = %d\n", ret);

+    if (ret != 0 && ret != 4)

+    {

+        printf("modem_time_enable failed !\n");

+        dlclose(dlHandle_systime);

+        return -1;

+    }

+    return 0;

+}

+

+int lynq_gnss_sync_demo(int argc, char *argv[])

+{

+    int ret = -1;

+    if (argc != 3)

+    {

+        printf("Parameter number wrong !\n");

+        dlclose(dlHandle_systime);

+        return -1;

+    }

+    gnss_time_enable = (int (*)(int enable))dlsym(dlHandle_systime, "gnss_time_enable");

+    if (NULL == gnss_time_enable)

+    {

+        fprintf(stderr, "Failed to dlsym function gnss_time_enable: %s\n", dlerror());

+        dlclose(dlHandle_systime);

+        return -1;

+    }

+    ret = gnss_time_enable(atoi(argv[2]));

+    printf("ret = %d\n", ret);

+    if (ret != 0 && ret != 4)

+    {

+        printf("gnss_time_enable failed !\n");

+        dlclose(dlHandle_systime);

+        return -1;

+    }

+    return ret;

+}

+

+int lynq_user_set_time_demo(int argc, char *argv[])

+{

+    int ret = -1;

+    if (argc != 4)

+    {

+        printf("Parameter number wrong !\n");

+        dlclose(dlHandle_systime);

+        return -1;

+    }

+    user_set_time = (int (*)(char *date, char *time))dlsym(dlHandle_systime, "user_set_time");

+    if (NULL == user_set_time)

+    {

+        fprintf(stderr, "Failed to dlsym function user_set_time: %s\n", dlerror());

+        dlclose(dlHandle_systime);

+        return -1;

+    }

+    ret = user_set_time(argv[2], argv[3]);

+    return ret;

+}

+

+int lynq_get_time_src_status_demo(int arg_c, char *arg_v[])

+{

+    lynq_get_time_src_status = (int (*)(time_src_status_s *time_src))dlsym(dlHandle_systime, "lynq_get_time_src_status");

+    if (NULL == lynq_get_time_src_status)

+    {

+        fprintf(stderr, "Failed to dlsym function lynq_get_time_src_status : %s\n", dlerror());

+        dlclose(dlHandle_systime);

+        return -1;

+    }

+    time_src_status_s time_src = {0};

+    lynq_get_time_src_status(&time_src);

+    printf("time source status are :\nntp=%d\nnitz=%d\ngnss=%d\n", time_src.ntp, time_src.nitz, time_src.gnss);

+    return 0;

+}

+

+int main(int argc, char *argv[])

+{

+    int ret = -1;

+    char *cmd = argv[1];

+    printf("enter lynq_systime_demo \n");

+    dlHandle_systime = dlopen("/lib/liblynq-systime.so", RTLD_NOW);

+    if (!dlHandle_systime)

+    {

+        fprintf(stderr, "Failed to load library: %s\n", dlerror());

+        return 1;

+    }

+

+    if (cmd == NULL)

+    {

+        printf("No command received!\n");

+        dlclose(dlHandle_systime);

+        return 1;

+    }

+    else if (strcmp(cmd, "ntp") == 0)

+    {

+        ret = lynq_ntp_sync_demo(argc, argv);

+    }

+    else if (strcmp(cmd, "nitz") == 0)

+    {

+        ret = lynq_modem_sync_demo(argc, argv);

+    }

+    else if (strcmp(cmd, "gnss") == 0)

+    {

+        ret = lynq_gnss_sync_demo(argc, argv);

+    }

+    else if (strcmp(cmd, "user") == 0)

+    {

+        ret = lynq_user_set_time_demo(argc, argv);

+    }

+#ifdef MOBILETEK_TARGET_PLATFORM_T106

+    else if (strcmp(cmd, "sync_rtc") == 0)

+    {

+        lynq_sync_time_from_rtc = (int (*)(void))dlsym(dlHandle_systime, "lynq_sync_time_from_rtc");

+        if (NULL == lynq_sync_time_from_rtc)

+        {

+            fprintf(stderr, "Failed to dlsym function lynq_sync_time_from_rtc : %s\n", dlerror());

+            dlclose(dlHandle_systime);

+            return -1;

+        }

+        ret = lynq_sync_time_from_rtc();

+    }

+    else if (strcmp(cmd, "rtc_set") == 0)

+    {

+        lynq_set_rtc_time = (int (*)(void))dlsym(dlHandle_systime, "lynq_set_rtc_time");

+        if (NULL == lynq_set_rtc_time)

+        {

+            fprintf(stderr, "Failed to dlsym function lynq_set_rtc_time : %s\n", dlerror());

+            dlclose(dlHandle_systime);

+            return -1;

+        }

+        ret = lynq_set_rtc_time();

+    }

+    else if (strcmp(cmd, "rtc_get") == 0)

+    {

+        lynq_get_rtc_time = (int (*)(unsigned long *ulsec))dlsym(dlHandle_systime, "lynq_get_rtc_time");

+        if (NULL == lynq_get_rtc_time)

+        {

+            fprintf(stderr, "Failed to dlsym function lynq_get_rtc_time : %s\n", dlerror());

+            dlclose(dlHandle_systime);

+            return -1;

+        }

+        unsigned long time_ret;

+        ret = lynq_get_rtc_time(&time_ret);

+        time_t tp = (time_t)time_ret;

+        char *rtc_time = ctime(&tp);

+        printf("rtc_time seconds = %lu\n", time_ret);

+        printf("rtc time = %s\n", rtc_time);

+    }

+#endif

+    else if (strcmp(cmd, "src_status") == 0)

+    {

+        ret = lynq_get_time_src_status_demo(argc, argv);

+    }

+    else

+    {

+        printf("command wrong !\n");

+        dlclose(dlHandle_systime);

+        return -1;

+    }

+    if (0 != ret)

+    {

+        printf("ret = %d\n Command execution failure.\n", ret);

+    }

+    dlclose(dlHandle_systime);

+    return ret;

+}

diff --git a/cap/zx297520v3/src/lynq/packages/apps/lynq-systime-demo/makefile b/cap/zx297520v3/src/lynq/packages/apps/lynq-systime-demo/makefile
new file mode 100755
index 0000000..890f85a
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/packages/apps/lynq-systime-demo/makefile
@@ -0,0 +1,58 @@
+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)

+

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 f7becaa..caac23e 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
@@ -115,6 +115,14 @@
 	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.

+	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.

+

     sc_cfg_get("sntp_time_set_mode", mode, sizeof(mode));

 	if(strcmp(mode, "manual") == 0)

 	{

diff --git a/esdk_patch/linux_bb.diff b/esdk_patch/linux_bb.diff
index b4bc4f9..d68aeb5 100644
--- a/esdk_patch/linux_bb.diff
+++ b/esdk_patch/linux_bb.diff
@@ -1,20 +1,19 @@
 diff --git a/linux-zxic_5.10.bb b/linux-zxic_5.10.bb
-old mode 100644
-new mode 100755
-index 29942f4..4b10e1c
+index abadd9b..a8c7f65 100755
 --- a/linux-zxic_5.10.bb
 +++ b/linux-zxic_5.10.bb
-@@ -4,15 +4,15 @@ PV      = "${LINUX_VERSION}"
+@@ -4,16 +4,16 @@ PV      = "${LINUX_VERSION}"
  LICENSE = "GPLv2"
  LIC_FILES_CHKSUM ?= "file://COPYING;md5=6bc538ed5bd9a7fc9398086aedcd7e46"
  LINUX_VERSION    ?= "5.10.156"
 -
-+BSPDIR = "${TOPDIR}/../upstream/"
++BSPDIR = "${TOPDIR}/../upstream"
  #pub include
 -include ${BSPDIR}/sources/meta-zxic/conf/pub.inc
 +include ${TOPDIR}/layers/meta-zxic/conf/pub_esdk.inc
  
  DEPENDS += "kern-tools-native"
+ DEPENDS += "${@bb.utils.contains('DISTRO_FEATURES','dm-verity','zstd-native','',d)}"
  inherit kernel  siteinfo  
  
  EXTRA_OEMAKE_append = " LOADADDR=${KERNEL_LOADADDR} EXTRA_CFLAGS='${ZXIC_EXTRA_CFLAGS}' "
@@ -23,3 +22,11 @@
  # PR_CONFIG_cpe = "linux-5_10-cpe-${BOOT_CTL}-defconfig"
  # PR_CONFIG_v2x = "linux-5_10-v2x-${BOOT_CTL}-defconfig"
  PR_CONFIG_vehicle_dc = "linux-5_10-vehicle_dc-${BOOT_CTL}-defconfig"
+@@ -61,7 +61,7 @@ kernel_do_configure() {
+ 
+ fakeroot do_cpio () {
+ 	if ${@bb.utils.contains('DISTRO_FEATURES','dm-verity','true','false',d)}; then
+-		cp  -v  ${BSPDIR}/sources/meta-zxic-custom/conf/distro/dm-verity/${KERNEL_INITRAMFS_CPIO}   ${B}/
++		cp  -v  ${BSPDIR}/../esdk/sources/meta-zxic-custom/conf/distro/dm-verity/${KERNEL_INITRAMFS_CPIO}   ${B}/
+ 	fi
+ }
diff --git a/esdk_patch/mk_esdk.sh b/esdk_patch/mk_esdk.sh
index 5037d76..75a112e 100755
--- a/esdk_patch/mk_esdk.sh
+++ b/esdk_patch/mk_esdk.sh
@@ -3,7 +3,7 @@
 dest_dir_relative=$1
 intall_dir=$(pwd)
 
-chmod a+x ./vehicle_dc-glibc-x86_64-zxic-image-armv7a-zx297520v3-toolchain-ext-1.0.sh
+chmod a+x ./vehicle_dc_ref-glibc-x86_64-zxic-image-armv7a-zx297520v3-toolchain-ext-1.0.sh
 mkdir ${dest_dir_relative}
 cd $1
 dest_dir=$(pwd)
@@ -12,7 +12,7 @@
 	echo "Input invaild path for folders to install\n"
 	exit 1
 fi
-./vehicle_dc-glibc-x86_64-zxic-image-armv7a-zx297520v3-toolchain-ext-1.0.sh -d ${dest_dir}/esdk
+./vehicle_dc_ref-glibc-x86_64-zxic-image-armv7a-zx297520v3-toolchain-ext-1.0.sh -d ${dest_dir}/esdk
 tar -zxvf upstream.tar.gz -C $dest_dir
 ln -s ${dest_dir}/upstream/tools ${dest_dir}/esdk
 cp linux_bb.diff ${dest_dir}/esdk/layers/meta-zxic/recipes-kernel/linux/