From d6fff8b45d78f3fbb01dac4ec3332b29adc48524 Mon Sep 17 00:00:00 2001 From: Evgeny Gagua Date: Tue, 16 Sep 2025 20:22:06 +0300 Subject: [PATCH] SCADA First commit --- Projects/la_serva/la_serva.vpj | 2 + Projects/la_serva/makefile | 103 ++++++++++++---------- lib/App/common/SQLite_dataBinder.cpp | 70 +++++++++++++++ lib/App/common/SQLite_dataBinder.h | 2 + lib/App/common/dataBinder.h | 2 + lib/App/common/deviceNodeCamera.cpp | 4 +- lib/App/common/hardwareManager.cpp | 22 +++-- lib/App/common/hardwareManager.h | 11 ++- lib/App/common/kernelEventFilterTrain.cpp | 9 +- lib/App/common/kernelModuleEmbedVideo.cpp | 21 ++--- lib/App/mojo/mojoRemoteClient.cpp | 35 +++++++- lib/App/serva/servaScadaManager.cpp | 11 +++ lib/App/serva/servaScadaManager.h | 11 +++ lib/data/protocol/protocol.h | 1 + lib/data/protocol/protocolPTZ.h | 1 + lib/data/protocol/protocolPTZ_ONVIF.cpp | 21 +++-- lib/data/protocol/protocolPTZ_ONVIF.h | 1 + 17 files changed, 241 insertions(+), 86 deletions(-) create mode 100644 lib/App/serva/servaScadaManager.cpp create mode 100644 lib/App/serva/servaScadaManager.h diff --git a/Projects/la_serva/la_serva.vpj b/Projects/la_serva/la_serva.vpj index 0da23633..6d2009b8 100644 --- a/Projects/la_serva/la_serva.vpj +++ b/Projects/la_serva/la_serva.vpj @@ -531,6 +531,7 @@ + @@ -552,6 +553,7 @@ + diff --git a/Projects/la_serva/makefile b/Projects/la_serva/makefile index 7f782e2d..fcff0966 100644 --- a/Projects/la_serva/makefile +++ b/Projects/la_serva/makefile @@ -44,10 +44,11 @@ COMMON_OBJ=$(OUTDIR)/basicDualThread.o $(OUTDIR)/basicEngine.o \ $(OUTDIR)/protocolARGUS_DATA.o $(OUTDIR)/servaBackend.o \ $(OUTDIR)/servaKernel.o $(OUTDIR)/servaKernelToolKit.o \ $(OUTDIR)/servaMediaEncoder.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 + $(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 OBJ=$(COMMON_OBJ) $(CFG_OBJ) ALL_OBJ=$(OUTDIR)/basicDualThread.o $(OUTDIR)/basicEngine.o \ $(OUTDIR)/basicEvent.o $(OUTDIR)/basicEventHandler.o \ @@ -66,15 +67,16 @@ ALL_OBJ=$(OUTDIR)/basicDualThread.o $(OUTDIR)/basicEngine.o \ $(OUTDIR)/protocolARGUS_DATA.o $(OUTDIR)/servaBackend.o \ $(OUTDIR)/servaKernel.o $(OUTDIR)/servaKernelToolKit.o \ $(OUTDIR)/servaMediaEncoder.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 + $(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 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) @@ -161,10 +163,11 @@ COMMON_OBJ=$(OUTDIR)/basicDualThread.o $(OUTDIR)/basicEngine.o \ $(OUTDIR)/protocolARGUS_DATA.o $(OUTDIR)/servaBackend.o \ $(OUTDIR)/servaKernel.o $(OUTDIR)/servaKernelToolKit.o \ $(OUTDIR)/servaMediaEncoder.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 + $(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 OBJ=$(COMMON_OBJ) $(CFG_OBJ) ALL_OBJ=$(OUTDIR)/basicDualThread.o $(OUTDIR)/basicEngine.o \ $(OUTDIR)/basicEvent.o $(OUTDIR)/basicEventHandler.o \ @@ -183,10 +186,11 @@ ALL_OBJ=$(OUTDIR)/basicDualThread.o $(OUTDIR)/basicEngine.o \ $(OUTDIR)/protocolARGUS_DATA.o $(OUTDIR)/servaBackend.o \ $(OUTDIR)/servaKernel.o $(OUTDIR)/servaKernelToolKit.o \ $(OUTDIR)/servaMediaEncoder.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 + $(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 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) @@ -277,10 +281,11 @@ COMMON_OBJ=$(OUTDIR)/basicDualThread.o $(OUTDIR)/basicEngine.o \ $(OUTDIR)/protocolARGUS_DATA.o $(OUTDIR)/servaBackend.o \ $(OUTDIR)/servaKernel.o $(OUTDIR)/servaKernelToolKit.o \ $(OUTDIR)/servaMediaEncoder.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 + $(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 OBJ=$(COMMON_OBJ) $(CFG_OBJ) ALL_OBJ=$(OUTDIR)/basicDualThread.o $(OUTDIR)/basicEngine.o \ $(OUTDIR)/basicEvent.o $(OUTDIR)/basicEventHandler.o \ @@ -299,15 +304,16 @@ ALL_OBJ=$(OUTDIR)/basicDualThread.o $(OUTDIR)/basicEngine.o \ $(OUTDIR)/protocolARGUS_DATA.o $(OUTDIR)/servaBackend.o \ $(OUTDIR)/servaKernel.o $(OUTDIR)/servaKernelToolKit.o \ $(OUTDIR)/servaMediaEncoder.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 + $(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 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) @@ -398,10 +404,11 @@ COMMON_OBJ=$(OUTDIR)/basicDualThread.o $(OUTDIR)/basicEngine.o \ $(OUTDIR)/protocolARGUS_DATA.o $(OUTDIR)/servaBackend.o \ $(OUTDIR)/servaKernel.o $(OUTDIR)/servaKernelToolKit.o \ $(OUTDIR)/servaMediaEncoder.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 + $(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 OBJ=$(COMMON_OBJ) $(CFG_OBJ) ALL_OBJ=$(OUTDIR)/basicDualThread.o $(OUTDIR)/basicEngine.o \ $(OUTDIR)/basicEvent.o $(OUTDIR)/basicEventHandler.o \ @@ -420,15 +427,16 @@ ALL_OBJ=$(OUTDIR)/basicDualThread.o $(OUTDIR)/basicEngine.o \ $(OUTDIR)/protocolARGUS_DATA.o $(OUTDIR)/servaBackend.o \ $(OUTDIR)/servaKernel.o $(OUTDIR)/servaKernelToolKit.o \ $(OUTDIR)/servaMediaEncoder.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 + $(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 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) @@ -528,6 +536,7 @@ $(OUTDIR)/servaKernelToolKit.o: ../../lib/App/serva/servaKernelToolKit.cpp ../.. $(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)/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 diff --git a/lib/App/common/SQLite_dataBinder.cpp b/lib/App/common/SQLite_dataBinder.cpp index a87f3d0e..31443872 100644 --- a/lib/App/common/SQLite_dataBinder.cpp +++ b/lib/App/common/SQLite_dataBinder.cpp @@ -3123,10 +3123,18 @@ TRAIN_FILTER_DATA *sqliteDBC::getTrainFilterData( uint32_t ID ){ if( it != cArr->end() ){ tVal->nDecisionTime = 1000 * atoi( it->second.c_str() ); }; + //In case Wrong Parameter (less then Second) + if ( tVal->nDecisionTime < 1000 ) { + tVal->nDecisionTime = 10000; + }; it = cArr->find("SUSPECT_TIME"); if( it != cArr->end() ){ tVal->nSuspectTime = 1000 * atoi( it->second.c_str() ); }; + //In case Wrong Parameter (less then Second) + if ( tVal->nSuspectTime < 1000 ) { + tVal->nSuspectTime = 10000; + }; it = cArr->find("TRACK_TRAIN"); if( it != cArr->end() ){ tVal->bTrackTrain = (bool)atoi( it->second.c_str() ); @@ -3264,6 +3272,37 @@ uint32_t sqliteDBC::getWiFi_ID( uint32_t nif_id ){ return tVal; }; +DBC_INT_LIST *sqliteDBC::listCameras(){ + DBC_INT_LIST * tVal = NULL; + if( m_bStoIsConnected ){ + char tQBuf[CTEXT]; + AAssoc *result; + sprintf(tQBuf, "SELECT `id` FROM `cameras` WHERE `status`=3" ); +#ifdef DEBUG_ALL + LOG(tQBuf); +#endif + result = m_pDataStorage->Query( tQBuf ); + if( result!= NULL ) { + if( result->size() > 0 ) { + Assoc *cArr; + tVal = new DBC_INT_LIST(); + if( tVal != NULL ) { + Assoc::iterator it; + for(int i=0;isize();i++) { + cArr = result->at(i); + it = cArr->find("id"); + if( it != cArr->end() ){ + tVal->push_back( atoi( it->second.c_str() )); + }; + }; + }; + }; + }; + deleteResult( result ); + }; + return tVal; +}; + DBC_INT_LIST *sqliteDBC::listCamPresets( uint32_t SETID ){ DBC_INT_LIST * tVal = NULL; if( m_bStoIsConnected ){ @@ -3326,6 +3365,37 @@ DBC_INT_LIST *sqliteDBC::listFilters( uint32_t ServerID ){ return tVal; }; +DBC_INT_LIST *sqliteDBC::listLRFSensors(){ + DBC_INT_LIST * tVal = NULL; + if( m_bStoIsConnected ){ + char tQBuf[CTEXT]; + AAssoc *result; + sprintf(tQBuf, "SELECT `id` FROM `lrf_sensors` WHERE `data_status`>0" ); +#ifdef DEBUG_ALL + LOG(tQBuf); +#endif + result = m_pDataStorage->Query( tQBuf ); + if( result!= NULL ) { + if( result->size() > 0 ) { + Assoc *cArr; + tVal = new DBC_INT_LIST(); + if( tVal != NULL ) { + Assoc::iterator it; + for(int i=0;isize();i++) { + cArr = result->at(i); + it = cArr->find("id"); + if( it != cArr->end() ){ + tVal->push_back( atoi( it->second.c_str() )); + }; + }; + }; + }; + }; + deleteResult( result ); + }; + return tVal; +}; + DBC_INT_LIST *sqliteDBC::listLRFUploads( uint32_t deviceID ){ DBC_INT_LIST * tVal = NULL; if( m_bStoIsConnected ){ diff --git a/lib/App/common/SQLite_dataBinder.h b/lib/App/common/SQLite_dataBinder.h index d9ca98b5..9074497c 100644 --- a/lib/App/common/SQLite_dataBinder.h +++ b/lib/App/common/SQLite_dataBinder.h @@ -150,8 +150,10 @@ class sqliteDBC: public dataBinder { virtual TRAIN_FILTER_DATA * getTrainFilterData( uint32_t ID ); virtual DBC_UART_DATA * getUartData( uint32_t UartID ); virtual uint32_t getUartID( uint32_t NodeID, uint8_t Type, CSTR path ); + virtual DBC_INT_LIST * listCameras(); virtual DBC_INT_LIST * listCamPresets( uint32_t SETID ); virtual DBC_INT_LIST * listFilters( uint32_t ServerID ); + virtual DBC_INT_LIST * listLRFSensors(); virtual DBC_INT_LIST * listLRFUploads( uint32_t deviceID ); virtual DBC_INT_LIST * listMediaStreams( uint32_t SiteId, uint8_t listingType = LIST_ALL_RECORDS ); virtual DBC_INT_LIST * listModules(); diff --git a/lib/App/common/dataBinder.h b/lib/App/common/dataBinder.h index afd01088..4200b027 100644 --- a/lib/App/common/dataBinder.h +++ b/lib/App/common/dataBinder.h @@ -57,11 +57,13 @@ class dataBinder{ //virtual void fillRDF( uint32_t ts, REPORT_DIRINFO &RDF ){}; virtual void lazyEventArchiver( uint32_t DalayTime = 10 ){}; + virtual DBC_INT_LIST * listCameras(){ return NULL;}; virtual DBC_INT_LIST * listCamMediaStreams( uint32_t CAMID ){ return NULL;}; virtual DBC_INT_LIST * listCamPresets( uint32_t SETID ){ return NULL;}; virtual DBC_INT_LIST * listStreamCapPictures( uint32_t StreamID, uint32_t cnt ){ return NULL;}; virtual DBC_INT_LIST * listDetectionProfileIDs( uint32_t nodeID ){ return NULL;}; virtual DBC_INT_LIST * listDetectionProfiles( uint32_t nodeID ){ return NULL;}; + virtual DBC_INT_LIST * listLRFSensors(){ return NULL;}; virtual DBC_INT_LIST * listLRFUploads( uint32_t deviceID ){ return NULL;}; virtual DBC_INT_LIST * listFilters( uint32_t ServerID ){ return NULL;}; virtual DBC_INT_LIST * listLRFMaskVertexes( uint32_t MaskID ){ return NULL;}; diff --git a/lib/App/common/deviceNodeCamera.cpp b/lib/App/common/deviceNodeCamera.cpp index 9dfdac4e..5d495e21 100644 --- a/lib/App/common/deviceNodeCamera.cpp +++ b/lib/App/common/deviceNodeCamera.cpp @@ -1909,7 +1909,9 @@ bool deviceNodeCamera::validate(){ if ( tDATA == NULL ) return false; if ( memcmp( tDATA, &m_sCamData, sizeof(DBC_CAM_DATA) ) != 0 ) { //Settings Changed - memcpy(&m_sCamData, tDATA, sizeof(DBC_CAM_DATA) ); + //memcpy(&m_sCamData, tDATA, sizeof(DBC_CAM_DATA) ); + free( tDATA ); + return false; }; free( tDATA ); if (!validateStream()) return false; diff --git a/lib/App/common/hardwareManager.cpp b/lib/App/common/hardwareManager.cpp index d4e5f937..6b352810 100644 --- a/lib/App/common/hardwareManager.cpp +++ b/lib/App/common/hardwareManager.cpp @@ -64,9 +64,9 @@ hardwareManager::hardwareManager( bool cold_start ){ m_nServerNodeID = 0; m_nServerID = 0; m_nSiteID = 0; - +#ifdef MEMORY_CONSUMPTION_LIMIT m_bCacheCleanCounter = 3; - +#endif memset( &m_sSYS_INFO, 0, sizeof(DBC_SYS_INFO) ); strncpy( m_sSYS_INFO.SW_INFO, _BUILD_STRING_, 128 ); config_setting_t * m_pSettings = basicSettingsProvider::getInstance()->getSubNode( NULL, "HARDWARE" ); @@ -75,6 +75,7 @@ hardwareManager::hardwareManager( bool cold_start ){ long long int tVal; const char * tBuf; char tBuffer[128]; +#ifdef MEMORY_CONSUMPTION_LIMIT if( !config_setting_lookup_int64( m_pSettings, "MEMORY_LIMIT", &tVal ) ){ tVal = m_nMemoryLimitHeapSize = MEMORY_CONSUMPTION_LIMIT; pSetting = config_setting_add( m_pSettings, "MEMORY_LIMIT", CONFIG_TYPE_INT64 ); @@ -86,12 +87,15 @@ hardwareManager::hardwareManager( bool cold_start ){ sprintf( tBuffer, "MEMORY LIMIT Read From Settings: %lld bytes", m_nMemoryLimitHeapSize ); LOG( tBuffer ); }; - +#endif basicSettingsProvider::getInstance()->validate(); } else { +#ifdef MEMORY_CONSUMPTION_LIMIT m_nMemoryLimitHeapSize = MEMORY_CONSUMPTION_LIMIT; +#endif }; + #ifndef NO_EXEC_EXTERNALS FILE *fd = popen("/bin/uname -s -r -v -m","r"); if( fd!= NULL ) { @@ -360,15 +364,16 @@ bool hardwareManager::validate( void ){ #endif }; m_mVectorProtector.unlock(); - //Mem Validator + //Mem Validator +#ifdef MEMORY_CONSUMPTION_LIMIT if( m_nMemoryLimitHeapSize ) { size_t memStat = getCurrentRSS(); -#ifdef DEBUG_EXTRA + #ifdef DEBUG_EXTRA char MEM_MSG[128]; sprintf( MEM_MSG, "MEM: %" PRIu64 " TARG: %" PRIu64, memStat, m_nMemoryLimitHeapSize ); LOG( MEM_MSG ); -#endif -//https://www.ebay.com/itm/274974088159? + #endif + //https://www.ebay.com/itm/274974088159? RetVal = ( memStat < m_nMemoryLimitHeapSize ); if ( !RetVal ) { LOG_ERROR("Memory Consumption too BIG!"); @@ -378,6 +383,7 @@ bool hardwareManager::validate( void ){ LOG_ERROR("System Cache Fas Too Big Too Many Times!"); RetVal = false; }; +#endif return RetVal; }; @@ -1418,6 +1424,7 @@ bool hardwareManager::updateSysInfo( DBC_SYS_LOAD_INFO *ptr ){ sprintf( tB, "Total Mem: %" PRIu64 " Free: %" PRIu64 " Perc: %.2f", SI.totalram, SI.freeram, ptr->mem ); LOG( tB ); #endif +#ifdef MEMORY_CONSUMPTION_LIMIT if ( ptr->mem > 80.0f ) { LOG_ERROR( "Try to free some caches!" ); /* @@ -1440,6 +1447,7 @@ bool hardwareManager::updateSysInfo( DBC_SYS_LOAD_INFO *ptr ){ // kill( getpid(), 9 ); }; }; +#endif } else { LOG_ERROR("Error while getting System Info!"); }; diff --git a/lib/App/common/hardwareManager.h b/lib/App/common/hardwareManager.h index de83ab7e..c9f0e77c 100644 --- a/lib/App/common/hardwareManager.h +++ b/lib/App/common/hardwareManager.h @@ -6,7 +6,7 @@ #include "hardwareResource.h" //#define MEMORY_CONSUMPTION_LIMIT (524288000UL) //500 MB ~ 1 Hour -#define MEMORY_CONSUMPTION_LIMIT (2147483648UL) // 2GB +//#define MEMORY_CONSUMPTION_LIMIT (2147483648UL) // 2GB //#define MEMORY_CONSUMPTION_LIMIT (4294967296UL) // 4GB class hardwareManager{ @@ -19,9 +19,10 @@ class hardwareManager{ uint32_t m_nServerNodeID; uint32_t m_nServerID; // Prop of DBC uint32_t m_nSiteID; // Prop of Kernel - +#ifdef MEMORY_CONSUMPTION_LIMIT size_t m_nMemoryLimitHeapSize; - + uint8_t m_bCacheCleanCounter; +#endif //bool m_bHardwareEnumerated; void loadResources( void ); void unloadResources( void ); @@ -38,9 +39,7 @@ class hardwareManager{ PARSE_RESULT_NET_INTERFACES * parse_neconfig( CSTR if_name ); PARSE_RESULT_WIFI_SETTINGS * parse_wifi( CSTR if_name ); - void clearAllResources( void ); - - uint8_t m_bCacheCleanCounter; + void clearAllResources( void ); public: virtual ~hardwareManager(); static hardwareManager * getInstance( bool cold_start = true ); diff --git a/lib/App/common/kernelEventFilterTrain.cpp b/lib/App/common/kernelEventFilterTrain.cpp index c9f938ad..2fbaf222 100644 --- a/lib/App/common/kernelEventFilterTrain.cpp +++ b/lib/App/common/kernelEventFilterTrain.cpp @@ -73,7 +73,7 @@ bool kernelEventFilterTrain::validate(){ //Upper Sensor Zone if( m_sUpperZone.TrainOnTheField ){ if( ( cts - m_sUpperZone.ts ) > m_sTrainFilterData.nDecisionTime ){ - // Clear Expired Suspicious + // Clear Expired Train memset( &m_sUpperZone, 0, sizeof( EFT_UPPER_ZONE ) ); createEvent( EVT_FLT_LATF_TRP_EXP ); #ifdef SECOND_PEER_PORT @@ -86,7 +86,6 @@ bool kernelEventFilterTrain::validate(){ //Bottom Sensor Zone if( m_sBottomZone.SuspiciousUnconfirmed ){ if( ( cts - m_sBottomZone.ts ) > ( m_sTrainFilterData.nSuspectTime << 1 ) ){ - //m_sBottomZone.SuspiciousUnconfirmed = false; // Clear Expired Suspicious memset( &m_sBottomZone, 0, sizeof( EFT_BOTTOM_ZONE ) ); createEvent( EVT_FLT_LATF_SUSP_EXP ); @@ -125,7 +124,6 @@ bool kernelEventFilterTrain::validateTarget( uint32_t DevID, TARGET_DATA *ptr ){ uint64_t cts = getMilliseconds(); // Validate Zones and statuses (EXP) -> Moved to Filter Validation - m_mStateProtector.lock(); // Check Current Target float tAngleWidth; if( ptr->digital > 0 ) { @@ -133,12 +131,12 @@ bool kernelEventFilterTrain::validateTarget( uint32_t DevID, TARGET_DATA *ptr ){ } else { tAngleWidth = ( 360.0f * ptr->area ) / 12000.0f; }; - + m_mStateProtector.lock(); if( DevID == m_sTrainFilterData.nUpperSensorID ){ //If Upper Sensor // Train is detected + m_sUpperZone.ts = cts; // Update TS if( m_sUpperZone.TrainOnTheField ){ // Already was Train Detection - m_sUpperZone.ts = cts; // Update TS if( ( ptr->local_target.fi - tAngleWidth ) < m_sUpperZone.startAngle ) m_sUpperZone.startAngle = ptr->local_target.fi - tAngleWidth; if( ( ptr->local_target.fi + tAngleWidth ) > m_sUpperZone.endAngle ) m_sUpperZone.endAngle = ptr->local_target.fi + tAngleWidth; if( ( m_sTrainFilterData.bDebugMode && ( m_sUpperZone.LastEvtType != EVT_FLT_LATF_TRP_UPDT ) ) || m_sTrainFilterData.bTrackTrain ){ @@ -161,7 +159,6 @@ bool kernelEventFilterTrain::validateTarget( uint32_t DevID, TARGET_DATA *ptr ){ } else { // Newly Detected Train m_sUpperZone.TrainOnTheField = true; - m_sUpperZone.ts = cts; m_sUpperZone.startAngle = ptr->local_target.fi - tAngleWidth; m_sUpperZone.endAngle = ptr->local_target.fi + tAngleWidth; if( ( m_sTrainFilterData.bDebugMode && ( m_sUpperZone.LastEvtType != EVT_FLT_LATF_TRP_DET ) ) || m_sTrainFilterData.bDetectTrain ){ diff --git a/lib/App/common/kernelModuleEmbedVideo.cpp b/lib/App/common/kernelModuleEmbedVideo.cpp index 6f18eec8..19a11246 100644 --- a/lib/App/common/kernelModuleEmbedVideo.cpp +++ b/lib/App/common/kernelModuleEmbedVideo.cpp @@ -179,15 +179,15 @@ kernelModuleEmbedVideo::~kernelModuleEmbedVideo(){ #endif -#ifdef DEBUG +#ifdef DEBUG_EXTRA LOG("Deleting CAPS"); #endif if( m_mapCAPTURES.size() ) m_mapCAPTURES.clear(); -#ifdef DEBUG +#ifdef DEBUG_EXTRA LOG("Deleting MATS"); #endif if( m_mapMATS.size() ) m_mapMATS.clear(); -#ifdef DEBUG +#ifdef DEBUG_EXTRA LOG("Deleting No Signal"); #endif if( n_pNoSignalData ) free(n_pNoSignalData); @@ -200,7 +200,7 @@ kernelModuleEmbedVideo::~kernelModuleEmbedVideo(){ sprintf( tCMD, "rm -r -f -d %s/* ", m_pVideoScratchPath ); system( tCMD ); }; -#ifdef DEBUG +#ifdef DEBUG_EXTRA LOG("All Done!"); #endif }; @@ -230,8 +230,10 @@ static const char * ht_no_signal = "HTTP/1.1 200 OK\r\n" void signal_pipe_handler( int SIG ){ - basicLogCollection::getInstance()->Log("SIG_PIPE", NULL, _LOG_ERROR, "Sig Pipe Received Web Client Disconnected!"); // Web Client Disconnected! +#ifdef DEBUG_EXTRA + basicLogCollection::getInstance()->Log("SIG_PIPE", NULL, _LOG_ERROR, "Sig Pipe Received Web Client Disconnected!"); +#endif }; uint8_t kernelModuleEmbedVideo::getMediaMode( void ){ @@ -479,7 +481,7 @@ void *kernelModuleEmbedVideo::webClientProc( void *ptr ){ /*********/ sprintf( mesg, "--MPFrame\r\nContent-type: image/jpeg\r\nContent-length: %d\r\n\r\n", msgSize ); if( send( CTX->m_iSocketFID, mesg, strlen( mesg ), 0 )< 0 ){ -#ifdef DEBUG +#ifdef DEBUG_EXTRA sprintf( mesg, "[1]Failed sending file to client: %s", strerror(errno)); TLOG_ERROR(mesg); #endif @@ -487,7 +489,7 @@ void *kernelModuleEmbedVideo::webClientProc( void *ptr ){ continue; }; if( send( CTX->m_iSocketFID, tBuf, msgSize, 0 ) < 0 ){ -#ifdef DEBUG +#ifdef DEBUG_EXTRA sprintf( mesg, "[2]Failed sending file to client: %s", strerror(errno)); TLOG_ERROR(mesg); #endif @@ -495,7 +497,7 @@ void *kernelModuleEmbedVideo::webClientProc( void *ptr ){ continue; }; if( send( CTX->m_iSocketFID, "\r\n\r\n", 4, 0 )< 0 ){ -#ifdef DEBUG +#ifdef DEBUG_EXTRA sprintf( mesg, "[3]Failed sending file to client: %s", strerror(errno)); TLOG_ERROR(mesg); #endif @@ -511,11 +513,10 @@ void *kernelModuleEmbedVideo::webClientProc( void *ptr ){ SLEEP( 3 ); close( CTX->m_iSocketFID ); CTX->bValid = false; -#ifdef DEBUG +#ifdef DEBUG_EXTRA TLOG("WEB Client Handler Ended!"); #endif pthread_exit( NULL ); - TLOG( "After Pthread Ecit!" ); return NULL; }; diff --git a/lib/App/mojo/mojoRemoteClient.cpp b/lib/App/mojo/mojoRemoteClient.cpp index 27fb5fd6..3ce6474a 100644 --- a/lib/App/mojo/mojoRemoteClient.cpp +++ b/lib/App/mojo/mojoRemoteClient.cpp @@ -314,11 +314,10 @@ void mojoRemoteClient::enqueueStatMsg(){ tCMD->CMD = ARGUS_DATA_MSG_STAT; tCMD->DATA_SIZE = sizeof( ARGUS_DATA_MOJO_STATUS ); tCMD->DATA = malloc(tCMD->DATA_SIZE); - if (tCMD->DATA) { + if( tCMD->DATA ){ + memset( tCMD->DATA, 0, tCMD->DATA_SIZE ); ARGUS_DATA_MOJO_STATUS *cSTATUS = (ARGUS_DATA_MOJO_STATUS*)tCMD->DATA; DBC_SYS_LOAD_INFO cSYSSTAT; - uint8_t tS = m_pMaster->m_pDBC->getLRFDataStatus( 1 ); - cSTATUS->STATUSES = 0xff00ff00 | tS; m_pMaster->getSystemUtilization( &cSYSSTAT ); cSTATUS->CPU_LOAD = round( cSYSSTAT.cpu15 ); cSTATUS->CPU_TEMP = round( cSYSSTAT.temperature ); @@ -326,6 +325,36 @@ 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); + }; + }; + 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)); + }; + // check the stream + if( tCD->online ) { + cSTATUS->STATUSES = cSTATUS->STATUSES | (0x40000000 >> (idx<<1)); + }; + free( tCD ); + }; + }; + tList->clear(); + delete( tList ); + }; if ( pushNewTransaction( tCMD ) ) return; free( tCMD->DATA ); }; diff --git a/lib/App/serva/servaScadaManager.cpp b/lib/App/serva/servaScadaManager.cpp new file mode 100644 index 00000000..f138b30f --- /dev/null +++ b/lib/App/serva/servaScadaManager.cpp @@ -0,0 +1,11 @@ +#include "servaScadaManager.h" + + +servaScadaManager::_instance = NULL; + +servaScadaManager *servaScadaManager::getInstance(){ + if ( _instance == NULL ) { + _instance = new servaScadaManager(); + }; + return _instance; +}; diff --git a/lib/App/serva/servaScadaManager.h b/lib/App/serva/servaScadaManager.h new file mode 100644 index 00000000..6446eb85 --- /dev/null +++ b/lib/App/serva/servaScadaManager.h @@ -0,0 +1,11 @@ +#ifndef __SERVA_SCADA_MANAGER_HEADER__ +#define __SERVA_SCADA_MANAGER_HEADER__ + +class servaScadaManager{ + +}; + + + + +#endif diff --git a/lib/data/protocol/protocol.h b/lib/data/protocol/protocol.h index 0f298b2f..66e18c1f 100644 --- a/lib/data/protocol/protocol.h +++ b/lib/data/protocol/protocol.h @@ -70,6 +70,7 @@ class protocolParser{ CONNECTION_STATUS getConnectionStatus( void ); bool setTransport(basicTransport* ptrTransport, bool check_if_allready = true); basicTransport * getCurrentTransport( void ); + virtual bool validate(){ return true; }; }; #endif diff --git a/lib/data/protocol/protocolPTZ.h b/lib/data/protocol/protocolPTZ.h index 2016e293..1f73ae07 100644 --- a/lib/data/protocol/protocolPTZ.h +++ b/lib/data/protocol/protocolPTZ.h @@ -196,6 +196,7 @@ class protocolPTZ: public protocolParser { virtual bool goPreset( char *PresetToken ){ return true; }; virtual bool setOSD( bool nMode ){ return true; }; virtual bool waitMoveIsDone( void ){ return false; }; + virtual bool validate(){ return true; }; }; #endif // NO_PTZ_CAMERAS diff --git a/lib/data/protocol/protocolPTZ_ONVIF.cpp b/lib/data/protocol/protocolPTZ_ONVIF.cpp index 277d74aa..9366b53d 100644 --- a/lib/data/protocol/protocolPTZ_ONVIF.cpp +++ b/lib/data/protocol/protocolPTZ_ONVIF.cpp @@ -125,6 +125,7 @@ bool protocolPTZ_ONVIF::create( void ){ m_pOnVif = new pOnvif(); if( m_pOnVif == NULL ){ LOG_ERROR("pOnvif NEW FAILURE!"); + m_bStatus = 0; return false; }; m_pOnVif->setDeviceUri( m_pDeviceURI ); @@ -135,11 +136,13 @@ bool protocolPTZ_ONVIF::create( void ){ if( m_pOnVif->create() ){ m_pProfile = m_pOnVif->getProfiles()->at(0); LOG("DONE"); + m_bStatus = 1; return true; } else { LOG_ERROR("pOnvif CREATE FAILURE!"); delete( m_pOnVif ); m_pOnVif = NULL; + m_bStatus = 0; return false; }; #else @@ -218,15 +221,16 @@ bool protocolPTZ_ONVIF::move( uint32_t MoveMatrix ){ res = m_pOnVif->ptz_ContinuousMove( m_pProfile->profiletoken, Speed_x , Speed_y ); }; if( res ){ - if(( MoveMatrix & PTZ_DRIVE_ZOOM_MASK) == 0 ) { - return true; + if(( MoveMatrix & PTZ_DRIVE_ZOOM_MASK) != 0 ) { + res = m_pOnVif->ptz_ContinuousMoveZoom( m_pProfile->profiletoken, Speed_z ); }; - return m_pOnVif->ptz_ContinuousMoveZoom( m_pProfile->profiletoken, Speed_z ); }; + m_bStatus = (res)?1:0; } else { - return m_pOnVif->ptz_Stop( m_pProfile->profiletoken, true, true ); + + m_bStatus = (m_pOnVif->ptz_Stop( m_pProfile->profiletoken, true, true ))?1:0; }; - return false; + return ( m_bStatus > 0 ); #else if (m_bStatus == 0) return false; //if (m_bReplyRequired) if (m_bLastCommandIssued != CMD_PTZ_NOOP) return false; @@ -352,7 +356,8 @@ bool protocolPTZ_ONVIF::goPreset( char *PresetToken ){ LOG_ERROR("No PTZ Profile!!"); return false; }; - return m_pOnVif->ptz_GotoPreset( m_pProfile->profiletoken, PresetToken, 1.0f, 1.0f, 1.0f ); + if ( !m_pOnVif->ptz_GotoPreset(m_pProfile->profiletoken, PresetToken, 1.0f, 1.0f, 1.0f) ) m_bStatus = 0 ; + return ( m_bStatus > 0 ); #else if (m_bStatus == 0) return false; //if (m_bReplyRequired) if (m_bLastCommandIssued != CMD_PTZ_NOOP) return false; @@ -383,5 +388,9 @@ bool protocolPTZ_ONVIF::goPreset( char *PresetToken ){ #endif }; +bool protocolPTZ_ONVIF::validate(){ + return ( m_bStatus > 0 ); +}; + #undef LOG #undef LOG_ERROR diff --git a/lib/data/protocol/protocolPTZ_ONVIF.h b/lib/data/protocol/protocolPTZ_ONVIF.h index a8c1b610..162f61c7 100644 --- a/lib/data/protocol/protocolPTZ_ONVIF.h +++ b/lib/data/protocol/protocolPTZ_ONVIF.h @@ -47,6 +47,7 @@ class protocolPTZ_ONVIF: public protocolPTZ{ bool setPassword( CSTR password ); bool setAuthMode( uint8_t Mode ); virtual bool waitMoveIsDone( void ); + virtual bool validate(); };