HttpPlugin.hpp 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. #ifndef __HTTPPLUGIN_HPP_
  2. #define __HTTPPLUGIN_HPP_
  3. #include <iostream>
  4. #include "UtilBase.hpp"
  5. #include "Util/logger.h"
  6. #include "config.hpp"
  7. #include "HttpClient.hpp"
  8. #include "HttpServer.hpp"
  9. #include "requests.hpp"
  10. #include "ExpelDevice.h"
  11. #include "InfineFilter.hpp"
  12. #include "PluginSubscriber.hpp"
  13. using namespace std;
  14. using namespace toolkit;
  15. namespace gsd
  16. {
  17. class HttpPlugin: public PluginSubscriber<HttpPlugin>, public PluginBase
  18. {
  19. private:
  20. HttpPlugin(){
  21. }
  22. public:
  23. using Ptr = std::shared_ptr<HttpPlugin>;
  24. /**
  25. * @description: getPtr
  26. * @return {*}
  27. */
  28. static std::shared_ptr<HttpPlugin> getPtr();
  29. /**
  30. * @description: 初始化
  31. * @return {*}
  32. */
  33. bool Init();
  34. /**
  35. * @description: 启动任务
  36. * @return {*}
  37. */
  38. bool StartTask();
  39. /**
  40. * @description: 释放
  41. * @return {*}
  42. */
  43. void Destroy();
  44. /**
  45. * @description: 获取数据
  46. * @return {*}
  47. */
  48. void getHttpInfo();
  49. /**
  50. * @description: Alive
  51. * @return {*}
  52. */
  53. bool Alive();
  54. /**
  55. * @description: 纠察器
  56. * @param {string&} ImageBase64
  57. * @param {string&} datas
  58. * @return {*}
  59. */
  60. std::pair<bool, std::string> getCheck(std::string& ImageBase64, std::string& datas);
  61. /**
  62. * @description: RestPlugin
  63. * @return {*}
  64. */
  65. virtual bool RestPlugin();
  66. ~HttpPlugin(){}
  67. protected:
  68. std::shared_ptr<HttpClient> m_httpClient = nullptr;
  69. std::shared_ptr<HttpServer> m_HttpServer = nullptr;
  70. // timer
  71. Timer::Ptr timer0;
  72. };
  73. } // namespace gsd
  74. #endif