2025-03-12T17:29:52
This commit is contained in:
parent
3e1a51b48b
commit
adca7786c4
@ -1,21 +0,0 @@
|
|||||||
QMAKE_CXX.QT_COMPILER_STDCXX = 199711L
|
|
||||||
QMAKE_CXX.QMAKE_MSC_VER = 1943
|
|
||||||
QMAKE_CXX.QMAKE_MSC_FULL_VER = 194334808
|
|
||||||
QMAKE_CXX.COMPILER_MACROS = \
|
|
||||||
QT_COMPILER_STDCXX \
|
|
||||||
QMAKE_MSC_VER \
|
|
||||||
QMAKE_MSC_FULL_VER
|
|
||||||
QMAKE_CXX.INCDIRS = \
|
|
||||||
"D:\\Program Files\\vs\\community\\VC\\Tools\\MSVC\\14.43.34808\\include" \
|
|
||||||
"D:\\Program Files\\vs\\community\\VC\\Tools\\MSVC\\14.43.34808\\ATLMFC\\include" \
|
|
||||||
"D:\\Program Files\\vs\\community\\VC\\Auxiliary\\VS\\include" \
|
|
||||||
"D:\\Windows Kits\\10\\include\\10.0.22621.0\\ucrt" \
|
|
||||||
"D:\\Windows Kits\\10\\\\include\\10.0.22621.0\\\\um" \
|
|
||||||
"D:\\Windows Kits\\10\\\\include\\10.0.22621.0\\\\shared" \
|
|
||||||
"D:\\Windows Kits\\10\\\\include\\10.0.22621.0\\\\winrt" \
|
|
||||||
"D:\\Windows Kits\\10\\\\include\\10.0.22621.0\\\\cppwinrt"
|
|
||||||
QMAKE_CXX.LIBDIRS = \
|
|
||||||
"D:\\Program Files\\vs\\community\\VC\\Tools\\MSVC\\14.43.34808\\ATLMFC\\lib\\x64" \
|
|
||||||
"D:\\Program Files\\vs\\community\\VC\\Tools\\MSVC\\14.43.34808\\lib\\x64" \
|
|
||||||
"D:\\Windows Kits\\10\\lib\\10.0.22621.0\\ucrt\\x64" \
|
|
||||||
"D:\\Windows Kits\\10\\\\lib\\10.0.22621.0\\\\um\\x64"
|
|
||||||
@ -16,9 +16,9 @@ DEFINES += QT_DEPRECATED_WARNINGS
|
|||||||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
|
global.cpp \
|
||||||
ui/centralwidget.cpp \
|
ui/centralwidget.cpp \
|
||||||
main.cpp \
|
main.cpp \
|
||||||
mainwidget.cpp \
|
|
||||||
mainwindow.cpp \
|
mainwindow.cpp \
|
||||||
serialport/dataparser.cpp \
|
serialport/dataparser.cpp \
|
||||||
serialport/serialport.cpp \
|
serialport/serialport.cpp \
|
||||||
@ -29,8 +29,8 @@ SOURCES += \
|
|||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
defines.h \
|
defines.h \
|
||||||
|
global.h \
|
||||||
ui/centralwidget.h \
|
ui/centralwidget.h \
|
||||||
mainwidget.h \
|
|
||||||
mainwindow.h \
|
mainwindow.h \
|
||||||
serialport/dataparser.h \
|
serialport/dataparser.h \
|
||||||
serialport/protocol.h \
|
serialport/protocol.h \
|
||||||
@ -53,3 +53,6 @@ thirdparty/qcustomplot
|
|||||||
qnx: target.path = /tmp/$${TARGET}/bin
|
qnx: target.path = /tmp/$${TARGET}/bin
|
||||||
else: unix:!android: target.path = /opt/$${TARGET}/bin
|
else: unix:!android: target.path = /opt/$${TARGET}/bin
|
||||||
!isEmpty(target.path): INSTALLS += target
|
!isEmpty(target.path): INSTALLS += target
|
||||||
|
|
||||||
|
RESOURCES += \
|
||||||
|
images.qrc
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@ -1,25 +0,0 @@
|
|||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
|
||||||
# Visual Studio Version 17
|
|
||||||
VisualStudioVersion = 17.13.35825.156 d17.13
|
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AnalysTool", "AnalysTool.vcxproj", "{F30D2791-A8A0-38F9-928F-89C2B41456F0}"
|
|
||||||
EndProject
|
|
||||||
Global
|
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
|
||||||
Debug|x64 = Debug|x64
|
|
||||||
Release|x64 = Release|x64
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
|
||||||
{F30D2791-A8A0-38F9-928F-89C2B41456F0}.Debug|x64.ActiveCfg = Debug|x64
|
|
||||||
{F30D2791-A8A0-38F9-928F-89C2B41456F0}.Debug|x64.Build.0 = Debug|x64
|
|
||||||
{F30D2791-A8A0-38F9-928F-89C2B41456F0}.Release|x64.ActiveCfg = Release|x64
|
|
||||||
{F30D2791-A8A0-38F9-928F-89C2B41456F0}.Release|x64.Build.0 = Release|x64
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
|
||||||
HideSolutionNode = FALSE
|
|
||||||
EndGlobalSection
|
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
|
||||||
SolutionGuid = {084FD268-695B-4117-A631-0128BC510B8E}
|
|
||||||
EndGlobalSection
|
|
||||||
EndGlobal
|
|
||||||
@ -1,227 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<ItemGroup Label="ProjectConfigurations">
|
|
||||||
<ProjectConfiguration Include="Release|x64">
|
|
||||||
<Configuration>Release</Configuration>
|
|
||||||
<Platform>x64</Platform>
|
|
||||||
</ProjectConfiguration>
|
|
||||||
<ProjectConfiguration Include="Debug|x64">
|
|
||||||
<Configuration>Debug</Configuration>
|
|
||||||
<Platform>x64</Platform>
|
|
||||||
</ProjectConfiguration>
|
|
||||||
</ItemGroup>
|
|
||||||
<PropertyGroup Label="Globals">
|
|
||||||
<ProjectGuid>{F30D2791-A8A0-38F9-928F-89C2B41456F0}</ProjectGuid>
|
|
||||||
<RootNamespace>AnalysTool</RootNamespace>
|
|
||||||
<Keyword>QtVS_v304</Keyword>
|
|
||||||
<WindowsTargetPlatformVersion>10.0.22621.0</WindowsTargetPlatformVersion>
|
|
||||||
<WindowsTargetPlatformMinVersion>10.0.22621.0</WindowsTargetPlatformMinVersion>
|
|
||||||
<QtMsBuild Condition="'$(QtMsBuild)'=='' OR !Exists('$(QtMsBuild)\qt.targets')">$(MSBuildProjectDirectory)\QtMsBuild</QtMsBuild>
|
|
||||||
</PropertyGroup>
|
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
|
||||||
<PlatformToolset>v142</PlatformToolset>
|
|
||||||
<OutputDirectory>release\</OutputDirectory>
|
|
||||||
<ATLMinimizesCRunTimeLibraryUsage>false</ATLMinimizesCRunTimeLibraryUsage>
|
|
||||||
<CharacterSet>NotSet</CharacterSet>
|
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
|
||||||
<IntermediateDirectory>release\</IntermediateDirectory>
|
|
||||||
<PrimaryOutput>AnalysTool</PrimaryOutput>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
|
||||||
<PlatformToolset>v141</PlatformToolset>
|
|
||||||
<OutputDirectory>debug\</OutputDirectory>
|
|
||||||
<ATLMinimizesCRunTimeLibraryUsage>false</ATLMinimizesCRunTimeLibraryUsage>
|
|
||||||
<CharacterSet>NotSet</CharacterSet>
|
|
||||||
<ConfigurationType>Application</ConfigurationType>
|
|
||||||
<IntermediateDirectory>debug\</IntermediateDirectory>
|
|
||||||
<PrimaryOutput>AnalysTool</PrimaryOutput>
|
|
||||||
</PropertyGroup>
|
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
|
||||||
<Import Project="$(QtMsBuild)\qt_defaults.props" Condition="Exists('$(QtMsBuild)\qt_defaults.props')" />
|
|
||||||
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
|
||||||
<QtInstall>5.14.2_msvc2017_64</QtInstall>
|
|
||||||
<QtModules>core;gui;widgets;serialport;printsupport</QtModules>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
|
||||||
<QtInstall>5.14.2_msvc2017_64</QtInstall>
|
|
||||||
<QtModules>core;gui;widgets;serialport;printsupport</QtModules>
|
|
||||||
</PropertyGroup>
|
|
||||||
<Target Name="QtMsBuildNotFound" BeforeTargets="CustomBuild;ClCompile" Condition="!Exists('$(QtMsBuild)\qt.targets') OR !Exists('$(QtMsBuild)\Qt.props')">
|
|
||||||
<Message Importance="High" Text="QtMsBuild: could not locate qt.targets, qt.props; project may not build correctly." />
|
|
||||||
</Target>
|
|
||||||
<ImportGroup Label="ExtensionSettings" />
|
|
||||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
|
|
||||||
<Import Project="$(QtMsBuild)\Qt.props" />
|
|
||||||
</ImportGroup>
|
|
||||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
|
|
||||||
<Import Project="$(QtMsBuild)\Qt.props" />
|
|
||||||
</ImportGroup>
|
|
||||||
<PropertyGroup Label="UserMacros" />
|
|
||||||
<PropertyGroup>
|
|
||||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">release\</OutDir>
|
|
||||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">release\</IntDir>
|
|
||||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AnalysTool</TargetName>
|
|
||||||
<IgnoreImportLibrary Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</IgnoreImportLibrary>
|
|
||||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
|
|
||||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)..\build-debug</OutDir>
|
|
||||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)..\build-debug</IntDir>
|
|
||||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AnalysTool</TargetName>
|
|
||||||
<IgnoreImportLibrary Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</IgnoreImportLibrary>
|
|
||||||
</PropertyGroup>
|
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
|
||||||
<ClCompile>
|
|
||||||
<AdditionalIncludeDirectories>GeneratedFiles\$(ConfigurationName);GeneratedFiles;.;serialport;ui;thirdparty\qcustomplot;release;/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
|
||||||
<AdditionalOptions>-Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 %(AdditionalOptions)</AdditionalOptions>
|
|
||||||
<AssemblerListingLocation>release\</AssemblerListingLocation>
|
|
||||||
<BrowseInformation>false</BrowseInformation>
|
|
||||||
<DebugInformationFormat>None</DebugInformationFormat>
|
|
||||||
<DisableSpecificWarnings>4577;4467;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
|
||||||
<ExceptionHandling>Sync</ExceptionHandling>
|
|
||||||
<ObjectFileName>release\</ObjectFileName>
|
|
||||||
<Optimization>MaxSpeed</Optimization>
|
|
||||||
<PreprocessorDefinitions>_WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WIN64;QT_DEPRECATED_WARNINGS;NDEBUG;QT_NO_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
||||||
<PreprocessToFile>false</PreprocessToFile>
|
|
||||||
<ProgramDataBaseFileName>
|
|
||||||
</ProgramDataBaseFileName>
|
|
||||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
|
||||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
|
||||||
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
|
|
||||||
<WarningLevel>Level3</WarningLevel>
|
|
||||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
|
||||||
</ClCompile>
|
|
||||||
<Link>
|
|
||||||
<AdditionalDependencies>shell32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
|
||||||
<AdditionalLibraryDirectories>C:\openssl\lib;C:\Utils\my_sql\mysql-5.7.25-winx64\lib;C:\Utils\postgresql\pgsql\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
|
||||||
<AdditionalOptions>"/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" %(AdditionalOptions)</AdditionalOptions>
|
|
||||||
<DataExecutionPrevention>true</DataExecutionPrevention>
|
|
||||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
|
||||||
<IgnoreImportLibrary>true</IgnoreImportLibrary>
|
|
||||||
<LinkIncremental>false</LinkIncremental>
|
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
|
||||||
<OutputFile>$(OutDir)\AnalysTool.exe</OutputFile>
|
|
||||||
<RandomizedBaseAddress>true</RandomizedBaseAddress>
|
|
||||||
<SubSystem>Windows</SubSystem>
|
|
||||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
|
||||||
</Link>
|
|
||||||
<Midl>
|
|
||||||
<DefaultCharType>Unsigned</DefaultCharType>
|
|
||||||
<EnableErrorChecks>None</EnableErrorChecks>
|
|
||||||
<WarningLevel>0</WarningLevel>
|
|
||||||
</Midl>
|
|
||||||
<ResourceCompile>
|
|
||||||
<PreprocessorDefinitions>_WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WIN64;QT_DEPRECATED_WARNINGS;NDEBUG;QT_NO_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
||||||
</ResourceCompile>
|
|
||||||
<QtMoc>
|
|
||||||
<CompilerFlavor>msvc</CompilerFlavor>
|
|
||||||
<Include>./$(Configuration)/moc_predefs.h</Include>
|
|
||||||
<ExecutionDescription>Moc'ing %(Identity)...</ExecutionDescription>
|
|
||||||
<DynamicSource>output</DynamicSource>
|
|
||||||
<QtMocDir>$(Configuration)</QtMocDir>
|
|
||||||
<QtMocFileName>moc_%(Filename).cpp</QtMocFileName>
|
|
||||||
</QtMoc>
|
|
||||||
<QtUic>
|
|
||||||
<ExecutionDescription>Uic'ing %(Identity)...</ExecutionDescription>
|
|
||||||
<QtUicDir>$(ProjectDir)</QtUicDir>
|
|
||||||
<QtUicFileName>ui_%(Filename).h</QtUicFileName>
|
|
||||||
</QtUic>
|
|
||||||
</ItemDefinitionGroup>
|
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
|
||||||
<ClCompile>
|
|
||||||
<AdditionalIncludeDirectories>GeneratedFiles\$(ConfigurationName);GeneratedFiles;.;serialport;ui;thirdparty\qcustomplot;debug;/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
|
||||||
<AdditionalOptions>-Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 %(AdditionalOptions)</AdditionalOptions>
|
|
||||||
<AssemblerListingLocation>debug\</AssemblerListingLocation>
|
|
||||||
<BrowseInformation>false</BrowseInformation>
|
|
||||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
|
||||||
<DisableSpecificWarnings>4577;4467;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
|
||||||
<ExceptionHandling>Sync</ExceptionHandling>
|
|
||||||
<ObjectFileName>debug\</ObjectFileName>
|
|
||||||
<Optimization>Disabled</Optimization>
|
|
||||||
<PreprocessorDefinitions>_WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WIN64;QT_DEPRECATED_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
||||||
<PreprocessToFile>false</PreprocessToFile>
|
|
||||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
|
||||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
|
||||||
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
|
|
||||||
<WarningLevel>Level3</WarningLevel>
|
|
||||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
|
||||||
</ClCompile>
|
|
||||||
<Link>
|
|
||||||
<AdditionalDependencies>shell32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
|
||||||
<AdditionalLibraryDirectories>C:\openssl\lib;C:\Utils\my_sql\mysql-5.7.25-winx64\lib;C:\Utils\postgresql\pgsql\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
|
||||||
<AdditionalOptions>"/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" %(AdditionalOptions)</AdditionalOptions>
|
|
||||||
<DataExecutionPrevention>true</DataExecutionPrevention>
|
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
|
||||||
<IgnoreImportLibrary>true</IgnoreImportLibrary>
|
|
||||||
<OutputFile>$(OutDir)\AnalysTool.exe</OutputFile>
|
|
||||||
<RandomizedBaseAddress>true</RandomizedBaseAddress>
|
|
||||||
<SubSystem>Windows</SubSystem>
|
|
||||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
|
||||||
</Link>
|
|
||||||
<Midl>
|
|
||||||
<DefaultCharType>Unsigned</DefaultCharType>
|
|
||||||
<EnableErrorChecks>None</EnableErrorChecks>
|
|
||||||
<WarningLevel>0</WarningLevel>
|
|
||||||
</Midl>
|
|
||||||
<ResourceCompile>
|
|
||||||
<PreprocessorDefinitions>_WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WIN64;QT_DEPRECATED_WARNINGS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
||||||
</ResourceCompile>
|
|
||||||
<QtUic>
|
|
||||||
<ExecutionDescription>Uic'ing %(Identity)...</ExecutionDescription>
|
|
||||||
<QtUicDir>$(ProjectDir)</QtUicDir>
|
|
||||||
<QtUicFileName>ui_%(Filename).h</QtUicFileName>
|
|
||||||
</QtUic>
|
|
||||||
<QtMoc>
|
|
||||||
<CompilerFlavor>msvc</CompilerFlavor>
|
|
||||||
<Include>./$(Configuration)/moc_predefs.h</Include>
|
|
||||||
<ExecutionDescription>Moc'ing %(Identity)...</ExecutionDescription>
|
|
||||||
<DynamicSource>output</DynamicSource>
|
|
||||||
<QtMocDir>$(Configuration)</QtMocDir>
|
|
||||||
<QtMocFileName>moc_%(Filename).cpp</QtMocFileName>
|
|
||||||
</QtMoc>
|
|
||||||
</ItemDefinitionGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ClCompile Include="ui\centralwidget.cpp" />
|
|
||||||
<ClCompile Include="serialport\dataparser.cpp" />
|
|
||||||
<ClCompile Include="main.cpp" />
|
|
||||||
<ClCompile Include="mainwidget.cpp" />
|
|
||||||
<ClCompile Include="mainwindow.cpp" />
|
|
||||||
<ClCompile Include="thirdparty\qcustomplot\qcustomplot.cpp" />
|
|
||||||
<ClCompile Include="ui\realtimedataform.cpp" />
|
|
||||||
<ClCompile Include="serialport\serialport.cpp" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<QtMoc Include="ui\centralwidget.h" />
|
|
||||||
<ClInclude Include="serialport\dataparser.h" />
|
|
||||||
<QtMoc Include="mainwidget.h" />
|
|
||||||
<QtMoc Include="mainwindow.h" />
|
|
||||||
<ClInclude Include="serialport\protocol.h" />
|
|
||||||
<QtMoc Include="thirdparty\qcustomplot\qcustomplot.h" />
|
|
||||||
<QtMoc Include="ui\realtimedataform.h" />
|
|
||||||
<QtMoc Include="serialport\serialport.h" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<CustomBuild Include="debug\moc_predefs.h.cbt">
|
|
||||||
<FileType>Document</FileType>
|
|
||||||
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(QTDIR)\mkspecs\features\data\dummy.cpp;%(AdditionalInputs)</AdditionalInputs>
|
|
||||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">cl -Bx"$(QTDIR)\bin\qmake.exe" -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus -Zi -MDd -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -E $(QTDIR)\mkspecs\features\data\dummy.cpp 2>NUL >$(IntDir)\moc_predefs.h</Command>
|
|
||||||
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Generate moc_predefs.h</Message>
|
|
||||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(IntDir)\moc_predefs.h;%(Outputs)</Outputs>
|
|
||||||
</CustomBuild>
|
|
||||||
<CustomBuild Include="release\moc_predefs.h.cbt">
|
|
||||||
<FileType>Document</FileType>
|
|
||||||
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(QTDIR)\mkspecs\features\data\dummy.cpp;%(AdditionalInputs)</AdditionalInputs>
|
|
||||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">cl -Bx"$(QTDIR)\bin\qmake.exe" -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -Zc:referenceBinding -Zc:__cplusplus -O2 -MD -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -E $(QTDIR)\mkspecs\features\data\dummy.cpp 2>NUL >$(IntDir)\moc_predefs.h</Command>
|
|
||||||
<Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Generate moc_predefs.h</Message>
|
|
||||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(IntDir)\moc_predefs.h;%(Outputs)</Outputs>
|
|
||||||
</CustomBuild>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<QtUic Include="mainwindow.ui" />
|
|
||||||
<QtUic Include="ui\realtimedataform.ui" />
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
|
||||||
<Import Project="$(QtMsBuild)\qt.targets" Condition="Exists('$(QtMsBuild)\qt.targets')" />
|
|
||||||
<ImportGroup Label="ExtensionTargets" />
|
|
||||||
</Project>
|
|
||||||
@ -1,107 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<ItemGroup>
|
|
||||||
<Filter Include="Form Files">
|
|
||||||
<UniqueIdentifier>{99349809-55BA-4b9d-BF79-8FDBB0286EB3}</UniqueIdentifier>
|
|
||||||
<Extensions>ui</Extensions>
|
|
||||||
<ParseFiles>false</ParseFiles>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="Form Files">
|
|
||||||
<UniqueIdentifier>{99349809-55BA-4b9d-BF79-8FDBB0286EB3}</UniqueIdentifier>
|
|
||||||
<Extensions>ui</Extensions>
|
|
||||||
<ParseFiles>false</ParseFiles>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="Generated Files">
|
|
||||||
<UniqueIdentifier>{71ED8ED8-ACB9-4CE9-BBE1-E00B30144E11}</UniqueIdentifier>
|
|
||||||
<Extensions>cpp;c;cxx;moc;h;def;odl;idl;res;</Extensions>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="Generated Files">
|
|
||||||
<UniqueIdentifier>{71ED8ED8-ACB9-4CE9-BBE1-E00B30144E11}</UniqueIdentifier>
|
|
||||||
<Extensions>cpp;c;cxx;moc;h;def;odl;idl;res;</Extensions>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="Header Files">
|
|
||||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
|
||||||
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="Header Files">
|
|
||||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
|
||||||
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="Source Files">
|
|
||||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
|
||||||
<Extensions>cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="Source Files">
|
|
||||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
|
||||||
<Extensions>cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
|
||||||
</Filter>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<ClCompile Include="ui\centralwidget.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="serialport\dataparser.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="main.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="mainwidget.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="mainwindow.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="thirdparty\qcustomplot\qcustomplot.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="ui\realtimedataform.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="serialport\serialport.cpp">
|
|
||||||
<Filter>Source Files</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<QtMoc Include="ui\centralwidget.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</QtMoc>
|
|
||||||
<ClInclude Include="serialport\dataparser.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<QtMoc Include="mainwidget.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</QtMoc>
|
|
||||||
<QtMoc Include="mainwindow.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</QtMoc>
|
|
||||||
<ClInclude Include="serialport\protocol.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<QtMoc Include="thirdparty\qcustomplot\qcustomplot.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</QtMoc>
|
|
||||||
<QtMoc Include="ui\realtimedataform.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</QtMoc>
|
|
||||||
<QtMoc Include="serialport\serialport.h">
|
|
||||||
<Filter>Header Files</Filter>
|
|
||||||
</QtMoc>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<CustomBuild Include="debug\moc_predefs.h.cbt">
|
|
||||||
<Filter>Generated Files</Filter>
|
|
||||||
</CustomBuild>
|
|
||||||
<CustomBuild Include="release\moc_predefs.h.cbt">
|
|
||||||
<Filter>Generated Files</Filter>
|
|
||||||
</CustomBuild>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
|
||||||
<QtUic Include="mainwindow.ui">
|
|
||||||
<Filter>Form Files</Filter>
|
|
||||||
</QtUic>
|
|
||||||
<QtUic Include="ui\realtimedataform.ui">
|
|
||||||
<Filter>Form Files</Filter>
|
|
||||||
</QtUic>
|
|
||||||
</ItemGroup>
|
|
||||||
</Project>
|
|
||||||
20
src/global.cpp
Normal file
20
src/global.cpp
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
#include "global.h"
|
||||||
|
|
||||||
|
Global::Global()
|
||||||
|
{
|
||||||
|
_mode = Global::Mode::ANALYZE;
|
||||||
|
}
|
||||||
|
|
||||||
|
Global *Global::instance()
|
||||||
|
{
|
||||||
|
static Global ins;
|
||||||
|
return &ins;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Global::setMode(const Global::Mode mode)
|
||||||
|
{
|
||||||
|
if(mode != _mode){
|
||||||
|
_mode = mode;
|
||||||
|
emit sigModeModify(mode);
|
||||||
|
}
|
||||||
|
}
|
||||||
26
src/global.h
Normal file
26
src/global.h
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
#ifndef GLOBAL_H
|
||||||
|
#define GLOBAL_H
|
||||||
|
|
||||||
|
#include <qobject.h>
|
||||||
|
|
||||||
|
class Global:public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
Global();
|
||||||
|
static Global* instance();
|
||||||
|
|
||||||
|
enum Mode{
|
||||||
|
EXPERIMENT,
|
||||||
|
ANALYZE
|
||||||
|
};
|
||||||
|
|
||||||
|
void setMode(const Mode);
|
||||||
|
signals:
|
||||||
|
void sigModeModify(const Mode);
|
||||||
|
public slots:
|
||||||
|
private:
|
||||||
|
Mode _mode;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // GLOBAL_H
|
||||||
6
src/images.qrc
Normal file
6
src/images.qrc
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<RCC>
|
||||||
|
<qresource prefix="/">
|
||||||
|
<file>images/start.png</file>
|
||||||
|
<file>images/stop.png</file>
|
||||||
|
</qresource>
|
||||||
|
</RCC>
|
||||||
BIN
src/images/start.png
Normal file
BIN
src/images/start.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.5 KiB |
BIN
src/images/stop.png
Normal file
BIN
src/images/stop.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.3 KiB |
@ -13,10 +13,10 @@ int main(int argc, char *argv[])
|
|||||||
QApplication a(argc, argv);
|
QApplication a(argc, argv);
|
||||||
|
|
||||||
MainWindow w;
|
MainWindow w;
|
||||||
// w.show();
|
w.show();
|
||||||
|
|
||||||
ExperimentSettingForm es;
|
// ExperimentSettingForm es;
|
||||||
es.show();
|
// es.show();
|
||||||
|
|
||||||
// CentralWidget central;
|
// CentralWidget central;
|
||||||
// central.show();
|
// central.show();
|
||||||
|
|||||||
@ -1,6 +0,0 @@
|
|||||||
#include "mainwidget.h"
|
|
||||||
|
|
||||||
MainWidget::MainWidget()
|
|
||||||
{
|
|
||||||
setStyleSheet("background-color: blue;");
|
|
||||||
}
|
|
||||||
@ -1,13 +0,0 @@
|
|||||||
#ifndef MAINWIDGET_H
|
|
||||||
#define MAINWIDGET_H
|
|
||||||
|
|
||||||
#include <QWidget>
|
|
||||||
|
|
||||||
class MainWidget:public QWidget
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
MainWidget();
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // MAINWIDGET_H
|
|
||||||
@ -1,18 +1,24 @@
|
|||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "ui_mainwindow.h"
|
#include "ui_mainwindow.h"
|
||||||
|
#include "global.h"
|
||||||
|
#include "serialport.h"
|
||||||
|
|
||||||
MainWindow::MainWindow(QWidget *parent)
|
MainWindow::MainWindow(QWidget *parent)
|
||||||
: QMainWindow(parent)
|
: QMainWindow(parent)
|
||||||
, ui(new Ui::MainWindow)
|
, ui(new Ui::MainWindow)
|
||||||
, _centralWidget(new CentralWidget)
|
, _centralWidget(new CentralWidget)
|
||||||
,_leftWidget(new LeftWidget)
|
,_leftWidget(new LeftWidget)
|
||||||
|
,_expertmentSettingForm(new ExperimentSettingForm)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
this->setToolTip(".....");
|
this->setToolTip(".....");
|
||||||
|
// resize(2222,1111);
|
||||||
|
|
||||||
setCentralWidget(_centralWidget);
|
setCentralWidget(_centralWidget);
|
||||||
addDockWidget(Qt::LeftDockWidgetArea, _leftWidget);
|
addDockWidget(Qt::LeftDockWidgetArea, _leftWidget);
|
||||||
|
|
||||||
|
connections();
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow::~MainWindow()
|
MainWindow::~MainWindow()
|
||||||
@ -20,3 +26,24 @@ MainWindow::~MainWindow()
|
|||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::connections()
|
||||||
|
{
|
||||||
|
//ui
|
||||||
|
// connect(ui->actionshitu,&QAction::triggered,
|
||||||
|
// [&]{_expertmentSettingForm->show();});
|
||||||
|
|
||||||
|
connect(_expertmentSettingForm,&ExperimentSettingForm::sigConnectToDevice,
|
||||||
|
SerialPort::instance(),&SerialPort::slotConnectToDevice);
|
||||||
|
//dynamic data
|
||||||
|
connect(SerialPort::instance(),&SerialPort::sigSendCommonData,
|
||||||
|
_centralWidget,&CentralWidget::slotRevCommonData);
|
||||||
|
//mode
|
||||||
|
connect(Global::instance(),&Global::sigModeModify,
|
||||||
|
_centralWidget,&CentralWidget::slotModeModify);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MainWindow::on_actionstart_triggered()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
#include "centralwidget.h"
|
#include "centralwidget.h"
|
||||||
#include "leftwidget.h"
|
#include "leftwidget.h"
|
||||||
|
#include "experimentsettingform.h"
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
namespace Ui { class MainWindow; }
|
namespace Ui { class MainWindow; }
|
||||||
@ -17,10 +18,15 @@ class MainWindow : public QMainWindow
|
|||||||
public:
|
public:
|
||||||
MainWindow(QWidget *parent = nullptr);
|
MainWindow(QWidget *parent = nullptr);
|
||||||
~MainWindow();
|
~MainWindow();
|
||||||
|
private slots:
|
||||||
|
void on_actionstart_triggered();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void connections();
|
||||||
private:
|
private:
|
||||||
Ui::MainWindow *ui;
|
Ui::MainWindow *ui;
|
||||||
CentralWidget *_centralWidget;
|
CentralWidget *_centralWidget;
|
||||||
LeftWidget*_leftWidget;
|
LeftWidget*_leftWidget;
|
||||||
|
ExperimentSettingForm *_expertmentSettingForm;
|
||||||
};
|
};
|
||||||
#endif // MAINWINDOW_H
|
#endif // MAINWINDOW_H
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>800</width>
|
<width>850</width>
|
||||||
<height>600</height>
|
<height>600</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@ -19,7 +19,7 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>800</width>
|
<width>850</width>
|
||||||
<height>21</height>
|
<height>21</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@ -27,7 +27,8 @@
|
|||||||
<property name="title">
|
<property name="title">
|
||||||
<string>文件</string>
|
<string>文件</string>
|
||||||
</property>
|
</property>
|
||||||
<addaction name="actionshitu"/>
|
<addaction name="action_new"/>
|
||||||
|
<addaction name="action22"/>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QMenu" name="menu_2">
|
<widget class="QMenu" name="menu_2">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
@ -68,12 +69,43 @@
|
|||||||
<addaction name="menu_7"/>
|
<addaction name="menu_7"/>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QStatusBar" name="statusbar"/>
|
<widget class="QStatusBar" name="statusbar"/>
|
||||||
<action name="actionshitu">
|
<widget class="QToolBar" name="toolBar">
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>toolBar</string>
|
||||||
|
</property>
|
||||||
|
<property name="toolButtonStyle">
|
||||||
|
<enum>Qt::ToolButtonIconOnly</enum>
|
||||||
|
</property>
|
||||||
|
<attribute name="toolBarArea">
|
||||||
|
<enum>TopToolBarArea</enum>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="toolBarBreak">
|
||||||
|
<bool>false</bool>
|
||||||
|
</attribute>
|
||||||
|
<addaction name="actionstart"/>
|
||||||
|
</widget>
|
||||||
|
<action name="action_new">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>shitu </string>
|
<string>新建</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="action22">
|
||||||
|
<property name="text">
|
||||||
|
<string>22</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionstart">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="images.qrc">
|
||||||
|
<normaloff>:/images/start.png</normaloff>:/images/start.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>start</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources>
|
||||||
|
<include location="images.qrc"/>
|
||||||
|
</resources>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
|||||||
@ -2,10 +2,39 @@
|
|||||||
#include <QDataStream>
|
#include <QDataStream>
|
||||||
|
|
||||||
#include "dataparser.h"
|
#include "dataparser.h"
|
||||||
|
#include "defines.h"
|
||||||
|
|
||||||
DataParser::DataParser()
|
DataParser::DataParser()
|
||||||
{
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DataParser::commonDataParser(const QByteArray &ba, CommonData &cd)
|
||||||
|
{
|
||||||
|
const char *charArray = ba.data();
|
||||||
|
|
||||||
|
// 判断前两个字节是否为 0xA5 和 0x5A (小端格式)
|
||||||
|
if (static_cast<unsigned char>(charArray[0]) == 0xA5 &&
|
||||||
|
static_cast<unsigned char>(charArray[1]) == 0x5A)
|
||||||
|
{
|
||||||
|
// std::cout << "前两个字节是 0x5AA5 (小端)" << std::endl;
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// std::cout << "前两个字节不是 0x5AA5 (小端)" << std::endl;
|
||||||
|
qDebug()<<"header failed.";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (static_cast<unsigned char>(charArray[3]) != 0x83)
|
||||||
|
{
|
||||||
|
qDebug()<<"mark failed.";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
memcpy(&cd, charArray + 6, sizeof(CommonData));
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray DataParser::connectToDevice(const QVector<Phase> &vtr)
|
QByteArray DataParser::connectToDevice(const QVector<Phase> &vtr)
|
||||||
@ -15,7 +44,8 @@ QByteArray DataParser::connectToDevice(const QVector<Phase> &vtr)
|
|||||||
char phaseArray[300] = {};
|
char phaseArray[300] = {};
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
|
|
||||||
for(const Phase& phase:vtr){
|
for (const Phase &phase : vtr)
|
||||||
|
{
|
||||||
memcpy(phaseArray + offset, &phase, sizeof(Phase));
|
memcpy(phaseArray + offset, &phase, sizeof(Phase));
|
||||||
offset += phaseLength;
|
offset += phaseLength;
|
||||||
}
|
}
|
||||||
@ -39,7 +69,7 @@ QByteArray DataParser::connectToDevice(const QVector<Phase> &vtr)
|
|||||||
|
|
||||||
memcpy(totalData + 6, phaseArray, phaseArrayLength);
|
memcpy(totalData + 6, phaseArray, phaseArrayLength);
|
||||||
|
|
||||||
//crc
|
//
|
||||||
char data[300] = {};
|
char data[300] = {};
|
||||||
|
|
||||||
data[0] = 0x82;
|
data[0] = 0x82;
|
||||||
@ -58,15 +88,49 @@ QByteArray DataParser::connectToDevice(const QVector<Phase> &vtr)
|
|||||||
return QByteArray(totalData, 6 + phaseArrayLength + 2);
|
return QByteArray(totalData, 6 + phaseArrayLength + 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned short DataParser::modbusCRC16(unsigned char *data, unsigned short length) {
|
QByteArray DataParser::setDeviceStartStop(const DeviceStartMode mode)
|
||||||
|
{
|
||||||
|
char data[300] = {};
|
||||||
|
// header
|
||||||
|
u16 header = 0x5aa5;
|
||||||
|
memcpy(data, (char *)&header, sizeof(u16));
|
||||||
|
|
||||||
|
// length
|
||||||
|
data[2] = 1 + 2 + 1 + 2;
|
||||||
|
|
||||||
|
// commond
|
||||||
|
data[3] = 0x82;
|
||||||
|
|
||||||
|
//address
|
||||||
|
u16 address = 0x002C;
|
||||||
|
memcpy(data + 4, (char *)&address, sizeof(u16));
|
||||||
|
|
||||||
|
data[6] = mode;
|
||||||
|
|
||||||
|
//crc
|
||||||
|
u16 crc = modbusCRC16((u8 *)(data + 3), 4);
|
||||||
|
memcpy(data + 7, (char *)&crc, sizeof(u16));
|
||||||
|
|
||||||
|
int length = 9;
|
||||||
|
|
||||||
|
return QByteArray(data,length);
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned short DataParser::modbusCRC16(unsigned char *data, unsigned short length)
|
||||||
|
{
|
||||||
unsigned short crc = 0xFFFF;
|
unsigned short crc = 0xFFFF;
|
||||||
unsigned char i;
|
unsigned char i;
|
||||||
for (unsigned short j = 0; j < length; j++) {
|
for (unsigned short j = 0; j < length; j++)
|
||||||
|
{
|
||||||
crc ^= (unsigned short)data[j];
|
crc ^= (unsigned short)data[j];
|
||||||
for (i = 0; i < 8; i++) {
|
for (i = 0; i < 8; i++)
|
||||||
if (crc & 0x0001) {
|
{
|
||||||
|
if (crc & 0x0001)
|
||||||
|
{
|
||||||
crc = (crc >> 1) ^ 0xA001;
|
crc = (crc >> 1) ^ 0xA001;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
crc = crc >> 1;
|
crc = crc >> 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -74,3 +138,4 @@ unsigned short DataParser::modbusCRC16(unsigned char *data, unsigned short lengt
|
|||||||
// CRC结果低字节在前,高字节在后
|
// CRC结果低字节在前,高字节在后
|
||||||
return crc;
|
return crc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -12,9 +12,11 @@ class DataParser
|
|||||||
public:
|
public:
|
||||||
DataParser();
|
DataParser();
|
||||||
|
|
||||||
|
static unsigned short modbusCRC16(unsigned char *data,unsigned short length);
|
||||||
static QByteArray connectToDevice(const QVector<Phase>&);
|
static QByteArray connectToDevice(const QVector<Phase>&);
|
||||||
static unsigned short modbusCRC16(unsigned char *data,
|
static QByteArray setDeviceStartStop(const DeviceStartMode);
|
||||||
unsigned short length);
|
|
||||||
|
static bool commonDataParser(const QByteArray&ba,CommonData &cd);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DATAPARSER_H
|
#endif // DATAPARSER_H
|
||||||
|
|||||||
@ -10,6 +10,13 @@
|
|||||||
#pragma pack(push)
|
#pragma pack(push)
|
||||||
#pragma pack(1)
|
#pragma pack(1)
|
||||||
|
|
||||||
|
enum DeviceStartMode{
|
||||||
|
Stop,
|
||||||
|
Start,
|
||||||
|
StartAutoTune, // 启动升温速率自整定
|
||||||
|
StopAutoTune // 停止升温速率自整定
|
||||||
|
};
|
||||||
|
|
||||||
struct com_protocol
|
struct com_protocol
|
||||||
{
|
{
|
||||||
uint16_t head;
|
uint16_t head;
|
||||||
|
|||||||
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
#include "protocol.h"
|
#include "protocol.h"
|
||||||
#include "defines.h"
|
#include "defines.h"
|
||||||
|
#include "dataparser.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
@ -15,11 +16,10 @@ const u16 conVid = 1155; // 0x0483
|
|||||||
const u16 conPid = 22336; // 0x5740
|
const u16 conPid = 22336; // 0x5740
|
||||||
|
|
||||||
SerialPort::SerialPort(QObject *parent)
|
SerialPort::SerialPort(QObject *parent)
|
||||||
:QObject(parent)
|
: QObject(parent), _sp(nullptr)
|
||||||
,_sp(nullptr)
|
|
||||||
{
|
{
|
||||||
// displayPortInfo();
|
// displayPortInfo();
|
||||||
openSp();
|
|
||||||
#if 0
|
#if 0
|
||||||
// 1.初始化
|
// 1.初始化
|
||||||
_sp = new QSerialPort();
|
_sp = new QSerialPort();
|
||||||
@ -77,7 +77,8 @@ SerialPort *SerialPort::instance()
|
|||||||
|
|
||||||
SerialPort::~SerialPort()
|
SerialPort::~SerialPort()
|
||||||
{
|
{
|
||||||
if(_sp->isOpen()){
|
if (_sp->isOpen())
|
||||||
|
{
|
||||||
_sp->clear();
|
_sp->clear();
|
||||||
_sp->close();
|
_sp->close();
|
||||||
}
|
}
|
||||||
@ -91,11 +92,36 @@ void SerialPort::timerEvent(QTimerEvent *event)
|
|||||||
|
|
||||||
void SerialPort::slotReadData()
|
void SerialPort::slotReadData()
|
||||||
{
|
{
|
||||||
QByteArray data = _sp->readAll();
|
QByteArray ba = _sp->readAll();
|
||||||
|
|
||||||
|
#if 1
|
||||||
// 将 QByteArray 转换为十六进制字符串
|
// 将 QByteArray 转换为十六进制字符串
|
||||||
QString hexData = data.toHex(' '); // ' ' 作为分隔符,可选参数
|
QString hexData = ba.toHex(' '); // ' ' 作为分隔符,可选参数
|
||||||
qDebug() << "receive info (hex):" << hexData;
|
qDebug() << "receive info (hex):" << hexData;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
CommonData cd;
|
||||||
|
if (!DataParser::commonDataParser(ba, cd))
|
||||||
|
{
|
||||||
|
qDebug() << "CommonData parse failed.";
|
||||||
|
}
|
||||||
|
|
||||||
|
// 格式化输出 float 类型,保留两位小数
|
||||||
|
QString formattedRunTime = QString::number(cd.add_run_time, 'f', 2);
|
||||||
|
qDebug() << "run time:" << formattedRunTime;
|
||||||
|
|
||||||
|
qDebug()<<"phase:"<<QString::number(cd.current_phase);
|
||||||
|
qDebug()<<"dsc:"<<QString::number(cd.dsc,'f',3);
|
||||||
|
|
||||||
|
// 格式化输出 double 类型,保留三位小数
|
||||||
|
QString formattedSampleTemp = QString::number(cd.sample_temp, 'f', 3);
|
||||||
|
qDebug() << "sample temp:" << formattedSampleTemp;
|
||||||
|
|
||||||
|
QString formattedColdTemp = QString::number(cd.cold_temp, 'f', 3);
|
||||||
|
qDebug() << "cold temp:" << formattedColdTemp;
|
||||||
|
|
||||||
|
emit sigSendCommonData(cd);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
CommonData *serialPortData =
|
CommonData *serialPortData =
|
||||||
reinterpret_cast<CommonData*>(const_cast<char*>(&data.data()[6]));
|
reinterpret_cast<CommonData*>(const_cast<char*>(&data.data()[6]));
|
||||||
@ -118,19 +144,18 @@ void SerialPort::openSp()
|
|||||||
u16 pid = info.productIdentifier();
|
u16 pid = info.productIdentifier();
|
||||||
u16 vid = info.vendorIdentifier();
|
u16 vid = info.vendorIdentifier();
|
||||||
|
|
||||||
if((pid == conPid) && (vid == conVid)){
|
if ((pid == conPid) && (vid == conVid))
|
||||||
|
{
|
||||||
_sp = new QSerialPort(info);
|
_sp = new QSerialPort(info);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if 0
|
|
||||||
if(!_sp->isOpen()){
|
if (_sp == nullptr)
|
||||||
qDebug()<<"Com open failed.";
|
{
|
||||||
|
qDebug() << "Device not found.";
|
||||||
return;
|
return;
|
||||||
}else{
|
|
||||||
qDebug()<<"Com open succ.";
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
// 设置波特率和读写方向
|
// 设置波特率和读写方向
|
||||||
_sp->setBaudRate(QSerialPort::Baud115200,
|
_sp->setBaudRate(QSerialPort::Baud115200,
|
||||||
@ -145,11 +170,13 @@ void SerialPort::openSp()
|
|||||||
this, &SerialPort::slotReadData);
|
this, &SerialPort::slotReadData);
|
||||||
|
|
||||||
// 2.打开串口
|
// 2.打开串口
|
||||||
if(!_sp->open(QIODevice::ReadWrite)){
|
if (!_sp->open(QIODevice::ReadWrite))
|
||||||
|
{
|
||||||
qDebug() << "open failed." << _sp->error();
|
qDebug() << "open failed." << _sp->error();
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
else{
|
else
|
||||||
|
{
|
||||||
qDebug() << "open succ.";
|
qDebug() << "open succ.";
|
||||||
// 设置 DTR 信号为就绪状态(true 表示低电平)
|
// 设置 DTR 信号为就绪状态(true 表示低电平)
|
||||||
_sp->setDataTerminalReady(true);
|
_sp->setDataTerminalReady(true);
|
||||||
@ -162,17 +189,22 @@ void SerialPort::sendCmd(const SerialPort::E_CMD_TYPE e)
|
|||||||
int length = 20;
|
int length = 20;
|
||||||
char in_char[21] = {'\0'};
|
char in_char[21] = {'\0'};
|
||||||
|
|
||||||
if(e == e_zero){
|
if (e == e_zero)
|
||||||
|
{
|
||||||
// char data[10] = {'55','aa','0b','0a','20',
|
// char data[10] = {'55','aa','0b','0a','20',
|
||||||
// '4e','00','00','00','c3'};
|
// '4e','00','00','00','c3'};
|
||||||
const char *data = "55aa0b0a204e000000c3";
|
const char *data = "55aa0b0a204e000000c3";
|
||||||
memcpy(in_char, data, length);
|
memcpy(in_char, data, length);
|
||||||
}else if(e == e_back){
|
}
|
||||||
|
else if (e == e_back)
|
||||||
|
{
|
||||||
// char data[10] = {'55','aa','08','10','27',
|
// char data[10] = {'55','aa','08','10','27',
|
||||||
// 'f0','d8','ff','ff','c3'};
|
// 'f0','d8','ff','ff','c3'};
|
||||||
const char *data = "55aa081027f0d8ffffc3";
|
const char *data = "55aa081027f0d8ffffc3";
|
||||||
memcpy(in_char, data, length);
|
memcpy(in_char, data, length);
|
||||||
}else if(e == e_forward){
|
}
|
||||||
|
else if (e == e_forward)
|
||||||
|
{
|
||||||
// char data[10] = {'55','aa','08','10','27',
|
// char data[10] = {'55','aa','08','10','27',
|
||||||
// '10','27','00','00','c3'};
|
// '10','27','00','00','c3'};
|
||||||
const char *data = "55aa08102710270000c3";
|
const char *data = "55aa08102710270000c3";
|
||||||
@ -188,9 +220,12 @@ void SerialPort::sendCmd(const SerialPort::E_CMD_TYPE e)
|
|||||||
|
|
||||||
int num = _sp->write(out_char,
|
int num = _sp->write(out_char,
|
||||||
hex_length);
|
hex_length);
|
||||||
if(num == -1){
|
if (num == -1)
|
||||||
|
{
|
||||||
qDebug() << "write failed.";
|
qDebug() << "write failed.";
|
||||||
}else{
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
qDebug() << "write ok|num:" << num;
|
qDebug() << "write ok|num:" << num;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -213,7 +248,8 @@ void SerialPort::displayPortInfo()
|
|||||||
QList<QSerialPortInfo> serialPorts = QSerialPortInfo::availablePorts();
|
QList<QSerialPortInfo> serialPorts = QSerialPortInfo::availablePorts();
|
||||||
|
|
||||||
// 遍历每个串口信息
|
// 遍历每个串口信息
|
||||||
for (const QSerialPortInfo &portInfo : serialPorts) {
|
for (const QSerialPortInfo &portInfo : serialPorts)
|
||||||
|
{
|
||||||
qDebug() << "================================================";
|
qDebug() << "================================================";
|
||||||
// 打印串口的名称
|
// 打印串口的名称
|
||||||
qDebug() << "串口名称: " << portInfo.portName();
|
qDebug() << "串口名称: " << portInfo.portName();
|
||||||
@ -230,14 +266,16 @@ void SerialPort::displayPortInfo()
|
|||||||
// 打印是否有产品标识符
|
// 打印是否有产品标识符
|
||||||
qDebug() << "是否有产品标识符: " << (portInfo.hasProductIdentifier() ? "是" : "否");
|
qDebug() << "是否有产品标识符: " << (portInfo.hasProductIdentifier() ? "是" : "否");
|
||||||
// 如果有虚拟调制解调器,打印其标识符
|
// 如果有虚拟调制解调器,打印其标识符
|
||||||
if (portInfo.hasVendorIdentifier()) {
|
if (portInfo.hasVendorIdentifier())
|
||||||
|
{
|
||||||
qint16 vid = portInfo.vendorIdentifier();
|
qint16 vid = portInfo.vendorIdentifier();
|
||||||
qDebug() << "虚拟调制解调器标识符: " << vid;
|
qDebug() << "虚拟调制解调器标识符: " << vid;
|
||||||
QString hexStr = QString("0x%1").arg(vid, 4, 16, QChar('0')).toUpper();
|
QString hexStr = QString("0x%1").arg(vid, 4, 16, QChar('0')).toUpper();
|
||||||
qDebug() << "vid 0x" << hexStr;
|
qDebug() << "vid 0x" << hexStr;
|
||||||
}
|
}
|
||||||
// 如果有产品标识符,打印其标识符
|
// 如果有产品标识符,打印其标识符
|
||||||
if (portInfo.hasProductIdentifier()) {
|
if (portInfo.hasProductIdentifier())
|
||||||
|
{
|
||||||
qint16 pid = portInfo.productIdentifier();
|
qint16 pid = portInfo.productIdentifier();
|
||||||
qDebug() << "产品标识符: " << pid;
|
qDebug() << "产品标识符: " << pid;
|
||||||
QString hexStr = QString("0x%1").arg(pid, 4, 16, QChar('0')).toUpper();
|
QString hexStr = QString("0x%1").arg(pid, 4, 16, QChar('0')).toUpper();
|
||||||
@ -274,7 +312,6 @@ void SerialPort::parserTest()
|
|||||||
QString formattedColdTemp = QString::number(serialPortData->cold_temp, 'f', 3);
|
QString formattedColdTemp = QString::number(serialPortData->cold_temp, 'f', 3);
|
||||||
qDebug() << "cold temp:" << formattedColdTemp;
|
qDebug() << "cold temp:" << formattedColdTemp;
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
// 定义小端序的 4 字节数据
|
// 定义小端序的 4 字节数据
|
||||||
unsigned char bytesLittle[] = {0x23, 0x23, 0x01, 0x00};
|
unsigned char bytesLittle[] = {0x23, 0x23, 0x01, 0x00};
|
||||||
@ -287,57 +324,43 @@ void SerialPort::parserTest()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SerialPort::slotConnectToDevice(const QByteArray &ba)
|
||||||
|
{
|
||||||
|
openSp();
|
||||||
|
|
||||||
|
slotSendData(ba);
|
||||||
|
}
|
||||||
|
|
||||||
void SerialPort::slotSendData(const QByteArray &ba)
|
void SerialPort::slotSendData(const QByteArray &ba)
|
||||||
{
|
{
|
||||||
qDebug() << "slotSendData:" << ba.size();
|
qDebug() << "slotSendData:" << ba.size();
|
||||||
|
|
||||||
_sp->write(ba);
|
_sp->write(ba);
|
||||||
|
#if 0
|
||||||
// 将 QByteArray 转换为十六进制字符串
|
// 将 QByteArray 转换为十六进制字符串
|
||||||
QString hexData = ba.toHex(' '); // ' ' 作为分隔符,可选参数
|
QString hexData = ba.toHex(' '); // ' ' 作为分隔符,可选参数
|
||||||
qDebug() << "send info (hex):" << hexData;
|
qDebug() << "send info (hex):" << hexData;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
CommonData cd;
|
||||||
|
if (!DataParser::commonDataParser(ba, cd))
|
||||||
|
{
|
||||||
|
qDebug() << "CommonData parse failed.";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 格式化输出 float 类型,保留两位小数
|
||||||
|
QString formattedRunTime = QString::number(cd.add_run_time, 'f', 2);
|
||||||
|
qDebug() << "run time:" << formattedRunTime;
|
||||||
|
|
||||||
|
// 格式化输出 double 类型,保留三位小数
|
||||||
|
QString formattedSampleTemp = QString::number(cd.sample_temp, 'f', 3);
|
||||||
|
qDebug() << "sample temp:" << formattedSampleTemp;
|
||||||
|
|
||||||
|
QString formattedColdTemp = QString::number(cd.cold_temp, 'f', 3);
|
||||||
|
qDebug() << "cold temp:" << formattedColdTemp;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SerialPort::slotCloseSp()
|
||||||
|
{
|
||||||
|
_sp->close();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -17,16 +17,18 @@ public:
|
|||||||
e_back
|
e_back
|
||||||
};
|
};
|
||||||
|
|
||||||
SerialPort(QObject* parent=nullptr);
|
|
||||||
static SerialPort *instance();
|
static SerialPort *instance();
|
||||||
~SerialPort();
|
~SerialPort();
|
||||||
|
|
||||||
void sendCmd(const E_CMD_TYPE e);
|
void sendCmd(const E_CMD_TYPE e);
|
||||||
static void parserTest();
|
static void parserTest();
|
||||||
public slots:
|
public slots:
|
||||||
|
void slotConnectToDevice(const QByteArray&);
|
||||||
void slotSendData(const QByteArray&);
|
void slotSendData(const QByteArray&);
|
||||||
|
void slotCloseSp();
|
||||||
signals:
|
signals:
|
||||||
void sigSendSerialPortData(const CommonData&);
|
// void sigSendSerialPortData(const CommonData&);
|
||||||
|
void sigSendCommonData(const CommonData&);
|
||||||
protected:
|
protected:
|
||||||
void timerEvent(QTimerEvent *event);
|
void timerEvent(QTimerEvent *event);
|
||||||
private slots:
|
private slots:
|
||||||
@ -36,6 +38,7 @@ private:
|
|||||||
void to_hex(char* in_char, int char_length, char* out_char);
|
void to_hex(char* in_char, int char_length, char* out_char);
|
||||||
void displayPortInfo();
|
void displayPortInfo();
|
||||||
private:
|
private:
|
||||||
|
SerialPort(QObject* parent=nullptr);
|
||||||
QSerialPort *_sp;
|
QSerialPort *_sp;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -14,8 +14,6 @@ CentralWidget::CentralWidget(QWidget* parent)
|
|||||||
layout->addWidget(_customPlot);
|
layout->addWidget(_customPlot);
|
||||||
this->setLayout(layout);
|
this->setLayout(layout);
|
||||||
|
|
||||||
//创建画布,设置画布上的点数据
|
|
||||||
_customPlot->addGraph();
|
|
||||||
#if 0
|
#if 0
|
||||||
// init data
|
// init data
|
||||||
QVector<double> x(101), y(101);
|
QVector<double> x(101), y(101);
|
||||||
@ -33,7 +31,32 @@ CentralWidget::CentralWidget(QWidget* parent)
|
|||||||
_customPlot->yAxis->setRange(0, 100);
|
_customPlot->yAxis->setRange(0, 100);
|
||||||
_customPlot->replot();
|
_customPlot->replot();
|
||||||
#endif
|
#endif
|
||||||
startTimer(1000);
|
// startTimer(1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CentralWidget::slotModeModify(const Global::Mode mode)
|
||||||
|
{
|
||||||
|
if (Global::Mode::EXPERIMENT == mode)
|
||||||
|
{
|
||||||
|
// 创建画布,设置画布上的点数据
|
||||||
|
_customPlot->addGraph();
|
||||||
|
|
||||||
|
// 设置坐标轴标签
|
||||||
|
_customPlot->xAxis->setLabel("Temp/℃");
|
||||||
|
_customPlot->yAxis->setLabel("DSC/mW");
|
||||||
|
// 设置坐标轴范围,以便我们可以看到全部数据
|
||||||
|
_customPlot->xAxis->setRange(0, 400);
|
||||||
|
_customPlot->yAxis->setRange(-20, 20);
|
||||||
|
}
|
||||||
|
else if (Global::Mode::ANALYZE == mode)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CentralWidget::slotRevCommonData(const CommonData &cd)
|
||||||
|
{
|
||||||
|
_customPlot->graph(0)->addData(cd.sample_temp, cd.dsc); // 添加数据到曲线
|
||||||
|
_customPlot->replot();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CentralWidget::timerEvent(QTimerEvent *event)
|
void CentralWidget::timerEvent(QTimerEvent *event)
|
||||||
@ -61,3 +84,4 @@ void CentralWidget::timerEvent(QTimerEvent* event)
|
|||||||
_customPlot->xAxis->setRange(key + 0.25, 80, Qt::AlignRight); // 设定x轴的范围
|
_customPlot->xAxis->setRange(key + 0.25, 80, Qt::AlignRight); // 设定x轴的范围
|
||||||
_customPlot->replot();
|
_customPlot->replot();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,15 +2,22 @@
|
|||||||
#define CENTRALWIDGET_H
|
#define CENTRALWIDGET_H
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
#include "qcustomplot.h"
|
#include "qcustomplot.h"
|
||||||
|
#include "protocol.h"
|
||||||
|
#include "global.h"
|
||||||
|
|
||||||
class CentralWidget:public QWidget
|
class CentralWidget:public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
CentralWidget(QWidget *parent = nullptr);
|
CentralWidget(QWidget *parent = nullptr);
|
||||||
|
public slots:
|
||||||
|
void slotModeModify(const Global::Mode);
|
||||||
|
void slotRevCommonData(const CommonData&);
|
||||||
protected:
|
protected:
|
||||||
void timerEvent(QTimerEvent* event);
|
void timerEvent(QTimerEvent* event);
|
||||||
|
private:
|
||||||
private:
|
private:
|
||||||
QCustomPlot *_customPlot;
|
QCustomPlot *_customPlot;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -5,6 +5,7 @@
|
|||||||
#include "protocol.h"
|
#include "protocol.h"
|
||||||
#include "dataparser.h"
|
#include "dataparser.h"
|
||||||
#include "serialport.h"
|
#include "serialport.h"
|
||||||
|
#include "global.h"
|
||||||
|
|
||||||
ExperimentSettingForm::ExperimentSettingForm(QWidget *parent) :
|
ExperimentSettingForm::ExperimentSettingForm(QWidget *parent) :
|
||||||
QWidget(parent),
|
QWidget(parent),
|
||||||
@ -25,8 +26,7 @@ ExperimentSettingForm::ExperimentSettingForm(QWidget *parent) :
|
|||||||
connect(ui->pushButton_cancel,&QPushButton::clicked,
|
connect(ui->pushButton_cancel,&QPushButton::clicked,
|
||||||
this,&ExperimentSettingForm::slotCancel);
|
this,&ExperimentSettingForm::slotCancel);
|
||||||
|
|
||||||
connect(this,&ExperimentSettingForm::sigConnectToDevice,
|
|
||||||
SerialPort::instance(),&SerialPort::slotSendData);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ExperimentSettingForm::~ExperimentSettingForm()
|
ExperimentSettingForm::~ExperimentSettingForm()
|
||||||
@ -168,8 +168,16 @@ void ExperimentSettingForm::slotConnectToDevice()
|
|||||||
|
|
||||||
QByteArray ba = DataParser::connectToDevice(phaseVtr);
|
QByteArray ba = DataParser::connectToDevice(phaseVtr);
|
||||||
qDebug()<<"ba size:"<<ba.size();
|
qDebug()<<"ba size:"<<ba.size();
|
||||||
|
|
||||||
emit sigConnectToDevice(ba);
|
emit sigConnectToDevice(ba);
|
||||||
|
|
||||||
|
Global::instance()->setMode(Global::Mode::EXPERIMENT);
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
QByteArray startBa = DataParser::setDeviceStartStop(DeviceStartMode::Start);
|
||||||
|
emit sigConnectToDevice(startBa);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExperimentSettingForm::slotCancel()
|
void ExperimentSettingForm::slotCancel()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user