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.

46 lines
1.5 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. #define KERNEL_SLOW_SLEEP_TIME 1000 // msec
  19. #define KERNEL_QUICK_SLEEP_TIME 50 // msec
  20. class mekorotKernel: public protocolLGS_CLIENT, public basicThread, basicEngine {
  21. private:
  22. basicLogCollection *m_pLog;
  23. config_setting_t *m_pSettings;
  24. serialPort *m_pSerial;
  25. uint8_t m_bStage;
  26. char m_pSerialDevice[128];
  27. uint32_t m_nSerialSpeed;
  28. int8_t m_bDeviceID[3];
  29. unsigned long long m_bDeviceTO[3];
  30. bool m_bDeviceFlags[3];
  31. bool m_bDeviceAlarms[3];
  32. protected:
  33. void m_fThreadProc(void);
  34. virtual bool packetHandler(protocolPackage* Package);
  35. public:
  36. explicit mekorotKernel( config_setting_t *ptr=NULL );
  37. virtual ~mekorotKernel();
  38. virtual bool init(void);
  39. };
  40. #endif