Browse Source

Qt NGS first commit finish the sim port

flower 11 months ago
parent
commit
42ca6bee0b

+ 74 - 0
.gitignore

@@ -0,0 +1,74 @@
+# 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*
+CMakeLists.txt.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
+

+ 35 - 0
.vscode/c_cpp_properties.json

@@ -0,0 +1,35 @@
+{
+    "configurations": [
+        {
+            "name": "Win32",
+            "includePath": [
+                "${workspaceFolder}/**",
+                "D:/app/qt/6.2.4/mingw_64/include/**",
+                "D:/app/qt/6.2.4/mingw_64/include/QtCore",
+                "D:/app/qt/6.2.4/mingw_64/include/QtGui",
+                "D:/app/qt/6.2.4/mingw_64/include/QtWidgets"
+            ],
+            "defines": [
+                "_DEBUG",
+                "UNICODE",
+                "_UNICODE"
+            ],
+            "compilerPath": "D:/app/qt/Tools/mingw1120_64/bin/g++.exe",
+            "intelliSenseMode": "windows-gcc-x64",
+            "cStandard": "c11",
+            "cppStandard": "c++17",
+            "browse": {
+                "path": [
+                    "${workspaceFolder}",
+                    "D:/app/qt/6.2.4/mingw_64/include",
+                    "D:/app/qt/6.2.4/mingw_64/include/QtCore",
+                    "D:/app/qt/6.2.4/mingw_64/include/QtGui",
+                    "D:/app/qt/6.2.4/mingw_64/include/QtWidgets"
+                ],
+                "limitSymbolsToIncludedHeaders": true,
+                "databaseFilename": ""
+            }
+        }
+    ],
+    "version": 4
+}

+ 54 - 0
.vscode/launch.json

@@ -0,0 +1,54 @@
+{
+    // 使用 IntelliSense 了解相关属性。 
+    // 悬停以查看现有属性的描述。
+    // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
+    "version": "0.2.0",
+    "configurations": [
+        // {
+        //     "name": "(gdb) 启动", //模板,实际使用记得删除
+        //     "type": "cppdbg",
+        //     "request": "launch",
+        //     "program": "D:/document/code_all/Qt/TCP_test/build/release/TCP_test.exe",
+        //     "args": [],
+        //     "stopAtEntry": false,
+        //     "cwd": "${fileDirname}",
+        //     "environment": [],
+        //     "externalConsole": false,
+        //     "MIMode": "gdb",
+        //     "miDebuggerPath": "/path/to/gdb",
+        //     "setupCommands": [
+        //         {
+        //             "description": "为 gdb 启用整齐打印",
+        //             "text": "-enable-pretty-printing",
+        //             "ignoreFailures": true
+        //         },
+        //         {
+        //             "description": "将反汇编风格设置为 Intel",
+        //             "text": "-gdb-set disassembly-flavor intel",
+        //             "ignoreFailures": true
+        //         }
+        //     ]
+        // },
+        {
+            "name": "debug", //修改后
+            "type": "cppdbg",
+            "request": "launch",
+            "program": "D:/document/code_all/Qt/TCP_test/build/release/TCP_test.exe", //写完整路径
+            "args": [],
+            "stopAtEntry": false,
+            "cwd": "${workspaceFolder}", //工作目录,项目根目录
+            "environment": [],
+            "externalConsole": false,
+            "MIMode": "gdb",
+            "miDebuggerPath": "D:/app/qt/Tools/mingw1120_64/bin/gdb.exe", //选择MinGW中的gdb
+            "setupCommands": [
+                {
+                    "description": "为 gdb 启用整齐打印",
+                    "text": "-enable-pretty-printing",
+                    "ignoreFailures": true
+                }
+            ],
+            "preLaunchTask": "make-debug", //这跟depend[]很像啊,make就行了,用make编译出exe
+        }
+    ]
+}

+ 17 - 0
.vscode/settings.json

@@ -0,0 +1,17 @@
+{
+    "files.associations": {
+        "qrandomgenerator": "cpp",
+        "new": "cpp",
+        "qdebug": "cpp",
+        "qcloseevent": "cpp",
+        "optional": "cpp",
+        "ratio": "cpp",
+        "system_error": "cpp",
+        "array": "cpp",
+        "functional": "cpp",
+        "tuple": "cpp",
+        "type_traits": "cpp",
+        "utility": "cpp",
+        "variant": "cpp"
+    }
+}

+ 121 - 0
.vscode/tasks.json

@@ -0,0 +1,121 @@
+{
+    // See https://go.microsoft.com/fwlink/?LinkId=733558
+    // for the documentation about the tasks.json format
+    "version": "2.0.0",
+    "tasks": [
+        {
+            "label": "mkdir",
+            "type": "shell",
+            "options": {
+                "cwd": "${workspaceFolder}"
+            },
+            "command": "mkdir",
+            "args": [
+                "-Force",
+                "build"
+            ]
+        },
+        {
+            "label": "qmake-debug",
+            "type": "shell",
+            "options": {
+                "cwd": "${workspaceFolder}/build"
+            },
+            "command": "qmake",
+            "args": [
+                "../${workspaceFolderBasename}.pro",
+                "-spec",
+                "win32-g++",
+                "\"CONFIG+=debug\"",
+                "\"CONFIG+=console\""
+            ],
+            "dependsOn": [
+                "mkdir"
+            ]
+        },
+        {
+            "label": "make-debug",
+            "type": "shell",
+            "options": {
+                "cwd": "${workspaceFolder}/build"
+            },
+            "command": "mingw32-make",
+            "args": [
+                "-f",
+                "Makefile.Debug",
+                "-j7"
+            ],
+            "dependsOn": [
+                "qmake-debug"
+            ]
+        },
+        {
+            "label": "run-debug",
+            "type": "process",
+            "options": {
+                "cwd": "${workspaceFolder}/build/debug"
+            },
+            "command": "${workspaceFolder}/build/debug/${workspaceFolderBasename}.exe",
+            "dependsOn": [
+                "make-debug"
+            ]
+        },
+        {
+            "label": "qmake-release",
+            "type": "shell",
+            "options": {
+                "cwd": "${workspaceFolder}/build"
+            },
+            "command": "qmake",
+            "args": [
+                "../${workspaceFolderBasename}.pro",
+                "-spec",
+                "win32-g++",
+                "\"CONFIG+=qtquickcompiler\""
+            ],
+            "dependsOn": []
+        },
+        {
+            "label": "make-release",
+            "type": "shell",
+            "options": {
+                "cwd": "${workspaceFolder}/build"
+            },
+            "command": "mingw32-make",
+            "args": [
+                "-f",
+                "Makefile.Release",
+                "-j7"
+            ],
+            "dependsOn": [
+                "qmake-release"
+            ],
+            "problemMatcher": [
+                "$vite"
+            ],
+            "isBackground": true
+        },
+        {
+            "label": "run-release",
+            "type": "process",
+            "options": {
+                "cwd": "${workspaceFolder}/build/release"
+            },
+            "command": "${workspaceFolder}/build/release/${workspaceFolderBasename}.exe",
+            "dependsOn": [
+                "make-release"
+            ]
+        },
+        {
+            "label": "clean",
+            "type": "shell",
+            "options": {
+                "cwd": "${workspaceFolder}/build"
+            },
+            "command": "mingw32-make",
+            "args": [
+                "clean"
+            ]
+        }
+    ]
+}

+ 39 - 0
Qt_NGS.pro

@@ -0,0 +1,39 @@
+QT       += core gui network
+QT       += charts
+
+greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
+
+CONFIG += c++17
+
+# You can make your code fail to compile if it uses deprecated APIs.
+# In order to do so, uncomment the following line.
+#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
+
+SOURCES += \
+    main.cpp \
+    src/base/base.cpp \
+    src/chart/chart_file.cpp \
+    src/login/login_switch.cpp \
+    src/message/message_dialog.cpp \
+    src/model_select/model_select.cpp \
+    src/page_main/page_main.cpp
+
+HEADERS += \
+    src/base/base.h \
+    src/chart/chart_file.h \
+    src/login/login_switch.h \
+    src/message/message_dialog.h \
+    src/model_select/model_select.h \
+    src/page_main/page_main.h
+
+FORMS += \
+    src/chart/chart_file.ui \
+    src/login/login_switch.ui \
+    src/message/message_dialog.ui \
+    src/model_select/model_select.ui \
+    src/page_main/page_main.ui
+
+# Default rules for deployment.
+qnx: target.path = /tmp/$${TARGET}/bin
+else: unix:!android: target.path = /opt/$${TARGET}/bin
+!isEmpty(target.path): INSTALLS += target

+ 21 - 0
build/.qmake.stash

@@ -0,0 +1,21 @@
+QMAKE_CXX.QT_COMPILER_STDCXX = 201703L
+QMAKE_CXX.QMAKE_GCC_MAJOR_VERSION = 11
+QMAKE_CXX.QMAKE_GCC_MINOR_VERSION = 2
+QMAKE_CXX.QMAKE_GCC_PATCH_VERSION = 0
+QMAKE_CXX.COMPILER_MACROS = \
+    QT_COMPILER_STDCXX \
+    QMAKE_GCC_MAJOR_VERSION \
+    QMAKE_GCC_MINOR_VERSION \
+    QMAKE_GCC_PATCH_VERSION
+QMAKE_CXX.INCDIRS = \
+    D:/app/qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++ \
+    D:/app/qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++/x86_64-w64-mingw32 \
+    D:/app/qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++/backward \
+    D:/app/qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include \
+    D:/app/qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include-fixed \
+    D:/app/qt/Tools/mingw1120_64/x86_64-w64-mingw32/include
+QMAKE_CXX.LIBDIRS = \
+    D:/app/qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0 \
+    D:/app/qt/Tools/mingw1120_64/lib/gcc \
+    D:/app/qt/Tools/mingw1120_64/x86_64-w64-mingw32/lib \
+    D:/app/qt/Tools/mingw1120_64/lib

+ 21 - 0
build/Desktop_Qt_6_2_4_MinGW_64_bit-Debug/.qmake.stash

@@ -0,0 +1,21 @@
+QMAKE_CXX.QT_COMPILER_STDCXX = 201703L
+QMAKE_CXX.QMAKE_GCC_MAJOR_VERSION = 11
+QMAKE_CXX.QMAKE_GCC_MINOR_VERSION = 2
+QMAKE_CXX.QMAKE_GCC_PATCH_VERSION = 0
+QMAKE_CXX.COMPILER_MACROS = \
+    QT_COMPILER_STDCXX \
+    QMAKE_GCC_MAJOR_VERSION \
+    QMAKE_GCC_MINOR_VERSION \
+    QMAKE_GCC_PATCH_VERSION
+QMAKE_CXX.INCDIRS = \
+    D:/app/qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++ \
+    D:/app/qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++/x86_64-w64-mingw32 \
+    D:/app/qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++/backward \
+    D:/app/qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include \
+    D:/app/qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include-fixed \
+    D:/app/qt/Tools/mingw1120_64/x86_64-w64-mingw32/include
+QMAKE_CXX.LIBDIRS = \
+    D:/app/qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0 \
+    D:/app/qt/Tools/mingw1120_64/lib/gcc \
+    D:/app/qt/Tools/mingw1120_64/x86_64-w64-mingw32/lib \
+    D:/app/qt/Tools/mingw1120_64/lib

+ 440 - 0
build/Desktop_Qt_6_2_4_MinGW_64_bit-Debug/debug/moc_predefs.h

@@ -0,0 +1,440 @@
+#define __DBL_MIN_EXP__ (-1021)
+#define __cpp_attributes 200809L
+#define __cpp_nontype_template_parameter_auto 201606L
+#define __UINT_LEAST16_MAX__ 0xffff
+#define __ATOMIC_ACQUIRE 2
+#define __FLT128_MAX_10_EXP__ 4932
+#define __FLT_MIN__ 1.17549435082228750796873653722224568e-38F
+#define __GCC_IEC_559_COMPLEX 2
+#define __cpp_aggregate_nsdmi 201304L
+#define __UINT_LEAST8_TYPE__ unsigned char
+#define __SIZEOF_FLOAT80__ 16
+#define __INTMAX_C(c) c ## LL
+#define __CHAR_BIT__ 8
+#define __MINGW32__ 1
+#define __UINT8_MAX__ 0xff
+#define __SCHAR_WIDTH__ 8
+#define _WIN64 1
+#define __WINT_MAX__ 0xffff
+#define __FLT32_MIN_EXP__ (-125)
+#define __cpp_static_assert 201411L
+#define __ORDER_LITTLE_ENDIAN__ 1234
+#define __SIZE_MAX__ 0xffffffffffffffffULL
+#define __WCHAR_MAX__ 0xffff
+#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1
+#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 1
+#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 1
+#define __DBL_DENORM_MIN__ double(4.94065645841246544176568792868221372e-324L)
+#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 1
+#define __GCC_ATOMIC_CHAR_LOCK_FREE 2
+#define __GCC_IEC_559 2
+#define __FLT32X_DECIMAL_DIG__ 17
+#define __FLT_EVAL_METHOD__ 0
+#define __cpp_binary_literals 201304L
+#define __FLT64_DECIMAL_DIG__ 17
+#define __cpp_noexcept_function_type 201510L
+#define __GCC_ATOMIC_CHAR32_T_LOCK_FREE 2
+#define __cpp_variadic_templates 200704L
+#define __UINT_FAST64_MAX__ 0xffffffffffffffffULL
+#define __SIG_ATOMIC_TYPE__ int
+#define __DBL_MIN_10_EXP__ (-307)
+#define __FINITE_MATH_ONLY__ 0
+#define __cpp_variable_templates 201304L
+#define __FLT32X_MAX_EXP__ 1024
+#define __FLT32_HAS_DENORM__ 1
+#define __UINT_FAST8_MAX__ 0xff
+#define __cpp_rvalue_reference 200610L
+#define __cpp_nested_namespace_definitions 201411L
+#define _stdcall __attribute__((__stdcall__))
+#define __DEC64_MAX_EXP__ 385
+#define __INT8_C(c) c
+#define __INT_LEAST8_WIDTH__ 8
+#define __cpp_variadic_using 201611L
+#define __UINT_LEAST64_MAX__ 0xffffffffffffffffULL
+#define __INT_LEAST8_MAX__ 0x7f
+#define __cpp_capture_star_this 201603L
+#define __SHRT_MAX__ 0x7fff
+#define __LDBL_MAX__ 1.18973149535723176502126385303097021e+4932L
+#define __FLT64X_MAX_10_EXP__ 4932
+#define __cpp_if_constexpr 201606L
+#define __LDBL_IS_IEC_60559__ 2
+#define __FLT64X_HAS_QUIET_NAN__ 1
+#define __UINT_LEAST8_MAX__ 0xff
+#define __GCC_ATOMIC_BOOL_LOCK_FREE 2
+#define __FLT128_DENORM_MIN__ 6.47517511943802511092443895822764655e-4966F128
+#define __UINTMAX_TYPE__ long long unsigned int
+#define __DEC32_EPSILON__ 1E-6DF
+#define __FLT_EVAL_METHOD_TS_18661_3__ 0
+#define __UINT32_MAX__ 0xffffffffU
+#define __GXX_EXPERIMENTAL_CXX0X__ 1
+#define __FLT128_MIN_EXP__ (-16381)
+#define __WINT_MIN__ 0
+#define __FLT128_MIN_10_EXP__ (-4931)
+#define __FLT32X_IS_IEC_60559__ 2
+#define __INT_LEAST16_WIDTH__ 16
+#define __SCHAR_MAX__ 0x7f
+#define __FLT128_MANT_DIG__ 113
+#define __WCHAR_MIN__ 0
+#define __INT64_C(c) c ## LL
+#define __GCC_ATOMIC_POINTER_LOCK_FREE 2
+#define __FLT32X_MANT_DIG__ 53
+#define __GCC_ATOMIC_CHAR16_T_LOCK_FREE 2
+#define __cpp_aligned_new 201606L
+#define __USER_LABEL_PREFIX__ 
+#define __FLT32_MAX_10_EXP__ 38
+#define __FLT64X_EPSILON__ 1.08420217248550443400745280086994171e-19F64x
+#define __STDC_HOSTED__ 1
+#define __DEC64_MIN_EXP__ (-382)
+#define __WIN64 1
+#define __cpp_decltype_auto 201304L
+#define __DBL_DIG__ 15
+#define __FLT32_DIG__ 6
+#define __FLT_EPSILON__ 1.19209289550781250000000000000000000e-7F
+#define __GXX_WEAK__ 1
+#define __SHRT_WIDTH__ 16
+#define __FLT32_IS_IEC_60559__ 2
+#define __LDBL_MIN__ 3.36210314311209350626267781732175260e-4932L
+#define __DBL_IS_IEC_60559__ 2
+#define __DEC32_MAX__ 9.999999E96DF
+#define __cpp_threadsafe_static_init 200806L
+#define __cpp_enumerator_attributes 201411L
+#define __FLT64X_DENORM_MIN__ 3.64519953188247460252840593361941982e-4951F64x
+#define __FLT32X_HAS_INFINITY__ 1
+#define __INT32_MAX__ 0x7fffffff
+#define __INT_WIDTH__ 32
+#define __SIZEOF_LONG__ 4
+#define __UINT16_C(c) c
+#define __DECIMAL_DIG__ 21
+#define __FLT64_EPSILON__ 2.22044604925031308084726333618164062e-16F64
+#define __INT16_MAX__ 0x7fff
+#define __FLT64_MIN_EXP__ (-1021)
+#define __FLT64X_MIN_10_EXP__ (-4931)
+#define __LDBL_HAS_QUIET_NAN__ 1
+#define __FLT64_MANT_DIG__ 53
+#define _REENTRANT 1
+#define __FLT64X_MANT_DIG__ 64
+#define __GNUC__ 11
+#define _cdecl __attribute__((__cdecl__))
+#define __GXX_RTTI 1
+#define __MMX__ 1
+#define __FLT_HAS_DENORM__ 1
+#define __SIZEOF_LONG_DOUBLE__ 16
+#define __BIGGEST_ALIGNMENT__ 16
+#define __STDC_UTF_16__ 1
+#define __FLT64_MAX_10_EXP__ 308
+#define __cpp_delegating_constructors 200604L
+#define __FLT32_HAS_INFINITY__ 1
+#define __DBL_MAX__ double(1.79769313486231570814527423731704357e+308L)
+#define _thiscall __attribute__((__thiscall__))
+#define __cpp_raw_strings 200710L
+#define __INT_FAST32_MAX__ 0x7fffffff
+#define __WINNT 1
+#define __DBL_HAS_INFINITY__ 1
+#define __SIZEOF_FLOAT__ 4
+#define __WINNT__ 1
+#define __HAVE_SPECULATION_SAFE_VALUE 1
+#define __cpp_fold_expressions 201603L
+#define __DEC32_MIN_EXP__ (-94)
+#define __INTPTR_WIDTH__ 64
+#define __FLT64X_HAS_INFINITY__ 1
+#define __UINT_LEAST32_MAX__ 0xffffffffU
+#define __FLT32X_HAS_DENORM__ 1
+#define __INT_FAST16_TYPE__ short int
+#define __MMX_WITH_SSE__ 1
+#define _fastcall __attribute__((__fastcall__))
+#define __LDBL_HAS_DENORM__ 1
+#define __cplusplus 201703L
+#define __cpp_ref_qualifiers 200710L
+#define __DEC32_MIN__ 1E-95DF
+#define __DEPRECATED 1
+#define __cpp_rvalue_references 200610L
+#define __DBL_MAX_EXP__ 1024
+#define __WCHAR_WIDTH__ 16
+#define __FLT32_MAX__ 3.40282346638528859811704183484516925e+38F32
+#define __DEC128_EPSILON__ 1E-33DL
+#define __SSE2_MATH__ 1
+#define __ATOMIC_HLE_RELEASE 131072
+#define __WIN32__ 1
+#define __PTRDIFF_MAX__ 0x7fffffffffffffffLL
+#define __amd64 1
+#define __tune_core2__ 1
+#define __ATOMIC_HLE_ACQUIRE 65536
+#define __GNUG__ 11
+#define __LONG_LONG_MAX__ 0x7fffffffffffffffLL
+#define __SIZEOF_SIZE_T__ 8
+#define __cpp_nsdmi 200809L
+#define __FLT64X_MIN_EXP__ (-16381)
+#define __SIZEOF_WINT_T__ 2
+#define __LONG_LONG_WIDTH__ 64
+#define __cpp_initializer_lists 200806L
+#define __FLT32_MAX_EXP__ 128
+#define __cpp_hex_float 201603L
+#define __GXX_ABI_VERSION 1016
+#define __FLT128_HAS_INFINITY__ 1
+#define __FLT_MIN_EXP__ (-125)
+#define __GCC_HAVE_DWARF2_CFI_ASM 1
+#define __x86_64 1
+#define __cpp_lambdas 200907L
+#define __INT_FAST64_TYPE__ long long int
+#define __FLT64_DENORM_MIN__ 4.94065645841246544176568792868221372e-324F64
+#define __cpp_template_auto 201606L
+#define __DBL_MIN__ double(2.22507385850720138309023271733240406e-308L)
+#define __FLT128_EPSILON__ 1.92592994438723585305597794258492732e-34F128
+#define __FLT64X_NORM_MAX__ 1.18973149535723176502126385303097021e+4932F64x
+#define __SIZEOF_POINTER__ 8
+#define __SIZE_TYPE__ long long unsigned int
+#define __DBL_HAS_QUIET_NAN__ 1
+#define __FLT32X_EPSILON__ 2.22044604925031308084726333618164062e-16F32x
+#define __DECIMAL_BID_FORMAT__ 1
+#define __GXX_TYPEINFO_EQUALITY_INLINE 0
+#define __FLT64_MIN_10_EXP__ (-307)
+#define __FLT64X_DECIMAL_DIG__ 21
+#define __DEC128_MIN__ 1E-6143DL
+#define __REGISTER_PREFIX__ 
+#define __UINT16_MAX__ 0xffff
+#define __cdecl __attribute__((__cdecl__))
+#define __LDBL_HAS_INFINITY__ 1
+#define __FLT32_MIN__ 1.17549435082228750796873653722224568e-38F32
+#define __UINT8_TYPE__ unsigned char
+#define __FLT_DIG__ 6
+#define __NO_INLINE__ 1
+#define __DEC_EVAL_METHOD__ 2
+#define __DEC128_MAX__ 9.999999999999999999999999999999999E6144DL
+#define __FLT_MANT_DIG__ 24
+#define __LDBL_DECIMAL_DIG__ 21
+#define __VERSION__ "11.2.0"
+#define __UINT64_C(c) c ## ULL
+#define __cpp_unicode_characters 201411L
+#define _WIN32 1
+#define __SEH__ 1
+#define __INT_LEAST32_MAX__ 0x7fffffff
+#define __GCC_ATOMIC_INT_LOCK_FREE 2
+#define __FLT128_MAX_EXP__ 16384
+#define __FLT32_MANT_DIG__ 24
+#define __FLOAT_WORD_ORDER__ __ORDER_LITTLE_ENDIAN__
+#define __cpp_aggregate_bases 201603L
+#define __FLT128_HAS_DENORM__ 1
+#define __FLT32_DECIMAL_DIG__ 9
+#define __FLT128_DIG__ 33
+#define __INT32_C(c) c
+#define __DEC64_EPSILON__ 1E-15DD
+#define __ORDER_PDP_ENDIAN__ 3412
+#define __DEC128_MIN_EXP__ (-6142)
+#define __INT_FAST32_TYPE__ int
+#define __UINT_LEAST16_TYPE__ short unsigned int
+#define __DBL_HAS_DENORM__ 1
+#define __cpp_rtti 199711L
+#define __UINT64_MAX__ 0xffffffffffffffffULL
+#define __FLT_IS_IEC_60559__ 2
+#define __GNUC_WIDE_EXECUTION_CHARSET_NAME "UTF-16LE"
+#define __FLT64X_DIG__ 18
+#define __INT8_TYPE__ signed char
+#define __cpp_digit_separators 201309L
+#define __GCC_ASM_FLAG_OUTPUTS__ 1
+#define __UINT32_TYPE__ unsigned int
+#define __FLT_RADIX__ 2
+#define __INT_LEAST16_TYPE__ short int
+#define __LDBL_EPSILON__ 1.08420217248550443400745280086994171e-19L
+#define __UINTMAX_C(c) c ## ULL
+#define __GLIBCXX_BITSIZE_INT_N_0 128
+#define __FLT32X_MIN__ 2.22507385850720138309023271733240406e-308F32x
+#define __SIG_ATOMIC_MAX__ 0x7fffffff
+#define __GCC_ATOMIC_WCHAR_T_LOCK_FREE 2
+#define __SIZEOF_PTRDIFF_T__ 8
+#define __LDBL_DIG__ 18
+#define __FLT64_IS_IEC_60559__ 2
+#define __x86_64__ 1
+#define __FLT32X_MIN_EXP__ (-1021)
+#define __DEC32_SUBNORMAL_MIN__ 0.000001E-95DF
+#define __MSVCRT__ 1
+#define __INT_FAST16_MAX__ 0x7fff
+#define __FLT64_DIG__ 15
+#define __UINT_FAST32_MAX__ 0xffffffffU
+#define __UINT_LEAST64_TYPE__ long long unsigned int
+#define __FLT_HAS_QUIET_NAN__ 1
+#define __FLT_MAX_10_EXP__ 38
+#define __LONG_MAX__ 0x7fffffffL
+#define __FLT64X_HAS_DENORM__ 1
+#define __DEC128_SUBNORMAL_MIN__ 0.000000000000000000000000000000001E-6143DL
+#define __FLT_HAS_INFINITY__ 1
+#define __GNUC_EXECUTION_CHARSET_NAME "UTF-8"
+#define __cpp_unicode_literals 200710L
+#define __UINT_FAST16_TYPE__ short unsigned int
+#define __DEC64_MAX__ 9.999999999999999E384DD
+#define __INT_FAST32_WIDTH__ 32
+#define __CHAR16_TYPE__ short unsigned int
+#define __PRAGMA_REDEFINE_EXTNAME 1
+#define __SIZE_WIDTH__ 64
+#define __SEG_FS 1
+#define __INT_LEAST16_MAX__ 0x7fff
+#define __DEC64_MANT_DIG__ 16
+#define __INT64_MAX__ 0x7fffffffffffffffLL
+#define __SEG_GS 1
+#define __FLT32_DENORM_MIN__ 1.40129846432481707092372958328991613e-45F32
+#define __SIG_ATOMIC_WIDTH__ 32
+#define __INT_LEAST64_TYPE__ long long int
+#define __INT16_TYPE__ short int
+#define __INT_LEAST8_TYPE__ signed char
+#define __nocona__ 1
+#define __cpp_structured_bindings 201606L
+#define __SIZEOF_INT__ 4
+#define __DEC32_MAX_EXP__ 97
+#define __INT_FAST8_MAX__ 0x7f
+#define __FLT128_MAX__ 1.18973149535723176508575932662800702e+4932F128
+#define __INTPTR_MAX__ 0x7fffffffffffffffLL
+#define __cpp_sized_deallocation 201309L
+#define __cpp_guaranteed_copy_elision 201606L
+#define __FLT64_HAS_QUIET_NAN__ 1
+#define __stdcall __attribute__((__stdcall__))
+#define __FLT32_MIN_10_EXP__ (-37)
+#define __EXCEPTIONS 1
+#define __GXX_MERGED_TYPEINFO_NAMES 0
+#define __PTRDIFF_WIDTH__ 64
+#define __LDBL_MANT_DIG__ 64
+#define __cpp_range_based_for 201603L
+#define __FLT64_HAS_INFINITY__ 1
+#define __FLT64X_MAX__ 1.18973149535723176502126385303097021e+4932F64x
+#define __STDCPP_DEFAULT_NEW_ALIGNMENT__ 16
+#define __SIG_ATOMIC_MIN__ (-__SIG_ATOMIC_MAX__ - 1)
+#define __GCC_ATOMIC_LONG_LOCK_FREE 2
+#define __cpp_nontype_template_args 201411L
+#define __DEC32_MANT_DIG__ 7
+#define __cpp_return_type_deduction 201304L
+#define __INTPTR_TYPE__ long long int
+#define __UINT16_TYPE__ short unsigned int
+#define __WCHAR_TYPE__ short unsigned int
+#define __pic__ 1
+#define __UINTPTR_MAX__ 0xffffffffffffffffULL
+#define __INT_FAST64_WIDTH__ 64
+#define __cpp_decltype 200707L
+#define __INT_FAST64_MAX__ 0x7fffffffffffffffLL
+#define __GCC_ATOMIC_TEST_AND_SET_TRUEVAL 1
+#define __FLT_NORM_MAX__ 3.40282346638528859811704183484516925e+38F
+#define __FLT64X_MAX_EXP__ 16384
+#define __UINT_FAST64_TYPE__ long long unsigned int
+#define __cpp_inline_variables 201606L
+#define __INT_MAX__ 0x7fffffff
+#define WIN32 1
+#define __nocona 1
+#define __code_model_medium__ 1
+#define __INT64_TYPE__ long long int
+#define __FLT_MAX_EXP__ 128
+#define WIN64 1
+#define __ORDER_BIG_ENDIAN__ 4321
+#define __DBL_MANT_DIG__ 53
+#define __cpp_inheriting_constructors 201511L
+#define __SIZEOF_FLOAT128__ 16
+#define __INT_LEAST64_MAX__ 0x7fffffffffffffffLL
+#define __DEC64_MIN__ 1E-383DD
+#define __WINT_TYPE__ short unsigned int
+#define __UINT_LEAST32_TYPE__ unsigned int
+#define __SIZEOF_SHORT__ 2
+#define __FLT32_NORM_MAX__ 3.40282346638528859811704183484516925e+38F32
+#define __SSE__ 1
+#define __LDBL_MIN_EXP__ (-16381)
+#define __FLT64_MAX__ 1.79769313486231570814527423731704357e+308F64
+#define __amd64__ 1
+#define __WINT_WIDTH__ 16
+#define __INT_LEAST64_WIDTH__ 64
+#define __LDBL_MAX_EXP__ 16384
+#define __FLT32X_MAX_10_EXP__ 308
+#define __WIN32 1
+#define __SIZEOF_INT128__ 16
+#define __FLT64X_IS_IEC_60559__ 2
+#define __WCHAR_UNSIGNED__ 1
+#define __LDBL_MAX_10_EXP__ 4932
+#define __ATOMIC_RELAXED 0
+#define __DBL_EPSILON__ double(2.22044604925031308084726333618164062e-16L)
+#define __thiscall __attribute__((__thiscall__))
+#define __FLT128_MIN__ 3.36210314311209350626267781732175260e-4932F128
+#define __UINT8_C(c) c
+#define __FLT64_MAX_EXP__ 1024
+#define __INT_LEAST32_TYPE__ int
+#define __SIZEOF_WCHAR_T__ 2
+#define __GNUC_PATCHLEVEL__ 0
+#define __FLT128_NORM_MAX__ 1.18973149535723176508575932662800702e+4932F128
+#define __FLT64_NORM_MAX__ 1.79769313486231570814527423731704357e+308F64
+#define __FLT128_HAS_QUIET_NAN__ 1
+#define __INTMAX_MAX__ 0x7fffffffffffffffLL
+#define __SSE3__ 1
+#define __INT_FAST8_TYPE__ signed char
+#define __fastcall __attribute__((__fastcall__))
+#define __cpp_namespace_attributes 201411L
+#define __FLT64X_MIN__ 3.36210314311209350626267781732175260e-4932F64x
+#define __STDCPP_THREADS__ 1
+#define __GNUC_STDC_INLINE__ 1
+#define __FLT64_HAS_DENORM__ 1
+#define __FLT32_EPSILON__ 1.19209289550781250000000000000000000e-7F32
+#define __DBL_DECIMAL_DIG__ 17
+#define __STDC_UTF_32__ 1
+#define __INT_FAST8_WIDTH__ 8
+#define __FXSR__ 1
+#define __FLT32X_MAX__ 1.79769313486231570814527423731704357e+308F32x
+#define __DBL_NORM_MAX__ double(1.79769313486231570814527423731704357e+308L)
+#define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__
+#define __MINGW64__ 1
+#define __INTMAX_WIDTH__ 64
+#define __cpp_runtime_arrays 198712L
+#define __UINT64_TYPE__ long long unsigned int
+#define __UINT32_C(c) c ## U
+#define __cpp_alias_templates 200704L
+#define WINNT 1
+#define __FLT_DENORM_MIN__ 1.40129846432481707092372958328991613e-45F
+#define __FLT128_IS_IEC_60559__ 2
+#define __INT8_MAX__ 0x7f
+#define __LONG_WIDTH__ 32
+#define __PIC__ 1
+#define __UINT_FAST32_TYPE__ unsigned int
+#define __FLT32X_NORM_MAX__ 1.79769313486231570814527423731704357e+308F32x
+#define __CHAR32_TYPE__ unsigned int
+#define __FLT_MAX__ 3.40282346638528859811704183484516925e+38F
+#define __cpp_constexpr 201603L
+#define __SSE2__ 1
+#define __cpp_deduction_guides 201703L
+#define __INT32_TYPE__ int
+#define __SIZEOF_DOUBLE__ 8
+#define __cpp_exceptions 199711L
+#define __FLT_MIN_10_EXP__ (-37)
+#define __FLT64_MIN__ 2.22507385850720138309023271733240406e-308F64
+#define __INT_LEAST32_WIDTH__ 32
+#define __INTMAX_TYPE__ long long int
+#define _INTEGRAL_MAX_BITS 64
+#define __DEC128_MAX_EXP__ 6145
+#define __FLT32X_HAS_QUIET_NAN__ 1
+#define __ATOMIC_CONSUME 1
+#define __GNUC_MINOR__ 2
+#define __GLIBCXX_TYPE_INT_N_0 __int128
+#define __INT_FAST16_WIDTH__ 16
+#define __UINTMAX_MAX__ 0xffffffffffffffffULL
+#define __FLT32X_DENORM_MIN__ 4.94065645841246544176568792868221372e-324F32x
+#define __cpp_template_template_args 201611L
+#define __DBL_MAX_10_EXP__ 308
+#define __LDBL_DENORM_MIN__ 3.64519953188247460252840593361941982e-4951L
+#define __INT16_C(c) c
+#define __STDC__ 1
+#define __FLT32X_DIG__ 15
+#define __PTRDIFF_TYPE__ long long int
+#define __ATOMIC_SEQ_CST 5
+#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 1
+#define __FLT32X_MIN_10_EXP__ (-307)
+#define __UINTPTR_TYPE__ long long unsigned int
+#define __DEC64_SUBNORMAL_MIN__ 0.000000000000001E-383DD
+#define __DEC128_MANT_DIG__ 34
+#define __LDBL_MIN_10_EXP__ (-4931)
+#define __cpp_generic_lambdas 201304L
+#define __SSE_MATH__ 1
+#define __SIZEOF_LONG_LONG__ 8
+#define __cpp_user_defined_literals 200809L
+#define __FLT128_DECIMAL_DIG__ 36
+#define __GCC_ATOMIC_LLONG_LOCK_FREE 2
+#define __FLT32_HAS_QUIET_NAN__ 1
+#define __FLT_DECIMAL_DIG__ 9
+#define __UINT_FAST16_MAX__ 0xffff
+#define __LDBL_NORM_MAX__ 1.18973149535723176502126385303097021e+4932L
+#define __GCC_ATOMIC_SHORT_LOCK_FREE 2
+#define __UINT_FAST8_TYPE__ unsigned char
+#define __WIN64__ 1
+#define __cpp_init_captures 201304L
+#define __ATOMIC_ACQ_REL 4
+#define __ATOMIC_RELEASE 3
+#define __declspec(x) __attribute__((x))

+ 11 - 0
main.cpp

@@ -0,0 +1,11 @@
+#include "src/login/login_switch.h"
+#include <QApplication>
+
+int main(int argc, char *argv[])
+{
+    QApplication a(argc, argv);
+    loginMain = new login_switch();
+    loginMain->showMaximized();
+    return a.exec();
+}
+

+ 23 - 0
src/base/base.cpp

@@ -0,0 +1,23 @@
+#include "base.h"
+
+BaseWindow::BaseWindow(QWidget *parent) :
+    QMainWindow(parent)
+{
+}
+void BaseWindow::closeEvent(QCloseEvent *e)
+{
+        (void)e;
+        MessageDialog md(
+            "确认关闭", "确认关闭当前窗口吗?", MESSAGE_LEVEL_WARNING);
+        int ret = md.exec();
+
+        if (ret)
+        {
+
+            e->accept();
+        }
+        else
+        {
+            e->ignore();
+        }
+    }

+ 21 - 0
src/base/base.h

@@ -0,0 +1,21 @@
+// baseWindow.h
+#ifndef BASEWINDOW_H
+#define BASEWINDOW_H
+
+#include <QMainWindow>
+#include <QMessageBox>
+#include <QCloseEvent>
+#include "src/message/message_dialog.h"
+
+class BaseWindow : public QMainWindow
+{
+    Q_OBJECT
+public:
+    // 构造函数声明
+    explicit BaseWindow(QWidget *parent = nullptr);
+
+protected:
+    void closeEvent(QCloseEvent *e) override;
+};
+
+#endif // BASEWINDOW_H

+ 282 - 0
src/board/AO_AsynchronousOneWaveformAO/AsynchronousOneWaveformAO.cpp

@@ -0,0 +1,282 @@
+/*******************************************************************************
+Copyright (c) 1983-2016 Advantech Co., Ltd.
+********************************************************************************
+THIS IS AN UNPUBLISHED WORK CONTAINING CONFIDENTIAL AND PROPRIETARY INFORMATION
+WHICH IS THE PROPERTY OF ADVANTECH CORP., ANY DISCLOSURE, USE, OR REPRODUCTION,
+WITHOUT WRITTEN AUTHORIZATION FROM ADVANTECH CORP., IS STRICTLY PROHIBITED. 
+================================================================================
+REVISION HISTORY
+--------------------------------------------------------------------------------
+$Log: $
+--------------------------------------------------------------------------------
+$NoKeywords:  $
+*/
+/******************************************************************************
+*
+* Windows Example:
+*    AsynchronousOneWaveformAO.cpp
+*
+* Example Category
+*    AO
+* Description:
+*    This example demonstrates how to use Asynchronous One Waveform AO function.
+*
+* Instructions for Running:
+*    1  Set the 'deviceDescription' for opening the device. 
+*	  2  Set the 'profilePath' to save the profile path of being initialized device. 
+*    3  Set the 'channelStart' as the first channel for analog data output.
+*    4  Set the 'channelCount' to decide how many sequential channels to output analog data.
+*
+* I/O Connections Overview:
+*    Please refer to your hardware reference manual.
+*
+******************************************************************************/
+#include <stdlib.h>
+#include <stdio.h>
+#include <math.h>
+#include "../inc/compatibility.h"
+#include "../../../inc/bdaqctrl.h"
+using namespace Automation::BDaq;
+
+//-----------------------------------------------------------------------------------
+// Configure the following parameters before running the demo
+//-----------------------------------------------------------------------------------
+#define  ONE_WAVE_POINT_COUNT 2048 //define how many data to makeup a waveform period.
+int32       samples  = ONE_WAVE_POINT_COUNT;
+
+#define  deviceDescription  L"DemoDevice,BID#0"
+const wchar_t* profilePath = L"../../profile/DemoDevice.xml";
+int32    startChannel = 0;
+int32    channelCount = 10;
+
+enum WaveStyle{ Sine, Sawtooth, Square };
+
+//function GenerateWaveform: generate one waveform for each selected analog data output channel 
+ErrorCode GenerateWaveform( BufferedAoCtrl * ,int32 ,int32 ,  double * , int32 ,WaveStyle );
+
+inline void waitAnyKey()
+{
+   do{SLEEP(1);} while(!kbhit());
+} 
+// This function is used to deal with 'Stopped' Event.
+void BDAQCALL OnStoppedEvent(void * sender, BfdAoEventArgs * args, void * userParam)
+{
+   printf("\nBufferedAO stopped: offset = %d, count = %d\n", args->Offset, args->Count);
+}
+
+int main(int argc, char* argv[])
+{
+   ErrorCode ret = Success;
+  
+   // Step 1: Create a 'BufferedAoCtrl' for buffered AO function.
+   BufferedAoCtrl * bfdAoCtrl = BufferedAoCtrl::Create();
+
+	// Step 2: Set the notification event Handler by which we can known the state of operation effectively.
+   bfdAoCtrl->addStoppedHandler(OnStoppedEvent, NULL);
+
+   do
+   {
+      // Step 3: Select a device by device number or device description and specify the access mode.
+      // in this example we use ModeWrit mode so that we can fully control the device, including configuring, sampling, etc.
+      DeviceInformation devInfo(deviceDescription);
+      ret = bfdAoCtrl->setSelectedDevice(devInfo);
+      CHK_RESULT(ret);
+		ret = bfdAoCtrl->setStreaming(false);// specify the running mode: one-buffered.
+		CHK_RESULT(ret);
+      ret = bfdAoCtrl->LoadProfile(profilePath);//Loads a profile to initialize the device.
+      CHK_RESULT(ret);
+
+      // Step 4: Set necessary parameters.
+		ScanChannel * scanChannel = bfdAoCtrl->getScanChannel();
+      ret = scanChannel->setChannelStart(startChannel);
+      CHK_RESULT(ret);
+      ret = scanChannel->setChannelCount(channelCount);
+      CHK_RESULT(ret);
+		ret = scanChannel->setSamples(samples);
+		CHK_RESULT(ret);
+
+      // Step 5: Prepare the buffered AO. 
+      ret = bfdAoCtrl->Prepare();
+      CHK_RESULT(ret);
+
+      // Generate waveform data
+		int scaledWaveFormLen = channelCount*ONE_WAVE_POINT_COUNT*sizeof(double);
+      double*  scaledWaveForm = (double*)malloc(scaledWaveFormLen);
+      if( NULL  == scaledWaveForm )
+      {
+         printf( "Insufficient memory available\n" );
+         break;
+      }
+      ret = GenerateWaveform( bfdAoCtrl,startChannel,channelCount, scaledWaveForm,(int32)(channelCount*ONE_WAVE_POINT_COUNT),Sine);
+      CHK_RESULT(ret);
+      ret = bfdAoCtrl->SetData(channelCount*ONE_WAVE_POINT_COUNT,scaledWaveForm);
+      CHK_RESULT(ret);
+
+      // Step 6: Start Asynchronous One Waveform AO, 'Asynchronous' means the method returns immediately
+      // after the Buffered AO has been started. The StoppedHandler's 'BfdAoEvent' method will be called
+      // after the Buffered AO is completed.
+      printf("Asynchronous Buffered AO is in progress.\n");
+      printf("Please wait... any key to quit !\n");
+      ret = bfdAoCtrl->Start();
+      CHK_RESULT(ret);
+      free(scaledWaveForm);
+
+      // Step 7: Do anything you are interesting while the device is outputting data.
+      do
+      {
+         // do something yourself !
+         SLEEP(1);
+      }while(!kbhit());
+    
+      // step 8: Stop the operation if it is running.
+      ret = bfdAoCtrl->Stop(1);  
+      CHK_RESULT(ret);
+   }while(false);
+
+	// Step 9: Close device, release any allocated resource.
+	bfdAoCtrl->Dispose();
+
+	// If something wrong in this execution, print the error code on screen for tracking.
+   if(BioFailed(ret))
+   {
+      wchar_t enumString[256];
+      AdxEnumToString(L"ErrorCode", (int32)ret, 256, enumString);
+      printf("Some error occurred. And the last error code is 0x%X. [%ls]\n", ret, enumString);
+      waitAnyKey();// Wait any key to quit !
+   }
+   return 0;
+}
+
+ErrorCode GenerateWaveform(BufferedAoCtrl * bfdAoCtrl, int32 channelStart,int32 channelCount,double * waveBuffer,int32 SamplesCount,WaveStyle style)
+{
+   ErrorCode ret = Success;
+   int32    channel = 0;
+   int32    channelCountMax = 0;
+   int32    oneWaveSamplesCount = SamplesCount/channelCount;
+   int32    i = 0;
+
+   MathInterval  ranges[64] ;
+   ValueRange valRange;
+
+   channelCountMax =  bfdAoCtrl->getFeatures()->getChannelCountMax();
+   for(i = 0;i < channelCountMax ;i++ )
+   {
+      valRange = bfdAoCtrl->getChannels()->getItem(i).getValueRange();
+      if ( V_ExternalRefBipolar == valRange || valRange == V_ExternalRefUnipolar )
+      {
+		 if (bfdAoCtrl->getFeatures()->getExternalRefAntiPolar())
+		 {
+			double referenceValue;
+
+			if (valRange == V_ExternalRefBipolar)
+			{
+				referenceValue = bfdAoCtrl->getChannels()->getItem(i).getExtRefBipolar();
+				if (referenceValue >= 0) {
+					ranges[i].Max = referenceValue;
+					ranges[i].Min = 0 - referenceValue;
+				} else {
+					ranges[i].Max = 0 - referenceValue; 
+					ranges[i].Min = referenceValue;
+				}
+			}
+			else
+			{
+				referenceValue = bfdAoCtrl->getChannels()->getItem(i).getExtRefUnipolar();
+				if (referenceValue >= 0) {
+					ranges[i].Max = 0;
+					ranges[i].Min = 0 - referenceValue;
+				} else {
+					ranges[i].Max = 0 - referenceValue; 
+					ranges[i].Min = 0;
+				}
+			}	
+		 }
+		 else
+		 {
+			double referenceValue;
+
+			if (valRange == V_ExternalRefBipolar)
+			{
+				referenceValue = bfdAoCtrl->getChannels()->getItem(i).getExtRefBipolar();
+
+				if (referenceValue >= 0) {
+					ranges[i].Max = referenceValue;
+					ranges[i].Min = 0 - referenceValue;
+				} else {
+					ranges[i].Max = 0 - referenceValue; 
+					ranges[i].Min = referenceValue;
+				}
+			}
+			else
+			{
+				referenceValue = bfdAoCtrl->getChannels()->getItem(i).getExtRefUnipolar();
+				if (referenceValue >= 0) {
+					ranges[i].Max = referenceValue;
+					ranges[i].Min = 0;
+				} else {
+					ranges[i].Max = 0; 
+					ranges[i].Min = referenceValue;
+				}
+			}	
+		 }
+      } 
+	  else {
+         ret = AdxGetValueRangeInformation( valRange,0,NULL,&ranges[i],NULL);
+         if(BioFailed(ret))
+         {
+            return ret;
+         }
+      }
+   }
+
+   //generate waveform data and put them into the buffer which the parameter 'waveBuffer' give in, the Amplitude these waveform
+   for(i = 0; i < oneWaveSamplesCount; i++ ) 
+   { 
+      for( int32 j = channelStart; j < channelStart+channelCount; j++ )
+      {
+         //pay attention to channel rollback(when startChannel+channelCount>chNumberMax+1)
+         channel = j%channelCountMax;
+		
+		 double amplitude = (ranges[channel].Max - ranges[channel].Min) / 2;
+		 double offset = (ranges[channel].Max + ranges[channel].Min) / 2; 
+
+         switch ( style)
+         {
+         case Sine:
+            *waveBuffer++ = amplitude*(sin((double)i*2.0*( 3.14159 )/oneWaveSamplesCount )) + offset; 
+            break;
+         case  Sawtooth:
+            if ((i >= 0) && (i < (oneWaveSamplesCount / 4.0)))
+            {
+               *waveBuffer++ =  amplitude*( i/(oneWaveSamplesCount/4.0)) + offset;
+            }
+            else
+            {
+               if ((i >= (oneWaveSamplesCount / 4.0)) && (i < 3 * (oneWaveSamplesCount/4.0)))
+               {
+                  *waveBuffer++ = amplitude* ((2.0*(oneWaveSamplesCount/4.0)-i)/(oneWaveSamplesCount/4.0)) + offset;
+               }
+               else
+               { 
+                  *waveBuffer++ = amplitude* ((i-oneWaveSamplesCount)/(oneWaveSamplesCount/4.0)) + offset; 
+               }
+            }
+            break;
+         case  Square:
+            if ((i >= 0) && (i < (oneWaveSamplesCount / 2)))
+            {
+               *waveBuffer++ = amplitude * 1 + offset;
+            }
+            else
+            {
+               *waveBuffer++ = amplitude * (-1) + offset;
+            }
+            break;
+         default:
+            printf("invalid wave style,generate waveform error !");
+            ret = ErrorUndefined;
+         }
+      } 
+   }
+   return ret;
+};

+ 250 - 0
src/board/AO_StaticAO/StaticAO.cpp

@@ -0,0 +1,250 @@
+/******************************************************************************
+*
+* Windows Example:
+*    StaticAO.cpp
+*
+* Example Category:
+*    AO
+*
+* Description:
+*    This example demonstrates how to use Static AO voltage function.
+*
+* Instructions for Running:
+*    1  Set the 'deviceDescription' for opening the device. 
+*	  2  Set the 'profilePath' to save the profile path of being initialized device. 
+*    3  Set the 'channelStart' as the first channel for analog data output.
+*    4  Set the 'channelCount' to decide how many sequential channels to output analog data.
+*
+* I/O Connections Overview:
+*    Please refer to your hardware reference manual.
+*
+******************************************************************************/
+#include <stdlib.h>
+#include <stdio.h>
+#include <iostream>
+#include <math.h>
+#include "../inc/compatibility.h"
+#include "../inc/bdaqctrl.h"
+#include "StaticAO.h"
+using namespace std;
+using namespace Automation::BDaq;
+//-----------------------------------------------------------------------------------
+// Configure the following parameters before running the demo
+//-----------------------------------------------------------------------------------
+#define     ONE_WAVE_POINT_COUNT  512 //define how many data to makeup a waveform period.
+ 
+#define     deviceDescription  L"PCI-1724,BID#0" // 设备描述
+const wchar_t* profilePath = L"../../profile/PCI-1724.xml"; // 配置文件路径
+int32       channelStart = 0; // 输出数据的起始通道
+int32       channelCount = 1; // 输出数据的通道数量
+
+//function GenerateWaveform: generate one waveform for each selected analog data output channel 
+ErrorCode GenerateWaveform( InstantAoCtrl * instantAoCtrl,int32 channelStart,int32 channelCount,  double * waveBuffer, int32 SamplesCount,WaveStyle style);
+ 
+inline void waitAnyKey()
+{
+   do{SLEEP(1);} while(!kbhit()); // 等待任意键
+} 
+//----------代码作用:生成单通道波形数据----------
+//----------输入参数:instantAoCtrl:InstantAoCtrl类实例;channelStart:输出数据的起始通道;channelCount:输出数据的通道数量;waveBuffer:输出波形数据缓冲区;SamplesCount:波形数据点数;style:波形类型枚举----------
+//----------输出参数:返回值:成功返回Success,失败返回错误码----------
+
+
+
+void StaticAO::AO_1724::Static_AO(int argc, StaticAO_data* argv)
+{
+   ErrorCode ret = Success;
+   // Step 1: Create a 'InstantAoCtrl' for Static AO function.
+   InstantAoCtrl * instantAoCtrl = InstantAoCtrl::Create();
+   do
+   {
+      // Step 2: Select a device by device number or device description and specify the access mode.
+      // in this example we use ModeWrite mode so that we can fully control the device, including configuring, sampling, etc.
+      DeviceInformation devInfo(deviceDescription);
+      ret = instantAoCtrl->setSelectedDevice(devInfo); // 选择设备
+      CHK_RESULT(ret);
+      ret = instantAoCtrl->LoadProfile(profilePath); // 加载配置文件以初始化设备
+      CHK_RESULT(ret);
+ 
+      // Step 3: Output data 
+      // Generate waveform data
+      double *waveform = (double*)malloc( channelCount*ONE_WAVE_POINT_COUNT*sizeof(double)); // 分配内存用于波形数据
+      if( NULL  == waveform )
+      {
+         printf( "Insufficient memory available\n" ); // 检查内存分配情况
+         break;
+      }
+      ret = GenerateWaveform( instantAoCtrl,channelStart,channelCount, waveform,channelCount*ONE_WAVE_POINT_COUNT,argv->style,argv->current); // 生成波形
+      CHK_RESULT(ret);
+ 
+      printf("\n Outputting data...  any key to quit!\n"); // 输出数据提示
+      bool enforced = false; // 强制退出标志
+      do 
+      {
+         for( int32 i = 0; i < ONE_WAVE_POINT_COUNT; i++ ) 
+         { 
+            ret = instantAoCtrl->Write(channelStart, channelCount, &waveform[channelCount*i]); // 写入数据
+            CHK_RESULT(ret);
+            SLEEP(1); // 延时
+            cout << "当前输出数据点数:" << i << endl; // 输出提示信息
+            if(kbhit())
+            {
+               printf("\n Static AO is over compulsorily"); // 强制结束提示
+               enforced = true;
+               break;
+            }
+         } 
+      } while (false);
+      free(waveform); // 释放波形数据内存
+      if (!enforced)
+      {
+         printf("\n Static AO is over, press any key to quit!\n"); // 正常结束提示
+      }
+   }while(false);
+    
+ // Step 4: Close device and release any allocated resource.
+ instantAoCtrl->Dispose(); // 关闭设备并释放资源
+ 
+ // If something wrong in this execution, print the error code on screen for tracking.
+   if(BioFailed(ret)) // 错误处理
+   {
+      wchar_t enumString[256];
+      AdxEnumToString(L"ErrorCode", (int32)ret, 256, enumString); // 获取错误信息
+      printf("Some error occurred. And the last error code is 0x%X. [%ls]\n", ret, enumString);
+      waitAnyKey(); // 等待任意键退出
+   }
+  
+}
+ 
+ 
+ErrorCode GenerateWaveform( InstantAoCtrl * instantAoCtrl, int32 channelStart,int32 channelCount,double * waveBuffer,int32 SamplesCount,WaveStyle style,double referenceValue)
+{
+   ErrorCode ret = Success; // 初始化返回状态
+   int32    channel = 0; // 当前通道索引
+   int32    channelCountMax = 0; // 最大通道数
+   int32    oneWaveSamplesCount = SamplesCount/channelCount; // 每通道波形样本数量
+   int32    i = 0; // 循环索引
+ 
+   MathInterval  ranges[64] ; // 通道值范围
+   ValueRange valRange; // 存储通道值范围
+   channelCountMax =  instantAoCtrl->getFeatures()->getChannelCountMax(); // 获取设备最大通道数
+   for(i = 0;i < channelCountMax ;i++ )
+   {
+      valRange = instantAoCtrl->getChannels()->getItem(i).getValueRange(); // 获取当前通道的值范围
+      if ( V_ExternalRefBipolar == valRange || valRange == V_ExternalRefUnipolar ) // 如果是外部参考
+      {
+   if (instantAoCtrl->getFeatures()->getExternalRefAntiPolar())
+   {
+   // 参考值
+ 
+   if (valRange == V_ExternalRefBipolar)
+   {
+    referenceValue = instantAoCtrl->getChannels()->getItem(i).getExtRefBipolar(); // 获取双极性参考值
+    if (referenceValue >= 0) {
+     ranges[i].Max = referenceValue; // 设置最大值
+     ranges[i].Min = 0 - referenceValue; // 设置最小值
+    } else {
+     ranges[i].Max = 0 - referenceValue; 
+     ranges[i].Min = referenceValue;
+    }
+   }
+   else
+   {
+    referenceValue = instantAoCtrl->getChannels()->getItem(i).getExtRefUnipolar(); // 获取单极性参考值
+    if (referenceValue >= 0) {
+     ranges[i].Max = 0;
+     ranges[i].Min = 0 - referenceValue;
+    } else {
+     ranges[i].Max = 0 - referenceValue; 
+     ranges[i].Min = 0;
+    }
+   }	
+   }
+   else
+   {
+   double referenceValue; // 参考值
+ 
+   if (valRange == V_ExternalRefBipolar)
+   {
+    referenceValue = instantAoCtrl->getChannels()->getItem(i).getExtRefBipolar(); // 获取双极性参考值
+    if (referenceValue >= 0) {
+     ranges[i].Max = referenceValue; // 设置最大值
+     ranges[i].Min = 0 - referenceValue; // 设置最小值
+    } else {
+     ranges[i].Max = 0 - referenceValue; 
+     ranges[i].Min = referenceValue;
+    }
+   }
+   else
+   {
+    referenceValue = instantAoCtrl->getChannels()->getItem(i).getExtRefUnipolar(); // 获取单极性参考值
+    if (referenceValue >= 0) {
+     ranges[i].Max = referenceValue; // 设置最大值
+     ranges[i].Min = 0;
+    } else {
+     ranges[i].Max = 0; 
+     ranges[i].Min = referenceValue;
+    }
+   }	
+   }
+      } 
+   else {
+         ret = AdxGetValueRangeInformation( valRange,0,NULL,&ranges[i],NULL); // 获取值范围信息
+         if(BioFailed(ret))
+         {
+            return ret; // 返回错误状态
+         }
+      }
+   }
+ 
+   //generate waveform data and put them into the buffer which the parameter 'waveBuffer' give in, the Amplitude these waveform
+   for(i = 0; i < oneWaveSamplesCount; i++ ) 
+   { 
+      for( int32 j = channelStart; j < channelStart+channelCount; j++ )
+      {
+         //pay attention to channel rollback(when startChannel+channelCount>chNumberMax+1)
+         channel = j%channelCountMax; // 处理通道回卷
+    
+   double amplitude = (ranges[channel].Max - ranges[channel].Min) / 2; // 幅度计算
+   double offset = (ranges[channel].Max + ranges[channel].Min) / 2; // 偏移计算
+ 
+         switch ( style) // 根据波形类型生成波形数据
+         {
+         case Sine:
+            *waveBuffer++ = amplitude*(sin((double)i*2.0*( 3.14159 )/oneWaveSamplesCount )) + offset; 
+            break;
+         case  Sawtooth:
+            if ((i >= 0) && (i < (oneWaveSamplesCount / 4.0)))
+            {
+               *waveBuffer++ =  amplitude*( i/(oneWaveSamplesCount/4.0)) + offset;
+            }
+            else
+            {
+               if ((i >= (oneWaveSamplesCount / 4.0)) && (i < 3 * (oneWaveSamplesCount/4.0)))
+               {
+                  *waveBuffer++ = amplitude* ((2.0*(oneWaveSamplesCount/4.0)-i)/(oneWaveSamplesCount/4.0)) + offset;
+               }
+               else
+               { 
+                  *waveBuffer++ = amplitude* ((i-oneWaveSamplesCount)/(oneWaveSamplesCount/4.0)) + offset; 
+               }
+            }
+            break;
+         case  Square:
+            if ((i >= 0) && (i < (oneWaveSamplesCount / 2)))
+            {
+               *waveBuffer++ = amplitude * 1 + offset;
+            }
+            else
+            {
+               *waveBuffer++ = amplitude * (-1) + offset;
+            }
+            break;
+         default:
+            printf("invalid wave style,generate waveform error !"); // 无效波形类型提示
+            ret = ErrorUndefined; // 返回未定义错误
+         }
+      } 
+   }
+   return ret; // 返回状态
+};

+ 26 - 0
src/board/AO_StaticAO/StaticAO.h

@@ -0,0 +1,26 @@
+#ifndef STATICAO_H
+#define STATICAO_H
+enum WaveStyle{ Sine, Sawtooth, Square }; // 波形类型枚举
+struct StaticAO_data
+{
+    int channel;// 通道号
+    double current;// 电流
+    double frequency;// 频率
+    double amplitude;// 振幅
+    double offset;// 偏移
+    double phase;// 相位
+    WaveStyle style;
+};
+
+
+namespace StaticAO
+{
+    class AO_1724
+    {
+    public:
+        void Static_AO(int argc, StaticAO_data* argv);
+    };
+    
+}
+
+#endif // STATICAO_H

File diff suppressed because it is too large
+ 7051 - 0
src/board/inc/bdaqctrl.h


+ 33 - 0
src/board/inc/compatibility.h

@@ -0,0 +1,33 @@
+#ifndef _WIN32
+#include   <unistd.h>
+#include   <string.h>
+#else
+#include <conio.h>
+#pragma warning( disable: 4996 )
+#endif
+
+//#if defined(DEBUG)||defined(_DEBUG)
+#define CHK_RESULT(ret) {if(BioFailed(ret))break;}
+//#else
+//#define CHK_RESULT(ret) 
+//#endif
+
+#define MinValue(a,b) (((a) < (b)) ? (a) : (b))
+#define BufLength(buf) (sizeof(buf)/sizeof(buf[0]))
+#if !defined(_WIN32)
+#  define SLEEP(second)  sleep(second)
+inline int kbhit(void)
+{
+   struct timeval tv = {0};
+   fd_set rdfs;
+   FD_ZERO(&rdfs);
+   FD_SET (STDIN_FILENO, &rdfs);
+   select(STDIN_FILENO+1, &rdfs, NULL, NULL, &tv);
+   return FD_ISSET(STDIN_FILENO, &rdfs);
+}
+#else
+#define SLEEP(second)  Sleep(second*1000)
+#endif
+
+
+

+ 509 - 0
src/chart/chart_file.cpp

@@ -0,0 +1,509 @@
+#include "chart_file.h"
+#include "src/model_select/model_select.h"
+#include "ui_chart_file.h"
+
+#include <QDebug>
+#include <QMessageBox>
+#include <QFile>
+
+#define MAX_LINE_NUM 1000
+
+chart_file::chart_file(QWidget *parent) : QWidget(parent),
+                                          ui(new Ui::chart_file),
+                                          chart(new QChart),
+                                          timer(new QTimer),
+                                          count(0),
+                                          line_now_count(0),
+                                          line_last_count(0),
+                                          read_time(1)
+
+{
+    ui->setupUi(this);
+
+    // 初始化变量
+    time = nullptr;
+    point1 = nullptr;
+    point2 = nullptr;
+
+    // 设置点的数量
+    pointsSize = 200;
+
+    // 初始化字体颜色
+    initFontColor();
+
+    // 初始化读取数据
+    initReadData();
+
+    // 设置定时器间隔为100毫秒
+    timer->setInterval(10);
+
+    // 启动定时器
+    timer->start();
+}
+
+chart_file::~chart_file()
+{
+    // 释放UI对象和动态分配的内存
+    delete ui;
+
+    // 释放动态分配的数组内存
+    delete[] time;
+    delete[] point1;
+    delete[] point2;
+
+    // 释放二维数组tempDis的内存
+    for (int i = 0; i < pointsNum; i++)
+    {
+        delete[] tempDis[i];
+    }
+    delete[] tempDis;
+}
+
+// 鼠标滚轮事件处理函数
+void chart_file::wheelEvent(QWheelEvent *event)
+{
+    if (event->angleDelta().y() > 0)
+    {
+        chart->zoom(1.1);
+    }
+    else
+    {
+        chart->zoom(10 / 1.1);
+    }
+
+    QWidget::wheelEvent(event);
+}
+
+void chart_file::initUI()
+{
+    initChart();
+}
+// 初始化曲线图
+void chart_file::initChart()
+{
+    // chart->createDefaultAxes();
+
+    /**修改**/
+    axisX = new QValueAxis();
+    axisX->setTitleFont(QFont("Microsoft YaHei", 10, QFont::Normal, true));
+    axisX->setTitleText("Time(s)");
+    axisX->setGridLineVisible(true);
+    chart->addAxis(axisX, Qt::AlignBottom);
+
+    axisY = new QValueAxis();
+    axisY->setTitleFont(QFont("Microsoft YaHei", 10, QFont::Normal, true));
+    axisY->setTitleText("值");
+    axisY->setGridLineVisible(true);
+    chart->addAxis(axisY, Qt::AlignLeft);
+
+    for (int i = 0; i < pointsNum; i++)
+    {
+        series[i]->attachAxis(axisX);
+        series[i]->attachAxis(axisY);
+    }
+    /**修改**/
+    chart->legend()->hide();
+    chartView = new QChartView(chart);
+    chartView->setRenderHint(QPainter::Antialiasing); // 抗锯齿渲染
+    // 为 scope_1 设置布局
+    QVBoxLayout *layout = new QVBoxLayout(ui->scope_1);
+    layout->addWidget(chartView);
+}
+// 初始化信号槽连接
+// 初始化槽函数,连接信号和槽
+void chart_file::initSlot()
+{
+    connect(timer, SIGNAL(timeout()), this, SLOT(timerSlot()));
+    connect(ui->allRadioButton, SIGNAL(clicked()), this, SLOT(selectAll()));
+    connect(ui->invertRadioButton, SIGNAL(clicked()), this, SLOT(invertSelect()));
+
+    for (int i = 0; i < pointsNum; i++)
+    {
+        connect(checkBoxVector.at(i), SIGNAL(toggled(bool)), this, SLOT(checkboxChanged()));
+        connect(series[i], SIGNAL(hovered(QPointF, bool)), this, SLOT(tipSlot(QPointF, bool)));
+    }
+}
+
+/*
+ for (int i=0;i<pointsNum;i++)
+    {
+        QVector<QPointF> oldData = series[i]->pointsVector();
+        QVector<QPointF> data;
+
+        if(oldData.size()<pointsSize){
+            data=oldData;
+        }
+        else {
+            oldData.removeFirst();
+            data=oldData;
+        }
+    }
+*/
+// 添加图表数据
+struct ValueRange
+{
+    float minY = std::numeric_limits<float>::max();    // 初始为正无穷
+    float maxY = std::numeric_limits<float>::lowest(); // 初始为负无穷
+};
+
+ValueRange valueRanges[8]; // MAX_POINTS_NUM为最大数据系列数量
+
+void chart_file::addChartData(float time, float *pointsDis)
+{
+    float globalMinX = 0;
+    float globalMaxX = time;
+    float globalMinY = pointsDis[0];
+    float globalMaxY = pointsDis[0];
+
+    for (int i = 0; i < pointsNum; i++)
+    {
+        // 获取第 i 个数据系列的点向量
+        QVector<QPointF> data = series[i]->pointsVector();
+
+        data.append(QPointF(time, pointsDis[i]));
+
+        float minX = data.at(0).x();
+        float maxX = data.at(0).x();
+        float minY = data.at(0).y();
+        float maxY = data.at(0).y();
+
+        for (int j = 0; j < data.size(); j++)
+        {
+            if (minY > data.at(j).y())
+                minY = data.at(j).y();
+            if (maxY < data.at(j).y())
+                maxY = data.at(j).y();
+        }
+
+        if (i == 0)
+        {
+            for (int j = 0; j < data.size(); j++)
+            {
+                if (maxX < data.at(j).x())
+                    maxX = data.at(j).x();
+            }
+
+            globalMaxX = maxX;
+        }
+
+        globalMinY = globalMinY < minY ? globalMinY : minY;
+        globalMaxY = globalMaxY > maxY ? globalMaxY : maxY;
+
+        series[i]->replace(data);
+        valueRanges[i].minY = std::min(valueRanges[i].minY, minY);
+        valueRanges[i].maxY = std::max(valueRanges[i].maxY, maxY);
+
+        tempDis[i][0] = pointsDis[i];
+        tempDis[i][1] = maxY;
+        tempDis[i][2] = minY;
+    }
+
+    addTableData(tempDis);
+
+    axisX->setRange(globalMinX, globalMaxX);
+    axisY->setRange(globalMinY - (globalMaxY - globalMinY) * 0.1, globalMaxY + (globalMaxY - globalMinY) * 0.1);
+}
+
+// 设置点的数量
+void chart_file::setPointsNum(int num)
+{
+    if (num > 9)
+    {
+        QMessageBox::information(this, "Warnning", "The number of points exceed 9!");
+        return;
+    }
+
+    tempDis = new float *[num];
+
+    pointsNum = num;
+    // model->setRowCount(num);
+
+    // 该函数用于初始化图表中的数据系列,并为每个数据系列设置颜色和临时数据存储空间
+    // 参数:
+    // - pointsNum: 数据系列的数量
+    // - series: 指向数据系列数组的指针
+    // - colorTable: 包含每个数据系列颜色的QList
+    // - chart: 指向图表对象的指针
+    // - tempDis: 指向临时数据存储数组的指针
+    for (int i = 0; i < pointsNum; i++)
+    {
+        series[i] = new QLineSeries();
+        series[i]->setColor(colorTable.at(i));
+        chart->addSeries(series[i]);
+        tempDis[i] = new float[3];
+    }
+
+    initUI();
+    initTable(num);
+    initSlot();
+}
+
+// 添加表格数据
+void chart_file::addTableData(float **pointsDis)
+{
+    for (int i = 0; i < pointsNum; i++)
+    {
+        for (int j = 0; j < 1; j++)
+        {
+            model->setItem(i, j + 1, new QStandardItem(QString::number(pointsDis[i][j])));
+            model->item(i, j + 1)->setForeground(QBrush(colorTable.at(i)));
+            model->item(i, j + 1)->setTextAlignment(Qt::AlignCenter);
+        }
+    }
+}
+
+// 初始化表格
+void chart_file::initTable(int pointsNumber)
+{
+    ui->allRadioButton->setChecked(true);
+
+    model = new QStandardItemModel();
+    model->setColumnCount(2);
+    model->setHorizontalHeaderItem(0, new QStandardItem(QObject::tr("曲线编号")));
+    model->setHorizontalHeaderItem(1, new QStandardItem(QObject::tr("当前值")));
+    // model->setHorizontalHeaderItem(2, new QStandardItem(QObject::tr("Peak(mm)")));
+    // model->setHorizontalHeaderItem(3, new QStandardItem(QObject::tr("Valley(mm)")));
+
+    ui->tableView->setModel(model);
+
+    ui->tableView->setEditTriggers(QAbstractItemView::NoEditTriggers);
+    ui->tableView->verticalHeader()->hide();
+    ui->tableView->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
+    ui->tableView->setColumnWidth(1, 100);
+
+    model->setRowCount(pointsNumber);
+
+    // 此函数用于在表格视图中创建多个复选框,并将它们添加到模型中
+    // 每个复选框的标签为 "Point" 加上序号,并根据颜色数组设置样式
+    // 最后,将复选框添加到表格视图中,并设置其初始状态为选中
+    QString str = "";
+    for (int i = 0; i < pointsNumber; i++)
+    {
+        str = "NGS干扰仿真曲线";
+        str += QString::number(i + 1);
+        QCheckBox *box = new QCheckBox(str, ui->tableView);
+        box->setStyleSheet(strColor[i]);
+
+        checkBoxVector.append(box);
+
+        model->setItem(i, 0, new QStandardItem(""));
+        ui->tableView->setIndexWidget(model->index(i, 0), checkBoxVector.at(i));
+        model->item(i, 0)->setTextAlignment(Qt::AlignCenter);
+        checkBoxVector.at(i)->setChecked(true);
+    }
+}
+
+// 全选所有点
+void chart_file::selectAll()
+{
+    for (int i = 0; i < checkBoxVector.size(); i++)
+        checkBoxVector.at(i)->setChecked(true);
+}
+
+// 初始化字体颜色
+void chart_file::initFontColor()
+{
+    colorTable.append(QColor(255, 0, 0));    // red
+    colorTable.append(QColor(0, 0, 255));    // blue
+    colorTable.append(QColor(0, 255, 0));    // green
+    colorTable.append(QColor(139, 0, 0));    // dark red
+    colorTable.append(QColor(255, 255, 0));  // yellow
+    colorTable.append(QColor(0, 0, 0));      // black
+    colorTable.append(QColor(128, 42, 42));  // 棕色
+    colorTable.append(QColor(160, 32, 240)); // purple
+    colorTable.append(QColor(0, 255, 255));  // 青色
+
+    strColor[0] = "QCheckBox{color:rgb(255,0,0)}";
+    strColor[1] = "QCheckBox{color:rgb(0,0,255)}";
+    strColor[2] = "QCheckBox{color:rgb(0,255,0)}";
+    strColor[3] = "QCheckBox{color:rgb(139,0,0)}";
+    strColor[4] = "QCheckBox{color:rgb(255,255,0)}";
+    strColor[5] = "QCheckBox{color:rgb(128,42,42)}";
+    strColor[7] = "QCheckBox{color:rgb(160,32,240)}";
+    strColor[8] = "QCheckBox{color:rgb(0,255,255)}";
+}
+
+// 反选所有点
+void chart_file::invertSelect()
+{
+    for (int i = 0; i < checkBoxVector.size(); i++)
+    {
+        if (checkBoxVector.at(i)->checkState())
+            checkBoxVector.at(i)->setChecked(false);
+        else
+            checkBoxVector.at(i)->setChecked(true);
+    }
+}
+
+// 复选框状态改变处理函数
+void chart_file::checkboxChanged()
+{
+    for (int i = 0; i < pointsNum; i++)
+    {
+        if (checkBoxVector.at(i)->checkState())
+        {
+            series[i]->setVisible(true);
+        }
+        else
+        {
+            series[i]->setVisible(false);
+        }
+    }
+}
+
+// 初始化读取数据
+void chart_file::initReadData()
+{
+    QString name = "D:/desktop/NGS/model_git/model_zl/tcp/data/data_output_1.txt";
+
+    QFile readFile(name);
+    int i = 0;
+
+    if (!readFile.open(QIODevice::ReadOnly | QIODevice::Text))
+    {
+        QMessageBox::information(nullptr, "Warning", "Fail to read the file");
+        return;
+    }
+
+    QTextStream readStream(&readFile);
+    QString line;
+
+    time = new float[100000];
+    point1 = new float[100000];
+    point2 = new float[100000];
+
+    while (i < MAX_LINE_NUM)
+    {
+        line = readStream.readLine();
+
+        if (!line.isEmpty())
+        {
+            QStringList list = line.split(QRegularExpression(" "), Qt::SkipEmptyParts);
+            time[i] = list.at(0).toFloat();
+            point1[i] = list.at(1).toFloat();
+            point2[i] = list.at(2).toFloat();
+            line_now_count++;
+        }
+
+        i++;
+    }
+
+    readFile.close();
+}
+// 每当曲线显示完全尝试读取新的数据,若无尝试提示信息
+void chart_file::add_read_data()
+{
+
+    QString name = QString("D:/desktop/NGS/model_git/model_zl/tcp/data/data_output_%1.txt").arg(read_time);
+    line_last_count = line_now_count;
+    QFile readFile(name);
+    int i = 0;
+
+    if (!readFile.open(QIODevice::ReadOnly | QIODevice::Text))
+    {
+        QMessageBox::information(nullptr, "Warning", "Fail to read the file");
+        return;
+    }
+
+    QTextStream readStream(&readFile);
+    QString line;
+
+    while (i < MAX_LINE_NUM)
+    {
+        line = readStream.readLine();
+
+        if (!line.isEmpty())
+        {
+            QStringList list = line.split(QRegularExpression(" "), Qt::SkipEmptyParts);
+
+            time[i + line_last_count] = list.at(0).toFloat();
+            point1[i + line_last_count] = list.at(1).toFloat();
+            point2[i + line_last_count] = list.at(2).toFloat();
+            line_now_count++;
+        }
+
+        i++;
+    }
+
+    readFile.close();
+}
+
+// 添加数据
+void chart_file::addData()
+{
+    if (count < MAX_LINE_NUM * read_time)
+    { // 确保不会越界
+        float y[2];
+        y[0] = point1[count];
+        y[1] = point2[count];
+
+        addChartData(time[count], y);
+        count++;
+    }
+}
+//获取指定文件夹下文件数目
+int chart_file::getFileNum(QString path)
+{
+    QDir dir(path);
+    int count = 0;
+    foreach (QFileInfo fileInfo, dir.entryInfoList(QDir::Files))
+    {
+        count++;
+    }
+    return count;
+}
+
+
+
+// 定时器槽函数
+void chart_file::timerSlot()
+{
+
+    if (QObject::sender() == timer)
+    {
+        if (count >= MAX_LINE_NUM * read_time)
+        {
+            timer->stop(); // 停止定时器v
+            send_time = getFileNum("D:/desktop/NGS/model_git/model_zl/tcp/data/");
+            MessageDialog md(
+                QString("曲线显示完全,请选择是否继续显示"),
+                QString("当前曲线显示完成%1/%2个曲线,是否继续显示下一个曲线?").arg(read_time).arg(send_time),
+                MESSAGE_LEVEL_WARNING);
+            int ret = md.exec();
+            if (ret)
+            {
+                read_time++;
+                add_read_data();
+                timer->start(); // 重新启动定时器
+            }
+            
+        }
+        else
+        {
+            addData();
+        }
+    }
+}
+
+void chart_file::on_btn_clear_clicked()
+{
+    timer->stop(); // 停止定时器
+
+    for (int i = 0; i < pointsNum; i++)
+    {
+        series[i]->clear();
+    }
+    count = 0; // 重置计数
+    chart->update();
+    chartView->repaint();
+
+    timer->start(); // 重新启动定时器(如果需要)
+}
+
+void chart_file::on_btn_save_clicked()
+{
+    for (int i = 0; i < pointsNum; i++)
+    {
+        series[i]->clear();
+    }
+}

+ 99 - 0
src/chart/chart_file.h

@@ -0,0 +1,99 @@
+#ifndef CHART_FILE_H
+#define CHART_FILE_H
+
+#include <QWidget>
+#include <QChart>
+#include <QLineSeries>
+#include <QVector>
+#include <QTimer>
+#include <QStandardItemModel>
+#include <QCheckBox>
+#include <QValueAxis>
+#include <QChartView>
+#include <QDir> 
+#include <QFileInfo>
+
+#include "src/message/message_dialog.h"
+//QT_USE_NAMESPACE
+
+namespace Ui {
+class chart_file;
+}
+
+class chart_file : public QWidget
+{
+    Q_OBJECT
+
+public:
+    explicit chart_file(QWidget *parent = nullptr);
+    ~chart_file();
+
+    void setPointsNum(int num);
+    void addChartData(float time, float *pointsDis);
+
+
+
+private:
+    Ui::chart_file *ui;
+    void wheelEvent(QWheelEvent *event);
+
+    void initUI();
+    void initChart();
+    void initSlot();
+    void initTable(int pointsNumber);
+    void initFontColor();
+
+
+    void initReadData();
+    void add_read_data();
+    int read_time;
+  
+    void addData();
+    QChartView *chartView;
+    QChart *chart;
+    QLineSeries *series[8];
+    int pointsSize;//用于画曲线的数据点数
+
+
+    float *time;
+    float *point1;
+    float *point2;
+    int pointsNum;
+
+    float **tempDis;//store dis,mini dis, max dis for every points;
+
+    QTimer *timer;
+
+    quint16 count;
+    quint16 line_now_count;
+    quint16 line_last_count;
+
+
+
+private slots:
+    void timerSlot();
+    int getFileNum(QString path);
+    void selectAll();
+    void invertSelect();
+    void checkboxChanged();
+
+
+
+private:
+
+    QVector<QCheckBox *> checkBoxVector;
+    QString strColor[9];
+    QVector<QColor> colorTable;
+    QStandardItemModel *model;
+
+    QValueAxis *axisX;
+    QValueAxis *axisY;
+
+    void addTableData(float **pointsDis);
+    void on_btn_clear_clicked();
+    void on_btn_save_clicked();
+
+
+};
+
+#endif // CHART_FILE_H

+ 143 - 0
src/chart/chart_file.ui

@@ -0,0 +1,143 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>chart_file</class>
+ <widget class="QWidget" name="chart_file">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>885</width>
+    <height>722</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Form</string>
+  </property>
+  <property name="styleSheet">
+   <string notr="true"/>
+  </property>
+  <layout class="QGridLayout" name="gridLayout_6" columnminimumwidth="1,1,8">
+   <item row="1" column="0" colspan="3">
+    <layout class="QGridLayout" name="gridLayout_5">
+     <item row="1" column="0" colspan="3">
+      <layout class="QGridLayout" name="gridLayout_4">
+       <item row="0" column="0">
+        <layout class="QGridLayout" name="gridLayout">
+         <item row="0" column="0">
+          <widget class="QWidget" name="scope_1" native="true">
+           <property name="minimumSize">
+            <size>
+             <width>0</width>
+             <height>0</height>
+            </size>
+           </property>
+          </widget>
+         </item>
+        </layout>
+       </item>
+      </layout>
+     </item>
+     <item row="0" column="0">
+      <widget class="QPushButton" name="btn_clear">
+       <property name="text">
+        <string>清空窗口</string>
+       </property>
+      </widget>
+     </item>
+     <item row="0" column="1">
+      <widget class="QPushButton" name="btn_one">
+       <property name="text">
+        <string>归一化</string>
+       </property>
+      </widget>
+     </item>
+     <item row="0" column="2">
+      <widget class="QPushButton" name="btn_save">
+       <property name="text">
+        <string>保存</string>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </item>
+   <item row="0" column="2">
+    <widget class="QGroupBox" name="groupBox">
+     <property name="minimumSize">
+      <size>
+       <width>120</width>
+       <height>0</height>
+      </size>
+     </property>
+     <property name="maximumSize">
+      <size>
+       <width>120</width>
+       <height>100</height>
+      </size>
+     </property>
+     <property name="toolTipDuration">
+      <number>-1</number>
+     </property>
+     <property name="layoutDirection">
+      <enum>Qt::LeftToRight</enum>
+     </property>
+     <property name="title">
+      <string>曲线</string>
+     </property>
+     <property name="flat">
+      <bool>false</bool>
+     </property>
+     <layout class="QVBoxLayout" name="verticalLayout">
+      <item>
+       <widget class="QRadioButton" name="allRadioButton">
+        <property name="text">
+         <string>全选</string>
+        </property>
+        <property name="iconSize">
+         <size>
+          <width>16</width>
+          <height>16</height>
+         </size>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QRadioButton" name="invertRadioButton">
+        <property name="text">
+         <string>反转</string>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item row="0" column="1">
+    <spacer name="horizontalSpacer">
+     <property name="orientation">
+      <enum>Qt::Horizontal</enum>
+     </property>
+     <property name="sizeType">
+      <enum>QSizePolicy::Minimum</enum>
+     </property>
+     <property name="sizeHint" stdset="0">
+      <size>
+       <width>20</width>
+       <height>20</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+   <item row="0" column="0">
+    <widget class="QTableView" name="tableView">
+     <property name="maximumSize">
+      <size>
+       <width>16777215</width>
+       <height>150</height>
+      </size>
+     </property>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>

+ 30 - 0
src/login/login_switch.cpp

@@ -0,0 +1,30 @@
+#include "login_switch.h"
+#include "ui_login_switch.h"
+// 在 login_switch.cpp 文件中
+login_switch *loginMain = nullptr; // 定义 extern 变量
+
+
+login_switch::login_switch(QWidget *parent) :
+    QWidget(parent),
+    ui(new Ui::login_switch)
+{
+    ui->setupUi(this);
+    page_main_sim = new page_main();
+}
+
+login_switch::~login_switch()
+{
+    delete ui;
+}
+
+
+void login_switch::on_btn_sim_clicked()
+{
+    page_main_sim->showMaximized();
+}
+
+
+void login_switch::on_btn_real_clicked()
+{
+    page_main_sim->showFullScreen();
+}

+ 33 - 0
src/login/login_switch.h

@@ -0,0 +1,33 @@
+#ifndef LOGIN_SWITCH_H
+#define LOGIN_SWITCH_H
+
+#include <QWidget>
+#include "src/page_main/page_main.h"
+
+namespace Ui {
+class login_switch;
+}
+
+
+
+class login_switch : public QWidget
+{
+    Q_OBJECT
+
+public:
+    explicit login_switch(QWidget *parent = nullptr);
+
+    ~login_switch();
+
+private slots:
+
+    void on_btn_sim_clicked();//仿真台架btn
+
+    void on_btn_real_clicked();//试验台架btn
+
+private:
+    Ui::login_switch *ui;
+    page_main *page_main_sim;
+};
+extern login_switch *loginMain;
+#endif // LOGIN_SWITCH_H

+ 246 - 0
src/login/login_switch.ui

@@ -0,0 +1,246 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>login_switch</class>
+ <widget class="QWidget" name="login_switch">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>792</width>
+    <height>522</height>
+   </rect>
+  </property>
+  <property name="font">
+   <font>
+    <family>楷体</family>
+    <pointsize>18</pointsize>
+    <italic>false</italic>
+    <bold>false</bold>
+   </font>
+  </property>
+  <property name="windowTitle">
+   <string>台架选择</string>
+  </property>
+  <property name="windowIcon">
+   <iconset>
+    <normaloff>:/switch-on.svg</normaloff>:/switch-on.svg</iconset>
+  </property>
+  <property name="styleSheet">
+   <string notr="true">
+</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout" stretch="2,8">
+   <item>
+    <widget class="QGroupBox" name="groupBox">
+     <property name="title">
+      <string/>
+     </property>
+     <layout class="QHBoxLayout" name="horizontalLayout_5">
+      <item>
+       <widget class="QLabel" name="page_label">
+        <property name="font">
+         <font>
+          <family>楷体</family>
+          <pointsize>38</pointsize>
+         </font>
+        </property>
+        <property name="layoutDirection">
+         <enum>Qt::LeftToRight</enum>
+        </property>
+        <property name="styleSheet">
+         <string notr="true">background-image: url();</string>
+        </property>
+        <property name="text">
+         <string>台架选择</string>
+        </property>
+        <property name="alignment">
+         <set>Qt::AlignCenter</set>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item>
+    <widget class="QGroupBox" name="groupBox_2">
+     <property name="layoutDirection">
+      <enum>Qt::LeftToRight</enum>
+     </property>
+     <property name="styleSheet">
+      <string notr="true">border-image: url();</string>
+     </property>
+     <property name="title">
+      <string/>
+     </property>
+     <property name="alignment">
+      <set>Qt::AlignCenter</set>
+     </property>
+     <layout class="QHBoxLayout" name="horizontalLayout">
+      <item>
+       <spacer name="horizontalSpacer">
+        <property name="orientation">
+         <enum>Qt::Horizontal</enum>
+        </property>
+        <property name="sizeHint" stdset="0">
+         <size>
+          <width>197</width>
+          <height>20</height>
+         </size>
+        </property>
+       </spacer>
+      </item>
+      <item>
+       <widget class="QGroupBox" name="groupBox_3">
+        <property name="styleSheet">
+         <string notr="true">border-image: url();</string>
+        </property>
+        <property name="title">
+         <string/>
+        </property>
+        <layout class="QVBoxLayout" name="verticalLayout_2">
+         <item>
+          <spacer name="verticalSpacer_2">
+           <property name="orientation">
+            <enum>Qt::Vertical</enum>
+           </property>
+           <property name="sizeHint" stdset="0">
+            <size>
+             <width>20</width>
+             <height>43</height>
+            </size>
+           </property>
+          </spacer>
+         </item>
+         <item>
+          <widget class="QPushButton" name="btn_sim">
+           <property name="minimumSize">
+            <size>
+             <width>300</width>
+             <height>100</height>
+            </size>
+           </property>
+           <property name="maximumSize">
+            <size>
+             <width>300</width>
+             <height>100</height>
+            </size>
+           </property>
+           <property name="font">
+            <font>
+             <family>宋体</family>
+             <pointsize>28</pointsize>
+             <italic>false</italic>
+             <bold>false</bold>
+            </font>
+           </property>
+           <property name="styleSheet">
+            <string notr="true">background-color: rgb(86, 104, 156);
+
+</string>
+           </property>
+           <property name="text">
+            <string>仿真台架</string>
+           </property>
+           <property name="icon">
+            <iconset>
+             <normaloff>:/sine-wave.svg</normaloff>:/sine-wave.svg</iconset>
+           </property>
+           <property name="iconSize">
+            <size>
+             <width>30</width>
+             <height>30</height>
+            </size>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <spacer name="verticalSpacer">
+           <property name="orientation">
+            <enum>Qt::Vertical</enum>
+           </property>
+           <property name="sizeHint" stdset="0">
+            <size>
+             <width>20</width>
+             <height>44</height>
+            </size>
+           </property>
+          </spacer>
+         </item>
+         <item>
+          <widget class="QPushButton" name="btn_real">
+           <property name="minimumSize">
+            <size>
+             <width>300</width>
+             <height>100</height>
+            </size>
+           </property>
+           <property name="maximumSize">
+            <size>
+             <width>300</width>
+             <height>100</height>
+            </size>
+           </property>
+           <property name="font">
+            <font>
+             <family>宋体</family>
+             <pointsize>28</pointsize>
+             <italic>false</italic>
+             <bold>false</bold>
+            </font>
+           </property>
+           <property name="styleSheet">
+            <string notr="true">background-color: rgb(225, 215, 183);
+font: 28pt &quot;宋体&quot;;</string>
+           </property>
+           <property name="text">
+            <string>试验台架</string>
+           </property>
+           <property name="icon">
+            <iconset>
+             <normaloff>:/airplay.svg</normaloff>:/airplay.svg</iconset>
+           </property>
+           <property name="iconSize">
+            <size>
+             <width>30</width>
+             <height>30</height>
+            </size>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <spacer name="verticalSpacer_3">
+           <property name="orientation">
+            <enum>Qt::Vertical</enum>
+           </property>
+           <property name="sizeHint" stdset="0">
+            <size>
+             <width>18</width>
+             <height>14</height>
+            </size>
+           </property>
+          </spacer>
+         </item>
+        </layout>
+       </widget>
+      </item>
+      <item>
+       <spacer name="horizontalSpacer_2">
+        <property name="orientation">
+         <enum>Qt::Horizontal</enum>
+        </property>
+        <property name="sizeHint" stdset="0">
+         <size>
+          <width>197</width>
+          <height>20</height>
+         </size>
+        </property>
+       </spacer>
+      </item>
+     </layout>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>

+ 76 - 0
src/message/message_dialog.cpp

@@ -0,0 +1,76 @@
+/**
+ * 弹框提示
+ */
+
+#include "message_dialog.h"
+#include "ui_message_dialog.h"
+
+
+MessageDialog::MessageDialog(
+    QString message,
+    QString detail,
+    MessageLevel level,
+    bool ok_button,
+    bool cancel_button,
+    QWidget* parent) :
+    QDialog(parent),
+    ui_(new Ui::messageDialog)
+{
+    ui_->setupUi(this);
+    setWindowFlags(Qt::WindowCloseButtonHint);
+
+    ui_->message_label->setText(message);
+    ui_->detail_label->setText(detail);
+
+    if(level == MESSAGE_LEVEL_INFO) {
+        ui_->icon_label->setPixmap(QPixmap(
+            ":/message/images/message/information_2x.png"));
+        setWindowTitle("提示");
+    }
+    else if(level == MESSAGE_LEVEL_SUCCEESS) {
+        ui_->icon_label->setPixmap(QPixmap(
+            ":/message/images/message/success_2x.png"));
+        setWindowTitle("提示");
+    }
+    else if(level == MESSAGE_LEVEL_WARNING) {
+        ui_->icon_label->setPixmap(QPixmap(
+            ":/message/images/message/warning_2x.png"));
+        setWindowTitle("警告");
+    }
+    else if(level == MESSAGE_LEVEL_ERROR) {
+        ui_->icon_label->setPixmap(QPixmap(
+            ":/message/images/message/error_2x.png"));
+        setWindowTitle("错误");
+    }
+
+    if(!ok_button) {
+        ui_->ok_button->setVisible(false);
+    }
+    if(!cancel_button) {
+        ui_->cancel_button->setVisible(false);
+        if(ok_button) {
+            ui_->ok_button->setGeometry(
+                ui_->cancel_button->geometry());
+        }
+    }
+
+    connect(ui_->ok_button, SIGNAL(clicked()),
+        this, SLOT(__okButtonClicked()));
+    connect(ui_->cancel_button, SIGNAL(clicked()),
+        this, SLOT(__cancelButtonClicked()));
+}
+
+MessageDialog::~MessageDialog()
+{
+    delete ui_;
+}
+
+void MessageDialog::__cancelButtonClicked()
+{
+    reject();
+}
+
+void MessageDialog::__okButtonClicked()
+{
+    accept();
+}

+ 46 - 0
src/message/message_dialog.h

@@ -0,0 +1,46 @@
+/**
+ * 弹框提示
+ *
+ * © 2023 成都河狸智能科技有限责任公司。保留所有权利。
+ *
+ * 作者: zhq1229
+ */
+
+#ifndef __MESSAGE_DIALOG_H__
+#define __MESSAGE_DIALOG_H__
+
+#include <QDialog>
+enum MessageLevel {
+    MESSAGE_LEVEL_INFO,
+    MESSAGE_LEVEL_SUCCEESS,
+    MESSAGE_LEVEL_WARNING,
+    MESSAGE_LEVEL_ERROR,
+};
+
+namespace Ui {
+class messageDialog;
+}
+
+class MessageDialog : public QDialog
+{
+    Q_OBJECT
+
+public:
+    explicit MessageDialog(
+        QString message,
+        QString detail = "",
+        MessageLevel level = MESSAGE_LEVEL_INFO,
+        bool ok_button = true,
+        bool cancel_button = true,
+        QWidget* parent = nullptr);
+    ~MessageDialog();
+
+private slots:
+    void __cancelButtonClicked();
+    void __okButtonClicked();
+
+private:
+    Ui::messageDialog* ui_;
+};
+
+#endif // __MESSAGE_DIALOG_H__

+ 196 - 0
src/message/message_dialog.ui

@@ -0,0 +1,196 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>messageDialog</class>
+ <widget class="QDialog" name="messageDialog">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>424</width>
+    <height>192</height>
+   </rect>
+  </property>
+  <property name="minimumSize">
+   <size>
+    <width>424</width>
+    <height>192</height>
+   </size>
+  </property>
+  <property name="maximumSize">
+   <size>
+    <width>424</width>
+    <height>192</height>
+   </size>
+  </property>
+  <property name="windowTitle">
+   <string>提示</string>
+  </property>
+  <property name="windowIcon">
+   <iconset>
+    <normaloff>:/logo/images/logo/logo.png</normaloff>:/logo/images/logo/logo.png</iconset>
+  </property>
+  <property name="styleSheet">
+   <string notr="true">* {
+	font-family:&quot;宋体&quot;;
+}</string>
+  </property>
+  <widget class="QWidget" name="message_widget" native="true">
+   <property name="geometry">
+    <rect>
+     <x>0</x>
+     <y>0</y>
+     <width>424</width>
+     <height>192</height>
+    </rect>
+   </property>
+   <property name="styleSheet">
+    <string notr="true">QWidget {
+	background-color:rgba(255,255,255,1);
+	border-radius:2px;
+	border-top:1px solid rgba(0,0,0,0.05);
+}</string>
+   </property>
+   <widget class="QLabel" name="icon_label">
+    <property name="geometry">
+     <rect>
+      <x>34</x>
+      <y>31</y>
+      <width>24</width>
+      <height>24</height>
+     </rect>
+    </property>
+    <property name="styleSheet">
+     <string notr="true">QLabel {
+	background-color:transparent;
+	border:none;
+}</string>
+    </property>
+    <property name="text">
+     <string/>
+    </property>
+    <property name="pixmap">
+     <pixmap>:/message/images/message/information_2x.png</pixmap>
+    </property>
+    <property name="scaledContents">
+     <bool>true</bool>
+    </property>
+   </widget>
+   <widget class="QPushButton" name="cancel_button">
+    <property name="geometry">
+     <rect>
+      <x>327</x>
+      <y>136</y>
+      <width>65</width>
+      <height>32</height>
+     </rect>
+    </property>
+    <property name="sizePolicy">
+     <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+      <horstretch>0</horstretch>
+      <verstretch>0</verstretch>
+     </sizepolicy>
+    </property>
+    <property name="styleSheet">
+     <string notr="true">QPushButton {
+	font-size:14px;
+	color:rgba(0,0,0,0.5); 
+    background-color:transparent;
+	border:1px solid rgba(0,0,0,0.2);
+    border-radius:2px;
+}</string>
+    </property>
+    <property name="text">
+     <string>取消</string>
+    </property>
+   </widget>
+   <widget class="QLabel" name="message_label">
+    <property name="geometry">
+     <rect>
+      <x>72</x>
+      <y>32</y>
+      <width>301</width>
+      <height>21</height>
+     </rect>
+    </property>
+    <property name="mouseTracking">
+     <bool>true</bool>
+    </property>
+    <property name="styleSheet">
+     <string notr="true">QLabel {
+	font-size:16px;
+	color:rgba(0,0,0,0.85); 
+    background-color:transparent;
+	border:none;
+}</string>
+    </property>
+    <property name="text">
+     <string>null</string>
+    </property>
+   </widget>
+   <widget class="QPushButton" name="ok_button">
+    <property name="geometry">
+     <rect>
+      <x>254</x>
+      <y>136</y>
+      <width>65</width>
+      <height>32</height>
+     </rect>
+    </property>
+    <property name="sizePolicy">
+     <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+      <horstretch>0</horstretch>
+      <verstretch>0</verstretch>
+     </sizepolicy>
+    </property>
+    <property name="styleSheet">
+     <string notr="true">QPushButton {
+	font-size:14px;
+	color:rgba(255,255,255,0.8); 
+    background-color:rgb(86, 104, 156);
+	border:none;
+    border-radius:2px;
+}</string>
+    </property>
+    <property name="text">
+     <string>确定</string>
+    </property>
+   </widget>
+   <widget class="QLabel" name="detail_label">
+    <property name="geometry">
+     <rect>
+      <x>72</x>
+      <y>68</y>
+      <width>301</width>
+      <height>51</height>
+     </rect>
+    </property>
+    <property name="mouseTracking">
+     <bool>true</bool>
+    </property>
+    <property name="styleSheet">
+     <string notr="true">QLabel {
+	font-size:14px;
+	color:rgba(0,0,0,0.65); 
+    background-color:transparent;
+	border:none;
+}</string>
+    </property>
+    <property name="text">
+     <string>null</string>
+    </property>
+    <property name="alignment">
+     <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
+    </property>
+    <property name="wordWrap">
+     <bool>true</bool>
+    </property>
+   </widget>
+  </widget>
+ </widget>
+ <tabstops>
+  <tabstop>ok_button</tabstop>
+  <tabstop>cancel_button</tabstop>
+ </tabstops>
+ <resources/>
+ <connections/>
+</ui>

+ 380 - 0
src/model_select/model_select.cpp

@@ -0,0 +1,380 @@
+#include "model_select.h"
+#include "ui_model_select.h"
+#include <QProcess>
+#include <QFile>
+#include <QTextStream>
+
+model_select::model_select(QWidget *parent) : QMainWindow(parent),
+    ui(new Ui::model_select)
+{
+    ui->setupUi(this);
+    send_time = 2;
+    initsetting(); // 初始化设置
+}
+
+model_select::~model_select()
+{
+    delete ui;
+}
+
+void model_select::initsetting()
+{
+    this->setWindowTitle("开始设置");
+    ui->port->setText("8899");
+    ui->sim_time_wt->setText("100");
+    ui->sim_time_qh->setText("100");
+    connectNum = 0;
+    // 初始化下拉菜单内容
+    cbo_select_Init();
+    // 连接信号槽
+    // 创建监听的服务器对象
+    ms = new QTcpServer(this);
+    connect(ms, &QTcpServer::newConnection, this, [=]()
+    {
+        QTcpSocket *clientSocket = ms->nextPendingConnection();
+        mstatus->setPixmap(QPixmap(":/accessibility.svg").scaled(20, 20));
+
+        // 将客户端连接添加到连接管理中
+        connectedClients[clientSocket] = "";
+
+        // 增加处理连接的信号和槽
+        connectClient(clientSocket);
+        receive_Client(clientSocket); });
+
+    // 状态栏处理动作
+    mstatus = new QLabel;
+    ui->statusbar->addWidget(new QLabel("是否有用户连接:"));
+    ui->statusbar->addWidget(mstatus);
+}
+
+void model_select::connectClient(QTcpSocket *clientSocket)
+{
+    connectNum++;
+    qDebug() << "有用户连接:" << connectNum;
+    connect(clientSocket, &QTcpSocket::disconnected, this, [=]()
+    {
+        clientSocket->close();
+        connectedClients.remove(clientSocket);
+        connectNum = 0;
+
+        // 更新状态栏
+        if (connectNum == 0) {
+            mstatus->setPixmap(QPixmap(":/chat-bubble-xmark.svg").scaled(20, 20));
+
+        } });
+
+
+}
+
+void model_select::openSimulinkModel(const QString &modelName)
+{
+    static QProcess *process = nullptr; // 静态变量,保持 MATLAB 进程
+
+    if (!process) // 如果尚未启动 MATLAB 进程
+    {
+        process = new QProcess();
+        QString program = "D:/app/matlab_2021b/bin/matlab.exe";
+        QString model_path = "D:/desktop/NGS/model_git/model_zl/tcp";
+        model_path.replace("/", "\\\\");
+        
+        QStringList arguments;
+        arguments << "-r" << QString("cd('%1'); run('%2');").arg(model_path, modelName)
+                  << "-nosplash"
+                  << "-nodesktop";
+
+        // connect(process, &QProcess::finished, [=]()
+        // {
+        //     qDebug() << "MATLAB finished with exit code " << process->exitCode();
+        //     process->deleteLater();
+        //     process = nullptr; // 结束后将指针置为空以便下次重新启动
+        // });
+
+        process->start(program, arguments);
+
+        if (!process->waitForStarted())
+        {
+            qDebug() << "Failed to start MATLAB!";
+            delete process; // 启动失败,释放资源
+            process = nullptr; // 将指针置为空
+        }
+        else
+        {
+            qDebug() << "MATLAB started successfully.";
+        }
+    }
+    else // 如果正在运行 MATLAB 进程
+    {
+        QString model_path = "D:/desktop/NGS/model_git/model_zl/tcp";
+        QString command = QString("cd('%1'); run('%2');").arg(model_path, modelName);
+
+        // 通过标准输入将命令发送到 MATLAB
+        process->write(command.toUtf8() + "\n");
+        process->waitForBytesWritten();
+        qDebug() << "Sent command to running MATLAB: " << command;
+    }
+}
+
+
+// 编写cbo_select的槽函数,下拉菜单的内容
+void model_select::cbo_select_Init()
+{
+    // 代码解释:初始化model_select的下拉菜单内容,并设置当前选择项为"选择仿真模型"
+    ui->cbo_model_select->addItem("选择仿真模型");
+    ui->cbo_model_select->addItem("稳态模型");
+    ui->cbo_model_select->addItem("切换模型");
+
+    ui->cbo_model_select->setCurrentIndex(0);
+    connect(ui->cbo_model_select, &QComboBox::currentIndexChanged, this, &model_select::cbo_select_changed);
+
+    // 代码解释:初始化下拉菜单内容,并设置当前选择项为"选择仿真模型"
+    ui->cbo_wt->addItem("选择稳态工况");
+    ui->cbo_wt->addItem("27节");
+    ui->cbo_wt->addItem("18节");
+    ui->cbo_wt->addItem("12节");
+    ui->cbo_wt->addItem("2.5节");
+    ui->cbo_wt->addItem("9节");
+    ui->cbo_wt->addItem("6节");
+    ui->cbo_wt->addItem("6节静音");
+    ui->cbo_wt->setCurrentIndex(0);
+    connect(ui->cbo_wt, &QComboBox::currentIndexChanged, this, &model_select::cbo_wt_changed);
+    // 代码解释:初始化工况下拉菜单内容,并设置当前选择项为"稳态工况"
+    ui->cbo_condition->addItem("选择工况");
+    connect(ui->cbo_condition, &QComboBox::currentIndexChanged, this, &model_select::cbo_condition_changed);
+
+    ui->cbo_qh->addItem("选择切换工况");
+    ui->cbo_qh->addItem("切换1");
+    ui->cbo_qh->addItem("切换2");
+    ui->cbo_qh->addItem("切换3");
+    ui->cbo_qh->addItem("切换4");
+    ui->cbo_qh->addItem("切换5");
+    ui->cbo_qh->addItem("切换6");
+    ui->cbo_qh->setCurrentIndex(0);
+    //connect(ui->cbo_qh, &QComboBox::currentIndexChanged, this, &model_select::cbo_qh_changed);
+
+    ui->cbo_lg->addItem("先开后关");
+    ui->cbo_lg->addItem("预定顺序");
+    ui->cbo_lg->setCurrentIndex(0);
+    //connect(ui->cbo_lg, &QComboBox::currentIndexChanged, this, &model_select::cbo_lg_changed);
+
+    ui->cbo_target->addItem("迅速");
+    ui->cbo_target->addItem("平稳");
+    ui->cbo_target->addItem("缓慢");
+    ui->cbo_target->setCurrentIndex(0);
+    //connect(ui->cbo_target, &QComboBox::currentIndexChanged, this, &model_select::cbo_target_changed);
+
+    ui->line_gsf->setText("100");
+    ui->line_gsp->setText("100");
+    ui->line_nsp->setText("100");
+    ui->line_nshf->setText("100");
+
+    ui->cbo_pid->addItem("专家系统");
+    ui->cbo_pid->addItem("PI");
+    ui->cbo_pid->addItem("PID");
+    ui->cbo_pid->setCurrentIndex(0);
+    ui->cbo_pid_wt->addItem("专家系统");
+    ui->cbo_pid_wt->addItem("PI");
+    ui->cbo_pid_wt->addItem("PID");
+    ui->cbo_pid_wt->setCurrentIndex(0);
+    //connect(ui->cbo_pid, &QComboBox::currentIndexChanged, this, &model_select::cbo_pid_changed);
+}
+
+// slot函数,下拉菜单内容改变时触发
+
+void model_select::cbo_select_changed(int index)
+{
+    QString modelAddress = "wt"; // 模型的地址大泵模型地址
+    QString pro_dress = "model_address:";
+    if (index == 1)
+    {
+        // 往txt中写入大泵稳态模型的地址
+        modelAddress="wt";
+
+    }
+    else if (index == 2)
+    {
+        // 往txt中写入小泵稳态模型的地址
+        modelAddress = "qh";
+    }
+    file_write(&pro_dress, &modelAddress);
+    
+    // ui->cbo_model_select->setDisabled(true);
+    file_write(&pro_dress, &modelAddress);
+}
+
+void model_select::cbo_wt_changed(int index)
+{
+    QString wt_str = "condition_wt:";
+    QString wt_num = "27";
+    if (index == 1)
+    {
+        wt_num = "27";
+    }
+    else if (index == 2)
+    {
+        wt_num = "18";
+    }
+    else if (index == 3)
+    {
+        wt_num = "12";
+    }
+    else if (index == 4)
+    {
+        wt_num = "2.5";
+    }
+    else if (index == 5)
+    {
+        wt_num = "9";
+    }
+    else if (index == 6)
+    {
+        wt_num = "6";
+    }
+    else if (index == 7)
+    {
+        wt_num = "61";
+    }
+    file_write(&wt_str, &wt_num);
+
+}
+
+// slot函数,工况下拉菜单内容改变时触发
+void model_select::cbo_condition_changed(int index)
+{
+    // 根据下拉菜单的选中项切换显示界面
+    switch (index)
+    {
+    case 0:
+        ui->condition->setCurrentIndex(0); // 显示第一个页面
+        break;
+    case 1:
+        ui->condition->setCurrentIndex(1); // 显示第二个页面
+        break;
+    case 2:
+        ui->condition->setCurrentIndex(2); // 显示第三个页面
+        break;
+
+    default:
+        break;
+    }
+
+}
+// 读取txt文件
+void model_select::file_read()
+{
+    QFile file("D:/desktop/NGS/model_git/model_zl/tcp/model_address.txt"); // 要读取的文件名
+
+    // 以只读模式打开文件
+    if (file.open(QIODevice::ReadOnly | QIODevice::Text))
+    {
+        QTextStream in(&file);
+        QString line = in.readLine(); // 读取一行
+        while (!line.isNull())
+        {
+            // 处理每行数据
+            qDebug() << "Line: " << line;
+            line = in.readLine(); // 读取下一行
+        }
+        file.close(); // 关闭文件
+    }
+    else
+    {
+        // 处理文件打开失败的情况
+        qDebug() << "Unable to open file for reading.";
+    }
+}
+// 写入txt文件
+void model_select::file_write(QString *prs_name, QString *msg)
+{
+    QString modelAddress = *prs_name + *msg;                               // 将指针解引用并连接字符串
+    QFile file("D:/desktop/NGS/model_git/model_zl/tcp/model_address.txt"); // 要写入的文件名
+
+    // 以附加模式打开文件
+    if (file.open(QIODevice::Append | QIODevice::Text))
+    {
+        QTextStream out(&file);
+        out << modelAddress << '\n'; // 写入地址并换行
+        file.close();                // 关闭文件
+    }
+    else
+    {
+        // 处理文件打开失败的情况
+        qDebug() << "Unable to open file for writing.";
+    }
+}
+void model_select::on_btn_link_clicked()
+{
+    unsigned short port = ui->port->text().toUShort(); // 获取端口号
+    ms->listen(QHostAddress::Any, port);               // 监听所有地址上的指定端口
+    // ui->setListen->setDisabled(true);                  // 禁用监听按钮
+    // this->hide();
+}
+void model_select::on_btn_start_clicked()
+{
+    openSimulinkModel("tcp_test_link.m"); // 使用socket调用
+    sim_time_wt = ui->sim_time_wt->text(); // 获取仿真时间
+    QString pro_sim_time_wt="sim_time_wt:";
+    file_write(&pro_sim_time_wt, &sim_time_wt); // 写入仿真时间到配置文件
+    ui->btn_stop->setDisabled(false);  // 禁用停止按钮
+    ui->btn_pause->setDisabled(false);  // 禁用暂停按钮
+}
+void model_select::on_btn_pause_clicked()//TCP发送pause命令
+{
+    QString serverMsg =(pause_flag > 0)?"pause": "continue";//
+    if (serverMsg == "pause") {
+        ui->btn_pause->setText("继续仿真");
+    }
+    else {
+        ui->btn_pause->setText("暂停仿真");
+    }
+    for (auto clientSocket : connectedClients.keys()) {
+        if (clientSocket->state() == QAbstractSocket::ConnectedState) {
+            clientSocket->write(serverMsg.toUtf8());  // 发送消息
+        }
+    }
+    pause_flag = (pause_flag > 0) ? -1 : 1;
+}
+void model_select::on_btn_stop_clicked()
+{
+    // 发送停止命令
+    for (auto clientSocket : connectedClients.keys()) {
+        if (clientSocket->state() == QAbstractSocket::ConnectedState) {
+            clientSocket->write("stop");  // 发送消息
+            ui->btn_stop->setDisabled(true);  // 禁用停止按钮
+            ui->btn_pause->setDisabled(true);  // 禁用暂停按钮
+        }
+    }
+}
+
+void model_select::receive_Client(QTcpSocket *clientSocket)
+{
+    connect(clientSocket, &QTcpSocket::readyRead, this, [=]()
+    {
+        QByteArray data = clientSocket->readAll();
+        if (data.isEmpty())
+            return;
+
+        char dataType = data.at(0);  // 读取前缀
+        data.remove(0, 1);  // 移除前缀t
+
+        if (dataType == 't') {
+            // 处理文本数据
+            QString message = QString::fromUtf8(data);
+            qDebug() << "收到文本: " << message;
+        }
+        //处理数值数据
+        else if (dataType == 'n') {
+            // 处理数值数据
+            QDataStream in(&data, QIODevice::ReadOnly);
+            
+            in >> send_time;
+            qDebug() << "收到数值: " << send_time;
+        }
+
+        //发送信号到界面
+        emit receive_msg(data);
+        data.clear();  // 清空 data
+    } );
+
+}
+
+

+ 61 - 0
src/model_select/model_select.h

@@ -0,0 +1,61 @@
+#ifndef MODEL_SELECT_H
+#define MODEL_SELECT_H
+
+#include <QMainWindow>
+#include <QTcpServer>
+#include <QTcpSocket>
+#include <QLabel>
+#include <QFile>
+
+
+
+namespace Ui {
+class model_select;
+}
+static int send_time=2; // 全局变量,记录发送时间
+class model_select : public QMainWindow
+{
+    Q_OBJECT
+
+public:
+    explicit model_select(QWidget *parent = nullptr);
+    ~model_select();
+
+
+signals:
+    void receive_msg(const QString &data);  // 声明信号
+private slots:
+    void connectClient(QTcpSocket *clientSocket);
+    void receive_Client(QTcpSocket *clientSocket);
+    void on_btn_start_clicked();
+    void initsetting();
+
+
+    void openSimulinkModel(const QString &modelName);
+    void on_btn_pause_clicked();
+
+    void on_btn_stop_clicked();
+
+    void on_btn_link_clicked();
+
+private:
+    Ui::model_select *ui;
+
+    QTcpServer* ms;
+    QTcpSocket* mtcp;
+    QLabel* mstatus;
+    QMap<QTcpSocket*, QString> connectedClients;
+    int connectNum;
+    int pause_flag=1;
+    QString sim_time_wt;
+    void cbo_select_Init();
+    void cbo_select_changed(int index);
+    void cbo_wt_changed(int index);
+    void file_write(QString *prs_name, QString *msg);
+    void file_read();
+    void cbo_condition_changed(int index);
+    
+
+};
+
+#endif // MODEL_SELECT_H

File diff suppressed because it is too large
+ 1235 - 0
src/model_select/model_select.ui


+ 91 - 0
src/page_main/page_main.cpp

@@ -0,0 +1,91 @@
+#include "page_main.h"
+#include "ui_page_main.h"
+#include <QDebug>
+page_main::page_main(QWidget *parent) : BaseWindow(parent),
+                                        ui(new Ui::page_main)
+{
+    ui->setupUi(this);
+    fun_stacked_page_init();
+}
+
+page_main::~page_main()
+{
+    delete ui;
+}
+
+void page_main::on_logout_button_clicked()
+{
+    MessageDialog md(
+        "确认退出", "退出系统后回到页面选择", MESSAGE_LEVEL_WARNING);
+    int ret = md.exec();
+
+    if (ret)
+    {
+        this->hide();
+    }
+}
+// void page_main::closeEvent(QCloseEvent* e)
+// {
+//     (void)e;
+//     MessageDialog md(
+//         "确认关闭", "确认关闭系统?", MESSAGE_LEVEL_WARNING);
+//     int ret = md.exec();
+
+//     if(ret) {
+
+//         e->accept();
+//     }
+//     else {
+//         e->ignore();
+//     }
+// }
+void page_main::btn_select_(int index)
+{
+    ui->btn_model_select->setChecked(false);
+    ui->btn_chart_file->setChecked(false);
+    ui->btn_database->setChecked(false);
+    switch (index)
+    {
+    case 1:
+        ui->btn_model_select->setChecked(true);
+        break;
+    case 2:
+        ui->btn_chart_file->setChecked(true);
+        break;
+    case 3:
+        ui->btn_database->setChecked(true);
+        break;
+    default:
+        break;
+    }
+}
+
+void page_main::fun_stacked_page_init()
+{   
+    qDebug() << "fun_stacked_page_init";
+    page_model_select_ = new model_select();
+    page_chart_file_= new chart_file();
+    
+    ui->fun_stacked_widget->addWidget(page_model_select_);
+    ui->fun_stacked_widget->addWidget(page_chart_file_);
+}
+void page_main::on_btn_model_select_clicked()
+{
+    select_form_ = 1;
+    qDebug() << "on_btn_model_select_clicked";
+    qDebug() << "select_form_:" << select_form_;
+    btn_select_(select_form_);
+    ui->fun_stacked_widget->setCurrentIndex(select_form_-1);
+}
+void page_main::on_btn_chart_file_clicked()
+{
+    select_form_ = 2;
+    if (page_chart_flag_==0)
+    {page_chart_file_->setPointsNum(1);page_chart_flag_=1;}
+
+    qDebug() << "on_btn_chart_file_clicked";
+    qDebug() << "select_form_:" << select_form_;
+    
+    btn_select_(select_form_);
+    ui->fun_stacked_widget->setCurrentIndex(select_form_-1);
+}

+ 45 - 0
src/page_main/page_main.h

@@ -0,0 +1,45 @@
+#ifndef PAGE_MAIN_H
+#define PAGE_MAIN_H
+
+#include <QMainWindow>
+#include <QCloseEvent>
+
+#include "src/message/message_dialog.h"
+#include "src/model_select/model_select.h"
+#include "src/base/base.h"
+#include "src/chart/chart_file.h"
+
+namespace Ui {
+class page_main;
+}
+
+class page_main : public BaseWindow
+{
+    Q_OBJECT
+
+public:
+    explicit page_main(QWidget *parent = nullptr);
+    ~page_main();
+// protected:
+
+//     virtual void closeEvent(QCloseEvent* e) override;
+
+private slots:
+    void on_btn_model_select_clicked();
+    void on_btn_chart_file_clicked();
+
+    void on_logout_button_clicked();
+
+private:
+
+    Ui::page_main *ui;
+    model_select *page_model_select_=nullptr;
+    chart_file *page_chart_file_=nullptr;
+    void fun_stacked_page_init();
+    void btn_select_(int index);
+    int select_form_;
+    int page_chart_flag_=0;
+
+};
+
+#endif // PAGE_MAIN_H

+ 380 - 0
src/page_main/page_main.ui

@@ -0,0 +1,380 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>page_main</class>
+ <widget class="QMainWindow" name="page_main">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>1066</width>
+    <height>749</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>MainWindow</string>
+  </property>
+  <property name="styleSheet">
+   <string notr="true">font:  &quot;宋体&quot;;</string>
+  </property>
+  <widget class="QWidget" name="centralwidget">
+   <layout class="QGridLayout" name="gridLayout">
+    <property name="leftMargin">
+     <number>0</number>
+    </property>
+    <property name="topMargin">
+     <number>0</number>
+    </property>
+    <property name="rightMargin">
+     <number>0</number>
+    </property>
+    <property name="bottomMargin">
+     <number>0</number>
+    </property>
+    <property name="spacing">
+     <number>0</number>
+    </property>
+    <item row="0" column="0">
+     <widget class="QWidget" name="menu_widget" native="true">
+      <property name="sizePolicy">
+       <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+        <horstretch>0</horstretch>
+        <verstretch>0</verstretch>
+       </sizepolicy>
+      </property>
+      <property name="minimumSize">
+       <size>
+        <width>400</width>
+        <height>40</height>
+       </size>
+      </property>
+      <property name="maximumSize">
+       <size>
+        <width>16777215</width>
+        <height>40</height>
+       </size>
+      </property>
+      <property name="styleSheet">
+       <string notr="true">QWidget#menu_widget {
+    background-color:rgb(86, 104, 156)
+}</string>
+      </property>
+      <layout class="QHBoxLayout" name="horizontalLayout_2">
+       <property name="spacing">
+        <number>0</number>
+       </property>
+       <property name="leftMargin">
+        <number>0</number>
+       </property>
+       <property name="topMargin">
+        <number>0</number>
+       </property>
+       <property name="rightMargin">
+        <number>0</number>
+       </property>
+       <property name="bottomMargin">
+        <number>0</number>
+       </property>
+       <item>
+        <spacer name="horizontalSpacer_7">
+         <property name="orientation">
+          <enum>Qt::Horizontal</enum>
+         </property>
+         <property name="sizeType">
+          <enum>QSizePolicy::Fixed</enum>
+         </property>
+         <property name="sizeHint" stdset="0">
+          <size>
+           <width>23</width>
+           <height>20</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+       <item>
+        <widget class="QLabel" name="label">
+         <property name="styleSheet">
+          <string notr="true">QLabel {
+	font:bold 28px;
+	color:rgb(225, 215, 183);
+}</string>
+         </property>
+         <property name="text">
+          <string>NGS仿真</string>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <spacer name="horizontalSpacer">
+         <property name="orientation">
+          <enum>Qt::Horizontal</enum>
+         </property>
+         <property name="sizeHint" stdset="0">
+          <size>
+           <width>40</width>
+           <height>20</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+       <item>
+        <widget class="QPushButton" name="logout_button">
+         <property name="minimumSize">
+          <size>
+           <width>58</width>
+           <height>30</height>
+          </size>
+         </property>
+         <property name="maximumSize">
+          <size>
+           <width>58</width>
+           <height>30</height>
+          </size>
+         </property>
+         <property name="cursor">
+          <cursorShape>PointingHandCursor</cursorShape>
+         </property>
+         <property name="focusPolicy">
+          <enum>Qt::NoFocus</enum>
+         </property>
+         <property name="styleSheet">
+          <string notr="true">QPushButton {
+	border:1px solid rgb(170, 0, 0);
+	background-color:transparent;
+	font-size:18px;
+    color:rgb(170, 0, 0);
+	border-radius:4px;
+}
+
+QPushButton:hover {
+	background-color:rgba(254,134,55,1);
+    color:rgba(255,255,255,1);
+}
+</string>
+         </property>
+         <property name="text">
+          <string>退出</string>
+         </property>
+         <property name="flat">
+          <bool>true</bool>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <spacer name="horizontalSpacer_6">
+         <property name="orientation">
+          <enum>Qt::Horizontal</enum>
+         </property>
+         <property name="sizeType">
+          <enum>QSizePolicy::Fixed</enum>
+         </property>
+         <property name="sizeHint" stdset="0">
+          <size>
+           <width>11</width>
+           <height>20</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+      </layout>
+     </widget>
+    </item>
+    <item row="1" column="0">
+     <layout class="QHBoxLayout" name="horizontalLayout">
+      <property name="spacing">
+       <number>0</number>
+      </property>
+      <item>
+       <widget class="QWidget" name="main_fun_widget" native="true">
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <property name="minimumSize">
+         <size>
+          <width>105</width>
+          <height>400</height>
+         </size>
+        </property>
+        <property name="font">
+         <font>
+          <family>Microsoft Sans Serif</family>
+          <italic>false</italic>
+          <bold>false</bold>
+         </font>
+        </property>
+        <property name="styleSheet">
+         <string notr="true">QWidget#main_fun_widget {
+	border-right:6px solid qlineargradient(x0: 0, x1: 1, stop: 0 rgba(0, 0, 0, 0), stop: 1 rgba(0, 0, 0, 0.18));
+	background-color:rgba(246,246,246,1);
+}
+
+QPushButton {
+	
+	font: 12pt &quot;宋体&quot;;
+	font-size:16px;
+	color:rgba(51,51,51,1);
+	background-color:transparent;
+	text-align:left;
+	border-top:none;
+	border-left:none;
+	border-right:none;
+	border-bottom:2px solid transparent;
+	padding:0px 0px 0px 20px;
+	margin:0px 0px;
+}
+
+QPushButton:checked {
+	
+	background-color:rgb(125, 147, 195);
+}
+
+QPushButton:hover {
+	border-bottom:2px solid rgb(225, 215, 183);
+}</string>
+        </property>
+        <widget class="QPushButton" name="btn_model_select">
+         <property name="geometry">
+          <rect>
+           <x>0</x>
+           <y>0</y>
+           <width>100</width>
+           <height>44</height>
+          </rect>
+         </property>
+         <property name="cursor">
+          <cursorShape>PointingHandCursor</cursorShape>
+         </property>
+         <property name="focusPolicy">
+          <enum>Qt::NoFocus</enum>
+         </property>
+         <property name="text">
+          <string>模型设置</string>
+         </property>
+         <property name="icon">
+          <iconset>
+           <normaloff>:/mainwindow/images/mainwindow/home.png</normaloff>:/mainwindow/images/mainwindow/home.png</iconset>
+         </property>
+         <property name="iconSize">
+          <size>
+           <width>20</width>
+           <height>20</height>
+          </size>
+         </property>
+         <property name="checkable">
+          <bool>true</bool>
+         </property>
+        </widget>
+        <widget class="QPushButton" name="btn_chart_file">
+         <property name="geometry">
+          <rect>
+           <x>0</x>
+           <y>40</y>
+           <width>100</width>
+           <height>44</height>
+          </rect>
+         </property>
+         <property name="cursor">
+          <cursorShape>PointingHandCursor</cursorShape>
+         </property>
+         <property name="focusPolicy">
+          <enum>Qt::NoFocus</enum>
+         </property>
+         <property name="text">
+          <string>曲线显示</string>
+         </property>
+         <property name="icon">
+          <iconset>
+           <normaloff>:/mainwindow/images/mainwindow/home.png</normaloff>:/mainwindow/images/mainwindow/home.png</iconset>
+         </property>
+         <property name="iconSize">
+          <size>
+           <width>20</width>
+           <height>20</height>
+          </size>
+         </property>
+         <property name="checkable">
+          <bool>true</bool>
+         </property>
+        </widget>
+        <widget class="QPushButton" name="btn_database">
+         <property name="geometry">
+          <rect>
+           <x>0</x>
+           <y>80</y>
+           <width>100</width>
+           <height>44</height>
+          </rect>
+         </property>
+         <property name="cursor">
+          <cursorShape>PointingHandCursor</cursorShape>
+         </property>
+         <property name="focusPolicy">
+          <enum>Qt::NoFocus</enum>
+         </property>
+         <property name="text">
+          <string>历史数据</string>
+         </property>
+         <property name="icon">
+          <iconset>
+           <normaloff>:/mainwindow/images/mainwindow/home.png</normaloff>:/mainwindow/images/mainwindow/home.png</iconset>
+         </property>
+         <property name="iconSize">
+          <size>
+           <width>20</width>
+           <height>20</height>
+          </size>
+         </property>
+         <property name="checkable">
+          <bool>true</bool>
+         </property>
+        </widget>
+       </widget>
+      </item>
+      <item>
+       <widget class="QStackedWidget" name="fun_stacked_widget">
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <property name="minimumSize">
+         <size>
+          <width>848</width>
+          <height>424</height>
+         </size>
+        </property>
+        <property name="styleSheet">
+         <string notr="true">QStackedWidget#fun_stacked_widget {
+	background-color:rgba(242,242,242,1);
+}</string>
+        </property>
+        <property name="lineWidth">
+         <number>1</number>
+        </property>
+        <property name="currentIndex">
+         <number>-1</number>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </item>
+   </layout>
+  </widget>
+  <widget class="QMenuBar" name="menubar">
+   <property name="geometry">
+    <rect>
+     <x>0</x>
+     <y>0</y>
+     <width>1066</width>
+     <height>25</height>
+    </rect>
+   </property>
+  </widget>
+  <widget class="QStatusBar" name="statusbar"/>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>

+ 83 - 0
src/pid_control/pid_control.cpp

@@ -0,0 +1,83 @@
+#include "pid_control.h"
+#include <iostream>
+//位置式PID
+pid_control::pid_control() {
+
+}
+pid_control::PID_position::PID_position():kp(0),ki(0),kd(0),target(0),actual(0),integral(0)
+{
+    e=target-actual;
+    e_pre=e;
+}
+pid_control::PID_position::PID_position(float p,float i,float d):kp(p),ki(i),kd(d),target(0),actual(0),integral(0)
+{
+    e=target-actual;
+    e_pre=e;
+}
+float pid_control::PID_position::pid_control(float tar,float act)
+{
+    float u;
+    target=tar;
+    actual=act;
+    e=target-actual;
+    integral+=e;
+    u=kp*e+ki*integral+kd*(e-e_pre);
+    e_pre=e;
+    return u;
+}
+void pid_control::PID_position::pid_show()
+{
+    using std::cout;
+    using std::endl;
+    cout<<"The infomation of this position PID controller is as following:"<<endl;
+    cout<<"       Kp="<<kp<<endl;
+    cout<<"       Ki="<<ki<<endl;
+    cout<<"       Kd="<<kd<<endl;
+    cout<<" integral="<<integral<<endl;
+    cout<<"   target="<<target<<endl;
+    cout<<"   actual="<<actual<<endl;
+    cout<<"        e="<<e<<endl;
+    cout<<"    e_pre="<<e_pre<<endl;
+}
+//增量PID
+pid_control::PID_incremental::PID_incremental():kp(0),ki(0),kd(0),e_pre_1(0),e_pre_2(0),target(0),actual(0)
+{
+    A=kp+ki+kd;
+    B=-2*kd-kp;
+    C=kd;
+    e=target-actual;
+}
+pid_control::PID_incremental::PID_incremental(float p,float i,float d):kp(p),ki(i),kd(d),e_pre_1(0),e_pre_2(0),target(0),actual(0)
+{
+    A=kp+ki+kd;
+    B=-2*kd-kp;
+    C=kd;
+    e=target-actual;
+}
+float pid_control::PID_incremental::pid_control(float tar,float act)
+{
+    float u_increment;
+    target=tar;
+    actual=act;
+    e=target-actual;
+    u_increment=A*e+B*e_pre_1+C*e_pre_2;
+    e_pre_2=e_pre_1;
+    e_pre_1=e;
+    return u_increment;
+}
+
+void pid_control::PID_incremental::pid_show()
+{
+    using std::cout;
+    using std::endl;
+    cout<<"The infomation of this incremental PID controller is as following:"<<endl;
+    cout<<"     Kp="<<kp<<endl;
+    cout<<"     Ki="<<ki<<endl;
+    cout<<"     Kd="<<kd<<endl;
+    cout<<" target="<<target<<endl;
+    cout<<" actual="<<actual<<endl;
+    cout<<"      e="<<e<<endl;
+    cout<<"e_pre_1="<<e_pre_1<<endl;
+    cout<<"e_pre_2="<<e_pre_2<<endl;
+}
+

+ 52 - 0
src/pid_control/pid_control.h

@@ -0,0 +1,52 @@
+#ifndef PID_CONTROL_H
+#define PID_CONTROL_H
+
+class pid_control
+{
+    //位置式PID
+    class PID_position
+    {
+    private:
+        float kp;//比例系数
+        float ki;//积分系数
+        float kd;//微分系数
+        float target;//目标值
+        float actual;//实际值
+        float e;//误差
+        float e_pre;//上一次误差
+        float integral;//积分项
+    public:
+        PID_position();
+        ~PID_position(){};
+        PID_position(float p,float i,float d);
+        float pid_control(float tar,float act);//执行PID控制
+        void pid_show();//显示PID控制器的内部参数
+    };
+    //增量式PID
+    class PID_incremental
+    {
+    private:
+        float kp;
+        float ki;
+        float kd;
+        float target;
+        float actual;
+        float e;
+        float e_pre_1;
+        float e_pre_2;
+        float A;
+        float B;
+        float C;
+    public:
+        PID_incremental();
+        PID_incremental(float p,float i,float d);
+        float pid_control(float tar,float act);
+        void pid_show();
+    };
+
+
+public:
+    pid_control();
+};
+
+#endif // PID_CONTROL_H

+ 47 - 0
src/profile/PCI_1724.xml

@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<DAQNavi Version="4.0.0.0" Profile="2.0.0.0">
+    <DaqDevice ModuleIndex="0">
+        <Property ID="8">
+            <Description>Product ID:</Description>
+            <Attribute>0</Attribute>
+            <Type>2</Type>
+            <EnumType>ProductId</EnumType>
+            <Tip>Product ID is used to represent a DAQ Device model and distinguish devices of different models. Each device model owns an unique Product ID.</Tip>
+            <Value>158</Value>
+        </Property>
+    </DaqDevice>
+    <DaqAo ModuleIndex="0">
+        <Property ID="52">
+            <Description>Value Range Type:</Description>
+            <Attribute>1</Attribute>
+            <Type>65538</Type>
+            <EnumType>ValueRange</EnumType>
+            <Tip>Gets or sets the ValueRange for the selected channel.</Tip>
+            <Value>34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34</Value>
+        </Property>
+        <Property ID="23">
+            <Description>Resolution:</Description>
+            <Attribute>2</Attribute>
+            <Type>2</Type>
+            <EnumType></EnumType>
+            <Tip>Data resolution refers to the number of the bit that is used to realize analog to digital(or digital to analog) conversion,the bigger bit number of ADC(or DAC) is, the higher the resolution will be</Tip>
+            <Value>14</Value>
+        </Property>
+        <Property ID="26">
+            <Description>Channel Number Max:</Description>
+            <Attribute>2</Attribute>
+            <Type>2</Type>
+            <EnumType></EnumType>
+            <Tip> Max number of physical channel.Physical channel refers to visible input/output terminals or pins that can connect wires on a data acquisition card.</Tip>
+            <Value>31</Value>
+        </Property>
+        <Property ID="31">
+            <Description>Value Range:</Description>
+            <Attribute>0</Attribute>
+            <Type>65538</Type>
+            <EnumType>ValueRange</EnumType>
+            <Tip>The device supported Value Range type.</Tip>
+            <Value>1,33,34</Value>
+        </Property>
+    </DaqAo>
+</DAQNavi>

+ 26 - 0
src/taijia/tj/test_tj.cpp

@@ -0,0 +1,26 @@
+#include "test_tj.h"
+#include "ui_test_tj.h"
+
+test_tj::test_tj(QWidget *parent)
+    : QMainWindow(parent)
+    , ui(new Ui::test_tj)
+{
+    ui->setupUi(this);
+}
+
+test_tj::~test_tj()
+{
+    delete ui;
+}
+
+void test_tj::cbo_init()
+{
+    for (int i = 0; i < 31; i++) {
+        ui->cbo_line->addItem(QString::number(i) + "端口");
+    }
+}
+
+void test_tj::
+{
+
+}

+ 24 - 0
src/taijia/tj/test_tj.h

@@ -0,0 +1,24 @@
+#ifndef TEST_TJ_H
+#define TEST_TJ_H
+
+#include <QMainWindow>
+#include "code/board/AO_StaticAO/StaticAO.h"
+
+namespace Ui {
+class test_tj;
+}
+
+class test_tj : public QMainWindow
+{
+    Q_OBJECT
+
+public:
+    explicit test_tj(QWidget *parent = nullptr);
+    ~test_tj();
+
+private:
+    Ui::test_tj *ui;
+    void  cbo_init();
+};
+
+#endif // TEST_TJ_H

+ 157 - 0
src/taijia/tj/test_tj.ui

@@ -0,0 +1,157 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>test_tj</class>
+ <widget class="QMainWindow" name="test_tj">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>610</width>
+    <height>444</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>MainWindow</string>
+  </property>
+  <widget class="QWidget" name="centralwidget">
+   <layout class="QGridLayout" name="gridLayout_4">
+    <item row="0" column="0" rowspan="5">
+     <widget class="QTreeView" name="treeView"/>
+    </item>
+    <item row="0" column="1">
+     <widget class="QGroupBox" name="groupBox">
+      <property name="title">
+       <string/>
+      </property>
+      <layout class="QGridLayout" name="gridLayout">
+       <item row="0" column="0">
+        <widget class="QLabel" name="label">
+         <property name="text">
+          <string>通道</string>
+         </property>
+        </widget>
+       </item>
+       <item row="0" column="1">
+        <widget class="QComboBox" name="cbo_line"/>
+       </item>
+       <item row="0" column="2">
+        <widget class="QLabel" name="label_2">
+         <property name="text">
+          <string>通道值</string>
+         </property>
+        </widget>
+       </item>
+       <item row="0" column="3">
+        <widget class="QLineEdit" name="lineEdit"/>
+       </item>
+      </layout>
+     </widget>
+    </item>
+    <item row="1" column="1">
+     <spacer name="verticalSpacer">
+      <property name="orientation">
+       <enum>Qt::Vertical</enum>
+      </property>
+      <property name="sizeHint" stdset="0">
+       <size>
+        <width>20</width>
+        <height>40</height>
+       </size>
+      </property>
+     </spacer>
+    </item>
+    <item row="2" column="1">
+     <widget class="QPushButton" name="btn_set">
+      <property name="text">
+       <string>板卡控制</string>
+      </property>
+     </widget>
+    </item>
+    <item row="3" column="1">
+     <widget class="QGroupBox" name="groupBox_2">
+      <property name="title">
+       <string>pid</string>
+      </property>
+      <layout class="QGridLayout" name="gridLayout_3">
+       <item row="0" column="0">
+        <widget class="QLabel" name="label_4">
+         <property name="text">
+          <string>PID类型</string>
+         </property>
+        </widget>
+       </item>
+       <item row="2" column="0">
+        <widget class="QGroupBox" name="groupBox_3">
+         <property name="title">
+          <string>参数</string>
+         </property>
+         <layout class="QGridLayout" name="gridLayout_2">
+          <item row="0" column="0">
+           <widget class="QLabel" name="label_5">
+            <property name="text">
+             <string>P</string>
+            </property>
+           </widget>
+          </item>
+          <item row="0" column="1">
+           <widget class="QLineEdit" name="lineEdit_2"/>
+          </item>
+          <item row="1" column="0" rowspan="2" colspan="2">
+           <widget class="QLabel" name="label_6">
+            <property name="text">
+             <string>I</string>
+            </property>
+           </widget>
+          </item>
+          <item row="2" column="1">
+           <widget class="QLineEdit" name="lineEdit_4"/>
+          </item>
+          <item row="3" column="0">
+           <widget class="QLabel" name="label_3">
+            <property name="text">
+             <string>D</string>
+            </property>
+           </widget>
+          </item>
+          <item row="3" column="1">
+           <widget class="QLineEdit" name="lineEdit_3"/>
+          </item>
+         </layout>
+        </widget>
+       </item>
+       <item row="1" column="0">
+        <widget class="QComboBox" name="cbo_line_2"/>
+       </item>
+      </layout>
+     </widget>
+    </item>
+    <item row="4" column="1">
+     <widget class="QPushButton" name="pushButton">
+      <property name="text">
+       <string>确认参数</string>
+      </property>
+     </widget>
+    </item>
+   </layout>
+  </widget>
+  <widget class="QMenuBar" name="menubar">
+   <property name="geometry">
+    <rect>
+     <x>0</x>
+     <y>0</y>
+     <width>610</width>
+     <height>25</height>
+    </rect>
+   </property>
+   <widget class="QMenu" name="menu">
+    <property name="title">
+     <string>板卡设置</string>
+    </property>
+   </widget>
+   <addaction name="menu"/>
+  </widget>
+  <widget class="QStatusBar" name="statusbar"/>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>