diff --git a/README.md b/README.md index 08c7529..9a282da 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,12 @@ # SerialPortDebug_Tools -串口调试工具 \ No newline at end of file +串口调试工具 + +这是一个由 JRNitre 编写的串口调试工具, 功能尚不完善。 + +## 待办 + +* 完善 About 界面 +* 增加一个详细设置界面 +* 优化信息显示形式 +* 完善hex&text模式选择 \ No newline at end of file diff --git a/build/D3Dcompiler_47.dll b/build/D3Dcompiler_47.dll new file mode 100644 index 0000000..e5bf5cf Binary files /dev/null and b/build/D3Dcompiler_47.dll differ diff --git a/build/Qt5Core.dll b/build/Qt5Core.dll new file mode 100644 index 0000000..21fc29a Binary files /dev/null and b/build/Qt5Core.dll differ diff --git a/build/Qt5Gui.dll b/build/Qt5Gui.dll new file mode 100644 index 0000000..3f2cf4b Binary files /dev/null and b/build/Qt5Gui.dll differ diff --git a/build/Qt5SerialPort.dll b/build/Qt5SerialPort.dll new file mode 100644 index 0000000..34a636c Binary files /dev/null and b/build/Qt5SerialPort.dll differ diff --git a/build/Qt5Svg.dll b/build/Qt5Svg.dll new file mode 100644 index 0000000..c0b3a83 Binary files /dev/null and b/build/Qt5Svg.dll differ diff --git a/build/Qt5Widgets.dll b/build/Qt5Widgets.dll new file mode 100644 index 0000000..74f5f41 Binary files /dev/null and b/build/Qt5Widgets.dll differ diff --git a/build/iconengines/qsvgicon.dll b/build/iconengines/qsvgicon.dll new file mode 100644 index 0000000..a9c1cf3 Binary files /dev/null and b/build/iconengines/qsvgicon.dll differ diff --git a/build/imageformats/qgif.dll b/build/imageformats/qgif.dll new file mode 100644 index 0000000..cd1721d Binary files /dev/null and b/build/imageformats/qgif.dll differ diff --git a/build/imageformats/qicns.dll b/build/imageformats/qicns.dll new file mode 100644 index 0000000..2eff438 Binary files /dev/null and b/build/imageformats/qicns.dll differ diff --git a/build/imageformats/qico.dll b/build/imageformats/qico.dll new file mode 100644 index 0000000..e7b1023 Binary files /dev/null and b/build/imageformats/qico.dll differ diff --git a/build/imageformats/qjpeg.dll b/build/imageformats/qjpeg.dll new file mode 100644 index 0000000..5497165 Binary files /dev/null and b/build/imageformats/qjpeg.dll differ diff --git a/build/imageformats/qsvg.dll b/build/imageformats/qsvg.dll new file mode 100644 index 0000000..5e37db1 Binary files /dev/null and b/build/imageformats/qsvg.dll differ diff --git a/build/imageformats/qtga.dll b/build/imageformats/qtga.dll new file mode 100644 index 0000000..beefe90 Binary files /dev/null and b/build/imageformats/qtga.dll differ diff --git a/build/imageformats/qtiff.dll b/build/imageformats/qtiff.dll new file mode 100644 index 0000000..6335b6e Binary files /dev/null and b/build/imageformats/qtiff.dll differ diff --git a/build/imageformats/qwbmp.dll b/build/imageformats/qwbmp.dll new file mode 100644 index 0000000..c0a1d64 Binary files /dev/null and b/build/imageformats/qwbmp.dll differ diff --git a/build/imageformats/qwebp.dll b/build/imageformats/qwebp.dll new file mode 100644 index 0000000..d06003f Binary files /dev/null and b/build/imageformats/qwebp.dll differ diff --git a/build/libEGL.dll b/build/libEGL.dll new file mode 100644 index 0000000..f10c674 Binary files /dev/null and b/build/libEGL.dll differ diff --git a/build/libGLESv2.dll b/build/libGLESv2.dll new file mode 100644 index 0000000..6140990 Binary files /dev/null and b/build/libGLESv2.dll differ diff --git a/build/libgcc_s_dw2-1.dll b/build/libgcc_s_dw2-1.dll new file mode 100644 index 0000000..d33266d Binary files /dev/null and b/build/libgcc_s_dw2-1.dll differ diff --git a/build/libstdc++-6.dll b/build/libstdc++-6.dll new file mode 100644 index 0000000..2809f65 Binary files /dev/null and b/build/libstdc++-6.dll differ diff --git a/build/opengl32sw.dll b/build/opengl32sw.dll new file mode 100644 index 0000000..6ebc90a Binary files /dev/null and b/build/opengl32sw.dll differ diff --git a/build/platforms/qwindows.dll b/build/platforms/qwindows.dll new file mode 100644 index 0000000..3157d0c Binary files /dev/null and b/build/platforms/qwindows.dll differ diff --git a/build/serialport.exe b/build/serialport.exe new file mode 100644 index 0000000..1f6be57 Binary files /dev/null and b/build/serialport.exe differ diff --git a/build/styles/qwindowsvistastyle.dll b/build/styles/qwindowsvistastyle.dll new file mode 100644 index 0000000..0dfa2ed Binary files /dev/null and b/build/styles/qwindowsvistastyle.dll differ diff --git a/build/translations/qt_ar.qm b/build/translations/qt_ar.qm new file mode 100644 index 0000000..1e9227a Binary files /dev/null and b/build/translations/qt_ar.qm differ diff --git a/build/translations/qt_bg.qm b/build/translations/qt_bg.qm new file mode 100644 index 0000000..dcec255 Binary files /dev/null and b/build/translations/qt_bg.qm differ diff --git a/build/translations/qt_ca.qm b/build/translations/qt_ca.qm new file mode 100644 index 0000000..0b798e5 Binary files /dev/null and b/build/translations/qt_ca.qm differ diff --git a/build/translations/qt_cs.qm b/build/translations/qt_cs.qm new file mode 100644 index 0000000..3ab5ca7 Binary files /dev/null and b/build/translations/qt_cs.qm differ diff --git a/build/translations/qt_da.qm b/build/translations/qt_da.qm new file mode 100644 index 0000000..6756496 Binary files /dev/null and b/build/translations/qt_da.qm differ diff --git a/build/translations/qt_de.qm b/build/translations/qt_de.qm new file mode 100644 index 0000000..034286e Binary files /dev/null and b/build/translations/qt_de.qm differ diff --git a/build/translations/qt_en.qm b/build/translations/qt_en.qm new file mode 100644 index 0000000..9dad8df Binary files /dev/null and b/build/translations/qt_en.qm differ diff --git a/build/translations/qt_es.qm b/build/translations/qt_es.qm new file mode 100644 index 0000000..3a527df Binary files /dev/null and b/build/translations/qt_es.qm differ diff --git a/build/translations/qt_fi.qm b/build/translations/qt_fi.qm new file mode 100644 index 0000000..2548cca Binary files /dev/null and b/build/translations/qt_fi.qm differ diff --git a/build/translations/qt_fr.qm b/build/translations/qt_fr.qm new file mode 100644 index 0000000..8353f0a Binary files /dev/null and b/build/translations/qt_fr.qm differ diff --git a/build/translations/qt_gd.qm b/build/translations/qt_gd.qm new file mode 100644 index 0000000..fd7eecd Binary files /dev/null and b/build/translations/qt_gd.qm differ diff --git a/build/translations/qt_he.qm b/build/translations/qt_he.qm new file mode 100644 index 0000000..e15d45e Binary files /dev/null and b/build/translations/qt_he.qm differ diff --git a/build/translations/qt_hu.qm b/build/translations/qt_hu.qm new file mode 100644 index 0000000..b51bd1a Binary files /dev/null and b/build/translations/qt_hu.qm differ diff --git a/build/translations/qt_it.qm b/build/translations/qt_it.qm new file mode 100644 index 0000000..0d9d17d Binary files /dev/null and b/build/translations/qt_it.qm differ diff --git a/build/translations/qt_ja.qm b/build/translations/qt_ja.qm new file mode 100644 index 0000000..7f688c1 Binary files /dev/null and b/build/translations/qt_ja.qm differ diff --git a/build/translations/qt_ko.qm b/build/translations/qt_ko.qm new file mode 100644 index 0000000..c612a10 Binary files /dev/null and b/build/translations/qt_ko.qm differ diff --git a/build/translations/qt_lv.qm b/build/translations/qt_lv.qm new file mode 100644 index 0000000..c1dbfbd Binary files /dev/null and b/build/translations/qt_lv.qm differ diff --git a/build/translations/qt_pl.qm b/build/translations/qt_pl.qm new file mode 100644 index 0000000..62988d2 Binary files /dev/null and b/build/translations/qt_pl.qm differ diff --git a/build/translations/qt_ru.qm b/build/translations/qt_ru.qm new file mode 100644 index 0000000..7f092e9 Binary files /dev/null and b/build/translations/qt_ru.qm differ diff --git a/build/translations/qt_sk.qm b/build/translations/qt_sk.qm new file mode 100644 index 0000000..215d234 Binary files /dev/null and b/build/translations/qt_sk.qm differ diff --git a/build/translations/qt_uk.qm b/build/translations/qt_uk.qm new file mode 100644 index 0000000..02103d8 Binary files /dev/null and b/build/translations/qt_uk.qm differ diff --git a/build/translations/qt_zh_TW.qm b/build/translations/qt_zh_TW.qm new file mode 100644 index 0000000..051b516 Binary files /dev/null and b/build/translations/qt_zh_TW.qm differ diff --git a/src/06_QtCreator_Cplus_SerialDebug_20240425.pro b/src/06_QtCreator_Cplus_SerialDebug_20240425.pro new file mode 100644 index 0000000..a8fdb29 --- /dev/null +++ b/src/06_QtCreator_Cplus_SerialDebug_20240425.pro @@ -0,0 +1,31 @@ +QT += core gui serialport + +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets + +CONFIG += c++11 + +# The following define makes your compiler emit warnings if you use +# any Qt feature that has been marked deprecated (the exact warnings +# depend on your compiler). Please consult the documentation of the +# deprecated API in order to know how to port your code away from it. +DEFINES += QT_DEPRECATED_WARNINGS + +# You can also make your code fail to compile if it uses deprecated APIs. +# In order to do so, uncomment the following line. +# You can also select to disable deprecated APIs only up to a certain version of Qt. +#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 + +SOURCES += \ + main.cpp \ + widget.cpp + +HEADERS += \ + widget.h + +FORMS += \ + widget.ui + +# Default rules for deployment. +qnx: target.path = /tmp/$${TARGET}/bin +else: unix:!android: target.path = /opt/$${TARGET}/bin +!isEmpty(target.path): INSTALLS += target diff --git a/src/06_QtCreator_Cplus_SerialDebug_20240425.pro.user b/src/06_QtCreator_Cplus_SerialDebug_20240425.pro.user new file mode 100644 index 0000000..0fe3f09 --- /dev/null +++ b/src/06_QtCreator_Cplus_SerialDebug_20240425.pro.user @@ -0,0 +1,319 @@ + + + + + + EnvironmentId + {34cec845-c4cc-4ae5-952a-77d31d4ebd2e} + + + ProjectExplorer.Project.ActiveTarget + 0 + + + ProjectExplorer.Project.EditorSettings + + true + false + true + + Cpp + + CppGlobal + + + + QmlJS + + QmlJSGlobal + + + 2 + UTF-8 + false + 4 + false + 80 + true + true + 1 + true + false + 0 + true + true + 0 + 8 + true + 1 + true + true + true + false + + + + ProjectExplorer.Project.PluginSettings + + + -fno-delayed-template-parsing + + true + + + + ProjectExplorer.Project.Target.0 + + Desktop Qt 5.14.2 MinGW 32-bit + Desktop Qt 5.14.2 MinGW 32-bit + qt.qt5.5142.win32_mingw73_kit + 1 + 0 + 0 + + E:/SYSTEM/Desktop/PROJECT/CodeLibrary_Next/Cplus/build-06_QtCreator_Cplus_SerialDebug_20240425-Desktop_Qt_5_14_2_MinGW_32_bit-Debug + + + true + QtProjectManager.QMakeBuildStep + true + + false + false + false + + + true + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Debug + Qt4ProjectManager.Qt4BuildConfiguration + 2 + + + E:/SYSTEM/Desktop/PROJECT/CodeLibrary_Next/Cplus/build-06_QtCreator_Cplus_SerialDebug_20240425-Desktop_Qt_5_14_2_MinGW_32_bit-Release + + + true + QtProjectManager.QMakeBuildStep + false + + false + false + true + + + true + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Release + Qt4ProjectManager.Qt4BuildConfiguration + 0 + + + E:/SYSTEM/Desktop/PROJECT/CodeLibrary_Next/Cplus/build-06_QtCreator_Cplus_SerialDebug_20240425-Desktop_Qt_5_14_2_MinGW_32_bit-Profile + + + true + QtProjectManager.QMakeBuildStep + true + + false + true + true + + + true + Qt4ProjectManager.MakeStep + + false + + + false + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build + + + + true + Qt4ProjectManager.MakeStep + + true + clean + + false + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Profile + Qt4ProjectManager.Qt4BuildConfiguration + 0 + + 3 + + + 0 + Deploy + Deploy + ProjectExplorer.BuildSteps.Deploy + + 1 + ProjectExplorer.DefaultDeployConfiguration + + 1 + + + dwarf + + cpu-cycles + + + 250 + + -e + cpu-cycles + --call-graph + dwarf,4096 + -F + 250 + + -F + true + 4096 + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + kcachegrind + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + Qt4ProjectManager.Qt4RunConfiguration:E:/SYSTEM/Desktop/PROJECT/CodeLibrary_Next/Cplus/06_QtCreator_Cplus_SerialDebug_20240425/06_QtCreator_Cplus_SerialDebug_20240425.pro + E:/SYSTEM/Desktop/PROJECT/CodeLibrary_Next/Cplus/06_QtCreator_Cplus_SerialDebug_20240425/06_QtCreator_Cplus_SerialDebug_20240425.pro + + false + + false + true + true + false + false + true + + E:/SYSTEM/Desktop/PROJECT/CodeLibrary_Next/Cplus/build-06_QtCreator_Cplus_SerialDebug_20240425-Desktop_Qt_5_14_2_MinGW_32_bit-Release + + 1 + + + + ProjectExplorer.Project.TargetCount + 1 + + + ProjectExplorer.Project.Updater.FileVersion + 22 + + + Version + 22 + + diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..b0a4ec2 --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,11 @@ +#include "widget.h" + +#include + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + Widget w; + w.show(); + return a.exec(); +} diff --git a/src/widget.cpp b/src/widget.cpp new file mode 100644 index 0000000..2126f47 --- /dev/null +++ b/src/widget.cpp @@ -0,0 +1,248 @@ +#include "widget.h" +#include "ui_widget.h" + +Widget::Widget(QWidget *parent) + : QWidget(parent) + , ui(new Ui::Widget) +{ + ui->setupUi(this); + + serialPort = new QSerialPort(this); + + // 修改窗口标题 + this->setWindowTitle("Design by JRNitre - Serial Port Debug Tools"); + + // 读取系统可用串口 + // 发送到下拉框中 + ui->config_port_comboBox->clear(); + + foreach(const QSerialPortInfo &info, QSerialPortInfo::availablePorts()){ + ui->config_port_comboBox->addItem(info.portName()); + } + + // 串口配置数据初始化 + + // 默认接收&发送模式 + // TRUE - Hex + // FALSE - Bool + if (recive_config_select){ + ui->receive_hexmode->setChecked(1); + }else{ + ui->receivetextmode->setChecked(1); + } + if (transmission_config_select){ + ui->transmission_hexmode->setChecked(1); + }else{ + ui->transmission_textmode->setChecked(1); + } + + // 链接信号与槽函数 + // 发送模式配置 -> hex模式被选择 -> Widget::receiveHex_selectSlot() + connect(ui->receive_hexmode, &QRadioButton::pressed, this, &Widget::receiveHex_selectSlot); + // 发送模式配置 -> text模式被选择 -> Widget::receiveText_selectSlot() + connect(ui->receivetextmode, &QRadioButton::pressed, this, &Widget::receiveText_selectSlot); + // 接收模式配置 -> hex模式被选择 -> Widget::transmissionHex_selectSlot() + connect(ui->transmission_hexmode, &QRadioButton::pressed, this, &Widget::transmissionHex_selectSlot); + // 接收模式配置 -> text模式被选择 -> Widget::transmissionText_selectSlot() + connect(ui->transmission_textmode, &QRadioButton::pressed, this, &Widget::transmissionText_selectSlot); + + // 读取默认波特率并赋值 + baud_rate = ui->config_baud_comboBox->currentText().toInt(); + // 读取默认数据位长度并赋值 + data_bit = ui->config_databit_comboBox->currentText().toInt(); + // 读取默认停止位长度并赋值 + stop_bit = ui->config_stopbit_comboBox->currentText().toDouble() * 10; + // 读取默认校验模式 + if (ui->config_check_comboBox->currentText() != "no"){ + if (ui->config_check_comboBox->currentText() == "odd"){ + check = 1; + } + if (ui->config_check_comboBox->currentText() == "even"){ + check = 2; + } + }else{ + check = 0; + } + +} + +Widget::~Widget() +{ + delete ui; +} + +// Button: Clear +void Widget::on_transmission_clear_Button_clicked() +{ + ui->transmission_Edit->clear(); +} +void Widget::on_receive_clear_Button_clicked() +{ + ui->receive_Edit->clear(); +} + +// 手动更新串口列表 +void Widget::on_updateport_Button_clicked() +{ + // 列出可用串口 + ui->config_port_comboBox->clear(); + + foreach(const QSerialPortInfo &info, QSerialPortInfo::availablePorts()){ + ui->config_port_comboBox->addItem(info.portName()); + } +} + +// 发送模式 - Hex 模式被选中 +void Widget::receiveHex_selectSlot(){ + ui->receive_Edit->insertPlainText("Receive Hex select\n"); +} + +// 发送模式 - Text 模式被选中 +void Widget::receiveText_selectSlot(){ + ui->receive_Edit->insertPlainText("Receive Text select\n"); +} +// 接收模式 - Hex 模式被选中 +void Widget::transmissionHex_selectSlot(){ + ui->receive_Edit->insertPlainText("Transmission Hex select\n"); +} +// 接收模式 - Text 模式被选中 +void Widget::transmissionText_selectSlot(){ + ui->receive_Edit->insertPlainText("Transmission Text select\n"); +} + +// 波特率选择 +void Widget::on_config_baud_comboBox_currentIndexChanged(int index) +{ + baud_rate = ui->config_baud_comboBox->itemText(index).toInt(); + ui->receive_Edit->insertPlainText("baud rate to " + QString::number(baud_rate) + "\n"); +} + +// 数据位长度选择 +void Widget::on_config_databit_comboBox_currentIndexChanged(int index) +{ + data_bit = ui->config_databit_comboBox->itemText(index).toInt(); + ui->receive_Edit->insertPlainText("data bit to " + QString::number(data_bit) + "\n"); +} + +// 停止位长度选择 +void Widget::on_config_stopbit_comboBox_currentIndexChanged(int index) +{ + stop_bit = ui->config_stopbit_comboBox->itemText(index).toDouble() * 10; + ui->receive_Edit->insertPlainText("stop bit to " + QString::number(stop_bit) + "\n"); +} + +void Widget::on_config_check_comboBox_currentIndexChanged(int index) +{ + if (ui->config_check_comboBox->itemText(index) != "no"){ + if (ui->config_check_comboBox->itemText(index) == "odd"){ + check = 1; + } + if (ui->config_check_comboBox->itemText(index) == "even"){ + check = 2; + } + }else{ + check = 0; + } + ui->receive_Edit->insertPlainText("check to " + QString::number(check) + "\n"); +} + +// 打开串口 +void Widget::on_openserial_button_clicked() +{ + // 串口初始化 + // 串口号 + serialPort->setPortName(ui->config_port_comboBox->currentText()); + // 波特率 + switch (baud_rate) { + case 4800: + serialPort->setBaudRate(QSerialPort::Baud4800); + break; + case 9600: + serialPort->setBaudRate(QSerialPort::Baud9600); + break; + case 38400: + serialPort->setBaudRate(QSerialPort::Baud38400); + break; + case 115200: + serialPort->setBaudRate(QSerialPort::Baud115200); + break; + } + // 数据位 + switch (data_bit) { + case 5: + serialPort->setDataBits(QSerialPort::Data5); + break; + case 6: + serialPort->setDataBits(QSerialPort::Data6); + break; + case 7: + serialPort->setDataBits(QSerialPort::Data7); + break; + case 8: + serialPort->setDataBits(QSerialPort::Data8); + break; + } + // 停止位 + switch (stop_bit) { + case 10: + serialPort->setStopBits(QSerialPort::OneStop); + break; + case 15: + serialPort->setStopBits(QSerialPort::OneAndHalfStop); + break; + case 20: + serialPort->setStopBits(QSerialPort::TwoStop); + break; + } + // 奇偶校验 + switch (check) { + case 0: + serialPort->setParity(QSerialPort::NoParity); + break; + case 1: + serialPort->setParity(QSerialPort::OddParity); + break; + case 2: + serialPort->setParity(QSerialPort::EvenParity); + break; + } + + // 按下后是否需要执行打开端口功能 + if (ui->openserial_button->text() == "Open Serial"){ + // 提示正在连接 + ui->receive_Edit->insertPlainText("Connect to Serial " + ui->config_port_comboBox->currentText() + " ...\n"); + // 端口开启成功 + if (serialPort->open(QIODevice::ReadWrite) == true){ + // 改变按钮名 + ui->openserial_button->setText("Close Serial"); + // 让端口下拉框不可选 + ui->config_port_comboBox->setEnabled(false); + + // 更新提示 + ui->status->setText("Connect to " + ui->config_port_comboBox->currentText()); + ui->status->setStyleSheet("color:green"); + + // 提示用户已连接 + ui->receive_Edit->insertPlainText("Connect Succesufully! \n"); + }else{ + // 连接失败 + ui->receive_Edit->insertPlainText("Connect Faild\n"); + } + }else{ + // 关闭串口 + serialPort->close(); + // 改变按钮名 + ui->openserial_button->setText("Open Serial"); + // 让端口下拉框可选 + ui->config_port_comboBox->setEnabled(true); + + ui->status->setText("Disconnect"); + ui->status->setStyleSheet("color:black"); + } +} + +// Button: About +void Widget::on_about_button_clicked() +{ + QMessageBox::information(this, "Info", "null"); +} diff --git a/src/widget.h b/src/widget.h new file mode 100644 index 0000000..e138a13 --- /dev/null +++ b/src/widget.h @@ -0,0 +1,74 @@ +#ifndef WIDGET_H +#define WIDGET_H + +#include +#include +#include +#include +#include + +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 diff --git a/src/widget.ui b/src/widget.ui new file mode 100644 index 0000000..f5b4c7b --- /dev/null +++ b/src/widget.ui @@ -0,0 +1,478 @@ + + + Widget + + + + 0 + 0 + 692 + 462 + + + + + 692 + 462 + + + + + 692 + 462 + + + + Widget + + + + + 10 + 10 + 441 + 261 + + + + Receive + + + + + 10 + 20 + 421 + 191 + + + + + + + 340 + 220 + 93 + 28 + + + + Clear + + + + + + 10 + 220 + 101 + 28 + + + + update port + + + + + + + 10 + 280 + 441 + 181 + + + + Transmission + + + + + 340 + 140 + 93 + 28 + + + + Send + + + + + + 240 + 140 + 93 + 28 + + + + Clear + + + + + + 10 + 20 + 421 + 111 + + + + + + + 10 + 140 + 211 + 31 + + + + Disconnected + + + + + + + 460 + 10 + 221 + 191 + + + + Serial Config + + + + + 10 + 20 + 201 + 161 + + + + + + + + + + 80 + 0 + + + + + 80 + 16777215 + + + + <html><head/><body><p align="center">Port</p></body></html> + + + + + + + + + + + + + + + 80 + 0 + + + + + 80 + 16777215 + + + + <html><head/><body><p align="center">Baud</p></body></html> + + + + + + + + 4800 + + + + + 9600 + + + + + 38400 + + + + + 115200 + + + + + + + + + + + + + 80 + 0 + + + + + 80 + 16777215 + + + + <html><head/><body><p align="center">DataBit</p></body></html> + + + + + + + 5 + + + + 5 + + + + + 6 + + + + + 7 + + + + + 8 + + + + + + + + + + + + + 80 + 0 + + + + + 80 + 16777215 + + + + <html><head/><body><p align="center">StopBit</p></body></html> + + + + + + + + 1 + + + + + 1.5 + + + + + 2 + + + + + + + + + + + + + 80 + 0 + + + + + 80 + 16777215 + + + + <html><head/><body><p align="center">Check</p></body></html> + + + + + + + + no + + + + + odd + + + + + even + + + + + + + + + + + + + 460 + 210 + 221 + 91 + + + + Receive Config + + + + + 10 + 20 + 71 + 61 + + + + + + + Hex + + + + + + + Text + + + + + + + + + + 460 + 310 + 221 + 91 + + + + Transmission Config + + + + + 10 + 20 + 71 + 61 + + + + + + + Hex + + + + + + + Text + + + + + + + + + + 550 + 410 + 131 + 41 + + + + Open Serial + + + + + + 460 + 410 + 81 + 41 + + + + About + + + + + +