#ifndef __EXPELPLUGIN_HPP_ #define __EXPELPLUGIN_HPP_ #include #include "UtilBase.hpp" #include "Network/Socket.h" #include #include #include #include "Util/logger.h" #include "requests.hpp" #include "Expel.hpp" #include "InfineFilter.hpp" #include "PluginSubscriber.hpp" using namespace std; using namespace toolkit; namespace gsd { class ExpelPlugin: public PluginSubscriber, public PluginBase { private: ExpelPlugin(): PluginBase(){ } public: using Ptr = std::shared_ptr; /** * @description: 获取Ptr * @return {*} */ static std::shared_ptr getPtr(); /** * @description: Init * @return {*} */ virtual bool Init(); /** * @description: StartTask * @return {*} */ virtual bool StartTask(); /** * @description: Alive * @return {*} */ virtual bool Alive(); /** * @description: UdpRecData * @param {Ptr} &buf * @return {*} */ void UdpRecData(const Buffer::Ptr &buf); /** * @description: 释放资源 * @return {*} */ virtual void Destroy(); /** * @description: makeAddr * @param {sockaddr} *out * @param {char} *ip * @param {uint16_t} port * @return {*} */ static void makeAddr(struct sockaddr *out,const char *ip,uint16_t port); /** * @description: sendDeviceMsgCallback * @param {NettyServerResultMsg} &nettyServerResultMsg * @param {ExpelDevice} expelDevice * @return {*} */ void sendDeviceMsgCallback(NettyServerResultMsg &nettyServerResultMsg, ExpelDevice expelDevice); /** * @description: getExpelSize * @return {*} */ int32_t getExpelSize(); /** * @description: ~ExpelPlugin * @return {*} */ ~ExpelPlugin(){ InfoL; this->Destroy(); } /** * @description: RestPlugin * @return {*} */ virtual bool RestPlugin(); protected: Socket::Ptr sockerUdp = nullptr; mutex m_mutex; bool m_DevPowerState = false; Timer::Ptr timer0 = nullptr; }; } // namespace gsd #endif