diff --git a/.gitignore b/.gitignore index 1aff3350..fc1fdfa7 100644 --- a/.gitignore +++ b/.gitignore @@ -112,3 +112,7 @@ Projects/la_mojo/Debug86/* Projects/la_mojo/Release86/* Projects/watchDogDaemon/Debug/* Projects/watchDogDaemon/Release/* +Projects/la_serva/Debug/* +Projects/la_serva/Debug86/* +Projects/la_serva/Release/* +Projects/la_serva/Release86/* \ No newline at end of file diff --git a/Linux_Workspace.vpw b/Linux_Workspace.vpw index 0f2fa7c0..110127c0 100644 --- a/Linux_Workspace.vpw +++ b/Linux_Workspace.vpw @@ -10,6 +10,7 @@ + diff --git a/Projects/la_mojo/build b/Projects/la_mojo/build index e30c9046..59699e61 100755 --- a/Projects/la_mojo/build +++ b/Projects/la_mojo/build @@ -4,7 +4,7 @@ #make clean -e "CFG=Debug" #make -e "CFG=Debug" -j6 -#make clean -e "CFG=Debug86" +make clean -e "CFG=Debug86" make -e "CFG=Debug86" -j4 #make clean -e "CFG=Release86" diff --git a/Projects/la_mojo/la_mojo.vpj b/Projects/la_mojo/la_mojo.vpj index fcfc4e8b..bc752b0b 100644 --- a/Projects/la_mojo/la_mojo.vpj +++ b/Projects/la_mojo/la_mojo.vpj @@ -132,6 +132,9 @@ + + + @@ -172,7 +175,7 @@ RunFromDir="%rw"> + OtherOptions="-lconfig -lpthread -lmysqlclient -lelf -lcurses -lcdk -lcurl `pkg-config --libs rdkafka++` -L/usr/lib -lrdkafka++ -lrdkafka -lwiringx -lsqlite3 -s"/> + @@ -581,6 +585,7 @@ + @@ -632,6 +637,7 @@ + diff --git a/Projects/la_mojo/makefile b/Projects/la_mojo/makefile index ff7e349b..ac95dda9 100644 --- a/Projects/la_mojo/makefile +++ b/Projects/la_mojo/makefile @@ -25,8 +25,8 @@ CFG_LIB=-lsqlite3 -lpthread -lmysqlclient -lssl -lcurl -lm -lcrypto \ -lconfig -lz -lv4l1 -lv4l2 -lhidapi-libusb `pkg-config libavcodec \ libavdevice libavfilter libavformat libavutil libpostproc \ libswresample libswscale --libs` -latomic `pkg-config --libs openssl \ - opencv4 rdkafka++` -lwiringx -lliveMedia -lgroupsock \ - -lBasicUsageEnvironment -lUsageEnvironment + opencv4 rdkafka++` -L/usr/lib -lrdkafka++ -lrdkafka -lwiringx \ + -lliveMedia -lgroupsock -lBasicUsageEnvironment -lUsageEnvironment CFG_OBJ= COMMON_OBJ=$(OUTDIR)/base64.o $(OUTDIR)/basicCameraInfo.o \ $(OUTDIR)/basicDualThread.o $(OUTDIR)/basicEngine.o \ @@ -63,20 +63,21 @@ COMMON_OBJ=$(OUTDIR)/base64.o $(OUTDIR)/basicCameraInfo.o \ $(OUTDIR)/kernelModuleUSBRelay.o $(OUTDIR)/kernelPrototype.o \ $(OUTDIR)/libzip.o $(OUTDIR)/mask.o $(OUTDIR)/md5.o \ $(OUTDIR)/mojoBackend.o $(OUTDIR)/mojoKernel.o \ - $(OUTDIR)/mysql_class.o $(OUTDIR)/MySQL_dataBinder.o \ - $(OUTDIR)/netClientHandler.o $(OUTDIR)/netServer.o \ - $(OUTDIR)/objectFileLoggingService.o $(OUTDIR)/objectSystemAnchor.o \ - $(OUTDIR)/ponvif.o $(OUTDIR)/protocol.o $(OUTDIR)/protocolHTTP.o \ - $(OUTDIR)/protocolKAFKA.o $(OUTDIR)/protocolLGS2D.o \ - $(OUTDIR)/protocolLGS3D.o $(OUTDIR)/protocolLGS3D_client.o \ - $(OUTDIR)/protocolONVIF.o $(OUTDIR)/protocolPTZ.o \ - $(OUTDIR)/protocolPTZ_ONVIF.o $(OUTDIR)/protocolPTZ_PELCO.o \ - $(OUTDIR)/protocolPTZ_VISCA.o $(OUTDIR)/serverPort.o \ - $(OUTDIR)/sqlite_class.o $(OUTDIR)/SQLite_dataBinder.o \ - $(OUTDIR)/Transform.o $(OUTDIR)/transportSerial.o \ - $(OUTDIR)/transportSocket.o $(OUTDIR)/utm.o \ - $(OUTDIR)/videoAVLIBSource.o $(OUTDIR)/videoLive555AVLibSource.o \ - $(OUTDIR)/xmlParser.o + $(OUTDIR)/mojoRemoteClient.o $(OUTDIR)/mysql_class.o \ + $(OUTDIR)/MySQL_dataBinder.o $(OUTDIR)/netClientHandler.o \ + $(OUTDIR)/netServer.o $(OUTDIR)/objectFileLoggingService.o \ + $(OUTDIR)/objectSystemAnchor.o $(OUTDIR)/ponvif.o \ + $(OUTDIR)/protocol.o $(OUTDIR)/protocolARGUS.o \ + $(OUTDIR)/protocolHTTP.o $(OUTDIR)/protocolKAFKA.o \ + $(OUTDIR)/protocolLGS2D.o $(OUTDIR)/protocolLGS3D.o \ + $(OUTDIR)/protocolLGS3D_client.o $(OUTDIR)/protocolONVIF.o \ + $(OUTDIR)/protocolPTZ.o $(OUTDIR)/protocolPTZ_ONVIF.o \ + $(OUTDIR)/protocolPTZ_PELCO.o $(OUTDIR)/protocolPTZ_VISCA.o \ + $(OUTDIR)/serverPort.o $(OUTDIR)/sqlite_class.o \ + $(OUTDIR)/SQLite_dataBinder.o $(OUTDIR)/Transform.o \ + $(OUTDIR)/transportSerial.o $(OUTDIR)/transportSocket.o \ + $(OUTDIR)/utm.o $(OUTDIR)/videoAVLIBSource.o \ + $(OUTDIR)/videoLive555AVLibSource.o $(OUTDIR)/xmlParser.o OBJ=$(COMMON_OBJ) $(CFG_OBJ) ALL_OBJ=$(OUTDIR)/base64.o $(OUTDIR)/basicCameraInfo.o \ $(OUTDIR)/basicDualThread.o $(OUTDIR)/basicEngine.o \ @@ -113,25 +114,27 @@ ALL_OBJ=$(OUTDIR)/base64.o $(OUTDIR)/basicCameraInfo.o \ $(OUTDIR)/kernelModuleUSBRelay.o $(OUTDIR)/kernelPrototype.o \ $(OUTDIR)/libzip.o $(OUTDIR)/mask.o $(OUTDIR)/md5.o \ $(OUTDIR)/mojoBackend.o $(OUTDIR)/mojoKernel.o \ - $(OUTDIR)/mysql_class.o $(OUTDIR)/MySQL_dataBinder.o \ - $(OUTDIR)/netClientHandler.o $(OUTDIR)/netServer.o \ - $(OUTDIR)/objectFileLoggingService.o $(OUTDIR)/objectSystemAnchor.o \ - $(OUTDIR)/ponvif.o $(OUTDIR)/protocol.o $(OUTDIR)/protocolHTTP.o \ - $(OUTDIR)/protocolKAFKA.o $(OUTDIR)/protocolLGS2D.o \ - $(OUTDIR)/protocolLGS3D.o $(OUTDIR)/protocolLGS3D_client.o \ - $(OUTDIR)/protocolONVIF.o $(OUTDIR)/protocolPTZ.o \ - $(OUTDIR)/protocolPTZ_ONVIF.o $(OUTDIR)/protocolPTZ_PELCO.o \ - $(OUTDIR)/protocolPTZ_VISCA.o $(OUTDIR)/serverPort.o \ - $(OUTDIR)/sqlite_class.o $(OUTDIR)/SQLite_dataBinder.o \ - $(OUTDIR)/Transform.o $(OUTDIR)/transportSerial.o \ - $(OUTDIR)/transportSocket.o $(OUTDIR)/utm.o \ - $(OUTDIR)/videoAVLIBSource.o $(OUTDIR)/videoLive555AVLibSource.o \ - $(OUTDIR)/xmlParser.o -lsqlite3 -lpthread -lmysqlclient -lssl -lcurl \ - -lm -lcrypto -lconfig -lz -lv4l1 -lv4l2 -lhidapi-libusb `pkg-config \ - libavcodec libavdevice libavfilter libavformat libavutil libpostproc \ - libswresample libswscale --libs` -latomic `pkg-config --libs openssl \ - opencv4 rdkafka++` -lwiringx -lliveMedia -lgroupsock \ - -lBasicUsageEnvironment -lUsageEnvironment + $(OUTDIR)/mojoRemoteClient.o $(OUTDIR)/mysql_class.o \ + $(OUTDIR)/MySQL_dataBinder.o $(OUTDIR)/netClientHandler.o \ + $(OUTDIR)/netServer.o $(OUTDIR)/objectFileLoggingService.o \ + $(OUTDIR)/objectSystemAnchor.o $(OUTDIR)/ponvif.o \ + $(OUTDIR)/protocol.o $(OUTDIR)/protocolARGUS.o \ + $(OUTDIR)/protocolHTTP.o $(OUTDIR)/protocolKAFKA.o \ + $(OUTDIR)/protocolLGS2D.o $(OUTDIR)/protocolLGS3D.o \ + $(OUTDIR)/protocolLGS3D_client.o $(OUTDIR)/protocolONVIF.o \ + $(OUTDIR)/protocolPTZ.o $(OUTDIR)/protocolPTZ_ONVIF.o \ + $(OUTDIR)/protocolPTZ_PELCO.o $(OUTDIR)/protocolPTZ_VISCA.o \ + $(OUTDIR)/serverPort.o $(OUTDIR)/sqlite_class.o \ + $(OUTDIR)/SQLite_dataBinder.o $(OUTDIR)/Transform.o \ + $(OUTDIR)/transportSerial.o $(OUTDIR)/transportSocket.o \ + $(OUTDIR)/utm.o $(OUTDIR)/videoAVLIBSource.o \ + $(OUTDIR)/videoLive555AVLibSource.o $(OUTDIR)/xmlParser.o -lsqlite3 \ + -lpthread -lmysqlclient -lssl -lcurl -lm -lcrypto -lconfig -lz \ + -lv4l1 -lv4l2 -lhidapi-libusb `pkg-config libavcodec libavdevice \ + libavfilter libavformat libavutil libpostproc libswresample \ + libswscale --libs` -latomic `pkg-config --libs openssl opencv4 \ + rdkafka++` -L/usr/lib -lrdkafka++ -lrdkafka -lwiringx -lliveMedia \ + -lgroupsock -lBasicUsageEnvironment -lUsageEnvironment COMPILE=g++ -c -x c++ "-DDEBUG" "-D__STDC_CONSTANT_MACROS__" "-D_CLIENT_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) @@ -254,20 +257,21 @@ COMMON_OBJ=$(OUTDIR)/base64.o $(OUTDIR)/basicCameraInfo.o \ $(OUTDIR)/kernelModuleUSBRelay.o $(OUTDIR)/kernelPrototype.o \ $(OUTDIR)/libzip.o $(OUTDIR)/mask.o $(OUTDIR)/md5.o \ $(OUTDIR)/mojoBackend.o $(OUTDIR)/mojoKernel.o \ - $(OUTDIR)/mysql_class.o $(OUTDIR)/MySQL_dataBinder.o \ - $(OUTDIR)/netClientHandler.o $(OUTDIR)/netServer.o \ - $(OUTDIR)/objectFileLoggingService.o $(OUTDIR)/objectSystemAnchor.o \ - $(OUTDIR)/ponvif.o $(OUTDIR)/protocol.o $(OUTDIR)/protocolHTTP.o \ - $(OUTDIR)/protocolKAFKA.o $(OUTDIR)/protocolLGS2D.o \ - $(OUTDIR)/protocolLGS3D.o $(OUTDIR)/protocolLGS3D_client.o \ - $(OUTDIR)/protocolONVIF.o $(OUTDIR)/protocolPTZ.o \ - $(OUTDIR)/protocolPTZ_ONVIF.o $(OUTDIR)/protocolPTZ_PELCO.o \ - $(OUTDIR)/protocolPTZ_VISCA.o $(OUTDIR)/serverPort.o \ - $(OUTDIR)/sqlite_class.o $(OUTDIR)/SQLite_dataBinder.o \ - $(OUTDIR)/Transform.o $(OUTDIR)/transportSerial.o \ - $(OUTDIR)/transportSocket.o $(OUTDIR)/utm.o \ - $(OUTDIR)/videoAVLIBSource.o $(OUTDIR)/videoLive555AVLibSource.o \ - $(OUTDIR)/xmlParser.o + $(OUTDIR)/mojoRemoteClient.o $(OUTDIR)/mysql_class.o \ + $(OUTDIR)/MySQL_dataBinder.o $(OUTDIR)/netClientHandler.o \ + $(OUTDIR)/netServer.o $(OUTDIR)/objectFileLoggingService.o \ + $(OUTDIR)/objectSystemAnchor.o $(OUTDIR)/ponvif.o \ + $(OUTDIR)/protocol.o $(OUTDIR)/protocolARGUS.o \ + $(OUTDIR)/protocolHTTP.o $(OUTDIR)/protocolKAFKA.o \ + $(OUTDIR)/protocolLGS2D.o $(OUTDIR)/protocolLGS3D.o \ + $(OUTDIR)/protocolLGS3D_client.o $(OUTDIR)/protocolONVIF.o \ + $(OUTDIR)/protocolPTZ.o $(OUTDIR)/protocolPTZ_ONVIF.o \ + $(OUTDIR)/protocolPTZ_PELCO.o $(OUTDIR)/protocolPTZ_VISCA.o \ + $(OUTDIR)/serverPort.o $(OUTDIR)/sqlite_class.o \ + $(OUTDIR)/SQLite_dataBinder.o $(OUTDIR)/Transform.o \ + $(OUTDIR)/transportSerial.o $(OUTDIR)/transportSocket.o \ + $(OUTDIR)/utm.o $(OUTDIR)/videoAVLIBSource.o \ + $(OUTDIR)/videoLive555AVLibSource.o $(OUTDIR)/xmlParser.o OBJ=$(COMMON_OBJ) $(CFG_OBJ) ALL_OBJ=$(OUTDIR)/base64.o $(OUTDIR)/basicCameraInfo.o \ $(OUTDIR)/basicDualThread.o $(OUTDIR)/basicEngine.o \ @@ -304,23 +308,24 @@ ALL_OBJ=$(OUTDIR)/base64.o $(OUTDIR)/basicCameraInfo.o \ $(OUTDIR)/kernelModuleUSBRelay.o $(OUTDIR)/kernelPrototype.o \ $(OUTDIR)/libzip.o $(OUTDIR)/mask.o $(OUTDIR)/md5.o \ $(OUTDIR)/mojoBackend.o $(OUTDIR)/mojoKernel.o \ - $(OUTDIR)/mysql_class.o $(OUTDIR)/MySQL_dataBinder.o \ - $(OUTDIR)/netClientHandler.o $(OUTDIR)/netServer.o \ - $(OUTDIR)/objectFileLoggingService.o $(OUTDIR)/objectSystemAnchor.o \ - $(OUTDIR)/ponvif.o $(OUTDIR)/protocol.o $(OUTDIR)/protocolHTTP.o \ - $(OUTDIR)/protocolKAFKA.o $(OUTDIR)/protocolLGS2D.o \ - $(OUTDIR)/protocolLGS3D.o $(OUTDIR)/protocolLGS3D_client.o \ - $(OUTDIR)/protocolONVIF.o $(OUTDIR)/protocolPTZ.o \ - $(OUTDIR)/protocolPTZ_ONVIF.o $(OUTDIR)/protocolPTZ_PELCO.o \ - $(OUTDIR)/protocolPTZ_VISCA.o $(OUTDIR)/serverPort.o \ - $(OUTDIR)/sqlite_class.o $(OUTDIR)/SQLite_dataBinder.o \ - $(OUTDIR)/Transform.o $(OUTDIR)/transportSerial.o \ - $(OUTDIR)/transportSocket.o $(OUTDIR)/utm.o \ - $(OUTDIR)/videoAVLIBSource.o $(OUTDIR)/videoLive555AVLibSource.o \ - $(OUTDIR)/xmlParser.o + $(OUTDIR)/mojoRemoteClient.o $(OUTDIR)/mysql_class.o \ + $(OUTDIR)/MySQL_dataBinder.o $(OUTDIR)/netClientHandler.o \ + $(OUTDIR)/netServer.o $(OUTDIR)/objectFileLoggingService.o \ + $(OUTDIR)/objectSystemAnchor.o $(OUTDIR)/ponvif.o \ + $(OUTDIR)/protocol.o $(OUTDIR)/protocolARGUS.o \ + $(OUTDIR)/protocolHTTP.o $(OUTDIR)/protocolKAFKA.o \ + $(OUTDIR)/protocolLGS2D.o $(OUTDIR)/protocolLGS3D.o \ + $(OUTDIR)/protocolLGS3D_client.o $(OUTDIR)/protocolONVIF.o \ + $(OUTDIR)/protocolPTZ.o $(OUTDIR)/protocolPTZ_ONVIF.o \ + $(OUTDIR)/protocolPTZ_PELCO.o $(OUTDIR)/protocolPTZ_VISCA.o \ + $(OUTDIR)/serverPort.o $(OUTDIR)/sqlite_class.o \ + $(OUTDIR)/SQLite_dataBinder.o $(OUTDIR)/Transform.o \ + $(OUTDIR)/transportSerial.o $(OUTDIR)/transportSocket.o \ + $(OUTDIR)/utm.o $(OUTDIR)/videoAVLIBSource.o \ + $(OUTDIR)/videoLive555AVLibSource.o $(OUTDIR)/xmlParser.o COMPILE=g++ -c -x c++ "-DSLIM_KERNEL" "-D_THREAD_SAFE" "-D_BSD_SOURCE" "-D_REENTRANT" -O3 -w -Wpointer-arith -std=gnu++11 -I../../lib/include -o "$(OUTDIR)/$(*F).o" $(CFG_INC) $< -LINK=g++ -O3 -w -lconfig -lpthread -lmysqlclient -lelf -lcurses -lcdk -lcurl `pkg-config --libs rdkafka++` -lwiringx -lsqlite3 -s -o "$(OUTFILE)" $(ALL_OBJ) +LINK=g++ -O3 -w -lconfig -lpthread -lmysqlclient -lelf -lcurses -lcdk -lcurl `pkg-config --libs rdkafka++` -L/usr/lib -lrdkafka++ -lrdkafka -lwiringx -lsqlite3 -s -o "$(OUTFILE)" $(ALL_OBJ) # Pattern rules $(OUTDIR)/%.o : ../../lib/components/object/%.cpp @@ -445,20 +450,21 @@ COMMON_OBJ=$(OUTDIR)/base64.o $(OUTDIR)/basicCameraInfo.o \ $(OUTDIR)/kernelModuleUSBRelay.o $(OUTDIR)/kernelPrototype.o \ $(OUTDIR)/libzip.o $(OUTDIR)/mask.o $(OUTDIR)/md5.o \ $(OUTDIR)/mojoBackend.o $(OUTDIR)/mojoKernel.o \ - $(OUTDIR)/mysql_class.o $(OUTDIR)/MySQL_dataBinder.o \ - $(OUTDIR)/netClientHandler.o $(OUTDIR)/netServer.o \ - $(OUTDIR)/objectFileLoggingService.o $(OUTDIR)/objectSystemAnchor.o \ - $(OUTDIR)/ponvif.o $(OUTDIR)/protocol.o $(OUTDIR)/protocolHTTP.o \ - $(OUTDIR)/protocolKAFKA.o $(OUTDIR)/protocolLGS2D.o \ - $(OUTDIR)/protocolLGS3D.o $(OUTDIR)/protocolLGS3D_client.o \ - $(OUTDIR)/protocolONVIF.o $(OUTDIR)/protocolPTZ.o \ - $(OUTDIR)/protocolPTZ_ONVIF.o $(OUTDIR)/protocolPTZ_PELCO.o \ - $(OUTDIR)/protocolPTZ_VISCA.o $(OUTDIR)/serverPort.o \ - $(OUTDIR)/sqlite_class.o $(OUTDIR)/SQLite_dataBinder.o \ - $(OUTDIR)/Transform.o $(OUTDIR)/transportSerial.o \ - $(OUTDIR)/transportSocket.o $(OUTDIR)/utm.o \ - $(OUTDIR)/videoAVLIBSource.o $(OUTDIR)/videoLive555AVLibSource.o \ - $(OUTDIR)/xmlParser.o + $(OUTDIR)/mojoRemoteClient.o $(OUTDIR)/mysql_class.o \ + $(OUTDIR)/MySQL_dataBinder.o $(OUTDIR)/netClientHandler.o \ + $(OUTDIR)/netServer.o $(OUTDIR)/objectFileLoggingService.o \ + $(OUTDIR)/objectSystemAnchor.o $(OUTDIR)/ponvif.o \ + $(OUTDIR)/protocol.o $(OUTDIR)/protocolARGUS.o \ + $(OUTDIR)/protocolHTTP.o $(OUTDIR)/protocolKAFKA.o \ + $(OUTDIR)/protocolLGS2D.o $(OUTDIR)/protocolLGS3D.o \ + $(OUTDIR)/protocolLGS3D_client.o $(OUTDIR)/protocolONVIF.o \ + $(OUTDIR)/protocolPTZ.o $(OUTDIR)/protocolPTZ_ONVIF.o \ + $(OUTDIR)/protocolPTZ_PELCO.o $(OUTDIR)/protocolPTZ_VISCA.o \ + $(OUTDIR)/serverPort.o $(OUTDIR)/sqlite_class.o \ + $(OUTDIR)/SQLite_dataBinder.o $(OUTDIR)/Transform.o \ + $(OUTDIR)/transportSerial.o $(OUTDIR)/transportSocket.o \ + $(OUTDIR)/utm.o $(OUTDIR)/videoAVLIBSource.o \ + $(OUTDIR)/videoLive555AVLibSource.o $(OUTDIR)/xmlParser.o OBJ=$(COMMON_OBJ) $(CFG_OBJ) ALL_OBJ=$(OUTDIR)/base64.o $(OUTDIR)/basicCameraInfo.o \ $(OUTDIR)/basicDualThread.o $(OUTDIR)/basicEngine.o \ @@ -495,24 +501,26 @@ ALL_OBJ=$(OUTDIR)/base64.o $(OUTDIR)/basicCameraInfo.o \ $(OUTDIR)/kernelModuleUSBRelay.o $(OUTDIR)/kernelPrototype.o \ $(OUTDIR)/libzip.o $(OUTDIR)/mask.o $(OUTDIR)/md5.o \ $(OUTDIR)/mojoBackend.o $(OUTDIR)/mojoKernel.o \ - $(OUTDIR)/mysql_class.o $(OUTDIR)/MySQL_dataBinder.o \ - $(OUTDIR)/netClientHandler.o $(OUTDIR)/netServer.o \ - $(OUTDIR)/objectFileLoggingService.o $(OUTDIR)/objectSystemAnchor.o \ - $(OUTDIR)/ponvif.o $(OUTDIR)/protocol.o $(OUTDIR)/protocolHTTP.o \ - $(OUTDIR)/protocolKAFKA.o $(OUTDIR)/protocolLGS2D.o \ - $(OUTDIR)/protocolLGS3D.o $(OUTDIR)/protocolLGS3D_client.o \ - $(OUTDIR)/protocolONVIF.o $(OUTDIR)/protocolPTZ.o \ - $(OUTDIR)/protocolPTZ_ONVIF.o $(OUTDIR)/protocolPTZ_PELCO.o \ - $(OUTDIR)/protocolPTZ_VISCA.o $(OUTDIR)/serverPort.o \ - $(OUTDIR)/sqlite_class.o $(OUTDIR)/SQLite_dataBinder.o \ - $(OUTDIR)/Transform.o $(OUTDIR)/transportSerial.o \ - $(OUTDIR)/transportSocket.o $(OUTDIR)/utm.o \ - $(OUTDIR)/videoAVLIBSource.o $(OUTDIR)/videoLive555AVLibSource.o \ - $(OUTDIR)/xmlParser.o -lsqlite3 -lpthread -lmysqlclient -lssl -lcurl \ - -lm -lcrypto -lconfig -lz -lv4l1 -lv4l2 -lhidapi-libusb `pkg-config \ - libavcodec libavdevice libavfilter libavformat libavutil libpostproc \ - libswresample libswscale --libs` -latomic `pkg-config --libs openssl \ - opencv4 rdkafka++` -lliveMedia -lgroupsock -lBasicUsageEnvironment \ + $(OUTDIR)/mojoRemoteClient.o $(OUTDIR)/mysql_class.o \ + $(OUTDIR)/MySQL_dataBinder.o $(OUTDIR)/netClientHandler.o \ + $(OUTDIR)/netServer.o $(OUTDIR)/objectFileLoggingService.o \ + $(OUTDIR)/objectSystemAnchor.o $(OUTDIR)/ponvif.o \ + $(OUTDIR)/protocol.o $(OUTDIR)/protocolARGUS.o \ + $(OUTDIR)/protocolHTTP.o $(OUTDIR)/protocolKAFKA.o \ + $(OUTDIR)/protocolLGS2D.o $(OUTDIR)/protocolLGS3D.o \ + $(OUTDIR)/protocolLGS3D_client.o $(OUTDIR)/protocolONVIF.o \ + $(OUTDIR)/protocolPTZ.o $(OUTDIR)/protocolPTZ_ONVIF.o \ + $(OUTDIR)/protocolPTZ_PELCO.o $(OUTDIR)/protocolPTZ_VISCA.o \ + $(OUTDIR)/serverPort.o $(OUTDIR)/sqlite_class.o \ + $(OUTDIR)/SQLite_dataBinder.o $(OUTDIR)/Transform.o \ + $(OUTDIR)/transportSerial.o $(OUTDIR)/transportSocket.o \ + $(OUTDIR)/utm.o $(OUTDIR)/videoAVLIBSource.o \ + $(OUTDIR)/videoLive555AVLibSource.o $(OUTDIR)/xmlParser.o -lsqlite3 \ + -lpthread -lmysqlclient -lssl -lcurl -lm -lcrypto -lconfig -lz \ + -lv4l1 -lv4l2 -lhidapi-libusb `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" "-DMEKOROT_PROJECT" "-D__STDC_CONSTANT_MACROS" "-D_CLIENT_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) $< @@ -641,20 +649,21 @@ COMMON_OBJ=$(OUTDIR)/base64.o $(OUTDIR)/basicCameraInfo.o \ $(OUTDIR)/kernelModuleUSBRelay.o $(OUTDIR)/kernelPrototype.o \ $(OUTDIR)/libzip.o $(OUTDIR)/mask.o $(OUTDIR)/md5.o \ $(OUTDIR)/mojoBackend.o $(OUTDIR)/mojoKernel.o \ - $(OUTDIR)/mysql_class.o $(OUTDIR)/MySQL_dataBinder.o \ - $(OUTDIR)/netClientHandler.o $(OUTDIR)/netServer.o \ - $(OUTDIR)/objectFileLoggingService.o $(OUTDIR)/objectSystemAnchor.o \ - $(OUTDIR)/ponvif.o $(OUTDIR)/protocol.o $(OUTDIR)/protocolHTTP.o \ - $(OUTDIR)/protocolKAFKA.o $(OUTDIR)/protocolLGS2D.o \ - $(OUTDIR)/protocolLGS3D.o $(OUTDIR)/protocolLGS3D_client.o \ - $(OUTDIR)/protocolONVIF.o $(OUTDIR)/protocolPTZ.o \ - $(OUTDIR)/protocolPTZ_ONVIF.o $(OUTDIR)/protocolPTZ_PELCO.o \ - $(OUTDIR)/protocolPTZ_VISCA.o $(OUTDIR)/serverPort.o \ - $(OUTDIR)/sqlite_class.o $(OUTDIR)/SQLite_dataBinder.o \ - $(OUTDIR)/Transform.o $(OUTDIR)/transportSerial.o \ - $(OUTDIR)/transportSocket.o $(OUTDIR)/utm.o \ - $(OUTDIR)/videoAVLIBSource.o $(OUTDIR)/videoLive555AVLibSource.o \ - $(OUTDIR)/xmlParser.o + $(OUTDIR)/mojoRemoteClient.o $(OUTDIR)/mysql_class.o \ + $(OUTDIR)/MySQL_dataBinder.o $(OUTDIR)/netClientHandler.o \ + $(OUTDIR)/netServer.o $(OUTDIR)/objectFileLoggingService.o \ + $(OUTDIR)/objectSystemAnchor.o $(OUTDIR)/ponvif.o \ + $(OUTDIR)/protocol.o $(OUTDIR)/protocolARGUS.o \ + $(OUTDIR)/protocolHTTP.o $(OUTDIR)/protocolKAFKA.o \ + $(OUTDIR)/protocolLGS2D.o $(OUTDIR)/protocolLGS3D.o \ + $(OUTDIR)/protocolLGS3D_client.o $(OUTDIR)/protocolONVIF.o \ + $(OUTDIR)/protocolPTZ.o $(OUTDIR)/protocolPTZ_ONVIF.o \ + $(OUTDIR)/protocolPTZ_PELCO.o $(OUTDIR)/protocolPTZ_VISCA.o \ + $(OUTDIR)/serverPort.o $(OUTDIR)/sqlite_class.o \ + $(OUTDIR)/SQLite_dataBinder.o $(OUTDIR)/Transform.o \ + $(OUTDIR)/transportSerial.o $(OUTDIR)/transportSocket.o \ + $(OUTDIR)/utm.o $(OUTDIR)/videoAVLIBSource.o \ + $(OUTDIR)/videoLive555AVLibSource.o $(OUTDIR)/xmlParser.o OBJ=$(COMMON_OBJ) $(CFG_OBJ) ALL_OBJ=$(OUTDIR)/base64.o $(OUTDIR)/basicCameraInfo.o \ $(OUTDIR)/basicDualThread.o $(OUTDIR)/basicEngine.o \ @@ -691,24 +700,26 @@ ALL_OBJ=$(OUTDIR)/base64.o $(OUTDIR)/basicCameraInfo.o \ $(OUTDIR)/kernelModuleUSBRelay.o $(OUTDIR)/kernelPrototype.o \ $(OUTDIR)/libzip.o $(OUTDIR)/mask.o $(OUTDIR)/md5.o \ $(OUTDIR)/mojoBackend.o $(OUTDIR)/mojoKernel.o \ - $(OUTDIR)/mysql_class.o $(OUTDIR)/MySQL_dataBinder.o \ - $(OUTDIR)/netClientHandler.o $(OUTDIR)/netServer.o \ - $(OUTDIR)/objectFileLoggingService.o $(OUTDIR)/objectSystemAnchor.o \ - $(OUTDIR)/ponvif.o $(OUTDIR)/protocol.o $(OUTDIR)/protocolHTTP.o \ - $(OUTDIR)/protocolKAFKA.o $(OUTDIR)/protocolLGS2D.o \ - $(OUTDIR)/protocolLGS3D.o $(OUTDIR)/protocolLGS3D_client.o \ - $(OUTDIR)/protocolONVIF.o $(OUTDIR)/protocolPTZ.o \ - $(OUTDIR)/protocolPTZ_ONVIF.o $(OUTDIR)/protocolPTZ_PELCO.o \ - $(OUTDIR)/protocolPTZ_VISCA.o $(OUTDIR)/serverPort.o \ - $(OUTDIR)/sqlite_class.o $(OUTDIR)/SQLite_dataBinder.o \ - $(OUTDIR)/Transform.o $(OUTDIR)/transportSerial.o \ - $(OUTDIR)/transportSocket.o $(OUTDIR)/utm.o \ - $(OUTDIR)/videoAVLIBSource.o $(OUTDIR)/videoLive555AVLibSource.o \ - $(OUTDIR)/xmlParser.o -lsqlite3 -lpthread -lmysqlclient -lssl -lcurl \ - -lm -lcrypto -lconfig -lz -lv4l1 -lv4l2 -lhidapi-libusb `pkg-config \ - libavcodec libavdevice libavfilter libavformat libavutil libpostproc \ - libswresample libswscale --libs` -latomic `pkg-config --libs openssl \ - opencv4 rdkafka++` -lliveMedia -lgroupsock -lBasicUsageEnvironment \ + $(OUTDIR)/mojoRemoteClient.o $(OUTDIR)/mysql_class.o \ + $(OUTDIR)/MySQL_dataBinder.o $(OUTDIR)/netClientHandler.o \ + $(OUTDIR)/netServer.o $(OUTDIR)/objectFileLoggingService.o \ + $(OUTDIR)/objectSystemAnchor.o $(OUTDIR)/ponvif.o \ + $(OUTDIR)/protocol.o $(OUTDIR)/protocolARGUS.o \ + $(OUTDIR)/protocolHTTP.o $(OUTDIR)/protocolKAFKA.o \ + $(OUTDIR)/protocolLGS2D.o $(OUTDIR)/protocolLGS3D.o \ + $(OUTDIR)/protocolLGS3D_client.o $(OUTDIR)/protocolONVIF.o \ + $(OUTDIR)/protocolPTZ.o $(OUTDIR)/protocolPTZ_ONVIF.o \ + $(OUTDIR)/protocolPTZ_PELCO.o $(OUTDIR)/protocolPTZ_VISCA.o \ + $(OUTDIR)/serverPort.o $(OUTDIR)/sqlite_class.o \ + $(OUTDIR)/SQLite_dataBinder.o $(OUTDIR)/Transform.o \ + $(OUTDIR)/transportSerial.o $(OUTDIR)/transportSocket.o \ + $(OUTDIR)/utm.o $(OUTDIR)/videoAVLIBSource.o \ + $(OUTDIR)/videoLive555AVLibSource.o $(OUTDIR)/xmlParser.o -lsqlite3 \ + -lpthread -lmysqlclient -lssl -lcurl -lm -lcrypto -lconfig -lz \ + -lv4l1 -lv4l2 -lhidapi-libusb `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++ "-D__STDC_CONSTANT_MACROS" "-D_CLIENT_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) $< @@ -820,10 +831,10 @@ $(OUTDIR)/detector.o: ../../lib/alg/lgs/detector.cpp ../../lib/alg/lgs/detector. $(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 -$(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 +$(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 $(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/deviceNodeStaticCamControl.h ../../lib/App/common/deviceNodeEthernet2Serial.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 +$(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 $(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 @@ -852,12 +863,13 @@ $(OUTDIR)/kernelModuleOnvifObserver.o: ../../lib/App/common/kernelModuleOnvifObs $(OUTDIR)/kernelModuleReportBackupper.o: ../../lib/App/common/kernelModuleReportBackupper.cpp ../../lib/App/common/kernelModuleReportBackupper.h ../../lib/components/base/basicFunctionality.h ../../lib/components/base/basicBuildTimeStamp.h ../../lib/components/base/basicTypes.h $(OUTDIR)/kernelModuleSSDP.o: ../../lib/App/common/kernelModuleSSDP.cpp ../../lib/App/common/kernelModuleSSDP.h $(OUTDIR)/kernelModuleUSBRelay.o: ../../lib/App/common/kernelModuleUSBRelay.cpp ../../lib/App/common/kernelModuleUSBRelay.h -$(OUTDIR)/kernelPrototype.o: ../../lib/App/common/kernelPrototype.cpp ../../lib/App/common/kernelPrototype.h ../../lib/App/common/MySQL_dataBinder.h ../../lib/App/common/SQLite_dataBinder.h +$(OUTDIR)/kernelPrototype.o: ../../lib/App/common/kernelPrototype.cpp ../../lib/App/common/kernelPrototype.h $(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/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/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)/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/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/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 $(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 @@ -866,6 +878,7 @@ $(OUTDIR)/objectFileLoggingService.o: ../../lib/components/object/objectFileLogg $(OUTDIR)/objectSystemAnchor.o: ../../lib/components/object/objectSystemAnchor.cpp ../../lib/components/object/objectSystemAnchor.h ../../lib/components/base/basicLogCollection.h ../../lib/components/base/basicLoggingService.h ../../lib/components/base/basicRing.h ../../lib/components/base/basicMutex.h $(OUTDIR)/ponvif.o: ../../lib/data/ponvif/ponvif.cpp ../../lib/data/ponvif/ponvif.h $(OUTDIR)/protocol.o: ../../lib/data/protocol/protocol.cpp ../../lib/data/protocol/protocol.h +$(OUTDIR)/protocolARGUS.o: ../../lib/data/protocol/protocolARGUS.cpp ../../lib/data/protocol/protocolARGUS.h $(OUTDIR)/protocolHTTP.o: ../../lib/data/protocol/protocolHTTP.cpp ../../lib/data/protocol/protocolHTTP.h $(OUTDIR)/protocolKAFKA.o: ../../lib/data/protocol/protocolKAFKA.cpp ../../lib/data/protocol/protocolKAFKA.h ../../lib/alg/generic/md5.h ../../lib/data/json/json_tool.h $(OUTDIR)/protocolLGS2D.o: ../../lib/data/protocol/protocolLGS2D.cpp ../../lib/data/protocol/protocolLGS2D.h diff --git a/Projects/la_serva/build b/Projects/la_serva/build new file mode 100755 index 00000000..59699e61 --- /dev/null +++ b/Projects/la_serva/build @@ -0,0 +1,14 @@ +#! /bin/sh + + +#make clean -e "CFG=Debug" +#make -e "CFG=Debug" -j6 + +make clean -e "CFG=Debug86" +make -e "CFG=Debug86" -j4 + +#make clean -e "CFG=Release86" +#make -e "CFG=Release86" -j4 +#cd Release86 +#strip ./mojo +#cd .. diff --git a/Projects/la_serva/la_serva.vpj b/Projects/la_serva/la_serva.vpj new file mode 100644 index 00000000..1134d824 --- /dev/null +++ b/Projects/la_serva/la_serva.vpj @@ -0,0 +1,569 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Projects/la_serva/makefile b/Projects/la_serva/makefile new file mode 100644 index 00000000..6d1788fb --- /dev/null +++ b/Projects/la_serva/makefile @@ -0,0 +1,430 @@ +# SlickEdit generated file. Do not edit this file except in designated areas. + +# Make command to use for dependencies +MAKE=make +RM=rm +MKDIR=mkdir + +# -----Begin user-editable area----- + +# -----End user-editable area----- + +# If no configuration is specified, "Debug" will be used +ifndef CFG +CFG=Debug +endif + +# +# Configuration: Debug +# +ifeq "$(CFG)" "Debug" +OUTDIR=Debug +OUTFILE=$(OUTDIR)/serva_d +CFG_INC= +CFG_LIB=-lsqlite3 -lpthread -lmysqlclient -lssl -lcurl -lm -lcrypto \ + -lconfig -lz -lv4l1 -lv4l2 -lhidapi-libusb `pkg-config libavcodec \ + libavdevice libavfilter libavformat libavutil libpostproc \ + libswresample libswscale --libs` -latomic `pkg-config --libs openssl \ + opencv4 rdkafka++` -lwiringx -lliveMedia -lgroupsock \ + -lBasicUsageEnvironment -lUsageEnvironment +CFG_OBJ= +COMMON_OBJ=$(OUTDIR)/basicEngine.o $(OUTDIR)/basicEvent.o \ + $(OUTDIR)/basicEventHandler.o $(OUTDIR)/basicEventHeap.o \ + $(OUTDIR)/basicFunctionality.o $(OUTDIR)/basicLogCollection.o \ + $(OUTDIR)/basicLoggingService.o $(OUTDIR)/basicMutex.o \ + $(OUTDIR)/basicObject.o $(OUTDIR)/basicRing.o \ + $(OUTDIR)/basicSettings.o $(OUTDIR)/basicSettingsProvider.o \ + $(OUTDIR)/basicThread.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)/objectFileLoggingService.o \ + $(OUTDIR)/objectMySQLLoggingService.o $(OUTDIR)/servaBackend.o \ + $(OUTDIR)/servaKernel.o $(OUTDIR)/servaKernelToolKit.o \ + $(OUTDIR)/serverDataBinder.o $(OUTDIR)/serverMySQL_dataBinder.o \ + $(OUTDIR)/Transform.o $(OUTDIR)/utm.o +OBJ=$(COMMON_OBJ) $(CFG_OBJ) +ALL_OBJ=$(OUTDIR)/basicEngine.o $(OUTDIR)/basicEvent.o \ + $(OUTDIR)/basicEventHandler.o $(OUTDIR)/basicEventHeap.o \ + $(OUTDIR)/basicFunctionality.o $(OUTDIR)/basicLogCollection.o \ + $(OUTDIR)/basicLoggingService.o $(OUTDIR)/basicMutex.o \ + $(OUTDIR)/basicObject.o $(OUTDIR)/basicRing.o \ + $(OUTDIR)/basicSettings.o $(OUTDIR)/basicSettingsProvider.o \ + $(OUTDIR)/basicThread.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)/objectFileLoggingService.o \ + $(OUTDIR)/objectMySQLLoggingService.o $(OUTDIR)/servaBackend.o \ + $(OUTDIR)/servaKernel.o $(OUTDIR)/servaKernelToolKit.o \ + $(OUTDIR)/serverDataBinder.o $(OUTDIR)/serverMySQL_dataBinder.o \ + $(OUTDIR)/Transform.o $(OUTDIR)/utm.o -lsqlite3 -lpthread \ + -lmysqlclient -lssl -lcurl -lm -lcrypto -lconfig -lz -lv4l1 -lv4l2 \ + -lhidapi-libusb `pkg-config libavcodec libavdevice libavfilter \ + libavformat libavutil libpostproc libswresample libswscale --libs` \ + -latomic `pkg-config --libs openssl opencv4 rdkafka++` -lwiringx \ + -lliveMedia -lgroupsock -lBasicUsageEnvironment -lUsageEnvironment + +COMPILE=g++ -c -x c++ "-DDEBUG" "-DUSE_MYSQL" "-D__STDC_CONSTANT_MACROS__" "-D_CLIENT_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) + +# Pattern rules +$(OUTDIR)/%.o : ../../lib/components/object/%.cpp + $(COMPILE) + +$(OUTDIR)/%.o : ../../lib/App/serva/%.cpp + $(COMPILE) + +$(OUTDIR)/%.o : ../../lib/data/json/%.cpp + $(COMPILE) + +$(OUTDIR)/%.o : ../../lib/App/common/%.cpp + $(COMPILE) + +$(OUTDIR)/%.o : ../../lib/data/mysql/%.cpp + $(COMPILE) + +$(OUTDIR)/%.o : ../../lib/components/base/%.cpp + $(COMPILE) + +$(OUTDIR)/%.o : ../../lib/alg/generic/%.cpp + $(COMPILE) + +# Build rules +all: $(OUTFILE) + +$(OUTFILE): $(OUTDIR) $(OBJ) + $(LINK) + +$(OUTDIR): + $(MKDIR) -p "$(OUTDIR)" + +# Rebuild this project +rebuild: cleanall + @$(MAKE) -f "$(strip $(MAKEFILE_LIST))" $(MAKEFLAGS) all + +# Clean this project +clean: + $(RM) -f $(OUTFILE) + $(RM) -f $(OBJ) + +# Clean this project and all dependencies +cleanall: clean +endif + +# +# Configuration: Release +# +ifeq "$(CFG)" "Release" +OUTDIR=Release +OUTFILE=$(OUTDIR)/serva +CFG_INC= +CFG_LIB= +CFG_OBJ= +COMMON_OBJ=$(OUTDIR)/basicEngine.o $(OUTDIR)/basicEvent.o \ + $(OUTDIR)/basicEventHandler.o $(OUTDIR)/basicEventHeap.o \ + $(OUTDIR)/basicFunctionality.o $(OUTDIR)/basicLogCollection.o \ + $(OUTDIR)/basicLoggingService.o $(OUTDIR)/basicMutex.o \ + $(OUTDIR)/basicObject.o $(OUTDIR)/basicRing.o \ + $(OUTDIR)/basicSettings.o $(OUTDIR)/basicSettingsProvider.o \ + $(OUTDIR)/basicThread.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)/objectFileLoggingService.o \ + $(OUTDIR)/objectMySQLLoggingService.o $(OUTDIR)/servaBackend.o \ + $(OUTDIR)/servaKernel.o $(OUTDIR)/servaKernelToolKit.o \ + $(OUTDIR)/serverDataBinder.o $(OUTDIR)/serverMySQL_dataBinder.o \ + $(OUTDIR)/Transform.o $(OUTDIR)/utm.o +OBJ=$(COMMON_OBJ) $(CFG_OBJ) +ALL_OBJ=$(OUTDIR)/basicEngine.o $(OUTDIR)/basicEvent.o \ + $(OUTDIR)/basicEventHandler.o $(OUTDIR)/basicEventHeap.o \ + $(OUTDIR)/basicFunctionality.o $(OUTDIR)/basicLogCollection.o \ + $(OUTDIR)/basicLoggingService.o $(OUTDIR)/basicMutex.o \ + $(OUTDIR)/basicObject.o $(OUTDIR)/basicRing.o \ + $(OUTDIR)/basicSettings.o $(OUTDIR)/basicSettingsProvider.o \ + $(OUTDIR)/basicThread.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)/objectFileLoggingService.o \ + $(OUTDIR)/objectMySQLLoggingService.o $(OUTDIR)/servaBackend.o \ + $(OUTDIR)/servaKernel.o $(OUTDIR)/servaKernelToolKit.o \ + $(OUTDIR)/serverDataBinder.o $(OUTDIR)/serverMySQL_dataBinder.o \ + $(OUTDIR)/Transform.o $(OUTDIR)/utm.o + +COMPILE=g++ -c -x c++ "-DUSE_MYSQL" "-DSLIM_KERNEL" "-D_THREAD_SAFE" "-D_BSD_SOURCE" "-D_REENTRANT" -O3 -w -Wpointer-arith -std=gnu++11 -I../../lib/include -o "$(OUTDIR)/$(*F).o" $(CFG_INC) $< +LINK=g++ -O3 -w -lconfig -lpthread -lmysqlclient -lelf -lcurses -lcdk -lcurl `pkg-config --libs rdkafka++` -lwiringx -lsqlite3 -s -o "$(OUTFILE)" $(ALL_OBJ) + +# Pattern rules +$(OUTDIR)/%.o : ../../lib/components/object/%.cpp + $(COMPILE) + +$(OUTDIR)/%.o : ../../lib/App/serva/%.cpp + $(COMPILE) + +$(OUTDIR)/%.o : ../../lib/data/json/%.cpp + $(COMPILE) + +$(OUTDIR)/%.o : ../../lib/App/common/%.cpp + $(COMPILE) + +$(OUTDIR)/%.o : ../../lib/data/mysql/%.cpp + $(COMPILE) + +$(OUTDIR)/%.o : ../../lib/components/base/%.cpp + $(COMPILE) + +$(OUTDIR)/%.o : ../../lib/alg/generic/%.cpp + $(COMPILE) + +# Build rules +all: $(OUTFILE) + +$(OUTFILE): $(OUTDIR) $(OBJ) + $(LINK) + +$(OUTDIR): + $(MKDIR) -p "$(OUTDIR)" + +# Rebuild this project +rebuild: cleanall + @$(MAKE) -f "$(strip $(MAKEFILE_LIST))" $(MAKEFLAGS) all + +# Clean this project +clean: + $(RM) -f $(OUTFILE) + $(RM) -f $(OBJ) + +# Clean this project and all dependencies +cleanall: clean +endif + +# +# Configuration: Debug86 +# +ifeq "$(CFG)" "Debug86" +OUTDIR=Debug86 +OUTFILE=$(OUTDIR)/serva_d +CFG_INC= +CFG_LIB=-lsqlite3 -lpthread -lmysqlclient -lssl -lcurl -lm -lcrypto \ + -lconfig -lz -lv4l1 -lv4l2 -lhidapi-libusb `pkg-config libavcodec \ + libavdevice libavfilter libavformat libavutil libpostproc \ + libswresample libswscale --libs` -latomic `pkg-config --libs openssl \ + opencv4 rdkafka++` -lliveMedia -lgroupsock -lBasicUsageEnvironment \ + -lUsageEnvironment +CFG_OBJ= +COMMON_OBJ=$(OUTDIR)/basicEngine.o $(OUTDIR)/basicEvent.o \ + $(OUTDIR)/basicEventHandler.o $(OUTDIR)/basicEventHeap.o \ + $(OUTDIR)/basicFunctionality.o $(OUTDIR)/basicLogCollection.o \ + $(OUTDIR)/basicLoggingService.o $(OUTDIR)/basicMutex.o \ + $(OUTDIR)/basicObject.o $(OUTDIR)/basicRing.o \ + $(OUTDIR)/basicSettings.o $(OUTDIR)/basicSettingsProvider.o \ + $(OUTDIR)/basicThread.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)/objectFileLoggingService.o \ + $(OUTDIR)/objectMySQLLoggingService.o $(OUTDIR)/servaBackend.o \ + $(OUTDIR)/servaKernel.o $(OUTDIR)/servaKernelToolKit.o \ + $(OUTDIR)/serverDataBinder.o $(OUTDIR)/serverMySQL_dataBinder.o \ + $(OUTDIR)/Transform.o $(OUTDIR)/utm.o +OBJ=$(COMMON_OBJ) $(CFG_OBJ) +ALL_OBJ=$(OUTDIR)/basicEngine.o $(OUTDIR)/basicEvent.o \ + $(OUTDIR)/basicEventHandler.o $(OUTDIR)/basicEventHeap.o \ + $(OUTDIR)/basicFunctionality.o $(OUTDIR)/basicLogCollection.o \ + $(OUTDIR)/basicLoggingService.o $(OUTDIR)/basicMutex.o \ + $(OUTDIR)/basicObject.o $(OUTDIR)/basicRing.o \ + $(OUTDIR)/basicSettings.o $(OUTDIR)/basicSettingsProvider.o \ + $(OUTDIR)/basicThread.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)/objectFileLoggingService.o \ + $(OUTDIR)/objectMySQLLoggingService.o $(OUTDIR)/servaBackend.o \ + $(OUTDIR)/servaKernel.o $(OUTDIR)/servaKernelToolKit.o \ + $(OUTDIR)/serverDataBinder.o $(OUTDIR)/serverMySQL_dataBinder.o \ + $(OUTDIR)/Transform.o $(OUTDIR)/utm.o -lsqlite3 -lpthread \ + -lmysqlclient -lssl -lcurl -lm -lcrypto -lconfig -lz -lv4l1 -lv4l2 \ + -lhidapi-libusb `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_CLIENT_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) + +# Pattern rules +$(OUTDIR)/%.o : ../../lib/components/object/%.cpp + $(COMPILE) + +$(OUTDIR)/%.o : ../../lib/App/serva/%.cpp + $(COMPILE) + +$(OUTDIR)/%.o : ../../lib/data/json/%.cpp + $(COMPILE) + +$(OUTDIR)/%.o : ../../lib/App/common/%.cpp + $(COMPILE) + +$(OUTDIR)/%.o : ../../lib/data/mysql/%.cpp + $(COMPILE) + +$(OUTDIR)/%.o : ../../lib/components/base/%.cpp + $(COMPILE) + +$(OUTDIR)/%.o : ../../lib/alg/generic/%.cpp + $(COMPILE) + +# Build rules +all: $(OUTFILE) + +$(OUTFILE): $(OUTDIR) $(OBJ) + $(LINK) + +$(OUTDIR): + $(MKDIR) -p "$(OUTDIR)" + +# Rebuild this project +rebuild: cleanall + @$(MAKE) -f "$(strip $(MAKEFILE_LIST))" $(MAKEFLAGS) all + +# Clean this project +clean: + $(RM) -f $(OUTFILE) + $(RM) -f $(OBJ) + +# Clean this project and all dependencies +cleanall: clean +endif + +# +# Configuration: Release86 +# +ifeq "$(CFG)" "Release86" +OUTDIR=Release86 +OUTFILE=$(OUTDIR)/serva +CFG_INC= +CFG_LIB=-lsqlite3 -lpthread -lmysqlclient -lssl -lcurl -lm -lcrypto \ + -lconfig -lz -lv4l1 -lv4l2 -lhidapi-libusb `pkg-config libavcodec \ + libavdevice libavfilter libavformat libavutil libpostproc \ + libswresample libswscale --libs` -latomic `pkg-config --libs openssl \ + opencv4 rdkafka++` -lliveMedia -lgroupsock -lBasicUsageEnvironment \ + -lUsageEnvironment +CFG_OBJ= +COMMON_OBJ=$(OUTDIR)/basicEngine.o $(OUTDIR)/basicEvent.o \ + $(OUTDIR)/basicEventHandler.o $(OUTDIR)/basicEventHeap.o \ + $(OUTDIR)/basicFunctionality.o $(OUTDIR)/basicLogCollection.o \ + $(OUTDIR)/basicLoggingService.o $(OUTDIR)/basicMutex.o \ + $(OUTDIR)/basicObject.o $(OUTDIR)/basicRing.o \ + $(OUTDIR)/basicSettings.o $(OUTDIR)/basicSettingsProvider.o \ + $(OUTDIR)/basicThread.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)/objectFileLoggingService.o \ + $(OUTDIR)/objectMySQLLoggingService.o $(OUTDIR)/servaBackend.o \ + $(OUTDIR)/servaKernel.o $(OUTDIR)/servaKernelToolKit.o \ + $(OUTDIR)/serverDataBinder.o $(OUTDIR)/serverMySQL_dataBinder.o \ + $(OUTDIR)/Transform.o $(OUTDIR)/utm.o +OBJ=$(COMMON_OBJ) $(CFG_OBJ) +ALL_OBJ=$(OUTDIR)/basicEngine.o $(OUTDIR)/basicEvent.o \ + $(OUTDIR)/basicEventHandler.o $(OUTDIR)/basicEventHeap.o \ + $(OUTDIR)/basicFunctionality.o $(OUTDIR)/basicLogCollection.o \ + $(OUTDIR)/basicLoggingService.o $(OUTDIR)/basicMutex.o \ + $(OUTDIR)/basicObject.o $(OUTDIR)/basicRing.o \ + $(OUTDIR)/basicSettings.o $(OUTDIR)/basicSettingsProvider.o \ + $(OUTDIR)/basicThread.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)/objectFileLoggingService.o \ + $(OUTDIR)/objectMySQLLoggingService.o $(OUTDIR)/servaBackend.o \ + $(OUTDIR)/servaKernel.o $(OUTDIR)/servaKernelToolKit.o \ + $(OUTDIR)/serverDataBinder.o $(OUTDIR)/serverMySQL_dataBinder.o \ + $(OUTDIR)/Transform.o $(OUTDIR)/utm.o -lsqlite3 -lpthread \ + -lmysqlclient -lssl -lcurl -lm -lcrypto -lconfig -lz -lv4l1 -lv4l2 \ + -lhidapi-libusb `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++ "-DUSE_SERVER_MYSQL" "-D__STDC_CONSTANT_MACROS" "-D_CLIENT_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) + +# Pattern rules +$(OUTDIR)/%.o : ../../lib/components/object/%.cpp + $(COMPILE) + +$(OUTDIR)/%.o : ../../lib/App/serva/%.cpp + $(COMPILE) + +$(OUTDIR)/%.o : ../../lib/data/json/%.cpp + $(COMPILE) + +$(OUTDIR)/%.o : ../../lib/App/common/%.cpp + $(COMPILE) + +$(OUTDIR)/%.o : ../../lib/data/mysql/%.cpp + $(COMPILE) + +$(OUTDIR)/%.o : ../../lib/components/base/%.cpp + $(COMPILE) + +$(OUTDIR)/%.o : ../../lib/alg/generic/%.cpp + $(COMPILE) + +# Build rules +all: $(OUTFILE) + +$(OUTFILE): $(OUTDIR) $(OBJ) + $(LINK) + +$(OUTDIR): + $(MKDIR) -p "$(OUTDIR)" + +# Rebuild this project +rebuild: cleanall + @$(MAKE) -f "$(strip $(MAKEFILE_LIST))" $(MAKEFLAGS) all + +# Clean this project +clean: + $(RM) -f $(OUTFILE) + $(RM) -f $(OBJ) + +# Clean this project and all dependencies +cleanall: clean +endif + +# +# include dependencies: +# +$(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)/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 +$(OUTDIR)/basicLogCollection.o: ../../lib/components/base/basicLogCollection.cpp ../../lib/components/base/basicLogCollection.h ../../lib/alg/generic/heapDebug.h +$(OUTDIR)/basicLoggingService.o: ../../lib/components/base/basicLoggingService.cpp ../../lib/components/base/basicLoggingService.h +$(OUTDIR)/basicMutex.o: ../../lib/components/base/basicMutex.cpp ../../lib/components/base/basicMutex.h +$(OUTDIR)/basicObject.o: ../../lib/components/base/basicObject.cpp ../../lib/components/base/basicObject.h ../../lib/alg/generic/md5.h +$(OUTDIR)/basicRing.o: ../../lib/components/base/basicRing.cpp ../../lib/components/base/basicRing.h +$(OUTDIR)/basicSettings.o: ../../lib/components/base/basicSettings.cpp ../../lib/components/base/basicSettings.h +$(OUTDIR)/basicSettingsProvider.o: ../../lib/components/base/basicSettingsProvider.cpp ../../lib/components/base/basicSettingsProvider.h +$(OUTDIR)/basicThread.o: ../../lib/components/base/basicThread.cpp ../../lib/components/base/basicThread.h +$(OUTDIR)/json_reader.o: ../../lib/data/json/json_reader.cpp ../../lib/data/json/json_tool.h +$(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 ../../lib/App/common/MySQL_dataBinder.h ../../lib/App/common/SQLite_dataBinder.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)/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)/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/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 +$(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/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 +$(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)/Transform.o: ../../lib/alg/generic/Transform.cpp ../../lib/alg/generic/Transform.h ../../lib/components/base/basicLogCollection.h +$(OUTDIR)/utm.o: ../../lib/alg/generic/utm.cpp ../../lib/alg/generic/utm.h diff --git a/Projects/starProcDaemon/kernel.cpp b/Projects/starProcDaemon/kernel.cpp index d963a344..34fa3d7d 100644 --- a/Projects/starProcDaemon/kernel.cpp +++ b/Projects/starProcDaemon/kernel.cpp @@ -27,7 +27,7 @@ SP_KERNEL::~SP_KERNEL(){ #include #include -#include +//#include ->does not exists in Slackware #include #include @@ -291,7 +291,7 @@ void SP_KERNEL::m_fThreadProc( void ){ }; } else { LOG_ERROR("Can not read PID File!"); - m_bThreadStatus = TH_ENDED; + //m_bThreadStatus = TH_ENDED; }; }; break; diff --git a/Projects/starProcDaemon/starProcDaemon.cpp b/Projects/starProcDaemon/starProcDaemon.cpp index a8a6ab6c..a830deda 100644 --- a/Projects/starProcDaemon/starProcDaemon.cpp +++ b/Projects/starProcDaemon/starProcDaemon.cpp @@ -150,7 +150,18 @@ int main (int argc, char *argv[]){ #endif ; - + if( fileExist( gsCFG_PID_FILE ) ){ + FILE * fd = fopen( gsCFG_PID_FILE, "r" ); + if ( fd ) { + char Kaka[64]; + readLine( fd, Kaka, 64 ); + pid_t tPID = ( pid_t ) atol( Kaka ); + if ( kill( tPID, 0 ) == 0 ) { + printf("Can not Start!\nThe Process [%s] Already is Runing[PID:%lld]\n", argv[0], tPID ); + return 33; + }; + }; + }; // Reading Config if( argc > 1 ){ for( int i = 0; i < argc; i++ ){ diff --git a/Projects/watchDogDaemon/watchDogDaemon.cpp b/Projects/watchDogDaemon/watchDogDaemon.cpp index e2cd9bb0..455a1eaf 100644 --- a/Projects/watchDogDaemon/watchDogDaemon.cpp +++ b/Projects/watchDogDaemon/watchDogDaemon.cpp @@ -149,10 +149,20 @@ int main (int argc, char *argv[]){ | SW_INFO_DEBUG_MODE #endif ; - if( !isProcessUniq( argv[0] ) ){ - printf( "The Process [%s] Already is Runing\n", argv[0] ); - return 33; + + if( fileExist( gsCFG_PID_FILE ) ){ + FILE * fd = fopen( gsCFG_PID_FILE, "r" ); + if ( fd ) { + char Kaka[64]; + readLine( fd, Kaka, 64 ); + pid_t tPID = ( pid_t ) atol( Kaka ); + if ( kill( tPID, 0 ) == 0 ) { + printf("Can not Start!\nThe Process [%s] Already is Runing[PID:%lld]\n", argv[0], tPID ); + return 33; + }; + }; }; + // Reading Config if( argc > 1 ){ for( int i = 1; i < argc; i++ ){ diff --git a/lib/App/common/SQLite_dataBinder.cpp b/lib/App/common/SQLite_dataBinder.cpp index 17a3a04d..e3d3f5df 100644 --- a/lib/App/common/SQLite_dataBinder.cpp +++ b/lib/App/common/SQLite_dataBinder.cpp @@ -2719,6 +2719,22 @@ DBC_SITE_DATA *sqliteDBC::getSiteData( uint32_t ID ){ if( it != cArr->end() ){ tVal->preserve_empty = atoi(it->second.c_str()); }; + it = cArr->find("remote_ip"); + if( it != cArr->end() ){ + sprintf( tVal->remote_ip, it->second.c_str() ); + }; + it = cArr->find("remote_port"); + if( it != cArr->end() ){ + tVal->remote_port = atoi(it->second.c_str()); + }; + it = cArr->find("use_remote_server"); + if( it != cArr->end() ){ + tVal->use_remote_server = atoi(it->second.c_str()); + }; + it = cArr->find("skip_local_report"); + if( it != cArr->end() ){ + tVal->skip_local_report = atoi(it->second.c_str()); + }; }; }; }; diff --git a/lib/App/common/dataBinder_structures.h b/lib/App/common/dataBinder_structures.h index d3cc719e..fe0dcda7 100644 --- a/lib/App/common/dataBinder_structures.h +++ b/lib/App/common/dataBinder_structures.h @@ -75,15 +75,15 @@ typedef enum E_ARGUS_NODE_TYPE{ #ifdef __linux__ #if defined( __arm__ ) || defined( __aarch64__ ) || defined( RASPI_HARDWARE ) #if defined( __aarch64__ ) - #define _BUILD_STRING_ ( "ALS_22.06.17 [" __DATE__ " " __TIME__ "]") + #define _BUILD_STRING_ ( "ALS_24.08.17 [" __DATE__ " " __TIME__ "]") #else - #define _BUILD_STRING_ ( "RLS_22.06.17 [" __DATE__ " " __TIME__ "]") + #define _BUILD_STRING_ ( "RLS_24.08.17 [" __DATE__ " " __TIME__ "]") #endif #else - #define _BUILD_STRING_ ( "ILS_22.06.17 [" __DATE__ " " __TIME__ "]") + #define _BUILD_STRING_ ( "ILS_24.08.17 [" __DATE__ " " __TIME__ "]") #endif #else - #define _BUILD_STRING_ ( "WIN_22.06.17 [" __DATE__ " " __TIME__ "]") + #define _BUILD_STRING_ ( "WIN_24.08.17 [" __DATE__ " " __TIME__ "]") #endif typedef uint8_t NODE_TYPE; @@ -555,6 +555,10 @@ typedef struct S_DBC_SITE_DATA{ bool local_binding; uint32_t report_cleanup; uint32_t preserve_empty; + char remote_ip[16]; + uint16_t remote_port; + bool use_remote_server; + bool skip_local_report; }DBC_SITE_DATA; typedef struct S_DBC_FH_DATA{ diff --git a/lib/App/common/kernelPrototype.cpp b/lib/App/common/kernelPrototype.cpp index 75a2b0e2..0982836f 100644 --- a/lib/App/common/kernelPrototype.cpp +++ b/lib/App/common/kernelPrototype.cpp @@ -1,11 +1,5 @@ #include "kernelPrototype.h" -#ifdef USE_MYSQL - #include "MySQL_dataBinder.h" -#else - #include "SQLite_dataBinder.h" -#endif - #define LOG( X ) kernelPrototype::m_pLog->Log( "KRNL", this, X ) #ifdef DEBUG #define LOG_ERROR( X ) {\ @@ -64,15 +58,21 @@ kernelPrototype::kernelPrototype( config_setting_t *ptr ): basicEventHandler(), }; #endif m_pEventHeap = basicEventHeap::getInstance(); + m_pSettings = basicSettingsProvider::getInstance()->getSubNode( ptr, "KERNEL" ); -#ifdef USE_MYSQL - m_pDBC = mysqlDBC::getInstance(); -#else - m_pDBC = sqliteDBC::getInstance(); -#endif + +#ifndef USE_SERVER_MYSQL + #ifdef USE_MYSQL + m_pDBC = mysqlDBC::getInstance(); + #else + m_pDBC = sqliteDBC::getInstance(); + #endif m_pHardwareManager = NULL; m_pModuleFactory = NULL; m_pNodeFactory = NULL; +#else + m_pDBC = servaMySQLDBC::getInstance(); +#endif m_bExitCause = EXIT_CODE_KERNEL_CLEAR; m_bWM = WM_KERNEL_PROTOTYPE_INIT; kernelPrototype::_instance = this; @@ -122,6 +122,7 @@ void kernelPrototype::WaitFinish( bool Force ){ waitThreadEnd( Force ); }; +#ifndef USE_SERVER_MYSQL kernelEventFilter *kernelPrototype::getFilter( uint32_t id ){ kernelEventFilter *RetVal = NULL; if( m_vTargetFilters.size() > 0 ) { @@ -134,7 +135,7 @@ kernelEventFilter *kernelPrototype::getFilter( uint32_t id ){ }; return RetVal; }; - +#endif #undef LOG #undef LOG_ERROR \ No newline at end of file diff --git a/lib/App/common/kernelPrototype.h b/lib/App/common/kernelPrototype.h index 8a507455..52e409df 100644 --- a/lib/App/common/kernelPrototype.h +++ b/lib/App/common/kernelPrototype.h @@ -7,11 +7,20 @@ #include "../../components/base/basicEventHeap.h" #include "../../components/base/basicLogCollection.h" #include "../../components/base/basicSettingsProvider.h" -#include "hardwareManager.h" -#include "kernelModuleFactory.h" -#include "deviceNodeFactory.h" -#include "kernelEventFilter.h" +#ifndef USE_SERVER_MYSQL + #include "hardwareManager.h" + #include "kernelModuleFactory.h" + #include "deviceNodeFactory.h" + #include "kernelEventFilter.h" + #ifdef USE_MYSQL + #include "MySQL_dataBinder.h" + #else + #include "SQLite_dataBinder.h" + #endif +#else + #include "serverMySQL_dataBinder.h" +#endif #define WM_KERNEL_PROTOTYPE_INIT 0 @@ -47,11 +56,15 @@ class kernelPrototype: public basicThread, public basicEventHandler { basicEventHeap * m_pEventHeap; config_setting_t * m_pSettings; /* Special */ +#ifndef USE_SERVER_MYSQL dataBinder * m_pDBC; hardwareManager * m_pHardwareManager; kernelModuleFactory * m_pModuleFactory; deviceNodeFactory * m_pNodeFactory; vectorKernelEventFilters m_vTargetFilters; +#else + serverDataBinder * m_pDBC; +#endif /* func */ virtual void m_fThreadProc( void ){}; //hiden constructor -> the object cannot be used directly! @@ -64,10 +77,12 @@ class kernelPrototype: public basicThread, public basicEventHandler { uint8_t getExitCause(); static kernelPrototype * getInstance(); uint8_t getWM( void ); +#ifndef USE_SERVER_MYSQL //uint32_t getInstanceID(); //hardwareManager * getHardwareManager(){ return m_pHardwareManager; }; //kernelModuleFactory * getModuleFactory(); kernelEventFilter * getFilter( uint32_t id ); +#endif void WaitFinish( bool Force = false ); virtual void dispatchEvent( EVENT_CONTAINER *Evt ){}; }; diff --git a/lib/App/common/serverDataBinder.cpp b/lib/App/common/serverDataBinder.cpp new file mode 100644 index 00000000..2a6e28b5 --- /dev/null +++ b/lib/App/common/serverDataBinder.cpp @@ -0,0 +1,3 @@ +#include "serverDataBinder.h" +serverDataBinder::serverDataBinder(){}; +serverDataBinder::~serverDataBinder(){}; \ No newline at end of file diff --git a/lib/App/common/serverDataBinder.h b/lib/App/common/serverDataBinder.h new file mode 100644 index 00000000..ca63cd79 --- /dev/null +++ b/lib/App/common/serverDataBinder.h @@ -0,0 +1,21 @@ +#ifndef __ARGUS_SERVER_DATA_BINDER_HEADER__ +#define __ARGUS_SERVER_DATA_BINDER_HEADER__ + +#include "dataBinder_structures.h" + +class serverDataBinder { + public: + serverDataBinder(); + ~serverDataBinder(); + /* Functionality */ + bool connect( void ){ return false; }; + bool putIntoLog( char *Msg ){ return false; }; + bool registerServer( uint32_t SiteID, CSTR identity, int PID, uint32_t *ServID, uint32_t *ServNode ){ return false; }; + bool setNodeOffline( uint32_t NodeID ){ return false; }; + bool setNodeOnline( uint32_t NodeID, uint8_t status ){ return false; }; + bool unregisterServer(){ return false; }; + bool updateServerUtilisation( DBC_SYS_LOAD_INFO *ptr ){ return false; }; +}; + + +#endif \ No newline at end of file diff --git a/lib/App/common/serverMySQL_dataBinder.cpp b/lib/App/common/serverMySQL_dataBinder.cpp new file mode 100644 index 00000000..d7aafd40 --- /dev/null +++ b/lib/App/common/serverMySQL_dataBinder.cpp @@ -0,0 +1,238 @@ +#include "serverMySQL_dataBinder.h" + +#define LOG( X ) m_pLog->Log( "MDBC", 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( "MDBC", this, _LOG_ERROR, _tBfrErrMSG2w34 );\ + } +#else + #define LOG_ERROR( X ) m_pLog->Log( "MDBC", this, _LOG_ERROR, X ); +#endif + +servaMySQLDBC *servaMySQLDBC::_instance = NULL; + +/** + * Returns the single instance of the object. + */ +servaMySQLDBC* servaMySQLDBC::getInstance( config_setting_t * Settings ) { + // check if the instance has been created yet + if( 0 == _instance ){ + // if not, then create it + _instance = new servaMySQLDBC( Settings ); + }; + // return the single instance + return _instance; +}; + + +servaMySQLDBC::servaMySQLDBC( config_setting_t * Settings ):serverDataBinder(){ + m_pLog = basicLogCollection::getInstance(); + m_pSettings = basicSettingsProvider::getInstance()->getSubNode( Settings, "DBC" ); + m_bIsConnected = false; + m_pDatabase = NULL; +}; + +servaMySQLDBC::~servaMySQLDBC(){ + m_bIsConnected = false; + if( m_pDatabase != NULL ) delete( m_pDatabase ); + m_pDatabase = NULL; + _instance = NULL; +}; + +bool servaMySQLDBC::connect( void ){ + config_setting_t * tSetting; + m_bIsConnected = false; + if( m_pSettings!= NULL ) { + tSetting = config_setting_get_member( m_pSettings, "DATABASE_HOST" ); + if( tSetting == NULL ){ + tSetting = config_setting_add(m_pSettings, "DATABASE_HOST", CONFIG_TYPE_STRING ); + config_setting_set_string( tSetting, "localhost" ); + basicSettingsProvider::getInstance()->compromise(); + LOG("No DB Host Setting! Using default!"); + }; + sprintf(m_pDbHost, "%s", config_setting_get_string(tSetting)); + tSetting = config_setting_get_member(m_pSettings, "DATABASE_NAME"); + if( tSetting == NULL ){ + tSetting = config_setting_add(m_pSettings, "DATABASE_NAME", CONFIG_TYPE_STRING ); + config_setting_set_string( tSetting, "dfsl_gunter" ); + basicSettingsProvider::getInstance()->compromise(); + LOG("No DB Database Setting! Using default!"); + }; + sprintf(m_pDbDatabase, "%s", config_setting_get_string(tSetting)); + tSetting = config_setting_get_member( m_pSettings, "DATABASE_USER" ); + if( tSetting == NULL ){ + tSetting = config_setting_add(m_pSettings, "DATABASE_USER", CONFIG_TYPE_STRING ); + config_setting_set_string( tSetting, "dbroot" ); + basicSettingsProvider::getInstance()->compromise(); + LOG("No DB User Setting! Using default!"); + }; + sprintf(m_pDbUsername, "%s", config_setting_get_string(tSetting)); + tSetting = config_setting_get_member( m_pSettings, "DATABASE_PASSWORD" ); + if( tSetting == NULL ){ + tSetting = config_setting_add(m_pSettings, "DATABASE_PASSWORD", CONFIG_TYPE_STRING ); + config_setting_set_string( tSetting, "123567" ); + basicSettingsProvider::getInstance()->compromise(); + LOG("No DB Password Setting! Using default!"); + }; + sprintf(m_pDbPassword, "%s", config_setting_get_string(tSetting)); + basicSettingsProvider::getInstance()->validate(); + m_pDatabase = new MySQL_Connector(); + if( m_pDatabase == NULL )return false; + m_bIsConnected = m_pDatabase->Connect( m_pDbDatabase, m_pDbHost, m_pDbUsername, m_pDbPassword ); + } else { + LOG_ERROR("No Settings Provided!"); + }; + return m_bIsConnected; +}; + +bool servaMySQLDBC::putIntoLog( char *Msg ){ + if(m_bIsConnected){ + char tQBuf[MAX_PATH_LEN]; + sprintf( tQBuf, "INSERT INTO `log` SET `ts`=NOW(), `msg`='%s'", Msg ); + m_pDatabase->SilentQuery( tQBuf ); + }; +}; + +bool servaMySQLDBC::registerServer( uint32_t SiteID, CSTR identity, int PID, uint32_t *ServID, uint32_t *ServNode ){ + if(m_bIsConnected){ + //m_nSiteID = SiteID; + + char tQBuf[MAX_PATH_LEN]; + sprintf( tQBuf, "INSERT INTO servers SET `site_id`=%d, `identity`='%s', `version_string`='%s', `online`=1, `ts`=UNIX_TIMESTAMP(now()), pid=%d ON DUPLICATE KEY UPDATE `version_string`='%s', `ts`=UNIX_TIMESTAMP(now()), `online`=1, pid=%d", + SiteID, identity, _BUILD_STRING_, PID, _BUILD_STRING_, PID ); +#ifdef DEBUG + LOG(tQBuf); +#endif + m_pDatabase->SilentQuery( tQBuf ); + + //*ServID = getServerID( identity ); + //m_nServerID = *ServID; + if( *ServID ) { + + //sprintf(tQBuf,"INSERT INTO nodes SET `site_id`=%d, `aux_id`='%d', `type`= 0, `online`=1, `name`='Server Node' ON DUPLICATE KEY UPDATE `online`=1", m_nSiteID, *ServID ); +#ifdef DEBUG_ALL + LOG(tQBuf); +#endif + *ServNode = ( uint32_t ) m_pDatabase->QueryID( tQBuf ); + + //if( *ServNode == 0 ){ + // *ServNode = getServerNode( *ServID ); + //}; + //m_nServerNodeID = *ServNode; + // Clenup Nodes and services ... + sprintf(tQBuf,"UPDATE nodes SET `online`=0 WHERE `server_id`=%d ", *ServID ); + #ifdef DEBUG_ALL + LOG(tQBuf); + #endif + m_pDatabase->SilentQuery( tQBuf ); + sprintf(tQBuf,"UPDATE cameras SET `online`=0 WHERE `site_id`=%d ", SiteID ); + #ifdef DEBUG_ALL + LOG(tQBuf); + #endif + m_pDatabase->SilentQuery( tQBuf ); + + sprintf(tQBuf,"UPDATE media_streams SET `valid`=0 WHERE `site_id`=%d ", SiteID ); + #ifdef DEBUG_ALL + LOG(tQBuf); + #endif + m_pDatabase->SilentQuery( tQBuf ); + + sprintf(tQBuf,"UPDATE media_server_streams SET `valid`=0, `online`=0 WHERE `site_id`=%d ", SiteID ); + #ifdef DEBUG_ALL + LOG(tQBuf); + #endif + m_pDatabase->SilentQuery( tQBuf ); + + //cleanResources( tServerNodeID ); + return setNodeOnline( 0, 1 );//m_nServerNodeID ); + } + }; + return false; +}; + +bool servaMySQLDBC::unregisterServer(){ + if( setNodeOffline( 0 ) ) { //m_nServerNodeID ) ){ + char tQBuf[CTEXT]; + sprintf(tQBuf,"UPDATE servers SET `online`=0, `ts`=UNIX_TIMESTAMP(now()) WHERE `id`=%d", 1 );//m_nServerID ); +#ifdef DEBUG_ALL + LOG(tQBuf); +#endif + m_pDatabase->SilentQuery( tQBuf ); + return true; + }; + return false; +}; + +bool servaMySQLDBC::setNodeOnline( uint32_t NodeID, uint8_t status ){ + if(m_bIsConnected){ + char tQBuf[CTEXT]; + if( NodeID ) { + sprintf(tQBuf,"UPDATE nodes SET `online`=%d WHERE `id`=%d", status, NodeID ); +#ifdef DEBUG_ALL + LOG(tQBuf); +#endif + m_pDatabase->SilentQuery( tQBuf ); + sprintf(tQBuf,"UPDATE `resources` SET `active`=1 WHERE `node_id`=%d", NodeID ); +#ifdef DEBUG_ALL + LOG(tQBuf); +#endif + m_pDatabase->SilentQuery( tQBuf ); + return true; + }; + }; + return false; +}; + +bool servaMySQLDBC::setNodeOffline( uint32_t NodeID ){ + if(m_bIsConnected){ + char tQBuf[CTEXT]; + if( NodeID ) { + sprintf(tQBuf,"UPDATE nodes SET `online`=0 WHERE `id` = %d", NodeID ); +#ifdef DEBUG_ALL + LOG(tQBuf); +#endif + m_pDatabase->SilentQuery( tQBuf ); + sprintf(tQBuf,"UPDATE `resources` SET `active`=0 WHERE `node_id` = %d", NodeID ); +#ifdef DEBUG_ALL + LOG(tQBuf); +#endif + m_pDatabase->SilentQuery( tQBuf ); + return true; + }; + }; + return false; +}; + +//bool servaMySQLDBC::updateServerUtilisation( uint32_t ServerID, uint32_t nCores, float cpu1, float cpu5, float cpu15, float mem, float disk, uint64_t dtsize, uint64_t dcsize, uint64_t mtsize, uint64_t mcsize ){ +bool servaMySQLDBC::updateServerUtilisation( DBC_SYS_LOAD_INFO *ptr ){ + if( m_bIsConnected ) { + char tQBuf[MAX_PATH_LEN]; + sprintf( tQBuf, "UPDATE `servers` SET `ts`=UNIX_TIMESTAMP(now()), `cpu_cores`=%d, `stat_cpu1`=%0.2f, `stat_cpu5`=%0.2f, `stat_cpu15`=%0.2f, `stat_mem`=%0.2f, `stat_disk`=%0.2f, `temp0`=%0.1f, `val_mem_tottal`=%" PRIu64 ", `val_mem_current`=%" PRIu64 ", `val_disk_tottal`=%" PRIu64 ", `val_disk_current`=%" PRIu64 " WHERE `id`=%d", + ptr->CPU_CORES, + ptr->cpu1, + ptr->cpu5, + ptr->cpu15, + ptr->mem, + ptr->disk, + ptr->temperature, + ptr->T_DISK, + ptr->C_DISK, + ptr->T_MEM, + ptr->C_MEM, + 0//m_nServerID + ); +#ifdef DEBUG_ALL + LOG(tQBuf); +#endif + m_pDatabase->SilentQuery( tQBuf ); + return true; + }; + return false; +}; + +#undef LOG +#undef LOG_ERROR + diff --git a/lib/App/common/serverMySQL_dataBinder.h b/lib/App/common/serverMySQL_dataBinder.h new file mode 100644 index 00000000..10e9dd7a --- /dev/null +++ b/lib/App/common/serverMySQL_dataBinder.h @@ -0,0 +1,39 @@ +#ifndef __MYSQL_DATA_BINDER_HEADER__ +#define __MYSQL_DATA_BINDER_HEADER__ + +#include "serverDataBinder.h" +#include "../../data/mysql/mysql_class.h" +#include "../../components/base/basicSettingsProvider.h" +#include "../../alg/generic/md5.h" +#include "../../alg/lgs/mask.h" + + +class servaMySQLDBC: public serverDataBinder { + private: + basicLogCollection * m_pLog; + config_setting_t * m_pSettings; + MySQL_Connector * m_pDatabase; + bool m_bIsConnected; + char m_pDbHost[CLOG]; + char m_pDbUsername[CLOG]; + char m_pDbPassword[CLOG]; + char m_pDbDatabase[CLOG]; + + static servaMySQLDBC * _instance; + explicit servaMySQLDBC( config_setting_t * Settings = NULL ); + public: + static servaMySQLDBC * getInstance( config_setting_t * Settings = NULL ); + virtual ~servaMySQLDBC(); + /* Functionality */ + virtual bool connect( void ); + virtual bool putIntoLog( char *Msg ); + virtual bool registerServer( uint32_t SiteID, CSTR identity, int PID, uint32_t *ServID, uint32_t *ServNode ); + virtual bool setNodeOffline( uint32_t NodeID ); + virtual bool setNodeOnline( uint32_t NodeID, uint8_t status ); + virtual bool unregisterServer(); + virtual bool updateServerUtilisation( DBC_SYS_LOAD_INFO *ptr ); +}; + + + +#endif \ No newline at end of file diff --git a/lib/App/mojo/mojoKernel.cpp b/lib/App/mojo/mojoKernel.cpp index 88260005..1bd56ccd 100644 --- a/lib/App/mojo/mojoKernel.cpp +++ b/lib/App/mojo/mojoKernel.cpp @@ -60,7 +60,9 @@ mojoKernel::mojoKernel( config_setting_t *ptr ):kernelPrototype( ptr ){ m_pSystemAnchor = NULL; m_bSessionStarted = false; m_bWorkWithRemoteServer = false; + m_bKeepLocalReport = true; m_bMediaMode = 0; + m_pRPC = NULL; //setWM( WM_NONE ); }; @@ -194,32 +196,51 @@ bool mojoKernel::create(){ memset( &m_sSiteData, 0, sizeof( DBC_SITE_DATA )); m_pSystemAnchor = systemAnchor::getInstance( false, &t, true ); }; + m_bKeepLocalReport = !m_sSiteData.skip_local_report; + + m_bDebugMode = m_pDBC->getAppDebugMode(); + if ( m_bDebugMode ) m_bKeepLocalReport = true; //Forced in case of debug mode + + m_bWorkWithRemoteServer = m_sSiteData.use_remote_server; + if ( m_bWorkWithRemoteServer ) { +#ifdef DEBUG + LOG("Working With Remote Server"); +#endif + if ( m_pRPC = new mojoRemoteClient( this ) ) { + if( m_bWorkWithRemoteServer = m_pRPC->create() ){ + + } else LOG_ERROR("Cannot Connect to Remote Server!"); + } else m_bWorkWithRemoteServer = false; + }; //Check date/Time if correct! - // On some systems the System Date may be in past cause last session was interrupted by power loose - uint32_t tTS = m_pDBC->getLastEventTS(); - if ( tTS ) { - // Have last TS - struct timespec tS = { 0 }; - if( clock_gettime( CLOCK_REALTIME, &tS ) == 0 ){ - //time_t cTS = time(NULL); - if ( tTS > tS.tv_sec ) { - // System Time is in the Past - LOG("Correcting System Time!"); - tS.tv_sec = tTS; - tS.tv_nsec = tTS * 1000000; - if (clock_settime(CLOCK_REALTIME, &tS) != 0) LOG_ERROR("Time Correction Failed!"); + // Just in case that we have local reports + if ( m_bKeepLocalReport ) { +#ifdef DEBUG + LOG("Working With Local Reports"); +#endif + // On some systems the System Date may be in past cause last session was interrupted by power loose + uint32_t tTS = m_pDBC->getLastEventTS(); + if ( tTS ) { + // Have last TS + struct timespec tS = { 0 }; + if( clock_gettime( CLOCK_REALTIME, &tS ) == 0 ){ + //time_t cTS = time(NULL); + if ( tTS > tS.tv_sec ) { + // System Time is in the Past + LOG("Correcting System Time!"); + tS.tv_sec = tTS; + tS.tv_nsec = tTS * 1000000; + if (clock_settime(CLOCK_REALTIME, &tS) != 0) LOG_ERROR("Time Correction Failed!"); + }; }; - }; - } #ifdef DEBUG - else LOG("No Last TS fetched from DB!") + } else { + LOG("No Last TS fetched from DB!"); #endif - ; - - m_bDebugMode = m_pDBC->getAppDebugMode(); - - m_bSessionStarted = m_pDBC->getEventSessionStatus( m_nServerNodeID ); - stopSession( false ); + }; + m_bSessionStarted = m_pDBC->getEventSessionStatus( m_nServerNodeID ); + stopSession( false ); + }; m_pHardwareManager = hardwareManager::getInstance(); @@ -254,44 +275,48 @@ void mojoKernel::startSession(){ m_mSessionProtector.lock(); m_nNoAlarmCounter = 0; if( !m_bSessionStarted ) { - DBC_EVT_RECORD tRecord; - memset( &tRecord, 0, sizeof(DBC_EVT_RECORD)); - uint64_t TS_64 = getMilliseconds() - 20; // -20 msec before - tRecord.ts_s = TS_64/ 1000; - tRecord.ts_ms = TS_64 % 1000; - tRecord.node_id = m_nServerNodeID; - tRecord.type = EVT_LRF_START_SESSION; - CSTR tUUID = getUniqID_UUID( tRecord.ts_s ); - if( tUUID ) { - strncpy(tRecord.uuid, tUUID, 64 ); - free( tUUID ); - } else { - memset( tRecord.uuid, 0, 65 ); - }; - m_pDBC->addEvent( &tRecord ); + if ( m_bKeepLocalReport ) { + DBC_EVT_RECORD tRecord; + memset( &tRecord, 0, sizeof(DBC_EVT_RECORD)); + uint64_t TS_64 = getMilliseconds() - 20; // -20 msec before + tRecord.ts_s = TS_64/ 1000; + tRecord.ts_ms = TS_64 % 1000; + tRecord.node_id = m_nServerNodeID; + tRecord.type = EVT_LRF_START_SESSION; + CSTR tUUID = getUniqID_UUID( tRecord.ts_s ); + if( tUUID ) { + strncpy(tRecord.uuid, tUUID, 64 ); + free( tUUID ); + } else { + memset( tRecord.uuid, 0, 65 ); + }; + m_pDBC->addEvent( &tRecord ); + }; m_bSessionStarted = true; - } + }; m_mSessionProtector.unlock(); }; void mojoKernel::stopSession( bool forced ){ m_mSessionProtector.lock(); if( m_bSessionStarted ){ - DBC_EVT_RECORD tRecord; - memset( &tRecord, 0, sizeof(DBC_EVT_RECORD)); - uint64_t TS_64 = getMilliseconds() + 20; // +20 msec before - tRecord.ts_s = TS_64/ 1000; - tRecord.ts_ms = TS_64 % 1000; - tRecord.node_id = m_nServerNodeID; - tRecord.type = forced ? EVT_LRF_END_SESSION_MA:EVT_LRF_END_SESSION_TO; - CSTR tUUID = getUniqID_UUID( tRecord.ts_s ); - if( tUUID ) { - strncpy(tRecord.uuid, tUUID, 64 ); - free( tUUID ); - } else { - memset( tRecord.uuid, 0, 65 ); + if ( m_bKeepLocalReport ) { + DBC_EVT_RECORD tRecord; + memset( &tRecord, 0, sizeof(DBC_EVT_RECORD)); + uint64_t TS_64 = getMilliseconds() + 20; // +20 msec before + tRecord.ts_s = TS_64/ 1000; + tRecord.ts_ms = TS_64 % 1000; + tRecord.node_id = m_nServerNodeID; + tRecord.type = forced ? EVT_LRF_END_SESSION_MA:EVT_LRF_END_SESSION_TO; + CSTR tUUID = getUniqID_UUID( tRecord.ts_s ); + if( tUUID ) { + strncpy(tRecord.uuid, tUUID, 64 ); + free( tUUID ); + } else { + memset( tRecord.uuid, 0, 65 ); + }; + m_pDBC->addEvent( &tRecord ); }; - m_pDBC->addEvent( &tRecord ); m_bSessionStarted = false; }; m_mSessionProtector.unlock(); @@ -970,41 +995,43 @@ void mojoKernel::dispatchEvent( EVENT_CONTAINER *Evt ){ void mojoKernel::handleVideo( VIDEO_SEGMENT_INFO *ptr ){ if ( fileExist( ptr->scratchPath ) ) { - if( ptr->recordMD5[0] ) { - //if wm is debug -> add all to database, else send to server - ptr->db_id = m_pDBC->addVideoRecord( ptr->stream_id, ptr->recordMD5, ptr->recordEXT, ptr->streamTSS, ptr->streamTMS, ptr->streamFPS ); - if ( ptr->db_id ) { + if( ptr->recordMD5[0] ) { + if( m_bKeepLocalReport ) { + //if wm is debug -> add all to database, else send to server + ptr->db_id = m_pDBC->addVideoRecord( ptr->stream_id, ptr->recordMD5, ptr->recordEXT, ptr->streamTSS, ptr->streamTMS, ptr->streamFPS ); + if ( ptr->db_id ) { #ifdef DEBUG - LOG("Video File Registered"); + LOG("Video File Registered"); #endif - for (int idx = 0; idx < ptr->eventIDS.size(); idx++) { + for (int idx = 0; idx < ptr->eventIDS.size(); idx++) { #ifdef DEBUG - LOG("Binding Event to a Video File!"); + LOG("Binding Event to a Video File!"); #endif - if( m_pDBC->addVideoEvent( ptr->eventIDS[idx], ptr->db_id, ptr->eventFrames[idx], ptr->eventTSS[idx], ptr->eventTMS[idx] )) { + if( m_pDBC->addVideoEvent( ptr->eventIDS[idx], ptr->db_id, ptr->eventFrames[idx], ptr->eventTSS[idx], ptr->eventTMS[idx] )) { #ifdef DEBUG - LOG("OK"); + LOG("OK"); #endif - }; - }; - CSTR tP = m_pDBC->getCurrentReportDir(); - if ( tP ) { - char tB[MAX_PATH]; - char dB[MAX_PATH]; - //sprintf( tB, "%s/data/videos/%s.%s", getcwd(dB,MAX_PATH), ptr->recordMD5, ptr->recordEXT ); - sprintf(tB, "%s/data/reports/%s/%s.%s", getcwd(dB, MAX_PATH), tP, ptr->recordMD5, ptr->recordEXT ); - fileCopy(ptr->scratchPath, tB); - ch_chown( tB, "nobody", "nogroup" ); - chmod( tB, 0664 ); + }; + }; + CSTR tP = m_pDBC->getCurrentReportDir(); + if ( tP ) { + char tB[MAX_PATH]; + char dB[MAX_PATH]; + //sprintf( tB, "%s/data/videos/%s.%s", getcwd(dB,MAX_PATH), ptr->recordMD5, ptr->recordEXT ); + sprintf(tB, "%s/data/reports/%s/%s.%s", getcwd(dB, MAX_PATH), tP, ptr->recordMD5, ptr->recordEXT ); + fileCopy(ptr->scratchPath, tB); + ch_chown( tB, "nobody", "nogroup" ); + chmod( tB, 0664 ); #ifdef DEBUG - LOG("Video Saved"); + LOG("Video Saved"); #endif - free( tP ); + free( tP ); + } else { + LOG_ERROR("Cannot Get Report Path from DB!"); + }; } else { - LOG_ERROR("Cannot Get Report Path from DB!"); + LOG_ERROR("Failure in registration video!"); }; - } else { - LOG_ERROR("Failure in registration video!"); }; }; unlink( ptr->scratchPath ); @@ -1015,35 +1042,38 @@ void mojoKernel::handleVideo( VIDEO_SEGMENT_INFO *ptr ){ }; bool mojoKernel::validateReports( void ){ - DBC_SITE_DATA *tSiteData = m_pDBC->getSiteData( 1 ); - if( tSiteData ) { - // Check if settings has been changed in DB - if ( tSiteData->report_cleanup != m_sSiteData.report_cleanup || tSiteData->preserve_empty != m_sSiteData.preserve_empty ) return false; - } else { - LOG_ERROR("Error Loading Site DATA!"); - return false; - }; - if ( m_sSiteData.report_cleanup ) { - cleanUpReportDir( m_sSiteData.report_cleanup ); - }; - if ( m_sSiteData.preserve_empty ) { - float tT = 100.0f * ( 1.0f - ( 1.0f / ((float)m_sSiteData.preserve_empty))); + if ( m_bKeepLocalReport ) { + DBC_SITE_DATA *tSiteData = m_pDBC->getSiteData(1); + if( tSiteData ) { + // Check if settings has been changed in DB + if ( tSiteData->report_cleanup != m_sSiteData.report_cleanup || tSiteData->preserve_empty != m_sSiteData.preserve_empty ) return false; + } else { + LOG_ERROR("Error Loading Site DATA!"); + return false; + }; + if ( m_sSiteData.report_cleanup ) { + cleanUpReportDir( m_sSiteData.report_cleanup ); + }; + if ( m_sSiteData.preserve_empty ) { + float tT = 100.0f * ( 1.0f - ( 1.0f / ((float)m_sSiteData.preserve_empty))); #ifdef DEBUG_EXTRA - char tB[128]; - sprintf( tB, "Check Disk Size: %0.3f %0.3f %d [%d]", m_sSysInfo.disk, tT, m_sSiteData.preserve_empty ); - LOG( tB ); + char tB[128]; + sprintf( tB, "Check Disk Size: %0.3f %0.3f %d [%d]", m_sSysInfo.disk, tT, m_sSiteData.preserve_empty ); + LOG( tB ); #endif - if( m_sSysInfo.disk > tT ){ - // delete some oldest report date - m_pDBC->deleteReportDate( m_pDBC->getFirstEventTS() ); + if( m_sSysInfo.disk > tT ){ + // delete some oldest report date + m_pDBC->deleteReportDate( m_pDBC->getFirstEventTS() ); + }; }; - }; + } return true; }; void mojoKernel::backupReports( uint32_t days ){ - REPORT_DIRINFO tRDI = {0}; + if ( !m_bKeepLocalReport ) return; + REPORT_DIRINFO tRDI = { 0 }; uint32_t cTS = (uint32_t)time(NULL); cTS -= 86400 * days; fillRDF( cTS, tRDI ); diff --git a/lib/App/mojo/mojoKernel.h b/lib/App/mojo/mojoKernel.h index f2187a5c..a165a95c 100644 --- a/lib/App/mojo/mojoKernel.h +++ b/lib/App/mojo/mojoKernel.h @@ -32,6 +32,8 @@ #include "../common/kernelPrototype.h" +#include "mojoRemoteClient.h" + #define MAX_CYCLE_COUNTER_VALUE 0xFFFFFFFF; #define SLEEP_KERNEL_INTERVAL 10 // 10 millisecond #define TIME_SYNC_INTERVAL 900000 // 15 minute(s) in 1 millisecond units @@ -66,9 +68,10 @@ class mojoKernel: public kernelPrototype{ uint32_t m_nServerID; uint32_t m_nServerNodeID; systemAnchor * m_pSystemAnchor; - + mojoRemoteClient * m_pRPC; bool m_bDebugMode; + bool m_bKeepLocalReport; bool m_bWorkWithRemoteServer; bool m_bSessionStarted; uint8_t m_bMediaMode; @@ -108,6 +111,8 @@ class mojoKernel: public kernelPrototype{ virtual void dispatchEvent( EVENT_CONTAINER *Evt ); inline bool getDebugMode(){ return m_bDebugMode; }; inline uint8_t getMediaMode(){ return m_bMediaMode; }; + + friend class mojoRemoteClient; }; #endif // __MOJJO_KERNEL_H_INCL__ diff --git a/lib/App/mojo/mojoRemoteClient.cpp b/lib/App/mojo/mojoRemoteClient.cpp new file mode 100644 index 00000000..1abf5a57 --- /dev/null +++ b/lib/App/mojo/mojoRemoteClient.cpp @@ -0,0 +1,68 @@ +#include "mojoRemoteClient.h" +#include "mojoKernel.h" + +#define LOG( X ) m_pLog->Log( "RPC", this, X ) +#ifdef DEBUG + #define LOG_ERROR( X ) {\ + char _tBfrErrMSG234[256];\ + sprintf( _tBfrErrMSG234, "In file %s[%d] in func:%s %s",__FILE__, __LINE__, __func__, X );\ + m_pLog->Log( "RPC", this, _LOG_ERROR, _tBfrErrMSG234 );\ + } +#else + #define LOG_ERROR( X ) m_pLog->Log( "RPC", this, _LOG_ERROR, X ); +#endif + +mojoRemoteClient::mojoRemoteClient( mojoKernel * ptr ):protocolParser(){ + m_pLog = basicLogCollection::getInstance(); + m_pPort = NULL; + m_pMaster = ptr; +}; + +mojoRemoteClient::~mojoRemoteClient(){ + if ( m_pPort ) delete( m_pPort ); +}; + +bool mojoRemoteClient::create(){ + if ( m_pMaster == NULL ) return false; +#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_pMaster->m_sSiteData.remote_port ) { + m_pPort = new clientPort( m_pMaster->m_sSiteData.remote_ip, m_pMaster->m_sSiteData.remote_port ); + if( m_pPort ) { + if ( m_pPort->create() ) { + LOG( "Port Created Sucessfully!" ); + return setTransport( m_pPort ); + } else { + delete( m_pPort ); + m_pPort = NULL; + }; + }; + }; + return false; +}; + +int mojoRemoteClient::packetChecker(U8 *Buffer, size_t BufferSize){ + if ( Buffer[0] == ARGUS_START_SERVER_FLAG ) { + ARGUS_DATA_HEADER *ptr = (ARGUS_DATA_HEADER*) Buffer; + if ( ( ptr->SIZE + ARGUS_HEADER_SIZE + ARGUS_CHECKSUM_SIZE ) <= BufferSize ) { + uint16_t tCRC = checksum16( Buffer, ptr->SIZE + ARGUS_HEADER_SIZE ); + uint16_t *cCRC = (uint16_t*)( Buffer + ptr->SIZE + ARGUS_HEADER_SIZE ); + if ( tCRC == *cCRC ) return 0; + } else return 1; + }; + return -1; +}; + +protocolPackage *mojoRemoteClient::packetExtractor(U8 *Buffer, size_t BufferSize){ + +}; + +bool mojoRemoteClient::packetHandler( protocolPackage *Package ){ + +}; + +#undef LOG +#undef LOG_ERROR \ No newline at end of file diff --git a/lib/App/mojo/mojoRemoteClient.h b/lib/App/mojo/mojoRemoteClient.h new file mode 100644 index 00000000..2e94bf01 --- /dev/null +++ b/lib/App/mojo/mojoRemoteClient.h @@ -0,0 +1,27 @@ +#ifndef __MOJO_REMOTE_CLIENT_HEADER__ +#define __MOJO_REMOTE_CLIENT_HEADER__ + +#include "../../components/base/basicLogCollection.h" +#include "../../data/net/clientPort.h" +#include "../../data/protocol/protocol.h" +#include "../../data/protocol/protocolARGUS_DATA.h" + +class mojoKernel; + +class mojoRemoteClient: public protocolParser{ + private: + basicLogCollection *m_pLog; + mojoKernel *m_pMaster; + clientPort *m_pPort; + protected: + virtual int packetChecker(U8 *Buffer, size_t BufferSize); + virtual protocolPackage * packetExtractor(U8 *Buffer, size_t BufferSize); + virtual bool packetHandler( protocolPackage *Package ); + //virtual void dataEraser( U8*& tPtr ); + public: + explicit mojoRemoteClient( mojoKernel *ptr ); + ~mojoRemoteClient(); + virtual bool create(); +}; + +#endif \ No newline at end of file diff --git a/lib/App/serva/lifeMonitoring.cpp b/lib/App/serva/lifeMonitoring.cpp new file mode 100644 index 00000000..2ec8d389 --- /dev/null +++ b/lib/App/serva/lifeMonitoring.cpp @@ -0,0 +1,16 @@ +#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 new file mode 100644 index 00000000..9badb337 --- /dev/null +++ b/lib/App/serva/lifeMonitoring.h @@ -0,0 +1,15 @@ +#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/objectMySQLLoggingService.cpp b/lib/App/serva/objectMySQLLoggingService.cpp new file mode 100644 index 00000000..3c947c27 --- /dev/null +++ b/lib/App/serva/objectMySQLLoggingService.cpp @@ -0,0 +1,21 @@ +#include "objectMySQLLoggingService.h" + +objectMySQLLoggingService::objectMySQLLoggingService(){ + m_bLogging = false; + m_pDBC = NULL; +}; + +objectMySQLLoggingService::objectMySQLLoggingService( serverDataBinder *ptr ){ + m_pDBC = ptr; + m_bLogging = ( m_pDBC != NULL ); +}; + +void objectMySQLLoggingService::logMessage( CSTR Msg ){ + if( !m_bLogging ) return; + logMessage( (const char * ) Msg ); +}; + +void objectMySQLLoggingService::logMessage( const char *Msg ){ + if( !m_bLogging ) return; + if( m_pDBC ) m_pDBC->putIntoLog( ( CSTR ) Msg ); +}; \ No newline at end of file diff --git a/lib/App/serva/objectMySQLLoggingService.h b/lib/App/serva/objectMySQLLoggingService.h new file mode 100644 index 00000000..c9a558b8 --- /dev/null +++ b/lib/App/serva/objectMySQLLoggingService.h @@ -0,0 +1,57 @@ +#ifndef __OBJECTMYSQLLOGGINGSERVICE_H_INCL__ +#define __OBJECTMYSQLLOGGINGSERVICE_H_INCL__ + +#include +#include "../components/base/basicFunctionality.h" +#include "../components/base/basicLoggingService.h" +#include "../common/serverDataBinder.h" + +/** + * TODO: Add class description + * + * @author Gagua + */ + +class objectMySQLLoggingService : public basicLoggingService { + private: + bool m_bLogging; + serverDataBinder * m_pDBC; + public: + // Constructor + objectMySQLLoggingService(); + + objectMySQLLoggingService( serverDataBinder *ptr ); + + // Destructor + ~objectMySQLLoggingService(){}; + + void logMessage( CSTR Msg ); + void logMessage( const char *Msg ); + // Copy constructor + // TODO: Uncomment the copy constructor when you need it. + //objectFileLoggingService(const objectFileLoggingService& src); + + // Assignment operator + // TODO: Uncomment the assignment operator when you need it. + //objectFileLoggingService& operator=(const objectFileLoggingService& src); +}; + +// TODO: Uncomment the copy constructor when you need it. +//inline objectFileLoggingService::objectFileLoggingService(const objectFileLoggingService& src) +//{ +// // TODO: copy +//} + +// TODO: Uncomment the assignment operator when you need it. +//inline objectFileLoggingService& objectFileLoggingService::operator=(const objectFileLoggingService& rhs) +//{ +// if (this == &rhs) { +// return *this; +// } +// +// // TODO: assignment +// +// return *this; +//} + +#endif // __OBJECTFILELOGGINGSERVICE_H_INCL__ diff --git a/lib/App/serva/servaBackend.cpp b/lib/App/serva/servaBackend.cpp new file mode 100644 index 00000000..0dd22ab0 --- /dev/null +++ b/lib/App/serva/servaBackend.cpp @@ -0,0 +1,477 @@ +//---------------------------------------------------------------------------- +// Dr.Frucht Systems Ltd. +// Copyright © 2000-2022. All Rights Reserved. +// Version 2.0 11/18/2022 +// Last modification: 11/18/2022 +// PROJECT: +// SUBSYSTEM: +// FILE: LRF_Server.cpp +// AUTHOR: gagua +// OVERVIEW +// ~~~~~~~~ +// Header file of servaBackend.cpp +//---------------------------------------------------------------------------- +// + +#include "servaBackend.h" + +typedef enum { + ST_NONE = -1, + ST_SN = 0, + ST_BIND_ADDRESS, + ST_BIND_PORT, + ST_PID_FILE, + ST_LOG_FILE, + ST_LOG_ENABLE, + ST_INTERACTIVE, + ST_SMS_ENABLE, + ST_EMAIL_ENABLE, + ST_SMS_PROVIDER, + ST_DATABASE_SERVER, + ST_DATABASE_USER, + ST_DATABASE_PASSWORD, + ST_DATABASE_NAME, + ST_SOCKET_NAME +} SETTING_TYPE; + +CSTR m_pSetting[] = { + (CSTR)"SN", + (CSTR)"BIND_ADDRESS", + (CSTR)"BIND_PORT", + (CSTR)"PID_FILE", + (CSTR)"LOG_FILE" , + (CSTR)"LOG_ENABLED", + (CSTR)"INTERACTIVE", + (CSTR)"SMS_ENABLE", + (CSTR)"EMAIL_ENABLE", + (CSTR)"SMS_PROVIDER", + (CSTR)"DATABASE_SERVER", + (CSTR)"DATABASE_USER", + (CSTR)"DATABASE_PASSWORD", + (CSTR)"DATABASE_NAME", + (CSTR)"SOCKET_NAME" +}; + +// Global Variables + +CSTR gsCFG_ADDRESS; +uint16_t guCFG_PORT = DEFAULT_SERVER_PORT; +CSTR gsCFG_LICENSE; +CSTR gsCFG_DB_SERVER; +CSTR gsCFG_DB_NAME; +CSTR gsCFG_DB_USER; +CSTR gsCFG_DB_PASSWORD; +CSTR gsCFG_PID_FILE = (CSTR) DEFAULT_SERVER_PID_FILE; +SOFTWARE_INFO gsSOFT_INFO; +bool gbCFG_MASTER_ROLE = true; + +bool gModule_GeoFence_Enabled = true; +bool gModule_SMS_Enabled = false; +bool gModule_Email_Enabled = false; +bool gSignal_Handler_Enabled = true; + +#define LOG( X ) m_pLog->Log( "main", 0, X ) +#define LOG_ERROR( X ) m_pLog->Log( "main", 0, _LOG_ERROR, X ) + +servaKernel * Kernel = NULL; +basicLogCollection * m_pLog = NULL; +basicSettingsProvider * SettingsProvider = NULL; +config_setting_t * Settings = NULL; +servaMySQLDBC * DBC = NULL; + + +void (*old_kill_handler_9)(int); +void (*old_kill_handler_15)(int); + +void signal_kill_handler( int SIG ){ + if( Kernel!= NULL ){ + if( gSignal_Handler_Enabled ){ + m_pLog->Log("SIG", 0, _LOG_DEBUG, "Shutdown Service by Signal" ); + Kernel->setStatus( TH_ENDED ); // Closing all Connections; + } else { + m_pLog->Log("SIG", 0, _LOG_DEBUG, "Shutdown Signal Handler Disabled" ); + }; + }; +}; + +int main( int argc, char *argv[] ){ + + bool WBG; // Working Background + bool FLE; // File Logging Engine + bool SSE; // Server Statistics Engine + bool NDC; // No Default Configuration + CSTR FLE_NAME; + CSTR DCF_NAME; + CSTR SSP_NAME; + + // default init + WBG = true; + FLE = true; + FLE_NAME = (CSTR) DEFAULT_SERVER_LOG_FILE; + SSE = true; + NDC = true; + DCF_NAME = (CSTR) DEFAULT_SERVER_CONFIG_PATH; + SSP_NAME = (CSTR) DEFAULT_SERVER_SOCKET_PATH; + gsSOFT_INFO.SW_BUILD_DATE = UNIX_TIMESTAMP; + gsSOFT_INFO.DATA_VALID = false; + gsSOFT_INFO.SW_MODE_FLAGS = 0 +#ifdef SKIP_TARGET_LOG + | SW_INFO_NO_TARGET_LOG +#endif +#ifdef HIBERNATE_ENABLE + | SW_INFO_HIBERNATE_ENA +#endif +#ifdef TGD + | SW_INFO_TGD_MOTORS + #ifdef TGD_VERSION_2 + | SW_INFO_TGD_VER_2 + #endif +#endif +#ifdef ENCODER_8192 + | SW_INFO_EU_PROJECT +#endif +#ifdef NO_BLACK_TARGETS + | SW_INFO_NO_BLACK_TARGETS +#endif +#ifndef NO_MOTORS + | SW_INFO_MOTOR_CTRL_ENA +#endif +#ifdef THREADED_FLIP + | SW_INFO_THREAD_FLIP +#endif +#ifndef PRU_SLAVE + | SW_INFO_FLAG_MASTER +#endif +#ifdef DEBUG + | SW_INFO_DEBUG_MODE +#endif + ; + + //if( !isProcessUniq( argv[0] ) ){ + if( fileExist( gsCFG_PID_FILE ) ){ + FILE * fd = fopen( gsCFG_PID_FILE, "r" ); + if ( fd ) { + char Kaka[64]; + readLine( fd, Kaka, 64 ); + pid_t tPID = ( pid_t ) atol( Kaka ); + if ( kill( tPID, 0 ) == 0 ) { + printf("Can not Start!\nThe Process [%s] Already is Runing[PID:%lld]\n", argv[0], tPID ); + return 33; + }; + }; + }; + //}; + + // Reading Config + if( argc > 1 ){ + for( int i = 0; i < argc; i++ ){ + switch( argv[i][0] ){ + case '-': + case '\\': + case '/':{ + switch( argv[i][1] ){ + case 'h': case 'H': case 'v': case 'V': case '?':{ + printf( "Dr Frucht Systems C-Server\n"); + printf( "Software version <%s>\n", VERSION_NUMBER ); + printf( " -h -H This Message\n" ); + printf( " -i -I Interactive Mode\n" ); + return 0; + break; + }; + case 'i': case 'I':{ + WBG = false; + break; + }; + case 'c': case 'C':{ + DCF_NAME = (CSTR) malloc( MAX_PATH_LEN ); + sprintf( DCF_NAME, "%s", argv[i+1] ); + break; + }; + }; + break; + }; + }; + }; + }; + if ( fileExist( DCF_NAME ) ){ + NDC = false; + } else { + DCF_NAME = (CSTR) DEFAULT_SERVER_CONFIG_FILE; + if( fileExist( DCF_NAME ) ){ + NDC = false; + }; + } + if ( !NDC ){ + // read serial number + FILE *pFile = fopen( DCF_NAME, "rt" ); + printf("Trying open file %s\n", DCF_NAME ); + if( pFile != NULL ){ + char pLine[1024]; + while( fgets( pLine, 1024, pFile ) ){ + SETTING_TYPE eType = ST_NONE; + CSTR pTemp = NULL; + for( int i = 0; i < sizeof( m_pSetting ) / sizeof( *m_pSetting ); i++ ){ + pTemp = strstr( pLine, m_pSetting[i] ); + if( pTemp ){ + eType = (SETTING_TYPE)i; + pTemp = strstr( pTemp, "=" ); + if( pTemp ) pTemp = strtok( pTemp + 1, " \t\n\r" ); + break; + }; + }; + + if( eType == ST_NONE || !pTemp ) continue; + + switch( eType ){ + case ST_SN:{ + gsCFG_LICENSE = (CSTR) malloc(strlen( pTemp )); + //memcpy( gsCFG_LICENSE, pTemp, strlen( pTemp ) ); + sprintf( gsCFG_LICENSE, "%s", pTemp ); + break; + }; + case ST_BIND_ADDRESS:{ + gsCFG_ADDRESS = (CSTR) malloc(strlen( pTemp )); + sprintf( gsCFG_ADDRESS, "%s", pTemp ); + break; + }; + case ST_BIND_PORT:{ + guCFG_PORT = ( uint16_t ) atoi( pTemp ); + break; + }; + case ST_PID_FILE:{ + gsCFG_PID_FILE = (CSTR) malloc(strlen( pTemp )); + sprintf( gsCFG_PID_FILE, "%s", pTemp ); + break; + }; + case ST_LOG_FILE:{ + FLE_NAME = (CSTR) malloc(strlen( pTemp )); + sprintf( FLE_NAME, "%s", pTemp ); + break; + }; + case ST_INTERACTIVE:{ + WBG = (atoi( pTemp ))? false: true; + break; + }; + case ST_SMS_ENABLE:{ + gModule_SMS_Enabled = (bool)atoi( pTemp ); + break; + }; + case ST_EMAIL_ENABLE:{ + gModule_Email_Enabled = (bool)atoi( pTemp ); + break; + }; + case ST_SMS_PROVIDER:{ + break; + }; + case ST_DATABASE_SERVER:{ + gsCFG_DB_SERVER = (CSTR) malloc(strlen( pTemp )); + sprintf( gsCFG_DB_SERVER, "%s", pTemp ); + break; + }; + case ST_DATABASE_USER:{ + gsCFG_DB_USER = (CSTR) malloc(strlen( pTemp )); + sprintf( gsCFG_DB_USER, "%s", pTemp ); + break; + }; + case ST_DATABASE_PASSWORD:{ + gsCFG_DB_PASSWORD = (CSTR) malloc(strlen( pTemp )); + sprintf( gsCFG_DB_PASSWORD, "%s", pTemp ); + break; + }; + case ST_DATABASE_NAME:{ + gsCFG_DB_NAME = (CSTR) malloc(strlen( pTemp )); + sprintf( gsCFG_DB_NAME, "%s", pTemp ); + break; + }; + case ST_SOCKET_NAME:{ + SSP_NAME = (CSTR) malloc(strlen( pTemp )); + sprintf( SSP_NAME, "%s", pTemp ); + break; + }; + }; + }; + fclose( pFile ); + } else { + NDC = true; + }; + }; + + + + if( NDC ){//Default config + gsCFG_LICENSE = (CSTR) "FRUCHT_DEMO_LICENSE"; + gsCFG_DB_SERVER = (CSTR) "localhost"; + gsCFG_ADDRESS = gsCFG_DB_SERVER; + gsCFG_DB_NAME = (CSTR) "tgdos"; + gsCFG_DB_USER = (CSTR) "tgdos"; + gsCFG_DB_PASSWORD = (CSTR) "NoGud4U@"; + }; + + + // Demonizing or not + if( WBG ){ + printf( "Dr Frucht Systems C-Server ver. %s\n", VERSION_NUMBER ); + printf( "Configuration Applied:\n"); + printf( " Service Established %s at %d\n", gsCFG_ADDRESS, guCFG_PORT ); + printf( " PID File: %s\n", gsCFG_PID_FILE ); + printf( " Log File: %s\n", FLE_NAME ); + printf( " License: %s\n", gsCFG_LICENSE ); + printf( " Database Server: %s Database: %s\n", gsCFG_DB_SERVER, gsCFG_DB_NAME ); + if( NDC ){ + printf( " No configuration file (%s) supplied.\n", DCF_NAME); + } else { + printf( " Configuration read from: %s\n", DCF_NAME ); + }; + + //Demonizing + pid_t pid, sid; + sync(); + close( STDIN_FILENO ); + close( STDOUT_FILENO ); + close( STDERR_FILENO ); + + pid = fork(); + if( pid < 0 ){ + return pid; + }; + if( pid > 0 ){ + return 0; + }; + //umask(0); + sid = setsid(); + if (sid < 0) { + return sid; + }; + + pid = fork(); + if( pid < 0 ){ + return pid; + }; + if( pid > 0 ){ + FILE *pPIDF = fopen( gsCFG_PID_FILE, "w+" ); + if( pPIDF ){ + fprintf( pPIDF, "%d\n", pid ); + fclose( pPIDF ); + } + return 0; + }; + }; + + + //Block Some Signals + //sigset_t signal_mask; + //sigfillset( &signal_mask ); + //sigaddset(&signal_mask, SIGUSR1); + //pthread_sigmask( SIG_BLOCK, &signal_mask, NULL ); + + // Clear to start Service + m_pLog = basicLogCollection::getInstance( _LOG_LVL_TIME_PTR ); + m_pLog->setLogLevel( _LOG_ERROR ); // Most Silent Mode + + if ( FLE ){// Init File Logging Engine + m_pLog->addHandler((basicLoggingService *) new objectFileLoggingService( FLE_NAME )); + }; + + if ( !WBG ){// Init Curses class to handle UI + //m_pLog->addHandler((_Core_Logging_Service *) new _Core_CLUI()); + }; + + SettingsProvider = basicSettingsProvider::getInstance( DCF_NAME ); + Settings = SettingsProvider->getSubNode( NULL, "GENERAL" ); + + uint8_t ExitCode = 0; + bool SSDP_ENABLE = false; + config_setting_t * pSetting = NULL; + + if(!config_setting_lookup_bool( Settings, "SSDP_ENABLE", (int*) &SSDP_ENABLE )){ + pSetting = config_setting_add( Settings, "SSDP_ENABLE", CONFIG_TYPE_BOOL ); + SSDP_ENABLE = true; + config_setting_set_bool( pSetting, SSDP_ENABLE ); + basicSettingsProvider::getInstance()->compromise(); + LOG("Manufacturer not set - using default"); + }; + + SettingsProvider->validate(); + + DBC = servaMySQLDBC::getInstance( Settings ); + + if( DBC ) { + if( !DBC->connect() ){ + delete( DBC ); + LOG_ERROR( "++++ DB ERROR ++++" ); + unlink( gsCFG_PID_FILE ); + LOG( "PID File Deleted" ); + delete( m_pLog ); + return -1; + }; + }; + + // Start Loop of Restarted Kernel + do{ + ExitCode = 0; + Kernel = servaKernel::getInstance( Settings );//HWManager ); + + if( Kernel == NULL ) { + // Aborting Work + LOG_ERROR( "++++ Kernel failed to born ++++" ); + unlink( gsCFG_PID_FILE ); + LOG( "PID File Deleted" ); + delete( m_pLog ); + return -1; + }; + //Loop till some Restart action + if( Kernel != NULL ){ + LOG( "++++ Server Started ++++" ); + if ( !Kernel->create( ) ){ + LOG_ERROR("Kernel create failure!"); + } else { + //Install Signal Listeners + old_kill_handler_15 = signal( 15, signal_kill_handler ); + old_kill_handler_9 = signal( 9, signal_kill_handler ); + // Waiting for Worker to Shut Down + Kernel->WaitFinish( false ); + ExitCode = Kernel->getExitCause(); + signal( 9, old_kill_handler_9 ); + signal( 15, old_kill_handler_15 ); + }; + delete( Kernel ); + LOG( "++++ Server Ended ++++" ); + }; + switch( ExitCode ){ + case EXIT_CODE_NO_DATABASE:{ + ExitCode = 0; + DBC = NULL; + break; + }; + case EXIT_CODE_RELOAD_SERVICES:{ + delete( DBC ); + + DBC = servaMySQLDBC::getInstance( Settings ); + + if( DBC ) { + if( !DBC->connect() ) ExitCode = 0; + + } else ExitCode = 0; + break; + }; + case EXIT_CODE_FACTORY_RESET:{ + ExitCode = 0; + break; + }; + }; + } while( ExitCode > 0 ); + + if ( DBC ){ + delete( DBC ); + LOG( "DBC Deleted" ); + }; + + unlink( gsCFG_PID_FILE ); + LOG( "PID File Deleted" ); + delete( m_pLog ); + return 0; +}; + +#undef LOG +#undef LOG_ERROR + diff --git a/lib/App/serva/servaBackend.h b/lib/App/serva/servaBackend.h new file mode 100644 index 00000000..2373ba11 --- /dev/null +++ b/lib/App/serva/servaBackend.h @@ -0,0 +1,31 @@ +//---------------------------------------------------------------------------- +// Dr.Frucht Systems Ltd. +// Copyright © 2000-2016. All Rights Reserved. +// Version 2.0 7/20/2017 +// Last modification: 7/20/2017 +// PROJECT: +// SUBSYSTEM: +// FILE: LRF_Server.h +// AUTHOR: gagua +// OVERVIEW +// ~~~~~~~~ +// Header file of LRF_Server.h +//---------------------------------------------------------------------------- +// +#ifndef __LA_SERVA_SERVER_HEADER__ +#define __LA_SERVA_SERVER_HEADER__ + +#include +#include +#include + +#include "../common/serverMySQL_dataBinder.h" + +#include "../../components/base/basicSettings.h" +#include "../../components/base/basicLogCollection.h" +#include "../../components/base/basicMemoryOperation.h" +#include "../../components/object/objectFileLoggingService.h" +#include "servaKernel.h" + + +#endif diff --git a/lib/App/serva/servaKernel.cpp b/lib/App/serva/servaKernel.cpp new file mode 100644 index 00000000..186e538f --- /dev/null +++ b/lib/App/serva/servaKernel.cpp @@ -0,0 +1,341 @@ +//---------------------------------------------------------------------------- +// Dr.Frucht Systems Ltd. +// Copyright © 2000-2022. All Rights Reserved. +// Version 1.0 11/19/2022 +// Last modification: 11/19/2022 +// PROJECT: +// SUBSYSTEM: +// FILE: mojoKernel.cpp +// AUTHOR: gagua +// OVERVIEW +// ~~~~~~~~ +// LRF_Kernel.cpp +//---------------------------------------------------------------------------- +// + +#include "servaKernel.h" +#include "../data/json/json_tool.h" +#include +#include +#include +#include +#include +#include + +#include "../common/kernelEventFilterAPF.h" +#include "../common/kernelEventFilterTrain.h" +#include "../common/kernelModuleEmbedVideo.h" + +#include "../common/serverMySQL_dataBinder.h" + + +#define LOG( X ) kernelPrototype::m_pLog->Log( "KRNL", this, X ) +#ifdef DEBUG + #define LOG_ERROR( X ) {\ + char _tBfrErrMSG234[256];\ + sprintf( _tBfrErrMSG234, "In file %s[%d] in func:%s %s",__FILE__, __LINE__, __func__, X );\ + kernelPrototype::m_pLog->Log( "KRNL", this, _LOG_ERROR, _tBfrErrMSG234 );\ + } +#else + #define LOG_ERROR( X ) kernelPrototype::m_pLog->Log( "KRNL", this, _LOG_ERROR, X ); +#endif + +servaKernel *servaKernel::_instance = NULL; + +servaKernel *servaKernel::getInstance( config_setting_t *ptr ){ + if ( _instance == NULL ) { + _instance = new servaKernel( ptr ); + }; + return _instance; +}; + +servaKernel::servaKernel( config_setting_t *ptr ):kernelPrototype( ptr ){ + //m_pEventHeap = basicEventHeap::getInstance(); + // memset( &m_sSysInfo, 0, sizeof( DBC_SYS_LOAD_INFO )); + //m_pShadow = NULL; + //m_pSystemAnchor = NULL; + // m_bSessionStarted = false; + // m_bWorkWithRemoteServer = false; + // m_bKeepLocalReport = true; + // m_bMediaMode = 0; + m_pLifeMonitor = servaLifeMonitoring::getInstance(); + setWM( WM_NONE ); +}; + + +servaKernel::~servaKernel(){ + WaitFinish( true ); + + //stopSession( false ); + + //while(1){ + // char tB[200]; + // sprintf( tB, "[%d] Seconds Till System Restart", timeout ); + // LOG( "BopBop!" ); + // SLEEP(1000); + //}; +#ifdef LINUX_KERNEL_WATCHDOG + LOG("Disable WD!"); + if( m_iWatchdogFd > -1 ) { + char tB[64]; + sprintf( tB, "-1\n" ); + //ToDo: Make Error Handling here! + write( m_iWatchdogFd, &tB, strlen( tB ) ); + }; + LOG("WatchDog turned Off!"); +#endif + _instance = NULL; +}; + +bool servaKernel::create(){ + if( m_pSettings != NULL ) { + config_setting_t * pSetting; + int tVal; + const char * tBuf; + char tBuffer[128]; + LOG("Getting Settings ..."); + /*if( !config_setting_lookup_string( m_pSettings, MOJO_KERNEL_TAG_SERVER_IDENTITY, &tBuf ) ){ + char * tVar; + char * tTS; + tTS = getTStr(NULL); + tVar = MD5String(tTS); + free(tTS); + sprintf( m_sIdentity, tVar ); + pSetting = config_setting_add( m_pSettings, MOJO_KERNEL_TAG_SERVER_IDENTITY, CONFIG_TYPE_STRING ); + config_setting_set_string( pSetting, tVar ); + free( tVar ); + basicSettingsProvider::getInstance()->compromise(); + LOG("Server Identity not defined - generating new!"); + } else { + sprintf( m_sIdentity, tBuf ); + sprintf( tBuffer, "Server Identity Read From Settings: %s", tBuf ); + LOG( tBuffer ); + }; + if( !config_setting_lookup_int( m_pSettings, MOJO_KERNEL_TAG_SITE_ID, &tVal ) ){ + tVal = m_nInstanceID = 1; + pSetting = config_setting_add( m_pSettings, MOJO_KERNEL_TAG_SITE_ID, CONFIG_TYPE_INT ); + config_setting_set_int( pSetting, tVal ); + basicSettingsProvider::getInstance()->compromise(); + LOG("Site ID not defined - using [1] as number!"); + } else { + m_nInstanceID = tVal; + sprintf( tBuffer, "App Instance ID Read From Settings: %d", m_nInstanceID ); + LOG( tBuffer ); + };*/ + basicSettingsProvider::getInstance()->validate(); + } else { + LOG_ERROR("Failed Read Config Settings!"); + return false; + }; + + LOG("Register Server ... "); + //m_pDBC->registerServer( m_nInstanceID, m_sIdentity, getpid(), &m_nServerID, &m_nServerNodeID ); + char tBuffer[128]; + //sprintf( tBuffer,"Server Registered as [%d] nodeID[%d]",m_nServerID, m_nServerNodeID ); + //LOG( tBuffer ); + + //DBC_SITE_DATA *tSiteData = m_pDBC->getSiteData( 1 ); + +// if( tSiteData ) { +// C3D_WGS84_LOC t; +// t.lat = tSiteData->lat; +// t.lon = tSiteData->lon; +// t.alt = tSiteData->alt; + //m_pSystemAnchor = systemAnchor::getInstance( tSiteData->SH, &t, tSiteData->local_binding ); + //memcpy( &m_sSiteData, tSiteData, sizeof( DBC_SITE_DATA )); + //free( tSiteData ); +// } else { +// LOG_ERROR("Error Loading Site DATA!"); + // C3D_WGS84_LOC t; + // t.lat = 0; + // t.lon = 0; + // t.alt = 0; + //memset( &m_sSiteData, 0, sizeof( DBC_SITE_DATA )); + //m_pSystemAnchor = systemAnchor::getInstance( false, &t, true ); + //}; + //Check date/Time if correct! + // On some systems the System Date may be in past cause last session was interrupted by power loose + /* + uint32_t tTS = m_pDBC->getLastEventTS(); + if ( tTS ) { + // Have last TS + struct timespec tS = { 0 }; + if( clock_gettime( CLOCK_REALTIME, &tS ) == 0 ){ + //time_t cTS = time(NULL); + if ( tTS > tS.tv_sec ) { + // System Time is in the Past + LOG("Correcting System Time!"); + tS.tv_sec = tTS; + tS.tv_nsec = tTS * 1000000; + if (clock_settime(CLOCK_REALTIME, &tS) != 0) LOG_ERROR("Time Correction Failed!"); + }; + }; + } +#ifdef DEBUG + else LOG("No Last TS fetched from DB!") +#endif + ; + + */ + + + //m_bDebugMode = m_pDBC->getAppDebugMode(); + + //m_bSessionStarted = m_pDBC->getEventSessionStatus( m_nServerNodeID ); + //stopSession( false ); + + return init(); +}; + +void servaKernel::m_fThreadProc( void ){ + time_t tTimeTSeconds = 0; + time_t cTimeTSeconds = 0; + m_bThreadStatus = TH_WORKING; + LOG("Mojo Started!"); + while ( m_bThreadStatus < TH_ENDED ) { + cTimeTSeconds = time( NULL ); + //Each Second + if( cTimeTSeconds != tTimeTSeconds ){ + tTimeTSeconds = cTimeTSeconds; +#ifdef LINUX_KERNEL_WATCHDOG + if( m_iWatchdogFd > -1 ) { + char tB[64]; + sprintf( tB, "2000\n" ); + //ToDo: Make Error Handling here! + write( m_iWatchdogFd, &tB, strlen( tB ) ); + }; +#endif + //m_pHardwareManager->updateSysInfo( &m_sSysInfo ); + DBC_PUSHED_CMD * tCMD = NULL;//m_pDBC->getNodePushedCMD( 0 ); //Kernel + if( tCMD != NULL ) { + //m_pDBC->updateNodePushedCMD( tCMD->id, DBC_CMD_STARTED ); + switch( tCMD->CMD ){ + case CMD_KRNL_RELOAD:{ + LOG("Reload Mojo Node!"); + m_bThreadStatus = TH_ENDED; + setExitCause( EXIT_CODE_RELOAD_SERVICES ); + break; + }; + case CMD_KRNL_RESTART:{ + LOG("Restart Mojo Node!"); + m_bThreadStatus = TH_ENDED; + setExitCause( EXIT_CODE_KERNEL_CLEAR ); + break; + }; + case CMD_KRNL_FACTORY_RESET:{ + LOG("Restart Mojo -> 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; + }; + }; + free( tCMD ); + }; + //if ( m_pDBC ) m_pDBC->cleanNodePushedCMD(); + }; + SLEEP(SLEEP_KERNEL_INTERVAL); + }; +}; + +#undef LOG +#undef LOG_ERROR diff --git a/lib/App/serva/servaKernel.h b/lib/App/serva/servaKernel.h new file mode 100644 index 00000000..7e38100b --- /dev/null +++ b/lib/App/serva/servaKernel.h @@ -0,0 +1,59 @@ +//---------------------------------------------------------------------------- +// Dr.Frucht Systems Ltd. +// Copyright © 2000-2022. All Rights Reserved. +// Version 1.0 11/19/2022 +// Last modification: 11/19/2022 +// PROJECT: +// SUBSYSTEM: +// FILE: mojoKernel.h +// AUTHOR: gagua +// OVERVIEW +// ~~~~~~~~ +// Header file of mojoKernel.cpp +//---------------------------------------------------------------------------- +// + +#ifndef __MOJO_KERNEL_H_INCL__ +#define __MOJO_KERNEL_H_INCL__ + +#define LA_METRO 1 +#define MER_INC 2 + +#define NOTARGET_SESSION_CLOSE 300 //sec + +#include "../../components/base/basicThread.h" +#include "../../components/base/basicSettingsProvider.h" +#include "../../components/base/basicEventHeap.h" +#include "../../components/object/objectSystemAnchor.h" +#include "../../alg/lgs/detectorStructures.h" +#include "../../alg/lgs/detector.h" +#include "../../alg/lgs/mask.h" +#include "../../alg/generic/md5.h" + +#include "../common/kernelPrototype.h" +#include "lifeMonitoring.h" + +#define MAX_CYCLE_COUNTER_VALUE 0xFFFFFFFF; +#define SLEEP_KERNEL_INTERVAL 10 // 10 millisecond +#define TIME_SYNC_INTERVAL 900000 // 15 minute(s) in 1 millisecond units +#define STATUS_OK_INTERVAL 2000 // 2 Sec in 1 millisecond units + + +class servaKernel: public kernelPrototype{ + private: + static servaKernel * _instance; + servaLifeMonitoring * m_pLifeMonitor; + protected: + virtual void m_fThreadProc( void ); + // Constructor + explicit servaKernel( config_setting_t *ptr ); + public: + static servaKernel * getInstance( config_setting_t *ptr = NULL ); + // Destructor + virtual ~servaKernel(); + virtual bool create(); + // Functionality (implementatio in servaKernelToolKit.cpp ) + bool registerMojo(); +}; + +#endif // __MOJJO_KERNEL_H_INCL__ diff --git a/lib/App/serva/servaKernelToolKit.cpp b/lib/App/serva/servaKernelToolKit.cpp new file mode 100644 index 00000000..a6518097 --- /dev/null +++ b/lib/App/serva/servaKernelToolKit.cpp @@ -0,0 +1,7 @@ +#include "servaKernel.h" + + + +bool servaKernel::registerMojo(){ + return true; +}; diff --git a/lib/data/protocol/protocolARGUS.cpp b/lib/data/protocol/protocolARGUS.cpp new file mode 100644 index 00000000..bccf31c2 --- /dev/null +++ b/lib/data/protocol/protocolARGUS.cpp @@ -0,0 +1,10 @@ +#include "protocolARGUS.h" + +protocolARGUS::protocolARGUS():protocolParser(){ + +}; + +protocolARGUS::~protocolARGUS(){ + +}; + diff --git a/lib/data/protocol/protocolARGUS.h b/lib/data/protocol/protocolARGUS.h new file mode 100644 index 00000000..f57042df --- /dev/null +++ b/lib/data/protocol/protocolARGUS.h @@ -0,0 +1,16 @@ +#ifndef __ARGUS_DATA_PROTOCOL_ARGUS_HEADER__ +#define __ARGUS_DATA_PROTOCOL_ARGUS_HEADER__ + +#include "protocol.h" +#include "protocolARGUS_DATA.h" + +class protocolARGUS:public protocolParser{ + private: + public: + protocolARGUS(); + ~protocolARGUS(); + +}; + + +#endif diff --git a/lib/data/protocol/protocolARGUS_DATA.h b/lib/data/protocol/protocolARGUS_DATA.h new file mode 100644 index 00000000..5207b63b --- /dev/null +++ b/lib/data/protocol/protocolARGUS_DATA.h @@ -0,0 +1,18 @@ +#ifndef __ARGUS_REMOTE_NETWORK_CONNECTOR_DATA__ +#define __ARGUS_REMOTE_NETWORK_CONNECTOR_DATA__ + + + +#define ARGUS_START_SERVER_FLAG 0x55 +#define ARGUS_START_CLIENT_FLAG 0x88 +#define ARGUS_HEADER_SIZE 5 +//Proto uses CRC16 +#define ARGUS_CHECKSUM_SIZE 2 + +typedef struct S_ARGUS_DATA_HEADER{ + uint8_t START_FLAG; + uint32_t SIZE; +}ARGUS_DATA_HEADER; + + +#endif \ No newline at end of file