HttpPlugin.hpp 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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 "requests.hpp"
  9. #include "ExpelDevice.h"
  10. #include "InfineFilter.hpp"
  11. using namespace std;
  12. using namespace toolkit;
  13. namespace gsd
  14. {
  15. class HttpPlugin: public enable_shared_from_this<HttpPlugin>, public PluginBase
  16. {
  17. private:
  18. HttpPlugin(){
  19. InfoL;
  20. }
  21. public:
  22. using Ptr = std::shared_ptr<HttpPlugin>;
  23. /**
  24. * @description: CreateNew
  25. * @return {*}
  26. */
  27. static std::shared_ptr<HttpPlugin> CreateNew();
  28. /**
  29. * @description: 初始化
  30. * @return {*}
  31. */
  32. bool Init();
  33. /**
  34. * @description: 启动任务
  35. * @return {*}
  36. */
  37. bool StartTask();
  38. /**
  39. * @description: 释放
  40. * @return {*}
  41. */
  42. void Destroy();
  43. /**
  44. * @description: 获取数据
  45. * @return {*}
  46. */
  47. void getHttpInfo();
  48. /**
  49. * @description: Alive
  50. * @return {*}
  51. */
  52. bool Alive(){
  53. return true;
  54. }
  55. ~HttpPlugin(){}
  56. protected:
  57. std::shared_ptr<HttpClient> m_httpClient = nullptr;
  58. // timer
  59. Timer::Ptr timer0;
  60. };
  61. } // namespace gsd
  62. #endif