MonitorPlugin.hpp 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. #ifndef __MONITORPLUGIN_HPP_
  2. #define __MONITORPLUGIN_HPP_
  3. #include <iostream>
  4. #include "UtilBase.hpp"
  5. #include "requests.hpp"
  6. #include "Monitor.hpp"
  7. #include "HttpClient.hpp"
  8. #include "TcpPlugin.hpp"
  9. #include "InfineFilter.hpp"
  10. #include "HttpPlugin.hpp"
  11. using namespace std;
  12. namespace gsd
  13. {
  14. class MonitorPlugin: public enable_shared_from_this<MonitorPlugin>, public PluginBase
  15. {
  16. private:
  17. MonitorPlugin(): PluginBase(){
  18. }
  19. public:
  20. using Ptr = std::shared_ptr<MonitorPlugin>;
  21. ~MonitorPlugin(){}
  22. /**
  23. * @description: CreateNew
  24. * @return {*}
  25. */
  26. static std::shared_ptr<MonitorPlugin> CreateNew();
  27. /**
  28. * @description: 初始化
  29. * @return {*}
  30. */
  31. virtual bool Init();
  32. /**
  33. * @description: StartTask
  34. * @return {*}
  35. */
  36. virtual bool StartTask();
  37. /**
  38. * @description: 释放
  39. * @return {*}
  40. */
  41. virtual void Destroy();
  42. /**
  43. * @description:
  44. * @return {*}
  45. */
  46. virtual bool Alive();
  47. /**
  48. * @description: 处理数据的进程
  49. * @return {*}
  50. */
  51. void MonitorProThrd();
  52. /**
  53. * @description: 消费数据
  54. * @param {Ptr&} result
  55. * @return {*}
  56. */
  57. bool ConsumeData(FrameInferData::Ptr& result);
  58. /**
  59. * @description: 保存视频记录
  60. * @param {HistoryVideo&} historyVideo
  61. * @return {*}
  62. */
  63. bool SaveVideoRecord(HistoryVideo& historyVideo);
  64. private:
  65. std::shared_ptr<Monitor> monitor = nullptr;
  66. std::shared_ptr<ThreadPool> pool = nullptr;
  67. bool stop_ = false;
  68. };
  69. } // namespace gsd
  70. #endif