diff --git a/Projects/MEKOROT/MEKOROT.cpp b/Projects/MEKOROT/MEKOROT.cpp
new file mode 100644
index 00000000..f4dc1fa0
--- /dev/null
+++ b/Projects/MEKOROT/MEKOROT.cpp
@@ -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
diff --git a/Projects/MEKOROT/MEKOROT.h b/Projects/MEKOROT/MEKOROT.h
new file mode 100644
index 00000000..59544e66
--- /dev/null
+++ b/Projects/MEKOROT/MEKOROT.h
@@ -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
diff --git a/Projects/MEKOROT/MEKOROT.sln b/Projects/MEKOROT/MEKOROT.sln
new file mode 100644
index 00000000..e93cc530
--- /dev/null
+++ b/Projects/MEKOROT/MEKOROT.sln
@@ -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
diff --git a/Projects/MEKOROT/MEKOROT.vcxproj b/Projects/MEKOROT/MEKOROT.vcxproj
new file mode 100644
index 00000000..095b21a2
--- /dev/null
+++ b/Projects/MEKOROT/MEKOROT.vcxproj
@@ -0,0 +1,197 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Release
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ x64
+
+
+
+ 16.0
+ {536824B6-ACDF-4F57-BA13-C2B72E65FAD7}
+ Win32Proj
+ MEKOROT
+ 10.0
+
+
+
+ Application
+ true
+ v142
+ Unicode
+
+
+ Application
+ false
+ v142
+ true
+ Unicode
+
+
+ Application
+ true
+ v142
+ NotSet
+
+
+ Application
+ false
+ v142
+ true
+ Unicode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+ true
+ C:\LIBS\libconfig-1.5\include;C:\LIBS\opencv\opencv4\include;C:\LIBS\ffmpeg\include;$(IncludePath)
+ C:\LIBS\ffmpeg\static_lib\debug\x64;C:\LIBS\libconfig-1.5\lib\x64;C:\LIBS\opencv\opencv4\x64\vc16\lib;$(LibraryPath)
+
+
+ false
+
+
+ false
+
+
+
+
+
+ Level3
+ Disabled
+ true
+ WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)
+ true
+
+
+ Console
+ true
+
+
+
+
+
+
+ Level3
+ Disabled
+ true
+ _DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;DEBUG;DUBUG_COMMUNICATION;DEBUG_SERIAL_COMMUNICATION;_CLIENT_APPLICATION_;VC_EXTRALEAN;WIN32_LEAN_AND_MEAN;_OPENCV_;_MEKOROT_;%(PreprocessorDefinitions)
+ true
+
+
+ Console
+ true
+ opencv_core440d.lib;%(AdditionalDependencies)
+
+
+
+
+
+
+ Level3
+ MaxSpeed
+ true
+ true
+ true
+ WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
+ true
+
+
+ Console
+ true
+ true
+ true
+
+
+
+
+
+
+ Level3
+ MaxSpeed
+ true
+ true
+ true
+ NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
+ true
+
+
+ Console
+ true
+ true
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Projects/MEKOROT/MEKOROT.vcxproj.filters b/Projects/MEKOROT/MEKOROT.vcxproj.filters
new file mode 100644
index 00000000..5b277b7b
--- /dev/null
+++ b/Projects/MEKOROT/MEKOROT.vcxproj.filters
@@ -0,0 +1,123 @@
+
+
+
+
+ {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
+ cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
+
+
+ {93995380-89BD-4b04-88EB-625FBE52EBFB}
+ h;hh;hpp;hxx;hm;inl;inc;ipp;xsd
+
+
+ {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
+ rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
+
+
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+ Source Files
+
+
+
+
+ Header Files
+
+
+ Header Files
+
+
+
\ No newline at end of file
diff --git a/Projects/MEKOROT/MEKOROT.vcxproj.user b/Projects/MEKOROT/MEKOROT.vcxproj.user
new file mode 100644
index 00000000..0f14913f
--- /dev/null
+++ b/Projects/MEKOROT/MEKOROT.vcxproj.user
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/Projects/MEKOROT/MEKOROT_Kernel.cpp b/Projects/MEKOROT/MEKOROT_Kernel.cpp
new file mode 100644
index 00000000..e5c0d642
--- /dev/null
+++ b/Projects/MEKOROT/MEKOROT_Kernel.cpp
@@ -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
diff --git a/Projects/MEKOROT/MEKOROT_Kernel.h b/Projects/MEKOROT/MEKOROT_Kernel.h
new file mode 100644
index 00000000..594901f9
--- /dev/null
+++ b/Projects/MEKOROT/MEKOROT_Kernel.h
@@ -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
\ No newline at end of file
diff --git a/Projects/MEKOROT/mekorot.conf b/Projects/MEKOROT/mekorot.conf
new file mode 100644
index 00000000..245d8f88
--- /dev/null
+++ b/Projects/MEKOROT/mekorot.conf
@@ -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;
+};