From 11d6115748663b7306f025ffeffb42a39de9dc8d Mon Sep 17 00:00:00 2001 From: Evgeny Gagua Date: Mon, 9 May 2022 10:24:27 +0100 Subject: [PATCH] Before Sending 3D to Spain --- Projects/LRF_Server/build | 2 +- Projects/LRF_ServerSlim/build | 6 +- Projects/argus/argus.vpj | 2 - Projects/argus/build | 6 +- Projects/argus/makefile | 85 +- lib/App/3dSERVER/LRF_ClientHandler.cpp | 95 +- lib/App/3dSERVER/LRF_ClientHandler.h | 5 +- lib/App/3dSERVER/LRF_HardwareManager.cpp | 559 +++----- lib/App/3dSERVER/LRF_HardwareManager.h | 8 +- lib/App/3dSERVER/LRF_SlimKernel.cpp | 259 +++- lib/App/3dSERVER/LRF_SlimKernel.h | 29 +- lib/App/3dSERVER/LRF_TargetTracker.cpp | 76 +- lib/App/3dSERVER/LRF_TwinConnector.cpp | 778 ++++++++--- lib/App/3dSERVER/LRF_TwinConnector.h | 65 +- lib/alg/lgs/mask.cpp | 230 ++- lib/alg/lgs/mask.h | 100 +- lib/components/base/basicEngine.h | 67 +- lib/components/base/basicEvent.h | 3 +- lib/components/base/basicObject.cpp | 14 +- lib/components/base/basicObject.h | 8 +- lib/components/base/basicTransport.cpp | 3 - lib/components/base/basicTransport.h | 9 +- lib/components/base/basicTypes.h | 35 + lib/data/net/clientPort.cpp | 27 +- lib/data/net/netClientHandler.cpp | 4 +- lib/data/net/netClientHandler.h | 13 +- lib/data/net/netServer.cpp | 4 +- lib/data/net/netServer.h | 9 +- lib/data/net/netServiceEngine.h | 24 + lib/data/net/serverPort.cpp | 5 - lib/data/protocol/protocolInternalLRF3D.cpp | 189 ++- lib/data/protocol/protocolInternalLRF3D.h | 56 +- lib/data/protocol/protocolLGS3D.cpp | 40 +- lib/data/protocol/protocolLGS3D.h | 8 +- lib/data/protocol/protocolLGS3D_client.cpp | 32 +- lib/data/protocol/protocolLGS3D_client.h | 8 +- lib/data/protocol/protocolLGS3D_server.cpp | 398 +++--- lib/data/protocol/protocolLGS3D_server.h | 7 +- lib/data/protocol/protocolLGS_data.h | 82 +- lib/data/transport/transportSocket.cpp | 2 +- lib/data/transport/transportSocket.h | 5 +- lib/hardware/sensors/lrf/lrf_3d.cpp | 265 ++-- lib/hardware/sensors/lrf/lrf_3d.h | 9 +- lib/hardware/soc/general/3DLRF.h | 14 +- lib/rgoose/rgooseDBConnector.cpp | 452 +++++- lib/rgoose/rgooseDBConnector.h | 20 +- lib/rgoose/rgooseKernel.cpp | 13 +- lib/rgoose/rgooseModuleFlyHunter.cpp | 2 +- lib/rgoose/rgooseNode.cpp | 4 +- lib/rgoose/rgooseNode.h | 51 +- lib/rgoose/rgooseNode2D.cpp | 11 +- lib/rgoose/rgooseNode2D.h | 29 - lib/rgoose/rgooseNode3D.cpp | 1381 ++++++++++++++++++- lib/rgoose/rgooseNode3D.h | 96 +- lib/rgoose/rgooseTypes.h | 54 +- 55 files changed, 4340 insertions(+), 1418 deletions(-) mode change 100644 => 100755 Projects/LRF_Server/build create mode 100644 lib/data/net/netServiceEngine.h diff --git a/Projects/LRF_Server/build b/Projects/LRF_Server/build old mode 100644 new mode 100755 index 479962e8..ad1f2266 --- a/Projects/LRF_Server/build +++ b/Projects/LRF_Server/build @@ -5,5 +5,5 @@ #make -e "CFG=Debug" -#make clean -e "CFG=Release" +make clean -e "CFG=Release" make -e "CFG=Release" diff --git a/Projects/LRF_ServerSlim/build b/Projects/LRF_ServerSlim/build index 443546f2..6623787d 100755 --- a/Projects/LRF_ServerSlim/build +++ b/Projects/LRF_ServerSlim/build @@ -2,8 +2,8 @@ make clean -e "CFG=Debug_MASTER" -make -e "CFG=Debug_MASTER" -j4 +#make -e "CFG=Debug_MASTER" -j4 -make clean -e "CFG=Debug_SLAVE" -make -e "CFG=Debug_SLAVE" -j4 +#make clean -e "CFG=Debug_SLAVE" +#make -e "CFG=Debug_SLAVE" -j4 diff --git a/Projects/argus/argus.vpj b/Projects/argus/argus.vpj index 99033f3c..098a5173 100644 --- a/Projects/argus/argus.vpj +++ b/Projects/argus/argus.vpj @@ -297,7 +297,6 @@ - @@ -383,7 +382,6 @@ - diff --git a/Projects/argus/build b/Projects/argus/build index a35ee846..be703d90 100755 --- a/Projects/argus/build +++ b/Projects/argus/build @@ -1,9 +1,9 @@ #! /bin/sh -make clean -e "CFG=Debug" -#make -j4 -e "CFG=Debug" +#make clean -e "CFG=Debug" +make -j4 -e "CFG=Debug" -make clean -e "CFG=Release" +#make clean -e "CFG=Release" #make -j4 -e "CFG=Release" diff --git a/Projects/argus/makefile b/Projects/argus/makefile index 909eb856..4d5f275a 100644 --- a/Projects/argus/makefile +++ b/Projects/argus/makefile @@ -42,9 +42,8 @@ COMMON_OBJ=$(OUTDIR)/ArgusBackend.o $(OUTDIR)/base64.o \ $(OUTDIR)/clientPort.o $(OUTDIR)/curlRequest.o \ $(OUTDIR)/curlRequestsManager.o $(OUTDIR)/database_class.o \ $(OUTDIR)/heapDebug.o $(OUTDIR)/json_reader.o $(OUTDIR)/json_value.o \ - $(OUTDIR)/json_writer.o $(OUTDIR)/libzip.o $(OUTDIR)/lrf_3d.o \ - $(OUTDIR)/mask.o $(OUTDIR)/md5.o \ - $(OUTDIR)/mediaNginxStreamingProxyManager.o \ + $(OUTDIR)/json_writer.o $(OUTDIR)/libzip.o $(OUTDIR)/mask.o \ + $(OUTDIR)/md5.o $(OUTDIR)/mediaNginxStreamingProxyManager.o \ $(OUTDIR)/objectConsoleLoggingService.o \ $(OUTDIR)/objectFileLoggingService.o $(OUTDIR)/objectSystemAnchor.o \ $(OUTDIR)/onvifMediaObserver.o $(OUTDIR)/ponvif.o \ @@ -94,9 +93,8 @@ ALL_OBJ=$(OUTDIR)/ArgusBackend.o $(OUTDIR)/base64.o \ $(OUTDIR)/clientPort.o $(OUTDIR)/curlRequest.o \ $(OUTDIR)/curlRequestsManager.o $(OUTDIR)/database_class.o \ $(OUTDIR)/heapDebug.o $(OUTDIR)/json_reader.o $(OUTDIR)/json_value.o \ - $(OUTDIR)/json_writer.o $(OUTDIR)/libzip.o $(OUTDIR)/lrf_3d.o \ - $(OUTDIR)/mask.o $(OUTDIR)/md5.o \ - $(OUTDIR)/mediaNginxStreamingProxyManager.o \ + $(OUTDIR)/json_writer.o $(OUTDIR)/libzip.o $(OUTDIR)/mask.o \ + $(OUTDIR)/md5.o $(OUTDIR)/mediaNginxStreamingProxyManager.o \ $(OUTDIR)/objectConsoleLoggingService.o \ $(OUTDIR)/objectFileLoggingService.o $(OUTDIR)/objectSystemAnchor.o \ $(OUTDIR)/onvifMediaObserver.o $(OUTDIR)/ponvif.o \ @@ -191,9 +189,6 @@ $(OUTDIR)/%.o : ../../lib/data/ponvif/%.cpp $(OUTDIR)/%.o : ../../lib/data/NginxMediaServer/%.cpp $(COMPILE) -$(OUTDIR)/%.o : ../../lib/hardware/sensors/lrf/%.cpp - $(COMPILE) - # Build rules all: $(OUTFILE) @@ -244,9 +239,8 @@ COMMON_OBJ=$(OUTDIR)/ArgusBackend.o $(OUTDIR)/base64.o \ $(OUTDIR)/clientPort.o $(OUTDIR)/curlRequest.o \ $(OUTDIR)/curlRequestsManager.o $(OUTDIR)/database_class.o \ $(OUTDIR)/heapDebug.o $(OUTDIR)/json_reader.o $(OUTDIR)/json_value.o \ - $(OUTDIR)/json_writer.o $(OUTDIR)/libzip.o $(OUTDIR)/lrf_3d.o \ - $(OUTDIR)/mask.o $(OUTDIR)/md5.o \ - $(OUTDIR)/mediaNginxStreamingProxyManager.o \ + $(OUTDIR)/json_writer.o $(OUTDIR)/libzip.o $(OUTDIR)/mask.o \ + $(OUTDIR)/md5.o $(OUTDIR)/mediaNginxStreamingProxyManager.o \ $(OUTDIR)/objectConsoleLoggingService.o \ $(OUTDIR)/objectFileLoggingService.o $(OUTDIR)/objectSystemAnchor.o \ $(OUTDIR)/onvifMediaObserver.o $(OUTDIR)/ponvif.o \ @@ -296,9 +290,8 @@ ALL_OBJ=$(OUTDIR)/ArgusBackend.o $(OUTDIR)/base64.o \ $(OUTDIR)/clientPort.o $(OUTDIR)/curlRequest.o \ $(OUTDIR)/curlRequestsManager.o $(OUTDIR)/database_class.o \ $(OUTDIR)/heapDebug.o $(OUTDIR)/json_reader.o $(OUTDIR)/json_value.o \ - $(OUTDIR)/json_writer.o $(OUTDIR)/libzip.o $(OUTDIR)/lrf_3d.o \ - $(OUTDIR)/mask.o $(OUTDIR)/md5.o \ - $(OUTDIR)/mediaNginxStreamingProxyManager.o \ + $(OUTDIR)/json_writer.o $(OUTDIR)/libzip.o $(OUTDIR)/mask.o \ + $(OUTDIR)/md5.o $(OUTDIR)/mediaNginxStreamingProxyManager.o \ $(OUTDIR)/objectConsoleLoggingService.o \ $(OUTDIR)/objectFileLoggingService.o $(OUTDIR)/objectSystemAnchor.o \ $(OUTDIR)/onvifMediaObserver.o $(OUTDIR)/ponvif.o \ @@ -393,9 +386,6 @@ $(OUTDIR)/%.o : ../../lib/data/ponvif/%.cpp $(OUTDIR)/%.o : ../../lib/data/NginxMediaServer/%.cpp $(COMPILE) -$(OUTDIR)/%.o : ../../lib/hardware/sensors/lrf/%.cpp - $(COMPILE) - # Build rules all: $(OUTFILE) @@ -421,11 +411,11 @@ endif # # include dependencies: # -$(OUTDIR)/ArgusBackend.o: ../../lib/App/argus/ArgusBackend.cpp ../../lib/App/argus/ArgusBackend.h ../../lib/components/base/basicSettings.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicMemoryOperation.h ../../lib/components/object/objectFileLoggingService.h ../../lib/components/object/objectConsoleLoggingService.h ../../lib/data/net/netServer.h ../../lib/data/mysql/database_class.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicMutex.h ../../lib/rgoose/rgooseKernel.h ../../lib/alg/generic/md5.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicEngine.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/components/object/objectSystemAnchor.h ../../lib/components/base/basicEventHeap.h ../../lib/rgoose/rgooseDBConnector.h ../../lib/rgoose/rgooseTypes.h ../../lib/rgoose/rgooseIPCamera.h ../../lib/rgoose/rgooseNodeFactory.h ../../lib/rgoose/rgooseNode.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/utm.h ../../lib/alg/generic/Transform.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicStatus.h ../../lib/rgoose/rgooseTargetFilter.h ../../lib/components/base/basicEvent.h ../../lib/rgoose/rgooseModuleFactory.h ../../lib/rgoose/rgooseModule.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicStatus.h ../../lib/components/base/basicEventHandler.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicMutex.h ../../lib/rgoose/rgooseHardwareManager.h ../../lib/rgoose/rgooseHardwareResource.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicStatus.h ../../lib/rgoose/rgooseTargetFilter.h ../../lib/components/base/basicEvent.h +$(OUTDIR)/ArgusBackend.o: ../../lib/App/argus/ArgusBackend.cpp ../../lib/App/argus/ArgusBackend.h ../../lib/components/base/basicSettings.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicMemoryOperation.h ../../lib/components/object/objectFileLoggingService.h ../../lib/components/object/objectConsoleLoggingService.h ../../lib/data/net/netServer.h ../../lib/data/mysql/database_class.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicMutex.h ../../lib/rgoose/rgooseKernel.h ../../lib/alg/generic/md5.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicEngine.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/components/object/objectSystemAnchor.h ../../lib/components/base/basicEventHeap.h ../../lib/rgoose/rgooseDBConnector.h ../../lib/rgoose/rgooseTypes.h ../../lib/rgoose/rgooseIPCamera.h ../../lib/rgoose/rgooseNodeFactory.h ../../lib/rgoose/rgooseNode.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/utm.h ../../lib/alg/generic/Transform.h ../../lib/rgoose/rgooseTargetFilter.h ../../lib/components/base/basicEvent.h ../../lib/rgoose/rgooseModuleFactory.h ../../lib/rgoose/rgooseModule.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicEventHandler.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicMutex.h ../../lib/rgoose/rgooseHardwareManager.h ../../lib/rgoose/rgooseHardwareResource.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/rgoose/rgooseTargetFilter.h ../../lib/components/base/basicEvent.h $(OUTDIR)/base64.o: ../../lib/alg/generic/base64.cpp ../../lib/alg/generic/base64.h $(OUTDIR)/basicCameraInfo.o: ../../lib/components/base/basicCameraInfo.cpp ../../lib/components/base/basicCameraInfo.h $(OUTDIR)/basicDualThread.o: ../../lib/components/base/basicDualThread.cpp ../../lib/components/base/basicDualThread.h -$(OUTDIR)/basicEngine.o: ../../lib/components/base/basicEngine.cpp ../../lib/components/base/basicEngine.h +$(OUTDIR)/basicEngine.o: ../../lib/components/base/basicEngine.cpp ../../lib/components/base/basicEngine.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicMutex.h $(OUTDIR)/basicEvent.o: ../../lib/components/base/basicEvent.cpp ../../lib/components/base/basicEvent.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h $(OUTDIR)/basicEventHandler.o: ../../lib/components/base/basicEventHandler.cpp ../../lib/components/base/basicEventHandler.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicEventHeap.h $(OUTDIR)/basicEventHeap.o: ../../lib/components/base/basicEventHeap.cpp ../../lib/components/base/basicEventHeap.h ../../lib/components/base/basicEventHandler.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicEvent.h @@ -436,7 +426,7 @@ $(OUTDIR)/basicLoggingService.o: ../../lib/components/base/basicLoggingService.c $(OUTDIR)/basicMediaDestination.o: ../../lib/components/base/basicMediaDestination.cpp ../../lib/components/base/basicMediaDestination.h $(OUTDIR)/basicMediaSource.o: ../../lib/components/base/basicMediaSource.cpp ../../lib/components/base/basicMediaSource.h $(OUTDIR)/basicMutex.o: ../../lib/components/base/basicMutex.cpp ../../lib/components/base/basicMutex.h -$(OUTDIR)/basicObject.o: ../../lib/components/base/basicObject.cpp ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicStatus.h +$(OUTDIR)/basicObject.o: ../../lib/components/base/basicObject.cpp ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/alg/generic/md5.h $(OUTDIR)/basicPosition.o: ../../lib/components/base/basicPosition.cpp ../../lib/components/base/basicPosition.h ../../lib/alg/generic/utm.h ../../lib/alg/generic/Transform.h $(OUTDIR)/basicRing.o: ../../lib/components/base/basicRing.cpp ../../lib/components/base/basicRing.h $(OUTDIR)/basicSettings.o: ../../lib/components/base/basicSettings.cpp ../../lib/components/base/basicSettings.h @@ -454,7 +444,6 @@ $(OUTDIR)/json_reader.o: ../../lib/data/json/json_reader.cpp ../../lib/data/json $(OUTDIR)/json_value.o: ../../lib/data/json/json_value.cpp ../../lib/data/json/json_valueiterator.inl $(OUTDIR)/json_writer.o: ../../lib/data/json/json_writer.cpp ../../lib/data/json/json_tool.h $(OUTDIR)/libzip.o: ../../lib/alg/generic/libzip.cpp ../../lib/alg/generic/libzip.h -$(OUTDIR)/lrf_3d.o: ../../lib/hardware/sensors/lrf/lrf_3d.cpp ../../lib/hardware/sensors/lrf/lrf_3d.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicStatus.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicDualThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicEventHeap.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/utm.h ../../lib/alg/generic/Transform.h ../../lib/components/object/objectSystemAnchor.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/alg/lgs/mask.h ../../lib/data/net/clientPort.h ../../lib/data/transport/transportSocket.h ../../lib/components/base/basicDualThread.h ../../lib/components/base/basicTransport.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicLogCollection.h ../../lib/data/protocol/protocolLGS3D_client.h ../../lib/data/protocol/protocolLGS3D.h ../../lib/data/protocol/protocol.h ../../lib/data/protocol/protocolLGS_data.h ../../lib/alg/lgs/detectorStructures.h ../../lib/hardware/soc/general/3DLRF.h $(OUTDIR)/mask.o: ../../lib/alg/lgs/mask.cpp ../../lib/alg/lgs/mask.h $(OUTDIR)/md5.o: ../../lib/alg/generic/md5.cpp ../../lib/alg/generic/md5.h $(OUTDIR)/mediaNginxStreamingProxyManager.o: ../../lib/data/NginxMediaServer/mediaNginxStreamingProxyManager.cpp ../../lib/data/NginxMediaServer/mediaNginxStreamingProxyManager.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicMutex.h @@ -470,8 +459,8 @@ $(OUTDIR)/protocolEuropeanGeneral.o: ../../lib/data/protocol/protocolEuropeanGen $(OUTDIR)/protocolHTTP.o: ../../lib/data/protocol/protocolHTTP.cpp ../../lib/data/protocol/protocolHTTP.h ../../lib/data/net/clientPort.h ../../lib/data/transport/transportSocket.h ../../lib/components/base/basicDualThread.h ../../lib/components/base/basicTransport.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicLogCollection.h ../../lib/data/curl/curlRequestsManager.h ../../lib/data/protocol/protocol.h ../../lib/components/base/basicTransport.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h $(OUTDIR)/protocolKAFKA.o: ../../lib/data/protocol/protocolKAFKA.cpp ../../lib/data/protocol/protocolKAFKA.h ../../lib/data/protocol/protocolEuropeanGeneral.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/alg/generic/md5.h ../../lib/data/json/json_tool.h $(OUTDIR)/protocolLGS2D.o: ../../lib/data/protocol/protocolLGS2D.cpp ../../lib/data/protocol/protocolLGS2D.h ../../lib/data/protocol/protocol.h ../../lib/data/protocol/protocolLGS_data.h ../../lib/alg/lgs/detectorStructures.h ../../lib/alg/lgs/mask.h -$(OUTDIR)/protocolLGS3D.o: ../../lib/data/protocol/protocolLGS3D.cpp ../../lib/data/protocol/protocolLGS3D.h ../../lib/data/protocol/protocol.h ../../lib/data/protocol/protocolLGS_data.h -$(OUTDIR)/protocolLGS3D_client.o: ../../lib/data/protocol/protocolLGS3D_client.cpp ../../lib/data/protocol/protocolLGS3D_client.h ../../lib/data/protocol/protocolLGS3D.h ../../lib/data/protocol/protocol.h ../../lib/data/protocol/protocolLGS_data.h ../../lib/alg/lgs/detectorStructures.h +$(OUTDIR)/protocolLGS3D.o: ../../lib/data/protocol/protocolLGS3D.cpp ../../lib/data/protocol/protocolLGS3D.h ../../lib/data/protocol/protocol.h ../../lib/alg/lgs/detectorStructures.h ../../lib/data/protocol/protocolLGS_data.h +$(OUTDIR)/protocolLGS3D_client.o: ../../lib/data/protocol/protocolLGS3D_client.cpp ../../lib/data/protocol/protocolLGS3D_client.h ../../lib/data/protocol/protocolLGS3D.h ../../lib/data/protocol/protocol.h ../../lib/alg/lgs/detectorStructures.h ../../lib/data/protocol/protocolLGS_data.h ../../lib/alg/lgs/detectorStructures.h ../../lib/alg/lgs/mask.h $(OUTDIR)/protocolMAVLINK.o: ../../lib/data/protocol/protocolMAVLINK.cpp ../../lib/data/protocol/protocolMAVLINK.h ../../lib/data/protocol/protocol.h ../../lib/data/mavlink/ardupilotmega/mavlink.h ../../lib/hardware/uart/serialPort.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/utm.h ../../lib/alg/generic/Transform.h $(OUTDIR)/protocolPTZ.o: ../../lib/data/protocol/protocolPTZ.cpp ../../lib/data/protocol/protocolPTZ.h ../../lib/data/protocol/protocol.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicTransport.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicLogCollection.h $(OUTDIR)/protocolPTZ_ONVIF.o: ../../lib/data/protocol/protocolPTZ_ONVIF.cpp ../../lib/data/protocol/protocolPTZ_ONVIF.h ../../lib/data/protocol/protocolPTZ.h ../../lib/data/protocol/protocol.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicTransport.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicLogCollection.h ../../lib/data/ponvif/ponvif.h ../../lib/data/protocol/xmlParser.h ../../lib/alg/generic/base64.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicLogCollection.h ../../lib/data/curl/curlRequestsManager.h ../../lib/data/onvif/include/onvifclient.hpp ../../lib/hardware/uart/serialPort.h @@ -479,32 +468,32 @@ $(OUTDIR)/protocolPTZ_PELCO.o: ../../lib/data/protocol/protocolPTZ_PELCO.cpp ../ $(OUTDIR)/protocolPTZ_VISCA.o: ../../lib/data/protocol/protocolPTZ_VISCA.cpp ../../lib/data/protocol/protocolPTZ_VISCA.h ../../lib/data/protocol/protocolPTZ.h ../../lib/data/protocol/protocol.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicTransport.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicLogCollection.h $(OUTDIR)/protocolSafeShore.o: ../../lib/data/protocol/protocolSafeShore.cpp ../../lib/data/protocol/protocolSafeShore.h ../../lib/alg/generic/md5.h $(OUTDIR)/protocolZLMEDIA.o: ../../lib/data/protocol/protocolZLMEDIA.cpp ../../lib/data/protocol/protocolZLMEDIA.h ../../lib/data/protocol/protocolHTTP.h ../../lib/data/net/clientPort.h ../../lib/data/transport/transportSocket.h ../../lib/components/base/basicDualThread.h ../../lib/components/base/basicTransport.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicLogCollection.h ../../lib/data/curl/curlRequestsManager.h ../../lib/data/protocol/protocol.h ../../lib/components/base/basicTransport.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/data/json/json_tool.h -$(OUTDIR)/rgooseCamera.o: ../../lib/rgoose/rgooseCamera.cpp ../../lib/rgoose/rgooseCamera.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicMutex.h ../../lib/data/protocol/protocolPTZ.h ../../lib/data/protocol/protocol.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicTransport.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicLogCollection.h ../../lib/data/media/video/videoAVLIBSource.h ../../lib/components/base/basicEventHeap.h ../../lib/rgoose/rgooseDBConnector.h ../../lib/rgoose/rgooseTypes.h ../../lib/components/base/basicCameraInfo.h ../../lib/components/object/objectSystemAnchor.h ../../lib/hardware/uart/serialPort.h ../../lib/hardware/uart/serialSOL.h ../../lib/data/protocol/protocolPTZ_VISCA.h ../../lib/data/protocol/protocolPTZ.h ../../lib/data/protocol/protocol.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicTransport.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicLogCollection.h ../../lib/data/protocol/protocolPTZ_ONVIF.h ../../lib/data/protocol/protocolPTZ.h ../../lib/data/protocol/protocol.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicTransport.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicLogCollection.h ../../lib/data/ponvif/ponvif.h ../../lib/data/protocol/xmlParser.h ../../lib/alg/generic/base64.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicLogCollection.h ../../lib/data/curl/curlRequestsManager.h ../../lib/data/onvif/include/onvifclient.hpp ../../lib/data/protocol/protocolPTZ_PELCO.h ../../lib/data/protocol/protocolPTZ.h ../../lib/data/protocol/protocol.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicTransport.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicLogCollection.h ../../lib/rgoose/rgooseKernel.h ../../lib/alg/generic/md5.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicEngine.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/components/object/objectSystemAnchor.h ../../lib/components/base/basicEventHeap.h ../../lib/rgoose/rgooseDBConnector.h ../../lib/rgoose/rgooseTypes.h ../../lib/rgoose/rgooseIPCamera.h ../../lib/rgoose/rgooseNodeFactory.h ../../lib/rgoose/rgooseNode.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/utm.h ../../lib/alg/generic/Transform.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicStatus.h ../../lib/rgoose/rgooseTargetFilter.h ../../lib/components/base/basicEvent.h ../../lib/rgoose/rgooseModuleFactory.h ../../lib/rgoose/rgooseModule.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicStatus.h ../../lib/components/base/basicEventHandler.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicMutex.h ../../lib/rgoose/rgooseHardwareManager.h ../../lib/rgoose/rgooseHardwareResource.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicStatus.h ../../lib/rgoose/rgooseTargetFilter.h ../../lib/components/base/basicEvent.h ../../lib/rgoose/rgooseHardwareResourceSerialProvider.h ../../lib/rgoose/rgooseHardwareResource.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicStatus.h ../../lib/components/base/basicTransport.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicDualThread.h ../../lib/rgoose/rgooseModuleEmbedVideo.h ../../lib/rgoose/rgooseModule.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicStatus.h ../../lib/components/base/basicEventHandler.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicEventHeap.h ../../lib/components/base/basicMediaDestination.h +$(OUTDIR)/rgooseCamera.o: ../../lib/rgoose/rgooseCamera.cpp ../../lib/rgoose/rgooseCamera.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicMutex.h ../../lib/data/protocol/protocolPTZ.h ../../lib/data/protocol/protocol.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicTransport.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicLogCollection.h ../../lib/data/media/video/videoAVLIBSource.h ../../lib/components/base/basicEventHeap.h ../../lib/rgoose/rgooseDBConnector.h ../../lib/rgoose/rgooseTypes.h ../../lib/components/base/basicCameraInfo.h ../../lib/components/object/objectSystemAnchor.h ../../lib/hardware/uart/serialPort.h ../../lib/hardware/uart/serialSOL.h ../../lib/data/protocol/protocolPTZ_VISCA.h ../../lib/data/protocol/protocolPTZ.h ../../lib/data/protocol/protocol.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicTransport.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicLogCollection.h ../../lib/data/protocol/protocolPTZ_ONVIF.h ../../lib/data/protocol/protocolPTZ.h ../../lib/data/protocol/protocol.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicTransport.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicLogCollection.h ../../lib/data/ponvif/ponvif.h ../../lib/data/protocol/xmlParser.h ../../lib/alg/generic/base64.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicLogCollection.h ../../lib/data/curl/curlRequestsManager.h ../../lib/data/onvif/include/onvifclient.hpp ../../lib/data/protocol/protocolPTZ_PELCO.h ../../lib/data/protocol/protocolPTZ.h ../../lib/data/protocol/protocol.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicTransport.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicLogCollection.h ../../lib/rgoose/rgooseKernel.h ../../lib/alg/generic/md5.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicEngine.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/components/object/objectSystemAnchor.h ../../lib/components/base/basicEventHeap.h ../../lib/rgoose/rgooseDBConnector.h ../../lib/rgoose/rgooseTypes.h ../../lib/rgoose/rgooseIPCamera.h ../../lib/rgoose/rgooseNodeFactory.h ../../lib/rgoose/rgooseNode.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/utm.h ../../lib/alg/generic/Transform.h ../../lib/rgoose/rgooseTargetFilter.h ../../lib/components/base/basicEvent.h ../../lib/rgoose/rgooseModuleFactory.h ../../lib/rgoose/rgooseModule.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicEventHandler.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicMutex.h ../../lib/rgoose/rgooseHardwareManager.h ../../lib/rgoose/rgooseHardwareResource.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/rgoose/rgooseTargetFilter.h ../../lib/components/base/basicEvent.h ../../lib/rgoose/rgooseHardwareResourceSerialProvider.h ../../lib/rgoose/rgooseHardwareResource.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicTransport.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicDualThread.h ../../lib/rgoose/rgooseModuleEmbedVideo.h ../../lib/rgoose/rgooseModule.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicEventHandler.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicEventHeap.h ../../lib/components/base/basicMediaDestination.h $(OUTDIR)/rgooseDBConnector.o: ../../lib/rgoose/rgooseDBConnector.cpp ../../lib/rgoose/rgooseDBConnector.h ../../lib/rgoose/rgooseTypes.h $(OUTDIR)/rgooseFilterAPF.o: ../../lib/rgoose/rgooseFilterAPF.cpp ../../lib/rgoose/rgooseFilterAPF.h ../../lib/rgoose/rgooseTargetFilter.h ../../lib/components/base/basicEvent.h ../../lib/components/object/objectSystemAnchor.h ../../lib/components/base/basicThread.h -$(OUTDIR)/rgooseHardwareManager.o: ../../lib/rgoose/rgooseHardwareManager.cpp ../../lib/rgoose/rgooseHardwareManager.h ../../lib/rgoose/rgooseHardwareResource.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicStatus.h ../../lib/rgoose/rgooseKernel.h ../../lib/alg/generic/md5.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicEngine.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/components/object/objectSystemAnchor.h ../../lib/components/base/basicEventHeap.h ../../lib/rgoose/rgooseDBConnector.h ../../lib/rgoose/rgooseTypes.h ../../lib/rgoose/rgooseIPCamera.h ../../lib/rgoose/rgooseNodeFactory.h ../../lib/rgoose/rgooseNode.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/utm.h ../../lib/alg/generic/Transform.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicStatus.h ../../lib/rgoose/rgooseTargetFilter.h ../../lib/components/base/basicEvent.h ../../lib/rgoose/rgooseModuleFactory.h ../../lib/rgoose/rgooseModule.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicStatus.h ../../lib/components/base/basicEventHandler.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicMutex.h ../../lib/rgoose/rgooseHardwareManager.h ../../lib/rgoose/rgooseHardwareResource.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicStatus.h ../../lib/rgoose/rgooseTargetFilter.h ../../lib/components/base/basicEvent.h ../../lib/rgoose/rgooseDBConnector.h ../../lib/rgoose/rgooseTypes.h ../../lib/rgoose/rgooseHardwareResourceSerialProvider.h ../../lib/rgoose/rgooseHardwareResource.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicStatus.h ../../lib/components/base/basicTransport.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicDualThread.h ../../lib/rgoose/rgooseHardwareResourceNetworkProvider.h ../../lib/rgoose/rgooseHardwareResource.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicStatus.h ../../lib/hardware/hid/hid_dc.h ../../lib/alg/generic/heapDebug.h -$(OUTDIR)/rgooseHardwareResource.o: ../../lib/rgoose/rgooseHardwareResource.cpp ../../lib/rgoose/rgooseHardwareResource.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicStatus.h -$(OUTDIR)/rgooseHardwareResourceDryContactProvider.o: ../../lib/rgoose/rgooseHardwareResourceDryContactProvider.cpp ../../lib/rgoose/rgooseHardwareResourceDryContactProvider.h ../../lib/rgoose/rgooseHardwareResource.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicStatus.h -$(OUTDIR)/rgooseHardwareResourceNetworkProvider.o: ../../lib/rgoose/rgooseHardwareResourceNetworkProvider.cpp ../../lib/rgoose/rgooseHardwareResourceNetworkProvider.h ../../lib/rgoose/rgooseHardwareResource.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicStatus.h -$(OUTDIR)/rgooseHardwareResourceSerialProvider.o: ../../lib/rgoose/rgooseHardwareResourceSerialProvider.cpp ../../lib/rgoose/rgooseHardwareResourceSerialProvider.h ../../lib/rgoose/rgooseHardwareResource.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicStatus.h ../../lib/components/base/basicTransport.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicDualThread.h ../../lib/data/protocol/protocol.h -$(OUTDIR)/rgooseKernel.o: ../../lib/rgoose/rgooseKernel.cpp ../../lib/rgoose/rgooseKernel.h ../../lib/alg/generic/md5.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicEngine.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/components/object/objectSystemAnchor.h ../../lib/components/base/basicEventHeap.h ../../lib/rgoose/rgooseDBConnector.h ../../lib/rgoose/rgooseTypes.h ../../lib/rgoose/rgooseIPCamera.h ../../lib/rgoose/rgooseNodeFactory.h ../../lib/rgoose/rgooseNode.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/utm.h ../../lib/alg/generic/Transform.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicStatus.h ../../lib/rgoose/rgooseTargetFilter.h ../../lib/components/base/basicEvent.h ../../lib/rgoose/rgooseModuleFactory.h ../../lib/rgoose/rgooseModule.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicStatus.h ../../lib/components/base/basicEventHandler.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicMutex.h ../../lib/rgoose/rgooseHardwareManager.h ../../lib/rgoose/rgooseHardwareResource.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicStatus.h ../../lib/rgoose/rgooseTargetFilter.h ../../lib/components/base/basicEvent.h ../../lib/rgoose/rgooseFilterAPF.h ../../lib/rgoose/rgooseTargetFilter.h ../../lib/components/base/basicEvent.h ../../lib/components/object/objectSystemAnchor.h ../../lib/components/base/basicThread.h ../../lib/data/json/json_tool.h -$(OUTDIR)/rgooseModule.o: ../../lib/rgoose/rgooseModule.cpp ../../lib/rgoose/rgooseModule.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicStatus.h ../../lib/components/base/basicEventHandler.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicEvent.h ../../lib/rgoose/rgooseKernel.h ../../lib/alg/generic/md5.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicEngine.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/components/object/objectSystemAnchor.h ../../lib/components/base/basicEventHeap.h ../../lib/rgoose/rgooseDBConnector.h ../../lib/rgoose/rgooseTypes.h ../../lib/rgoose/rgooseIPCamera.h ../../lib/rgoose/rgooseNodeFactory.h ../../lib/rgoose/rgooseNode.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/utm.h ../../lib/alg/generic/Transform.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicStatus.h ../../lib/rgoose/rgooseTargetFilter.h ../../lib/components/base/basicEvent.h ../../lib/rgoose/rgooseModuleFactory.h ../../lib/rgoose/rgooseModule.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicStatus.h ../../lib/components/base/basicEventHandler.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicMutex.h ../../lib/rgoose/rgooseHardwareManager.h ../../lib/rgoose/rgooseHardwareResource.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicStatus.h ../../lib/rgoose/rgooseTargetFilter.h ../../lib/components/base/basicEvent.h -$(OUTDIR)/rgooseModuleEmbedVideo.o: ../../lib/rgoose/rgooseModuleEmbedVideo.cpp ../../lib/rgoose/rgooseModuleEmbedVideo.h ../../lib/rgoose/rgooseModule.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicStatus.h ../../lib/components/base/basicEventHandler.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicEventHeap.h ../../lib/components/base/basicMediaDestination.h ../../lib/rgoose/rgooseHardwareResourceNetworkProvider.h ../../lib/rgoose/rgooseHardwareResource.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicStatus.h ../../lib/alg/generic/base64.h -$(OUTDIR)/rgooseModuleFactory.o: ../../lib/rgoose/rgooseModuleFactory.cpp ../../lib/rgoose/rgooseModuleFactory.h ../../lib/rgoose/rgooseModule.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicStatus.h ../../lib/components/base/basicEventHandler.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicMutex.h ../../lib/rgoose/rgooseModuleZLMedia.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicMutex.h ../../lib/data/protocol/protocolZLMEDIA.h ../../lib/data/protocol/protocolHTTP.h ../../lib/data/net/clientPort.h ../../lib/data/transport/transportSocket.h ../../lib/components/base/basicDualThread.h ../../lib/components/base/basicTransport.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicLogCollection.h ../../lib/data/curl/curlRequestsManager.h ../../lib/data/protocol/protocol.h ../../lib/components/base/basicTransport.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/rgoose/rgooseModule.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicStatus.h ../../lib/components/base/basicEventHandler.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicEvent.h ../../lib/rgoose/rgooseModuleUSBRelay.h ../../lib/rgoose/rgooseModule.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicStatus.h ../../lib/components/base/basicEventHandler.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicEvent.h ../../lib/rgoose/rgooseModuleKafka.h ../../lib/rgoose/rgooseModule.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicStatus.h ../../lib/components/base/basicEventHandler.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicEventHeap.h ../../lib/data/protocol/protocolKAFKA.h ../../lib/data/protocol/protocolEuropeanGeneral.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/rgoose/rgooseModuleFlyHunter.h ../../lib/rgoose/rgooseModule.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicStatus.h ../../lib/components/base/basicEventHandler.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicEventHeap.h ../../lib/data/protocol/protocolMAVLINK.h ../../lib/data/protocol/protocol.h ../../lib/data/mavlink/ardupilotmega/mavlink.h ../../lib/hardware/uart/serialPort.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/utm.h ../../lib/alg/generic/Transform.h ../../lib/rgoose/rgooseModuleSSDP.h ../../lib/rgoose/rgooseModule.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicStatus.h ../../lib/components/base/basicEventHandler.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicEventHeap.h ../../lib/rgoose/rgooseModuleOnvifObserver.h ../../lib/data/protocol/xmlParser.h ../../lib/rgoose/rgooseModule.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicStatus.h ../../lib/components/base/basicEventHandler.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicEventHeap.h ../../lib/rgoose/rgooseModuleEmbedVideo.h ../../lib/rgoose/rgooseModule.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicStatus.h ../../lib/components/base/basicEventHandler.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicEventHeap.h ../../lib/components/base/basicMediaDestination.h ../../lib/alg/generic/heapDebug.h -$(OUTDIR)/rgooseModuleFlyHunter.o: ../../lib/rgoose/rgooseModuleFlyHunter.cpp ../../lib/rgoose/rgooseModuleFlyHunter.h ../../lib/rgoose/rgooseModule.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicStatus.h ../../lib/components/base/basicEventHandler.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicEventHeap.h ../../lib/data/protocol/protocolMAVLINK.h ../../lib/data/protocol/protocol.h ../../lib/data/mavlink/ardupilotmega/mavlink.h ../../lib/hardware/uart/serialPort.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/utm.h ../../lib/alg/generic/Transform.h -$(OUTDIR)/rgooseModuleKafka.o: ../../lib/rgoose/rgooseModuleKafka.cpp ../../lib/rgoose/rgooseModuleKafka.h ../../lib/rgoose/rgooseModule.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicStatus.h ../../lib/components/base/basicEventHandler.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicEventHeap.h ../../lib/data/protocol/protocolKAFKA.h ../../lib/data/protocol/protocolEuropeanGeneral.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/hardware/soc/general/3DLRF.h ../../lib/data/json/json_tool.h -$(OUTDIR)/rgooseModuleModemManager.o: ../../lib/rgoose/rgooseModuleModemManager.cpp -$(OUTDIR)/rgooseModuleOnvifObserver.o: ../../lib/rgoose/rgooseModuleOnvifObserver.cpp ../../lib/rgoose/rgooseModuleOnvifObserver.h ../../lib/data/protocol/xmlParser.h ../../lib/rgoose/rgooseModule.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicStatus.h ../../lib/components/base/basicEventHandler.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicEventHeap.h ../../lib/rgoose/rgooseKernel.h ../../lib/alg/generic/md5.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicEngine.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/components/object/objectSystemAnchor.h ../../lib/components/base/basicEventHeap.h ../../lib/rgoose/rgooseDBConnector.h ../../lib/rgoose/rgooseTypes.h ../../lib/rgoose/rgooseIPCamera.h ../../lib/rgoose/rgooseNodeFactory.h ../../lib/rgoose/rgooseNode.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/utm.h ../../lib/alg/generic/Transform.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicStatus.h ../../lib/rgoose/rgooseTargetFilter.h ../../lib/components/base/basicEvent.h ../../lib/rgoose/rgooseModuleFactory.h ../../lib/rgoose/rgooseModule.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicStatus.h ../../lib/components/base/basicEventHandler.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicMutex.h ../../lib/rgoose/rgooseHardwareManager.h ../../lib/rgoose/rgooseHardwareResource.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicStatus.h ../../lib/rgoose/rgooseTargetFilter.h ../../lib/components/base/basicEvent.h ../../lib/rgoose/rgooseHardwareResourceNetworkProvider.h ../../lib/rgoose/rgooseHardwareResource.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicStatus.h -$(OUTDIR)/rgooseModuleSSDP.o: ../../lib/rgoose/rgooseModuleSSDP.cpp ../../lib/rgoose/rgooseModuleSSDP.h ../../lib/rgoose/rgooseModule.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicStatus.h ../../lib/components/base/basicEventHandler.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicEventHeap.h -$(OUTDIR)/rgooseModuleUSBRelay.o: ../../lib/rgoose/rgooseModuleUSBRelay.cpp ../../lib/rgoose/rgooseModuleUSBRelay.h ../../lib/rgoose/rgooseModule.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicStatus.h ../../lib/components/base/basicEventHandler.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicEvent.h -$(OUTDIR)/rgooseModuleZLMedia.o: ../../lib/rgoose/rgooseModuleZLMedia.cpp ../../lib/rgoose/rgooseModuleZLMedia.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicMutex.h ../../lib/data/protocol/protocolZLMEDIA.h ../../lib/data/protocol/protocolHTTP.h ../../lib/data/net/clientPort.h ../../lib/data/transport/transportSocket.h ../../lib/components/base/basicDualThread.h ../../lib/components/base/basicTransport.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicLogCollection.h ../../lib/data/curl/curlRequestsManager.h ../../lib/data/protocol/protocol.h ../../lib/components/base/basicTransport.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/rgoose/rgooseModule.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicStatus.h ../../lib/components/base/basicEventHandler.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicEvent.h ../../lib/rgoose/rgooseKernel.h ../../lib/alg/generic/md5.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicEngine.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/components/object/objectSystemAnchor.h ../../lib/components/base/basicEventHeap.h ../../lib/rgoose/rgooseDBConnector.h ../../lib/rgoose/rgooseTypes.h ../../lib/rgoose/rgooseIPCamera.h ../../lib/rgoose/rgooseNodeFactory.h ../../lib/rgoose/rgooseNode.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/utm.h ../../lib/alg/generic/Transform.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicStatus.h ../../lib/rgoose/rgooseTargetFilter.h ../../lib/components/base/basicEvent.h ../../lib/rgoose/rgooseModuleFactory.h ../../lib/rgoose/rgooseModule.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicStatus.h ../../lib/components/base/basicEventHandler.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicMutex.h ../../lib/rgoose/rgooseHardwareManager.h ../../lib/rgoose/rgooseHardwareResource.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicStatus.h ../../lib/rgoose/rgooseTargetFilter.h ../../lib/components/base/basicEvent.h ../../lib/rgoose/rgooseHardwareResourceNetworkProvider.h ../../lib/rgoose/rgooseHardwareResource.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicStatus.h ../../lib/alg/generic/md5.h -$(OUTDIR)/rgooseNode.o: ../../lib/rgoose/rgooseNode.cpp ../../lib/rgoose/rgooseNode.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/utm.h ../../lib/alg/generic/Transform.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicStatus.h ../../lib/rgoose/rgooseTargetFilter.h ../../lib/components/base/basicEvent.h -$(OUTDIR)/rgooseNode2D.o: ../../lib/rgoose/rgooseNode2D.cpp ../../lib/rgoose/rgooseNode2D.h ../../lib/rgoose/rgooseNode.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/utm.h ../../lib/alg/generic/Transform.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicStatus.h ../../lib/rgoose/rgooseTargetFilter.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicStatus.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicEventHeap.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/utm.h ../../lib/alg/generic/Transform.h ../../lib/components/object/objectSystemAnchor.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/alg/lgs/mask.h ../../lib/data/protocol/protocolLGS2D.h ../../lib/data/protocol/protocol.h ../../lib/data/protocol/protocolLGS_data.h ../../lib/alg/lgs/detectorStructures.h ../../lib/alg/lgs/mask.h ../../lib/rgoose/rgooseHardwareResourceSerialProvider.h ../../lib/rgoose/rgooseHardwareResource.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicStatus.h ../../lib/components/base/basicTransport.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicDualThread.h ../../lib/rgoose/rgooseKernel.h ../../lib/alg/generic/md5.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicEngine.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/components/object/objectSystemAnchor.h ../../lib/components/base/basicEventHeap.h ../../lib/rgoose/rgooseDBConnector.h ../../lib/rgoose/rgooseTypes.h ../../lib/rgoose/rgooseIPCamera.h ../../lib/rgoose/rgooseNodeFactory.h ../../lib/rgoose/rgooseNode.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/utm.h ../../lib/alg/generic/Transform.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicStatus.h ../../lib/rgoose/rgooseTargetFilter.h ../../lib/components/base/basicEvent.h ../../lib/rgoose/rgooseModuleFactory.h ../../lib/rgoose/rgooseModule.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicStatus.h ../../lib/components/base/basicEventHandler.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicMutex.h ../../lib/rgoose/rgooseHardwareManager.h ../../lib/rgoose/rgooseHardwareResource.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicStatus.h ../../lib/rgoose/rgooseTargetFilter.h ../../lib/components/base/basicEvent.h -$(OUTDIR)/rgooseNode3D.o: ../../lib/rgoose/rgooseNode3D.cpp ../../lib/rgoose/rgooseNode3D.h ../../lib/hardware/sensors/lrf/lrf_3d.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicStatus.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicDualThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicEventHeap.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/utm.h ../../lib/alg/generic/Transform.h ../../lib/components/object/objectSystemAnchor.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/alg/lgs/mask.h ../../lib/data/net/clientPort.h ../../lib/data/transport/transportSocket.h ../../lib/components/base/basicDualThread.h ../../lib/components/base/basicTransport.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicLogCollection.h ../../lib/data/protocol/protocolLGS3D_client.h ../../lib/data/protocol/protocolLGS3D.h ../../lib/data/protocol/protocol.h ../../lib/data/protocol/protocolLGS_data.h ../../lib/alg/lgs/detectorStructures.h ../../lib/hardware/soc/general/3DLRF.h ../../lib/rgoose/rgooseNode.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/utm.h ../../lib/alg/generic/Transform.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicStatus.h ../../lib/rgoose/rgooseTargetFilter.h ../../lib/components/base/basicEvent.h -$(OUTDIR)/rgooseNodeFactory.o: ../../lib/rgoose/rgooseNodeFactory.cpp ../../lib/rgoose/rgooseNodeFactory.h ../../lib/rgoose/rgooseNode.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/utm.h ../../lib/alg/generic/Transform.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicStatus.h ../../lib/rgoose/rgooseTargetFilter.h ../../lib/components/base/basicEvent.h ../../lib/rgoose/rgooseIPCamera.h ../../lib/rgoose/rgooseNode3D.h ../../lib/hardware/sensors/lrf/lrf_3d.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicStatus.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicDualThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicEventHeap.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/utm.h ../../lib/alg/generic/Transform.h ../../lib/components/object/objectSystemAnchor.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/alg/lgs/mask.h ../../lib/data/net/clientPort.h ../../lib/data/transport/transportSocket.h ../../lib/components/base/basicDualThread.h ../../lib/components/base/basicTransport.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicLogCollection.h ../../lib/data/protocol/protocolLGS3D_client.h ../../lib/data/protocol/protocolLGS3D.h ../../lib/data/protocol/protocol.h ../../lib/data/protocol/protocolLGS_data.h ../../lib/alg/lgs/detectorStructures.h ../../lib/hardware/soc/general/3DLRF.h ../../lib/rgoose/rgooseNode.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/utm.h ../../lib/alg/generic/Transform.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicStatus.h ../../lib/rgoose/rgooseTargetFilter.h ../../lib/components/base/basicEvent.h ../../lib/rgoose/rgooseNode2D.h ../../lib/rgoose/rgooseNode.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/utm.h ../../lib/alg/generic/Transform.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicStatus.h ../../lib/rgoose/rgooseTargetFilter.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicStatus.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicEventHeap.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/utm.h ../../lib/alg/generic/Transform.h ../../lib/components/object/objectSystemAnchor.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/alg/lgs/mask.h ../../lib/data/protocol/protocolLGS2D.h ../../lib/data/protocol/protocol.h ../../lib/data/protocol/protocolLGS_data.h ../../lib/alg/lgs/detectorStructures.h ../../lib/alg/lgs/mask.h ../../lib/rgoose/rgooseNodePTZCamControl.h ../../lib/rgoose/rgooseCamera.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicMutex.h ../../lib/data/protocol/protocolPTZ.h ../../lib/data/protocol/protocol.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicTransport.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicLogCollection.h ../../lib/data/media/video/videoAVLIBSource.h ../../lib/components/base/basicEventHeap.h ../../lib/rgoose/rgooseDBConnector.h ../../lib/rgoose/rgooseTypes.h ../../lib/rgoose/rgooseNode.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/utm.h ../../lib/alg/generic/Transform.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicStatus.h ../../lib/rgoose/rgooseTargetFilter.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicEventHandler.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicEventHeap.h ../../lib/rgoose/rgooseNodeStaticCamControl.h ../../lib/rgoose/rgooseCamera.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicMutex.h ../../lib/data/protocol/protocolPTZ.h ../../lib/data/protocol/protocol.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicTransport.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicLogCollection.h ../../lib/data/media/video/videoAVLIBSource.h ../../lib/components/base/basicEventHeap.h ../../lib/rgoose/rgooseDBConnector.h ../../lib/rgoose/rgooseTypes.h ../../lib/rgoose/rgooseNode.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/utm.h ../../lib/alg/generic/Transform.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicStatus.h ../../lib/rgoose/rgooseTargetFilter.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicEventHandler.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicEventHeap.h ../../lib/alg/generic/heapDebug.h -$(OUTDIR)/rgooseNodePTZCamControl.o: ../../lib/rgoose/rgooseNodePTZCamControl.cpp ../../lib/rgoose/rgooseNodePTZCamControl.h ../../lib/rgoose/rgooseCamera.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicMutex.h ../../lib/data/protocol/protocolPTZ.h ../../lib/data/protocol/protocol.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicTransport.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicLogCollection.h ../../lib/data/media/video/videoAVLIBSource.h ../../lib/components/base/basicEventHeap.h ../../lib/rgoose/rgooseDBConnector.h ../../lib/rgoose/rgooseTypes.h ../../lib/rgoose/rgooseNode.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/utm.h ../../lib/alg/generic/Transform.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicStatus.h ../../lib/rgoose/rgooseTargetFilter.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicEventHandler.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicEventHeap.h -$(OUTDIR)/rgooseNodeStaticCamControl.o: ../../lib/rgoose/rgooseNodeStaticCamControl.cpp ../../lib/rgoose/rgooseNodeStaticCamControl.h ../../lib/rgoose/rgooseCamera.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicMutex.h ../../lib/data/protocol/protocolPTZ.h ../../lib/data/protocol/protocol.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicTransport.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicLogCollection.h ../../lib/data/media/video/videoAVLIBSource.h ../../lib/components/base/basicEventHeap.h ../../lib/rgoose/rgooseDBConnector.h ../../lib/rgoose/rgooseTypes.h ../../lib/rgoose/rgooseNode.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/utm.h ../../lib/alg/generic/Transform.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicStatus.h ../../lib/rgoose/rgooseTargetFilter.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicEventHandler.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicEventHeap.h -$(OUTDIR)/rgooseServerModule.o: ../../lib/rgoose/rgooseServerModule.cpp ../../lib/rgoose/rgooseServerModule.h ../../lib/rgoose/rgooseDBConnector.h ../../lib/rgoose/rgooseTypes.h ../../lib/rgoose/rgooseModule.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicStatus.h ../../lib/components/base/basicEventHandler.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicEvent.h +$(OUTDIR)/rgooseHardwareManager.o: ../../lib/rgoose/rgooseHardwareManager.cpp ../../lib/rgoose/rgooseHardwareManager.h ../../lib/rgoose/rgooseHardwareResource.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/rgoose/rgooseKernel.h ../../lib/alg/generic/md5.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicEngine.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/components/object/objectSystemAnchor.h ../../lib/components/base/basicEventHeap.h ../../lib/rgoose/rgooseDBConnector.h ../../lib/rgoose/rgooseTypes.h ../../lib/rgoose/rgooseIPCamera.h ../../lib/rgoose/rgooseNodeFactory.h ../../lib/rgoose/rgooseNode.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/utm.h ../../lib/alg/generic/Transform.h ../../lib/rgoose/rgooseTargetFilter.h ../../lib/components/base/basicEvent.h ../../lib/rgoose/rgooseModuleFactory.h ../../lib/rgoose/rgooseModule.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicEventHandler.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicMutex.h ../../lib/rgoose/rgooseHardwareManager.h ../../lib/rgoose/rgooseHardwareResource.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/rgoose/rgooseTargetFilter.h ../../lib/components/base/basicEvent.h ../../lib/rgoose/rgooseDBConnector.h ../../lib/rgoose/rgooseTypes.h ../../lib/rgoose/rgooseHardwareResourceSerialProvider.h ../../lib/rgoose/rgooseHardwareResource.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicTransport.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicDualThread.h ../../lib/rgoose/rgooseHardwareResourceNetworkProvider.h ../../lib/rgoose/rgooseHardwareResource.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/hardware/hid/hid_dc.h ../../lib/alg/generic/heapDebug.h +$(OUTDIR)/rgooseHardwareResource.o: ../../lib/rgoose/rgooseHardwareResource.cpp ../../lib/rgoose/rgooseHardwareResource.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h +$(OUTDIR)/rgooseHardwareResourceDryContactProvider.o: ../../lib/rgoose/rgooseHardwareResourceDryContactProvider.cpp ../../lib/rgoose/rgooseHardwareResourceDryContactProvider.h ../../lib/rgoose/rgooseHardwareResource.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h +$(OUTDIR)/rgooseHardwareResourceNetworkProvider.o: ../../lib/rgoose/rgooseHardwareResourceNetworkProvider.cpp ../../lib/rgoose/rgooseHardwareResourceNetworkProvider.h ../../lib/rgoose/rgooseHardwareResource.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h +$(OUTDIR)/rgooseHardwareResourceSerialProvider.o: ../../lib/rgoose/rgooseHardwareResourceSerialProvider.cpp ../../lib/rgoose/rgooseHardwareResourceSerialProvider.h ../../lib/rgoose/rgooseHardwareResource.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicTransport.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicDualThread.h ../../lib/data/protocol/protocol.h +$(OUTDIR)/rgooseKernel.o: ../../lib/rgoose/rgooseKernel.cpp ../../lib/rgoose/rgooseKernel.h ../../lib/alg/generic/md5.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicEngine.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/components/object/objectSystemAnchor.h ../../lib/components/base/basicEventHeap.h ../../lib/rgoose/rgooseDBConnector.h ../../lib/rgoose/rgooseTypes.h ../../lib/rgoose/rgooseIPCamera.h ../../lib/rgoose/rgooseNodeFactory.h ../../lib/rgoose/rgooseNode.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/utm.h ../../lib/alg/generic/Transform.h ../../lib/rgoose/rgooseTargetFilter.h ../../lib/components/base/basicEvent.h ../../lib/rgoose/rgooseModuleFactory.h ../../lib/rgoose/rgooseModule.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicEventHandler.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicMutex.h ../../lib/rgoose/rgooseHardwareManager.h ../../lib/rgoose/rgooseHardwareResource.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/rgoose/rgooseTargetFilter.h ../../lib/components/base/basicEvent.h ../../lib/rgoose/rgooseFilterAPF.h ../../lib/rgoose/rgooseTargetFilter.h ../../lib/components/base/basicEvent.h ../../lib/components/object/objectSystemAnchor.h ../../lib/components/base/basicThread.h ../../lib/data/json/json_tool.h +$(OUTDIR)/rgooseModule.o: ../../lib/rgoose/rgooseModule.cpp ../../lib/rgoose/rgooseModule.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicEventHandler.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicEvent.h ../../lib/rgoose/rgooseKernel.h ../../lib/alg/generic/md5.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicEngine.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/components/object/objectSystemAnchor.h ../../lib/components/base/basicEventHeap.h ../../lib/rgoose/rgooseDBConnector.h ../../lib/rgoose/rgooseTypes.h ../../lib/rgoose/rgooseIPCamera.h ../../lib/rgoose/rgooseNodeFactory.h ../../lib/rgoose/rgooseNode.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/utm.h ../../lib/alg/generic/Transform.h ../../lib/rgoose/rgooseTargetFilter.h ../../lib/components/base/basicEvent.h ../../lib/rgoose/rgooseModuleFactory.h ../../lib/rgoose/rgooseModule.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicEventHandler.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicMutex.h ../../lib/rgoose/rgooseHardwareManager.h ../../lib/rgoose/rgooseHardwareResource.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/rgoose/rgooseTargetFilter.h ../../lib/components/base/basicEvent.h +$(OUTDIR)/rgooseModuleEmbedVideo.o: ../../lib/rgoose/rgooseModuleEmbedVideo.cpp ../../lib/rgoose/rgooseModuleEmbedVideo.h ../../lib/rgoose/rgooseModule.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicEventHandler.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicEventHeap.h ../../lib/components/base/basicMediaDestination.h ../../lib/rgoose/rgooseHardwareResourceNetworkProvider.h ../../lib/rgoose/rgooseHardwareResource.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/alg/generic/base64.h +$(OUTDIR)/rgooseModuleFactory.o: ../../lib/rgoose/rgooseModuleFactory.cpp ../../lib/rgoose/rgooseModuleFactory.h ../../lib/rgoose/rgooseModule.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicEventHandler.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicMutex.h ../../lib/rgoose/rgooseModuleZLMedia.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicMutex.h ../../lib/data/protocol/protocolZLMEDIA.h ../../lib/data/protocol/protocolHTTP.h ../../lib/data/net/clientPort.h ../../lib/data/transport/transportSocket.h ../../lib/components/base/basicDualThread.h ../../lib/components/base/basicTransport.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicLogCollection.h ../../lib/data/curl/curlRequestsManager.h ../../lib/data/protocol/protocol.h ../../lib/components/base/basicTransport.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/rgoose/rgooseModule.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicEventHandler.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicEvent.h ../../lib/rgoose/rgooseModuleUSBRelay.h ../../lib/rgoose/rgooseModule.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicEventHandler.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicEvent.h ../../lib/rgoose/rgooseModuleKafka.h ../../lib/rgoose/rgooseModule.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicEventHandler.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicEventHeap.h ../../lib/data/protocol/protocolKAFKA.h ../../lib/data/protocol/protocolEuropeanGeneral.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/rgoose/rgooseModuleFlyHunter.h ../../lib/rgoose/rgooseModule.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicEventHandler.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicEventHeap.h ../../lib/data/protocol/protocolMAVLINK.h ../../lib/data/protocol/protocol.h ../../lib/data/mavlink/ardupilotmega/mavlink.h ../../lib/hardware/uart/serialPort.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/utm.h ../../lib/alg/generic/Transform.h ../../lib/rgoose/rgooseModuleSSDP.h ../../lib/rgoose/rgooseModule.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicEventHandler.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicEventHeap.h ../../lib/rgoose/rgooseModuleOnvifObserver.h ../../lib/data/protocol/xmlParser.h ../../lib/rgoose/rgooseModule.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicEventHandler.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicEventHeap.h ../../lib/rgoose/rgooseModuleEmbedVideo.h ../../lib/rgoose/rgooseModule.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicEventHandler.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicEventHeap.h ../../lib/components/base/basicMediaDestination.h ../../lib/rgoose/rgooseModuleModemManager.h ../../lib/rgoose/rgooseModule.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicEventHandler.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicThread.h ../../lib/alg/generic/heapDebug.h +$(OUTDIR)/rgooseModuleFlyHunter.o: ../../lib/rgoose/rgooseModuleFlyHunter.cpp ../../lib/rgoose/rgooseModuleFlyHunter.h ../../lib/rgoose/rgooseModule.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicEventHandler.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicEventHeap.h ../../lib/data/protocol/protocolMAVLINK.h ../../lib/data/protocol/protocol.h ../../lib/data/mavlink/ardupilotmega/mavlink.h ../../lib/hardware/uart/serialPort.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/utm.h ../../lib/alg/generic/Transform.h +$(OUTDIR)/rgooseModuleKafka.o: ../../lib/rgoose/rgooseModuleKafka.cpp ../../lib/rgoose/rgooseModuleKafka.h ../../lib/rgoose/rgooseModule.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicEventHandler.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicEventHeap.h ../../lib/data/protocol/protocolKAFKA.h ../../lib/data/protocol/protocolEuropeanGeneral.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/hardware/soc/general/3DLRF.h ../../lib/data/json/json_tool.h +$(OUTDIR)/rgooseModuleModemManager.o: ../../lib/rgoose/rgooseModuleModemManager.cpp ../../lib/rgoose/rgooseModuleModemManager.h ../../lib/rgoose/rgooseModule.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicEventHandler.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicThread.h +$(OUTDIR)/rgooseModuleOnvifObserver.o: ../../lib/rgoose/rgooseModuleOnvifObserver.cpp ../../lib/rgoose/rgooseModuleOnvifObserver.h ../../lib/data/protocol/xmlParser.h ../../lib/rgoose/rgooseModule.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicEventHandler.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicEventHeap.h ../../lib/rgoose/rgooseKernel.h ../../lib/alg/generic/md5.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicEngine.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/components/object/objectSystemAnchor.h ../../lib/components/base/basicEventHeap.h ../../lib/rgoose/rgooseDBConnector.h ../../lib/rgoose/rgooseTypes.h ../../lib/rgoose/rgooseIPCamera.h ../../lib/rgoose/rgooseNodeFactory.h ../../lib/rgoose/rgooseNode.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/utm.h ../../lib/alg/generic/Transform.h ../../lib/rgoose/rgooseTargetFilter.h ../../lib/components/base/basicEvent.h ../../lib/rgoose/rgooseModuleFactory.h ../../lib/rgoose/rgooseModule.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicEventHandler.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicMutex.h ../../lib/rgoose/rgooseHardwareManager.h ../../lib/rgoose/rgooseHardwareResource.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/rgoose/rgooseTargetFilter.h ../../lib/components/base/basicEvent.h ../../lib/rgoose/rgooseHardwareResourceNetworkProvider.h ../../lib/rgoose/rgooseHardwareResource.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h +$(OUTDIR)/rgooseModuleSSDP.o: ../../lib/rgoose/rgooseModuleSSDP.cpp ../../lib/rgoose/rgooseModuleSSDP.h ../../lib/rgoose/rgooseModule.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicEventHandler.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicEventHeap.h +$(OUTDIR)/rgooseModuleUSBRelay.o: ../../lib/rgoose/rgooseModuleUSBRelay.cpp ../../lib/rgoose/rgooseModuleUSBRelay.h ../../lib/rgoose/rgooseModule.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicEventHandler.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicEvent.h +$(OUTDIR)/rgooseModuleZLMedia.o: ../../lib/rgoose/rgooseModuleZLMedia.cpp ../../lib/rgoose/rgooseModuleZLMedia.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicMutex.h ../../lib/data/protocol/protocolZLMEDIA.h ../../lib/data/protocol/protocolHTTP.h ../../lib/data/net/clientPort.h ../../lib/data/transport/transportSocket.h ../../lib/components/base/basicDualThread.h ../../lib/components/base/basicTransport.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicLogCollection.h ../../lib/data/curl/curlRequestsManager.h ../../lib/data/protocol/protocol.h ../../lib/components/base/basicTransport.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/rgoose/rgooseModule.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicEventHandler.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicEvent.h ../../lib/rgoose/rgooseKernel.h ../../lib/alg/generic/md5.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicEngine.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/components/object/objectSystemAnchor.h ../../lib/components/base/basicEventHeap.h ../../lib/rgoose/rgooseDBConnector.h ../../lib/rgoose/rgooseTypes.h ../../lib/rgoose/rgooseIPCamera.h ../../lib/rgoose/rgooseNodeFactory.h ../../lib/rgoose/rgooseNode.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/utm.h ../../lib/alg/generic/Transform.h ../../lib/rgoose/rgooseTargetFilter.h ../../lib/components/base/basicEvent.h ../../lib/rgoose/rgooseModuleFactory.h ../../lib/rgoose/rgooseModule.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicEventHandler.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicMutex.h ../../lib/rgoose/rgooseHardwareManager.h ../../lib/rgoose/rgooseHardwareResource.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/rgoose/rgooseTargetFilter.h ../../lib/components/base/basicEvent.h ../../lib/rgoose/rgooseHardwareResourceNetworkProvider.h ../../lib/rgoose/rgooseHardwareResource.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/alg/generic/md5.h +$(OUTDIR)/rgooseNode.o: ../../lib/rgoose/rgooseNode.cpp ../../lib/rgoose/rgooseNode.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/utm.h ../../lib/alg/generic/Transform.h ../../lib/rgoose/rgooseTargetFilter.h ../../lib/components/base/basicEvent.h +$(OUTDIR)/rgooseNode2D.o: ../../lib/rgoose/rgooseNode2D.cpp ../../lib/rgoose/rgooseNode2D.h ../../lib/rgoose/rgooseNode.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/utm.h ../../lib/alg/generic/Transform.h ../../lib/rgoose/rgooseTargetFilter.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicEventHeap.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/utm.h ../../lib/alg/generic/Transform.h ../../lib/components/object/objectSystemAnchor.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/alg/lgs/mask.h ../../lib/data/protocol/protocolLGS2D.h ../../lib/data/protocol/protocol.h ../../lib/data/protocol/protocolLGS_data.h ../../lib/alg/lgs/detectorStructures.h ../../lib/alg/lgs/mask.h ../../lib/rgoose/rgooseHardwareResourceSerialProvider.h ../../lib/rgoose/rgooseHardwareResource.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicTransport.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicDualThread.h ../../lib/rgoose/rgooseKernel.h ../../lib/alg/generic/md5.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicEngine.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/components/object/objectSystemAnchor.h ../../lib/components/base/basicEventHeap.h ../../lib/rgoose/rgooseDBConnector.h ../../lib/rgoose/rgooseTypes.h ../../lib/rgoose/rgooseIPCamera.h ../../lib/rgoose/rgooseNodeFactory.h ../../lib/rgoose/rgooseNode.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/utm.h ../../lib/alg/generic/Transform.h ../../lib/rgoose/rgooseTargetFilter.h ../../lib/components/base/basicEvent.h ../../lib/rgoose/rgooseModuleFactory.h ../../lib/rgoose/rgooseModule.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicEventHandler.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicMutex.h ../../lib/rgoose/rgooseHardwareManager.h ../../lib/rgoose/rgooseHardwareResource.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/rgoose/rgooseTargetFilter.h ../../lib/components/base/basicEvent.h +$(OUTDIR)/rgooseNode3D.o: ../../lib/rgoose/rgooseNode3D.cpp ../../lib/rgoose/rgooseNode3D.h ../../lib/components/base/basicEngine.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicDualThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicEventHeap.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/utm.h ../../lib/alg/generic/Transform.h ../../lib/components/object/objectSystemAnchor.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/alg/lgs/mask.h ../../lib/data/net/clientPort.h ../../lib/data/transport/transportSocket.h ../../lib/components/base/basicDualThread.h ../../lib/components/base/basicTransport.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicLogCollection.h ../../lib/data/protocol/protocolLGS3D_client.h ../../lib/data/protocol/protocolLGS3D.h ../../lib/data/protocol/protocol.h ../../lib/alg/lgs/detectorStructures.h ../../lib/data/protocol/protocolLGS_data.h ../../lib/alg/lgs/detectorStructures.h ../../lib/alg/lgs/mask.h ../../lib/hardware/soc/general/3DLRF.h ../../lib/rgoose/rgooseNode.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/utm.h ../../lib/alg/generic/Transform.h ../../lib/rgoose/rgooseTargetFilter.h ../../lib/components/base/basicEvent.h +$(OUTDIR)/rgooseNodeFactory.o: ../../lib/rgoose/rgooseNodeFactory.cpp ../../lib/rgoose/rgooseNodeFactory.h ../../lib/rgoose/rgooseNode.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/utm.h ../../lib/alg/generic/Transform.h ../../lib/rgoose/rgooseTargetFilter.h ../../lib/components/base/basicEvent.h ../../lib/rgoose/rgooseIPCamera.h ../../lib/rgoose/rgooseNode3D.h ../../lib/components/base/basicEngine.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicDualThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicEventHeap.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/utm.h ../../lib/alg/generic/Transform.h ../../lib/components/object/objectSystemAnchor.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/alg/lgs/mask.h ../../lib/data/net/clientPort.h ../../lib/data/transport/transportSocket.h ../../lib/components/base/basicDualThread.h ../../lib/components/base/basicTransport.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicLogCollection.h ../../lib/data/protocol/protocolLGS3D_client.h ../../lib/data/protocol/protocolLGS3D.h ../../lib/data/protocol/protocol.h ../../lib/alg/lgs/detectorStructures.h ../../lib/data/protocol/protocolLGS_data.h ../../lib/alg/lgs/detectorStructures.h ../../lib/alg/lgs/mask.h ../../lib/hardware/soc/general/3DLRF.h ../../lib/rgoose/rgooseNode.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/utm.h ../../lib/alg/generic/Transform.h ../../lib/rgoose/rgooseTargetFilter.h ../../lib/components/base/basicEvent.h ../../lib/rgoose/rgooseNode2D.h ../../lib/rgoose/rgooseNode.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/utm.h ../../lib/alg/generic/Transform.h ../../lib/rgoose/rgooseTargetFilter.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicEventHeap.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/utm.h ../../lib/alg/generic/Transform.h ../../lib/components/object/objectSystemAnchor.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/alg/lgs/mask.h ../../lib/data/protocol/protocolLGS2D.h ../../lib/data/protocol/protocol.h ../../lib/data/protocol/protocolLGS_data.h ../../lib/alg/lgs/detectorStructures.h ../../lib/alg/lgs/mask.h ../../lib/rgoose/rgooseNodePTZCamControl.h ../../lib/rgoose/rgooseCamera.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicMutex.h ../../lib/data/protocol/protocolPTZ.h ../../lib/data/protocol/protocol.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicTransport.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicLogCollection.h ../../lib/data/media/video/videoAVLIBSource.h ../../lib/components/base/basicEventHeap.h ../../lib/rgoose/rgooseDBConnector.h ../../lib/rgoose/rgooseTypes.h ../../lib/rgoose/rgooseNode.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/utm.h ../../lib/alg/generic/Transform.h ../../lib/rgoose/rgooseTargetFilter.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicEventHandler.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicEventHeap.h ../../lib/rgoose/rgooseNodeStaticCamControl.h ../../lib/rgoose/rgooseCamera.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicMutex.h ../../lib/data/protocol/protocolPTZ.h ../../lib/data/protocol/protocol.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicTransport.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicLogCollection.h ../../lib/data/media/video/videoAVLIBSource.h ../../lib/components/base/basicEventHeap.h ../../lib/rgoose/rgooseDBConnector.h ../../lib/rgoose/rgooseTypes.h ../../lib/rgoose/rgooseNode.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/utm.h ../../lib/alg/generic/Transform.h ../../lib/rgoose/rgooseTargetFilter.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicEventHandler.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicEventHeap.h ../../lib/alg/generic/heapDebug.h +$(OUTDIR)/rgooseNodePTZCamControl.o: ../../lib/rgoose/rgooseNodePTZCamControl.cpp ../../lib/rgoose/rgooseNodePTZCamControl.h ../../lib/rgoose/rgooseCamera.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicMutex.h ../../lib/data/protocol/protocolPTZ.h ../../lib/data/protocol/protocol.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicTransport.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicLogCollection.h ../../lib/data/media/video/videoAVLIBSource.h ../../lib/components/base/basicEventHeap.h ../../lib/rgoose/rgooseDBConnector.h ../../lib/rgoose/rgooseTypes.h ../../lib/rgoose/rgooseNode.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/utm.h ../../lib/alg/generic/Transform.h ../../lib/rgoose/rgooseTargetFilter.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicEventHandler.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicEventHeap.h +$(OUTDIR)/rgooseNodeStaticCamControl.o: ../../lib/rgoose/rgooseNodeStaticCamControl.cpp ../../lib/rgoose/rgooseNodeStaticCamControl.h ../../lib/rgoose/rgooseCamera.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicMutex.h ../../lib/data/protocol/protocolPTZ.h ../../lib/data/protocol/protocol.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicTransport.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicLogCollection.h ../../lib/data/media/video/videoAVLIBSource.h ../../lib/components/base/basicEventHeap.h ../../lib/rgoose/rgooseDBConnector.h ../../lib/rgoose/rgooseTypes.h ../../lib/rgoose/rgooseNode.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/utm.h ../../lib/alg/generic/Transform.h ../../lib/rgoose/rgooseTargetFilter.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicEventHandler.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicEventHeap.h +$(OUTDIR)/rgooseServerModule.o: ../../lib/rgoose/rgooseServerModule.cpp ../../lib/rgoose/rgooseServerModule.h ../../lib/rgoose/rgooseDBConnector.h ../../lib/rgoose/rgooseTypes.h ../../lib/rgoose/rgooseModule.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicEventHandler.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicEvent.h $(OUTDIR)/rgooseTargetFilter.o: ../../lib/rgoose/rgooseTargetFilter.cpp ../../lib/rgoose/rgooseTargetFilter.h ../../lib/components/base/basicEvent.h $(OUTDIR)/serverPort.o: ../../lib/data/net/serverPort.cpp ../../lib/data/net/serverPort.h ../../lib/data/transport/transportSocket.h ../../lib/components/base/basicDualThread.h ../../lib/components/base/basicTransport.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicLogCollection.h $(OUTDIR)/servletChannelWS.o: ../../lib/data/servletWS/servletChannelWS.cpp ../../lib/data/servletWS/servletChannelWS.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h diff --git a/lib/App/3dSERVER/LRF_ClientHandler.cpp b/lib/App/3dSERVER/LRF_ClientHandler.cpp index 25e10e14..d2ce67fc 100644 --- a/lib/App/3dSERVER/LRF_ClientHandler.cpp +++ b/lib/App/3dSERVER/LRF_ClientHandler.cpp @@ -21,7 +21,7 @@ #define DATA_BEGIN_IDX 6 // Constructor implementation -LRF_ClientHandler::LRF_ClientHandler( int SockFD, basicEngine *ptr ) : networkClientHandler( SockFD, ptr ), protocolLGS3D_Server(){ +LRF_ClientHandler::LRF_ClientHandler( int SockFD, networkServiceEngine *ptr ) : networkClientHandler( SockFD, ptr ), protocolLGS3D_Server(){ m_pLog = basicLogCollection::getInstance(); m_pWorkingSAF = NULL; @@ -58,7 +58,7 @@ LRF_ClientHandler::~LRF_ClientHandler(){ # endif }; -bool LRF_ClientHandler::attachEngine( basicEngine *ptr ){ +bool LRF_ClientHandler::attachEngine( networkServiceEngine *ptr ){ m_pKernelEngine = (LRF_Kernel *) ptr; if( m_pKernelEngine!= NULL ) { m_bKernelWM = m_pKernelEngine->getWM(); @@ -76,11 +76,14 @@ bool LRF_ClientHandler::getStatus( void ){ bool LRF_ClientHandler::packetHandler( protocolPackage *Package ){ if( Package != NULL ) { -#ifdef DUBUG_COMMUNICATION +#ifdef DEBUG + char tBuffer[256]; + #ifdef DUBUG_COMMUNICATION LOG("Package Handler"); - char tBuffer[256]; + sprintf( tBuffer, "Package Code: %d 0x%02X", Package->m_nCode, Package->m_nCode ); LOG( tBuffer ); + #endif #endif switch(Package->m_nCode){ case CMD_STATE: @@ -96,6 +99,7 @@ bool LRF_ClientHandler::packetHandler( protocolPackage *Package ){ // Set Working to translate Targets //m_bClientWorkingMode = CWM_PINGPONG; setWM( CWM_INIT ); + //setWM( CWM_IDLE ); break; case CMD_QUIT: #ifdef DEBUG @@ -112,6 +116,27 @@ bool LRF_ClientHandler::packetHandler( protocolPackage *Package ){ setWM( CWM_INIT ); m_pKernelEngine->reset( false ); break; + case CMD_QUERY_TWINK_LINK: +#ifdef DEBUG + LOG("TWINC Check"); +#endif + if( m_pKernelEngine != NULL ) { + LRF_TwinConnector *tTWINC = m_pKernelEngine->getTwinConnector(); + if( tTWINC != NULL ) { + TWIN_STATUS *tSTATUS = tTWINC->getSystemStatus(); + uint8_t status = 0; + if( tSTATUS->VERSION_IS_SYNCED ) status = 0x01; + if( tSTATUS->SETTINGS_IS_SYNCED ) status |= 0x02; + if( tSTATUS->SHADOW_IS_SYNCED ) status |= 0x04; + sendTwinLinkACK( status ); + } else { + sendNACK( CMD_QUERY_TWINK_LINK ); + }; + } else { + sendNACK( CMD_QUERY_TWINK_LINK ); + }; + setWM( CWM_IDLE ); + break; case CMD_MODE: if( Package->m_pData[SUB_CMD_IDX] & 0x80 ){ // Flag to SET Mode U8 Byte = Package->m_pData[SUB_CMD_IDX] & MODE_MASK; @@ -149,6 +174,8 @@ bool LRF_ClientHandler::packetHandler( protocolPackage *Package ){ setWM( CWM_INIT ); m_pKernelEngine->reset( false ); break; + + case CMD_SET_ACTIVE_PROFILE: // Work Around oold 3D Client Software case CMD_GET_PARAMETERS: case CMD_PARAMETERS: #ifdef DEBUG @@ -235,8 +262,12 @@ bool LRF_ClientHandler::packetHandler( protocolPackage *Package ){ if( SampleID == 0 ){ # ifdef DEBUG LOG("Requesting TH access"); -# endif - m_pWorkingSAF = m_pKernelEngine->getTreshold( m_nWorkingSAF, SelectedLRF ); +# endif + //m_pWorkingSAF = m_pKernelEngine->getTreshold(m_nWorkingSAF, SelectedLRF); + if ( m_pKernelEngine ) { + LRF_TwinConnector *tTWINC = m_pKernelEngine->getTwinConnector(); + m_pWorkingSAF = tTWINC->getTreshold( m_nWorkingSAF, SelectedLRF ); + }; }; if( m_pWorkingSAF != NULL ) { m_nCurrentSampleIDofBoardData = 0; @@ -271,7 +302,7 @@ bool LRF_ClientHandler::packetHandler( protocolPackage *Package ){ #endif sendFullResetACK(); setWM( CWM_INIT ); - m_pKernelEngine->reset(true); + m_pKernelEngine->reset( true ); break; case CMD_CAMERA: #ifdef DEBUG @@ -314,10 +345,19 @@ bool LRF_ClientHandler::packetHandler( protocolPackage *Package ){ case CMD_STATE_2: if( m_bClientWM != CWM_BORDER ){ if( m_pKernelEngine != NULL ) { - m_bKernelWM = m_pKernelEngine->getWM(); + if( m_pKernelEngine->getRuntimeStatus( &m_sRuntimeStatus ) ){ + m_bKernelWM = m_pKernelEngine->getWM(); + } else { + m_bKernelWM = WM_NONE; + }; } else { m_bKernelWM = WM_NONE; }; + m_mOutputProtector.lock(); + uint8_t tCount = m_oOutputFIFO.size(); + m_mOutputProtector.unlock(); + sendState2( m_bKernelWM, tCount, &m_sRuntimeStatus ); + /* uint8_t tCount = 0; uint8_t * tPData = NULL; @@ -345,10 +385,37 @@ bool LRF_ClientHandler::packetHandler( protocolPackage *Package ){ } else { m_mOutputProtector.unlock(); sendState2( m_bKernelWM ); - }; + }; + */ setWM( CWM_IDLE ); }; break; + case CMD_GET_LAST_EVENTS:{ + uint8_t tCount = 0; + uint8_t * tPData = NULL; + + m_mOutputProtector.lock(); + tCount = m_oOutputFIFO.size(); + if( tCount > 0 ) { + tPData = (uint8_t *) malloc( tCount * sizeof(CLIENT_EVENT)); + if( tPData!= NULL ) { + CLIENT_EVENT * tElm = NULL; + uint8_t * cPtr = tPData; + for( uint8_t index = 0; index < tCount; index++) { + tElm = m_oOutputFIFO.front(); + memcpy( cPtr, tElm, sizeof(CLIENT_EVENT)); + cPtr += sizeof(CLIENT_EVENT); + m_oOutputFIFO.pop(); + free(tElm); + }; + m_mOutputProtector.unlock(); + sendEvents( tCount, tPData ); + free(tPData); + } else m_mOutputProtector.unlock(); + } else m_mOutputProtector.unlock(); + setWM( CWM_IDLE ); + break; + }; case CMD_GET_WIDTH_TABLE: setWM( CWM_PARAMS ); break; @@ -533,9 +600,11 @@ bool LRF_ClientHandler::packetHandler( protocolPackage *Package ){ }; sendGenericACK(true); break; - default: + default: + LOG_ERROR( "Not Implemented Command Was received" ); #ifdef DEBUG - LOG_ERROR( "Not Implemented Command Was received" ); + sprintf( tBuffer, "Package Code: %d 0x%02X SUB: 0x%02X", Package->m_nCode, Package->m_nCode, Package->m_pData[SUB_CMD_IDX] ); + LOG( tBuffer ); #endif break; }; @@ -590,7 +659,7 @@ void LRF_ClientHandler::dispatchEvent( EVENT_CONTAINER *Evt ){ }; if( tCEVT!= NULL ) { m_mOutputProtector.lock(); - while( m_oOutputFIFO.size() >= EVENTS_OUTPUT_QUEUE_MAX ) { + while( m_oOutputFIFO.size() >= EVENTS_OUTPUT_QUEUE_MAX ) { //MAXIMAL_EVENT_COUNT_IN_PACKET CLIENT_EVENT * tt; tt = m_oOutputFIFO.front(); m_oOutputFIFO.pop(); @@ -619,6 +688,7 @@ void LRF_ClientHandler::setWM( CLIENT_WORK_MODE NM ){ }; m_mWMProtector.unlock(); }; + CLIENT_WORK_MODE LRF_ClientHandler::getWM(){ CLIENT_WORK_MODE rV; m_mWMProtector.lock(); @@ -627,6 +697,7 @@ CLIENT_WORK_MODE LRF_ClientHandler::getWM(){ return rV; }; + #undef SIZE_IDX #undef DEV_ID_IDX #undef CMD_IDX diff --git a/lib/App/3dSERVER/LRF_ClientHandler.h b/lib/App/3dSERVER/LRF_ClientHandler.h index a2a44a63..eb2eb094 100644 --- a/lib/App/3dSERVER/LRF_ClientHandler.h +++ b/lib/App/3dSERVER/LRF_ClientHandler.h @@ -31,18 +31,19 @@ class LRF_ClientHandler : public networkClientHandler, public protocolLGS3D_Serv EventsFIFO m_oOutputFIFO; basicMutex m_mOutputProtector; + ALG_RUN_STATUS m_sRuntimeStatus; void setWM( CLIENT_WORK_MODE ); CLIENT_WORK_MODE getWM(); protected: bool packetHandler( protocolPackage *Package ); public: // Constructor - explicit LRF_ClientHandler( int SockFD, basicEngine *ptr = NULL ); + explicit LRF_ClientHandler( int SockFD, networkServiceEngine *ptr = NULL ); // Destructor virtual ~LRF_ClientHandler(); - virtual bool attachEngine( basicEngine *ptr ); + virtual bool attachEngine( networkServiceEngine *ptr ); virtual bool getStatus( void ); void dispatchEvent( EVENT_CONTAINER *Evt ); }; diff --git a/lib/App/3dSERVER/LRF_HardwareManager.cpp b/lib/App/3dSERVER/LRF_HardwareManager.cpp index ed9feba3..6d19ab6c 100644 --- a/lib/App/3dSERVER/LRF_HardwareManager.cpp +++ b/lib/App/3dSERVER/LRF_HardwareManager.cpp @@ -31,12 +31,14 @@ LRF_HardwareManager::LRF_HardwareManager( config_setting_t *SNode ){ } else { m_pSettings = NULL; }; + m_bWorkEnable = true; m_bInitOK = false; m_bDumpMemoryToDisk = false; m_nFlipEnaFLags = 0; m_nDetectionFilter = 0; + m_nTHVisualFlags = 0; m_eSOC = SOC_UNKNOWN; - + memset( &m_sRuntimeStatus, 0, sizeof(HWM_CSTATUS)); #ifdef IGNORE_PRU_FLIP m_bStudyCompleteFlag = 0; m_bDataFilledTH = 0; @@ -607,6 +609,7 @@ bool LRF_HardwareManager::create( HW_PARAMS &HS ){ void LRF_HardwareManager::beginService( void ){ m_bInitOK = false; + m_bWorkEnable = true; #ifndef ONPC_TOTTAL_SIMULATOR if( m_pSOC != NULL ) { LOG("Begin HW init process"); @@ -1008,10 +1011,20 @@ void LRF_HardwareManager::beginService( void ){ }; #else //#ifndef ONPC_TOTTAL_SIMULATOR LOG("Dummy Init of Hardware"); + gsSOFT_INFO.FW_CORE1_VER = 0x01234567; + gsSOFT_INFO.FW_CORE1_TYP = 0x01234567; + gsSOFT_INFO.FW_CORE2_VER = 0x01234567; + gsSOFT_INFO.FW_CORE2_TYP = 0x01234567; + gsSOFT_INFO.FW_CORE3_VER = 0x01234567; + gsSOFT_INFO.FW_CORE3_TYP = 0x01234567; + gsSOFT_INFO.FW_CORE4_VER = 0x01234567; + gsSOFT_INFO.FW_CORE4_TYP = 0x01234567; + gsSOFT_INFO.DATA_VALID = true; m_bInitOK = true; #endif //#ifndef ONPC_TOTTAL_SIMULATOR }; void LRF_HardwareManager::endService( void ){ + m_bWorkEnable = false; #ifndef ONPC_TOTTAL_SIMULATOR if( m_pSOC!=NULL ){ #ifndef PRU_SLAVE @@ -1289,12 +1302,12 @@ bool LRF_HardwareManager::startMotors( bool Auto ){ LOG_ERROR("Thread Creation Faled."); pthread_mutex_unlock( m_pMotorCtrlMutex ); }; -#ifdef DEBUG - // LOG("TH Flip Thread Started"); +#ifdef DEBUG_EXTRA + LOG("TH Flip Thread Started"); #endif } else { -#ifdef DEBUG - // LOG("TH Flip Request Overlapped!"); +#ifdef DEBUG_EXTRA + LOG("TH Flip Request Overlapped!"); #endif }; }; @@ -1454,12 +1467,12 @@ bool LRF_HardwareManager::stopMotors( bool Auto ){ LOG_ERROR("Thread Creation Faled."); pthread_mutex_unlock( m_pMotorCtrlMutex ); }; -#ifdef DEBUG - // LOG("TH Flip Thread Started"); +#ifdef DEBUG_EXTRA + LOG("TH Flip Thread Started"); #endif } else { -#ifdef DEBUG - // LOG("TH Flip Request Overlapped!"); +#ifdef DEBUG_EXTRA + LOG("TH Flip Request Overlapped!"); #endif }; }; @@ -1741,7 +1754,7 @@ bool LRF_HardwareManager::validateCores( void ){ #endif #ifdef THREADED_FLIP if( m_bFlipUnlockRequested ){ - #ifdef DEBUG + #ifdef DEBUG_EXTRA LOG("Unlocking Flip protecting Mutex"); #endif if( m_pFlipMutex != NULL ){ @@ -1770,28 +1783,28 @@ bool LRF_HardwareManager::validateCores( void ){ pthread_mutex_unlock( m_pFlipMutex ); }; } else m_bWaitFirstFlip = false; - #ifdef DEBUG + #ifdef DEBUG_EXTRA LOG("Build Working Threshold Memories MT Mode!"); #endif if( 0 != pthread_create( m_pFlipThreadHandler, NULL, m_fFlipThreadFunction, ( void * ) this ) ) { LOG_ERROR("Thread Creation Faled."); pthread_mutex_unlock( m_pFlipMutex ); }; - #ifdef DEBUG + #ifdef DEBUG_EXTRA LOG("TH Flip Thread Started"); #endif } else { - #ifdef DEBUG - //LOG("TH Flip Request Overlapped!"); + #ifdef DEBUG_EXTRA + LOG("TH Flip Request Overlapped!"); #endif }; } #else //!THREADED_FLIP - #ifdef DEBUG + #ifdef DEBUG_EXTRA LOG("Build Working Threshold Memories NT Mode!"); #endif if( performFlip() ){ - #ifdef DEBUG + #ifdef DEBUG_EXTRA LOG("CORE REQ Done."); #endif } else { @@ -1838,12 +1851,14 @@ bool LRF_HardwareManager::validateCores( void ){ void LRF_HardwareManager::restartService( void ){ m_nFlipEnaFLags = 0; m_nDetectionFilter = 0; + m_nTHVisualFlags = 0; }; bool LRF_HardwareManager::reset( bool Hard ){ uint8_t lrfID; m_nFlipEnaFLags = 0; m_nDetectionFilter = 0; + m_nTHVisualFlags = 0; if( Hard ){ #ifdef DEBUG LOG("Waiting Till Flip Process is Done"); @@ -1945,8 +1960,6 @@ void *LRF_HardwareManager::m_fFlipThreadFunction( void *ptr ){ static uint32_t m_sgnFlipCounter = 0; -#ifdef TH_NEW_FLIP_FUNC - bool LRF_HardwareManager::performFlip( void ){ if( !m_bInitOK ) return false; #ifndef ONPC_TOTTAL_SIMULATOR @@ -1960,13 +1973,22 @@ bool LRF_HardwareManager::performFlip( void ){ int32_t cNodeID; int32_t sNodeID; // Start point bool QAreaOK; - +#ifdef STRONG_STAT + uint32_t cGPCount; + uint32_t cQGPCount; + uint32_t cWGPCount; + uint8_t bLooseQFlags; + uint8_t bGPointsFlags; +#endif th_node[0] = (volatile thresholdNode *) m_pSOC->getTH_MEMORY(); if( th_node[0] != NULL ){ -#ifdef DEBUG_EXTRA +#ifdef DEBUG char Buffer[256]; + #ifdef DEBUG_EXTRA + LOG("Start TH Build Cycle"); sprintf( Buffer, "NF TH pointer is: %p", th_node ); LOG( Buffer ); + #endif #endif th_node[1] = th_node[0]+ TH_SIZE_NODES; th_node[2] = th_node[1]+ TH_SIZE_NODES; @@ -1983,17 +2005,24 @@ bool LRF_HardwareManager::performFlip( void ){ th_node[13] = th_node[12]+ TH_SIZE_NODES; th_node[14] = th_node[13]+ TH_SIZE_NODES; th_node[15] = th_node[14]+ TH_SIZE_NODES; - // Set All TH as full of Good Points - m_nGPointsFlags = m_nKernelFilter; //0xFF - for( LRF_ID = 0; LRF_ID= TH_LINE_NODES ) LocalX -= TH_LINE_NODES; uint32_t CleanID = ( LocalY * TH_LINE_NODES ) + LocalX; + //Masking out WTH Area th_node[8|LRF_ID][CleanID].data = tTN.data; }; }; + //Treat as SUNBIT points as GOOD points + cGPCount++; + cQGPCount++; + cWGPCount++; continue; }; - // if point was measured + if ( ((1 << LRF_ID ) & m_nFlipEnaFLags ) == 0 ) { + //If Building Working TH disabled for TH #ifdef STRONG_STAT - if( tTN.values.cnt >= m_sPARAMETERS.nGPointSamples ){ + if( tTN.values.cnt >= m_sPARAMETERS.nGPointSamples ){ + cGPCount++; + cQGPCount++; + } else { + if( tTN.values.cnt ) { + cGPCount++; + }; + }; #else - if( tTN.values.cnt ){ + if( tTN.values.cnt ){ + cGPCount++; + cQGPCount++; + }; #endif - - cMax = 0; - cMin = 4095; - QAreaOK = true; - for( int x = -m_sPARAMETERS.nOrder; x < (m_sPARAMETERS.nOrder+1); x++ ) { - for( int y = -m_sPARAMETERS.nOrder; y < (m_sPARAMETERS.nOrder+1); y++ ) { - int LocalX = LocalStrideX+x; - int LocalY = LocalStrideY+y; - if( LocalY < 0 ) LocalY += Q_SCAN_COUNT; - if( LocalY >= Q_SCAN_COUNT ) LocalY -= Q_SCAN_COUNT; - if( LocalX < 0 ) LocalX += M_SCAN_POINTS; - if( LocalX >= TH_LINE_NODES ) LocalX -= TH_LINE_NODES; - uint32_t TestID = ( LocalY * TH_LINE_NODES ) + LocalX; - - tTN.data = th_node[LRF_ID][TestID].data; + + } else { + //If Building Working TH enabled for TH #ifdef STRONG_STAT - if( tTN.values.cnt >= m_sPARAMETERS.nGPointSamples ){ + if( tTN.values.cnt >= m_sPARAMETERS.nGPointSamples ){ #else - if( tTN.values.cnt ){ + if( tTN.values.cnt ){ +#endif + // if point was measured + cMax = 0; + cMin = 4095; + QAreaOK = true; + for( int x = -m_sPARAMETERS.nOrder; x < (m_sPARAMETERS.nOrder+1); x++ ) { + for( int y = -m_sPARAMETERS.nOrder; y < (m_sPARAMETERS.nOrder+1); y++ ) { + if( !m_bWorkEnable ) return false; + int LocalX = LocalStrideX+x; + int LocalY = LocalStrideY+y; + if( LocalY < 0 ) LocalY += Q_SCAN_COUNT; + if( LocalY >= Q_SCAN_COUNT ) LocalY -= Q_SCAN_COUNT; + if( LocalX < 0 ) LocalX += M_SCAN_POINTS; + if( LocalX >= TH_LINE_NODES ) LocalX -= TH_LINE_NODES; + uint32_t TestID = ( LocalY * TH_LINE_NODES ) + LocalX; + + tTN.data = th_node[LRF_ID][TestID].data; +#ifdef STRONG_STAT + if( tTN.values.cnt >= m_sPARAMETERS.nGPointSamples ){ +#else + if( tTN.values.cnt ){ #endif - if( cMax < tTN.values.max ) cMax = tTN.values.max; - if( cMin > tTN.values.min ) cMin = tTN.values.min; - } else { - QAreaOK = false; - break; - }; + if( cMax < tTN.values.max ) cMax = tTN.values.max; + if( cMin > tTN.values.min ) cMin = tTN.values.min; + } else { + QAreaOK = false; + break; + }; + }; + if( !QAreaOK ) break; + }; + if( QAreaOK ){ + tTN.values.cnt = 0x0F; + tTN.values.min =(cMin>m_sCP_Detector.offset)?cMin-m_sCP_Detector.offset:0; + tTN.values.max =(cMax<(4095-m_sCP_Detector.offset))?cMax+m_sCP_Detector.offset:4095; + } else { + // disable detection of that point + tTN.values.cnt = 0; + tTN.values.min = 0; + tTN.values.max = 4095; }; - if( !QAreaOK ) break; - }; - if( QAreaOK ){ - tTN.values.cnt = 0x0F; - tTN.values.min =(cMin>m_sCP_Detector.offset)?cMin-m_sCP_Detector.offset:0; - tTN.values.max =(cMax<(4095-m_sCP_Detector.offset))?cMax+m_sCP_Detector.offset:4095; - } else { - // disable detection of that point - tTN.values.cnt = 0; - tTN.values.min = 0; - tTN.values.max = 4095; #ifdef STRONG_STAT - // Clear GoodPoint Flags at not complete TH Measurement - // Turn off TH Clean - m_nGPointsFlags &= ~( 1 << LRF_ID ); + cGPCount++; + cQGPCount++; #endif - }; - } else { - // Not Enought points in values.cnt - // disable detection of that point - tTN.values.cnt = 0; + } else { +#ifdef STRONG_STAT + if( tTN.values.cnt ) { + cGPCount++; + }; +#endif + // Not Enought points in values.cnt + // disable detection of that point + tTN.values.cnt = 0; #ifndef TH_JUST_UPDATE_WORKING - tTN.values.min = 0; - tTN.values.max = 4095; + tTN.values.min = 0; + tTN.values.max = 4095; #endif - // Clear GoodPoint Flags at not measured point - // Turn off TH Clean - m_nGPointsFlags &= ~( 1 << LRF_ID ); - }; + }; #ifdef TH_JUST_UPDATE_WORKING - // Just Update - Without Remove TH Old Info - if( tTN.values.cnt ){ - th_node[8|LRF_ID][LBA_ID].data = tTN.data; - }; + // Just Update - Without Remove TH Old Info + if( tTN.values.cnt ){ + th_node[8|LRF_ID][LBA_ID].data = tTN.data; + cWGPCount++; + }; #else - th_node[8|LRF_ID][LBA_ID].data = tTN.data; + if( tTN.values.cnt ){ + cWGPCount++; + }; + th_node[8|LRF_ID][LBA_ID].data = tTN.data; #endif + }; // If Flip Enabled to Update Working TH };//for lba_id - }; -#ifdef DEBUG_EXTRA - LOG("Finish Cycle"); +#ifdef STRONG_STAT + if ( cGPCount > 600000 ) { + bLooseQFlags |= ( 1 << LRF_ID ); + if( ( 100 + cQGPCount ) >= cGPCount ){ + //Turn On Detection on the Kernel X + bGPointsFlags |= ( 1 << LRF_ID ); + } else { + //Turn Off Detection on the Kernel X + bGPointsFlags &= ~( 1 << LRF_ID ); + }; + }; #endif + m_sRuntimeStatus._GP[LRF_ID] = cQGPCount; + m_sRuntimeStatus._MP[LRF_ID] = cGPCount; + m_sRuntimeStatus._WP[LRF_ID] = cWGPCount; +#ifdef DEBUG + //sprintf( Buffer, "Current TH [AP:MP:QMP:WP] [%d:%d:%d:%d]", TH_SIZE_NODES, cGPCount, cQGPCount, cWGPCount ); + //LOG( Buffer ); +#endif + }; + #ifdef TH_FORCED_BOOM_CLEAN - for( LRF_ID = 0; LRF_ID < KERNEL_COUNT; LRF_ID++ ){ - if( m_nFlipEnaFLags & (1<getTH_MEMORY(); if( tNode != NULL ) { -#ifdef DEBUG_EXTRA +#ifdef DEBUG LOG( "Save Memory Dump!"); #endif FILE *fd; @@ -2177,231 +2271,6 @@ bool LRF_HardwareManager::performFlip( void ){ #endif //#ifndef ONPC_TOTTAL_SIMULATOR }; -#else // TH_NEW_FLIP_FUNC == 0 -bool LRF_HardwareManager::performFlip( void ){ - if( !m_bInitOK ) return false; - if( m_pSOC != NULL ){ - char Buffer[256]; -#ifdef TH_PER_MIRROR - volatile thresholdNode *th_node[40]; -#else - volatile thresholdNode *th_node[16]; -#endif - uint32_t sampleID; - uint8_t lrfID; - uint32_t cMax; - uint32_t cMin; - thresholdNode tTN; - int32_t cNodeID; - int32_t sNodeID; // Start point - uint8_t QAreaOK; - uint8_t i,j; - - th_node[0] = (volatile thresholdNode *) m_pSOC->getTH_MEMORY(); - 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; - th_node[4] = th_node[3]+ TH_SIZE_NODES; - th_node[5] = th_node[4]+ TH_SIZE_NODES; - th_node[6] = th_node[5]+ TH_SIZE_NODES; - th_node[7] = th_node[6]+ TH_SIZE_NODES; - th_node[8] = th_node[7]+ TH_SIZE_NODES; - th_node[9] = th_node[8]+ TH_SIZE_NODES; - th_node[10] = th_node[9]+ TH_SIZE_NODES; - th_node[11] = th_node[10]+ TH_SIZE_NODES; - th_node[12] = th_node[11]+ TH_SIZE_NODES; - th_node[13] = th_node[12]+ TH_SIZE_NODES; - th_node[14] = th_node[13]+ TH_SIZE_NODES; - th_node[15] = th_node[14]+ TH_SIZE_NODES; -#ifdef TH_PER_MIRROR - th_node[16] = th_node[15]+ TH_SIZE_NODES; - th_node[17] = th_node[16]+ TH_SIZE_NODES; - th_node[18] = th_node[17]+ TH_SIZE_NODES; - th_node[19] = th_node[18]+ TH_SIZE_NODES; - th_node[20] = th_node[19]+ TH_SIZE_NODES; - th_node[21] = th_node[20]+ TH_SIZE_NODES; - th_node[22] = th_node[21]+ TH_SIZE_NODES; - th_node[23] = th_node[22]+ TH_SIZE_NODES; - th_node[24] = th_node[23]+ TH_SIZE_NODES; - th_node[25] = th_node[24]+ TH_SIZE_NODES; - th_node[26] = th_node[25]+ TH_SIZE_NODES; - th_node[27] = th_node[26]+ TH_SIZE_NODES; - th_node[28] = th_node[27]+ TH_SIZE_NODES; - th_node[29] = th_node[28]+ TH_SIZE_NODES; - th_node[30] = th_node[29]+ TH_SIZE_NODES; - th_node[31] = th_node[30]+ TH_SIZE_NODES; - th_node[32] = th_node[31]+ TH_SIZE_NODES; - th_node[33] = th_node[32]+ TH_SIZE_NODES; - th_node[34] = th_node[33]+ TH_SIZE_NODES; - th_node[35] = th_node[34]+ TH_SIZE_NODES; - th_node[36] = th_node[35]+ TH_SIZE_NODES; - th_node[37] = th_node[36]+ TH_SIZE_NODES; - th_node[38] = th_node[37]+ TH_SIZE_NODES; - th_node[39] = th_node[38]+ TH_SIZE_NODES; -#endif - sprintf( Buffer, "OF TH pointer is: %p", th_node ); - LOG( Buffer ); - m_nGPointsFlags = 0xFF; -#ifdef DEBUG - //LOG("Performing FLIP in HOST SOC"); -#endif - if( th_node != NULL ){ -#ifdef DEBUG - char tBuffer[128]; - - sprintf(tBuffer, "Start Cycle order: %d Good Points: %d", m_sPARAMETERS.nOrder, m_sPARAMETERS.nGPointSamples ); - LOG( tBuffer ); -#endif - for( sampleID=0; sampleID < TH_SIZE_NODES; sampleID++ ){ - sNodeID = sampleID - ( TH_LINE_NODES + 1 ) * m_sCP_Detector.order; -#ifdef TH_PER_MIRROR - for( lrfID = 0; lrfID < KERNEL_COUNT * Q_MIRROR_COUNT; lrfID++ ){ -#else - for( lrfID = 0; lrfID < KERNEL_COUNT; lrfID++ ){ -#endif - //Filter Kernel - if( ((1 << lrfID ) & m_nKernelFilter ) == 0 ) continue; - // Get Central TH Point - tTN.data = th_node[lrfID][sampleID].data; - // if point was measured - //if( tTN.values.cnt >= m_sCP_Detector.good_points ){ -#ifdef STRONG_STAT - if( tTN.values.cnt >= m_sPARAMETERS.nGPointSamples ){ -#else - if( tTN.values.cnt ){ -#endif - cMax = 0; - cMin = 4095; - QAreaOK = 1; - //for( i = 0; i < (( m_sCP_Detector.order << 1 ) + 1 ); i++ ){ - for( i = 0; i < (( m_sPARAMETERS.nOrder << 1 ) + 1 ); i++ ){ - cNodeID = sNodeID + ( i * TH_LINE_NODES ); - //for( j = 0; j < (( m_sCP_Detector.order << 1 ) + 1 ); j++ ){ - for( j = 0; j < (( m_sPARAMETERS.nOrder << 1 ) + 1 ); j++ ){ - cNodeID ++; - if( cNodeID < 0 ) continue; - if( cNodeID < TH_SIZE_NODES ){ - tTN.data = th_node[lrfID][cNodeID].data; -#ifdef STRONG_STAT - if( tTN.values.cnt >= m_sPARAMETERS.nGPointSamples ){ -#else - if( tTN.values.cnt ){ -#endif - if( cMax < tTN.values.max ) cMax = tTN.values.max; - if( cMin > tTN.values.min ) cMin = tTN.values.min; - } else { - QAreaOK = 0; - break; - }; - }; - }; - if( QAreaOK == 0 ) break; - }; - if( QAreaOK == 0 ){ - // disable detection of that point - tTN.values.cnt = 0; - tTN.values.min = 0; - tTN.values.max = 4095; - } else { - tTN.values.cnt = 0x0F; - tTN.values.min =(cMin>m_sCP_Detector.offset)?cMin-m_sCP_Detector.offset:0; - tTN.values.max =(cMax<(4095-m_sCP_Detector.offset))?cMax+m_sCP_Detector.offset:4095; - }; - } else { // Not Enought points in values.cnt - // disable detection of that point - tTN.values.cnt = 0; -#ifndef TH_JUST_UPDATE_WORKING - tTN.values.min = 0; - tTN.values.max = 4095; -#endif - // Clear GoodPoint Flags at not measured point - m_nGPointsFlags &=~(1<> 2 )][sampleID].data = tTN.data; -#else - th_node[8|lrfID][sampleID].data = tTN.data; -#endif -#ifdef TH_JUST_UPDATE_WORKING - }; -#endif - }; - }; -#ifdef DEBUG - //LOG("Finish Cycle"); -#endif - -#ifdef TH_FORCED_BOOM_CLEAN - for( lrfID = 0; lrfID < KERNEL_COUNT; lrfID++ ){ - if( m_nFlipEnaFLags & (1<getTH_MEMORY(); - if( tNode != NULL ) { - LOG( "Save Memory Dump!"); - FILE *fd; - char tName[64]; - for( int index = 0; index < KERNEL_COUNT; index++ ) { - sprintf( tName, "memdump_%03d-%02d.raw", nMemoryDumpID, index ); - fd = fopen(tName, "wb+"); - if( fd != NULL ) { - uint32_t tSize; - tSize = TH_SIZE_NODES; - fwrite( &tSize, sizeof(uint32_t), 1, fd ); - fwrite( tNode, sizeof(thresholdNode), TH_SIZE_NODES, fd ); - fclose(fd); - } else { - LOG_ERROR( "Mem Dump Failure!"); - }; - tNode += TH_SIZE_NODES; - }; - nMemoryDumpID++; - }; - }; - basicEvent *tEvt = createBasicEvent( 0, EVT_CLASS_SENSOR, EVT_FLIP, Buffer, NULL ); - if( tEvt != NULL ){ - basicEventHeap::getInstance()->broadcast( tEvt ); - // Evt utilisation done by EventHeap thread - tEvt = NULL; - }; -#ifdef HIBERNATE_ENABLE - return saveHibernatedTH(); -#else - return true; -#endif - } else { - LOG_ERROR("Cannot access TH Memory!"); - }; - }; - return false; -}; -#endif //TH_NEW_FLIP_FUNC #ifdef HIBERNATE_ENABLE bool LRF_HardwareManager::saveHibernatedTH( CSTR fname ){ @@ -2460,7 +2329,10 @@ bool LRF_HardwareManager::cleanTH( uint8_t tID ){ if( thPtr ){ thPtr += ( tID & 0x0F ) * TH_SIZE_NODES; int index = 0; // fl|Max|Min - for(; index < TH_SIZE_NODES; thPtr++, index++ ) *thPtr = 0x00000FFF; + for(; index < TH_SIZE_NODES; thPtr++, index++ ){ + if( !m_bWorkEnable ) return false; + *thPtr = 0x00000FFF; + } return true; }; }; @@ -2750,5 +2622,18 @@ void LRF_HardwareManager::saveCurrentParameters( void ){ }; }; +bool LRF_HardwareManager::getRunTimeStat( HWM_CSTATUS *ptr ){ + if ( ptr == NULL ) return false; + memcpy( ptr, &m_sRuntimeStatus, sizeof(HWM_CSTATUS)); + ptr->HW_STATUS = ((m_bWaitFirstFlip)?0x2000:0x00000000) | + ((m_bInitOK)?0x1000:0x00000000) | + #ifndef PRU_SLAVE + *(( uint32_t *) &m_sCS_Motors ) | + #endif + ((m_bDumpMemoryToDisk)?0x4000:0x00000000) | + ((m_bWorkEnable)?0x8000:0x00000000); + return true; +}; + #undef LOG #undef LOG_ERROR diff --git a/lib/App/3dSERVER/LRF_HardwareManager.h b/lib/App/3dSERVER/LRF_HardwareManager.h index 9e8c9483..2bda4184 100644 --- a/lib/App/3dSERVER/LRF_HardwareManager.h +++ b/lib/App/3dSERVER/LRF_HardwareManager.h @@ -117,9 +117,11 @@ class LRF_HardwareManager { E_SOC_TYPE m_eSOC; bool m_bDumpMemoryToDisk; + bool m_bWorkEnable; DT_STATUS m_sCS_Detector; TH_PARAMS m_sCP_Detector; HW_PARAMS m_sHW_Params; + HWM_CSTATUS m_sRuntimeStatus; #ifdef IGNORE_PRU_FLIP uint8_t m_bStudyCompleteFlag; // Used to clean Primary (learning TH) @@ -150,8 +152,8 @@ class LRF_HardwareManager { /* For Flip Purposes */ uint8_t m_nFlipEnaFLags; - uint8_t m_nGPointsFlags; uint8_t m_nDetectionFilter; + uint8_t m_nTHVisualFlags; #ifdef THREADED_FLIP pthread_t *m_pFlipThreadHandler; static void *m_fFlipThreadFunction(void *); @@ -201,6 +203,7 @@ class LRF_HardwareManager { int getWorkingMemoryID( void ); uint32_t *getEventMemory( void ); uint8_t getTargetFilter( void ){ return m_nDetectionFilter; }; + uint8_t getTHVisual( void ){ return m_nTHVisualFlags; }; bool reset( bool Hard ); bool create( HW_PARAMS &HardwareSettings ); bool create( config_setting_t *SNode ); @@ -216,10 +219,11 @@ class LRF_HardwareManager { bool saveHibernatedTH( CSTR fname = "hibernate.dat" ); bool loadHibernatedTH( CSTR fname = "hibernate.dat" ); #endif - uint8_t getDetectionStatus(){ return m_nDetectionFilter; } + uint8_t getDetectionStatus(){ return m_nDetectionFilter; }; #ifdef IGNORE_PRU_FLIP uint8_t getFilledTH( void ){ return m_bDataFilledTH; }; #endif + bool getRunTimeStat( HWM_CSTATUS *tHWS ); }; #endif // __LRF_HARDWAREMANAGER_H_INCL__ diff --git a/lib/App/3dSERVER/LRF_SlimKernel.cpp b/lib/App/3dSERVER/LRF_SlimKernel.cpp index 7a92d105..50521d1f 100644 --- a/lib/App/3dSERVER/LRF_SlimKernel.cpp +++ b/lib/App/3dSERVER/LRF_SlimKernel.cpp @@ -29,7 +29,12 @@ #endif // Constructor implementation +#ifdef PRU_SLAVE LRF_Kernel::LRF_Kernel( LRF_HardwareManager *HM ): basicThread(), basicEngine(){ +#else +LRF_Kernel::LRF_Kernel( LRF_HardwareManager *HM ): basicThread(), networkServiceEngine(){ +#endif + m_bExitCause = 0; m_pLog = basicLogCollection::getInstance(); m_pEventHeap = basicEventHeap::getInstance(); @@ -57,6 +62,7 @@ LRF_Kernel::LRF_Kernel( LRF_HardwareManager *HM ): basicThread(), basicEngine(){ m_pCurrentTH = NULL; m_nCurrentTH = 0; m_bCurrentTH = 0; + m_nForcedDrawTH = 0; m_eWM = WM_NONE; m_nWidth = 800; @@ -82,6 +88,7 @@ LRF_Kernel::~LRF_Kernel(){ #ifdef DEBUG LOG("Shadow Mask - Done"); #endif + if ( m_pCurrentTH ) free( m_pCurrentTH ); #ifdef DEBUG LOG("Destructor Finished"); #endif @@ -95,7 +102,7 @@ LRF_Kernel::~LRF_Kernel(){ m_pNetClientsServer = srvPort; }; if( m_pNetClientsServer!= NULL ) { - return srvPort->attachEngine( (basicEngine *)this ); + return srvPort->attachEngine( this ); }; return false; }; @@ -158,13 +165,17 @@ LRF_Kernel::~LRF_Kernel(){ if( m_pShadow == NULL ) { LOG_ERROR("Failed to create Shadow Mask!"); return false; - }; + } else { + //Load Default Masks + if( m_pShadow->loadVertexes() ) LOG("Vertexeses Loadded!"); + if( m_pShadow->loadRastered() ) LOG("Traces Loadded!"); + }; if( m_pShadow->isActive() ) { LOG("Shadow Mask is ACTIVE"); } else { LOG("Shadow Mask is NOT ACTIVE"); - } + }; if( m_pEventHeap == NULL ){ LOG_ERROR("No Event Heap attached!"); @@ -287,33 +298,77 @@ void LRF_Kernel::m_fThreadProc( void ){ char Buffer[256]; DT_STATUS tStatus = {0}; uint8_t bActiveTH = 0; - uint8_t bOldTH = 0; + uint8_t bMeasuredTH = 0; + uint8_t bDrawedTH = 0; + +#ifdef SIMULATE_TARGETS + uint8_t CCNT = 0; + uint16_t CNNT = 0; +#endif + m_bThreadStatus = TH_WORKING; while( m_bThreadStatus < TH_ENDED ){ +#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 + if( !m_pHardwareManager->validateCores() ){ if( getWM() != WM_ERROR ){ setWM(WM_ERROR); LOG_ERROR("PRU Core Trouble Detected!"); }; } else { + // PRU Cores are valid + bActiveTH = m_nKernelFilter & m_pHardwareManager->getDetectionStatus(); + bMeasuredTH = m_nKernelFilter & m_pHardwareManager->getTHVisual(); switch( getWM() ) { case WM_INIT:{ if( m_pHardwareManager->getCoreStatus( tStatus ) ){ m_pHardwareManager->reset( false ); - if( tStatus.mode == WM_DETECTOR ) setWM( WM_STUDY ); + if( tStatus.mode == WM_DETECTOR ){ + LOG("**********SWITCHING TO STUDY MODE**********"); + setWM( WM_STUDY ); + }; }; break; }; case WM_STUDY:{ - bActiveTH = m_nKernelFilter & m_pHardwareManager->getDetectionStatus(); - if( bActiveTH ) setWM( WM_DETECTOR ); + if( bActiveTH ){ + LOG("**********SWITCHING TO DETECTOR MODE**********"); + setWM( WM_DETECTOR ); + } else { + if( bMeasuredTH != bDrawedTH ){ + LOG("**********SWITCHING TO BORDER MODE**********"); + setWM( WM_BORDER ); + }; + }; break; }; case WM_DETECTOR:{ - bActiveTH = m_nKernelFilter & m_pHardwareManager->getDetectionStatus(); - if( bActiveTH != bOldTH ) { + bActiveTH = m_nKernelFilter & m_pHardwareManager->getTHVisual(); //m_pHardwareManager->getDetectionStatus(); + if( bMeasuredTH != bDrawedTH ) { + LOG("**********SWITCHING TO BORDER MODE**********"); setWM( WM_BORDER ); continue; }; @@ -325,6 +380,8 @@ void LRF_Kernel::m_fThreadProc( void ){ uint32_t cRange; uint32_t cTrackID = 0; EVENT_CONTAINER * tEvt = NULL; + uint8_t bFilter = m_nKernelFilter & m_pHardwareManager->getTargetFilter(); + bActiveRecordsPresent = false; for( int idx = 0; idx < MAX_TARGETS_COUNT; idx++ ){ // Filter Not Active Events @@ -337,10 +394,15 @@ void LRF_Kernel::m_fThreadProc( void ){ // 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 + //if( ((1 << cNode.flags.lrf ) & m_nKernelFilter ) == 0 ){ + // // Abort checking this target since Kernel Disabled + // continue; + //}; + // Filter Events from Disabled Kernels -> goes to flip + if( ((1 << cNode.flags.lrf ) & bFilter ) == 0 ){ + // Abort checking this target since Kernel not Detecting continue; - }; + }; // Abort checking this target since no width if( cNode.flags.w_cnt ){ cRange = cNode.width / cNode.flags.w_cnt; @@ -349,6 +411,7 @@ void LRF_Kernel::m_fThreadProc( void ){ cNode.width = cRange * cNode.flags.w_cnt; #endif } else continue; + bActiveRecordsPresent = true; switch( cNode.flags.type ){ case TARGET_WHITE:{ @@ -463,40 +526,107 @@ void LRF_Kernel::m_fThreadProc( void ){ }; break; }; - case WM_BORDER:{ - if( bActiveTH == 0 ){ - setWM( WM_STUDY ); + case WM_BORDER:{ + if( ( bMeasuredTH == 0 ) && ( m_nForcedDrawTH == 0 ) ){ + LOG("No Measured No Force!"); + bDrawedTH = bMeasuredTH; + if( bActiveTH ) { + LOG("**********SWITCHING TO DETECTOR MODE**********"); + setWM( WM_DETECTOR ); + } else { + LOG("**********SWITCHING TO STUDY MODE**********"); + 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<> 8 ) & 0xFF; + // Force Local TH Draw + for ( uint8_t idx = 0; idx < 16; idx++ ) { + if( ( chVal & (1<requestRemoteDraw( idx ) ){ + m_nForcedDrawTH &=~(1<<(idx+8)); // Clear Flag + break; // from for + }; }; }; }; +#endif } else { - // If Th is cleared - remove old flag to consume newly build TH - if( ( bActiveTH & (1<readyToConsumeTH() ) { + //Finished Build TH + uint32_t THsize; + thresholdNode *tPTR = getTreshold( THsize, idx ); + if ( m_pTWIC->consumeTH( idx, tPTR, THsize ) ) { + m_nForcedDrawTH &=~(1<readyToConsumeTH() ) { + //Finished Build TH + uint32_t THsize; + thresholdNode *tPTR = getTreshold( THsize, idx ); + if ( m_pTWIC->consumeTH( idx, tPTR, THsize ) ) { + //mark as consumed + bDrawedTH |= (1<validateCores() ) setWM( WM_INIT ); + if( m_pHardwareManager->validateCores() ){ + LOG("**********SWITCHING TO INIT MODE**********"); + setWM( WM_INIT ); + } break; }; }; }; - + +#ifdef ONPC_TOTTAL_SIMULATOR + //Simulation Stuff + //bActiveTH = 199; +#endif SLEEP( SLEEP_KERNEL_INTERVAL ); if(( m_lCycleCounter >> 31 )!= 0 ) { @@ -509,8 +639,8 @@ PLGS_3D_PARAMETERS LRF_Kernel::getDetectionParameters( void ){ PLGS_3D_PARAMETERS tParam = NULL; if( m_pHardwareManager != NULL ){ tParam = (PLGS_3D_PARAMETERS) malloc(sizeof(LGS_3D_PARAMETERS)); - memset( tParam, 0 , sizeof(LGS_3D_PARAMETERS)); - if( tParam != NULL ){ + if( tParam != NULL ){ + memset( tParam, 0 , sizeof(LGS_3D_PARAMETERS)); /*TH_PARAMS tThParams; if( m_pHardwareManager->getDetectionParams( tThParams ) ){ tParam->flags.BuildThByCore = tThParams.self_build_ena; @@ -650,12 +780,41 @@ thresholdNode *LRF_Kernel::getTreshold( uint32_t &size, uint8_t kID ){ #else kID = (kID>15)?15:kID; #endif + +#ifdef ONPC_TOTTAL_SIMULATOR + if( m_pCurrentTH == NULL ) { + m_pCurrentTH = (thresholdNode *) malloc( TH_SIZE_BYTES ); + }; + if( m_pCurrentTH != NULL ) { + char fName[64]; + sprintf( fName, "sim_data_%d.raw", kID ); + if( fileExist( fName ) ) { + FILE *fd = fopen( fName, "rb" ); + if( fd != NULL ) { + uint32_t Size = TH_SIZE_NODES; + fread( &Size, sizeof( uint32_t ), 1, fd ); + fread( m_pCurrentTH, sizeof( thresholdNode ), Size, fd ); + fclose( fd ); + }; + } else { + for (int i = 0; i < TH_SIZE_NODES; i++) { + m_pCurrentTH[i].values.min = i; + m_pCurrentTH[i].values.max = i; + m_pCurrentTH[i].values.cnt = 1; + m_pCurrentTH[i].values.sbit = 0; + }; + } + m_bCurrentTH = kID; + size = TH_SIZE_NODES; + return m_pCurrentTH; + }; +#else if( m_pCurrentTH != NULL ) { if ( m_bCurrentTH == kID ) { size = TH_SIZE_NODES; return m_pCurrentTH; } else { - if (m_pHardwareManager != NULL) { + if( m_pHardwareManager != NULL ) { thresholdNode *ptr = m_pHardwareManager->getWorkingMemory(); if( ptr!= NULL ){ memcpy( m_pCurrentTH, ptr+(kID*TH_SIZE_NODES), TH_SIZE_BYTES ); @@ -669,7 +828,7 @@ thresholdNode *LRF_Kernel::getTreshold( uint32_t &size, uint8_t kID ){ }; }; } else { - if (m_pHardwareManager != NULL) { + if( m_pHardwareManager != NULL ){ thresholdNode *ptr = m_pHardwareManager->getWorkingMemory(); if( ptr!= NULL ){ m_pCurrentTH = (thresholdNode *) malloc( TH_SIZE_BYTES ); @@ -682,6 +841,7 @@ thresholdNode *LRF_Kernel::getTreshold( uint32_t &size, uint8_t kID ){ }; }; }; +#endif size = 0; return NULL; }; @@ -708,6 +868,11 @@ bool LRF_Kernel::shutdown( bool Restart ){ setStatus( TH_ENDED ); return true; }; + +void LRF_Kernel::forceDrawTH( uint16_t kMASK ){ + m_nForcedDrawTH |= kMASK; +}; + #ifndef PRU_SLAVE //Just Master Stuff networkClientHandler *LRF_Kernel::attachNewClient( int SocketID ){ LOG("Creating Client Handler!"); @@ -747,6 +912,30 @@ bool LRF_Kernel::shutdown( bool Restart ){ return true; #endif }; + bool LRF_Kernel::getRuntimeStatus( ALG_RUN_STATUS *ptr ){ + if( ptr == NULL ) return false; + memset( ptr, 0, sizeof( ALG_RUN_STATUS )); + ptr->ENABLED_LRF = m_nKernelFilter; + if( m_pHardwareManager ) { + HWM_CSTATUS tHWS; + if( m_pHardwareManager->getRunTimeStat( &tHWS ) ){ + ptr->HW_STATUS = tHWS.HW_STATUS; + ptr->DETECTING_LRF = tHWS._DETECTING_LRF; + ptr->ENABLED_LRF = m_nKernelFilter; + ptr->MASTER_FLIP_CNT = tHWS._FLIP_CNT; + memcpy( ptr->MASTER_MP, tHWS._MP, sizeof(uint32_t) * 8 ); + memcpy( ptr->MASTER_GP, tHWS._GP, sizeof(uint32_t) * 8 ); + memcpy( ptr->MASTER_WP, tHWS._WP, sizeof(uint32_t) * 8 ); + }; + } else return false; + if( m_pTWIC ) { + TWIN_STATUS * tPPP = m_pTWIC->getSystemStatus(); + if (tPPP->VERSION_IS_SYNCED ) ptr->TWINC_STATUS = 1; + if (tPPP->SETTINGS_IS_SYNCED ) ptr->TWINC_STATUS |= 2; + if (tPPP->SHADOW_IS_SYNCED ) ptr->TWINC_STATUS |= 4; + } else return false; + return true; + }; #endif #undef LOG diff --git a/lib/App/3dSERVER/LRF_SlimKernel.h b/lib/App/3dSERVER/LRF_SlimKernel.h index 7de67233..fcfdbb0a 100644 --- a/lib/App/3dSERVER/LRF_SlimKernel.h +++ b/lib/App/3dSERVER/LRF_SlimKernel.h @@ -19,7 +19,6 @@ //#define TH_USE_PICTURES #include "../../components/base/basicThread.h" -#include "../../components/base/basicEngine.h" #include "../../components/base/basicSettingsProvider.h" #include "../../components/base/basicEventHeap.h" #include "LRF_HardwareManager.h" @@ -28,7 +27,10 @@ #include "../../alg/lgs/detector.h" #include "../../alg/lgs/mask.h" -#ifndef PRU_SLAVE +#ifdef PRU_SLAVE + #include "../../components/base/basicEngine.h" +#else + #include "../../data/net/netServiceEngine.h" #include "../../data/net/netServer.h" #include "LRF_TargetTracker.h" #endif @@ -53,8 +55,11 @@ * * @author gagua */ - +#ifdef PRU_SLAVE class LRF_Kernel: public basicThread, public basicEngine{ +#else +class LRF_Kernel: public basicThread, public networkServiceEngine{ +#endif private: basicLogCollection * m_pLog; LRF_HardwareManager * m_pHardwareManager; @@ -83,6 +88,7 @@ class LRF_Kernel: public basicThread, public basicEngine{ thresholdNode * m_pCurrentTH; uint32_t m_nCurrentTH; uint8_t m_bCurrentTH; + uint16_t m_nForcedDrawTH; protected: void m_fThreadProc( void ); @@ -94,19 +100,20 @@ class LRF_Kernel: public basicThread, public basicEngine{ virtual ~LRF_Kernel(); #ifdef PRU_SLAVE - bool create( LRF_HardwareManager *ptr = NULL ); + bool create( LRF_HardwareManager *ptr = NULL ); #else bool attachNetServer( networkServer *srvPort ); virtual networkClientHandler * attachNewClient( int SocketID ); virtual bool detachClient( networkClientHandler *ptr ); - bool create( LRF_HardwareManager *ptr = NULL, networkServer *srvPort = NULL ); + bool create( LRF_HardwareManager *ptr = NULL, networkServer *srvPort = NULL ); - bool stopMotors( void ); - bool startMotors( void ); + bool stopMotors( void ); + bool startMotors( void ); + bool getRuntimeStatus( ALG_RUN_STATUS *ptr ); #endif - void WaitFinish( bool Force = false ); + void WaitFinish( bool Force = false ); /* functional API */ bool askReset( void ); @@ -115,6 +122,9 @@ class LRF_Kernel: public basicThread, public basicEngine{ bool getParameters( void ); thresholdNode * getTreshold( uint32_t &size, uint8_t kID=0 ); ShadowMask * getShadowMask( void ){ return m_pShadow; }; + uint8_t getFilteredKernels(void){ return (m_nKernelFilter & 0xff); }; + uint8_t getDetectionKernels(void){ return 0xff; }; + void forceDrawTH( uint16_t kMASK ); void setWM( LRF_WORK_MODE nMode ); bool setOffset( uint8_t nOffset ); bool setOrder( uint8_t nOrder ); @@ -124,6 +134,9 @@ class LRF_Kernel: public basicThread, public basicEngine{ bool reset( bool FullRestart = false ); bool shutdown( bool Restart = false ); uint8_t getExitCause( void ){ return m_bExitCause; }; + LRF_TwinConnector * getTwinConnector( void ){ return m_pTWIC; }; + + }; #endif // __LRF_KERNEL_H_INCL__ diff --git a/lib/App/3dSERVER/LRF_TargetTracker.cpp b/lib/App/3dSERVER/LRF_TargetTracker.cpp index 8a41c1a7..8bbd198a 100644 --- a/lib/App/3dSERVER/LRF_TargetTracker.cpp +++ b/lib/App/3dSERVER/LRF_TargetTracker.cpp @@ -186,18 +186,66 @@ 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_EXTRA +#ifdef DEBUG LOG("Validate Target"); #endif + if( TR == NULL ){ + LOG_ERROR( "Target Record is Invalid!" ); + return -1; + }; + + if( TR->flags.type != TARGET_BLACK && TR->flags.type != TARGET_WHITE ){ +#ifdef DEBUG + LOG("Unknown Target Type [possible error!]"); +#endif + return 0; + }; + // Filter Width if( TR->width < m_nWidth ){ -#ifdef DEBUG_EXTRA +#ifdef DEBUG sprintf( tBuff, "Target Dropped By Filter Width[%d] > %d !", m_nWidth, TR->width ); LOG( tBuff ); #endif return 0; }; + if ( TR->begin_id > TH_SIZE_NODES ) { +#ifdef DEBUG + sprintf( tBuff, "Target Dropped By Filter Begin ID[%d] > %d !", TR->begin_id, TH_SIZE_NODES ); + LOG( tBuff ); +#endif + return 0; + }; + + if ( TR->end_id > TH_SIZE_NODES ) { +#ifdef DEBUG + sprintf( tBuff, "Target Dropped By Filter End ID[%d] > %d !", TR->end_id, TH_SIZE_NODES ); + LOG( tBuff ); +#endif + return 0; + }; + + if( TR->range_max > 4000 ) { +#ifdef DEBUG + sprintf( tBuff, "Target Dropped By Range Max[%d] > %d !", TR->range_max, 4000 ); + LOG( tBuff ); +#endif + return 0; + }; + + if( TR->range_min > 4000 ) { +#ifdef DEBUG + sprintf( tBuff, "Target Dropped By Range Min[%d] > %d !", TR->range_min, 4000 ); + LOG( tBuff ); +#endif + return 0; + }; + +#ifdef DEBUG + LOG("All Seems to be OK"); +#endif + m_nSTS++; pTREC = createTrackingRecord( TR, bIsMaster ); if( pTREC == NULL ) { @@ -211,14 +259,15 @@ int LRF_TargetTracker::validateTarget( targetRecord *TR, bool bIsMaster ){ tData = (CLIENT_EVENT *) malloc(sizeof(CLIENT_EVENT)); if( tData!= NULL ) { EVENT_CONTAINER *tEvt = NULL; - tData->a_th_node = 0; + tData->a_th_node = pTREC->beginID;//0; tData->k_id = pTREC->kernelID | ( (pTREC->bMaster )?0x00:0x08 ); tData->range = pTREC->reducedRange; - tData->th_id = (( pTREC->beginColumn + pTREC->endColumn ) >> 1 ) + ( ( pTREC->beginRow + pTREC->endRow ) >> 1 ) * TH_LINE_NODES; + //tData->th_id = (( pTREC->beginColumn + pTREC->endColumn ) >> 1 ) + ( ( pTREC->beginRow + pTREC->endRow ) >> 1 ) * TH_LINE_NODES; + tData->th_id = pTREC->endID;//pTREC->beginID + ((pTREC->endID - pTREC->beginID ) >> 1 ); tData->w_cnt = pTREC->areaCount; tData->uts = pTREC->nUTS; tData->ums = pTREC->nUTmS; -#ifdef DISABLE_FRENDLY_MESSAGES + #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 ); @@ -226,14 +275,23 @@ 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, NULL, (void *)tData ); }; -#else - sprintf( tBuff, "Target[%d] T:[%d] R:[%d] C:[%d] R:[%d] W:[%d]", + #else + /*sprintf( tBuff, "Target[%d] T:[%d] R:[%d] C:[%d] R:[%d] W:[%d]", 0, pTREC->bType, pTREC->reducedRange, pTREC->beginColumn, pTREC->beginRow, - pTREC->area ); + pTREC->area );*/ + sprintf( tBuff, "Type[%d] K[%d] R[%d] THA[%d] THB[%d] AA[%d] W[%d]", + tData->type, + tData->k_id, + tData->range, + tData->a_th_node, + tData->th_id, + TH_SIZE_NODES, + tData->w_cnt ); + if( pTREC->bType ) { tData->type = EVT_TARGET_3D_WHITE; tEvt = createBasicEvent( 0, EVT_CLASS_SENSOR_3D, EVT_TARGET_3D_WHITE, NULL, tBuff, (void *)tData ); @@ -241,7 +299,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 + #endif 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 779a0ede..041cdb70 100644 --- a/lib/App/3dSERVER/LRF_TwinConnector.cpp +++ b/lib/App/3dSERVER/LRF_TwinConnector.cpp @@ -36,20 +36,19 @@ LRF_TwinConnector::LRF_TwinConnector( config_setting_t *Settings ): basicThread( m_pLog = basicLogCollection::getInstance(); m_pSettings = basicSettingsProvider::getInstance()->getSubNode( Settings, (CSTR)"TWIN_3DLRF_CONNECTION" ); m_pEngine = NULL; - m_pCurrentTH = NULL; + m_pCurrentTH = NULL; m_bDrawThreadStatus = TH_PRE_INIT; + m_eWM = TWI_STAGE_NO_AKTIVE; #ifdef PRU_SLAVE m_nMasterPort = 0; memset( m_cMasterAddress, 0 , 16 ); - m_eWM = TWI_STAGE_WAITING_CONNECTION; - memset(&m_sSystemStatus,0, sizeof(TWI_PEER_STATUS)); #else + m_pSlaveShadowMask = NULL; m_nMainSocket = -1; m_nBindPort = 0; memset( m_cBindAddress, 0, 16 ); - m_eWM = TWI_STAGE_BEFORE_BIND; - cleanupInfo(); #endif + cleanupInfo(); }; LRF_TwinConnector::~LRF_TwinConnector(){ @@ -60,7 +59,8 @@ LRF_TwinConnector::~LRF_TwinConnector(){ if( m_oDataTransport != NULL ) delete( (clientPort *) m_oDataTransport ); #else if( m_oDataTransport != NULL ) delete( (serverPort *) m_oDataTransport ); -#endif +#endif + cleanupInfo(); }; void LRF_TwinConnector::setWM( TWI_WM NWM ){ @@ -92,8 +92,31 @@ TWIN_COMMAND LRF_TwinConnector::getCMD(){ return rv; }; +#ifndef PRU_SLAVE + +thresholdNode *LRF_TwinConnector::getTreshold( uint32_t &size, uint8_t kID ){ + char tFN[64]; + sprintf( tFN, "data/th_data_%d.raw", kID ); + size = 0; + if( fileExist( tFN ) ){ + if ( m_pCurrentTH == NULL ) { + m_pCurrentTH = (thresholdNode *) malloc( TH_SIZE_BYTES ); + }; + if( m_pCurrentTH != NULL ) { + if( loadTHData( kID, m_pCurrentTH )){ + size = TH_SIZE_NODES; + } else { + return NULL; + }; + }; + }; + return m_pCurrentTH; +}; + +#endif + bool LRF_TwinConnector::readyToConsumeTH( void ){ - if ( m_mDrawProtector.try_lock()) { + if ( m_mDrawProtector.try_lock() ) { m_mDrawProtector.unlock(); return true; }; @@ -101,10 +124,37 @@ bool LRF_TwinConnector::readyToConsumeTH( void ){ }; bool LRF_TwinConnector::consumeTH( uint8_t kID, thresholdNode *ptr, uint32_t THsize ){ + /* + // 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( m_mDrawProtector.try_lock() ) { +#ifdef DEBUG + LOG("Mutex Grabed"); +#endif + if( m_bDrawThreadStatus > TH_ARMED ) { + pthread_join( m_sDrawThreadHandler, NULL ); + }; + cDrawTO = cMilliseconds; + m_bDrawThreadStatus = TH_ARMED; + int RetVal = pthread_create( &m_sDrawThreadHandler, NULL, m_fDrawThreadEntryPoint, ( void * ) this ); + if( RetVal == -1 ) { + LOG_ERROR("Image Draw Thread Creation Failed."); + m_mDrawProtector.unlock(); + }; + }; + }; + */ int RetVal; if ( ptr == NULL) return false; if ( THsize == 0 ) return false; + m_mDrawProtector.lock(); + m_mStatusProtector.lock(); #ifdef PRU_SLAVE m_sSystemStatus.TH_READY &= ~(1 << kID); @@ -114,8 +164,26 @@ bool LRF_TwinConnector::consumeTH( uint8_t kID, thresholdNode *ptr, uint32_t THs m_mStatusProtector.unlock(); cleanTHData( kID ); - - + char tBuffer[64]; + sprintf( tBuffer, "data/th_data_%d.raw", kID ); +#ifdef DEBUG + LOG("SAVE TH Data ..."); + LOG( tBuffer ); +#endif + FILE *fd; + fd = fopen( tBuffer, "wb+"); + if( fd != NULL ){ + //uint32_t Size = TH_SIZE_NODES; + fwrite( &THsize, sizeof( uint32_t ), 1, fd ); + fwrite( ptr, sizeof( thresholdNode ), THsize, fd ); + fclose( fd ); + } else { + LOG_ERROR("TH RAW save failure!"); + }; +#ifdef DEBUG + LOG("SAVE TH Data DONE!"); +#endif + /* if( m_bDrawThreadStatus > TH_ARMED ) { RetVal = pthread_join( m_sDrawThreadHandler, NULL ); if( RetVal != 0 ){ @@ -130,11 +198,17 @@ bool LRF_TwinConnector::consumeTH( uint8_t kID, thresholdNode *ptr, uint32_t THs if( RetVal == -1 ) { LOG_ERROR("Image Draw Thread Creation Failed."); m_mDrawProtector.unlock(); - }; + }; + */ + m_mDrawProtector.unlock(); return true; }; #ifdef PRU_SLAVE + void LRF_TwinConnector::cleanupInfo(void){ + memset( &m_sSystemStatus, 0, sizeof( TWI_PEER_STATUS )); + m_bOldTHRecords = 0; + }; bool LRF_TwinConnector::create(){ if( m_pSettings!= NULL ) { config_setting_t *pSetting; @@ -170,7 +244,7 @@ bool LRF_TwinConnector::consumeTH( uint8_t kID, thresholdNode *ptr, uint32_t THs return false; }; if( !protocolInternalLRF3D_SLAVE::create() ) return false; - m_eWM = TWI_STAGE_WAITING_CONNECTION; + m_eWM = TWI_STAGE_CONNECTING; return init(); }; @@ -179,36 +253,33 @@ bool LRF_TwinConnector::consumeTH( uint8_t kID, thresholdNode *ptr, uint32_t THs if( Package == NULL ) return false; 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_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_SHADOW_INFO: + case TWC_GET_CONFIG: + case TWC_GET_STATUS: + case TWC_GET_SHADOW_TRACE: case TWC_GET_VERSION:{ - LOG("Get Version"); - sendVersion( &gsSOFT_INFO ); + LOG("Generic CMD->Queued!"); + pushCMD( cCMD ); break; }; + case TWC_SET_CONFIG:{ + pushCMD( TWC_SET_CONFIG, Package->m_pData+TWI_PLS_INDEX ,sizeof(LGS_3D_PARAMETERS)); + break; + } case TWC_GET_MODE:{ LOG("Get Mode"); sendMode( getWM() ); break; }; + case TWC_GET_SHADOW_POLY:{ + pushCMD( TWC_GET_SHADOW_POLY, Package->m_pData+TWI_PLS_INDEX , 1 ); + break; + }; }; return true; }; @@ -218,6 +289,7 @@ bool LRF_TwinConnector::consumeTH( uint8_t kID, thresholdNode *ptr, uint32_t THs /// Nothing void LRF_TwinConnector::m_fThreadProc( void ){ TWI_CMD_CONTAINER * tCMD = NULL; + char tB[128]; int ClientSocket = -1; struct sockaddr ClientAddress; socklen_t ClientAddressSize; @@ -230,44 +302,21 @@ bool LRF_TwinConnector::consumeTH( uint8_t kID, thresholdNode *ptr, uint32_t THs while( m_bThreadStatus < TH_ENDED ){ cMilliseconds = getMilliseconds(); - - /* - // TH Saving procedure - if ( ( cMilliseconds - cDrawTO ) > TWI_DRAW_LOOP_MS ){ - if( m_mDrawProtector.try_lock() ) { - // The Mutex will be unlocked by the End of the thread procedure - int RetVal; - - if( m_bDrawThreadStatus > TH_ARMED ) { - RetVal = pthread_join( m_sDrawThreadHandler, NULL ); - if( RetVal != 0 ){ - LOG_ERROR("Thread Join Error!"); - }; - }; - - 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(); - } else cDrawTO = cMilliseconds; - - }; - }; - */ - - if ( getWM() >= TWI_STAGE_CONNECTED ) { + TWI_WM cWM = getWM(); + if ( cWM > TWI_STAGE_CONNECTING ) { if( m_oDataTransport!= NULL ) { if (m_oDataTransport->getConnectionStatus() == CS_DISCONNECTED) { - setWM( TWI_STAGE_WAITING_CONNECTION ); + setWM( TWI_STAGE_CONNECTING ); continue; }; - } else LOG_ERROR("Port Object Missed!"); + } else { + LOG_ERROR("Port Object Missed!"); + m_bThreadStatus = TH_ENDED; + continue; + }; }; - switch( getWM() ) { - case TWI_STAGE_WAITING_CONNECTION:{ + switch( cWM ) { + case TWI_STAGE_CONNECTING:{ if( m_oDataTransport != NULL ){ delete( (clientPort *) m_oDataTransport ); m_oDataTransport = NULL; @@ -277,43 +326,155 @@ bool LRF_TwinConnector::consumeTH( uint8_t kID, thresholdNode *ptr, uint32_t THs if( tPort->create() ){ setTransport( tPort ); setWM( TWI_STAGE_CONNECTED ); + cStatusTO = cMilliseconds; + cleanupInfo(); } else { delete( tPort ); SLEEP( TWI_SLOW_LOOP_SLEEP ); }; - } else LOG_ERROR( "Port Not Created!"); + } else { + LOG_ERROR( "Port Not Created!"); + m_bThreadStatus = TH_ENDED; + continue; + }; }; 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; - }; - //case + case TWI_STAGE_CONNECTED:{ + //Cleanup Queue + m_mQUEUEProtector.lock(); + while( !m_qCMD.empty() ) { + TWI_CMD_CONTAINER *ptr = m_qCMD.front(); + if (ptr->DATA) free(ptr->DATA); + free( ptr ); + m_qCMD.pop(); }; + m_mQUEUEProtector.unlock(); + setWM( TWI_STAGE_IDLE ); break; }; - case TWI_STAGE_EVENT_MODE:{ + case TWI_STAGE_IDLE:{ //Fetch Event from Queue and send to master - + tCMD = fetchCMD(); + if( tCMD != NULL ){ + LOG("CMD Fetched!"); + switch( tCMD->CMD ){ + case TWC_GET_STATUS: sendStatus( &m_sSystemStatus ); break; + case TWC_PUSH_TARGET: if( tCMD->DATA ) sendTarget( (targetRecord *) tCMD->DATA ); break; + case TWC_GET_VERSION: sendVersion( &gsSOFT_INFO ); break; + case TWC_GET_CONFIG:{ + if( m_pEngine != NULL ){ + PLGS_3D_PARAMETERS tPTR = m_pEngine->getDetectionParameters(); + if ( tPTR ) { + sendDetectionParameters( tPTR ); + free( tPTR ); + } else { + sendNACK( TWC_SET_CONFIG ); + }; + } else { + sendNACK( TWC_SET_CONFIG ); + }; + break; + }; + case TWC_SET_CONFIG:{ + if( ( m_pEngine != NULL ) && ( tCMD->DATA != NULL ) ) { + if( m_pEngine->setDetectionParameters( ( PLGS_3D_PARAMETERS ) tCMD->DATA ) ){ + sendACK( TWC_SET_CONFIG ); + } else { + sendNACK( TWC_SET_CONFIG ); + }; + } else { + sendNACK( TWC_SET_CONFIG ); + }; + break; + }; + case TWC_GET_SHADOW_INFO:{ + if( m_pEngine != NULL ) { + ShadowMask *tPTR = m_pEngine->getShadowMask(); + if( tPTR!= NULL ) { + TWI_MASK_INFO tInfo; + tInfo.active = tPTR->isActive(); + tInfo.poly_cnt = tPTR->getPolyCount(); + tInfo.ray_cnt = tPTR->getRayCount(); + sprintf( tB, "ShadowInfo: A:[%d] P:[%d] R:[%d]", tInfo.active, tInfo.poly_cnt, tInfo.ray_cnt ); + LOG( tB ); + sprintf( tB, "ShadowInfo: A:[%d] P:[%d] R:[%d]", tPTR->isActive(), tPTR->getPolyCount(), tPTR->getRayCount() ); + LOG( tB ); + sendShadowInfo( &tInfo ); + } else { + sendNACK( TWC_GET_SHADOW_INFO ); + }; + } else { + sendNACK( TWC_GET_SHADOW_INFO ); + }; + break; + }; + case TWC_GET_SHADOW_POLY:{ + if( m_pEngine != NULL ) { + uint8_t polyID = *((uint8_t *)tCMD->DATA); + ShadowMask * tPTR = m_pEngine->getShadowMask(); + if( tPTR!= NULL ) { + simplePolygone *tSP = tPTR->getPoly( polyID ); + if ( tSP ) { + sendPolygone( polyID, tSP ); + } else { + sendNACK( TWC_GET_SHADOW_POLY ); + }; + } else { + sendNACK( TWC_GET_SHADOW_POLY ); + } + } else { + sendNACK( TWC_GET_SHADOW_POLY ); + }; + break; + }; + case TWC_GET_SHADOW_TRACE:{ + if( m_pEngine != NULL ) { + ShadowMask * tPTR = m_pEngine->getShadowMask(); + if( tPTR!= NULL ) { + if( m_vShadowZM.size() == 0 ){ + if( tPTR->getZoneMask( m_vShadowZM ) ){ + sendShadowTrace( &m_vShadowZM ); + } else { + sendNACK( TWC_GET_SHADOW_TRACE ); + }; + } else { + sendShadowTrace( &m_vShadowZM ); + }; + } else { + sendNACK( TWC_GET_SHADOW_TRACE ); + }; + } else { + sendNACK( TWC_GET_SHADOW_TRACE ); + }; + break; + }; + }; + if( tCMD->DATA ) free( tCMD->DATA ); + free( tCMD ); + tCMD = NULL; + } else { + SLEEP( TWI_SLOW_LOOP_SLEEP ); + }; + if( m_pEngine ) { + m_sSystemStatus.KRNL_WM = m_pEngine->getWM(); + m_sSystemStatus.ENABLED = m_pEngine->getFilteredKernels(); + m_sSystemStatus.DETECTION = m_pEngine->getDetectionKernels(); + if( m_bOldTHRecords != m_sSystemStatus.TH_READY ) { + m_bOldTHRecords = m_sSystemStatus.TH_READY; + }; + }; break; }; }; - - SLEEP( TWI_SLOW_LOOP_SLEEP ); }; }; #else //Master void LRF_TwinConnector::cleanupInfo(void){ memset( &m_sSystemStatus, 0, sizeof( TWIN_STATUS )); + memset( &m_sSlaveMaskInfo, 0, sizeof( TWI_MASK_INFO )); memcpy( &m_sSystemStatus.MASTER_NFO, &gsSOFT_INFO, sizeof(SOFTWARE_INFO)); + if ( m_pSlaveShadowMask != NULL) delete( m_pSlaveShadowMask ); }; bool LRF_TwinConnector::create(){ if( m_pSettings!= NULL ) { @@ -399,7 +560,7 @@ bool LRF_TwinConnector::consumeTH( uint8_t kID, thresholdNode *ptr, uint32_t THs } else { LOG( "Can't set N-Blocking Mode of Accepting Socket" ); }; - m_eWM = TWI_STAGE_WAITING_CONNECTION; + m_eWM = TWI_STAGE_CONNECTING; return init(); }; @@ -409,12 +570,13 @@ bool LRF_TwinConnector::consumeTH( uint8_t kID, thresholdNode *ptr, uint32_t THs 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 ); + 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 { @@ -435,10 +597,15 @@ bool LRF_TwinConnector::consumeTH( uint8_t kID, thresholdNode *ptr, uint32_t THs break; }; }; - }; + };*/ + break; + }; + case TWC_NACK_CMD:{ + LOG("NACK RECEIVED!"); + setCMD( TWC_NO_COMMAND ); break; }; - case TWC_CURRENT_MODE:{ + /*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); @@ -454,17 +621,133 @@ bool LRF_TwinConnector::consumeTH( uint8_t kID, thresholdNode *ptr, uint32_t THs }; break; - }; + };*/ case TWC_CURRENT_STATUS:{ - LOG( "Cur Status"); - setWM( TWI_STAGE_REQUEST_STATUS ); + LOG( "Status"); + memcpy( &m_sSystemStatus.SLAVE_STATUS, Package->m_pData + TWI_PLS_INDEX, sizeof(TWI_PEER_STATUS)); break; }; case TWC_CURRENT_VERSION:{ - LOG( "CUr Version"); - m_sSystemStatus.SLAVE_STATUS.KRNL_WM = WM_INIT; // At least it Works; + LOG( "Version"); memcpy( &m_sSystemStatus.SLAVE_NFO, Package->m_pData + TWI_PLS_INDEX, sizeof(SOFTWARE_INFO)); - setWM( TWI_STAGE_REQUEST_MODE ); + m_sSystemStatus.VERSION_IS_SYNCED = true; + setCMD( TWC_NO_COMMAND ); + break; + }; + case TWC_SET_CONFIG:{ + LOG( "Detection Params"); + memcpy( &m_sSystemStatus.SLAVE_PARAMS, Package->m_pData + TWI_PLS_INDEX, sizeof(LGS_3D_PARAMETERS)); + m_sSystemStatus.SETTINGS_IS_SYNCED = true; + setCMD( TWC_NO_COMMAND ); + break; + }; + case TWC_SHADOW_INFO:{ + memcpy( &m_sSlaveMaskInfo, Package->m_pData + TWI_PLS_INDEX, sizeof(TWI_MASK_INFO)); + sprintf(tB, "Shadow Info A:[%d] P:[%d] R:[%d]", m_sSlaveMaskInfo.active, m_sSlaveMaskInfo.poly_cnt, m_sSlaveMaskInfo.ray_cnt ); + LOG( tB ); + if( m_sSlaveMaskInfo.poly_cnt == 0 && m_sSlaveMaskInfo.ray_cnt == 0 ) { + LOG("No Shadow Defined!"); + m_sSystemStatus.SHADOW_IS_SYNCED = true; + setCMD( TWC_NO_COMMAND ); + } else { + LOG("Shadow Defined!"); + if ( m_pSlaveShadowMask == NULL ) { + m_pSlaveShadowMask = new ShadowMask(); + } else { + m_pSlaveShadowMask->clear(); + }; + if ( m_pSlaveShadowMask!= NULL ) { + if (m_sSlaveMaskInfo.poly_cnt) { + uint8_t id=0; + LOG("Get POLY"); + pushCMD(TWC_GET_SHADOW_POLY, &id, 1 ); + setCMD( TWC_GET_SHADOW_POLY ); + } else { + LOG("Get TRACE"); + pushCMD( TWC_GET_SHADOW_TRACE ); + setCMD( TWC_GET_SHADOW_TRACE ); + }; + } else { + LOG_ERROR("Error Creating Slave Shadow Mask!"); + //m_sSystemStatus.SHADOW_IS_SYNCED = false; + //setCMD( TWC_NO_COMMAND ); + }; + }; + break; + }; + case TWC_SET_SHADOW_POLY:{ + uint8_t id = Package->m_pData[TWI_PLS_INDEX]; + simplePolygone * tPoly = (simplePolygone*) malloc(sizeof(simplePolygone)); + if ( tPoly ) { + tPoly->count = Package->m_pData[TWI_PLS_INDEX + 1]; + tPoly->points = (simplePoint*) calloc(tPoly->count, sizeof(simplePoint)); + if( tPoly->points != NULL ){ + tPoly->color[0] = Package->m_pData[TWI_PLS_INDEX + 2]; + tPoly->color[1] = Package->m_pData[TWI_PLS_INDEX + 3]; + tPoly->color[2] = Package->m_pData[TWI_PLS_INDEX + 4]; + uint16_t adr = TWI_PLS_INDEX + 5; + for( uint8_t i=0; i < tPoly->count; i++ ) { + uint16_t x,y; + x = Package->m_pData[adr++]; + x = ( x << 8 ) | Package->m_pData[adr++]; + y = Package->m_pData[adr++]; + y = ( y << 8 ) | Package->m_pData[adr++]; + tPoly->points[i].setX(x); + tPoly->points[i].setY(y); + }; + m_pSlaveShadowMask->addPoly( tPoly ); + id++; + } else { + free( tPoly ); + }; + }; + if( id < m_sSlaveMaskInfo.poly_cnt ) { + pushCMD(TWC_GET_SHADOW_POLY, &id, 1 ); + setCMD( TWC_GET_SHADOW_POLY ); + } else { + m_pSlaveShadowMask->saveVertexes("sl_masking.dat"); + if ( m_sSlaveMaskInfo.ray_cnt ) { + LOG("Get TRACE"); + pushCMD( TWC_GET_SHADOW_TRACE ); + setCMD( TWC_GET_SHADOW_TRACE ); + } else { + LOG("Shadow Now Synced!"); + m_sSystemStatus.SHADOW_IS_SYNCED = true; + setCMD(TWC_NO_COMMAND); + }; + }; + break; + }; + case TWC_SET_SHADOW_TRACE:{ + uint16_t traceSize = Package->m_pData[TWI_PLS_INDEX]; + traceSize = ( traceSize << 8 ) | Package->m_pData[TWI_PLS_INDEX+1]; + sprintf( tB, "Shadow Trace [%d]pp[%d]bs[%d]", traceSize, Package->m_nSize, (TWI_PLS_INDEX + (traceSize << 3) + 3) ); + LOG( tB ); + if((TWI_PLS_INDEX + (traceSize << 3) + 3) == Package->m_nSize ) { + uint16_t index; + uint16_t cColumn; + uint16_t cCount; + raySegment RS; + index = TWI_PLS_INDEX+2; + for( int i=0; i < traceSize; i++ ){ + cColumn = Package->m_pData[index++]; + cColumn = ( cColumn << 8 ) | Package->m_pData[index++]; + cCount = Package->m_pData[index++]; + cCount = ( cCount << 8 ) | Package->m_pData[index++]; + for( int j = 0; j < cCount; j++ ){ + RS.start = Package->m_pData[index++]; + RS.start = ( RS.start << 8 ) | Package->m_pData[index++]; + RS.stop = Package->m_pData[index++]; + RS.stop = ( RS.stop << 8 ) | Package->m_pData[index++]; + m_pSlaveShadowMask->addRay( cColumn, RS ); + }; + }; + m_pSlaveShadowMask->setActive(true); + m_pSlaveShadowMask->saveRastered("sl_shadow.dat"); + LOG("Shadow Now Synced!"); + m_sSystemStatus.SHADOW_IS_SYNCED = true; + setCMD(TWC_NO_COMMAND); + }; break; }; case TWC_PUSH_TARGET:{ @@ -481,9 +764,10 @@ bool LRF_TwinConnector::consumeTH( uint8_t kID, thresholdNode *ptr, uint32_t THs }; void LRF_TwinConnector::m_fThreadProc( void ){ + TWI_CMD_CONTAINER * tCMD = NULL; int ClientSocket = -1; struct sockaddr ClientAddress; - socklen_t ClientAddressSize; + socklen_t ClientAddressSize = (socklen_t) sizeof( struct sockaddr_in ); long long cMilliseconds; long long cStatusTO = 0; long long cDrawTO = 0; @@ -491,156 +775,182 @@ bool LRF_TwinConnector::consumeTH( uint8_t kID, thresholdNode *ptr, uint32_t THs 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( m_mDrawProtector.try_lock() ) { -#ifdef DEBUG - LOG("Mutex Grabed"); -#endif - if( m_bDrawThreadStatus > TH_ARMED ) { - pthread_join( m_sDrawThreadHandler, NULL ); - }; - cDrawTO = cMilliseconds; - m_bDrawThreadStatus = TH_ARMED; - int RetVal = pthread_create( &m_sDrawThreadHandler, NULL, m_fDrawThreadEntryPoint, ( void * ) this ); - if( RetVal == -1 ) { - LOG_ERROR("Image Draw Thread Creation Failed."); - m_mDrawProtector.unlock(); + TWI_WM cWM = getWM(); + if ( cWM > TWI_STAGE_CONNECTING ) { + if( m_oDataTransport!= NULL ) { + if (m_oDataTransport->getConnectionStatus() == CS_DISCONNECTED) { + setWM( TWI_STAGE_CONNECTING ); + continue; }; + } else { + LOG_ERROR("Port Object Missed!"); + m_bThreadStatus = TH_ENDED; + continue; }; }; - */ - - // Port exists - SLAVE is connected - if( m_oDataTransport != NULL ){ - // Check if still connected - if( m_oDataTransport->getConnectionStatus() == CS_DISCONNECTED ){ - // Handle Disconnection - LOG("HANDLE DISCONNECT!"); - setWM( TWI_STAGE_WAITING_CONNECTION ); - delete( (serverPort *) m_oDataTransport ); - m_oDataTransport = NULL; - //Reset Flags - cStatusTO = 0; - continue; - }; - } else { - serverPort *tPort = NULL; - // (re)Establish Connection - ClientAddressSize = (socklen_t) sizeof( struct sockaddr_in ); - ClientSocket = accept ( m_nMainSocket, &ClientAddress, &ClientAddressSize ); - if ( ClientSocket == -1 ) { - switch( errno ){ - case EAGAIN:{ - SLEEP( TWI_QUICK_LOOP_SLEEP ); - continue; - }; - //case EWOULDBLOCK: me->Log(" The socket is marked non-blocking and no connections are present to be accepted."); break; - case EBADF: LOG_ERROR( "The descriptor is invalid." ); break; - case ECONNABORTED: LOG_ERROR( "A connection has been aborted."); break; - case EINTR: LOG_ERROR( "The system call was interrupted by a signal that was caught before a valid connection arrived."); break; - case EINVAL: LOG_ERROR( "Socket is not listening for connections, or addrlen is invalid (e.g., is negative)."); break; - case EMFILE: LOG_ERROR( "The per-process limit of open file descriptors has been reached."); break; - case ENFILE: LOG_ERROR( "The system limit on the total number of open files has been reached."); break; - case ENOTSOCK: LOG_ERROR( "The descriptor references a file, not a socket."); break; - case EOPNOTSUPP: LOG_ERROR( "The referenced socket is not of type SOCK_STREAM."); break; - case EFAULT: LOG_ERROR( "The addr argument is not in a writable part of the user address space."); break; - case ENOBUFS: - case ENOMEM: LOG_ERROR( "Not enough free memory. This often means that the memory allocation is limited by the socket buffer limits, not by the system memory."); break; - case EPROTO: LOG_ERROR( "Protocol error."); break; - case EPERM: LOG_ERROR( "Firewall rules forbid connection."); break; - case ENOSR: - case ESOCKTNOSUPPORT: - case EPROTONOSUPPORT: - case ETIMEDOUT: LOG_ERROR( " Unusual error in Kernel (Timeout, No Socket Support in Kernel, Unsupported Protocol)"); break; - //case ERESTARTSYS: me->Log(" Unusual error by Kernel"); break; - default: LOG_ERROR( " Unhandled error in Kernel"); break; - }; - m_bThreadStatus = TH_ENDED; - } else { - char tstr[CQUERY]; - inet_ntop( AF_INET, &(((struct sockaddr_in*) &(ClientAddress ))->sin_addr ), tstr, CQUERY ); - LOG( "SLAVE LRF Connection Accepted" ); - tPort = new serverPort( ClientSocket ); - }; - if( tPort != NULL ){ - if ( tPort->create() ) { - setTransport(tPort); - // Reset Stage - LOG("State->Connected"); - setWM( TWI_STAGE_CONNECTED ); + switch( cWM ) { + case TWI_STAGE_CONNECTING:{ + if( m_oDataTransport != NULL ){ + delete( (serverPort *) m_oDataTransport ); + m_oDataTransport = NULL; } else { - LOG_ERROR("Failure Create Server Connection!"); - delete( tPort ); + serverPort *tPort = NULL; + // (re)Establish Connection + ClientSocket = accept ( m_nMainSocket, &ClientAddress, &ClientAddressSize ); + if ( ClientSocket == -1 ) { + switch( errno ){ + case EAGAIN:{ + SLEEP( TWI_QUICK_LOOP_SLEEP ); + continue; + }; + //case EWOULDBLOCK: me->Log(" The socket is marked non-blocking and no connections are present to be accepted."); break; + case EBADF: LOG_ERROR( "The descriptor is invalid." ); break; + case ECONNABORTED: LOG_ERROR( "A connection has been aborted."); break; + case EINTR: LOG_ERROR( "The system call was interrupted by a signal that was caught before a valid connection arrived."); break; + case EINVAL: LOG_ERROR( "Socket is not listening for connections, or addrlen is invalid (e.g., is negative)."); break; + case EMFILE: LOG_ERROR( "The per-process limit of open file descriptors has been reached."); break; + case ENFILE: LOG_ERROR( "The system limit on the total number of open files has been reached."); break; + case ENOTSOCK: LOG_ERROR( "The descriptor references a file, not a socket."); break; + case EOPNOTSUPP: LOG_ERROR( "The referenced socket is not of type SOCK_STREAM."); break; + case EFAULT: LOG_ERROR( "The addr argument is not in a writable part of the user address space."); break; + case ENOBUFS: + case ENOMEM: LOG_ERROR( "Not enough free memory. This often means that the memory allocation is limited by the socket buffer limits, not by the system memory."); break; + case EPROTO: LOG_ERROR( "Protocol error."); break; + case EPERM: LOG_ERROR( "Firewall rules forbid connection."); break; + case ENOSR: + case ESOCKTNOSUPPORT: + case EPROTONOSUPPORT: + case ETIMEDOUT: LOG_ERROR( " Unusual error in Kernel (Timeout, No Socket Support in Kernel, Unsupported Protocol)"); break; + //case ERESTARTSYS: me->Log(" Unusual error by Kernel"); break; + default: LOG_ERROR( " Unhandled error in Kernel"); break; + }; + m_bThreadStatus = TH_ENDED; + continue; + } else { + char tstr[32]; + char tB[256]; + inet_ntop( AF_INET, &(((struct sockaddr_in*) &(ClientAddress ))->sin_addr ), tstr, 32 ); + sprintf( tB, "SLAVE LRF Connection Accepted[%s]", tstr ); + LOG( tB ); + tPort = new serverPort( ClientSocket ); + }; + if( tPort != NULL ){ + if ( tPort->create() ) { + setTransport( tPort ); + cleanupInfo(); + 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 ); + m_mQUEUEProtector.lock(); + while( !m_qCMD.empty() ) { + TWI_CMD_CONTAINER *ptr = m_qCMD.front(); + if (ptr->DATA) free(ptr->DATA); + free( ptr ); + m_qCMD.pop(); }; + m_mQUEUEProtector.unlock(); + cStatusTO = cMilliseconds; + setWM( TWI_STAGE_IDLE ); break; }; - case TWI_STAGE_TIME_SYNC_MODE:{ - if ( sendPlainCMD( TWC_INIT_TSINC ) ) { - setWM( TWI_STAGE_RESPONCE_WAITING ); + case TWI_STAGE_IDLE:{ + tCMD = fetchCMD(); + if( tCMD != NULL ){ + switch( tCMD->CMD ){ + case TWC_GET_STATUS: + case TWC_GET_VERSION: + case TWC_GET_CONFIG: + case TWC_GET_SHADOW_INFO:{ + sendPlainCMD( tCMD->CMD ); + break; + }; + case TWC_GET_SHADOW_TRACE:{ + sendPlainCMD( TWC_GET_SHADOW_TRACE ); + //Prolong TO + cStatusTO = cMilliseconds; + break; + }; + case TWC_GET_SHADOW_POLY:{ + if( tCMD->DATA != NULL ) { + uint8_t polyID = *((uint8_t*) tCMD->DATA ); + getShadowPoly( polyID ); + //Prolong TO + cStatusTO = cMilliseconds; + }; + break; + }; + case TWC_GET_THRESHOLD:{ + if( tCMD->DATA != NULL ) { + uint8_t kID = *((uint8_t*) tCMD->DATA ); + getTHData( kID ); + }; + break; + }; + case TWC_SET_CONFIG:{ + if (tCMD->DATA != NULL && tCMD->SIZE == sizeof( LGS_3D_PARAMETERS ) ) { + if( sendDetectionParameters( (PLGS_3D_PARAMETERS)tCMD->DATA ) ) { + memcpy(&m_sSystemStatus.SLAVE_PARAMS, tCMD->DATA, tCMD->SIZE); + }; + }; + break; + }; + + }; + if (tCMD->DATA) free(tCMD->DATA); + free( tCMD ); + tCMD = NULL; + continue; // No delay After CMD }; - break; - }; - case TWI_STAGE_RETRY_CMD:{ - if( getCMD() ){ - m_bCMDTO = 10; - if( sendPlainCMD(getCMD()) ){ - setWM( TWI_STAGE_RESPONCE_WAITING ); + //If Initial Slave Data is Read + if( m_sSystemStatus.SETTINGS_IS_SYNCED && m_sSystemStatus.SHADOW_IS_SYNCED && m_sSystemStatus.VERSION_IS_SYNCED ){ + if ((cMilliseconds - cStatusTO) > TWI_PING_PONG_TO) { + cStatusTO = cMilliseconds; + pushCMD( TWC_GET_STATUS ); + } else { + SLEEP( TWI_QUICK_LOOP_SLEEP ); }; - } else setWM( TWI_STAGE_REQUEST_MODE ); + } else { + TWIN_COMMAND iCMD = getCMD(); + if ( iCMD == TWC_NO_COMMAND ) { + LOG("INIT MODE"); + if( !m_sSystemStatus.VERSION_IS_SYNCED ) { + LOG("ASK VERSION"); + pushCMD( TWC_GET_VERSION ); + setCMD( TWC_GET_VERSION ); + } else if( !m_sSystemStatus.SETTINGS_IS_SYNCED ) { + LOG("ASK CONFIG"); + pushCMD( TWC_GET_CONFIG ); + setCMD( TWC_GET_CONFIG ); + } else if( !m_sSystemStatus.SHADOW_IS_SYNCED ) { + LOG("ASK SHADOW"); + pushCMD( TWC_GET_SHADOW_INFO ); + setCMD( TWC_GET_SHADOW_INFO ); + }; + cStatusTO = cMilliseconds; + } else { + if ((cMilliseconds - cStatusTO) > TWI_PING_PONG_TO) { + cStatusTO = cMilliseconds; + setCMD( TWC_NO_COMMAND ); + } else { + SLEEP( TWI_SLOW_LOOP_SLEEP ); + }; + }; + }; break; }; - case TWI_STAGE_RESPONCE_WAITING:{ - if ( m_bCMDTO ) { - m_bCMDTO--; - SLEEP(TWI_SLOW_LOOP_SLEEP); - } else setWM( TWI_STAGE_RETRY_CMD ); + case TWI_STAGE_DISCONNECTING:{ + delete( (serverPort *) m_oDataTransport ); + m_oDataTransport = NULL; + setWM( TWI_STAGE_CONNECTING ); break; }; }; @@ -661,7 +971,7 @@ bool LRF_TwinConnector::consumeTH( uint8_t kID, thresholdNode *ptr, uint32_t THs TWI_CMD_CONTAINER *LRF_TwinConnector::fetchCMD(){ TWI_CMD_CONTAINER *retVal = NULL; m_mQUEUEProtector.lock(); - if( m_qCMD.size() ) { + if( !m_qCMD.empty() ) { retVal = m_qCMD.front(); m_qCMD.pop(); }; @@ -672,7 +982,9 @@ TWI_CMD_CONTAINER *LRF_TwinConnector::fetchCMD(){ void LRF_TwinConnector::pushCMD( TWI_CMD_CONTAINER *ptr ){ if ( ptr ) { m_mQUEUEProtector.lock(); - m_qCMD.push(ptr); + if( m_qCMD.size() < TWI_MAX_QUEUE_SIZE ) { + m_qCMD.push(ptr); + }; m_mQUEUEProtector.unlock(); }; }; @@ -681,11 +993,19 @@ 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(); + if( ptr!= NULL && DataSize > 0 ) { + tVal->DATA = malloc(DataSize); + if ( tVal->DATA ) { + memcpy( tVal->DATA, ptr, DataSize ); + tVal->SIZE = DataSize; + } else { + tVal->SIZE = 0; + }; + } else { + tVal->DATA = NULL; + tVal->SIZE = 0; + }; + pushCMD( tVal ); }; }; diff --git a/lib/App/3dSERVER/LRF_TwinConnector.h b/lib/App/3dSERVER/LRF_TwinConnector.h index d381175b..e9d6fbf4 100644 --- a/lib/App/3dSERVER/LRF_TwinConnector.h +++ b/lib/App/3dSERVER/LRF_TwinConnector.h @@ -1,8 +1,8 @@ #ifndef __LRF_TWINCONNECTOR_H_INCL__ #define __LRF_TWINCONNECTOR_H_INCL__ -#include "../../alg/lgs/detectorStructures.h" #include "../../data/protocol/protocolInternalLRF3D.h" +#include "../../components/base/basicFunctionality.h" #ifdef PRU_SLAVE #include "../../data/net/clientPort.h" @@ -10,59 +10,30 @@ #include "../../data/net/serverPort.h" #endif -#define TH_USE_PICTURES +//#define TH_USE_PICTURES #define TWI_QUICK_LOOP_SLEEP 15 #define TWI_SLOW_LOOP_SLEEP 100 #define TWI_STATUS_LOOP_MS 500 #define TWI_RECONNECT_LOOP_SLEEP 1000 -#define TWI_DRAW_LOOP_MS 300000 // 5 minutes; +#define TWI_DRAW_LOOP_MS 300000 // 5 minutes +#define TWI_PING_PONG_TO 2000 // 2 seconds +#define TWI_MAX_QUEUE_SIZE 200 #define STORAGE_DIR_MODE 0x1FF #define STORAGE_FILE_MODE 0x1B6 typedef enum E_TWI_WM{ - TWI_STAGE_BEFORE_BIND = 0, - TWI_STAGE_WAITING_CONNECTION = 1, - TWI_STAGE_CONNECTED = 2, - 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_STAGE_NO_AKTIVE = 0, + TWI_STAGE_CONNECTING = 1, + TWI_STAGE_CONNECTED, + TWI_STAGE_BORDER, + TWI_STAGE_IDLE, + TWI_STAGE_DISCONNECTING } 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; @@ -97,12 +68,14 @@ class LRF_Kernel; 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; + uint32_t m_nCurrentTH; void waitDrawThreadEnd( bool forced = false ); pthread_t m_sDrawThreadHandler; @@ -115,17 +88,22 @@ class LRF_Kernel; bool loadTHData( uint8_t kid, thresholdNode *ptr ); bool saveTHData( uint8_t kid, thresholdNode *ptr ); + void cleanupInfo(void); + #ifdef PRU_SLAVE uint16_t m_nMasterPort; char m_cMasterAddress[16]; TWI_PEER_STATUS m_sSystemStatus; + uint8_t m_bOldTHRecords; + vectorZoneMask m_vShadowZM; #else int m_nMainSocket; LRF_TargetTracker * m_pTracker; uint16_t m_nBindPort; char m_cBindAddress[16]; TWIN_STATUS m_sSystemStatus; - void cleanupInfo(void); + ShadowMask * m_pSlaveShadowMask; + TWI_MASK_INFO m_sSlaveMaskInfo; #endif @@ -138,6 +116,7 @@ class LRF_Kernel; bool create(); void setKernel( LRF_Kernel *ptr ){ m_pEngine = ptr; }; bool readyToConsumeTH( void ); + bool requestRemoteDraw( uint8_t kID ){ return true; }; bool consumeTH( uint8_t kID, thresholdNode *ptr, uint32_t THsize ); #ifdef PRU_SLAVE bool sendCurrentSettings( void ); @@ -147,7 +126,9 @@ class LRF_Kernel; #else bool attachTargetTracker( LRF_TargetTracker *ptr ); bool updateSettings( void ); - TWIN_STATUS *getSystemStatus(){ return &m_sSystemStatus; }; + TWIN_STATUS * getSystemStatus(){ return &m_sSystemStatus; }; + ShadowMask * getShadowMask( void ){ return m_pSlaveShadowMask; }; + thresholdNode * getTreshold( uint32_t &size, uint8_t kID=0 ); #endif }; diff --git a/lib/alg/lgs/mask.cpp b/lib/alg/lgs/mask.cpp index 773adb5d..d063a4ed 100644 --- a/lib/alg/lgs/mask.cpp +++ b/lib/alg/lgs/mask.cpp @@ -11,19 +11,17 @@ ShadowMask::ShadowMask(){ m_pRasterFileName = (CSTR)malloc(256); sprintf( m_pVertexFileName, "masking.dat" ); sprintf( m_pRasterFileName, "shadow.dat" ); - LOG(m_pVertexFileName); - loadVertexes(m_pVertexFileName); - LOG("done"); - LOG(m_pRasterFileName); - loadRastered(m_pRasterFileName); - LOG("done"); + m_bAutoSave = true; +#else + m_bAutoSave = false; #endif }; ShadowMask::~ShadowMask(){ - if( m_vVectorMask.size() ){ + if( m_vVectorMask.size() ){ + if( m_bAutoSave ) saveVertexes(m_pVertexFileName); #if defined( __linux__ ) && !defined( __GUI__ ) - saveVertexes(m_pVertexFileName); + #else if( !m_bRasterized ){ if( rasterizeVertexes() ){ @@ -42,8 +40,9 @@ ShadowMask::~ShadowMask(){ if( m_pVertexFileName ) free( m_pVertexFileName ); #endif if(m_vZoneMask.size()){ + if( m_bAutoSave ) saveRastered( m_pRasterFileName ); #if defined( __linux__ ) && !defined( __GUI__ ) - saveRastered( m_pRasterFileName ); + #endif // Clear Data for( vectorZoneMask::iterator index = m_vZoneMask.begin(); index < m_vZoneMask.end(); index++ ){ @@ -130,11 +129,11 @@ bool ShadowMask::loadRastered( CSTR fName ){ bool ShadowMask::saveRastered( CSTR fName ){ FILE *fd; - if (fName == NULL){ - fd = fopen( m_pRasterFileName, "wb+"); - } else { - fd = fopen(fName, "wb+"); + if( m_vZoneMask.size() == 0 ) return false; + if( fName != NULL ){ + strncpy( m_pRasterFileName, fName, 256 ); }; + fd = fopen( m_pRasterFileName, "wb+"); if( fd != NULL ){ if( m_bActive ) fprintf( fd, "ENABLED\n" ); else fprintf( fd, "DISABLED\n" ); for( vectorZoneMask::iterator index = m_vZoneMask.begin(); index < m_vZoneMask.end(); index++ ){ @@ -211,7 +210,9 @@ bool ShadowMask::addRay( uint16_t column, uint32_t RS ){// Binary Data to RaySeg }; bool ShadowMask::addPoly( simplePolygone *SP ){ + LOG("Add Poly"); m_vVectorMask.push_back( SP ); + LOG("Add Poly Done"); return true; }; @@ -229,8 +230,9 @@ bool ShadowMask::clear( void ){ delete( tPoly ); }; m_vVectorMask.clear(); + if( m_bAutoSave ) unlink( m_pVertexFileName ); #ifdef __linux__ - unlink( m_pVertexFileName ); + #endif for( vectorZoneMask::iterator index = m_vZoneMask.begin(); index < m_vZoneMask.end(); index++ ){ tRay = *index; @@ -238,8 +240,8 @@ bool ShadowMask::clear( void ){ delete( tRay ); }; m_vZoneMask.clear(); + if( m_bAutoSave ) unlink( m_pRasterFileName ); #ifdef __linux__ - unlink( m_pRasterFileName ); #endif m_bActive = false; return true; @@ -261,13 +263,13 @@ bool ShadowMask::deletePoly( int ID ){ bool ShadowMask::saveVertexes( CSTR fName ){ if( m_vVectorMask.size() == 0 ) return true; FILE *fd; - if (fName == NULL){ - fd = fopen( m_pVertexFileName, "wb+"); - } else { - fd = fopen(fName, "wb+"); + if( fName != NULL){ + strncpy( m_pVertexFileName, fName, 256 ); }; + fd = fopen( m_pVertexFileName, "wb+"); if( fd == NULL ) return false; for( vectorMasking::iterator index = m_vVectorMask.begin(); index < m_vVectorMask.end(); index++ ){ + LOG("VERTEX->SAVE"); fprintf( fd, "%d\n", (*index)->count ); fprintf( fd, "%d %d %d\n", (*index)->color[0], (*index)->color[1], (*index)->color[2] ); for( int j = 0; j < (*index)->count; j++){ @@ -479,8 +481,198 @@ bool ShadowMask::getZoneMask(vectorZoneMask &ZM){ }; return true; }; +#else // GUI - QT + bool ShadowMask::rasterizeVertexes( void ){ + if( m_vZoneMask.size() ){ + // Clear Data + for (vectorZoneMask::iterator index = m_vZoneMask.begin(); index < m_vZoneMask.end(); index++){ + free((*index)->zones); + free((*index)); + }; + m_vZoneMask.clear(); + }; + // Check each TH Matrix on Polygones + uint16_t cColumn = 0; + uint16_t cStart = 0; + uint16_t cStop = 0; + raySegment RS; + bool oldZone = false; + bool inZone = false; + + // Check each point for polygons + for( int x = 0; x < M_SCAN_POINTS; x++){ + cColumn = x; + oldZone = false; + inZone = false; + cStart = 0; + cStop = 0; + for( int y = 0; y < Q_SCAN_COUNT; y++ ){ + simplePoint tPoint; + tPoint.setX( x ); + tPoint.setY( y ); + inZone = false; + for( int i = 0; i < m_vVectorMask.size(); i++ ){ + if( !inZone ){ + if( isInside( m_vVectorMask.at(i), tPoint ) ){ + //if( tVectorPoly.at(i)->containsPoint( tPoint, Qt::OddEvenFill) ){ + if( cStart == 0 ) cStart = y; + inZone = true; + break; // No need to check Other Polygones + }; + }; + }; + if( inZone != oldZone ){ + if( !inZone ){ + cStop = y; + RS.start = cStart; + RS.stop = cStop; + addRay(cColumn, RS); + //fprintf( fd, "%d %d %d\n", cColumn, cStart, cStop ); + cStart = 0; + }; + oldZone = inZone; + }; + }; + if( inZone ){ + cStop = Q_SCAN_COUNT; + inZone = false; + oldZone = false; + RS.start = cStart; + RS.stop = cStop; + addRay(cColumn, RS); + //fprintf( fd, "%d %d %d\n", cColumn, cStart, cStop ); + }; + }; + //fclose( fd ); + m_bRasterized = true; + //}; + return true; + }; #endif + +// A C++ program to check if a given point lies inside a given polygon +// Refer https://www.geeksforgeeks.org/check-if-two-given-line-segments-intersect/ +// for explanation of functions onSegment(), orientation() and doIntersect() +//#include +//using namespace std; + +// Define Infinite (Using INT_MAX caused overflow problems) +#define INF 10000 + +//struct Point +//{ +// int x; +// int y; +//}; + +// Given three collinear points p, q, r, the function checks if +// point q lies on line segment 'pr' +bool ShadowMask::onSegment( simplePoint p, simplePoint q, simplePoint r){ + if( q.x() <= max(p.x(), r.x()) && q.x() >= min(p.x(), r.x()) && q.y() <= max(p.y(), r.y()) && q.y() >= min(p.y(), r.y()) ) return true; + return false; +}; + +// To find orientation of ordered triplet (p, q, r). +// The function returns following values +// 0 --> p, q and r are collinear +// 1 --> Clockwise +// 2 --> Counterclockwise +int ShadowMask::orientation( simplePoint p, simplePoint q, simplePoint r ){ + int val = (q.y() - p.y()) * (r.x() - q.x()) - (q.x() - p.x()) * (r.y() - q.y()); + + if( val == 0 ) return 0; // collinear + return ( val > 0 )? 1: 2; // clock or counterclock wise +}; + +// The function that returns true if line segment 'p1q1' +// and 'p2q2' intersect. +bool ShadowMask::doIntersect( simplePoint p1, simplePoint q1, simplePoint p2, simplePoint q2 ){ + // Find the four orientations needed for general and + // special cases + int o1 = orientation( p1, q1, p2 ); + int o2 = orientation( p1, q1, q2 ); + int o3 = orientation( p2, q2, p1 ); + int o4 = orientation( p2, q2, q1 ); + + // General case + if( o1 != o2 && o3 != o4 ) return true; + + // Special Cases + // p1, q1 and p2 are collinear and p2 lies on segment p1q1 + if( o1 == 0 && onSegment(p1, p2, q1) ) return true; + + // p1, q1 and p2 are collinear and q2 lies on segment p1q1 + if( o2 == 0 && onSegment(p1, q2, q1) ) return true; + + // p2, q2 and p1 are collinear and p1 lies on segment p2q2 + if( o3 == 0 && onSegment(p2, p1, q2) ) return true; + + // p2, q2 and q1 are collinear and q1 lies on segment p2q2 + if( o4 == 0 && onSegment(p2, q1, q2) ) return true; + + return false; // Doesn't fall in any of the above cases +} + +// Returns true if the point p lies inside the polygon[] with n vertices +bool ShadowMask::isInside( simplePolygone *polygon, simplePoint p ){ + // There must be at least 3 vertices in polygon[] + if (polygon->count < 3) return false; + + // Create a point for line segment from p to infinite + simplePoint extreme;// = {INF, p.y}; + extreme.setX( INF ); + extreme.setY( p.y() ); + // Count intersections of the above line with sides of polygon + int count = 0, i = 0; + do{ + int next = (i+1) % polygon->count; + // Check if the line segment from 'p' to 'extreme' intersects + // with the line segment from 'polygon[i]' to 'polygon[next]' + if( doIntersect( polygon->points[i], polygon->points[next], p, extreme )){ + // If the point 'p' is collinear with line segment 'i-next', + // then check if it lies on segment. If it lies, return true, + // otherwise false + if( orientation( polygon->points[i], p, polygon->points[next] ) == 0 ) return onSegment( polygon->points[i], p, polygon->points[next] ); + count++; + }; + i = next; + } while( i != 0 ); + // Return true if count is odd, false otherwise + return count & 1; // Same as (count%2 == 1) +}; +/* +// Driver program to test above functions +int main() +{ + Point polygon1[] = {{0, 0}, {10, 0}, {10, 10}, {0, 10}}; + int n = sizeof(polygon1)/sizeof(polygon1[0]); + Point p = {20, 20}; + isInside(polygon1, n, p)? cout << "Yes \n": cout << "No \n"; + + p = {5, 5}; + isInside(polygon1, n, p)? cout << "Yes \n": cout << "No \n"; + + Point polygon2[] = {{0, 0}, {5, 5}, {5, 0}}; + p = {3, 3}; + n = sizeof(polygon2)/sizeof(polygon2[0]); + isInside(polygon2, n, p)? cout << "Yes \n": cout << "No \n"; + + p = {5, 1}; + isInside(polygon2, n, p)? cout << "Yes \n": cout << "No \n"; + + p = {8, 1}; + isInside(polygon2, n, p)? cout << "Yes \n": cout << "No \n"; + + Point polygon3[] = {{0, 0}, {10, 0}, {10, 10}, {0, 10}}; + p = {-1,10}; + n = sizeof(polygon3)/sizeof(polygon3[0]); + isInside(polygon3, n, p)? cout << "Yes \n": cout << "No \n"; + + return 0; +} +*/ + #undef LOG #undef LOG_ERROR \ No newline at end of file diff --git a/lib/alg/lgs/mask.h b/lib/alg/lgs/mask.h index 2836d0c6..b1b56a61 100644 --- a/lib/alg/lgs/mask.h +++ b/lib/alg/lgs/mask.h @@ -55,18 +55,109 @@ typedef struct{ typedef std::vector vectorZoneMask; +/* +// Given three collinear points p, q, r, the function checks if +// point q lies on line segment 'pr' +inline bool onSegment( simplePoint p, simplePoint q, simplePoint r ){ + if (q.x() <= max(p.x(), r.x()) && q.x() >= min(p.x(), r.x()) && + q.y() <= max(p.y(), r.y()) && q.y() >= min(p.y(), r.y())) + return true; + return false; +}; + +// To find orientation of ordered triplet (p, q, r). +// The function returns following values +// 0 --> p, q and r are collinear +// 1 --> Clockwise +// 2 --> Counterclockwise +inline int orientation( simplePoint p, simplePoint q, simplePoint r ){ + int val = (q.y() - p.y()) * (r.x() - q.x()) - + (q.x() - p.x()) * (r.y() - q.y()); + + if (val == 0) return 0; // collinear + return (val > 0)? 1: 2; // clock or counterclock wise +}; + +// The function that returns true if line segment 'p1q1' +// and 'p2q2' intersect. +inline bool doIntersect(simplePoint p1, simplePoint q1, simplePoint p2, simplePoint q2){ + // Find the four orientations needed for general and + // special cases + int o1 = orientation(p1, q1, p2); + int o2 = orientation(p1, q1, q2); + int o3 = orientation(p2, q2, p1); + int o4 = orientation(p2, q2, q1); + + // General case + if (o1 != o2 && o3 != o4) + return true; + + // Special Cases + // p1, q1 and p2 are collinear and p2 lies on segment p1q1 + if (o1 == 0 && onSegment(p1, p2, q1)) return true; + + // p1, q1 and p2 are collinear and q2 lies on segment p1q1 + if (o2 == 0 && onSegment(p1, q2, q1)) return true; + + // p2, q2 and p1 are collinear and p1 lies on segment p2q2 + if (o3 == 0 && onSegment(p2, p1, q2)) return true; + // p2, q2 and q1 are collinear and q1 lies on segment p2q2 + if (o4 == 0 && onSegment(p2, q1, q2)) return true; + + return false; // Doesn't fall in any of the above cases +} + +// Returns true if the point p lies inside the polygon[] with n vertices +inline bool isInside( simplePoint polygon[], int n, simplePoint p ){ + // There must be at least 3 vertices in polygon[] + if( n < 3 ) return false; + + // Create a point for line segment from p to infinite + simplePoint extreme; + extreme.setX(10000); + extreme.setY(p.y()); + // Count intersections of the above line with sides of polygon + int count = 0, i = 0; + do + { + int next = (i+1)%n; + + // Check if the line segment from 'p' to 'extreme' intersects + // with the line segment from 'polygon[i]' to 'polygon[next]' + if (doIntersect(polygon[i], polygon[next], p, extreme)) + { + // If the point 'p' is collinear with line segment 'i-next', + // then check if it lies on segment. If it lies, return true, + // otherwise false + if (orientation(polygon[i], p, polygon[next]) == 0) + return onSegment(polygon[i], p, polygon[next]); + + count++; + } + i = next; + } while (i != 0); + + // Return true if count is odd, false otherwise + return count&1; // Same as (count%2 == 1) +} +*/ class ShadowMask{ private: basicLogCollection *m_pLog; vectorZoneMask m_vZoneMask; - bool m_bActive; + bool m_bActive; + bool m_bAutoSave; vectorMasking m_vVectorMask; bool m_bRasterized; #if defined( __linux__ ) && !defined( __GUI__ ) CSTR m_pRasterFileName; CSTR m_pVertexFileName; + bool onSegment( simplePoint p, simplePoint q, simplePoint r ); + int orientation( simplePoint p, simplePoint q, simplePoint r ); + bool doIntersect( simplePoint p1, simplePoint q1, simplePoint p2, simplePoint q2 ); + bool isInside( simplePolygone *polygon, simplePoint p ); #endif public: ShadowMask(); @@ -84,9 +175,10 @@ class ShadowMask{ bool clear( void ); bool deletePoly( int ID ); uint8_t getPolyCount( void ){ return ( m_vVectorMask.size() & 0xFF ); }; - uint16_t getRayCount( void ){ return ( m_vZoneMask.size() & 0xFFFF ); }; + uint16_t getRayCount( void ){ return ( m_vZoneMask.size() & 0xFFFF ); }; + bool rasterizeVertexes( void ); #if defined( WIN32 ) || defined( __GUI__ ) - bool rasterizeVertexes( void ); + bool getQPoly( vectorQPoly &VM ); bool addVertex( uint16_t polyID, simplePoint SP ); bool addVertex( uint16_t polyID, uint32_t SP ); // Binary Data to Vertex @@ -97,6 +189,8 @@ class ShadowMask{ void setActive( bool tVal ); bool addRay( uint16_t column, raySegment RS ); bool addRay( uint16_t column, uint32_t RS ); // Binary Data to RaySegment + void disableAutoSave( void ){ m_bAutoSave = false; }; + void enableAutoSave( void ){ m_bAutoSave = false; }; }; diff --git a/lib/components/base/basicEngine.h b/lib/components/base/basicEngine.h index 80bcc10a..6921be12 100644 --- a/lib/components/base/basicEngine.h +++ b/lib/components/base/basicEngine.h @@ -1,44 +1,59 @@ #ifndef __BASICENGINE_H_INCL__ #define __BASICENGINE_H_INCL__ +#include "basicObject.h" +#include "basicMutex.h" -class networkClientHandler; /** * TODO: Add class description * * @author Gagua */ -class basicEngine { -public: - // Constructor - basicEngine(); - - // Destructor - virtual ~basicEngine(); - - // Copy constructor - // TODO: Uncomment the copy constructor when you need it. - //basicEngine(const basicEngine& src); - - // Assignment operator - // TODO: Uncomment the assignment operator when you need it. - //basicEngine& operator=(const basicEngine& src); - virtual networkClientHandler * attachNewClient( int SocketID ){ return 0; }; - virtual bool detachClient( networkClientHandler *ptr ){ return false; }; - virtual bool start(){ return false; }; - virtual bool stop( bool force = true ){ return false; }; +class basicEngine: public basicObject { + private: + basicMutex m_mWMProtector; + uint8_t m_bWM; + public: + // Constructor + basicEngine(); + // Destructor + virtual ~basicEngine(); + + // Copy constructor + // TODO: Uncomment the copy constructor when you need it. + //basicEngine(const basicEngine& src); + + // Assignment operator + // TODO: Uncomment the assignment operator when you need it. + //basicEngine& operator=(const basicEngine& src); + // + //virtual networkClientHandler * attachNewClient( int SocketID ){ return 0; }; + //virtual bool detachClient( networkClientHandler *ptr ){ return false; }; + // + //virtual bool start(){ return false; }; + //virtual bool stop( bool force = true ){ return false; }; + virtual bool startService(){ return false; }; + virtual bool stopService(){ return true; }; + void setWM( uint8_t s ){ + m_mWMProtector.lock(); + m_bWM = s; + m_mWMProtector.unlock(); + }; + uint8_t getWM( void ){ + uint8_t s; + m_mWMProtector.lock(); + s = m_bWM; + m_mWMProtector.unlock(); + return s; + }; }; // Constructor implementation -inline basicEngine::basicEngine() -{ -} +inline basicEngine::basicEngine():basicObject(){}; // Destructor implementation -inline basicEngine::~basicEngine() -{ -} +inline basicEngine::~basicEngine(){}; // TODO: Uncomment the copy constructor when you need it. //inline basicEngine::basicEngine(const basicEngine& src) diff --git a/lib/components/base/basicEvent.h b/lib/components/base/basicEvent.h index 1ee1621a..25874590 100644 --- a/lib/components/base/basicEvent.h +++ b/lib/components/base/basicEvent.h @@ -141,6 +141,7 @@ typedef struct S_TARGET_DATA { C3D_DECART system_target; C3D_WGS84_LOC global_target; uint32_t digital; + uint8_t lrf_id; float area; }TARGET_DATA; @@ -153,7 +154,7 @@ typedef struct S_CLIENT_EVENT{ uint16_t range; uint8_t w_cnt; uint32_t a_th_node; -} CLIENT_EVENT; +} CLIENT_EVENT; //19 bytes typedef enum E_FH_MISSION_TYPE{ FH_MISSION_NO_MISSION = 0, diff --git a/lib/components/base/basicObject.cpp b/lib/components/base/basicObject.cpp index e4b18024..46fe4d82 100644 --- a/lib/components/base/basicObject.cpp +++ b/lib/components/base/basicObject.cpp @@ -1,20 +1,16 @@ #include "basicObject.h" +#include "../../alg/generic/md5.h" -U32 Global_Basic_Objects_Enumerator = 1; +U32 Global_Basic_Objects_Enumerator = 1; basicObject::basicObject(){ m_nID = Global_Basic_Objects_Enumerator++; - m_eCaps = OC_PASSIVE; - char Buffer[32]; - sprintf(Buffer, "%d", m_nID); + char Buffer[33]; + sprintf( Buffer, "%d", m_nID ); m_sUID = MD5String(Buffer); - m_eStatus = OS_STATUS_OK; }; basicObject::~basicObject(){ - free( m_sUID ); - if( m_eStatus >= OS_STATUS_INIT ){ - m_eStatus = OS_STATUS_DEAD; - }; + if( m_sUID ) free( m_sUID ); }; diff --git a/lib/components/base/basicObject.h b/lib/components/base/basicObject.h index c52c1a4f..cc280c07 100644 --- a/lib/components/base/basicObject.h +++ b/lib/components/base/basicObject.h @@ -16,22 +16,16 @@ #define __BASIC_OBJECT_HEADER__ #include "basicTypes.h" -#include "basicStatus.h" -#include "../../alg/generic/md5.h" class basicObject{ - protected: + private: CSTR m_sUID; U32 m_nID; - objectStatus m_eStatus; - objectCaps m_eCaps; public: basicObject(); ~basicObject(); - virtual objectStatus getStatus( void ){ return m_eStatus; }; virtual CSTR getObjectUID( void ){ return m_sUID; }; virtual int getObjectId( void ){ return m_nID; }; - virtual objectCaps getCaps( void ){ return m_eCaps; }; }; diff --git a/lib/components/base/basicTransport.cpp b/lib/components/base/basicTransport.cpp index 7aa5a78b..211c1821 100644 --- a/lib/components/base/basicTransport.cpp +++ b/lib/components/base/basicTransport.cpp @@ -7,8 +7,6 @@ basicTransport::basicTransport() :m_mQueueProtectorMutex(), m_mBufferProtectorMutex(){ m_pLog = basicLogCollection::getInstance(); m_eConnectionStatus = CS_UNKNOWN; - //LOG("C-Done"); - //m_bConnected = false; }; basicTransport::~basicTransport(){ @@ -16,7 +14,6 @@ basicTransport::~basicTransport(){ }; bool basicTransport::addRecipient( protocolParser *ProtoParser ){ - //LOG("Add Parser"); m_mQueueProtectorMutex.lock(); m_vParsers.push_back( ProtoParser ); ProtoParser->setConnectionStatus( m_eConnectionStatus ); diff --git a/lib/components/base/basicTransport.h b/lib/components/base/basicTransport.h index 7af1f58a..186fcd4d 100644 --- a/lib/components/base/basicTransport.h +++ b/lib/components/base/basicTransport.h @@ -9,7 +9,7 @@ #ifdef DEBUG //#ifndef DUBUG_COMMUNICATION - // #define DUBUG_COMMUNICATION + //#define DUBUG_COMMUNICATION //#endif #endif @@ -21,7 +21,6 @@ class basicTransport{ private: basicLogCollection * m_pLog; protected: - //bool m_bConnected; parseQueue m_vParsers; basicMutex m_mQueueProtectorMutex; basicMutex m_mBufferProtectorMutex; @@ -29,11 +28,11 @@ class basicTransport{ CONNECTION_STATUS m_eConnectionStatus; public: basicTransport(); - ~basicTransport(); - bool addRecipient( protocolParser *ProtoParser ); + ~basicTransport(); virtual bool sendData(unsigned char *Data, int DataSize){ return true; }; - bool getStatus( void ){ return m_eConnectionStatus == CS_CONNECTED; }; virtual bool reconnect( void ){ return false; }; + bool addRecipient( protocolParser *ProtoParser ); + bool getStatus( void ){ return m_eConnectionStatus == CS_CONNECTED; }; void setConnectionStatus( CONNECTION_STATUS ES); CONNECTION_STATUS getConnectionStatus( void ); }; diff --git a/lib/components/base/basicTypes.h b/lib/components/base/basicTypes.h index 024aa8f6..7728cb25 100644 --- a/lib/components/base/basicTypes.h +++ b/lib/components/base/basicTypes.h @@ -346,6 +346,41 @@ typedef struct S_SOFTWARE_INFO{ uint8_t DATA_VALID; } SOFTWARE_INFO; +typedef enum E_TWINC_SYNC_STATUSES{ + TWINC_SYNC_STATUS_SLAVE_CONNECTED = 0x01, + TWINC_SYNC_STATUS_SLAVE_PARAMS_OK = 0x02, + TWINC_SYNC_STATUS_SLAVE_SHADOW_OK = 0x04, + TWINC_SYNC_STATUS_SLAVE_SHADOW_EN = 0x08, + TWINC_SYNC_STATUS_MASTER_SHADOW_EN = 0x10 +}TWINC_SYNC_STATUSES; + +typedef struct S_HWM_CSTATUS{ + uint32_t HW_STATUS; + uint8_t _DETECTING_LRF; + uint8_t _MEASURED_LRF; + uint8_t _STUDING_LRF; + uint32_t _MP[8]; + uint32_t _GP[8]; + uint32_t _WP[8]; + uint32_t _FLIP_CNT; +} HWM_CSTATUS; + +typedef struct S_ALG_RUN_STATUS{ + uint32_t HW_STATUS; + uint16_t ENABLED_LRF; + uint16_t DETECTING_LRF; + uint32_t TH_READY; + uint32_t MASTER_MP[8]; + uint32_t MASTER_GP[8]; + uint32_t MASTER_WP[8]; + uint32_t MASTER_FLIP_CNT; + uint32_t SLAVE_MP[8]; + uint32_t SLAVE_GP[8]; + uint32_t SLAVE_WP[8]; + uint32_t SLAVE_FLIP_CNT; + uint8_t TWINC_STATUS; +}ALG_RUN_STATUS; + template struct basicRingElement{ T *data; U32 id; diff --git a/lib/data/net/clientPort.cpp b/lib/data/net/clientPort.cpp index 2fdf671e..a4c25634 100644 --- a/lib/data/net/clientPort.cpp +++ b/lib/data/net/clientPort.cpp @@ -62,6 +62,9 @@ clientPort::clientPort(CSTR Host, int Port, bool KeepALive ) :transportSocket(){ clientPort::~clientPort(){ //if (m_sHostName)free(m_sHostName); + LOG("Disconnecting on Destructor!"); + disconnect(); + LOG("Destructor Done!"); }; bool clientPort::create(){ @@ -204,7 +207,7 @@ bool clientPort::connectTo(CSTR Host, int Port){ return _connect(); }; -int clientPort::sendBlock(unsigned char *Data, int DataSize){ +int clientPort::sendBlock(unsigned char *Data, int DataSize){ if( m_eConnectionStatus != CS_CONNECTED ){ if( connectTo( m_cHostName, m_nPort ) ){ char MsgBuffer[CLOG]; @@ -231,11 +234,17 @@ int clientPort::sendBlock(unsigned char *Data, int DataSize){ return -1; }; if( RetVal < 0 ) RetVal = 0; -#ifdef DEBUG_EXTRA +#ifdef DUBUG_COMMUNICATION { char cBuffer[128]; sprintf(cBuffer,"Bytes Sent: %ld", RetVal); LOG(cBuffer); + #ifdef DUBUG_COMMUNICATION + for (int i = 0; i < RetVal; i++) { + sprintf(cBuffer, "0x%02X", Data[i]); + LOG(cBuffer); + }; + #endif } #endif } else { @@ -340,10 +349,16 @@ int clientPort::recptBlock(unsigned char *Buffer, int *BufferLength){ }; #endif if (RetVal > 0) { -#ifdef DEBUG - //char cBuffer[165]; - //sprintf(cBuffer, "Bytes received: %d", RetVal); - //LOG(cBuffer); +#ifdef DUBUG_COMMUNICATION + char cBuffer[165]; + sprintf(cBuffer, "Bytes received: %d", RetVal); + LOG(cBuffer); + #ifdef DUBUG_COMMUNICATION + for (int i = 0; i < RetVal; i++) { + sprintf(cBuffer, "0x%02X", Buffer[i]); + LOG(cBuffer); + }; + #endif #endif *BufferLength = RetVal; return RetVal; diff --git a/lib/data/net/netClientHandler.cpp b/lib/data/net/netClientHandler.cpp index 1dbd09f1..8f4ba1d3 100644 --- a/lib/data/net/netClientHandler.cpp +++ b/lib/data/net/netClientHandler.cpp @@ -11,7 +11,7 @@ #define LOG_ERROR( X ) m_pLog->Log( "NCH", this, _LOG_ERROR, X ); #endif -networkClientHandler::networkClientHandler( int SocketFD, basicEngine *ptr ): basicEventHandler(){ +networkClientHandler::networkClientHandler( int SocketFD, networkServiceEngine *ptr ): basicEventHandler(){ m_pLog = basicLogCollection::getInstance(); m_pEngine = ptr; /* Init of Port goes to Top Level Parser!! @@ -45,7 +45,7 @@ networkClientHandler::~networkClientHandler(){ # endif }; -bool networkClientHandler::attachEngine( basicEngine *ptr ){ +bool networkClientHandler::attachEngine( networkServiceEngine *ptr ){ if( ptr == NULL ) return false; m_pEngine = ptr; return true; diff --git a/lib/data/net/netClientHandler.h b/lib/data/net/netClientHandler.h index d51d05e1..a02d12bb 100644 --- a/lib/data/net/netClientHandler.h +++ b/lib/data/net/netClientHandler.h @@ -2,20 +2,21 @@ #define __NET_CLIENT_HANDLER_HEADER__ #include "../protocol/protocol.h" -#include "../../components/base/basicEngine.h" +//#include "../../components/base/basicEngine.h" #include "../../components/base/basicEventHandler.h" #include "../../components/base/basicLogCollection.h" #include "serverPort.h" +#include "netServiceEngine.h" class networkClientHandler: public basicEventHandler{ protected: - basicLogCollection * m_pLog; - basicEngine * m_pEngine; - serverPort * m_pPort; + basicLogCollection * m_pLog; + networkServiceEngine * m_pEngine; + serverPort * m_pPort; public: - explicit networkClientHandler( int SocketFD, basicEngine *ptr = NULL ); + explicit networkClientHandler( int SocketFD, networkServiceEngine *ptr = NULL ); virtual ~networkClientHandler(); - virtual bool attachEngine( basicEngine *ptr ); + virtual bool attachEngine( networkServiceEngine *ptr ); virtual void dispatchEvent( EVENT_CONTAINER *Evt ){}; virtual bool getStatus( void ){ return false; }; }; diff --git a/lib/data/net/netServer.cpp b/lib/data/net/netServer.cpp index 1342c11e..3258a67c 100644 --- a/lib/data/net/netServer.cpp +++ b/lib/data/net/netServer.cpp @@ -16,7 +16,7 @@ void signal_void_handler( int SIG ){ }; -networkServer::networkServer( config_setting_t *Settings, basicEngine *ptr ) : basicThread(){ +networkServer::networkServer( config_setting_t *Settings, networkServiceEngine *ptr ) : basicThread(){ m_pLog = basicLogCollection::getInstance(); m_bConnectionType = 0; m_vHandlersPool.clear(); @@ -276,7 +276,7 @@ bool networkServer::BootUp( U16 Port ){ return BootUp( m_pHostName, m_nPortNumber ); }; -bool networkServer::attachEngine( basicEngine *ptr ){ +bool networkServer::attachEngine( networkServiceEngine *ptr ){ m_pKernelEngine = ptr; if( m_vHandlersPool.size()) { // Pass Kernel to all already connected nodes diff --git a/lib/data/net/netServer.h b/lib/data/net/netServer.h index 598a165e..ebb38c4d 100644 --- a/lib/data/net/netServer.h +++ b/lib/data/net/netServer.h @@ -43,9 +43,10 @@ #include "../../components/base/basicLogCollection.h" #include "../../components/base/basicLogCollection.h" #include "../../components/base/basicSettingsProvider.h" -#include "../../components/base/basicEngine.h" +//#include "../../components/base/basicEngine.h" #include "../../components/base/basicEventHeap.h" #include "../protocol/protocol.h" +#include "netServiceEngine.h" #include "netClientHandler.h" @@ -65,7 +66,7 @@ class networkServer: public basicThread, public basicEventHandler{ private: basicLogCollection * m_pLog; vectorNetHandlers m_vHandlersPool; - basicEngine * m_pKernelEngine; + networkServiceEngine * m_pKernelEngine; config_setting_t * m_pSettings; struct sockaddr * MainSocketAddress; CSTR m_pHostName; @@ -79,7 +80,7 @@ class networkServer: public basicThread, public basicEventHandler{ protected: void m_fThreadProc( void ); public: - explicit networkServer( config_setting_t *Settings = NULL, basicEngine *ptr=NULL ); + explicit networkServer( config_setting_t *Settings = NULL, networkServiceEngine *ptr=NULL ); virtual ~networkServer(); bool BootUp( void ); // Config By Settings provided in constructor, on fail uses next BootUp bool BootUp( U16 Port ); // Uses Default Hostname and Port as parameter, on fail (getlocalhost) uses next Bootup @@ -87,7 +88,7 @@ class networkServer: public basicThread, public basicEventHandler{ #ifdef __linux__ bool BootUp( CSTR UNIX_SOCKET_NAME ); #endif - bool attachEngine( basicEngine *ptr ); + bool attachEngine( networkServiceEngine *ptr ); void dispatchEvent( EVENT_CONTAINER *Evt ); CSTR getAddress( void ){ return m_pHostName; }; uint16_t getPort( void ){ return m_nPortNumber; }; diff --git a/lib/data/net/netServiceEngine.h b/lib/data/net/netServiceEngine.h new file mode 100644 index 00000000..af62334c --- /dev/null +++ b/lib/data/net/netServiceEngine.h @@ -0,0 +1,24 @@ +#ifndef __NETWORK_SERVICE_ENGINE_HEADERS__ +#define __NETWORK_SERVICE_ENGINE_HEADERS__ + +#include "../../components/base/basicEngine.h" + +class networkClientHandler; + +class networkServiceEngine: public basicEngine { + public: + networkServiceEngine(); + virtual ~networkServiceEngine(); + virtual networkClientHandler * attachNewClient( int SocketID ){ return 0; }; + virtual bool detachClient( networkClientHandler *ptr ){ return false; }; + virtual bool start(){ return false; }; + virtual bool stop( bool force = true ){ return false; }; +}; + +// Constructor implementation +inline networkServiceEngine::networkServiceEngine():basicEngine(){}; + +// Destructor implementation +inline networkServiceEngine::~networkServiceEngine(){}; + +#endif \ No newline at end of file diff --git a/lib/data/net/serverPort.cpp b/lib/data/net/serverPort.cpp index c25f0f9c..f215a907 100644 --- a/lib/data/net/serverPort.cpp +++ b/lib/data/net/serverPort.cpp @@ -11,10 +11,6 @@ serverPort::serverPort( SOCKET AcceptedSocket ):transportSocket(){ m_pLog = basicLogCollection::getInstance(); m_nSocketFD = AcceptedSocket; m_bKeepAlive = true; - // Moved To Create Method of transportSocket - //if( m_bInitComplete = init() ) { - // setConnectionStatus( CS_CONNECTED ); - //}; }; @@ -22,7 +18,6 @@ serverPort::~serverPort(){ }; int serverPort::sendBlock(unsigned char *Data, int DataSize){ - if( !m_bInitComplete || m_eConnectionStatus!= CS_CONNECTED ) return -1; // Exit after unsuccess reconnect #ifdef __linux__ diff --git a/lib/data/protocol/protocolInternalLRF3D.cpp b/lib/data/protocol/protocolInternalLRF3D.cpp index 92adcd70..6bfeb83c 100644 --- a/lib/data/protocol/protocolInternalLRF3D.cpp +++ b/lib/data/protocol/protocolInternalLRF3D.cpp @@ -1,14 +1,14 @@ #include "protocolInternalLRF3D.h" -#define LOG( X ) m_pLog->Log( "protocolLRF3D", this, X ) +#define LOG( X ) m_pLog->Log( "PTWINC", 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( "protocolLRF3D", this, _LOG_ERROR, _tBfrErrMSG234 );\ + m_pLog->Log( "PTWINC", this, _LOG_ERROR, _tBfrErrMSG234 );\ } #else - #define LOG_ERROR( X ) m_pLog->Log( "protocolLRF3D", this, _LOG_ERROR, X ); + #define LOG_ERROR( X ) m_pLog->Log( "PTWINC", this, _LOG_ERROR, X ); #endif protocolInternalLRF3D::protocolInternalLRF3D(): protocolParser(){ @@ -27,7 +27,7 @@ int protocolInternalLRF3D::packetChecker( U8 *Buffer, size_t BufferSize ){ }; #endif if( Buffer[0] == 0xAA ){ - if( BufferSize > 5 ) { + if( BufferSize > 3 ) { #ifdef PRU_SLAVE if ((Buffer[1] & 0x80) == 0x80 ){ #else @@ -79,7 +79,7 @@ protocolPackage *protocolInternalLRF3D::packetExtractor( U8 *Buffer, size_t Buff }; #endif if( Buffer[0] == 0xAA ){ - if( BufferSize > 5 ){ + if( BufferSize > 3 ){ #ifdef PRU_SLAVE if ((Buffer[1] & 0x80) == 0x80 ) { #else @@ -130,6 +130,82 @@ bool protocolInternalLRF3D::sendACK( TWIN_COMMAND ACK_CMD ){ return m_oDataTransport->sendData( Package, FinishUpPackage( Package, TWI_CMD_INDEX+2 ) ); }; +bool protocolInternalLRF3D::sendNACK( TWIN_COMMAND ACK_CMD ){ + uint8_t Package[10]; + if( m_oDataTransport == NULL ) return false; + Package[TWI_CMD_INDEX] = TWC_NACK_CMD; + Package[TWI_CMD_INDEX+1] = ACK_CMD; + return m_oDataTransport->sendData( Package, FinishUpPackage( Package, TWI_CMD_INDEX+2 ) ); +}; + +bool protocolInternalLRF3D::sendDetectionParameters( PLGS_3D_PARAMETERS ptr ){ + uint8_t Buffer[1024]; + if( ptr == NULL ) return false; + Buffer[TWI_CMD_INDEX] = TWC_SET_CONFIG; + for( uint8_t idx = 0; idx < sizeof(LGS_3D_PARAMETERS); idx++ ) { + Buffer[TWI_PLS_INDEX+idx] = ((uint8_t *)ptr)[idx]; + }; + return m_oDataTransport->sendData(Buffer, FinishUpPackage(Buffer, TWI_PLS_INDEX+sizeof(LGS_3D_PARAMETERS))); +}; + +bool protocolInternalLRF3D::sendPolygone( uint8_t polyID, simplePolygone *SP ){ + uint16_t counter = TWI_PLS_INDEX+5; + uint8_t Buffer[PROTOCOL_PARSER_BUFFER_SIZE]; + + Buffer[TWI_CMD_INDEX] = TWC_SET_SHADOW_POLY; + Buffer[TWI_PLS_INDEX] = polyID; + Buffer[TWI_PLS_INDEX+1] = SP->count; + Buffer[TWI_PLS_INDEX+2] = SP->color[0]; + Buffer[TWI_PLS_INDEX+3] = SP->color[1]; + Buffer[TWI_PLS_INDEX+4] = SP->color[2]; + + for( uint8_t i = 0; i < SP->count; i++ ){ + uint16_t x,y; + x = SP->points[i].x(); + y = SP->points[i].y(); + Buffer[counter++] = ( x >> 8 ) & 0xFF; + Buffer[counter++] = x & 0xFF; + Buffer[counter++] = ( y >> 8 ) & 0xFF; + Buffer[counter++] = y & 0xFF; + }; +#ifdef DEBUG + LOG("sendPolygone"); +#endif + return m_oDataTransport->sendData( Buffer, FinishUpPackage( Buffer, counter ) ); +}; + +bool protocolInternalLRF3D::sendShadowTrace( vectorZoneMask *VM ){ + uint8_t Buffer[PROTOCOL_PARSER_BUFFER_SIZE]; + uint16_t counter = TWI_PLS_INDEX+2; + uint16_t tVal = VM->size(); + + Buffer[TWI_CMD_INDEX] = TWC_SET_SHADOW_TRACE; + Buffer[TWI_PLS_INDEX] = ( tVal >> 8 ) & 0xFF; + Buffer[TWI_PLS_INDEX+1] = tVal & 0xFF; + + for( uint16_t i = 0; i < tVal; i++ ){ + uint16_t x, y, start, stop; + x = VM->at( i )->column; + y = VM->at( i )->count; + Buffer[counter++] = ( x >> 8 ) & 0xFF; + Buffer[counter++] = x & 0xFF; + Buffer[counter++] = ( y >> 8 ) & 0xFF; + Buffer[counter++] = y & 0xFF; + for( uint8_t j = 0; j < y; j++ ){ + start = VM->at( i )->zones[j].start; + stop = VM->at( i )->zones[j].stop; + Buffer[counter++] = ( start >> 8 ) & 0xFF; + Buffer[counter++] = start & 0xFF; + Buffer[counter++] = ( stop >> 8 ) & 0xFF; + Buffer[counter++] = stop & 0xFF; + }; + }; +#ifdef DEBUG + LOG("sendShadowTrace"); +#endif + return m_oDataTransport->sendData(Buffer, FinishUpPackage( Buffer, counter ) ); +}; + bool protocolInternalLRF3D::sendPlainCMD( TWIN_COMMAND CMD ){ uint8_t Package[10]; #ifdef DEBUG @@ -193,79 +269,52 @@ bool protocolInternalLRF3D::sendPlainCMD( TWIN_COMMAND CMD ){ node_index++; }; #ifdef DEBUG - LOG("TH Data Segment"); + LOG("TH Data->"); #endif return m_oDataTransport->sendData( Buffer, FinishUpPackage( Buffer, index ) ); }; - bool protocolInternalLRF3D_SLAVE::pushTarget( targetRecord *ptr ){ + bool protocolInternalLRF3D_SLAVE::sendTarget( 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]; - if( m_nTargetCount > 0 ) { - Buffer[3] = TWC_PUSH_TARGET; - uint32_t index = 5; - uint8_t target_index = 0; - m_mTargetProtector.lock(); - while ( ( index < ( TWI_MAX_PACKAGE_SIZE_BYTES - 21 ) ) && ( target_index < m_nTargetCount ) ){ - Buffer[index++] = (m_pTargets[ target_index ].width >> 24 ) & 0xFF; - Buffer[index++] = (m_pTargets[ target_index ].width >> 16 ) & 0xFF; - Buffer[index++] = (m_pTargets[ target_index ].width >> 8 ) & 0xFF; - Buffer[index++] = m_pTargets[ target_index ].width & 0xFF; - Buffer[index++] = (m_pTargets[ target_index ].begin_id >> 24 ) & 0xFF; - Buffer[index++] = (m_pTargets[ target_index ].begin_id >> 16 ) & 0xFF; - Buffer[index++] = (m_pTargets[ target_index ].begin_id >> 8 ) & 0xFF; - Buffer[index++] = m_pTargets[ target_index ].begin_id & 0xFF; - Buffer[index++] = (m_pTargets[ target_index ].end_id >> 8 ) & 0xFF; - Buffer[index++] = m_pTargets[ target_index ].end_id & 0xFF; - Buffer[index++] = (m_pTargets[ target_index ].end_id >> 8 ) & 0xFF; - Buffer[index++] = m_pTargets[ target_index ].end_id & 0xFF; - Buffer[index++] = (m_pTargets[ target_index ].range_min >> 24 ) & 0xFF; - Buffer[index++] = (m_pTargets[ target_index ].range_min >> 16 ) & 0xFF; - Buffer[index++] = (m_pTargets[ target_index ].range_max >> 8 ) & 0xFF; - Buffer[index++] = m_pTargets[ target_index ].range_max & 0xFF; - Buffer[index++] = (m_pTargets[ target_index ].status >> 24 ) & 0xFF; - Buffer[index++] = (m_pTargets[ target_index ].status >> 16 ) & 0xFF; - Buffer[index++] = (m_pTargets[ target_index ].status >> 8 ) & 0xFF; - Buffer[index++] = m_pTargets[ target_index ].status & 0xFF; - target_index++; - }; - m_nTargetCount -= target_index; - m_nStatus = ( m_nStatus & 0x00fffffe ) | ( m_nTargetCount << 24 ); - m_mTargetProtector.unlock(); - Buffer[4] = target_index; #ifdef DEBUG - LOG("Targets"); + LOG("Target->"); #endif - return m_oDataTransport->sendData( Buffer, FinishUpPackage( Buffer, index ) ); - } else { - Buffer[3] = TWC_PUSH_TARGET; - Buffer[4] = 0; - return m_oDataTransport->sendData( Buffer, FinishUpPackage( Buffer, 5 ) ); - }; - }; -*/ - bool protocolInternalLRF3D_SLAVE::sendStatus( uint32_t m_nStatus ){ + return m_oDataTransport->sendData(Buffer, FinishUpPackage(Buffer, TWI_PLS_INDEX+sizeof(targetRecord))); + }; + + bool protocolInternalLRF3D_SLAVE::sendStatus( TWI_PEER_STATUS *ptr ){ if( m_oDataTransport == NULL ) return false; - uint8_t Buffer[16]; - 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 ); + if( ptr == NULL ) return false; + uint8_t Buffer[64]; + Buffer[TWI_CMD_INDEX] = TWC_CURRENT_STATUS; + for( uint8_t idx = 0; idx < sizeof(TWI_PEER_STATUS); idx++ ) { + Buffer[TWI_PLS_INDEX+idx] = ((uint8_t *)ptr)[idx]; + }; #ifdef DEBUG LOG("Status->"); #endif - return m_oDataTransport->sendData( Buffer, FinishUpPackage( Buffer, 8 ) ); + return m_oDataTransport->sendData( Buffer, FinishUpPackage(Buffer, TWI_PLS_INDEX+sizeof(TWI_PEER_STATUS))); }; + + bool protocolInternalLRF3D_SLAVE::sendShadowInfo( TWI_MASK_INFO *ptr ){ + if( m_oDataTransport == NULL ) return false; + if( ptr == NULL ) return false; + uint8_t Buffer[64]; + Buffer[TWI_CMD_INDEX] = TWC_SHADOW_INFO; + for( uint8_t idx = 0; idx < sizeof(TWI_MASK_INFO); idx++ ) { + Buffer[TWI_PLS_INDEX+idx] = ((uint8_t *)ptr)[idx]; + }; +#ifdef DEBUG + LOG("ShadowInfo->"); +#endif + return m_oDataTransport->sendData( Buffer, FinishUpPackage( Buffer, TWI_PLS_INDEX+sizeof(TWI_MASK_INFO) ) ); + }; + bool protocolInternalLRF3D_SLAVE::sendMode( uint8_t mode ){ if( m_oDataTransport == NULL ) return false; uint8_t Buffer[16]; @@ -278,14 +327,14 @@ bool protocolInternalLRF3D::sendPlainCMD( TWIN_COMMAND CMD ){ }; bool protocolInternalLRF3D_SLAVE::sendVersion( SOFTWARE_INFO *sv ){ - uint8_t Buffer[1024]; + uint8_t Buffer[64]; 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->"); + LOG("Version->"); #endif return m_oDataTransport->sendData( Buffer, FinishUpPackage( Buffer, TWI_PLS_INDEX + sizeof(SOFTWARE_INFO) ) ); }; @@ -327,20 +376,18 @@ bool protocolInternalLRF3D::sendPlainCMD( TWIN_COMMAND CMD ){ return m_oDataTransport->sendData( Buffer, FinishUpPackage( Buffer, TWI_PLS_INDEX+3 ) ); }; - bool protocolInternalLRF3D_MASTER::ackShadowSegment( uint32_t dataIdx ){ + bool protocolInternalLRF3D_MASTER::getShadowPoly( uint8_t polyID ){ if( m_oDataTransport == NULL ) return false; uint8_t Buffer[16]; - 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 ); + Buffer[TWI_CMD_INDEX] = TWC_GET_SHADOW_POLY; + Buffer[TWI_PLS_INDEX] = polyID; #ifdef DEBUG - LOG("Shadow Data Seg"); + LOG("ShadowPoly Req"); #endif - return m_oDataTransport->sendData( Buffer, FinishUpPackage( Buffer, TWI_PLS_INDEX+3 ) ); + return m_oDataTransport->sendData( Buffer, FinishUpPackage( Buffer, TWI_PLS_INDEX+1 ) ); }; - bool protocolInternalLRF3D_MASTER::requestThresholdData( uint8_t lrf_id ){ + bool protocolInternalLRF3D_MASTER::getTHData( uint8_t lrf_id ){ if( m_oDataTransport == NULL ) return false; uint8_t Buffer[16]; Buffer[TWI_CMD_INDEX] = TWC_GET_THRESHOLD; diff --git a/lib/data/protocol/protocolInternalLRF3D.h b/lib/data/protocol/protocolInternalLRF3D.h index 5d84de25..cfd2283b 100644 --- a/lib/data/protocol/protocolInternalLRF3D.h +++ b/lib/data/protocol/protocolInternalLRF3D.h @@ -6,7 +6,9 @@ #include #include "protocol.h" +#include "../../alg/lgs/detectorStructures.h" #include "../../hardware/soc/general/3DLRF.h" +#include "../../alg/lgs/mask.h" #ifdef PRU_SLAVE @@ -28,6 +30,7 @@ typedef enum E_TWIN_COMMAND{ TWC_SET_EVT_MODE, TWC_ACK_CMD, + TWC_NACK_CMD, TWC_GET_MODE, TWC_CURRENT_MODE, @@ -36,16 +39,19 @@ typedef enum E_TWIN_COMMAND{ 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_SHADOW_INFO, + TWC_SHADOW_INFO, + TWC_GET_SHADOW_POLY, + TWC_SET_SHADOW_POLY, + TWC_GET_SHADOW_TRACE, + TWC_SET_SHADOW_TRACE, + TWC_SHADOW_DATA_POLY, + TWC_SHADOW_DATA_RAY, TWC_GET_THRESHOLD, TWC_TH_DATA, @@ -64,6 +70,32 @@ typedef struct S_TWI_CMD_CONTAINER{ void * DATA; }TWI_CMD_CONTAINER; +typedef struct S_TWI_MASK_INFO{ + uint32_t active: 1; + uint32_t poly_cnt: 8; + uint32_t nouse: 7; + uint32_t ray_cnt: 16; +}TWI_MASK_INFO; + +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 VERSION_IS_SYNCED; + bool SETTINGS_IS_SYNCED; + bool SHADOW_IS_SYNCED; +}TWIN_STATUS; + typedef std::queue TWI_CMD_QUEUE; @@ -122,7 +154,11 @@ class protocolInternalLRF3D: public protocolParser { return Size + 1; }; bool sendACK( TWIN_COMMAND ACK_CMD ); + bool sendNACK( TWIN_COMMAND ACK_CMD ); bool sendPlainCMD( TWIN_COMMAND ACK_CMD ); + bool sendDetectionParameters( PLGS_3D_PARAMETERS ptr ); + bool sendPolygone( uint8_t polyID, simplePolygone *SP ); + bool sendShadowTrace( vectorZoneMask *ZM ); public: protocolInternalLRF3D(); virtual ~protocolInternalLRF3D(); @@ -144,10 +180,12 @@ class protocolInternalLRF3D: public protocolParser { bool ackShadowSegment( uint32_t dataIdx = 0 ); bool resetChannel(void); - bool pushTarget( targetRecord *ptr ); + bool sendShadowInfo( TWI_MASK_INFO *ptr ); + bool sendTarget( targetRecord *ptr ); bool sendTrasholdData( thresholdNode *data, uint32_t dataIdx = 0 ); + bool sendCurrentParameters( PLGS_3D_PARAMETERS ptr ); bool sendMode( uint8_t mode ); - bool sendStatus( uint32_t m_nStatus ); + bool sendStatus( TWI_PEER_STATUS *ptr ); bool sendVersion( SOFTWARE_INFO *sv ); }; #else //!PRU_SLAVE @@ -162,11 +200,11 @@ class protocolInternalLRF3D: public protocolParser { virtual ~protocolInternalLRF3D_MASTER(); virtual bool create(void); bool resetChannel(void); - + bool getShadowPoly( uint8_t polyID ); bool ackThresholdSegment( uint32_t dataIdx = 0 ); bool ackShadowSegment( uint32_t dataIdx = 0 ); - bool requestThresholdData( uint8_t lrf_id ); + bool getTHData( uint8_t lrf_id ); bool sendMode( uint8_t Mode ); bool sendSoftwareUpdate( uint8_t *ptr ); diff --git a/lib/data/protocol/protocolLGS3D.cpp b/lib/data/protocol/protocolLGS3D.cpp index 69250601..17332d13 100644 --- a/lib/data/protocol/protocolLGS3D.cpp +++ b/lib/data/protocol/protocolLGS3D.cpp @@ -28,7 +28,6 @@ protocolLGS_3D::~protocolLGS_3D(){ # ifdef DEBUG LOG("Destructor Begin"); # endif - m_mInquiryMutex.unlock(); # ifdef DEBUG LOG("Destructor End"); # endif @@ -130,6 +129,45 @@ protocolPackage *protocolLGS_3D::packetExtractor(U8 *Buffer, size_t BufferSize ) return NULL; }; +bool protocolLGS_3D::sendACK( uint8_t CMD ){ + if( m_oDataTransport == NULL ) return false; + m_mBufferProtector.lock(); + m_pWorkingBuffer[4] = CMD_ACK; + m_pWorkingBuffer[5] = CMD; +#ifdef DEBUG_EXTRA + LOG("sendACK"); +#endif + bool rv = m_oDataTransport->sendData( m_pWorkingBuffer, FinishUpPackage( m_pWorkingBuffer, 6, m_bDeviceID)); + m_mBufferProtector.unlock(); + return rv; +}; + +bool protocolLGS_3D::sendNACK( uint8_t CMD ){ + if( m_oDataTransport == NULL ) return false; + m_mBufferProtector.lock(); + m_pWorkingBuffer[4] = CMD_NACK; + m_pWorkingBuffer[5] = CMD; +#ifdef DEBUG_EXTRA + LOG("sendNACK"); +#endif + bool rv = m_oDataTransport->sendData( m_pWorkingBuffer, FinishUpPackage( m_pWorkingBuffer, 6, m_bDeviceID)); + m_mBufferProtector.unlock(); + return rv; +}; + +bool protocolLGS_3D::sendIDONK( uint8_t CMD ){ + if( m_oDataTransport == NULL ) return false; + m_mBufferProtector.lock(); + m_pWorkingBuffer[4] = CMD_IDONK; + m_pWorkingBuffer[5] = CMD; +#ifdef DEBUG_EXTRA + LOG("sendIDONK"); +#endif + bool rv = m_oDataTransport->sendData( m_pWorkingBuffer, FinishUpPackage( m_pWorkingBuffer, 6, m_bDeviceID)); + m_mBufferProtector.unlock(); + return rv; +}; + #undef SIZE_IDX #undef DEV_ID_IDX #undef CMD_IDX diff --git a/lib/data/protocol/protocolLGS3D.h b/lib/data/protocol/protocolLGS3D.h index 2f591ba5..fdb2e5a5 100644 --- a/lib/data/protocol/protocolLGS3D.h +++ b/lib/data/protocol/protocolLGS3D.h @@ -5,11 +5,14 @@ #include "../../alg/lgs/detectorStructures.h" #include "protocolLGS_data.h" +//#define DUBUG_COMMUNICATION + class protocolLGS_3D: public protocolParser{ private: basicLogCollection * m_pLog; - basicMutex m_mInquiryMutex; protected: + basicMutex m_mBufferProtector; + uint8_t m_pWorkingBuffer[MAXIMAL_SOCKET_PACKET_LENGTH]; uint8_t m_bDeviceID; inline int FinishUpPackage( uint8_t *Buffer, size_t Size, uint8_t DeviceID ){ Buffer[0] = 0x55; @@ -27,6 +30,9 @@ class protocolLGS_3D: public protocolParser{ virtual bool create(void){ return protocolParser::create(); }; uint8_t getDeviceID(void) { return m_bDeviceID; }; bool setDeviceID( uint8_t DeviceID ){ m_bDeviceID = DeviceID; return true; }; + bool sendACK( uint8_t CMD ); + bool sendNACK( uint8_t CMD ); + bool sendIDONK( uint8_t CMD ); }; #endif diff --git a/lib/data/protocol/protocolLGS3D_client.cpp b/lib/data/protocol/protocolLGS3D_client.cpp index 703b52ff..12c367f1 100644 --- a/lib/data/protocol/protocolLGS3D_client.cpp +++ b/lib/data/protocol/protocolLGS3D_client.cpp @@ -70,11 +70,21 @@ bool protocolLGS3D_Client::getState2( void ){ Buffer[SUB_CMD_IDX] = 0x00; #endif #ifdef DEBUG - // LOG("getState2"); + LOG("getState2"); #endif return m_oDataTransport->sendData(Buffer, FinishUpPackage( Buffer, 6, m_bDeviceID)); }; +bool protocolLGS3D_Client::getEvents( void ){ + if( m_oDataTransport == NULL ) return false; + U8 Buffer[16]; + Buffer[CMD_IDX] = CMD_GET_LAST_EVENTS; +#ifdef DEBUG + LOG("getEvents"); +#endif + return m_oDataTransport->sendData(Buffer, FinishUpPackage( Buffer, SUB_CMD_IDX, m_bDeviceID)); +}; + bool protocolLGS3D_Client::doFullReset( void ){ if( m_oDataTransport == NULL ) return false; U8 Buffer[16]; @@ -140,22 +150,24 @@ bool protocolLGS3D_Client::setMode( U8 Mode ){ return m_oDataTransport->sendData(Buffer, FinishUpPackage(Buffer, 6, m_bDeviceID)); }; -bool protocolLGS3D_Client::getParameters( void ){ +bool protocolLGS3D_Client::getParameters( bool master ){ if( m_oDataTransport == NULL ) return false; U8 Buffer[16]; Buffer[CMD_IDX] = CMD_GET_PARAMETERS; + Buffer[SUB_CMD_IDX] = (master)?0x01:0x02; #ifdef DEBUG LOG("getParameters"); #endif - return m_oDataTransport->sendData(Buffer, FinishUpPackage( Buffer, 5, m_bDeviceID )); + return m_oDataTransport->sendData(Buffer, FinishUpPackage( Buffer, 6, m_bDeviceID )); }; -bool protocolLGS3D_Client::setParameters( PLGS_3D_PARAMETERS ptr ){ +bool protocolLGS3D_Client::setParameters( PLGS_3D_PARAMETERS ptr, bool master ){ if( m_oDataTransport == NULL ) return false; U8 counter; U8 Buffer[64]; Buffer[CMD_IDX] = CMD_SET_PARAMETERS; - counter = SUB_CMD_IDX; + Buffer[SUB_CMD_IDX] = (master)?0x01:0x02; + counter = SUB_CMD_IDX+1; for( int i=0; i < sizeof( LGS_3D_PARAMETERS ); i++ ){ Buffer[counter] = *(((U8*)ptr)+i); counter++; @@ -273,6 +285,16 @@ bool protocolLGS3D_Client::setShadowTrace( vectorZoneMask *VM ){ return m_oDataTransport->sendData(Buffer, FinishUpPackage(Buffer, counter, m_bDeviceID ) ); }; +bool protocolLGS3D_Client::getTwincSupport( void ){ + if( m_oDataTransport == NULL ) return false; + U8 Buffer[16]; + Buffer[CMD_IDX] = CMD_QUERY_TWINK_LINK; +#ifdef DEBUG + LOG("getTwincSupport"); +#endif + return m_oDataTransport->sendData(Buffer, FinishUpPackage(Buffer, SUB_CMD_IDX, m_bDeviceID)); +}; + #undef SIZE_IDX #undef DEV_ID_IDX #undef CMD_IDX diff --git a/lib/data/protocol/protocolLGS3D_client.h b/lib/data/protocol/protocolLGS3D_client.h index c1b4535f..9a32cad4 100644 --- a/lib/data/protocol/protocolLGS3D_client.h +++ b/lib/data/protocol/protocolLGS3D_client.h @@ -18,18 +18,22 @@ class protocolLGS3D_Client: public protocolLGS_3D{ bool doStartMotors( void ); bool doStopMotors( void ); bool getDraw( uint32_t SampleID, uint8_t KernelID = 0 ); - bool getParameters( void ); + bool getParameters( bool master = true ); bool getShadowPoly( uint8_t PolyID ); bool getShadowStatus( uint8_t MaskID = 0 ); bool getShadowInfo( void ); + bool getTwincSupport( void ); bool getVoltage(void); bool getState( void ); bool getState2( void ); + bool getEvents( void ); bool setMode( U8 Mode ); bool setShadowPoly( simplePolygone *SP ); bool setShadowStatus( bool Status, uint8_t MaskID = 0 ); bool setShadowTrace( vectorZoneMask *VM ); - bool setParameters( PLGS_3D_PARAMETERS ptr ); + bool setParameters( PLGS_3D_PARAMETERS ptr, bool master = true ); + + }; #endif diff --git a/lib/data/protocol/protocolLGS3D_server.cpp b/lib/data/protocol/protocolLGS3D_server.cpp index c2daa1e5..cafae433 100644 --- a/lib/data/protocol/protocolLGS3D_server.cpp +++ b/lib/data/protocol/protocolLGS3D_server.cpp @@ -29,21 +29,23 @@ protocolLGS3D_Server::~protocolLGS3D_Server(){ bool protocolLGS3D_Server::sendBorderError(uint8_t Error){ if( m_oDataTransport == NULL ) return false; - U8 Buffer[16]; - Buffer[CMD_IDX] = CMD_BORDER; - Buffer[SUB_CMD_IDX] = Error; -# ifdef DEBUG + m_mBufferProtector.lock(); + m_pWorkingBuffer[CMD_IDX] = CMD_BORDER; + m_pWorkingBuffer[SUB_CMD_IDX] = Error; +#ifdef DEBUG_EXTRA LOG("sendBorderError"); -# endif - return m_oDataTransport->sendData(Buffer, FinishUpPackage(Buffer, 6, m_bDeviceID)); +#endif + bool rv = m_oDataTransport->sendData(m_pWorkingBuffer, FinishUpPackage(m_pWorkingBuffer, 6, m_bDeviceID)); + m_mBufferProtector.unlock(); + return rv; }; + bool protocolLGS3D_Server::sendBorderData(uint32_t SampleID, uint8_t KernelID, thresholdNode *WorkingSAF){ if( m_oDataTransport == NULL ) return false; - U8 Buffer[PROTOCOL_PARSER_BUFFER_SIZE]; - - Buffer[CMD_IDX] = CMD_BORDER; - Buffer[SUB_CMD_IDX] = BD_ANGLEMASK | BD_RANGE0MASK | BD_RANGE1MASK; + m_mBufferProtector.lock(); + m_pWorkingBuffer[CMD_IDX] = CMD_BORDER; + m_pWorkingBuffer[SUB_CMD_IDX] = BD_ANGLEMASK | BD_RANGE0MASK | BD_RANGE1MASK; int index = 6; int cCount = 0; int node_index = SampleID; @@ -51,305 +53,359 @@ bool protocolLGS3D_Server::sendBorderData(uint32_t SampleID, uint8_t KernelID, t thresholdNode cNode; //cNode = WorkingSAF[node_index++]; memcpy( &cNode, &WorkingSAF[node_index++], sizeof(thresholdNode)); - Buffer[index++] = (cNode.data >> 24 ) & 0xFE; // to clear Sunbit data - Buffer[index++] = (cNode.data >> 16 ) & 0xFF; - Buffer[index++] = (cNode.data >> 8 ) & 0xFF; - Buffer[index++] = cNode.data & 0xFF; + m_pWorkingBuffer[index++] = (cNode.data >> 24 ) & 0xFE; // to clear Sunbit data + m_pWorkingBuffer[index++] = (cNode.data >> 16 ) & 0xFF; + m_pWorkingBuffer[index++] = (cNode.data >> 8 ) & 0xFF; + m_pWorkingBuffer[index++] = cNode.data & 0xFF; cCount++; }; -#ifdef DEBUG +#ifdef DEBUG_EXTRA LOG("sendBorderData"); #endif - return m_oDataTransport->sendData(Buffer, FinishUpPackage(Buffer, 5 + index, m_bDeviceID)); + bool rv = m_oDataTransport->sendData(m_pWorkingBuffer, FinishUpPackage(m_pWorkingBuffer, 5 + index, m_bDeviceID)); + m_mBufferProtector.unlock(); + return rv; }; bool protocolLGS3D_Server::sendTarget(U16 Angle, U16 Azimuth, U16 Range){ if( m_oDataTransport == NULL ) return false; - U8 Buffer[16]; - Buffer[CMD_IDX] = CMD_TARGET; - Buffer[5] = ( Angle >> 8 ) & 0xFF; - Buffer[6] = Angle & 0xFF; - Buffer[7] = ( Azimuth >> 8 ) & 0xFF; - Buffer[8] = Azimuth & 0xFF; - Buffer[9] = ( Range >> 8 ) & 0xFF; - Buffer[10] = Range & 0xFF; -#ifndef SKIP_TARGET_LOG - #ifdef DEBUG - LOG("sendTarget"); - #endif + m_mBufferProtector.lock(); + m_pWorkingBuffer[CMD_IDX] = CMD_TARGET; + m_pWorkingBuffer[5] = ( Angle >> 8 ) & 0xFF; + m_pWorkingBuffer[6] = Angle & 0xFF; + m_pWorkingBuffer[7] = ( Azimuth >> 8 ) & 0xFF; + m_pWorkingBuffer[8] = Azimuth & 0xFF; + m_pWorkingBuffer[9] = ( Range >> 8 ) & 0xFF; + m_pWorkingBuffer[10] = Range & 0xFF; +#ifdef DEBUG_EXTRA + LOG("sendTarget"); #endif - return m_oDataTransport->sendData(Buffer, FinishUpPackage(Buffer, 11, m_bDeviceID)); + bool rv = m_oDataTransport->sendData(m_pWorkingBuffer, FinishUpPackage(m_pWorkingBuffer, 11, m_bDeviceID)); + m_mBufferProtector.unlock(); + return rv; }; bool protocolLGS3D_Server::sendTargetW(U16 Angle, U16 Azimuth, U16 Range, U32 Width){ if( m_oDataTransport == NULL ) return false; - U8 Buffer[16]; - Buffer[CMD_IDX] = CMD_TARGET_WW; - Buffer[5] = ( Angle >> 8 ) & 0xFF; - Buffer[6] = Angle & 0xFF; - Buffer[7] = ( Azimuth >> 8 ) & 0xFF; - Buffer[8] = Azimuth & 0xFF; - Buffer[9] = ( Range >> 8 ) & 0xFF; - Buffer[10] = Range & 0xFF; - Buffer[11] = ( Width >> 24 ) & 0xFF; - Buffer[12] = ( Width >> 16 ) & 0xFF; - Buffer[13] = ( Width >> 8 ) & 0xFF; - Buffer[14] = Width & 0xFF; -#ifndef SKIP_TARGET_LOG - #ifdef DEBUG + m_mBufferProtector.lock(); + m_pWorkingBuffer[CMD_IDX] = CMD_TARGET_WW; + m_pWorkingBuffer[5] = ( Angle >> 8 ) & 0xFF; + m_pWorkingBuffer[6] = Angle & 0xFF; + m_pWorkingBuffer[7] = ( Azimuth >> 8 ) & 0xFF; + m_pWorkingBuffer[8] = Azimuth & 0xFF; + m_pWorkingBuffer[9] = ( Range >> 8 ) & 0xFF; + m_pWorkingBuffer[10] = Range & 0xFF; + m_pWorkingBuffer[11] = ( Width >> 24 ) & 0xFF; + m_pWorkingBuffer[12] = ( Width >> 16 ) & 0xFF; + m_pWorkingBuffer[13] = ( Width >> 8 ) & 0xFF; + m_pWorkingBuffer[14] = Width & 0xFF; +#ifdef DEBUG_EXTRA LOG("sendTargetW"); - #endif #endif - return m_oDataTransport->sendData(Buffer, FinishUpPackage(Buffer, 15, m_bDeviceID)); + bool rv = m_oDataTransport->sendData(m_pWorkingBuffer, FinishUpPackage(m_pWorkingBuffer, 15, m_bDeviceID)); + m_mBufferProtector.unlock(); + return rv; }; bool protocolLGS3D_Server::sendTargetM( uint32_t SampleID, U8 Kernel, U16 Range, U32 Width, bool isBlack ){ if( m_oDataTransport == NULL ) return false; - U8 Buffer[18]; - Buffer[CMD_IDX] = (isBlack) ? CMD_TARGET_MB : CMD_TARGET_MW; - Buffer[5] = (SampleID >> 24) & 0xFF; - Buffer[6] = (SampleID >> 16) & 0xFF; - Buffer[7] = (SampleID >> 8) & 0xFF; - Buffer[8] = SampleID & 0xFF; - Buffer[9] = Kernel; - Buffer[10] = (Range >> 8) & 0xFF; - Buffer[11] = Range & 0xFF; - Buffer[12] = (Width >> 24) & 0xFF; - Buffer[13] = (Width >> 16) & 0xFF; - Buffer[14] = (Width >> 8) & 0xFF; - Buffer[15] = Width & 0xFF; -#ifndef SKIP_TARGET_LOG - #ifdef DEBUG + m_mBufferProtector.lock(); + m_pWorkingBuffer[CMD_IDX] = (isBlack) ? CMD_TARGET_MB : CMD_TARGET_MW; + m_pWorkingBuffer[5] = (SampleID >> 24) & 0xFF; + m_pWorkingBuffer[6] = (SampleID >> 16) & 0xFF; + m_pWorkingBuffer[7] = (SampleID >> 8) & 0xFF; + m_pWorkingBuffer[8] = SampleID & 0xFF; + m_pWorkingBuffer[9] = Kernel; + m_pWorkingBuffer[10] = (Range >> 8) & 0xFF; + m_pWorkingBuffer[11] = Range & 0xFF; + m_pWorkingBuffer[12] = (Width >> 24) & 0xFF; + m_pWorkingBuffer[13] = (Width >> 16) & 0xFF; + m_pWorkingBuffer[14] = (Width >> 8) & 0xFF; + m_pWorkingBuffer[15] = Width & 0xFF; +#ifdef DEBUG_EXTRA LOG("sendTargetW"); - #endif #endif - return m_oDataTransport->sendData(Buffer, FinishUpPackage(Buffer, 16, m_bDeviceID)); + bool rv = m_oDataTransport->sendData(m_pWorkingBuffer, FinishUpPackage(m_pWorkingBuffer, 16, m_bDeviceID)); + m_mBufferProtector.unlock(); + return rv; }; bool protocolLGS3D_Server::sendTargetZ( TARGET_DATA *ptr ){ if( m_oDataTransport == NULL ) return false; - U8 Buffer[256]; + m_mBufferProtector.lock(); uint8_t cnt; - Buffer[CMD_IDX] = CMD_TARGET_ZZ; + m_pWorkingBuffer[CMD_IDX] = CMD_TARGET_ZZ; cnt = SUB_CMD_IDX; for( int index = 0; index < sizeof(TARGET_DATA); index++ ){ - Buffer[cnt++] = ((uint8_t *)ptr )[index]; + m_pWorkingBuffer[cnt++] = ((uint8_t *)ptr )[index]; }; -#ifndef SKIP_TARGET_LOG - #ifdef DEBUG +#ifdef DEBUG_EXTRA LOG("sendTargetZ"); - #endif #endif - return m_oDataTransport->sendData(Buffer, FinishUpPackage(Buffer, cnt, m_bDeviceID)); + bool rv = m_oDataTransport->sendData(m_pWorkingBuffer, FinishUpPackage(m_pWorkingBuffer, cnt, m_bDeviceID)); + m_mBufferProtector.unlock(); + return rv; }; bool protocolLGS3D_Server::sendFlip(U16 Count){ if( m_oDataTransport == NULL ) return false; - U8 Buffer[16]; - Buffer[CMD_IDX] = CMD_FLIP_COMPLETE; - Buffer[5] = ( Count >> 8 ) & 0xFF; - Buffer[6] = Count & 0xFF; -#ifdef DEBUG + m_mBufferProtector.lock(); + m_pWorkingBuffer[CMD_IDX] = CMD_FLIP_COMPLETE; + m_pWorkingBuffer[5] = ( Count >> 8 ) & 0xFF; + m_pWorkingBuffer[6] = Count & 0xFF; +#ifdef DEBUG_EXTRA LOG("sendFlip"); #endif - return m_oDataTransport->sendData(Buffer, FinishUpPackage(Buffer, 7, m_bDeviceID)); + bool rv = m_oDataTransport->sendData(m_pWorkingBuffer, FinishUpPackage(m_pWorkingBuffer, 7, m_bDeviceID)); + m_mBufferProtector.unlock(); + return rv; }; -bool protocolLGS3D_Server::sendEvent(U8 Code){ +bool protocolLGS3D_Server::sendMode(U8 Mode){ if( m_oDataTransport == NULL ) return false; - U8 Buffer[16]; - Buffer[CMD_IDX] = CMD_EVT; - Buffer[SUB_CMD_IDX] = Code; -#ifdef DEBUG - LOG("sendEvent"); + m_mBufferProtector.lock(); + m_pWorkingBuffer[CMD_IDX] = CMD_MODE; + m_pWorkingBuffer[SUB_CMD_IDX] = Mode | 0x80; +#ifdef DEBUG_EXTRA + LOG("sendMode"); #endif - return m_oDataTransport->sendData(Buffer, FinishUpPackage(Buffer, 6, m_bDeviceID)); + bool rv = m_oDataTransport->sendData(m_pWorkingBuffer, FinishUpPackage( m_pWorkingBuffer, DATA_BEGIN_IDX, m_bDeviceID)); + m_mBufferProtector.unlock(); + return rv; }; -bool protocolLGS3D_Server::sendMode(U8 Mode){ - if( m_oDataTransport == NULL ) return false; - U8 Buffer[16]; - Buffer[CMD_IDX] = CMD_MODE; - Buffer[SUB_CMD_IDX] = Mode | 0x80; -#ifdef DEBUG - LOG("sendMode"); +bool protocolLGS3D_Server::sendTwinLinkACK( U8 SyncStatus ){ + if( m_oDataTransport == NULL ) return false; + m_mBufferProtector.lock(); + m_pWorkingBuffer[CMD_IDX] = CMD_ACK_TWINK_LINK; + m_pWorkingBuffer[SUB_CMD_IDX] = SyncStatus; +#ifdef DEBUG_EXTRA + LOG("sendTwinLinkACK"); #endif - return m_oDataTransport->sendData(Buffer, FinishUpPackage(Buffer, 6, m_bDeviceID)); + bool rv = m_oDataTransport->sendData(m_pWorkingBuffer, FinishUpPackage( m_pWorkingBuffer, DATA_BEGIN_IDX, m_bDeviceID)); + m_mBufferProtector.unlock(); + return rv; }; bool protocolLGS3D_Server::sendState(U8 State){ if( m_oDataTransport == NULL ) return false; - U8 Buffer[256]; + m_mBufferProtector.lock(); U8 index; - Buffer[CMD_IDX] = CMD_STATE; - Buffer[SUB_CMD_IDX] = State; + m_pWorkingBuffer[CMD_IDX] = CMD_STATE; + m_pWorkingBuffer[SUB_CMD_IDX] = State; index = DATA_BEGIN_IDX; #if defined( __linux__ ) && !defined( __GUI__ ) U8 *ptr; + + gsSOFT_INFO.FW_CORE1_VER = 0x01234567; + gsSOFT_INFO.FW_CORE1_TYP = 0x01234567; + gsSOFT_INFO.FW_CORE2_VER = 0x01234567; + gsSOFT_INFO.FW_CORE2_TYP = 0x01234567; + gsSOFT_INFO.FW_CORE3_VER = 0x01234567; + gsSOFT_INFO.FW_CORE3_TYP = 0x01234567; + gsSOFT_INFO.FW_CORE4_VER = 0x01234567; + gsSOFT_INFO.FW_CORE4_TYP = 0x01234567; + gsSOFT_INFO.DATA_VALID = true; + ptr = (U8 *)&gsSOFT_INFO; for( U8 i = 0; i < sizeof(SOFTWARE_INFO); i++ ) { - Buffer[index] = ptr[i]; + m_pWorkingBuffer[index] = ptr[i]; index++; }; #endif #ifdef DEBUG LOG("sendState"); #endif - return m_oDataTransport->sendData(Buffer, FinishUpPackage( Buffer, index, m_bDeviceID )); + bool rv = m_oDataTransport->sendData(m_pWorkingBuffer, FinishUpPackage( m_pWorkingBuffer, index, m_bDeviceID )); + m_mBufferProtector.unlock(); + return rv; }; bool protocolLGS3D_Server::sendScan(void){ if( m_oDataTransport == NULL ) return false; - U8 Buffer[16]; - Buffer[CMD_IDX] = CMD_SCAN_COMPLETE; -#ifdef DEBUG + m_mBufferProtector.lock(); + m_pWorkingBuffer[CMD_IDX] = CMD_SCAN_COMPLETE; +#ifdef DEBUG_EXTRA LOG("sendScan"); #endif - return m_oDataTransport->sendData(Buffer, FinishUpPackage(Buffer, 5, m_bDeviceID)); + bool rv = m_oDataTransport->sendData(m_pWorkingBuffer, FinishUpPackage(m_pWorkingBuffer, 5, m_bDeviceID)); + m_mBufferProtector.unlock(); + return rv; }; -bool protocolLGS3D_Server::sendState2(U8 State, U8 bTargetsCount, U8 *pTargetsData ){ +bool protocolLGS3D_Server::sendState2( U8 State, U8 Events, ALG_RUN_STATUS *StatusData ){ if( m_oDataTransport == NULL ) return false; - U8 Buffer[MAXIMAL_SOCKET_PACKET_LENGTH]; - Buffer[CMD_IDX] = CMD_STATE_2; - Buffer[SUB_CMD_IDX] = State; - Buffer[6] = bTargetsCount; - if( bTargetsCount == 0 ) { -#ifdef DEBUG - //LOG("sendState2"); + m_mBufferProtector.lock(); + m_pWorkingBuffer[CMD_IDX] = CMD_STATE_2; + m_pWorkingBuffer[SUB_CMD_IDX] = State; + m_pWorkingBuffer[6] = Events; +#ifdef DEBUG_EXTRA + LOG("sendState2"); #endif - return m_oDataTransport->sendData(Buffer, FinishUpPackage(Buffer, 7, m_bDeviceID)); + bool rv; + if( StatusData == NULL ) { + rv = m_oDataTransport->sendData( m_pWorkingBuffer, FinishUpPackage(m_pWorkingBuffer, 7, m_bDeviceID) ); } else { - memcpy( &Buffer[7], pTargetsData, bTargetsCount*sizeof(CLIENT_EVENT)); -#ifdef DEBUG - //LOG("sendState2+Targets"); + memcpy( &m_pWorkingBuffer[7], StatusData, sizeof(ALG_RUN_STATUS)); + rv = m_oDataTransport->sendData( m_pWorkingBuffer, FinishUpPackage( m_pWorkingBuffer, 7 + sizeof(ALG_RUN_STATUS), m_bDeviceID )); + }; + m_mBufferProtector.unlock(); + return rv; +}; + + +bool protocolLGS3D_Server::sendEvents( U8 bEventsCount, U8 *pEventData ){ + if( m_oDataTransport == NULL ) return false; + m_mBufferProtector.lock(); + m_pWorkingBuffer[CMD_IDX] = CMD_EVT; + m_pWorkingBuffer[SUB_CMD_IDX] = bEventsCount; +#ifdef DEBUG_EXTRA + LOG("sendEvents"); #endif - return m_oDataTransport->sendData(Buffer, FinishUpPackage(Buffer, 7 + bTargetsCount*sizeof(CLIENT_EVENT), m_bDeviceID)); + bool rv; + if( bEventsCount == 0 ) { + rv = m_oDataTransport->sendData(m_pWorkingBuffer, FinishUpPackage(m_pWorkingBuffer, 6, m_bDeviceID)); + } else { + memcpy( &m_pWorkingBuffer[6], pEventData, bEventsCount*sizeof(CLIENT_EVENT)); + rv = m_oDataTransport->sendData(m_pWorkingBuffer, FinishUpPackage(m_pWorkingBuffer, 6 + bEventsCount*sizeof(CLIENT_EVENT), m_bDeviceID)); }; + m_mBufferProtector.unlock(); + return rv; }; + bool protocolLGS3D_Server::sendParameters( PLGS_3D_PARAMETERS ptr ){ if( m_oDataTransport == NULL ) return false; + bool rv; + m_mBufferProtector.lock(); if( ptr != NULL ) { U8 counter; - U8 Buffer[128]; - Buffer[2] = m_bDeviceID; - Buffer[CMD_IDX] = CMD_PARAMETERS; - Buffer[SUB_CMD_IDX] = SUB_DATA_INTEGRITY_VALID; + m_pWorkingBuffer[CMD_IDX] = CMD_PARAMETERS; + m_pWorkingBuffer[SUB_CMD_IDX] = SUB_DATA_INTEGRITY_VALID; counter = 6; for( int i=0; i < sizeof( LGS_3D_PARAMETERS ); i++ ){ - Buffer[counter] = *(((U8*)ptr)+i); + m_pWorkingBuffer[counter] = *(((U8*)ptr)+i); counter++; }; -#ifdef DEBUG +#ifdef DEBUG_EXTRA LOG("sendParameters VALID"); #endif - return m_oDataTransport->sendData(Buffer, FinishUpPackage(Buffer, counter, m_bDeviceID)); + rv = m_oDataTransport->sendData(m_pWorkingBuffer, FinishUpPackage(m_pWorkingBuffer, counter, m_bDeviceID)); } else { - U8 Buffer[64]; - Buffer[2] = m_bDeviceID; - Buffer[CMD_IDX] = CMD_PARAMETERS; - Buffer[SUB_CMD_IDX] = SUB_DATA_INTEGRITY_ERROR; -#ifdef DEBUG + m_pWorkingBuffer[CMD_IDX] = CMD_PARAMETERS; + m_pWorkingBuffer[SUB_CMD_IDX] = SUB_DATA_INTEGRITY_ERROR; +#ifdef DEBUG_EXTRA LOG("sendParameters EMPTY"); #endif - return m_oDataTransport->sendData(Buffer, FinishUpPackage(Buffer, 6, m_bDeviceID)); + rv = m_oDataTransport->sendData(m_pWorkingBuffer, FinishUpPackage(m_pWorkingBuffer, 6, m_bDeviceID)); }; + m_mBufferProtector.unlock(); + return rv; }; bool protocolLGS3D_Server::sendShadowInfo( ShadowMask *ShObj ){ - if( ShObj == NULL ) return false; if( m_oDataTransport == NULL ) return false; - U8 Buffer[16]; - Buffer[2] = m_bDeviceID; - Buffer[CMD_IDX] = CMD_HZ_INFO; - Buffer[SUB_CMD_IDX] = ShObj->isActive() ? 0xFF : 0x00; - Buffer[6] = ShObj->getPolyCount(); -#ifdef DEBUG + if( ShObj == NULL ) return false; + m_mBufferProtector.lock(); + m_pWorkingBuffer[CMD_IDX] = CMD_SET_HZ_INFO; + m_pWorkingBuffer[SUB_CMD_IDX] = ShObj->isActive() ? 0xFF : 0x00; + m_pWorkingBuffer[6] = ShObj->getPolyCount(); +#ifdef DEBUG_EXTRA LOG("sendShadowInfo"); #endif - return m_oDataTransport->sendData(Buffer, FinishUpPackage(Buffer, 7, m_bDeviceID ) ); + bool rv = m_oDataTransport->sendData(m_pWorkingBuffer, FinishUpPackage(m_pWorkingBuffer, 7, m_bDeviceID ) ); + m_mBufferProtector.unlock(); + return rv; }; bool protocolLGS3D_Server::sendSetPolyACK(uint8_t id){ if( m_oDataTransport == NULL ) return false; - U8 Buffer[16]; - Buffer[2] = m_bDeviceID; - Buffer[CMD_IDX] = CMD_SET_HZ_POLY_ACK; - Buffer[5] = id; -#ifdef DEBUG + m_mBufferProtector.lock(); + m_pWorkingBuffer[CMD_IDX] = CMD_SET_HZ_POLY_ACK; + m_pWorkingBuffer[5] = id; +#ifdef DEBUG_EXTRA LOG("sendSetPolyACK"); #endif - return m_oDataTransport->sendData(Buffer, FinishUpPackage(Buffer, 6, m_bDeviceID)); + bool rv = m_oDataTransport->sendData(m_pWorkingBuffer, FinishUpPackage(m_pWorkingBuffer, 6, m_bDeviceID)); + m_mBufferProtector.unlock(); + return rv; }; bool protocolLGS3D_Server::sendShadowStatus( bool Status, uint8_t ShadowID ){ if( m_oDataTransport == NULL ) return false; - U8 Buffer[16]; - Buffer[2] = m_bDeviceID; - Buffer[CMD_IDX] = CMD_SET_HZ_STATUS; - Buffer[SUB_CMD_IDX] = ShadowID; - Buffer[6] = (uint8_t) Status; -#ifdef DEBUG + m_mBufferProtector.lock(); + m_pWorkingBuffer[CMD_IDX] = CMD_SET_HZ_STATUS; + m_pWorkingBuffer[SUB_CMD_IDX] = ShadowID; + m_pWorkingBuffer[6] = (uint8_t) Status; +#ifdef DEBUG_EXTRA LOG("sendShadowStatus"); #endif - return m_oDataTransport->sendData(Buffer, FinishUpPackage(Buffer, 7, m_bDeviceID ) ); + bool rv = m_oDataTransport->sendData(m_pWorkingBuffer, FinishUpPackage(m_pWorkingBuffer, 7, m_bDeviceID ) ); + m_mBufferProtector.unlock(); + return rv; }; bool protocolLGS3D_Server::sendShadowPoly( simplePolygone *SP ){ - if( SP == NULL ) return false; - if( m_oDataTransport == NULL ) return false; U8 counter; - U8 Buffer[PROTOCOL_PARSER_BUFFER_SIZE]; - Buffer[2] = m_bDeviceID; - Buffer[CMD_IDX] = CMD_SET_HZ_POLY; - Buffer[SUB_CMD_IDX] = SP->count; - Buffer[SUB_CMD_IDX+1] = SP->color[0]; - Buffer[SUB_CMD_IDX+2] = SP->color[1]; - Buffer[SUB_CMD_IDX+3] = SP->color[2]; + if( m_oDataTransport == NULL ) return false; + if( SP == NULL ) return false; + m_mBufferProtector.lock(); + m_pWorkingBuffer[CMD_IDX] = CMD_SET_HZ_POLY; + m_pWorkingBuffer[SUB_CMD_IDX] = SP->count; + m_pWorkingBuffer[SUB_CMD_IDX+1] = SP->color[0]; + m_pWorkingBuffer[SUB_CMD_IDX+2] = SP->color[1]; + m_pWorkingBuffer[SUB_CMD_IDX+3] = SP->color[2]; counter = SUB_CMD_IDX+4; for( uint8_t i = 0; i < SP->count; i++ ){ uint16_t x,y; x = SP->points[i].x(); y = SP->points[i].y(); - Buffer[counter++] = ( x >> 8 ) & 0xFF; - Buffer[counter++] = x & 0xFF; - Buffer[counter++] = ( y >> 8 ) & 0xFF; - Buffer[counter++] = y & 0xFF; + m_pWorkingBuffer[counter++] = ( x >> 8 ) & 0xFF; + m_pWorkingBuffer[counter++] = x & 0xFF; + m_pWorkingBuffer[counter++] = ( y >> 8 ) & 0xFF; + m_pWorkingBuffer[counter++] = y & 0xFF; }; -#ifdef DEBUG +#ifdef DEBUG_EXTRA LOG("sendShadowPoly"); #endif - return m_oDataTransport->sendData(Buffer, FinishUpPackage(Buffer, counter, m_bDeviceID ) ); + bool rv = m_oDataTransport->sendData(m_pWorkingBuffer, FinishUpPackage(m_pWorkingBuffer, counter, m_bDeviceID ) ); + m_mBufferProtector.unlock(); + return rv; }; bool protocolLGS3D_Server::sendResetACK( void ){ if( m_oDataTransport == NULL ) return false; - U8 Buffer[16]; - Buffer[CMD_IDX] = CMD_RESET; -#ifdef DEBUG + m_mBufferProtector.lock(); + m_pWorkingBuffer[CMD_IDX] = CMD_RESET; +#ifdef DEBUG_EXTRA LOG("sendResetACK"); #endif - return m_oDataTransport->sendData(Buffer, FinishUpPackage(Buffer, 5, m_bDeviceID ) ); + bool rv = m_oDataTransport->sendData(m_pWorkingBuffer, FinishUpPackage(m_pWorkingBuffer, 5, m_bDeviceID ) ); + m_mBufferProtector.unlock(); + return rv; }; bool protocolLGS3D_Server::sendFullResetACK( void ){ if( m_oDataTransport == NULL ) return false; - U8 Buffer[16]; - Buffer[CMD_IDX] = CMD_RESET; + m_mBufferProtector.lock(); + m_pWorkingBuffer[CMD_IDX] = CMD_RESET; #ifdef DEBUG LOG("sendFullResetACK"); #endif - return m_oDataTransport->sendData(Buffer, FinishUpPackage(Buffer, 5, m_bDeviceID ) ); + bool rv = m_oDataTransport->sendData(m_pWorkingBuffer, FinishUpPackage(m_pWorkingBuffer, 5, m_bDeviceID ) ); + m_mBufferProtector.unlock(); + return rv; }; bool protocolLGS3D_Server::sendGenericACK(bool Status){ if( m_oDataTransport == NULL ) return false; - U8 Buffer[16]; - Buffer[CMD_IDX] = (Status)?CMD_ACK:CMD_NACK; + m_mBufferProtector.lock(); + m_pWorkingBuffer[CMD_IDX] = (Status)?CMD_ACK:CMD_NACK; #ifdef DEBUG LOG("sendGenerickACK"); #endif - return m_oDataTransport->sendData(Buffer, FinishUpPackage(Buffer, 5, m_bDeviceID)); + bool rv = m_oDataTransport->sendData(m_pWorkingBuffer, FinishUpPackage(m_pWorkingBuffer, 5, m_bDeviceID)); + m_mBufferProtector.unlock(); + return rv; }; #undef SIZE_IDX diff --git a/lib/data/protocol/protocolLGS3D_server.h b/lib/data/protocol/protocolLGS3D_server.h index 7b069547..9b276d31 100644 --- a/lib/data/protocol/protocolLGS3D_server.h +++ b/lib/data/protocol/protocolLGS3D_server.h @@ -5,6 +5,8 @@ #include "../../alg/lgs/mask.h" #include "protocolLGS3D.h" +#define MAXIMAL_EVENT_COUNT_IN_PACKET 5370 + class protocolLGS3D_Server: public protocolLGS_3D{ private: basicLogCollection * m_pLog; @@ -15,7 +17,6 @@ class protocolLGS3D_Server: public protocolLGS_3D{ /* Query Issuer Methods */ bool sendBorderError( uint8_t Error ); bool sendBorderData( uint32_t SampleID, uint8_t KernelID, thresholdNode *WorkingSAF); - bool sendEvent( uint8_t Code); bool sendFlip( uint16_t Count); bool sendMode( uint8_t Mode); bool sendParameters( PLGS_3D_PARAMETERS ptr ); @@ -28,11 +29,13 @@ class protocolLGS3D_Server: public protocolLGS_3D{ bool sendFullResetACK( void ); bool sendGenericACK( bool Status ); bool sendState( uint8_t State); - bool sendState2( uint8_t State, uint8_t Coumt = 0, uint8_t *Data = NULL ); + bool sendState2( uint8_t State, uint8_t Evemts, ALG_RUN_STATUS *StatusData ); + bool sendEvents( uint8_t bEventsCount, uint8_t *pEventData ); bool sendTarget( uint16_t Angle, uint16_t Azimuth, uint16_t Range ); bool sendTargetW( uint16_t Angle, uint16_t Azimuth, uint16_t Range, uint32_t Width); bool sendTargetM( uint32_t SampleID, uint8_t Kernel, uint16_t Range, uint32_t Width, bool isBlack = false ); bool sendTargetZ( TARGET_DATA *ptr ); + bool sendTwinLinkACK(uint8_t status); }; #endif diff --git a/lib/data/protocol/protocolLGS_data.h b/lib/data/protocol/protocolLGS_data.h index 32c62d26..c06becfd 100644 --- a/lib/data/protocol/protocolLGS_data.h +++ b/lib/data/protocol/protocolLGS_data.h @@ -79,13 +79,23 @@ typedef enum E_CLIENT_WORK_MODE{ CWM_WAIT_HW_PARAMS = 22, CWM_SET_HW_PARAMS = 23, CWM_WAIT_ACK_HW_PARAMS = 24, - + CWM_INITIAL_GET_TWINC = 25, + CWM_INITIAL_WAIT_TWINC = 26, + CWM_GET_EVENTS = 27, + CWM_WAIT_EVENTS = 28, + CWM_SET_MODE_BORDER = 29, + CWM_SET_MODE_DETECTOR = 30, + CWM_SET_MODE_FILE = 31, + CWM_SET_MODE_FUMANCHU = 32, + CWM_WAIT_MODE_ACK = 33, + CWM_ISSUE_FULL_RESET = 34, + CWM_ISSUE_DETECTION_RESET = 35, CWM_INITIAL_GET_PARAM = 249, CWM_INITIAL_WAIT_PARAM = 250, CWM_INITIAL_GET_MASKS_INFO = 251, CWM_INITIAL_WAIT_MASKS_INFO = 252, - CWM_INITIAL_GET_MASKS_DATA = 253, - CWM_INITIAL_WAIT_MASKS_DATA = 254, + CWM_INITIAL_GET_VERTEX_DATA = 253, + CWM_INITIAL_WAIT_VERTEX_DATA = 254, CWM_ERROR = 255 } CLIENT_WORK_MODE; @@ -141,10 +151,59 @@ typedef enum E_LGS_CMD{ CMD_GET_HZ_ENABLE = 0x28, CMD_SET_HZ_ENABLE = 0x29, CMD_GET_ACTIVE_PROFILE = 0x2A, - CMD_SET_ACTIVE_PROFILE = 0x2B, - - /* 3D */ - CMD_EVT = 0x40, + CMD_SET_ACTIVE_PROFILE = 0x2B, // also CMD_GET_PARAMETERS in 3D + /* 3DLRF */ + CMD_SET_PARAMETERS = 0x2C, + CMD_FLIP_COMPLETE = 0x2D, + CMD_SCAN_COMPLETE = 0x2E, + CMD_TARGET = 0x2F, + CMD_TARGET_WW = 0x30, + CMD_TARGET_MW = 0x31, + CMD_TARGET_MB = 0x32, + CMD_TARGET_ZZ = 0x33, + CMD_GET_HZ_INFO = 0x34, + CMD_SET_HZ_INFO = 0x35, + CMD_GET_HZ_POLY = 0x36, + CMD_SET_HZ_POLY = 0x37, + CMD_SET_HZ_POLY_ACK = 0x38, + CMD_GET_HZ_STATUS = 0x39, + CMD_SET_HZ_STATUS = 0x3A, + CMD_QUERY_TWINK_LINK = 0x3B, + CMD_ACK_TWINK_LINK = 0x3C, + CMD_GET_PARAMETERS = 0x3E, + CMD_GET_LAST_EVENTS = 0x3F, + CMD_EVT = 0x40, + /* Drone Hunter */ + CMD_DHWM_START_MOTORS = 0x50, + CMD_DHWM_STOP_MOTORS = 0x51, + + /* 3DLRF TWINC ENABLED KERNEL */ + CMD_GET_MASTER_SYSINFO = 0x60, + CMD_SET_MASTER_SYSINFO = 0x61, + CMD_GET_MASTER_PARAMETERS = 0x62, + CMD_SET_MASTER_PARAMETERS = 0x63, + CMD_GET_MASTER_HZ_INFO = 0x64, + CMD_SET_MASTER_HZ_INFO = 0x65, + CMD_GET_MASTER_HZ_POLY = 0x66, + CMD_SET_MASTER_HZ_POLY = 0x67, + CMD_SET_MASTER_HZ_POLY_ACK = 0x68, + CMD_GET_MASTER_HZ_STATUS = 0x69, + CMD_SET_MASTER_HZ_STATUS = 0x6A, + + CMD_GET_SLAVE_SYSINFO = 0x6B, + CMD_SET_SLAVE_SYSINFO = 0x6C, + CMD_GET_SLAVE_PARAMETERS = 0x6D, + CMD_SET_SLAVE_PARAMETERS = 0x6E, + CMD_GET_SLAVE_HZ_INFO = 0x6F, + CMD_SET_SLAVE_HZ_INFO = 0x70, + CMD_GET_SLAVE_HZ_POLY = 0x71, + CMD_SET_SLAVE_HZ_POLY = 0x72, + CMD_SET_SLAVE_HZ_POLY_ACK = 0x73, + CMD_GET_SLAVE_HZ_STATUS = 0x74, + CMD_SET_SLAVE_HZ_STATUS = 0x75, + + + /* CMD_GET_PARAMETERS = 0x41, CMD_SET_PARAMETERS = 0x42, CMD_FLIP_COMPLETE = 0x43, @@ -161,14 +220,13 @@ typedef enum E_LGS_CMD{ CMD_SET_HZ_POLY_ACK = 0x4e, CMD_GET_HZ_STATUS = 0x4f, CMD_SET_HZ_STATUS = 0x50, + */ - /* Drone Hunter */ - CMD_DHWM_START_MOTORS = 0x60, - CMD_DHWM_STOP_MOTORS = 0x61, CMD_ACK = 0xFA, - CMD_NACK = 0xFB, - CMD_NONE = 0xFF + CMD_NACK = 0xFB, // Not Ready + CMD_IDONK = 0xFC, // Not Recognized Command + CMD_NONE = 0xFF } LGS_CMD; // modes diff --git a/lib/data/transport/transportSocket.cpp b/lib/data/transport/transportSocket.cpp index 6e566446..ce75f52e 100644 --- a/lib/data/transport/transportSocket.cpp +++ b/lib/data/transport/transportSocket.cpp @@ -83,7 +83,7 @@ void transportSocket::m_fThreadBProc(void){ LOG("Recipient Thread Started!"); #endif while( m_bThreadBStatus < TH_ENDED ){ - RetVal = recptBlock( m_pInputBuffer, &m_nInputBufferSize); + RetVal = recptBlock( m_pInputBuffer, &m_nInputBufferSize ); if( RetVal == -1 ){ setConnectionStatus(CS_DISCONNECTED); m_nInputBufferSize = 0; diff --git a/lib/data/transport/transportSocket.h b/lib/data/transport/transportSocket.h index d783754a..555a3277 100644 --- a/lib/data/transport/transportSocket.h +++ b/lib/data/transport/transportSocket.h @@ -27,8 +27,9 @@ protected: virtual int recptBlock(unsigned char *Buffer, int *BufferLength){ return 0; }; public: transportSocket(); - virtual ~transportSocket(); - bool sendData(unsigned char *Data, int DataSize); + virtual ~transportSocket(); + virtual bool sendData(unsigned char *Data, int DataSize); + virtual bool reconnect( void ){ return false; }; virtual bool create( void ); }; diff --git a/lib/hardware/sensors/lrf/lrf_3d.cpp b/lib/hardware/sensors/lrf/lrf_3d.cpp index 1d79e7e2..8ee53d2b 100644 --- a/lib/hardware/sensors/lrf/lrf_3d.cpp +++ b/lib/hardware/sensors/lrf/lrf_3d.cpp @@ -25,7 +25,7 @@ inline void make3D( uint32_t sid, float &az, float &el, bool master = true ){ //sensorLGS3D::sensorLGS3D( LGS_PARAMETERS *ptr, bool Master ): sensorLGS3D::sensorLGS3D( uint32_t id, bool Master ): - basicObject(), + basicEngine(), basicThread(), protocolLGS3D_Client(), m_mPackageMutex(), @@ -37,14 +37,11 @@ sensorLGS3D::sensorLGS3D( uint32_t id, bool Master ): m_pEventHeap = basicEventHeap::getInstance(); m_DbId = id; - m_eCaps = OC_EVENT_GENERATOR; - m_eStatus = OS_STATUS_PREBORN; - m_nBusyCounter = 0; m_nIdleCounter = 0; m_nIdleTarget = LGS_MAX_IDLE_DELAY; m_pThresholdData = NULL; - m_pTransport = NULL; + //m_pTransport = NULL; //m_bMasksAreLoadded = false; m_nFullBorderDataIndex = 0; //m_bTransportStatus = true;//false; @@ -68,59 +65,33 @@ sensorLGS3D::sensorLGS3D( uint32_t id, bool Master ): m_sDeviceStatus.ProgressIsActive = false; sprintf( m_pHost, "192.168.200.100" ); m_nPort = 4444; - m_eWorkMode = CWM_INIT; + //m_eWorkMode = CWM_INIT; + setWM( CWM_INIT ); }; sensorLGS3D::~sensorLGS3D(){ - m_eStatus = OS_STATUS_DEAD; - //unlock all mutexes + LOG("unlock all mutexes"); m_mDataMutex.unlock(); m_mStatusMutex.unlock(); m_mPackageMutex.unlock(); - //Kill Threads - + LOG("Kill Thread"); waitThreadEnd( true ); - // Close Communication Transport - if( m_pTransport!= NULL ){ - m_pTransport->disconnect(); - delete(m_pTransport); - }; - //if( m_oProtocol != NULL ){ - // delete( m_oProtocol ); - //}; + LOG("Clean Data"); cleanDataTH(); + LOG("Remove Shadow"); if( m_pShadow ) delete( m_pShadow ); + LOG("Done!"); }; bool sensorLGS3D::create( void ){ // Check if Allredy Working - if ( m_bThreadStatus > TH_ARMED ){ + if( m_bThreadStatus > TH_ARMED ){ if( m_bThreadStatus == TH_WORKING ) return true; return false; }; - m_pShadow = new ShadowMask(); if( m_pShadow ) m_pShadow->clear(); - - m_pTransport = new clientPort(); - if( m_pTransport != NULL ){ - if( setTransport( m_pTransport ) ){ - if( protocolLGS3D_Client::create() ){ - m_eStatus = OS_STATUS_INIT; - return basicThread::init(); - } else { - LOG_ERROR("Client Protocol Parser Init Failure!"); - }; - } else { - LOG_ERROR("Transport is not Attached to Parser!"); - delete( m_pTransport ); - m_pTransport = NULL; - }; - } else { - LOG_ERROR("Transport is not Created!"); - }; - m_eStatus = OS_STATUS_DEAD; - return false; + return init(); }; bool sensorLGS3D::getDeviceStatus(DEVICE_STATUS &STAT){ @@ -135,163 +106,150 @@ void sensorLGS3D::updateSettings(void){ }; void sensorLGS3D::m_fThreadProc(void){ - uint32_t nTimeOut = 20; - m_eStatus = OS_STATUS_INIT; - m_bThreadStatus = TH_WORKING; - while( m_eStatus < OS_STATUS_DEAD && m_bThreadStatus < TH_ENDED ){ - m_mStatusMutex.lock(); - switch( m_eWorkMode ) { + uint32_t nTimeOut = 20; + clientPort * tPort = NULL; + + m_bThreadStatus = TH_WORKING; + + while( m_bThreadStatus < TH_ENDED ){ + uint8_t cWM = getWM(); + + switch( cWM ) { case CWM_INIT:{ - m_mStatusMutex.unlock(); - if( m_pTransport == NULL ) { + if ( tPort!= NULL ) { + delete( tPort ); + EVENT_CONTAINER *tEVT; + //ToDo: Change Device Name! + tEVT = createBasicEvent( m_DbId, EVT_CLASS_SENSOR_3D, EVT_ERROR, NULL, "Device is Disconnected"); + m_pEventHeap->broadcast( tEVT ); SLEEP(100); } else { - m_eWorkMode = CWM_CONNECT; - } + tPort = new clientPort( m_pHost, m_nPort ); + if( tPort!= NULL ) { + setWM(CWM_CONNECT); + }; + }; break; }; case CWM_CONNECT:{ - m_mStatusMutex.unlock(); - if( CS_CONNECTED == m_pTransport->getConnectionStatus() ) { + if( CS_CONNECTED == getConnectionStatus() ) { EVENT_CONTAINER *tEVT; tEVT = createBasicEvent( m_DbId, EVT_CLASS_SENSOR_3D, EVT_READY, NULL, "Device is connected"); m_pEventHeap->broadcast(tEVT); - m_eWorkMode = CWM_INITIAL_GET_PARAM; - m_eStatus = OS_STATUS_ACTIVE; + setWM( CWM_INITIAL_GET_PARAM ); } else { - // After Initial Connection - // Each time Disconnection Event must be generated - if( m_eStatus != OS_STATUS_INIT ) { - EVENT_CONTAINER *tEVT; - //ToDo: Change Device Name! - tEVT = createBasicEvent( m_DbId, EVT_CLASS_SENSOR_3D, EVT_ERROR, NULL, "Device is Not Connected"); - m_pEventHeap->broadcast( tEVT ); - m_eStatus = OS_STATUS_INIT; - }; - char tB[128]; - sprintf( tB, "Connect to [%s:%d]", m_pHost, m_nPort ); - LOG( tB ); - if( !m_pTransport->connectTo( m_pHost, m_nPort ) ){ - SLEEP( 1000 ); + if( tPort!= NULL ) { + if ( tPort->create() ) { + if( setTransport( tPort ) ){ + break; + } else { + LOG_ERROR("Transport is not Attached to Parser!"); + }; + } else { + LOG_ERROR("Transport is not Created!"); + }; }; + SLEEP(1000); + setWM( CWM_INIT ); }; break; }; case CWM_INITIAL_GET_PARAM:{ - LOG("Before Get Param"); - m_mStatusMutex.unlock(); - LOG("Mutex OK"); if( !getParameters() ) { - LOG("Get Param Failure"); - if( CS_CONNECTED != m_pTransport->getConnectionStatus() ) { - LOG("Disconnected!"); - m_eWorkMode = CWM_CONNECT; - }; +#ifdef DEBUG + LOG_ERROR("Get Param Failure"); +#endif + setWM( CWM_INIT ); } else { LOG("Waiting ACK Param"); - m_eWorkMode = CWM_INITIAL_WAIT_PARAM; + setWM( CWM_INITIAL_WAIT_PARAM ); }; break; }; case CWM_INITIAL_GET_MASKS_INFO:{ - m_mStatusMutex.unlock(); if( !getShadowInfo() ){ - if( CS_CONNECTED != m_pTransport->getConnectionStatus() ) { - m_eWorkMode = CWM_CONNECT; - } else LOG_ERROR("Error INITIAL CMD_GET_SHADOW_INFO!"); + LOG_ERROR("Error INITIAL CMD_GET_SHADOW_INFO!"); + setWM( CWM_INIT ); } else { - m_eWorkMode = CWM_INITIAL_WAIT_MASKS_INFO; + setWM( CWM_INITIAL_WAIT_MASKS_INFO ); }; break; }; case CWM_INITIAL_GET_MASKS_DATA:{ - m_mStatusMutex.unlock(); if( !getShadowPoly( m_nCurrentPolyID ) ){ - if( CS_CONNECTED != m_pTransport->getConnectionStatus() ) { - m_eWorkMode = CWM_CONNECT; + if( CS_CONNECTED != getConnectionStatus() ) { + setWM( CWM_INIT ); } else LOG_ERROR("Error INITIAL CMD_GET_SHADOW_DATA!"); } else { - m_eWorkMode = CWM_INITIAL_WAIT_MASKS_DATA; + setWM( CWM_INITIAL_WAIT_MASKS_DATA ); }; break; }; case CWM_GET_BORDER:{ - m_mStatusMutex.unlock(); if( !getDraw( 0, m_nFullBorderKernelIndex ) ){ - if( CS_CONNECTED != m_pTransport->getConnectionStatus() ) { - m_eWorkMode = CWM_CONNECT; + if( CS_CONNECTED != getConnectionStatus() ) { + setWM( CWM_INIT ); } else LOG_ERROR("Error Sending CMD_FULL_BORDER!"); } else { - m_eWorkMode = CWM_WAIT_BORDER; + setWM( CWM_WAIT_BORDER ); }; break; }; case CWM_GET_MASK:{ - m_mStatusMutex.unlock(); if( !setShadowPoly(NULL) ){ - if( CS_CONNECTED != m_pTransport->getConnectionStatus() ) { - m_eWorkMode = CWM_CONNECT; + if( CS_CONNECTED != getConnectionStatus() ) { + setWM( CWM_INIT ); } else LOG_ERROR("Error Sending CMD_SET_HZ_POLY!"); } else { - m_eWorkMode = CWM_WAIT_MASK; + setWM( CWM_WAIT_MASK ); }; break; }; case CWM_GET_PARAMS:{ - m_mStatusMutex.unlock(); if( !getParameters() ){ - if( CS_CONNECTED != m_pTransport->getConnectionStatus() ) { - m_eWorkMode = CWM_CONNECT; + if( CS_CONNECTED != getConnectionStatus() ) { + setWM( CWM_INIT ); } else LOG_ERROR("Error Sending CMD_GET_PARAMETERS!"); } else { - m_eWorkMode = CWM_WAIT_PARAMS; + setWM( CWM_WAIT_PARAMS ); }; break; }; case CWM_SET_PARAMS:{ - m_mStatusMutex.unlock(); if( !setParameters( &m_sLGS_PARAMETERS ) ){ - if( CS_CONNECTED != m_pTransport->getConnectionStatus() ) { - m_eWorkMode = CWM_CONNECT; - } else LOG_ERROR("Error Sending CMD_SET_PARAMETERS!"); + setWM( CWM_INIT ); + LOG_ERROR("Error Sending CMD_SET_PARAMETERS!"); } else { - m_eWorkMode = CWM_WAIT_ACK_PARAMS; + setWM( CWM_WAIT_ACK_PARAMS ); }; break; }; case CWM_GET_STATUS:{ - m_mStatusMutex.unlock(); if( !getState2() ){ - if( CS_CONNECTED != m_pTransport->getConnectionStatus() ) { - m_eWorkMode = CWM_CONNECT; - } else LOG_ERROR("Error Sending CMD_GET_STATUS2!"); + setWM( CWM_INIT ); + LOG_ERROR("Error Sending CMD_GET_STATUS2!"); } else { - m_eWorkMode = CWM_WAIT_STATUS; + setWM( CWM_WAIT_STATUS ); }; break; }; case CWM_IDLE: default:{ - m_mStatusMutex.unlock(); //Time Driven Logic if( nTimeOut ){ nTimeOut--; } else { nTimeOut = 20; - m_eWorkMode = CWM_GET_STATUS; + setWM( CWM_GET_STATUS ); }; break; }; }; - if( m_pTransport!= NULL ) { - if( CS_CONNECTED != m_pTransport->getConnectionStatus() ) { - m_mStatusMutex.lock(); - m_eWorkMode = CWM_CONNECT; - m_mStatusMutex.unlock(); - }; - }; SLEEP( 50 ); }; + if( tPort != NULL ){ + delete( tPort ); + }; }; thresholdNode *sensorLGS3D::grabDataAccess( void ){ @@ -386,7 +344,7 @@ bool sensorLGS3D::packetHandler( protocolPackage* Package ) { SUB_CMD = pReceivedPackage[SUB_CMD_IDX]; #ifdef DEBUG char tZ[128]; - sprintf(tZ,"CMD: 0x%02X SUB: 0x%02X", CUR_CMD, SUB_CMD ); + sprintf(tZ,"CMD: 0x%02X SUB: 0x%02X WM:0x%02X", CUR_CMD, SUB_CMD, getWM() ); LOG( tZ ); #endif m_nBusyCounter = 0; @@ -403,10 +361,7 @@ bool sensorLGS3D::packetHandler( protocolPackage* Package ) { LOG("SOFT INFO FILLED!"); #endif }; - m_mStatusMutex.lock(); - m_eWorkMode = CWM_INITIAL_GET_PARAM; - m_eStatus = OS_STATUS_ACTIVE; - m_mStatusMutex.unlock(); + setWM( CWM_INITIAL_GET_PARAM ); break; }; case CMD_QUIT: @@ -471,36 +426,35 @@ bool sensorLGS3D::packetHandler( protocolPackage* Package ) { case CMD_GET_PARAMETERS: case CMD_PARAMETERS: case CMD_SET_PARAMETERS: { - m_mStatusMutex.lock(); - if( m_eWorkMode == CWM_WAIT_PARAMS || m_eWorkMode == CWM_INITIAL_WAIT_PARAM ){ + uint8_t cWM = getWM(); + if( cWM == CWM_WAIT_PARAMS || cWM == CWM_INITIAL_WAIT_PARAM ){ #ifdef DEBUG LOG("Finish Get Params"); #endif if( SUB_CMD == SUB_DATA_INTEGRITY_VALID ){ PLGS_3D_PARAMETERS tParam = (PLGS_3D_PARAMETERS)(pReceivedPackage + 6); memcpy( &m_sLGS_PARAMETERS, tParam, sizeof(LGS_3D_PARAMETERS) ); - if( m_eWorkMode == CWM_INITIAL_WAIT_PARAM ) { - m_eWorkMode = CWM_INITIAL_GET_MASKS_INFO; + if( cWM == CWM_INITIAL_WAIT_PARAM ) { + setWM( CWM_INITIAL_GET_MASKS_INFO ); } else { - m_eWorkMode = CWM_IDLE; + setWM( CWM_IDLE ); }; } else { LOG_ERROR("Data Integrity Error(on Get Parameters)!"); - if( m_eWorkMode == CWM_INITIAL_WAIT_PARAM ) { - m_eWorkMode = CWM_INITIAL_GET_PARAM; + if( cWM == CWM_INITIAL_WAIT_PARAM ) { + setWM( CWM_INITIAL_GET_PARAM ); } else { - m_eWorkMode = CWM_GET_PARAMS; + setWM( CWM_GET_PARAMS ); }; }; } else { LOG_ERROR("Not Requested Parameters Package!"); }; - m_mStatusMutex.unlock(); break; }; - case CMD_HZ_INFO: { - m_mStatusMutex.lock(); - if( m_eWorkMode == CWM_WAIT_MASK_INFO || m_eWorkMode == CWM_INITIAL_WAIT_MASKS_INFO ) { + case CMD_SET_HZ_INFO: { + uint8_t cWM = getWM(); + if( cWM == CWM_WAIT_MASK_INFO || cWM == CWM_INITIAL_WAIT_MASKS_INFO ) { #ifdef DEBUG LOG("Finish Get HZ INFO"); #endif @@ -512,17 +466,16 @@ bool sensorLGS3D::packetHandler( protocolPackage* Package ) { } else { m_pShadow->setActive( false ); }; - if( m_eWorkMode == CWM_INITIAL_WAIT_MASKS_INFO ) { + if( cWM == CWM_INITIAL_WAIT_MASKS_INFO ) { if( m_nDevicePolyCount ){ - m_eWorkMode = CWM_INITIAL_GET_MASKS_DATA; + setWM( CWM_INITIAL_GET_MASKS_DATA ); } else { - m_eWorkMode = CWM_IDLE; + setWM( CWM_IDLE ); }; } else { - m_eWorkMode = CWM_IDLE; + setWM( CWM_IDLE ); }; }; - m_mStatusMutex.unlock(); break; }; case CMD_SET_HZ_POLY: { @@ -617,10 +570,10 @@ bool sensorLGS3D::packetHandler( protocolPackage* Package ) { case CMD_FS_SUB_PACKET: break; case CMD_STATE_2:{ - m_mStatusMutex.lock(); - if( m_eWorkMode != CWM_GET_STATUS ) { - LOG("Wrong WM - No Status Requested!"); - } else { + uint8_t cWM = getWM(); + //if( cWM != CWM_GET_STATUS ) { + // LOG("Wrong WM - No Status Requested!"); + //} else { E_LGS_STAGE tStatus = (E_LGS_STAGE)SUB_CMD; if( m_sDeviceStatus.Status != tStatus ){ LOG("Device Status Changed!"); @@ -646,8 +599,7 @@ bool sensorLGS3D::packetHandler( protocolPackage* Package ) { }; m_sDeviceStatus.Status = tStatus; }; - }; - m_mStatusMutex.unlock(); + //}; if( pReceivedPackage[DATA_BEGIN_IDX] > 0 ){ uint8_t tCount = pReceivedPackage[DATA_BEGIN_IDX]; @@ -702,7 +654,7 @@ bool sensorLGS3D::packetHandler( protocolPackage* Package ) { m_nIdleTarget = m_nIdleTarget << 1; if (m_nIdleTarget > LGS_MAX_IDLE_DELAY) m_nIdleTarget = LGS_MAX_IDLE_DELAY; }; - m_eWorkMode = CWM_IDLE; + setWM( CWM_IDLE ); break; }; case CMD_GET_WIDTH_TABLE: @@ -796,7 +748,8 @@ bool sensorLGS3D::packetHandler( protocolPackage* Package ) { break; }; case CMD_TARGET_ZZ: { - if( m_eWorkMode == CWM_IDLE ){ + uint8_t cWM = getWM(); + if( cWM == CWM_IDLE ){ tData = (CLIENT_EVENT*)malloc(sizeof(CLIENT_EVENT)); if (tData != NULL) { /* @@ -944,10 +897,11 @@ bool sensorLGS3D::startMasksStatus(bool Active){ bool sensorLGS3D::setHost(CSTR Host){ if( strcmp( m_pHost, Host ) != 0 ){ sprintf( m_pHost, "%s", Host ); - if( m_pTransport!= NULL ) { - m_pTransport->disconnect(); - m_pTransport->connectTo( m_pHost, m_nPort ); - }; + setWM( WM_INIT ); + //if( m_pTransport!= NULL ) { + // m_pTransport->disconnect(); + // m_pTransport->connectTo( m_pHost, m_nPort ); + //}; }; return true; }; @@ -955,10 +909,11 @@ bool sensorLGS3D::setHost(CSTR Host){ bool sensorLGS3D::setPort(int Port){ if( m_nPort != Port ){ m_nPort = Port; - if( m_pTransport!= NULL ) { - m_pTransport->disconnect(); - m_pTransport->connectTo(m_pHost, m_nPort); - } + setWM( WM_INIT ); + //if( m_pTransport!= NULL ) { + // m_pTransport->disconnect(); + // m_pTransport->connectTo(m_pHost, m_nPort); + //} }; return true; }; diff --git a/lib/hardware/sensors/lrf/lrf_3d.h b/lib/hardware/sensors/lrf/lrf_3d.h index 657e29fd..b2fc60db 100644 --- a/lib/hardware/sensors/lrf/lrf_3d.h +++ b/lib/hardware/sensors/lrf/lrf_3d.h @@ -1,8 +1,7 @@ #ifndef __SENSOR_LRF_3D_HEADER__ #define __SENSOR_LRF_3D_HEADER__ -#include "../../../components/base/basicObject.h" -#include "../../../components/base/basicMutex.h" +#include "../../../components/base/basicEngine.h" #include "../../../components/base/basicDualThread.h" #include "../../../components/base/basicLogCollection.h" #include "../../../components/base/basicEventHeap.h" @@ -35,7 +34,7 @@ -class sensorLGS3D : public basicObject, basicThread, protocolLGS3D_Client{ +class sensorLGS3D : public basicEngine, basicThread, protocolLGS3D_Client{ private: basicLogCollection * m_pLog; basicEventHeap * m_pEventHeap; @@ -43,12 +42,12 @@ class sensorLGS3D : public basicObject, basicThread, protocolLGS3D_Client{ //config_setting_t * m_pSettings; - clientPort * m_pTransport; + //clientPort * m_pTransport; char m_pHost[255]; uint16_t m_nPort; LGS_3D_PARAMETERS m_sLGS_PARAMETERS; - CLIENT_WORK_MODE m_eWorkMode; + //CLIENT_WORK_MODE m_eWorkMode; DEVICE_STATUS m_sDeviceStatus; SOFTWARE_INFO m_sDeviceSoftNFO; diff --git a/lib/hardware/soc/general/3DLRF.h b/lib/hardware/soc/general/3DLRF.h index c21c8366..1a824132 100644 --- a/lib/hardware/soc/general/3DLRF.h +++ b/lib/hardware/soc/general/3DLRF.h @@ -1,7 +1,7 @@ #ifndef __3D_LRF_GENERAL_SETTINGS_HEADER__ #define __3D_LRF_GENERAL_SETTINGS_HEADER__ -#define DISABLE_FRENDLY_MESSAGES +//#define DISABLE_FRENDLY_MESSAGES typedef enum E_LRF_WORK_MODE{ WM_NONE = 0x00, @@ -20,9 +20,9 @@ typedef enum E_LRF_WORK_MODE{ #endif #endif -#define EVENTS_OUTPUT_QUEUE_MAX 128 +#define EVENTS_OUTPUT_QUEUE_MAX 2000 //128 -#define SKIP_TARGET_LOG +//#define SKIP_TARGET_LOG //#define HIBERNATE_ENABLE #define THREADED_FLIP #define TH_JUST_UPDATE_WORKING @@ -36,7 +36,7 @@ typedef enum E_LRF_WORK_MODE{ #define ONPC_TOTTAL_SIMULATOR //#define TRACKER_FULL_COMPARE -//#define SIMULATE_TARGETS +#define SIMULATE_TARGETS //#define SIMULATE_FLIPS #define CHECK_SUN_BIT @@ -157,8 +157,8 @@ typedef enum E_LRF_WORK_MODE{ #define Q_Q_INTERLEAVE 2048 - #define Q_DEGREE_FOV 100.1953125f - #define Q_RADIAN_FOV 1.7487380981896310018786198520208f + #define Q_DEGREE_FOV 101.25f // 100.1953125f + #define Q_RADIAN_FOV 1.7671458676442586966352369030947f #define Q_BLOCK_COUNT 8192 @@ -607,7 +607,7 @@ enum { // x = sid % TH_LINE_NODES; // }; inline uint32_t makeIds( int x, int y, bool Master = true ){ - return (Master)?(Q_SCAN_COUNT-y)*TH_LINE_NODES+x:y*TH_LINE_NODES+x; + return (Master)?(Q_SCAN_COUNT-y-1)*TH_LINE_NODES+x:y*TH_LINE_NODES+x; }; inline uint32_t interpolate(int color1, int color2, float progress) { int a1 = (color1 & 0xff000000) >> 24; diff --git a/lib/rgoose/rgooseDBConnector.cpp b/lib/rgoose/rgooseDBConnector.cpp index c483dcf0..2175426f 100644 --- a/lib/rgoose/rgooseDBConnector.cpp +++ b/lib/rgoose/rgooseDBConnector.cpp @@ -106,6 +106,42 @@ bool argusDBC::cleanResources( uint32_t ServerNodeID, bool all ){ return false; }; +bool argusDBC::cleanLRFMask( uint32_t maskID, bool deleteMask ){ + if(m_bIsConnected) { + char tQBuf[MAX_PATH_LEN]; + sprintf( tQBuf, "DELETE FROM `lrf_mask_trace_zones` WHERE `zone_id` IN ( SELECT `id` FROM `lrf_mask_traces` WHERE `mask_id`=%d )", maskID ); +#ifdef DEBUG_EXTRA + LOG(tQBuf); +#endif + m_pDatabase->SilentQuery( tQBuf ); + sprintf( tQBuf, "DELETE FROM `lrf_mask_traces` WHERE `mask_id`=%d", maskID ); +#ifdef DEBUG_EXTRA + LOG(tQBuf); +#endif + m_pDatabase->SilentQuery( tQBuf ); + sprintf( tQBuf, "DELETE FROM `lrf_mask_vertex_points` WHERE `vertex_id` IN ( SELECT `id` FROM `lrf_mask_vertexes` WHERE `mask_id`=%d )", maskID ); +#ifdef DEBUG_EXTRA + LOG(tQBuf); +#endif + m_pDatabase->SilentQuery( tQBuf ); + sprintf( tQBuf, "DELETE FROM `lrf_mask_vertexes` WHERE `mask_id`=%d", maskID ); +#ifdef DEBUG_EXTRA + LOG(tQBuf); +#endif + m_pDatabase->SilentQuery( tQBuf ); + //Delete Mask Itself! + if ( deleteMask ) { + sprintf( tQBuf, "DELETE FROM `lrf_masks` WHERE `id`=%d", maskID ); +#ifdef DEBUG_EXTRA + LOG(tQBuf); +#endif + m_pDatabase->SilentQuery( tQBuf ); + }; + return true; + }; + return false; +}; + bool argusDBC::updateIPCam( uint32_t SiteID, CSTR uuid, CSTR Addr ){ if(m_bIsConnected) { char tQBuf[MAX_PATH_LEN]; @@ -301,6 +337,7 @@ bool argusDBC::transferEvtToArchive( uint32_t SECONDS ){ }; return false; } +/* bool argusDBC::getLastEvents( vectorEventRecords &VR, uint32_t tss, uint32_t tsms ){ if(m_bIsConnected){ char tQBuf[CTEXT]; @@ -388,7 +425,7 @@ bool argusDBC::getLastEvents( vectorEventRecords &VR, uint32_t tss, uint32_t tsm }; return false; }; - +*/ bool argusDBC::getAllCamRecords( uint32_t SiteID, vectorCamRecords &VR ){ if(m_bIsConnected){ char tQBuf[CTEXT]; @@ -1353,6 +1390,10 @@ DBC_LRF_DATA *argusDBC::getLRFData( uint32_t ID ){ if( it != cArr->end() ){ tVal->detection_profile_id = atoi( it->second.c_str() ); }; + it = cArr->find("draw_lrf_id"); + if( it != cArr->end() ){ + tVal->draw_lrf_id = atoi( it->second.c_str() ); + }; it = cArr->find("width_table_id"); if( it != cArr->end() ){ tVal->width_table_id = atoi( it->second.c_str() ); @@ -1390,7 +1431,7 @@ uint8_t argusDBC::getLRFDataStatus( uint32_t ID ){ if(m_bIsConnected){ char tQBuf[CTEXT]; AAssoc *result; - sprintf(tQBuf, "SELECT * FROM `lrf_sensors` WHERE `id`=%d", ID ); + sprintf(tQBuf, "SELECT `data_status` FROM `lrf_sensors` WHERE `id`=%d", ID ); #ifdef DEBUG LOG(tQBuf); #endif @@ -1410,6 +1451,32 @@ uint8_t argusDBC::getLRFDataStatus( uint32_t ID ){ }; return RetVal; }; + +uint32_t argusDBC::getLRFMaskID( uint32_t deviceID, uint8_t lrfID, uint8_t layer ){ + uint32_t RetVal = 0; + if(m_bIsConnected){ + char tQBuf[CTEXT]; + AAssoc *result; + sprintf(tQBuf, "SELECT `id` FROM `lrf_masks` WHERE `sensor_id`=%d AND `lrf_id`=%d AND `layer`=%d ", deviceID, lrfID, layer ); +#ifdef DEBUG + LOG(tQBuf); +#endif + result = m_pDatabase->Query( tQBuf ); + if( result!= NULL ) { + if( result->size() > 0 ) { + Assoc *cArr; + Assoc::iterator it; + cArr = result->at(0); + it = cArr->find("id"); + if( it != cArr->end() ){ + RetVal = atoi( it->second.c_str() ); + }; + }; + }; + deleteResult( result ); + }; + return RetVal; +}; /* DBC_PUSHED_CMD *argusDBC::getLRFPushedCMD( uint32_t ID ){ DBC_PUSHED_CMD *RetVal = NULL; @@ -1510,6 +1577,68 @@ DBC_INT_LIST *argusDBC::listFilters( uint32_t ServerID ){ return tVal; }; +DBC_INT_LIST *argusDBC::listLRFMaskVertexes( uint32_t MaskID ){ + DBC_INT_LIST * tVal = NULL; + if(m_bIsConnected){ + char tQBuf[CTEXT]; + AAssoc *result; + sprintf(tQBuf, "SELECT `id` FROM `lrf_mask_vertexes` WHERE `mask_id`=%d", MaskID ); +#ifdef DEBUG_ALL + LOG(tQBuf); +#endif + result = m_pDatabase->Query( tQBuf ); + if( result!= NULL ) { + if( result->size() > 0 ) { + Assoc *cArr; + tVal = new DBC_INT_LIST(); + if( tVal != NULL ) { + Assoc::iterator it; + for(int i=0;isize();i++) { + cArr = result->at(i); + it = cArr->find("id"); + if( it != cArr->end() ){ + tVal->push_back( atoi( it->second.c_str() )); + }; + }; + }; + }; + }; + deleteResult( result ); + }; + return tVal; +}; + +DBC_INT_LIST *argusDBC::listLRFMaskVertexPoints( uint32_t VertexID ){ + DBC_INT_LIST * tVal = NULL; + if(m_bIsConnected){ + char tQBuf[CTEXT]; + AAssoc *result; + sprintf(tQBuf, "SELECT `id` FROM `lrf_mask_vertex_points` WHERE `vertex_id`=%d ORDER BY `id`", VertexID ); +#ifdef DEBUG_ALL + LOG(tQBuf); +#endif + result = m_pDatabase->Query( tQBuf ); + if( result!= NULL ) { + if( result->size() > 0 ) { + Assoc *cArr; + tVal = new DBC_INT_LIST(); + if( tVal != NULL ) { + Assoc::iterator it; + for(int i=0;isize();i++) { + cArr = result->at(i); + it = cArr->find("id"); + if( it != cArr->end() ){ + tVal->push_back( atoi( it->second.c_str() )); + }; + }; + }; + }; + }; + deleteResult( result ); + }; + return tVal; +}; + DBC_INT_LIST *argusDBC::listMediaServerStreams( uint32_t SiteId, uint32_t MediaServerID, uint8_t listMode ){ DBC_INT_LIST * tVal = NULL; if(m_bIsConnected){ @@ -1715,6 +1844,70 @@ DBC_INT_LIST *argusDBC::listResources( uint32_t NodeID ){ return tVal; }; +simplePolygone *argusDBC::loadLRFMaskVertex( uint32_t vid ){ + simplePolygone *tVal = NULL; + if(m_bIsConnected){ + char tQBuf[CTEXT]; + AAssoc *result; + sprintf(tQBuf, "SELECT * FROM `lrf_mask_vertexes` WHERE `id`=%d", vid ); +#ifdef DEBUG + LOG(tQBuf); +#endif + result = m_pDatabase->Query( tQBuf ); + if( result!= NULL ) { + if( result->size() > 0 ) { + tVal = (simplePolygone *) malloc(sizeof(simplePolygone)); + if ( tVal ) { + Assoc * cArr; + memset( tVal, 0, sizeof(simplePolygone)); + Assoc::iterator it; + cArr = result->at(0); + it = cArr->find("r"); + if( it != cArr->end() ){ + tVal->color[0] = atoi( it->second.c_str() ); + }; + it = cArr->find("g"); + if( it != cArr->end() ){ + tVal->color[1] = atoi( it->second.c_str() ); + }; + it = cArr->find("b"); + if( it != cArr->end() ){ + tVal->color[2] = atoi( it->second.c_str() ); + }; + AAssoc *points; + sprintf(tQBuf, "SELECT * FROM `lrf_mask_vertex_points` WHERE `vertex_id`=%d ORDER BY `id`", vid ); +#ifdef DEBUG + LOG(tQBuf); +#endif + points = m_pDatabase->Query( tQBuf ); + if( points!= NULL ) { + if ( points->size() ) { + tVal->count = points->size(); + tVal->points = (simplePoint *) calloc( points->size(), sizeof(simplePoint) ); + if( tVal->points!= NULL ) { + for (int i = 0; i < points->size(); i++) { + cArr = points->at( i ); + it = cArr->find("x"); + if( it != cArr->end() ){ + tVal->points[i].setX( atoi( it->second.c_str() ) ); + }; + it = cArr->find("y"); + if( it != cArr->end() ){ + tVal->points[i].setY( atoi( it->second.c_str() ) ); + }; + }; + }; + }; + }; + deleteResult( points ); + }; + }; + }; + deleteResult( result ); + }; + return tVal; +}; + DBC_INT_LIST *argusDBC::listNetworks( uint32_t nif_id ){ DBC_INT_LIST * tVal = NULL; if(m_bIsConnected){ @@ -1786,6 +1979,7 @@ DBC_INT_LIST *argusDBC::listNewModules( uint32_t ServerID, DBC_INT_LIST * old_id }; return tVal; }; + uint32_t argusDBC::getCamId( CSTR UUID ){ uint32_t RetVal = 0; if(m_bIsConnected){ @@ -3030,6 +3224,61 @@ uint32_t argusDBC::addLocalWiFi( uint32_t NIF_ID, ARGUS_WIFI_MODE mode, CSTR SSI return RetVal; }; +uint32_t argusDBC::addLRFMask( uint32_t devID, uint8_t lrfID, uint8_t layerID ){ + uint32_t RetVal = 0; + if( m_bIsConnected ) { + char tQBuf[MAX_PATH_LEN]; + sprintf( tQBuf, "INSERT INTO `lrf_masks` SET `sensor_id`=%d, `lrf_id`=%d, `layer`=%d ON DUPLICATE KEY UPDATE `id`=`id`", + devID, + lrfID, + layerID + ); +#ifdef DEBUG + LOG(tQBuf); +#endif + RetVal = m_pDatabase->QueryID( tQBuf ); + if( RetVal == 0 ) { + RetVal = getLRFMaskID( devID, lrfID, layerID ); + }; + }; + return RetVal; +}; + +uint32_t argusDBC::addLRFMaskPolygone( uint32_t maskID, uint8_t r, uint8_t g, uint8_t b ){ + uint32_t RetVal = 0; + if( m_bIsConnected ) { + char tQBuf[MAX_PATH_LEN]; + sprintf( tQBuf, "INSERT INTO `lrf_mask_vertexes` SET `mask_id`=%d, `r`=%d, `g`=%d, `b`=%d", + maskID, + r, + g, + b + ); +#ifdef DEBUG + LOG(tQBuf); +#endif + RetVal = m_pDatabase->QueryID( tQBuf ); + }; + return RetVal; +}; + +bool argusDBC::addLRFMaskPolygonePoint( uint32_t polyID, uint16_t x, uint16_t y ){ + if( m_bIsConnected ) { + char tQBuf[MAX_PATH_LEN]; + sprintf( tQBuf, "INSERT INTO `lrf_mask_vertex_points` SET `vertex_id`=%d, `x`=%d, `y`=%d", + polyID, + x, + y + ); +#ifdef DEBUG + LOG(tQBuf); +#endif + m_pDatabase->SilentQuery( tQBuf ); + return true; + }; + return false; +}; + uint32_t argusDBC::addLocalNetwork( uint32_t NIF_ID, ARGUS_NETWORK_TYPE net_type, CSTR address, CSTR mask, CSTR gateway, CSTR broadcast ){ uint32_t RetVal = 0; if( m_bIsConnected ) { @@ -3110,17 +3359,31 @@ uint32_t argusDBC::addLocalNetworkInfrastructure( uint32_t NIF_ID, uint32_t OUTB return RetVal; }; -bool argusDBC::addDraw( uint32_t DBID, uint16_t SIZE, CSTR ID ){ +bool argusDBC::addDraw( uint32_t DBID, uint32_t SIZE, CSTR ID, uint8_t kID, uint8_t type, bool rendered ){ if( m_bIsConnected ) { char tQBuf[MAX_PATH_LEN]; - sprintf( tQBuf,"INSERT INTO `lrf_draw` SET `node_id`=%d,`ts`=NOW(),`md5`='%s',`size`=%d ON DUPLICATE KEY UPDATE `ts`=NOW(),`md5`='%s',`size`=%d, `rendered`='N'", - DBID, - ID, - SIZE, - ID, - SIZE - ); -#ifdef DEBUG_ALL + if ( rendered ) { + sprintf(tQBuf, "INSERT INTO `lrf_draw` SET `node_id`=%d,`ts`=NOW(),`md5`='%s',`size`=%d, `lrf_id`=%d, `type`=%d, `rendered`='Y' ON DUPLICATE KEY UPDATE `ts`=NOW(),`md5`='%s',`size`=%d, `rendered`='Y'", + DBID, + ID, + SIZE, + kID, + type, + ID, + SIZE + ); + } else { + sprintf(tQBuf, "INSERT INTO `lrf_draw` SET `node_id`=%d,`ts`=NOW(),`md5`='%s',`size`=%d, `lrf_id`=%d, `type`=%d ON DUPLICATE KEY UPDATE `ts`=NOW(),`md5`='%s',`size`=%d, `rendered`='N'", + DBID, + ID, + SIZE, + kID, + type, + ID, + SIZE + ); + }; +#ifdef DEBUG LOG(tQBuf); #endif m_pDatabase->SilentQuery( tQBuf ); @@ -3128,17 +3391,18 @@ bool argusDBC::addDraw( uint32_t DBID, uint16_t SIZE, CSTR ID ){ }; return false; }; -uint32_t argusDBC::addEvent( uint32_t SRC, CSTR UUID, uint32_t tss, uint32_t tsms, uint8_t evt_type, uint16_t dig_r, float AZ, float EL, float RANGE, float AREA, float lat, float lon, float alt, uint32_t RefID, CSTR RefUUID ){ +uint32_t argusDBC::addEvent( uint32_t SRC, CSTR UUID, uint32_t tss, uint32_t tsms, uint8_t evt_type, uint8_t k_id, uint16_t dig_r, float EL, float AZ, float RANGE, float AREA, float lat, float lon, float alt, uint32_t RefID, CSTR RefUUID ){ uint32_t RetVal = 0; if( m_bIsConnected ) { char tQBuf[MAX_PATH_LEN]; if( RefUUID == NULL ) { - sprintf( tQBuf,"INSERT INTO events_cloud SET node_id=%d, uuid='%s', ts=%d, ts_ms=%d, evt_type=%d, range_digital=%d, azimuth=%0.6f, elevation=%0.6f, `range`=%0.2f, area=%0.3f, lat=%0.6f, lon=%0.6f, alt=%0.3f", + sprintf( tQBuf,"INSERT INTO events_cloud SET node_id=%d, uuid='%s', ts=%d, ts_ms=%d, evt_type=%d, lrf_id=%d, range_digital=%d, azimuth=%0.6f, elevation=%0.6f, `range`=%0.2f, area=%0.3f, lat=%0.6f, lon=%0.6f, alt=%0.3f", SRC, UUID, tss, tsms, evt_type, + k_id, dig_r, AZ, EL, @@ -3149,12 +3413,13 @@ uint32_t argusDBC::addEvent( uint32_t SRC, CSTR UUID, uint32_t tss, uint32_t tsm alt ); } else { - sprintf( tQBuf,"INSERT INTO events_cloud SET node_id=%d, uuid='%s', ts=%d, ts_ms=%d, evt_type=%d, range_digital=%d, azimuth=%0.6f, elevation=%0.6f, `range`=%0.2f, area=%0.3f, lat=%0.6f, lon=%0.6f, alt=%0.3f, ref_uuid='%s'", + sprintf( tQBuf,"INSERT INTO events_cloud SET node_id=%d, uuid='%s', ts=%d, ts_ms=%d, evt_type=%d, lrf_id=%d, range_digital=%d, azimuth=%0.6f, elevation=%0.6f, `range`=%0.2f, area=%0.3f, lat=%0.6f, lon=%0.6f, alt=%0.3f, ref_uuid='%s'", SRC, UUID, tss, tsms, evt_type, + k_id, dig_r, AZ, EL, @@ -3298,6 +3563,136 @@ bool argusDBC::updateLRFVerison( uint32_t lrfID, CSTR version ){ return false; }; +bool argusDBC::update3DRuntimeStatus( uint32_t lrfID, ALG_RUN_STATUS *ptr ){ + if( m_bIsConnected ) { + char tQBuf[MAX_PATH_LEN]; + sprintf( tQBuf, "INSERT INTO `lrf_runtime_status` SET `lrf_id`=%d ON DUPLICATE KEY UPDATE `lrf_id`=`lrf_id`", lrfID ); +#ifdef DEBUG_ALL + LOG(tQBuf); +#endif + m_pDatabase->SilentQuery( tQBuf ); + sprintf( tQBuf, + "UPDATE `lrf_runtime_status` SET " + "`hw_status`=%d," + "`detecting_kernels`=%d," + "`th_ready`=%d," + "`master_flips`=%d," + "`slave_flips`=%d," + "`twinc`=%d," + "`master_mp_0`=%d," + "`master_mp_1`=%d," + "`master_mp_2`=%d," + "`master_mp_3`=%d," + "`master_mp_4`=%d," + "`master_mp_5`=%d," + "`master_mp_6`=%d," + "`master_mp_7`=%d," + "`master_gp_0`=%d," + "`master_gp_1`=%d," + "`master_gp_2`=%d," + "`master_gp_3`=%d," + "`master_gp_4`=%d," + "`master_gp_5`=%d," + "`master_gp_6`=%d," + "`master_gp_7`=%d," + "`master_wp_0`=%d," + "`master_wp_1`=%d," + "`master_wp_2`=%d," + "`master_wp_3`=%d," + "`master_wp_4`=%d," + "`master_wp_5`=%d," + "`master_wp_6`=%d," + "`master_wp_7`=%d," + "`slave_mp_0`=%d," + "`slave_mp_1`=%d," + "`slave_mp_2`=%d," + "`slave_mp_3`=%d," + "`slave_mp_4`=%d," + "`slave_mp_5`=%d," + "`slave_mp_6`=%d," + "`slave_mp_7`=%d," + "`slave_gp_0`=%d," + "`slave_gp_1`=%d," + "`slave_gp_2`=%d," + "`slave_gp_3`=%d," + "`slave_gp_4`=%d," + "`slave_gp_5`=%d," + "`slave_gp_6`=%d," + "`slave_gp_7`=%d," + "`slave_wp_0`=%d," + "`slave_wp_1`=%d," + "`slave_wp_2`=%d," + "`slave_wp_3`=%d," + "`slave_wp_4`=%d," + "`slave_wp_5`=%d," + "`slave_wp_6`=%d," + "`slave_wp_7`=%d" + " WHERE `lrf_id`=%d", + ptr->HW_STATUS, + ptr->DETECTING_LRF, + ptr->TH_READY, + ptr->MASTER_FLIP_CNT, + ptr->SLAVE_FLIP_CNT, + ptr->TWINC_STATUS, + ptr->MASTER_MP[0], + ptr->MASTER_MP[1], + ptr->MASTER_MP[2], + ptr->MASTER_MP[3], + ptr->MASTER_MP[4], + ptr->MASTER_MP[5], + ptr->MASTER_MP[6], + ptr->MASTER_MP[7], + ptr->MASTER_GP[0], + ptr->MASTER_GP[1], + ptr->MASTER_GP[2], + ptr->MASTER_GP[3], + ptr->MASTER_GP[4], + ptr->MASTER_GP[5], + ptr->MASTER_GP[6], + ptr->MASTER_GP[7], + ptr->MASTER_WP[0], + ptr->MASTER_WP[1], + ptr->MASTER_WP[2], + ptr->MASTER_WP[3], + ptr->MASTER_WP[4], + ptr->MASTER_WP[5], + ptr->MASTER_WP[6], + ptr->MASTER_WP[7], + ptr->SLAVE_MP[0], + ptr->SLAVE_MP[1], + ptr->SLAVE_MP[2], + ptr->SLAVE_MP[3], + ptr->SLAVE_MP[4], + ptr->SLAVE_MP[5], + ptr->SLAVE_MP[6], + ptr->SLAVE_MP[7], + ptr->SLAVE_GP[0], + ptr->SLAVE_GP[1], + ptr->SLAVE_GP[2], + ptr->SLAVE_GP[3], + ptr->SLAVE_GP[4], + ptr->SLAVE_GP[5], + ptr->SLAVE_GP[6], + ptr->SLAVE_GP[7], + ptr->SLAVE_WP[0], + ptr->SLAVE_WP[1], + ptr->SLAVE_WP[2], + ptr->SLAVE_WP[3], + ptr->SLAVE_WP[4], + ptr->SLAVE_WP[5], + ptr->SLAVE_WP[6], + ptr->SLAVE_WP[7], + lrfID + ); +#ifdef DEBUG_ALL + LOG(tQBuf); +#endif + m_pDatabase->SilentQuery( tQBuf ); + return true; + }; + return false; +}; + bool argusDBC::setLRFDataStatus( uint32_t lrfID, uint8_t ST ){ if( m_bIsConnected ) { char tQBuf[MAX_PATH_LEN]; @@ -3323,6 +3718,27 @@ bool argusDBC::setLRFDetectionProfile( uint32_t lrfID, uint8_t profileID ){ }; return false; }; + +bool argusDBC::setLRFMaskStatus( uint32_t maskID, bool status ){ + if( m_bIsConnected ) { + char tQBuf[MAX_PATH_LEN]; + char S[2]; + if (status ) { + S[0] = 'E'; + S[1] = (char)0; + } else { + S[0] = 'D'; + S[1] = (char)0; + }; + sprintf( tQBuf, "UPDATE `lrf_masks` SET `status`='%s' WHERE `id`=%d", S, maskID ); +#ifdef DEBUG_ALL + LOG(tQBuf); +#endif + m_pDatabase->SilentQuery( tQBuf ); + return true; + }; + return false; +}; bool argusDBC::setLRFAltSerial( uint32_t lrfID, CSTR Serial ){ if( m_bIsConnected ) { char tQBuf[MAX_PATH_LEN]; @@ -3508,8 +3924,8 @@ DBC_MODULE_EMBED_VIDEO_DATA *argusDBC::getEmbedVideoData( uint32_t ID ){ return tPtr; }; -DBC_EVT_DATA *argusDBC::getEventByUUID( CSTR UUID ){ - DBC_EVT_DATA *tPtr = NULL; +DBC_EVT_RECORD *argusDBC::getEventByUUID( CSTR UUID ){ + DBC_EVT_RECORD *tPtr = NULL; if( m_bIsConnected ) { char tQBuf[MAX_PATH_LEN]; AAssoc *result; @@ -3521,10 +3937,10 @@ DBC_EVT_DATA *argusDBC::getEventByUUID( CSTR UUID ){ if( result!= NULL ) { if( result->size() > 0 ) { Assoc *cArr; - tPtr = (DBC_EVT_DATA*)malloc(sizeof(DBC_EVT_DATA)); + tPtr = (DBC_EVT_RECORD*)malloc(sizeof(DBC_EVT_RECORD)); if( tPtr!= NULL ) { Assoc::iterator it; - memset(tPtr,0,sizeof(DBC_EVT_DATA)); + memset(tPtr,0,sizeof(DBC_EVT_RECORD)); cArr = result->at(0); it = cArr->find("id"); if( it != cArr->end() ){ diff --git a/lib/rgoose/rgooseDBConnector.h b/lib/rgoose/rgooseDBConnector.h index a20bdfc8..94335c5d 100644 --- a/lib/rgoose/rgooseDBConnector.h +++ b/lib/rgoose/rgooseDBConnector.h @@ -5,6 +5,7 @@ #include "../data/mysql/database_class.h" //#include "../data/protocol/onvifMediaObserver.h" #include "../alg/generic/md5.h" +#include "../alg/lgs/mask.h" #include "rgooseTypes.h" class argusDBC{ @@ -31,8 +32,12 @@ class argusDBC{ - bool addDraw( uint32_t DBID, uint16_t SIZE, CSTR ID ); - uint32_t addEvent( uint32_t SRC, CSTR UUID, uint32_t tss, uint32_t tsms, uint8_t evt_type, uint16_t dig_r=0, float AZ=.0f, float EL=.0f, float RANGE=.0f, float AREA=.0f, float lat=.0f, float lon=.0f, float alt=.0f, uint32_t RefID=0, CSTR RefUUID=NULL ); + bool addDraw( uint32_t DBID, uint32_t SIZE, CSTR ID, uint8_t kID =0, uint8_t type = 0, bool rendered = false ); + uint32_t addEvent( uint32_t SRC, CSTR UUID, uint32_t tss, uint32_t tsms, uint8_t evt_type, uint8_t k_id=0, uint16_t dig_r=0, float EL=.0f, float AZ=.0f, float RANGE=.0f, float AREA=.0f, float lat=.0f, float lon=.0f, float alt=.0f, uint32_t RefID=0, CSTR RefUUID=NULL ); + uint32_t addLRFMask( uint32_t devID, uint8_t lrfID = 0, uint8_t layerID = 0 ); + uint32_t addLRFMaskPolygone( uint32_t maskID, uint8_t r, uint8_t g, uint8_t b ); + bool addLRFMaskPolygonePoint( uint32_t polyID, uint16_t x, uint16_t y ); + //bool addIPCam( uint32_t SiteID, resultWoWo *tPtr ); bool addIPCam( uint32_t SiteID, OBSERVER_RESULT *tPtr ); uint32_t addLocalMediaSource( uint32_t SiteID, CSTR path, uint32_t width, uint32_t height ); @@ -51,12 +56,15 @@ class argusDBC{ bool addVideoEvent( uint32_t evtID, uint32_t videoID ); uint32_t addVideoRecord( uint32_t streamID, CSTR md5, uint32_t partID ); bool cleanResources( uint32_t ServerNodeID, bool all = false ); + bool cleanLRFMask( uint32_t maskID, bool deleteMask = false ); void lazyEventArchiver( uint32_t DalayTime = 10 ); DBC_INT_LIST * listCamMediaStreams( uint32_t CAMID ); DBC_INT_LIST * listDetectionProfileIDs( uint32_t nodeID ); DBC_INT_LIST * listDetectionProfiles( uint32_t nodeID ); DBC_INT_LIST * listFilters( uint32_t m_nServerID ); + DBC_INT_LIST * listLRFMaskVertexes( uint32_t MaskID ); + DBC_INT_LIST * listLRFMaskVertexPoints( uint32_t VertexID ); DBC_INT_LIST * listMediaServerStreams( uint32_t SiteId, uint32_t MediaServerID, uint8_t listingType = LIST_ALL_RECORDS ); DBC_INT_LIST * listMediaStreams( uint32_t SiteId, uint8_t listingType = LIST_ALL_RECORDS ); DBC_INT_LIST * listModules( uint32_t SiteID ); @@ -66,6 +74,7 @@ class argusDBC{ DBC_INT_LIST * listNodes( uint32_t SiteID ); //DBC_INT_LIST * listSockets( uint32_t NodeID ); DBC_INT_LIST * listResources( uint32_t NodeID = 0 ); + simplePolygone * loadLRFMaskVertex( uint32_t vid ); bool getAllCamRecords( uint32_t SiteID, vectorCamRecords &VR ); DBC_APF_DATA * getAPFData( uint32_t APFID ); @@ -73,14 +82,15 @@ class argusDBC{ uint32_t getCamId( CSTR UUID ); bool getConnectionStatus(void){return m_bIsConnected;}; - DBC_EVT_DATA * getEventByUUID( CSTR UUID ); + DBC_EVT_RECORD * getEventByUUID( CSTR UUID ); DBC_MODULE_EMBED_VIDEO_DATA * getEmbedVideoData( uint32_t ID ); DBC_FH_DATA * getFlyHunterData( uint32_t ID ); int getIPCamCount( uint32_t SiteID ); KAFKA_TEMPLATE * getKafkaTemplateForEvent( uint32_t ModuleID, uint32_t ClassID, uint32_t EventID ); - bool getLastEvents( vectorEventRecords &VR, uint32_t tss, uint32_t tsms ); + //bool getLastEvents( vectorEventRecords &VR, uint32_t tss, uint32_t tsms ); DBC_LRF_DATA * getLRFData( uint32_t ID ); uint8_t getLRFDataStatus( uint32_t ID ); + uint32_t getLRFMaskID( uint32_t deviceID, uint8_t lrfID = 0, uint8_t layer = 0 ); DBC_MEDIA_STREAM_DATA * getMediaStreamData( uint32_t ID ); DBC_MEDIA_SERVER_DATA * getMediaServerData( uint32_t ID ); DBC_MEDIA_SERVER_STREAM_DATA * getMediaServerStreamData( uint32_t ID ); @@ -125,7 +135,9 @@ class argusDBC{ bool setLRFDataStatus( uint32_t lrfID, uint8_t ST ); bool setLRFAltSerial( uint32_t lrfID, CSTR Serial ); bool setLRFAltVerison( uint32_t lrfID, CSTR version ); + bool setLRFMaskStatus( uint32_t maskID, bool status ); bool setStreamValid( uint32_t streamID ); + bool update3DRuntimeStatus( uint32_t lrfID, ALG_RUN_STATUS *ptr ); bool updateAFPBox( uint32_t filterID, CSTR Tag, float x, float y, float z ); bool updateIPCam( uint32_t SiteID, CSTR uuid, CSTR Addr ); bool updateIPCam( uint32_t SiteID, uint32_t CamID, CSTR Addr ); diff --git a/lib/rgoose/rgooseKernel.cpp b/lib/rgoose/rgooseKernel.cpp index 68139fe8..4594a6e2 100644 --- a/lib/rgoose/rgooseKernel.cpp +++ b/lib/rgoose/rgooseKernel.cpp @@ -369,7 +369,7 @@ void argusKernel::m_fThreadProc( void ){ time_t tTimeTSeconds; int lastTSS = 0; int lastTMS = 0; - DBC_EVT_DATA * tEvtPtr; + DBC_EVT_RECORD * tEvtPtr; uint32_t tLazyTimer = ARGUS_KERNEL_LAZY_SECONDS; char pidBuf[16]; sprintf(pidBuf,"pid: %d tid: %d", getpid(), gettid() ); @@ -695,6 +695,7 @@ void argusKernel::dispatchEvent( EVENT_CONTAINER *Evt ){ 0, 0, 0, + 0, tData->evtUUID ) ){ //Simulate FH Module Event; @@ -763,7 +764,7 @@ void argusKernel::dispatchEvent( EVENT_CONTAINER *Evt ){ #ifdef SIMULATE_KERNEL_TARGETS sprintf( m_cCurrentMission, tData->evtUUID ); #endif - DBC_EVT_DATA * tEVT = m_pDBC->getEventByUUID( tData->targetUUID ); + DBC_EVT_RECORD * tEVT = m_pDBC->getEventByUUID( tData->targetUUID ); if( tEVT ) { uint32_t TS_A, TS_B; TS_A = Evt->m_UMSTS / 1000; @@ -779,6 +780,7 @@ void argusKernel::dispatchEvent( EVENT_CONTAINER *Evt ){ 0, 0, 0, + 0, tEVT->lat, tEVT->lon, tEVT->alt, @@ -786,8 +788,8 @@ void argusKernel::dispatchEvent( EVENT_CONTAINER *Evt ){ tEVT->uuid ) ){ //Simulate FH Module Event; - EVENT_CONTAINER *ttt; - FH_MISSION_DATA * nnn = (FH_MISSION_DATA *) malloc( sizeof(FH_MISSION_DATA)); + EVENT_CONTAINER * ttt; + FH_MISSION_DATA * nnn = (FH_MISSION_DATA *) malloc( sizeof(FH_MISSION_DATA)); if( nnn ){ nnn->location.lat = tEVT->lat; nnn->location.lon = tEVT->lon; @@ -832,6 +834,7 @@ void argusKernel::dispatchEvent( EVENT_CONTAINER *Evt ){ TS_A, TS_B, Evt->m_eType, + 0, tDATA->digital, 0, 0, @@ -857,6 +860,7 @@ void argusKernel::dispatchEvent( EVENT_CONTAINER *Evt ){ TS_A, TS_B, Evt->m_eType, + tDATA->lrf_id, tDATA->digital, tDATA->local_target.tetta, tDATA->local_target.fi, @@ -882,6 +886,7 @@ void argusKernel::dispatchEvent( EVENT_CONTAINER *Evt ){ TS_A, TS_B, Evt->m_eType, + tDATA->lrf_id, tDATA->digital, tDATA->local_target.tetta, tDATA->local_target.fi, diff --git a/lib/rgoose/rgooseModuleFlyHunter.cpp b/lib/rgoose/rgooseModuleFlyHunter.cpp index a402764b..2965a21f 100644 --- a/lib/rgoose/rgooseModuleFlyHunter.cpp +++ b/lib/rgoose/rgooseModuleFlyHunter.cpp @@ -372,7 +372,7 @@ void argusModuleFlyHunter::dispatchEvent(EVENT_CONTAINER *Evt){ ( ( ( m_bDroneStatus == FH_STATUS_ARMED ) && ( ( m_bWorkingMode == FH_WM_HOOVERING ) || ( m_bWorkingMode == FH_WM_FTL ) ) ) ) ){ FH_CTRL_DATA * tData = (FH_CTRL_DATA *) Evt->m_pEvtData; - DBC_EVT_DATA * tEVT = m_pDBC->getEventByUUID( tData->targetUUID ); + DBC_EVT_RECORD * tEVT = m_pDBC->getEventByUUID( tData->targetUUID ); if( tEVT ) { EVENT_CONTAINER * newEvt; FH_MISSION_DATA * evtData = (FH_MISSION_DATA *) malloc( sizeof(FH_MISSION_DATA)); diff --git a/lib/rgoose/rgooseNode.cpp b/lib/rgoose/rgooseNode.cpp index a39841e5..440a8a2c 100644 --- a/lib/rgoose/rgooseNode.cpp +++ b/lib/rgoose/rgooseNode.cpp @@ -12,7 +12,7 @@ #define LOG_ERROR( X ) m_pLog->Log( "NODE", this, _LOG_ERROR, X ); #endif -argusNetNode::argusNetNode( uint32_t id ):basicObject(){ +argusNetNode::argusNetNode( uint32_t id ):basicEngine(){ m_pDBC = argusDBC::getInstance(); m_pLog = basicLogCollection::getInstance(); m_pPosition = NULL; @@ -36,7 +36,7 @@ argusNetNode::argusNetNode( uint32_t id ):basicObject(){ }; }; -argusNetNode::argusNetNode( DBC_NODE_DATA *Data ):basicObject(){ +argusNetNode::argusNetNode( DBC_NODE_DATA *Data ):basicEngine(){ m_pDBC = argusDBC::getInstance(); m_pLog = basicLogCollection::getInstance(); m_pPosition = NULL; diff --git a/lib/rgoose/rgooseNode.h b/lib/rgoose/rgooseNode.h index 74303cf3..71b20645 100644 --- a/lib/rgoose/rgooseNode.h +++ b/lib/rgoose/rgooseNode.h @@ -2,14 +2,55 @@ #define __ARGUS_NODE_HEADER__ #include "../components/base/basicPosition.h" -#include "../components/base/basicObject.h" +#include "../components/base/basicEngine.h" #include "rgooseDBConnector.h" #include "rgooseTargetFilter.h" #include +#define ARGUS_LRF_PCMD_FULL_RESET 1 +#define ARGUS_LRF_PCMD_RESET 2 +#define ARGUS_LRF_PCMD_DRAW 3 +#define ARGUS_LRF_PCMD_GET_PROFILE 3 + +#define ARGUS_LRF_PCMD_SET_MASK_1 60 +#define ARGUS_LRF_PCMD_SET_MASK_2 61 +#define ARGUS_LRF_PCMD_SET_MASK_3 62 +#define ARGUS_LRF_PCMD_SET_MASK_4 63 +#define ARGUS_LRF_PCMD_SET_MASK_5 64 + +#define ARGUS_LRF_PCMD_MASK_1_ON 65 +#define ARGUS_LRF_PCMD_MASK_2_ON 66 +#define ARGUS_LRF_PCMD_MASK_3_ON 67 +#define ARGUS_LRF_PCMD_MASK_4_ON 68 +#define ARGUS_LRF_PCMD_MASK_5_ON 69 + +#define ARGUS_LRF_PCMD_MASK_1_OFF 70 +#define ARGUS_LRF_PCMD_MASK_2_OFF 71 +#define ARGUS_LRF_PCMD_MASK_3_OFF 72 +#define ARGUS_LRF_PCMD_MASK_4_OFF 73 +#define ARGUS_LRF_PCMD_MASK_5_OFF 74 + +#define ARGUS_LRF_PCMD_CLEAN_MASK_1 75 +#define ARGUS_LRF_PCMD_CLEAN_MASK_2 76 +#define ARGUS_LRF_PCMD_CLEAN_MASK_3 77 +#define ARGUS_LRF_PCMD_CLEAN_MASK_4 78 +#define ARGUS_LRF_PCMD_CLEAN_MASK_5 79 + +#define ARGUS_LRF_PCMD_SET_DP_0 100 +#define ARGUS_LRF_PCMD_SET_DP_1 101 +#define ARGUS_LRF_PCMD_SET_DP_2 102 +#define ARGUS_LRF_PCMD_SET_DP_3 103 +#define ARGUS_LRF_PCMD_UPLOAD_FILE 120 + +#define ARGUS_LRF_PCMD_UPDATE_ALL 255 + + + + #define NODE_CMD_RESET_STUDY 230 #define NODE_CMD_FULL_RESET 235 +#define NODE_CMD_UPLOAD_SHADOW 234 //#define NODE_CMD_FULL_RESET 235 #define NODE_CMD_UPLOAD_FILE 240 #define NODE_CMD_GET_DEVICE_DRAW 100 @@ -22,7 +63,7 @@ typedef struct S_NODE_COMMAND{ typedef std::queue NODE_CMD_Q; -class argusNetNode: public basicObject{ +class argusNetNode: public basicEngine{ private: basicLogCollection * m_pLog; NODE_CMD_Q m_qCommands; @@ -42,8 +83,10 @@ class argusNetNode: public basicObject{ bool isOnline( void ) const { return m_sNodeData.online; }; virtual bool isDetached() { return true; }; virtual bool isAttached() { return false; }; - virtual bool startService(){ return false; }; - virtual bool stopService(){ return true; }; + + //Goes to basicEngine + //virtual bool startService(){ return false; }; + //virtual bool stopService(){ return true; }; virtual bool validate(){ return true; }; virtual void simulateTarget( void ){}; void enqueueCommand( NODE_COMMAND *ptr ); diff --git a/lib/rgoose/rgooseNode2D.cpp b/lib/rgoose/rgooseNode2D.cpp index c1c8a410..6dc91f7a 100644 --- a/lib/rgoose/rgooseNode2D.cpp +++ b/lib/rgoose/rgooseNode2D.cpp @@ -2,16 +2,16 @@ #include "rgooseHardwareResourceSerialProvider.h" #include "rgooseKernel.h" -#define LOG( X ) m_pLog->Log( "2DNODE", this, X ) +#define LOG( X ) m_pLog->Log( "NODE2D", this, X ) #ifdef DEBUG #define LOG_ERROR( X ) {\ char _tBfrErrMSG2w34[256];\ sprintf( _tBfrErrMSG2w34, "In file %s[%d] in func:%s %s",__FILE__, __LINE__, __func__, X );\ - m_pLog->Log( "2DNODE", this, _LOG_ERROR, _tBfrErrMSG2w34 );\ + m_pLog->Log( "NODE2D", this, _LOG_ERROR, _tBfrErrMSG2w34 );\ } #else - #define LOG_ERROR( X ) m_pLog->Log( "2DNODE", this, _LOG_ERROR, X ); + #define LOG_ERROR( X ) m_pLog->Log( "NODE2D", this, _LOG_ERROR, X ); #endif /* @@ -464,7 +464,7 @@ void ARGUS_2DSensor::m_fThreadProc( void ){ LOG_ERROR("Fall Back to Disconnected!"); setWM( ANODE_WM_2D_CREATE_PORT ); } else { - m_nSleepTime = LGS_ALERT_SLEEP_TIME; + m_nSleepTime = LGS_DEFAULT_TO_COUNTER;//LGS_ALERT_SLEEP_TIME; setWM( ANODE_WM_2D_WAIT_FAST_DRAW ); }; } @@ -516,7 +516,7 @@ void ARGUS_2DSensor::m_fThreadProc( void ){ // Special Mode - Push COMMMANDS case ANODE_WM_2D_ISSUE_FULL_RESET:{ - m_bTimeOutCounter = LGS_DEFAULT_SLEEP_TIME; + m_bTimeOutCounter = LGS_DEFAULT_TO_COUNTER; if( !doFullReset()) { LOG_ERROR("Fall Back to Disconnected!"); setWM( ANODE_WM_2D_CREATE_PORT ); @@ -1082,6 +1082,7 @@ TARGET_DATA *ARGUS_2DSensor::prepareTargetData( uint16_t AZ, uint16_t RANGE, uin tVal->local_target.tetta = (360.0f / 6000.0f) * (float) AZ; tVal->local_target.fi = 90.0f; tVal->area = WIDTH; + tVal->lrf_id = 0; // Always Master? tVal->digital = RANGE; // local - C3D_SPH_DEGREES // system - C3D_DECART diff --git a/lib/rgoose/rgooseNode2D.h b/lib/rgoose/rgooseNode2D.h index 2f7c367d..cf34903a 100644 --- a/lib/rgoose/rgooseNode2D.h +++ b/lib/rgoose/rgooseNode2D.h @@ -56,36 +56,7 @@ #define ANODE_2D_MAX_DRAW_ANGLES 6000 -#define ARGUS_LRF_PCMD_FULL_RESET 1 -#define ARGUS_LRF_PCMD_RESET 2 -#define ARGUS_LRF_PCMD_DRAW 3 -#define ARGUS_LRF_PCMD_GET_PROFILE 3 -#define ARGUS_LRF_PCMD_SET_MASK_1 60 -#define ARGUS_LRF_PCMD_SET_MASK_2 61 -#define ARGUS_LRF_PCMD_SET_MASK_3 62 -#define ARGUS_LRF_PCMD_SET_MASK_4 63 -#define ARGUS_LRF_PCMD_SET_MASK_5 64 - -#define ARGUS_LRF_PCMD_MASK_1_ON 65 -#define ARGUS_LRF_PCMD_MASK_2_ON 66 -#define ARGUS_LRF_PCMD_MASK_3_ON 67 -#define ARGUS_LRF_PCMD_MASK_4_ON 68 -#define ARGUS_LRF_PCMD_MASK_5_ON 69 - -#define ARGUS_LRF_PCMD_MASK_1_OFF 70 -#define ARGUS_LRF_PCMD_MASK_2_OFF 71 -#define ARGUS_LRF_PCMD_MASK_3_OFF 72 -#define ARGUS_LRF_PCMD_MASK_4_OFF 73 -#define ARGUS_LRF_PCMD_MASK_5_OFF 74 - -#define ARGUS_LRF_PCMD_SET_DP_0 100 -#define ARGUS_LRF_PCMD_SET_DP_1 101 -#define ARGUS_LRF_PCMD_SET_DP_2 102 -#define ARGUS_LRF_PCMD_SET_DP_3 103 -#define ARGUS_LRF_PCMD_UPLOAD_FILE 120 - -#define ARGUS_LRF_PCMD_UPDATE_ALL 255 class ARGUS_2DSensor: public argusNetNode, public basicThread, public protocolLGS_2D{ diff --git a/lib/rgoose/rgooseNode3D.cpp b/lib/rgoose/rgooseNode3D.cpp index bad5e728..41a81418 100644 --- a/lib/rgoose/rgooseNode3D.cpp +++ b/lib/rgoose/rgooseNode3D.cpp @@ -5,11 +5,14 @@ argus3DLIDAR::argus3DLIDAR( uint32_t ID ): argusNetNode( ID ){ m_pLog = basicLogCollection::getInstance(); - m_pMasterNode = NULL; - m_pSlaveNode = NULL; m_pEventHeap = basicEventHeap::getInstance(); - DBC_LRF_DATA *tDATA = m_pDBC->getLRFData( m_sNodeData.aux_id ); + //m_pThresholdData = NULL; + m_pThresholdData = (thresholdNode *) malloc( sizeof(thresholdNode) * TH_SIZE_NODES ); + m_nFullBorderDataIndex = 0; + m_nFullBorderKernelIndex = 0; + m_bTWINC = false; + m_pShadow = NULL; if( tDATA != NULL ) { memcpy( &m_sDATA, tDATA, sizeof(DBC_LRF_DATA)); free( tDATA ); @@ -30,68 +33,140 @@ bool argus3DLIDAR::startService(){ LOG_ERROR("No Database Connector Defined!"); return false; }; - // DBC_LRF_DATA *tData; - // tData = m_pDBC->getLRFData( m_sNodeData.aux_id ); - // if( tData == NULL ) { - // LOG_ERROR("No Database Data!!"); - // return false; - // }; - // memcpy( &m_sDATA, tData, sizeof(DBC_LRF_DATA)); - // free( tData ); - m_pMasterNode = new sensorLGS3D( m_sNodeData.node_id, true ); - if( m_pMasterNode != NULL ) { -#ifdef DEBUG - LOG("Set Master Host to:"); - LOG( m_sDATA.master_host ); -#endif - m_pMasterNode->setHost( m_sDATA.master_host ); - m_pMasterNode->setPort( m_sDATA.master_port ); - LOG("Host/Port Set Done"); - basicPosition *pos = m_pMasterNode->getPosition(); - //pos->setPositionDeg( m_sDATA.lat, m_sDATA.lon, m_sDATA.alt, m_sDATA.roll, m_sDATA.pitch, m_sDATA.yaw, 0.f ); - pos->setPositionXYZ( m_sDATA.x , m_sDATA.y, m_sDATA.z ); - pos->setOrientationDeg( m_sDATA.x_rot , m_sDATA.y_rot, m_sDATA.z_rot ); - if(!m_pMasterNode->create() ){ - LOG_ERROR("CANNOT CREATE MASTER DEVICE!"); - delete( m_pMasterNode ); - m_pMasterNode = NULL; - } -#ifdef DEBUG - else LOG("Master Node CREATE - OK!") -#endif - ; - } else LOG_ERROR("Master Node CREATE Failure!"); - /* - m_pSlaveNode = new sensorLGS3D( m_sNodeData.node_id, false ); - if( m_pSlaveNode != NULL ) { - m_pSlaveNode->setHost( m_sDATA.slave_host ); - m_pSlaveNode->setPort( m_sDATA.slave_port ); - basicPosition *pos = m_pSlaveNode->getPosition(); - pos->setPositionDeg( m_sDATA.lat, m_sDATA.lon, m_sDATA.alt, m_sDATA.roll, m_sDATA.pitch, m_sDATA.yaw, 0.f ); - if(!m_pSlaveNode->create() ){ - LOG_ERROR("CANNOT CREATE SLAVE DEVICE!"); - delete( m_pSlaveNode ); - m_pSlaveNode = NULL; - }; - }; - */ - return (m_pMasterNode != NULL);// && (m_pSlaveNode != NULL); + LOG("1"); + m_oPosition.setPositionXYZ( m_sDATA.x , m_sDATA.y, m_sDATA.z ); + m_oPosition.setOrientationDeg( m_sDATA.x_rot , m_sDATA.y_rot, m_sDATA.z_rot ); + LOG("2"); + // Check if Allredy Working + if( m_bThreadStatus > TH_ARMED ){ + if( m_bThreadStatus == TH_WORKING ) return true; + return false; + }; + LOG("3"); + m_pShadow = new ShadowMask(); + if( m_pShadow ) { + m_pShadow->disableAutoSave(); + m_pShadow->clear(); + }; + LOG("4"); + return init(); }; bool argus3DLIDAR::stopService(){ LOG("STOP SERVICE"); - if( m_pMasterNode != NULL ) { - delete( m_pMasterNode ); - m_pMasterNode = NULL; - }; - if( m_pSlaveNode != NULL ) { - delete( m_pSlaveNode ); - m_pSlaveNode = NULL; - }; + LOG("unlock all mutexes"); + m_mDataMutex.unlock(); + m_mStatusMutex.unlock(); + m_mPackageMutex.unlock(); + LOG("Kill Thread"); + waitThreadEnd( true ); + LOG("Clean Data"); + cleanDataTH(); + LOG("Remove Shadow"); + if( m_pShadow ) delete( m_pShadow ); + LOG("Done!"); return true; }; bool argus3DLIDAR::validate(){ + DBC_PUSHED_CMD *tCMD = m_pDBC->getNodePushedCMD( m_sNodeData.node_id ); + if ( tCMD!= NULL ) { + switch( tCMD->CMD ){ + case ARGUS_LRF_PCMD_FULL_RESET:{ +#ifdef DEBUG + LOG("Full Reset Push CMD!"); +#endif + NODE_COMMAND *tNCMD = (NODE_COMMAND *) malloc( sizeof(NODE_COMMAND)); + if (tNCMD) { + tNCMD->cmd = NODE_CMD_FULL_RESET; + tNCMD->parameter = NULL; + LOG("B E"); + enqueueCommand( tNCMD ); + LOG("A E"); + }; + break; + }; + case ARGUS_LRF_PCMD_DRAW:{ +#ifdef DEBUG + LOG("Get Draw Push CMD!"); +#endif + NODE_COMMAND *tNCMD = (NODE_COMMAND *) malloc( sizeof(NODE_COMMAND)); + if (tNCMD) { + tNCMD->cmd = NODE_CMD_GET_DEVICE_DRAW; + tNCMD->parameter = NULL; + enqueueCommand( tNCMD ); + } + break; + }; + case ARGUS_LRF_PCMD_UPLOAD_FILE:{ +#ifdef DEBUG + LOG("Upload File CMD!"); +#endif + uint16_t sz = strlen(tCMD->PARAM); + if( sz ){ + NODE_COMMAND *tNCMD = (NODE_COMMAND *)malloc(sizeof(NODE_COMMAND)); + if( tNCMD ){ + tNCMD->cmd = NODE_CMD_UPLOAD_FILE; + tNCMD->parameter = malloc( sz+1 ); + if ( tNCMD->parameter != NULL ) { + memcpy(tNCMD->parameter, tCMD->PARAM, sz); + ((uint8_t *)tNCMD->parameter)[sz] = 0; + enqueueCommand( tNCMD ); + } else { + free( tNCMD ); + }; + }; + }; + break; + }; + case ARGUS_LRF_PCMD_SET_MASK_1: + case ARGUS_LRF_PCMD_SET_MASK_2: + case ARGUS_LRF_PCMD_SET_MASK_3: + case ARGUS_LRF_PCMD_SET_MASK_4: + case ARGUS_LRF_PCMD_SET_MASK_5:{ + //Rasterize Masks and upload + m_nCurrentMaskID = m_pDBC->getLRFMaskID( m_sNodeData.aux_id ); // 3DLRF has onli one mask + if( m_nCurrentMaskID ){ + if( m_pShadow == NULL ){ + m_pShadow = new ShadowMask(); + }; + if ( m_pShadow != NULL ) { + m_pShadow->clear(); + DBC_INT_LIST *tVertexes = m_pDBC->listLRFMaskVertexes( m_nCurrentMaskID ); + if ( tVertexes ){ + if( tVertexes->size() ){ + LOG("Has POLY"); + for ( int vidx=0; vidx < tVertexes->size(); vidx++ ) { + simplePolygone *tPoly = m_pDBC->loadLRFMaskVertex( tVertexes->at(vidx) ); + if( tPoly ) { + LOG("POLY LOADDED!"); + m_pShadow->addPoly( tPoly ); + LOG("POLY ADDED!"); + if( m_pShadow->rasterizeVertexes() ){ + LOG("Vertexes Rasterized!"); + } else { + LOG("Vertexes ARE NOT Rasterized!"); + }; + }; + }; + LOG("Create Command!"); + NODE_COMMAND *tNCMD = (NODE_COMMAND *)malloc(sizeof(NODE_COMMAND)); + if( tNCMD ){ + tNCMD->cmd = NODE_CMD_UPLOAD_SHADOW; + tNCMD->parameter = NULL; + m_nCurrentPolyID = 0; + enqueueCommand( tNCMD ); + LOG("Command Queued!"); + }; + } + delete( tVertexes ); + }; + }; + }; + }; + }; + free(tCMD); + }; return true; }; @@ -106,7 +181,8 @@ void argus3DLIDAR::simulateTarget( void ){ cEVT.k_id = 5; cEVT.w_cnt = 5; - tData = m_pMasterNode->prepareTargetData( &cEVT ); + //tData = m_pMasterNode-> + tData = prepareTargetData( &cEVT ); if( tData != NULL ){ EVENT_CONTAINER * bEVT = createBasicEvent( getDbId(), EVT_CLASS_SENSOR_3D, (basicEventTypeID)cEVT.type, NULL, NULL, tData ); @@ -116,16 +192,1195 @@ void argus3DLIDAR::simulateTarget( void ){ }; }; -// Local Funcs +void argus3DLIDAR::m_fThreadProc(void){ + uint32_t nTimeOut = 20; + clientPort * tPort = NULL; + m_bThreadStatus = TH_WORKING; + while( m_bThreadStatus < TH_ENDED ){ + uint8_t cWM = getWM(); -#undef LOG -#undef LOG_ERROR + switch( cWM ) { + case CWM_INIT:{ + if ( tPort!= NULL ) { + delete( tPort ); + tPort = NULL; + EVENT_CONTAINER *tEVT; + //ToDo: Change Device Name! + m_pDBC->setNodeOffline( m_sNodeData.node_id ); + tEVT = createBasicEvent( m_sNodeData.node_id, EVT_CLASS_SENSOR_3D, EVT_ERROR, NULL, "Device is Disconnected"); + m_pEventHeap->broadcast( tEVT ); + SLEEP(100); + } else { + if( strlen( m_sDATA.slave_host ) < 7 ) { //minimal size of "X.X.X.X" + tPort = new clientPort( m_sDATA.master_host, m_sDATA.master_port ); + } else { + tPort = new clientPort( m_sDATA.slave_host, m_sDATA.slave_port ); + }; + if( tPort!= NULL ) { + setWM(CWM_CONNECT); + }; + }; + break; + }; + case CWM_CONNECT:{ + if( CS_CONNECTED == getConnectionStatus() ) { + EVENT_CONTAINER *tEVT; +#ifdef DEBUG + LOG("Set Device Connected!"); +#endif + m_pDBC->setNodeOnline( m_sNodeData.node_id ); + tEVT = createBasicEvent( m_sNodeData.node_id, EVT_CLASS_SENSOR_3D, EVT_READY, NULL, "Device is connected"); + m_pEventHeap->broadcast( tEVT ); + setWM( CWM_INITIAL_GET_TWINC ); + + } else { + if( tPort!= NULL ) { + if ( tPort->create() ) { + if( setTransport( tPort , false ) ){ + break; + } else { + LOG_ERROR("Transport is not Attached to Parser!"); + }; + } else { + LOG_ERROR("Transport is not Created!"); + }; + }; + SLEEP(1000); + setWM( CWM_INIT ); + }; + break; + }; + case CWM_INITIAL_GET_TWINC:{ + if( !getTwincSupport() ) { +#ifdef DEBUG + LOG_ERROR("Get TWINC Support"); +#endif + setWM( CWM_INIT ); + } else { + LOG("Waiting ACK Twinc"); + setWM( CWM_INITIAL_WAIT_TWINC ); + }; + break; + }; + case CWM_INITIAL_GET_PARAM:{ + if( !getParameters() ) { +#ifdef DEBUG + LOG_ERROR("Get Param Failure"); +#endif + setWM( CWM_INIT ); + } else { + LOG("Waiting ACK Param"); + setWM( CWM_INITIAL_WAIT_PARAM ); + }; + break; + }; + case CWM_INITIAL_GET_MASKS_INFO:{ + if( !getShadowInfo() ){ + LOG_ERROR("Error INITIAL CMD_GET_SHADOW_INFO!"); + setWM( CWM_INIT ); + } else { + setWM( CWM_INITIAL_WAIT_MASKS_INFO ); + }; + break; + }; + case CWM_INITIAL_GET_VERTEX_DATA:{ + char tB[64]; + sprintf(tB, "Ini Get Vertex[%d]", m_nCurrentPolyID ); + LOG( tB ); + if( !getShadowPoly( m_nCurrentPolyID ) ){ + if( CS_CONNECTED != getConnectionStatus() ) { + setWM( CWM_INIT ); + } else LOG_ERROR("Error INITIAL CMD_GET_SHADOW_DATA!"); + } else { + setWM( CWM_INITIAL_WAIT_VERTEX_DATA ); + }; + break; + }; + + case CWM_GET_BORDER:{ + if( !getDraw( m_nFullBorderDataIndex, m_nFullBorderKernelIndex ) ){ + if( CS_CONNECTED != getConnectionStatus() ) { + setWM( CWM_INIT ); + } else LOG_ERROR("Error Sending CMD_FULL_BORDER!"); + } else { + setWM( CWM_WAIT_BORDER ); + }; + break; + }; + case CWM_GET_MASK:{ + if( !setShadowPoly(NULL) ){ + if( CS_CONNECTED != getConnectionStatus() ) { + setWM( CWM_INIT ); + } else LOG_ERROR("Error Sending CMD_SET_HZ_POLY!"); + } else { + setWM( CWM_WAIT_MASK ); + }; + break; + }; + case CWM_SET_MASK:{ + m_pShadow->getPolyCount(); + if( !setShadowPoly(NULL) ){ + if( CS_CONNECTED != getConnectionStatus() ) { + setWM( CWM_INIT ); + } else LOG_ERROR("Error Sending CMD_SET_HZ_POLY!"); + } else { + setWM( CWM_WAIT_MASK ); + }; + break; + }; + case CWM_GET_PARAMS:{ + if( !getParameters() ){ + if( CS_CONNECTED != getConnectionStatus() ) { + setWM( CWM_INIT ); + } else LOG_ERROR("Error Sending CMD_GET_PARAMETERS!"); + } else { + setWM( CWM_WAIT_PARAMS ); + }; + break; + }; + case CWM_SET_PARAMS:{ + //if( !setParameters( &m_sLGS_MASTER_PARAMETERS ) ){ + // setWM( CWM_INIT ); + // LOG_ERROR("Error Sending CMD_SET_PARAMETERS!"); + //} else { + // setWM( CWM_WAIT_ACK_PARAMS ); + //}; + break; + }; + case CWM_GET_STATUS:{ + if( !getState2() ){ + setWM( CWM_INIT ); + LOG_ERROR("Error Sending CMD_GET_STATUS2!"); + } else { + setWM( CWM_WAIT_STATUS ); + }; + break; + }; + case CWM_GET_EVENTS:{ + if( !getEvents() ){ + setWM( CWM_INIT ); + LOG_ERROR("Error Sending CMD_GET_EVENTS!"); + } else { + LOG("GetEVENTS sent"); + setWM( CWM_WAIT_EVENTS ); + }; + break; + }; + case CWM_SET_MODE_DETECTOR:{ + if( !setMode( MODE_DETECTOR )){ + setWM( CWM_INIT ); + LOG_ERROR("Error Sending CMD_GET_EVENTS!"); + } else { + setWM( CWM_WAIT_MODE_ACK ); + }; + break; + }; + case CWM_IDLE: + default:{ + if( NODE_COMMAND * tCMD = fetchCommand() ) { + switch( tCMD->cmd ) { + case NODE_CMD_FULL_RESET:{ + setWM( CWM_ISSUE_FULL_RESET ); + break; + }; + case NODE_CMD_UPLOAD_FILE:{ + //m_nUploadID = atoi( (CSTR) tCMD->parameter ); + //m_sCurrentFile, m_pDBC->get + break; + }; + case NODE_CMD_GET_DEVICE_DRAW:{ + m_nFullBorderDataIndex = 0; + if( tCMD->parameter != NULL ) { + m_nFullBorderKernelIndex = *((uint8_t *)tCMD->parameter); + } else m_nFullBorderKernelIndex = m_sDATA.draw_lrf_id; + setWM( CWM_GET_BORDER ); + break; + }; + case NODE_CMD_UPLOAD_SHADOW:{ + setWM( CWM_SET_MASK ); + break; + }; + }; + if( tCMD->parameter ) free( tCMD->parameter ); + free( tCMD ); + break; + }; + //Time Driven Logic + if( nTimeOut ){ + nTimeOut--; + } else { + nTimeOut = 20; + setWM( CWM_GET_STATUS ); + }; + break; + }; + }; + SLEEP( 50 ); + }; + if( tPort != NULL ){ + delete( tPort ); + }; +}; + +thresholdNode *argus3DLIDAR::grabDataAccess( void ){ + if( m_mDataMutex.try_lock() ){ + if(( m_pThresholdData != NULL ) && ( m_nFullBorderDataIndex == TH_SIZE_NODES )){ + return m_pThresholdData; + }; + m_mDataMutex.unlock(); + }; + return NULL; +}; + +void argus3DLIDAR::cleanDataTH( void ){ + m_mDataMutex.lock(); + if( m_pThresholdData != NULL ){ + free( m_pThresholdData ); + m_pThresholdData = NULL; + m_nFullBorderDataIndex = 0; + }; + m_mDataMutex.unlock(); +}; + +void argus3DLIDAR::releaseDataAccess( void ){ + m_mDataMutex.unlock(); +}; + +TARGET_DATA *argus3DLIDAR::prepareTargetData(CLIENT_EVENT* CE) { + TARGET_DATA* tVal = NULL; + if (CE != NULL) { +#ifdef DEBUG_EXTRA + char tB[256]; + sprintf( tB, "TRAW Type[%d] K[%d] R[%d] TH[%d] AA[%d] W[%d]", + CE->type, + CE->k_id, + CE->range, + CE->th_id, + TH_SIZE_NODES, + CE->w_cnt + ); + LOG( tB ); +#endif + tVal = (TARGET_DATA*)malloc(sizeof(TARGET_DATA)); + if (tVal != NULL) { + systemAnchor* tSystem = systemAnchor::getInstance(); + uint16_t cX, cY; + memset(tVal, 0, sizeof(TARGET_DATA)); + tVal->source_position.lat = m_oPosition.getLat(); + tVal->source_position.lon = m_oPosition.getLon(); + tVal->source_position.alt = m_oPosition.getAlt(); + makeXY(CE->th_id, cX, cY, (CE->k_id < 8)); + + tVal->local_target.r = m_sDATA.max_range / 4095.0f * (float)CE->range; + tVal->local_target.fi = 360.0f - (360.0f / (float)TH_LINE_NODES) * (float)cX; + tVal->local_target.tetta = /* 90.0f - */ ((float)Q_DEGREE_FOV / (float)Q_SCAN_COUNT) * (float)( cY + Q_SHIFT_DOWN_FOV ); + if( tVal->local_target.tetta > 90.0f ) { + tVal->local_target.tetta = 180.0f - tVal->local_target.tetta; + tVal->local_target.fi = tVal->local_target.fi + 180.0f; + if( tVal->local_target.fi > 360.0f ) tVal->local_target.fi = tVal->local_target.fi - 360.0f; + }; + tVal->digital = CE->range; + tVal->lrf_id = CE->k_id; + //CE->w_cnt * CE->range + tVal->area = CE->w_cnt * tVal->local_target.r; + // local - C3D_SPH_RADIANS/C3D_SPH_DEGREES + // system - C3D_DECART + // global - C3D_WGS84_LOC + tSystem->convertToSystem( &m_oPosition, tVal->local_target, tVal->system_target ); + tSystem->convertToGlobal( &m_oPosition, tVal->local_target, tVal->global_target ); + }; + }; + return tVal; +}; + +#define SIZE_IDX_A 1 +#define SIZE_IDX_B 2 +#define DEV_ID_IDX 3 +#define CMD_IDX 4 +#define SUB_CMD_IDX 5 +#define DATA_BEGIN_IDX 6 + +bool argus3DLIDAR::packetHandler( protocolPackage* Package ) { + uint8_t * pReceivedPackage = NULL; + size_t nReceivedPackageSize = 0; + bool bPackageIsArived = false; + EVENT_CONTAINER * tEVT; + CLIENT_EVENT * tData; + if( Package == NULL ) return true; + if( Package->m_pData == NULL ) return true; + + pReceivedPackage = Package->m_pData; + nReceivedPackageSize = Package->m_nSize; -#define LOG( X ) m_pLog->Log( (m_bIsMaster?"objectLGS[M]":"objectLGS[S]"), this, X ) -#define LOG_ERROR( X ) m_pLog->Log( (m_bIsMaster?"objectLGS[M]":"objectLGS[S]"), this, _LOG_ERROR, X ) + uint8_t CUR_CMD; + uint16_t PKG_LEN; + uint8_t index; + uint8_t SUB_LEN; + uint8_t SUB_CMD; + uint16_t Range; + uint32_t Angle; + uint32_t Width; + bool State; + uint8_t Status; + uint8_t Code; + PKG_LEN = ((pReceivedPackage[SIZE_IDX_A] & 0x7F) << 8) | pReceivedPackage[SIZE_IDX_B]; + CUR_CMD = pReceivedPackage[CMD_IDX]; + SUB_CMD = pReceivedPackage[SUB_CMD_IDX]; +#ifdef DEBUG + char tZ[128]; + sprintf(tZ,"CMD: 0x%02X SUB: 0x%02X WM:0x%02X", CUR_CMD, SUB_CMD, getWM() ); + LOG( tZ ); +#endif + m_nBusyCounter = 0; + switch( CUR_CMD ){ + case CMD_STATE:{ +#ifdef DEBUG + LOG("CMD_STATE"); +#endif + if( SUB_CMD > WM_INIT ){ + SOFTWARE_INFO tINFO; + uint8_t* ptr; + ptr = (uint8_t*)&tINFO; + + for (uint8_t i = 0; i < sizeof( SOFTWARE_INFO ); i++) ptr[i] = pReceivedPackage[DATA_BEGIN_IDX + i]; +#ifdef DEBUG + LOG("SOFT INFO FILLED!"); +#endif + char tB[65]; + sprintf(tB, "%08X", tINFO.SW_MODE_FLAGS ); + m_pDBC->updateLRFSerial(m_sNodeData.aux_id, tB ); + sprintf(tB, "%08X", tINFO.SW_BUILD_DATE ); + m_pDBC->updateLRFVerison( m_sNodeData.aux_id, tB ); + sprintf(tB, "%08X%08X%08X%08X", tINFO.FW_CORE1_TYP, tINFO.FW_CORE2_TYP, tINFO.FW_CORE3_TYP, tINFO.FW_CORE4_TYP); + m_pDBC->setLRFAltSerial( m_sNodeData.aux_id, tB ); + sprintf(tB, "%08X%08X%08X%08X", tINFO.FW_CORE1_VER, tINFO.FW_CORE2_VER, tINFO.FW_CORE3_VER, tINFO.FW_CORE4_VER ); + m_pDBC->setLRFAltVerison( m_sNodeData.aux_id, tB ); + }; + //setWM( CWM_INITIAL_GET_PARAM ); + setWM( CWM_INITIAL_GET_TWINC ); + break; + }; + case CMD_QUIT: + break; + case CMD_RESET: +#ifdef DEBUG + LOG("Reset ACK"); +#endif + break; + case CMD_FULL_BORDER: + case CMD_BORDER: +#ifdef DEBUG_EXTRA + LOG("CMD_BORDER"); +#endif + if (SUB_CMD == BD_ERRORMODE) { + LOG_ERROR("BOARD DATA ERROR!"); + m_nFullBorderDataIndex = 0; + setWM( CWM_IDLE ); + } else if (SUB_CMD == BD_NOTREADY) { + LOG_ERROR("BOARD DATA NOT READY!"); + m_nFullBorderDataIndex = 0; + setWM( CWM_IDLE ); + } else { + uint32_t index = 6; + while (index < (nReceivedPackageSize - 7) && m_nFullBorderDataIndex < TH_SIZE_NODES) { + m_pThresholdData[m_nFullBorderDataIndex].data = pReceivedPackage[index++]; + m_pThresholdData[m_nFullBorderDataIndex].data = (m_pThresholdData[m_nFullBorderDataIndex].data << 8) | pReceivedPackage[index++]; + m_pThresholdData[m_nFullBorderDataIndex].data = (m_pThresholdData[m_nFullBorderDataIndex].data << 8) | pReceivedPackage[index++]; + m_pThresholdData[m_nFullBorderDataIndex].data = (m_pThresholdData[m_nFullBorderDataIndex].data << 8) | pReceivedPackage[index++]; + m_nFullBorderDataIndex++; + }; + if (m_nFullBorderDataIndex < TH_SIZE_NODES) { + setWM( CWM_GET_BORDER ); + } else { +#ifdef DEBUG + LOG("FINISH GET BOARD DATA"); +#endif + if( m_pThresholdData!= NULL ){ + if( m_nFullBorderDataIndex > 0 ){ + CSTR tID = getUniqID_MD5(); + if( tID!= NULL ) { + if( saveTHPicture( m_pThresholdData, tID, ((m_nFullBorderKernelIndex < 16 )?true:false), true ) ){ + m_pDBC->addDraw( m_sNodeData.node_id, TH_SIZE_NODES, tID, m_nFullBorderKernelIndex, 1, true ); + } else { + char cPATH[256]; + FILE *fd; + sprintf( cPATH, "data/device_draws/%s.raw", tID ); + fd = fopen( cPATH, "wb"); + if( fd != NULL ) { + fwrite( &m_nFullBorderDataIndex, sizeof(uint32_t), 1, fd ); + fwrite( m_pThresholdData, sizeof( thresholdNode ), m_nFullBorderDataIndex, fd ); + fclose( fd ); + m_pDBC->addDraw( m_sNodeData.node_id, TH_SIZE_NODES, tID, m_nFullBorderKernelIndex, 1 ); + } else { + LOG_ERROR("Cannot open DRAW file!"); + }; + }; + free( tID ); + }; + }; + }; +#ifdef DEBUG + LOG("FINISH SAVE BOARD DATA"); +#endif + m_nFullBorderDataIndex = 0; + setWM( CWM_SET_MODE_DETECTOR ); + }; + }; + break; + case CMD_GETFILE: + break; + case CMD_RESTART: + break; + case CMD_GET_PARAMETERS: + case CMD_PARAMETERS: + case CMD_SET_PARAMETERS: { + uint8_t cWM = getWM(); + if( cWM == CWM_WAIT_PARAMS || cWM == CWM_INITIAL_WAIT_PARAM ){ +#ifdef DEBUG + LOG("Finish Get Params"); +#endif + if( SUB_CMD == SUB_DATA_INTEGRITY_VALID ){ + PLGS_3D_PARAMETERS tParam = (PLGS_3D_PARAMETERS)(pReceivedPackage + 6); + //memcpy( &m_sLGS_MASTER_PARAMETERS, tParam, sizeof(LGS_3D_PARAMETERS) ); + if( cWM == CWM_INITIAL_WAIT_PARAM ) { + setWM( CWM_INITIAL_GET_MASKS_INFO ); + } else { + setWM( CWM_IDLE ); + }; + } else { + LOG_ERROR("Data Integrity Error(on Get Parameters)!"); + if( cWM == CWM_INITIAL_WAIT_PARAM ) { + setWM( CWM_INITIAL_GET_PARAM ); + } else { + setWM( CWM_GET_PARAMS ); + }; + }; + } else { + LOG_ERROR("Not Requested Parameters Package!"); + }; + break; + }; + case CMD_SET_HZ_INFO: { + uint8_t cWM = getWM(); + if( cWM == CWM_WAIT_MASK_INFO || cWM == CWM_INITIAL_WAIT_MASKS_INFO ) { +#ifdef DEBUG + LOG("Finish Get HZ INFO"); +#endif + m_nDevicePolyCount = pReceivedPackage[6]; + m_nCurrentMaskID = m_pDBC->getLRFMaskID( m_sNodeData.aux_id ); + if ( m_nCurrentMaskID == 0 ) { + m_nCurrentMaskID = m_pDBC->addLRFMask(m_sNodeData.aux_id); + } else { + // Clear Existed Masks + m_pShadow->clear(); + m_pDBC->cleanLRFMask( m_nCurrentMaskID ); + }; +#ifdef DEBUG + char tB[64]; + sprintf( tB, "Mask Info: %d vertexes: %d", m_nCurrentMaskID, m_nDevicePolyCount ); + LOG(tB); +#endif + if( m_nDevicePolyCount ){ + m_pDBC->setLRFMaskStatus( m_nCurrentMaskID, ( SUB_CMD > 0 ) ); + } else { + m_pDBC->setLRFMaskStatus( m_nCurrentMaskID, false ); + }; + if( m_nDevicePolyCount && m_nCurrentMaskID ){ + if( cWM == CWM_INITIAL_WAIT_MASKS_INFO ) { + setWM( CWM_INITIAL_GET_VERTEX_DATA ); + } else { + setWM( CWM_IDLE ); + }; + } else { + setWM( CWM_IDLE ); + }; + }; + break; + }; + case CMD_SET_HZ_POLY: { +#ifdef DEBUG + LOG("Finish Get HZ POLY"); +#endif + uint8_t r = pReceivedPackage[6]; + uint8_t g = pReceivedPackage[7]; + uint8_t b = pReceivedPackage[8]; + uint32_t tLID = m_pDBC->addLRFMaskPolygone( m_nCurrentMaskID, r, g, b ); + + + //simplePolygone* tPolygone; + //tPolygone = new simplePolygone(); + //if (tPolygone != NULL) { + if( tLID ) { + uint8_t pCount = pReceivedPackage[5]; + //tPolygone->count = pReceivedPackage[5]; + //tPolygone->color[0] = pReceivedPackage[6]; + //tPolygone->color[1] = pReceivedPackage[7]; + //tPolygone->color[2] = pReceivedPackage[8]; + +#if defined( __linux__ ) && !defined( __GUI__ ) + //tPolygone->points = (simplePoint*)malloc(sizeof(simplePoint) * tPolygone->count); +#else + //tPolygone->points = (QPoint*)malloc(sizeof(QPoint) * tPolygone->count); +#endif + //if (tPolygone->count && tPolygone->points != NULL) { + if( pCount ) { + char tB[64]; + sprintf( tB, "Have Poly[%d] of %d Points", tLID, pCount ); + LOG( tB ); + uint16_t x, y; + int index = 9; + for (int i = 0; i < pCount; i++) { + x = pReceivedPackage[index++]; + x = (x << 8) | pReceivedPackage[index++]; + y = pReceivedPackage[index++]; + y = (y << 8) | pReceivedPackage[index++]; + //tPolygone->points[i].setX(x); + //tPolygone->points[i].setY(y); + m_pDBC->addLRFMaskPolygonePoint( tLID, x, y ); + }; + //m_pShadow->addPoly(tPolygone); + // } else { + // free( tPolygone ); + }; + }; + m_nCurrentPolyID++; + if ( m_nCurrentPolyID < m_nDevicePolyCount ) { + setWM( CWM_INITIAL_GET_VERTEX_DATA ); + } else { + //setWM( CWM_IDLE ); + setWM( CWM_GET_BORDER ); + m_nFullBorderKernelIndex = m_sDATA.draw_lrf_id; + } + break; + }; + case CMD_SET_HZ_POLY_ACK: { + m_nCurrentPolyID = SUB_CMD; + if (m_nCurrentPolyID < m_pShadow->getPolyCount()) { + simplePolygone* tPoly; + tPoly = m_pShadow->getPoly(m_nCurrentPolyID); + if (tPoly != NULL) { + setShadowPoly(tPoly); + } else { + }; + } else { +#ifdef DEBUG + LOG("Send RayTraces"); +#endif + vectorZoneMask VZ; + if (m_pShadow->getZoneMask(VZ)) { + if (setShadowTrace(&VZ)) { + } else { + }; + } else { + }; + }; + break; + }; + case CMD_GET_SERIAL_NUMBER: + break; + case CMD_SET_ADDRESS: + break; + case CMD_GET_SOFTWARE_VERSION: + break; + case CMD_UNSUPPORTED: + break; + case CMD_SET_COMM_SPEED: + break; + case CMD_FULL_RESET: +#ifdef DEBUG + LOG("Full Reset ACK"); +#endif + break; + case CMD_CAMERA: + break; + case CMD_SET_SERIAL_NUMBER: + break; + case CMD_BOARDDATA: + break; + case CMD_GET_CAMERA_PARAMETERS: + break; + case CMD_SET_CAMERA_PARAMETERS: + break; + case CMD_RELAY: + break; + case CMD_GET_RELAY_PARAMETERS: + break; + case CMD_SET_RELAY_PARAMETERS: + break; + case CMD_FS_SUB_PACKET: + break; + case CMD_STATE_2:{ + //if( cWM != CWM_GET_STATUS ) { + // LOG("Wrong WM - No Status Requested!"); + //} else { + LRF_WORK_MODE tStatus = ( LRF_WORK_MODE ) SUB_CMD; + uint8_t evtCnt = pReceivedPackage[DATA_BEGIN_IDX]; + + if ( tStatus > WM_NONE ) { + if ( PKG_LEN > 10 ) { + ALG_RUN_STATUS *ptr = (ALG_RUN_STATUS *)&pReceivedPackage[DATA_BEGIN_IDX + 1]; + m_pDBC->update3DRuntimeStatus( m_sNodeData.aux_id, ptr ); + }; + if ( evtCnt ) { + char tB[64]; + sprintf( tB, "Have [%d] Events!", evtCnt ); + LOG(tB); + setWM( CWM_GET_EVENTS ); + } else { + LOG("No Events!"); + setWM( CWM_IDLE ); + }; + } else { + LOG("STATUS WM_NONE!"); + setWM( CWM_IDLE ); + }; + /* + if( m_sDeviceStatus.Status != tStatus ){ + LOG("Device Status Changed!"); + switch( tStatus ){ + case STG_STUDY: { + //EVENT_CONTAINER * tEVT; + tEVT = createBasicEvent( m_sNodeData.node_id, EVT_CLASS_SENSOR_3D, EVT_STUDY, NULL, "Device in STUDY mode"); + m_pEventHeap->broadcast(tEVT); + break; + }; + case STG_READY: { + //basicEvent* tEVT; + tEVT = createBasicEvent( m_sNodeData.node_id, EVT_CLASS_SENSOR_3D, EVT_READY, NULL, "Device in DETECTION mode"); + m_pEventHeap->broadcast(tEVT); + break; + }; + case STG_BUSY: { + //basicEvent* tEVT; + tEVT = createBasicEvent( m_sNodeData.node_id, EVT_CLASS_SENSOR_3D, EVT_ERROR, NULL, "Device in BUSY mode"); + m_pEventHeap->broadcast(tEVT); + break; + }; + }; + m_sDeviceStatus.Status = tStatus; + }; + */ + //}; + + + //setWM( CWM_IDLE ); + break; + }; + case CMD_EVT:{ + char tBuffer[256]; + uint8_t tCount = pReceivedPackage[SUB_CMD_IDX];//DATA_BEGIN_IDX]; + if( tCount > 0 ){ + CLIENT_EVENT *cEVT = (CLIENT_EVENT*)& pReceivedPackage[DATA_BEGIN_IDX];// + 1]; + for( uint8_t xindex = 0; xindex < tCount; xindex++ ) { + switch (cEVT[xindex].type) { + case EVT_TARGET_2D_WHITE: + case EVT_TARGET_2D_BLACK: + case EVT_TARGET_3D_WHITE: + case EVT_TARGET_3D_BLACK:{ + TARGET_DATA *tData; + tData = prepareTargetData(cEVT+xindex); + if(tData != NULL){ + EVENT_CONTAINER * bEVT = NULL; + sprintf(tBuffer, "%s[%d] %s target \tRange: %.2fm. \tAzimuth: %.2f \tElevation: %.2f \tTS: %d@%d W:%.2f", + ((tData->lrf_id < 8) ? "M" : "S"), + //bKernelID, + tData->lrf_id, + ((cEVT[xindex].type == EVT_TARGET_3D_WHITE) ? "White" : "Black"), + tData->local_target.r, + tData->local_target.fi, + tData->local_target.tetta, + cEVT[xindex].uts, + cEVT[xindex].ums, + tData->area + ); +#ifdef DEBUG + LOG( tBuffer ); +#endif + bEVT = createBasicEvent( m_sNodeData.node_id, EVT_CLASS_SENSOR_3D, (basicEventTypeID) cEVT[xindex].type, NULL, tBuffer, tData ); + if (bEVT != NULL) { + m_pEventHeap->broadcast(bEVT); + } else { + free(tData); + }; + } else { + LOG_ERROR("Error Preparing Target Data!"); + }; + break; + }; + default:{ + sprintf( tBuffer, "Event[%d] Type:[%d]", xindex, cEVT[xindex].type ); + break; + }; + }; + }; + //set new stage2 + m_nIdleTarget = m_nIdleTarget >> 1; + if( m_nIdleTarget < LGS_MIN_IDLE_DELAY ) m_nIdleTarget = LGS_MIN_IDLE_DELAY; + setWM( CWM_GET_EVENTS ); + } else { + LOG("No Events in Package???"); + m_nIdleTarget = m_nIdleTarget << 1; + if (m_nIdleTarget > LGS_MAX_IDLE_DELAY) m_nIdleTarget = LGS_MAX_IDLE_DELAY; + setWM( CWM_IDLE ); + }; + break; + }; + case CMD_GET_WIDTH_TABLE: + break; + case CMD_SET_WIDTH_TABLE: + break; + case CMD_GET_VOLTAGE: + break; + case CMD_GET_VOLTAGE_PARAMETERS: + break; + case CMD_SET_VOLTAGE_PARAMETERS: + break; + case CMD_GET_HZ_DATA: + break; + case CMD_SET_HZ_DATA: + break; + case CMD_GET_CALIBRATION_TABLE: + break; + case CMD_SET_CALIBRATION_TABLE: + break; + case CMD_GET_LRF_DISABLE: + break; + case CMD_SET_LRF_DISABLE: + break; + case CMD_GET_ZOOM_TABLE: + break; + case CMD_SET_ZOOM_TABLE: + break; + case CMD_GET_TILT_TABLE: + break; + case CMD_SET_TILT_TABLE: + break; + case CMD_GET_HZ_ENABLE: + break; + case CMD_SET_HZ_ENABLE: + break; + case CMD_FLIP_COMPLETE: { + tEVT = createBasicEvent( m_sNodeData.node_id, EVT_CLASS_SENSOR_3D, EVT_FLIP, NULL, "Flip Complete"); + m_pEventHeap->broadcast(tEVT); + break; + }; + case CMD_SCAN_COMPLETE: { + tEVT = createBasicEvent( m_sNodeData.node_id, EVT_CLASS_SENSOR_3D, EVT_SCAN, NULL, "Scan Complete"); + m_pEventHeap->broadcast(tEVT); + break; + }; + case CMD_TARGET: { + tEVT = createBasicEvent( m_sNodeData.node_id, EVT_CLASS_SENSOR_3D, EVT_TARGET_3D_WHITE, NULL, "Target"); + m_pEventHeap->broadcast(tEVT); + break; + }; + case CMD_TARGET_WW: { + + tEVT = createBasicEvent( m_sNodeData.node_id, EVT_CLASS_SENSOR_3D, EVT_TARGET_3D_WHITE, NULL, "Target with Width"); + m_pEventHeap->broadcast(tEVT); + break; + }; + case CMD_TARGET_MW: { + tData = (CLIENT_EVENT*)malloc(sizeof(CLIENT_EVENT)); + if (tData != NULL) { + /* + tData->mSampleID = (pReceivedPackage[5] << 24) + (pReceivedPackage[6] << 16) + (pReceivedPackage[7] << 8) + pReceivedPackage[8]; + tData->mInfo = pReceivedPackage[9]; + tData->mRange = (pReceivedPackage[12] << 8) + pReceivedPackage[11]; + tData->mWidth = (pReceivedPackage[12] << 24) + (pReceivedPackage[13] << 16) + (pReceivedPackage[14] << 8) + pReceivedPackage[15]; + //if( m_pMapWidget != NULL ) m_pMapWidget->addTarget(tData->mSampleID ); + //if( m_pRadarWidget != NULL ) m_pRadarWidget->addTarget(tData->mSampleID, tData->mRange, m_bIsMaster ); + tEVT = createBasicEvent( m_DbId, EVT_CLASS_SENSOR, EVT_TARGET_3D_WHITE, NULL, "White Intruder Detection", tData ); + m_pEventHeap->broadcast( tEVT ); + */ + }; + break; + }; + case CMD_TARGET_MB: { + tData = (CLIENT_EVENT*)malloc(sizeof(CLIENT_EVENT)); + if (tData != NULL) { + /* + tData->mSampleID = (pReceivedPackage[5] << 24) + (pReceivedPackage[6] << 16) + (pReceivedPackage[7] << 8) + pReceivedPackage[8]; + tData->mInfo = pReceivedPackage[9]; + tData->mRange = (pReceivedPackage[12] << 8) + pReceivedPackage[11]; + tData->mWidth = (pReceivedPackage[12] << 24) + (pReceivedPackage[13] << 16) + (pReceivedPackage[14] << 8) + pReceivedPackage[15]; + //if( m_pMapWidget != NULL ) m_pMapWidget->addTarget(tData->mSampleID, m_bIsMaster ); + //if( m_pRadarWidget != NULL ) m_pRadarWidget->addTarget(tData->mSampleID, tData->mRange, m_bIsMaster ); + tEVT = createBasicEvent( m_DbId, EVT_CLASS_SENSOR, EVT_TARGET_3D_BLACK, NULL, "Target Black", tData ); + m_pEventHeap->broadcast( tEVT ); + */ + }; + break; + }; + case CMD_TARGET_ZZ: { + uint8_t cWM = getWM(); + if( cWM == CWM_IDLE ){ + tData = (CLIENT_EVENT*)malloc(sizeof(CLIENT_EVENT)); + if (tData != NULL) { + /* + char tBuffer[256]; + float fRange, fAzimuth, fElevation; + int sX, sY, eX, eY, cX, cY; + for( int index = 0; index < sizeof(CLIENT_EVENT); index++ ){ + ((uint8_t*)tData)[index] = pReceivedPackage[5+index]; + }; + + fRange = 300.0 / 4095.0 * tData->mRange; + makeCds( tData->mStartID, sX, sY, ( tData->mInfo & 0xFF000000 ) > 0 ); + makeCds( tData->mEndID, eX, eY, ( tData->mInfo & 0xFF000000 ) > 0 ); + cX = ((sX+eX)>>1); + cY = ((sY+eY)>>1); + fAzimuth = (360.0 / TH_LINE_NODES )*cX; + fElevation = 90.0 - (90.0/Q_SCAN_COUNT )*cY; + //if( m_pMapWidget != NULL ) m_pMapWidget->addTarget( makeIds( cX, cY ), m_bIsMaster ); + //if( m_pRadarWidget != NULL ) m_pRadarWidget->addTarget( makeIds( cX, cY ), tData->mRange, m_bIsMaster ); + if( ( tData->mInfo & 0x00FF0000 ) > 0 ){ + sprintf( tBuffer, "[%s]:%.2fm. Azimuth: %.2f Elevation: %.2f", + (m_bIsMaster?"M":"S"), + fRange, + fAzimuth, + fElevation + ); + tEVT = createBasicEvent( m_DbId, EVT_CLASS_SENSOR, EVT_TARGET_3D_WHITE, NULL, tBuffer, tData ); + } else { + sprintf( tBuffer, "[%s]:%.2fm. Azimuth: %.2f Elevation: %.2f", + (m_bIsMaster?"M":"S"), + fRange, + fAzimuth, + fElevation + ); + tEVT = createBasicEvent( m_DbId, EVT_CLASS_SENSOR, EVT_TARGET_3D_BLACK, NULL, tBuffer, tData ); + }; + m_pEventHeap->broadcast( tEVT ); + */ + }; + }; + break; + }; + case CMD_ACK_TWINK_LINK:{ + char tB[64]; + m_bSlaveConnectionStatus = SUB_CMD; + m_bTWINC =true; + sprintf( tB, "WINK SUPPORTED! [0x%02X]", SUB_CMD ); + LOG( tB ); + setWM( CWM_INITIAL_GET_PARAM ); + break; + }; + case CMD_ACK:{ + setWM( CWM_IDLE ); + break; + }; + case CMD_NACK:{ + if( SUB_CMD == CMD_QUERY_TWINK_LINK ) { + m_bTWINC =true; + LOG("TWINK SUPPORTED BUT TROUBLE!"); + setWM( CWM_INITIAL_GET_PARAM ); + }; + break; + }; + case CMD_IDONK:{ + char tB[64]; + sprintf( tB, "Not Recognized Command [0x%02X]", SUB_CMD ); + LOG( tB ); + break; + }; + case CMD_NONE: + default:{ + break; + }; + }; // CMD SWITCH + return true; +}; + +#undef SIZE_IDX +#undef DEV_ID_IDX +#undef CMD_IDX +#undef SUB_CMD_IDX +#undef DATA_BEGIN_IDX + +bool argus3DLIDAR::startGetScanData( uint8_t kID, uint32_t *th_zone ){ + //if( getOperation() == CMD_FULL_BORDER ) return true; + m_mDataMutex.lock(); + if( th_zone == NULL ){ + if( m_pThresholdData != NULL ) free(m_pThresholdData); + m_pThresholdData = (thresholdNode *) malloc( sizeof(thresholdNode) * TH_SIZE_NODES ); + } else { + m_pThresholdData = (thresholdNode *) th_zone; + }; + m_nFullBorderDataIndex = 0; + m_nFullBorderKernelIndex = kID; + m_mDataMutex.unlock(); + if( m_pThresholdData!= NULL ){ + LOG("TH Assigned - OK"); + return setOperation( CMD_FULL_BORDER ); + } else { + LOG_ERROR("TH Assigned - NOK (mem issue)"); + }; + return false; +}; + +bool argus3DLIDAR::startGetParameters( uint32_t timeout ){ + //if (CMD_GET_PARAMETERS == getOperation()) return true; + return setOperation( CMD_GET_PARAMETERS ); +}; + +bool argus3DLIDAR::startDeviceReset( bool FullReset ){ + if( FullReset ){ + //if (CMD_FULL_RESET == getOperation()) return true; + return setOperation( CMD_FULL_RESET ); + }; + //if (CMD_RESET == getOperation()) return true; + return setOperation( CMD_RESET ); +}; + +bool argus3DLIDAR::startUploadMask(void){ + simplePolygone *tPoly; + m_nCurrentPolyID = 0; +#ifndef __linux__ + m_pShadow->rasterizeVertexes(); +#endif + if (setOperation(CMD_SET_HZ_POLY, true)){ + return true; + }; + return false; +}; + +bool argus3DLIDAR::startStopMotors( void ){ + if (setOperation(CMD_DHWM_STOP_MOTORS, true)){ + return true; + }; + return false; +}; + +bool argus3DLIDAR::startStartMotors( void ){ + if (setOperation(CMD_DHWM_START_MOTORS, true)){ + return true; + }; + return false; +}; + +bool argus3DLIDAR::startMasksStatus(bool Active){ + if ( m_pShadow!=NULL ){ + m_pShadow->setActive(Active); + if (setOperation(CMD_SET_HZ_STATUS, true)){ + return true; + }; + }; + return false; +}; + +bool argus3DLIDAR::setOperation( E_LGS_CMD opCode, bool fNOW ){ + m_mStatusMutex.lock(); +/* + if( m_sDeviceStatus.CurrentOperation == CMD_NONE ){ + m_sDeviceStatus.CurrentOperation = opCode; + } else if( fNOW ){ + m_mStatusMutex.unlock(); + return false; + } else if( m_sDeviceStatus.PendingOperation == CMD_NONE ){ + m_sDeviceStatus.PendingOperation = opCode; + } else { + m_mStatusMutex.unlock(); + return false; + }; +*/ + m_mStatusMutex.unlock(); + return true; +}; + +#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 + +#define SKIP_LINE_PIXELS 28 +#define HEIGHT 512 +#define WIDTH 1024 +// scale factor -> 4/9 + + + +bool argus3DLIDAR::saveTHPicture( thresholdNode *ptr, CSTR uid, bool master, bool byMinimum, bool monochrome ){ + uint8_t *tMemory = NULL; + thresholdNode *cNode = NULL; + uint8_t *cPixel = NULL; + int cSpace; + + + int x, y; + tMemory = stbi_load( "data/assets/images/empty_3d.png", &x, &y, &cSpace, STBI_default ); + + if( tMemory == NULL ){ + LOG_ERROR("Draw Memory Alloc Eror!"); + return false; + }; + + if( x != 1024 || y != 512 ){ + LOG("Wrong IMG Size!"); + free( tMemory ); + return NULL; + }; + + int pix = 0; + int mem = 0; + bool s_bit = false; + bool no_data = false; + float tVal; + + for ( int idx = 0; idx < ( TH_SIZE_NODES << 2 ); idx++ ) { // tik-tak + + if( ( idx % 4 ) == 0 ){ + mem++; + if ( master ) { + cNode = ptr + TH_SIZE_NODES - mem - 1; + } else { + cNode = ptr + mem - 1; + }; + if( !s_bit ) s_bit = cNode->values.sbit; + if( !no_data ) no_data = ( cNode->values.cnt == 0 ); + if( !s_bit && !no_data ){ + if( byMinimum ) { + tVal = ((float)cNode->values.min) / 4096.f; + } else { + tVal = ((float)cNode->values.max) / 4096.f; + }; + }; + }; + + if( ( idx % 9 ) == 0 ){ + if( mem > ( SKIP_LINE_PIXELS * TH_LINE_NODES ) ) { + cPixel = tMemory + (pix << 2); + pix++; + if( s_bit ) { // Set Red + cPixel[0] = 0x00; cPixel[1] = 0xff; cPixel[2] = 0x00; cPixel[3] = 0xff; + } else { + if( no_data ) { // Set Blue + cPixel[0] = 0x00; cPixel[1] = 0x00; cPixel[2] = 0xff; cPixel[3] = 0xff; + } else { + uint32_t tColor; + tColor = interpolate( 0x000000ff, 0xffffffff, tVal ); + cPixel[0] = ( tColor >> 24 ) & 0xFF; + cPixel[1] = ( tColor >> 16 ) & 0xFF; + cPixel[2] = ( tColor >> 8 ) & 0xFF; + cPixel[3] = tColor & 0xFF; + }; + }; + s_bit = false; + no_data = false; + } + }; + }; + + char filename[256]; + sprintf( filename, "data/device_draws/%s_100.png", uid ); + int RetVal = stbi_write_png( filename, 1024, 512, cSpace, tMemory, 1024 * cSpace ); + free( tMemory ); + if( RetVal == 0 ) return false; + + if( monochrome ) { + cSpace = 1; + } else { + cSpace = 4; + }; + + tMemory = (uint8_t *) malloc( TH_SIZE_NODES * cSpace ); + if( tMemory == NULL ){ + LOG_ERROR("Map Memory Alloc Eror!"); + return false; + }; + + for (int j = 0; j < Q_SCAN_COUNT; j++) { + for ( int i = 0; i < TH_LINE_NODES; i++ ) { + //cNode = ptr+(j*i); + //cNode = &ptr[ ( TH_LINE_NODES * j ) + i ]; + int ids = 0; + int idd = 0; + if ( master ) { + //cNode = ptr+makeIds( i, j , true ); + //cPixel = tMemory+( cSpace * makeIds( i, j , false )); + ids = makeIds( i, j , true ); + idd = cSpace * makeIds( i, j , false ); + //cNode = ptr + ( i * j ); + //cPixel = tMemory + ( cSpace * i * j ); + } else { + //cNode = ptr+makeIds( i, j , false ); + //cPixel = tMemory+( cSpace * makeIds( i, j , false )); + ids = makeIds( i, j , false ); + idd = cSpace * makeIds( i, j , false ); + }; + + cNode = ptr + ids ; + cPixel = tMemory + idd; + + if( monochrome ) { +#ifdef CHECK_SUN_BIT + if( cNode->values.sbit ) { + cPixel[0] = 0; + } else { + cPixel[0] = (uint8_t)((((float) cNode->values.min ) * 255.f ) / 4096.f ); + }; +#else + cPixel[0] = (uint8_t)((((float) cNode->values.min ) * 255.f ) / 4096.f ); +#endif + } else { +#ifdef CHECK_SUN_BIT + if( cNode->values.sbit ) { + // Set Red + cPixel[0] = 0x00; + cPixel[1] = 0xff; + cPixel[2] = 0x00; + cPixel[3] = 0xff; + } else { + if( cNode->values.cnt == 0 ) { + // Set Blue + cPixel[0] = 0x00; + cPixel[1] = 0x00; + cPixel[2] = 0xff; + cPixel[3] = 0xff; + } else { + uint32_t tColor; + float tVal = ((float) cNode->values.min ) / 4096.f; + tColor = interpolate( 0x000000ff, 0xffffffff, tVal ); + cPixel[0] = ( tColor >> 24 ) & 0xFF; + cPixel[1] = ( tColor >> 16 ) & 0xFF; + cPixel[2] = ( tColor >> 8 ) & 0xFF; + cPixel[3] = tColor & 0xFF; + }; + }; +#else + if( cNode->values.cnt == 0 ) { + // Set Blue + cPixel[0] = 0x00; + cPixel[1] = 0x00; + cPixel[2] = 0xff; + cPixel[3] = 0xff; + } else { + uint32_t tColor; + float tVal = ((float) cNode->values.min ) / 4096.f; + tColor = interpolate( 0x000000ff, 0xffffffff, tVal ); + cPixel[0] = ( tColor >> 24 ) & 0xFF; + cPixel[1] = ( tColor >> 16 ) & 0xFF; + cPixel[2] = ( tColor >> 8 ) & 0xFF; + cPixel[3] = tColor & 0xFF; + }; +#endif + }; + }; + }; + + sprintf( filename, "data/device_draws/%s_map.png", uid ); + RetVal = stbi_write_png( filename, TH_LINE_NODES, Q_SCAN_COUNT, cSpace, tMemory, TH_LINE_NODES * cSpace ); + free( tMemory ); + if( RetVal == 0 ) return false; + return true; +}; #undef LOG #undef LOG_ERROR + + diff --git a/lib/rgoose/rgooseNode3D.h b/lib/rgoose/rgooseNode3D.h index f00fbf15..db7d5e3a 100644 --- a/lib/rgoose/rgooseNode3D.h +++ b/lib/rgoose/rgooseNode3D.h @@ -1,30 +1,108 @@ #ifndef __OBJECT_NET_NODE_3D_HEADERS__ #define __OBJECT_NET_NODE_3D_HEADERS__ -#ifndef __linux__ - #include -#endif -#include "../hardware/sensors/lrf/lrf_3d.h" -#include "rgooseNode.h" +#include "../components/base/basicEngine.h" +#include "../components/base/basicDualThread.h" +#include "../components/base/basicLogCollection.h" +#include "../components/base/basicEventHeap.h" +#include "../components/base/basicPosition.h" +#include "../components/object/objectSystemAnchor.h" +#include "../components/base/basicSettingsProvider.h" +#include "../alg/lgs/mask.h" + +#include "../data/net/clientPort.h" +#include "../data/protocol/protocolLGS3D_client.h" +#include "../hardware/soc/general/3DLRF.h" -#include +//#include "../hardware/sensors/lrf/lrf_3d.h" + +#include "rgooseNode.h" +#define LGS_TIMEOUT_COUNT 100 +#define LGS_MAX_IDLE_DELAY 40 // x10 msec +#define LGS_MIN_IDLE_DELAY 1 // x10 msec -class argus3DLIDAR: public argusNetNode{ +#define USE_MUTEX true +#define DONT_USE_MUTEX false + +class argus3DLIDAR: public argusNetNode, public basicThread, public protocolLGS3D_Client{ private: basicLogCollection * m_pLog; - sensorLGS3D * m_pMasterNode; - sensorLGS3D * m_pSlaveNode; basicEventHeap * m_pEventHeap; + DBC_LRF_DATA m_sDATA; + + //LGS_3D_PARAMETERS m_sLGS_MASTER_PARAMETERS; + //LGS_3D_PARAMETERS m_sLGS_SLAVE_PARAMETERS; + + //DEVICE_STATUS m_sDeviceStatus; + //SOFTWARE_INFO m_sDeviceSoftNFO; + + //char m_pHost[255]; + //uint16_t m_nPort; + bool m_bTWINC; + uint8_t m_bSlaveConnectionStatus; + int m_nBusyCounter; + int m_nIdleCounter; + int m_nIdleTarget; + + basicMutex m_mPackageMutex; + basicMutex m_mStatusMutex; + basicMutex m_mDataMutex; + + basicPosition m_oPosition; + thresholdNode * m_pThresholdData; + + uint32_t m_nFullBorderDataIndex; + uint8_t m_nFullBorderKernelIndex; + + uint8_t m_nDevicePolyCount; + uint32_t m_nCurrentPolyID; + uint32_t m_nCurrentMaskID; + ShadowMask * m_pShadow; + + bool setOperation( E_LGS_CMD opCode, bool fNOW = false ); + bool forceOperation( E_LGS_CMD opCode ); + void setCompelition( uint8_t Perc ); + E_LGS_CMD getOperation( void ); + void promoteOperation( void ); + void completeOperation( bool success = true ); + void cleanOperation( void ); + void comSetIdle( bool useMutex = true ); + void comSetBusy( bool useMutex = true ); + bool comIsIdle( void ); + void cleanDataTH( void ); + bool saveTHPicture( thresholdNode *ptr, CSTR uid, bool master = true, bool byMinimum = false, bool monochrome = false ); + protected: + virtual void m_fThreadProc( void ); + virtual bool packetHandler( protocolPackage* Package ); public: + TARGET_DATA * prepareTargetData(CLIENT_EVENT* CE); explicit argus3DLIDAR( uint32_t dbID ); virtual ~argus3DLIDAR(); virtual bool startService(); virtual bool stopService(); virtual bool validate(); virtual void simulateTarget( void ); + + bool startGetScanData( uint8_t kID = 0, uint32_t *th_zone = NULL ); + bool startGetParameters( uint32_t timeout=0 ); + bool startUploadMask(void); + bool startDeviceReset( bool FullReset = true ); + bool startStopMotors( void ); + bool startStartMotors( void ); + bool startMasksStatus(bool Active); + + basicPosition * getPosition(void){ return &m_oPosition; }; + void updateSettings(void); + + // New Order + thresholdNode * grabDataAccess( void ); + void releaseDataAccess( void ); + + bool lastTaskComplete( void ); + void cleanLastTaskStatus( void ); }; #endif diff --git a/lib/rgoose/rgooseTypes.h b/lib/rgoose/rgooseTypes.h index 174fcd30..61dfb355 100644 --- a/lib/rgoose/rgooseTypes.h +++ b/lib/rgoose/rgooseTypes.h @@ -411,10 +411,11 @@ typedef struct S_DBC_LRF_DATA{ uint8_t auto_draw; uint16_t slave_port; uint16_t enabled_lrf; + float max_range; uint32_t base_shift; uint32_t mirror_shift; - float max_range; uint8_t detection_profile_id; + uint8_t draw_lrf_id; uint32_t width_table_id; uint32_t zoom_table_id; uint8_t embd_cam; @@ -437,13 +438,25 @@ typedef struct S_DBC_UART_DATA{ uint8_t flow_ctrl; }DBC_UART_DATA; -typedef struct S_DBC_EVT_DATA{ +typedef struct S_EVT_DATA{ + uint32_t id; + uint32_t node_id; + char uuid[65]; + uint32_t ts_s; + uint32_t ts_ms; + uint8_t type; + uint32_t ref_id; + char ref_uuid[65]; +}EVT_DATA; + +typedef struct S_DBC_EVT_RECORD{ uint32_t id; uint32_t node_id; char uuid[65]; uint32_t ts_s; uint32_t ts_ms; uint8_t type; + uint8_t lrf_id; uint32_t range_digital; float az; float el; @@ -454,7 +467,7 @@ typedef struct S_DBC_EVT_DATA{ float alt; uint32_t ref_id; char ref_uuid[65]; -}DBC_EVT_DATA; +}DBC_EVT_RECORD; typedef struct S_DBC_SITE_DATA{ uint32_t account_id; @@ -526,9 +539,42 @@ typedef struct S_DBC_MODEM_DATA{ char registration[65]; }DBC_MODEM_DATA; +typedef struct S_DBC_3DLRF_WSTAT{ + +}DBC_3DLRF_WSTAT; + +typedef struct S_DBC_MASKING_POINT{ + +}DBC_MASKING_POINT; + +typedef struct S_DBC_MASKING_RAY{ + +}DBC_MASKING_RAY; + +typedef struct S_DBC_MASKING_VERTEX{ + uint32_t mask_id; + uint8_t color[3]; + uint32_t vertex_id; + uint16_t points_cnt; + DBC_MASKING_POINT * points; +}DBC_MASKING_VERTEX; + +typedef struct S_DBC_ZONE_MASK{ + uint32_t id; + uint8_t status; + uint16_t vertexes_cnt; + DBC_MASKING_VERTEX * vertexes; + uint16_t rays_cnt; + DBC_MASKING_RAY rays; +}DBC_ZONE_MASK; + +typedef struct S_DBC_3DWINC_SETTINGS{ + +}DBC_3DWINC_SETTINGS; + typedef std::vector DBC_INT_LIST; typedef std::vector vectorCamRecords; -typedef std::vector vectorEventRecords; +typedef std::vector vectorEventRecords; #define ARGUS_NM_DISMISS_LEVEL_VIEWER 1 #define ARGUS_NM_DISMISS_LEVEL_OPERATOR 2