MonitorPlugin.hpp 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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. /**
  64. * @description: 发送请求
  65. * @param {CNStreamInferData Ptr} data
  66. * @return {*}
  67. */
  68. bool sendRequest(CNStreamInferData::Ptr data);
  69. private:
  70. std::shared_ptr<Monitor> monitor = nullptr;
  71. std::shared_ptr<ThreadPool> pool = nullptr;
  72. bool stop_ = false;
  73. };
  74. } // namespace gsd
  75. #endif