Compare commits

...

3 Commits

Author SHA1 Message Date
JRNitre
52c4723dd9 20240925 Version 1.0
- 增加了周期扫描可用串口功能
- 增加了发送数据功能
- 增加了接受数据功能
- 增加了在连接串口后禁止更改参数功能
2024-09-25 21:02:40 +08:00
JRNitre
9c3c8a1936 更新 README.md 2024-06-22 23:53:32 +08:00
JRNitre
4cece0cc3e 更新 README.md 2024-06-22 23:53:20 +08:00
58 changed files with 531 additions and 47 deletions

View File

@ -1,12 +1,14 @@
# SerialPortDebug_Tools # SerialPortDebug_Tools
串口调试工具 这是一个由 JRNitre 编写的基于 Windows 平台的串口调试工具
这是一个由 JRNitre 编写的串口调试工具, 功能尚不完善 此软件为 Qt 开发的学习成果,功能会逐渐完善并趋于可用
## 待办 # 当前软件待完善的内容
* 完善 About 界面 - [ ] 优化信息显示形式
* 增加一个详细设置界面 - [ ] 完善hex&text模式选择
* 优化信息显示形式
* 完善hex&text模式选择 # 预计会增加的功能
- [ ] 跨平台支持 (Linux)

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
build/SerialDebug_Tools.exe Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

73
src/.gitignore vendored Normal file
View File

@ -0,0 +1,73 @@
# This file is used to ignore files which are generated
# ----------------------------------------------------------------------------
*~
*.autosave
*.a
*.core
*.moc
*.o
*.obj
*.orig
*.rej
*.so
*.so.*
*_pch.h.cpp
*_resource.rc
*.qm
.#*
*.*#
core
!core/
tags
.DS_Store
.directory
*.debug
Makefile*
*.prl
*.app
moc_*.cpp
ui_*.h
qrc_*.cpp
Thumbs.db
*.res
*.rc
/.qmake.cache
/.qmake.stash
# qtcreator generated files
*.pro.user*
# xemacs temporary files
*.flc
# Vim temporary files
.*.swp
# Visual Studio generated files
*.ib_pdb_index
*.idb
*.ilk
*.pdb
*.sln
*.suo
*.vcproj
*vcproj.*.*.user
*.ncb
*.sdf
*.opensdf
*.vcxproj
*vcxproj.*
# MinGW generated files
*.Debug
*.Release
# Python byte code
*.pyc
# Binaries
# --------
*.dll
*.exe

View File

@ -17,12 +17,15 @@ DEFINES += QT_DEPRECATED_WARNINGS
SOURCES += \ SOURCES += \
main.cpp \ main.cpp \
setting.cpp \
widget.cpp widget.cpp
HEADERS += \ HEADERS += \
setting.h \
widget.h widget.h
FORMS += \ FORMS += \
setting.ui \
widget.ui widget.ui
# Default rules for deployment. # Default rules for deployment.

View File

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject> <!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.11.1, 2024-04-26T20:54:12. --> <!-- Written by QtCreator 4.11.1, 2024-09-25T20:43:19. -->
<qtcreator> <qtcreator>
<data> <data>
<variable>EnvironmentId</variable> <variable>EnvironmentId</variable>
<value type="QByteArray">{34cec845-c4cc-4ae5-952a-77d31d4ebd2e}</value> <value type="QByteArray">{4e4ad3ae-36c7-4321-b44a-701d61ae246a}</value>
</data> </data>
<data> <data>
<variable>ProjectExplorer.Project.ActiveTarget</variable> <variable>ProjectExplorer.Project.ActiveTarget</variable>
@ -71,7 +71,7 @@
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value> <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value> <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0"> <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">E:/SYSTEM/Desktop/PROJECT/CodeLibrary_Next/Cplus/build-06_QtCreator_Cplus_SerialDebug_20240425-Desktop_Qt_5_14_2_MinGW_32_bit-Debug</value> <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">E:/system/desktop/PROJECT/CodeLibrary_Next/Cplus/build-06_QtCreator_Cplus_SerialDebug_20240425-Desktop_Qt_5_14_2_MinGW_32_bit-Debug</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
@ -119,7 +119,7 @@
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value> <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
</valuemap> </valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1"> <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">E:/SYSTEM/Desktop/PROJECT/CodeLibrary_Next/Cplus/build-06_QtCreator_Cplus_SerialDebug_20240425-Desktop_Qt_5_14_2_MinGW_32_bit-Release</value> <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">E:/system/desktop/PROJECT/CodeLibrary_Next/Cplus/build-06_QtCreator_Cplus_SerialDebug_20240425-Desktop_Qt_5_14_2_MinGW_32_bit-Release</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
@ -167,7 +167,7 @@
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value> <value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
</valuemap> </valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2"> <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">E:/SYSTEM/Desktop/PROJECT/CodeLibrary_Next/Cplus/build-06_QtCreator_Cplus_SerialDebug_20240425-Desktop_Qt_5_14_2_MinGW_32_bit-Profile</value> <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">E:/system/desktop/PROJECT/CodeLibrary_Next/Cplus/build-06_QtCreator_Cplus_SerialDebug_20240425-Desktop_Qt_5_14_2_MinGW_32_bit-Profile</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0"> <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0"> <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value> <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
@ -287,8 +287,8 @@
</valuelist> </valuelist>
<value type="int" key="PE.EnvironmentAspect.Base">2</value> <value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/> <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:E:/SYSTEM/Desktop/PROJECT/CodeLibrary_Next/Cplus/06_QtCreator_Cplus_SerialDebug_20240425/06_QtCreator_Cplus_SerialDebug_20240425.pro</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:E:/system/desktop/PROJECT/CodeLibrary_Next/Cplus/06_QtCreator_Cplus_SerialDebug_20240425/06_QtCreator_Cplus_SerialDebug_20240425.pro</value>
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey">E:/SYSTEM/Desktop/PROJECT/CodeLibrary_Next/Cplus/06_QtCreator_Cplus_SerialDebug_20240425/06_QtCreator_Cplus_SerialDebug_20240425.pro</value> <value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey">E:/system/desktop/PROJECT/CodeLibrary_Next/Cplus/06_QtCreator_Cplus_SerialDebug_20240425/06_QtCreator_Cplus_SerialDebug_20240425.pro</value>
<value type="QString" key="RunConfiguration.Arguments"></value> <value type="QString" key="RunConfiguration.Arguments"></value>
<value type="bool" key="RunConfiguration.Arguments.multi">false</value> <value type="bool" key="RunConfiguration.Arguments.multi">false</value>
<value type="QString" key="RunConfiguration.OverrideDebuggerStartup"></value> <value type="QString" key="RunConfiguration.OverrideDebuggerStartup"></value>
@ -299,14 +299,257 @@
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value> <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value> <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
<value type="QString" key="RunConfiguration.WorkingDirectory"></value> <value type="QString" key="RunConfiguration.WorkingDirectory"></value>
<value type="QString" key="RunConfiguration.WorkingDirectory.default">E:/SYSTEM/Desktop/PROJECT/CodeLibrary_Next/Cplus/build-06_QtCreator_Cplus_SerialDebug_20240425-Desktop_Qt_5_14_2_MinGW_32_bit-Release</value> <value type="QString" key="RunConfiguration.WorkingDirectory.default">E:/system/desktop/PROJECT/CodeLibrary_Next/Cplus/build-06_QtCreator_Cplus_SerialDebug_20240425-Desktop_Qt_5_14_2_MinGW_32_bit-Release</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.Target.1</variable>
<valuemap type="QVariantMap">
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 5.14.2 MinGW 64-bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 5.14.2 MinGW 64-bit</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.qt5.5142.win64_mingw73_kit</value>
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">1</value>
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">E:/system/desktop/PROJECT/CodeLibrary_Next/Cplus/build-06_QtCreator_Cplus_SerialDebug_20240425-Desktop_Qt_5_14_2_MinGW_64_bit-Debug</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">true</value>
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">false</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">E:/system/desktop/PROJECT/CodeLibrary_Next/Cplus/build-06_QtCreator_Cplus_SerialDebug_20240425-Desktop_Qt_5_14_2_MinGW_64_bit-Release</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">true</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Release</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">E:/system/desktop/PROJECT/CodeLibrary_Next/Cplus/build-06_QtCreator_Cplus_SerialDebug_20240425-Desktop_Qt_5_14_2_MinGW_64_bit-Profile</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">true</value>
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">true</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">true</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.BuildTargets"/>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
<value type="bool" key="Qt4ProjectManager.MakeStep.OverrideMakeflags">false</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Profile</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">3</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Deploy</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
<value type="QString" key="Analyzer.Perf.CallgraphMode">dwarf</value>
<valuelist type="QVariantList" key="Analyzer.Perf.Events">
<value type="QString">cpu-cycles</value>
</valuelist>
<valuelist type="QVariantList" key="Analyzer.Perf.ExtraArguments"/>
<value type="int" key="Analyzer.Perf.Frequency">250</value>
<valuelist type="QVariantList" key="Analyzer.Perf.RecordArguments">
<value type="QString">-e</value>
<value type="QString">cpu-cycles</value>
<value type="QString">--call-graph</value>
<value type="QString">dwarf,4096</value>
<value type="QString">-F</value>
<value type="QString">250</value>
</valuelist>
<value type="QString" key="Analyzer.Perf.SampleMode">-F</value>
<value type="bool" key="Analyzer.Perf.Settings.UseGlobalSettings">true</value>
<value type="int" key="Analyzer.Perf.StackSize">4096</value>
<value type="bool" key="Analyzer.QmlProfiler.AggregateTraces">false</value>
<value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value>
<value type="uint" key="Analyzer.QmlProfiler.FlushInterval">1000</value>
<value type="QString" key="Analyzer.QmlProfiler.LastTraceFile"></value>
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
<value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
<value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
<value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
<value type="QString" key="Analyzer.Valgrind.KCachegrindExecutable">kcachegrind</value>
<value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
<value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
<value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
<value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
<value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
<value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
<value type="int">0</value>
<value type="int">1</value>
<value type="int">2</value>
<value type="int">3</value>
<value type="int">4</value>
<value type="int">5</value>
<value type="int">6</value>
<value type="int">7</value>
<value type="int">8</value>
<value type="int">9</value>
<value type="int">10</value>
<value type="int">11</value>
<value type="int">12</value>
<value type="int">13</value>
<value type="int">14</value>
</valuelist>
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:E:/system/desktop/PROJECT/CodeLibrary_Next/Cplus/06_QtCreator_Cplus_SerialDebug_20240425/06_QtCreator_Cplus_SerialDebug_20240425.pro</value>
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey">E:/system/desktop/PROJECT/CodeLibrary_Next/Cplus/06_QtCreator_Cplus_SerialDebug_20240425/06_QtCreator_Cplus_SerialDebug_20240425.pro</value>
<value type="QString" key="RunConfiguration.Arguments"></value>
<value type="bool" key="RunConfiguration.Arguments.multi">false</value>
<value type="QString" key="RunConfiguration.OverrideDebuggerStartup"></value>
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
<value type="bool" key="RunConfiguration.UseLibrarySearchPath">true</value>
<value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
<value type="QString" key="RunConfiguration.WorkingDirectory"></value>
<value type="QString" key="RunConfiguration.WorkingDirectory.default">E:/system/desktop/PROJECT/CodeLibrary_Next/Cplus/build-06_QtCreator_Cplus_SerialDebug_20240425-Desktop_Qt_5_14_2_MinGW_64_bit-Release</value>
</valuemap> </valuemap>
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value> <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
</valuemap> </valuemap>
</data> </data>
<data> <data>
<variable>ProjectExplorer.Project.TargetCount</variable> <variable>ProjectExplorer.Project.TargetCount</variable>
<value type="int">1</value> <value type="int">2</value>
</data> </data>
<data> <data>
<variable>ProjectExplorer.Project.Updater.FileVersion</variable> <variable>ProjectExplorer.Project.Updater.FileVersion</variable>

View File

@ -2,6 +2,12 @@
#include <QApplication> #include <QApplication>
// 更新报告
// 增加了定时扫描是否有可用串口功能
// 发送功能
// 接收功能
// 在连接了串口后禁止改动波特率等参数
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
QApplication a(argc, argv); QApplication a(argc, argv);

14
src/setting.cpp Normal file
View File

@ -0,0 +1,14 @@
#include "setting.h"
#include "ui_setting.h"
setting::setting(QWidget *parent) :
QWidget(parent),
ui(new Ui::setting)
{
ui->setupUi(this);
}
setting::~setting()
{
delete ui;
}

22
src/setting.h Normal file
View File

@ -0,0 +1,22 @@
#ifndef SETTING_H
#define SETTING_H
#include <QWidget>
namespace Ui {
class setting;
}
class setting : public QWidget
{
Q_OBJECT
public:
explicit setting(QWidget *parent = nullptr);
~setting();
private:
Ui::setting *ui;
};
#endif // SETTING_H

21
src/setting.ui Normal file
View File

@ -0,0 +1,21 @@
<ui version="4.0">
<author/>
<comment/>
<exportmacro/>
<class>setting</class>
<widget name="setting" class="QWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
</widget>
<pixmapfunction/>
<connections/>
</ui>

View File

@ -9,32 +9,51 @@ Widget::Widget(QWidget *parent)
serialPort = new QSerialPort(this); serialPort = new QSerialPort(this);
// 循环扫描可用串口
QTimer *timer = new QTimer(this);
QStringList previousPorts;
timer->setInterval(500);
QObject::connect(timer, &QTimer::timeout, [this, &previousPorts]() {
QStringList currentPorts;
const QList<QSerialPortInfo> ports = QSerialPortInfo::availablePorts();
for (const QSerialPortInfo &info : ports){
currentPorts << info.portName();
}
if (currentPorts != previousPorts){
ui->config_port_comboBox->clear();
for (const QString &portName : currentPorts){
ui->config_port_comboBox->addItem(portName);
}
previousPorts = currentPorts;
}
});
timer -> start();
// 修改窗口标题 // 修改窗口标题
this->setWindowTitle("Design by JRNitre - Serial Port Debug Tools"); this->setWindowTitle("Serial Port Debug Tools - by JRNitre");
// 读取系统可用串口
// 发送到下拉框中
ui->config_port_comboBox->clear();
foreach(const QSerialPortInfo &info, QSerialPortInfo::availablePorts()){
ui->config_port_comboBox->addItem(info.portName());
}
// 串口配置数据初始化 // 串口配置数据初始化
// 默认接收&发送模式 // 默认接收&发送模式
// TRUE - Hex if (recive_config_select == 1){
// FALSE - Bool
if (recive_config_select){
ui->receive_hexmode->setChecked(1);
}else{
ui->receivetextmode->setChecked(1); ui->receivetextmode->setChecked(1);
} }
if (transmission_config_select){ if (recive_config_select == 0){
ui->transmission_hexmode->setChecked(1); ui->receive_hexmode->setChecked(1);
}else{ }
if (transmission_config_select == 1){
ui->transmission_textmode->setChecked(1); ui->transmission_textmode->setChecked(1);
} }
if (transmission_config_select == 1){
ui->transmission_hexmode->setChecked(1);
}
// Enter 发送数据
QShortcut *shortcut = new QShortcut(QKeySequence(Qt::Key_Return), ui->transmission_Edit);
connect(shortcut, &QShortcut::activated, this, &Widget::on_transmission_send_Button_clicked);
// 链接信号与槽函数 // 链接信号与槽函数
// 发送模式配置 -> hex模式被选择 -> Widget::receiveHex_selectSlot() // 发送模式配置 -> hex模式被选择 -> Widget::receiveHex_selectSlot()
@ -46,6 +65,8 @@ Widget::Widget(QWidget *parent)
// 接收模式配置 -> text模式被选择 -> Widget::transmissionText_selectSlot() // 接收模式配置 -> text模式被选择 -> Widget::transmissionText_selectSlot()
connect(ui->transmission_textmode, &QRadioButton::pressed, this, &Widget::transmissionText_selectSlot); connect(ui->transmission_textmode, &QRadioButton::pressed, this, &Widget::transmissionText_selectSlot);
connect(serialPort, SIGNAL(readyRead()), this, SLOT(serialPort_readyRead()));
// 读取默认波特率并赋值 // 读取默认波特率并赋值
baud_rate = ui->config_baud_comboBox->currentText().toInt(); baud_rate = ui->config_baud_comboBox->currentText().toInt();
// 读取默认数据位长度并赋值 // 读取默认数据位长度并赋值
@ -94,20 +115,20 @@ void Widget::on_updateport_Button_clicked()
// 发送模式 - Hex 模式被选中 // 发送模式 - Hex 模式被选中
void Widget::receiveHex_selectSlot(){ void Widget::receiveHex_selectSlot(){
ui->receive_Edit->insertPlainText("Receive Hex select\n"); //ui->receive_Edit->insertPlainText("Receive Hex select\n");
} }
// 发送模式 - Text 模式被选中 // 发送模式 - Text 模式被选中
void Widget::receiveText_selectSlot(){ void Widget::receiveText_selectSlot(){
ui->receive_Edit->insertPlainText("Receive Text select\n"); //ui->receive_Edit->insertPlainText("Receive Text select\n");
} }
// 接收模式 - Hex 模式被选中 // 接收模式 - Hex 模式被选中
void Widget::transmissionHex_selectSlot(){ void Widget::transmissionHex_selectSlot(){
ui->receive_Edit->insertPlainText("Transmission Hex select\n"); //ui->receive_Edit->insertPlainText("Transmission Hex select\n");
} }
// 接收模式 - Text 模式被选中 // 接收模式 - Text 模式被选中
void Widget::transmissionText_selectSlot(){ void Widget::transmissionText_selectSlot(){
ui->receive_Edit->insertPlainText("Transmission Text select\n"); //ui->receive_Edit->insertPlainText("Transmission Text select\n");
} }
// 波特率选择 // 波特率选择
@ -210,6 +231,9 @@ void Widget::on_openserial_button_clicked()
// 按下后是否需要执行打开端口功能 // 按下后是否需要执行打开端口功能
if (ui->openserial_button->text() == "Open Serial"){ if (ui->openserial_button->text() == "Open Serial"){
// 提示正在连接 // 提示正在连接
QDateTime dateTime = QDateTime::currentDateTime();
QString dateStr = dateTime.toString("yyyy-MM-dd hh:mm:ss");
ui->receive_Edit->insertPlainText("[" + dateStr + "]\n");
ui->receive_Edit->insertPlainText("Connect to Serial " + ui->config_port_comboBox->currentText() + " ...\n"); ui->receive_Edit->insertPlainText("Connect to Serial " + ui->config_port_comboBox->currentText() + " ...\n");
// 端口开启成功 // 端口开启成功
if (serialPort->open(QIODevice::ReadWrite) == true){ if (serialPort->open(QIODevice::ReadWrite) == true){
@ -217,6 +241,10 @@ void Widget::on_openserial_button_clicked()
ui->openserial_button->setText("Close Serial"); ui->openserial_button->setText("Close Serial");
// 让端口下拉框不可选 // 让端口下拉框不可选
ui->config_port_comboBox->setEnabled(false); ui->config_port_comboBox->setEnabled(false);
ui->config_baud_comboBox->setEnabled(false);
ui->config_databit_comboBox->setEnabled(false);
ui->config_stopbit_comboBox->setEnabled(false);
ui->config_check_comboBox->setEnabled(false);
// 更新提示 // 更新提示
ui->status->setText("Connect to " + ui->config_port_comboBox->currentText()); ui->status->setText("Connect to " + ui->config_port_comboBox->currentText());
@ -235,14 +263,75 @@ void Widget::on_openserial_button_clicked()
ui->openserial_button->setText("Open Serial"); ui->openserial_button->setText("Open Serial");
// 让端口下拉框可选 // 让端口下拉框可选
ui->config_port_comboBox->setEnabled(true); ui->config_port_comboBox->setEnabled(true);
ui->config_baud_comboBox->setEnabled(true);
ui->config_databit_comboBox->setEnabled(true);
ui->config_stopbit_comboBox->setEnabled(true);
ui->config_check_comboBox->setEnabled(true);
ui->status->setText("Disconnect"); ui->status->setText("Disconnect");
ui->status->setStyleSheet("color:black"); ui->status->setStyleSheet("color:black");
} }
} }
// Button: About // Button: send
void Widget::on_about_button_clicked() void Widget::on_transmission_send_Button_clicked()
{ {
QMessageBox::information(this, "Info", "null"); QByteArray qbytearray;
// 判断发送的内容是否为空
if (ui->transmission_Edit->toPlainText().isEmpty()){
QMessageBox::information(this, tr("Attention"), tr("No Send Data"), QMessageBox::Ok);
return;
}
// utf8 模式获取需要发送的数据
SendText = ui->transmission_Edit->toPlainText().toUtf8();
// 判断发送模式
if (ui->transmission_textmode->isChecked()){
qbytearray = SendText;
}
if (ui->transmission_hexmode->isChecked()){
qbytearray = SendText.toHex();
}
// 判断是否连接了串口
if (serialPort->isOpen()){
serialPort->write(qbytearray);
if (ui->transmission_textmode->isChecked()){
ui->receive_Edit->insertPlainText("[Send]\n" + SendText + "\n");
}
if (ui->transmission_hexmode->isChecked()){
ui->receive_Edit->insertPlainText("[Send]\n" + SendText.toHex(' ').toUpper() + "\n");
}
} else {
QMessageBox::information(this, tr("Attention"), tr("Not connected to an available serial port"), QMessageBox::Ok);
}
ui->transmission_Edit->clear();
}
// Button: setting
void Widget::on_setting_button_clicked()
{
setting *set_window = new setting();
set_window->show();
}
// 接受数据
void Widget::serialPort_readyRead(){
// 读取串口中所有的数据
QByteArray receive_data = serialPort->readAll();
QString str_reveive_data;
if (ui->receivetextmode->isChecked()){
str_reveive_data = QString(receive_data);
}
if (ui->receive_hexmode->isChecked()){
str_reveive_data = receive_data.toHex(' ').toUpper();
}
ui->receive_Edit->insertPlainText("[Receive]\n" + str_reveive_data + "\n");
} }

View File

@ -6,6 +6,10 @@
#include <QMessageBox> #include <QMessageBox>
#include <QSerialPort> #include <QSerialPort>
#include <QSerialPortInfo> #include <QSerialPortInfo>
#include <QDateTime>
#include <QTimer>
#include <QShortcut>
#include "setting.h"
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
namespace Ui { class Widget; } namespace Ui { class Widget; }
@ -43,7 +47,11 @@ private slots:
void on_openserial_button_clicked(); void on_openserial_button_clicked();
void on_about_button_clicked(); void on_transmission_send_Button_clicked();
void on_setting_button_clicked();
void serialPort_readyRead();
private: private:
Ui::Widget *ui; Ui::Widget *ui;
@ -54,10 +62,10 @@ private:
int id = 0; int id = 0;
// 发送&接收模式 - 通过调整此处可以更改默认值 // 发送&接收模式 - 通过调整此处可以更改默认值
// TRUE - Hex // 1 - Text
// FALSE - Bool // 0 - Hex
bool recive_config_select = true; int recive_config_select = 1;
bool transmission_config_select = true; int transmission_config_select = 1;
// 波特率 // 波特率
int baud_rate = 0; int baud_rate = 0;
@ -70,5 +78,8 @@ private:
// 1 - odd 奇 // 1 - odd 奇
// 2 - even 偶 // 2 - even 偶
quint8 check = 0; quint8 check = 0;
QByteArray SendText,ReceiveText;
}; };
#endif // WIDGET_H #endif // WIDGET_H

View File

@ -459,7 +459,7 @@
<string>Open Serial</string> <string>Open Serial</string>
</property> </property>
</widget> </widget>
<widget class="QPushButton" name="about_button"> <widget class="QPushButton" name="setting_button">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>460</x> <x>460</x>
@ -469,7 +469,7 @@
</rect> </rect>
</property> </property>
<property name="text"> <property name="text">
<string>About</string> <string>setting</string>
</property> </property>
</widget> </widget>
</widget> </widget>