HttpPlugin.hpp 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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. using namespace std;
  13. using namespace toolkit;
  14. namespace gsd
  15. {
  16. class HttpPlugin: public enable_shared_from_this<HttpPlugin>, public PluginBase
  17. {
  18. private:
  19. HttpPlugin(){
  20. InfoL;
  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. return true;
  55. }
  56. /**
  57. * @description: 纠察器
  58. * @param {string&} ImageBase64
  59. * @param {string&} datas
  60. * @return {*}
  61. */
  62. std::pair<bool, std::string> getCheck(std::string& ImageBase64, std::string& datas);
  63. ~HttpPlugin(){}
  64. protected:
  65. std::shared_ptr<HttpClient> m_httpClient = nullptr;
  66. std::shared_ptr<HttpServer> m_HttpServer = nullptr;
  67. // timer
  68. Timer::Ptr timer0;
  69. };
  70. } // namespace gsd
  71. #endif