123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- #ifndef __EXPELPLUGIN_HPP_
- #define __EXPELPLUGIN_HPP_
- #include <iostream>
- #include "UtilBase.hpp"
- #include "Network/Socket.h"
- #include <mutex>
- #include <condition_variable>
- #include <future>
- #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<ExpelPlugin>, public PluginBase
- {
- private:
- ExpelPlugin(): PluginBase(){
- }
- public:
- using Ptr = std::shared_ptr<ExpelPlugin>;
- /**
- * @description: 获取Ptr
- * @return {*}
- */
- static std::shared_ptr<ExpelPlugin> 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<RecDeviceCommand>} &nettyServerResultMsg
- * @param {ExpelDevice} expelDevice
- * @return {*}
- */
- void sendDeviceMsgCallback(NettyServerResultMsg<RecDeviceCommand> &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
|