MonitorPlugin.hpp 2.0 KB

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