gsd_ExpelPlugin.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /**
  2. *
  3. * gsd_ExpelPlugin.h
  4. *
  5. */
  6. #pragma once
  7. #include <drogon/plugins/Plugin.h>
  8. #include "Util/util.h"
  9. #include "Network/Socket.h"
  10. #include "config.hpp"
  11. #include "dataTypeList.h"
  12. #include "InfineFilter.h"
  13. using namespace toolkit;
  14. namespace gsd
  15. {
  16. class ExpelPlugin : public drogon::Plugin<ExpelPlugin>
  17. {
  18. public:
  19. ExpelPlugin() {}
  20. /// This method must be called by drogon to initialize and start the plugin.
  21. /// It must be implemented by the user.
  22. virtual void initAndStart(const Json::Value &config) override;
  23. /// This method must be called by drogon to shutdown the plugin.
  24. /// It must be implemented by the user.
  25. virtual void shutdown() override;
  26. /**
  27. * @description: 初始化
  28. * @return {*}
  29. */
  30. int8_t Init();
  31. /**
  32. * @description: 启动任务
  33. * @return {*}
  34. */
  35. void StartTask();
  36. /**
  37. * @description: 赋值struct sockaddr
  38. * @param undefined
  39. * @param undefined
  40. * @param undefined
  41. * @return {*}
  42. */
  43. void makeAddr(struct sockaddr *out,const char *ip,uint16_t port);
  44. /**
  45. * @description: Udp数据接收
  46. * @param {Ptr} &buf
  47. * @return {*}
  48. */
  49. void UdpRecData(const Buffer::Ptr &buf);
  50. private:
  51. Socket::Ptr sockerUdp = nullptr;
  52. mutex m_mutex;
  53. // 驱鸟设备状态
  54. bool m_DevPowerState = false;
  55. };
  56. }