[Feature][ZXW-86][ZXW-87]add status&net api

Only Configure:No,
Affected branch:master,
Affected module:LED
Is it affected on both ZXIC and MTK:only ZXIC,
Self-test:Yes,
Doc Update:NO.

Change-Id: I5bfa4e37373f1db96461951cf00966e4c500eb95
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 44be59c..f483df1 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
@@ -196,6 +196,7 @@
         liblynq-gpio \
         liblynq-irq \
         liblynq-at-common \
+        liblynq-led \
 	"
 
 zxic_lib += "${@bb.utils.contains('CONFIG_TEL_API_SUPPORT', 'RIL', 'libril', 'libtelsvr', d)}"
@@ -257,6 +258,8 @@
 	msm-svr \
 	player-demo \
 	lynq-ril-service \
+        lynq-led-demo \
+        lynq-led-sev \
         uci \
         gdb \
         mobiletek-tester-rdit \
@@ -339,7 +342,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-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/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/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..a4f9a38
--- /dev/null
+++ b/cap/zx297520v3/src/lynq/framework/lynq-led-sev/lynq_led_sev.c
@@ -0,0 +1,29 @@
+#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 LYNQ_UCI_SECTION "lynq_led"
+#define LYNQ_UCI_KEY "lynq_statusled_on"
+
+
+int main(int argc, const char *argv[])
+{
+    char led_enable[BUF_LEN] = "";
+
+    system("/usr/bin/lynq-default");
+    lynq_get_value(LYNQ_UCI_FILE, LYNQ_UCI_SECTION, LYNQ_UCI_KEY, led_enable);
+    if(atoi(led_enable))
+    {
+        system("echo 127 > /sys/class/gpio/export");
+        system("echo out > /sys/class/gpio/gpio127/direction");//92 net_Status,127 status
+        system("echo 127 > /sys/class/gpio/gpio127/value");
+    }
+
+    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-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-uci/lynq_uci.config b/cap/zx297520v3/src/lynq/lib/liblynq-uci/lynq_uci.config
index c53e44a..95577f1 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-uci/lynq_uci.config
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-uci/lynq_uci.config
@@ -27,3 +27,6 @@
 

 config  rndis_status 'rndis'

         option status '0'

+        

+config  lynq_led_rw  'lynq_led'

+        option lynq_statusled_on '1'
\ No newline at end of file