ballvalve.h 971 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #ifndef BALLVALVE_H
  2. #define BALLVALVE_H
  3. #include "serialui.h"
  4. #include <QString>
  5. #define BALLVALVE_STATUS_OPENING (0xAA)
  6. #define BALLVALVE_STATUS_CLOSING (0xBB)
  7. #define BALLVALVE_STATUS_OPENEND (0xAC)
  8. #define BALLVALVE_STATUS_CLOSEEND (0xBC)
  9. #define BALLVALVE_STATUS_BREAK (0x00)
  10. #define BALLVALVE_STATUS_FAULT (0xEA)
  11. #define REGADDR_WORKSTATUS (0X0001)
  12. #define REGADDR_CONTROL (0X0002)
  13. #define REGADDR_POSITION (0X0014)
  14. #define REGADDR_STATUS_POSITION (0X0052)
  15. class BallValve
  16. {
  17. public:
  18. BallValve(SerialUi* pSerial);
  19. bool SetPosition(unsigned short value); //设置阀门的开度值 A (0--1000) 表示:(A/10)%
  20. bool GetWorkStatus(unsigned char& status);
  21. bool GetPosition(unsigned short& value);
  22. //bool Break();
  23. bool GetSP(unsigned char& status, unsigned short& value);
  24. void Dump_Statistics(QString file_path);
  25. private:
  26. SerialUi* m_pSerial;
  27. bool check_crc(QByteArray data);
  28. };
  29. #endif // BALLVALVE_H