commit e795c6ee701c058d4c90763ab3ab1af2171d7c42 Author: ZTZHANG\ztzhang Date: Fri Jul 25 09:25:17 2025 +0800 Modbus项目初创 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6827df9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,10 @@ +# 忽略编译文件和VS生成文件 +.vs/ +x64/ +Modbus/x64 +UnitTest/x64 +# 忽略无需上传的文件夹和文件 +Modbus/resources +Modbus/ui +Modbus/Modbus.vcxproj.user +UnitTest/UnitTest.vcxproj.user \ No newline at end of file diff --git a/Modbus.sln b/Modbus.sln new file mode 100644 index 0000000..e729a57 --- /dev/null +++ b/Modbus.sln @@ -0,0 +1,39 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.36227.6 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Modbus", "Modbus\Modbus.vcxproj", "{6C6AE003-C3F3-4848-BC5D-B6E1D10CFFDA}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UnitTest", "UnitTest\UnitTest.vcxproj", "{1BF5A85F-E101-4C18-A5B7-813098A60579}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {6C6AE003-C3F3-4848-BC5D-B6E1D10CFFDA}.Debug|x64.ActiveCfg = Debug|x64 + {6C6AE003-C3F3-4848-BC5D-B6E1D10CFFDA}.Debug|x64.Build.0 = Debug|x64 + {6C6AE003-C3F3-4848-BC5D-B6E1D10CFFDA}.Debug|x86.ActiveCfg = Debug|x64 + {6C6AE003-C3F3-4848-BC5D-B6E1D10CFFDA}.Release|x64.ActiveCfg = Release|x64 + {6C6AE003-C3F3-4848-BC5D-B6E1D10CFFDA}.Release|x64.Build.0 = Release|x64 + {6C6AE003-C3F3-4848-BC5D-B6E1D10CFFDA}.Release|x86.ActiveCfg = Release|x64 + {1BF5A85F-E101-4C18-A5B7-813098A60579}.Debug|x64.ActiveCfg = Debug|x64 + {1BF5A85F-E101-4C18-A5B7-813098A60579}.Debug|x64.Build.0 = Debug|x64 + {1BF5A85F-E101-4C18-A5B7-813098A60579}.Debug|x86.ActiveCfg = Debug|Win32 + {1BF5A85F-E101-4C18-A5B7-813098A60579}.Debug|x86.Build.0 = Debug|Win32 + {1BF5A85F-E101-4C18-A5B7-813098A60579}.Release|x64.ActiveCfg = Release|x64 + {1BF5A85F-E101-4C18-A5B7-813098A60579}.Release|x64.Build.0 = Release|x64 + {1BF5A85F-E101-4C18-A5B7-813098A60579}.Release|x86.ActiveCfg = Release|Win32 + {1BF5A85F-E101-4C18-A5B7-813098A60579}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {3E53BE7E-95C6-449F-A1E1-8C4DE0DDDF10} + EndGlobalSection +EndGlobal diff --git a/Modbus/Modbus.vcxproj b/Modbus/Modbus.vcxproj new file mode 100644 index 0000000..2f67d67 --- /dev/null +++ b/Modbus/Modbus.vcxproj @@ -0,0 +1,109 @@ + + + + + Debug + x64 + + + Release + x64 + + + + {6C6AE003-C3F3-4848-BC5D-B6E1D10CFFDA} + QtVS_v304 + 10.0 + 10.0 + $(MSBuildProjectDirectory)\QtMsBuild + + + + Application + v142 + true + Unicode + + + Application + v142 + false + true + Unicode + + + + + + + 5.15.2_msvc2019_64 + core;gui;widgets;serialport + debug + + + 5.15.2_msvc2019_64 + core;gui;widgets + release + + + + + + + + + + + + + + + + + + + + + + true + Level3 + true + true + + + Windows + true + + + + + true + Level3 + true + true + true + true + + + Windows + false + true + true + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Modbus/Modbus.vcxproj.filters b/Modbus/Modbus.vcxproj.filters new file mode 100644 index 0000000..745d07f --- /dev/null +++ b/Modbus/Modbus.vcxproj.filters @@ -0,0 +1,50 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + qml;cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + qrc;rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + {99349809-55BA-4b9d-BF79-8FDBB0286EB3} + ui + + + {639EADAA-A684-42e4-A9AD-28FC9BCB8F7C} + ts + + + + + Resource Files + + + Form Files + + + Header Files + + + Source Files + + + Resource Files + + + Resource Files + + + + + Source Files + + + \ No newline at end of file diff --git a/Modbus/include/modbus.h b/Modbus/include/modbus.h new file mode 100644 index 0000000..8569933 --- /dev/null +++ b/Modbus/include/modbus.h @@ -0,0 +1,25 @@ +#pragma once + +#include +// Ӵ +#include +#include + +#include "ui_modbus.h" + +QT_BEGIN_NAMESPACE +namespace Ui { class ModbusClass; }; +QT_END_NAMESPACE + +class Modbus : public QMainWindow +{ + Q_OBJECT + +public: + Modbus(QWidget *parent = nullptr); + ~Modbus(); + +private: + Ui::ModbusClass *ui; +}; + diff --git a/Modbus/src/main.cpp b/Modbus/src/main.cpp new file mode 100644 index 0000000..c8f7759 --- /dev/null +++ b/Modbus/src/main.cpp @@ -0,0 +1,10 @@ +#include "../include/modbus.h" +#include + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + Modbus window; + window.show(); + return app.exec(); +} diff --git a/Modbus/src/modbus.cpp b/Modbus/src/modbus.cpp new file mode 100644 index 0000000..c5b6dfe --- /dev/null +++ b/Modbus/src/modbus.cpp @@ -0,0 +1,14 @@ +#include "../include/modbus.h" + +Modbus::Modbus(QWidget *parent) + : QMainWindow(parent) + , ui(new Ui::ModbusClass()) +{ + ui->setupUi(this); +} + +Modbus::~Modbus() +{ + delete ui; +} + diff --git a/UnitTest/UnitTest.vcxproj b/UnitTest/UnitTest.vcxproj new file mode 100644 index 0000000..edb0da6 --- /dev/null +++ b/UnitTest/UnitTest.vcxproj @@ -0,0 +1,167 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 16.0 + {1BF5A85F-E101-4C18-A5B7-813098A60579} + Win32Proj + UnitTest + 10.0 + NativeUnitTestProject + + + + DynamicLibrary + true + v142 + Unicode + false + + + DynamicLibrary + false + v142 + true + Unicode + false + + + DynamicLibrary + true + v142 + Unicode + false + + + DynamicLibrary + false + v142 + true + Unicode + false + + + + + + + + + + + + + + + + + + + + + true + + + true + + + false + + + false + + + + NotUsing + Level3 + true + $(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories) + _DEBUG;%(PreprocessorDefinitions) + true + pch.h + + + Windows + $(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories) + + + + + Use + Level3 + true + $(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;%(PreprocessorDefinitions) + true + pch.h + + + Windows + $(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories) + + + + + Use + Level3 + true + true + true + $(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;%(PreprocessorDefinitions) + true + pch.h + + + Windows + true + true + $(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories) + + + + + Use + Level3 + true + true + true + $(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories) + NDEBUG;%(PreprocessorDefinitions) + true + pch.h + + + Windows + true + true + $(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories) + + + + + + + + + + + + \ No newline at end of file diff --git a/UnitTest/UnitTest.vcxproj.filters b/UnitTest/UnitTest.vcxproj.filters new file mode 100644 index 0000000..925d009 --- /dev/null +++ b/UnitTest/UnitTest.vcxproj.filters @@ -0,0 +1,27 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + 源文件 + + + + + 源文件 + + + \ No newline at end of file diff --git a/UnitTest/test.cpp b/UnitTest/test.cpp new file mode 100644 index 0000000..4496c29 --- /dev/null +++ b/UnitTest/test.cpp @@ -0,0 +1,16 @@ +#include "CppUnitTest.h" + +using namespace Microsoft::VisualStudio::CppUnitTestFramework; + +namespace UnitTest +{ + TEST_CLASS(UnitTest) + { + public: + // ͨ + TEST_METHOD(CommonMethod1) + { + + } + }; +} diff --git a/UnitTest/test.ini b/UnitTest/test.ini new file mode 100644 index 0000000..e69de29