75 lines
1.5 KiB
C
75 lines
1.5 KiB
C
|
#ifndef WIDGET_H
|
||
|
#define WIDGET_H
|
||
|
|
||
|
#include <QWidget>
|
||
|
#include <QDialog>
|
||
|
#include <QMessageBox>
|
||
|
#include <QSerialPort>
|
||
|
#include <QSerialPortInfo>
|
||
|
|
||
|
QT_BEGIN_NAMESPACE
|
||
|
namespace Ui { class Widget; }
|
||
|
QT_END_NAMESPACE
|
||
|
|
||
|
class Widget : public QWidget
|
||
|
{
|
||
|
Q_OBJECT
|
||
|
|
||
|
public:
|
||
|
Widget(QWidget *parent = nullptr);
|
||
|
|
||
|
~Widget();
|
||
|
|
||
|
private slots:
|
||
|
|
||
|
void on_transmission_clear_Button_clicked();
|
||
|
|
||
|
void on_receive_clear_Button_clicked();
|
||
|
|
||
|
void on_updateport_Button_clicked();
|
||
|
|
||
|
void receiveHex_selectSlot();
|
||
|
void receiveText_selectSlot();
|
||
|
void transmissionHex_selectSlot();
|
||
|
void transmissionText_selectSlot();
|
||
|
|
||
|
void on_config_baud_comboBox_currentIndexChanged(int index);
|
||
|
|
||
|
void on_config_databit_comboBox_currentIndexChanged(int index);
|
||
|
|
||
|
void on_config_stopbit_comboBox_currentIndexChanged(int index);
|
||
|
|
||
|
void on_config_check_comboBox_currentIndexChanged(int index);
|
||
|
|
||
|
void on_openserial_button_clicked();
|
||
|
|
||
|
void on_about_button_clicked();
|
||
|
|
||
|
private:
|
||
|
Ui::Widget *ui;
|
||
|
|
||
|
QSerialPort *serialPort;
|
||
|
|
||
|
int Timer_ID;
|
||
|
int id = 0;
|
||
|
|
||
|
// 发送&接收模式 - 通过调整此处可以更改默认值
|
||
|
// TRUE - Hex
|
||
|
// FALSE - Bool
|
||
|
bool recive_config_select = true;
|
||
|
bool transmission_config_select = true;
|
||
|
|
||
|
// 波特率
|
||
|
int baud_rate = 0;
|
||
|
// 数据位长度
|
||
|
int data_bit = 0;
|
||
|
// 停止位长度
|
||
|
int stop_bit = 0;
|
||
|
// 校验模式
|
||
|
// 0 - no 无
|
||
|
// 1 - odd 奇
|
||
|
// 2 - even 偶
|
||
|
quint8 check = 0;
|
||
|
};
|
||
|
#endif // WIDGET_H
|