35 changed files with 2853 additions and 260 deletions
-
4.gitignore
-
1Linux_Workspace.vpw
-
2Projects/la_mojo/build
-
8Projects/la_mojo/la_mojo.vpj
-
279Projects/la_mojo/makefile
-
14Projects/la_serva/build
-
569Projects/la_serva/la_serva.vpj
-
430Projects/la_serva/makefile
-
4Projects/starProcDaemon/kernel.cpp
-
13Projects/starProcDaemon/starProcDaemon.cpp
-
16Projects/watchDogDaemon/watchDogDaemon.cpp
-
16lib/App/common/SQLite_dataBinder.cpp
-
12lib/App/common/dataBinder_structures.h
-
25lib/App/common/kernelPrototype.cpp
-
23lib/App/common/kernelPrototype.h
-
3lib/App/common/serverDataBinder.cpp
-
21lib/App/common/serverDataBinder.h
-
238lib/App/common/serverMySQL_dataBinder.cpp
-
39lib/App/common/serverMySQL_dataBinder.h
-
226lib/App/mojo/mojoKernel.cpp
-
7lib/App/mojo/mojoKernel.h
-
68lib/App/mojo/mojoRemoteClient.cpp
-
27lib/App/mojo/mojoRemoteClient.h
-
16lib/App/serva/lifeMonitoring.cpp
-
15lib/App/serva/lifeMonitoring.h
-
21lib/App/serva/objectMySQLLoggingService.cpp
-
57lib/App/serva/objectMySQLLoggingService.h
-
477lib/App/serva/servaBackend.cpp
-
31lib/App/serva/servaBackend.h
-
341lib/App/serva/servaKernel.cpp
-
59lib/App/serva/servaKernel.h
-
7lib/App/serva/servaKernelToolKit.cpp
-
10lib/data/protocol/protocolARGUS.cpp
-
16lib/data/protocol/protocolARGUS.h
-
18lib/data/protocol/protocolARGUS_DATA.h
@ -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 .. |
|||
@ -0,0 +1,569 @@ |
|||
<!DOCTYPE Project SYSTEM "http://www.slickedit.com/dtd/vse/10.0/vpj.dtd"> |
|||
<Project |
|||
Version="10.0" |
|||
VendorName="SlickEdit" |
|||
TemplateName="GNU C/C++" |
|||
WorkingDir="." |
|||
BuildSystem="automakefile" |
|||
BuildMakeFile="makefile" |
|||
VCSProject="Git:"> |
|||
<Config |
|||
Name="Debug" |
|||
Type="gnuc" |
|||
DebugCallbackName="gdb" |
|||
Version="1" |
|||
OutputFile="%bdserva_d" |
|||
CompilerConfigName="Latest Version" |
|||
Defines='"/DDEBUG" "/DUSE_MYSQL" "/D__STDC_CONSTANT_MACROS__" "/D_CLIENT_APPLICATION_" "/D_OPENCV_" "/DRASPI_HARDWARE"'> |
|||
<Menu> |
|||
<Target |
|||
Name="Compile" |
|||
MenuCaption="&Compile" |
|||
Dialog="_gnuc_options_form Compile" |
|||
CaptureOutputWith="ProcessBuffer" |
|||
Deletable="0" |
|||
OutputExts="*.o" |
|||
SaveOption="SaveCurrent" |
|||
RunFromDir="%rw"> |
|||
<Exec |
|||
CmdLine='g++ -c %xup -x c++ %defd -O0 -w -Wpointer-arith %~other -o "%bd%n%oe" %i %f' |
|||
OtherOptions="-std=c++11 -Wno-write-strings -I../../lib/include `pkg-config opencv4 libavcodec libavdevice libavfilter libavformat libavutil libpostproc libswresample libswscale live555 --cflags`"/> |
|||
</Target> |
|||
<Target |
|||
Name="Link" |
|||
MenuCaption="&Link" |
|||
ShowOnMenu="Never" |
|||
Dialog="_gnuc_options_form Link" |
|||
CaptureOutputWith="ProcessBuffer" |
|||
Deletable="0" |
|||
SaveOption="SaveCurrent" |
|||
RunFromDir="%rw"> |
|||
<Exec CmdLine='g++ %xup -O0 -w -o "%o" %objs'/> |
|||
</Target> |
|||
<Target |
|||
Name="Build" |
|||
MenuCaption="&Build" |
|||
CaptureOutputWith="ProcessBuffer" |
|||
Deletable="0" |
|||
SaveOption="SaveWorkspaceFiles" |
|||
RunFromDir="%rw"> |
|||
<Exec CmdLine='make -f "makefile" CFG=%b'/> |
|||
</Target> |
|||
<Target |
|||
Name="Rebuild" |
|||
MenuCaption="&Rebuild" |
|||
CaptureOutputWith="ProcessBuffer" |
|||
Deletable="0" |
|||
SaveOption="SaveWorkspaceFiles" |
|||
RunFromDir="%rw"> |
|||
<Exec CmdLine='make -f "makefile" rebuild CFG=%b'/> |
|||
</Target> |
|||
<Target |
|||
Name="Debug" |
|||
MenuCaption="&Debug" |
|||
Dialog="_gnuc_options_form Run/Debug" |
|||
BuildFirst="1" |
|||
CaptureOutputWith="ProcessBuffer" |
|||
Deletable="0" |
|||
SaveOption="SaveNone" |
|||
RunFromDir="%rw"> |
|||
<Exec CmdLine='vsdebugio -prog "%o"'/> |
|||
</Target> |
|||
<Target |
|||
Name="Execute" |
|||
MenuCaption="E&xecute" |
|||
Dialog="_gnuc_options_form Run/Debug" |
|||
BuildFirst="1" |
|||
CaptureOutputWith="ProcessBuffer" |
|||
Deletable="0" |
|||
SaveOption="SaveWorkspaceFiles" |
|||
RunFromDir="%rw"> |
|||
<Exec CmdLine='"%o"'/> |
|||
</Target> |
|||
<Target |
|||
Name="dash" |
|||
MenuCaption="-" |
|||
Deletable="0"> |
|||
<Exec/> |
|||
</Target> |
|||
<Target |
|||
Name="GNU C Options" |
|||
MenuCaption="GNU C &Options..." |
|||
ShowOnMenu="HideIfNoCmdLine" |
|||
Deletable="0" |
|||
SaveOption="SaveNone"> |
|||
<Exec |
|||
CmdLine="gnucoptions" |
|||
Type="Slick-C"/> |
|||
</Target> |
|||
</Menu> |
|||
<List Name="GNUC Options"> |
|||
<Item |
|||
Name="LinkerOutputType" |
|||
Value="Executable"/> |
|||
</List> |
|||
<Includes></Includes> |
|||
<Libs PreObjects="0"> |
|||
<Lib File="-lsqlite3"/> |
|||
<Lib File="-lpthread"/> |
|||
<Lib File="-lmysqlclient"/> |
|||
<Lib File="-lssl"/> |
|||
<Lib File="-lcurl"/> |
|||
<Lib File="-lm"/> |
|||
<Lib File="-lcrypto"/> |
|||
<Lib File="-lconfig"/> |
|||
<Lib File="-lz"/> |
|||
<Lib File="-lv4l1"/> |
|||
<Lib File="-lv4l2"/> |
|||
<Lib File="-lhidapi-libusb"/> |
|||
<Lib File="`pkg-config"/> |
|||
<Lib File="libavcodec"/> |
|||
<Lib File="libavdevice"/> |
|||
<Lib File="libavfilter"/> |
|||
<Lib File="libavformat"/> |
|||
<Lib File="libavutil"/> |
|||
<Lib File="libpostproc"/> |
|||
<Lib File="libswresample"/> |
|||
<Lib File="libswscale"/> |
|||
<Lib File="--libs`"/> |
|||
<Lib File="-latomic"/> |
|||
<Lib File="`pkg-config"/> |
|||
<Lib File="--libs"/> |
|||
<Lib File="openssl"/> |
|||
<Lib File="opencv4"/> |
|||
<Lib File="rdkafka++`"/> |
|||
<Lib File="-lwiringx"/> |
|||
<Lib File="-lliveMedia"/> |
|||
<Lib File="-lgroupsock"/> |
|||
<Lib File="-lBasicUsageEnvironment"/> |
|||
<Lib File="-lUsageEnvironment"/> |
|||
</Libs> |
|||
</Config> |
|||
<Config |
|||
Name="Release" |
|||
Type="gnuc" |
|||
DebugCallbackName="gdb" |
|||
Version="1" |
|||
OutputFile="%bdserva" |
|||
CompilerConfigName="Latest Version" |
|||
Defines='"/DUSE_MYSQL" "/DSLIM_KERNEL" "/D_THREAD_SAFE" "/D_BSD_SOURCE" "/D_REENTRANT"'> |
|||
<Menu> |
|||
<Target |
|||
Name="Compile" |
|||
MenuCaption="&Compile" |
|||
Dialog="_gnuc_options_form Compile" |
|||
CaptureOutputWith="ProcessBuffer" |
|||
Deletable="0" |
|||
OutputExts="*.o" |
|||
SaveOption="SaveCurrent" |
|||
RunFromDir="%rw"> |
|||
<Exec |
|||
CmdLine='g++ -c %xup -x c++ %defd -O3 -w -Wpointer-arith %~other -o "%bd%n%oe" %i %f' |
|||
OtherOptions="-std=gnu++11 -I../../lib/include"/> |
|||
</Target> |
|||
<Target |
|||
Name="Link" |
|||
MenuCaption="&Link" |
|||
ShowOnMenu="Never" |
|||
Dialog="_gnuc_options_form Link" |
|||
CaptureOutputWith="ProcessBuffer" |
|||
Deletable="0" |
|||
SaveOption="SaveCurrent" |
|||
RunFromDir="%rw"> |
|||
<Exec |
|||
CmdLine='g++ %xup -O3 -w %~other -o "%o" %objs' |
|||
OtherOptions="-lconfig -lpthread -lmysqlclient -lelf -lcurses -lcdk -lcurl `pkg-config --libs rdkafka++` -lwiringx -lsqlite3 -s"/> |
|||
</Target> |
|||
<Target |
|||
Name="Build" |
|||
MenuCaption="&Build" |
|||
CaptureOutputWith="ProcessBuffer" |
|||
Deletable="0" |
|||
SaveOption="SaveWorkspaceFiles" |
|||
RunFromDir="%rw"> |
|||
<Exec CmdLine='make -f "makefile" CFG=%b'/> |
|||
</Target> |
|||
<Target |
|||
Name="Rebuild" |
|||
MenuCaption="&Rebuild" |
|||
CaptureOutputWith="ProcessBuffer" |
|||
Deletable="0" |
|||
SaveOption="SaveWorkspaceFiles" |
|||
RunFromDir="%rw"> |
|||
<Exec CmdLine='make -f "makefile" rebuild CFG=%b'/> |
|||
</Target> |
|||
<Target |
|||
Name="Debug" |
|||
MenuCaption="&Debug" |
|||
Dialog="_gnuc_options_form Run/Debug" |
|||
BuildFirst="1" |
|||
CaptureOutputWith="ProcessBuffer" |
|||
Deletable="0" |
|||
SaveOption="SaveNone" |
|||
RunFromDir="%rw"> |
|||
<Exec CmdLine='vsdebugio -prog "%o"'/> |
|||
</Target> |
|||
<Target |
|||
Name="Execute" |
|||
MenuCaption="E&xecute" |
|||
Dialog="_gnuc_options_form Run/Debug" |
|||
BuildFirst="1" |
|||
CaptureOutputWith="ProcessBuffer" |
|||
Deletable="0" |
|||
SaveOption="SaveWorkspaceFiles" |
|||
RunFromDir="%rw"> |
|||
<Exec CmdLine='"%o"'/> |
|||
</Target> |
|||
<Target |
|||
Name="dash" |
|||
MenuCaption="-" |
|||
Deletable="0"> |
|||
<Exec/> |
|||
</Target> |
|||
<Target |
|||
Name="GNU C Options" |
|||
MenuCaption="GNU C &Options..." |
|||
ShowOnMenu="HideIfNoCmdLine" |
|||
Deletable="0" |
|||
SaveOption="SaveNone"> |
|||
<Exec |
|||
CmdLine="gnucoptions" |
|||
Type="Slick-C"/> |
|||
</Target> |
|||
</Menu> |
|||
<List Name="GNUC Options"> |
|||
<Item |
|||
Name="LinkerOutputType" |
|||
Value="Executable"/> |
|||
</List> |
|||
<Includes></Includes> |
|||
<Libs PreObjects="0"/> |
|||
</Config> |
|||
<Config |
|||
Name="Debug86" |
|||
Type="gnuc" |
|||
DebugCallbackName="gdb" |
|||
Version="1" |
|||
OutputFile="%bdserva_d" |
|||
CompilerConfigName="Latest Version" |
|||
Defines='"/DDEBUG" "/DUSE_SERVER_MYSQL" "/D__STDC_CONSTANT_MACROS" "/D_CLIENT_APPLICATION_" "/D_OPENCV_"'> |
|||
<Menu> |
|||
<Target |
|||
Name="Compile" |
|||
MenuCaption="&Compile" |
|||
Dialog="_gnuc_options_form Compile" |
|||
CaptureOutputWith="ProcessBuffer" |
|||
Deletable="0" |
|||
OutputExts="*.o" |
|||
SaveOption="SaveCurrent" |
|||
RunFromDir="%rw"> |
|||
<Exec |
|||
CmdLine='g++ -c %xup -x c++ %defd -O0 -w -Wpointer-arith %~other -o "%bd%n%oe" %i %f' |
|||
OtherOptions="-std=c++11 -Wno-write-strings -I../../lib/include `pkg-config opencv4 libavcodec libavdevice libavfilter libavformat libavutil libpostproc libswresample libswscale live555 --cflags`"/> |
|||
</Target> |
|||
<Target |
|||
Name="Link" |
|||
MenuCaption="&Link" |
|||
ShowOnMenu="Never" |
|||
Dialog="_gnuc_options_form Link" |
|||
CaptureOutputWith="ProcessBuffer" |
|||
Deletable="0" |
|||
SaveOption="SaveCurrent" |
|||
RunFromDir="%rw"> |
|||
<Exec CmdLine='g++ %xup -O0 -w -o "%o" %objs'/> |
|||
</Target> |
|||
<Target |
|||
Name="Build" |
|||
MenuCaption="&Build" |
|||
CaptureOutputWith="ProcessBuffer" |
|||
Deletable="0" |
|||
SaveOption="SaveWorkspaceFiles" |
|||
RunFromDir="%rw"> |
|||
<Exec CmdLine='make -f "makefile" CFG=%b'/> |
|||
</Target> |
|||
<Target |
|||
Name="Rebuild" |
|||
MenuCaption="&Rebuild" |
|||
CaptureOutputWith="ProcessBuffer" |
|||
Deletable="0" |
|||
SaveOption="SaveWorkspaceFiles" |
|||
RunFromDir="%rw"> |
|||
<Exec CmdLine='make -f "makefile" rebuild CFG=%b'/> |
|||
</Target> |
|||
<Target |
|||
Name="Debug" |
|||
MenuCaption="&Debug" |
|||
Dialog="_gnuc_options_form Run/Debug" |
|||
BuildFirst="1" |
|||
CaptureOutputWith="ProcessBuffer" |
|||
Deletable="0" |
|||
SaveOption="SaveNone" |
|||
RunFromDir="%rw"> |
|||
<Exec CmdLine='vsdebugio -prog "%o"'/> |
|||
</Target> |
|||
<Target |
|||
Name="Execute" |
|||
MenuCaption="E&xecute" |
|||
Dialog="_gnuc_options_form Run/Debug" |
|||
BuildFirst="1" |
|||
CaptureOutputWith="ProcessBuffer" |
|||
Deletable="0" |
|||
SaveOption="SaveWorkspaceFiles" |
|||
RunFromDir="%rw"> |
|||
<Exec CmdLine='"%o"'/> |
|||
</Target> |
|||
<Target |
|||
Name="dash" |
|||
MenuCaption="-" |
|||
Deletable="0"> |
|||
<Exec/> |
|||
</Target> |
|||
<Target |
|||
Name="GNU C Options" |
|||
MenuCaption="GNU C &Options..." |
|||
ShowOnMenu="HideIfNoCmdLine" |
|||
Deletable="0" |
|||
SaveOption="SaveNone"> |
|||
<Exec |
|||
CmdLine="gnucoptions" |
|||
Type="Slick-C"/> |
|||
</Target> |
|||
</Menu> |
|||
<List Name="GNUC Options"> |
|||
<Item |
|||
Name="LinkerOutputType" |
|||
Value="Executable"/> |
|||
</List> |
|||
<Includes></Includes> |
|||
<Libs PreObjects="0"> |
|||
<Lib File="-lsqlite3"/> |
|||
<Lib File="-lpthread"/> |
|||
<Lib File="-lmysqlclient"/> |
|||
<Lib File="-lssl"/> |
|||
<Lib File="-lcurl"/> |
|||
<Lib File="-lm"/> |
|||
<Lib File="-lcrypto"/> |
|||
<Lib File="-lconfig"/> |
|||
<Lib File="-lz"/> |
|||
<Lib File="-lv4l1"/> |
|||
<Lib File="-lv4l2"/> |
|||
<Lib File="-lhidapi-libusb"/> |
|||
<Lib File="`pkg-config"/> |
|||
<Lib File="libavcodec"/> |
|||
<Lib File="libavdevice"/> |
|||
<Lib File="libavfilter"/> |
|||
<Lib File="libavformat"/> |
|||
<Lib File="libavutil"/> |
|||
<Lib File="libpostproc"/> |
|||
<Lib File="libswresample"/> |
|||
<Lib File="libswscale"/> |
|||
<Lib File="--libs`"/> |
|||
<Lib File="-latomic"/> |
|||
<Lib File="`pkg-config"/> |
|||
<Lib File="--libs"/> |
|||
<Lib File="openssl"/> |
|||
<Lib File="opencv4"/> |
|||
<Lib File="rdkafka++`"/> |
|||
<Lib File="-lliveMedia"/> |
|||
<Lib File="-lgroupsock"/> |
|||
<Lib File="-lBasicUsageEnvironment"/> |
|||
<Lib File="-lUsageEnvironment"/> |
|||
</Libs> |
|||
</Config> |
|||
<Config |
|||
Name="Release86" |
|||
Type="gnuc" |
|||
DebugCallbackName="gdb" |
|||
Version="1" |
|||
OutputFile="%bdserva" |
|||
CompilerConfigName="Latest Version" |
|||
Defines='"/DUSE_SERVER_MYSQL" "/D__STDC_CONSTANT_MACROS" "/D_CLIENT_APPLICATION_" "/D_OPENCV_"'> |
|||
<Menu> |
|||
<Target |
|||
Name="Compile" |
|||
MenuCaption="&Compile" |
|||
Dialog="_gnuc_options_form Compile" |
|||
CaptureOutputWith="ProcessBuffer" |
|||
Deletable="0" |
|||
OutputExts="*.o" |
|||
SaveOption="SaveCurrent" |
|||
RunFromDir="%rw"> |
|||
<Exec |
|||
CmdLine='g++ -c %xup -x c++ %defd -O3 -w -Wpointer-arith %~other -o "%bd%n%oe" %i %f' |
|||
OtherOptions="-std=c++11 -Wno-write-strings -I../../lib/include `pkg-config opencv4 libavcodec libavdevice libavfilter libavformat libavutil libpostproc libswresample libswscale live555 --cflags`"/> |
|||
</Target> |
|||
<Target |
|||
Name="Link" |
|||
MenuCaption="&Link" |
|||
ShowOnMenu="Never" |
|||
Dialog="_gnuc_options_form Link" |
|||
CaptureOutputWith="ProcessBuffer" |
|||
Deletable="0" |
|||
SaveOption="SaveCurrent" |
|||
RunFromDir="%rw"> |
|||
<Exec CmdLine='g++ %xup -O3 -w -o "%o" %objs'/> |
|||
</Target> |
|||
<Target |
|||
Name="Build" |
|||
MenuCaption="&Build" |
|||
CaptureOutputWith="ProcessBuffer" |
|||
Deletable="0" |
|||
SaveOption="SaveWorkspaceFiles" |
|||
RunFromDir="%rw"> |
|||
<Exec CmdLine='make -f "makefile" CFG=%b'/> |
|||
</Target> |
|||
<Target |
|||
Name="Rebuild" |
|||
MenuCaption="&Rebuild" |
|||
CaptureOutputWith="ProcessBuffer" |
|||
Deletable="0" |
|||
SaveOption="SaveWorkspaceFiles" |
|||
RunFromDir="%rw"> |
|||
<Exec CmdLine='make -f "makefile" rebuild CFG=%b'/> |
|||
</Target> |
|||
<Target |
|||
Name="Debug" |
|||
MenuCaption="&Debug" |
|||
Dialog="_gnuc_options_form Run/Debug" |
|||
BuildFirst="1" |
|||
CaptureOutputWith="ProcessBuffer" |
|||
Deletable="0" |
|||
SaveOption="SaveNone" |
|||
RunFromDir="%rw"> |
|||
<Exec CmdLine='vsdebugio -prog "%o"'/> |
|||
</Target> |
|||
<Target |
|||
Name="Execute" |
|||
MenuCaption="E&xecute" |
|||
Dialog="_gnuc_options_form Run/Debug" |
|||
BuildFirst="1" |
|||
CaptureOutputWith="ProcessBuffer" |
|||
Deletable="0" |
|||
SaveOption="SaveWorkspaceFiles" |
|||
RunFromDir="%rw"> |
|||
<Exec CmdLine='"%o"'/> |
|||
</Target> |
|||
<Target |
|||
Name="dash" |
|||
MenuCaption="-" |
|||
Deletable="0"> |
|||
<Exec/> |
|||
</Target> |
|||
<Target |
|||
Name="GNU C Options" |
|||
MenuCaption="GNU C &Options..." |
|||
ShowOnMenu="HideIfNoCmdLine" |
|||
Deletable="0" |
|||
SaveOption="SaveNone"> |
|||
<Exec |
|||
CmdLine="gnucoptions" |
|||
Type="Slick-C"/> |
|||
</Target> |
|||
</Menu> |
|||
<List Name="GNUC Options"> |
|||
<Item |
|||
Name="LinkerOutputType" |
|||
Value="Executable"/> |
|||
</List> |
|||
<Includes></Includes> |
|||
<Libs PreObjects="0"> |
|||
<Lib File="-lsqlite3"/> |
|||
<Lib File="-lpthread"/> |
|||
<Lib File="-lmysqlclient"/> |
|||
<Lib File="-lssl"/> |
|||
<Lib File="-lcurl"/> |
|||
<Lib File="-lm"/> |
|||
<Lib File="-lcrypto"/> |
|||
<Lib File="-lconfig"/> |
|||
<Lib File="-lz"/> |
|||
<Lib File="-lv4l1"/> |
|||
<Lib File="-lv4l2"/> |
|||
<Lib File="-lhidapi-libusb"/> |
|||
<Lib File="`pkg-config"/> |
|||
<Lib File="libavcodec"/> |
|||
<Lib File="libavdevice"/> |
|||
<Lib File="libavfilter"/> |
|||
<Lib File="libavformat"/> |
|||
<Lib File="libavutil"/> |
|||
<Lib File="libpostproc"/> |
|||
<Lib File="libswresample"/> |
|||
<Lib File="libswscale"/> |
|||
<Lib File="--libs`"/> |
|||
<Lib File="-latomic"/> |
|||
<Lib File="`pkg-config"/> |
|||
<Lib File="--libs"/> |
|||
<Lib File="openssl"/> |
|||
<Lib File="opencv4"/> |
|||
<Lib File="rdkafka++`"/> |
|||
<Lib File="-lliveMedia"/> |
|||
<Lib File="-lgroupsock"/> |
|||
<Lib File="-lBasicUsageEnvironment"/> |
|||
<Lib File="-lUsageEnvironment"/> |
|||
</Libs> |
|||
</Config> |
|||
<Files> |
|||
<Folder |
|||
Name="Source Files" |
|||
Filters="*.c;*.C;*.cc;*.cpp;*.cp;*.cxx;*.c++;*.prg;*.pas;*.dpr;*.asm;*.s;*.bas;*.java;*.cs;*.sc;*.e;*.cob;*.html;*.rc;*.tcl;*.py;*.pl;*.d" |
|||
GUID="{502FD7D9-3DD6-4F47-A8F2-7805FC79B3AA}"> |
|||
<F N="../../lib/components/base/basicEngine.cpp"/> |
|||
<F N="../../lib/components/base/basicEvent.cpp"/> |
|||
<F N="../../lib/components/base/basicEventHandler.cpp"/> |
|||
<F N="../../lib/components/base/basicEventHeap.cpp"/> |
|||
<F N="../../lib/components/base/basicFunctionality.cpp"/> |
|||
<F N="../../lib/components/base/basicLogCollection.cpp"/> |
|||
<F N="../../lib/components/base/basicLoggingService.cpp"/> |
|||
<F N="../../lib/components/base/basicMutex.cpp"/> |
|||
<F N="../../lib/components/base/basicObject.cpp"/> |
|||
<F N="../../lib/components/base/basicRing.cpp"/> |
|||
<F N="../../lib/components/base/basicSettings.cpp"/> |
|||
<F N="../../lib/components/base/basicSettingsProvider.cpp"/> |
|||
<F N="../../lib/components/base/basicThread.cpp"/> |
|||
<F N="../../lib/data/json/json_reader.cpp"/> |
|||
<F N="../../lib/data/json/json_value.cpp"/> |
|||
<F N="../../lib/data/json/json_writer.cpp"/> |
|||
<F N="../../lib/App/common/kernelPrototype.cpp"/> |
|||
<F N="../../lib/App/serva/lifeMonitoring.cpp"/> |
|||
<F N="../../lib/alg/generic/md5.cpp"/> |
|||
<F N="../../lib/data/mysql/mysql_class.cpp"/> |
|||
<F N="../../lib/components/object/objectFileLoggingService.cpp"/> |
|||
<F N="../../lib/App/serva/objectMySQLLoggingService.cpp"/> |
|||
<F N="../../lib/App/serva/servaBackend.cpp"/> |
|||
<F N="../../lib/App/serva/servaKernel.cpp"/> |
|||
<F N="../../lib/App/serva/servaKernelToolKit.cpp"/> |
|||
<F N="../../lib/App/common/serverDataBinder.cpp"/> |
|||
<F N="../../lib/App/common/serverMySQL_dataBinder.cpp"/> |
|||
<F N="../../lib/alg/generic/Transform.cpp"/> |
|||
<F N="../../lib/alg/generic/utm.cpp"/> |
|||
</Folder> |
|||
<Folder |
|||
Name="Header Files" |
|||
Filters="*.h;*.H;*.hh;*.hpp;*.hxx;*.inc;*.sh;*.cpy;*.if" |
|||
GUID="{AC1A2E44-6BBF-481F-81E4-5466FA3801D3}"> |
|||
<F N="../../lib/App/serva/lifeMonitoring.h"/> |
|||
<F N="../../lib/App/serva/objectMySQLLoggingService.h"/> |
|||
<F N="../../lib/App/serva/servaBackend.h"/> |
|||
<F N="../../lib/App/serva/servaKernel.h"/> |
|||
<F N="../../lib/App/common/serverDataBinder.h"/> |
|||
<F N="../../lib/App/common/serverMySQL_dataBinder.h"/> |
|||
</Folder> |
|||
<Folder |
|||
Name="Resource Files" |
|||
Filters="*.ico;*.cur;*.dlg" |
|||
GUID="{8BD78378-5860-4905-AF1A-33114B24439C}"/> |
|||
<Folder |
|||
Name="Bitmaps" |
|||
Filters="*.bmp" |
|||
GUID="{6D406F40-545E-41FC-BD64-2DB7171E51C3}"/> |
|||
<Folder |
|||
Name="Other Files" |
|||
Filters="" |
|||
GUID="{26D67376-8D5A-4FD5-8D31-C3A5719A77AA}"> |
|||
<F |
|||
N="makefile" |
|||
Type="Makefile"/> |
|||
</Folder> |
|||
</Files> |
|||
<List Name="RTE"> |
|||
</List> |
|||
</Project> |
|||
@ -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 |
|||
@ -0,0 +1,3 @@ |
|||
#include "serverDataBinder.h"
|
|||
serverDataBinder::serverDataBinder(){}; |
|||
serverDataBinder::~serverDataBinder(){}; |
|||
@ -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 |
|||
@ -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
|
|||
|
|||
@ -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 |
|||
@ -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
|
|||
@ -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 |
|||
@ -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(){ |
|||
}; |
|||
@ -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 |
|||
@ -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 ); |
|||
}; |
|||
@ -0,0 +1,57 @@ |
|||
#ifndef __OBJECTMYSQLLOGGINGSERVICE_H_INCL__ |
|||
#define __OBJECTMYSQLLOGGINGSERVICE_H_INCL__ |
|||
|
|||
#include <time.h> |
|||
#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__ |
|||
@ -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
|
|||
|
|||
@ -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 <stdlib.h> |
|||
#include <stdio.h> |
|||
#include <signal.h> |
|||
|
|||
#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 |
|||
@ -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 <strings.h>
|
|||
#include <sys/time.h>
|
|||
#include <time.h>
|
|||
#include <json/value.h>
|
|||
#include <json/writer.h>
|
|||
#include <json/reader.h>
|
|||
|
|||
#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
|
|||
@ -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__ |
|||
@ -0,0 +1,7 @@ |
|||
#include "servaKernel.h"
|
|||
|
|||
|
|||
|
|||
bool servaKernel::registerMojo(){ |
|||
return true; |
|||
}; |
|||
@ -0,0 +1,10 @@ |
|||
#include "protocolARGUS.h"
|
|||
|
|||
protocolARGUS::protocolARGUS():protocolParser(){ |
|||
|
|||
}; |
|||
|
|||
protocolARGUS::~protocolARGUS(){ |
|||
|
|||
}; |
|||
|
|||
@ -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 |
|||
@ -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 |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue