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.

80 lines
2.8 KiB

​
​
6 years ago
6 years ago
​
6 years ago
​
​
​
6 years ago
​
​
​
​
​
​
6 years ago
​
​
​
​
​
6 years ago
​
​
​
​
6 years ago
​
​
​
​
​
​
​
6 years ago
​
​
​
6 years ago
6 years ago
​
​
​
​
​
​
​
6 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
6 years ago
​
​
​
  1. #ifndef __MEKOROT_KERNEL_HEADER__
  2. #define __MEKOROT_KERNEL_HEADER__
  3. #include "../../lib/components/base/basicEngine.h"
  4. #include "../../lib/components/base/basicLogCollection.h"
  5. #include "../../lib/components/base/basicMediaDestination.h"
  6. #include "../../lib/components/base/basicSettingsProvider.h"
  7. #include "../../lib/components/base/basicThread.h"
  8. #include "../../lib/data/media/lapsedVideoRecorder.h"
  9. #include "../../lib/data/media/videoNode.h"
  10. #include "../../lib/data/media/video/videoAVLIBSource.h"
  11. //#include "../../lib/data/media/video/videoV4L2Source.h"
  12. #include "../../lib/data/protocol/protocolLGS.h"
  13. #include "../../lib/data/storage/storageProvider.h"
  14. #include "../../lib/hardware/uart/serialPort.h"
  15. #define MEKOROT_KRNL_SERIAL_LINE_TAG "SERIAL_LINE"
  16. #define MEKOROT_KRNL_SERIAL_SPEED_TAG "SERIAL_SPEED"
  17. #define MEKOROT_KRNL_DEVICE_0_ID_TAG "DEVICE_LEFT_ID"
  18. #define MEKOROT_KRNL_DEVICE_1_ID_TAG "DEVICE_CENTER_ID"
  19. #define MEKOROT_KRNL_DEVICE_2_ID_TAG "DEVICE_RIGHT_ID"
  20. #define KNL_SETTINGS_VIDEO_SECTION "VIDEO"
  21. #define MEKOROT_KRNL_STG_INIT 0
  22. #define MEKOROT_KRNL_STG_CONNECT 1
  23. #define MEKOROT_KRNL_STG_PING_DEVICES 2
  24. #define MEKOROT_KRNL_STG_WORKING 3
  25. #define MAX_RECORD_FRAMES 120
  26. #define MAX_TARGET_ACCEPTED_AT_ONCE 100
  27. #define KERNEL_SLOW_SLEEP_TIME 1000 // msec
  28. #define KERNEL_QUICK_SLEEP_TIME 50 // msec
  29. class mekorotKernel: public basicEngine, public basicThread, public basicMediaDestination, public protocolLGS_CLIENT {
  30. private:
  31. basicLogCollection *m_pLog;
  32. config_setting_t *m_pSettings;
  33. serialPort *m_pSerial;
  34. uint8_t m_bStage;
  35. char m_pSerialDevice[128];
  36. uint32_t m_nSerialSpeed;
  37. int8_t m_bDeviceID[3];
  38. unsigned long long m_bDeviceTO[3];
  39. bool m_bDeviceFlags[3];
  40. bool m_bDeviceAlarms[3];
  41. int m_nVideoInputs;
  42. basicMediaSource ** m_pVideoInputs;
  43. lapsedVideoRecorder * m_pVideoOutput;
  44. CSTR * m_pVideoNames;
  45. uint32_t m_nInitialFSID;
  46. uint32_t m_nRecordCounter;
  47. uint32_t m_nFrameCounter;
  48. basicMutex * m_pMatProtector;
  49. cv::Mat * m_pFinalFrame;
  50. cv::Mat ** m_pVideoFrame;
  51. bool m_bHorizontal;
  52. bool m_bRecordIsActive;
  53. bool m_bRecordIsSaving;
  54. long long m_lStartTS;
  55. uint32_t m_nCLoopMask;
  56. uint32_t m_nCLoopCheck;
  57. int m_nWidth;
  58. int m_nHeight;
  59. CSTR m_pStorageBase;
  60. storageProvider * m_pStorageProvider;
  61. protected:
  62. void m_fThreadProc(void);
  63. virtual bool packetHandler(protocolPackage* Package);
  64. public:
  65. explicit mekorotKernel( config_setting_t *ptr=NULL );
  66. virtual ~mekorotKernel();
  67. virtual bool init(void);
  68. virtual void pushFrame(cv::Mat* Frame, void* src = NULL);
  69. bool copyFrame(cv::Mat& Frame);
  70. };
  71. #endif