Line.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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. void on_pushButton_clicked();
  100. void textEdit_append(QString str_txt);
  101. void on_pushButton_2_clicked();
  102. void on_pushButton_md5_clicked();
  103. void on_pushButton_decode_clicked();
  104. void on_pushButton_A2HEX_clicked();
  105. public:
  106. QMenu * portmenu;
  107. QDialog *portdialog;
  108. HKEY hKey;
  109. LPCWSTR subkey;
  110. wchar_t keyname[256]; //��������
  111. unsigned char keyvalue[256]; //��ֵ����
  112. DWORD keysize, type, valuesize;
  113. int indexnum;
  114. QSerialPort* myserial;
  115. char sendflag;
  116. char recvflag;
  117. //QByteArray s;
  118. int timerid;
  119. int retry;
  120. int len;
  121. int crc;
  122. unsigned int packetno;
  123. QByteArray q;
  124. QThread tt;
  125. protected:
  126. void timerEvent(QTimerEvent *event);
  127. void timerEvent_old(QTimerEvent *event);
  128. int timer_id_searil; //串口定时器ID
  129. int timer_id_old; //串口定时器ID
  130. private:
  131. Ui::LineClass ui;
  132. Ui::Dialog_port portui;
  133. };