diff --git a/Projects/la_mojo/la_mojo.vpj b/Projects/la_mojo/la_mojo.vpj
index b3739e28..9598f69a 100644
--- a/Projects/la_mojo/la_mojo.vpj
+++ b/Projects/la_mojo/la_mojo.vpj
@@ -636,6 +636,7 @@
+
diff --git a/Projects/la_mojo/makefile b/Projects/la_mojo/makefile
index 14e01f8b..496bd8a2 100644
--- a/Projects/la_mojo/makefile
+++ b/Projects/la_mojo/makefile
@@ -830,17 +830,17 @@ $(OUTDIR)/clientPort.o: ../../lib/data/net/clientPort.cpp ../../lib/data/net/cli
$(OUTDIR)/cmdNodeConveyor.o: ../../lib/App/common/cmdNodeConveyor.cpp ../../lib/App/common/cmdNodeConveyor.h
$(OUTDIR)/curlRequest.o: ../../lib/data/curl/curlRequest.cpp ../../lib/data/curl/curlRequest.h
$(OUTDIR)/curlRequestsManager.o: ../../lib/data/curl/curlRequestsManager.cpp ../../lib/data/curl/curlRequestsManager.h
-$(OUTDIR)/dataBinder.o: ../../lib/App/common/dataBinder.cpp ../../lib/App/common/dataBinder.h ../../lib/App/common/dataBinder_structures.h ../../lib/App/common/dataBinder_ReportAux.h
+$(OUTDIR)/dataBinder.o: ../../lib/App/common/dataBinder.cpp ../../lib/App/common/dataBinder.h ../../lib/App/common/dataBinder_structures.h ../../lib/App/common/dataBinder_ReportAux.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/Transform.h
$(OUTDIR)/dataBinder_ReportAux.o: ../../lib/App/common/dataBinder_ReportAux.cpp ../../lib/App/common/dataBinder_ReportAux.h
$(OUTDIR)/detector.o: ../../lib/alg/lgs/detector.cpp ../../lib/alg/lgs/detector.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicValidatable.h ../../lib/alg/lgs/detectorStructures.h ../../lib/components/base/basicTypes.h
$(OUTDIR)/deviceNode.o: ../../lib/App/common/deviceNode.cpp ../../lib/App/common/deviceNode.h ../../lib/App/common/MySQL_dataBinder.h ../../lib/App/common/SQLite_dataBinder.h
$(OUTDIR)/deviceNode2D.o: ../../lib/App/common/deviceNode2D.cpp ../../lib/App/common/deviceNode2D.h ../../lib/App/common/hardwareResourceSerialProvider.h ../../lib/App/common/kernelPrototype.h ../../lib/App/common/hardwareManager.h
$(OUTDIR)/deviceNode3D.o: ../../lib/App/common/deviceNode3D.cpp ../../lib/App/common/deviceNode3D.h ../../lib/App/common/kernelPrototype.h
-$(OUTDIR)/deviceNodeCamera.o: ../../lib/App/common/deviceNodeCamera.cpp ../../lib/App/common/deviceNodeCamera.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_ONVIF.h ../../lib/data/protocol/protocolPTZ_PELCO.h ../../lib/App/common/hardwareManager.h ../../lib/App/common/hardwareResourceSerialProvider.h ../../lib/App/common/kernelModuleEmbedVideo.h ../../lib/App/mojo/mojoKernel.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicEventHeap.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/Transform.h ../../lib/alg/lgs/detectorStructures.h ../../lib/components/base/basicTypes.h ../../lib/alg/lgs/detector.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicValidatable.h ../../lib/alg/lgs/detectorStructures.h ../../lib/components/base/basicTypes.h ../../lib/alg/lgs/mask.h ../../lib/components/base/basicTypes.h ../../lib/hardware/soc/general/3DLRF.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/gui/gui.h ../../lib/alg/generic/md5.h ../../lib/App/common/kernelPrototype.h ../../lib/App/mojo/mojoRemoteClient.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/data/net/clientPort.h ../../lib/data/transport/transportSocket.h ../../lib/components/base/basicDualThread.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicTransport.h ../../lib/data/protocol/protocol.h ../../lib/data/protocol/protocolARGUS_DATA.h ../../lib/App/common/dataBinder.h ../../lib/App/common/dataBinder_structures.h ../../lib/App/common/dataBinder_ReportAux.h
+$(OUTDIR)/deviceNodeCamera.o: ../../lib/App/common/deviceNodeCamera.cpp ../../lib/App/common/deviceNodeCamera.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_ONVIF.h ../../lib/data/protocol/protocolPTZ_PELCO.h ../../lib/App/common/hardwareManager.h ../../lib/App/common/hardwareResourceSerialProvider.h ../../lib/App/common/kernelModuleEmbedVideo.h ../../lib/App/mojo/mojoKernel.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicEventHeap.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/Transform.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/Transform.h ../../lib/alg/lgs/detectorStructures.h ../../lib/components/base/basicTypes.h ../../lib/alg/lgs/detector.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicValidatable.h ../../lib/alg/lgs/detectorStructures.h ../../lib/components/base/basicTypes.h ../../lib/alg/lgs/mask.h ../../lib/components/base/basicTypes.h ../../lib/hardware/soc/general/3DLRF.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/gui/gui.h ../../lib/alg/generic/md5.h ../../lib/App/common/kernelPrototype.h ../../lib/App/mojo/mojoRemoteClient.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/data/net/clientPort.h ../../lib/data/transport/transportSocket.h ../../lib/components/base/basicDualThread.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicTransport.h ../../lib/data/protocol/protocol.h ../../lib/data/protocol/protocolARGUS_DATA.h ../../lib/App/common/dataBinder.h ../../lib/App/common/dataBinder_structures.h ../../lib/App/common/dataBinder_ReportAux.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/Transform.h
$(OUTDIR)/deviceNodeEthernet2Serial.o: ../../lib/App/common/deviceNodeEthernet2Serial.cpp ../../lib/App/common/deviceNodeEthernet2Serial.h ../../lib/App/common/hardwareManager.h ../../lib/data/protocol/protocol.h
$(OUTDIR)/deviceNodeFactory.o: ../../lib/App/common/deviceNodeFactory.cpp ../../lib/App/common/deviceNodeFactory.h ../../lib/App/common/MySQL_dataBinder.h ../../lib/App/common/SQLite_dataBinder.h ../../lib/App/common/deviceNode3D.h ../../lib/App/common/deviceNode2D.h ../../lib/App/common/deviceNodePTZCamControl.h ../../lib/App/common/deviceNodePresetCamControl.h ../../lib/App/common/deviceNodeStaticCamControl.h ../../lib/App/common/deviceNodeEthernet2Serial.h
-$(OUTDIR)/deviceNodePresetCamControl.o: ../../lib/App/common/deviceNodePresetCamControl.cpp ../../lib/App/common/deviceNodePresetCamControl.h ../../lib/App/mojo/mojoKernel.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicEventHeap.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/Transform.h ../../lib/alg/lgs/detectorStructures.h ../../lib/components/base/basicTypes.h ../../lib/alg/lgs/detector.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicValidatable.h ../../lib/alg/lgs/detectorStructures.h ../../lib/components/base/basicTypes.h ../../lib/alg/lgs/mask.h ../../lib/components/base/basicTypes.h ../../lib/hardware/soc/general/3DLRF.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/gui/gui.h ../../lib/alg/generic/md5.h ../../lib/App/common/kernelPrototype.h ../../lib/App/mojo/mojoRemoteClient.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/data/net/clientPort.h ../../lib/data/transport/transportSocket.h ../../lib/components/base/basicDualThread.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicTransport.h ../../lib/data/protocol/protocol.h ../../lib/data/protocol/protocolARGUS_DATA.h ../../lib/App/common/dataBinder.h ../../lib/App/common/dataBinder_structures.h ../../lib/App/common/dataBinder_ReportAux.h
-$(OUTDIR)/deviceNodePTZCamControl.o: ../../lib/App/common/deviceNodePTZCamControl.cpp ../../lib/App/common/deviceNodePTZCamControl.h ../../lib/App/mojo/mojoKernel.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicEventHeap.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/Transform.h ../../lib/alg/lgs/detectorStructures.h ../../lib/components/base/basicTypes.h ../../lib/alg/lgs/detector.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicValidatable.h ../../lib/alg/lgs/detectorStructures.h ../../lib/components/base/basicTypes.h ../../lib/alg/lgs/mask.h ../../lib/components/base/basicTypes.h ../../lib/hardware/soc/general/3DLRF.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/gui/gui.h ../../lib/alg/generic/md5.h ../../lib/App/common/kernelPrototype.h ../../lib/App/mojo/mojoRemoteClient.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/data/net/clientPort.h ../../lib/data/transport/transportSocket.h ../../lib/components/base/basicDualThread.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicTransport.h ../../lib/data/protocol/protocol.h ../../lib/data/protocol/protocolARGUS_DATA.h ../../lib/App/common/dataBinder.h ../../lib/App/common/dataBinder_structures.h ../../lib/App/common/dataBinder_ReportAux.h
+$(OUTDIR)/deviceNodePresetCamControl.o: ../../lib/App/common/deviceNodePresetCamControl.cpp ../../lib/App/common/deviceNodePresetCamControl.h ../../lib/App/mojo/mojoKernel.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicEventHeap.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/Transform.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/Transform.h ../../lib/alg/lgs/detectorStructures.h ../../lib/components/base/basicTypes.h ../../lib/alg/lgs/detector.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicValidatable.h ../../lib/alg/lgs/detectorStructures.h ../../lib/components/base/basicTypes.h ../../lib/alg/lgs/mask.h ../../lib/components/base/basicTypes.h ../../lib/hardware/soc/general/3DLRF.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/gui/gui.h ../../lib/alg/generic/md5.h ../../lib/App/common/kernelPrototype.h ../../lib/App/mojo/mojoRemoteClient.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/data/net/clientPort.h ../../lib/data/transport/transportSocket.h ../../lib/components/base/basicDualThread.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicTransport.h ../../lib/data/protocol/protocol.h ../../lib/data/protocol/protocolARGUS_DATA.h ../../lib/App/common/dataBinder.h ../../lib/App/common/dataBinder_structures.h ../../lib/App/common/dataBinder_ReportAux.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/Transform.h
+$(OUTDIR)/deviceNodePTZCamControl.o: ../../lib/App/common/deviceNodePTZCamControl.cpp ../../lib/App/common/deviceNodePTZCamControl.h ../../lib/App/mojo/mojoKernel.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicEventHeap.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/Transform.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/Transform.h ../../lib/alg/lgs/detectorStructures.h ../../lib/components/base/basicTypes.h ../../lib/alg/lgs/detector.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicValidatable.h ../../lib/alg/lgs/detectorStructures.h ../../lib/components/base/basicTypes.h ../../lib/alg/lgs/mask.h ../../lib/components/base/basicTypes.h ../../lib/hardware/soc/general/3DLRF.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/gui/gui.h ../../lib/alg/generic/md5.h ../../lib/App/common/kernelPrototype.h ../../lib/App/mojo/mojoRemoteClient.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/data/net/clientPort.h ../../lib/data/transport/transportSocket.h ../../lib/components/base/basicDualThread.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicTransport.h ../../lib/data/protocol/protocol.h ../../lib/data/protocol/protocolARGUS_DATA.h ../../lib/App/common/dataBinder.h ../../lib/App/common/dataBinder_structures.h ../../lib/App/common/dataBinder_ReportAux.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/Transform.h
$(OUTDIR)/deviceNodeSensor.o: ../../lib/App/common/deviceNodeSensor.cpp ../../lib/App/common/deviceNodeSensor.h ../../lib/components/object/objectSystemAnchor.h
$(OUTDIR)/deviceNodeStaticCamControl.o: ../../lib/App/common/deviceNodeStaticCamControl.cpp ../../lib/App/common/deviceNodeStaticCamControl.h
$(OUTDIR)/fs_helper.o: ../../lib/data/rfs/fs_helper.cpp ../../lib/data/rfs/fs_helper.h
@@ -858,7 +858,7 @@ $(OUTDIR)/json_value.o: ../../lib/data/json/json_value.cpp ../../lib/data/json/j
$(OUTDIR)/json_writer.o: ../../lib/data/json/json_writer.cpp ../../lib/data/json/json_tool.h
$(OUTDIR)/kernelEventFilter.o: ../../lib/App/common/kernelEventFilter.cpp ../../lib/App/common/kernelEventFilter.h ../../lib/App/common/MySQL_dataBinder.h ../../lib/App/common/SQLite_dataBinder.h
$(OUTDIR)/kernelEventFilterAPF.o: ../../lib/App/common/kernelEventFilterAPF.cpp ../../lib/App/common/kernelEventFilterAPF.h
-$(OUTDIR)/kernelEventFilterTrain.o: ../../lib/App/common/kernelEventFilterTrain.cpp ../../lib/App/common/kernelEventFilterTrain.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h
+$(OUTDIR)/kernelEventFilterTrain.o: ../../lib/App/common/kernelEventFilterTrain.cpp ../../lib/App/common/kernelEventFilterTrain.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/App/common/deviceNodeFactory.h
$(OUTDIR)/kernelModule.o: ../../lib/App/common/kernelModule.cpp ../../lib/App/common/kernelModule.h ../../lib/App/common/MySQL_dataBinder.h ../../lib/App/common/SQLite_dataBinder.h
$(OUTDIR)/kernelModuleEmbedVideo.o: ../../lib/App/common/kernelModuleEmbedVideo.cpp ../../lib/App/common/kernelModuleEmbedVideo.h
$(OUTDIR)/kernelModuleFactory.o: ../../lib/App/common/kernelModuleFactory.cpp ../../lib/App/common/kernelModuleFactory.h ../../lib/App/common/kernelModuleUSBRelay.h ../../lib/App/common/kernelModuleKafka.h ../../lib/App/common/kernelModuleFlyHunter.h ../../lib/App/common/kernelModuleSSDP.h ../../lib/App/common/kernelModuleOnvifObserver.h ../../lib/App/common/kernelModuleEmbedVideo.h ../../lib/App/common/kernelModuleModemManager.h ../../lib/App/common/MySQL_dataBinder.h ../../lib/App/common/SQLite_dataBinder.h
@@ -873,9 +873,9 @@ $(OUTDIR)/kernelPrototype.o: ../../lib/App/common/kernelPrototype.cpp ../../lib/
$(OUTDIR)/libzip.o: ../../lib/alg/generic/libzip.cpp ../../lib/alg/generic/libzip.h
$(OUTDIR)/mask.o: ../../lib/alg/lgs/mask.cpp ../../lib/alg/lgs/mask.h ../../lib/components/base/basicTypes.h ../../lib/hardware/soc/general/3DLRF.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/gui/gui.h
$(OUTDIR)/md5.o: ../../lib/alg/generic/md5.cpp ../../lib/alg/generic/md5.h
-$(OUTDIR)/mojoBackend.o: ../../lib/App/mojo/mojoBackend.cpp ../../lib/App/mojo/mojoBackend.h ../../lib/components/base/basicSettings.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicMemoryOperation.h ../../lib/components/object/objectFileLoggingService.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/App/mojo/mojoKernel.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicEventHeap.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/Transform.h ../../lib/alg/lgs/detectorStructures.h ../../lib/components/base/basicTypes.h ../../lib/alg/lgs/detector.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicValidatable.h ../../lib/alg/lgs/detectorStructures.h ../../lib/components/base/basicTypes.h ../../lib/alg/lgs/mask.h ../../lib/components/base/basicTypes.h ../../lib/hardware/soc/general/3DLRF.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/gui/gui.h ../../lib/alg/generic/md5.h ../../lib/App/common/kernelPrototype.h ../../lib/App/mojo/mojoRemoteClient.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/data/net/clientPort.h ../../lib/data/transport/transportSocket.h ../../lib/components/base/basicDualThread.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicTransport.h ../../lib/data/protocol/protocol.h ../../lib/data/protocol/protocolARGUS_DATA.h ../../lib/App/common/dataBinder.h ../../lib/App/common/dataBinder_structures.h ../../lib/App/common/dataBinder_ReportAux.h ../../lib/App/common/MySQL_dataBinder.h ../../lib/App/common/SQLite_dataBinder.h
-$(OUTDIR)/mojoKernel.o: ../../lib/App/mojo/mojoKernel.cpp ../../lib/App/mojo/mojoKernel.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicEventHeap.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/Transform.h ../../lib/alg/lgs/detectorStructures.h ../../lib/components/base/basicTypes.h ../../lib/alg/lgs/detector.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicValidatable.h ../../lib/alg/lgs/detectorStructures.h ../../lib/components/base/basicTypes.h ../../lib/alg/lgs/mask.h ../../lib/components/base/basicTypes.h ../../lib/hardware/soc/general/3DLRF.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/gui/gui.h ../../lib/alg/generic/md5.h ../../lib/App/common/kernelPrototype.h ../../lib/App/mojo/mojoRemoteClient.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/data/net/clientPort.h ../../lib/data/transport/transportSocket.h ../../lib/components/base/basicDualThread.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicTransport.h ../../lib/data/protocol/protocol.h ../../lib/data/protocol/protocolARGUS_DATA.h ../../lib/App/common/dataBinder.h ../../lib/App/common/dataBinder_structures.h ../../lib/App/common/dataBinder_ReportAux.h ../../lib/App/common/kernelEventFilterAPF.h ../../lib/App/common/kernelEventFilterTrain.h ../../lib/App/common/kernelModuleEmbedVideo.h ../../lib/App/common/MySQL_dataBinder.h ../../lib/App/common/SQLite_dataBinder.h
-$(OUTDIR)/mojoRemoteClient.o: ../../lib/App/mojo/mojoRemoteClient.cpp ../../lib/App/mojo/mojoRemoteClient.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/data/net/clientPort.h ../../lib/data/transport/transportSocket.h ../../lib/components/base/basicDualThread.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicTransport.h ../../lib/data/protocol/protocol.h ../../lib/data/protocol/protocolARGUS_DATA.h ../../lib/App/common/dataBinder.h ../../lib/App/common/dataBinder_structures.h ../../lib/App/common/dataBinder_ReportAux.h ../../lib/App/mojo/mojoKernel.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicEventHeap.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/Transform.h ../../lib/alg/lgs/detectorStructures.h ../../lib/components/base/basicTypes.h ../../lib/alg/lgs/detector.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicValidatable.h ../../lib/alg/lgs/detectorStructures.h ../../lib/components/base/basicTypes.h ../../lib/alg/lgs/mask.h ../../lib/components/base/basicTypes.h ../../lib/hardware/soc/general/3DLRF.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/gui/gui.h ../../lib/alg/generic/md5.h ../../lib/App/common/kernelPrototype.h ../../lib/App/mojo/mojoRemoteClient.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/data/net/clientPort.h ../../lib/data/transport/transportSocket.h ../../lib/components/base/basicDualThread.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicTransport.h ../../lib/data/protocol/protocol.h ../../lib/data/protocol/protocolARGUS_DATA.h ../../lib/App/common/dataBinder.h ../../lib/App/common/dataBinder_structures.h ../../lib/App/common/dataBinder_ReportAux.h
+$(OUTDIR)/mojoBackend.o: ../../lib/App/mojo/mojoBackend.cpp ../../lib/App/mojo/mojoBackend.h ../../lib/components/base/basicSettings.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicMemoryOperation.h ../../lib/components/object/objectFileLoggingService.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/App/mojo/mojoKernel.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicEventHeap.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/Transform.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/Transform.h ../../lib/alg/lgs/detectorStructures.h ../../lib/components/base/basicTypes.h ../../lib/alg/lgs/detector.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicValidatable.h ../../lib/alg/lgs/detectorStructures.h ../../lib/components/base/basicTypes.h ../../lib/alg/lgs/mask.h ../../lib/components/base/basicTypes.h ../../lib/hardware/soc/general/3DLRF.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/gui/gui.h ../../lib/alg/generic/md5.h ../../lib/App/common/kernelPrototype.h ../../lib/App/mojo/mojoRemoteClient.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/data/net/clientPort.h ../../lib/data/transport/transportSocket.h ../../lib/components/base/basicDualThread.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicTransport.h ../../lib/data/protocol/protocol.h ../../lib/data/protocol/protocolARGUS_DATA.h ../../lib/App/common/dataBinder.h ../../lib/App/common/dataBinder_structures.h ../../lib/App/common/dataBinder_ReportAux.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/Transform.h ../../lib/App/common/MySQL_dataBinder.h ../../lib/App/common/SQLite_dataBinder.h
+$(OUTDIR)/mojoKernel.o: ../../lib/App/mojo/mojoKernel.cpp ../../lib/App/mojo/mojoKernel.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicEventHeap.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/Transform.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/Transform.h ../../lib/alg/lgs/detectorStructures.h ../../lib/components/base/basicTypes.h ../../lib/alg/lgs/detector.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicValidatable.h ../../lib/alg/lgs/detectorStructures.h ../../lib/components/base/basicTypes.h ../../lib/alg/lgs/mask.h ../../lib/components/base/basicTypes.h ../../lib/hardware/soc/general/3DLRF.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/gui/gui.h ../../lib/alg/generic/md5.h ../../lib/App/common/kernelPrototype.h ../../lib/App/mojo/mojoRemoteClient.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/data/net/clientPort.h ../../lib/data/transport/transportSocket.h ../../lib/components/base/basicDualThread.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicTransport.h ../../lib/data/protocol/protocol.h ../../lib/data/protocol/protocolARGUS_DATA.h ../../lib/App/common/dataBinder.h ../../lib/App/common/dataBinder_structures.h ../../lib/App/common/dataBinder_ReportAux.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/Transform.h ../../lib/App/common/kernelEventFilterAPF.h ../../lib/App/common/kernelEventFilterTrain.h ../../lib/App/common/kernelModuleEmbedVideo.h ../../lib/App/common/MySQL_dataBinder.h ../../lib/App/common/SQLite_dataBinder.h
+$(OUTDIR)/mojoRemoteClient.o: ../../lib/App/mojo/mojoRemoteClient.cpp ../../lib/App/mojo/mojoRemoteClient.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/data/net/clientPort.h ../../lib/data/transport/transportSocket.h ../../lib/components/base/basicDualThread.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicTransport.h ../../lib/data/protocol/protocol.h ../../lib/data/protocol/protocolARGUS_DATA.h ../../lib/App/common/dataBinder.h ../../lib/App/common/dataBinder_structures.h ../../lib/App/common/dataBinder_ReportAux.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/Transform.h ../../lib/App/mojo/mojoKernel.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicEventHeap.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/Transform.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/Transform.h ../../lib/alg/lgs/detectorStructures.h ../../lib/components/base/basicTypes.h ../../lib/alg/lgs/detector.h ../../lib/components/base/basicObject.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicValidatable.h ../../lib/alg/lgs/detectorStructures.h ../../lib/components/base/basicTypes.h ../../lib/alg/lgs/mask.h ../../lib/components/base/basicTypes.h ../../lib/hardware/soc/general/3DLRF.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/gui/gui.h ../../lib/alg/generic/md5.h ../../lib/App/common/kernelPrototype.h ../../lib/App/mojo/mojoRemoteClient.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/data/net/clientPort.h ../../lib/data/transport/transportSocket.h ../../lib/components/base/basicDualThread.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicTransport.h ../../lib/data/protocol/protocol.h ../../lib/data/protocol/protocolARGUS_DATA.h ../../lib/App/common/dataBinder.h ../../lib/App/common/dataBinder_structures.h ../../lib/App/common/dataBinder_ReportAux.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/Transform.h
$(OUTDIR)/mysql_class.o: ../../lib/data/mysql/mysql_class.cpp ../../lib/data/mysql/mysql_class.h
$(OUTDIR)/MySQL_dataBinder.o: ../../lib/App/common/MySQL_dataBinder.cpp ../../lib/App/common/MySQL_dataBinder.h
$(OUTDIR)/netClientHandler.o: ../../lib/data/net/netClientHandler.cpp ../../lib/data/net/netClientHandler.h ../../lib/data/protocol/protocol.h ../../lib/components/base/basicEventHandler.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/Transform.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/data/net/serverPort.h ../../lib/data/transport/transportSocket.h ../../lib/components/base/basicDualThread.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicTransport.h ../../lib/data/net/netServiceEngine.h
diff --git a/Projects/la_serva/la_serva.vpj b/Projects/la_serva/la_serva.vpj
index 6d2009b8..436ff05a 100644
--- a/Projects/la_serva/la_serva.vpj
+++ b/Projects/la_serva/la_serva.vpj
@@ -132,6 +132,7 @@
+
+
-
@@ -528,10 +529,11 @@
+
+
-
@@ -545,15 +547,16 @@
Name="Header Files"
Filters="*.h;*.H;*.hh;*.hpp;*.hxx;*.inc;*.sh;*.cpy;*.if"
GUID="{AC1A2E44-6BBF-481F-81E4-5466FA3801D3}">
-
+
+
+
-
diff --git a/Projects/la_serva/makefile b/Projects/la_serva/makefile
index fcff0966..77928092 100644
--- a/Projects/la_serva/makefile
+++ b/Projects/la_serva/makefile
@@ -25,7 +25,7 @@ CFG_LIB=-lsqlite3 -lpthread -lmysqlclient -lssl -lcurl -lm -lcrypto \
-lconfig -lz `pkg-config libavcodec libavdevice libavfilter \
libavformat libavutil libpostproc libswresample libswscale --libs` \
-latomic `pkg-config --libs openssl opencv4 rdkafka++`-lliveMedia \
- -lgroupsock -lBasicUsageEnvironment -lUsageEnvironment
+ -lgroupsock -lBasicUsageEnvironment -lUsageEnvironment -lmodbus
CFG_OBJ=
COMMON_OBJ=$(OUTDIR)/basicDualThread.o $(OUTDIR)/basicEngine.o \
$(OUTDIR)/basicEvent.o $(OUTDIR)/basicEventHandler.o \
@@ -37,18 +37,18 @@ COMMON_OBJ=$(OUTDIR)/basicDualThread.o $(OUTDIR)/basicEngine.o \
$(OUTDIR)/basicThread.o $(OUTDIR)/basicTransport.o \
$(OUTDIR)/dataBinder_ReportAux.o $(OUTDIR)/json_reader.o \
$(OUTDIR)/json_value.o $(OUTDIR)/json_writer.o \
- $(OUTDIR)/kernelPrototype.o $(OUTDIR)/lifeMonitoring.o \
- $(OUTDIR)/md5.o $(OUTDIR)/mysql_class.o $(OUTDIR)/netClientHandler.o \
- $(OUTDIR)/netServer.o $(OUTDIR)/objectFileLoggingService.o \
+ $(OUTDIR)/kernelPrototype.o $(OUTDIR)/md5.o $(OUTDIR)/mysql_class.o \
+ $(OUTDIR)/netClientHandler.o $(OUTDIR)/netServer.o \
+ $(OUTDIR)/objectFileLoggingService.o \
$(OUTDIR)/objectMySQLLoggingService.o $(OUTDIR)/protocol.o \
$(OUTDIR)/protocolARGUS_DATA.o $(OUTDIR)/servaBackend.o \
$(OUTDIR)/servaKernel.o $(OUTDIR)/servaKernelToolKit.o \
- $(OUTDIR)/servaMediaEncoder.o $(OUTDIR)/servaRemoteClient.o \
- $(OUTDIR)/servaRemoteClientHandler.o $(OUTDIR)/servaScadaManager.o \
- $(OUTDIR)/servaSessionManager.o $(OUTDIR)/serverDataBinder.o \
- $(OUTDIR)/serverMySQL_dataBinder.o $(OUTDIR)/serverPort.o \
- $(OUTDIR)/sqlite_class.o $(OUTDIR)/Transform.o \
- $(OUTDIR)/transportSocket.o $(OUTDIR)/utm.o
+ $(OUTDIR)/servaLifeMonitoring.o $(OUTDIR)/servaMediaEncoder.o \
+ $(OUTDIR)/servaModBusManager.o $(OUTDIR)/servaRemoteClient.o \
+ $(OUTDIR)/servaRemoteClientHandler.o $(OUTDIR)/servaSessionManager.o \
+ $(OUTDIR)/serverDataBinder.o $(OUTDIR)/serverMySQL_dataBinder.o \
+ $(OUTDIR)/serverPort.o $(OUTDIR)/sqlite_class.o \
+ $(OUTDIR)/Transform.o $(OUTDIR)/transportSocket.o $(OUTDIR)/utm.o
OBJ=$(COMMON_OBJ) $(CFG_OBJ)
ALL_OBJ=$(OUTDIR)/basicDualThread.o $(OUTDIR)/basicEngine.o \
$(OUTDIR)/basicEvent.o $(OUTDIR)/basicEventHandler.o \
@@ -60,23 +60,23 @@ ALL_OBJ=$(OUTDIR)/basicDualThread.o $(OUTDIR)/basicEngine.o \
$(OUTDIR)/basicThread.o $(OUTDIR)/basicTransport.o \
$(OUTDIR)/dataBinder_ReportAux.o $(OUTDIR)/json_reader.o \
$(OUTDIR)/json_value.o $(OUTDIR)/json_writer.o \
- $(OUTDIR)/kernelPrototype.o $(OUTDIR)/lifeMonitoring.o \
- $(OUTDIR)/md5.o $(OUTDIR)/mysql_class.o $(OUTDIR)/netClientHandler.o \
- $(OUTDIR)/netServer.o $(OUTDIR)/objectFileLoggingService.o \
+ $(OUTDIR)/kernelPrototype.o $(OUTDIR)/md5.o $(OUTDIR)/mysql_class.o \
+ $(OUTDIR)/netClientHandler.o $(OUTDIR)/netServer.o \
+ $(OUTDIR)/objectFileLoggingService.o \
$(OUTDIR)/objectMySQLLoggingService.o $(OUTDIR)/protocol.o \
$(OUTDIR)/protocolARGUS_DATA.o $(OUTDIR)/servaBackend.o \
$(OUTDIR)/servaKernel.o $(OUTDIR)/servaKernelToolKit.o \
- $(OUTDIR)/servaMediaEncoder.o $(OUTDIR)/servaRemoteClient.o \
- $(OUTDIR)/servaRemoteClientHandler.o $(OUTDIR)/servaScadaManager.o \
- $(OUTDIR)/servaSessionManager.o $(OUTDIR)/serverDataBinder.o \
- $(OUTDIR)/serverMySQL_dataBinder.o $(OUTDIR)/serverPort.o \
- $(OUTDIR)/sqlite_class.o $(OUTDIR)/Transform.o \
- $(OUTDIR)/transportSocket.o $(OUTDIR)/utm.o -lsqlite3 -lpthread \
- -lmysqlclient -lssl -lcurl -lm -lcrypto -lconfig -lz `pkg-config \
- libavcodec libavdevice libavfilter libavformat libavutil libpostproc \
- libswresample libswscale --libs` -latomic `pkg-config --libs openssl \
- opencv4 rdkafka++`-lliveMedia -lgroupsock -lBasicUsageEnvironment \
- -lUsageEnvironment
+ $(OUTDIR)/servaLifeMonitoring.o $(OUTDIR)/servaMediaEncoder.o \
+ $(OUTDIR)/servaModBusManager.o $(OUTDIR)/servaRemoteClient.o \
+ $(OUTDIR)/servaRemoteClientHandler.o $(OUTDIR)/servaSessionManager.o \
+ $(OUTDIR)/serverDataBinder.o $(OUTDIR)/serverMySQL_dataBinder.o \
+ $(OUTDIR)/serverPort.o $(OUTDIR)/sqlite_class.o \
+ $(OUTDIR)/Transform.o $(OUTDIR)/transportSocket.o $(OUTDIR)/utm.o \
+ -lsqlite3 -lpthread -lmysqlclient -lssl -lcurl -lm -lcrypto -lconfig \
+ -lz `pkg-config libavcodec libavdevice libavfilter libavformat \
+ libavutil libpostproc libswresample libswscale --libs` -latomic \
+ `pkg-config --libs openssl opencv4 rdkafka++`-lliveMedia -lgroupsock \
+ -lBasicUsageEnvironment -lUsageEnvironment -lmodbus
COMPILE=g++ -c -x c++ "-DDEBUG" "-DUSE_SERVER_MYSQL" "-D__STDC_CONSTANT_MACROS__" "-D_SERVER_APPLICATION_" "-D_OPENCV_" "-DRASPI_HARDWARE" -O0 -w -Wpointer-arith -std=c++11 -Wno-write-strings -I../../lib/include `pkg-config opencv4 libavcodec libavdevice libavfilter libavformat libavutil libpostproc libswresample libswscale live555 --cflags` -o "$(OUTDIR)/$(*F).o" $(CFG_INC) $<
LINK=g++ -O0 -w -o "$(OUTFILE)" $(ALL_OBJ)
@@ -156,18 +156,18 @@ COMMON_OBJ=$(OUTDIR)/basicDualThread.o $(OUTDIR)/basicEngine.o \
$(OUTDIR)/basicThread.o $(OUTDIR)/basicTransport.o \
$(OUTDIR)/dataBinder_ReportAux.o $(OUTDIR)/json_reader.o \
$(OUTDIR)/json_value.o $(OUTDIR)/json_writer.o \
- $(OUTDIR)/kernelPrototype.o $(OUTDIR)/lifeMonitoring.o \
- $(OUTDIR)/md5.o $(OUTDIR)/mysql_class.o $(OUTDIR)/netClientHandler.o \
- $(OUTDIR)/netServer.o $(OUTDIR)/objectFileLoggingService.o \
+ $(OUTDIR)/kernelPrototype.o $(OUTDIR)/md5.o $(OUTDIR)/mysql_class.o \
+ $(OUTDIR)/netClientHandler.o $(OUTDIR)/netServer.o \
+ $(OUTDIR)/objectFileLoggingService.o \
$(OUTDIR)/objectMySQLLoggingService.o $(OUTDIR)/protocol.o \
$(OUTDIR)/protocolARGUS_DATA.o $(OUTDIR)/servaBackend.o \
$(OUTDIR)/servaKernel.o $(OUTDIR)/servaKernelToolKit.o \
- $(OUTDIR)/servaMediaEncoder.o $(OUTDIR)/servaRemoteClient.o \
- $(OUTDIR)/servaRemoteClientHandler.o $(OUTDIR)/servaScadaManager.o \
- $(OUTDIR)/servaSessionManager.o $(OUTDIR)/serverDataBinder.o \
- $(OUTDIR)/serverMySQL_dataBinder.o $(OUTDIR)/serverPort.o \
- $(OUTDIR)/sqlite_class.o $(OUTDIR)/Transform.o \
- $(OUTDIR)/transportSocket.o $(OUTDIR)/utm.o
+ $(OUTDIR)/servaLifeMonitoring.o $(OUTDIR)/servaMediaEncoder.o \
+ $(OUTDIR)/servaModBusManager.o $(OUTDIR)/servaRemoteClient.o \
+ $(OUTDIR)/servaRemoteClientHandler.o $(OUTDIR)/servaSessionManager.o \
+ $(OUTDIR)/serverDataBinder.o $(OUTDIR)/serverMySQL_dataBinder.o \
+ $(OUTDIR)/serverPort.o $(OUTDIR)/sqlite_class.o \
+ $(OUTDIR)/Transform.o $(OUTDIR)/transportSocket.o $(OUTDIR)/utm.o
OBJ=$(COMMON_OBJ) $(CFG_OBJ)
ALL_OBJ=$(OUTDIR)/basicDualThread.o $(OUTDIR)/basicEngine.o \
$(OUTDIR)/basicEvent.o $(OUTDIR)/basicEventHandler.o \
@@ -179,18 +179,18 @@ ALL_OBJ=$(OUTDIR)/basicDualThread.o $(OUTDIR)/basicEngine.o \
$(OUTDIR)/basicThread.o $(OUTDIR)/basicTransport.o \
$(OUTDIR)/dataBinder_ReportAux.o $(OUTDIR)/json_reader.o \
$(OUTDIR)/json_value.o $(OUTDIR)/json_writer.o \
- $(OUTDIR)/kernelPrototype.o $(OUTDIR)/lifeMonitoring.o \
- $(OUTDIR)/md5.o $(OUTDIR)/mysql_class.o $(OUTDIR)/netClientHandler.o \
- $(OUTDIR)/netServer.o $(OUTDIR)/objectFileLoggingService.o \
+ $(OUTDIR)/kernelPrototype.o $(OUTDIR)/md5.o $(OUTDIR)/mysql_class.o \
+ $(OUTDIR)/netClientHandler.o $(OUTDIR)/netServer.o \
+ $(OUTDIR)/objectFileLoggingService.o \
$(OUTDIR)/objectMySQLLoggingService.o $(OUTDIR)/protocol.o \
$(OUTDIR)/protocolARGUS_DATA.o $(OUTDIR)/servaBackend.o \
$(OUTDIR)/servaKernel.o $(OUTDIR)/servaKernelToolKit.o \
- $(OUTDIR)/servaMediaEncoder.o $(OUTDIR)/servaRemoteClient.o \
- $(OUTDIR)/servaRemoteClientHandler.o $(OUTDIR)/servaScadaManager.o \
- $(OUTDIR)/servaSessionManager.o $(OUTDIR)/serverDataBinder.o \
- $(OUTDIR)/serverMySQL_dataBinder.o $(OUTDIR)/serverPort.o \
- $(OUTDIR)/sqlite_class.o $(OUTDIR)/Transform.o \
- $(OUTDIR)/transportSocket.o $(OUTDIR)/utm.o
+ $(OUTDIR)/servaLifeMonitoring.o $(OUTDIR)/servaMediaEncoder.o \
+ $(OUTDIR)/servaModBusManager.o $(OUTDIR)/servaRemoteClient.o \
+ $(OUTDIR)/servaRemoteClientHandler.o $(OUTDIR)/servaSessionManager.o \
+ $(OUTDIR)/serverDataBinder.o $(OUTDIR)/serverMySQL_dataBinder.o \
+ $(OUTDIR)/serverPort.o $(OUTDIR)/sqlite_class.o \
+ $(OUTDIR)/Transform.o $(OUTDIR)/transportSocket.o $(OUTDIR)/utm.o
COMPILE=g++ -c -x c++ "-DUSE_SERVER_MYSQL" "-D_SERVER_APPLICATION_" "-D_THREAD_SAFE" "-D_BSD_SOURCE" "-D_REENTRANT" "-DRASPI_HARDWARE" -O3 -w -Wpointer-arith -std=gnu++11 -I../../lib/include -o "$(OUTDIR)/$(*F).o" $(CFG_INC) $<
LINK=g++ -O3 -w -lconfig -lpthread -lmysqlclient -lelf -lcurses -lcdk -lcurl `pkg-config --libs rdkafka++` -s -o "$(OUTFILE)" $(ALL_OBJ)
@@ -262,7 +262,7 @@ CFG_LIB=-lsqlite3 -lpthread -lmysqlclient -lssl -lcurl -lm -lcrypto \
-lconfig -lz `pkg-config libavcodec libavdevice libavfilter \
libavformat libavutil libpostproc libswresample libswscale --libs` \
-latomic `pkg-config --libs openssl opencv4 rdkafka++` -lliveMedia \
- -lgroupsock -lBasicUsageEnvironment -lUsageEnvironment
+ -lgroupsock -lBasicUsageEnvironment -lUsageEnvironment -lmodbus
CFG_OBJ=
COMMON_OBJ=$(OUTDIR)/basicDualThread.o $(OUTDIR)/basicEngine.o \
$(OUTDIR)/basicEvent.o $(OUTDIR)/basicEventHandler.o \
@@ -274,18 +274,18 @@ COMMON_OBJ=$(OUTDIR)/basicDualThread.o $(OUTDIR)/basicEngine.o \
$(OUTDIR)/basicThread.o $(OUTDIR)/basicTransport.o \
$(OUTDIR)/dataBinder_ReportAux.o $(OUTDIR)/json_reader.o \
$(OUTDIR)/json_value.o $(OUTDIR)/json_writer.o \
- $(OUTDIR)/kernelPrototype.o $(OUTDIR)/lifeMonitoring.o \
- $(OUTDIR)/md5.o $(OUTDIR)/mysql_class.o $(OUTDIR)/netClientHandler.o \
- $(OUTDIR)/netServer.o $(OUTDIR)/objectFileLoggingService.o \
+ $(OUTDIR)/kernelPrototype.o $(OUTDIR)/md5.o $(OUTDIR)/mysql_class.o \
+ $(OUTDIR)/netClientHandler.o $(OUTDIR)/netServer.o \
+ $(OUTDIR)/objectFileLoggingService.o \
$(OUTDIR)/objectMySQLLoggingService.o $(OUTDIR)/protocol.o \
$(OUTDIR)/protocolARGUS_DATA.o $(OUTDIR)/servaBackend.o \
$(OUTDIR)/servaKernel.o $(OUTDIR)/servaKernelToolKit.o \
- $(OUTDIR)/servaMediaEncoder.o $(OUTDIR)/servaRemoteClient.o \
- $(OUTDIR)/servaRemoteClientHandler.o $(OUTDIR)/servaScadaManager.o \
- $(OUTDIR)/servaSessionManager.o $(OUTDIR)/serverDataBinder.o \
- $(OUTDIR)/serverMySQL_dataBinder.o $(OUTDIR)/serverPort.o \
- $(OUTDIR)/sqlite_class.o $(OUTDIR)/Transform.o \
- $(OUTDIR)/transportSocket.o $(OUTDIR)/utm.o
+ $(OUTDIR)/servaLifeMonitoring.o $(OUTDIR)/servaMediaEncoder.o \
+ $(OUTDIR)/servaModBusManager.o $(OUTDIR)/servaRemoteClient.o \
+ $(OUTDIR)/servaRemoteClientHandler.o $(OUTDIR)/servaSessionManager.o \
+ $(OUTDIR)/serverDataBinder.o $(OUTDIR)/serverMySQL_dataBinder.o \
+ $(OUTDIR)/serverPort.o $(OUTDIR)/sqlite_class.o \
+ $(OUTDIR)/Transform.o $(OUTDIR)/transportSocket.o $(OUTDIR)/utm.o
OBJ=$(COMMON_OBJ) $(CFG_OBJ)
ALL_OBJ=$(OUTDIR)/basicDualThread.o $(OUTDIR)/basicEngine.o \
$(OUTDIR)/basicEvent.o $(OUTDIR)/basicEventHandler.o \
@@ -297,23 +297,23 @@ ALL_OBJ=$(OUTDIR)/basicDualThread.o $(OUTDIR)/basicEngine.o \
$(OUTDIR)/basicThread.o $(OUTDIR)/basicTransport.o \
$(OUTDIR)/dataBinder_ReportAux.o $(OUTDIR)/json_reader.o \
$(OUTDIR)/json_value.o $(OUTDIR)/json_writer.o \
- $(OUTDIR)/kernelPrototype.o $(OUTDIR)/lifeMonitoring.o \
- $(OUTDIR)/md5.o $(OUTDIR)/mysql_class.o $(OUTDIR)/netClientHandler.o \
- $(OUTDIR)/netServer.o $(OUTDIR)/objectFileLoggingService.o \
+ $(OUTDIR)/kernelPrototype.o $(OUTDIR)/md5.o $(OUTDIR)/mysql_class.o \
+ $(OUTDIR)/netClientHandler.o $(OUTDIR)/netServer.o \
+ $(OUTDIR)/objectFileLoggingService.o \
$(OUTDIR)/objectMySQLLoggingService.o $(OUTDIR)/protocol.o \
$(OUTDIR)/protocolARGUS_DATA.o $(OUTDIR)/servaBackend.o \
$(OUTDIR)/servaKernel.o $(OUTDIR)/servaKernelToolKit.o \
- $(OUTDIR)/servaMediaEncoder.o $(OUTDIR)/servaRemoteClient.o \
- $(OUTDIR)/servaRemoteClientHandler.o $(OUTDIR)/servaScadaManager.o \
- $(OUTDIR)/servaSessionManager.o $(OUTDIR)/serverDataBinder.o \
- $(OUTDIR)/serverMySQL_dataBinder.o $(OUTDIR)/serverPort.o \
- $(OUTDIR)/sqlite_class.o $(OUTDIR)/Transform.o \
- $(OUTDIR)/transportSocket.o $(OUTDIR)/utm.o -lsqlite3 -lpthread \
- -lmysqlclient -lssl -lcurl -lm -lcrypto -lconfig -lz `pkg-config \
- libavcodec libavdevice libavfilter libavformat libavutil libpostproc \
- libswresample libswscale --libs` -latomic `pkg-config --libs openssl \
- opencv4 rdkafka++` -lliveMedia -lgroupsock -lBasicUsageEnvironment \
- -lUsageEnvironment
+ $(OUTDIR)/servaLifeMonitoring.o $(OUTDIR)/servaMediaEncoder.o \
+ $(OUTDIR)/servaModBusManager.o $(OUTDIR)/servaRemoteClient.o \
+ $(OUTDIR)/servaRemoteClientHandler.o $(OUTDIR)/servaSessionManager.o \
+ $(OUTDIR)/serverDataBinder.o $(OUTDIR)/serverMySQL_dataBinder.o \
+ $(OUTDIR)/serverPort.o $(OUTDIR)/sqlite_class.o \
+ $(OUTDIR)/Transform.o $(OUTDIR)/transportSocket.o $(OUTDIR)/utm.o \
+ -lsqlite3 -lpthread -lmysqlclient -lssl -lcurl -lm -lcrypto -lconfig \
+ -lz `pkg-config libavcodec libavdevice libavfilter libavformat \
+ libavutil libpostproc libswresample libswscale --libs` -latomic \
+ `pkg-config --libs openssl opencv4 rdkafka++` -lliveMedia \
+ -lgroupsock -lBasicUsageEnvironment -lUsageEnvironment -lmodbus
COMPILE=g++ -c -x c++ "-DDEBUG" "-DUSE_SERVER_MYSQL" "-D__STDC_CONSTANT_MACROS" "-D_SERVER_APPLICATION_" "-D_OPENCV_" -O0 -w -Wpointer-arith -std=c++11 -Wno-write-strings -I../../lib/include `pkg-config opencv4 libavcodec libavdevice libavfilter libavformat libavutil libpostproc libswresample libswscale live555 --cflags` -o "$(OUTDIR)/$(*F).o" $(CFG_INC) $<
LINK=g++ -O0 -w -o "$(OUTFILE)" $(ALL_OBJ)
@@ -397,18 +397,18 @@ COMMON_OBJ=$(OUTDIR)/basicDualThread.o $(OUTDIR)/basicEngine.o \
$(OUTDIR)/basicThread.o $(OUTDIR)/basicTransport.o \
$(OUTDIR)/dataBinder_ReportAux.o $(OUTDIR)/json_reader.o \
$(OUTDIR)/json_value.o $(OUTDIR)/json_writer.o \
- $(OUTDIR)/kernelPrototype.o $(OUTDIR)/lifeMonitoring.o \
- $(OUTDIR)/md5.o $(OUTDIR)/mysql_class.o $(OUTDIR)/netClientHandler.o \
- $(OUTDIR)/netServer.o $(OUTDIR)/objectFileLoggingService.o \
+ $(OUTDIR)/kernelPrototype.o $(OUTDIR)/md5.o $(OUTDIR)/mysql_class.o \
+ $(OUTDIR)/netClientHandler.o $(OUTDIR)/netServer.o \
+ $(OUTDIR)/objectFileLoggingService.o \
$(OUTDIR)/objectMySQLLoggingService.o $(OUTDIR)/protocol.o \
$(OUTDIR)/protocolARGUS_DATA.o $(OUTDIR)/servaBackend.o \
$(OUTDIR)/servaKernel.o $(OUTDIR)/servaKernelToolKit.o \
- $(OUTDIR)/servaMediaEncoder.o $(OUTDIR)/servaRemoteClient.o \
- $(OUTDIR)/servaRemoteClientHandler.o $(OUTDIR)/servaScadaManager.o \
- $(OUTDIR)/servaSessionManager.o $(OUTDIR)/serverDataBinder.o \
- $(OUTDIR)/serverMySQL_dataBinder.o $(OUTDIR)/serverPort.o \
- $(OUTDIR)/sqlite_class.o $(OUTDIR)/Transform.o \
- $(OUTDIR)/transportSocket.o $(OUTDIR)/utm.o
+ $(OUTDIR)/servaLifeMonitoring.o $(OUTDIR)/servaMediaEncoder.o \
+ $(OUTDIR)/servaModBusManager.o $(OUTDIR)/servaRemoteClient.o \
+ $(OUTDIR)/servaRemoteClientHandler.o $(OUTDIR)/servaSessionManager.o \
+ $(OUTDIR)/serverDataBinder.o $(OUTDIR)/serverMySQL_dataBinder.o \
+ $(OUTDIR)/serverPort.o $(OUTDIR)/sqlite_class.o \
+ $(OUTDIR)/Transform.o $(OUTDIR)/transportSocket.o $(OUTDIR)/utm.o
OBJ=$(COMMON_OBJ) $(CFG_OBJ)
ALL_OBJ=$(OUTDIR)/basicDualThread.o $(OUTDIR)/basicEngine.o \
$(OUTDIR)/basicEvent.o $(OUTDIR)/basicEventHandler.o \
@@ -420,23 +420,23 @@ ALL_OBJ=$(OUTDIR)/basicDualThread.o $(OUTDIR)/basicEngine.o \
$(OUTDIR)/basicThread.o $(OUTDIR)/basicTransport.o \
$(OUTDIR)/dataBinder_ReportAux.o $(OUTDIR)/json_reader.o \
$(OUTDIR)/json_value.o $(OUTDIR)/json_writer.o \
- $(OUTDIR)/kernelPrototype.o $(OUTDIR)/lifeMonitoring.o \
- $(OUTDIR)/md5.o $(OUTDIR)/mysql_class.o $(OUTDIR)/netClientHandler.o \
- $(OUTDIR)/netServer.o $(OUTDIR)/objectFileLoggingService.o \
+ $(OUTDIR)/kernelPrototype.o $(OUTDIR)/md5.o $(OUTDIR)/mysql_class.o \
+ $(OUTDIR)/netClientHandler.o $(OUTDIR)/netServer.o \
+ $(OUTDIR)/objectFileLoggingService.o \
$(OUTDIR)/objectMySQLLoggingService.o $(OUTDIR)/protocol.o \
$(OUTDIR)/protocolARGUS_DATA.o $(OUTDIR)/servaBackend.o \
$(OUTDIR)/servaKernel.o $(OUTDIR)/servaKernelToolKit.o \
- $(OUTDIR)/servaMediaEncoder.o $(OUTDIR)/servaRemoteClient.o \
- $(OUTDIR)/servaRemoteClientHandler.o $(OUTDIR)/servaScadaManager.o \
- $(OUTDIR)/servaSessionManager.o $(OUTDIR)/serverDataBinder.o \
- $(OUTDIR)/serverMySQL_dataBinder.o $(OUTDIR)/serverPort.o \
- $(OUTDIR)/sqlite_class.o $(OUTDIR)/Transform.o \
- $(OUTDIR)/transportSocket.o $(OUTDIR)/utm.o -lpthread -lmysqlclient \
- -lssl -lcurl -lm -lcrypto -lconfig -lz `pkg-config libavcodec \
- libavdevice libavfilter libavformat libavutil libpostproc \
- libswresample libswscale --libs` -latomic `pkg-config --libs openssl \
- opencv4 rdkafka++` -lliveMedia -lgroupsock -lBasicUsageEnvironment \
- -lUsageEnvironment -s
+ $(OUTDIR)/servaLifeMonitoring.o $(OUTDIR)/servaMediaEncoder.o \
+ $(OUTDIR)/servaModBusManager.o $(OUTDIR)/servaRemoteClient.o \
+ $(OUTDIR)/servaRemoteClientHandler.o $(OUTDIR)/servaSessionManager.o \
+ $(OUTDIR)/serverDataBinder.o $(OUTDIR)/serverMySQL_dataBinder.o \
+ $(OUTDIR)/serverPort.o $(OUTDIR)/sqlite_class.o \
+ $(OUTDIR)/Transform.o $(OUTDIR)/transportSocket.o $(OUTDIR)/utm.o \
+ -lpthread -lmysqlclient -lssl -lcurl -lm -lcrypto -lconfig -lz \
+ `pkg-config libavcodec libavdevice libavfilter libavformat libavutil \
+ libpostproc libswresample libswscale --libs` -latomic `pkg-config \
+ --libs openssl opencv4 rdkafka++` -lliveMedia -lgroupsock \
+ -lBasicUsageEnvironment -lUsageEnvironment -s
COMPILE=g++ -c -x c++ "-DUSE_SERVER_MYSQL" "-D__STDC_CONSTANT_MACROS" "-D_SERVER_APPLICATION_" "-D_OPENCV_" -O3 -w -Wpointer-arith -std=c++11 -Wno-write-strings -I../../lib/include `pkg-config opencv4 libavcodec libavdevice libavfilter libavformat libavutil libpostproc libswresample libswscale live555 --cflags` -o "$(OUTDIR)/$(*F).o" $(CFG_INC) $<
LINK=g++ -O3 -w -o "$(OUTFILE)" $(ALL_OBJ)
@@ -502,7 +502,7 @@ endif
#
$(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)/basicEvent.o: ../../lib/components/base/basicEvent.cpp ../../lib/components/base/basicEvent.h ../../lib/components/base/basicFunctionality.h
+$(OUTDIR)/basicEvent.o: ../../lib/components/base/basicEvent.cpp ../../lib/components/base/basicEvent.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/Transform.h ../../lib/components/base/basicFunctionality.h
$(OUTDIR)/basicEventHandler.o: ../../lib/components/base/basicEventHandler.cpp ../../lib/components/base/basicEventHandler.h ../../lib/components/base/basicEventHeap.h
$(OUTDIR)/basicEventHeap.o: ../../lib/components/base/basicEventHeap.cpp ../../lib/components/base/basicEventHeap.h ../../lib/components/base/basicEventHandler.h
$(OUTDIR)/basicFunctionality.o: ../../lib/components/base/basicFunctionality.cpp ../../lib/components/base/basicFunctionality.h ../../lib/alg/generic/md5.h ../../lib/components/base/basicLogCollection.h
@@ -521,7 +521,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)/kernelPrototype.o: ../../lib/App/common/kernelPrototype.cpp ../../lib/App/common/kernelPrototype.h
-$(OUTDIR)/lifeMonitoring.o: ../../lib/App/serva/lifeMonitoring.cpp ../../lib/App/serva/lifeMonitoring.h
$(OUTDIR)/md5.o: ../../lib/alg/generic/md5.cpp ../../lib/alg/generic/md5.h
$(OUTDIR)/mysql_class.o: ../../lib/data/mysql/mysql_class.cpp ../../lib/data/mysql/mysql_class.h
$(OUTDIR)/netClientHandler.o: ../../lib/data/net/netClientHandler.cpp ../../lib/data/net/netClientHandler.h
@@ -529,15 +528,16 @@ $(OUTDIR)/netServer.o: ../../lib/data/net/netServer.cpp ../../lib/data/net/netSe
$(OUTDIR)/objectFileLoggingService.o: ../../lib/components/object/objectFileLoggingService.cpp ../../lib/components/object/objectFileLoggingService.h
$(OUTDIR)/objectMySQLLoggingService.o: ../../lib/App/serva/objectMySQLLoggingService.cpp ../../lib/App/serva/objectMySQLLoggingService.h ../../lib/App/common/serverDataBinder.h ../../lib/App/common/dataBinder_structures.h
$(OUTDIR)/protocol.o: ../../lib/data/protocol/protocol.cpp ../../lib/data/protocol/protocol.h
-$(OUTDIR)/protocolARGUS_DATA.o: ../../lib/data/protocol/protocolARGUS_DATA.cpp ../../lib/data/protocol/protocolARGUS_DATA.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicEvent.h ../../lib/App/common/dataBinder_structures.h
-$(OUTDIR)/servaBackend.o: ../../lib/App/serva/servaBackend.cpp ../../lib/App/serva/servaBackend.h ../../lib/App/common/serverMySQL_dataBinder.h ../../lib/App/common/serverDataBinder.h ../../lib/App/common/dataBinder_structures.h ../../lib/data/mysql/mysql_class.h ../../lib/components/base/basicSettingsProvider.h ../../lib/alg/generic/md5.h ../../lib/alg/lgs/mask.h ../../lib/components/base/basicSettings.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicMemoryOperation.h ../../lib/components/object/objectFileLoggingService.h ../../lib/App/serva/objectMySQLLoggingService.h ../../lib/App/common/serverDataBinder.h ../../lib/App/common/dataBinder_structures.h ../../lib/App/serva/servaKernel.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicEventHeap.h ../../lib/components/object/objectSystemAnchor.h ../../lib/alg/lgs/detectorStructures.h ../../lib/alg/lgs/detector.h ../../lib/alg/lgs/mask.h ../../lib/alg/generic/md5.h ../../lib/App/common/kernelPrototype.h ../../lib/App/serva/lifeMonitoring.h ../../lib/App/serva/servaRemoteClient.h ../../lib/data/net/netServer.h ../../lib/App/serva/servaMediaEncoder.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicLIBAV.h ../../lib/App/serva/servaSessionManager.h ../../lib/App/common/dataBinder_ReportAux.h ../../lib/components/base/basicEvent.h ../../lib/App/common/serverDataBinder.h ../../lib/App/common/dataBinder_structures.h ../../lib/data/protocol/protocolARGUS_DATA.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicEvent.h ../../lib/App/common/dataBinder_structures.h
-$(OUTDIR)/servaKernel.o: ../../lib/App/serva/servaKernel.cpp ../../lib/App/serva/servaKernel.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicEventHeap.h ../../lib/components/object/objectSystemAnchor.h ../../lib/alg/lgs/detectorStructures.h ../../lib/alg/lgs/detector.h ../../lib/alg/lgs/mask.h ../../lib/alg/generic/md5.h ../../lib/App/common/kernelPrototype.h ../../lib/App/serva/lifeMonitoring.h ../../lib/App/serva/servaRemoteClient.h ../../lib/data/net/netServer.h ../../lib/App/serva/servaMediaEncoder.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicLIBAV.h ../../lib/App/serva/servaSessionManager.h ../../lib/App/common/dataBinder_ReportAux.h ../../lib/components/base/basicEvent.h ../../lib/App/common/serverDataBinder.h ../../lib/App/common/dataBinder_structures.h ../../lib/data/protocol/protocolARGUS_DATA.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicEvent.h ../../lib/App/common/dataBinder_structures.h ../../lib/App/common/kernelEventFilterAPF.h ../../lib/App/common/kernelEventFilterTrain.h ../../lib/App/common/kernelModuleEmbedVideo.h ../../lib/App/common/serverMySQL_dataBinder.h ../../lib/App/common/serverDataBinder.h ../../lib/App/common/dataBinder_structures.h ../../lib/data/mysql/mysql_class.h ../../lib/components/base/basicSettingsProvider.h ../../lib/alg/generic/md5.h ../../lib/alg/lgs/mask.h
-$(OUTDIR)/servaKernelToolKit.o: ../../lib/App/serva/servaKernelToolKit.cpp ../../lib/App/serva/servaKernel.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicEventHeap.h ../../lib/components/object/objectSystemAnchor.h ../../lib/alg/lgs/detectorStructures.h ../../lib/alg/lgs/detector.h ../../lib/alg/lgs/mask.h ../../lib/alg/generic/md5.h ../../lib/App/common/kernelPrototype.h ../../lib/App/serva/lifeMonitoring.h ../../lib/App/serva/servaRemoteClient.h ../../lib/data/net/netServer.h ../../lib/App/serva/servaMediaEncoder.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicLIBAV.h ../../lib/App/serva/servaSessionManager.h ../../lib/App/common/dataBinder_ReportAux.h ../../lib/components/base/basicEvent.h ../../lib/App/common/serverDataBinder.h ../../lib/App/common/dataBinder_structures.h ../../lib/data/protocol/protocolARGUS_DATA.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicEvent.h ../../lib/App/common/dataBinder_structures.h
-$(OUTDIR)/servaMediaEncoder.o: ../../lib/App/serva/servaMediaEncoder.cpp ../../lib/App/serva/servaMediaEncoder.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicLIBAV.h ../../lib/App/serva/servaKernel.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicEventHeap.h ../../lib/components/object/objectSystemAnchor.h ../../lib/alg/lgs/detectorStructures.h ../../lib/alg/lgs/detector.h ../../lib/alg/lgs/mask.h ../../lib/alg/generic/md5.h ../../lib/App/common/kernelPrototype.h ../../lib/App/serva/lifeMonitoring.h ../../lib/App/serva/servaRemoteClient.h ../../lib/data/net/netServer.h ../../lib/App/serva/servaMediaEncoder.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicLIBAV.h ../../lib/App/serva/servaSessionManager.h ../../lib/App/common/dataBinder_ReportAux.h ../../lib/components/base/basicEvent.h ../../lib/App/common/serverDataBinder.h ../../lib/App/common/dataBinder_structures.h ../../lib/data/protocol/protocolARGUS_DATA.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicEvent.h ../../lib/App/common/dataBinder_structures.h
-$(OUTDIR)/servaRemoteClient.o: ../../lib/App/serva/servaRemoteClient.cpp ../../lib/App/serva/servaRemoteClient.h ../../lib/data/net/netServer.h ../../lib/App/serva/servaRemoteClientHandler.h ../../lib/data/net/netClientHandler.h ../../lib/data/protocol/protocol.h ../../lib/data/protocol/protocolARGUS_DATA.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicEvent.h ../../lib/App/common/dataBinder_structures.h ../../lib/components/base/basicThread.h ../../lib/App/common/serverMySQL_dataBinder.h ../../lib/App/common/serverDataBinder.h ../../lib/App/common/dataBinder_structures.h ../../lib/data/mysql/mysql_class.h ../../lib/components/base/basicSettingsProvider.h ../../lib/alg/generic/md5.h ../../lib/alg/lgs/mask.h ../../lib/App/serva/servaSessionManager.h ../../lib/App/common/dataBinder_ReportAux.h ../../lib/components/base/basicEvent.h ../../lib/App/common/serverDataBinder.h ../../lib/App/common/dataBinder_structures.h ../../lib/data/protocol/protocolARGUS_DATA.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicEvent.h ../../lib/App/common/dataBinder_structures.h ../../lib/App/serva/servaKernel.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicEventHeap.h ../../lib/components/object/objectSystemAnchor.h ../../lib/alg/lgs/detectorStructures.h ../../lib/alg/lgs/detector.h ../../lib/alg/lgs/mask.h ../../lib/alg/generic/md5.h ../../lib/App/common/kernelPrototype.h ../../lib/App/serva/lifeMonitoring.h ../../lib/App/serva/servaRemoteClient.h ../../lib/data/net/netServer.h ../../lib/App/serva/servaMediaEncoder.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicLIBAV.h ../../lib/App/serva/servaSessionManager.h ../../lib/App/common/dataBinder_ReportAux.h ../../lib/components/base/basicEvent.h ../../lib/App/common/serverDataBinder.h ../../lib/App/common/dataBinder_structures.h ../../lib/data/protocol/protocolARGUS_DATA.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicEvent.h ../../lib/App/common/dataBinder_structures.h
-$(OUTDIR)/servaRemoteClientHandler.o: ../../lib/App/serva/servaRemoteClientHandler.cpp ../../lib/App/serva/servaRemoteClientHandler.h ../../lib/data/net/netClientHandler.h ../../lib/data/protocol/protocol.h ../../lib/data/protocol/protocolARGUS_DATA.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicEvent.h ../../lib/App/common/dataBinder_structures.h ../../lib/components/base/basicThread.h ../../lib/App/common/serverMySQL_dataBinder.h ../../lib/App/common/serverDataBinder.h ../../lib/App/common/dataBinder_structures.h ../../lib/data/mysql/mysql_class.h ../../lib/components/base/basicSettingsProvider.h ../../lib/alg/generic/md5.h ../../lib/alg/lgs/mask.h ../../lib/App/serva/servaSessionManager.h ../../lib/App/common/dataBinder_ReportAux.h ../../lib/components/base/basicEvent.h ../../lib/App/common/serverDataBinder.h ../../lib/App/common/dataBinder_structures.h ../../lib/data/protocol/protocolARGUS_DATA.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicEvent.h ../../lib/App/common/dataBinder_structures.h ../../lib/App/serva/servaRemoteClient.h ../../lib/data/net/netServer.h ../../lib/App/serva/servaKernel.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicEventHeap.h ../../lib/components/object/objectSystemAnchor.h ../../lib/alg/lgs/detectorStructures.h ../../lib/alg/lgs/detector.h ../../lib/alg/lgs/mask.h ../../lib/alg/generic/md5.h ../../lib/App/common/kernelPrototype.h ../../lib/App/serva/lifeMonitoring.h ../../lib/App/serva/servaRemoteClient.h ../../lib/data/net/netServer.h ../../lib/App/serva/servaMediaEncoder.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicLIBAV.h ../../lib/App/serva/servaSessionManager.h ../../lib/App/common/dataBinder_ReportAux.h ../../lib/components/base/basicEvent.h ../../lib/App/common/serverDataBinder.h ../../lib/App/common/dataBinder_structures.h ../../lib/data/protocol/protocolARGUS_DATA.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicEvent.h ../../lib/App/common/dataBinder_structures.h
-$(OUTDIR)/servaScadaManager.o: ../../lib/App/serva/servaScadaManager.cpp
-$(OUTDIR)/servaSessionManager.o: ../../lib/App/serva/servaSessionManager.cpp ../../lib/App/serva/servaSessionManager.h ../../lib/App/common/dataBinder_ReportAux.h ../../lib/components/base/basicEvent.h ../../lib/App/common/serverDataBinder.h ../../lib/App/common/dataBinder_structures.h ../../lib/data/protocol/protocolARGUS_DATA.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicEvent.h ../../lib/App/common/dataBinder_structures.h ../../lib/App/common/serverMySQL_dataBinder.h ../../lib/App/common/serverDataBinder.h ../../lib/App/common/dataBinder_structures.h ../../lib/data/mysql/mysql_class.h ../../lib/components/base/basicSettingsProvider.h ../../lib/alg/generic/md5.h ../../lib/alg/lgs/mask.h
+$(OUTDIR)/protocolARGUS_DATA.o: ../../lib/data/protocol/protocolARGUS_DATA.cpp ../../lib/data/protocol/protocolARGUS_DATA.h ../../lib/components/base/basicFunctionality.h ../../lib/App/common/dataBinder_structures.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/Transform.h
+$(OUTDIR)/servaBackend.o: ../../lib/App/serva/servaBackend.cpp ../../lib/App/serva/servaBackend.h ../../lib/App/common/serverMySQL_dataBinder.h ../../lib/App/common/serverDataBinder.h ../../lib/App/common/dataBinder_structures.h ../../lib/data/mysql/mysql_class.h ../../lib/components/base/basicSettingsProvider.h ../../lib/alg/generic/md5.h ../../lib/alg/lgs/mask.h ../../lib/components/base/basicSettings.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicMemoryOperation.h ../../lib/components/object/objectFileLoggingService.h ../../lib/App/serva/objectMySQLLoggingService.h ../../lib/App/common/serverDataBinder.h ../../lib/App/common/dataBinder_structures.h ../../lib/App/serva/servaKernel.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/Transform.h ../../lib/components/base/basicEventHeap.h ../../lib/components/object/objectSystemAnchor.h ../../lib/alg/lgs/detectorStructures.h ../../lib/alg/lgs/detector.h ../../lib/alg/lgs/mask.h ../../lib/alg/generic/md5.h ../../lib/App/common/kernelPrototype.h ../../lib/App/serva/servaLifeMonitoring.h ../../lib/components/base/basicValidatable.h ../../lib/App/serva/servaRemoteClient.h ../../lib/data/net/netServer.h ../../lib/App/serva/servaMediaEncoder.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicLIBAV.h ../../lib/App/serva/servaSessionManager.h ../../lib/App/common/dataBinder_ReportAux.h ../../lib/App/common/serverDataBinder.h ../../lib/App/common/dataBinder_structures.h ../../lib/data/protocol/protocolARGUS_DATA.h ../../lib/components/base/basicFunctionality.h ../../lib/App/common/dataBinder_structures.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/Transform.h
+$(OUTDIR)/servaKernel.o: ../../lib/App/serva/servaKernel.cpp ../../lib/App/serva/servaKernel.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/Transform.h ../../lib/components/base/basicEventHeap.h ../../lib/components/object/objectSystemAnchor.h ../../lib/alg/lgs/detectorStructures.h ../../lib/alg/lgs/detector.h ../../lib/alg/lgs/mask.h ../../lib/alg/generic/md5.h ../../lib/App/common/kernelPrototype.h ../../lib/App/serva/servaLifeMonitoring.h ../../lib/components/base/basicValidatable.h ../../lib/App/serva/servaRemoteClient.h ../../lib/data/net/netServer.h ../../lib/App/serva/servaMediaEncoder.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicLIBAV.h ../../lib/App/serva/servaSessionManager.h ../../lib/App/common/dataBinder_ReportAux.h ../../lib/App/common/serverDataBinder.h ../../lib/App/common/dataBinder_structures.h ../../lib/data/protocol/protocolARGUS_DATA.h ../../lib/components/base/basicFunctionality.h ../../lib/App/common/dataBinder_structures.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/Transform.h ../../lib/App/common/serverMySQL_dataBinder.h ../../lib/App/common/serverDataBinder.h ../../lib/App/common/dataBinder_structures.h ../../lib/data/mysql/mysql_class.h ../../lib/components/base/basicSettingsProvider.h ../../lib/alg/generic/md5.h ../../lib/alg/lgs/mask.h ../../lib/App/serva/servaModBusManager.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicValidatable.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicEventHandler.h ../../lib/components/base/basicLogCollection.h ../../lib/App/common/serverDataBinder.h ../../lib/App/common/dataBinder_structures.h
+$(OUTDIR)/servaKernelToolKit.o: ../../lib/App/serva/servaKernelToolKit.cpp ../../lib/App/serva/servaKernel.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/Transform.h ../../lib/components/base/basicEventHeap.h ../../lib/components/object/objectSystemAnchor.h ../../lib/alg/lgs/detectorStructures.h ../../lib/alg/lgs/detector.h ../../lib/alg/lgs/mask.h ../../lib/alg/generic/md5.h ../../lib/App/common/kernelPrototype.h ../../lib/App/serva/servaLifeMonitoring.h ../../lib/components/base/basicValidatable.h ../../lib/App/serva/servaRemoteClient.h ../../lib/data/net/netServer.h ../../lib/App/serva/servaMediaEncoder.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicLIBAV.h ../../lib/App/serva/servaSessionManager.h ../../lib/App/common/dataBinder_ReportAux.h ../../lib/App/common/serverDataBinder.h ../../lib/App/common/dataBinder_structures.h ../../lib/data/protocol/protocolARGUS_DATA.h ../../lib/components/base/basicFunctionality.h ../../lib/App/common/dataBinder_structures.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/Transform.h
+$(OUTDIR)/servaLifeMonitoring.o: ../../lib/App/serva/servaLifeMonitoring.cpp ../../lib/App/serva/servaLifeMonitoring.h ../../lib/components/base/basicValidatable.h
+$(OUTDIR)/servaMediaEncoder.o: ../../lib/App/serva/servaMediaEncoder.cpp ../../lib/App/serva/servaMediaEncoder.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicLIBAV.h ../../lib/App/serva/servaKernel.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/Transform.h ../../lib/components/base/basicEventHeap.h ../../lib/components/object/objectSystemAnchor.h ../../lib/alg/lgs/detectorStructures.h ../../lib/alg/lgs/detector.h ../../lib/alg/lgs/mask.h ../../lib/alg/generic/md5.h ../../lib/App/common/kernelPrototype.h ../../lib/App/serva/servaLifeMonitoring.h ../../lib/components/base/basicValidatable.h ../../lib/App/serva/servaRemoteClient.h ../../lib/data/net/netServer.h ../../lib/App/serva/servaMediaEncoder.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicLIBAV.h ../../lib/App/serva/servaSessionManager.h ../../lib/App/common/dataBinder_ReportAux.h ../../lib/App/common/serverDataBinder.h ../../lib/App/common/dataBinder_structures.h ../../lib/data/protocol/protocolARGUS_DATA.h ../../lib/components/base/basicFunctionality.h ../../lib/App/common/dataBinder_structures.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/Transform.h
+$(OUTDIR)/servaModBusManager.o: ../../lib/App/serva/servaModBusManager.cpp ../../lib/App/serva/servaModBusManager.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicValidatable.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicEventHandler.h ../../lib/components/base/basicLogCollection.h ../../lib/App/common/serverDataBinder.h ../../lib/App/common/dataBinder_structures.h ../../lib/App/serva/servaKernel.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/Transform.h ../../lib/components/base/basicEventHeap.h ../../lib/components/object/objectSystemAnchor.h ../../lib/alg/lgs/detectorStructures.h ../../lib/alg/lgs/detector.h ../../lib/alg/lgs/mask.h ../../lib/alg/generic/md5.h ../../lib/App/common/kernelPrototype.h ../../lib/App/serva/servaLifeMonitoring.h ../../lib/components/base/basicValidatable.h ../../lib/App/serva/servaRemoteClient.h ../../lib/data/net/netServer.h ../../lib/App/serva/servaMediaEncoder.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicLIBAV.h ../../lib/App/serva/servaSessionManager.h ../../lib/App/common/dataBinder_ReportAux.h ../../lib/App/common/serverDataBinder.h ../../lib/App/common/dataBinder_structures.h ../../lib/data/protocol/protocolARGUS_DATA.h ../../lib/components/base/basicFunctionality.h ../../lib/App/common/dataBinder_structures.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/Transform.h
+$(OUTDIR)/servaRemoteClient.o: ../../lib/App/serva/servaRemoteClient.cpp ../../lib/App/serva/servaRemoteClient.h ../../lib/data/net/netServer.h ../../lib/App/serva/servaRemoteClientHandler.h ../../lib/data/net/netClientHandler.h ../../lib/data/protocol/protocol.h ../../lib/data/protocol/protocolARGUS_DATA.h ../../lib/components/base/basicFunctionality.h ../../lib/App/common/dataBinder_structures.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/Transform.h ../../lib/components/base/basicThread.h ../../lib/App/common/serverMySQL_dataBinder.h ../../lib/App/common/serverDataBinder.h ../../lib/App/common/dataBinder_structures.h ../../lib/data/mysql/mysql_class.h ../../lib/components/base/basicSettingsProvider.h ../../lib/alg/generic/md5.h ../../lib/alg/lgs/mask.h ../../lib/App/serva/servaSessionManager.h ../../lib/App/common/dataBinder_ReportAux.h ../../lib/App/common/serverDataBinder.h ../../lib/App/common/dataBinder_structures.h ../../lib/data/protocol/protocolARGUS_DATA.h ../../lib/components/base/basicFunctionality.h ../../lib/App/common/dataBinder_structures.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/Transform.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/Transform.h ../../lib/components/base/basicEventHeap.h ../../lib/App/serva/servaKernel.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/Transform.h ../../lib/components/base/basicEventHeap.h ../../lib/components/object/objectSystemAnchor.h ../../lib/alg/lgs/detectorStructures.h ../../lib/alg/lgs/detector.h ../../lib/alg/lgs/mask.h ../../lib/alg/generic/md5.h ../../lib/App/common/kernelPrototype.h ../../lib/App/serva/servaLifeMonitoring.h ../../lib/components/base/basicValidatable.h ../../lib/App/serva/servaRemoteClient.h ../../lib/data/net/netServer.h ../../lib/App/serva/servaMediaEncoder.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicLIBAV.h ../../lib/App/serva/servaSessionManager.h ../../lib/App/common/dataBinder_ReportAux.h ../../lib/App/common/serverDataBinder.h ../../lib/App/common/dataBinder_structures.h ../../lib/data/protocol/protocolARGUS_DATA.h ../../lib/components/base/basicFunctionality.h ../../lib/App/common/dataBinder_structures.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/Transform.h
+$(OUTDIR)/servaRemoteClientHandler.o: ../../lib/App/serva/servaRemoteClientHandler.cpp ../../lib/App/serva/servaRemoteClientHandler.h ../../lib/data/net/netClientHandler.h ../../lib/data/protocol/protocol.h ../../lib/data/protocol/protocolARGUS_DATA.h ../../lib/components/base/basicFunctionality.h ../../lib/App/common/dataBinder_structures.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/Transform.h ../../lib/components/base/basicThread.h ../../lib/App/common/serverMySQL_dataBinder.h ../../lib/App/common/serverDataBinder.h ../../lib/App/common/dataBinder_structures.h ../../lib/data/mysql/mysql_class.h ../../lib/components/base/basicSettingsProvider.h ../../lib/alg/generic/md5.h ../../lib/alg/lgs/mask.h ../../lib/App/serva/servaSessionManager.h ../../lib/App/common/dataBinder_ReportAux.h ../../lib/App/common/serverDataBinder.h ../../lib/App/common/dataBinder_structures.h ../../lib/data/protocol/protocolARGUS_DATA.h ../../lib/components/base/basicFunctionality.h ../../lib/App/common/dataBinder_structures.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/Transform.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/Transform.h ../../lib/components/base/basicEventHeap.h ../../lib/App/serva/servaRemoteClient.h ../../lib/data/net/netServer.h ../../lib/App/serva/servaKernel.h ../../lib/components/base/basicThread.h ../../lib/components/base/basicSettingsProvider.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/Transform.h ../../lib/components/base/basicEventHeap.h ../../lib/components/object/objectSystemAnchor.h ../../lib/alg/lgs/detectorStructures.h ../../lib/alg/lgs/detector.h ../../lib/alg/lgs/mask.h ../../lib/alg/generic/md5.h ../../lib/App/common/kernelPrototype.h ../../lib/App/serva/servaLifeMonitoring.h ../../lib/components/base/basicValidatable.h ../../lib/App/serva/servaRemoteClient.h ../../lib/data/net/netServer.h ../../lib/App/serva/servaMediaEncoder.h ../../lib/components/base/basicMutex.h ../../lib/components/base/basicLIBAV.h ../../lib/App/serva/servaSessionManager.h ../../lib/App/common/dataBinder_ReportAux.h ../../lib/App/common/serverDataBinder.h ../../lib/App/common/dataBinder_structures.h ../../lib/data/protocol/protocolARGUS_DATA.h ../../lib/components/base/basicFunctionality.h ../../lib/App/common/dataBinder_structures.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/Transform.h
+$(OUTDIR)/servaSessionManager.o: ../../lib/App/serva/servaSessionManager.cpp ../../lib/App/serva/servaSessionManager.h ../../lib/App/common/dataBinder_ReportAux.h ../../lib/App/common/serverDataBinder.h ../../lib/App/common/dataBinder_structures.h ../../lib/data/protocol/protocolARGUS_DATA.h ../../lib/components/base/basicFunctionality.h ../../lib/App/common/dataBinder_structures.h ../../lib/components/base/basicEvent.h ../../lib/components/base/basicTypes.h ../../lib/components/base/basicPosition.h ../../lib/alg/generic/Transform.h ../../lib/App/common/serverMySQL_dataBinder.h ../../lib/App/common/serverDataBinder.h ../../lib/App/common/dataBinder_structures.h ../../lib/data/mysql/mysql_class.h ../../lib/components/base/basicSettingsProvider.h ../../lib/alg/generic/md5.h ../../lib/alg/lgs/mask.h ../../lib/components/base/basicEventHeap.h
$(OUTDIR)/serverDataBinder.o: ../../lib/App/common/serverDataBinder.cpp ../../lib/App/common/serverDataBinder.h ../../lib/App/common/dataBinder_structures.h
$(OUTDIR)/serverMySQL_dataBinder.o: ../../lib/App/common/serverMySQL_dataBinder.cpp ../../lib/App/common/serverMySQL_dataBinder.h ../../lib/App/common/serverDataBinder.h ../../lib/App/common/dataBinder_structures.h ../../lib/data/mysql/mysql_class.h ../../lib/components/base/basicSettingsProvider.h ../../lib/alg/generic/md5.h ../../lib/alg/lgs/mask.h
$(OUTDIR)/serverPort.o: ../../lib/data/net/serverPort.cpp ../../lib/data/net/serverPort.h
diff --git a/lib/App/common/SQLite_dataBinder.cpp b/lib/App/common/SQLite_dataBinder.cpp
index 31443872..35bb60fd 100644
--- a/lib/App/common/SQLite_dataBinder.cpp
+++ b/lib/App/common/SQLite_dataBinder.cpp
@@ -2973,7 +2973,7 @@ DBC_SITE_DATA *sqliteDBC::getSiteData( uint32_t ID ){
};
it = cArr->find("remote_backup_ip");
if( it != cArr->end() ){
- sprintf( tVal->remote_ip, it->second.c_str() );
+ sprintf( tVal->remote_backup_ip, it->second.c_str() );
};
it = cArr->find("remote_backup_port");
if( it != cArr->end() ){
@@ -4299,6 +4299,10 @@ DBC_CAM_DATA *sqliteDBC::getCamData( uint32_t ID ){
if( it != cArr->end() ){
tVal->prefered_events_only = (bool) atoi( it->second.c_str() );
};
+ it = cArr->find("flip_mode");
+ if( it != cArr->end() ){
+ tVal->flip_mode = atoi( it->second.c_str() );
+ };
};
};
};
diff --git a/lib/App/common/dataBinder.h b/lib/App/common/dataBinder.h
index 4200b027..7afcc767 100644
--- a/lib/App/common/dataBinder.h
+++ b/lib/App/common/dataBinder.h
@@ -3,6 +3,7 @@
#include "dataBinder_structures.h"
#include "dataBinder_ReportAux.h"
+#include "../../components/base/basicEvent.h"
class dataBinder{
protected:
diff --git a/lib/App/common/dataBinder_structures.h b/lib/App/common/dataBinder_structures.h
index 375afb22..849a5b4a 100644
--- a/lib/App/common/dataBinder_structures.h
+++ b/lib/App/common/dataBinder_structures.h
@@ -238,6 +238,7 @@ typedef struct S_DBC_CAM_DATA{
char home_token[33];
bool eco_ir;
bool prefered_events_only;
+ uint8_t flip_mode;
}DBC_CAM_DATA;
typedef struct S_DBC_NETWORK_DATA{
@@ -354,6 +355,9 @@ typedef struct S_DBC_RESOURCE_DATA{
#define CMD_KRNL_REPLACE_DATABASE 129
#define CMD_KRNL_DELNODE 240
#define CMD_KRNL_RESET_SITE 245
+#define CMD_KRNL_PURGE_SESSION 246
+#define CMD_KRNL_SET_SESSION_HZL 247
+#define CMD_KRNL_TEST_MODBUS 248
#define CMD_KRNL_UPDATE_IDENT 249
#define CMD_KRNL_RESTART 250
#define CMD_KRNL_PNP 251
@@ -901,18 +905,10 @@ typedef struct S_DBC_SERVA_MEDIA_ENCODER_SETTINGS{
typedef struct S_DBC_RPC_WEB_CMD{
uint64_t id;
- uint32_t aux_id;
+ uint64_t aux_id;
uint8_t status;
uint8_t cmd;
char param[65];
}DBC_RPC_WEB_CMD;
-typedef struct S_DBC_SERVA_CONFIG{
- uint16_t encoderLimit;
- uint16_t historyDaysLimit;
- uint8_t historyAutoDeleteLimit;
- uint8_t historyPreserveFreeSpacePerc;
- uint32_t historyPreserveFreeSpaceMB;
-}DBC_SERVA_CONFIG;
-
#endif
\ No newline at end of file
diff --git a/lib/App/common/deviceNode.h b/lib/App/common/deviceNode.h
index e972f5be..e8e392f8 100644
--- a/lib/App/common/deviceNode.h
+++ b/lib/App/common/deviceNode.h
@@ -3,6 +3,7 @@
#include "../../components/base/basicEngine.h"
#include "cmdNodeConveyor.h"
+#include "../../components/base/basicEvent.h"
class deviceNode: public cmdNodeConveyor, public basicEngine{
private:
diff --git a/lib/App/common/deviceNodeCamera.cpp b/lib/App/common/deviceNodeCamera.cpp
index 5d495e21..1c190e19 100644
--- a/lib/App/common/deviceNodeCamera.cpp
+++ b/lib/App/common/deviceNodeCamera.cpp
@@ -96,7 +96,7 @@ deviceNodeCamera::deviceNodeCamera( uint32_t NodeID ): deviceNode( NodeID ), bas
m_bCameraOnHomePosition = false;
m_tTimeTSeconds = 0;
m_pProtocol = NULL;
- m_pTransport = NULL;
+ //m_pTransport = NULL;
m_pCurrentROI = NULL;
m_nRealFrameWidth = 640;
//m_bState = 0;
@@ -125,7 +125,7 @@ deviceNodeCamera::deviceNodeCamera( DBC_NODE_DATA *Data ): deviceNode( Data ),
m_bCameraOnHomePosition = false;
m_tTimeTSeconds = 0;
m_pProtocol = NULL;
- m_pTransport = NULL;
+ //m_pTransport = NULL;
m_pCurrentROI = NULL;
m_nRealFrameWidth = 640;
//m_bState = 0;
@@ -150,7 +150,7 @@ deviceNodeCamera::~deviceNodeCamera(){
//m_mQPROTECTOR.unlock();
waitThreadEnd( true );
LOG("Thread Del OK");
- if( m_pTransport!= NULL ) {
+ /*if( m_pTransport!= NULL ) {
if( m_sCamData.uart_id ) {
DBC_UART_DATA *tData = NULL;
tData = m_pDBC->getUartData( m_sCamData.uart_id );
@@ -166,7 +166,8 @@ deviceNodeCamera::~deviceNodeCamera(){
};
};
};
- LOG("Transport Del OK");
+ LOG("Transport Del OK");
+ */
if( m_pProtocol != NULL ) {
switch( m_sCamData.protocol ) {
case CAM_CTRL_PROTO_VISCA:
@@ -269,8 +270,9 @@ void deviceNodeCamera::updateOpticalParameters( uint16_t frame_width, uint16_t f
};
bool deviceNodeCamera::create(){
+ if ( m_bThreadStatus == TH_WORKING ) return true;
- setWM( CAM_WS_INIT );
+ setWM(CAM_WS_INIT);
if( m_sNodeData.aux_id == 0 ) return false;
@@ -331,11 +333,22 @@ bool deviceNodeCamera::create(){
sprintf( tB, "Orientation: x:%.3f y:%.3f z:%.3f", m_oPosition.getRotX_deg(), m_oPosition.getRotY_deg(), m_oPosition.getRotZ_deg() );
LOG( tB );
#endif
-
if( m_pProtocol != NULL ){
LOG_ERROR("Cannot Start: Service Already Running!");
return false;
};
+#ifdef CAM_POST_INIT
+ if( ( m_sCamData.type == ARGUS_IP_PRESET_CAMERA ) || ( m_sCamData.type == ARGUS_ANALOG_PRESET_CAMERA ) ) m_bNoAbsPositionning = true;
+ if( m_sCamData.protocol == 0 ) {
+ m_bCameraIsStatic = true;
+ m_bSkeepPositioningWait = true;
+ m_sCamData.online = true;
+ m_pDBC->updateCamOnlineStatus( m_sCamData.id, m_sCamData.online );
+ return m_sCamData.online;
+ };
+ m_pDBC->updateCamOnlineStatus( m_sCamData.id, m_sCamData.online );
+ return init();
+#else //!CAM_POST_INIT
switch( m_sCamData.protocol ){
case CAM_CTRL_PROTO_VISCA: {
#ifdef DEBUG
@@ -429,7 +442,7 @@ bool deviceNodeCamera::create(){
break;
};
case CAM_CTRL_PROTO_ONVIF:{
-#ifdef DEBUG
+#ifdef DEBUG_EXTRA
LOG("ONVIF");
#endif
//m_pProtocol = (protocolPTZ *) new protocolPTZ_ONVIF( m_sCamData.ip, m_sCamData.port, m_sCamData.username, m_sCamData.password, m_sCamData.auth_mode );
@@ -444,7 +457,7 @@ bool deviceNodeCamera::create(){
} else {
m_pProtocol = (protocolPTZ *)new protocolPTZ_ONVIF(m_sCamData.onvif_ctrl, m_sCamData.username, m_sCamData.password, m_sCamData.auth_mode);
};
-#ifdef DEBUG
+#ifdef DEBUG_EXTRA
LOG("ONVIF-END");
#endif
if( m_pProtocol != NULL ) {
@@ -453,7 +466,7 @@ bool deviceNodeCamera::create(){
delete( (protocolPTZ_ONVIF*) m_pProtocol );
m_pProtocol = NULL;
};
-#ifdef DEBUG
+#ifdef DEBUG_EXTRA
LOG("PROTO CREATE DONE");
#endif
};
@@ -467,14 +480,14 @@ bool deviceNodeCamera::create(){
};
//Check - No ABS Movement!
if( ( m_sCamData.type == ARGUS_IP_PRESET_CAMERA ) || ( m_sCamData.type == ARGUS_ANALOG_PRESET_CAMERA ) ) m_bNoAbsPositionning = true;
- if (m_pProtocol == NULL) {
+ if( m_pProtocol == NULL ){
if( m_sCamData.protocol == 0 ) {
m_bCameraIsStatic = true;
m_bSkeepPositioningWait = true;
m_sCamData.online = true;
} else LOG_ERROR("No Proto Created!");
} else {
-#ifdef DEBUG
+#ifdef DEBUG_EXTRA
LOG("Proto is OK");
#endif
//Load Presets only if we have protocol
@@ -483,7 +496,7 @@ bool deviceNodeCamera::create(){
mojoKernel *tKRNL = mojoKernel::getInstance();
if( tKRNL ) {
m_bSkeepPositioningWait = (( tKRNL->getMediaMode() & EVE_OUTPUT_VIDEO ) == EVE_OUTPUT_VIDEO );
-#ifdef DEBUG
+#ifdef DEBUG_EXTRA
char ttTT[128];
sprintf( ttTT, "Kernel Media Mode:%d", tKRNL->getMediaMode() );
LOG( ttTT );
@@ -500,6 +513,7 @@ bool deviceNodeCamera::create(){
};
m_pDBC->updateCamOnlineStatus( m_sCamData.id, m_sCamData.online );
return m_sCamData.online;
+#endif //!CAM_POST_INIT
};
@@ -514,16 +528,32 @@ bool deviceNodeCamera::relativeMove( float PanSPD, float TiltSPD, float ZoomSPD
uint32_t MoveMatrix = 0;
if( PanSPD != .0f ){
if( PanSPD > 0 ) {
- MoveMatrix |= PTZ_DRIVE_PAN_RIGHT;
+ if ( m_sCamData.flip_mode == 0 || m_sCamData.flip_mode == 2 ) {
+ MoveMatrix |= PTZ_DRIVE_PAN_RIGHT;
+ } else {
+ MoveMatrix |= PTZ_DRIVE_PAN_LEFT;
+ };
} else {
- MoveMatrix |= PTZ_DRIVE_PAN_LEFT;
+ if ( m_sCamData.flip_mode == 0 || m_sCamData.flip_mode == 2 ) {
+ MoveMatrix |= PTZ_DRIVE_PAN_LEFT;
+ } else {
+ MoveMatrix |= PTZ_DRIVE_PAN_RIGHT;
+ };
};
};
if( TiltSPD != .0f ){
if( TiltSPD > 0 ) {
- MoveMatrix |= PTZ_DRIVE_TILT_UP;
+ if ( m_sCamData.flip_mode == 0 || m_sCamData.flip_mode == 1 ) {
+ MoveMatrix |= PTZ_DRIVE_TILT_UP;
+ } else {
+ MoveMatrix |= PTZ_DRIVE_TILT_DOWN;
+ };
} else {
- MoveMatrix |= PTZ_DRIVE_TILT_DOWN;
+ if ( m_sCamData.flip_mode == 0 || m_sCamData.flip_mode == 1 ) {
+ MoveMatrix |= PTZ_DRIVE_TILT_DOWN;
+ } else {
+ MoveMatrix |= PTZ_DRIVE_TILT_UP;
+ };
};
};
if( ZoomSPD != .0f ){
@@ -843,6 +873,16 @@ bool deviceNodeCamera::absoluteMove( uint32_t TargetRefID, C3D_ORIENT_ONVIF O ){
return false;
};
+uint8_t deviceNodeCamera::getPtzStatus(){
+ if ( m_sCamData.protocol == 0 ) return 1;
+ if ( getWM() > CAM_WS_INIT ) return 1;
+ return 0;
+};
+
+uint8_t deviceNodeCamera::getStreamStatus(){
+ return 1;
+};
+
void deviceNodeCamera::m_fThreadProc( void ){
DBC_PUSHED_CMD * PUSHED = NULL;
m_bThreadStatus = TH_WORKING;
@@ -863,6 +903,179 @@ void deviceNodeCamera::m_fThreadProc( void ){
switch( tState ) {
case CAM_WS_INIT:{
+ if ( m_pProtocol != NULL ) {
+ switch( m_sCamData.protocol ) {
+ case CAM_CTRL_PROTO_VISCA:
+ delete( (protocolPTZ_VISCA *) m_pProtocol );
+ break;
+ case CAM_CTRL_PROTO_PELCO:
+ delete( (protocolPTZ_PELCO *) m_pProtocol );
+ break;
+ case CAM_CTRL_PROTO_ONVIF:
+ delete( (protocolPTZ_ONVIF *) m_pProtocol );
+ break;
+ default:
+ delete( m_pProtocol );
+ };
+ m_pProtocol = NULL;
+ m_sCamData.online = false;
+ };
+ switch( m_sCamData.protocol ){
+ case CAM_CTRL_PROTO_VISCA: {
+ #ifdef DEBUG
+ LOG("VISCA");
+ #endif
+ m_pProtocol = (protocolPTZ *) new protocolPTZ_VISCA( m_sCamData.protocol_aux );
+ if( m_pProtocol!= NULL ) {
+ basicTransport *tTransport = NULL;
+ hardwareManager *tHM = hardwareManager::getInstance();
+ if( tHM ){
+ hardwareResource *tRES = tHM->requestResource( HARDWARE_PROVIDER_SERIAL, m_sCamData.uart_id );
+ if( tRES != NULL ) {
+ if( tRES->isValid()) {
+ tTransport = static_cast(static_cast(tRES));
+ if( m_pProtocol->setTransport( tTransport )){
+ if( !m_pProtocol->create() ){
+ LOG_ERROR("Protocol <<< Create >>> Failure!");
+ };
+ } else {
+ LOG_ERROR("Binding Port Failure!");
+ };
+ };
+ #ifdef DEBUG
+ } else {
+ LOG("HWM Has No UART PORT!");
+ #endif
+ };
+ #ifdef DEBUG
+ } else {
+ LOG_ERROR("Can not get Hardware Manager!");
+ #endif
+ };
+ if( tTransport!= NULL ) {
+ LOG( "Bind Transport Port!" );
+ } else {
+ LOG_ERROR("Transport Creation Failure!");
+ delete( ( protocolPTZ_VISCA * )m_pProtocol );
+ m_pProtocol = NULL;
+ };
+ #ifdef DEBUG
+ } else {
+ LOG_ERROR("Protocol Creation failure!");
+ #endif
+ };
+ break;
+ };
+ case CAM_CTRL_PROTO_PELCO:{
+ #ifdef DEBUG
+ LOG("PELCO");
+ #endif
+ m_pProtocol = (protocolPTZ *) new protocolPTZ_PELCO( m_sCamData.protocol_aux );
+
+ if( m_pProtocol!= NULL ) {
+ basicTransport *tTransport = NULL;
+ hardwareManager *tHM = hardwareManager::getInstance();
+ if ( tHM ) {
+ hardwareResource * tRES = tHM->requestResource( HARDWARE_PROVIDER_SERIAL, m_sCamData.uart_id );
+ if( tRES != NULL ) {
+ if( tRES->isValid()) {
+ tTransport = static_cast(static_cast(tRES));
+ if( m_pProtocol->setTransport( tTransport )){
+ if( !m_pProtocol->create() ){
+ LOG_ERROR("Protocol <<< Create >>> Failure!");
+ };
+ } else {
+ LOG_ERROR("Binding Port Failure!");
+ };
+ };
+ #ifdef DEBUG
+ } else {
+ LOG("HWM Has No UART PORT!");
+ #endif
+ };
+ #ifdef DEBUG
+ } else {
+ LOG_ERROR("Can not get Hardware Manager!");
+ #endif
+ };
+ if( tTransport!= NULL ) {
+ LOG( "Bind Transport Port!" );
+ } else {
+ LOG_ERROR("Transport Creation Failure!");
+ delete( ( protocolPTZ_PELCO * )m_pProtocol );
+ m_pProtocol = NULL;
+ };
+ #ifdef DEBUG
+ } else {
+ LOG_ERROR("Protocol Creation failure!");
+ #endif
+ };
+ break;
+ };
+ case CAM_CTRL_PROTO_ONVIF:{
+ #ifdef DEBUG_EXTRA
+ LOG("ONVIF");
+ #endif
+ //m_pProtocol = (protocolPTZ *) new protocolPTZ_ONVIF( m_sCamData.ip, m_sCamData.port, m_sCamData.username, m_sCamData.password, m_sCamData.auth_mode );
+ if( strstr( m_sCamData.onvif_ctrl, "http" ) == NULL ) {
+ char tURI[256];
+ if ( m_sCamData.port ) {
+ sprintf(tURI, "http://%s:%d%s", m_sCamData.ip, m_sCamData.port, m_sCamData.onvif_ctrl);
+ } else {
+ sprintf(tURI, "http://%s%s", m_sCamData.ip, m_sCamData.onvif_ctrl);
+ };
+ m_pProtocol = (protocolPTZ *)new protocolPTZ_ONVIF( tURI, m_sCamData.username, m_sCamData.password, m_sCamData.auth_mode);
+ } else {
+ m_pProtocol = (protocolPTZ *)new protocolPTZ_ONVIF(m_sCamData.onvif_ctrl, m_sCamData.username, m_sCamData.password, m_sCamData.auth_mode);
+ };
+ #ifdef DEBUG_EXTRA
+ LOG("ONVIF-END");
+ #endif
+ if( m_pProtocol != NULL ) {
+ if( !m_pProtocol->create() ) {
+ LOG_ERROR("Error Creating Proto!");
+ delete( (protocolPTZ_ONVIF*) m_pProtocol );
+ m_pProtocol = NULL;
+ };
+ #ifdef DEBUG_EXTRA
+ LOG("PROTO CREATE DONE");
+ #endif
+ };
+ break;
+ };
+ default:{
+ #ifdef DEBUG
+ LOG("Camera Has no defined control protocol");
+ #endif
+ };
+ };
+ if ( m_pProtocol != NULL ) {
+ //Load Presets only if we have protocol
+ load_presets();
+
+ mojoKernel *tKRNL = mojoKernel::getInstance();
+ if( tKRNL ) {
+ m_bSkeepPositioningWait = (( tKRNL->getMediaMode() & EVE_OUTPUT_VIDEO ) == EVE_OUTPUT_VIDEO );
+ #ifdef DEBUG_EXTRA
+ char ttTT[128];
+ sprintf( ttTT, "Kernel Media Mode:%d", tKRNL->getMediaMode() );
+ LOG( ttTT );
+ if ( m_bSkeepPositioningWait ) {
+ LOG("Camera No Wait On Pos!");
+ } else {
+ LOG("Camera Will Wait On Pos!");
+ };
+ #endif
+ } else {
+ LOG_ERROR("No Kernel Instance!");
+ };
+ m_sCamData.online = true;
+ setWM(CAM_WS_POWER_INIT);
+ };
+ m_pDBC->updateCamOnlineStatus( m_sCamData.id, m_sCamData.online );
+ break;
+ };
+ case CAM_WS_POWER_INIT:{
#ifdef DEBUG
LOG("Init Camera - PowerMode");
#endif
diff --git a/lib/App/common/deviceNodeCamera.h b/lib/App/common/deviceNodeCamera.h
index f5f28d55..97c3cb57 100644
--- a/lib/App/common/deviceNodeCamera.h
+++ b/lib/App/common/deviceNodeCamera.h
@@ -30,6 +30,8 @@
//ffmpeg -i input.mp4 -af loudnorm=I=-23:LRA=7:tp=-2:print_format=json -f null -
//ffmpeg -i input.mp4 -af loudnorm=I=-23:LRA=7:tp=-2:measured_I=-30:measured_LRA=1.1:measured_tp=-11 04:measured_thresh=-40.21:offset=-0.47 -ar 48k -y output.mp4
+#define CAM_POST_INIT
+
#define CAM_CTRL_PROTO_VISCA 1
#define CAM_CTRL_PROTO_PELCO 2
#define CAM_CTRL_PROTO_ONVIF 3
@@ -75,10 +77,11 @@ typedef std::queue CAM_PTZ_CMD_QUEUE;
typedef enum E_CAM_WORKING_STATE{
CAM_WS_INIT = 0,
- CAM_WS_WHITE_BALLANCE = 1,
- CAM_WS_BACKLIGHT = 2,
- CAM_WS_AUTO_FOCUS = 3,
- CAM_WS_INIT_GO_HOME = 4,
+ CAM_WS_POWER_INIT = 1,
+ CAM_WS_WHITE_BALLANCE = 2,
+ CAM_WS_BACKLIGHT = 3,
+ CAM_WS_AUTO_FOCUS = 4,
+ CAM_WS_INIT_GO_HOME = 5,
CAM_WS_AUTOMATED_MOVE = 10,
CAM_WS_STOP_MOVE = 11,
CAM_WS_GO_ABS_POSITION = 12,
@@ -149,7 +152,7 @@ class deviceNodeCamera: public deviceNode, public basicThread {
float m_fMaxVFov;
protocolPTZ * m_pProtocol;
- basicTransport * m_pTransport;
+ //basicTransport * m_pTransport;
CAM_TASK_QUEUE m_qCAM_TASK;
basicMutex m_mQPROTECTOR;
@@ -229,7 +232,6 @@ class deviceNodeCamera: public deviceNode, public basicThread {
//void setBusy( bool Status );
bool connectToStream( uint32_t id );
bool disconnectFromStream( void );
- bool validateStream( void );
CAM_TASK * fetchCamTask( void );
bool pushCamTask( CAM_TASK * );
virtual void m_fThreadProc( void );
@@ -239,8 +241,13 @@ class deviceNodeCamera: public deviceNode, public basicThread {
virtual ~deviceNodeCamera();
bool create();
virtual bool validate();
+ virtual bool validateStream( void );
bool setNoPositionWait( bool FL = true );
+ virtual uint8_t getCamStatus(){ return (uint8_t) m_sCamData.online;};
uint32_t getCamStream() { return m_sCamData.stream_id; };
+ virtual uint8_t getFlipMode(){ return m_sCamData.flip_mode;};
+ virtual uint8_t getPtzStatus();
+ virtual uint8_t getStreamStatus();
};
typedef std::vector vectorNodeCameras;
diff --git a/lib/App/common/deviceNodeFactory.cpp b/lib/App/common/deviceNodeFactory.cpp
index 97c3e083..49bf605a 100644
--- a/lib/App/common/deviceNodeFactory.cpp
+++ b/lib/App/common/deviceNodeFactory.cpp
@@ -615,15 +615,15 @@ uint32_t deviceNodeFactory::getNodesCount( ARGUS_NODE_TYPE type ){
uint32_t deviceNodeFactory::fetchNodes( ARGUS_NODE_TYPE type, deviceNode **&RA ){
uint32_t RetVal = 0;
if( RA == NULL ) {
- RetVal = getNodesCount( type );
- if( RetVal > 0 ) {
- RA = (deviceNode **) calloc( RetVal, sizeof(deviceNode *));
+ uint32_t cnt = getNodesCount( type );
+ if( cnt > 0 ) {
+ RA = (deviceNode **) calloc( cnt, sizeof(deviceNode *));
if( RA == NULL ) return 0;
- uint32_t cnt = 0;
+ //memset( RA, 0, cnt * sizeof(deviceNode *) );
for( vectorDeviceNodes::iterator index = m_vDeviceNodes.begin(); index < m_vDeviceNodes.end(); index++ ) {
if( (*index)->getNodeType() == type ) {
- RA[cnt] = (*index);
- cnt++;
+ RA[RetVal] = (*index);
+ RetVal++;
};
};
};
diff --git a/lib/App/common/deviceNodeSensor.cpp b/lib/App/common/deviceNodeSensor.cpp
index cd8fbf03..a19be371 100644
--- a/lib/App/common/deviceNodeSensor.cpp
+++ b/lib/App/common/deviceNodeSensor.cpp
@@ -932,7 +932,9 @@ void deviceNodeSensor::startWaitDeviceOnline( LRF_WORK_MODE wm, LRF_WORK_STAGE s
m_SP_STAGE = stg;
setWM( LRF_WM_WAIT_ONLINE_SPECIAL );
};
-
+uint8_t deviceNodeSensor::getSensStatus(){
+ return m_sLRF_DATA.data_status;
+};
void deviceNodeSensor::updateDataStatus( uint8_t ds, uint8_t ns ){
if ( m_pDBC == NULL ) return;
if ( m_sNodeData.node_id ) {
diff --git a/lib/App/common/deviceNodeSensor.h b/lib/App/common/deviceNodeSensor.h
index 85bb349c..f9cbd83c 100644
--- a/lib/App/common/deviceNodeSensor.h
+++ b/lib/App/common/deviceNodeSensor.h
@@ -243,7 +243,8 @@ class deviceNodeSensor: public deviceNode, public basicThread{
explicit deviceNodeSensor( DBC_NODE_DATA *Data );
virtual ~deviceNodeSensor();
virtual void simulateTarget( void ){};
- virtual bool validate();
+ virtual bool validate();
+ virtual uint8_t getSensStatus();
};
diff --git a/lib/App/common/hardwareResourceSerialProvider.cpp b/lib/App/common/hardwareResourceSerialProvider.cpp
index d8fb9fec..b2393cfe 100644
--- a/lib/App/common/hardwareResourceSerialProvider.cpp
+++ b/lib/App/common/hardwareResourceSerialProvider.cpp
@@ -80,23 +80,6 @@ bool hardwareResourceSerialProvider::create( void ){
return m_bValid;
};
-// Calculating the Check Sum
-unsigned short checksum(void *b, int len){
- unsigned short *buf = (unsigned short *) b;
- unsigned int sum=0;
- unsigned short result;
-
- for ( sum = 0; len > 1; len -= 2 )
- sum += *buf++;
- if ( len == 1 )
- sum += *(unsigned char*)buf;
- sum = (sum >> 16) + (sum & 0xFFFF);
- sum += (sum >> 16);
- result = ~sum;
- return result;
-}
-
-
bool hardwareResourceSerialProvider::validate( void ){
if( m_pDBC != NULL ){
DBC_UART_DATA *tDATA = m_pDBC->getUartData(m_sResourceSettings.aux_id);
@@ -168,106 +151,9 @@ bool hardwareResourceSerialProvider::validate( void ){
return m_bValid;
};
-#include
-// Define the Packet Constants
-// ping packet size
-#define PING_PKT_S 64
-
-// Automatic port number
-#define PORT_NO 0
-
-// Automatic port number
-#define PING_SLEEP_RATE 1000000
-
-// Gives the timeout delay for receiving packets
-// in seconds
-#define RECV_TIMEOUT 1
-
-// ping packet structure
-struct ping_pkt {
- struct icmphdr hdr;
- char msg[PING_PKT_S-sizeof(struct icmphdr)];
-};
-
bool hardwareResourceSerialProvider::pingDevice(){
bool RetVal = false;
- if( m_bValid ) {
-#ifdef DEBUG_EXTRA
- LOG("Pinging Device!");
-#endif
- int sockfd;
- int ttl_val=64, msg_count=0, i, flag=1, msg_received_count=0;
- struct ping_pkt pckt;
- struct sockaddr_in ping_addr;
- struct sockaddr_in r_addr;
- struct timeval tv_out;
-
- tv_out.tv_sec = 0;
- tv_out.tv_usec = 300000; // 1/3 of second
-
-
- ping_addr.sin_family = AF_INET;
- ping_addr.sin_addr.s_addr = inet_addr( m_sUartData.path );
- //ping_addr.sin_port = htons( m_nPort );
- LOG( m_sUartData.path );
-
- sockfd = socket( AF_INET, SOCK_RAW, IPPROTO_ICMP );
- if( sockfd < 0 ){
- LOG_ERROR("Socket file descriptor not received!");
- return false;
- };
-
- // set socket options at ip to TTL and value to 64,
- // change to what you want by setting ttl_val
- if( setsockopt( sockfd, SOL_IP, IP_TTL, &ttl_val, sizeof(ttl_val)) != 0 ){
- LOG_ERROR("Setting socket options to TTL failed!");
- shutdown( sockfd, SHUT_RDWR );
- return false;
- };
-
- // setting timeout of recv setting
- setsockopt( sockfd, SOL_SOCKET, SO_RCVTIMEO, (const char*)&tv_out, sizeof tv_out );
-
- // flag is whether packet was sent or not
- flag=1;
-
- //filling packet
- bzero(&pckt, sizeof(pckt));
-
- pckt.hdr.type = ICMP_ECHO;
- pckt.hdr.un.echo.id = getpid();
-
- for ( i = 0; i < sizeof(pckt.msg)-1; i++ ) pckt.msg[i] = i+'0';
-
- pckt.msg[i] = 0;
- pckt.hdr.un.echo.sequence = msg_count++;
- pckt.hdr.checksum = checksum(&pckt, sizeof(pckt));
-
-
- //SLEEP( 300 );
-
- //send packet
- if( sendto( sockfd, &pckt, sizeof(pckt), 0, (struct sockaddr*)&ping_addr, sizeof(ping_addr)) <= 0 ){
- LOG_ERROR("Packet Sending Failed!");
- shutdown( sockfd, SHUT_RDWR );
- return false;
- };
-
- //receive packet
- socklen_t addr_len = sizeof(r_addr);
-
- if( recvfrom( sockfd, &pckt, sizeof(pckt), 0, (struct sockaddr*)&r_addr, &addr_len) <= 0 ){
- LOG_ERROR("Packet receive failed!");
- shutdown( sockfd, SHUT_RDWR );
- return false;
- } else {
-#ifdef DEBUG_EXTRA
- LOG("Device pinged Sucessfully");
-#endif
- RetVal = true;
- };
- shutdown( sockfd, SHUT_RDWR );
- };
+ if ( m_bValid ) RetVal = pingIP4( m_sUartData.path );
return RetVal;
};
diff --git a/lib/App/common/kernelEventFilter.h b/lib/App/common/kernelEventFilter.h
index 499f33d1..f2f53a0b 100644
--- a/lib/App/common/kernelEventFilter.h
+++ b/lib/App/common/kernelEventFilter.h
@@ -3,6 +3,7 @@
//#include "../../components/base/basicEvent.h"
#include "../../components/base/basicEventHeap.h"
+#include "../../components/base/basicEvent.h"
#include "../../components/base/basicPosition.h"
#include "dataBinder.h"
diff --git a/lib/App/common/kernelEventFilterTrain.cpp b/lib/App/common/kernelEventFilterTrain.cpp
index 2fbaf222..bb643745 100644
--- a/lib/App/common/kernelEventFilterTrain.cpp
+++ b/lib/App/common/kernelEventFilterTrain.cpp
@@ -66,9 +66,8 @@ bool kernelEventFilterTrain::validate(){
#endif
// Internal values
if( m_bActive ){
-
- uint64_t cts = getMilliseconds();
m_mStateProtector.lock();
+ uint64_t cts = getMilliseconds();
// Validate Zones and statuses (EXP)
//Upper Sensor Zone
if( m_sUpperZone.TrainOnTheField ){
@@ -121,8 +120,6 @@ void kernelEventFilterTrain::createEvent( uint8_t EVT ){
bool kernelEventFilterTrain::validateTarget( uint32_t DevID, TARGET_DATA *ptr ){
if( m_bActive && ( ptr != NULL ) ){
-
- uint64_t cts = getMilliseconds();
// Validate Zones and statuses (EXP) -> Moved to Filter Validation
// Check Current Target
float tAngleWidth;
@@ -132,6 +129,7 @@ bool kernelEventFilterTrain::validateTarget( uint32_t DevID, TARGET_DATA *ptr ){
tAngleWidth = ( 360.0f * ptr->area ) / 12000.0f;
};
m_mStateProtector.lock();
+ uint64_t cts = getMilliseconds();
if( DevID == m_sTrainFilterData.nUpperSensorID ){ //If Upper Sensor
// Train is detected
m_sUpperZone.ts = cts; // Update TS
@@ -399,7 +397,7 @@ void TrainFilterOSP_Helper::m_fThreadProc( void ){
n = recvfrom( m_iSocketUDP, buffer, 255, MSG_DONTWAIT/*MSG_WAITALL*/, ( struct sockaddr *) &cliaddr, &len );
if( n >= 0 ){
bool tStatus = (bool) atoi( buffer );
-#ifdef DEBUG
+#ifdef DEBUG_EXTRA
char tB[512];
buffer[n] = (char)0;
sprintf( tB, "From Other Peer: %s", buffer );
@@ -485,8 +483,10 @@ bool TrainFilterOSP_Helper::setLocalStatus( bool train_on_line ){
// Filling server information
servaddr.sin_family = AF_INET;
+#ifdef DEBUG_EXTRA
sprintf( buffer, "Try host [%s]", m_cRemoteHostName );
LOG( buffer );
+#endif
struct hostent *server = gethostbyname( m_cRemoteHostName );
if( server == NULL ){
sprintf( buffer, "ERROR, no such host [%s]", m_cRemoteHostName );
diff --git a/lib/App/common/kernelModule.h b/lib/App/common/kernelModule.h
index 68208ba6..56877809 100644
--- a/lib/App/common/kernelModule.h
+++ b/lib/App/common/kernelModule.h
@@ -6,6 +6,7 @@
#include "../../components/base/basicObject.h"
#include "../../components/base/basicEngine.h"
#include "../../components/base/basicEventHandler.h"
+#include "../../components/base/basicEvent.h"
#include "../../components/base/basicLogCollection.h"
#include "dataBinder.h"
diff --git a/lib/App/common/kernelModuleEmbedVideo.cpp b/lib/App/common/kernelModuleEmbedVideo.cpp
index 19a11246..d0743b66 100644
--- a/lib/App/common/kernelModuleEmbedVideo.cpp
+++ b/lib/App/common/kernelModuleEmbedVideo.cpp
@@ -119,7 +119,6 @@ kernelModuleEmbedVideo::kernelModuleEmbedVideo( uint32_t moduleID ): kernelModul
#endif
;
};
- //sprintf( m_pVideoScratchPath, "%s/video_scratch", DB_SHMEM_POINT);
if( !fileExist( DB_SHMEM_POINT )) {
mkdir( DB_SHMEM_POINT, 0775 );// S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IWGRP | S_IXGRP | S_IROTH | S_IXOTH );
chmod( DB_SHMEM_POINT, 0775 );
@@ -208,8 +207,9 @@ kernelModuleEmbedVideo::~kernelModuleEmbedVideo(){
static const char * ht_head = "HTTP/1.1 200 OK\r\n"
"Cache-Control: no-store, no-cache, post-check=0, pre-check=0\r\n"
"Pragma: no-cache\r\n"
+ "Expires: 0\r\n"
"MIME-version: 1.0\r\n"
- "Connection: close\r\n"
+ "Connection: close\r\n"
//"Keep-Alive: timeout=5, max=1\r\n"
//"Connection: Keep-Alive\r\n"
//"Content-Type: video/mp4\r\n"
@@ -220,8 +220,12 @@ static const char * ht_head = "HTTP/1.1 200 OK\r\n"
static const char * ht_abort = "HTTP/1.1 404 OK\r\n"
"Cache-Control: no-store, no-cache, post-check=0, pre-check=0\r\n"
"Pragma: no-cache\r\n"
+ "Expires: 0\r\n"
"Connection: close\r\n\r\n";
static const char * ht_no_signal = "HTTP/1.1 200 OK\r\n"
+ "Cache-Control: no-store, no-cache, post-check=0, pre-check=0\r\n"
+ "Pragma: no-cache\r\n"
+ "Expires: 0\r\n"
"MIME-version: 1.0\r\n"
"Connection: close\r\n"
"Content-Transfer-Encoding: BINARY\r\n"
@@ -249,7 +253,9 @@ void *kernelModuleEmbedVideo::webClientProc( void *ptr ){
uint8_t tBuf[FILESTREAMBUFFERSZ];
int retVal;
bool w = true;
+#ifdef DEBUG_EXTRA
TLOG( "Start WebClient" );
+#endif
if( CTX ) {
char mesg[1024];
size_t RecvSize;
@@ -368,7 +374,7 @@ void *kernelModuleEmbedVideo::webClientProc( void *ptr ){
//Send Dummy Picture
#ifdef HAVE_SMAL_PREVIEW_STREAMS
if( CTX->bPreviewMode ){
- sprintf( mesg, ht_no_signal, CTX->ModulePtr->m_nNoSignalSize );
+ sprintf( mesg, ht_no_signal, CTX->ModulePtr->m_nNoSignalSmallSize );
send( CTX->m_iSocketFID, mesg, strlen(mesg), 0 );
send( CTX->m_iSocketFID, CTX->ModulePtr->n_pNoSignalSmallData, CTX->ModulePtr->m_nNoSignalSmallSize, 0 );
send( CTX->m_iSocketFID, "\r\n\r\n", 4, 0 );
@@ -1102,6 +1108,18 @@ bool kernelModuleEmbedVideo::startService(){
memcpy( n_pNoSignalData, buf.data(), m_nNoSignalSize );
} else m_nNoSignalSize =0;
buf.clear();
+#ifdef HAVE_SMAL_PREVIEW_STREAMS
+ // Make Small Preview Thumb
+ cv::Mat dst;
+ cv::resize( tMat, dst, cv::Size( PREVIEW_SIZE_WIDTH, PREVIEW_SIZE_HEIGHT ));
+ cv::imencode( ".jpg", dst, buf, compression_params );
+ m_nNoSignalSmallSize = buf.size();
+ n_pNoSignalSmallData = (uint8_t *) malloc( m_nNoSignalSmallSize );
+ if( n_pNoSignalSmallData ) {
+ memcpy( n_pNoSignalSmallData, buf.data(), m_nNoSignalSmallSize );
+ } else m_nNoSignalSmallSize =0;
+ buf.clear();
+#endif
} catch (cv::Exception & e) {
LOG_ERROR(e.msg.c_str());
};
@@ -1303,9 +1321,57 @@ bool kernelModuleEmbedVideo::reloadSettings(){
};
return false;
};
-
+#include "deviceNodeCamera.h"
+#include "deviceNodeFactory.h"
bool kernelModuleEmbedVideo::validate(){
bool RetVal = true;
+ deviceNode **tA=NULL;
+ uint32_t tCNT = deviceNodeFactory::getInstance()->fetchNodes( ARGUS_ANALOG_STATIC_CAMERA, tA );
+ if( !tCNT ){
+ tCNT = deviceNodeFactory::getInstance()->fetchNodes( ARGUS_ANALOG_PTZ_CAMERA, tA );
+ if( !tCNT ){
+ tCNT = deviceNodeFactory::getInstance()->fetchNodes( ARGUS_IP_STATIC_CAMERA, tA );
+ if( !tCNT ){
+ tCNT = deviceNodeFactory::getInstance()->fetchNodes( ARGUS_IP_PTZ_CAMERA, tA );
+ if( !tCNT ){
+ tCNT = deviceNodeFactory::getInstance()->fetchNodes( ARGUS_IP_PRESET_CAMERA, tA );
+ if( !tCNT ){
+ tCNT = deviceNodeFactory::getInstance()->fetchNodes( ARGUS_ANALOG_PRESET_CAMERA, tA );
+ };
+ };
+ };
+ };
+ };
+ if( tCNT ){
+ for ( int i = 0; i < tCNT; i++) {
+ deviceNodeCamera *tCAM = (deviceNodeCamera*) tA[i];
+ if( !registerStream( tCAM->getCamStream(), tCAM->getFlipMode() ) ){
+ RetVal = false;
+ //tCAM->set
+ continue;
+ };
+ };
+ free( tA );
+ tA = NULL;
+ } else {
+ LOG("No Camera Defined/Enabled In the system!");
+ };
+ if ( RetVal ) {
+ DBC_INT_LIST tInvalidList;
+ m_mStreamHandlersProtector.lock();
+ for( mapSTREAMHANDLERS::iterator idx = m_mapHANDLERS.begin(); idx != m_mapHANDLERS.end(); idx++ ) {
+ if ( (*idx).second != NULL ) if (!(*idx).second->validate()) tInvalidList.push_back( (*idx).first );
+ };
+ m_mStreamHandlersProtector.unlock();
+ if ( tInvalidList.size() ) {
+ for( DBC_INT_LIST::iterator idx = tInvalidList.begin(); idx != tInvalidList.end(); idx++ ){
+ if( unregisterStream( *idx ) ) registerStream( *idx );
+ };
+ tInvalidList.clear();
+ };
+ };
+ return RetVal;
+
if( m_pDBC ){
DBC_MODULE_EMBED_VIDEO_DATA *tDATA = m_pDBC->getEmbedVideoData( m_nDBAUXID );
if( tDATA ) {
@@ -1622,7 +1688,7 @@ bool kernelModuleEmbedVideo::generateSavePicPath( CSTR MD5, CSTR Output ){
return true;
};
-bool kernelModuleEmbedVideo::registerStream( uint32_t streamID ){
+bool kernelModuleEmbedVideo::registerStream( uint32_t streamID, uint8_t flip_mode ){
// return true;
try {
m_mStreamHandlersProtector.lock();
@@ -1634,9 +1700,9 @@ bool kernelModuleEmbedVideo::registerStream( uint32_t streamID ){
};
//Create New One
if( ( m_sEmbedVideoData.output_mode & EVE_OUTPUT_VIDEO ) != EVE_OUTPUT_VIDEO ){
- tData = new streamHandler( this, MS_MODE_DECODE_FRAMES );
+ tData = new streamHandler( this, MS_MODE_DECODE_FRAMES, flip_mode );
} else {
- tData = new streamHandler( this, MS_MODE_ENCODE_FRAMES );
+ tData = new streamHandler( this, MS_MODE_ENCODE_FRAMES, flip_mode );
};
if ( tData != NULL ) {
if ( tData->create( m_pDBC, streamID ) ) {
@@ -1654,10 +1720,11 @@ bool kernelModuleEmbedVideo::registerStream( uint32_t streamID ){
m_mStreamHandlersProtector.unlock();
} catch (const std::out_of_range& oor ) {
streamHandler * tSH = NULL;
+ //Create New One
if( ( m_sEmbedVideoData.output_mode & EVE_OUTPUT_VIDEO ) != EVE_OUTPUT_VIDEO ){
- tSH = new streamHandler( this, MS_MODE_DECODE_FRAMES );
+ tSH = new streamHandler( this, MS_MODE_DECODE_FRAMES, flip_mode );
} else {
- tSH = new streamHandler( this, MS_MODE_ENCODE_FRAMES );
+ tSH = new streamHandler( this, MS_MODE_ENCODE_FRAMES, flip_mode );
};
if ( tSH != NULL ) {
if ( tSH->create( m_pDBC, streamID ) ) {
@@ -1712,7 +1779,7 @@ bool kernelModuleEmbedVideo::unregisterStream( uint32_t streamID ){
#endif
-streamHandler::streamHandler( kernelModuleEmbedVideo *ptr, MS_WORK_MODE M ): m_pMaster( ptr ), m_eWM( M ), basicMediaDestination()
+streamHandler::streamHandler( kernelModuleEmbedVideo *ptr, MS_WORK_MODE M, uint8_t flip_mode ): m_pMaster( ptr ), m_eWM( M ), basicMediaDestination()
#ifdef EVE_ENABLE_VIDEO
,basicThread()
#endif
@@ -1722,6 +1789,7 @@ streamHandler::streamHandler( kernelModuleEmbedVideo *ptr, MS_WORK_MODE M ): m_p
m_pSource = NULL;
m_bEvtMarkerCounter = 0;
m_bCamMoveCounter = 0;
+ m_bFlipMode = flip_mode;
#ifdef EVE_ENABLE_EASE_OUTPUT_FPS
#ifdef EVE_ENABLE_VIDEO
@@ -1787,21 +1855,16 @@ streamHandler::streamHandler( kernelModuleEmbedVideo *ptr, MS_WORK_MODE M ): m_p
};
streamHandler::~streamHandler(){
- LOG("Destructor");
if ( m_sStreamData.id ) {
- LOG("Deleting Source!");
if( m_pSource != NULL ) {
switch( m_cSourceType ){// m_sStreamData.source_type[0] ) {
case 'D': delete( ( videoLIVE555Source *) m_pSource ); break;
case 'A': delete( ( videoAVLIBSource *) m_pSource ); break;
};
};
- LOG("Source Delete!");
- LOG("Deleting Output!");
#ifdef EVE_ENABLE_VIDEO
closeAll();
#endif //EVE_ENABLE_VIDEO
- LOG("Output Closed!");
};
};
@@ -1882,7 +1945,6 @@ bool streamHandler::create( dataBinder *ptr, uint32_t stremID ){
} else {
sprintf( tMRL, "%s://%s:%s@%s:%d%s", m_sStreamData.mrl_proto, tCAM->username, tCAM->password, tCAM->ip, m_sStreamData.mrl_port, m_sStreamData.mrl );
};
- LOG( tMRL );
if( m_pSource->_open( tMRL, false, -1.0f, pix, m_sStreamData.width, m_sStreamData.height, tW, tH ) ){
if( !m_pSource->attachDestination( this ) ){
switch( m_cSourceType ){
@@ -2084,6 +2146,13 @@ bool streamHandler::pushFrame( cv::Mat &Frame, void* src ){
};
};
#endif
+ // 0 - dis .. 1 - Hor ... 2 - vert 3 - both
+ if ( m_bFlipMode ) {
+ //Flip Horizontally = 1 vertically = 0 both = -1
+ cv::Mat mirroredImage;
+ cv::flip( m_pMaster->m_mapMATS[tMD->mediaStreamId], mirroredImage, ( 2 - m_bFlipMode ) );
+ mirroredImage.copyTo( m_pMaster->m_mapMATS[tMD->mediaStreamId] );
+ };
#ifdef EVE_ENABLE_DROP_OUTPUT_FPS
//LOG("T");
diff --git a/lib/App/common/kernelModuleEmbedVideo.h b/lib/App/common/kernelModuleEmbedVideo.h
index 9f75a9a3..3f1aa30e 100644
--- a/lib/App/common/kernelModuleEmbedVideo.h
+++ b/lib/App/common/kernelModuleEmbedVideo.h
@@ -28,6 +28,8 @@ class kernelModuleEmbedVideo;
#endif
#define USE_SCALING_IN
+//#define USE_CV_DENOISE
+//#define USE_CV_TONEMAP
#ifndef DB_SHMEM_POINT
#define DB_SHMEM_POINT "/dev/shm/argus"
@@ -329,6 +331,7 @@ class streamHandler:
bool m_bSegADelete;
bool m_bSegBActive;
bool m_bSegBDelete;
+ uint8_t m_bFlipMode;
basicMutex m_mCurrentOperationProtector;
uint8_t m_bCOP;
VIDEO_SEGMENT_INFO m_sStreamSegmentInfo[2];
@@ -394,7 +397,7 @@ class streamHandler:
#endif //!EVE_ENABLE_VIDEO
public:
- explicit streamHandler( kernelModuleEmbedVideo *ptr, MS_WORK_MODE M = MS_MODE_DECODE_FRAMES );
+ explicit streamHandler( kernelModuleEmbedVideo *ptr, MS_WORK_MODE M = MS_MODE_DECODE_FRAMES, uint8_t flip_mode = 0 );
virtual ~streamHandler();
bool create( dataBinder *ptr, uint32_t stremID );
/* from Media Destination */
@@ -462,7 +465,7 @@ class kernelModuleEmbedVideo: public kernelModule, public basicDualThread {
/* Module Specific Functionality */
int getWidh( void );
int getHeight( void );
- bool registerStream( uint32_t streamID );
+ bool registerStream( uint32_t streamID, uint8_t flip_mode =0 );
bool unregisterStream( uint32_t streamID );
uint8_t getMediaMode( void );
friend class streamHandler;
diff --git a/lib/App/common/kernelPrototype.cpp b/lib/App/common/kernelPrototype.cpp
index 0982836f..8fbfcf0d 100644
--- a/lib/App/common/kernelPrototype.cpp
+++ b/lib/App/common/kernelPrototype.cpp
@@ -57,10 +57,8 @@ kernelPrototype::kernelPrototype( config_setting_t *ptr ): basicEventHandler(),
write( m_iWatchdogFd, &tB, strlen( tB ) );
};
#endif
- m_pEventHeap = basicEventHeap::getInstance();
-
- m_pSettings = basicSettingsProvider::getInstance()->getSubNode( ptr, "KERNEL" );
-
+ m_pSettings = basicSettingsProvider::getInstance()->getSubNode( ptr, "KERNEL" );
+ m_pEventHeap = basicEventHeap::getInstance();
#ifndef USE_SERVER_MYSQL
#ifdef USE_MYSQL
m_pDBC = mysqlDBC::getInstance();
diff --git a/lib/App/common/kernelPrototype.h b/lib/App/common/kernelPrototype.h
index fdc5ab60..f8e629bd 100644
--- a/lib/App/common/kernelPrototype.h
+++ b/lib/App/common/kernelPrototype.h
@@ -4,11 +4,11 @@
#include "../../components/base/basicThread.h"
#include "../../components/base/basicMutex.h"
#include "../../components/base/basicMutex.h"
-#include "../../components/base/basicEventHeap.h"
#include "../../components/base/basicLogCollection.h"
#include "../../components/base/basicSettingsProvider.h"
+#include "../../components/base/basicEventHeap.h"
-#ifndef USE_SERVER_MYSQL
+#ifndef USE_SERVER_MYSQL
#include "hardwareManager.h"
#include "kernelModuleFactory.h"
#include "deviceNodeFactory.h"
@@ -54,6 +54,7 @@ class kernelPrototype: public basicThread, public basicEventHandler {
/* basic */
basicLogCollection * m_pLog;
basicEventHeap * m_pEventHeap;
+
config_setting_t * m_pSettings;
/* Special */
#ifndef USE_SERVER_MYSQL
@@ -86,6 +87,12 @@ class kernelPrototype: public basicThread, public basicEventHandler {
void WaitFinish( bool Force = false );
virtual bool dispatchEvent( EVENT_CONTAINER *Evt ){ return true; };
virtual void startSession(){};
+#ifndef USE_SERVER_MYSQL
+ dataBinder * getDBC(){ return m_pDBC; };
+#else
+ serverDataBinder * getDBC(){ return m_pDBC; };
+#endif
+
};
#endif
\ No newline at end of file
diff --git a/lib/App/common/serverDataBinder.h b/lib/App/common/serverDataBinder.h
index fba85e8d..16cd9006 100644
--- a/lib/App/common/serverDataBinder.h
+++ b/lib/App/common/serverDataBinder.h
@@ -3,16 +3,40 @@
#include "dataBinder_structures.h"
-#define ARGUS_OBJECT_USER 32
-#define ARGUS_OBJECT_MODULE 10
-#define ARGUS_OBJECT_SENSOR 20
-#define ARGUS_OBJECT_CAMERA 22
-#define ARGUS_CLOUD_STATUS_REG 1
-#define ARGUS_CLOUD_STATUS_ONLINE 2
-#define ARGUS_CLOUD_STATUS_BUSY 3
-#define ARGUS_CLOUD_STATUS_ONLINE 4
-#define ARGUS_CLOUD_STATUS_TROUBLE 5
+#define ARGUS_OBJECT_MODULE 10
+#define ARGUS_OBJECT_MODBUS 15
+#define ARGUS_OBJECT_SENSOR 20
+#define ARGUS_OBJECT_CAMERA 22
+#define ARGUS_OBJECT_USER 32
+
+#define ARGUS_CLOUD_STATUS_NA 0
+#define ARGUS_CLOUD_STATUS_REG 1
+#define ARGUS_CLOUD_STATUS_ONLINE 2
+#define ARGUS_CLOUD_STATUS_BUSY 3
+#define ARGUS_CLOUD_STATUS_MAINTENENCE 4
+#define ARGUS_CLOUD_STATUS_ALARM 5
+/*----------- ERRORS -----------------------*/
+#define ARGUS_CLOUD_STATUS_E_GENERIC 6
+#define ARGUS_CLOUD_STATUS_E_CAM_GENERIC 7
+#define ARGUS_CLOUD_STATUS_E_CAM_NC 8
+#define ARGUS_CLOUD_STATUS_E_CAM_NPTZ 9
+#define ARGUS_CLOUD_STATUS_E_CAM_NIM 10
+#define ARGUS_CLOUD_STATUS_E_SEN_GENERIC 11
+#define ARGUS_CLOUD_STATUS_E_US_LRF 12
+#define ARGUS_CLOUD_STATUS_E_BS_LRF 13
+#define ARGUS_CLOUD_STATUS_E_US_NC 14
+#define ARGUS_CLOUD_STATUS_E_BS_NC 15
+#define ARGUS_CLOUD_STATUS_E_SW 16
+#define ARGUS_CLOUD_STATUS_E_NW 17
+
+#define ARGUS_LIFE_STATUS_CLEAN 0
+#define ARGUS_LIFE_STATUS_LVL_1 1
+#define ARGUS_LIFE_STATUS_LVL_2 2
+#define ARGUS_LIFE_STATUS_LVL_3 3
+#define ARGUS_LIFE_STATUS_LVL_4 4
+#define ARGUS_LIFE_STATUS_LVL_5 5
+
typedef enum E_SERVER_STAT_ENUM{
SERVER_LTS = 0,
@@ -50,6 +74,83 @@ typedef struct S_SESSION_DATA{
}SESSION_DATA;
typedef std::unordered_map< uint32_t, SESSION_DATA* > M_SESSIONS;
+typedef struct S_DBC_SERVA_CONFIG{
+ uint16_t encoderLimit;
+ uint16_t historyDaysLimit;
+ uint8_t historyAutoDeleteLimit;
+ uint8_t historyPreserveFreeSpacePerc;
+ uint32_t historyPreserveFreeSpaceMB;
+}DBC_SERVA_CONFIG;
+
+typedef struct S_MODBUS_RTU_INFO{
+ uint64_t id;
+ uint64_t platform_id;
+ uint64_t active_session_id;
+ char ip[16];
+ uint16_t port;
+ uint8_t output_base_addr;
+ uint8_t input_base_addr;
+ uint8_t crossbar[8];
+ uint8_t c_InBits;
+ uint8_t c_OutBits;
+ uint8_t status;
+ uint64_t ts;
+}MODBUS_RTU_INFO;
+
+typedef struct S_SCADA_TRACK_INFO{
+ uint64_t platform_id;
+ char side;
+}SCADA_TRACK_INFO;
+
+typedef struct S_MODBUS_TEST_DATA{
+ uint64_t platform_id;
+ uint8_t c_OutBits;
+}MODBUS_TEST_DATA;
+
+typedef struct S_SESSION_RATE_DATA{
+ uint64_t track_id;
+ uint8_t level;
+}SESSION_RATE_DATA;
+
+typedef struct S_MODULE_HEALTH_STATUS{
+ uint64_t platform_id;
+ uint8_t status;
+}MODULE_HEALTH_STATUS;
+
+
+typedef enum E_ENCODER_STAGES:uint8_t{
+ ENCODER_NONE = 0,
+ DECODER_INIT = 1,
+ ENCODER_INIT,
+ THREAD_INIT,
+ ENCODER_ENCODING,
+ ENCODER_FINISHED
+}ENCODER_STAGES;
+
+typedef enum E_MEDIA_STATUS:uint8_t{
+ MEDIA_TRANSFERING = 0,
+ MEDIA_STORED = 1,
+ MEDIA_ENCODE_PROGRESS = 2,
+ MEDIA_READY
+}MEDIA_STATUS;
+
+typedef struct S_MODBUS_MANAGER_DATA{
+ uint32_t automaticAlarmRisingTO;
+ //uint32_t automaticAlarmSuppressionTO;
+ uint8_t helthSignalLevel;
+ uint8_t hazardSignalLevel;
+}MODBUS_MANAGER_DATA;
+
+typedef std::vector V_MODBUS_RTU_INFO;
+
+
+typedef struct S_DBC_IS_MODULE_DATA{
+ uint64_t id;
+ uint64_t track_id;
+ char side;
+ char status;
+ char ip4[16];
+}DBC_IS_MODULE_DATA; // Infrostructure Module Data
class serverDataBinder {
public:
@@ -61,10 +162,15 @@ class serverDataBinder {
virtual bool cleanWebCmd(){ return false; };
virtual bool closeAllOnGoingSessions(){ return false; };
virtual bool deleteSession(uint64_t id ){ return false; };
- virtual char getMojoWM( uint64_t id ){ return 'N'; };
virtual uint64_t getBottomLRF( uint64_t id ){ return 0; };
virtual uint32_t getCloudLTS( uint8_t Obj, uint64_t id ){ return 0; };
virtual uint8_t getCloudStatus( uint8_t Obj, uint64_t id ){ return 0; };
+ virtual CSTR getMediaUUID( uint64_t id ){ return NULL; };
+ virtual MODBUS_MANAGER_DATA * getModBusManagerData(){ return NULL; };
+ virtual MODBUS_RTU_INFO * getModBusRTU( uint64_t id ){ return NULL; };
+ virtual MODBUS_RTU_INFO * getModBusRTU_Platform( uint64_t id ){ return NULL; };
+ virtual DBC_IS_MODULE_DATA * getModuleData( uint64_t id ){ return NULL; };
+ virtual char getMojoWM( uint64_t id ){ return 'N'; };
virtual uint64_t getRecentMediaId(){ return 0;};
virtual DBC_RPC_MEDIA_INFO * getRemoteMediaInfo( uint64_t id ){ return NULL; };
virtual DBC_RPC_MEDIA_INFO_EX * getRemoteMediaInfoEx( uint64_t id ){ return NULL; };
@@ -74,9 +180,14 @@ class serverDataBinder {
virtual uint64_t getSessionTrackId( uint64_t id ){ return 0; };
virtual DBC_SERVA_CONFIG * getServaConfig( ){ return NULL; };
virtual uint64_t getTrackIdByMojo( uint64_t id ){ return 0;};
+ virtual SCADA_TRACK_INFO * getTrackSCADA( uint64_t id ){ return NULL;};
virtual uint64_t getUpperLRF( uint64_t id ){ return 0; };
virtual DBC_RPC_WEB_CMD * fetchWebCmd( uint64_t id ){ return NULL;};
virtual DBC_UINT64_LIST * listMediaQueueItems( uint8_t status ){ return NULL; };
+ virtual DBC_UINT64_LIST * listMetroModules( char status ){ return NULL; };
+ virtual DBC_UINT64_LIST * listModBusRTUs( uint8_t status=0, char mode='E'){ return NULL; };
+ virtual DBC_UINT64_LIST * listPlatformModules(uint64_t id ){ return NULL; };
+ virtual DBC_UINT64_LIST * listPlatforms( char mode='E' ){ return NULL; };
virtual bool putIntoLog( CSTR A, CSTR B, CSTR Msg ){ return false; };
virtual uint64_t registerMojo( CSTR A, CSTR B ){ return 0; };
virtual bool registerServer( uint32_t SiteID, CSTR identity, int PID, uint32_t *ServID, uint32_t *ServNode ){ return false; };
@@ -99,6 +210,7 @@ class serverDataBinder {
virtual bool unregisterServer(){ return false; };
virtual bool updateEncodeFormat( uint64_t id, CSTR ext ){ return false; };
virtual bool updateEncodeStatus( uint64_t dbid, uint8_t status, uint8_t perc = 0 ){ return false; };
+ virtual bool updateModBusRTU( uint64_t dbid, uint8_t status=0, uint8_t inputs=0, uint8_t outputs=0 ){ return false; };
virtual bool updateModuleData( uint64_t m_dMojoDBID, uint32_t UPPER_ID, uint32_t BOTTOM_ID, uint32_t CAM_ID, uint32_t CAM_STREAM_ID, CSTR vstr, CSTR lstr ){ return false; };
virtual bool updateServerUtilisation( DBC_SYS_LOAD_INFO *ptr ){ return false; };
virtual bool updateSessionStatus( uint64_t id, uint8_t status ){ return false; };
diff --git a/lib/App/common/serverMySQL_dataBinder.cpp b/lib/App/common/serverMySQL_dataBinder.cpp
index 75281071..8f19f2e7 100644
--- a/lib/App/common/serverMySQL_dataBinder.cpp
+++ b/lib/App/common/serverMySQL_dataBinder.cpp
@@ -138,6 +138,251 @@ bool servaMySQLDBC::deleteSession(uint64_t id ){
};
return true;
};
+CSTR servaMySQLDBC::getMediaUUID( uint64_t id ){
+ CSTR RetVal = NULL;
+ if( m_bIsConnected ){
+ char tQBuf[MAX_PATH_LEN];
+ AAssoc *result;
+ sprintf( tQBuf, "SELECT `uuid` FROM `media_queue` WHERE `id`=%"PRIu64, id );
+#ifdef DEBUG_ALL
+ 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("uuid");
+ if( it != cArr->end() ){
+ RetVal = strdup( it->second.c_str() );
+ };
+ };
+ };
+ deleteResult( result );
+ };
+ return RetVal;
+};
+MODBUS_MANAGER_DATA *servaMySQLDBC::getModBusManagerData(){
+ MODBUS_MANAGER_DATA *RetVal = NULL;
+ if( m_bIsConnected ){
+ char tQBuf[MAX_PATH_LEN];
+ sprintf( tQBuf, "SELECT `modbus_auto_rise`,`modbus_health_level`,`modbus_hazard_level` FROM `system_props` WHERE `id`=1" );
+#ifdef DEBUG_ALL
+ LOG(tQBuf);
+#endif
+ AAssoc *result;
+ result = m_pDatabase->Query( tQBuf );
+ if( result!= NULL ) {
+ if( result->size() > 0 ) {
+ RetVal = (MODBUS_MANAGER_DATA *)malloc(sizeof(MODBUS_MANAGER_DATA));
+ if ( RetVal ) {
+ memset( RetVal, 0, sizeof( MODBUS_MANAGER_DATA ));
+ Assoc *cArr;
+ Assoc::iterator it;
+ cArr = result->at(0);
+ it = cArr->find("modbus_auto_rise");
+ if( it != cArr->end() ){
+ RetVal->automaticAlarmRisingTO = atoi(it->second.c_str());
+ };
+ it = cArr->find("modbus_health_level");
+ if( it != cArr->end() ){
+ RetVal->helthSignalLevel = atoi(it->second.c_str());
+ };
+ it = cArr->find("modbus_hazard_level");
+ if( it != cArr->end() ){
+ RetVal->hazardSignalLevel = atoi(it->second.c_str());
+ };
+ };
+ };
+ deleteResult( result );
+ };
+ };
+ return RetVal;
+};
+MODBUS_RTU_INFO *servaMySQLDBC::getModBusRTU( uint64_t id ){
+ MODBUS_RTU_INFO *RetVal = NULL;
+ if( m_bIsConnected ){
+ char tQBuf[MAX_PATH_LEN];
+ AAssoc *result;
+ sprintf(tQBuf, "SELECT * FROM `modbus_modules` WHERE `id`=%" PRIu64, id );
+#ifdef DEBUG_ALL
+ LOG(tQBuf);
+#endif
+ result = m_pDatabase->Query( tQBuf );
+ if( result!= NULL ) {
+ if( result->size() > 0 ) {
+ RetVal = (MODBUS_RTU_INFO *)malloc(sizeof(MODBUS_RTU_INFO));
+ if ( RetVal ) {
+ memset( RetVal, 0, sizeof( MODBUS_RTU_INFO ));
+
+ RetVal->id = id;
+ RetVal->input_base_addr = 0x00;
+ RetVal->output_base_addr = 0x10;
+
+ Assoc *cArr;
+ Assoc::iterator it;
+ cArr = result->at(0);
+ it = cArr->find("platform_id");
+ if( it != cArr->end() ){
+ RetVal->platform_id = atoll(it->second.c_str());
+ };
+ it = cArr->find("ip4");
+ if( it != cArr->end() ){
+ strncpy( RetVal->ip, it->second.c_str(), 15 );
+ RetVal->ip[15] = (char)0;
+ };
+ it = cArr->find("port");
+ if( it != cArr->end() ){
+ RetVal->port = atoi( it->second.c_str() );
+ };
+ it = cArr->find("status");
+ if( it != cArr->end() ){
+ RetVal->status = atoi( it->second.c_str() );
+ };
+ it = cArr->find("values");
+ if( it != cArr->end() ){
+ RetVal->c_OutBits = atoi( it->second.c_str() ) & 0xFF;
+ RetVal->c_InBits = ( atoi( it->second.c_str() ) >> 8 ) & 0xFF;
+ };
+ it = cArr->find("crossbar_a");
+ if( it != cArr->end() ){
+ RetVal->crossbar[0] = atoi( it->second.c_str() ) & 0xFF;
+ };
+ it = cArr->find("crossbar_b");
+ if( it != cArr->end() ){
+ RetVal->crossbar[1] = atoi( it->second.c_str() ) & 0xFF;
+ };
+ it = cArr->find("crossbar_c");
+ if( it != cArr->end() ){
+ RetVal->crossbar[2] = atoi( it->second.c_str() ) & 0xFF;
+ };
+ it = cArr->find("crossbar_d");
+ if( it != cArr->end() ){
+ RetVal->crossbar[3] = atoi( it->second.c_str() ) & 0xFF;
+ };
+ };
+ };
+ deleteResult( result );
+ };
+ };
+ return RetVal;
+};
+
+MODBUS_RTU_INFO *servaMySQLDBC::getModBusRTU_Platform( uint64_t id ){
+ MODBUS_RTU_INFO *RetVal = NULL;
+ if( m_bIsConnected ){
+ char tQBuf[MAX_PATH_LEN];
+ AAssoc *result;
+ sprintf(tQBuf, "SELECT * FROM `modbus_modules` WHERE `platform_id`=%" PRIu64, id );
+#ifdef DEBUG_ALL
+ LOG(tQBuf);
+#endif
+ result = m_pDatabase->Query( tQBuf );
+ if( result!= NULL ) {
+ if( result->size() > 0 ) {
+ RetVal = (MODBUS_RTU_INFO *)malloc(sizeof(MODBUS_RTU_INFO));
+ if ( RetVal ) {
+ memset( RetVal, 0, sizeof( MODBUS_RTU_INFO ));
+
+ RetVal->id = id;
+ RetVal->input_base_addr = 0x00;
+ RetVal->output_base_addr = 0x10;
+
+ Assoc *cArr;
+ Assoc::iterator it;
+ cArr = result->at(0);
+ it = cArr->find("platform_id");
+ if( it != cArr->end() ){
+ RetVal->platform_id = atoll(it->second.c_str());
+ };
+ it = cArr->find("ip4");
+ if( it != cArr->end() ){
+ strncpy( RetVal->ip, it->second.c_str(), 15 );
+ RetVal->ip[15] = (char)0;
+ };
+ it = cArr->find("port");
+ if( it != cArr->end() ){
+ RetVal->port = atoi( it->second.c_str() );
+ };
+ it = cArr->find("status");
+ if( it != cArr->end() ){
+ RetVal->status = atoi( it->second.c_str() );
+ };
+ it = cArr->find("values");
+ if( it != cArr->end() ){
+ RetVal->c_OutBits = atoi( it->second.c_str() ) & 0xFF;
+ RetVal->c_InBits = ( atoi( it->second.c_str() ) >> 8 ) & 0xFF;
+ };
+ it = cArr->find("crossbar_a");
+ if( it != cArr->end() ){
+ RetVal->crossbar[0] = atoi( it->second.c_str() ) & 0xFF;
+ };
+ it = cArr->find("crossbar_b");
+ if( it != cArr->end() ){
+ RetVal->crossbar[1] = atoi( it->second.c_str() ) & 0xFF;
+ };
+ it = cArr->find("crossbar_c");
+ if( it != cArr->end() ){
+ RetVal->crossbar[2] = atoi( it->second.c_str() ) & 0xFF;
+ };
+ it = cArr->find("crossbar_d");
+ if( it != cArr->end() ){
+ RetVal->crossbar[3] = atoi( it->second.c_str() ) & 0xFF;
+ };
+ };
+ };
+ deleteResult( result );
+ };
+ };
+ return RetVal;
+};
+
+DBC_IS_MODULE_DATA *servaMySQLDBC::getModuleData( uint64_t id ){
+ DBC_IS_MODULE_DATA *RetVal = NULL;
+ if( m_bIsConnected ){
+ char tQBuf[MAX_PATH_LEN];
+ AAssoc *result;
+ sprintf(tQBuf, "SELECT * FROM `metro_modules` WHERE `id`=%" PRIu64, id );
+#ifdef DEBUG_ALL
+ LOG(tQBuf);
+#endif
+ result = m_pDatabase->Query( tQBuf );
+ if( result!= NULL ) {
+ if( result->size() > 0 ) {
+ RetVal = (DBC_IS_MODULE_DATA *)malloc(sizeof(DBC_IS_MODULE_DATA));
+ if ( RetVal ) {
+ memset( RetVal, 0, sizeof( DBC_IS_MODULE_DATA ));
+
+ RetVal->id = id;
+
+ Assoc *cArr;
+ Assoc::iterator it;
+ cArr = result->at(0);
+ it = cArr->find("track_id");
+ if( it != cArr->end() ){
+ RetVal->track_id = atoll(it->second.c_str());
+ };
+ it = cArr->find("side");
+ if( it != cArr->end() ){
+ RetVal->side = it->second.c_str()[0];
+ };
+ it = cArr->find("status");
+ if( it != cArr->end() ){
+ RetVal->status = it->second.c_str()[0];
+ };
+ it = cArr->find("IP4");
+ if( it != cArr->end() ){
+ strncpy( RetVal->ip4, it->second.c_str(), 15 );
+ RetVal->ip4[15] = (char)0;
+ };
+ };
+ };
+ deleteResult( result );
+ };
+ };
+ return RetVal;
+};
char servaMySQLDBC::getMojoWM( uint64_t id ){
char RetVal = 'N';
@@ -192,7 +437,7 @@ DBC_RPC_WEB_CMD *servaMySQLDBC::fetchWebCmd( uint64_t id ){
};
it = cArr->find("aux_id");
if( it != cArr->end() ){
- RetVal->aux_id = atoi( it->second.c_str() );
+ RetVal->aux_id = atoll( it->second.c_str() );
};
it = cArr->find("param");
if( it != cArr->end() ){
@@ -606,6 +851,40 @@ uint64_t servaMySQLDBC::getSessionTrackId( uint64_t id ){
};
return RetVal;
};
+SCADA_TRACK_INFO *servaMySQLDBC::getTrackSCADA( uint64_t id ){
+ SCADA_TRACK_INFO * RetVal = NULL;
+ if( m_bIsConnected ){
+ RetVal = (SCADA_TRACK_INFO *) malloc( sizeof(SCADA_TRACK_INFO));
+ if ( RetVal ) {
+ char tQBuf[MAX_PATH_LEN];
+ AAssoc *result;
+ memset( RetVal, 0, sizeof(SCADA_TRACK_INFO) );
+
+ sprintf( tQBuf, "SELECT `platform_id`,`side` FROM `metro_tracks` WHERE `id`=%" PRIu64, id );
+#ifdef DEBUG_ALL
+ 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("platform_id");
+ if( it != cArr->end() ){
+ RetVal->platform_id = atoll(it->second.c_str());
+ };
+ it = cArr->find("side");
+ if( it != cArr->end() ){
+ RetVal->side = it->second.c_str()[0];
+ };
+ };
+ };
+ deleteResult( result );
+ }
+ };
+ return RetVal;
+};
uint64_t servaMySQLDBC::getTrackIdByMojo( uint64_t id ){
uint64_t RetVal = 0;
@@ -689,6 +968,134 @@ DBC_UINT64_LIST *servaMySQLDBC::listMediaQueueItems( uint8_t status ){
};
return tVal;
};
+DBC_UINT64_LIST *servaMySQLDBC::listMetroModules( char status ){
+ DBC_UINT64_LIST * tVal = NULL;
+ if( m_bIsConnected ){
+ char tQBuf[MAX_PATH_LEN];
+ AAssoc *result;
+ sprintf(tQBuf, "SELECT `id` FROM `metro_modules` WHERE `status`='%c'", status );
+#ifdef DEBUG_ALL
+ LOG(tQBuf);
+#endif
+ result = m_pDatabase->Query( tQBuf );
+ if( result!= NULL ) {
+ if( result->size() > 0 ) {
+ Assoc *cArr;
+ tVal = new DBC_UINT64_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( atoll( it->second.c_str() ));
+ };
+ };
+ };
+ };
+ };
+ deleteResult( result );
+ };
+ return tVal;
+};
+DBC_UINT64_LIST *servaMySQLDBC::listModBusRTUs( uint8_t status, char mode){
+ DBC_UINT64_LIST * tVal = NULL;
+ if( m_bIsConnected ){
+ char tQBuf[MAX_PATH_LEN];
+ AAssoc *result;
+ if ( status ) {
+ sprintf(tQBuf, "SELECT `id` FROM `modbus_modules` WHERE `wm`='%c', `status`=%d", mode, status);
+ } else {
+ sprintf(tQBuf, "SELECT `id` FROM `modbus_modules` WHERE `wm`='%c'", mode);
+ };
+#ifdef DEBUG_ALL
+ LOG(tQBuf);
+#endif
+ result = m_pDatabase->Query( tQBuf );
+ if( result!= NULL ) {
+ if( result->size() > 0 ) {
+ Assoc *cArr;
+ tVal = new DBC_UINT64_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( atoll( it->second.c_str() ));
+ };
+ };
+ };
+ };
+ };
+ deleteResult( result );
+ };
+ return tVal;
+};
+
+DBC_UINT64_LIST *servaMySQLDBC::listPlatformModules( uint64_t id ){
+ DBC_UINT64_LIST * tVal = NULL;
+ if( m_bIsConnected ){
+ char tQBuf[MAX_PATH_LEN];
+ AAssoc *result;
+ sprintf(tQBuf, "SELECT `mod`.`id` FROM `metro_modules` `mod` LEFT JOIN `metro_tracks` `tra` ON ( `tra`.`id` = `mod`.`track_id` ) WHERE `mod`.`status`='E' AND `tra`.`platform_id`=%" PRIu64, id );
+
+#ifdef DEBUG_ALL
+ LOG(tQBuf);
+#endif
+ result = m_pDatabase->Query( tQBuf );
+ if( result!= NULL ) {
+ if( result->size() > 0 ) {
+ Assoc *cArr;
+ tVal = new DBC_UINT64_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( atoll( it->second.c_str() ));
+ };
+ };
+ };
+ };
+ };
+ deleteResult( result );
+ };
+ return tVal;
+};
+
+DBC_UINT64_LIST *servaMySQLDBC::listPlatforms( char mode ){
+ DBC_UINT64_LIST * tVal = NULL;
+ if( m_bIsConnected ){
+ char tQBuf[MAX_PATH_LEN];
+ AAssoc *result;
+ sprintf(tQBuf, "SELECT `id` FROM `metro_platforms` WHERE `status`='%c'", mode );
+
+#ifdef DEBUG_ALL
+ LOG(tQBuf);
+#endif
+ result = m_pDatabase->Query( tQBuf );
+ if( result!= NULL ) {
+ if( result->size() > 0 ) {
+ Assoc *cArr;
+ tVal = new DBC_UINT64_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( atoll( it->second.c_str() ));
+ };
+ };
+ };
+ };
+ };
+ deleteResult( result );
+ };
+ return tVal;
+};
bool servaMySQLDBC::putIntoLog( CSTR A, CSTR B, CSTR C ){
if( m_bIsConnected ){
@@ -890,7 +1297,7 @@ bool servaMySQLDBC::sessionClose( uint64_t session_id ){
if( m_bIsConnected ){
char tQBuf[CTEXT];
sprintf(tQBuf, "UPDATE `sessions` SET `lts`=UNIX_TIMESTAMP(now()), `final`='Y' WHERE `id`=%" PRIu64, session_id );
-#ifdef DEBUG
+#ifdef DEBUG_ALL
LOG(tQBuf);
#endif
m_pDatabase->SilentQuery(tQBuf);
@@ -904,7 +1311,7 @@ uint64_t servaMySQLDBC::sessionCreate( uint64_t track_id, uint32_t ts, uint16_t
char tQBuf[CTEXT];
sprintf( tQBuf, "INSERT INTO `sessions` SET `ts`=%d, `ts_ms`=%d, `lts`=UNIX_TIMESTAMP(now()), `track_id`=%" PRIu64 ", `uuid`='%s', `src`='%c'",
ts, tsms, track_id, uuid, src );
-#ifdef DEBUG
+#ifdef DEBUG_ALL
LOG(tQBuf);
#endif
return m_pDatabase->QueryID(tQBuf);
@@ -983,7 +1390,20 @@ bool servaMySQLDBC::updateEncodeStatus( uint64_t dbid, uint8_t status, uint8_t p
};
return false;
};
-
+bool servaMySQLDBC::updateModBusRTU( uint64_t dbid, uint8_t status, uint8_t inputs, uint8_t outputs ) {
+ if( m_bIsConnected ) {
+ uint16_t values = inputs;
+ values = (values << 8 ) | outputs;
+ char tQBuf[MAX_PATH_LEN];
+ sprintf( tQBuf, "UPDATE `modbus_modules` SET `status`=%d, `values`=%d WHERE `id`=%" PRIu64, status, values, dbid );
+#ifdef DEBUG_ALL
+ LOG(tQBuf);
+#endif
+ m_pDatabase->SilentQuery( tQBuf );
+ return true;
+ };
+ return false;
+};
bool servaMySQLDBC::updateModuleData( uint64_t DBID, uint32_t UPPER_ID, uint32_t BOTTOM_ID, uint32_t CAM_ID, uint32_t CAM_STREAM_ID, CSTR vstr, CSTR lstr ){
if( m_bIsConnected ) {
char tQBuf[MAX_PATH_LEN];
diff --git a/lib/App/common/serverMySQL_dataBinder.h b/lib/App/common/serverMySQL_dataBinder.h
index cac878f4..2aebe5ae 100644
--- a/lib/App/common/serverMySQL_dataBinder.h
+++ b/lib/App/common/serverMySQL_dataBinder.h
@@ -30,11 +30,16 @@ class servaMySQLDBC: public serverDataBinder {
virtual bool cleanWebCmd();
virtual bool connect( void );
virtual bool deleteSession(uint64_t id );
- virtual DBC_RPC_WEB_CMD * fetchWebCmd( uint64_t id );
- virtual char getMojoWM( uint64_t id );
+ virtual DBC_RPC_WEB_CMD * fetchWebCmd( uint64_t id );
virtual uint64_t getBottomLRF( uint64_t id );
virtual uint32_t getCloudLTS( uint8_t Obj, uint64_t id );
virtual uint8_t getCloudStatus( uint8_t Obj, uint64_t id );
+ virtual CSTR getMediaUUID( uint64_t id );
+ virtual MODBUS_MANAGER_DATA * getModBusManagerData();
+ virtual MODBUS_RTU_INFO * getModBusRTU( uint64_t id );
+ virtual MODBUS_RTU_INFO * getModBusRTU_Platform( uint64_t id );
+ virtual DBC_IS_MODULE_DATA * getModuleData( uint64_t id );
+ virtual char getMojoWM( uint64_t id );
virtual DBC_RPC_MEDIA_INFO * getRemoteMediaInfo( uint64_t id );
virtual DBC_RPC_MEDIA_INFO_EX * getRemoteMediaInfoEx( uint64_t id );
virtual uint64_t getRecentMediaId();
@@ -44,8 +49,13 @@ class servaMySQLDBC: public serverDataBinder {
virtual uint64_t getSessionOldest( uint8_t min_lvl = 2 );
virtual uint64_t getSessionTrackId( uint64_t id );
virtual uint64_t getTrackIdByMojo( uint64_t id );
+ virtual SCADA_TRACK_INFO * getTrackSCADA( uint64_t id );
virtual uint64_t getUpperLRF( uint64_t id );
virtual DBC_UINT64_LIST * listMediaQueueItems( uint8_t status );
+ virtual DBC_UINT64_LIST * listMetroModules( char status );
+ virtual DBC_UINT64_LIST * listModBusRTUs( uint8_t status=0, char mode='E');
+ virtual DBC_UINT64_LIST * listPlatformModules(uint64_t id );
+ virtual DBC_UINT64_LIST * listPlatforms( char mode='E' );
virtual bool putIntoLog( CSTR type, CSTR TS, CSTR Msg );
virtual uint64_t registerMojo( CSTR A, CSTR B );
virtual bool registerServer( uint32_t SiteID, CSTR identity, int PID, uint32_t *ServID, uint32_t *ServNode );
@@ -58,7 +68,7 @@ class servaMySQLDBC: public serverDataBinder {
virtual bool sessionStatAddVid( uint64_t session_id );
virtual bool setCloudStatus( uint8_t Obj, uint64_t id, uint32_t status, CSTR sid = NULL );
virtual bool setNodeOffline( uint32_t NodeID );
- virtual bool setNodeOnline( uint32_t NodeID, uint8_t status );
+ virtual bool setNodeOnline( uint32_t NodeID, uint8_t status );
virtual bool setServerStatValue( SERVER_STAT_ENUM ptp, uint64_t value );
virtual bool setServerStatValue( SERVER_STAT_ENUM ptp, int64_t value );
virtual bool setServerStatValue( SERVER_STAT_ENUM ptp, uint32_t value );
@@ -69,6 +79,7 @@ class servaMySQLDBC: public serverDataBinder {
virtual bool unregisterServer();
virtual bool updateEncodeFormat( uint64_t id, CSTR ext );
virtual bool updateEncodeStatus( uint64_t dbid, uint8_t status, uint8_t perc = 0 );
+ virtual bool updateModBusRTU( uint64_t dbid, uint8_t status=0, uint8_t inputs=0, uint8_t outputs=0 );
virtual bool updateModuleData( uint64_t m_dMojoDBID, uint32_t UPPER_ID, uint32_t BOTTOM_ID, uint32_t CAM_ID, uint32_t CAM_STREAM_ID, CSTR vstr, CSTR lstr );
virtual bool updateServerUtilisation( DBC_SYS_LOAD_INFO *ptr );
virtual bool updateSessionStatus( uint64_t id, uint8_t status );
diff --git a/lib/App/mojo/mojoHardwareManager.h b/lib/App/mojo/mojoHardwareManager.h
index 6174b8c5..cd251d0d 100644
--- a/lib/App/mojo/mojoHardwareManager.h
+++ b/lib/App/mojo/mojoHardwareManager.h
@@ -31,6 +31,7 @@
#include "../../components/base/basicLogCollection.h"
#include "../../components/base/basicSettingsProvider.h"
#include "../../components/base/basicEventHeap.h"
+#include "mojoEvents.h"
#include "../../alg/lgs/detectorStructures.h"
#include "../../alg/generic/heapDebug.h"
#include "../../rgoose/rgooseTypes.h"
diff --git a/lib/App/mojo/mojoKernel.cpp b/lib/App/mojo/mojoKernel.cpp
index 35c9044a..fd4024a0 100644
--- a/lib/App/mojo/mojoKernel.cpp
+++ b/lib/App/mojo/mojoKernel.cpp
@@ -463,6 +463,10 @@ bool mojoKernel::fillMojoInfo( ARGUS_DATA_MOJO_INFO* ptr ){
};
};
};
+ if( tCNT ){
+ free(tA);
+ tA = NULL;
+ };
ptr->CPU_COUNT = m_sSysInfo.CPU_CORES;
ptr->TOT_DISK = m_sSysInfo.T_DISK;
ptr->TOT_MEMO = m_sSysInfo.T_MEM;
diff --git a/lib/App/mojo/mojoKernel.h b/lib/App/mojo/mojoKernel.h
index 8845ea29..c778905d 100644
--- a/lib/App/mojo/mojoKernel.h
+++ b/lib/App/mojo/mojoKernel.h
@@ -26,6 +26,7 @@
#include "../../components/base/basicThread.h"
#include "../../components/base/basicSettingsProvider.h"
#include "../../components/base/basicEventHeap.h"
+#include "../../components/base/basicEvent.h"
#include "../../components/object/objectSystemAnchor.h"
#include "../../alg/lgs/detectorStructures.h"
#include "../../alg/lgs/detector.h"
diff --git a/lib/App/mojo/mojoRemoteClient.cpp b/lib/App/mojo/mojoRemoteClient.cpp
index 3ce6474a..974cc178 100644
--- a/lib/App/mojo/mojoRemoteClient.cpp
+++ b/lib/App/mojo/mojoRemoteClient.cpp
@@ -24,19 +24,37 @@ mojoRemoteClient::mojoRemoteClient( mojoKernel * ptr ):protocolParser(){
m_bRegisteredWithRemotePeer = false;
m_bUseBackupServer = false;
m_bActiveServer = 0;
- m_pVideoHelper = new mojoVideoTransferHelper( ARGUS_RPC_DEFAULT_MEDIA_CHUNK );
+ //m_pVideoHelper = new mojoVideoTransferHelper( ARGUS_RPC_DEFAULT_MEDIA_CHUNK );
+ memset(&m_sINFO, 0, sizeof(ARGUS_DATA_MOJO_INFO));
m_qCMD = new RPC_CMD_QUEUE();
};
mojoRemoteClient::~mojoRemoteClient(){
LOG("Destructor");
- waitThreadEnd( true );
if( m_bRegisteredWithRemotePeer ) {
- //Unregister Mojo
+ LOG("Flushing");
+ //if( m_pVideoHelper ) delete( m_pVideoHelper );
+ while ( m_bRegisteredWithRemotePeer ) {
+ m_mCurrentVTRProtector.lock();
+ if ( m_vVTRHelpers.size() == 0 ) break;
+ m_mCurrentVTRProtector.unlock();
+ SLEEP( DEFAULT_THREAD_SLEEP_TIME );
+ };
+ // If disconnected but still have mem structs!
+ if ( m_vVTRHelpers.size() ) {
+ //while ( m_vVTRHelpers.size() ) {
+ // mojoVideoTransferHelper *tPtr = m_qVTRHelpers.first();
+ // delete( tPtr );
+ // m_qVTRHelpers.pop();
+ //};
+ } else {
+ // Still connected
+ // Unregister Mojo
+ }
};
- LOG("Flushing");
+ waitThreadEnd( true );
flushTransactions();
- if( m_pVideoHelper ) delete( m_pVideoHelper );
+
m_bShutdownCommunication = true;
m_bCommunicationEstablished = false;
m_bRegisteredWithRemotePeer = false;
@@ -49,6 +67,7 @@ mojoRemoteClient::~mojoRemoteClient(){
bool mojoRemoteClient::create(){
if( m_pMaster == NULL ) return false;
+ m_pMaster->fillMojoInfo( &m_sINFO );
if( m_bCommunicationEstablished && ( m_bThreadStatus == TH_WORKING ) ) return true;
m_bAutomationStage = ARGUS_RPC_STAGE_CONNECT;
m_pCurrentCMD = NULL;
@@ -156,33 +175,85 @@ bool mojoRemoteClient::packetHandler( protocolPackage *Package ){
tDBID = ( tDBID << 8 ) | Package->m_pData[ARGUS_HEADER_SIZE+6];
tDBID = ( tDBID << 8 ) | Package->m_pData[ARGUS_HEADER_SIZE+7];
tDBID = ( tDBID << 8 ) | Package->m_pData[ARGUS_HEADER_SIZE+8];
-#ifdef DEBUG_EXTRA
+#ifdef DEBUG
char tZ[128];
sprintf( tZ, "Video Ack %lld ID", tDBID );
LOG( tZ );
#endif
- m_pVideoHelper->setRemoteReferenceID( tDBID );
+ m_mCurrentVTRProtector.lock();
+ if ( tDBID ) {
+ VTR_HELPER *tHELP = m_vVTRHelpers.at(0);
+ tHELP->ptr->setRemoteReferenceID( tDBID );
+ tHELP->state = 2;
+ tHELP->ts = time( NULL );
+ } else {
+ //Abort Transaction
+ m_vVTRHelpers.at(0)->state = 3;
+ m_mCurrentVTRProtector.unlock();
+ break;
+ };
+ m_mCurrentVTRProtector.unlock();
};
case ARGUS_DATA_MSG_VIDEO_DATA:{
RPC_CMD_RECORD *tCMD = (RPC_CMD_RECORD *)malloc(sizeof(RPC_CMD_RECORD));
if ( tCMD ) {
uint32_t tSize;
tCMD->CMD = ARGUS_DATA_MSG_VIDEO_DATA;
- tCMD->DATA = (void *)m_pVideoHelper->getNextChunk( ARGUS_RPC_DEFAULT_MEDIA_CHUNK, &tSize );
- tCMD->DATA_SIZE = tSize;
+ m_mCurrentVTRProtector.lock();
+ if ( m_vVTRHelpers.size() == 0 ) {
+ tCMD->DATA = NULL;
+ tCMD->DATA_SIZE = 0;
+ if( !m_qCMD->push( tCMD ) ){
+ free( tCMD );
+ };
+ m_mCurrentVTRProtector.unlock();
+ finishTransaction(); //?? Do we need it
+ break;
+ };
+ tCMD->DATA = (void *)m_vVTRHelpers.at(0)->ptr->getNextChunk(ARGUS_RPC_DEFAULT_MEDIA_CHUNK, &tSize);
+ m_mCurrentVTRProtector.unlock();
+ tCMD->DATA_SIZE = tSize;
#ifdef DEBUG_EXTRA
char tC[128];
sprintf( tC, "Sending Video Chunk %d bytes", tSize );
LOG( tC );
-#endif
+#endif
if ( tCMD->DATA ) {
+ /*
+ //Direct Send to peer data
if ( peer_send_rpc_pack( tCMD ) ) {
setTO( 1 );
free( tCMD->DATA );
free( tCMD );
+ if ( tSize < ARGUS_RPC_DEFAULT_MEDIA_CHUNK ) {
+ //Last Chunk
+ m_mCurrentVTRProtector.lock();
+ mojoVideoTransferHelper tPtr = m_qVTRHelpers.first();
+ delte( tPtr );
+ m_qVTRHelpers.pop();
+ if ( !m_qVTRHelpers.empty() ) {
+ };
+ m_mCurrentVTRProtector.unlock();
+ };
+ break;
+ };
+ free( tCMD->DATA );
+ */
+ // Send Via Queue
+ if( m_qCMD->push( tCMD ) ){
+ m_mCurrentVTRProtector.lock();
+ m_vVTRHelpers.at(0)->ts = time(NULL);
+ m_mCurrentVTRProtector.unlock();
+ finishTransaction(); //?? Do we need it
break;
};
free( tCMD->DATA );
+ } else {
+ LOG("Finish");
+ // Finish Send That File
+ m_mCurrentVTRProtector.lock();
+ m_vVTRHelpers.at(0)->state = 3;
+ m_mCurrentVTRProtector.unlock();
};
free( tCMD );
};
@@ -298,8 +369,7 @@ void mojoRemoteClient::enqueueInfoMsg(){
tCMD->DATA_SIZE = sizeof( ARGUS_DATA_MOJO_INFO );
tCMD->DATA = malloc(tCMD->DATA_SIZE);
if (tCMD->DATA) {
- LOG("Send Client Info!");
- m_pMaster->fillMojoInfo( (ARGUS_DATA_MOJO_INFO*)tCMD->DATA );
+ memcpy( tCMD->DATA, &m_sINFO, sizeof( ARGUS_DATA_MOJO_INFO ) );
LOG("ARGUS_DATA_MOJO_INFO");
if ( pushNewTransaction( tCMD ) ) return;
free( tCMD->DATA );
@@ -308,6 +378,10 @@ void mojoRemoteClient::enqueueInfoMsg(){
};
};
+#include "../common/deviceNodeCamera.h"
+#include "../common/deviceNodeSensor.h"
+#include "../common/deviceNodeFactory.h"
+
void mojoRemoteClient::enqueueStatMsg(){
RPC_CMD_RECORD *tCMD = (RPC_CMD_RECORD *)malloc(sizeof(RPC_CMD_RECORD));
if ( tCMD ) {
@@ -325,36 +399,79 @@ void mojoRemoteClient::enqueueStatMsg(){
//if( cSTATUS->CPU_TEMP == 0xFF ) cSTATUS->CPU_TEMP = 0;
cSTATUS->DISK_UTI = cSYSSTAT.disk;
cSTATUS->MEMO_UTI = cSYSSTAT.mem;
- DBC_INT_LIST * tList;
- tList = m_pMaster->m_pDBC->listLRFSensors();
- if ( tList ) {
- for( uint8_t idx=0; idxsize(); idx++ ) {
- uint8_t tS = m_pMaster->m_pDBC->getLRFDataStatus( tList->at(idx) );
- if ( tS > 1 ) {
- cSTATUS->STATUSES = cSTATUS->STATUSES | (1 << idx);
+
+ deviceNode **tA = NULL;
+ uint32_t tCNT = deviceNodeFactory::getInstance()->fetchNodes( ARGUS_ALS_SENSOR, tA );
+ if( !tCNT ){
+ tCNT = deviceNodeFactory::getInstance()->fetchNodes( ARGUS_LFS_SENSOR, tA );
+ if( !tCNT ){
+ tCNT = deviceNodeFactory::getInstance()->fetchNodes( ARGUS_PLS_200_SENSOR, tA );
+ if( !tCNT ){
+ tCNT = deviceNodeFactory::getInstance()->fetchNodes( ARGUS_PLS_360_SENSOR, tA );
+ if( !tCNT ){
+ tCNT = deviceNodeFactory::getInstance()->fetchNodes( ARGUS_3D_SENSOR, tA );
+ if( !tCNT ){
+ tCNT = deviceNodeFactory::getInstance()->fetchNodes( ARGUS_NET_PLS_200, tA );
+ };
+ };
};
};
- tList->clear();
- delete( tList );
- };
- tList = m_pMaster->m_pDBC->listCameras();
- if ( tList ) {
- for( uint8_t idx=0; idxsize(); idx++ ) {
- DBC_CAM_DATA *tCD = m_pMaster->m_pDBC->getCamData( tList->at(idx) );
- if ( tCD ) {
- if( tCD->online ) {
- cSTATUS->STATUSES = cSTATUS->STATUSES | (0x80000000 >> (idx<<1));
+ };
+ if( tCNT ){
+ for ( int i = 0; i < tCNT; i++) {
+ deviceNodeSensor *tSENS = (deviceNodeSensor*) tA[i];
+ if (tSENS) {
+ uint16_t ttt = tSENS->getSensStatus();
+ if ( ttt > 2 ) {
+ ttt = 1;
+ } else {
+ ttt = 2;
};
- // check the stream
- if( tCD->online ) {
- cSTATUS->STATUSES = cSTATUS->STATUSES | (0x40000000 >> (idx<<1));
+ cSTATUS->STATUSES = cSTATUS->STATUSES | ( ttt <<(i*3) );
+ } else LOG("No Sensor PTR!!");
+ };
+ free( tA );
+ tA = NULL;
+#ifdef DEBUG_EXTRA
+ } else {
+ LOG("No Sensors Defined/Enabled In the system!");
+#endif
+ };
+
+ tCNT = deviceNodeFactory::getInstance()->fetchNodes( ARGUS_ANALOG_STATIC_CAMERA, tA );
+ if( !tCNT ){
+ tCNT = deviceNodeFactory::getInstance()->fetchNodes( ARGUS_ANALOG_PTZ_CAMERA, tA );
+ if( !tCNT ){
+ tCNT = deviceNodeFactory::getInstance()->fetchNodes( ARGUS_IP_STATIC_CAMERA, tA );
+ if( !tCNT ){
+ tCNT = deviceNodeFactory::getInstance()->fetchNodes( ARGUS_IP_PTZ_CAMERA, tA );
+ if( !tCNT ){
+ tCNT = deviceNodeFactory::getInstance()->fetchNodes( ARGUS_IP_PRESET_CAMERA, tA );
+ if( !tCNT ){
+ tCNT = deviceNodeFactory::getInstance()->fetchNodes( ARGUS_ANALOG_PRESET_CAMERA, tA );
+ };
};
- free( tCD );
};
};
- tList->clear();
- delete( tList );
};
+ if( tCNT ){
+ for ( int i = 0; i < tCNT; i++) {
+ deviceNodeCamera *tCAM = (deviceNodeCamera*) tA[i];
+ cSTATUS->STATUSES = cSTATUS->STATUSES | ( (tCAM->getCamStatus() > 0)?(ARGUS_RPC_STATUS_CAM_OK<<(i*3)):0);
+ cSTATUS->STATUSES = cSTATUS->STATUSES | ( (tCAM->getStreamStatus() > 0)?0:(ARGUS_RPC_STATUS_CAM_OK<<(i*3+1)));
+ cSTATUS->STATUSES = cSTATUS->STATUSES | ( (tCAM->getPtzStatus() > 0)?0:(ARGUS_RPC_STATUS_CAM_OK<<(i*3+2)));
+ };
+ free( tA );
+#ifdef DEBUG_EXTRA
+ } else {
+ LOG("No Camera Defined/Enabled In the system!");
+#endif
+ };
+#ifdef DEBUG_EXTRA
+ char tB[128];
+ sprintf( tB, "Final Status: 0x%04X", cSTATUS->STATUSES );
+ LOG( tB );
+#endif
if ( pushNewTransaction( tCMD ) ) return;
free( tCMD->DATA );
};
@@ -423,15 +540,21 @@ void mojoRemoteClient::m_fThreadProc( void ){
switch ( getAutomationStage() ) {
case ARGUS_RPC_STAGE_CONNECT:{
flushTransactions();
-#ifdef DEBUG
- char tB[128];
- sprintf(tB,"Creating Remote connection to [%s:%d]", m_pMaster->m_sSiteData.remote_ip, m_pMaster->m_sSiteData.remote_port );
- LOG( tB );
-#endif
if ( m_bUseBackupServer ) {
if ( m_bActiveServer == 0 ) {
+#ifdef DEBUG
+ char tB[128];
+ sprintf(tB,"Creating Remote connection to Main Server [%s:%d]", m_pMaster->m_sSiteData.remote_ip, m_pMaster->m_sSiteData.remote_port );
+ LOG( tB );
+#endif
m_pPort = new clientPort( m_pMaster->m_sSiteData.remote_ip, m_pMaster->m_sSiteData.remote_port );
+
} else {
+#ifdef DEBUG
+ char tB[128];
+ sprintf(tB,"Creating Remote connection to Backup Server [%s:%d]", m_pMaster->m_sSiteData.remote_backup_ip, m_pMaster->m_sSiteData.remote_backup_port );
+ LOG( tB );
+#endif
m_pPort = new clientPort( m_pMaster->m_sSiteData.remote_backup_ip, m_pMaster->m_sSiteData.remote_backup_port );
}
if( m_pPort ) {
@@ -445,6 +568,7 @@ void mojoRemoteClient::m_fThreadProc( void ){
setTransport( m_pPort, false );
setAutomationStage( ARGUS_RPC_STAGE_REGISTER );
} else {
+ LOG_ERROR("Connection to Remote Server Failed!");
setConnectionStatus( CS_DISCONNECTED );
setTransport( NULL, false );
delete( m_pPort );
@@ -459,18 +583,24 @@ void mojoRemoteClient::m_fThreadProc( void ){
};
} else {
if (m_pMaster->m_sSiteData.remote_port) {
+#ifdef DEBUG
+ char tB[128];
+ sprintf(tB,"Creating Remote connection to Alone Server [%s:%d]", m_pMaster->m_sSiteData.remote_ip, m_pMaster->m_sSiteData.remote_port );
+ LOG( tB );
+#endif
m_pPort = new clientPort( m_pMaster->m_sSiteData.remote_ip, m_pMaster->m_sSiteData.remote_port );
if( m_pPort ) {
if( m_pPort->create() ) {
- #ifdef DEBUG
+#ifdef DEBUG
LOG("Connection Sucessfull");
- #endif
+#endif
m_bShutdownCommunication = false;
m_bCommunicationEstablished = true;
m_bRegisteredWithRemotePeer = false;
setTransport( m_pPort, false );
setAutomationStage( ARGUS_RPC_STAGE_REGISTER );
} else {
+ LOG_ERROR("Connection to Remote Server Failed!");
setConnectionStatus( CS_DISCONNECTED );
setTransport( NULL, false );
delete( m_pPort );
@@ -497,21 +627,28 @@ void mojoRemoteClient::m_fThreadProc( void ){
#ifdef DEBUG
LOG("Stage Register!");
#endif
- m_pCurrentCMD = (RPC_CMD_RECORD*) malloc(sizeof(RPC_CMD_RECORD));
- if ( m_pCurrentCMD ) {
- m_pCurrentCMD->CMD = ARGUS_DATA_MSG_REGISTER;
- m_pCurrentCMD->DATA_SIZE = strlen( m_pMaster->m_sIdentity );
- m_pCurrentCMD->DATA = malloc(m_pCurrentCMD->DATA_SIZE);
- if ( m_pCurrentCMD->DATA ) {
- strncpy( (char *)m_pCurrentCMD->DATA, m_pMaster->m_sIdentity, m_pCurrentCMD->DATA_SIZE );
- if( peer_send_rpc_pack( m_pCurrentCMD ) ){
- setTO( 3 ); // Wait for 3 seconds to be registered with server
- setAutomationStage( ARGUS_RPC_STAGE_WAIT_ACK );
- break;
+ CSTR tIP = m_pPort->getLocalIp4();
+ if( tIP ) {
+ m_pCurrentCMD = (RPC_CMD_RECORD *)malloc(sizeof(RPC_CMD_RECORD));
+ if ( m_pCurrentCMD ) {
+ m_pCurrentCMD->CMD = ARGUS_DATA_MSG_REGISTER;
+ m_pCurrentCMD->DATA_SIZE = sizeof( ARGUS_DATA_MOJO_REGISTRATION );//strlen( m_pMaster->m_sIdentity );
+ m_pCurrentCMD->DATA = malloc(m_pCurrentCMD->DATA_SIZE);
+ if ( m_pCurrentCMD->DATA ) {
+ memset( m_pCurrentCMD->DATA, 0, m_pCurrentCMD->DATA_SIZE );
+ strncpy( ((ARGUS_DATA_MOJO_REGISTRATION *)m_pCurrentCMD->DATA)->identity, m_pMaster->m_sIdentity, 32 );
+ strncpy(((ARGUS_DATA_MOJO_REGISTRATION *)m_pCurrentCMD->DATA)->peer, tIP, 22);
+ if( peer_send_rpc_pack( m_pCurrentCMD ) ){
+ setTO( 3 ); // Wait for 3 seconds to be registered with server
+ setAutomationStage( ARGUS_RPC_STAGE_WAIT_ACK );
+ free( tIP );
+ break;
+ };
+ free( m_pCurrentCMD->DATA );
};
- free( m_pCurrentCMD->DATA );
+ free( m_pCurrentCMD );
};
- free( m_pCurrentCMD );
+ free( tIP );
};
m_pCurrentCMD = NULL;
break;
@@ -545,7 +682,9 @@ void mojoRemoteClient::m_fThreadProc( void ){
if ( !decTO() ) setAutomationStage( ARGUS_RPC_STAGE_CLOSE );
break;
};
- case ARGUS_RPC_STAGE_IDLE: if( ( tSecondsCounter % ARGUS_SECONDS_TO_SYNC_TIME ) == 15 ) enqueueTimeReq(); else enqueueStatMsg(); break;
+ case ARGUS_RPC_STAGE_IDLE: {
+ if( ( tSecondsCounter % ARGUS_SECONDS_TO_SYNC_TIME ) == 15 ) enqueueTimeReq(); else enqueueStatMsg(); break;
+ };
case ARGUS_RPC_STAGE_DISCONNECT:{
LOG("Stage Disconnect!");
// Gracefully Disconnect
@@ -571,8 +710,53 @@ void mojoRemoteClient::m_fThreadProc( void ){
break;
};
};
+ m_mCurrentVTRProtector.lock();
+ if ( m_vVTRHelpers.size() ) {
+ //Handle New Video Transfer
+ LOG("CHK HLPR");
+ if( m_vVTRHelpers.at(0)->state == 0 ){
+ RPC_CMD_RECORD *tPack = (RPC_CMD_RECORD *)malloc(sizeof(RPC_CMD_RECORD));
+ if ( tPack ) {
+ tPack->DATA_SIZE = sizeof( ARGUS_DATA_VIDEO_INFO );
+ tPack->DATA = malloc( tPack->DATA_SIZE );
+ if ( tPack->DATA ) {
+ memcpy( tPack->DATA, m_vVTRHelpers.at(0)->ptr->getVideoInfo(), tPack->DATA_SIZE );
+ tPack->CMD = ARGUS_DATA_MSG_VIDEO_INFO;
+ if( m_qCMD->push( tPack ) ){
+ m_vVTRHelpers.at(0)->state = 1;
+ m_vVTRHelpers.at(0)->ts = cTimeTSeconds;
+ } else {
+ free( tPack->DATA );
+ free( tPack );
+ }
+ } else {
+ free( tPack );
+ };
+ };
+ };
+ /// Validate Stalled/ Finished Videos (Try To Send next time
+ for ( V_VIDEO_TRANSFER_HELPERS::iterator idx = m_vVTRHelpers.begin(); idx != m_vVTRHelpers.end(); idx++ ) {
+ if ( (*idx)->state == 2 ) {
+ if ((cTimeTSeconds - (*idx)->ts) > 5) {
+ // The transfer is staled
+ (*idx)->state = 0;
+ }
+ };
+ if ( (*idx)->state == 3 ){
+ LOG("Del HLPR");
+ //Finished Transfer
+ delete( (*idx)->ptr );
+ free( (*idx) );
+ m_vVTRHelpers.erase(idx);
+ LOG("Erase HLPR done");
+ break; // must revalidate Beg-End conditions for FOR loop
+ };
+ };
+ };
+ m_mCurrentVTRProtector.unlock();
};
- if ( validateTransaction() ) {
+
+ if (validateTransaction()) {
if ( fetchNewTransaction() ) {
if( peer_send_rpc_pack( m_pCurrentCMD ) ) {
setTO( 1 );
@@ -674,6 +858,20 @@ bool mojoRemoteClient::validate(){
return true;
};
+VTR_HELPER *mojoRemoteClient::getHelperByDBID( uint64_t dbid ){
+ m_mCurrentVTRProtector.lock();
+ if( m_vVTRHelpers.size() ){
+ for ( V_VIDEO_TRANSFER_HELPERS::iterator idx = m_vVTRHelpers.begin(); idx != m_vVTRHelpers.end(); idx++ ) {
+ if ( (*idx)->ptr->getRemoteReferenceID() == dbid ) {
+ m_mCurrentVTRProtector.unlock();
+ return (*idx);
+ };
+ };
+ };
+ m_mCurrentVTRProtector.unlock();
+ return NULL;
+};
+
bool mojoRemoteClient::addEvent( EVENT_CONTAINER *Evt ){
#ifdef DEBUG_EXTRA
LOG("Add Evt!");
@@ -703,22 +901,24 @@ bool mojoRemoteClient::addVideo( VIDEO_SEGMENT_INFO *ptr ){
LOG("Add Video!");
#endif
if ( ptr == NULL ) return false;
- if ( m_pVideoHelper == NULL ) return false;
-
- RPC_CMD_RECORD *tPack = (RPC_CMD_RECORD *)malloc(sizeof(RPC_CMD_RECORD));
- if ( tPack ) {
- if( m_pVideoHelper->init( ptr ) ) {
- tPack->DATA_SIZE = sizeof( ARGUS_DATA_VIDEO_INFO );
- tPack->DATA = malloc( tPack->DATA_SIZE );
- if ( tPack->DATA ) {
- memcpy( tPack->DATA, m_pVideoHelper->getVideoInfo(), tPack->DATA_SIZE );
- tPack->CMD = ARGUS_DATA_MSG_VIDEO_INFO;
- if( m_qCMD->push( tPack ) ) return true;
- free( tPack->DATA );
+ VTR_HELPER *tHLPR = (VTR_HELPER*) malloc( sizeof(VTR_HELPER));
+ if ( tHLPR ) {
+ tHLPR->state = 0;
+ tHLPR->ptr = new mojoVideoTransferHelper( ARGUS_RPC_DEFAULT_MEDIA_CHUNK );
+ LOG("NW HLPR");
+ if ( tHLPR->ptr ) {
+ LOG("HLPR OK");
+ if ( tHLPR->ptr->init( ptr )) {
+ LOG("HLPR INIT OK");
+ m_mCurrentVTRProtector.lock();
+ m_vVTRHelpers.push_back( tHLPR );
+ m_mCurrentVTRProtector.unlock();
+ LOG("HLPR PUSH OK");
+ return true;
};
- m_pVideoHelper->abort();
+ delete( tHLPR->ptr );
};
- free( tPack );
+ free (tHLPR);
};
return false;
};
@@ -737,8 +937,11 @@ mojoVideoTransferHelper::mojoVideoTransferHelper( uint32_t buffer_size ){
mojoVideoTransferHelper::~mojoVideoTransferHelper(){
+ LOG("HDESTRC");
abort();
+ LOG("HDESTRC DONE");
};
+
#include
bool mojoVideoTransferHelper::init( VIDEO_SEGMENT_INFO *ptr ){
@@ -758,6 +961,7 @@ bool mojoVideoTransferHelper::init( VIDEO_SEGMENT_INFO *ptr ){
m_sIn.DTS = ptr->streamTSS;
m_sIn.DMS = ptr->streamTMS;
m_sIn.FPS = ptr->streamFPS;
+ m_sIn.REF_ID = m_nRemoteRefID;
strncpy( m_sIn.FMT, ptr->recordEXT, 5 );
m_sIn.FMT[5]=(char)0;
m_sIn.WIDTH = ptr->streamWidth;
diff --git a/lib/App/mojo/mojoRemoteClient.h b/lib/App/mojo/mojoRemoteClient.h
index f31b4c6b..c42df78f 100644
--- a/lib/App/mojo/mojoRemoteClient.h
+++ b/lib/App/mojo/mojoRemoteClient.h
@@ -40,13 +40,22 @@ class mojoVideoTransferHelper{
void abort();
void registerEventID( uint32_t local, uint64_t remote );
void setRemoteReferenceID( uint64_t rid ){ m_nRemoteRefID = rid; };
+ uint64_t getRemoteReferenceID(){ return m_nRemoteRefID; };
};
+typedef struct S_VTR_HELPER{
+ mojoVideoTransferHelper * ptr;
+ uint8_t state;
+ uint32_t ts;
+}VTR_HELPER;
+typedef std::vector V_VIDEO_TRANSFER_HELPERS;
+typedef std::queue Q_VIDEO_TRANSFER_HELPERS;
class mojoRemoteClient: public basicThread, public protocolParser{
private:
basicLogCollection * m_pLog;
mojoKernel * m_pMaster;
+ ARGUS_DATA_MOJO_INFO m_sINFO;
bool m_bUseBackupServer;
uint8_t m_bActiveServer;
clientPort * m_pPort;
@@ -57,7 +66,9 @@ class mojoRemoteClient: public basicThread, public protocolParser{
RPC_CMD_QUEUE * m_qCMD;
basicMutex m_mCurrentCMDProtector;
RPC_CMD_RECORD * m_pCurrentCMD;
- mojoVideoTransferHelper * m_pVideoHelper;
+ basicMutex m_mCurrentVTRProtector;
+ V_VIDEO_TRANSFER_HELPERS m_vVTRHelpers;
+ //mojoVideoTransferHelper * m_pVideoHelper;
uint32_t m_nQueryMessage;
uint32_t m_nInbondSerial;
uint32_t m_nOutbondSerial;
@@ -85,6 +96,7 @@ class mojoRemoteClient: public basicThread, public protocolParser{
basicMutex m_mTOProtoctor;
void setTO( uint8_t seconds );
bool decTO();
+ VTR_HELPER * getHelperByDBID( uint64_t dbid );
protected:
virtual int packetChecker( U8 *Buffer, size_t BufferSize);
virtual protocolPackage * packetExtractor( U8 *Buffer, size_t BufferSize);
diff --git a/lib/App/mojo/rgooseModuleEmbedVideo.h b/lib/App/mojo/rgooseModuleEmbedVideo.h
index 4215e4ea..80603b2c 100644
--- a/lib/App/mojo/rgooseModuleEmbedVideo.h
+++ b/lib/App/mojo/rgooseModuleEmbedVideo.h
@@ -4,6 +4,7 @@
#include "../components/base/basicMutex.h"
#include "../components/base/basicThread.h"
#include "../components/base/basicEventHeap.h"
+#include "mojoEvents.h"
//#include "../data/media/video/videoAVLIBDestination.h"
#include "../components/base/basicMediaSource.h"
#include "../components/base/basicMediaDestination.h"
diff --git a/lib/App/mojo/rgooseModuleFlyHunter.h b/lib/App/mojo/rgooseModuleFlyHunter.h
index f2e03dea..5b1900d8 100644
--- a/lib/App/mojo/rgooseModuleFlyHunter.h
+++ b/lib/App/mojo/rgooseModuleFlyHunter.h
@@ -3,6 +3,7 @@
#include "rgooseModule.h"
#include "../components/base/basicThread.h"
#include "../components/base/basicEventHeap.h"
+#include "mojoEvents.h"
#include "../data/protocol/protocolMAVLINK.h"
diff --git a/lib/App/mojo/rgooseModuleKafka.h b/lib/App/mojo/rgooseModuleKafka.h
index e91662ad..c5226b33 100644
--- a/lib/App/mojo/rgooseModuleKafka.h
+++ b/lib/App/mojo/rgooseModuleKafka.h
@@ -5,6 +5,7 @@
#include "rgooseModule.h"
#include "../components/base/basicThread.h"
#include "../components/base/basicEventHeap.h"
+#include "mojoEvents.h"
#include "../data/protocol/protocolKAFKA.h"
//#define SIMULATOR
diff --git a/lib/App/mojo/rgooseModuleOnvifObserver.h b/lib/App/mojo/rgooseModuleOnvifObserver.h
index bfae3834..7197ca5d 100644
--- a/lib/App/mojo/rgooseModuleOnvifObserver.h
+++ b/lib/App/mojo/rgooseModuleOnvifObserver.h
@@ -6,6 +6,7 @@
#include "../components/base/basicThread.h"
#include "../components/base/basicMutex.h"
#include "../components/base/basicEventHeap.h"
+#include "mojoEvents.h"
#pragma warning(disable: 4251)
diff --git a/lib/App/mojo/rgooseModuleSSDP.h b/lib/App/mojo/rgooseModuleSSDP.h
index ef1aaadf..6e7e2f8c 100644
--- a/lib/App/mojo/rgooseModuleSSDP.h
+++ b/lib/App/mojo/rgooseModuleSSDP.h
@@ -3,6 +3,7 @@
#include "rgooseModule.h"
#include "../components/base/basicThread.h"
#include "../components/base/basicEventHeap.h"
+#include "mojoEvents.h"
diff --git a/lib/App/serva/lifeMonitoring.cpp b/lib/App/serva/lifeMonitoring.cpp
deleted file mode 100644
index 2ec8d389..00000000
--- a/lib/App/serva/lifeMonitoring.cpp
+++ /dev/null
@@ -1,16 +0,0 @@
-#include "lifeMonitoring.h"
-
-servaLifeMonitoring *servaLifeMonitoring::_Instance = 0;
-
-servaLifeMonitoring *servaLifeMonitoring::getInstance(){
- if( _Instance == 0 ){
- _Instance = new servaLifeMonitoring();
- };
- return _Instance;
-};
-
-servaLifeMonitoring::servaLifeMonitoring(){
-};
-
-servaLifeMonitoring::~servaLifeMonitoring(){
-};
\ No newline at end of file
diff --git a/lib/App/serva/lifeMonitoring.h b/lib/App/serva/lifeMonitoring.h
deleted file mode 100644
index 9badb337..00000000
--- a/lib/App/serva/lifeMonitoring.h
+++ /dev/null
@@ -1,15 +0,0 @@
-#ifndef __ARGUS_SERVER_LIFE_MONOTORING__
-#define __ARGUS_SERVER_LIFE_MONOTORING__
-
-
-class servaLifeMonitoring{
- private:
- static servaLifeMonitoring * _Instance;
- servaLifeMonitoring();
- public:
- static servaLifeMonitoring * getInstance();
- ~servaLifeMonitoring();
-};
-
-
-#endif
\ No newline at end of file
diff --git a/lib/App/serva/servaKernel.cpp b/lib/App/serva/servaKernel.cpp
index c8ce451e..c7c21c7d 100644
--- a/lib/App/serva/servaKernel.cpp
+++ b/lib/App/serva/servaKernel.cpp
@@ -22,11 +22,12 @@
#include
#include
-#include "../common/kernelEventFilterAPF.h"
-#include "../common/kernelEventFilterTrain.h"
-#include "../common/kernelModuleEmbedVideo.h"
+//#include "../common/kernelEventFilterAPF.h"
+//#include "../common/kernelEventFilterTrain.h"
+//#include "../common/kernelModuleEmbedVideo.h"
#include "../common/serverMySQL_dataBinder.h"
+#include "servaModBusManager.h"
#define LOG( X ) kernelPrototype::m_pLog->Log( "KRNL", this, X )
#ifdef DEBUG
@@ -60,6 +61,7 @@ servaKernel::servaKernel( config_setting_t *ptr ):kernelPrototype( ptr ){
m_pLifeMonitor = servaLifeMonitoring::getInstance();
m_pSM = NULL;
m_pRPC = NULL;//??
+ m_pModBus = NULL;
memset( &m_sServaConfig, 0, sizeof( DBC_SERVA_CONFIG ));
setWM( WM_NONE );
};
@@ -76,6 +78,9 @@ servaKernel::~servaKernel(){
// LOG( "BopBop!" );
// SLEEP(1000);
//};
+ if ( m_pModBus ) {
+ delete( (servaModBusManager *) m_pModBus );
+ };
#ifdef LINUX_KERNEL_WATCHDOG
LOG("Disable WD!");
if( m_iWatchdogFd > -1 ) {
@@ -131,11 +136,21 @@ bool servaKernel::create(){
};
LOG("Register Server ... ");
- registerServA();
+ registerServA();
m_pSM = servaSessionManager::getInstance( m_pSettings );
if ( m_pSM ){
cleanUpMess();
if ( m_pSM->create() ) {
+ LOG("Session Manager Created");
+ servaModBusManager * tModBus = servaModBusManager::getInstance();
+ if( tModBus ){
+ LOG("Have ModBus Instance");
+ if( tModBus->create() ){
+ LOG("Modbus Created");
+ m_pModBus = (void *) tModBus;
+ } else delete( tModBus );
+ };
+
m_pRPC = servaRemoteClient::getInstance(this);
if ( m_pRPC ) {
if( m_pRPC->start() ) return init();
@@ -151,9 +166,168 @@ void servaKernel::m_fThreadProc( void ){
m_bThreadStatus = TH_WORKING;
LOG("ServA Started!");
while ( m_bThreadStatus < TH_ENDED ) {
+ if( DBC_RPC_WEB_CMD * tCMD = m_pDBC->fetchWebCmd( 0 ) ) {
+ m_pDBC->updateWebCmdStatus( tCMD->id, DBC_CMD_STARTED );
+ switch( tCMD->cmd ){
+ case CMD_KRNL_RELOAD:{
+ LOG("Reload ServA Node!");
+ m_bThreadStatus = TH_ENDED;
+ setExitCause( EXIT_CODE_RELOAD_SERVICES );
+ break;
+ };
+ case CMD_KRNL_RESTART:{
+ LOG("Restart ServA Node!");
+ m_bThreadStatus = TH_ENDED;
+ setExitCause( EXIT_CODE_KERNEL_CLEAR );
+ break;
+ };
+ case CMD_KRNL_FACTORY_RESET:{
+ LOG("Restart ServA -> Factory Reset!");
+ m_bThreadStatus = TH_ENDED;
+ setExitCause( EXIT_CODE_FACTORY_RESET );
+ break;
+ };
+ case CMD_NODES_RELOAD:{
+ //if( m_pNodeFactory != NULL ) {
+ // m_pNodeFactory->reloadNodes();
+ //};
+ break;
+ };
+ case CMD_NODE_RELOAD:{
+ uint32_t tNodeID = atoi( tCMD->param );
+ //if( m_pNodeFactory != NULL ) {
+ // m_pNodeFactory->reloadNode( tNodeID );
+ //};
+ break;
+ };
+ case CMD_KRNL_PNP:{
+ //if( m_pHardwareManager!= NULL ) {
+ // LOG_ERROR( "Restart and Detect HardWare!" );
+ // // Must be shutdowned all service that uses hardware prior to detection!
+ // m_bThreadStatus = TH_ENDED;
+ // setExitCause( EXIT_CODE_DETECT_HARDWARE ); // Go -> Detect Hardware in BACKEND
+ //};
+ break;
+ };
+ case CMD_KRNL_UPDATE_IDENT:{
+ //LOG("Restart Mojo -> Update Ident!");
+ //sprintf( m_sIdentity, tCMD->PARAM );
+ //config_setting_remove ( m_pSettings, MOJO_KERNEL_TAG_SERVER_IDENTITY );
+ //config_setting_t *pSetting = config_setting_add( m_pSettings, MOJO_KERNEL_TAG_SERVER_IDENTITY, CONFIG_TYPE_STRING );
+ //config_setting_set_string( pSetting, tCMD->PARAM );
+ //basicSettingsProvider::getInstance()->compromise();
+ //basicSettingsProvider::getInstance()->validate();
+ //m_pDBC->updateServerIdentity( m_nServerID, m_sIdentity );
+
+ m_bThreadStatus = TH_ENDED;
+ setExitCause( EXIT_CODE_KERNEL_CLEAR );
+ break;
+ };
+ case CMD_KRNL_REPLACE_DATABASE:{
+ LOG("Restart Mojo -> Replace Database!");
+ //CSTR tNAME = m_pDBC->getDataParam( 0 );
+ //CSTR tUSER = m_pDBC->getDataParam( 1 );
+ //CSTR tGROUP = m_pDBC->getDataParam( 2 );
+ //if ( tNAME ) {
+ // char tB[256];
+ // sprintf( tB,"./data/%s.db", tCMD->PARAM );
+ // if ( fileExist( tB )) {
+ // LOG("Restart Mojo -> Close Database!");
+ //Closing Database
+ // delete( m_pDBC );
+ // m_pDBC = NULL;
+ // LOG("Restart Mojo -> Delete Database!");
+ // //unlink( tNAME );
+ // LOG("Restart Mojo -> Copy Database!");
+ // fileCopy( tB, tNAME );
+ // LOG("Restart Mojo -> Chown Database!");
+ // ch_chown( tNAME, tUSER, tGROUP );
+ // LOG("Restart Mojo -> Delete Old Database!");
+ // unlink( tB );
+ // m_bThreadStatus = TH_ENDED;
+ // LOG("Restart Mojo -> Exit!");
+ // setExitCause( EXIT_CODE_NO_DATABASE );//EXIT_CODE_RELOAD_SERVICES );
+ // m_bThreadStatus = TH_ENDED;
+ // } else {
+ // LOG_ERROR("New Database Does not Exists!");
+ // };
+ //free( tNAME );
+ //free( tUSER );
+ //free( tGROUP );
+ //};
+ break;
+ };
+ case CMD_KRNL_SYNC_TIME:{
+ uint32_t uts = atoi( tCMD->param );
+ if( uts ){
+#if ( __GLIBC__ < 3 ) && ( __GLIBC_MINOR__ < 31 )
+ time_t ts = (time_t)uts;
+ if( stime( &ts ) == 0 ){
+ // Restert Server;
+ m_bThreadStatus = TH_ENDED;
+ setExitCause( EXIT_CODE_KERNEL_CLEAR );
+ };
+#else
+ timespec ts;
+ ts.tv_sec = (time_t)uts;
+ ts.tv_nsec = 0;
+ if( clock_settime( CLOCK_REALTIME, &ts ) == 0 ){
+ // Restert Server;
+ m_bThreadStatus = TH_ENDED;
+ setExitCause( EXIT_CODE_KERNEL_CLEAR );
+ };
+#endif
+ };
+ break;
+ };
+ case CMD_KRNL_SYSTEM_TASK:{
+ break;
+ };
+ case CMD_KRNL_PURGE_SESSION:{
+ if ( tCMD->aux_id ) {
+ if (m_pSM) m_pSM->eraseSession( tCMD->aux_id );
+ };
+ break;
+ };
+ case CMD_KRNL_SET_SESSION_HZL:{
+ uint8_t tLVL = atoi( tCMD->param );
+ if ( tCMD->aux_id ) {
+ LOG("Life Session Hazard Level Updated");
+ /* Actual DataBase chenge done in WebApp Here we just making internal Event */
+ SESSION_RATE_DATA *tData = (SESSION_RATE_DATA *) malloc( sizeof( SESSION_RATE_DATA ) );
+ if ( tData ) {
+ tData->level = tLVL;
+ tData->track_id = tCMD->aux_id;
+ EVENT_CONTAINER * tEvt = createBasicEvent( 0, EVT_CLASS_SYSTEM, EVT_SRV_SESSION_RATED, NULL, NULL, tData );
+ if ( tEvt ) {
+ basicEventHeap::getInstance()->broadcast( tEvt );
+ } else {
+ free( tData );
+ };
+ };
+ };
+ break;
+ };
+ case CMD_KRNL_TEST_MODBUS:{
+ MODBUS_TEST_DATA *tData = (MODBUS_TEST_DATA *) malloc( sizeof( MODBUS_TEST_DATA ) );
+ if ( tData ) {
+ tData->platform_id = tCMD->aux_id;
+ tData->c_OutBits = atoi( tCMD->param );
+ EVENT_CONTAINER * tEvt = createBasicEvent( 0, EVT_CLASS_SYSTEM, EVT_SRV_TEST_MODBUS, NULL, NULL, tData );
+ if ( tEvt ) {
+ basicEventHeap::getInstance()->broadcast( tEvt );
+ } else {
+ free( tData );
+ };
+ };
+ break;
+ };
+ };
+ m_pDBC->updateWebCmdStatus( tCMD->id, DBC_CMD_READY_TO_CLEAN );
+ free( tCMD );
+ };
cTimeTSeconds = time( NULL );
- //Each Second
- if( cTimeTSeconds != tTimeTSeconds ){
+ if( cTimeTSeconds != tTimeTSeconds ){ //Each Second
tTimeTSeconds = cTimeTSeconds;
#ifdef LINUX_KERNEL_WATCHDOG
if( m_iWatchdogFd > -1 ) {
@@ -163,6 +337,8 @@ void servaKernel::m_fThreadProc( void ){
write( m_iWatchdogFd, &tB, strlen( tB ) );
};
#endif
+ m_pDBC->cleanWebCmd();
+
updateStatus();
if ( m_vEncodersPool.size() ) {
@@ -173,147 +349,25 @@ void servaKernel::m_fThreadProc( void ){
};
};
};
- if( m_vEncodersPool.size() < m_sServaConfig.encoderLimit ){
- if (uint64_t new_id = m_pDBC->getRecentMediaId()) {
- if ( processVideoFile( new_id ) ) {
- updateEncodeStatus( new_id, MEDIA_ENCODE_PROGRESS, 0 );
- } else {
- LOG_ERROR("Cannot Encode Queued Video -> Removing Task!");
- m_pDBC->removeRemoteMediaInfo( new_id );
+ if ( m_sServaConfig.encoderLimit ) {
+ if (m_vEncodersPool.size() < m_sServaConfig.encoderLimit) {
+ if (uint64_t new_id = m_pDBC->getRecentMediaId()) {
+ LOG("New Encoder!");
+ if ( processVideoFile( new_id ) ) {
+ updateEncodeStatus( new_id, MEDIA_ENCODE_PROGRESS, 0 );
+ } else {
+ LOG_ERROR("Cannot Encode Queued Video -> Removing Task!");
+ m_pDBC->removeRemoteMediaInfo( new_id );
+ };
};
};
- };
+ } else LOG_ERROR("Video Encoders Disabled??");
if ( m_pSM ) m_pSM->validate();
-
+ if ( m_pLifeMonitor ) m_pLifeMonitor->validate();
+ if ( m_pModBus ) ((servaModBusManager *)m_pModBus)->validate();
//m_pHardwareManager->updateSysInfo( &m_sSysInfo );
- DBC_RPC_WEB_CMD * tCMD = m_pDBC->fetchWebCmd( 0 ); //Kernel
- if( tCMD != NULL ) {
- m_pDBC->updateWebCmdStatus( tCMD->id, DBC_CMD_STARTED );
- switch( tCMD->cmd ){
- case CMD_KRNL_RELOAD:{
- LOG("Reload Serva Node!");
- m_bThreadStatus = TH_ENDED;
- setExitCause( EXIT_CODE_RELOAD_SERVICES );
- break;
- };
- case CMD_KRNL_RESTART:{
- LOG("Restart Serva Node!");
- m_bThreadStatus = TH_ENDED;
- setExitCause( EXIT_CODE_KERNEL_CLEAR );
- break;
- };
- case CMD_KRNL_FACTORY_RESET:{
- LOG("Restart Serva -> Factory Reset!");
- m_bThreadStatus = TH_ENDED;
- setExitCause( EXIT_CODE_FACTORY_RESET );
- break;
- };
- case CMD_NODES_RELOAD:{
- //if( m_pNodeFactory != NULL ) {
- // m_pNodeFactory->reloadNodes();
- //};
- break;
- };
- case CMD_NODE_RELOAD:{
- uint32_t tNodeID = atoi( tCMD->param );
- //if( m_pNodeFactory != NULL ) {
- // m_pNodeFactory->reloadNode( tNodeID );
- //};
- break;
- };
- case CMD_KRNL_PNP:{
- //if( m_pHardwareManager!= NULL ) {
- // LOG_ERROR( "Restart and Detect HardWare!" );
- // // Must be shutdowned all service that uses hardware prior to detection!
- // m_bThreadStatus = TH_ENDED;
- // setExitCause( EXIT_CODE_DETECT_HARDWARE ); // Go -> Detect Hardware in BACKEND
- //};
- break;
- };
- case CMD_KRNL_UPDATE_IDENT:{
- //LOG("Restart Mojo -> Update Ident!");
- //sprintf( m_sIdentity, tCMD->PARAM );
- //config_setting_remove ( m_pSettings, MOJO_KERNEL_TAG_SERVER_IDENTITY );
- //config_setting_t *pSetting = config_setting_add( m_pSettings, MOJO_KERNEL_TAG_SERVER_IDENTITY, CONFIG_TYPE_STRING );
- //config_setting_set_string( pSetting, tCMD->PARAM );
- //basicSettingsProvider::getInstance()->compromise();
- //basicSettingsProvider::getInstance()->validate();
- //m_pDBC->updateServerIdentity( m_nServerID, m_sIdentity );
-
- m_bThreadStatus = TH_ENDED;
- setExitCause( EXIT_CODE_KERNEL_CLEAR );
- break;
- };
- case CMD_KRNL_REPLACE_DATABASE:{
- LOG("Restart Mojo -> Replace Database!");
- //CSTR tNAME = m_pDBC->getDataParam( 0 );
- //CSTR tUSER = m_pDBC->getDataParam( 1 );
- //CSTR tGROUP = m_pDBC->getDataParam( 2 );
- //if ( tNAME ) {
- // char tB[256];
- // sprintf( tB,"./data/%s.db", tCMD->PARAM );
- // if ( fileExist( tB )) {
- // LOG("Restart Mojo -> Close Database!");
- //Closing Database
- // delete( m_pDBC );
- // m_pDBC = NULL;
- // LOG("Restart Mojo -> Delete Database!");
- // //unlink( tNAME );
- // LOG("Restart Mojo -> Copy Database!");
- // fileCopy( tB, tNAME );
- // LOG("Restart Mojo -> Chown Database!");
- // ch_chown( tNAME, tUSER, tGROUP );
- // LOG("Restart Mojo -> Delete Old Database!");
- // unlink( tB );
- // m_bThreadStatus = TH_ENDED;
- // LOG("Restart Mojo -> Exit!");
- // setExitCause( EXIT_CODE_NO_DATABASE );//EXIT_CODE_RELOAD_SERVICES );
- // m_bThreadStatus = TH_ENDED;
- // } else {
- // LOG_ERROR("New Database Does not Exists!");
- // };
- //free( tNAME );
- //free( tUSER );
- //free( tGROUP );
- //};
- break;
- };
- case CMD_KRNL_SYNC_TIME:{
- uint32_t uts = atoi( tCMD->param );
- if( uts ){
-#if ( __GLIBC__ < 3 ) && ( __GLIBC_MINOR__ < 31 )
- time_t ts = (time_t)uts;
- if( stime( &ts ) == 0 ){
- // Restert Server;
- m_bThreadStatus = TH_ENDED;
- setExitCause( EXIT_CODE_KERNEL_CLEAR );
- };
-#else
- timespec ts;
- ts.tv_sec = (time_t)uts;
- ts.tv_nsec = 0;
- if( clock_settime( CLOCK_REALTIME, &ts ) == 0 ){
- // Restert Server;
- m_bThreadStatus = TH_ENDED;
- setExitCause( EXIT_CODE_KERNEL_CLEAR );
- };
-#endif
- };
- break;
- };
- case CMD_KRNL_SYSTEM_TASK:{
- break;
- };
- case NODE_FORCE_FINISH_ALARM:{
- //stopSession();
- break;
- };
- };
- m_pDBC->updateWebCmdStatus( tCMD->id, DBC_CMD_READY_TO_CLEAN );
- free( tCMD );
- };
- m_pDBC->cleanWebCmd();
+
};
SLEEP(SLEEP_KERNEL_INTERVAL);
};
@@ -335,15 +389,21 @@ bool servaKernel::processVideoFile( uint64_t dbid ){
char tA[MAX_PATH];
char tB[MAX_PATH];
//Todo -> Instead GetSessionBase -> calc Base based on TS of video
- sprintf( tA,"%s/%s.%s", m_pSM->getSessionBase( NFO->session_id ), NFO->uuid, NFO->fmt );
- sprintf( tB,"%s/%s.mp4", m_pSM->getSessionBase( NFO->session_id ), NFO->uuid );
- if ( ptr->create( tA, tB, NFO->fps ) ) {
+ CSTR BASE = m_pSM->getSessionBase( NFO->session_id );
+ if( BASE ){
+ sprintf( tA,"%s/%s.%s", BASE, NFO->uuid, NFO->fmt );
+ LOG(tA);
+ sprintf( tB,"%s/%s.mp4", BASE, NFO->uuid );
+ LOG(tB);
+ free(BASE);
+ if ( ptr->create( tA, tB, NFO->fps ) ) {
#ifdef DEBUG
- LOG("Encoder Created!");
+ LOG("Encoder Created!");
#endif
- m_vEncodersPool.push_back( ptr );
- return true;
- };
+ m_vEncodersPool.push_back( ptr );
+ return true;
+ };
+ };
delete( ptr );
};
free( NFO );
@@ -372,6 +432,27 @@ void servaKernel::handleEncodedVideo( servaMediaEncoder *ptr ){
};
};
+bool servaKernel::dispatchEvent( EVENT_CONTAINER *Evt ){
+ if ( Evt == NULL ) return false;
+ /*
+ switch ( Evt->m_eClass ) {
+ case EVT_CLASS_VIDEO:{
+ switch ( Evt->m_eType ) {
+ case EVT_SRV_VIDEO_CHUNK:{
+ SERVA_VIDEO_TRANSFER_INFO *tData = ( SERVA_VIDEO_TRANSFER_INFO * ) Evt->m_pEvtData;
+ if ( tData ){
+ if ( tData->status == MEDIA_STORED ) {
+ updateEncodeStatus(tData->db_id, tData->status, tData->perc);
+ };
+ };
+ return false; // Kernel is Final Destination for that Event
+ };
+ };
+ break;
+ };
+ };*/
+ return true;
+};
//Todo -> Startup Cleanup Media Encoder Queue (with ability to finish unfinishing jobs -> Drop just unsucessful transfers
// Make Treshold of Running Encoders to a server
diff --git a/lib/App/serva/servaKernel.h b/lib/App/serva/servaKernel.h
index d66d5f7c..6d60a5a3 100644
--- a/lib/App/serva/servaKernel.h
+++ b/lib/App/serva/servaKernel.h
@@ -23,6 +23,7 @@
#include "../../components/base/basicThread.h"
#include "../../components/base/basicSettingsProvider.h"
+#include "../../components/base/basicEvent.h"
#include "../../components/base/basicEventHeap.h"
#include "../../components/object/objectSystemAnchor.h"
#include "../../alg/lgs/detectorStructures.h"
@@ -31,7 +32,7 @@
#include "../../alg/generic/md5.h"
#include "../common/kernelPrototype.h"
-#include "lifeMonitoring.h"
+#include "servaLifeMonitoring.h"
#include "servaRemoteClient.h"
#include "servaMediaEncoder.h"
#include "servaSessionManager.h"
@@ -48,6 +49,7 @@ class servaKernel: public kernelPrototype{
servaRemoteClient * m_pRPC;
V_MEDIA_ENCODERS m_vEncodersPool;
servaSessionManager * m_pSM;
+ void * m_pModBus;
DBC_SERVA_CONFIG m_sServaConfig;
protected:
virtual void m_fThreadProc( void );
@@ -61,6 +63,7 @@ class servaKernel: public kernelPrototype{
static servaKernel * getInstance( config_setting_t *ptr = NULL );
// Destructor
virtual ~servaKernel();
+ virtual bool dispatchEvent( EVENT_CONTAINER *Evt );
virtual bool create();
// Functionality (implementatio in servaKernelToolKit.cpp )
bool registerServA();
diff --git a/lib/App/serva/servaKernelToolKit.cpp b/lib/App/serva/servaKernelToolKit.cpp
index ed6e34b5..cb207a44 100644
--- a/lib/App/serva/servaKernelToolKit.cpp
+++ b/lib/App/serva/servaKernelToolKit.cpp
@@ -46,6 +46,7 @@ bool servaKernel::cleanUpMess(){
tList->clear();
delete( tList );
};
+ LOG("LVL2");
//Get Not Converted Items
tList = m_pDBC->listMediaQueueItems( 2 );
if ( tList ) {
@@ -73,6 +74,7 @@ bool servaKernel::cleanUpMess(){
tList->clear();
delete( tList );
};
+ LOG("Done");
return true;
};
diff --git a/lib/App/serva/servaLifeMonitoring.cpp b/lib/App/serva/servaLifeMonitoring.cpp
new file mode 100644
index 00000000..d6ff8bdc
--- /dev/null
+++ b/lib/App/serva/servaLifeMonitoring.cpp
@@ -0,0 +1,201 @@
+#include "servaLifeMonitoring.h"
+#include "../../components/base/basicEvent.h"
+#include "../../components/base/basicEventHeap.h"
+
+#define LOG( X ) m_pLog->Log( "HELZ", 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( "HELZ", this, _LOG_ERROR, _tBfrErrMSG2w34 );\
+ }
+#else
+ #define LOG_ERROR( X ) m_pLog->Log( "HELZ", this, _LOG_ERROR, X );
+#endif
+
+servaLifeMonitoring *servaLifeMonitoring::_Instance = 0;
+
+servaLifeMonitoring *servaLifeMonitoring::getInstance(){
+ if( _Instance == 0 ){
+ _Instance = new servaLifeMonitoring();
+ };
+ return _Instance;
+};
+
+servaLifeMonitoring::servaLifeMonitoring():basicValidatable(),basicThread(){
+ m_pLog = basicLogCollection::getInstance();
+ m_pDBC = servaMySQLDBC::getInstance();
+ DBC_UINT64_LIST *tList = m_pDBC->listPlatforms('E');
+ if ( tList ) {
+ if ( tList->size() ) {
+ for ( DBC_UINT64_LIST::iterator idx = tList->begin(); idx != tList->end(); idx++ ) {
+ DBC_UINT64_LIST *tML = m_pDBC->listPlatformModules( *idx );
+ if ( tML ) {
+ if ( tML->size() ) {
+ HEALTH_MONITORING_ZONE *tHZ = (HEALTH_MONITORING_ZONE*) malloc( sizeof( HEALTH_MONITORING_ZONE));
+ if (tHZ) {
+ memset( tHZ, 0, sizeof(HEALTH_MONITORING_ZONE));
+ tHZ->platform_id = *idx;
+ uint8_t cid = 0;
+ tHZ->lvl = 255; // To clean prev State
+ for ( DBC_UINT64_LIST::iterator jdx = tML->begin(); jdx != tML->end(); jdx++ ) {
+ tHZ->module_id[cid] = *jdx;
+ tHZ->module_monitored[cid] = true;
+ cid++;
+ };
+ m_mMonitoringZonesProtector.lock();
+ m_vMonitoringZones.push_back( tHZ );
+ m_mMonitoringZonesProtector.unlock();
+ };
+ };
+ delete(tML);
+ };
+ };
+ };
+ delete( tList );
+ };
+ m_nStartupTS = time(NULL);
+ init();
+};
+
+servaLifeMonitoring::~servaLifeMonitoring(){
+ waitThreadEnd( true );
+ m_mMonitoringZonesProtector.lock();
+ if ( m_vMonitoringZones.size() ) {
+ for ( V_HEALTH_MONITORING_ZONES::iterator idx = m_vMonitoringZones.begin(); idx != m_vMonitoringZones.end(); idx++ ) {
+ free( *idx );
+ };
+ m_vMonitoringZones.clear();
+ };
+ m_mMonitoringZonesProtector.unlock();
+};
+
+bool servaLifeMonitoring::validateZone( HEALTH_MONITORING_ZONE *ptr ){
+ bool retVal = true;
+ if ( ptr ) {
+ uint8_t min_lvl = 0;
+ for ( uint8_t i = 0; i < 4; i++ ) {
+ if (ptr->module_monitored[i]) {
+ if( ptr->module_status[i] > min_lvl ) min_lvl = ptr->module_status[i];
+ };
+ };
+ if( min_lvl != ptr->lvl ) {
+ retVal = false;
+ ptr->lvl = min_lvl;
+ };
+ };
+ return retVal;
+};
+
+uint8_t servaLifeMonitoring::validateModule( uint64_t module_id ){
+ uint8_t retVal = 0;
+ if ( module_id ) {
+ uint32_t cts = time( NULL );
+ uint32_t mts = m_pDBC->getCloudLTS(ARGUS_OBJECT_MODULE, module_id );
+ uint8_t ms = m_pDBC->getCloudStatus( ARGUS_OBJECT_MODULE, module_id );
+ if ( mts ) {
+ if ((cts - mts) > 30) {
+ retVal = ARGUS_LIFE_STATUS_LVL_4;
+ } else {
+ //Online - Check Status
+ if( ms < ARGUS_CLOUD_STATUS_E_GENERIC ) {
+ retVal = ARGUS_LIFE_STATUS_CLEAN;
+ } else {
+ switch ( ms ) {
+ case ARGUS_CLOUD_STATUS_E_GENERIC: break;
+ case ARGUS_CLOUD_STATUS_E_CAM_GENERIC:
+ case ARGUS_CLOUD_STATUS_E_CAM_NC:
+ case ARGUS_CLOUD_STATUS_E_CAM_NPTZ:
+ case ARGUS_CLOUD_STATUS_E_CAM_NIM: retVal = ARGUS_LIFE_STATUS_LVL_1; break;
+ case ARGUS_CLOUD_STATUS_E_SEN_GENERIC:
+ case ARGUS_CLOUD_STATUS_E_US_LRF:
+ case ARGUS_CLOUD_STATUS_E_BS_LRF: retVal = ARGUS_LIFE_STATUS_LVL_2; break;
+ case ARGUS_CLOUD_STATUS_E_US_NC:
+ case ARGUS_CLOUD_STATUS_E_BS_NC: retVal = ARGUS_LIFE_STATUS_LVL_3; break;
+ default: retVal = ARGUS_LIFE_STATUS_LVL_3;
+ };
+ };
+ };
+ } else {
+ retVal = ARGUS_LIFE_STATUS_LVL_4;
+ };
+ if ( retVal == ARGUS_LIFE_STATUS_LVL_4 ) {
+ DBC_IS_MODULE_DATA *tData = m_pDBC->getModuleData( module_id );
+ if ( tData ) {
+ if( !pingIP4( tData->ip4 ) ) {
+#ifdef DEBUG_EXTRA
+ LOG_ERROR("No Network Access to Platform!");
+#endif
+ retVal = ARGUS_LIFE_STATUS_LVL_5;
+ };
+ free( tData );
+ };
+ };
+ };
+ return retVal;
+};
+
+bool servaLifeMonitoring::validate(){
+ uint32_t cts = time(NULL);
+ if ( ( cts - m_nStartupTS ) < LM_SKEEP_MONITORING_SECONDS ) return true;
+ m_mMonitoringZonesProtector.lock();
+ for ( V_HEALTH_MONITORING_ZONES::iterator idx = m_vMonitoringZones.begin(); idx != m_vMonitoringZones.end(); idx++ ) {
+ if (!validateZone(*idx)) {
+ LOG("Zone Health is Changed");
+ MODULE_HEALTH_STATUS *tData = (MODULE_HEALTH_STATUS*) malloc(sizeof(MODULE_HEALTH_STATUS));
+ if ( tData ) {
+ tData->status = (*idx)->lvl;
+ tData->platform_id = (*idx)->platform_id;
+ char tT[128];
+ sprintf( tT, "gen Event HEALTH %d", tData->status );
+ LOG( tT );
+ EVENT_CONTAINER *tEvt = createBasicEvent(0, EVT_CLASS_SYSTEM, EVT_SRV_MODULE_HEALTH, NULL, NULL, tData );
+ if ( tEvt ) {
+ basicEventHeap::getInstance()->broadcast( tEvt );
+ } else free( tData );
+ } else LOG_ERROR("No Data Fetched from DB");
+#ifdef DEBUG_EXTRA
+ } else {
+ char tT[128];
+ sprintf( tT, "Zone Health is same %d",(*idx)->lvl );
+ LOG( tT );
+#endif
+ };
+ };
+ m_mMonitoringZonesProtector.unlock();
+ return true;
+};
+
+void servaLifeMonitoring::m_fThreadProc( void ){
+ m_bThreadStatus = TH_WORKING;
+ uint32_t ots = time(NULL);
+ while( m_bThreadStatus < TH_ENDED ) {
+ uint32_t cts = time(NULL);
+ if ( ( cts - m_nStartupTS ) > LM_SKEEP_MONITORING_SECONDS ){
+ if ( ots != cts ) {
+ ots = cts;
+ // Taking to validate one record then return it to a queue
+ HEALTH_MONITORING_ZONE * tCWZ = NULL;
+ m_mMonitoringZonesProtector.lock();
+ if ( m_vMonitoringZones.size() ) {
+ tCWZ = m_vMonitoringZones.at(0);
+ m_vMonitoringZones.erase(m_vMonitoringZones.begin());
+ };
+ m_mMonitoringZonesProtector.unlock();
+ if ( tCWZ ) {
+ for ( uint8_t i = 0; i < 4; i++ ) {
+ if (tCWZ->module_monitored[i]) tCWZ->module_status[i] = validateModule( tCWZ->module_id[i] );
+ };
+ m_mMonitoringZonesProtector.lock();
+ m_vMonitoringZones.push_back( tCWZ );
+ m_mMonitoringZonesProtector.unlock();
+ };
+ };
+ };
+ SLEEP( DEFAULT_THREAD_SLEEP_TIME );
+ };
+};
+
+#undef LOG
+#undef LOG_ERROR
\ No newline at end of file
diff --git a/lib/App/serva/servaLifeMonitoring.h b/lib/App/serva/servaLifeMonitoring.h
new file mode 100644
index 00000000..2038e1a3
--- /dev/null
+++ b/lib/App/serva/servaLifeMonitoring.h
@@ -0,0 +1,41 @@
+#ifndef __ARGUS_SERVER_LIFE_MONOTORING__
+#define __ARGUS_SERVER_LIFE_MONOTORING__
+
+#include "../../components/base/basicValidatable.h"
+#include "../../components/base/basicLogCollection.h"
+#include "../../components/base/basicThread.h"
+#include "../common/serverMySQL_dataBinder.h"
+
+#define LM_SKEEP_MONITORING_SECONDS 180 // 3 Minutes Seep time from beginning
+
+typedef struct S_HEALTH_MONITORING_ZONE{
+ bool module_monitored[4];
+ uint64_t module_id[4];
+ uint8_t module_status[4];
+ uint64_t platform_id;
+ uint8_t lvl;
+}HEALTH_MONITORING_ZONE;
+
+typedef std::vector V_HEALTH_MONITORING_ZONES;
+
+class servaLifeMonitoring : public basicValidatable, basicThread {
+ private:
+ static servaLifeMonitoring * _Instance;
+ basicLogCollection * m_pLog;
+ servaMySQLDBC * m_pDBC;
+ basicMutex m_mMonitoringZonesProtector;
+ V_HEALTH_MONITORING_ZONES m_vMonitoringZones;
+ uint32_t m_nStartupTS; // to skip initial startup time
+ bool validateZone( HEALTH_MONITORING_ZONE *ptr );
+ uint8_t validateModule( uint64_t module_id );
+ servaLifeMonitoring();
+ protected:
+ virtual void m_fThreadProc( void );
+ public:
+ static servaLifeMonitoring * getInstance();
+ ~servaLifeMonitoring();
+ virtual bool validate();
+};
+
+
+#endif
\ No newline at end of file
diff --git a/lib/App/serva/servaMediaEncoder.h b/lib/App/serva/servaMediaEncoder.h
index a518cb40..43827b74 100644
--- a/lib/App/serva/servaMediaEncoder.h
+++ b/lib/App/serva/servaMediaEncoder.h
@@ -8,23 +8,6 @@
#include "../../components/base/basicLogCollection.h"
#include
-typedef enum E_ENCODER_STAGES{
- ENCODER_NONE = 0,
- DECODER_INIT = 1,
- ENCODER_INIT,
- THREAD_INIT,
- ENCODER_ENCODING,
- ENCODER_FINISHED
-}ENCODER_STAGES;
-
-typedef enum E_MEDIA_STATUS{
- MEDIA_TRANSFERING = 0,
- MEDIA_STORED = 1,
- MEDIA_ENCODE_PROGRESS = 2,
- MEDIA_READY
-}MEDIA_STATUS;
-
-
typedef struct S_LIBAV_VS{
int m_iVideoStreamID;
AVStream *m_pVideoStr;
diff --git a/lib/App/serva/servaModBusManager.cpp b/lib/App/serva/servaModBusManager.cpp
index da1230f7..8bd1ab51 100644
--- a/lib/App/serva/servaModBusManager.cpp
+++ b/lib/App/serva/servaModBusManager.cpp
@@ -1,11 +1,493 @@
#include "servaModBusManager.h"
+#include "servaKernel.h"
+#define LOG( X ) m_pLog->Log( "MODBUS", this, X )
-servaModBusManager::_instance = NULL;
+#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( "MODBUS", this, _LOG_ERROR, _tBfrErrMSG2w34 );\
+ }
+#else
+ #define LOG_ERROR( X ) m_pLog->Log( "MODBUS", this, _LOG_ERROR, X );
+#endif
-servaModBusManager *servaModBustManager::getInstance(){
+servaModBusManager *servaModBusManager::_instance = NULL;
+
+servaModBusManager *servaModBusManager::getInstance(){
if ( _instance == NULL ) {
_instance = new servaModBusManager();
};
return _instance;
};
+
+servaModBusManager::servaModBusManager():basicThread(),basicValidatable(){
+ m_bStage = MBUS_STAGE_INIT;
+ m_pDBC = NULL;
+ m_pLog = basicLogCollection::getInstance();
+ m_pMaster = servaKernel::getInstance();
+ if ( m_pMaster == NULL ) return;
+ m_pDBC = m_pMaster->getDBC();
+ memset( &m_sManagerData, 0, sizeof( MODBUS_MANAGER_DATA ));
+};
+
+servaModBusManager::~servaModBusManager(){
+ waitThreadEnd( true );
+ if (m_vRtuUnits.size()) {
+ for( V_MODBUS_RTU_INFO::iterator idx=m_vRtuUnits.begin(); idx != m_vRtuUnits.end(); idx++ ) {
+ free( *idx );
+ };
+ m_vRtuUnits.clear();
+ };
+};
+
+bool servaModBusManager::create(){
+ if( m_pMaster == NULL ) return false;
+ if( m_pDBC == NULL ) return false;
+ MODBUS_MANAGER_DATA * tData = m_pDBC->getModBusManagerData();
+ if ( tData ) {
+ memcpy( &m_sManagerData, tData, sizeof( MODBUS_MANAGER_DATA ) );
+ free( tData );
+ };
+ m_bStage = MBUS_STAGE_INIT;
+ return init();
+};
+
+int servaModBusManager::modbus_get_rtu( CSTR ip, uint16_t port, uint8_t addr, uint8_t &status ){
+ uint8_t buf[16];
+ modbus_t * ctx; // Modbus context pointer
+ int rc; // Return code for error checking
+ // Create a new Modbus TCP context for a slave device
+ ctx = modbus_new_tcp( ip, port );
+ if (ctx == NULL) {
+#ifdef DEBUG_EXTRA
+ LOG( "Unable to create the Modbus context" );
+#endif
+ return -1;
+ };
+ // Connect to the Modbus TCP slave device
+ rc = modbus_connect(ctx);
+ if (rc == -1) {
+#ifdef DEBUG_EXTRA
+ char tB[256];
+ sprintf(tB, "Connection failed: %s", modbus_strerror(errno));
+ LOG( tB );
+#endif
+ modbus_free(ctx);
+ return -1;
+ };
+ rc = modbus_read_bits(ctx, addr, 8, buf ); //0x10
+ if( rc == -1 ) {
+#ifdef DEBUG_EXTRA
+ char tB[256];
+ sprintf(tB, "Write register failed: %s", modbus_strerror(errno));
+ LOG( tB );
+#endif
+ } else {
+ status = modbus_get_byte_from_bits( buf, 0, 8 );
+ };
+ // Close the Modbus TCP connection and free the context
+ modbus_close(ctx);
+ modbus_free(ctx);
+ return rc;
+};
+int servaModBusManager::modbus_set_rtu( CSTR ip, uint16_t port, uint8_t addr, uint8_t data ){
+ uint8_t bits[8];
+ modbus_t * ctx; // Modbus context pointer
+ int rc; // Return code for error checking
+ // Create a new Modbus TCP context for a slave device
+ ctx = modbus_new_tcp( ip, port );
+ if (ctx == NULL) {
+#ifdef DEBUG_EXTRA
+ LOG( "Unable to create the Modbus context");
+#endif
+ return -1;
+ };
+ // Connect to the Modbus TCP slave device
+ rc = modbus_connect(ctx);
+ if (rc == -1) {
+#ifdef DEBUG_EXTRA
+ char tB[256];
+ sprintf(tB, "Connection failed: %s", modbus_strerror(errno));
+ LOG( tB );
+#endif
+ modbus_free(ctx);
+ return -1;
+ };
+ modbus_set_bits_from_byte( bits, 0, data );
+ rc = modbus_write_bits(ctx, addr, 8, bits ); //0x10
+ if (rc == -1) {
+#ifdef DEBUG_EXTRA
+ char tB[256];
+ sprintf(tB, "Write register failed: %s", modbus_strerror(errno));
+ LOG( tB );
+#endif
+ };
+ // Close the Modbus TCP connection and free the context
+ modbus_close(ctx);
+ modbus_free(ctx);
+ return rc;
+};
+int servaModBusManager::modbus_set_rtu_bit( CSTR ip, uint16_t port, uint8_t addr, uint8_t bit ){
+ modbus_t * ctx; // Modbus context pointer
+ int rc; // Return code for error checking
+ // Create a new Modbus TCP context for a slave device
+ ctx = modbus_new_tcp( ip, port );
+ if (ctx == NULL) {
+#ifdef DEBUG_EXTRA
+ LOG( "Unable to create the Modbus context");
+#endif
+ return -1;
+ };
+ // Connect to the Modbus TCP slave device
+ rc = modbus_connect(ctx);
+ if (rc == -1) {
+#ifdef DEBUG_EXTRA
+ char tB[256];
+ sprintf(tB, "Connection failed: %s", modbus_strerror(errno));
+ LOG( tB );
+#endif
+ modbus_free(ctx);
+ return -1;
+ };
+ rc = modbus_write_bit(ctx, addr, bit ); //0x10
+ if (rc == -1) {
+#ifdef DEBUG_EXTRA
+ char tB[256];
+ sprintf(tB, "Write register failed: %s", modbus_strerror(errno));
+ LOG( tB );
+#endif
+ };
+ // Close the Modbus TCP connection and free the context
+ modbus_close(ctx);
+ modbus_free(ctx);
+ return rc;
+};
+
+void servaModBusManager::m_fThreadProc( void ){
+ m_bThreadStatus = TH_WORKING;
+ uint32_t oss = time(NULL);
+ while ( m_bThreadStatus < TH_ENDED ) {
+ uint32_t css = time(NULL);
+ switch (m_bStage) {
+ case MBUS_STAGE_INIT:{
+#ifdef DEBUG
+ LOG("Load Enabled ModBus Modules");
+#endif
+ DBC_UINT64_LIST *tList = m_pDBC->listModBusRTUs( 0, 'E' );
+ if ( tList ) {
+ if ( tList->size() ) {
+ for ( DBC_UINT64_LIST::iterator idx = tList->begin(); idx != tList->end(); idx++ ) {
+ MODBUS_RTU_INFO *tData = m_pDBC->getModBusRTU( *idx );
+ if ( tData ) {
+ m_vRtuUnits.push_back( tData );
+ };
+ };
+ };
+ delete(tList);
+#ifdef DEBUG
+ LOG("Load ModBus Modules Done");
+#endif
+ } else LOG("No ModBus Modules Defined");
+ m_bStage = MBUS_STAGE_SYNC;
+ break;
+ };
+ case MBUS_STAGE_SYNC:{
+#ifdef DEBUG_EXTRA
+ LOG("Sync ModBus Modules");
+#endif
+ if( m_vRtuUnits.size() ){
+ for( V_MODBUS_RTU_INFO::iterator idx = m_vRtuUnits.begin(); idx!= m_vRtuUnits.end(); idx++ ){
+ int rv = modbus_get_rtu((*idx)->ip, (*idx)->port, (*idx)->output_base_addr, (*idx)->c_OutBits );
+ if ( rv != -1 ) {
+ rv = modbus_get_rtu((*idx)->ip, (*idx)->port, (*idx)->input_base_addr, (*idx)->c_InBits );
+ if ( rv != -1 ) {
+ (*idx)->status = MBUS_STATUS_ONLINE;
+ m_pDBC->updateModBusRTU( (*idx)->id, (*idx)->status, (*idx)->c_InBits, (*idx)->c_OutBits );
+ continue;
+ }
+#ifdef DEBUG_EXTRA
+ else LOG_ERROR("Read DI Failure");
+#endif
+ }
+#ifdef DEBUG_EXTRA
+ else LOG_ERROR("Read DO Failure");
+#endif
+ (*idx)->status = MBUS_STATUS_OFFLINE;
+ m_pDBC->updateModBusRTU( (*idx)->id, (*idx)->status, (*idx)->c_InBits, (*idx)->c_OutBits );
+ };
+ };
+#ifdef DEBUG_EXTRA
+ LOG("Sync ModBus Modules Done");
+#endif
+ m_bStage = MBUS_STAGE_WORK;
+ break;
+ };
+ case MBUS_STAGE_WORK:{
+ uint64_t cts = getMilliseconds();
+ m_mProtector.lock();
+ if ( m_vActioItems.size() ) {
+ for( V_MODBUS_ACION_ITEMS::iterator idx = m_vActioItems.begin(); idx != m_vActioItems.end(); idx++ ){
+ if( (*idx)->scheduled_on < cts ) {
+ MODBUS_RTU_INFO *tRTU = m_pDBC->getModBusRTU( (*idx)->module_id );
+ if ( tRTU ) {
+ if( ( tRTU->c_OutBits & (*idx)->value ) == 0 ) {
+ //Set
+ tRTU->c_OutBits |= (*idx)->value;
+ int rv = modbus_set_rtu( tRTU->ip, tRTU->port, tRTU->output_base_addr, tRTU->c_OutBits );
+ if ( rv < 0 ) {
+ m_pDBC->updateModBusRTU( tRTU->id, MBUS_STATUS_OFFLINE, 0, 0 );
+ } else {
+ m_pDBC->updateModBusRTU( tRTU->id, MBUS_STATUS_ONLINE, tRTU->c_InBits, tRTU->c_OutBits );
+ };
+ };
+ if( ( tRTU->c_OutBits & (*idx)->mask ) != 0 ) {
+ //Clear
+ tRTU->c_OutBits &= ~(*idx)->mask;
+ int rv = modbus_set_rtu( tRTU->ip, tRTU->port, tRTU->output_base_addr, tRTU->c_OutBits );
+ if ( rv < 0 ) {
+ m_pDBC->updateModBusRTU( tRTU->id, MBUS_STATUS_OFFLINE, 0, 0 );
+ } else {
+ m_pDBC->updateModBusRTU( tRTU->id, MBUS_STATUS_ONLINE, tRTU->c_InBits, tRTU->c_OutBits );
+ };
+ };
+ free(tRTU);
+ };
+ free( *idx );
+ m_vActioItems.erase( idx );
+ //Make Just One SCADA per loop
+ break;
+ };
+ };
+ };
+ m_mProtector.unlock();
+ break;
+ };
+ case MBUS_STAGE_END:{
+ m_bThreadStatus = TH_ENDED;
+ break;
+ };
+ };
+ if ( oss != css ) {
+ //Each Second
+ oss = css;
+ m_bStage = MBUS_STAGE_SYNC;
+ };
+ SLEEP(DEFAULT_THREAD_SLEEP_TIME);
+ };
+};
+
+bool servaModBusManager::validate(){
+ MODBUS_MANAGER_DATA * tData = m_pDBC->getModBusManagerData();
+ if ( tData ) {
+ if( memcmp( &m_sManagerData, tData, sizeof( MODBUS_MANAGER_DATA ) ) != 0 ){
+#ifdef DEBUG
+ LOG("Settings was changed ... reapplying");
+#endif
+ memcpy( &m_sManagerData, tData, sizeof( MODBUS_MANAGER_DATA ) );
+ };
+ free( tData );
+ };
+ return true;
+};
+
+bool servaModBusManager::dispatchEvent( EVENT_CONTAINER *Evt ){
+ if ( Evt == NULL ) return false;
+ switch ( Evt->m_eType ) {
+ case EVT_SRV_SESSION_STARTED:{
+ if( m_sManagerData.automaticAlarmRisingTO ) {
+ //setup Schedule
+ SCADA_TRACK_INFO *tData = m_pDBC->getTrackSCADA( Evt->m_nSourceNodeID );
+ if ( tData ) {
+ MODBUS_RTU_INFO *tRTU = m_pDBC->getModBusRTU_Platform( tData->platform_id );
+ if ( tRTU ) {
+ MODBUS_ACION_ITEM *tAI = (MODBUS_ACION_ITEM *)malloc(sizeof(MODBUS_ACION_ITEM));
+ if ( tAI ) {
+ memset( tAI, 0, sizeof(MODBUS_ACION_ITEM) );
+ tAI->scheduled_on = getMilliseconds() + ( m_sManagerData.automaticAlarmRisingTO * 1000 );
+ tAI->module_id = tRTU->id;
+ tAI->value = ( 1 << tRTU->crossbar[((tData->side == 'U')?MBUS_CROSSBAR_UPPER_TRACK:MBUS_CROSSBAR_BOTTOM_TRACK)] );
+ m_mProtector.lock();
+ m_vActioItems.push_back( tAI );
+ m_mProtector.unlock();
+ };
+ free( tRTU );
+ };
+ free( tData );
+ };
+ };
+ break;
+ };
+ case EVT_SRV_SESSION_ENDED:{
+ SCADA_TRACK_INFO *tData = m_pDBC->getTrackSCADA( Evt->m_nSourceNodeID );
+ if ( tData ) {
+ MODBUS_RTU_INFO *tRTU = m_pDBC->getModBusRTU_Platform( tData->platform_id );
+ if ( tRTU ) {
+ uint8_t bON = ( 1 << tRTU->crossbar[((tData->side == 'U')?MBUS_CROSSBAR_UPPER_TRACK:MBUS_CROSSBAR_BOTTOM_TRACK)] );
+ uint8_t bOFF = ~( 1 << tRTU->crossbar[((tData->side == 'U')?MBUS_CROSSBAR_UPPER_TRACK:MBUS_CROSSBAR_BOTTOM_TRACK)] );
+ //Remove Scheduled Signal change
+ m_mProtector.lock();
+ for ( V_MODBUS_ACION_ITEMS::iterator idx=m_vActioItems.begin(); idx!=m_vActioItems.end(); idx++ ){
+ if( (*idx)->module_id == tRTU->id ) {
+ //check if shceduled signal is current
+ if( (((*idx)->value & bON ) == bON ) || (((*idx)->mask & bOFF ) == bOFF ) ){
+ free((*idx));
+ m_vActioItems.erase( idx );
+ };
+ break;
+ };
+ };
+ m_mProtector.unlock();
+
+ //Mitigate Signal if sent
+ if ( (tRTU->c_OutBits & bON ) == bON ) {
+ tRTU->c_OutBits &= bOFF;
+ int rv = modbus_set_rtu( tRTU->ip, tRTU->port, tRTU->output_base_addr, tRTU->c_OutBits );
+ if ( rv < 0 ) {
+ m_pDBC->updateModBusRTU( tRTU->id, MBUS_STATUS_OFFLINE, 0, 0 );
+ } else {
+ m_pDBC->updateModBusRTU( tRTU->id, MBUS_STATUS_ONLINE, tRTU->c_InBits, tRTU->c_OutBits );
+ };
+ };
+
+ free( tRTU );
+ };
+ free( tData );
+ };
+ break;
+ };
+ case EVT_SRV_SESSION_RATED:{
+ if ( Evt->m_pEvtData == NULL ) return false;
+ if ( m_sManagerData.hazardSignalLevel ) {
+ SESSION_RATE_DATA *tSRD = (SESSION_RATE_DATA *)Evt->m_pEvtData;
+ SCADA_TRACK_INFO *tData = m_pDBC->getTrackSCADA( tSRD->track_id );
+ if ( tData ) {
+ MODBUS_RTU_INFO *tRTU = m_pDBC->getModBusRTU_Platform( tData->platform_id );
+ if ( tRTU ) {
+ uint8_t bON = ( 1 << tRTU->crossbar[((tData->side == 'U')?MBUS_CROSSBAR_UPPER_TRACK:MBUS_CROSSBAR_BOTTOM_TRACK)] );
+ uint8_t bOFF = ~( 1 << tRTU->crossbar[((tData->side == 'U')?MBUS_CROSSBAR_UPPER_TRACK:MBUS_CROSSBAR_BOTTOM_TRACK)] );
+ //Remove Scheduled Signal change
+ m_mProtector.lock();
+ for ( V_MODBUS_ACION_ITEMS::iterator idx=m_vActioItems.begin(); idx!=m_vActioItems.end(); idx++ ){
+ if( (*idx)->module_id == tRTU->id ) {
+ //check if shceduled signal is current
+ if( (((*idx)->value & bON ) == bON ) || (((*idx)->mask & bOFF ) == bOFF ) ){
+ free((*idx));
+ m_vActioItems.erase( idx );
+ };
+ break;
+ };
+ };
+ m_mProtector.unlock();
+
+ if ( tSRD->level < m_sManagerData.hazardSignalLevel ) {
+ //Mitigate Signal if sent
+ if ( (tRTU->c_OutBits & bON ) == bON ) {
+ tRTU->c_OutBits &= bOFF;
+ int rv = modbus_set_rtu( tRTU->ip, tRTU->port, tRTU->output_base_addr, tRTU->c_OutBits );
+ if ( rv < 0 ) {
+ m_pDBC->updateModBusRTU( tRTU->id, MBUS_STATUS_OFFLINE, 0, 0 );
+ } else {
+ m_pDBC->updateModBusRTU( tRTU->id, MBUS_STATUS_ONLINE, tRTU->c_InBits, tRTU->c_OutBits );
+ };
+ };
+ } else {
+ //Set Signal if was Cleared
+ if ( (tRTU->c_OutBits & bON ) == 0 ) {
+ tRTU->c_OutBits |= bON;
+ int rv = modbus_set_rtu( tRTU->ip, tRTU->port, tRTU->output_base_addr, tRTU->c_OutBits );
+ if ( rv < 0 ) {
+ m_pDBC->updateModBusRTU( tRTU->id, MBUS_STATUS_OFFLINE, 0, 0 );
+ } else {
+ m_pDBC->updateModBusRTU( tRTU->id, MBUS_STATUS_ONLINE, tRTU->c_InBits, tRTU->c_OutBits );
+ };
+ };
+ };
+ free( tRTU );
+ };
+ free( tData );
+ };
+ };
+ break;
+ };
+ case EVT_SRV_TEST_MODBUS:{
+ MODBUS_TEST_DATA *tData = (MODBUS_TEST_DATA *)Evt->m_pEvtData;
+ if ( tData ) {
+ MODBUS_RTU_INFO *tRTU = m_pDBC->getModBusRTU_Platform( tData->platform_id );
+ if ( tRTU ) {
+#ifdef DEBUG_EXTRA
+ char tB[200];
+ sprintf( tB, "%s:%d 0x%02x 0x%02x", tRTU->ip, tRTU->port, tRTU->output_base_addr, tData->c_OutBits );
+ LOG( tB );
+#endif
+ int rv = modbus_set_rtu( tRTU->ip, tRTU->port, tRTU->output_base_addr, tData->c_OutBits );
+ if ( rv < 0 ) {
+ m_pDBC->updateModBusRTU( tRTU->id, MBUS_STATUS_OFFLINE, 0, 0 );
+ } else {
+ m_pDBC->updateModBusRTU( tRTU->id, MBUS_STATUS_ONLINE, tRTU->c_InBits, tData->c_OutBits );
+ };
+ free( tRTU );
+ };
+ };
+ return false; // No need Propogate this Evt
+ };
+ case EVT_SRV_MODULE_HEALTH:{
+ if ( Evt->m_pEvtData == NULL ) return false;
+ if ( m_sManagerData.helthSignalLevel ) {
+ MODULE_HEALTH_STATUS *tData = (MODULE_HEALTH_STATUS *)Evt->m_pEvtData;
+ if ( tData->status >= m_sManagerData.helthSignalLevel ) {
+ MODBUS_RTU_INFO *tRTU = m_pDBC->getModBusRTU_Platform( tData->platform_id );
+ if ( tRTU ) {
+ uint8_t bON = ( 1 << tRTU->crossbar[MBUS_CROSSBAR_HEALTH] );
+ uint8_t bOFF = ~( 1 << tRTU->crossbar[MBUS_CROSSBAR_HEALTH] );
+#ifdef DEBUG_EXTRA
+ char tB[200];
+ sprintf( tB, "%s:%d 0x%02x 0x%02x", tRTU->ip, tRTU->port, tRTU->output_base_addr, tData->c_OutBits );
+ LOG( tB );
+#endif
+ //Set Signal if was Cleared
+ if ( (tRTU->c_OutBits & bON ) == 0 ) {
+ tRTU->c_OutBits |= bON;
+ int rv = modbus_set_rtu( tRTU->ip, tRTU->port, tRTU->output_base_addr, tRTU->c_OutBits );
+ if ( rv < 0 ) {
+ m_pDBC->updateModBusRTU( tRTU->id, MBUS_STATUS_OFFLINE, 0, 0 );
+ } else {
+ m_pDBC->updateModBusRTU( tRTU->id, MBUS_STATUS_ONLINE, tRTU->c_InBits, tRTU->c_OutBits );
+ };
+ };
+ free( tRTU );
+ };
+ } else { //Below Level
+ MODBUS_RTU_INFO *tRTU = m_pDBC->getModBusRTU_Platform( tData->platform_id );
+ if ( tRTU ) {
+ uint8_t bON = ( 1 << tRTU->crossbar[MBUS_CROSSBAR_HEALTH] );
+ uint8_t bOFF = ~( 1 << tRTU->crossbar[MBUS_CROSSBAR_HEALTH] );
+#ifdef DEBUG_EXTRA
+ char tB[200];
+ sprintf( tB, "%s:%d 0x%02x 0x%02x", tRTU->ip, tRTU->port, tRTU->output_base_addr, tData->c_OutBits );
+ LOG( tB );
+#endif
+ //Mitigate Signal if sent
+ if ( (tRTU->c_OutBits & bON ) == bON ) {
+ tRTU->c_OutBits &= bOFF;
+ int rv = modbus_set_rtu( tRTU->ip, tRTU->port, tRTU->output_base_addr, tRTU->c_OutBits );
+ if ( rv < 0 ) {
+ m_pDBC->updateModBusRTU( tRTU->id, MBUS_STATUS_OFFLINE, 0, 0 );
+ } else {
+ m_pDBC->updateModBusRTU( tRTU->id, MBUS_STATUS_ONLINE, tRTU->c_InBits, tRTU->c_OutBits );
+ };
+ };
+ free( tRTU );
+ };
+ };
+ };
+ break;
+ };
+ };
+ return true;
+};
+
+#undef LOG
+#undef LOG_ERROR
+
diff --git a/lib/App/serva/servaModBusManager.h b/lib/App/serva/servaModBusManager.h
index 64fa1c60..ca99fd47 100644
--- a/lib/App/serva/servaModBusManager.h
+++ b/lib/App/serva/servaModBusManager.h
@@ -1,11 +1,68 @@
#ifndef __SERVA_MODBUS_MANAGER_HEADER__
#define __SERVA_MODBUS_MANAGER_HEADER__
-class servaModBusManager{
+#include "../../components/base/basicTypes.h"
+#include "../../components/base/basicValidatable.h"
+#include "../../components/base/basicMutex.h"
+#include "../../components/base/basicThread.h"
+#include "../../components/base/basicEventHandler.h"
+#include "../../components/base/basicLogCollection.h"
+#include "../common/serverDataBinder.h"
+#include // Include the libmodbus header
+
+#define MBUS_STAGE_INIT 0
+#define MBUS_STAGE_SYNC 1
+#define MBUS_STAGE_WORK 2
+#define MBUS_STAGE_END 3
+
+#define MBUS_STATUS_OFFLINE 0
+#define MBUS_STATUS_ONLINE 1
+
+#define MBUS_CROSSBAR_UPPER_TRACK 0
+#define MBUS_CROSSBAR_BOTTOM_TRACK 1
+#define MBUS_CROSSBAR_HEALTH 2
+#define MBUS_CROSSBAR_AUX 3
+
+class servaKernel;
+
+#define IMMIDIATE_ACTION 0
+
+typedef struct S_MODBUS_ACION_ITEM{
+ uint64_t module_id;
+ uint64_t scheduled_on;
+ uint8_t value;
+ uint8_t mask;
+}MODBUS_ACION_ITEM;
+
+typedef std::vector V_MODBUS_ACION_ITEMS;
+
+class servaModBusManager: public basicEventHandler, basicThread, basicValidatable{
+ private:
+ static servaModBusManager * _instance;
+ basicLogCollection * m_pLog;
+ servaKernel * m_pMaster;
+ serverDataBinder * m_pDBC;
+ MODBUS_MANAGER_DATA m_sManagerData;
+ V_MODBUS_ACION_ITEMS m_vActioItems;
+ uint8_t m_bStage;
+ basicMutex m_mProtector;
+ V_MODBUS_RTU_INFO m_vRtuUnits;
+ servaModBusManager();
+ virtual void m_fThreadProc( void );
+ int modbus_get_rtu( CSTR ip, uint16_t port, uint8_t addr, uint8_t &status );//port=502
+ int modbus_set_rtu( CSTR ip, uint16_t port, uint8_t addr, uint8_t data );
+ int modbus_set_rtu_bit( CSTR ip, uint16_t port, uint8_t addr, uint8_t bit );
+ public:
+ virtual ~servaModBusManager();
+ bool create();
+ static servaModBusManager * getInstance();
+ virtual bool dispatchEvent( EVENT_CONTAINER *Evt );
+ virtual bool validate();
};
#endif
+
diff --git a/lib/App/serva/servaRemoteClientHandler.cpp b/lib/App/serva/servaRemoteClientHandler.cpp
index e080f541..c345d342 100644
--- a/lib/App/serva/servaRemoteClientHandler.cpp
+++ b/lib/App/serva/servaRemoteClientHandler.cpp
@@ -22,10 +22,10 @@ servaRPCHadnler::servaRPCHadnler( int SocketFD, networkServiceEngine *ptr ):basi
m_nInbondSerial = 0;
m_nOutbondSerial = 0;
m_dSessionDBID = 0;
-
+ m_nCloudStatus = ARGUS_CLOUD_STATUS_NA;
m_pDBC = servaMySQLDBC::getInstance();
m_pSM = servaSessionManager::getInstance();
-
+ m_pEventHeap = basicEventHeap::getInstance();
m_pPort = new serverPort( SocketFD );
if ( m_pPort ) {
if ( m_pPort->create() ) {
@@ -50,7 +50,7 @@ bool servaRPCHadnler::attachEngine( networkServiceEngine *ptr ){
};
bool servaRPCHadnler::dispatchEvent( EVENT_CONTAINER *Evt ){
- LOG("EVT");
+ //LOG("EVT");
return true;
};
@@ -126,7 +126,9 @@ bool servaRPCHadnler::packetHandler( protocolPackage *Package ){
#endif
switch( Package->m_nCode ){
case ARGUS_DATA_MSG_REGISTER:{
- strncpy( m_cRemoteIdentity, (const char*)(Package->m_pData+ARGUS_HEADER_SIZE+1), 32 );
+ ARGUS_DATA_MOJO_REGISTRATION *tM = (ARGUS_DATA_MOJO_REGISTRATION *) (Package->m_pData+ARGUS_HEADER_SIZE+1);
+ strncpy( m_cRemoteIdentity, tM->identity, 32);
+ strncpy( m_cRemoteIP, tM->peer, 22);
m_cRemoteIdentity[32] = (char)0;
#ifdef DEBUG
char tB[128];
@@ -144,9 +146,12 @@ bool servaRPCHadnler::packetHandler( protocolPackage *Package ){
#endif
//m_dRemoteBottomDBID = m_pDBC->getBottomLRF( m_dRemoteMojoDBID );
- uint32_t lts = m_pDBC->getCloudLTS( ARGUS_OBJECT_MODULE, m_dMojoDBID );
- uint32_t cts = time(NULL);
- m_pDBC->setCloudStatus( ARGUS_OBJECT_MODULE, m_dMojoDBID, ARGUS_CLOUD_STATUS_ONLINE );
+ //uint32_t lts = m_pDBC->getCloudLTS( ARGUS_OBJECT_MODULE, m_dMojoDBID );
+ //uint32_t cts = time(NULL);
+ m_mCloudProtector.lock();
+ m_nCloudStatus = ARGUS_CLOUD_STATUS_ONLINE;
+ m_mCloudProtector.unlock();
+ m_pDBC->setCloudStatus( ARGUS_OBJECT_MODULE, m_dMojoDBID, ARGUS_CLOUD_STATUS_REG );
//if( m_dRemoteUpperDBID ) m_pDBC->setCloudStatus( ARGUS_OBJECT_SENSOR, m_dRemoteUpperDBID, ARGUS_CLOUD_STATUS_REG );
//if( m_dRemoteBottomDBID ) m_pDBC->setCloudStatus( ARGUS_OBJECT_SENSOR, m_dRemoteBottomDBID, ARGUS_CLOUD_STATUS_REG );
peer_send_reg_status( ARGUS_DATA_MSG_REGISTER );
@@ -156,7 +161,7 @@ bool servaRPCHadnler::packetHandler( protocolPackage *Package ){
//};
} else {
#ifdef DEBUG
- LOG("Module Disabled!");
+ LOG("Module is Disabled!");
#endif
peer_send_reg_status( ARGUS_DATA_MSG_DISABLED );
setConnectionStatus( CS_DISCONNECTED );
@@ -172,7 +177,7 @@ bool servaRPCHadnler::packetHandler( protocolPackage *Package ){
};
case ARGUS_DATA_MSG_INFO:{
ARGUS_DATA_MOJO_INFO *tINFO = (ARGUS_DATA_MOJO_INFO *) (Package->m_pData+ARGUS_HEADER_SIZE+1);
-#ifdef DEBUG_EXTRA
+#ifdef DEBUG
LOG("Module Info Received!");
char tB[128];
sprintf( tB, "Upper Sensor Node: %d", tINFO->UPPER_ID );
@@ -188,8 +193,46 @@ bool servaRPCHadnler::packetHandler( protocolPackage *Package ){
peer_send_reg_status( ARGUS_DATA_MSG_INFO );
break;
};
+ case ARGUS_DATA_MSG_KEEP_ALIVE:
case ARGUS_DATA_MSG_STAT:{
- ARGUS_DATA_MOJO_STATUS *tSATUS = (ARGUS_DATA_MOJO_STATUS *) (Package->m_pData+ARGUS_HEADER_SIZE+1);
+ ARGUS_DATA_MOJO_STATUS *tSTATUS = (ARGUS_DATA_MOJO_STATUS *) (Package->m_pData+ARGUS_HEADER_SIZE+1);
+ m_mCloudProtector.lock();
+ if( tSTATUS->STATUSES == 0 ) {
+ //LOG("Generic Error [0]");
+ m_nCloudStatus = ARGUS_CLOUD_STATUS_E_GENERIC;
+ } else {
+ if ( ( tSTATUS->STATUSES & ARGUS_RPC_STATUS_MASK_OK ) == ARGUS_RPC_STATUS_OK ){
+ //LOG("Status Ok");
+ m_nCloudStatus = ARGUS_CLOUD_STATUS_ONLINE;
+ } else {
+ if( ( tSTATUS->STATUSES & ARGUS_RPC_STATUS_CAM_OK ) != ARGUS_RPC_STATUS_CAM_OK ){
+ //LOG("Cam Err");
+ switch( ( tSTATUS->STATUSES & ARGUS_RPC_STATUS_MASK_CAM ) >> ARGUS_RPC_STATUS_SHIFT_CAM ){
+ case 1: m_nCloudStatus = ARGUS_CLOUD_STATUS_E_CAM_NC; break;
+ case 2: m_nCloudStatus = ARGUS_CLOUD_STATUS_E_CAM_NIM; break;
+ case 3: m_nCloudStatus = ARGUS_CLOUD_STATUS_E_CAM_NPTZ; break;
+ default: m_nCloudStatus = ARGUS_CLOUD_STATUS_E_CAM_GENERIC;
+ };
+ };
+ if( ( tSTATUS->STATUSES & ARGUS_RPC_STATUS_BS_OK ) != ARGUS_RPC_STATUS_BS_OK ){
+ //LOG("BS Err");
+ switch( ( tSTATUS->STATUSES & ARGUS_RPC_STATUS_MASK_BS ) >> ARGUS_RPC_STATUS_SHIFT_BS ){
+ case 1: m_nCloudStatus = ARGUS_CLOUD_STATUS_E_BS_NC; break;
+ case 2: m_nCloudStatus = ARGUS_CLOUD_STATUS_E_BS_LRF; break;
+ default: m_nCloudStatus = ARGUS_CLOUD_STATUS_E_SEN_GENERIC;
+ };
+ };
+ if( ( tSTATUS->STATUSES & ARGUS_RPC_STATUS_US_OK ) != ARGUS_RPC_STATUS_US_OK ){
+ //LOG("US Err");
+ switch( ( tSTATUS->STATUSES & ARGUS_RPC_STATUS_MASK_US ) >> ARGUS_RPC_STATUS_SHIFT_US ){
+ case 1: m_nCloudStatus = ARGUS_CLOUD_STATUS_E_US_NC; break;
+ case 2: m_nCloudStatus = ARGUS_CLOUD_STATUS_E_US_LRF; break;
+ default: m_nCloudStatus = ARGUS_CLOUD_STATUS_E_SEN_GENERIC;
+ };
+ };
+ };
+ };
+ m_mCloudProtector.unlock();
peer_send_reg_status( ARGUS_DATA_MSG_STAT );
break;
};
@@ -226,7 +269,7 @@ bool servaRPCHadnler::packetHandler( protocolPackage *Package ){
break;
};
case ARGUS_DATA_MSG_TIME_SYNC:{
-#ifdef DEBUG_EXTRA
+#ifdef DEBUG
LOG( "Time Synchronization Request" );
#endif
ARGUS_DATA_TIME_SYNC_REQ *tTSR = ( ARGUS_DATA_TIME_SYNC_REQ *) (Package->m_pData+ARGUS_HEADER_SIZE+1);
@@ -236,34 +279,45 @@ bool servaRPCHadnler::packetHandler( protocolPackage *Package ){
peer_send_time_sync_ack( &tTSA );
break;
};
- case ARGUS_DATA_MSG_KEEP_ALIVE:{
- ARGUS_DATA_MOJO_STATUS *tSTATUS = (ARGUS_DATA_MOJO_STATUS *) (Package->m_pData+ARGUS_HEADER_SIZE+1);
- m_pDBC->setCloudStatus( ARGUS_OBJECT_MODULE, m_dMojoDBID, ARGUS_CLOUD_STATUS_ONLINE );
- //char tB[128];
- //sprintf(tB, "[%04X] CPU[%d] TEMO[%d]", tSTATUS->STATUSES, tSTATUS->CPU_LOAD, tSTATUS->CPU_TEMP );
- //LOG( tB );
- break;
- };
case ARGUS_DATA_MSG_VIDEO_INFO:{
-#ifdef DEBUG_EXTRA
+#ifdef DEBUG
LOG( "Received Video Record Info" );
#endif
- m_pVideoHelper.clear();
- if (m_pVideoHelper.init( m_pSM->getSessionBase( m_dSessionDBID ), m_dMojoDBID, m_dSessionDBID, (ARGUS_DATA_VIDEO_INFO *)(Package->m_pData + ARGUS_HEADER_SIZE + 1))) {
- peer_send_vinfo_ack( m_pVideoHelper.getReferenceID() );
- } else {
- peer_send_vinfo_ack( 0 );
- };
+ m_pVideoHelper.clear();
+ CSTR BASE = m_pSM->getSessionBase( m_dSessionDBID );
+ if( BASE ){
+ if (m_pVideoHelper.init( BASE, m_dMojoDBID, m_dSessionDBID, (ARGUS_DATA_VIDEO_INFO *)(Package->m_pData + ARGUS_HEADER_SIZE + 1))) {
+ LOG("Helper Init Ok");
+ peer_send_vinfo_ack( m_pVideoHelper.getReferenceID() );
+ } else {
+ LOG("Helper Init Failure");
+ peer_send_vinfo_ack( 0 );
+ };
+ free( BASE );
+ } else {
+ LOG("Helper Init Failure (NO SESSION)");
+ peer_send_vinfo_ack( 0 );
+ };
break;
};
case ARGUS_DATA_MSG_VIDEO_DATA:{
uint32_t tt = m_pVideoHelper.saveNextChunk( Package->m_pData+ARGUS_HEADER_SIZE+1 );
- //char tK[128];
- //sprintf( tK, "Saved %d Bytes of Video!", tt );
- //LOG( tK );
+#ifdef DEBUG_EXTRA
+ char tK[128];
+ sprintf( tK, "Saved %d Bytes of Video!", tt );
+ LOG( tK );
+#endif
peer_send_vdata_ack( tt );
break;
};
+ case ARGUS_DATA_MSG_RESTART_SW:{
+ LOG("Module Restarts control Software");
+ break;
+ };
+ case ARGUS_DATA_MSG_RESTART_PLATFORM:{
+ LOG("Module Restart HOST OS");
+ break;
+ };
};
return true;
};
@@ -284,6 +338,10 @@ void servaRPCHadnler::m_fThreadProc( void ){
if ( cTimeTSeconds != tTimeTSeconds ) {
tSecondsCounter++;
tTimeTSeconds = cTimeTSeconds;
+ // update clowd status
+ m_mCloudProtector.lock();
+ m_pDBC->setCloudStatus( ARGUS_OBJECT_MODULE, m_dMojoDBID, m_nCloudStatus );
+ m_mCloudProtector.unlock();
};
DBC_RPC_WEB_CMD *tCMD = m_pDBC->fetchWebCmd( m_dMojoDBID );
if ( tCMD ) {
@@ -381,6 +439,7 @@ bool servaRPCHadnler::peer_send_time_sync_ack( ARGUS_DATA_TIME_SYNC_ACK *ptr ){
servaVideoTransferHelper::servaVideoTransferHelper(){
m_pLog = basicLogCollection::getInstance();
+ m_pEventHeap = basicEventHeap::getInstance();
m_pFD = NULL;
clear();
};
@@ -392,29 +451,45 @@ servaVideoTransferHelper::~servaVideoTransferHelper(){
bool servaVideoTransferHelper::init( CSTR base, uint64_t MID, uint64_t SID, ARGUS_DATA_VIDEO_INFO *ptr ){
m_nRemoteRefID = 0;
if ( ptr ) {
-
-//ToDo Set File Access to web user
-
memcpy( &m_sIn, ptr, sizeof(ARGUS_DATA_VIDEO_INFO) );
- CSTR tUUID = getUniqID_UUID();
- if ( tUUID ) {
- char tB[256];
- sprintf(tB, "VideoData: %s, %d.%d, [%dx%d@%d] <%s>", tUUID, m_sIn.DTS, m_sIn.DMS, m_sIn.WIDTH, m_sIn.HEIGHT, m_sIn.FPS, m_sIn.FMT);
- LOG( tB );
+ if ( ptr->REF_ID ) {
servaMySQLDBC * m_pDBC = servaMySQLDBC::getInstance();
- servaSessionManager * m_pSM = servaSessionManager::getInstance();
- if ( m_nRemoteRefID = m_pDBC->addMediaQueueRecord( tUUID, MID, SID, m_sIn.DTS, m_sIn.DMS, m_sIn.WIDTH, m_sIn.HEIGHT, m_sIn.FPS, m_sIn.FMT ) ) {
+ CSTR tUUID = getUniqID_UUID(); //m_pDBC->getMediaUUID( ptr->REF_ID );
+ if ( tUUID ) {
+#ifdef DEBUG
+ char tB[256];
+ sprintf(tB, "Update VideoData: %s, %d.%d, [%dx%d@%d] <%s>", tUUID, m_sIn.DTS, m_sIn.DMS, m_sIn.WIDTH, m_sIn.HEIGHT, m_sIn.FPS, m_sIn.FMT);
+ LOG( tB );
+#endif
sprintf( m_cCurrentFile, "%s/%s.%s", base, tUUID, m_sIn.FMT );
m_pFD = fopen( m_cCurrentFile, "wb" );
free( tUUID );
+ m_nRemoteRefID = ptr->REF_ID;
return true;
};
- free( tUUID );
- };
- } else {
- memset( m_cCurrentFile, 0, MAX_PATH );
- memset( &m_sIn, 0, sizeof(ARGUS_DATA_VIDEO_INFO) );
+ } else {
+ //ToDo Set File Access to web user
+ CSTR tUUID = getUniqID_UUID();
+ if ( tUUID ) {
+#ifdef DEBUG
+ char tB[256];
+ sprintf(tB, "VideoData: %s, %d.%d, [%dx%d@%d] <%s>", tUUID, m_sIn.DTS, m_sIn.DMS, m_sIn.WIDTH, m_sIn.HEIGHT, m_sIn.FPS, m_sIn.FMT);
+ LOG( tB );
+#endif
+ servaMySQLDBC * m_pDBC = servaMySQLDBC::getInstance();
+ //servaSessionManager * m_pSM = servaSessionManager::getInstance();
+ if ( m_nRemoteRefID = m_pDBC->addMediaQueueRecord( tUUID, MID, SID, m_sIn.DTS, m_sIn.DMS, m_sIn.WIDTH, m_sIn.HEIGHT, m_sIn.FPS, m_sIn.FMT ) ) {
+ sprintf( m_cCurrentFile, "%s/%s.%s", base, tUUID, m_sIn.FMT );
+ m_pFD = fopen( m_cCurrentFile, "wb" );
+ free( tUUID );
+ return true;
+ };
+ free( tUUID );
+ };
+ }
};
+ memset( m_cCurrentFile, 0, MAX_PATH );
+ memset( &m_sIn, 0, sizeof(ARGUS_DATA_VIDEO_INFO) );
return false;
};
@@ -453,9 +528,10 @@ uint32_t servaVideoTransferHelper::saveNextChunk( uint8_t *ptr ){
};
m_nSAVED += chusz;
if ( chusz < ARGUS_RPC_DEFAULT_MEDIA_CHUNK ) {
+ LOG("Video File Reception Done");
fclose( m_pFD );
m_pFD = NULL;
- servaKernel::getInstance()->updateEncodeStatus( tDBID, MEDIA_STORED, 100 );
+ servaKernel::getInstance()->updateEncodeStatus(tDBID, MEDIA_STORED, 100);
} else {
if ( m_sIn.DATA_SIZE ) {
uint8_t perc = (uint8_t)((m_nSAVED * 100) / m_sIn.DATA_SIZE);
diff --git a/lib/App/serva/servaRemoteClientHandler.h b/lib/App/serva/servaRemoteClientHandler.h
index 96b5cfa8..45a6679e 100644
--- a/lib/App/serva/servaRemoteClientHandler.h
+++ b/lib/App/serva/servaRemoteClientHandler.h
@@ -7,6 +7,8 @@
#include "../../components/base/basicThread.h"
#include "../common/serverMySQL_dataBinder.h"
#include "../serva/servaSessionManager.h"
+#include "../../components/base/basicEvent.h"
+#include "../../components/base/basicEventHeap.h"
class servaRemoteClient;
@@ -33,6 +35,7 @@ class servaVideoTransferHelper{
ARGUS_DATA_VIDEO_INFO m_sIn;
uint64_t m_nSAVED;
uint8_t m_bOPerc;
+ basicEventHeap * m_pEventHeap;
//uint32_t m_nBufferSize;
//uint8_t * m_pBuffer;
//uint64_t m_nCTSMS; // future use for Target Binding ( history filtering )
@@ -51,6 +54,7 @@ class servaRPCHadnler: public basicThread, public networkClientHandler, public p
servaMySQLDBC * m_pDBC;
basicLogCollection * m_pLog;
servaSessionManager * m_pSM;
+ basicEventHeap * m_pEventHeap;
char m_cRemoteIP[64];
char m_cRemoteIdentity[64];
uint64_t m_dMojoDBID;
@@ -61,6 +65,8 @@ class servaRPCHadnler: public basicThread, public networkClientHandler, public p
//bool m_bSessionIsActive;
V_SESSION_EVENTS m_vSessionPool;
servaVideoTransferHelper m_pVideoHelper;
+ basicMutex m_mCloudProtector;
+ uint32_t m_nCloudStatus;
bool peer_send_ack_evt( uint64_t evt_dbid, CSTR uuid );
bool peer_send_req_draw( uint8_t sensor, uint8_t draw_type = ARGUS_RPC_DRAW_TYPE_FAST, bool getexisted = true );
bool peer_send_reg_status( uint8_t status );
diff --git a/lib/App/serva/servaSessionManager.cpp b/lib/App/serva/servaSessionManager.cpp
index 29b19bb5..ec5f0a3f 100644
--- a/lib/App/serva/servaSessionManager.cpp
+++ b/lib/App/serva/servaSessionManager.cpp
@@ -1,5 +1,6 @@
#include "servaSessionManager.h"
#include "../common/serverMySQL_dataBinder.h"
+#include "../../components/base/basicEventHeap.h"
#define LOG( X ) m_pLog->Log( "SSMN", this, X )
@@ -300,7 +301,11 @@ CSTR servaSessionManager::getReportDir( uint64_t track_id, uint32_t ts ){
CSTR servaSessionManager::getSessionBase( uint64_t sid ){
SESSION_DATA *sp = validateSession( sid );
- if ( sp ) return sp->reportVaultPath;
+ if ( sp ) return strdup( sp->reportVaultPath );
+ //Get Session Base from Database then
+ LOG("Reopen Session!");
+ sp = reopenSession( sid );
+ if ( sp ) return strdup( sp->reportVaultPath );
return NULL;
};
@@ -491,7 +496,12 @@ SESSION_DATA *servaSessionManager::updateSession( uint64_t tack_id, uint64_t mod
delete( tData->m_pDataReport );
free( tData );
tData = NULL;
- } else m_mSessions[tack_id] = tData;
+ } else {
+ m_mSessions[tack_id] = tData;
+ //Propogate Event ->Session Start
+ EVENT_CONTAINER *tEvt = createBasicEvent( tack_id, EVT_CLASS_SYSTEM, EVT_SRV_SESSION_STARTED );
+ if ( tEvt ) basicEventHeap::getInstance()->broadcast( tEvt );
+ };
};
};
return tData;
@@ -522,13 +532,16 @@ bool servaSessionManager::validate(){
LOG( tB );
#endif
if ( !(*idx).second->skeep_validation ) {
- if (cts - (*idx).second->lts > m_nSessionTO) {
+ if (cts - (*idx).second->lts > m_nSessionTO ) {
// Expire Session
//m_pDBC->updateSessionStatus( (*idx).second->db_id, 1 );
m_pDBC->sessionClose( (*idx).second->db_id );
// Set Session to remove
dE = idx;
bMustDelete = true;
+ //Propogate Event Session End
+ EVENT_CONTAINER *tEvt = createBasicEvent( (*idx).second->track_id, EVT_CLASS_SYSTEM, EVT_SRV_SESSION_ENDED );
+ if ( tEvt ) basicEventHeap::getInstance()->broadcast( tEvt );
};
};
};
diff --git a/lib/App/serva/servaSessionManager.h b/lib/App/serva/servaSessionManager.h
index 462cac61..9fae8df9 100644
--- a/lib/App/serva/servaSessionManager.h
+++ b/lib/App/serva/servaSessionManager.h
@@ -43,6 +43,7 @@ class servaSessionManager{
static servaSessionManager * getInstance( config_setting_t * Settings = NULL );
SESSION_DATA * updateSession( uint64_t tack_id, uint64_t module_id );
bool updateSessionStat( uint64_t session_id, bool evt = true );
+ //bool setSessionHazardLevel( uint64_t session_id, uint8_t lvl );
bool validate();
SESSION_DATA * validateSession( uint64_t sid );
};
diff --git a/lib/components/base/basicEvent.cpp b/lib/components/base/basicEvent.cpp
index cdccfcd6..c86a22cf 100644
--- a/lib/components/base/basicEvent.cpp
+++ b/lib/components/base/basicEvent.cpp
@@ -95,7 +95,7 @@ void utilizeBasicEvent( EVENT_CONTAINER *Evt ){
static uint32_t EventSeed_Counter = 0;
-EVENT_CONTAINER *createBasicEvent(unsigned int SRC, basicEventClassID Class, basicEventTypeID Type, char *RefUUID, char *Msg, void *Data, uint32_t tss, uint16_t tms ){
+EVENT_CONTAINER *createBasicEvent( uint64_t SRC, basicEventClassID Class, basicEventTypeID Type, char *RefUUID, char *Msg, void *Data, uint32_t tss, uint16_t tms ){
EVENT_CONTAINER *tEvent;
tEvent =(EVENT_CONTAINER *) malloc(sizeof(EVENT_CONTAINER));
if( tEvent ){
@@ -136,7 +136,7 @@ EVENT_CONTAINER *createBasicEvent(unsigned int SRC, basicEventClassID Class, bas
return tEvent;
};
-EVENT_CONTAINER *createBasicTargetedEvent(unsigned int SRC, unsigned int DST, basicEventClassID Class, basicEventTypeID Type, char *RefUUID, char *Msg, void *Data, uint32_t tss, uint16_t tms){
+EVENT_CONTAINER *createBasicTargetedEvent( uint64_t SRC, uint64_t DST, basicEventClassID Class, basicEventTypeID Type, char *RefUUID, char *Msg, void *Data, uint32_t tss, uint16_t tms){
EVENT_CONTAINER *tEvent;
tEvent = (EVENT_CONTAINER *)malloc(sizeof(EVENT_CONTAINER));
if (tEvent){
diff --git a/lib/components/base/basicEvent.h b/lib/components/base/basicEvent.h
index 2788628e..a7de417e 100644
--- a/lib/components/base/basicEvent.h
+++ b/lib/components/base/basicEvent.h
@@ -27,7 +27,7 @@
#define NODE_MASK 0x40000000
#define NODE_ID(X) (0x4000FFFF&X)
-typedef enum E_basicEventTypeID {
+typedef enum E_basicEventTypeID:uint8_t {
EVT_NOINIT = 0,
EVT_READY = 1,
EVT_ALARM = 2,
@@ -109,12 +109,16 @@ typedef enum E_basicEventTypeID {
EVT_FLT_LATF_TRP_EXP = 77,
EVT_FLT_LATF_SUSP_NAK = 78,
EVT_FLT_LATF_SUSP_EXP = 79,
- EVT_COUNT = 80
+ EVT_SRV_SESSION_STARTED = 80,
+ EVT_SRV_SESSION_RATED = 81,
+ EVT_SRV_SESSION_ENDED = 82,
+ EVT_SRV_TEST_MODBUS = 83,
+ EVT_SRV_MODULE_HEALTH = 84,
+ EVT_COUNT = 85
} basicEventTypeID;
-
-typedef enum E_basicEventClassID{
+typedef enum E_basicEventClassID:uint8_t{
EVT_CLASS_SYSTEM = 0,
EVT_CLASS_VIDEO = 2,
EVT_CLASS_IMAGE = 3,
@@ -136,11 +140,11 @@ typedef enum E_basicEventClassID{
} basicEventClassID;
typedef struct S_EVENT_CONTAINER{
- uint32_t m_nSourceNodeID;
- uint32_t m_nDestinationNodeID;
+ uint64_t m_nSourceNodeID;
+ uint64_t m_nDestinationNodeID;
char m_UUID[65];
- uint32_t m_db_id;
- uint32_t m_ref_id;
+ uint64_t m_db_id;
+ uint64_t m_ref_id;
char m_ref_UUID[65];
basicEventClassID m_eClass;
basicEventTypeID m_eType;
@@ -218,13 +222,19 @@ typedef struct S_FH_MISSION_DATA{
char missionID[38];
}FH_MISSION_DATA;
+typedef struct S_SERVA_VIDEO_TRANSFER_INFO{
+ uint64_t db_id;
+ uint8_t status;
+ uint8_t perc;
+}SERVA_VIDEO_TRANSFER_INFO;
+
//typedef std::queue EventsFIFO;
void utilizeBasicEvent( EVENT_CONTAINER &Evt );
void utilizeBasicEvent( EVENT_CONTAINER *Evt );
-EVENT_CONTAINER *createBasicEvent( unsigned int SRC, basicEventClassID Class, basicEventTypeID Type, char *RefUUID = NULL, char *Msg = NULL, void *Data = NULL, uint32_t tss=0, uint16_t tms=0 );
-EVENT_CONTAINER *createBasicTargetedEvent( unsigned int SRC, unsigned int DST, basicEventClassID Class, basicEventTypeID Type, char *RefUUID = NULL, char *Msg = NULL, void *Data = NULL, uint32_t tss=0, uint16_t tms=0 );
+EVENT_CONTAINER *createBasicEvent( uint64_t SRC, basicEventClassID Class, basicEventTypeID Type, char *RefUUID = NULL, char *Msg = NULL, void *Data = NULL, uint32_t tss=0, uint16_t tms=0 );
+EVENT_CONTAINER *createBasicTargetedEvent( uint64_t SRC, uint64_t DST, basicEventClassID Class, basicEventTypeID Type, char *RefUUID = NULL, char *Msg = NULL, void *Data = NULL, uint32_t tss=0, uint16_t tms=0 );
typedef std::queue< EVENT_CONTAINER > EventQueue;
typedef std::queue< EVENT_CONTAINER *> pEventQueue;
diff --git a/lib/components/base/basicFunctionality.cpp b/lib/components/base/basicFunctionality.cpp
index bfdcdec6..aeaf9765 100644
--- a/lib/components/base/basicFunctionality.cpp
+++ b/lib/components/base/basicFunctionality.cpp
@@ -456,6 +456,22 @@ uint16_t checksumPing(void *b, size_t len){
return result;
};
+// Calculating the Check Sum
+/*unsigned short checksum(void *b, int len){
+ unsigned short *buf = (unsigned short *) b;
+ unsigned int sum=0;
+ unsigned short result;
+
+ for ( sum = 0; len > 1; len -= 2 )
+ sum += *buf++;
+ if ( len == 1 )
+ sum += *(unsigned char*)buf;
+ sum = (sum >> 16) + (sum & 0xFFFF);
+ sum += (sum >> 16);
+ result = ~sum;
+ return result;
+}*/
+
CArray *explode( char Delim, CSTR S_Str ){
bool ws = false;
CArray * RetVal = NULL;
@@ -635,6 +651,115 @@ unsigned __int64 getMilliseconds( void ){
#ifdef __linux__
+
+#include
+// Define the Packet Constants
+// ping packet size
+#define PING_PKT_S 64
+
+// Automatic port number
+#define PORT_NO 0
+
+// Automatic port number
+#define PING_SLEEP_RATE 1000000
+
+// Gives the timeout delay for receiving packets
+// in seconds
+#define RECV_TIMEOUT 1
+
+// ping packet structure
+
+struct ping_pkt {
+ struct icmphdr hdr;
+ char msg[PING_PKT_S-sizeof(struct icmphdr)];
+};
+
+bool pingIP4( CSTR ip4 ){
+
+ return false;
+
+ bool RetVal = false;
+ if ( ip4 == NULL ) return false;
+ if ( strlen( ip4 ) < 7 ) return false;
+#ifdef DEBUG_EXTRA
+ URGENT_LOG("Pinging Device!");
+#endif
+ int sockfd;
+ int ttl_val=64, msg_count=0, i, flag=1, msg_received_count=0;
+ struct ping_pkt pckt;
+ struct sockaddr_in ping_addr;
+ struct sockaddr_in r_addr;
+ struct timeval tv_out;
+
+ tv_out.tv_sec = 0;
+ tv_out.tv_usec = 300000; // 1/3 of second
+
+
+ ping_addr.sin_family = AF_INET;
+ ping_addr.sin_addr.s_addr = inet_addr( ip4 );
+ //ping_addr.sin_port = htons( m_nPort );
+#ifdef DEBUG_EXTRA
+ URGENT_LOG( ip4 );
+#endif
+ sockfd = socket( AF_INET, SOCK_RAW, IPPROTO_ICMP );
+ if( sockfd < 0 ){
+ URGENT_LOG("Socket file descriptor not received!");
+ return false;
+ };
+
+ // set socket options at ip to TTL and value to 64,
+ // change to what you want by setting ttl_val
+ if( setsockopt( sockfd, SOL_IP, IP_TTL, &ttl_val, sizeof(ttl_val)) != 0 ){
+ URGENT_LOG("Setting socket options to TTL failed!");
+ shutdown( sockfd, SHUT_RDWR );
+ return false;
+ };
+
+ // setting timeout of recv setting
+ setsockopt( sockfd, SOL_SOCKET, SO_RCVTIMEO, (const char*)&tv_out, sizeof tv_out );
+
+ // flag is whether packet was sent or not
+ flag=1;
+
+ //filling packet
+ bzero(&pckt, sizeof(pckt));
+
+ pckt.hdr.type = ICMP_ECHO;
+ pckt.hdr.un.echo.id = getpid();
+
+ for ( i = 0; i < sizeof(pckt.msg)-1; i++ ) pckt.msg[i] = i+'0';
+
+ pckt.msg[i] = 0;
+ pckt.hdr.un.echo.sequence = msg_count++;
+ pckt.hdr.checksum = checksumPing(&pckt, sizeof(pckt));
+
+
+ //SLEEP( 300 );
+
+ //send packet
+ if( sendto( sockfd, &pckt, sizeof(pckt), 0, (struct sockaddr*)&ping_addr, sizeof(ping_addr)) <= 0 ){
+ URGENT_LOG("Packet Sending Failed!");
+ shutdown( sockfd, SHUT_RDWR );
+ return false;
+ };
+
+ //receive packet
+ socklen_t addr_len = sizeof(r_addr);
+
+ if( recvfrom( sockfd, &pckt, sizeof(pckt), 0, (struct sockaddr*)&r_addr, &addr_len) <= 0 ){
+#ifdef DEBUG_EXTRA
+ URGENT_LOG("Packet receive failed!");
+#endif
+ } else {
+#ifdef DEBUG_EXTRA
+ URGENT_LOG("Device pinged Sucessfully");
+#endif
+ RetVal = true;
+ };
+ shutdown( sockfd, SHUT_RDWR );
+ return RetVal;
+};
+
bool enumerateDevices( enumeratorInfo *mlist, const char *dTemplate){
DIR *d;
struct dirent *dir;
diff --git a/lib/components/base/basicFunctionality.h b/lib/components/base/basicFunctionality.h
index c8a20ef2..b1aa73be 100644
--- a/lib/components/base/basicFunctionality.h
+++ b/lib/components/base/basicFunctionality.h
@@ -119,9 +119,10 @@ CSTR getTimeStamp(void);
return ptr;
};
};
- pid_t gettid( void );
+ pid_t gettid( void );
#define SLEEP(X) usleep(X*1000)
- uint64_t getMilliseconds( void );
+ uint64_t getMilliseconds( void );
+ bool pingIP4( CSTR ip4 );
#else
#ifndef WIN_XP
#include
diff --git a/lib/data/net/clientPort.cpp b/lib/data/net/clientPort.cpp
index 1e2d9c45..b308b9c2 100644
--- a/lib/data/net/clientPort.cpp
+++ b/lib/data/net/clientPort.cpp
@@ -406,6 +406,54 @@ bool clientPort::disconnect(void){
return true;
};
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+CSTR clientPort::getLocalIp4(){
+#ifdef __linux__
+ struct sockaddr_in server_addr, client_addr;
+ socklen_t client_addr_len = sizeof(client_addr);
+ char ip_str[INET_ADDRSTRLEN];
+ // Get the local address of the connected socket
+ if (getsockname( m_nSocketFD, (struct sockaddr *)&client_addr, &client_addr_len) < 0) {
+ LOG_ERROR("getsockname failed");
+ return NULL;
+ };
+
+ // Convert the IP address to a human-readable string
+ if (inet_ntop(AF_INET, &client_addr.sin_addr, ip_str, INET_ADDRSTRLEN) == NULL) {
+ LOG_ERROR("inet_ntop failed");
+ return NULL;
+ };
+ return strdup( ip_str );
+#else
+ return NULL;
+#endif
+};
+CSTR clientPort::getRemoteIp4(){
+#ifdef __linux__
+ char ip_str[INET_ADDRSTRLEN];
+ struct sockaddr_in peer_addr;
+ socklen_t peer_addr_len = sizeof(peer_addr);
+ if (getpeername( m_nSocketFD, (struct sockaddr *)&peer_addr, &peer_addr_len) == -1) {
+ LOG_ERROR("Error getting peer name");
+ return NULL;
+ };
+ if (inet_ntop(AF_INET, &peer_addr.sin_addr, ip_str, INET_ADDRSTRLEN) == NULL) {
+ LOG_ERROR("Error converting IP to string");
+ return NULL;
+ };
+ return strdup(ip_str);
+#else
+ return NULL;
+#endif
+};
+
//#undef DUBUG_EXTRA
//#undef DUBUG_COMMUNICATION
diff --git a/lib/data/net/clientPort.h b/lib/data/net/clientPort.h
index c5c7ee0d..6b41179d 100644
--- a/lib/data/net/clientPort.h
+++ b/lib/data/net/clientPort.h
@@ -64,6 +64,8 @@ public:
bool isConnected(void){ return getConnectionStatus() == CS_CONNECTED; };
void setKeepAlive(bool Param);
bool getKeepAlive(void){ return m_bKeepAlive; };
+ CSTR getLocalIp4();
+ CSTR getRemoteIp4();
};
// TODO: Uncomment the copy constructor when you need it.
diff --git a/lib/data/net/netServer.cpp b/lib/data/net/netServer.cpp
index 362c939e..c6565ae6 100644
--- a/lib/data/net/netServer.cpp
+++ b/lib/data/net/netServer.cpp
@@ -493,9 +493,6 @@ void networkServer::m_fThreadProc( void ){
bool networkServer::dispatchEvent( EVENT_CONTAINER *Evt ){
if( Evt == NULL ) return false;
- if( Evt->m_eClass == EVT_CLASS_SYSTEM ) {
- // Handle System Events
- };
return true;
};
diff --git a/lib/data/protocol/protocolARGUS_DATA.cpp b/lib/data/protocol/protocolARGUS_DATA.cpp
index 5d05a946..9e70c911 100644
--- a/lib/data/protocol/protocolARGUS_DATA.cpp
+++ b/lib/data/protocol/protocolARGUS_DATA.cpp
@@ -21,6 +21,7 @@ size_t argus_rpc_finishupPackage( uint8_t *data, uint32_t serial, uint32_t size
return size+2;
};
+#ifndef _SERVER_APPLICATION_
ARGUS_DATA_EVENT *argus_rpc_convert_evt( EVENT_CONTAINER *Evt ){
if ( Evt == NULL ) return NULL;
ARGUS_DATA_EVENT *tVal = (ARGUS_DATA_EVENT *)malloc(sizeof(ARGUS_DATA_EVENT));
@@ -89,6 +90,7 @@ ARGUS_DATA_EVENT *argus_rpc_convert_evt( EVENT_CONTAINER *Evt ){
};
return tVal;
};
+#endif
DBC_EVT_RECORD *argus_rpc_convert_evt( ARGUS_DATA_EVENT *ptr ){
if ( ptr == NULL ) return NULL;
diff --git a/lib/data/protocol/protocolARGUS_DATA.h b/lib/data/protocol/protocolARGUS_DATA.h
index ad088285..8de56b69 100644
--- a/lib/data/protocol/protocolARGUS_DATA.h
+++ b/lib/data/protocol/protocolARGUS_DATA.h
@@ -2,8 +2,8 @@
#define __ARGUS_REMOTE_NETWORK_CONNECTOR_DATA__
#include "../../components/base/basicFunctionality.h"
-#include "../../components/base/basicEvent.h"
#include "../../App/common/dataBinder_structures.h"
+#include "../../components/base/basicEvent.h"
#define ARGUS_START_SERVER_FLAG 0x55
#define ARGUS_START_CLIENT_FLAG 0x88
@@ -25,6 +25,19 @@
#define ARGUS_RPC_DRAW_TYPE_FULL 0x01
+#define ARGUS_RPC_STATUS_MASK_US 0x00000007
+#define ARGUS_RPC_STATUS_SHIFT_US 1
+#define ARGUS_RPC_STATUS_MASK_BS 0x00000038
+#define ARGUS_RPC_STATUS_SHIFT_BS 4
+#define ARGUS_RPC_STATUS_MASK_CAM 0x000001C0
+#define ARGUS_RPC_STATUS_SHIFT_CAM 7
+#define ARGUS_RPC_STATUS_OK 0x00000049
+#define ARGUS_RPC_STATUS_MASK_OK 0xFFFFFFB6
+
+#define ARGUS_RPC_STATUS_US_OK 0x00000001
+#define ARGUS_RPC_STATUS_BS_OK 0x00000008
+#define ARGUS_RPC_STATUS_CAM_OK 0x00000040
+
#define ARGUS_RPC_DEFAULT_MEDIA_CHUNK 65536 //2048 64K
typedef enum E_ARGUS_RPC_TAGS{
@@ -56,6 +69,8 @@ typedef enum E_ARGUS_RPC_TAGS{
ARGUS_DATA_MSG_GET_USER_DATA = 0x1A,
ARGUS_DATA_MSG_SET_USER_DATA = 0x1B,
ARGUS_DATA_MSG_REGISTER = 0x1C,
+ ARGUS_DATA_MSG_RESTART_SW = 0x1D,
+ ARGUS_DATA_MSG_RESTART_PLATFORM = 0x1E,
ARGUS_DATA_MSG_RPC = 0x20,
ARGUS_DATA_MSG_RPC_ACK = 0x21,
@@ -85,7 +100,10 @@ typedef struct S_ARGUS_DATA_HEADER{
uint32_t SERIAL_ID; // Package Serial ID -> Provides ID to ACK
uint32_t SIZE;
}ARGUS_DATA_HEADER;
-
+typedef struct S_ARGUS_DATA_MOJO_REGISTRATION{
+ char peer[23];
+ char identity[33];
+}ARGUS_DATA_MOJO_REGISTRATION;
typedef struct S_ARGUS_DATA_MOJO_INFO{
uint8_t MOJO_WORK_MODE;
char TLS_VERSION[64]; //Top Level Software (Mojo)
@@ -146,6 +164,7 @@ typedef struct S_ARGUS_DATA_VIDEO_INFO{
uint16_t WIDTH;
uint16_t HEIGHT;
//char MD5[33];
+ uint64_t REF_ID;
char FMT[6];
//uint32_t EVTCNT;
uint32_t DATA_SIZE;
diff --git a/lib/rgoose/rgooseTypes.h b/lib/rgoose/rgooseTypes_.h
similarity index 100%
rename from lib/rgoose/rgooseTypes.h
rename to lib/rgoose/rgooseTypes_.h