123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- #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
|