Line.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. #pragma once
  2. #include <QtWidgets/QMainWindow>
  3. #include <QtSerialPort/qserialportinfo.h>
  4. #include "ui_Line.h"
  5. #include "ui_port.h"
  6. #include "ui_port_dialog.h"
  7. #include <conio.h>
  8. #include <Windows.h>
  9. #include <QtSerialPort/qserialport.h>
  10. #include <qthread>
  11. #include <qtimer>
  12. class Line : public QMainWindow
  13. {
  14. Q_OBJECT
  15. public:
  16. Line(QWidget *parent = Q_NULLPTR);
  17. public:
  18. QString getcomm(int index, QString keyorvalue);
  19. void SerialSend(QByteArray data);
  20. uint8_t MODBUS_ASCII_GetLrc(QByteArray data);
  21. void F3send(unsigned char *buff, int size);
  22. #if 1
  23. void out_buff(unsigned char *buff, int size);
  24. int in_buff(unsigned char *buff, int time_out);
  25. int calcrc(const unsigned char *ptr, int count);
  26. int check(int crc, const unsigned char *buf, int sz);
  27. int xmodemTransmit(unsigned char *src, int srcsz);
  28. #endif
  29. QByteArray FloattoHex(float f_val);
  30. void Simulation_OilUnloadSend(QByteArray command);
  31. void Simulation_AngleSend(QByteArray command);
  32. private slots:
  33. void portclick();
  34. void portopen();
  35. void portclose();
  36. void sendaddr();
  37. void sendvol();
  38. void change_update();
  39. void reboot_dev();
  40. void Clear_dev();
  41. void read_line();
  42. void on_openfile();
  43. void downfile();
  44. void down_file();
  45. void readver();
  46. void sendconnect();
  47. void readconnect();
  48. void Read_RegVal();
  49. void Write_RegVal();
  50. void into_cali();
  51. void quit_cali();
  52. void sendPT();
  53. void ReadPT();
  54. void sendCT();
  55. void ReadCT();
  56. void Receive_Data();
  57. void ReadStore();
  58. void SetStore();
  59. void GetControlDateTime();
  60. void SetControlDateTime();
  61. void StopUpGrade();
  62. void RebootControl();
  63. void ReadAutoSealTime();
  64. void SetAutoSealTime();
  65. void ReadConfig();
  66. void SetConfig();
  67. void ReadCoefExp();
  68. void SetCoefExp();
  69. void ReadUart1TimeOut();
  70. void SetUart1TimeOut();
  71. void ReadTankCapicity();
  72. void SetTankCapicity();
  73. void ReadBlankSeal();
  74. void SetBlankSeal();
  75. void CJReadStore();
  76. void CJSetStore();
  77. void RebootCollect();
  78. void CJReadOilUnload();
  79. void CJSetOilUnload();
  80. void CJReadBottomValve();
  81. void CJSetBottomValve();
  82. void CJReadVersion();
  83. void CJReadManHoleCover();
  84. void CJSetManHoleCover();
  85. void CJReadLevelType();
  86. void CJSetLevelType();
  87. void CJReadLevelZero();
  88. void CJSetLevelZero();
  89. void CJReadAttitudeType();
  90. void CJSetAttitudeType();
  91. void CJReadTemperatureType();
  92. void CJSetTemperatureType();
  93. void CJReadManHoleCoverThreshold();
  94. void CJSetManHoleCoverThreshold();
  95. void CJSetOilUnloadZero();
  96. void CJSetManHoleZero();
  97. void CJTransparentTransmition();
  98. void ReadControlSoftwareVer();
  99. public:
  100. QMenu * portmenu;
  101. QDialog *portdialog;
  102. HKEY hKey;
  103. LPCWSTR subkey;
  104. wchar_t keyname[256]; //¼üÃûÊý×é
  105. unsigned char keyvalue[256]; //¼üÖµÊý×é
  106. DWORD keysize, type, valuesize;
  107. int indexnum;
  108. QSerialPort* myserial;
  109. char sendflag;
  110. char recvflag;
  111. //QByteArray s;
  112. int timerid;
  113. int retry;
  114. int len;
  115. int crc;
  116. unsigned int packetno;
  117. QByteArray q;
  118. QThread tt;
  119. protected:
  120. void timerEvent(QTimerEvent *event);
  121. private:
  122. Ui::LineClass ui;
  123. Ui::Dialog_port portui;
  124. };