#ifndef _DEVICEGASV4_HPP_ #define _DEVICEGASV4_HPP_ #include "UtilBase.hpp" #include "Util/logger.h" #include "requests.hpp" namespace gsd { class DevicePlayerV4: public ContorlTcplBase { private: enum RECV_STEP{ STEP_HEAD_1 = 0, STEP_HEAD_2 = 1, STEP_TYPE = 2, STEP_DEVID = 3, STEP_COM = 4, STEP_ACK = 5 }; typedef struct { uint8_t dataCount; uint8_t dataLength; uint8_t dataCheckSum; uint8_t data[6]; enum RECV_STEP step = STEP_HEAD_1; }ExpelComm; ExpelComm _comm; public: DevicePlayerV4(): ContorlTcplBase(){ this->DeviceInfo = "赛为智能驱鸟器协议"; this->tool = DeviceTools::tcp; } ~DevicePlayerV4(){} // 电压 float voltage = 0; // 气压 float pressure = 0; // 状态 int state = 0; // 纬度 float latitude = 0; // 经度 float longitude = 0; static unsigned char check(unsigned char *pSendBuf,unsigned char num); static void serialization(const ControlerMsg gasControl,char *data); bool deserialization() { return true; } bool Consumer(uint8_t *data, int len, int &msg_id); bool deserialization(const uint8_t *data, int len, int &msg_id); /** * @description: 打开 * @param {int} deivceId * @return {*} */ int8_t Open(std::string DeviceId, uint8_t* data, int& length); /** * @description: 关闭 * @param {int} deivceId * @return {*} */ int8_t Close(std::string DeviceId, uint8_t* data, int& length); /** * @description: 开炮 * @param {int} deivceId * @return {*} */ int8_t Fire(std::string DeviceId, uint8_t* data, int& length); /** * @description: 状态 * @param {int} deivceId * @return {*} */ int8_t Status(std::string DeviceId, uint8_t* data, int& length); /** * @description: 判定msg是否为status * @param {int} &msg_id * @return {*} */ bool getStatusMsg(int &msg_id){ return true; } /** * @description: 构建设备信息 * @param {SendDevice&} sendDevice * @return {*} */ void BuildDeviceInfo(SendDevice& sendDevice); }; } // namespace gsd #endif