From d44a33fa49a701151d2c60a082e550b7d862cc1b Mon Sep 17 00:00:00 2001 From: Evgeny Gagua Date: Thu, 21 Apr 2022 20:10:11 +0100 Subject: [PATCH] Lololo 3D LFS --- Projects/LRF_ServerSlim/LRF_ServerSlim.vpj | 122 ++- Projects/LRF_ServerSlim/build | 8 +- Projects/LRF_ServerSlim/makefile | 193 +++- lib/App/3dSERVER/LRF_ClientHandler.cpp | 155 ++-- lib/App/3dSERVER/LRF_ClientHandler.h | 20 +- lib/App/3dSERVER/LRF_HardwareManager.cpp | 56 +- lib/App/3dSERVER/LRF_HardwareManager.h | 4 +- lib/App/3dSERVER/LRF_Server.h | 6 +- lib/App/3dSERVER/LRF_SlimKernel.cpp | 660 ++++++-------- lib/App/3dSERVER/LRF_SlimKernel.h | 59 +- lib/App/3dSERVER/LRF_TargetTracker.cpp | 46 +- lib/App/3dSERVER/LRF_TwinConnector.cpp | 929 +++++++++++++------- lib/App/3dSERVER/LRF_TwinConnector.h | 114 ++- lib/components/base/basicTransport.cpp | 2 +- lib/data/net/clientPort.cpp | 113 ++- lib/data/net/clientPort.h | 5 +- lib/data/protocol/protocolInternalLRF3D.cpp | 159 ++-- lib/data/protocol/protocolInternalLRF3D.h | 158 ++-- lib/data/protocol/protocolLGS_data.h | 23 + lib/hardware/soc/general/3DLRF.h | 6 +- 20 files changed, 1741 insertions(+), 1097 deletions(-) mode change 100644 => 100755 Projects/LRF_ServerSlim/build diff --git a/Projects/LRF_ServerSlim/LRF_ServerSlim.vpj b/Projects/LRF_ServerSlim/LRF_ServerSlim.vpj index fdd297de..cf62d697 100644 --- a/Projects/LRF_ServerSlim/LRF_ServerSlim.vpj +++ b/Projects/LRF_ServerSlim/LRF_ServerSlim.vpj @@ -8,13 +8,113 @@ BuildMakeFile="makefile" VCSProject="Git:"> + Defines='"/D_THREAD_SAFE" "/D_BSD_SOURCE" "/D_REENTRANT"'> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + OtherOptions="-lconfig -lpthread `pkg-config --libs rdkafka++`"/> + Defines='"/DPRU_SLAVE" "/DSLIM_KERNEL" "/D_THREAD_SAFE" "/D_BSD_SOURCE" "/D_REENTRANT" "/DDEBUG"'> + CmdLine='g++ -c %xup -x c++ %defd -O0 -g1 -ggdb -w -Wpointer-arith %~other -o "%bd%n%oe" %i %f' + OtherOptions="-std=c++11 -I../../lib/include"/> + CmdLine='g++ %xup -O0 -g1 -ggdb -w %~other -o "%o" %objs' + OtherOptions="-lconfig -lpthread `pkg-config --libs rdkafka++`"/> + + diff --git a/Projects/LRF_ServerSlim/build b/Projects/LRF_ServerSlim/build old mode 100644 new mode 100755 index 479962e8..443546f2 --- a/Projects/LRF_ServerSlim/build +++ b/Projects/LRF_ServerSlim/build @@ -1,9 +1,9 @@ #! /bin/sh -#make clean -e "CFG=Debug" -#make -e "CFG=Debug" +make clean -e "CFG=Debug_MASTER" +make -e "CFG=Debug_MASTER" -j4 -#make clean -e "CFG=Release" -make -e "CFG=Release" +make clean -e "CFG=Debug_SLAVE" +make -e "CFG=Debug_SLAVE" -j4 diff --git a/Projects/LRF_ServerSlim/makefile b/Projects/LRF_ServerSlim/makefile index 234f7a5b..4977e440 100644 --- a/Projects/LRF_ServerSlim/makefile +++ b/Projects/LRF_ServerSlim/makefile @@ -9,16 +9,16 @@ MKDIR=mkdir # -----End user-editable area----- -# If no configuration is specified, "Debug" will be used +# If no configuration is specified, "Release" will be used ifndef CFG -CFG=Debug +CFG=Release endif # -# Configuration: Debug +# Configuration: Release # -ifeq "$(CFG)" "Debug" -OUTDIR=Debug +ifeq "$(CFG)" "Release" +OUTDIR=Release OUTFILE=$(OUTDIR)/LRF_Server CFG_INC= CFG_LIB= @@ -65,8 +65,8 @@ ALL_OBJ=$(OUTDIR)/basicDualThread.o $(OUTDIR)/basicEngine.o \ $(OUTDIR)/ssdpAnnouncer.o $(OUTDIR)/transportSerial.o \ $(OUTDIR)/transportSocket.o -COMPILE=g++ -c -x c++ "-D_THREAD_SAFE" "-D_BSD_SOURCE" "-D_REENTRANT" "-DDEBUG" -O0 -g1 -ggdb -w -Wpointer-arith -std=c++11 -I../../lib/include -o "$(OUTDIR)/$(*F).o" $(CFG_INC) $< -LINK=g++ -O0 -g1 -ggdb -w -lconfig -lpthread -lelf -lcurses -lcdk -lcurl `pkg-config --libs rdkafka++` -o "$(OUTFILE)" $(ALL_OBJ) +COMPILE=g++ -c -x c++ "-D_THREAD_SAFE" "-D_BSD_SOURCE" "-D_REENTRANT" -O3 -w -Wpointer-arith -std=gnu++11 -I../../lib/include -o "$(OUTDIR)/$(*F).o" $(CFG_INC) $< +LINK=g++ -O3 -w -lconfig -lpthread -lelf -lcurses -lcdk -lcurl `pkg-config --libs rdkafka++` -s -o "$(OUTFILE)" $(ALL_OBJ) # Pattern rules $(OUTDIR)/%.o : ../../lib/hardware/soc/%.cpp @@ -170,11 +170,11 @@ cleanall: clean endif # -# Configuration: Release +# Configuration: Debug_MASTER # -ifeq "$(CFG)" "Release" -OUTDIR=Release -OUTFILE=$(OUTDIR)/LRF_Server +ifeq "$(CFG)" "Debug_MASTER" +OUTDIR=Debug_MASTER +OUTFILE=$(OUTDIR)/MASTER8196d CFG_INC= CFG_LIB= CFG_OBJ= @@ -220,8 +220,163 @@ ALL_OBJ=$(OUTDIR)/basicDualThread.o $(OUTDIR)/basicEngine.o \ $(OUTDIR)/ssdpAnnouncer.o $(OUTDIR)/transportSerial.o \ $(OUTDIR)/transportSocket.o -COMPILE=g++ -c -x c++ "-D_THREAD_SAFE" "-D_BSD_SOURCE" "-D_REENTRANT" -O3 -w -Wpointer-arith -std=gnu++11 -I../../lib/include -o "$(OUTDIR)/$(*F).o" $(CFG_INC) $< -LINK=g++ -O3 -w -lconfig -lpthread -lelf -lcurses -lcdk -lcurl `pkg-config --libs rdkafka++` -s -o "$(OUTFILE)" $(ALL_OBJ) +COMPILE=g++ -c -x c++ "-DSLIM_KERNEL" "-D_THREAD_SAFE" "-D_BSD_SOURCE" "-D_REENTRANT" "-DDEBUG" -O0 -g1 -ggdb -w -Wpointer-arith -std=c++11 -I../../lib/include -o "$(OUTDIR)/$(*F).o" $(CFG_INC) $< +LINK=g++ -O0 -g1 -ggdb -w -lconfig -lpthread `pkg-config --libs rdkafka++` -o "$(OUTFILE)" $(ALL_OBJ) + +# Pattern rules +$(OUTDIR)/%.o : ../../lib/hardware/soc/%.cpp + $(COMPILE) + +$(OUTDIR)/%.o : ../../lib/components/object/%.cpp + $(COMPILE) + +$(OUTDIR)/%.o : ../../lib/hardware/soc/modules/pru/%.cpp + $(COMPILE) + +$(OUTDIR)/%.o : ../../lib/data/transport/%.cpp + $(COMPILE) + +$(OUTDIR)/%.o : ../../lib/data/protocol/%.cpp + $(COMPILE) + +$(OUTDIR)/%.o : ../../lib/data/net/%.cpp + $(COMPILE) + +$(OUTDIR)/%.o : ../../lib/hardware/soc/modules/pwmss/%.cpp + $(COMPILE) + +$(OUTDIR)/%.o : ../../lib/App/3dSERVER/%.cpp + $(COMPILE) + +$(OUTDIR)/%.o : ../../lib/alg/lgs/%.cpp + $(COMPILE) + +$(OUTDIR)/%.o : ../../lib/data/ssdp/%.cpp + $(COMPILE) + +$(OUTDIR)/%.o : ../../lib/components/base/%.cpp + $(COMPILE) + +$(OUTDIR)/%.o : ../../lib/alg/generic/%.cpp + $(COMPILE) + +$(OUTDIR)/%.o : ../../lib/hardware/can/%.cpp + $(COMPILE) + +$(OUTDIR)/%.o : ../../lib/hardware/soc/%.c + $(COMPILE) + +$(OUTDIR)/%.o : ../../lib/components/object/%.c + $(COMPILE) + +$(OUTDIR)/%.o : ../../lib/hardware/soc/modules/pru/%.c + $(COMPILE) + +$(OUTDIR)/%.o : ../../lib/data/transport/%.c + $(COMPILE) + +$(OUTDIR)/%.o : ../../lib/data/protocol/%.c + $(COMPILE) + +$(OUTDIR)/%.o : ../../lib/data/net/%.c + $(COMPILE) + +$(OUTDIR)/%.o : ../../lib/hardware/soc/modules/pwmss/%.c + $(COMPILE) + +$(OUTDIR)/%.o : ../../lib/App/3dSERVER/%.c + $(COMPILE) + +$(OUTDIR)/%.o : ../../lib/alg/lgs/%.c + $(COMPILE) + +$(OUTDIR)/%.o : ../../lib/data/ssdp/%.c + $(COMPILE) + +$(OUTDIR)/%.o : ../../lib/components/base/%.c + $(COMPILE) + +$(OUTDIR)/%.o : ../../lib/alg/generic/%.c + $(COMPILE) + +$(OUTDIR)/%.o : ../../lib/hardware/can/%.c + $(COMPILE) + +# Build rules +all: $(OUTFILE) + +$(OUTFILE): $(OUTDIR) $(OBJ) + $(LINK) + +$(OUTDIR): + $(MKDIR) -p "$(OUTDIR)" + +# Rebuild this project +rebuild: cleanall + @$(MAKE) -f "$(strip $(MAKEFILE_LIST))" $(MAKEFLAGS) all + +# Clean this project +clean: + $(RM) -f $(OUTFILE) + $(RM) -f $(OBJ) + +# Clean this project and all dependencies +cleanall: clean +endif + +# +# Configuration: Debug_SLAVE +# +ifeq "$(CFG)" "Debug_SLAVE" +OUTDIR=Debug_SLAVE +OUTFILE=$(OUTDIR)/SLAVE8196d +CFG_INC= +CFG_LIB= +CFG_OBJ= +COMMON_OBJ=$(OUTDIR)/basicDualThread.o $(OUTDIR)/basicEngine.o \ + $(OUTDIR)/basicEvent.o $(OUTDIR)/basicEventHandler.o \ + $(OUTDIR)/basicEventHeap.o $(OUTDIR)/basicFunctionality.o \ + $(OUTDIR)/basicLogCollection.o $(OUTDIR)/basicLoggingService.o \ + $(OUTDIR)/basicMemoryOperation.o $(OUTDIR)/basicObject.o \ + $(OUTDIR)/basicRing.o $(OUTDIR)/basicSettings.o \ + $(OUTDIR)/basicSettingsProvider.o $(OUTDIR)/basicThread.o \ + $(OUTDIR)/basicTransport.o $(OUTDIR)/can_lib.o $(OUTDIR)/canbus.o \ + $(OUTDIR)/classSOC.o $(OUTDIR)/clientPort.o $(OUTDIR)/detector.o \ + $(OUTDIR)/LRF_ClientHandler.o $(OUTDIR)/LRF_Detector.o \ + $(OUTDIR)/LRF_HardwareManager.o $(OUTDIR)/LRF_Server.o \ + $(OUTDIR)/LRF_SlimKernel.o $(OUTDIR)/LRF_TargetTracker.o \ + $(OUTDIR)/LRF_TwinConnector.o $(OUTDIR)/mask.o $(OUTDIR)/md5.o \ + $(OUTDIR)/netClientHandler.o $(OUTDIR)/netServer.o \ + $(OUTDIR)/objectFileLoggingService.o $(OUTDIR)/protocol.o \ + $(OUTDIR)/protocolInternalLRF3D.o $(OUTDIR)/protocolLGS3D.o \ + $(OUTDIR)/protocolLGS3D_server.o $(OUTDIR)/protocolTGZ.o \ + $(OUTDIR)/pru_ss.o $(OUTDIR)/pwm_ss.o $(OUTDIR)/serverPort.o \ + $(OUTDIR)/ssdpAnnouncer.o $(OUTDIR)/transportSerial.o \ + $(OUTDIR)/transportSocket.o +OBJ=$(COMMON_OBJ) $(CFG_OBJ) +ALL_OBJ=$(OUTDIR)/basicDualThread.o $(OUTDIR)/basicEngine.o \ + $(OUTDIR)/basicEvent.o $(OUTDIR)/basicEventHandler.o \ + $(OUTDIR)/basicEventHeap.o $(OUTDIR)/basicFunctionality.o \ + $(OUTDIR)/basicLogCollection.o $(OUTDIR)/basicLoggingService.o \ + $(OUTDIR)/basicMemoryOperation.o $(OUTDIR)/basicObject.o \ + $(OUTDIR)/basicRing.o $(OUTDIR)/basicSettings.o \ + $(OUTDIR)/basicSettingsProvider.o $(OUTDIR)/basicThread.o \ + $(OUTDIR)/basicTransport.o $(OUTDIR)/can_lib.o $(OUTDIR)/canbus.o \ + $(OUTDIR)/classSOC.o $(OUTDIR)/clientPort.o $(OUTDIR)/detector.o \ + $(OUTDIR)/LRF_ClientHandler.o $(OUTDIR)/LRF_Detector.o \ + $(OUTDIR)/LRF_HardwareManager.o $(OUTDIR)/LRF_Server.o \ + $(OUTDIR)/LRF_SlimKernel.o $(OUTDIR)/LRF_TargetTracker.o \ + $(OUTDIR)/LRF_TwinConnector.o $(OUTDIR)/mask.o $(OUTDIR)/md5.o \ + $(OUTDIR)/netClientHandler.o $(OUTDIR)/netServer.o \ + $(OUTDIR)/objectFileLoggingService.o $(OUTDIR)/protocol.o \ + $(OUTDIR)/protocolInternalLRF3D.o $(OUTDIR)/protocolLGS3D.o \ + $(OUTDIR)/protocolLGS3D_server.o $(OUTDIR)/protocolTGZ.o \ + $(OUTDIR)/pru_ss.o $(OUTDIR)/pwm_ss.o $(OUTDIR)/serverPort.o \ + $(OUTDIR)/ssdpAnnouncer.o $(OUTDIR)/transportSerial.o \ + $(OUTDIR)/transportSocket.o + +COMPILE=g++ -c -x c++ "-DPRU_SLAVE" "-DSLIM_KERNEL" "-D_THREAD_SAFE" "-D_BSD_SOURCE" "-D_REENTRANT" "-DDEBUG" -O0 -g1 -ggdb -w -Wpointer-arith -std=c++11 -I../../lib/include -o "$(OUTDIR)/$(*F).o" $(CFG_INC) $< +LINK=g++ -O0 -g1 -ggdb -w -lconfig -lpthread `pkg-config --libs rdkafka++` -o "$(OUTFILE)" $(ALL_OBJ) # Pattern rules $(OUTDIR)/%.o : ../../lib/hardware/soc/%.cpp @@ -347,17 +502,17 @@ $(OUTDIR)/canbus.o: ../../lib/hardware/can/canbus.cpp ../../lib/hardware/can/can $(OUTDIR)/classSOC.o: ../../lib/hardware/soc/classSOC.cpp ../../lib/hardware/soc/classSOC.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/hardware/soc/general/3DLRF.h ../../lib/hardware/soc/general/am437x_prmcm.h ../../lib/hardware/soc/modules/gpio/gpio_ss.h ../../lib/hardware/soc/modules/adc/adc_ss.h ../../lib/hardware/soc/modules/pru/tupus_ext.h ../../lib/hardware/soc/modules/pru/pru_ss.h ../../lib/cli/cli.h ../../lib/hardware/soc/general/sitara-am437x.h ../../lib/hardware/soc/modules/pru/pru_ctrl.h ../../lib/hardware/soc/modules/pru/pru_cfg.h ../../lib/hardware/soc/modules/pwmss/sys_pwmss.h ../../lib/hardware/soc/modules/pwmss/pwm_ss.h ../../lib/hardware/soc/general/sitara-am437x.h ../../lib/hardware/soc/general/am437x_cm.h ../../lib/hardware/soc/modules/pwmss/hw_ehrpwm.h ../../lib/cli/cli.h ../../lib/hardware/soc/general/sitara-am437x.h $(OUTDIR)/clientPort.o: ../../lib/data/net/clientPort.cpp ../../lib/data/net/clientPort.h ../../lib/data/transport/transportSocket.h ../../lib/components/base/basicDualThread.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicTransport.h $(OUTDIR)/detector.o: ../../lib/alg/lgs/detector.cpp ../../lib/alg/lgs/detector.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicStatus.h ../../lib/alg/generic/md5.h ../../lib/alg/lgs/detectorStructures.h ../../lib/components/base/basicTypes.h -$(OUTDIR)/LRF_ClientHandler.o: ../../lib/App/3dSERVER/LRF_ClientHandler.cpp ../../lib/App/3dSERVER/LRF_ClientHandler.h ../../lib/data/protocol/protocolLGS3D_server.h ../../lib/data/net/netClientHandler.h ../../lib/data/protocol/protocol.h ../../lib/components/base/basicEngine.h ../../lib/components/base/basicEventHandler.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/Transform.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/data/net/serverPort.h ../../lib/data/transport/transportSocket.h ../../lib/components/base/basicDualThread.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicTransport.h ../../lib/App/3dSERVER/LRF_Kernel.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicMutex.h +$(OUTDIR)/LRF_ClientHandler.o: ../../lib/App/3dSERVER/LRF_ClientHandler.cpp ../../lib/App/3dSERVER/LRF_ClientHandler.h ../../lib/data/protocol/protocolLGS3D_server.h ../../lib/data/net/netClientHandler.h ../../lib/data/protocol/protocol.h ../../lib/components/base/basicEngine.h ../../lib/components/base/basicEventHandler.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/Transform.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/data/net/serverPort.h ../../lib/data/transport/transportSocket.h ../../lib/components/base/basicDualThread.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicTransport.h ../../lib/App/3dSERVER/LRF_SlimKernel.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicEngine.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicEventHeap.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/Transform.h ../../lib/App/3dSERVER/LRF_HardwareManager.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/hardware/soc/classSOC.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/hardware/soc/general/3DLRF.h ../../lib/hardware/soc/general/am437x_prmcm.h ../../lib/hardware/soc/modules/gpio/gpio_ss.h ../../lib/hardware/soc/modules/adc/adc_ss.h ../../lib/hardware/soc/modules/pru/tupus_ext.h ../../lib/hardware/soc/modules/pru/pru_ss.h ../../lib/cli/cli.h ../../lib/hardware/soc/general/sitara-am437x.h ../../lib/hardware/soc/modules/pru/pru_ctrl.h ../../lib/hardware/soc/modules/pru/pru_cfg.h ../../lib/hardware/soc/modules/pwmss/sys_pwmss.h ../../lib/hardware/soc/modules/pwmss/pwm_ss.h ../../lib/hardware/soc/general/sitara-am437x.h ../../lib/hardware/soc/general/am437x_cm.h ../../lib/hardware/soc/modules/pwmss/hw_ehrpwm.h ../../lib/cli/cli.h ../../lib/hardware/soc/general/3DLRF.h ../../lib/alg/lgs/detectorStructures.h ../../lib/components/base/basicTypes.h ../../lib/hardware/soc/general/sitara-am437x.h ../../lib/hardware/can/canbus.h ../../lib/data/protocol/protocolTGZ.h ../../lib/components/base/basicTransport.h ../../lib/data/protocol/protocol.h ../../lib/App/3dSERVER/LRF_TwinConnector.h ../../lib/data/protocol/protocolInternalLRF3D.h ../../lib/data/protocol/protocol.h ../../lib/hardware/soc/general/3DLRF.h ../../lib/data/net/clientPort.h ../../lib/data/transport/transportSocket.h ../../lib/components/base/basicDualThread.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicTransport.h ../../lib/data/net/serverPort.h ../../lib/data/transport/transportSocket.h ../../lib/components/base/basicDualThread.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicTransport.h ../../lib/alg/lgs/detectorStructures.h ../../lib/components/base/basicTypes.h ../../lib/alg/lgs/detector.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicStatus.h ../../lib/alg/generic/md5.h ../../lib/alg/lgs/detectorStructures.h ../../lib/components/base/basicTypes.h ../../lib/alg/lgs/mask.h ../../lib/components/base/basicTypes.h ../../lib/hardware/soc/general/3DLRF.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/gui/gui.h ../../lib/data/net/netServer.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/data/protocol/protocol.h ../../lib/App/3dSERVER/LRF_TargetTracker.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/hardware/soc/general/3DLRF.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicMutex.h $(OUTDIR)/LRF_Detector.o: ../../lib/App/3dSERVER/LRF_Detector.cpp ../../lib/App/3dSERVER/LRF_Detector.h ../../lib/alg/lgs/detector.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicStatus.h ../../lib/alg/generic/md5.h ../../lib/alg/lgs/detectorStructures.h ../../lib/components/base/basicTypes.h -$(OUTDIR)/LRF_HardwareManager.o: ../../lib/App/3dSERVER/LRF_HardwareManager.cpp ../../lib/App/3dSERVER/LRF_HardwareManager.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicEventHeap.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/Transform.h ../../lib/hardware/soc/classSOC.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/hardware/soc/general/3DLRF.h ../../lib/hardware/soc/general/am437x_prmcm.h ../../lib/hardware/soc/modules/gpio/gpio_ss.h ../../lib/hardware/soc/modules/adc/adc_ss.h ../../lib/hardware/soc/modules/pru/tupus_ext.h ../../lib/hardware/soc/modules/pru/pru_ss.h ../../lib/cli/cli.h ../../lib/hardware/soc/general/sitara-am437x.h ../../lib/hardware/soc/modules/pru/pru_ctrl.h ../../lib/hardware/soc/modules/pru/pru_cfg.h ../../lib/hardware/soc/modules/pwmss/sys_pwmss.h ../../lib/hardware/soc/modules/pwmss/pwm_ss.h ../../lib/hardware/soc/general/sitara-am437x.h ../../lib/hardware/soc/general/am437x_cm.h ../../lib/hardware/soc/modules/pwmss/hw_ehrpwm.h ../../lib/cli/cli.h ../../lib/hardware/soc/general/3DLRF.h ../../lib/alg/lgs/detectorStructures.h ../../lib/components/base/basicTypes.h ../../lib/hardware/soc/general/sitara-am437x.h ../../lib/hardware/can/canbus.h ../../lib/data/protocol/protocolTGZ.h ../../lib/components/base/basicTransport.h ../../lib/data/protocol/protocol.h -$(OUTDIR)/LRF_Server.o: ../../lib/App/3dSERVER/LRF_Server.cpp ../../lib/App/3dSERVER/LRF_Server.h ../../lib/components/base/basicSettings.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicMemoryOperation.h ../../lib/components/object/objectFileLoggingService.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/data/net/netServer.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicEngine.h ../../lib/components/base/basicEventHeap.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/Transform.h ../../lib/data/protocol/protocol.h ../../lib/data/net/netClientHandler.h ../../lib/data/protocol/protocol.h ../../lib/components/base/basicEngine.h ../../lib/components/base/basicEventHandler.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/Transform.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/data/net/serverPort.h ../../lib/data/transport/transportSocket.h ../../lib/components/base/basicDualThread.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicTransport.h ../../lib/data/ssdp/ssdpAnnouncer.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/data/ssdp/queue.h ../../lib/App/3dSERVER/LRF_Kernel.h ../../lib/App/3dSERVER/LRF_HardwareManager.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicEventHeap.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/Transform.h ../../lib/hardware/soc/classSOC.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/hardware/soc/general/3DLRF.h ../../lib/hardware/soc/general/am437x_prmcm.h ../../lib/hardware/soc/modules/gpio/gpio_ss.h ../../lib/hardware/soc/modules/adc/adc_ss.h ../../lib/hardware/soc/modules/pru/tupus_ext.h ../../lib/hardware/soc/modules/pru/pru_ss.h ../../lib/cli/cli.h ../../lib/hardware/soc/general/sitara-am437x.h ../../lib/hardware/soc/modules/pru/pru_ctrl.h ../../lib/hardware/soc/modules/pru/pru_cfg.h ../../lib/hardware/soc/modules/pwmss/sys_pwmss.h ../../lib/hardware/soc/modules/pwmss/pwm_ss.h ../../lib/hardware/soc/general/sitara-am437x.h ../../lib/hardware/soc/general/am437x_cm.h ../../lib/hardware/soc/modules/pwmss/hw_ehrpwm.h ../../lib/cli/cli.h ../../lib/hardware/soc/general/3DLRF.h ../../lib/alg/lgs/detectorStructures.h ../../lib/components/base/basicTypes.h ../../lib/hardware/soc/general/sitara-am437x.h ../../lib/hardware/can/canbus.h ../../lib/data/protocol/protocolTGZ.h ../../lib/components/base/basicTransport.h ../../lib/data/protocol/protocol.h -$(OUTDIR)/LRF_SlimKernel.o: ../../lib/App/3dSERVER/LRF_SlimKernel.cpp ../../lib/App/3dSERVER/LRF_SlimKernel.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicEngine.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicEventHeap.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/Transform.h ../../lib/App/3dSERVER/LRF_HardwareManager.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicEventHeap.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/Transform.h ../../lib/hardware/soc/classSOC.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/hardware/soc/general/3DLRF.h ../../lib/hardware/soc/general/am437x_prmcm.h ../../lib/hardware/soc/modules/gpio/gpio_ss.h ../../lib/hardware/soc/modules/adc/adc_ss.h ../../lib/hardware/soc/modules/pru/tupus_ext.h ../../lib/hardware/soc/modules/pru/pru_ss.h ../../lib/cli/cli.h ../../lib/hardware/soc/general/sitara-am437x.h ../../lib/hardware/soc/modules/pru/pru_ctrl.h ../../lib/hardware/soc/modules/pru/pru_cfg.h ../../lib/hardware/soc/modules/pwmss/sys_pwmss.h ../../lib/hardware/soc/modules/pwmss/pwm_ss.h ../../lib/hardware/soc/general/sitara-am437x.h ../../lib/hardware/soc/general/am437x_cm.h ../../lib/hardware/soc/modules/pwmss/hw_ehrpwm.h ../../lib/cli/cli.h ../../lib/hardware/soc/general/3DLRF.h ../../lib/alg/lgs/detectorStructures.h ../../lib/components/base/basicTypes.h ../../lib/hardware/soc/general/sitara-am437x.h ../../lib/hardware/can/canbus.h ../../lib/data/protocol/protocolTGZ.h ../../lib/components/base/basicTransport.h ../../lib/data/protocol/protocol.h ../../lib/App/3dSERVER/LRF_TwinConnector.h ../../lib/data/protocol/protocolInternalLRF3D.h ../../lib/data/protocol/protocol.h ../../lib/hardware/soc/general/3DLRF.h ../../lib/data/net/clientPort.h ../../lib/data/transport/transportSocket.h ../../lib/components/base/basicDualThread.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicTransport.h ../../lib/data/net/serverPort.h ../../lib/data/transport/transportSocket.h ../../lib/components/base/basicDualThread.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicTransport.h ../../lib/alg/lgs/detectorStructures.h ../../lib/components/base/basicTypes.h ../../lib/alg/lgs/detector.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicStatus.h ../../lib/alg/generic/md5.h ../../lib/alg/lgs/detectorStructures.h ../../lib/components/base/basicTypes.h ../../lib/alg/lgs/mask.h ../../lib/components/base/basicTypes.h ../../lib/hardware/soc/general/3DLRF.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/gui/gui.h ../../lib/data/net/netServer.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicEngine.h ../../lib/components/base/basicEventHeap.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/Transform.h ../../lib/data/protocol/protocol.h ../../lib/data/net/netClientHandler.h ../../lib/data/protocol/protocol.h ../../lib/components/base/basicEngine.h ../../lib/components/base/basicEventHandler.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/Transform.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/data/net/serverPort.h ../../lib/data/transport/transportSocket.h ../../lib/components/base/basicDualThread.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicTransport.h ../../lib/App/3dSERVER/LRF_TargetTracker.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/hardware/soc/general/3DLRF.h ../../lib/App/3dSERVER/LRF_Detector.h ../../lib/alg/lgs/detector.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicStatus.h ../../lib/alg/generic/md5.h ../../lib/alg/lgs/detectorStructures.h ../../lib/components/base/basicTypes.h ../../lib/App/3dSERVER/LRF_ClientHandler.h ../../lib/data/protocol/protocolLGS3D_server.h ../../lib/data/net/netClientHandler.h ../../lib/data/protocol/protocol.h ../../lib/components/base/basicEngine.h ../../lib/components/base/basicEventHandler.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/Transform.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/data/net/serverPort.h ../../lib/data/transport/transportSocket.h ../../lib/components/base/basicDualThread.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicTransport.h ../../lib/App/3dSERVER/LRF_Kernel.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicMutex.h +$(OUTDIR)/LRF_HardwareManager.o: ../../lib/App/3dSERVER/LRF_HardwareManager.cpp ../../lib/App/3dSERVER/LRF_HardwareManager.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/hardware/soc/classSOC.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/hardware/soc/general/3DLRF.h ../../lib/hardware/soc/general/am437x_prmcm.h ../../lib/hardware/soc/modules/gpio/gpio_ss.h ../../lib/hardware/soc/modules/adc/adc_ss.h ../../lib/hardware/soc/modules/pru/tupus_ext.h ../../lib/hardware/soc/modules/pru/pru_ss.h ../../lib/cli/cli.h ../../lib/hardware/soc/general/sitara-am437x.h ../../lib/hardware/soc/modules/pru/pru_ctrl.h ../../lib/hardware/soc/modules/pru/pru_cfg.h ../../lib/hardware/soc/modules/pwmss/sys_pwmss.h ../../lib/hardware/soc/modules/pwmss/pwm_ss.h ../../lib/hardware/soc/general/sitara-am437x.h ../../lib/hardware/soc/general/am437x_cm.h ../../lib/hardware/soc/modules/pwmss/hw_ehrpwm.h ../../lib/cli/cli.h ../../lib/hardware/soc/general/3DLRF.h ../../lib/alg/lgs/detectorStructures.h ../../lib/components/base/basicTypes.h ../../lib/hardware/soc/general/sitara-am437x.h ../../lib/hardware/can/canbus.h ../../lib/data/protocol/protocolTGZ.h ../../lib/components/base/basicTransport.h ../../lib/data/protocol/protocol.h +$(OUTDIR)/LRF_Server.o: ../../lib/App/3dSERVER/LRF_Server.cpp ../../lib/App/3dSERVER/LRF_Server.h ../../lib/components/base/basicSettings.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicMemoryOperation.h ../../lib/components/object/objectFileLoggingService.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/data/net/netServer.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/data/protocol/protocol.h ../../lib/data/ssdp/ssdpAnnouncer.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/data/ssdp/queue.h ../../lib/App/3dSERVER/LRF_SlimKernel.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicEngine.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicEventHeap.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/Transform.h ../../lib/App/3dSERVER/LRF_HardwareManager.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/hardware/soc/classSOC.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/hardware/soc/general/3DLRF.h ../../lib/hardware/soc/general/am437x_prmcm.h ../../lib/hardware/soc/modules/gpio/gpio_ss.h ../../lib/hardware/soc/modules/adc/adc_ss.h ../../lib/hardware/soc/modules/pru/tupus_ext.h ../../lib/hardware/soc/modules/pru/pru_ss.h ../../lib/cli/cli.h ../../lib/hardware/soc/general/sitara-am437x.h ../../lib/hardware/soc/modules/pru/pru_ctrl.h ../../lib/hardware/soc/modules/pru/pru_cfg.h ../../lib/hardware/soc/modules/pwmss/sys_pwmss.h ../../lib/hardware/soc/modules/pwmss/pwm_ss.h ../../lib/hardware/soc/general/sitara-am437x.h ../../lib/hardware/soc/general/am437x_cm.h ../../lib/hardware/soc/modules/pwmss/hw_ehrpwm.h ../../lib/cli/cli.h ../../lib/hardware/soc/general/3DLRF.h ../../lib/alg/lgs/detectorStructures.h ../../lib/components/base/basicTypes.h ../../lib/hardware/soc/general/sitara-am437x.h ../../lib/hardware/can/canbus.h ../../lib/data/protocol/protocolTGZ.h ../../lib/components/base/basicTransport.h ../../lib/data/protocol/protocol.h ../../lib/App/3dSERVER/LRF_TwinConnector.h ../../lib/data/protocol/protocolInternalLRF3D.h ../../lib/data/protocol/protocol.h ../../lib/hardware/soc/general/3DLRF.h ../../lib/data/net/clientPort.h ../../lib/data/transport/transportSocket.h ../../lib/components/base/basicDualThread.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicTransport.h ../../lib/data/net/serverPort.h ../../lib/data/transport/transportSocket.h ../../lib/components/base/basicDualThread.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicTransport.h ../../lib/alg/lgs/detectorStructures.h ../../lib/components/base/basicTypes.h ../../lib/alg/lgs/detector.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicStatus.h ../../lib/alg/generic/md5.h ../../lib/alg/lgs/detectorStructures.h ../../lib/components/base/basicTypes.h ../../lib/alg/lgs/mask.h ../../lib/components/base/basicTypes.h ../../lib/hardware/soc/general/3DLRF.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/gui/gui.h ../../lib/data/net/netServer.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/data/protocol/protocol.h ../../lib/App/3dSERVER/LRF_TargetTracker.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/hardware/soc/general/3DLRF.h ../../lib/App/3dSERVER/LRF_Kernel.h ../../lib/App/3dSERVER/LRF_HardwareManager.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/hardware/soc/classSOC.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/hardware/soc/general/3DLRF.h ../../lib/hardware/soc/general/am437x_prmcm.h ../../lib/hardware/soc/modules/gpio/gpio_ss.h ../../lib/hardware/soc/modules/adc/adc_ss.h ../../lib/hardware/soc/modules/pru/tupus_ext.h ../../lib/hardware/soc/modules/pru/pru_ss.h ../../lib/cli/cli.h ../../lib/hardware/soc/general/sitara-am437x.h ../../lib/hardware/soc/modules/pru/pru_ctrl.h ../../lib/hardware/soc/modules/pru/pru_cfg.h ../../lib/hardware/soc/modules/pwmss/sys_pwmss.h ../../lib/hardware/soc/modules/pwmss/pwm_ss.h ../../lib/hardware/soc/general/sitara-am437x.h ../../lib/hardware/soc/general/am437x_cm.h ../../lib/hardware/soc/modules/pwmss/hw_ehrpwm.h ../../lib/cli/cli.h ../../lib/hardware/soc/general/3DLRF.h ../../lib/alg/lgs/detectorStructures.h ../../lib/components/base/basicTypes.h ../../lib/hardware/soc/general/sitara-am437x.h ../../lib/hardware/can/canbus.h ../../lib/data/protocol/protocolTGZ.h ../../lib/components/base/basicTransport.h ../../lib/data/protocol/protocol.h +$(OUTDIR)/LRF_SlimKernel.o: ../../lib/App/3dSERVER/LRF_SlimKernel.cpp ../../lib/App/3dSERVER/LRF_SlimKernel.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicEngine.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicEventHeap.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/Transform.h ../../lib/App/3dSERVER/LRF_HardwareManager.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/hardware/soc/classSOC.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/hardware/soc/general/3DLRF.h ../../lib/hardware/soc/general/am437x_prmcm.h ../../lib/hardware/soc/modules/gpio/gpio_ss.h ../../lib/hardware/soc/modules/adc/adc_ss.h ../../lib/hardware/soc/modules/pru/tupus_ext.h ../../lib/hardware/soc/modules/pru/pru_ss.h ../../lib/cli/cli.h ../../lib/hardware/soc/general/sitara-am437x.h ../../lib/hardware/soc/modules/pru/pru_ctrl.h ../../lib/hardware/soc/modules/pru/pru_cfg.h ../../lib/hardware/soc/modules/pwmss/sys_pwmss.h ../../lib/hardware/soc/modules/pwmss/pwm_ss.h ../../lib/hardware/soc/general/sitara-am437x.h ../../lib/hardware/soc/general/am437x_cm.h ../../lib/hardware/soc/modules/pwmss/hw_ehrpwm.h ../../lib/cli/cli.h ../../lib/hardware/soc/general/3DLRF.h ../../lib/alg/lgs/detectorStructures.h ../../lib/components/base/basicTypes.h ../../lib/hardware/soc/general/sitara-am437x.h ../../lib/hardware/can/canbus.h ../../lib/data/protocol/protocolTGZ.h ../../lib/components/base/basicTransport.h ../../lib/data/protocol/protocol.h ../../lib/App/3dSERVER/LRF_TwinConnector.h ../../lib/data/protocol/protocolInternalLRF3D.h ../../lib/data/protocol/protocol.h ../../lib/hardware/soc/general/3DLRF.h ../../lib/data/net/clientPort.h ../../lib/data/transport/transportSocket.h ../../lib/components/base/basicDualThread.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicTransport.h ../../lib/data/net/serverPort.h ../../lib/data/transport/transportSocket.h ../../lib/components/base/basicDualThread.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicTransport.h ../../lib/alg/lgs/detectorStructures.h ../../lib/components/base/basicTypes.h ../../lib/alg/lgs/detector.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicStatus.h ../../lib/alg/generic/md5.h ../../lib/alg/lgs/detectorStructures.h ../../lib/components/base/basicTypes.h ../../lib/alg/lgs/mask.h ../../lib/components/base/basicTypes.h ../../lib/hardware/soc/general/3DLRF.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/gui/gui.h ../../lib/data/net/netServer.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/data/protocol/protocol.h ../../lib/App/3dSERVER/LRF_TargetTracker.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/hardware/soc/general/3DLRF.h ../../lib/App/3dSERVER/LRF_Detector.h ../../lib/alg/lgs/detector.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicStatus.h ../../lib/alg/generic/md5.h ../../lib/alg/lgs/detectorStructures.h ../../lib/components/base/basicTypes.h ../../lib/App/3dSERVER/LRF_ClientHandler.h ../../lib/data/protocol/protocolLGS3D_server.h ../../lib/data/net/netClientHandler.h ../../lib/data/protocol/protocol.h ../../lib/components/base/basicEngine.h ../../lib/components/base/basicEventHandler.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/Transform.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/data/net/serverPort.h ../../lib/data/transport/transportSocket.h ../../lib/components/base/basicDualThread.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicTransport.h ../../lib/App/3dSERVER/LRF_SlimKernel.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicEngine.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicEventHeap.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/Transform.h ../../lib/App/3dSERVER/LRF_HardwareManager.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/hardware/soc/classSOC.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/hardware/soc/general/3DLRF.h ../../lib/hardware/soc/general/am437x_prmcm.h ../../lib/hardware/soc/modules/gpio/gpio_ss.h ../../lib/hardware/soc/modules/adc/adc_ss.h ../../lib/hardware/soc/modules/pru/tupus_ext.h ../../lib/hardware/soc/modules/pru/pru_ss.h ../../lib/cli/cli.h ../../lib/hardware/soc/general/sitara-am437x.h ../../lib/hardware/soc/modules/pru/pru_ctrl.h ../../lib/hardware/soc/modules/pru/pru_cfg.h ../../lib/hardware/soc/modules/pwmss/sys_pwmss.h ../../lib/hardware/soc/modules/pwmss/pwm_ss.h ../../lib/hardware/soc/general/sitara-am437x.h ../../lib/hardware/soc/general/am437x_cm.h ../../lib/hardware/soc/modules/pwmss/hw_ehrpwm.h ../../lib/cli/cli.h ../../lib/hardware/soc/general/3DLRF.h ../../lib/alg/lgs/detectorStructures.h ../../lib/components/base/basicTypes.h ../../lib/hardware/soc/general/sitara-am437x.h ../../lib/hardware/can/canbus.h ../../lib/data/protocol/protocolTGZ.h ../../lib/components/base/basicTransport.h ../../lib/data/protocol/protocol.h ../../lib/App/3dSERVER/LRF_TwinConnector.h ../../lib/data/protocol/protocolInternalLRF3D.h ../../lib/data/protocol/protocol.h ../../lib/hardware/soc/general/3DLRF.h ../../lib/data/net/clientPort.h ../../lib/data/transport/transportSocket.h ../../lib/components/base/basicDualThread.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicTransport.h ../../lib/data/net/serverPort.h ../../lib/data/transport/transportSocket.h ../../lib/components/base/basicDualThread.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicTransport.h ../../lib/alg/lgs/detectorStructures.h ../../lib/components/base/basicTypes.h ../../lib/alg/lgs/detector.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicStatus.h ../../lib/alg/generic/md5.h ../../lib/alg/lgs/detectorStructures.h ../../lib/components/base/basicTypes.h ../../lib/alg/lgs/mask.h ../../lib/components/base/basicTypes.h ../../lib/hardware/soc/general/3DLRF.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/gui/gui.h ../../lib/data/net/netServer.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/data/protocol/protocol.h ../../lib/App/3dSERVER/LRF_TargetTracker.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/hardware/soc/general/3DLRF.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicMutex.h $(OUTDIR)/LRF_TargetTracker.o: ../../lib/App/3dSERVER/LRF_TargetTracker.cpp ../../lib/App/3dSERVER/LRF_TargetTracker.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/hardware/soc/general/3DLRF.h -$(OUTDIR)/LRF_TwinConnector.o: ../../lib/App/3dSERVER/LRF_TwinConnector.cpp ../../lib/App/3dSERVER/LRF_TwinConnector.h ../../lib/data/protocol/protocolInternalLRF3D.h ../../lib/data/protocol/protocol.h ../../lib/hardware/soc/general/3DLRF.h ../../lib/data/net/clientPort.h ../../lib/data/transport/transportSocket.h ../../lib/components/base/basicDualThread.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicTransport.h ../../lib/data/net/serverPort.h ../../lib/data/transport/transportSocket.h ../../lib/components/base/basicDualThread.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicTransport.h ../../lib/App/3dSERVER/LRF_Kernel.h ../../lib/App/3dSERVER/LRF_TargetTracker.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/hardware/soc/general/3DLRF.h ../../lib/data/stbi/stb_image.h ../../lib/data/stbi/stb_image_write.h +$(OUTDIR)/LRF_TwinConnector.o: ../../lib/App/3dSERVER/LRF_TwinConnector.cpp ../../lib/App/3dSERVER/LRF_TwinConnector.h ../../lib/data/protocol/protocolInternalLRF3D.h ../../lib/data/protocol/protocol.h ../../lib/hardware/soc/general/3DLRF.h ../../lib/data/net/clientPort.h ../../lib/data/transport/transportSocket.h ../../lib/components/base/basicDualThread.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicTransport.h ../../lib/data/net/serverPort.h ../../lib/data/transport/transportSocket.h ../../lib/components/base/basicDualThread.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicTransport.h ../../lib/App/3dSERVER/LRF_SlimKernel.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicEngine.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicEventHeap.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/Transform.h ../../lib/App/3dSERVER/LRF_HardwareManager.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/hardware/soc/classSOC.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/hardware/soc/general/3DLRF.h ../../lib/hardware/soc/general/am437x_prmcm.h ../../lib/hardware/soc/modules/gpio/gpio_ss.h ../../lib/hardware/soc/modules/adc/adc_ss.h ../../lib/hardware/soc/modules/pru/tupus_ext.h ../../lib/hardware/soc/modules/pru/pru_ss.h ../../lib/cli/cli.h ../../lib/hardware/soc/general/sitara-am437x.h ../../lib/hardware/soc/modules/pru/pru_ctrl.h ../../lib/hardware/soc/modules/pru/pru_cfg.h ../../lib/hardware/soc/modules/pwmss/sys_pwmss.h ../../lib/hardware/soc/modules/pwmss/pwm_ss.h ../../lib/hardware/soc/general/sitara-am437x.h ../../lib/hardware/soc/general/am437x_cm.h ../../lib/hardware/soc/modules/pwmss/hw_ehrpwm.h ../../lib/cli/cli.h ../../lib/hardware/soc/general/3DLRF.h ../../lib/alg/lgs/detectorStructures.h ../../lib/components/base/basicTypes.h ../../lib/hardware/soc/general/sitara-am437x.h ../../lib/hardware/can/canbus.h ../../lib/data/protocol/protocolTGZ.h ../../lib/components/base/basicTransport.h ../../lib/data/protocol/protocol.h ../../lib/App/3dSERVER/LRF_TwinConnector.h ../../lib/data/protocol/protocolInternalLRF3D.h ../../lib/data/protocol/protocol.h ../../lib/hardware/soc/general/3DLRF.h ../../lib/data/net/clientPort.h ../../lib/data/transport/transportSocket.h ../../lib/components/base/basicDualThread.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicTransport.h ../../lib/data/net/serverPort.h ../../lib/data/transport/transportSocket.h ../../lib/components/base/basicDualThread.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicTransport.h ../../lib/alg/lgs/detectorStructures.h ../../lib/components/base/basicTypes.h ../../lib/alg/lgs/detector.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicStatus.h ../../lib/alg/generic/md5.h ../../lib/alg/lgs/detectorStructures.h ../../lib/components/base/basicTypes.h ../../lib/alg/lgs/mask.h ../../lib/components/base/basicTypes.h ../../lib/hardware/soc/general/3DLRF.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/gui/gui.h ../../lib/data/net/netServer.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/data/protocol/protocol.h ../../lib/App/3dSERVER/LRF_TargetTracker.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/hardware/soc/general/3DLRF.h ../../lib/App/3dSERVER/LRF_Kernel.h ../../lib/App/3dSERVER/LRF_TargetTracker.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/hardware/soc/general/3DLRF.h ../../lib/data/stbi/stb_image.h ../../lib/data/stbi/stb_image_write.h $(OUTDIR)/mask.o: ../../lib/alg/lgs/mask.cpp ../../lib/alg/lgs/mask.h ../../lib/components/base/basicTypes.h ../../lib/hardware/soc/general/3DLRF.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/gui/gui.h $(OUTDIR)/md5.o: ../../lib/alg/generic/md5.cpp ../../lib/alg/generic/md5.h $(OUTDIR)/netClientHandler.o: ../../lib/data/net/netClientHandler.cpp ../../lib/data/net/netClientHandler.h ../../lib/data/protocol/protocol.h ../../lib/components/base/basicEngine.h ../../lib/components/base/basicEventHandler.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/Transform.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/data/net/serverPort.h ../../lib/data/transport/transportSocket.h ../../lib/components/base/basicDualThread.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicTransport.h -$(OUTDIR)/netServer.o: ../../lib/data/net/netServer.cpp ../../lib/data/net/netServer.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicEngine.h ../../lib/components/base/basicEventHeap.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/Transform.h ../../lib/data/protocol/protocol.h ../../lib/data/net/netClientHandler.h ../../lib/data/protocol/protocol.h ../../lib/components/base/basicEngine.h ../../lib/components/base/basicEventHandler.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/Transform.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/data/net/serverPort.h ../../lib/data/transport/transportSocket.h ../../lib/components/base/basicDualThread.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicTransport.h ../../lib/data/net/netClientHandler.h ../../lib/data/protocol/protocol.h ../../lib/components/base/basicEngine.h ../../lib/components/base/basicEventHandler.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/Transform.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/data/net/serverPort.h ../../lib/data/transport/transportSocket.h ../../lib/components/base/basicDualThread.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicTransport.h +$(OUTDIR)/netServer.o: ../../lib/data/net/netServer.cpp ../../lib/data/net/netServer.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/data/protocol/protocol.h ../../lib/data/net/netClientHandler.h ../../lib/data/protocol/protocol.h ../../lib/components/base/basicEngine.h ../../lib/components/base/basicEventHandler.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/Transform.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/data/net/serverPort.h ../../lib/data/transport/transportSocket.h ../../lib/components/base/basicDualThread.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicTransport.h $(OUTDIR)/objectFileLoggingService.o: ../../lib/components/object/objectFileLoggingService.cpp ../../lib/components/object/objectFileLoggingService.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h $(OUTDIR)/protocol.o: ../../lib/data/protocol/protocol.cpp ../../lib/data/protocol/protocol.h $(OUTDIR)/protocolInternalLRF3D.o: ../../lib/data/protocol/protocolInternalLRF3D.cpp ../../lib/data/protocol/protocolInternalLRF3D.h ../../lib/data/protocol/protocol.h ../../lib/hardware/soc/general/3DLRF.h diff --git a/lib/App/3dSERVER/LRF_ClientHandler.cpp b/lib/App/3dSERVER/LRF_ClientHandler.cpp index c33d66da..25e10e14 100644 --- a/lib/App/3dSERVER/LRF_ClientHandler.cpp +++ b/lib/App/3dSERVER/LRF_ClientHandler.cpp @@ -1,5 +1,7 @@ #include "LRF_ClientHandler.h" +#ifndef PRU_SLAVE + #define LOG( X ) m_pLog->Log( "LRF_NCH", this, X ) #ifdef DEBUG #define LOG_ERROR( X ) {\ @@ -22,8 +24,10 @@ LRF_ClientHandler::LRF_ClientHandler( int SockFD, basicEngine *ptr ) : networkClientHandler( SockFD, ptr ), protocolLGS3D_Server(){ m_pLog = basicLogCollection::getInstance(); m_pWorkingSAF = NULL; - m_bKernelWorkingMode = WM_NONE; - m_bClientWorkingMode = CWM_INIT; + + m_bKernelWM = WM_NONE; + m_bClientWM = CWM_INIT; + m_pKernelEngine = NULL; m_pPort = new serverPort( SockFD ); @@ -57,11 +61,11 @@ LRF_ClientHandler::~LRF_ClientHandler(){ bool LRF_ClientHandler::attachEngine( basicEngine *ptr ){ m_pKernelEngine = (LRF_Kernel *) ptr; if( m_pKernelEngine!= NULL ) { - m_bKernelWorkingMode = m_pKernelEngine->getMode(); + m_bKernelWM = m_pKernelEngine->getWM(); } else { - m_bKernelWorkingMode = WM_NONE; + m_bKernelWM = WM_NONE; }; - sendState( m_bKernelWorkingMode ); + sendState( m_bKernelWM ); return true; }; @@ -84,28 +88,28 @@ bool LRF_ClientHandler::packetHandler( protocolPackage *Package ){ LOG("Handshaking STATUS Request"); #endif if( m_pKernelEngine != NULL ) { - m_bKernelWorkingMode = m_pKernelEngine->getMode(); + m_bKernelWM = m_pKernelEngine->getWM(); } else { - m_bKernelWorkingMode = WM_NONE; + m_bKernelWM = WM_NONE; }; - sendState( m_bKernelWorkingMode ); + sendState( m_bKernelWM ); // Set Working to translate Targets //m_bClientWorkingMode = CWM_PINGPONG; - m_bClientWorkingMode = CWM_INIT; + setWM( CWM_INIT ); break; case CMD_QUIT: #ifdef DEBUG LOG("QUIT Request"); #endif m_pKernelEngine->shutdown(); - m_bClientWorkingMode = CWM_INIT; + setWM( CWM_INIT ); break; case CMD_RESET: #ifdef DEBUG LOG("RESET Request"); #endif sendResetACK(); - m_bClientWorkingMode = CWM_INIT; + setWM( CWM_INIT ); m_pKernelEngine->reset( false ); break; case CMD_MODE: @@ -124,25 +128,26 @@ bool LRF_ClientHandler::packetHandler( protocolPackage *Package ){ #ifdef DEBUG LOG("SET MODE Request"); #endif - m_bClientWorkingMode = (E_CLIENT_WORK_MODE) Byte; + sendMode( (E_CLIENT_WORK_MODE) Byte ); } #ifdef DEBUG else LOG("GET MODE Request"); #endif - sendMode( m_bClientWorkingMode ); + sendMode( m_bClientWM ); break; case CMD_GETFILE: #ifdef DEBUG LOG("GET_FILE Request"); #endif - m_bClientWorkingMode = CWM_FILE; + setWM( CWM_FILE ); break; case CMD_RESTART: #ifdef DEBUG LOG("RESTART Request"); #endif + sendResetACK(); + setWM( CWM_INIT ); m_pKernelEngine->reset( false ); - m_bClientWorkingMode = CWM_INIT; break; case CMD_GET_PARAMETERS: case CMD_PARAMETERS: @@ -160,7 +165,7 @@ bool LRF_ClientHandler::packetHandler( protocolPackage *Package ){ LOG_ERROR( "Can't get Parameters from Kernel!" ); sendParameters( NULL ); }; - m_bClientWorkingMode = CWM_PARAMS; + setWM( CWM_PARAMS ); } else { LOG_ERROR("Kernel Engine not attached!"); sendParameters( NULL ); @@ -177,7 +182,7 @@ bool LRF_ClientHandler::packetHandler( protocolPackage *Package ){ // Handle error setting parameters LOG_ERROR( "Can't set Parameters!" ); }; - m_bClientWorkingMode = CWM_PARAMS; + setWM( CWM_PARAMS ); } else { LOG_ERROR("Kernel Engine not attached!"); }; @@ -186,28 +191,28 @@ bool LRF_ClientHandler::packetHandler( protocolPackage *Package ){ #ifdef DEBUG LOG("GET SERIAL Request"); #endif - m_bClientWorkingMode = CWM_PARAMS; + setWM( CWM_PARAMS ); break; case CMD_SET_ADDRESS: #ifdef DEBUG LOG("SET ADDRESS Request"); #endif - m_bClientWorkingMode = CWM_PARAMS; + setWM( CWM_PARAMS ); break; case CMD_GET_SOFTWARE_VERSION: #ifdef DEBUG LOG("GET SOFTWARE VER Request"); #endif - m_bClientWorkingMode = CWM_PARAMS; + setWM( CWM_PARAMS ); break; case CMD_UNSUPPORTED: #ifdef DEBUG LOG("UNSUPORTED Request"); #endif - m_bClientWorkingMode = CWM_ERROR; + setWM( CWM_ERROR ); break; case CMD_SET_COMM_SPEED: - m_bClientWorkingMode = CWM_PARAMS; + setWM( CWM_PARAMS ); break; case CMD_BORDER: case CMD_FULL_BORDER:{ @@ -223,7 +228,7 @@ bool LRF_ClientHandler::packetHandler( protocolPackage *Package ){ sprintf( tBuf, "Requested Border Samples From: %d of %d",SampleID,TH_SIZE_NODES ); LOG( tBuf ); # endif - if( m_bClientWorkingMode != CWM_BORDER ) { + if( m_bClientWM != CWM_BORDER ) { # ifdef DEBUG LOG("Current Mode Isn't BORDER!"); # endif @@ -240,11 +245,11 @@ bool LRF_ClientHandler::packetHandler( protocolPackage *Package ){ # endif sendBorderData( m_nCurrentSampleIDofBoardData, 0, m_pWorkingSAF ); // Will Ignore Other Events; - m_bClientWorkingMode = CWM_BORDER; + setWM( CWM_BORDER ); } else { LOG_ERROR( "BORDER not Ready!"); sendBorderError( BD_NOTREADY ); - m_bClientWorkingMode = CWM_IDLE; + setWM( CWM_IDLE ); }; } else { if( SampleID < TH_SIZE_NODES ) { @@ -254,7 +259,7 @@ bool LRF_ClientHandler::packetHandler( protocolPackage *Package ){ # ifdef DEBUG LOG( "Finishing Border Upload" ); # endif - m_bClientWorkingMode = CWM_IDLE; + setWM( CWM_IDLE ); }; }; }; @@ -265,20 +270,20 @@ bool LRF_ClientHandler::packetHandler( protocolPackage *Package ){ LOG("FULL RESET Request"); #endif sendFullResetACK(); - m_bClientWorkingMode = CWM_INIT; + setWM( CWM_INIT ); m_pKernelEngine->reset(true); break; case CMD_CAMERA: #ifdef DEBUG LOG("CAMERA Request"); #endif - m_bClientWorkingMode = CWM_PARAMS; + setWM( CWM_PARAMS ); break; case CMD_SET_SERIAL_NUMBER: #ifdef DEBUG LOG("SET SERIAL Request"); #endif - m_bClientWorkingMode = CWM_PARAMS; + setWM( CWM_PARAMS ); break; case CMD_BOARDDATA: #ifdef DEBUG @@ -289,29 +294,29 @@ bool LRF_ClientHandler::packetHandler( protocolPackage *Package ){ #ifdef DEBUG LOG("GET CAMERA PARAMS Request"); #endif - m_bClientWorkingMode = CWM_PARAMS; + setWM( CWM_PARAMS ); break; case CMD_SET_CAMERA_PARAMETERS: - m_bClientWorkingMode = CWM_PARAMS; + setWM( CWM_PARAMS ); break; case CMD_RELAY: - m_bClientWorkingMode = CWM_PARAMS; + setWM( CWM_PARAMS ); break; case CMD_GET_RELAY_PARAMETERS: - m_bClientWorkingMode = CWM_PARAMS; + setWM( CWM_PARAMS ); break; case CMD_SET_RELAY_PARAMETERS: - m_bClientWorkingMode = CWM_PARAMS; + setWM( CWM_PARAMS ); break; case CMD_FS_SUB_PACKET: - m_bClientWorkingMode = CWM_FILE; + setWM( CWM_FILE ); break; case CMD_STATE_2: - if( m_bClientWorkingMode!= CWM_BORDER ){ + if( m_bClientWM != CWM_BORDER ){ if( m_pKernelEngine != NULL ) { - m_bKernelWorkingMode = m_pKernelEngine->getMode(); + m_bKernelWM = m_pKernelEngine->getWM(); } else { - m_bKernelWorkingMode = WM_NONE; + m_bKernelWM = WM_NONE; }; uint8_t tCount = 0; uint8_t * tPData = NULL; @@ -331,69 +336,67 @@ bool LRF_ClientHandler::packetHandler( protocolPackage *Package ){ free(tElm); }; m_mOutputProtector.unlock(); - sendState2( m_bKernelWorkingMode, tCount, tPData ); + sendState2( m_bKernelWM, tCount, tPData ); free(tPData); } else { m_mOutputProtector.unlock(); - sendState2( m_bKernelWorkingMode ); + sendState2( m_bKernelWM ); }; } else { m_mOutputProtector.unlock(); - sendState2( m_bKernelWorkingMode ); + sendState2( m_bKernelWM ); }; - if( m_bClientWorkingMode != CWM_IDLE ){ - m_bClientWorkingMode = CWM_IDLE; - }; + setWM( CWM_IDLE ); }; break; case CMD_GET_WIDTH_TABLE: - m_bClientWorkingMode = CWM_PARAMS; + setWM( CWM_PARAMS ); break; case CMD_SET_WIDTH_TABLE: - m_bClientWorkingMode = CWM_PARAMS; + setWM( CWM_PARAMS ); break; case CMD_GET_VOLTAGE: #ifdef DEBUG LOG("Get Voltage Request"); #endif - m_bClientWorkingMode = CWM_PARAMS; + setWM( CWM_PARAMS ); break; case CMD_GET_VOLTAGE_PARAMETERS: - m_bClientWorkingMode = CWM_PARAMS; + setWM( CWM_PARAMS ); break; case CMD_SET_VOLTAGE_PARAMETERS: - m_bClientWorkingMode = CWM_PARAMS; + setWM( CWM_PARAMS ); break; case CMD_GET_CALIBRATION_TABLE: - m_bClientWorkingMode = CWM_PARAMS; + setWM( CWM_PARAMS ); break; case CMD_SET_CALIBRATION_TABLE: - m_bClientWorkingMode = CWM_PARAMS; + setWM( CWM_PARAMS ); break; case CMD_GET_LRF_DISABLE: - m_bClientWorkingMode = CWM_PARAMS; + setWM( CWM_PARAMS ); break; case CMD_SET_LRF_DISABLE: - m_bClientWorkingMode = CWM_PARAMS; + setWM( CWM_PARAMS ); break; case CMD_GET_ZOOM_TABLE: - m_bClientWorkingMode = CWM_PARAMS; + setWM( CWM_PARAMS ); break; case CMD_SET_ZOOM_TABLE: - m_bClientWorkingMode = CWM_PARAMS; + setWM( CWM_PARAMS ); break; case CMD_GET_TILT_TABLE: - m_bClientWorkingMode = CWM_PARAMS; + setWM( CWM_PARAMS ); break; case CMD_SET_TILT_TABLE: - m_bClientWorkingMode = CWM_PARAMS; + setWM( CWM_PARAMS ); break; /* Shadow Masking Hidden Zones */ case CMD_GET_HZ_DATA: - m_bClientWorkingMode = CWM_MASK; + setWM( CWM_MASK ); break; case CMD_SET_HZ_DATA:{ - m_bClientWorkingMode = CWM_MASK; + setWM( CWM_MASK ); LOG("Set RayTraced Mask"); ShadowMask *tShMaskObj; tShMaskObj = m_pKernelEngine->getShadowMask(); @@ -424,13 +427,13 @@ bool LRF_ClientHandler::packetHandler( protocolPackage *Package ){ }; break; case CMD_GET_HZ_ENABLE: - m_bClientWorkingMode = CWM_MASK; + setWM( CWM_MASK ); break; case CMD_SET_HZ_ENABLE: - m_bClientWorkingMode = CWM_MASK; + setWM( CWM_MASK ); break; case CMD_GET_HZ_INFO:{ - m_bClientWorkingMode = CWM_MASK; + setWM( CWM_MASK ); ShadowMask *tShMaskObj; sendShadowInfo( m_pKernelEngine->getShadowMask()); }; @@ -441,7 +444,8 @@ bool LRF_ClientHandler::packetHandler( protocolPackage *Package ){ ShadowMask *tShMaskObj; uint8_t mPolyID; - m_bClientWorkingMode = CWM_MASK; + setWM( CWM_MASK ); + mPolyID = Package->m_pData[SUB_CMD_IDX]; tShMaskObj = m_pKernelEngine->getShadowMask(); if( tShMaskObj != NULL ) { @@ -457,7 +461,7 @@ bool LRF_ClientHandler::packetHandler( protocolPackage *Package ){ uint8_t mCount; ShadowMask *tShMaskObj; - m_bClientWorkingMode = CWM_MASK; + setWM( CWM_MASK ); mCount = Package->m_pData[SUB_CMD_IDX]; tShMaskObj = m_pKernelEngine->getShadowMask(); if( tShMaskObj != NULL ) { @@ -504,7 +508,7 @@ bool LRF_ClientHandler::packetHandler( protocolPackage *Package ){ }; break; case CMD_GET_HZ_STATUS: - m_bClientWorkingMode = CWM_MASK; + setWM( CWM_MASK ); break; case CMD_DHWM_START_MOTORS: if( m_pKernelEngine != NULL ) { @@ -542,8 +546,8 @@ bool LRF_ClientHandler::packetHandler( protocolPackage *Package ){ }; void LRF_ClientHandler::dispatchEvent( EVENT_CONTAINER *Evt ){ - if( Evt == NULL ) return; - if( m_bClientWorkingMode != CWM_IDLE ) return; + if ( Evt == NULL ) return; + if ( getWM() != CWM_IDLE) return; if( Evt->m_eClass == EVT_CLASS_SENSOR_3D ) { CLIENT_EVENT * tCEVT = NULL; switch( Evt->m_eType ) { @@ -608,6 +612,21 @@ void LRF_ClientHandler::dispatchEvent( EVENT_CONTAINER *Evt ){ }; }; +void LRF_ClientHandler::setWM( CLIENT_WORK_MODE NM ){ + m_mWMProtector.lock(); + if ( m_bClientWM != NM ) { + m_bClientWM = NM; + }; + m_mWMProtector.unlock(); +}; +CLIENT_WORK_MODE LRF_ClientHandler::getWM(){ + CLIENT_WORK_MODE rV; + m_mWMProtector.lock(); + rV = m_bClientWM; + m_mWMProtector.unlock(); + return rV; +}; + #undef SIZE_IDX #undef DEV_ID_IDX #undef CMD_IDX @@ -616,3 +635,5 @@ void LRF_ClientHandler::dispatchEvent( EVENT_CONTAINER *Evt ){ #undef LOG #undef LOG_ERROR + +#endif //PRU_SLAVE diff --git a/lib/App/3dSERVER/LRF_ClientHandler.h b/lib/App/3dSERVER/LRF_ClientHandler.h index ad1c7f19..a2a44a63 100644 --- a/lib/App/3dSERVER/LRF_ClientHandler.h +++ b/lib/App/3dSERVER/LRF_ClientHandler.h @@ -1,9 +1,11 @@ #ifndef __LRF_CLIENTHANDLER_H_INCL__ #define __LRF_CLIENTHANDLER_H_INCL__ +#ifndef PRU_SLAVE + #include "../../data/protocol/protocolLGS3D_server.h" #include "../../data/net/netClientHandler.h" -#include "LRF_Kernel.h" +#include "LRF_SlimKernel.h" #include "../../components/base/basicLogCollection.h" #include "../../components/base/basicMutex.h" @@ -16,13 +18,21 @@ class LRF_ClientHandler : public networkClientHandler, public protocolLGS3D_Serv private: basicLogCollection * m_pLog; LRF_Kernel * m_pKernelEngine; - LRF_WORK_MODE m_bKernelWorkingMode; - CLIENT_WORK_MODE m_bClientWorkingMode; + + LRF_WORK_MODE m_bKernelWM; + CLIENT_WORK_MODE m_bClientWM; + basicMutex m_mWMProtector; + thresholdNode * m_pWorkingSAF; - EventsFIFO m_oOutputFIFO; + + uint32_t m_nWorkingSAF; uint32_t m_nCurrentSampleIDofBoardData; + + EventsFIFO m_oOutputFIFO; basicMutex m_mOutputProtector; + void setWM( CLIENT_WORK_MODE ); + CLIENT_WORK_MODE getWM(); protected: bool packetHandler( protocolPackage *Package ); public: @@ -37,4 +47,6 @@ class LRF_ClientHandler : public networkClientHandler, public protocolLGS3D_Serv void dispatchEvent( EVENT_CONTAINER *Evt ); }; +#endif // PRU_SLAVE + #endif // __LRF_CLIENTHANDLER_H_INCL__ diff --git a/lib/App/3dSERVER/LRF_HardwareManager.cpp b/lib/App/3dSERVER/LRF_HardwareManager.cpp index 46725b4c..ed9feba3 100644 --- a/lib/App/3dSERVER/LRF_HardwareManager.cpp +++ b/lib/App/3dSERVER/LRF_HardwareManager.cpp @@ -1600,7 +1600,7 @@ uint32_t *LRF_HardwareManager::getEventMemory( void ){ return NULL; }; -bool LRF_HardwareManager::getDetectionStatus( DT_STATUS &Status ){ +bool LRF_HardwareManager::getCoreStatus( DT_STATUS &Status ){ #ifndef ONPC_TOTTAL_SIMULATOR if( m_pSOC!=NULL ){ *((uint32_t*)&m_sCS_Detector) = m_pSOC->getThCoreStatus(); @@ -1631,7 +1631,6 @@ bool LRF_HardwareManager::getDetectionParams( TH_PARAMS &Params ){ bool LRF_HardwareManager::setParams( LGS_3D_PARAMETERS *Params ){ if(Params == NULL) return false; - if(m_pSOC == NULL ) return false; memcpy( &m_sPARAMETERS, Params, sizeof(LGS_3D_PARAMETERS) ); // Save into settings m_sCP_Detector.delta = m_sPARAMETERS.nDelta; @@ -1654,21 +1653,23 @@ bool LRF_HardwareManager::setParams( LGS_3D_PARAMETERS *Params ){ ); LOG( Buffer ); #endif + +#ifndef ONPC_TOTTAL_SIMULATOR + if(m_pSOC == NULL ) return false; // Apply new Parameters if(!m_pSOC->setThCoreParams( &m_sCP_Detector )){ LOG_ERROR("Detection Core Set NEW Params Failure"); return false; }; *((uint32_t*)&m_sCP_Detector) = m_pSOC->getThCoreParams(); +#endif saveCurrentParameters(); return true; }; bool LRF_HardwareManager::setDetectionParams( TH_PARAMS *Params ){ - if( Params == NULL) return false; - if( m_pSOC == NULL ) return false; + if( Params == NULL) return false; memcpy( &m_sCP_Detector, Params, sizeof(TH_PARAMS) ); -#ifndef ONPC_TOTTAL_SIMULATOR #ifdef DEBUG char Buffer[256]; sprintf( Buffer, "Detector[%s] NEW Parameters: Delta[%d] Flip_Size[%d] Good_Points[%d] Order[%d] Offset[%d] TH_Automatic_Build[%d]", @@ -1682,16 +1683,17 @@ bool LRF_HardwareManager::setDetectionParams( TH_PARAMS *Params ){ ); LOG( Buffer ); #endif +#ifndef ONPC_TOTTAL_SIMULATOR + if( m_pSOC == NULL ) return false; // Apply new Parameters if(!m_pSOC->setThCoreParams( &m_sCP_Detector )){ LOG_ERROR("Detection Core Set NEW Params Failure"); return false; }; *((uint32_t*)&m_sCP_Detector) = m_pSOC->getThCoreParams(); +#endif saveCurrentParameters(); -#else return true; -#endif }; #ifdef SIMULATE_FLIPS @@ -1949,7 +1951,6 @@ bool LRF_HardwareManager::performFlip( void ){ if( !m_bInitOK ) return false; #ifndef ONPC_TOTTAL_SIMULATOR if( m_pSOC != NULL ){ - char Buffer[256];//Used also in Event!! volatile thresholdNode * th_node[16]; uint32_t LBA_ID; uint8_t LRF_ID; @@ -1961,11 +1962,12 @@ bool LRF_HardwareManager::performFlip( void ){ bool QAreaOK; th_node[0] = (volatile thresholdNode *) m_pSOC->getTH_MEMORY(); -#ifdef DEBUG - sprintf( Buffer, "NF TH pointer is: %p", th_node ); - LOG( Buffer ); -#endif if( th_node[0] != NULL ){ +#ifdef DEBUG_EXTRA + char Buffer[256]; + sprintf( Buffer, "NF TH pointer is: %p", th_node ); + LOG( Buffer ); +#endif th_node[1] = th_node[0]+ TH_SIZE_NODES; th_node[2] = th_node[1]+ TH_SIZE_NODES; th_node[3] = th_node[2]+ TH_SIZE_NODES; @@ -1987,7 +1989,7 @@ bool LRF_HardwareManager::performFlip( void ){ //Filter Disabled Kernels if( ((1 << LRF_ID ) & m_nKernelFilter ) == 0 ) continue; // Begin Scan Threshold -#ifdef DEBUG +#ifdef DEBUG_EXTRA sprintf( Buffer, "Building WTH for %dth Kernel", LRF_ID ); LOG( Buffer ); #endif @@ -2086,9 +2088,9 @@ bool LRF_HardwareManager::performFlip( void ){ #else th_node[8|LRF_ID][LBA_ID].data = tTN.data; #endif - }; + };//for lba_id }; -#ifdef DEBUG +#ifdef DEBUG_EXTRA LOG("Finish Cycle"); #endif @@ -2098,16 +2100,18 @@ bool LRF_HardwareManager::performFlip( void ){ if( m_bTHSteadyCounter[LRF_ID] ){ m_bTHSteadyCounter[LRF_ID] --; } else { - #ifdef DEBUG + #ifdef DEBUG_EXTRA sprintf( Buffer, "Cleanup TH%d", LRF_ID ); LOG(Buffer); #endif cleanTH( LRF_ID ); - #ifdef DEBUG + #ifdef DEBUG_EXTRA sprintf( Buffer, "Done Cleanup TH%d", LRF_ID ); LOG( Buffer ); #endif m_bTHSteadyCounter[LRF_ID] = m_sCP_Detector.good_points; + //clean Good TH + m_nGPointsFlags &= ~( 1 << LRF_ID ); }; }; }; @@ -2115,12 +2119,12 @@ bool LRF_HardwareManager::performFlip( void ){ // To perform cleaning of Threshold next time m_nFlipEnaFLags = m_nGPointsFlags; // To Enable Detection - m_nDetectionFilter |= m_nGPointsFlags; + //m_nDetectionFilter |= m_nGPointsFlags; + m_nDetectionFilter = m_nGPointsFlags; m_sgnFlipCounter++; - +#ifdef DEBUG_EXTRA sprintf( Buffer, "Flip#%d is Done: 0x%X", m_sgnFlipCounter, m_nFlipEnaFLags ); -#ifdef DEBUG LOG( Buffer ); #endif if( m_bDumpMemoryToDisk && ( ( m_sgnFlipCounter % 6 ) == 0 ) ) { @@ -2128,7 +2132,9 @@ bool LRF_HardwareManager::performFlip( void ){ thresholdNode *rNode; rNode = tNode = (thresholdNode *) m_pSOC->getTH_MEMORY(); if( tNode != NULL ) { +#ifdef DEBUG_EXTRA LOG( "Save Memory Dump!"); +#endif FILE *fd; char tName[64]; for( int index = 0; index < KERNEL_COUNT; index++ ) { @@ -2148,12 +2154,12 @@ bool LRF_HardwareManager::performFlip( void ){ nMemoryDumpID++; }; }; - EVENT_CONTAINER *tEvt = createBasicEvent( 0, EVT_CLASS_SENSOR_3D, EVT_FLIP, Buffer, NULL ); - if( tEvt != NULL ){ - basicEventHeap::getInstance()->broadcast( tEvt ); + //EVENT_CONTAINER *tEvt = createBasicEvent( 0, EVT_CLASS_SENSOR_3D, EVT_FLIP, Buffer, NULL ); + //if( tEvt != NULL ){ + /// basicEventHeap::getInstance()->broadcast( tEvt ); // Evt utilisation done by EventHeap thread - tEvt = NULL; - }; + // tEvt = NULL; + //}; #ifdef HIBERNATE_ENABLE return saveHibernatedTH(); #else diff --git a/lib/App/3dSERVER/LRF_HardwareManager.h b/lib/App/3dSERVER/LRF_HardwareManager.h index ad015bdc..9e8c9483 100644 --- a/lib/App/3dSERVER/LRF_HardwareManager.h +++ b/lib/App/3dSERVER/LRF_HardwareManager.h @@ -186,7 +186,7 @@ class LRF_HardwareManager { #else bool isMaster( void ){ return true; }; #endif - bool getDetectionStatus( DT_STATUS &Status ); + bool getCoreStatus( DT_STATUS &Status ); bool getDetectionParams( TH_PARAMS &Params ); bool setDetectionParams( TH_PARAMS *Params ); @@ -216,7 +216,7 @@ class LRF_HardwareManager { bool saveHibernatedTH( CSTR fname = "hibernate.dat" ); bool loadHibernatedTH( CSTR fname = "hibernate.dat" ); #endif - + uint8_t getDetectionStatus(){ return m_nDetectionFilter; } #ifdef IGNORE_PRU_FLIP uint8_t getFilledTH( void ){ return m_bDataFilledTH; }; #endif diff --git a/lib/App/3dSERVER/LRF_Server.h b/lib/App/3dSERVER/LRF_Server.h index a6fb7629..76e349f2 100644 --- a/lib/App/3dSERVER/LRF_Server.h +++ b/lib/App/3dSERVER/LRF_Server.h @@ -29,7 +29,11 @@ #include "../../data/ssdp/ssdpAnnouncer.h" #endif -#include "LRF_Kernel.h" +#ifdef SLIM_KERNEL + #include "LRF_SlimKernel.h" +#else + #include "LRF_Kernel.h" +#endif #include "LRF_HardwareManager.h" diff --git a/lib/App/3dSERVER/LRF_SlimKernel.cpp b/lib/App/3dSERVER/LRF_SlimKernel.cpp index b596e92f..7a92d105 100644 --- a/lib/App/3dSERVER/LRF_SlimKernel.cpp +++ b/lib/App/3dSERVER/LRF_SlimKernel.cpp @@ -17,15 +17,15 @@ #include "LRF_Detector.h" #include "LRF_ClientHandler.h" -#define LOG( X ) m_pLog->Log( "Kernel", this, X ) +#define LOG( X ) m_pLog->Log( "SLKRNL", this, X ) #ifdef DEBUG #define LOG_ERROR( X ) {\ char _tBfrErrMSG234[256];\ sprintf( _tBfrErrMSG234, "In file %s[%d] in func:%s %s",__FILE__, __LINE__, __func__, X );\ - m_pLog->Log( "Kernel", this, _LOG_ERROR, _tBfrErrMSG234 );\ + m_pLog->Log( "SLKRNL", this, _LOG_ERROR, _tBfrErrMSG234 );\ } #else - #define LOG_ERROR( X ) m_pLog->Log( "Kernel", this, _LOG_ERROR, X ); + #define LOG_ERROR( X ) m_pLog->Log( "SLKRNL", this, _LOG_ERROR, X ); #endif // Constructor implementation @@ -54,8 +54,11 @@ LRF_Kernel::LRF_Kernel( LRF_HardwareManager *HM ): basicThread(), basicEngine(){ m_pNetClientsServer = NULL; m_nSST = 0; #endif - m_pThreshold = NULL; - m_eWorkMode = WM_NONE; + m_pCurrentTH = NULL; + m_nCurrentTH = 0; + m_bCurrentTH = 0; + + m_eWM = WM_NONE; m_nWidth = 800; }; @@ -63,14 +66,17 @@ LRF_Kernel::LRF_Kernel( LRF_HardwareManager *HM ): basicThread(), basicEngine(){ LRF_Kernel::~LRF_Kernel(){ #ifdef DEBUG LOG("Destructor"); + LOG("End Main Thread"); #endif - WaitFinish(true); + WaitFinish( true ); #ifdef DEBUG LOG("Deleting Components"); + LOG("TWINC"); #endif if( m_pTWIC ) delete( m_pTWIC ); #ifdef DEBUG LOG("Twin Connector - Done"); + LOG("SHADOW"); #endif if( m_pShadow ) delete( m_pShadow ); #ifdef DEBUG @@ -143,7 +149,7 @@ LRF_Kernel::~LRF_Kernel(){ LOG_ERROR("Failed Read Config Settings!"); return false; }; - m_eWorkMode = WM_INIT; + m_eWM = WM_INIT; m_nFlipCounter = 0; m_nFlipSavierID = 0; @@ -238,7 +244,7 @@ LRF_Kernel::~LRF_Kernel(){ #ifdef DEBUG LOG( "Created" ); #endif - m_eWorkMode = WM_STUDY; + m_eWM = WM_STUDY; return true; }; @@ -261,364 +267,244 @@ void LRF_Kernel::WaitFinish( bool Force ){ #endif }; +LRF_WORK_MODE LRF_Kernel::getWM( void ){ + LRF_WORK_MODE rv; + m_mWMProtector.lock(); + rv = m_eWM; + m_mWMProtector.unlock(); + return rv; +}; + +void LRF_Kernel::setWM( LRF_WORK_MODE nMode ){ + m_mWMProtector.lock(); + m_eWM = nMode; + m_mWMProtector.unlock(); +}; + + /* Main Kernel Thread Procedure */ void LRF_Kernel::m_fThreadProc( void ){ -#ifdef SIMULATE_TARGETS - uint8_t CCNT = 0; - uint16_t CNNT = 0; -#endif - char Buffer[256]; - DT_STATUS tStatus = {0}; + char Buffer[256]; + DT_STATUS tStatus = {0}; + uint8_t bActiveTH = 0; + uint8_t bOldTH = 0; m_bThreadStatus = TH_WORKING; + while( m_bThreadStatus < TH_ENDED ){ + if( !m_pHardwareManager->validateCores() ){ - //Handle Error in PRU Cores - LOG_ERROR("PRU Core Trouble Detected!"); - m_eWorkMode = WM_ERROR; - while( ( m_bThreadStatus < TH_ENDED ) && ( !m_pHardwareManager->validateCores()) ) SLEEP( 100 ); //Stop Kernel -#ifdef DEBUG - LOG( "Cores Became OK!" ); -#endif - m_eWorkMode = WM_INIT; - }; -#ifdef SIMULATE_TARGETS - #ifdef SIMULATE_DOS_TARGETS - if( m_lCycleCounter % 10 == 0 ) { - #else - if( m_lCycleCounter % 1000 == 0 ) { - #endif - // Generate Target - CNNT++; - targetRecord cNode; - cNode.begin_id = ((TH_SIZE_NODES>>1)+CCNT*(TH_LINE_NODES>>3)+CNNT)%TH_SIZE_NODES; - cNode.end_id = (cNode.begin_id+TH_LINE_NODES)%TH_SIZE_NODES; - cNode.status = 0; - cNode.flags.active = 1; - cNode.flags.lrf = CCNT; - cNode.flags.w_cnt = 2; - cNode.width = ((4095>>3)*(8-CCNT))<<1; - cNode.flags.type = TARGET_WHITE; - m_pTracker->validateTarget( &cNode, m_pHardwareManager->isMaster() ); - CCNT++; - CCNT &= 7; - }; -#endif - // Check Working Mode - if( tStatus.mode != WM_DETECTOR ){ - //if( m_eWorkMode != WM_DETECTOR ){ - if( m_pHardwareManager->getDetectionStatus( tStatus ) ){ - if( tStatus.mode == WM_DETECTOR ) { - // Detection Mode - m_eWorkMode = WM_DETECTOR; -#ifdef DEBUG - LOG( "Switching to detection mode!" ); - #ifdef NO_BLACK_TARGETS - LOG( "B-Target Will be Ignored by Build" ); - #endif -#endif - thresholdNode *ptr; - ptr = m_pHardwareManager->getWorkingMemory(); - if( ptr!= NULL ){ - m_nThresholdSize = TH_SIZE_NODES; - m_pThreshold = (thresholdNode *) malloc( sizeof(thresholdNode)* m_nThresholdSize); - if( m_pThreshold!= NULL ) { - memcpy( m_pThreshold, ptr, m_nThresholdSize ); - } else m_nThresholdSize = 0; - }; - }; - }; - } else { //m_eWorkMode == WM_DETECTOR - // Readout Events - int index; - bool bActiveRecordsPresent; - targetRecord cNode; - volatile targetRecord *tNode; - tNode = (volatile targetRecord *) m_pHardwareManager->getEventMemory(); - if( tNode != NULL ) { - //LOG( "Event Mem accessed OK"); - EVENT_CONTAINER * tEvt = NULL; - uint32_t cRange; - uint32_t cTrackID = 0; - bActiveRecordsPresent = true; - while( bActiveRecordsPresent && ( m_bThreadStatus < TH_ENDED ) ) { - bActiveRecordsPresent = false; - for( index = 0; index < MAX_TARGETS_COUNT; index++){ - // Copy record from MEM - //LOG("Checking Event Record"); - cNode.width = tNode[index].width; - cNode.begin_id = tNode[index].begin_id; - cNode.end_id = tNode[index].end_id; - cNode.status = tNode[index].status; - // Unlock record for PRU - tNode[index].status = 0; - // Check by Working TH Complete for LRF -// if( cNode.flags.type == TARGET_WHITE || cNode.flags.type == TARGET_BLACK ) { -// // If not -> cancel analyze -// if((m_pHardwareManager->getTargetFilter() & ( 1 << cNode.flags.lrf )) == 0 ) continue; -// }; - if( cNode.flags.active ){ - // Filter Events from Disabled Kernels -> goes to flip - if( ((1 << cNode.flags.lrf ) & m_nKernelFilter ) == 0 ){ - // Abort checking this target since Kernel Disabled - continue; - }; - if( cNode.flags.w_cnt ){ - cRange = cNode.width / cNode.flags.w_cnt; + if( getWM() != WM_ERROR ){ + setWM(WM_ERROR); + LOG_ERROR("PRU Core Trouble Detected!"); + }; + } else { + switch( getWM() ) { + case WM_INIT:{ + if( m_pHardwareManager->getCoreStatus( tStatus ) ){ + m_pHardwareManager->reset( false ); + if( tStatus.mode == WM_DETECTOR ) setWM( WM_STUDY ); + }; + break; + }; + case WM_STUDY:{ + bActiveTH = m_nKernelFilter & m_pHardwareManager->getDetectionStatus(); + if( bActiveTH ) setWM( WM_DETECTOR ); + break; + }; + case WM_DETECTOR:{ + bActiveTH = m_nKernelFilter & m_pHardwareManager->getDetectionStatus(); + if( bActiveTH != bOldTH ) { + setWM( WM_BORDER ); + continue; + }; + volatile targetRecord *tNode = (volatile targetRecord *)m_pHardwareManager->getEventMemory(); + if( tNode != NULL ) { + bool bActiveRecordsPresent = true; + while( bActiveRecordsPresent && ( m_bThreadStatus < TH_ENDED ) ) { + targetRecord cNode; + uint32_t cRange; + uint32_t cTrackID = 0; + EVENT_CONTAINER * tEvt = NULL; + bActiveRecordsPresent = false; + for( int idx = 0; idx < MAX_TARGETS_COUNT; idx++ ){ + // Filter Not Active Events + if ( tNode[idx].flags.active == 0 ) continue; + + cNode.width = tNode[idx].width; + cNode.begin_id = tNode[idx].begin_id; + cNode.end_id = tNode[idx].end_id; + cNode.status = tNode[idx].status; + // Unlock record for PRU + tNode[idx].status = 0; + // Filter Events from Disabled Kernels -> goes to flip + if( ((1 << cNode.flags.lrf ) & m_nKernelFilter ) == 0 ){ + // Abort checking this target since Kernel Disabled + continue; + }; + // Abort checking this target since no width + if( cNode.flags.w_cnt ){ + cRange = cNode.width / cNode.flags.w_cnt; #ifdef SHIFT_50 - cRange += SHIFT_50; - // width must be updated accordingly - cNode.width = cRange * cNode.flags.w_cnt; -#endif -// Filter Target's Width in Da Tracker! -// if( m_nWidth > 0 ) { -// if( cNode.width < m_nWidth ) { - // Abort Detection of this target since small width -// continue; -// }; -// }; - };// else { - // Abort checking this target since no width - // continue; - //}; - tEvt = NULL; - - bActiveRecordsPresent = true; - - switch( cNode.flags.type ){ - case TARGET_WHITE:{ -#ifndef SKIP_TARGET_LOG - #ifdef DEBUG - LOG( "Push W-Target Into Tracker" ); - #endif -#endif - if( m_pShadow != NULL ) { - if( m_pShadow->isActive() ) { - uint16_t cPointX, cPointY; - makeXY( cNode.begin_id, cPointX, cPointY, m_pHardwareManager->isMaster() ); - if( m_pShadow->isOutside( cPointX, cPointY )){ + cRange += SHIFT_50; + cNode.width = cRange * cNode.flags.w_cnt; +#endif + } else continue; + bActiveRecordsPresent = true; + switch( cNode.flags.type ){ + case TARGET_WHITE:{ + if( m_pShadow != NULL ) { + if( m_pShadow->isActive() ) { + uint16_t cPointX, cPointY; #ifdef PRU_SLAVE + makeXY( cNode.begin_id, cPointX, cPointY, false ); #else - cTrackID = m_pTracker->validateTarget( &cNode, m_pHardwareManager->isMaster()); -#endif -#ifndef SKIP_TARGET_LOG - #ifdef DEBUG - sprintf( Buffer, "Assigned ID [%d] area: %d CNT: %d bID: %d eID: %d", - cTrackID, - cNode.width, - cNode.flags.w_cnt, - cNode.begin_id, - cNode.end_id - ); - LOG( Buffer ); - #endif + makeXY( cNode.begin_id, cPointX, cPointY, true ); #endif - } else { -#ifndef SKIP_TARGET_LOG - LOG( "Target Shadowed" ); + if( m_pShadow->isOutside( cPointX, cPointY )){ +#ifdef PRU_SLAVE + m_pTWIC->validateTarget( &cNode ); +#else + cTrackID = m_pTracker->validateTarget( &cNode, true ); #endif - }; - } else { // Shadow is Disabled + }; + } else { // Shadow is Disabled #ifdef PRU_SLAVE + m_pTWIC->validateTarget( &cNode ); +#else + cTrackID = m_pTracker->validateTarget( &cNode, true ); +#endif + }; + } else { + LOG_ERROR("NO SHADOW OBJECT!"); + m_bThreadStatus = TH_ENDED; + continue; + }; + break; + }; + case TARGET_BLACK:{ +#ifdef NO_BLACK_TARGETS + break; + }; #else - cTrackID = m_pTracker->validateTarget( &cNode, m_pHardwareManager->isMaster()); + if( m_pShadow != NULL ) { + if( m_pShadow->isActive() ) { + uint16_t cPointX, cPointY; +#ifdef PRU_SLAVE + makeXY( cNode.begin_id, cPointX, cPointY, false ); +#else + makeXY( cNode.begin_id, cPointX, cPointY, true ); #endif -#ifndef SKIP_TARGET_LOG - #ifdef DEBUG - sprintf( Buffer, "Assigned ID [%d] area: %d CNT: %d bID: %d eID: %d", - cTrackID, - cNode.width, - cNode.flags.w_cnt, - cNode.begin_id, - cNode.end_id - ); - LOG( Buffer ); - #endif + if( m_pShadow->isOutside( cPointX, cPointY )){ +#ifdef PRU_SLAVE + m_pTWIC->validateTarget( &cNode ); +#else + cTrackID = m_pTracker->validateTarget( &cNode, true ); #endif - } - } else { - LOG_ERROR("NO SHADOW OBJECT!"); - m_bThreadStatus = TH_ENDED; - continue; - } - break; - }; - case TARGET_BLACK:{ -#ifdef NO_BLACK_TARGETS - #ifndef SKIP_TARGET_LOG - #ifdef DEBUG - // LOG( "B-Target Ignored by Build" ); - #endif - #endif - }; - break; + }; + } else { +#ifdef PRU_SLAVE + m_pTWIC->validateTarget( &cNode ); #else - #ifndef SKIP_TARGET_LOG - #ifdef DEBUG - LOG( "Push B-Target Into Tracker" ); - #endif - #endif - if( m_pShadow != NULL ) { - if( m_pShadow->isActive() ) { - - uint16_t cPointX, cPointY; - makeXY( cNode.begin_id, cPointX, cPointY, m_pHardwareManager->isMaster() ); - - if( m_pShadow->isOutside( cPointX, cPointY )){ - cTrackID = m_pTracker->validateTarget( &cNode, m_pHardwareManager->isMaster()); - #ifndef SKIP_TARGET_LOG - #ifdef DEBUG - sprintf( Buffer, "Assigned ID [%d] area: %d CNT: %d bID: %d eID: %d", - cTrackID, - cNode.width, - cNode.flags.w_cnt, - cNode.begin_id, - cNode.end_id - ); - LOG( Buffer ); - #endif - #endif - }; - } else { // Shadow is Disabled - cTrackID = m_pTracker->validateTarget( &cNode, m_pHardwareManager->isMaster()); - #ifndef SKIP_TARGET_LOG - #ifdef DEBUG - sprintf( Buffer, "Assigned ID [%d] area: %d CNT: %d bID: %d eID: %d", - cTrackID, - cNode.width, - cNode.flags.w_cnt, - cNode.begin_id, - cNode.end_id - ); - LOG( Buffer ); - #endif - #endif - } - } else { - LOG_ERROR("NO SHADOW OBJECT!"); - m_bThreadStatus = TH_ENDED; - continue; - } - }; - break; -#endif // NO_BLACK_TARGETS + cTrackID = m_pTracker->validateTarget( &cNode, true ); +#endif + }; + } else { + LOG_ERROR("NO SHADOW OBJECT!"); + m_bThreadStatus = TH_ENDED; + continue; + }; + break; + }; + +#endif // NO_BLACK_TARGETS // nohup sleep 30 & echo $! > pidfile #ifndef IGNORE_PRU_SCAN - case SCAN_COMPLETE:{ - //CLIENT_EVENT *tData; - //tData = (CLIENT_EVENT *) malloc(sizeof(CLIENT_EVENT)); - #ifndef PRU_SLAVE - m_pTracker->ScanComplete(); - #endif - //sprintf( Buffer,"Scan Complete [%d,%d]", cNode.width, cNode.begin_id ); - #ifdef DEBUG - //LOG( Buffer ); - #endif - //if( tData!= NULL ) { - // long long tMS = getMilliseconds(); - // tData->uts = tMS / 1000; - // tData->ums = tMS % 1000; - // tData->type = EVT_SCAN; - // tData->a_th_node = cNode.width; - // tData->th_id = cNode.begin_id; - // tEvt = createBasicEvent( 0, EVT_CLASS_SENSOR_3D, EVT_SCAN, NULL, Buffer, tData ); - //} else { - // tEvt = createBasicEvent( 0, EVT_CLASS_SENSOR_3D, EVT_SCAN, NULL, Buffer, NULL ); - //}; - break; - } - case SCAN_FROZEN: #ifndef PRU_SLAVE - m_pTracker->ScanComplete(); - #endif - //sprintf( Buffer,"Scan was Frozen", cNode.width, cNode.begin_id ); - #ifdef DEBUG - //LOG( Buffer ); + case SCAN_COMPLETE: m_pTracker->ScanComplete(); break; + case SCAN_FROZEN: m_pTracker->ScanComplete(); break; + case MIRROR_FINISHED: m_pTracker->MirrorComplete(); break; #endif - //tEvt = createBasicEvent( 0, EVT_CLASS_SENSOR_3D, EVT_SCAN, Buffer, NULL ); - break; #endif //!IGNORE_PRU_SCAN #ifndef IGNORE_PRU_FLIP - case FLIP_COMPLETE:{ - CLIENT_EVENT *tData; - tData = (CLIENT_EVENT *) malloc(sizeof(CLIENT_EVENT)); - m_nFlipCounter = cNode.begin_id; - sprintf( Buffer,"Flip Complete [%d,%d]", cNode.width, m_nFlipCounter ); - #ifdef DEBUG - LOG( Buffer ); - #endif - if( tData!= NULL ) { - long long tMS = getMilliseconds(); - tData->uts = tMS / 1000; - tData->ums = tMS % 1000; - tData->type = EVT_FLIP; - tData->a_th_node = cNode.width; - tData->th_id = m_nFlipCounter; - tEvt = createBasicEvent( 0, EVT_CLASS_SENSOR_3D, EVT_FLIP, NULL, Buffer, tData ); - } else { - tEvt = createBasicEvent( 0, EVT_CLASS_SENSOR_3D, EVT_FLIP, NULL, Buffer, NULL ); + case FLIP_COMPLETE:{ + CLIENT_EVENT *tData; + tData = (CLIENT_EVENT *) malloc(sizeof(CLIENT_EVENT)); + m_nFlipCounter = cNode.begin_id; + if( tData!= NULL ) { + long long tMS = getMilliseconds(); + tData->uts = tMS / 1000; + tData->ums = tMS % 1000; + tData->type = EVT_FLIP; + tData->a_th_node = cNode.width; + tData->th_id = m_nFlipCounter; + tEvt = createBasicEvent( 0, EVT_CLASS_SENSOR_3D, EVT_FLIP, NULL, NULL, tData ); + } else { + tEvt = createBasicEvent( 0, EVT_CLASS_SENSOR_3D, EVT_FLIP, NULL, NULL, NULL ); + }; + break; }; - break; - }; #endif //!IGNORE_PRU_FLIP -#ifndef PRU_SLAVE - case MIRROR_FINISHED: - m_pTracker->MirrorComplete(); - break; -#endif - #ifndef IGNORE_ERROR_ANGLE - case ERROR_ANGLE: - sprintf( Buffer,"Error Angle [%d,%d]", cNode.width, cNode.begin_id ); - #ifdef DEBUG - LOG_ERROR( Buffer ); - #endif - tEvt = createBasicEvent( 0, EVT_CLASS_SENSOR_3D, EVT_ERROR, Buffer, NULL ); - break; + case ERROR_ANGLE: tEvt = createBasicEvent( 0, EVT_CLASS_SENSOR_3D, EVT_ERROR, NULL, NULL, NULL ); break; #endif - }; - if( tEvt != NULL) { - m_pEventHeap->broadcast( tEvt ); - // Evt utilisation done by EventHeap thread - tEvt = NULL; - };// else { LOG("No Event Created!" ); }; - }; - }; - }; - //LOG("End Event Check"); - } else { - LOG_ERROR("No access to Event Memory"); - m_bThreadStatus = TH_ENDED; - }; - }; + }; + if( tEvt != NULL) { + m_pEventHeap->broadcast( tEvt ); + // Evt utilisation done by EventHeap thread + tEvt = NULL; + }; + }; + }; + } else { + LOG_ERROR("No access to Event Memory"); + m_bThreadStatus = TH_ENDED; + continue; + }; + break; + }; + case WM_BORDER:{ + if( bActiveTH == 0 ){ + setWM( WM_STUDY ); + } else { + for ( uint8_t idx = 0; idx < 8; idx++ ) { + if( ( ( bActiveTH & (1<readyToConsumeTH() ) { + //Finished Build TH + uint32_t THsize; + thresholdNode *tPTR = getTreshold( THsize, idx ); + if ( m_pTWIC->consumeTH( idx, tPTR, THsize ) ) { + //mark as consumed + bOldTH |= (1<validateCores() ) setWM( WM_INIT ); + break; + }; + }; + }; + SLEEP( SLEEP_KERNEL_INTERVAL ); + if(( m_lCycleCounter >> 31 )!= 0 ) { m_lCycleCounter = 0; } else m_lCycleCounter++; }; }; -bool LRF_Kernel::setMode( LRF_WORK_MODE nMode ){ - if( m_eWorkMode == nMode ) return true; - -#ifndef NO_MOTORS - if( m_eWorkMode == WM_DETECTOR || nMode == WM_DETECTOR ){ -#endif - if( nMode == WM_BORDER ) { - LOG("Switched to Mode BORDER"); - }; - if( nMode == WM_DETECTOR ) { - LOG("Switched to Mode DETECTOR"); - }; - // No other cleints demand specoal mode - m_eWorkMode = nMode; - return true; -#ifndef NO_MOTORS - }; - return false; -#endif -}; - PLGS_3D_PARAMETERS LRF_Kernel::getDetectionParameters( void ){ PLGS_3D_PARAMETERS tParam = NULL; if( m_pHardwareManager != NULL ){ @@ -648,7 +534,9 @@ PLGS_3D_PARAMETERS LRF_Kernel::getDetectionParameters( void ){ LOG_ERROR("getParams ERROR!"); free( tParam ); tParam = NULL; - } else { + } +#ifdef DEBUG + else { char tBuf[123]; for( int i = 0; i < sizeof(HW_PARAMS); i++ ) { sprintf( tBuf, "FLAGS_BIN[%d]: %d", i, tParam->flags_binary[i] ); @@ -660,7 +548,9 @@ PLGS_3D_PARAMETERS LRF_Kernel::getDetectionParameters( void ){ LOG( tBuf ); sprintf( tBuf, "CAN TGZ ID: %d", tParam->flags.TGZ_canDST ); LOG( tBuf ); - }; + } +#endif + ; }; }; return tParam; @@ -751,33 +641,49 @@ bool LRF_Kernel::setDetectionParameters( PLGS_3D_PARAMETERS ptr ){ }; return false; }; - +// KIID 0-7 Master Study 8-15 - Master Work - 16-23 - Slave Study 24-31 - Slave Work thresholdNode *LRF_Kernel::getTreshold( uint32_t &size, uint8_t kID ){ - if( m_pTWIC != NULL ) { - - }; - if( m_pHardwareManager!= NULL ) { - thresholdNode *ptr; - ptr = m_pHardwareManager->getWorkingMemory(); + thresholdNode * retVal = 0; + //if ( kID < 16 ) { // Local TH #ifdef TH_PER_MIRROR - kID = (kID>39)?39:kID; + kID = (kID>39)?39:kID; #else - kID = (kID>15)?15:kID; -#endif - if( ptr!= NULL ){ - m_nThresholdSize = TH_SIZE_NODES; - if( m_pThreshold == NULL ) { - //m_pThreshold = (thresholdNode *) malloc( sizeof(thresholdNode)* m_nThresholdSize ); - m_pThreshold = (thresholdNode *) malloc( TH_SIZE_BYTES ); - }; - if( m_pThreshold != NULL ) { - //memcpy( m_pThreshold, ptr+(kID*TH_SIZE_NODES), sizeof(thresholdNode)* m_nThresholdSize ); - memcpy( m_pThreshold, ptr+(kID*TH_SIZE_NODES), TH_SIZE_BYTES ); - } else m_nThresholdSize = 0; - }; - }; - size = m_nThresholdSize; - return m_pThreshold; + kID = (kID>15)?15:kID; +#endif + if( m_pCurrentTH != NULL ) { + if ( m_bCurrentTH == kID ) { + size = TH_SIZE_NODES; + return m_pCurrentTH; + } else { + if (m_pHardwareManager != NULL) { + thresholdNode *ptr = m_pHardwareManager->getWorkingMemory(); + if( ptr!= NULL ){ + memcpy( m_pCurrentTH, ptr+(kID*TH_SIZE_NODES), TH_SIZE_BYTES ); + m_bCurrentTH = kID; + size = TH_SIZE_NODES; + return m_pCurrentTH; + } else { + size = 0; + return NULL; + }; + }; + }; + } else { + if (m_pHardwareManager != NULL) { + thresholdNode *ptr = m_pHardwareManager->getWorkingMemory(); + if( ptr!= NULL ){ + m_pCurrentTH = (thresholdNode *) malloc( TH_SIZE_BYTES ); + if( m_pCurrentTH != NULL ) { + memcpy( m_pCurrentTH, ptr+(kID*TH_SIZE_NODES), TH_SIZE_BYTES ); + m_bCurrentTH = kID; + size = TH_SIZE_NODES; + return m_pCurrentTH; + }; + }; + }; + }; + size = 0; + return NULL; }; bool LRF_Kernel::reset( bool FullRestart ){ @@ -802,26 +708,24 @@ bool LRF_Kernel::shutdown( bool Restart ){ setStatus( TH_ENDED ); return true; }; - -networkClientHandler *LRF_Kernel::attachNewClient( int SocketID ){ - LOG("Creating Client Handler!"); - LRF_ClientHandler *tal; - tal = new LRF_ClientHandler( SocketID, this ); - if( tal!= NULL ) { - LOG("Client Handler Created!"); +#ifndef PRU_SLAVE //Just Master Stuff + networkClientHandler *LRF_Kernel::attachNewClient( int SocketID ){ + LOG("Creating Client Handler!"); + LRF_ClientHandler *tal; + tal = new LRF_ClientHandler( SocketID, this ); + if( tal!= NULL ) { + LOG("Client Handler Created!"); + }; + return (networkClientHandler *) tal; }; - return (networkClientHandler *) tal; -}; - -bool LRF_Kernel::detachClient( networkClientHandler *ptr ){ - LOG("Delete Client Handler!"); - if( ptr == NULL ) return false; - delete( (LRF_ClientHandler *) ptr ); - return true; -}; -#ifndef PRU_SLAVE //Just Master Stuff - + bool LRF_Kernel::detachClient( networkClientHandler *ptr ){ + LOG("Delete Client Handler!"); + if( ptr == NULL ) return false; + delete( (LRF_ClientHandler *) ptr ); + return true; + }; + bool LRF_Kernel::stopMotors( void ){ #ifndef ONPC_TOTTAL_SIMULATOR if( m_pHardwareManager!= NULL ) { @@ -845,7 +749,5 @@ bool LRF_Kernel::detachClient( networkClientHandler *ptr ){ }; #endif - - #undef LOG #undef LOG_ERROR diff --git a/lib/App/3dSERVER/LRF_SlimKernel.h b/lib/App/3dSERVER/LRF_SlimKernel.h index a15e003b..7de67233 100644 --- a/lib/App/3dSERVER/LRF_SlimKernel.h +++ b/lib/App/3dSERVER/LRF_SlimKernel.h @@ -16,6 +16,7 @@ #ifndef __LRF_KERNEL_H_INCL__ #define __LRF_KERNEL_H_INCL__ +//#define TH_USE_PICTURES #include "../../components/base/basicThread.h" #include "../../components/base/basicEngine.h" @@ -65,22 +66,24 @@ class LRF_Kernel: public basicThread, public basicEngine{ uint32_t m_nFlipCounter; uint32_t m_nFlipSavierID; uint8_t m_bExitCause; - LRF_WORK_MODE m_eWorkMode; + LRF_WORK_MODE m_eWM; + basicMutex m_mWMProtector; LRF_TwinConnector * m_pTWIC; -#ifdef PRU_SLAVE -#else +#ifndef PRU_SLAVE LRF_TargetTracker * m_pTracker; - // Argus/LGS proto networkServer * m_pNetClientsServer; - // Detection Stuff uint32_t m_nSST; #endif uint32_t m_nWidth; - // Shadow ShadowMask * m_pShadow; - thresholdNode * m_pThreshold; - uint32_t m_nThresholdSize; + + + + thresholdNode * m_pCurrentTH; + uint32_t m_nCurrentTH; + uint8_t m_bCurrentTH; + protected: void m_fThreadProc( void ); public: @@ -89,34 +92,38 @@ class LRF_Kernel: public basicThread, public basicEngine{ // Destructor virtual ~LRF_Kernel(); - - bool attachNetServer( networkServer *srvPort ); + +#ifdef PRU_SLAVE + bool create( LRF_HardwareManager *ptr = NULL ); +#else + bool attachNetServer( networkServer *srvPort ); virtual networkClientHandler * attachNewClient( int SocketID ); virtual bool detachClient( networkClientHandler *ptr ); -#ifndef PRU_SLAVE //Just Master Stuff bool create( LRF_HardwareManager *ptr = NULL, networkServer *srvPort = NULL ); bool stopMotors( void ); bool startMotors( void ); #endif - ShadowMask * getShadowMask( void ){ return m_pShadow; }; - bool create( LRF_HardwareManager *ptr = NULL ); + + void WaitFinish( bool Force = false ); /* functional API */ - bool askReset( void ); - LRF_WORK_MODE getMode( void ){ return m_eWorkMode; }; - bool getParameters( void ); - thresholdNode * getTreshold( uint32_t &size, uint8_t kID=0 ); - bool setMode( LRF_WORK_MODE nMode ); - bool setOffset( uint8_t nOffset ); - bool setOrder( uint8_t nOrder ); - - PLGS_3D_PARAMETERS getDetectionParameters( void ); - bool setDetectionParameters( PLGS_3D_PARAMETERS ptr ); - bool reset( bool FullRestart = false ); - bool shutdown( bool Restart = false ); - uint8_t getExitCause( void ){ return m_bExitCause; }; + bool askReset( void ); + PLGS_3D_PARAMETERS getDetectionParameters( void ); + LRF_WORK_MODE getWM( void ); + bool getParameters( void ); + thresholdNode * getTreshold( uint32_t &size, uint8_t kID=0 ); + ShadowMask * getShadowMask( void ){ return m_pShadow; }; + void setWM( LRF_WORK_MODE nMode ); + bool setOffset( uint8_t nOffset ); + bool setOrder( uint8_t nOrder ); + + + bool setDetectionParameters( PLGS_3D_PARAMETERS ptr ); + bool reset( bool FullRestart = false ); + bool shutdown( bool Restart = false ); + uint8_t getExitCause( void ){ return m_bExitCause; }; }; #endif // __LRF_KERNEL_H_INCL__ diff --git a/lib/App/3dSERVER/LRF_TargetTracker.cpp b/lib/App/3dSERVER/LRF_TargetTracker.cpp index 58bd7b7b..8a41c1a7 100644 --- a/lib/App/3dSERVER/LRF_TargetTracker.cpp +++ b/lib/App/3dSERVER/LRF_TargetTracker.cpp @@ -186,12 +186,12 @@ void LRF_TargetTracker::extentTrackingRecord( TRACKING_RECORD *A, TRACKING_RECOR int LRF_TargetTracker::validateTarget( targetRecord *TR, bool bIsMaster ){ TRACKING_RECORD *pTREC; char tBuff[256]; -#ifdef DEBUG +#ifdef DEBUG_EXTRA LOG("Validate Target"); #endif // Filter Width if( TR->width < m_nWidth ){ -#ifdef DEBUG +#ifdef DEBUG_EXTRA sprintf( tBuff, "Target Dropped By Filter Width[%d] > %d !", m_nWidth, TR->width ); LOG( tBuff ); #endif @@ -218,6 +218,15 @@ int LRF_TargetTracker::validateTarget( targetRecord *TR, bool bIsMaster ){ tData->w_cnt = pTREC->areaCount; tData->uts = pTREC->nUTS; tData->ums = pTREC->nUTmS; +#ifdef DISABLE_FRENDLY_MESSAGES + if( pTREC->bType ) { + tData->type = EVT_TARGET_3D_WHITE; + tEvt = createBasicEvent( 0, EVT_CLASS_SENSOR_3D, EVT_TARGET_3D_WHITE, NULL, NULL, (void *)tData ); + } else { + tData->type = EVT_TARGET_3D_BLACK; + tEvt = createBasicEvent( 0, EVT_CLASS_SENSOR_3D, EVT_TARGET_3D_BLACK, NULL, NULL, (void *)tData ); + }; +#else sprintf( tBuff, "Target[%d] T:[%d] R:[%d] C:[%d] R:[%d] W:[%d]", 0, pTREC->bType, @@ -232,6 +241,7 @@ int LRF_TargetTracker::validateTarget( targetRecord *TR, bool bIsMaster ){ tData->type = EVT_TARGET_3D_BLACK; tEvt = createBasicEvent( 0, EVT_CLASS_SENSOR_3D, EVT_TARGET_3D_BLACK, NULL, tBuff, (void *)tData ); }; +#endif if( tEvt != NULL ) { tEvt->m_eClass = EVT_CLASS_SENSOR_3D; m_pEventHeap->broadcast( tEvt ); @@ -269,7 +279,7 @@ int LRF_TargetTracker::validateTarget( targetRecord *TR, bool bIsMaster ){ if( m_aTargetsPool[index].bActive ){ #ifdef TRACKER_FULL_COMPARE if( compareTrackingRecords( &m_aTargetsPool[index], pTREC ) ) { - #ifdef DEBUG + #ifdef DEBUG_EXTRA LOG("Compared[FullCompare] - found EQ"); #endif extentTrackingRecord( &m_aTargetsPool[index], pTREC ); @@ -283,7 +293,7 @@ int LRF_TargetTracker::validateTarget( targetRecord *TR, bool bIsMaster ){ C = QuickCompare( m_aTargetsPool[index].beginID, pTREC->endID ); D = QuickCompare( m_aTargetsPool[index].endID, pTREC->endID ); if( A | B | C | D ) { - #ifdef DEBUG + #ifdef DEBUG_EXTRA LOG("Compared[QuickCompare] - found EQ"); #endif extentTrackingRecord( &m_aTargetsPool[index], pTREC ); @@ -293,12 +303,12 @@ int LRF_TargetTracker::validateTarget( targetRecord *TR, bool bIsMaster ){ #endif // TRACKER_FULL_COMPARE }; }; - #ifdef DEBUG + #ifdef DEBUG_EXTRA LOG("Not Found EQ Targets"); #endif for( int index = 0; index < TRACKER_MAX_TARGETS_POOL; index++ ){ if( !m_aTargetsPool[index].bActive ){ - #ifdef DEBUG + #ifdef DEBUG_EXTRA LOG("Assigning to Empty Tracking Record"); #endif m_aTargetsPool[index].bActive = true; @@ -334,6 +344,15 @@ void LRF_TargetTracker::MirrorComplete( void ){ tData->w_cnt = m_aTargetsPool[index].areaCount; tData->uts = m_aTargetsPool[index].nUTS; tData->ums = m_aTargetsPool[index].nUTmS; +#ifdef DISABLE_FRENDLY_MESSAGES + if( m_aTargetsPool[index].bType ) { + tData->type = EVT_TARGET_3D_WHITE; + tEvt = createBasicEvent( 0, EVT_CLASS_SENSOR_3D, EVT_TARGET_3D_WHITE, NULL, NULL, (void *)tData ); + } else { + tData->type = EVT_TARGET_3D_BLACK; + tEvt = createBasicEvent( 0, EVT_CLASS_SENSOR_3D, EVT_TARGET_3D_BLACK, NULL, NULL, (void *)tData ); + }; +#else sprintf( tBuff, "Target[%d] T:[%d] R:[%d] C:[%d] R:[%d] W:[%d]", 0, m_aTargetsPool[index].bType, @@ -348,6 +367,7 @@ void LRF_TargetTracker::MirrorComplete( void ){ tData->type = EVT_TARGET_3D_BLACK; tEvt = createBasicEvent( 0, EVT_CLASS_SENSOR_3D, EVT_TARGET_3D_BLACK, NULL, tBuff, (void *)tData ); }; +#endif if( tEvt != NULL ) { tEvt->m_eClass = EVT_CLASS_SENSOR_3D; m_pEventHeap->broadcast( tEvt ); @@ -388,6 +408,13 @@ void LRF_TargetTracker::MirrorComplete( void ){ tData->mEndID = m_aTargetsPool[index].endID; tData->mWidth = m_aTargetsPool[index].area; tData->mCount = m_aTargetsPool[index].areaCount; +#ifdef DISABLE_FRENDLY_MESSAGES + if( m_aTargetsPool[index].bType ) { + tEvt = createBasicEvent( 0, EVT_CLASS_SENSOR_3D, EVT_TARGET_WHITE, NULL, NULL, (void *)tData ); + } else { + tEvt = createBasicEvent( 0, EVT_CLASS_SENSOR_3D, EVT_TARGET_BLACK, NULL, NULL, (void *)tData ); + }; +#else sprintf( tBuff, "Target[%d] T:[%d] R:[%d] C:[%d] R:[%d] W:[%d]", index, m_aTargetsPool[index].bType, @@ -396,10 +423,11 @@ void LRF_TargetTracker::MirrorComplete( void ){ m_aTargetsPool[index].beginRow, m_aTargetsPool[index].area ); if( m_aTargetsPool[index].bType ) { - tEvt = createBasicEvent( 0, EVT_CLASS_SENSOR_3D, EVT_TARGET_WHITE, tBuff, (void *)tData ); + tEvt = createBasicEvent( 0, EVT_CLASS_SENSOR_3D, EVT_TARGET_WHITE, NULL, tBuff, (void *)tData ); } else { - tEvt = createBasicEvent( 0, EVT_CLASS_SENSOR_3D, EVT_TARGET_BLACK, tBuff, (void *)tData ); + tEvt = createBasicEvent( 0, EVT_CLASS_SENSOR_3D, EVT_TARGET_BLACK, NULL, tBuff, (void *)tData ); }; +#endif if( tEvt != NULL ) { tEvt->m_eClass = EVT_CLASS_SENSOR_3D; m_pEventHeap->broadcast( tEvt ); @@ -458,7 +486,7 @@ void LRF_TargetTracker::ScanComplete( void ){ m_aTargetsPool[index].beginRow, m_aTargetsPool[index].area ); - tEvt = createBasicEvent( 0, EVT_CLASS_SENSOR_3D, EVT_TARGET_WHITE, tBuff, (void *)tData ); + tEvt = createBasicEvent( 0, EVT_CLASS_SENSOR_3D, EVT_TARGET_WHITE, NULL, tBuff, (void *)tData ); if( tEvt != NULL ) { tEvt->m_eClass = EVT_CLASS_SENSOR_3D; m_pEventHeap->broadcast( tEvt ); diff --git a/lib/App/3dSERVER/LRF_TwinConnector.cpp b/lib/App/3dSERVER/LRF_TwinConnector.cpp index 1f3fa4c3..779a0ede 100644 --- a/lib/App/3dSERVER/LRF_TwinConnector.cpp +++ b/lib/App/3dSERVER/LRF_TwinConnector.cpp @@ -1,14 +1,13 @@ #include "LRF_TwinConnector.h" -#include "LRF_Kernel.h" -#include "LRF_TargetTracker.h" -#ifdef TWI_TH_USE_PICTURES - #define STB_IMAGE_IMPLEMENTATION - #include "../../data/stbi/stb_image.h" - #define STB_IMAGE_WRITE_IMPLEMENTATION - #include "../../data/stbi/stb_image_write.h" - #undef STB_IMAGE_WRITE_IMPLEMENTATION - #undef STB_IMAGE_IMPLEMENTATION +#ifdef SLIM_KERNEL + #include "LRF_SlimKernel.h" +#else + #include "LRF_Kernel.h" +#endif + +#ifndef PRU_SLAVE + #include "LRF_TargetTracker.h" #endif #define LOG( X ) m_pLog->Log( "TWINC", this, X ) @@ -22,384 +21,465 @@ #define LOG_ERROR( X ) m_pLog->Log( "TWINC", this, _LOG_ERROR, X ); #endif -#define SLOG( X ) Me->m_pLog->Log( "TWINC", Me, X ) +#define SLOG( X ) Me->m_pLog->Log( "TWINC_T", Me, X ) #ifdef DEBUG #define SLOG_ERROR( X ) {\ char _tBfrErrMSG234[256];\ sprintf( _tBfrErrMSG234, "In file %s[%d] in func:%s %s",__FILE__, __LINE__, __func__, X );\ - Me->m_pLog->Log( "TWINC", Me, _LOG_ERROR, _tBfrErrMSG234 );\ + Me->m_pLog->Log( "TWINC_T", Me, _LOG_ERROR, _tBfrErrMSG234 );\ } #else - #define SLOG_ERROR( X ) Me->m_pLog->Log( "TWINC", Me, _LOG_ERROR, X ); + #define SLOG_ERROR( X ) Me->m_pLog->Log( "TWINC_T", Me, _LOG_ERROR, X ); #endif - LRF_TwinConnector::LRF_TwinConnector( config_setting_t *Settings ): basicThread(){ m_pLog = basicLogCollection::getInstance(); m_pSettings = basicSettingsProvider::getInstance()->getSubNode( Settings, (CSTR)"TWIN_3DLRF_CONNECTION" ); - m_pPort = NULL; m_pEngine = NULL; - m_nStatus = 0; + m_pCurrentTH = NULL; + m_bDrawThreadStatus = TH_PRE_INIT; #ifdef PRU_SLAVE m_nMasterPort = 0; - m_pMasterAddress = (CSTR) malloc( 16 ); - m_bWorkingMode = TWI_STAGE_WAITING_CONNECTION; + memset( m_cMasterAddress, 0 , 16 ); + m_eWM = TWI_STAGE_WAITING_CONNECTION; + memset(&m_sSystemStatus,0, sizeof(TWI_PEER_STATUS)); #else m_nMainSocket = -1; m_nBindPort = 0; - m_pBindAddress = (CSTR) malloc( 16 ); - m_bWorkingMode = TWI_STAGE_BEFORE_BIND; + memset( m_cBindAddress, 0, 16 ); + m_eWM = TWI_STAGE_BEFORE_BIND; + cleanupInfo(); #endif }; LRF_TwinConnector::~LRF_TwinConnector(){ - if( m_pPort != NULL ) delete( m_pPort ); - if (m_bDrawThreadStatus > TH_ARMED ) { - waitDrawThreadEnd( true ); - // JOIN in Wait function!! - //pthread_detach(m_sThreadHandler); - //pthread_join(m_sThreadHandler, NULL); - }; + waitDrawThreadEnd( true ); + waitThreadEnd( true ); #ifdef PRU_SLAVE - if( m_pMasterAddress ) free( m_pMasterAddress ); + if( m_oDataTransport != NULL ) delete( (clientPort *) m_oDataTransport ); #else - if( m_pBindAddress ) free( m_pBindAddress ); -#endif + if( m_oDataTransport != NULL ) delete( (serverPort *) m_oDataTransport ); +#endif +}; +void LRF_TwinConnector::setWM( TWI_WM NWM ){ + m_mWMProtector.lock(); + m_eWM = NWM; + m_mWMProtector.unlock(); }; -bool LRF_TwinConnector::create(){ - if( m_pSettings!= NULL ) { - config_setting_t *pSetting; - int tVal; - char tBuffer[256]; -#ifdef PRU_SLAVE - if (!config_setting_lookup_string(m_pSettings, "MASTER_ADDRESS", (const char**)&m_pMasterAddress)) { - strncpy( m_pMasterAddress, "10.0.0.1", 15 ); - pSetting = config_setting_add(m_pSettings, "MASTER_ADDRESS", CONFIG_TYPE_STRING); - config_setting_set_string(pSetting, m_pMasterAddress); - basicSettingsProvider::getInstance()->compromise(); - } else { - sprintf( tBuffer, "MASTER IP Address Read From Settings: %s", m_pMasterAddress ); - LOG( tBuffer ); - }; - if( !config_setting_lookup_int( m_pSettings, "MASTER_PORT", &tVal ) ){ - tVal = m_nMasterPort = 6564; - pSetting = config_setting_add( m_pSettings, "MASTER_PORT", CONFIG_TYPE_INT ); - config_setting_set_bool( pSetting, tVal ); - basicSettingsProvider::getInstance()->compromise(); - } else { - m_nMasterPort = tVal; - sprintf( tBuffer, "MASTER PORT Read From Settings: %d", tVal ); - LOG( tBuffer ); - }; -#else - if (!config_setting_lookup_string(m_pSettings, "BIND_ADDRESS", (const char**)&m_pBindAddress)) { - strncpy( m_pBindAddress, "10.0.0.1", 15 ); - pSetting = config_setting_add(m_pSettings, "BIND_ADDRESS", CONFIG_TYPE_STRING); - config_setting_set_string(pSetting, m_pBindAddress); - basicSettingsProvider::getInstance()->compromise(); - } else { - sprintf( tBuffer, "BIND to IP Address Read From Settings: %s", m_pBindAddress ); - LOG( tBuffer ); - }; - if( !config_setting_lookup_int( m_pSettings, "BIND_PORT", &tVal ) ){ - tVal = m_nBindPort = 6564; - pSetting = config_setting_add( m_pSettings, "BIND_PORT", CONFIG_TYPE_INT ); - config_setting_set_bool( pSetting, tVal ); - basicSettingsProvider::getInstance()->compromise(); - } else { - m_nBindPort = tVal; - sprintf( tBuffer, "BIND to PORT Read From Settings: %d", tVal ); - LOG( tBuffer ); - }; -#endif - if( basicSettingsProvider::getInstance()->isCompromised() ) { - LOG("Save Settings"); - basicSettingsProvider::getInstance()->validate(); - }; - } else { - LOG_ERROR("No Settings Provided!"); - return false; +TWI_WM LRF_TwinConnector::getWM(){ + TWI_WM rv; + m_mWMProtector.lock(); + rv = m_eWM; + m_mWMProtector.unlock(); + return rv; +}; + +void LRF_TwinConnector::setCMD( TWIN_COMMAND NCMD ){ + m_mCMDProtector.lock(); + m_eCCMD = NCMD; + m_bCMDTO = 10; // 1 sec + m_mCMDProtector.unlock(); +}; + +TWIN_COMMAND LRF_TwinConnector::getCMD(){ + TWIN_COMMAND rv; + m_mCMDProtector.lock(); + rv = m_eCCMD; + m_mCMDProtector.unlock(); + return rv; +}; + +bool LRF_TwinConnector::readyToConsumeTH( void ){ + if ( m_mDrawProtector.try_lock()) { + m_mDrawProtector.unlock(); + return true; }; -#ifdef PRU_SLAVE - //m_pProtocol = new protocolInternalLRF3D_SLAVE(); - //if( m_pProtocol == NULL ){ - // LOG_ERROR("Error creating protocol!"); - // return false; - //}; - if( !protocolInternalLRF3D_SLAVE::create() ) return false; -#else - int RetCode; - struct hostent * h_info; - struct sockaddr_in * MainSocketAddress = NULL; - - //m_pProtocol = new protocolInternalLRF3D_MASTER(); - //if( m_pProtocol == NULL ){ - // LOG_ERROR("Error creating protocol!"); - // return false; - //}; - if( !protocolInternalLRF3D_MASTER::create() ) return false; - - m_nMainSocket = socket( AF_INET, SOCK_STREAM, 0 ); - if( m_nMainSocket == -1){ - LOG_ERROR( "Some trouble with networking on this machine (Socket Error)!"); - return false; - }; - MainSocketAddress = ( struct sockaddr_in * ) malloc( sizeof( struct sockaddr_in ) ); - if( MainSocketAddress == NULL ){ - LOG_ERROR( "Some trouble with networking on this machine (Cannot Alloc Sockaddr Struct)!" ); - return false; - }; - bzero( MainSocketAddress, sizeof( struct sockaddr_in ) ); - h_info = gethostbyname ( m_pBindAddress ); - if ( h_info == NULL ){ - LOG_ERROR( "Some trouble with networking on this machine (Cannot Get Hostname)!" ); - return false; - }; - //***************************************** - //* there we building our network address * - //***************************************** - bcopy( h_info->h_addr, &(MainSocketAddress->sin_addr), h_info->h_length ); - MainSocketAddress->sin_family = h_info->h_addrtype; - MainSocketAddress->sin_port = htons( m_nBindPort ); - - RetCode = bind( m_nMainSocket ,(struct sockaddr *) MainSocketAddress, sizeof( struct sockaddr_in ) ); - if ( RetCode != 0 ){ - LOG_ERROR( "Error Binding to Port/Address" ); - return false; - }; - RetCode = listen( m_nMainSocket, 128); - if ( RetCode != 0 ){ - LOG_ERROR( "Cannot Listen Port/Address" ); - return false; - }; - - U8 dontblock; - dontblock = fcntl( m_nMainSocket, F_GETFL, NULL ); - dontblock |= O_NONBLOCK | O_NDELAY; - RetCode = ioctl( m_nMainSocket, FIONBIO, (char *) &dontblock ); - if ( RetCode == 0 ){ - LOG( "Set N-Blocking Mode of Accepting Socket" ); - } else { - LOG( "Can't set N-Blocking Mode of Accepting Socket" ); - }; -#endif // PRU_SLAVE - m_bWorkingMode = TWI_STAGE_WAITING_CONNECTION; - return init(); + return false; }; -void *LRF_TwinConnector::m_fDrawThreadEntryPoint( void *ptr ){ - LRF_TwinConnector *Me; - if( ptr == NULL ) return NULL; - Me = (LRF_TwinConnector*) ptr; -#ifdef DEBUG - SLOG("TH Thread OK"); -#endif - if( Me->m_bDrawThreadStatus == TH_ARMED ) { -#ifdef DEBUG - SLOG("TH Image Thread ARMED!"); -#endif - Me->m_bDrawThreadStatus = TH_WORKING; - if( Me->m_pEngine!= NULL ) { - // Store Local TH Draws - thresholdNode *tMem; - uint32_t tSize; -#ifdef DEBUG - SLOG("Kernel is Defined!"); +bool LRF_TwinConnector::consumeTH( uint8_t kID, thresholdNode *ptr, uint32_t THsize ){ + int RetVal; + if ( ptr == NULL) return false; + if ( THsize == 0 ) return false; + + m_mStatusProtector.lock(); +#ifdef PRU_SLAVE + m_sSystemStatus.TH_READY &= ~(1 << kID); +#else + m_sSystemStatus.MASTER_STATUS.TH_READY &= ~(1 << kID); #endif - for( uint8_t i=0; i<16; i++ ) { - // just in case if we must end work - if( Me->m_bDrawThreadStatus != TH_WORKING ) break; - tMem = Me->m_pEngine->getTreshold( tSize, i ); - if( tMem!= NULL ) { - char tBuffer[256]; -#ifdef TWI_TH_USE_PICTURES - sprintf( tBuffer, "data/th_data_%d.png", i ); - #ifdef DEBUG - SLOG("SAVE TH Image ..."); - SLOG( tBuffer ); - #endif - if( !Me->saveTHPicture( tMem, tBuffer, false )){ - SLOG_ERROR("TH PNG save failure!"); - } - #ifdef PRU_SLAVE - else { - Me->m_mStatusProtector.lock(); - Me->m_nStatus |= ( 1 << i ) << 16; - Me->m_mStatusProtector.unlock(); - } - #endif - ; - #ifdef DEBUG - SLOG("SAVE TH Image DONE!"); - #endif - SLEEP(10); -#else //TWI_TH_USE_PICTURES - sprintf( tBuffer, "data/th_data_%d.raw", i ); - #ifdef DEBUG - SLOG("SAVE TH Data ..."); - SLOG( tBuffer ); - #endif - FILE *fd; - fd = fopen( tBuffer, "wb+"); - if( fd != NULL ){ - uint32_t Size = TH_SIZE_NODES; - fwrite( &Size, sizeof( uint32_t ), 1, fd ); - fwrite( tMem, sizeof( thresholdNode ), Size, fd ); - fclose( fd ); - #ifdef PRU_SLAVE - Me->m_mStatusProtector.lock(); - Me->m_nStatus |= ( 1 << i ) << 16; - Me->m_mStatusProtector.unlock(); - #endif - } else { - SLOG_ERROR("TH RAW save failure!"); - }; - #ifdef DEBUG - SLOG("SAVE TH Data DONE!"); - #endif -#endif //TWI_TH_USE_PICTURES - }; - }; + m_mStatusProtector.unlock(); + + cleanTHData( kID ); + + + if( m_bDrawThreadStatus > TH_ARMED ) { + RetVal = pthread_join( m_sDrawThreadHandler, NULL ); + if( RetVal != 0 ){ + LOG_ERROR("Thread Join Error!"); + return false; }; }; - Me->m_bDrawThreadStatus = TH_EXIT; - Me->m_mDrawProtector.unlock(); - pthread_exit( NULL ); - return NULL; -}; - -void LRF_TwinConnector::waitDrawThreadEnd( bool forced ){ - if( m_bDrawThreadStatus > TH_WORKING || m_bDrawThreadStatus < TH_ARMED ) return; - if( forced ) m_bDrawThreadStatus = TH_ENDED; - while( m_bDrawThreadStatus != TH_EXIT ){ - SLEEP(DEFAULT_THREAD_SLEEP_TIME); + m_mDrawProtector.lock(); + m_pCurrentTH = ptr; + m_bDrawThreadStatus = TH_ARMED; + RetVal = pthread_create( &m_sDrawThreadHandler, NULL, m_fDrawThreadEntryPoint, ( void * ) this ); + if( RetVal == -1 ) { + LOG_ERROR("Image Draw Thread Creation Failed."); + m_mDrawProtector.unlock(); }; - pthread_join( m_sDrawThreadHandler, NULL ); + return true; }; #ifdef PRU_SLAVE + bool LRF_TwinConnector::create(){ + if( m_pSettings!= NULL ) { + config_setting_t *pSetting; + int tVal; + char tBuffer[256]; + CSTR tcVal = NULL; + if (!config_setting_lookup_string( m_pSettings, "MASTER_ADDRESS", (const char**)&tcVal)){ //&m_cMasterAddress )) { + strncpy( m_cMasterAddress, "10.0.0.1", 15 ); + pSetting = config_setting_add(m_pSettings, "MASTER_ADDRESS", CONFIG_TYPE_STRING); + config_setting_set_string(pSetting, m_cMasterAddress); + basicSettingsProvider::getInstance()->compromise(); + } else { + strncpy( m_cMasterAddress, tcVal, 16 ); + sprintf( tBuffer, "MASTER IP Address Read From Settings: %s", m_cMasterAddress ); + LOG( tBuffer ); + }; + if( !config_setting_lookup_int( m_pSettings, "MASTER_PORT", &tVal ) ){ + tVal = m_nMasterPort = 6564; + pSetting = config_setting_add( m_pSettings, "MASTER_PORT", CONFIG_TYPE_INT ); + config_setting_set_bool( pSetting, tVal ); + basicSettingsProvider::getInstance()->compromise(); + } else { + m_nMasterPort = tVal; + sprintf( tBuffer, "MASTER PORT Read From Settings: %d", tVal ); + LOG( tBuffer ); + }; + if( basicSettingsProvider::getInstance()->isCompromised() ) { + LOG("Save Settings"); + basicSettingsProvider::getInstance()->validate(); + }; + } else { + LOG_ERROR("No Settings Provided!"); + return false; + }; + if( !protocolInternalLRF3D_SLAVE::create() ) return false; + m_eWM = TWI_STAGE_WAITING_CONNECTION; + return init(); + }; + bool LRF_TwinConnector::packetHandler( protocolPackage *Package ){ + char tB[128]; if( Package == NULL ) return false; - TWIN_COMMAND cCMD = (TWIN_COMMAND) Package->m_pData[3]; + if( Package->m_pData == NULL ) return false; + if (Package->m_nSize < TWI_CMD_INDEX ) return false; + + TWIN_COMMAND cCMD = (TWIN_COMMAND)Package->m_pData[TWI_CMD_INDEX]; + //Any In Command Switchs to CMD mode + sprintf(tB,"Data IN! CODE: %d", cCMD ); + LOG( tB ); switch( cCMD ) { - case TWC_GET_STATUS:{ - m_mStatusProtector.lock(); - sendStatus( m_nStatus ); - m_mStatusProtector.unlock(); + case TWC_SET_CMD_MODE:{ + LOG("Set CMD Mode"); + //First Disable Events Propogation then Send ACK + setWM( TWI_STAGE_REQUEST_MODE ); + sendACK( TWC_SET_CMD_MODE ); + break; + }; + case TWC_SET_EVT_MODE:{ + LOG("Set EVT Mode"); + //First Send ACK then Enable Events Propogation + sendACK( TWC_SET_EVT_MODE ); + setWM( TWI_STAGE_EVENT_MODE ); + break; + }; + case TWC_GET_VERSION:{ + LOG("Get Version"); + sendVersion( &gsSOFT_INFO ); + break; + }; + case TWC_GET_MODE:{ + LOG("Get Mode"); + sendMode( getWM() ); break; }; }; return true; }; + /// + /// Main Loop Of Slave Part Of Connector + /// + /// Nothing void LRF_TwinConnector::m_fThreadProc( void ){ - TWIN_CMD_REC * tCMD = NULL; + TWI_CMD_CONTAINER * tCMD = NULL; int ClientSocket = -1; struct sockaddr ClientAddress; socklen_t ClientAddressSize; long long cMilliseconds; long long cStatusTO = 0; - long long cDrawTO = 0; + long long cDrawTO = getMilliseconds(); m_bThreadStatus = TH_WORKING; while( m_bThreadStatus < TH_ENDED ){ cMilliseconds = getMilliseconds(); + /* // TH Saving procedure - if( cDrawTO == 0 ) { - cDrawTO = cMilliseconds; - } else if ( ( cMilliseconds - cDrawTO ) > TWI_DRAW_LOOP_MS ){ -#ifdef DEBUG - LOG("Try to Dump TH Images"); -#endif + if ( ( cMilliseconds - cDrawTO ) > TWI_DRAW_LOOP_MS ){ if( m_mDrawProtector.try_lock() ) { -#ifdef DEBUG - LOG("Mutex Grabed"); -#endif + // The Mutex will be unlocked by the End of the thread procedure + int RetVal; + if( m_bDrawThreadStatus > TH_ARMED ) { - pthread_join( m_sDrawThreadHandler, NULL ); + RetVal = pthread_join( m_sDrawThreadHandler, NULL ); + if( RetVal != 0 ){ + LOG_ERROR("Thread Join Error!"); + }; }; - cDrawTO = cMilliseconds; + m_bDrawThreadStatus = TH_ARMED; - int RetVal = pthread_create( &m_sDrawThreadHandler, NULL, m_fDrawThreadEntryPoint, ( void * ) this ); + + RetVal = pthread_create( &m_sDrawThreadHandler, NULL, m_fDrawThreadEntryPoint, ( void * ) this ); + if( RetVal == -1 ) { LOG_ERROR("Image Draw Thread Creation Failed."); m_mDrawProtector.unlock(); + } else cDrawTO = cMilliseconds; + + }; + }; + */ + + if ( getWM() >= TWI_STAGE_CONNECTED ) { + if( m_oDataTransport!= NULL ) { + if (m_oDataTransport->getConnectionStatus() == CS_DISCONNECTED) { + setWM( TWI_STAGE_WAITING_CONNECTION ); + continue; }; - } -#ifdef DEBUG - else { - LOG("Mutex NOT Grabed"); - } -#endif - ; + } else LOG_ERROR("Port Object Missed!"); }; - - if( m_pPort != NULL ){ - if( m_pPort->getConnectionStatus() == CS_DISCONNECTED ){ - m_bWorkingMode = TWI_STAGE_WAITING_CONNECTION; - if( tCMD!= NULL ){ - //reset commands on disconnect - m_bCCMD = TWC_NO_COMMAND; - if( tCMD->PTR == NULL ) free( tCMD->PTR ); - free( tCMD ); - tCMD = NULL; - }; - delete( m_pPort ); - m_pPort = NULL; - continue; - } else { - // Status Send procedure - if( cStatusTO == 0 ) { - cStatusTO = cMilliseconds; - } else if( ( cMilliseconds - cStatusTO ) > TWI_STATUS_LOOP_MS ){ - m_mStatusProtector.lock(); - if( !sendStatus( m_nStatus ) ){ - LOG_ERROR("Status Sending failure!"); - m_pPort->disconnect(); + switch( getWM() ) { + case TWI_STAGE_WAITING_CONNECTION:{ + if( m_oDataTransport != NULL ){ + delete( (clientPort *) m_oDataTransport ); + m_oDataTransport = NULL; + } else { + clientPort *tPort = new clientPort( m_cMasterAddress, m_nMasterPort, true ); + if( tPort!= NULL ){ + if( tPort->create() ){ + setTransport( tPort ); + setWM( TWI_STAGE_CONNECTED ); + } else { + delete( tPort ); + SLEEP( TWI_SLOW_LOOP_SLEEP ); + }; + } else LOG_ERROR( "Port Not Created!"); + }; + break; + }; + case TWI_STAGE_REQUEST_MODE:{ + switch( getCMD() ){ + case TWC_GET_STATUS:{ + if( m_pEngine ){ + LRF_WORK_MODE tKM = m_pEngine->getWM(); + } else { + //sendStatus(); + }; + setCMD( TWC_NO_COMMAND ); + break; }; - m_mStatusProtector.unlock(); + //case }; + break; }; - } else { - LOG("(re)Establish Connection"); - m_pPort = new clientPort( m_pMasterAddress, m_nMasterPort, true ); - if( m_pPort!= NULL ){ - setTransport( m_pPort ); - m_bWorkingMode = TWI_STAGE_CONNECTED; - }; - }; + case TWI_STAGE_EVENT_MODE:{ + //Fetch Event from Queue and send to master + + break; + }; + }; + + SLEEP( TWI_SLOW_LOOP_SLEEP ); }; }; #else //Master + void LRF_TwinConnector::cleanupInfo(void){ + memset( &m_sSystemStatus, 0, sizeof( TWIN_STATUS )); + memcpy( &m_sSystemStatus.MASTER_NFO, &gsSOFT_INFO, sizeof(SOFTWARE_INFO)); + }; + bool LRF_TwinConnector::create(){ + if( m_pSettings!= NULL ) { + config_setting_t *pSetting; + int tVal; + char tBuffer[256]; + CSTR tcVal = NULL; + if (!config_setting_lookup_string(m_pSettings, "BIND_ADDRESS", (const char**)&tcVal )){ //(const char**)&m_cBindAddress)) { + strncpy( m_cBindAddress, "10.0.0.1", 15 ); + pSetting = config_setting_add(m_pSettings, "BIND_ADDRESS", CONFIG_TYPE_STRING); + config_setting_set_string(pSetting, m_cBindAddress); + basicSettingsProvider::getInstance()->compromise(); + } else { + strncpy( m_cBindAddress, tcVal, 16 ); + sprintf( tBuffer, "BIND to IP Address Read From Settings: %s", m_cBindAddress ); + LOG( tBuffer ); + }; + if( !config_setting_lookup_int( m_pSettings, "BIND_PORT", &tVal ) ){ + tVal = m_nBindPort = 6564; + pSetting = config_setting_add( m_pSettings, "BIND_PORT", CONFIG_TYPE_INT ); + config_setting_set_bool( pSetting, tVal ); + basicSettingsProvider::getInstance()->compromise(); + } else { + m_nBindPort = tVal; + sprintf( tBuffer, "BIND to PORT Read From Settings: %d", tVal ); + LOG( tBuffer ); + }; + if( basicSettingsProvider::getInstance()->isCompromised() ) { + LOG("Save Settings"); + basicSettingsProvider::getInstance()->validate(); + }; + } else { + LOG_ERROR("No Settings Provided!"); + return false; + }; + int RetCode; + struct hostent * h_info; + struct sockaddr_in * MainSocketAddress = NULL; + + if( !protocolInternalLRF3D_MASTER::create() ) return false; + + m_nMainSocket = socket( AF_INET, SOCK_STREAM, 0 ); + + if( m_nMainSocket == -1){ + LOG_ERROR( "Some trouble with networking on this machine (Socket Error)!"); + return false; + }; + MainSocketAddress = ( struct sockaddr_in * ) malloc( sizeof( struct sockaddr_in ) ); + if( MainSocketAddress == NULL ){ + LOG_ERROR( "Some trouble with networking on this machine (Cannot Alloc Sockaddr Struct)!" ); + return false; + }; + bzero( MainSocketAddress, sizeof( struct sockaddr_in ) ); + h_info = gethostbyname ( m_cBindAddress ); + if ( h_info == NULL ){ + LOG_ERROR( "Some trouble with networking on this machine (Cannot Get Hostname)!" ); + return false; + }; + //***************************************** + //* there we building our network address * + //***************************************** + bcopy( h_info->h_addr, &(MainSocketAddress->sin_addr), h_info->h_length ); + MainSocketAddress->sin_family = h_info->h_addrtype; + MainSocketAddress->sin_port = htons( m_nBindPort ); + + RetCode = bind( m_nMainSocket ,(struct sockaddr *) MainSocketAddress, sizeof( struct sockaddr_in ) ); + if ( RetCode != 0 ){ + LOG_ERROR( "Error Binding to Port/Address" ); + return false; + }; + RetCode = listen( m_nMainSocket, 128); + if ( RetCode != 0 ){ + LOG_ERROR( "Cannot Listen Port/Address" ); + return false; + }; + + U8 dontblock; + dontblock = fcntl( m_nMainSocket, F_GETFL, NULL ); + dontblock |= O_NONBLOCK | O_NDELAY; + RetCode = ioctl( m_nMainSocket, FIONBIO, (char *) &dontblock ); + if ( RetCode == 0 ){ + LOG( "Set N-Blocking Mode of Accepting Socket" ); + } else { + LOG( "Can't set N-Blocking Mode of Accepting Socket" ); + }; + m_eWM = TWI_STAGE_WAITING_CONNECTION; + return init(); + }; + bool LRF_TwinConnector::packetHandler( protocolPackage *Package ){ + char tB[128]; if( Package == NULL ) return false; - TWIN_COMMAND cCMD = (TWIN_COMMAND)Package->m_pData[3]; - switch( cCMD ) { - case TWC_ACK_STATUS:{ - uint32_t tStatus; -#ifdef DEBUG - LOG("Status ACK reseived"); -#endif - tStatus = ( Package->m_pData[4] << 24 ) | ( Package->m_pData[5] << 16 ) | ( Package->m_pData[6] << 8 ) | Package->m_pData[7]; - m_mStatusProtector.lock(); - m_nStatus = tStatus; - m_mStatusProtector.unlock(); + if( Package->m_pData == NULL ) return false; + if( Package->m_nSize < TWI_CMD_INDEX ) return false; + TWIN_COMMAND tCMD = (TWIN_COMMAND) Package->m_pData[TWI_CMD_INDEX]; + sprintf(tB,"Data IN! Code: %d", tCMD ); + LOG(tB); + switch( tCMD ) { + case TWC_ACK_CMD:{ + LOG( "CMD ACK"); + TWIN_COMMAND confirmedCMD = (TWIN_COMMAND) Package->m_pData[TWI_PLS_INDEX]; + if( getCMD() != confirmedCMD ) { + setWM( TWI_STAGE_RETRY_CMD ); + } else { + //Last Command Confirmed -> Clean + setCMD( TWC_NO_COMMAND ); + switch ( confirmedCMD ) { + case TWC_DO_REBOOT:{ + //After Confirmation -> Disconnect + setWM( TWI_STAGE_DISCONNECTING ); + break; + }; + case TWC_SET_EVT_MODE:{ + setWM( TWI_STAGE_EVENT_MODE ); + break; + }; + case TWC_SET_CMD_MODE:{ + setWM( TWI_STAGE_REQUEST_STATUS ); + break; + }; + }; + }; + break; + }; + case TWC_CURRENT_MODE:{ + TWI_WM tWM = ( TWI_WM ) Package->m_pData[TWI_PLS_INDEX]; + sprintf(tB,"Cur Slave Mode Is: %d", tWM ); + LOG(tB); + if ( tWM == TWI_STAGE_EVENT_MODE ) { + setWM( TWI_STAGE_SET_COMMAND_MODE ); + } else { + setWM( TWI_STAGE_REQUEST_STATUS ); + }; break; }; case TWC_TH_DATA:{ + if( getWM() == TWI_STAGE_TH_TRANSFER ) { + }; + break; + }; + case TWC_CURRENT_STATUS:{ + LOG( "Cur Status"); + setWM( TWI_STAGE_REQUEST_STATUS ); + break; + }; + case TWC_CURRENT_VERSION:{ + LOG( "CUr Version"); + m_sSystemStatus.SLAVE_STATUS.KRNL_WM = WM_INIT; // At least it Works; + memcpy( &m_sSystemStatus.SLAVE_NFO, Package->m_pData + TWI_PLS_INDEX, sizeof(SOFTWARE_INFO)); + setWM( TWI_STAGE_REQUEST_MODE ); + break; + }; + case TWC_PUSH_TARGET:{ + LOG( "Target"); + if( m_pTracker ) { + targetRecord *tTARGET = (targetRecord * ) ( Package->m_pData + TWI_PLS_INDEX ); + //All Targets Came From Slave + m_pTracker->validateTarget( tTARGET, false ); + }; + break; }; }; - m_mLastTypeProtector.lock(); - m_bLastPackageType = cCMD; - m_mLastTypeProtector.unlock(); return true; }; + void LRF_TwinConnector::m_fThreadProc( void ){ int ClientSocket = -1; struct sockaddr ClientAddress; @@ -414,6 +494,7 @@ void LRF_TwinConnector::waitDrawThreadEnd( bool forced ){ cMilliseconds = getMilliseconds(); + /* // TH Saving procedure if( cDrawTO == 0 ) { cDrawTO = cMilliseconds; @@ -435,28 +516,25 @@ void LRF_TwinConnector::waitDrawThreadEnd( bool forced ){ LOG_ERROR("Image Draw Thread Creation Failed."); m_mDrawProtector.unlock(); }; - } -#ifdef DEBUG - else { - LOG("Mutex NOT Grabed"); - } -#endif - ; + }; }; + */ + // Port exists - SLAVE is connected - if( m_pPort != NULL ){ + if( m_oDataTransport != NULL ){ // Check if still connected - if( m_pPort->getConnectionStatus() == CS_DISCONNECTED ){ + if( m_oDataTransport->getConnectionStatus() == CS_DISCONNECTED ){ // Handle Disconnection - m_bWorkingMode = TWI_STAGE_WAITING_CONNECTION; - delete( m_pPort ); - m_pPort = NULL; + LOG("HANDLE DISCONNECT!"); + setWM( TWI_STAGE_WAITING_CONNECTION ); + delete( (serverPort *) m_oDataTransport ); + m_oDataTransport = NULL; //Reset Flags cStatusTO = 0; continue; }; - SLEEP( TWI_SLOW_LOOP_SLEEP ); } else { + serverPort *tPort = NULL; // (re)Establish Connection ClientAddressSize = (socklen_t) sizeof( struct sockaddr_in ); ClientSocket = accept ( m_nMainSocket, &ClientAddress, &ClientAddressSize ); @@ -492,26 +570,134 @@ void LRF_TwinConnector::waitDrawThreadEnd( bool forced ){ char tstr[CQUERY]; inet_ntop( AF_INET, &(((struct sockaddr_in*) &(ClientAddress ))->sin_addr ), tstr, CQUERY ); LOG( "SLAVE LRF Connection Accepted" ); - m_pPort = new serverPort( ClientSocket ); + tPort = new serverPort( ClientSocket ); }; - if( m_pPort!= NULL ){ - setTransport( m_pPort ); - // Reset Stage - m_bWorkingMode = TWI_STAGE_CONNECTED; + if( tPort != NULL ){ + if ( tPort->create() ) { + setTransport(tPort); + // Reset Stage + LOG("State->Connected"); + setWM( TWI_STAGE_CONNECTED ); + } else { + LOG_ERROR("Failure Create Server Connection!"); + delete( tPort ); + }; }; }; + + switch ( getWM() ) { + case TWI_STAGE_DISCONNECTING:{ + delete( (serverPort *) m_oDataTransport ); + m_oDataTransport = NULL; + setWM( TWI_STAGE_WAITING_CONNECTION ); + //Reset Flags + cStatusTO = 0; + break; + }; + case TWI_STAGE_CONNECTED:{ + if( sendPlainCMD( TWC_GET_VERSION ) ){ + setCMD( TWC_GET_VERSION ); + setWM( TWI_STAGE_RESPONCE_WAITING ); + }; + break; + }; + case TWI_STAGE_REQUEST_MODE:{ + if ( sendPlainCMD( TWC_GET_MODE ) ) { + setCMD( TWC_GET_MODE ); + setWM( TWI_STAGE_RESPONCE_WAITING ); + }; + break; + }; + case TWI_STAGE_SET_COMMAND_MODE:{ + if ( sendPlainCMD( TWC_SET_CMD_MODE ) ) { + setCMD( TWC_SET_CMD_MODE ); + setWM( TWI_STAGE_RESPONCE_WAITING ); + }; + break; + }; + case TWI_STAGE_REQUEST_STATUS:{ + if( sendPlainCMD( TWC_GET_STATUS ) ){ + setWM( TWI_STAGE_RESPONCE_WAITING ); + }; + break; + }; + case TWI_STAGE_TIME_SYNC_MODE:{ + if ( sendPlainCMD( TWC_INIT_TSINC ) ) { + setWM( TWI_STAGE_RESPONCE_WAITING ); + }; + break; + }; + case TWI_STAGE_RETRY_CMD:{ + if( getCMD() ){ + m_bCMDTO = 10; + if( sendPlainCMD(getCMD()) ){ + setWM( TWI_STAGE_RESPONCE_WAITING ); + }; + } else setWM( TWI_STAGE_REQUEST_MODE ); + break; + }; + case TWI_STAGE_RESPONCE_WAITING:{ + if ( m_bCMDTO ) { + m_bCMDTO--; + SLEEP(TWI_SLOW_LOOP_SLEEP); + } else setWM( TWI_STAGE_RETRY_CMD ); + break; + }; + }; }; }; + bool LRF_TwinConnector::attachTargetTracker( LRF_TargetTracker *ptr ){ if(ptr == NULL) return false; m_pTracker = ptr; return false; }; + bool LRF_TwinConnector::updateSettings( void ){ return true; }; #endif //!PRU_SLAVE +TWI_CMD_CONTAINER *LRF_TwinConnector::fetchCMD(){ + TWI_CMD_CONTAINER *retVal = NULL; + m_mQUEUEProtector.lock(); + if( m_qCMD.size() ) { + retVal = m_qCMD.front(); + m_qCMD.pop(); + }; + m_mQUEUEProtector.unlock(); + return retVal; +}; + +void LRF_TwinConnector::pushCMD( TWI_CMD_CONTAINER *ptr ){ + if ( ptr ) { + m_mQUEUEProtector.lock(); + m_qCMD.push(ptr); + m_mQUEUEProtector.unlock(); + }; +}; + +void LRF_TwinConnector::pushCMD( TWIN_COMMAND CMD, void *ptr, size_t DataSize ){ + TWI_CMD_CONTAINER *tVal = (TWI_CMD_CONTAINER *) malloc(sizeof(TWI_CMD_CONTAINER)); + if (tVal) { + tVal->CMD = CMD; + tVal->DATA = ptr; + tVal->SIZE = DataSize; + m_mQUEUEProtector.lock(); + m_qCMD.push(tVal); + m_mQUEUEProtector.unlock(); + }; +}; + +#ifdef PRU_SLAVE + bool LRF_TwinConnector::validateTarget( targetRecord *ptr ){ + if( ptr == NULL ) return false; + pushCMD( TWC_PUSH_TARGET, ptr, sizeof( targetRecord ) ); + return true; + }; +#endif + + bool LRF_TwinConnector::cleanTHData( uint8_t kid ){ char tBuffer[1024]; FILE *FID = NULL; @@ -573,7 +759,104 @@ bool LRF_TwinConnector::saveTHData( uint8_t kid, thresholdNode *ptr ){ return true; }; -#ifdef TWI_TH_USE_PICTURES + +void *LRF_TwinConnector::m_fDrawThreadEntryPoint( void *ptr ){ + LRF_TwinConnector *Me; + if( ptr == NULL ) return NULL; + Me = (LRF_TwinConnector*) ptr; +#ifdef DEBUG + SLOG("TH Thread OK"); +#endif + if( Me->m_bDrawThreadStatus == TH_ARMED ) { +#ifdef DEBUG + SLOG("TH Image Thread ARMED!"); +#endif + Me->m_bDrawThreadStatus = TH_WORKING; + if( Me!= NULL ) { + // Store Local TH Draws + thresholdNode *tMem; + //uint32_t tSize; +#ifdef DEBUG + SLOG("Kernel is Defined!"); +#endif + for( uint8_t i=0; i<16; i++ ) { + // just in case if we must end work + if( Me->m_bDrawThreadStatus != TH_WORKING ) break; + //tMem = Me->getTreshold( tSize, i ); + tMem = Me->m_pCurrentTH; + if( tMem!= NULL ) { + char tBuffer[256]; +#ifdef TH_USE_PICTURES + sprintf( tBuffer, "data/th_data_%d.png", i ); + #ifdef DEBUG + SLOG("SAVE TH Image ..."); + SLOG( tBuffer ); + #endif + if( !Me->saveTHPicture( tMem, tBuffer, false )){ + SLOG_ERROR("TH PNG save failure!"); + } + #ifdef PRU_SLAVE + else { + //Me->m_mStatusProtector.lock(); + //Me->m_nStatus |= ( 1 << i ) << 16; + //Me->m_mStatusProtector.unlock(); + } + #endif + ; + #ifdef DEBUG + SLOG("SAVE TH Image DONE!"); + #endif + SLEEP(10); +#else //TH_USE_PICTURES + sprintf( tBuffer, "data/th_data_%d.raw", i ); + #ifdef DEBUG + SLOG("SAVE TH Data ..."); + SLOG( tBuffer ); + #endif + FILE *fd; + fd = fopen( tBuffer, "wb+"); + if( fd != NULL ){ + uint32_t Size = TH_SIZE_NODES; + fwrite( &Size, sizeof( uint32_t ), 1, fd ); + fwrite( tMem, sizeof( thresholdNode ), Size, fd ); + fclose( fd ); + #ifdef PRU_SLAVE + //Me->m_mStatusProtector.lock(); + //Me->m_nStatus |= ( 1 << i ) << 16; + //Me->m_mStatusProtector.unlock(); + #endif + } else { + SLOG_ERROR("TH RAW save failure!"); + }; + #ifdef DEBUG + SLOG("SAVE TH Data DONE!"); + #endif +#endif //TWI_TH_USE_PICTURES + }; + }; + }; + }; + Me->m_bDrawThreadStatus = TH_EXIT; + Me->m_mDrawProtector.unlock(); + pthread_exit( NULL ); + return NULL; +}; + +void LRF_TwinConnector::waitDrawThreadEnd( bool forced ){ + if( m_bDrawThreadStatus > TH_WORKING || m_bDrawThreadStatus < TH_ARMED ) return; + if( forced ) m_bDrawThreadStatus = TH_ENDED; + while( m_bDrawThreadStatus != TH_EXIT ) SLEEP(DEFAULT_THREAD_SLEEP_TIME); + pthread_join( m_sDrawThreadHandler, NULL ); +}; + +#ifdef TH_USE_PICTURES + #define STB_IMAGE_IMPLEMENTATION + #include "../../data/stbi/stb_image.h" + #define STB_IMAGE_WRITE_IMPLEMENTATION + #include "../../data/stbi/stb_image_write.h" + #undef STB_IMAGE_WRITE_IMPLEMENTATION + #undef STB_IMAGE_IMPLEMENTATION + bool LRF_TwinConnector::saveTHPicture( thresholdNode *ptr, CSTR fileName, bool monochrome, bool agressive ){ uint8_t *tMemory = NULL; thresholdNode *cNode = NULL; @@ -665,9 +948,9 @@ bool LRF_TwinConnector::saveTHPicture( thresholdNode *ptr, CSTR fileName, bool m }; #endif //TWI_TH_USE_PICTURES - #undef SLOG #undef SLOG_ERROR + #undef LOG #undef LOG_ERROR diff --git a/lib/App/3dSERVER/LRF_TwinConnector.h b/lib/App/3dSERVER/LRF_TwinConnector.h index 8457c360..d381175b 100644 --- a/lib/App/3dSERVER/LRF_TwinConnector.h +++ b/lib/App/3dSERVER/LRF_TwinConnector.h @@ -1,6 +1,7 @@ #ifndef __LRF_TWINCONNECTOR_H_INCL__ #define __LRF_TWINCONNECTOR_H_INCL__ +#include "../../alg/lgs/detectorStructures.h" #include "../../data/protocol/protocolInternalLRF3D.h" #ifdef PRU_SLAVE @@ -9,7 +10,7 @@ #include "../../data/net/serverPort.h" #endif -#define TWI_TH_USE_PICTURES +#define TH_USE_PICTURES #define TWI_QUICK_LOOP_SLEEP 15 #define TWI_SLOW_LOOP_SLEEP 100 @@ -21,69 +22,113 @@ #define STORAGE_DIR_MODE 0x1FF #define STORAGE_FILE_MODE 0x1B6 -typedef struct S_SW_VERSION{ - CSTR MASTER; - CSTR SLAVE; -} SW_VERSION; - typedef enum E_TWI_WM{ TWI_STAGE_BEFORE_BIND = 0, TWI_STAGE_WAITING_CONNECTION = 1, TWI_STAGE_CONNECTED = 2, - TWI_STAGE_INIT_1, - TWI_STAGE_INIT_2, - TWI_STAGE_INIT_3, - TWI_STAGE_MAIN_LOOP -}TWI_WM; + TWI_STAGE_DISCONNECTING, + TWI_STAGE_REQUEST_MODE, + TWI_STAGE_REQUEST_STATUS, + TWI_STAGE_TIME_SYNC_MODE, + TWI_STAGE_TIME_SYNC_STAGE1, + TWI_STAGE_TIME_SYNC_STAGE2, + + TWI_STAGE_TH_TRANSFER, + TWI_STAGE_SHADOW_TRANSFER, + TWI_STAGE_UPGRADE_TRANSFER, + TWI_STAGE_SET_COMMAND_MODE, + TWI_STAGE_COMMAND_MODE, + TWI_STAGE_SET_EVENT_MODE, + TWI_STAGE_EVENT_MODE, + TWI_STAGE_RETRY_CMD, + TWI_STAGE_RESPONCE_WAITING +} TWI_WM; + + +typedef struct S_TWI_PEER_STATUS{ + LRF_WORK_MODE KRNL_WM; + uint8_t ENABLED; + uint8_t DETECTION; + uint8_t TH_READY; +} TWI_PEER_STATUS; + +typedef struct S_TWIN_STATUS{ + TWI_PEER_STATUS MASTER_STATUS; + SOFTWARE_INFO MASTER_NFO; + LGS_3D_PARAMETERS MASTER_PARAMS; + TWI_PEER_STATUS SLAVE_STATUS; + SOFTWARE_INFO SLAVE_NFO; + LGS_3D_PARAMETERS SLAVE_PARAMS; + bool SETTINGS_IS_SYNCED; + bool SHADOW_IS_SYNCED; +}TWIN_STATUS; class LRF_Kernel; -class LRF_TargetTracker; + #ifdef PRU_SLAVE class LRF_TwinConnector: public basicThread, protocolInternalLRF3D_SLAVE { #else + class LRF_TargetTracker; + class LRF_TwinConnector: public basicThread, protocolInternalLRF3D_MASTER { #endif private: basicLogCollection * m_pLog; config_setting_t * m_pSettings; - - TWIN_COMMAND m_bCCMD; - basicMutex CMD_PROTEC; LRF_Kernel * m_pEngine; - uint8_t m_bWorkingMode; - uint32_t m_nStatus; - basicMutex m_mStatusProtector; + TWIN_COMMAND m_eCCMD; + TWI_WM m_eWM; + + + + void setWM( TWI_WM NWM ); + TWI_WM getWM(); + TWI_CMD_QUEUE m_qCMD; + void setCMD( TWIN_COMMAND NCMD ); + uint8_t m_bCMDTO; + TWIN_COMMAND getCMD(); + TWI_CMD_CONTAINER * fetchCMD(); + void pushCMD( TWI_CMD_CONTAINER *ptr ); + void pushCMD( TWIN_COMMAND CMD, void *ptr = NULL, size_t DataSize = 0 ); + + basicMutex m_mStatusProtector; + basicMutex m_mWMProtector; + basicMutex m_mQUEUEProtector; + basicMutex m_mCMDProtector; + //TH FLIP-DROW STUFF bool m_bDrawByRAW; bool m_bDrawMonochrome; basicMutex m_mDrawProtector; + thresholdNode * m_pCurrentTH; + void waitDrawThreadEnd( bool forced = false ); pthread_t m_sDrawThreadHandler; thredStatus m_bDrawThreadStatus; static void * m_fDrawThreadEntryPoint(void *); - void waitDrawThreadEnd( bool forced = false ); +#ifdef TH_USE_PICTURES + bool saveTHPicture( thresholdNode *ptr, CSTR fileName, bool monochrome = false, bool agressive = false ); +#endif + bool cleanTHData( uint8_t kid ); + bool loadTHData( uint8_t kid, thresholdNode *ptr ); + bool saveTHData( uint8_t kid, thresholdNode *ptr ); #ifdef PRU_SLAVE - clientPort * m_pPort; - TWIN_COMMAND_QUEUE m_qCMD; uint16_t m_nMasterPort; - CSTR m_pMasterAddress; + char m_cMasterAddress[16]; + TWI_PEER_STATUS m_sSystemStatus; #else - serverPort * m_pPort; int m_nMainSocket; LRF_TargetTracker * m_pTracker; uint16_t m_nBindPort; - CSTR m_pBindAddress; - // Handshaking flags - bool m_bSettingsIsLoadded; - bool m_bVersionIsLoadded; - bool m_bShadowIsLoadded; -#endif -#ifdef TWI_TH_USE_PICTURES - bool saveTHPicture( thresholdNode *ptr, CSTR fileName, bool monochrome = false, bool agressive = false ); + char m_cBindAddress[16]; + TWIN_STATUS m_sSystemStatus; + void cleanupInfo(void); #endif + + protected: void m_fThreadProc( void ); // Connection/THDraw Handling Thread virtual bool packetHandler( protocolPackage *Package ); @@ -92,16 +137,17 @@ class LRF_TargetTracker; virtual ~LRF_TwinConnector(); bool create(); void setKernel( LRF_Kernel *ptr ){ m_pEngine = ptr; }; - bool cleanTHData( uint8_t kid ); - bool loadTHData( uint8_t kid, thresholdNode *ptr ); - bool saveTHData( uint8_t kid, thresholdNode *ptr ); + bool readyToConsumeTH( void ); + bool consumeTH( uint8_t kID, thresholdNode *ptr, uint32_t THsize ); #ifdef PRU_SLAVE bool sendCurrentSettings( void ); bool sendSoftwareVersion( void ); bool sendEvent(); + bool validateTarget( targetRecord *ptr ); #else bool attachTargetTracker( LRF_TargetTracker *ptr ); bool updateSettings( void ); + TWIN_STATUS *getSystemStatus(){ return &m_sSystemStatus; }; #endif }; diff --git a/lib/components/base/basicTransport.cpp b/lib/components/base/basicTransport.cpp index 2ec9fe9f..7aa5a78b 100644 --- a/lib/components/base/basicTransport.cpp +++ b/lib/components/base/basicTransport.cpp @@ -7,7 +7,7 @@ basicTransport::basicTransport() :m_mQueueProtectorMutex(), m_mBufferProtectorMutex(){ m_pLog = basicLogCollection::getInstance(); m_eConnectionStatus = CS_UNKNOWN; - LOG("C-Done"); + //LOG("C-Done"); //m_bConnected = false; }; diff --git a/lib/data/net/clientPort.cpp b/lib/data/net/clientPort.cpp index 8d1b24cc..2fdf671e 100644 --- a/lib/data/net/clientPort.cpp +++ b/lib/data/net/clientPort.cpp @@ -5,16 +5,15 @@ clientPort::clientPort():transportSocket(){ m_pLog = basicLogCollection::getInstance(); - m_nPort = 80; - m_sHostName = NULL; + m_nPort = 0; + memset( m_cHostName, 0, MAX_HOST_STRING_SIZE ); + //m_sHostName = NULL; m_bKeepAlive = true; }; clientPort::clientPort(CSTR URI):transportSocket(){ m_pLog = basicLogCollection::getInstance(); m_bKeepAlive = true; - m_sHostName = NULL; - m_nPort = 80; if( URI!= NULL ) { char *ptChop = NULL; char *ptSt = NULL; @@ -25,37 +24,68 @@ clientPort::clientPort(CSTR URI):transportSocket(){ ptSt = ptChop + 1; ptChop = strstr(ptChop + 1, "/"); tSize = ptChop - ptSt; - //m_sHostName = (char *)malloc(tSize); - //strncpy(m_sHostName, ptSt, tSize); - //m_sHostName[tSize] = (char)0; ptSt[tSize] = (char)0; - if( connectTo(ptSt, m_nPort) ){ - char MsgBuffer[64]; - sprintf(MsgBuffer, "Connect %s [%d] OK", m_sHostName, m_nPort); - LOG(MsgBuffer); - } else { - LOG_ERROR("Cannot Connect!"); - }; + strncpy( m_cHostName, ptSt, MAX_HOST_STRING_SIZE ); + m_nPort = 80;//?? + //if( connectTo(ptSt, m_nPort) ){ + // char MsgBuffer[64]; + // sprintf(MsgBuffer, "Connect %s [%d] OK", m_sHostName, m_nPort); + // LOG(MsgBuffer); + //} else { + // LOG_ERROR("Cannot Connect!"); + //}; }; + } else { + memset( m_cHostName, 0, 128 ); + m_nPort = 0; }; }; + clientPort::clientPort(CSTR Host, int Port, bool KeepALive ) :transportSocket(){ m_pLog = basicLogCollection::getInstance(); m_bKeepAlive = KeepALive; - m_sHostName = NULL; - if( connectTo( Host, Port ) ) { - char MsgBuffer[64]; - sprintf(MsgBuffer, "Connect %s [%d] OK", m_sHostName, m_nPort ); - LOG(MsgBuffer); + if( strlen(Host) ){ + strncpy( m_cHostName, Host, MAX_HOST_STRING_SIZE ); + m_nPort = Port; } else { - LOG_ERROR("Cannot Connect!"); + memset( m_cHostName, 0, MAX_HOST_STRING_SIZE ); + m_nPort = 0; }; + //if( connectTo( Host, Port ) ) { + // char MsgBuffer[64]; + // sprintf(MsgBuffer, "Connect %s [%d] OK", m_sHostName, m_nPort ); + // LOG(MsgBuffer); + //} else { + // LOG_ERROR("Cannot Connect!"); + //}; }; clientPort::~clientPort(){ - if (m_sHostName)free(m_sHostName); + //if (m_sHostName)free(m_sHostName); }; +bool clientPort::create(){ + + if ( strlen( m_cHostName) == 0 ) { + LOG_ERROR("Host to connect is not Set!"); + return false; + }; + if( m_nPort == 0 ) { + LOG_ERROR("Port to connect is not Set!"); + return false; + }; + if( connectTo( m_cHostName, m_nPort ) ){ +#ifdef DEBUG + char tB[256]; + sprintf(tB, "Connect %s [%d] OK", m_cHostName, m_nPort); + LOG(tB); +#endif + return transportSocket::create(); + } else { + LOG_ERROR("Cannot Connect!"); + }; + return false; +}; bool clientPort::_connect(void){ int iResult; @@ -69,9 +99,9 @@ bool clientPort::_connect(void){ LOG_ERROR("ERROR creating socket"); return false; }; - server = gethostbyname( m_sHostName ); + server = gethostbyname( m_cHostName ); if( server == NULL ){ - sprintf( cBuffer, "ERROR, no such host [%s]", m_sHostName ); + sprintf( cBuffer, "ERROR, no such host [%s]", m_cHostName ); LOG_ERROR(cBuffer); return false; }; @@ -80,7 +110,7 @@ bool clientPort::_connect(void){ bcopy((char *)server->h_addr, (char *)&serv_addr.sin_addr.s_addr, server->h_length ); serv_addr.sin_port = htons( m_nPort ); if ( connect(m_nSocketFD,(struct sockaddr *)&serv_addr,sizeof(serv_addr)) < 0){ - sprintf(cBuffer,"ERROR connect to [%s:%d]", m_sHostName, m_nPort ); + sprintf(cBuffer,"ERROR connect to [%s:%d]", m_cHostName, m_nPort ); LOG_ERROR( cBuffer ); return false; }; @@ -99,9 +129,9 @@ bool clientPort::_connect(void){ hints.ai_protocol = IPPROTO_TCP; // Resolve the server address and port sprintf( cBuffer, "%d", m_nPort ); - iResult = getaddrinfo( m_sHostName, cBuffer, &hints, &result ); + iResult = getaddrinfo( m_cHostName, cBuffer, &hints, &result ); if (iResult != 0) { - sprintf(cBuffer, "getaddrinfo for [%s:%d] failed with error: %d", m_sHostName, m_nPort, iResult); + sprintf(cBuffer, "getaddrinfo for [%s:%d] failed with error: %d", m_cHostName, m_nPort, iResult); LOG_ERROR(cBuffer); WSACleanup(); return false; @@ -132,13 +162,13 @@ bool clientPort::_connect(void){ }; freeaddrinfo(result); if (m_nSocketFD == INVALID_SOCKET) { - sprintf( cBuffer, "Unable Connect to the Server[%s:%d]!", m_sHostName, m_nPort ); + sprintf( cBuffer, "Unable Connect to the Server[%s:%d]!", m_cHostName, m_nPort ); LOG_ERROR(cBuffer); WSACleanup(); return false; }; #endif - + /* setConnectionStatus(CS_CONNECTED); #ifdef DEBUG LOG("In case THREADS are running -> SHUTTING DOWN THREADS"); @@ -150,13 +180,14 @@ bool clientPort::_connect(void){ return init(); } else { LOG_ERROR("CAN NOT SHUTDOWN IO THREADS!"); - }; - return false; + }; + */ + return true;//false; }; bool clientPort::connectTo(CSTR Host, int Port){ if( m_eConnectionStatus == CS_CONNECTED ){ - setConnectionStatus(CS_DISCONNECTED); + setConnectionStatus( CS_DISCONNECTED ); #ifdef __linux__ shutdown( m_nSocketFD, SHUT_RDWR ); close( m_nSocketFD ); @@ -167,17 +198,17 @@ bool clientPort::connectTo(CSTR Host, int Port){ m_nSocketFD = INVALID_SOCKET; #endif }; - if( m_sHostName == NULL ) m_sHostName = (CSTR) malloc( strlen( Host ) +1 ); - if( m_sHostName != Host ) sprintf( m_sHostName, "%s", Host );// Prevent Self Copy + //if( m_sHostName == NULL ) m_sHostName = (CSTR) malloc( strlen( Host ) +1 ); + if( m_cHostName != Host ) strncpy( m_cHostName, Host, MAX_HOST_STRING_SIZE );//sprintf( m_sHostName, "%s", Host );// Prevent Self Copy m_nPort = Port; return _connect(); }; int clientPort::sendBlock(unsigned char *Data, int DataSize){ if( m_eConnectionStatus != CS_CONNECTED ){ - if( connectTo( m_sHostName, m_nPort ) ){ + if( connectTo( m_cHostName, m_nPort ) ){ char MsgBuffer[CLOG]; - sprintf(MsgBuffer, "Reconnect %s [%d] OK", m_sHostName, m_nPort); + sprintf(MsgBuffer, "Reconnect %s [%d] OK", m_cHostName, m_nPort); LOG(MsgBuffer); }; }; @@ -200,12 +231,12 @@ int clientPort::sendBlock(unsigned char *Data, int DataSize){ return -1; }; if( RetVal < 0 ) RetVal = 0; -#ifdef DEBUG - // { - // char cBuffer[128]; - // sprintf(cBuffer,"Bytes Sent: %ld", RetVal); - // LOG(cBuffer); - // } +#ifdef DEBUG_EXTRA + { + char cBuffer[128]; + sprintf(cBuffer,"Bytes Sent: %ld", RetVal); + LOG(cBuffer); + } #endif } else { //LOG_ERROR("Not Connected!"); diff --git a/lib/data/net/clientPort.h b/lib/data/net/clientPort.h index 0555db7a..496c5876 100644 --- a/lib/data/net/clientPort.h +++ b/lib/data/net/clientPort.h @@ -22,6 +22,8 @@ #include "../transport/transportSocket.h" +#define MAX_HOST_STRING_SIZE 128 + /** * TODO: Add class description * @@ -30,7 +32,7 @@ class clientPort : public transportSocket { private: basicLogCollection *m_pLog; - CSTR m_sHostName; + char m_cHostName[MAX_HOST_STRING_SIZE]; #ifdef __linux__ int m_nSocketFD; #else @@ -50,6 +52,7 @@ public: // Destructor virtual ~clientPort(); + virtual bool create(); bool disconnect(void); bool connectTo(CSTR Host, int Port); bool reconnect(void){ diff --git a/lib/data/protocol/protocolInternalLRF3D.cpp b/lib/data/protocol/protocolInternalLRF3D.cpp index 778e2bc5..92adcd70 100644 --- a/lib/data/protocol/protocolInternalLRF3D.cpp +++ b/lib/data/protocol/protocolInternalLRF3D.cpp @@ -122,6 +122,24 @@ protocolPackage *protocolInternalLRF3D::packetExtractor( U8 *Buffer, size_t Buff return NULL; }; +bool protocolInternalLRF3D::sendACK( TWIN_COMMAND ACK_CMD ){ + uint8_t Package[10]; + if( m_oDataTransport == NULL ) return false; + Package[TWI_CMD_INDEX] = TWC_ACK_CMD; + Package[TWI_CMD_INDEX+1] = ACK_CMD; + return m_oDataTransport->sendData( Package, FinishUpPackage( Package, TWI_CMD_INDEX+2 ) ); +}; + +bool protocolInternalLRF3D::sendPlainCMD( TWIN_COMMAND CMD ){ + uint8_t Package[10]; +#ifdef DEBUG + LOG("Plain CMD <->"); +#endif + if( m_oDataTransport == NULL ) return false; + Package[TWI_CMD_INDEX] = CMD; + return m_oDataTransport->sendData( Package, FinishUpPackage( Package, TWI_CMD_INDEX+1 ) ); +}; + //uint32_t protocolInternalLRF3D::getStatus(){ // uint32_t RetVal; // m_mStatusProtector.lock(); @@ -161,12 +179,12 @@ protocolPackage *protocolInternalLRF3D::packetExtractor( U8 *Buffer, size_t Buff if( data == NULL ) return false; uint8_t Buffer[PROTOCOL_PARSER_BUFFER_SIZE]; uint32_t node_index = dataIdx; - uint32_t index = 8; - Buffer[3] = TWC_TH_DATA; - Buffer[4] = ( node_index >> 24 ) & 0xFF; - Buffer[5] = ( node_index >> 16 ) & 0xFF; - Buffer[6] = ( node_index >> 8 ) & 0xFF; - Buffer[7] = ( node_index & 0xFF ); + uint32_t index = TWI_PLS_INDEX + 4; + Buffer[TWI_CMD_INDEX] = TWC_TH_DATA; + Buffer[TWI_PLS_INDEX] = ( node_index >> 24 ) & 0xFF; + Buffer[TWI_PLS_INDEX+1] = ( node_index >> 16 ) & 0xFF; + Buffer[TWI_PLS_INDEX+2] = ( node_index >> 8 ) & 0xFF; + Buffer[TWI_PLS_INDEX+3] = ( node_index & 0xFF ); while ( ( index < ( TWI_MAX_PACKAGE_SIZE_BYTES - 5 ) ) && ( node_index < TH_SIZE_NODES ) ){ Buffer[index++] = (data[ node_index ].data >> 24 ) & 0xFF;//0xFE; // to clear Sunbit data Buffer[index++] = (data[ node_index ].data >> 16 ) & 0xFF; @@ -179,6 +197,16 @@ protocolPackage *protocolInternalLRF3D::packetExtractor( U8 *Buffer, size_t Buff #endif return m_oDataTransport->sendData( Buffer, FinishUpPackage( Buffer, index ) ); }; + + bool protocolInternalLRF3D_SLAVE::pushTarget( targetRecord *ptr ){ + if( ptr == NULL ) return false; + uint8_t Buffer[32]; + Buffer[TWI_CMD_INDEX] = TWC_PUSH_TARGET; + for( uint8_t idx = 0; idx < sizeof(targetRecord); idx++ ) { + Buffer[TWI_PLS_INDEX+idx] = ((uint8_t *)ptr)[idx]; + }; + return m_oDataTransport->sendData(Buffer, FinishUpPackage(Buffer, TWI_PLS_INDEX+sizeof(targetRecord))); + }; /* bool protocolInternalLRF3D_SLAVE::sendTargets( void ){ uint8_t Buffer[PROTOCOL_PARSER_BUFFER_SIZE]; @@ -228,16 +256,40 @@ protocolPackage *protocolInternalLRF3D::packetExtractor( U8 *Buffer, size_t Buff bool protocolInternalLRF3D_SLAVE::sendStatus( uint32_t m_nStatus ){ if( m_oDataTransport == NULL ) return false; uint8_t Buffer[16]; - Buffer[3] = TWC_ACK_STATUS; + Buffer[TWI_CMD_INDEX] = TWC_CURRENT_STATUS; Buffer[4] = ( m_nStatus >> 24 ) & 0xFF; Buffer[5] = ( m_nStatus >> 16 ) & 0xFF; Buffer[6] = ( m_nStatus >> 8 ) & 0xFF; Buffer[7] = ( m_nStatus & 0xFF ); #ifdef DEBUG - LOG("Status ACK"); + LOG("Status->"); #endif return m_oDataTransport->sendData( Buffer, FinishUpPackage( Buffer, 8 ) ); }; + bool protocolInternalLRF3D_SLAVE::sendMode( uint8_t mode ){ + if( m_oDataTransport == NULL ) return false; + uint8_t Buffer[16]; + Buffer[TWI_CMD_INDEX] = TWC_CURRENT_MODE; + Buffer[TWI_PLS_INDEX] = mode; +#ifdef DEBUG + LOG("Mode->"); +#endif + return m_oDataTransport->sendData( Buffer, FinishUpPackage( Buffer, TWI_PLS_INDEX+1 ) ); + }; + + bool protocolInternalLRF3D_SLAVE::sendVersion( SOFTWARE_INFO *sv ){ + uint8_t Buffer[1024]; + if( sv ){ + Buffer[TWI_CMD_INDEX] = TWC_CURRENT_VERSION; + for( int i=0; i < sizeof(SOFTWARE_INFO); i++ ){ + Buffer[TWI_PLS_INDEX + i] = ((uint8_t *)sv)[i]; + }; +#ifdef DEBUG + LOG("Software Version->"); +#endif + return m_oDataTransport->sendData( Buffer, FinishUpPackage( Buffer, TWI_PLS_INDEX + sizeof(SOFTWARE_INFO) ) ); + }; + }; #else // PRU_SLAVE #define LOG( X ) m_pLog->Log( "protocolLRF3D_MASTER", this, X ) @@ -254,103 +306,52 @@ protocolPackage *protocolInternalLRF3D::packetExtractor( U8 *Buffer, size_t Buff m_pLog = basicLogCollection::getInstance(); }; - protocolInternalLRF3D_MASTER::~protocolInternalLRF3D_MASTER(){}; + protocolInternalLRF3D_MASTER::~protocolInternalLRF3D_MASTER(){ + + }; bool protocolInternalLRF3D_MASTER::create( void ){ return protocolInternalLRF3D::create(); }; - bool protocolInternalLRF3D_MASTER::ackDataSegment( uint32_t dataIdx ){ + bool protocolInternalLRF3D_MASTER::ackThresholdSegment( uint32_t dataIdx ){ if( m_oDataTransport == NULL ) return false; uint8_t Buffer[16]; - Buffer[3] = TWC_TH_DATA; - Buffer[4] = ( dataIdx >> 8 ) & 0xFF; - Buffer[5] = ( dataIdx & 0xFF ); + Buffer[TWI_CMD_INDEX] = TWC_ACK_CMD; + Buffer[TWI_PLS_INDEX] = TWC_TH_DATA; + Buffer[TWI_PLS_INDEX+1] = ( dataIdx >> 8 ) & 0xFF; + Buffer[TWI_PLS_INDEX+2] = ( dataIdx & 0xFF ); #ifdef DEBUG LOG("Treshold Data Seg"); #endif - return m_oDataTransport->sendData( Buffer, FinishUpPackage( Buffer, 6 ) ); - }; - - bool protocolInternalLRF3D_MASTER::ackTargets( uint32_t pkgId ){ - if( m_oDataTransport == NULL ) return false; - uint8_t Buffer[16]; - Buffer[3] = TWC_ACK_TARGETS; - Buffer[4] = ( pkgId >> 24 ) & 0xFF; - Buffer[5] = ( pkgId >> 16 ) & 0xFF; - Buffer[6] = ( pkgId >> 8 ) & 0xFF; - Buffer[7] = ( pkgId & 0xFF ); -#ifdef DEBUG - LOG("Target Ack"); -#endif - return m_oDataTransport->sendData( Buffer, FinishUpPackage( Buffer, 8 ) ); + return m_oDataTransport->sendData( Buffer, FinishUpPackage( Buffer, TWI_PLS_INDEX+3 ) ); }; - bool protocolInternalLRF3D_MASTER::requestTargets(void){ + bool protocolInternalLRF3D_MASTER::ackShadowSegment( uint32_t dataIdx ){ if( m_oDataTransport == NULL ) return false; uint8_t Buffer[16]; - Buffer[3] = TWC_GET_TARGETS; + Buffer[TWI_CMD_INDEX] = TWC_ACK_CMD; + Buffer[TWI_PLS_INDEX] = TWC_SH_DATA; + Buffer[TWI_PLS_INDEX+1] = ( dataIdx >> 8 ) & 0xFF; + Buffer[TWI_PLS_INDEX+2] = ( dataIdx & 0xFF ); #ifdef DEBUG - LOG("Target Req"); + LOG("Shadow Data Seg"); #endif - return m_oDataTransport->sendData( Buffer, FinishUpPackage( Buffer, 4 ) ); + return m_oDataTransport->sendData( Buffer, FinishUpPackage( Buffer, TWI_PLS_INDEX+3 ) ); }; - bool protocolInternalLRF3D_MASTER::requestTrasholdData( uint8_t lrf_id ){ + bool protocolInternalLRF3D_MASTER::requestThresholdData( uint8_t lrf_id ){ if( m_oDataTransport == NULL ) return false; uint8_t Buffer[16]; - Buffer[3] = TWC_GET_THDRAW; - Buffer[4] = lrf_id; + Buffer[TWI_CMD_INDEX] = TWC_GET_THRESHOLD; + Buffer[TWI_PLS_INDEX] = lrf_id; #ifdef DEBUG LOG("Treshold Req"); #endif - return m_oDataTransport->sendData( Buffer, FinishUpPackage( Buffer, 5 ) ); + return m_oDataTransport->sendData( Buffer, FinishUpPackage( Buffer, TWI_PLS_INDEX+1 ) ); }; - bool protocolInternalLRF3D_MASTER::requestStatus( void ){ - if( m_oDataTransport == NULL ) return false; - uint8_t Buffer[16]; - Buffer[3] = TWC_GET_STATUS; -#ifdef DEBUG - LOG("Status Req"); -#endif - return m_oDataTransport->sendData( Buffer, FinishUpPackage( Buffer, 4 ) ); - }; - TWIN_COMMAND protocolInternalLRF3D_MASTER::getLastPackageType( void ){ - TWIN_COMMAND RetVal; - m_mLastTypeProtector.lock(); - RetVal = m_bLastPackageType; - m_mLastTypeProtector.unlock(); - return RetVal; - }; - bool protocolInternalLRF3D_MASTER::requestSoftwareVersion( void ){ - if( m_oDataTransport == NULL ) return false; - uint8_t Buffer[16]; - Buffer[3] = TWC_GET_VERSION; -#ifdef DEBUG - LOG("Version Req"); -#endif - return m_oDataTransport->sendData( Buffer, FinishUpPackage( Buffer, 4 ) ); - }; - bool protocolInternalLRF3D_MASTER::requestCurrentSettings( void ){ - if( m_oDataTransport == NULL ) return false; - uint8_t Buffer[16]; - Buffer[3] = TWC_GET_CONFIG; -#ifdef DEBUG - LOG("Settings Req"); -#endif - return m_oDataTransport->sendData( Buffer, FinishUpPackage( Buffer, 4 ) ); - }; - bool protocolInternalLRF3D_MASTER::requestShadow( void ){ - if( m_oDataTransport == NULL ) return false; - uint8_t Buffer[16]; - Buffer[3] = TWC_GET_SHADOW; -#ifdef DEBUG - LOG("Shadow Req"); -#endif - return m_oDataTransport->sendData( Buffer, FinishUpPackage( Buffer, 4 ) ); - }; #endif #undef LOG diff --git a/lib/data/protocol/protocolInternalLRF3D.h b/lib/data/protocol/protocolInternalLRF3D.h index d1596af0..5d84de25 100644 --- a/lib/data/protocol/protocolInternalLRF3D.h +++ b/lib/data/protocol/protocolInternalLRF3D.h @@ -16,36 +16,55 @@ #endif #define TWI_TARGET_QUEUE_SIZE 128 -#define TWI_MAX_PACKAGE_SIZE_BYTES ( PROTOCOL_PARSER_BUFFER_SIZE >> 1 ) +#define TWI_CMD_INDEX 3 +#define TWI_PLS_INDEX 4 + +#define TWI_MAX_PACKAGE_SIZE_BYTES 0x8002 +#define TWI_MAX_PAYLOAD_SIZE_BYTES 0x7fff typedef enum E_TWIN_COMMAND{ TWC_NO_COMMAND = 0, - TWC_GET_STATUS = 1, - TWC_ACK_STATUS = 2, - TWC_GET_TARGETS = 3, - TWC_ACK_TARGETS = 4, - TWC_GET_CONFIG = 5, - TWC_SET_CONFIG = 6, - TWC_ACK_CONFIG = 7, - TWC_GET_THDRAW = 8, - TWC_SET_THDRAW = 9, - TWC_PUSH_TARGET = 10, - TWC_TH_DATA = 11, - TWC_TARGETS_DATA = 12, - TWC_GET_VERSION = 13, - TWC_ACK_VERSION = 14, - TWC_GET_SHADOW = 15, - TWC_ACK_SHADOW = 16, - TWC_SET_SHADOW = 17, - TWC_DO_REBOOT = 255 + TWC_SET_CMD_MODE = 1, + TWC_SET_EVT_MODE, + + TWC_ACK_CMD, + + TWC_GET_MODE, + TWC_CURRENT_MODE, + + TWC_GET_STATUS, + TWC_CURRENT_STATUS, + + TWC_GET_CONFIG, + TWC_CURRENT_CONFIG, + TWC_SET_CONFIG, + + TWC_GET_VERSION, + TWC_CURRENT_VERSION, + + TWC_GET_SHADOW, + TWC_CURRENT_SHADOW, + TWC_SET_SHADOW, + TWC_SH_DATA, + + TWC_GET_THRESHOLD, + TWC_TH_DATA, + + TWC_INIT_TSINC, + TWC_TSINC_1, + TWC_TSINC_2, + + TWC_PUSH_TARGET, + TWC_DO_REBOOT } TWIN_COMMAND; -typedef struct S_TWIN_CMD_RECORD{ - TWIN_COMMAND CMD; - void * PTR; -} TWIN_CMD_REC; +typedef struct S_TWI_CMD_CONTAINER{ + TWIN_COMMAND CMD; + size_t SIZE; + void * DATA; +}TWI_CMD_CONTAINER; -typedef std::queue TWIN_COMMAND_QUEUE; +typedef std::queue TWI_CMD_QUEUE; #define TWI_STATUS_ERROR_MASK 0x000000ff @@ -87,72 +106,71 @@ typedef std::queue TWIN_COMMAND_QUEUE; #define TWI_STATUS_KERNEL_30_RDY 0x40000000 #define TWI_STATUS_KERNEL_31_RDY 0x80000000 + + class protocolInternalLRF3D: public protocolParser { private: - basicLogCollection *m_pLog; + basicLogCollection * m_pLog; protected: - int packetChecker( U8 *Buffer, size_t BufferSize ); - protocolPackage *packetExtractor( U8 *Buffer, size_t BufferSize ); - inline int FinishUpPackage( U8 *Buffer, size_t Size ){ - Buffer[0] = 0xAA; - Buffer[1] = ((Size - 3) >> 8) | SEND_TAG; - Buffer[2] = (Size - 3) & 0xFF; - Buffer[Size] = checksumLGS(Buffer, Size); - return Size + 1; - }; + int packetChecker( U8 *Buffer, size_t BufferSize ); + protocolPackage * packetExtractor( U8 *Buffer, size_t BufferSize ); + inline int FinishUpPackage( U8 *Buffer, size_t Size ){ + Buffer[0] = 0xAA; + Buffer[1] = ((Size - 3) >> 8) | SEND_TAG; + Buffer[2] = (Size - 3) & 0xFF; + Buffer[Size] = checksumLGS(Buffer, Size); + return Size + 1; + }; + bool sendACK( TWIN_COMMAND ACK_CMD ); + bool sendPlainCMD( TWIN_COMMAND ACK_CMD ); public: protocolInternalLRF3D(); - virtual ~protocolInternalLRF3D(); - virtual bool create(){ return protocolParser::create(); }; - //uint32_t getStatus(); + virtual ~protocolInternalLRF3D(); + virtual bool create(){ return protocolParser::create(); }; }; + #ifdef PRU_SLAVE class protocolInternalLRF3D_SLAVE: public protocolInternalLRF3D{ private: - basicLogCollection *m_pLog; + basicLogCollection * m_pLog; protected: - //thresholdNode *m_pThresholds[16]; // 8 - learning 8 - working - basicMutex m_mData; - bool sendTrasholdData( thresholdNode *data, uint32_t dataIdx = 0 ); - //bool sendTargets( void ); - bool sendStatus( uint32_t m_nStatus ); - virtual bool packetHandler( protocolPackage *Package ){ return true; }; + //thresholdNode * m_pThresholds[16]; // 8 - learning 8 - working + basicMutex m_mData; + virtual bool packetHandler( protocolPackage *Package ){ return true; }; public: protocolInternalLRF3D_SLAVE(); - virtual ~protocolInternalLRF3D_SLAVE(); - virtual bool create( void ); - bool resetChannel(void); - bool pushTarget( targetRecord *ptr ); + virtual ~protocolInternalLRF3D_SLAVE(); + virtual bool create( void ); + + bool ackShadowSegment( uint32_t dataIdx = 0 ); + bool resetChannel(void); + bool pushTarget( targetRecord *ptr ); + bool sendTrasholdData( thresholdNode *data, uint32_t dataIdx = 0 ); + bool sendMode( uint8_t mode ); + bool sendStatus( uint32_t m_nStatus ); + bool sendVersion( SOFTWARE_INFO *sv ); }; #else //!PRU_SLAVE class protocolInternalLRF3D_MASTER: public protocolInternalLRF3D{ private: - basicLogCollection * m_pLog; + basicLogCollection * m_pLog; protected: - virtual bool packetHandler( protocolPackage *Package ){ return true; }; - basicMutex m_mLastTypeProtector; - TWIN_COMMAND m_bLastPackageType; - //thresholdNode * m_pTrashold; - //targetRecord m_pTargets[TWI_TARGET_QUEUE_SIZE]; - //uint8_t m_nTargetCount; - //basicMutex m_mTargetProtector; + virtual bool packetHandler( protocolPackage *Package ){ return true; }; + bool synchTimeStage2(); public: protocolInternalLRF3D_MASTER(); virtual ~protocolInternalLRF3D_MASTER(); - virtual bool create(void); - bool resetChannel(void); - bool ackDataSegment( uint32_t dataIdx = 0 ); - bool ackTargets( uint32_t pkgId ); - TWIN_COMMAND getLastPackageType( void ); - bool requestCurrentSettings( void ); - bool requestShadow( void ); - bool requestSoftwareVersion(void); - bool requestStatus( void ); - bool requestTargets(void); - bool requestTrasholdData( uint8_t lrf_id ); - bool sendSoftwareUpdate( uint8_t *ptr ); - //bool setTData( targetRecord *ptr ){ m_pTargets = ptr; return m_pTargets!=NULL; }; - //bool setTHData( thresholdNode *ptr ){ m_pTrashold = ptr; return m_pTrashold!=NULL; }; + virtual bool create(void); + bool resetChannel(void); + + bool ackThresholdSegment( uint32_t dataIdx = 0 ); + bool ackShadowSegment( uint32_t dataIdx = 0 ); + + bool requestThresholdData( uint8_t lrf_id ); + + bool sendMode( uint8_t Mode ); + bool sendSoftwareUpdate( uint8_t *ptr ); + bool sendShadowData( uint8_t *ptr ); }; #endif //!PRU_SLAVE //https://www.exler.ru/blog/kak-vernut-staryy-interfeys-facebook.htm diff --git a/lib/data/protocol/protocolLGS_data.h b/lib/data/protocol/protocolLGS_data.h index b46089d5..32c62d26 100644 --- a/lib/data/protocol/protocolLGS_data.h +++ b/lib/data/protocol/protocolLGS_data.h @@ -21,6 +21,29 @@ typedef struct S_LGS_PARAMETERS{ } LGS_PARAMETERS, *PLGS_PARAMETERS; */ +#define TWIC_INFO_MASTER 0x80; +#define TWIC_INFO_SLAVE 0x40; + +#define EVT_FLAGS_NONE 0x00000000; +#define EVT_FLAGS_ERROR 0x80000000; +#define EVT_FLAGS_ANGLE 0xC0000000; +#define EVT_FLAGS_MOTOR 0xE0000000; +#define EVT_FLAGS_PRU 0xF0000000; +#define EVT_FLAGS_TARGET 0x00008000; +#define EVT_FLAGS_FLIP 0x00004000; +#define EVT_FLAGS_SCAN 0x00002000; +#define EVT_FLAGS_STUDY 0x00010000; +#define EVT_FLAGS_DETECION 0x00020000; +#define EVT_FLAGS_CNT_MASK 0x00000FFF; + +typedef struct S_PEER_QUICK_INFO{ + uint32_t uts; + uint16_t uts_ms; + uint8_t twic_info; + char peer_version[64]; + uint32_t evt_flags; +}PEER_QUICK_INFO; + typedef enum E_LGS_STAGE{ STG_DISCONNECTED = 0x00, STG_CONNECTED = 0x01, diff --git a/lib/hardware/soc/general/3DLRF.h b/lib/hardware/soc/general/3DLRF.h index 785cee76..c21c8366 100644 --- a/lib/hardware/soc/general/3DLRF.h +++ b/lib/hardware/soc/general/3DLRF.h @@ -1,6 +1,8 @@ #ifndef __3D_LRF_GENERAL_SETTINGS_HEADER__ #define __3D_LRF_GENERAL_SETTINGS_HEADER__ +#define DISABLE_FRENDLY_MESSAGES + typedef enum E_LRF_WORK_MODE{ WM_NONE = 0x00, WM_INIT = 0x01, @@ -32,7 +34,7 @@ typedef enum E_LRF_WORK_MODE{ #define TRACKER_INSTANT_TARGET #define IGNORE_ERROR_ANGLE -//#define ONPC_TOTTAL_SIMULATOR +#define ONPC_TOTTAL_SIMULATOR //#define TRACKER_FULL_COMPARE //#define SIMULATE_TARGETS //#define SIMULATE_FLIPS @@ -54,7 +56,7 @@ typedef enum E_LRF_WORK_MODE{ #define NO_SOC #define NO_PRU #undef TGD - #define PRU_SLAVE + //#define PRU_SLAVE #endif #ifdef TGD