MonitorPlugin.hpp 1.8 KB

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