Browse Source
Set point to add Mekorot Project stp2
Set point to add Mekorot Project stp2
9 changed files with 638 additions and 0 deletions
-
77Projects/MEKOROT/MEKOROT.cpp
-
9Projects/MEKOROT/MEKOROT.h
-
31Projects/MEKOROT/MEKOROT.sln
-
197Projects/MEKOROT/MEKOROT.vcxproj
-
123Projects/MEKOROT/MEKOROT.vcxproj.filters
-
4Projects/MEKOROT/MEKOROT.vcxproj.user
-
142Projects/MEKOROT/MEKOROT_Kernel.cpp
-
43Projects/MEKOROT/MEKOROT_Kernel.h
-
12Projects/MEKOROT/mekorot.conf
@ -0,0 +1,77 @@ |
|||
// MEKOROT.cpp : This file contains the 'main' function. Program execution begins and ends there.
|
|||
//
|
|||
#include "MEKOROT.h"
|
|||
|
|||
|
|||
#define LOG( X ) m_pLog->Log( "main", NULL, X )
|
|||
#define LOG_ERROR( X ) m_pLog->Log( "main", NULL, _LOG_ERROR, X )
|
|||
|
|||
int main(){ |
|||
basicLogCollection * m_pLog = basicLogCollection::getInstance(); |
|||
objectConsoleLoggingService * m_pCL; |
|||
objectFileLoggingService * m_pFL; |
|||
config_setting_t * m_pSP = basicSettingsProvider::getInstance((CSTR)"mekorot.conf")->getSubNode(NULL, (CSTR)"GENERAL"); |
|||
config_setting_t * pSetting = NULL; |
|||
mekorotKernel * m_pKRNL; |
|||
|
|||
m_pCL = new objectConsoleLoggingService(); |
|||
if ( m_pCL ) m_pLog->addHandler( m_pCL ); |
|||
pSetting = config_setting_get_member( m_pSP, "USE_LOG_FILE" ); |
|||
if ( pSetting != NULL ) { |
|||
if (config_setting_get_bool(pSetting) ) { |
|||
char mLogFileName[128]; |
|||
pSetting = config_setting_get_member(m_pSP, "LOG_FILE_NAME"); |
|||
if (pSetting != NULL) { |
|||
sprintf(mLogFileName, "%s", config_setting_get_string(pSetting)); |
|||
} else { |
|||
sprintf(mLogFileName, "mekorot.log" ); |
|||
pSetting = config_setting_add(m_pSP, "LOG_FILE_NAME", CONFIG_TYPE_STRING); |
|||
basicSettingsProvider::getInstance()->compromise(); |
|||
if (pSetting == NULL) { |
|||
LOG_ERROR("Failure while adding setting!"); |
|||
return -1; |
|||
}; |
|||
config_setting_set_string(pSetting, mLogFileName); |
|||
}; |
|||
m_pFL = new objectFileLoggingService( mLogFileName ); |
|||
if ( m_pFL == NULL) { |
|||
LOG_ERROR("Failure open log file!"); |
|||
} else { |
|||
m_pLog->addHandler( m_pFL ); |
|||
}; |
|||
}; |
|||
} else { |
|||
pSetting = config_setting_add( m_pSP, "USE_LOG_FILE", CONFIG_TYPE_BOOL); |
|||
basicSettingsProvider::getInstance()->compromise(); |
|||
if (pSetting == NULL) { |
|||
LOG_ERROR("Failure while adding setting!"); |
|||
return -1; |
|||
}; |
|||
}; |
|||
m_pKRNL = new mekorotKernel(); |
|||
if (m_pKRNL != NULL) { |
|||
if (m_pKRNL->init()) { |
|||
m_pKRNL->waitThreadEnd(); |
|||
} else { |
|||
LOG_ERROR("Failure during Kernel Thread Start!"); |
|||
}; |
|||
} else { |
|||
LOG_ERROR("Failure during Kernel Construct!"); |
|||
}; |
|||
basicSettingsProvider::getInstance()->validate(); |
|||
return 0; |
|||
} |
|||
|
|||
#undef LOG
|
|||
#undef LOG_ERROR
|
|||
|
|||
// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
|
|||
// Debug program: F5 or Debug > Start Debugging menu
|
|||
|
|||
// Tips for Getting Started:
|
|||
// 1. Use the Solution Explorer window to add/manage files
|
|||
// 2. Use the Team Explorer window to connect to source control
|
|||
// 3. Use the Output window to see build output and other messages
|
|||
// 4. Use the Error List window to view errors
|
|||
// 5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
|
|||
// 6. In the future, to open this project again, go to File > Open > Project and select the .sln file
|
|||
@ -0,0 +1,9 @@ |
|||
#ifndef __MEKORROT_MAIN_HEADER__ |
|||
#define __MEKORROT_MAIN_HEADER__ |
|||
|
|||
#include "../../lib/components/base/basicLogCollection.h" |
|||
#include "../../lib/components/base/basicSettingsProvider.h" |
|||
#include "../../lib/components/object/objectConsoleLoggingService.h" |
|||
#include "../../lib/components/object/objectFileLoggingService.h" |
|||
#include "MEKOROT_Kernel.h" |
|||
#endif |
|||
@ -0,0 +1,31 @@ |
|||
|
|||
Microsoft Visual Studio Solution File, Format Version 12.00 |
|||
# Visual Studio Version 16 |
|||
VisualStudioVersion = 16.0.29418.71 |
|||
MinimumVisualStudioVersion = 10.0.40219.1 |
|||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MEKOROT", "MEKOROT.vcxproj", "{536824B6-ACDF-4F57-BA13-C2B72E65FAD7}" |
|||
EndProject |
|||
Global |
|||
GlobalSection(SolutionConfigurationPlatforms) = preSolution |
|||
Debug|x64 = Debug|x64 |
|||
Debug|x86 = Debug|x86 |
|||
Release|x64 = Release|x64 |
|||
Release|x86 = Release|x86 |
|||
EndGlobalSection |
|||
GlobalSection(ProjectConfigurationPlatforms) = postSolution |
|||
{536824B6-ACDF-4F57-BA13-C2B72E65FAD7}.Debug|x64.ActiveCfg = Debug|x64 |
|||
{536824B6-ACDF-4F57-BA13-C2B72E65FAD7}.Debug|x64.Build.0 = Debug|x64 |
|||
{536824B6-ACDF-4F57-BA13-C2B72E65FAD7}.Debug|x86.ActiveCfg = Debug|Win32 |
|||
{536824B6-ACDF-4F57-BA13-C2B72E65FAD7}.Debug|x86.Build.0 = Debug|Win32 |
|||
{536824B6-ACDF-4F57-BA13-C2B72E65FAD7}.Release|x64.ActiveCfg = Release|x64 |
|||
{536824B6-ACDF-4F57-BA13-C2B72E65FAD7}.Release|x64.Build.0 = Release|x64 |
|||
{536824B6-ACDF-4F57-BA13-C2B72E65FAD7}.Release|x86.ActiveCfg = Release|Win32 |
|||
{536824B6-ACDF-4F57-BA13-C2B72E65FAD7}.Release|x86.Build.0 = Release|Win32 |
|||
EndGlobalSection |
|||
GlobalSection(SolutionProperties) = preSolution |
|||
HideSolutionNode = FALSE |
|||
EndGlobalSection |
|||
GlobalSection(ExtensibilityGlobals) = postSolution |
|||
SolutionGuid = {AA43AC81-75F3-46CC-B518-468ADAB701CF} |
|||
EndGlobalSection |
|||
EndGlobal |
|||
@ -0,0 +1,197 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
|||
<ItemGroup Label="ProjectConfigurations"> |
|||
<ProjectConfiguration Include="Debug|Win32"> |
|||
<Configuration>Debug</Configuration> |
|||
<Platform>Win32</Platform> |
|||
</ProjectConfiguration> |
|||
<ProjectConfiguration Include="Release|Win32"> |
|||
<Configuration>Release</Configuration> |
|||
<Platform>Win32</Platform> |
|||
</ProjectConfiguration> |
|||
<ProjectConfiguration Include="Debug|x64"> |
|||
<Configuration>Debug</Configuration> |
|||
<Platform>x64</Platform> |
|||
</ProjectConfiguration> |
|||
<ProjectConfiguration Include="Release|x64"> |
|||
<Configuration>Release</Configuration> |
|||
<Platform>x64</Platform> |
|||
</ProjectConfiguration> |
|||
</ItemGroup> |
|||
<PropertyGroup Label="Globals"> |
|||
<VCProjectVersion>16.0</VCProjectVersion> |
|||
<ProjectGuid>{536824B6-ACDF-4F57-BA13-C2B72E65FAD7}</ProjectGuid> |
|||
<Keyword>Win32Proj</Keyword> |
|||
<RootNamespace>MEKOROT</RootNamespace> |
|||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion> |
|||
</PropertyGroup> |
|||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> |
|||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> |
|||
<ConfigurationType>Application</ConfigurationType> |
|||
<UseDebugLibraries>true</UseDebugLibraries> |
|||
<PlatformToolset>v142</PlatformToolset> |
|||
<CharacterSet>Unicode</CharacterSet> |
|||
</PropertyGroup> |
|||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> |
|||
<ConfigurationType>Application</ConfigurationType> |
|||
<UseDebugLibraries>false</UseDebugLibraries> |
|||
<PlatformToolset>v142</PlatformToolset> |
|||
<WholeProgramOptimization>true</WholeProgramOptimization> |
|||
<CharacterSet>Unicode</CharacterSet> |
|||
</PropertyGroup> |
|||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> |
|||
<ConfigurationType>Application</ConfigurationType> |
|||
<UseDebugLibraries>true</UseDebugLibraries> |
|||
<PlatformToolset>v142</PlatformToolset> |
|||
<CharacterSet>NotSet</CharacterSet> |
|||
</PropertyGroup> |
|||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> |
|||
<ConfigurationType>Application</ConfigurationType> |
|||
<UseDebugLibraries>false</UseDebugLibraries> |
|||
<PlatformToolset>v142</PlatformToolset> |
|||
<WholeProgramOptimization>true</WholeProgramOptimization> |
|||
<CharacterSet>Unicode</CharacterSet> |
|||
</PropertyGroup> |
|||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> |
|||
<ImportGroup Label="ExtensionSettings"> |
|||
</ImportGroup> |
|||
<ImportGroup Label="Shared"> |
|||
</ImportGroup> |
|||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
|||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
|||
</ImportGroup> |
|||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
|||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
|||
</ImportGroup> |
|||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> |
|||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
|||
</ImportGroup> |
|||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> |
|||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
|||
</ImportGroup> |
|||
<PropertyGroup Label="UserMacros" /> |
|||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
|||
<LinkIncremental>true</LinkIncremental> |
|||
</PropertyGroup> |
|||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> |
|||
<LinkIncremental>true</LinkIncremental> |
|||
<IncludePath>C:\LIBS\libconfig-1.5\include;C:\LIBS\opencv\opencv4\include;C:\LIBS\ffmpeg\include;$(IncludePath)</IncludePath> |
|||
<LibraryPath>C:\LIBS\ffmpeg\static_lib\debug\x64;C:\LIBS\libconfig-1.5\lib\x64;C:\LIBS\opencv\opencv4\x64\vc16\lib;$(LibraryPath)</LibraryPath> |
|||
</PropertyGroup> |
|||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
|||
<LinkIncremental>false</LinkIncremental> |
|||
</PropertyGroup> |
|||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> |
|||
<LinkIncremental>false</LinkIncremental> |
|||
</PropertyGroup> |
|||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
|||
<ClCompile> |
|||
<PrecompiledHeader> |
|||
</PrecompiledHeader> |
|||
<WarningLevel>Level3</WarningLevel> |
|||
<Optimization>Disabled</Optimization> |
|||
<SDLCheck>true</SDLCheck> |
|||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
|||
<ConformanceMode>true</ConformanceMode> |
|||
</ClCompile> |
|||
<Link> |
|||
<SubSystem>Console</SubSystem> |
|||
<GenerateDebugInformation>true</GenerateDebugInformation> |
|||
</Link> |
|||
</ItemDefinitionGroup> |
|||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> |
|||
<ClCompile> |
|||
<PrecompiledHeader> |
|||
</PrecompiledHeader> |
|||
<WarningLevel>Level3</WarningLevel> |
|||
<Optimization>Disabled</Optimization> |
|||
<SDLCheck>true</SDLCheck> |
|||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;DEBUG;DUBUG_COMMUNICATION;DEBUG_SERIAL_COMMUNICATION;_CLIENT_APPLICATION_;VC_EXTRALEAN;WIN32_LEAN_AND_MEAN;_OPENCV_;_MEKOROT_;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
|||
<ConformanceMode>true</ConformanceMode> |
|||
</ClCompile> |
|||
<Link> |
|||
<SubSystem>Console</SubSystem> |
|||
<GenerateDebugInformation>true</GenerateDebugInformation> |
|||
<AdditionalDependencies>opencv_core440d.lib;%(AdditionalDependencies)</AdditionalDependencies> |
|||
</Link> |
|||
</ItemDefinitionGroup> |
|||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
|||
<ClCompile> |
|||
<PrecompiledHeader> |
|||
</PrecompiledHeader> |
|||
<WarningLevel>Level3</WarningLevel> |
|||
<Optimization>MaxSpeed</Optimization> |
|||
<FunctionLevelLinking>true</FunctionLevelLinking> |
|||
<IntrinsicFunctions>true</IntrinsicFunctions> |
|||
<SDLCheck>true</SDLCheck> |
|||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
|||
<ConformanceMode>true</ConformanceMode> |
|||
</ClCompile> |
|||
<Link> |
|||
<SubSystem>Console</SubSystem> |
|||
<EnableCOMDATFolding>true</EnableCOMDATFolding> |
|||
<OptimizeReferences>true</OptimizeReferences> |
|||
<GenerateDebugInformation>true</GenerateDebugInformation> |
|||
</Link> |
|||
</ItemDefinitionGroup> |
|||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> |
|||
<ClCompile> |
|||
<PrecompiledHeader> |
|||
</PrecompiledHeader> |
|||
<WarningLevel>Level3</WarningLevel> |
|||
<Optimization>MaxSpeed</Optimization> |
|||
<FunctionLevelLinking>true</FunctionLevelLinking> |
|||
<IntrinsicFunctions>true</IntrinsicFunctions> |
|||
<SDLCheck>true</SDLCheck> |
|||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
|||
<ConformanceMode>true</ConformanceMode> |
|||
</ClCompile> |
|||
<Link> |
|||
<SubSystem>Console</SubSystem> |
|||
<EnableCOMDATFolding>true</EnableCOMDATFolding> |
|||
<OptimizeReferences>true</OptimizeReferences> |
|||
<GenerateDebugInformation>true</GenerateDebugInformation> |
|||
</Link> |
|||
</ItemDefinitionGroup> |
|||
<ItemGroup> |
|||
<ClCompile Include="..\..\lib\alg\generic\md5.cpp" /> |
|||
<ClCompile Include="..\..\lib\alg\generic\Transform.cpp" /> |
|||
<ClCompile Include="..\..\lib\alg\generic\utm.cpp" /> |
|||
<ClCompile Include="..\..\lib\components\base\basicCamera.cpp" /> |
|||
<ClCompile Include="..\..\lib\components\base\basicCameraPTZ.cpp" /> |
|||
<ClCompile Include="..\..\lib\components\base\basicDualThread.cpp" /> |
|||
<ClCompile Include="..\..\lib\components\base\basicEngine.cpp" /> |
|||
<ClCompile Include="..\..\lib\components\base\basicEvent.cpp" /> |
|||
<ClCompile Include="..\..\lib\components\base\basicEventHandler.cpp" /> |
|||
<ClCompile Include="..\..\lib\components\base\basicEventHeap.cpp" /> |
|||
<ClCompile Include="..\..\lib\components\base\basicFunctionality.cpp" /> |
|||
<ClCompile Include="..\..\lib\components\base\basicLIBAV.cpp" /> |
|||
<ClCompile Include="..\..\lib\components\base\basicLogCollection.cpp" /> |
|||
<ClCompile Include="..\..\lib\components\base\basicLoggingService.cpp" /> |
|||
<ClCompile Include="..\..\lib\components\base\basicObject.cpp" /> |
|||
<ClCompile Include="..\..\lib\components\base\basicPosition.cpp" /> |
|||
<ClCompile Include="..\..\lib\components\base\basicRing.cpp" /> |
|||
<ClCompile Include="..\..\lib\components\base\basicSettings.cpp" /> |
|||
<ClCompile Include="..\..\lib\components\base\basicSettingsProvider.cpp" /> |
|||
<ClCompile Include="..\..\lib\components\base\basicThread.cpp" /> |
|||
<ClCompile Include="..\..\lib\components\base\basicTimeStamp.cpp" /> |
|||
<ClCompile Include="..\..\lib\components\base\basicTransport.cpp" /> |
|||
<ClCompile Include="..\..\lib\components\object\objectConsoleLoggingService.cpp" /> |
|||
<ClCompile Include="..\..\lib\components\object\objectFileLoggingService.cpp" /> |
|||
<ClCompile Include="..\..\lib\data\media\videoNode.cpp" /> |
|||
<ClCompile Include="..\..\lib\data\protocol\protocol.cpp" /> |
|||
<ClCompile Include="..\..\lib\data\protocol\protocolLGS.cpp" /> |
|||
<ClCompile Include="..\..\lib\data\storage\storageProvider.cpp" /> |
|||
<ClCompile Include="..\..\lib\data\transport\transportSerial.cpp" /> |
|||
<ClCompile Include="..\..\lib\hardware\uart\serialPort.cpp" /> |
|||
<ClCompile Include="MEKOROT.cpp" /> |
|||
<ClCompile Include="MEKOROT_Kernel.cpp" /> |
|||
</ItemGroup> |
|||
<ItemGroup> |
|||
<ClInclude Include="MEKOROT.h" /> |
|||
<ClInclude Include="MEKOROT_Kernel.h" /> |
|||
</ItemGroup> |
|||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> |
|||
<ImportGroup Label="ExtensionTargets"> |
|||
</ImportGroup> |
|||
</Project> |
|||
@ -0,0 +1,123 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
|||
<ItemGroup> |
|||
<Filter Include="Source Files"> |
|||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> |
|||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> |
|||
</Filter> |
|||
<Filter Include="Header Files"> |
|||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> |
|||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions> |
|||
</Filter> |
|||
<Filter Include="Resource Files"> |
|||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> |
|||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions> |
|||
</Filter> |
|||
</ItemGroup> |
|||
<ItemGroup> |
|||
<ClCompile Include="MEKOROT.cpp"> |
|||
<Filter>Source Files</Filter> |
|||
</ClCompile> |
|||
<ClCompile Include="..\..\lib\components\base\basicLIBAV.cpp"> |
|||
<Filter>Source Files</Filter> |
|||
</ClCompile> |
|||
<ClCompile Include="..\..\lib\components\base\basicLogCollection.cpp"> |
|||
<Filter>Source Files</Filter> |
|||
</ClCompile> |
|||
<ClCompile Include="..\..\lib\components\base\basicLoggingService.cpp"> |
|||
<Filter>Source Files</Filter> |
|||
</ClCompile> |
|||
<ClCompile Include="..\..\lib\components\base\basicCameraPTZ.cpp"> |
|||
<Filter>Source Files</Filter> |
|||
</ClCompile> |
|||
<ClCompile Include="..\..\lib\components\object\objectConsoleLoggingService.cpp"> |
|||
<Filter>Source Files</Filter> |
|||
</ClCompile> |
|||
<ClCompile Include="..\..\lib\components\object\objectFileLoggingService.cpp"> |
|||
<Filter>Source Files</Filter> |
|||
</ClCompile> |
|||
<ClCompile Include="..\..\lib\components\base\basicEngine.cpp"> |
|||
<Filter>Source Files</Filter> |
|||
</ClCompile> |
|||
<ClCompile Include="..\..\lib\components\base\basicEvent.cpp"> |
|||
<Filter>Source Files</Filter> |
|||
</ClCompile> |
|||
<ClCompile Include="..\..\lib\components\base\basicEventHandler.cpp"> |
|||
<Filter>Source Files</Filter> |
|||
</ClCompile> |
|||
<ClCompile Include="..\..\lib\components\base\basicEventHeap.cpp"> |
|||
<Filter>Source Files</Filter> |
|||
</ClCompile> |
|||
<ClCompile Include="..\..\lib\components\base\basicFunctionality.cpp"> |
|||
<Filter>Source Files</Filter> |
|||
</ClCompile> |
|||
<ClCompile Include="..\..\lib\components\base\basicSettings.cpp"> |
|||
<Filter>Source Files</Filter> |
|||
</ClCompile> |
|||
<ClCompile Include="..\..\lib\components\base\basicSettingsProvider.cpp"> |
|||
<Filter>Source Files</Filter> |
|||
</ClCompile> |
|||
<ClCompile Include="..\..\lib\components\base\basicThread.cpp"> |
|||
<Filter>Source Files</Filter> |
|||
</ClCompile> |
|||
<ClCompile Include="..\..\lib\components\base\basicTimeStamp.cpp"> |
|||
<Filter>Source Files</Filter> |
|||
</ClCompile> |
|||
<ClCompile Include="..\..\lib\data\media\videoNode.cpp"> |
|||
<Filter>Source Files</Filter> |
|||
</ClCompile> |
|||
<ClCompile Include="..\..\lib\components\base\basicRing.cpp"> |
|||
<Filter>Source Files</Filter> |
|||
</ClCompile> |
|||
<ClCompile Include="..\..\lib\components\base\basicCamera.cpp"> |
|||
<Filter>Source Files</Filter> |
|||
</ClCompile> |
|||
<ClCompile Include="..\..\lib\components\base\basicPosition.cpp"> |
|||
<Filter>Source Files</Filter> |
|||
</ClCompile> |
|||
<ClCompile Include="..\..\lib\components\base\basicObject.cpp"> |
|||
<Filter>Source Files</Filter> |
|||
</ClCompile> |
|||
<ClCompile Include="..\..\lib\alg\generic\md5.cpp"> |
|||
<Filter>Source Files</Filter> |
|||
</ClCompile> |
|||
<ClCompile Include="..\..\lib\alg\generic\utm.cpp"> |
|||
<Filter>Source Files</Filter> |
|||
</ClCompile> |
|||
<ClCompile Include="..\..\lib\alg\generic\Transform.cpp"> |
|||
<Filter>Source Files</Filter> |
|||
</ClCompile> |
|||
<ClCompile Include="..\..\lib\data\storage\storageProvider.cpp"> |
|||
<Filter>Source Files</Filter> |
|||
</ClCompile> |
|||
<ClCompile Include="MEKOROT_Kernel.cpp"> |
|||
<Filter>Source Files</Filter> |
|||
</ClCompile> |
|||
<ClCompile Include="..\..\lib\hardware\uart\serialPort.cpp"> |
|||
<Filter>Source Files</Filter> |
|||
</ClCompile> |
|||
<ClCompile Include="..\..\lib\components\base\basicDualThread.cpp"> |
|||
<Filter>Source Files</Filter> |
|||
</ClCompile> |
|||
<ClCompile Include="..\..\lib\data\transport\transportSerial.cpp"> |
|||
<Filter>Source Files</Filter> |
|||
</ClCompile> |
|||
<ClCompile Include="..\..\lib\data\protocol\protocol.cpp"> |
|||
<Filter>Source Files</Filter> |
|||
</ClCompile> |
|||
<ClCompile Include="..\..\lib\components\base\basicTransport.cpp"> |
|||
<Filter>Source Files</Filter> |
|||
</ClCompile> |
|||
<ClCompile Include="..\..\lib\data\protocol\protocolLGS.cpp"> |
|||
<Filter>Source Files</Filter> |
|||
</ClCompile> |
|||
</ItemGroup> |
|||
<ItemGroup> |
|||
<ClInclude Include="MEKOROT.h"> |
|||
<Filter>Header Files</Filter> |
|||
</ClInclude> |
|||
<ClInclude Include="MEKOROT_Kernel.h"> |
|||
<Filter>Header Files</Filter> |
|||
</ClInclude> |
|||
</ItemGroup> |
|||
</Project> |
|||
@ -0,0 +1,4 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
|||
<PropertyGroup /> |
|||
</Project> |
|||
@ -0,0 +1,142 @@ |
|||
#include "MEKOROT_Kernel.h"
|
|||
|
|||
#define LOG( X ) m_pLog->Log( "KRNL", this, X )
|
|||
#define LOG_ERROR( X ) m_pLog->Log( "KRNL", this, _LOG_ERROR, X )
|
|||
|
|||
mekorotKernel::mekorotKernel(config_setting_t* ptr) : protocolLGS_CLIENT(), basicThread(), basicEngine() { |
|||
m_pLog = basicLogCollection::getInstance(); |
|||
m_pSettings = basicSettingsProvider::getInstance()->getSubNode(ptr, (CSTR)"KERNEL"); |
|||
m_bStage = MEKOROT_KRNL_STG_INIT; |
|||
m_pSerial = NULL; |
|||
m_pSerialDevice[0] = (char)0; |
|||
m_nSerialSpeed = 19200; |
|||
m_bDeviceID[0] = m_bDeviceID[1] = m_bDeviceID[2] = -1; |
|||
m_bDeviceFlags[0] = m_bDeviceFlags[1] = m_bDeviceFlags[2] = false; |
|||
}; |
|||
|
|||
mekorotKernel::~mekorotKernel() { |
|||
if (m_pSerial != NULL) delete( m_pSerial ); |
|||
}; |
|||
|
|||
bool mekorotKernel::init(void){ |
|||
config_setting_t *pSetting; |
|||
pSetting = config_setting_get_member(m_pSettings, MEKOROT_KRNL_SERIAL_LINE_TAG); |
|||
if (pSetting != NULL) { |
|||
sprintf(m_pSerialDevice, "%s", config_setting_get_string(pSetting)); |
|||
} else { |
|||
sprintf(m_pSerialDevice, "\\\\.\\COM2"); |
|||
pSetting = config_setting_add(m_pSettings, MEKOROT_KRNL_SERIAL_LINE_TAG, CONFIG_TYPE_STRING); |
|||
basicSettingsProvider::getInstance()->compromise(); |
|||
if (pSetting == NULL) { |
|||
LOG_ERROR("Failure while adding setting!"); |
|||
return -1; |
|||
}; |
|||
config_setting_set_string(pSetting, m_pSerialDevice); |
|||
}; |
|||
pSetting = config_setting_get_member(m_pSettings, MEKOROT_KRNL_SERIAL_SPEED_TAG); |
|||
if (pSetting != NULL) { |
|||
m_nSerialSpeed = config_setting_get_int(pSetting); |
|||
} else { |
|||
pSetting = config_setting_add(m_pSettings, MEKOROT_KRNL_SERIAL_SPEED_TAG, CONFIG_TYPE_INT); |
|||
basicSettingsProvider::getInstance()->compromise(); |
|||
if (pSetting == NULL) { |
|||
LOG_ERROR("Failure while adding setting!"); |
|||
return -1; |
|||
}; |
|||
config_setting_set_int(pSetting, m_nSerialSpeed ); |
|||
}; |
|||
pSetting = config_setting_get_member(m_pSettings, MEKOROT_KRNL_DEVICE_0_ID_TAG); |
|||
if (pSetting != NULL) { |
|||
m_bDeviceID[0] = config_setting_get_int(pSetting); |
|||
} else { |
|||
pSetting = config_setting_add(m_pSettings, MEKOROT_KRNL_DEVICE_0_ID_TAG, CONFIG_TYPE_INT); |
|||
basicSettingsProvider::getInstance()->compromise(); |
|||
if (pSetting == NULL) { |
|||
LOG_ERROR("Failure while adding setting!"); |
|||
return -1; |
|||
}; |
|||
config_setting_set_int(pSetting, m_bDeviceID[0]); |
|||
}; |
|||
pSetting = config_setting_get_member(m_pSettings, MEKOROT_KRNL_DEVICE_1_ID_TAG); |
|||
if (pSetting != NULL) { |
|||
m_bDeviceID[1] = config_setting_get_int(pSetting); |
|||
} else { |
|||
pSetting = config_setting_add(m_pSettings, MEKOROT_KRNL_DEVICE_1_ID_TAG, CONFIG_TYPE_INT); |
|||
basicSettingsProvider::getInstance()->compromise(); |
|||
if (pSetting == NULL) { |
|||
LOG_ERROR("Failure while adding setting!"); |
|||
return -1; |
|||
}; |
|||
config_setting_set_int(pSetting, m_bDeviceID[1]); |
|||
}; |
|||
pSetting = config_setting_get_member(m_pSettings, MEKOROT_KRNL_DEVICE_2_ID_TAG); |
|||
if (pSetting != NULL) { |
|||
m_bDeviceID[2] = config_setting_get_int(pSetting); |
|||
} else { |
|||
pSetting = config_setting_add(m_pSettings, MEKOROT_KRNL_DEVICE_2_ID_TAG, CONFIG_TYPE_INT); |
|||
basicSettingsProvider::getInstance()->compromise(); |
|||
if (pSetting == NULL) { |
|||
LOG_ERROR("Failure while adding setting!"); |
|||
return -1; |
|||
}; |
|||
config_setting_set_int(pSetting, m_bDeviceID[2]); |
|||
}; |
|||
|
|||
basicSettingsProvider::getInstance()->validate(); |
|||
m_bStage = MEKOROT_KRNL_STG_CONNECT; |
|||
return basicThread::init(); |
|||
}; |
|||
|
|||
void mekorotKernel::m_fThreadProc(void){ |
|||
m_bThreadStatus = TH_WORKING; |
|||
while (m_bThreadStatus < TH_ENDED) { |
|||
switch( m_bStage ) { |
|||
case MEKOROT_KRNL_STG_CONNECT:{ |
|||
if (m_pSerial == NULL) { |
|||
m_pSerial = new serialPort(m_pSerialDevice, m_nSerialSpeed); |
|||
if (m_pSerial != NULL) { |
|||
setTransport( m_pSerial ); |
|||
m_bStage = MEKOROT_KRNL_STG_PING_DEVICES; |
|||
|
|||
}; |
|||
}; |
|||
break; |
|||
}; |
|||
case MEKOROT_KRNL_STG_PING_DEVICES: { |
|||
bool LB = true; |
|||
for (uint8_t index = 0; index < 3; index++) { |
|||
if (m_bDeviceID[index] != -1 && !m_bDeviceFlags[index]){ |
|||
LB = false; |
|||
if (setDeviceID(m_bDeviceID[index])) { |
|||
if (!getState2()) { |
|||
LOG_ERROR("Get STATE FAILURE!"); |
|||
}; |
|||
} else { |
|||
LOG_ERROR("Set DevID FAILURE!"); |
|||
}; |
|||
m_bDeviceTO[index] = getMilliseconds(); |
|||
}; |
|||
}; |
|||
if (LB) { |
|||
m_bStage = MEKOROT_KRNL_STG_WORKING; |
|||
} else { |
|||
SLEEP(1000); // wait responce
|
|||
}; |
|||
break; |
|||
}; |
|||
case MEKOROT_KRNL_STG_WORKING: { |
|||
|
|||
break; |
|||
}; |
|||
}; |
|||
SLEEP(DEFAULT_THREAD_SLEEP_TIME); |
|||
}; |
|||
}; |
|||
|
|||
bool mekorotKernel::packetHandler(protocolPackage* Package) { |
|||
LOG("PROTO HANDLER!"); |
|||
return false; |
|||
}; |
|||
|
|||
#undef LOG
|
|||
#undef LOG_ERROR
|
|||
@ -0,0 +1,43 @@ |
|||
#ifndef __MEKOROT_KERNEL_HEADER__ |
|||
#define __MEKOROT_KERNEL_HEADER__ |
|||
|
|||
#include "../../lib/components/base/basicLogCollection.h" |
|||
#include "../../lib/components/base/basicSettingsProvider.h" |
|||
#include "../../lib/components/base/basicEngine.h" |
|||
#include "../../lib/components/base/basicThread.h" |
|||
#include "../../lib/data/protocol/protocolLGS.h" |
|||
#include "../../lib/hardware/uart/serialPort.h" |
|||
|
|||
#define MEKOROT_KRNL_SERIAL_LINE_TAG "SERIAL_LINE" |
|||
#define MEKOROT_KRNL_SERIAL_SPEED_TAG "SERIAL_SPEED" |
|||
#define MEKOROT_KRNL_DEVICE_0_ID_TAG "DEVICE_LEFT_ID" |
|||
#define MEKOROT_KRNL_DEVICE_1_ID_TAG "DEVICE_CENTER_ID" |
|||
#define MEKOROT_KRNL_DEVICE_2_ID_TAG "DEVICE_RIGHT_ID" |
|||
|
|||
#define MEKOROT_KRNL_STG_INIT 0 |
|||
#define MEKOROT_KRNL_STG_CONNECT 1 |
|||
#define MEKOROT_KRNL_STG_PING_DEVICES 2 |
|||
#define MEKOROT_KRNL_STG_WORKING 3 |
|||
|
|||
class mekorotKernel: public protocolLGS_CLIENT, public basicThread, basicEngine { |
|||
private: |
|||
basicLogCollection *m_pLog; |
|||
config_setting_t *m_pSettings; |
|||
serialPort *m_pSerial; |
|||
uint8_t m_bStage; |
|||
char m_pSerialDevice[128]; |
|||
uint32_t m_nSerialSpeed; |
|||
int8_t m_bDeviceID[3]; |
|||
uint32_t m_bDeviceTO[3]; |
|||
bool m_bDeviceFlags[3]; |
|||
protected: |
|||
void m_fThreadProc(void); |
|||
virtual bool packetHandler(protocolPackage* Package); |
|||
public: |
|||
explicit mekorotKernel( config_setting_t *ptr=NULL ); |
|||
virtual ~mekorotKernel(); |
|||
virtual bool init(void); |
|||
|
|||
}; |
|||
|
|||
#endif |
|||
@ -0,0 +1,12 @@ |
|||
GENERAL : |
|||
{ |
|||
USE_LOG_FILE = false; |
|||
}; |
|||
KERNEL : |
|||
{ |
|||
SERIAL_LINE = "\\\\.\\COM2"; |
|||
SERIAL_SPEED = 19200; |
|||
DEVICE_LEFT_ID = 0; |
|||
DEVICE_CENTER_ID = -1; |
|||
DEVICE_RIGHT_ID = -1; |
|||
}; |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue