You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
1.4 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. #ifndef __MEKOROT_KERNEL_HEADER__
  2. #define __MEKOROT_KERNEL_HEADER__
  3. #include "../../lib/components/base/basicLogCollection.h"
  4. #include "../../lib/components/base/basicSettingsProvider.h"
  5. #include "../../lib/components/base/basicEngine.h"
  6. #include "../../lib/components/base/basicThread.h"
  7. #include "../../lib/data/protocol/protocolLGS.h"
  8. #include "../../lib/hardware/uart/serialPort.h"
  9. #define MEKOROT_KRNL_SERIAL_LINE_TAG "SERIAL_LINE"
  10. #define MEKOROT_KRNL_SERIAL_SPEED_TAG "SERIAL_SPEED"
  11. #define MEKOROT_KRNL_DEVICE_0_ID_TAG "DEVICE_LEFT_ID"
  12. #define MEKOROT_KRNL_DEVICE_1_ID_TAG "DEVICE_CENTER_ID"
  13. #define MEKOROT_KRNL_DEVICE_2_ID_TAG "DEVICE_RIGHT_ID"
  14. #define MEKOROT_KRNL_STG_INIT 0
  15. #define MEKOROT_KRNL_STG_CONNECT 1
  16. #define MEKOROT_KRNL_STG_PING_DEVICES 2
  17. #define MEKOROT_KRNL_STG_WORKING 3
  18. class mekorotKernel: public protocolLGS_CLIENT, public basicThread, basicEngine {
  19. private:
  20. basicLogCollection *m_pLog;
  21. config_setting_t *m_pSettings;
  22. serialPort *m_pSerial;
  23. uint8_t m_bStage;
  24. char m_pSerialDevice[128];
  25. uint32_t m_nSerialSpeed;
  26. int8_t m_bDeviceID[3];
  27. uint32_t m_bDeviceTO[3];
  28. bool m_bDeviceFlags[3];
  29. protected:
  30. void m_fThreadProc(void);
  31. virtual bool packetHandler(protocolPackage* Package);
  32. public:
  33. explicit mekorotKernel( config_setting_t *ptr=NULL );
  34. virtual ~mekorotKernel();
  35. virtual bool init(void);
  36. };
  37. #endif