123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192 |
- #ifndef _EXPEL_HPP_
- #define _EXPEL_HPP_
- #include "UtilBase.hpp"
- #include <mutex>
- #include <condition_variable>
- #include <future>
- #include "Util/logger.h"
- #include "Util/NoticeCenter.h"
- #include "Network/TcpClient.h"
- #include "requests.hpp"
- #include "ExpelDevice.h"
- #include "httplib.h"
- #include "CSerialPort/SerialPort.h"
- #include "DevicePlayerV1.hpp"
- #include "DevicePlayerV2.hpp"
- #include "DevicePlayerV3.hpp"
- #include "DevicePlayerV3.hpp"
- #include "DevicePlayerV4.hpp"
- #include "DeviceGasV1.hpp"
- #include "config.hpp"
- #include <iostream>
- #include "PlayerStatus.h"
- #include "uuid.hpp"
- #include "Notices.h"
- using namespace utility;
- using namespace toolkit;
- using namespace itas109;
- namespace gsd{
- class Expel: public std::enable_shared_from_this<Expel>, public ModuleBase
- {
- private:
- Expel(): ModuleBase(){
- this->pool = std::make_shared<ThreadPool>(1,ThreadPool::PRIORITY_HIGHEST, false);
- InfoL;
- }
- public:
- using Ptr = std::shared_ptr<Expel>;
- ~Expel(){
- this->Destroy();
- }
-
-
- static std::shared_ptr<Expel> getPtr();
-
-
- bool Init();
-
-
- void Destroy();
-
-
- void HttpControler(int commandCode, ExpelDevice expelDevice);
-
-
- void sendDeviceMsgCallback(NettyServerResultMsg<RecDeviceCommand> &nettyServerResultMsg, ExpelDevice expelDevice);
-
-
- int32_t AllOpen();
-
-
- int32_t AllClose();
-
-
- int32_t AllFire();
-
-
- int32_t UpdateDeviceList(vector<vector<std::string>>& datas);
-
-
- static std::string bytesToHexString(const uint8_t* bytes,const int length);
-
- int32_t getExpelSize();
-
- int32_t Controler(std::string commandCode);
- list<int> m_deviceIdList;
- list<ExpelDevice> m_deviceLists;
- private:
-
-
- std::shared_ptr<ContorlGear> getControl(ExpelDevice& expelDevice);
-
-
- int32_t Open(ExpelDevice& expelDevice);
-
-
- int32_t Close(ExpelDevice& expelDevice);
-
-
- int32_t Fire(ExpelDevice& expelDevice);
-
-
- int32_t Status(ExpelDevice& expelDevice);
-
-
- bool SerialReceive(CSerialPort& ser, std::shared_ptr<ContorlGear>& deviceControl);
-
-
- int32_t Control(std::shared_ptr<ContorlGear>& deviceControl, ExpelDevice& expelDevice, uint8_t* data, int& length, int type);
-
- protected:
- mutex m_mutex;
- std::shared_ptr<ThreadPool> pool = nullptr;
- };
- };
- #endif
|