MonitorPlugin.hpp 2.0 KB

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