First commit
This commit is contained in:
@@ -0,0 +1,21 @@
|
|||||||
|
QMAKE_CXX.QT_COMPILER_STDCXX = 201402L
|
||||||
|
QMAKE_CXX.QMAKE_GCC_MAJOR_VERSION = 7
|
||||||
|
QMAKE_CXX.QMAKE_GCC_MINOR_VERSION = 3
|
||||||
|
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 = \
|
||||||
|
C:/Qt/Qt5.14.2/Tools/mingw730_64/lib/gcc/x86_64-w64-mingw32/7.3.0/include/c++ \
|
||||||
|
C:/Qt/Qt5.14.2/Tools/mingw730_64/lib/gcc/x86_64-w64-mingw32/7.3.0/include/c++/x86_64-w64-mingw32 \
|
||||||
|
C:/Qt/Qt5.14.2/Tools/mingw730_64/lib/gcc/x86_64-w64-mingw32/7.3.0/include/c++/backward \
|
||||||
|
C:/Qt/Qt5.14.2/Tools/mingw730_64/lib/gcc/x86_64-w64-mingw32/7.3.0/include \
|
||||||
|
C:/Qt/Qt5.14.2/Tools/mingw730_64/lib/gcc/x86_64-w64-mingw32/7.3.0/include-fixed \
|
||||||
|
C:/Qt/Qt5.14.2/Tools/mingw730_64/x86_64-w64-mingw32/include
|
||||||
|
QMAKE_CXX.LIBDIRS = \
|
||||||
|
C:/Qt/Qt5.14.2/Tools/mingw730_64/lib/gcc/x86_64-w64-mingw32/7.3.0 \
|
||||||
|
C:/Qt/Qt5.14.2/Tools/mingw730_64/lib/gcc \
|
||||||
|
C:/Qt/Qt5.14.2/Tools/mingw730_64/x86_64-w64-mingw32/lib \
|
||||||
|
C:/Qt/Qt5.14.2/Tools/mingw730_64/lib
|
||||||
@@ -0,0 +1,472 @@
|
|||||||
|
#############################################################################
|
||||||
|
# Makefile for building: OutilModbus
|
||||||
|
# Generated by qmake (3.1) (Qt 5.14.2)
|
||||||
|
# Project: OutilModbus.pro
|
||||||
|
# Template: app
|
||||||
|
# Command: C:\Qt\Qt5.14.2\5.14.2\mingw73_64\bin\qmake.exe -o Makefile OutilModbus.pro -spec win32-g++ "CONFIG+=debug" "CONFIG+=qml_debug"
|
||||||
|
#############################################################################
|
||||||
|
|
||||||
|
MAKEFILE = Makefile
|
||||||
|
|
||||||
|
EQ = =
|
||||||
|
|
||||||
|
first: debug
|
||||||
|
install: debug-install
|
||||||
|
uninstall: debug-uninstall
|
||||||
|
QMAKE = C:\Qt\Qt5.14.2\5.14.2\mingw73_64\bin\qmake.exe
|
||||||
|
DEL_FILE = del
|
||||||
|
CHK_DIR_EXISTS= if not exist
|
||||||
|
MKDIR = mkdir
|
||||||
|
COPY = copy /y
|
||||||
|
COPY_FILE = copy /y
|
||||||
|
COPY_DIR = xcopy /s /q /y /i
|
||||||
|
INSTALL_FILE = copy /y
|
||||||
|
INSTALL_PROGRAM = copy /y
|
||||||
|
INSTALL_DIR = xcopy /s /q /y /i
|
||||||
|
QINSTALL = C:\Qt\Qt5.14.2\5.14.2\mingw73_64\bin\qmake.exe -install qinstall
|
||||||
|
QINSTALL_PROGRAM = C:\Qt\Qt5.14.2\5.14.2\mingw73_64\bin\qmake.exe -install qinstall -exe
|
||||||
|
DEL_FILE = del
|
||||||
|
SYMLINK = $(QMAKE) -install ln -f -s
|
||||||
|
DEL_DIR = rmdir
|
||||||
|
MOVE = move
|
||||||
|
IDC = idc
|
||||||
|
IDL = midl
|
||||||
|
ZIP = zip -r -9
|
||||||
|
DEF_FILE =
|
||||||
|
RES_FILE =
|
||||||
|
SED = $(QMAKE) -install sed
|
||||||
|
MOVE = move
|
||||||
|
SUBTARGETS = \
|
||||||
|
debug \
|
||||||
|
release
|
||||||
|
|
||||||
|
|
||||||
|
debug: FORCE
|
||||||
|
$(MAKE) -f $(MAKEFILE).Debug
|
||||||
|
debug-make_first: FORCE
|
||||||
|
$(MAKE) -f $(MAKEFILE).Debug
|
||||||
|
debug-all: FORCE
|
||||||
|
$(MAKE) -f $(MAKEFILE).Debug all
|
||||||
|
debug-clean: FORCE
|
||||||
|
$(MAKE) -f $(MAKEFILE).Debug clean
|
||||||
|
debug-distclean: FORCE
|
||||||
|
$(MAKE) -f $(MAKEFILE).Debug distclean
|
||||||
|
debug-install: FORCE
|
||||||
|
$(MAKE) -f $(MAKEFILE).Debug install
|
||||||
|
debug-uninstall: FORCE
|
||||||
|
$(MAKE) -f $(MAKEFILE).Debug uninstall
|
||||||
|
release: FORCE
|
||||||
|
$(MAKE) -f $(MAKEFILE).Release
|
||||||
|
release-make_first: FORCE
|
||||||
|
$(MAKE) -f $(MAKEFILE).Release
|
||||||
|
release-all: FORCE
|
||||||
|
$(MAKE) -f $(MAKEFILE).Release all
|
||||||
|
release-clean: FORCE
|
||||||
|
$(MAKE) -f $(MAKEFILE).Release clean
|
||||||
|
release-distclean: FORCE
|
||||||
|
$(MAKE) -f $(MAKEFILE).Release distclean
|
||||||
|
release-install: FORCE
|
||||||
|
$(MAKE) -f $(MAKEFILE).Release install
|
||||||
|
release-uninstall: FORCE
|
||||||
|
$(MAKE) -f $(MAKEFILE).Release uninstall
|
||||||
|
|
||||||
|
Makefile: OutilModbus.pro C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/win32-g++/qmake.conf C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/spec_pre.prf \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/qdevice.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/device_config.prf \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/common/sanitize.conf \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/common/gcc-base.conf \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/common/g++-base.conf \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/common/angle.conf \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/win32/windows_vulkan_sdk.prf \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/common/windows-vulkan.conf \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/common/g++-win32.conf \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/common/windows-desktop.conf \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/qconfig.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_3danimation.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_3danimation_private.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_3dcore.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_3dcore_private.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_3dextras.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_3dextras_private.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_3dinput.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_3dinput_private.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_3dlogic.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_3dlogic_private.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_3dquick.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_3dquick_private.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_3dquickanimation.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_3dquickanimation_private.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_3dquickextras.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_3dquickextras_private.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_3dquickinput.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_3dquickinput_private.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_3dquickrender.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_3dquickrender_private.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_3dquickscene2d.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_3dquickscene2d_private.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_3drender.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_3drender_private.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_accessibility_support_private.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_axbase.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_axbase_private.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_axcontainer.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_axcontainer_private.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_axserver.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_axserver_private.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_bluetooth.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_bluetooth_private.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_bootstrap_private.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_concurrent.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_concurrent_private.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_core.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_core_private.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_dbus.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_dbus_private.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_designer.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_designer_private.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_designercomponents_private.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_devicediscovery_support_private.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_edid_support_private.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_egl_support_private.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_eventdispatcher_support_private.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_fb_support_private.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_fontdatabase_support_private.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_gamepad.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_gamepad_private.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_gui.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_gui_private.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_help.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_help_private.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_location.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_location_private.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_multimedia.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_multimedia_private.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_multimediawidgets.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_multimediawidgets_private.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_network.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_network_private.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_nfc.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_nfc_private.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_opengl.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_opengl_private.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_openglextensions.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_openglextensions_private.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_packetprotocol_private.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_platformcompositor_support_private.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_positioning.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_positioning_private.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_positioningquick.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_positioningquick_private.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_printsupport.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_printsupport_private.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_qml.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_qml_private.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_qmldebug_private.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_qmldevtools_private.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_qmlmodels.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_qmlmodels_private.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_qmltest.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_qmltest_private.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_qmlworkerscript.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_qmlworkerscript_private.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_qtmultimediaquicktools_private.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_quick.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_quick_private.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_quickcontrols2.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_quickcontrols2_private.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_quickparticles_private.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_quickshapes_private.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_quicktemplates2.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_quicktemplates2_private.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_quickwidgets.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_quickwidgets_private.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_remoteobjects.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_remoteobjects_private.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_repparser.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_repparser_private.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_scxml.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_scxml_private.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_sensors.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_sensors_private.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_serialbus.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_serialbus_private.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_serialport.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_serialport_private.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_sql.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_sql_private.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_svg.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_svg_private.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_testlib.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_testlib_private.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_texttospeech.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_texttospeech_private.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_theme_support_private.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_uiplugin.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_uitools.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_uitools_private.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_vulkan_support_private.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_webchannel.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_webchannel_private.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_websockets.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_websockets_private.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_widgets.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_widgets_private.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_windowsuiautomation_support_private.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_winextras.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_winextras_private.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_xml.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_xml_private.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_xmlpatterns.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_xmlpatterns_private.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_zlib_private.pri \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/qt_functions.prf \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/qt_config.prf \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/win32-g++/qmake.conf \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/spec_post.prf \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/exclusive_builds.prf \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/toolchain.prf \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/default_pre.prf \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/win32/default_pre.prf \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/resolve_config.prf \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/exclusive_builds_post.prf \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/default_post.prf \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/qml_debug.prf \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/precompile_header.prf \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/warn_on.prf \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/qt.prf \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/resources_functions.prf \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/resources.prf \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/moc.prf \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/win32/opengl.prf \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/uic.prf \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/qmake_use.prf \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/file_copies.prf \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/win32/windows.prf \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/testcase_targets.prf \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/exceptions.prf \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/yacc.prf \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/lex.prf \
|
||||||
|
OutilModbus.pro \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/lib/Qt5Widgets.prl \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/lib/Qt5Gui.prl \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/lib/Qt5Network.prl \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/lib/Qt5Core.prl \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/lib/qtmain.prl \
|
||||||
|
.qmake.stash \
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/build_pass.prf
|
||||||
|
$(QMAKE) -o Makefile OutilModbus.pro -spec win32-g++ "CONFIG+=debug" "CONFIG+=qml_debug"
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/spec_pre.prf:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/qdevice.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/device_config.prf:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/common/sanitize.conf:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/common/gcc-base.conf:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/common/g++-base.conf:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/common/angle.conf:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/win32/windows_vulkan_sdk.prf:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/common/windows-vulkan.conf:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/common/g++-win32.conf:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/common/windows-desktop.conf:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/qconfig.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_3danimation.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_3danimation_private.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_3dcore.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_3dcore_private.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_3dextras.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_3dextras_private.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_3dinput.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_3dinput_private.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_3dlogic.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_3dlogic_private.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_3dquick.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_3dquick_private.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_3dquickanimation.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_3dquickanimation_private.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_3dquickextras.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_3dquickextras_private.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_3dquickinput.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_3dquickinput_private.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_3dquickrender.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_3dquickrender_private.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_3dquickscene2d.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_3dquickscene2d_private.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_3drender.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_3drender_private.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_accessibility_support_private.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_axbase.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_axbase_private.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_axcontainer.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_axcontainer_private.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_axserver.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_axserver_private.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_bluetooth.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_bluetooth_private.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_bootstrap_private.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_concurrent.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_concurrent_private.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_core.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_core_private.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_dbus.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_dbus_private.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_designer.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_designer_private.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_designercomponents_private.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_devicediscovery_support_private.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_edid_support_private.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_egl_support_private.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_eventdispatcher_support_private.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_fb_support_private.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_fontdatabase_support_private.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_gamepad.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_gamepad_private.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_gui.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_gui_private.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_help.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_help_private.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_location.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_location_private.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_multimedia.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_multimedia_private.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_multimediawidgets.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_multimediawidgets_private.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_network.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_network_private.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_nfc.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_nfc_private.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_opengl.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_opengl_private.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_openglextensions.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_openglextensions_private.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_packetprotocol_private.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_platformcompositor_support_private.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_positioning.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_positioning_private.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_positioningquick.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_positioningquick_private.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_printsupport.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_printsupport_private.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_qml.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_qml_private.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_qmldebug_private.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_qmldevtools_private.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_qmlmodels.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_qmlmodels_private.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_qmltest.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_qmltest_private.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_qmlworkerscript.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_qmlworkerscript_private.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_qtmultimediaquicktools_private.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_quick.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_quick_private.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_quickcontrols2.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_quickcontrols2_private.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_quickparticles_private.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_quickshapes_private.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_quicktemplates2.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_quicktemplates2_private.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_quickwidgets.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_quickwidgets_private.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_remoteobjects.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_remoteobjects_private.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_repparser.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_repparser_private.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_scxml.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_scxml_private.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_sensors.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_sensors_private.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_serialbus.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_serialbus_private.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_serialport.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_serialport_private.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_sql.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_sql_private.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_svg.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_svg_private.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_testlib.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_testlib_private.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_texttospeech.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_texttospeech_private.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_theme_support_private.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_uiplugin.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_uitools.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_uitools_private.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_vulkan_support_private.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_webchannel.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_webchannel_private.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_websockets.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_websockets_private.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_widgets.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_widgets_private.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_windowsuiautomation_support_private.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_winextras.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_winextras_private.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_xml.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_xml_private.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_xmlpatterns.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_xmlpatterns_private.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/modules/qt_lib_zlib_private.pri:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/qt_functions.prf:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/qt_config.prf:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/win32-g++/qmake.conf:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/spec_post.prf:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/exclusive_builds.prf:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/toolchain.prf:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/default_pre.prf:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/win32/default_pre.prf:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/resolve_config.prf:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/exclusive_builds_post.prf:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/default_post.prf:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/qml_debug.prf:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/precompile_header.prf:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/warn_on.prf:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/qt.prf:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/resources_functions.prf:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/resources.prf:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/moc.prf:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/win32/opengl.prf:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/uic.prf:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/qmake_use.prf:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/file_copies.prf:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/win32/windows.prf:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/testcase_targets.prf:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/exceptions.prf:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/yacc.prf:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/lex.prf:
|
||||||
|
OutilModbus.pro:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/lib/Qt5Widgets.prl:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/lib/Qt5Gui.prl:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/lib/Qt5Network.prl:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/lib/Qt5Core.prl:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/lib/qtmain.prl:
|
||||||
|
.qmake.stash:
|
||||||
|
C:/Qt/Qt5.14.2/5.14.2/mingw73_64/mkspecs/features/build_pass.prf:
|
||||||
|
qmake: FORCE
|
||||||
|
@$(QMAKE) -o Makefile OutilModbus.pro -spec win32-g++ "CONFIG+=debug" "CONFIG+=qml_debug"
|
||||||
|
|
||||||
|
qmake_all: FORCE
|
||||||
|
|
||||||
|
make_first: debug-make_first release-make_first FORCE
|
||||||
|
all: debug-all release-all FORCE
|
||||||
|
clean: debug-clean release-clean FORCE
|
||||||
|
distclean: debug-distclean release-distclean FORCE
|
||||||
|
-$(DEL_FILE) Makefile
|
||||||
|
-$(DEL_FILE) .qmake.stash
|
||||||
|
|
||||||
|
debug-mocclean:
|
||||||
|
$(MAKE) -f $(MAKEFILE).Debug mocclean
|
||||||
|
release-mocclean:
|
||||||
|
$(MAKE) -f $(MAKEFILE).Release mocclean
|
||||||
|
mocclean: debug-mocclean release-mocclean
|
||||||
|
|
||||||
|
debug-mocables:
|
||||||
|
$(MAKE) -f $(MAKEFILE).Debug mocables
|
||||||
|
release-mocables:
|
||||||
|
$(MAKE) -f $(MAKEFILE).Release mocables
|
||||||
|
mocables: debug-mocables release-mocables
|
||||||
|
|
||||||
|
check: first
|
||||||
|
|
||||||
|
benchmark: first
|
||||||
|
FORCE:
|
||||||
|
|
||||||
|
$(MAKEFILE).Debug: Makefile
|
||||||
|
$(MAKEFILE).Release: Makefile
|
||||||
+3176
File diff suppressed because one or more lines are too long
+3081
File diff suppressed because one or more lines are too long
@@ -0,0 +1,66 @@
|
|||||||
|
#-------------------------------------------------
|
||||||
|
#
|
||||||
|
# Project created by QtCreator 2017-03-01T13:52:35
|
||||||
|
#
|
||||||
|
#-------------------------------------------------
|
||||||
|
|
||||||
|
QT += core gui network
|
||||||
|
CONFIG += static
|
||||||
|
|
||||||
|
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||||
|
|
||||||
|
TARGET = OutilModbus
|
||||||
|
TEMPLATE = app
|
||||||
|
|
||||||
|
INCLUDEPATH += Sources/ \
|
||||||
|
Sources/SerialPort/ \
|
||||||
|
Sources/SerialPort/qextserialport/src/
|
||||||
|
|
||||||
|
SOURCES += \
|
||||||
|
Sources/MainWindow.cpp \
|
||||||
|
Sources/main.cpp \
|
||||||
|
Sources/ModbusBackend.cpp \
|
||||||
|
Sources/ModbusSlave.cpp \
|
||||||
|
Sources/ModbusMaster.cpp \
|
||||||
|
Sources/OutilModbus.cpp \
|
||||||
|
Sources/ModbusRepository.cpp \
|
||||||
|
Sources/ZTInfo.cpp \
|
||||||
|
Sources/ModbusPage.cpp \
|
||||||
|
Sources/MainPage.cpp \
|
||||||
|
Sources/LazerProbeSimPage.cpp \
|
||||||
|
Sources/LazerProbeSimulator.cpp \
|
||||||
|
Sources/SerialPort/qextserialport/src/qextserialport_win.cpp \
|
||||||
|
Sources/SerialPort/qextserialport/src/qextserialport.cpp \
|
||||||
|
Sources/SEIModbusPage.cpp
|
||||||
|
|
||||||
|
HEADERS += \
|
||||||
|
Sources/MainWindow.h \
|
||||||
|
Sources/ModbusBackend.h \
|
||||||
|
Sources/ModbusSlave.h \
|
||||||
|
Sources/ModbusMaster.h \
|
||||||
|
Sources/OutilModbus.h \
|
||||||
|
Sources/ModbusRepository.h \
|
||||||
|
Sources/GlobalDefine.h \
|
||||||
|
Sources/ProtocolDefs.h \
|
||||||
|
Sources/ZTInfo.h \
|
||||||
|
Sources/ModbusPage.h \
|
||||||
|
Sources/MainPage.h \
|
||||||
|
Sources/LazerProbeSimPage.h \
|
||||||
|
Sources/LazerProbeSimulator.h \
|
||||||
|
Sources/SerialPort/qextserialport/src/qextserialport_p.h \
|
||||||
|
Sources/SerialPort/qextserialport/src/qextserialport_global.h \
|
||||||
|
Sources/SerialPort/qextserialport/src/qextserialport.h \
|
||||||
|
Sources/SEIModbusPage.h
|
||||||
|
|
||||||
|
FORMS += \
|
||||||
|
Sources/CModbusPage.ui \
|
||||||
|
Sources/MainPage.ui \
|
||||||
|
Sources/LazerProbeSimPage.ui \
|
||||||
|
Sources/SEIModbusPage.ui
|
||||||
|
|
||||||
|
DEFINES -= Q_OS_UNIX
|
||||||
|
|
||||||
|
#LIBS += $$PWD/Sources/SerialPort/libqextserialport1.a
|
||||||
|
|
||||||
|
OTHER_FILES += \
|
||||||
|
Sources/SerialPort/qextserialport/src/qextserialport.pri
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,33 @@
|
|||||||
|
#ifndef GLOBALDEFINE_H
|
||||||
|
#define GLOBALDEFINE_H
|
||||||
|
|
||||||
|
|
||||||
|
#define RET_OK 1
|
||||||
|
#define RET_ERROR 0
|
||||||
|
|
||||||
|
//#define MODBUS_CC_ALARM_REG_START_ADDRESS 2000
|
||||||
|
//#define MODBUS_CC_TC_REG_START_ADDRESS 3000
|
||||||
|
|
||||||
|
//#define MODBUS_CC_ZT1_PPINT_FLAG_MASK 0x0001
|
||||||
|
//#define MODBUS_CC_ZT1_PPEXT_FLAG_MASK 0x0002
|
||||||
|
//#define MODBUS_CC_ZT1_PG_FLAG_MASK 0x0004
|
||||||
|
//#define MODBUS_CC_ZT1_FN_FLAG_MASK 0x0008
|
||||||
|
//#define MODBUS_CC_ZT1_V00_FLAG_MASK 0x0010
|
||||||
|
//#define MODBUS_CC_PEQ1_FLAG_MASK 0x0020
|
||||||
|
//#define MODBUS_CC_PEQ2_FLAG_MASK 0x0040
|
||||||
|
//#define MODBUS_CC_ZT2_PPINT_FLAG_MASK 0x0080
|
||||||
|
//#define MODBUS_CC_ZT2_PPEXT_FLAG_MASK 0x0100
|
||||||
|
//#define MODBUS_CC_ZT2_V02_FLAG_MASK 0x0200
|
||||||
|
//#define MODBUS_CC_ALARM_ITI_FLAG_MASK 0x0400
|
||||||
|
//#define MODBUS_CC_INVALID1_FLAG_MASK 0x0800
|
||||||
|
//#define MODBUS_CC_INVALID2_FLAG_MASK 0x1000
|
||||||
|
//#define MODBUS_CC_INVALID3_FLAG_MASK 0x2000
|
||||||
|
//#define MODBUS_CC_INVALID4_FLAG_MASK 0x4000
|
||||||
|
//#define MODBUS_CC_INVALID5_FLAG_MASK 0x8000
|
||||||
|
|
||||||
|
//#define MODBUS_CC_AN1_FLAG_MASK 0x00001
|
||||||
|
//#define MODBUS_CC_AN2_FLAG_MASK 0x00002
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif // GLOBALDEFINE_H
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
#include "LazerProbeSimPage.h"
|
||||||
|
#include "ui_LazerProbeSimPage.h"
|
||||||
|
|
||||||
|
|
||||||
|
CLazerProbeSimPage::CLazerProbeSimPage(QWidget *parent) :
|
||||||
|
QWidget(parent),
|
||||||
|
ui(new Ui::CLazerProbeSimPage)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
connect(ui->mMeasurementValueSlider,SIGNAL(valueChanged(int)),this,SLOT(ProbeValueChanged(int)));
|
||||||
|
ui->mValueDisplayLabel->setText(QString("%1").arg(ui->mMeasurementValueSlider->value()));
|
||||||
|
|
||||||
|
connect(ui->mEnableProbeChkBx,SIGNAL(stateChanged(int)),this,SLOT(EnableProbeChanged(int)));
|
||||||
|
connect(ui->mOutOfRangeChkBx,SIGNAL(stateChanged(int)),this,SLOT(OutOfRangeChanged(int)));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CLazerProbeSimPage::~CLazerProbeSimPage()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CLazerProbeSimPage::ProbeValueChanged(int Value)
|
||||||
|
{
|
||||||
|
if(ui->mOutOfRangeChkBx->isChecked())
|
||||||
|
{
|
||||||
|
Value = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ui->mValueDisplayLabel->setText(QString("%1").arg(Value));
|
||||||
|
mLazerProbe.SetProbeCurRange(Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CLazerProbeSimPage::EnableProbeChanged(int State)
|
||||||
|
{
|
||||||
|
if(State == Qt::Checked)
|
||||||
|
{
|
||||||
|
mLazerProbe.EnableProbe(true);
|
||||||
|
}
|
||||||
|
else if(State == Qt::Unchecked)
|
||||||
|
{
|
||||||
|
mLazerProbe.EnableProbe(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CLazerProbeSimPage::OutOfRangeChanged(int State)
|
||||||
|
{
|
||||||
|
if(State == Qt::Checked)
|
||||||
|
{
|
||||||
|
ProbeValueChanged(0);
|
||||||
|
}
|
||||||
|
else if(State == Qt::Unchecked)
|
||||||
|
{
|
||||||
|
ProbeValueChanged(ui->mMeasurementValueSlider->value());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
#ifndef LAZERPROBESIMPAGE_H
|
||||||
|
#define LAZERPROBESIMPAGE_H
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
#include "LazerProbeSimulator.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class CLazerProbeSimPage;
|
||||||
|
}
|
||||||
|
|
||||||
|
class CLazerProbeSimPage : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit CLazerProbeSimPage(QWidget *parent = 0);
|
||||||
|
~CLazerProbeSimPage();
|
||||||
|
CLazerProbeSimulator mLazerProbe;
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::CLazerProbeSimPage *ui;
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void ProbeValueChanged(int);
|
||||||
|
void EnableProbeChanged(int);
|
||||||
|
void OutOfRangeChanged(int);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // LAZERPROBESIMPAGE_H
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>CLazerProbeSimPage</class>
|
||||||
|
<widget class="QWidget" name="CLazerProbeSimPage">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>1143</width>
|
||||||
|
<height>465</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Form</string>
|
||||||
|
</property>
|
||||||
|
<widget class="QCheckBox" name="mEnableProbeChkBx">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>130</x>
|
||||||
|
<y>160</y>
|
||||||
|
<width>70</width>
|
||||||
|
<height>17</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Activer</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QSlider" name="mMeasurementValueSlider">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>100</x>
|
||||||
|
<y>90</y>
|
||||||
|
<width>291</width>
|
||||||
|
<height>19</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<number>100000</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>200000</number>
|
||||||
|
</property>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QCheckBox" name="mOutOfRangeChkBx">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>240</x>
|
||||||
|
<y>160</y>
|
||||||
|
<width>70</width>
|
||||||
|
<height>17</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>CheckBox</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="mValueDisplayLabel">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>210</x>
|
||||||
|
<y>40</y>
|
||||||
|
<width>46</width>
|
||||||
|
<height>13</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>TextLabel</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
@@ -0,0 +1,102 @@
|
|||||||
|
#include "LazerProbeSimulator.h"
|
||||||
|
#include <QTextCodec>
|
||||||
|
#include <QtGlobal>
|
||||||
|
|
||||||
|
|
||||||
|
CLazerProbeSimulator::CLazerProbeSimulator()
|
||||||
|
{
|
||||||
|
// QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
|
||||||
|
mLaserProbeSerialPort = new QextSerialPort("COM1", QextSerialPort::EventDriven);
|
||||||
|
if(mLaserProbeSerialPort == NULL)
|
||||||
|
{
|
||||||
|
qDebug("Impossible de créer le port %s","COM1");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// connect(mSRDFSerialPort, SIGNAL(readyRead()), this, SLOT(SRDFDataAvailable()));
|
||||||
|
|
||||||
|
mLaserProbeSerialPort->setBaudRate(BAUD38400);
|
||||||
|
mLaserProbeSerialPort->setFlowControl(FLOW_OFF);
|
||||||
|
mLaserProbeSerialPort->setParity(PAR_NONE);
|
||||||
|
mLaserProbeSerialPort->setDataBits(DATA_8);
|
||||||
|
mLaserProbeSerialPort->setStopBits(STOP_2);
|
||||||
|
mLaserProbeSerialPort->setTimeout(0);
|
||||||
|
|
||||||
|
if(mLaserProbeSerialPort->open(QIODevice::WriteOnly | QIODevice::Unbuffered))
|
||||||
|
{
|
||||||
|
// connect(mSRDFSerialPort, SIGNAL(readyRead()), this, SLOT(SRDFDataAvailable()));
|
||||||
|
qDebug("Port série ouvert avec succès");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qDebug("Impossible d'ouvrir le port série COM1");
|
||||||
|
}
|
||||||
|
|
||||||
|
mHeader = 0x54;
|
||||||
|
mValue = 0;
|
||||||
|
mTxBuf[0] = 0;
|
||||||
|
mTxBuf[1] = 0;
|
||||||
|
mTxBuf[2] = 0;
|
||||||
|
|
||||||
|
mTxTimer = new QTimer();
|
||||||
|
mTxTimer->setInterval(1);
|
||||||
|
mTxTimer->setSingleShot(false);
|
||||||
|
mTxTimer->stop();
|
||||||
|
connect(mTxTimer,SIGNAL(timeout()),this, SLOT(ProbeTxTimerExpired()));
|
||||||
|
}
|
||||||
|
|
||||||
|
CLazerProbeSimulator::~CLazerProbeSimulator()
|
||||||
|
{
|
||||||
|
qDebug("Closing serial port");
|
||||||
|
mLaserProbeSerialPort->close();
|
||||||
|
delete mLaserProbeSerialPort;
|
||||||
|
delete mTxTimer;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CLazerProbeSimulator::EnableProbe(bool Enable)
|
||||||
|
{
|
||||||
|
if(Enable)
|
||||||
|
{
|
||||||
|
qDebug("Probe enabled");
|
||||||
|
mTxTimer->start();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qDebug("Probe disabled");
|
||||||
|
mTxTimer->stop();
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CLazerProbeSimulator::SetProbeCurRange(int Range)
|
||||||
|
{
|
||||||
|
|
||||||
|
mValue = Range;
|
||||||
|
|
||||||
|
qDebug(qPrintable(QString("%1").arg(mValue)));
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CLazerProbeSimulator::ProbeTxTimerExpired()
|
||||||
|
{
|
||||||
|
int Temp = mValue;
|
||||||
|
mHeader = (~mHeader) & LAZER_PROBE_HEADER_MASK;
|
||||||
|
mHeader |= ((char)Temp & LAZER_PROBE_DATA_NIBBLE_MASK);
|
||||||
|
mTxBuf[0] = mHeader;
|
||||||
|
|
||||||
|
Temp >>= 2;
|
||||||
|
mTxBuf[1] = (char)Temp & 0xFF;
|
||||||
|
|
||||||
|
Temp >>= 8;
|
||||||
|
mTxBuf[2] = (char)Temp & 0xFF;
|
||||||
|
|
||||||
|
QByteArray Buf;
|
||||||
|
Buf.append(mTxBuf[0]);
|
||||||
|
Buf.append(mTxBuf[1]);
|
||||||
|
Buf.append(mTxBuf[2]);
|
||||||
|
|
||||||
|
mLaserProbeSerialPort->write(Buf);
|
||||||
|
|
||||||
|
qDebug(qPrintable(QString().sprintf("[0x%x][0x%x][0x%x]",mTxBuf[0],mTxBuf[1], mTxBuf[2])));
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
#ifndef LAZERPROBESIMULATOR_H
|
||||||
|
#define LAZERPROBESIMULATOR_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include "qextserialport.h"
|
||||||
|
#include <QTimer>
|
||||||
|
#include <QByteArray>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class CLazerProbeSimulator : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
#define LAZER_PROBE_HEADER_MASK 0xFC
|
||||||
|
#define LAZER_PROBE_DATA_NIBBLE_MASK 0x03
|
||||||
|
|
||||||
|
public:
|
||||||
|
CLazerProbeSimulator();
|
||||||
|
~CLazerProbeSimulator();
|
||||||
|
|
||||||
|
bool EnableProbe(bool Enable);
|
||||||
|
bool SetProbeCurRange(int Range);
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
QextSerialPort *mLaserProbeSerialPort;
|
||||||
|
QTimer *mTxTimer;
|
||||||
|
|
||||||
|
quint8 mHeader;
|
||||||
|
char mTxBuf[3];
|
||||||
|
quint32 mValue;
|
||||||
|
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void ProbeTxTimerExpired(void);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // LAZERPROBESIMULATORESIMULATOR_H
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
#include "MainPage.h"
|
||||||
|
#include "LazerProbeSimPage.h"
|
||||||
|
#include "SEIModbusPage.h"
|
||||||
|
#include "ui_MainPage.h"
|
||||||
|
|
||||||
|
#include "OutilModbus.h"
|
||||||
|
|
||||||
|
|
||||||
|
CMainPage::CMainPage(QWidget *parent) :
|
||||||
|
QWidget(parent),
|
||||||
|
ui(new Ui::CMainPage)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
CMainPage::~CMainPage()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CMainPage::RegisterPagesTabs(CModbusPage *ModbusPage, CLazerProbeSimPage* LazerSimPage, CSEIModbusPage *SEIModbusPage)
|
||||||
|
{
|
||||||
|
ui->mMainPageTabs->clear();
|
||||||
|
ui->mMainPageTabs->addTab((QWidget*)ModbusPage,"Modbus CC");
|
||||||
|
ui->mMainPageTabs->addTab((QWidget*)SEIModbusPage,"Modbus SEI");
|
||||||
|
ui->mMainPageTabs->addTab((QWidget*)LazerSimPage,"Sondes");
|
||||||
|
|
||||||
|
//ModbusPage->show();
|
||||||
|
ui->mMainPageTabs->setCurrentIndex(1);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
#ifndef MAINPAGE_H
|
||||||
|
#define MAINPAGE_H
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
|
||||||
|
class COutilModbus;
|
||||||
|
class CModbusPage;
|
||||||
|
class CLazerProbeSimPage;
|
||||||
|
class CSEIModbusPage;
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class CMainPage;
|
||||||
|
}
|
||||||
|
|
||||||
|
class CMainPage : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit CMainPage(QWidget *parent = 0);
|
||||||
|
~CMainPage();
|
||||||
|
COutilModbus *mProgramHandle;
|
||||||
|
|
||||||
|
int RegisterPagesTabs(CModbusPage*, CLazerProbeSimPage*, CSEIModbusPage*);
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::CMainPage *ui;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // MAINPAGE_H
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>CMainPage</class>
|
||||||
|
<widget class="QWidget" name="CMainPage">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>1431</width>
|
||||||
|
<height>1008</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Form</string>
|
||||||
|
</property>
|
||||||
|
<widget class="QTabWidget" name="mMainPageTabs">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>10</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>1421</width>
|
||||||
|
<height>1011</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="currentIndex">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="Modbus">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>Tab 1</string>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="Sondes">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>Tab 2</string>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
@@ -0,0 +1,125 @@
|
|||||||
|
#include "MainWindow.h"
|
||||||
|
#include <QWidget>
|
||||||
|
#include "OutilModbus.h"
|
||||||
|
|
||||||
|
MainWindow::MainWindow(QWidget *parent,COutilModbus* ProgramHandle)
|
||||||
|
: QMainWindow(parent),
|
||||||
|
mProgramHandle(ProgramHandle)
|
||||||
|
{
|
||||||
|
resize(1024,768);
|
||||||
|
|
||||||
|
mMainPage = new CMainPage(this);
|
||||||
|
mMainPage->mProgramHandle = ProgramHandle;
|
||||||
|
|
||||||
|
mSEIModbusPage = new CSEIModbusPage(this);
|
||||||
|
mSEIModbusPage->mProgramHandle = ProgramHandle;
|
||||||
|
|
||||||
|
mModbusPage = new CModbusPage();
|
||||||
|
mModbusPage->mProgramHandle = ProgramHandle;
|
||||||
|
|
||||||
|
mLazerSimPage = new CLazerProbeSimPage;
|
||||||
|
|
||||||
|
setCentralWidget(mMainPage);
|
||||||
|
|
||||||
|
mMainPage->RegisterPagesTabs(mModbusPage,mLazerSimPage, mSEIModbusPage);
|
||||||
|
|
||||||
|
// setWindowFlags(Qt::WindowStaysOnTopHint);
|
||||||
|
|
||||||
|
// QHBoxLayout *MainLayout = new QHBoxLayout;
|
||||||
|
// QWidget *test = new QWidget();
|
||||||
|
// mCCGridLayout = new QGridLayout();
|
||||||
|
// mSEIGridLayout = new QGridLayout();
|
||||||
|
// test->setLayout(MainLayout);
|
||||||
|
// setCentralWidget(test);
|
||||||
|
|
||||||
|
// test->resize(200,200);
|
||||||
|
// MainLayout->addLayout(mCCGridLayout);
|
||||||
|
// MainLayout->addLayout(mSEIGridLayout);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// mConnectToSlaveBtn = new QPushButton("Connect to slave");
|
||||||
|
// connect(mConnectToSlaveBtn,SIGNAL(clicked()),this,SLOT(ButtonPushed()));
|
||||||
|
// mSendWriteMultipleHR = new QPushButton("Write Multiple HR");
|
||||||
|
// connect(mSendWriteMultipleHR,SIGNAL(clicked()),this,SLOT(ButtonPushed()));
|
||||||
|
// mSendReadHR = new QPushButton("Read HR");
|
||||||
|
// connect(mSendReadHR,SIGNAL(clicked()),this,SLOT(ButtonPushed()));
|
||||||
|
// mWriteSingleHR = new QPushButton("Write Single HR");
|
||||||
|
// connect(mWriteSingleHR,SIGNAL(clicked()),this,SLOT(ButtonPushed()));
|
||||||
|
|
||||||
|
// mAlarmePPIZT1 = new QLabel("Alarme PP Int. ZT1");
|
||||||
|
// mAlarmePPEZT1 = new QLabel("Alarem PP Ext. ZT1");
|
||||||
|
// mAlarmePG = new QLabel("Alarme PG ZT1");
|
||||||
|
// mAlarmeFN = new QLabel("Alarme FN");
|
||||||
|
// mAlarmePEQ1 = new QLabel("PEQ1");
|
||||||
|
// mAlarmePEQ2 = new QLabel("PEQ2");
|
||||||
|
// mAlarmePPIZT2 = new QLabel("Alarme PP Int. ZT2");
|
||||||
|
// mAlarmePPEZT2 = new QLabel("Alarme PP Ext. ZT2");
|
||||||
|
// mITI = new QLabel("Itinéraire: 10/12");
|
||||||
|
// mRankPPZT1 = new QLabel("Rang PP ZT1: 0");
|
||||||
|
// mRankPG = new QLabel("Rang PG ZT1: 0");
|
||||||
|
// mRankPPZT2 = new QLabel("Rang PP ZT2: 0");
|
||||||
|
|
||||||
|
// mCCEventsList = new QTextEdit;
|
||||||
|
// mCCEventsList->setText("");
|
||||||
|
// mCCGridLayout->addWidget(mCCEventsList,20,0,10,30);
|
||||||
|
|
||||||
|
// mSEIEventsList = new QTextEdit;
|
||||||
|
// mSEIEventsList->setText("TEST\nTest\nTEST\na;sdlfjkasl;fjasl;dkfjasl;dfjsdj\ntest");
|
||||||
|
// mSEIEventsList->resize(200,60);
|
||||||
|
// mSEIGridLayout->addWidget(mSEIEventsList,0,20,10,30);
|
||||||
|
|
||||||
|
// mCCGridLayout->addWidget(mConnectToSlaveBtn,0,0);
|
||||||
|
// mCCGridLayout->addWidget(mSendWriteMultipleHR,0,1);
|
||||||
|
// mCCGridLayout->addWidget(mSendReadHR,0,2);
|
||||||
|
// mCCGridLayout->addWidget(mWriteSingleHR,0,3);
|
||||||
|
|
||||||
|
// mCCGridLayout->addWidget(mAlarmePPIZT1,5,0);
|
||||||
|
// mCCGridLayout->addWidget(mAlarmePPEZT1,5,1);
|
||||||
|
// mCCGridLayout->addWidget(mAlarmePG,5,2);
|
||||||
|
// mCCGridLayout->addWidget(mAlarmeFN,5,3);
|
||||||
|
// mCCGridLayout->addWidget(mAlarmePEQ1,6,0);
|
||||||
|
// mCCGridLayout->addWidget(mAlarmePEQ2,6,1);
|
||||||
|
// mCCGridLayout->addWidget(mAlarmePPIZT2,6,2);
|
||||||
|
// mCCGridLayout->addWidget(mAlarmePPEZT2,6,3);
|
||||||
|
// mCCGridLayout->addWidget(mITI,7,0);
|
||||||
|
// mCCGridLayout->addWidget(mRankPPZT1,8,0);
|
||||||
|
// mCCGridLayout->addWidget(mRankPG,9,0,1,1,Qt::AlignLeft);
|
||||||
|
// mCCGridLayout->addWidget(mRankPPZT2,10,0,1,1,Qt::AlignLeft);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
MainWindow::~MainWindow()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::ButtonPushed()
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
// QObject *Btn = QObject::sender();
|
||||||
|
|
||||||
|
// qDebug("Button clicked:");
|
||||||
|
|
||||||
|
// if(Btn == mConnectToSlaveBtn)
|
||||||
|
// {
|
||||||
|
// qDebug("Button clicked: mConnectToSlaveBtn");
|
||||||
|
// }
|
||||||
|
// else if(Btn == mSendWriteMultipleHR)
|
||||||
|
// {
|
||||||
|
// qDebug("Button clicked: mSendWriteMultipleHR");
|
||||||
|
// }
|
||||||
|
// else if(Btn == mSendReadHR)
|
||||||
|
// {
|
||||||
|
// qDebug("Button clicked: mSendReadHR");
|
||||||
|
// }
|
||||||
|
// else if(Btn == mWriteSingleHR)
|
||||||
|
// {
|
||||||
|
// qDebug("Button clicked: mWriteSingleHR");
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
#ifndef MAINWINDOW_H
|
||||||
|
#define MAINWINDOW_H
|
||||||
|
|
||||||
|
#include <QMainWindow>
|
||||||
|
#include <QPushButton>
|
||||||
|
#include <QGridLayout>
|
||||||
|
#include <QLabel>
|
||||||
|
#include <QTextEdit>
|
||||||
|
#include "ModbusPage.h"
|
||||||
|
#include "MainPage.h"
|
||||||
|
#include "LazerProbeSimPage.h"
|
||||||
|
#include "SEIModbusPage.h"
|
||||||
|
|
||||||
|
class COutilModbus;
|
||||||
|
|
||||||
|
class MainWindow : public QMainWindow
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
MainWindow(QWidget *parent = 0,COutilModbus* ProgramHandle = 0);
|
||||||
|
~MainWindow();
|
||||||
|
|
||||||
|
CMainPage *mMainPage;
|
||||||
|
CModbusPage *mModbusPage;
|
||||||
|
COutilModbus *mProgramHandle;
|
||||||
|
CLazerProbeSimPage *mLazerSimPage;
|
||||||
|
CSEIModbusPage *mSEIModbusPage;
|
||||||
|
|
||||||
|
// QGridLayout *mCCGridLayout, *mSEIGridLayout;
|
||||||
|
// QPushButton *mConnectToSlaveBtn, *mSendWriteMultipleHR, *mSendReadHR, *mWriteSingleHR;
|
||||||
|
|
||||||
|
// QTextEdit *mCCEventsList, *mSEIEventsList;
|
||||||
|
|
||||||
|
// QLabel *mAlarmePPIZT1, *mAlarmePPEZT1, *mAlarmePG, *mAlarmeFN, *mAlarmePEQ1, *mAlarmePEQ2, *mAlarmePPIZT2, *mAlarmePPEZT2, *mITI, *mRankPPZT1, *mRankPG, *mRankPPZT2;
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void ButtonPushed();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // MAINWINDOW_H
|
||||||
@@ -0,0 +1,707 @@
|
|||||||
|
#include "ModbusBackend.h"
|
||||||
|
#include "QBuffer"
|
||||||
|
#include <QDataStream>
|
||||||
|
|
||||||
|
|
||||||
|
CModbusBackend::CModbusBackend(CModbusRepository *Repo)
|
||||||
|
{
|
||||||
|
mModbusTCPSocketHandle = 0;
|
||||||
|
mDataLinkValid = false;
|
||||||
|
mModbusRepo = Repo;
|
||||||
|
mModbusMode = MODBUS_INVALID_MODE;
|
||||||
|
mTransactionIDCounter = 0;
|
||||||
|
mDeviceID = 1;//0xFF;
|
||||||
|
|
||||||
|
mModbusMaxRetry = MODBUS_RETRY_MAX_COUNT;
|
||||||
|
mModbusRequestTimeout = MODBUS_RETRY_DELAY;
|
||||||
|
}
|
||||||
|
|
||||||
|
CModbusBackend::~CModbusBackend()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CModbusBackend::ModbusDataReady()
|
||||||
|
{
|
||||||
|
|
||||||
|
CModbusTransaction Transaction;
|
||||||
|
QByteArray InData = mModbusTCPSocketHandle->readAll();
|
||||||
|
|
||||||
|
QBuffer FileBuffer(&InData);
|
||||||
|
FileBuffer.open(QIODevice::ReadOnly);
|
||||||
|
FileBuffer.seek(0);
|
||||||
|
QDataStream *TransactionDataStrm = new QDataStream(&FileBuffer);
|
||||||
|
*TransactionDataStrm >> Transaction.mHeader;
|
||||||
|
*TransactionDataStrm >> Transaction.mPDU.mFunctionCode;
|
||||||
|
Transaction.mPDU.mData = InData.right(Transaction.mHeader.mMessageLength - 2); //-2 to remove Device ID and Function Code.
|
||||||
|
|
||||||
|
// qDebug("modbus data received %s",InData.toHex().data());
|
||||||
|
// qDebug("Transaction ID 0x%X",Transaction.mHeader.mTransactionID);
|
||||||
|
// qDebug("Message Length %d",Transaction.mHeader.mMessageLength);
|
||||||
|
// qDebug("Protocol ID 0x%X",Transaction.mHeader.mProtocolID);
|
||||||
|
// qDebug("Unit ID 0x%X",Transaction.mHeader.mUnitID);
|
||||||
|
|
||||||
|
// qDebug("Function Code 0x%X",Transaction.mPDU.mFunctionCode);
|
||||||
|
// qDebug("Data %s",Transaction.mPDU.mData.toHex().data());
|
||||||
|
|
||||||
|
if(mModbusMode == MODBUS_MASTER_MODE)
|
||||||
|
{
|
||||||
|
AnalyzeModbusResponse(Transaction);
|
||||||
|
}
|
||||||
|
else if( mModbusMode == MODBUS_SLAVE_MODE)
|
||||||
|
{
|
||||||
|
AnalyzeModbusRequest(Transaction);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qDebug("Illegal modbus backend mode...");
|
||||||
|
}
|
||||||
|
|
||||||
|
emit ModbusRX();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CModbusBackend::ModbusLinkDisconnected()
|
||||||
|
{
|
||||||
|
qDebug("Modbus link disconnected");
|
||||||
|
mDataLinkValid = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//In client mode. This is the request from the master.
|
||||||
|
int CModbusBackend::AnalyzeModbusRequest(CModbusTransaction Transaction)
|
||||||
|
{
|
||||||
|
if(Transaction.mHeader.mProtocolID != 0)
|
||||||
|
{
|
||||||
|
//Invalid protocol... what can we do?
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch(Transaction.mPDU.mFunctionCode)
|
||||||
|
{
|
||||||
|
case MODBUS_FCT_READ_HOLDING_REGISTERS:
|
||||||
|
{
|
||||||
|
bool ok = true;
|
||||||
|
unsigned short StartAdress = 0;
|
||||||
|
StartAdress = Transaction.mPDU.mData[0]&0xFF;
|
||||||
|
StartAdress <<= 8;
|
||||||
|
StartAdress += Transaction.mPDU.mData[1]&0xFF;
|
||||||
|
unsigned short NbRegisters = 0;
|
||||||
|
NbRegisters = Transaction.mPDU.mData[2]&0xFF;
|
||||||
|
NbRegisters <<= 8;
|
||||||
|
NbRegisters += Transaction.mPDU.mData[3]&0xFF;
|
||||||
|
|
||||||
|
//Validate nb of registers
|
||||||
|
if(NbRegisters < 1 || NbRegisters > MODBUS_MAX_NB_REGISTERS)
|
||||||
|
{
|
||||||
|
SendErrorResponse(Transaction,MODBUS_EXCEPTION_ILLEGAL_DATA_VALUE);
|
||||||
|
// emit ModbusRequestException(MODBUS_EXCEPTION_ILLEGAL_DATA_VALUE,MODBUS_FCT_READ_HOLDING_REGISTERS);
|
||||||
|
ModbusRequestException(MODBUS_EXCEPTION_ILLEGAL_DATA_VALUE,MODBUS_FCT_READ_HOLDING_REGISTERS);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Validate data range
|
||||||
|
if(!mModbusRepo->IsHRValid(StartAdress,NbRegisters))
|
||||||
|
{
|
||||||
|
qDebug("Reg invalid");
|
||||||
|
//Send negative response
|
||||||
|
SendErrorResponse(Transaction,MODBUS_EXCEPTION_ILLEGAL_DATA_ADDRESS);
|
||||||
|
// emit ModbusRequestException(MODBUS_EXCEPTION_ILLEGAL_DATA_ADDRESS,MODBUS_FCT_READ_HOLDING_REGISTERS);
|
||||||
|
ModbusRequestException(MODBUS_EXCEPTION_ILLEGAL_DATA_ADDRESS,MODBUS_FCT_READ_HOLDING_REGISTERS);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
QByteArray data = mModbusRepo->GetHRData(StartAdress,NbRegisters,&ok);
|
||||||
|
|
||||||
|
// qDebug("Slave Rx Read Holding Registers. Address: %d, Nb Reg: %d",StartAdress, NbRegisters);
|
||||||
|
// qDebug("Data: %s",data.toHex().data());
|
||||||
|
|
||||||
|
//The response to a HR reading needs the byte count before the data.
|
||||||
|
quint8 ByteCount = data.size();
|
||||||
|
data.prepend(ByteCount);
|
||||||
|
SendModbusResponse(Transaction, data);
|
||||||
|
|
||||||
|
//All OK
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case MODBUS_WRITE_SINGLE_REGISTER:
|
||||||
|
{
|
||||||
|
unsigned short StartAdress = 0;
|
||||||
|
|
||||||
|
StartAdress = Transaction.mPDU.mData[0]&0xFF;
|
||||||
|
StartAdress <<= 8;
|
||||||
|
StartAdress += Transaction.mPDU.mData[1]&0xFF;
|
||||||
|
|
||||||
|
//Validate data range
|
||||||
|
if(!mModbusRepo->IsHRValid(StartAdress,1))
|
||||||
|
{
|
||||||
|
qDebug("Reg invalid");
|
||||||
|
//Send negative response
|
||||||
|
SendErrorResponse(Transaction,MODBUS_EXCEPTION_ILLEGAL_DATA_ADDRESS);
|
||||||
|
// emit ModbusRequestException(MODBUS_EXCEPTION_ILLEGAL_DATA_ADDRESS,MODBUS_WRITE_SINGLE_REGISTER);
|
||||||
|
ModbusRequestException(MODBUS_EXCEPTION_ILLEGAL_DATA_ADDRESS,MODBUS_WRITE_SINGLE_REGISTER);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Extract data.
|
||||||
|
QByteArray data = Transaction.mPDU.mData.right(2);
|
||||||
|
|
||||||
|
//Write register data
|
||||||
|
mModbusRepo->WriteHRData(StartAdress,1,data);
|
||||||
|
|
||||||
|
// qDebug("Slave Rx Write Single Register. Address: %d, Value: 0x%s",StartAdress, data.toHex().data());
|
||||||
|
// qDebug("Data: %s",data.toHex().data());
|
||||||
|
|
||||||
|
data = Transaction.mPDU.mData.left(4); //The response corresponds to the Reg. Address & the value. Which is the first 4 bytes of the initial request.
|
||||||
|
SendModbusResponse(Transaction, data);
|
||||||
|
// emit RegistersDatabaseUpdated(StartAdress,1);
|
||||||
|
RegistersDatabaseUpdated(StartAdress,1);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case MODBUS_FCT_WRITE_MULTIPLE_REGISTERS:
|
||||||
|
{
|
||||||
|
unsigned short StartAdress = 0;
|
||||||
|
StartAdress = Transaction.mPDU.mData[0]&0xFF;
|
||||||
|
StartAdress <<= 8;
|
||||||
|
StartAdress += Transaction.mPDU.mData[1]&0xFF;
|
||||||
|
|
||||||
|
unsigned short NbRegisters = 0;
|
||||||
|
NbRegisters = Transaction.mPDU.mData[2]&0xFF;
|
||||||
|
NbRegisters <<= 8;
|
||||||
|
NbRegisters += Transaction.mPDU.mData[3]&0xFF;
|
||||||
|
|
||||||
|
quint8 ByteCount = Transaction.mPDU.mData[4];
|
||||||
|
|
||||||
|
//Validate nb of registers
|
||||||
|
if(NbRegisters < 1 || NbRegisters > 0x7D || ByteCount != (NbRegisters*2))
|
||||||
|
{
|
||||||
|
qDebug("Invalid register number or byte count ");
|
||||||
|
SendErrorResponse(Transaction,MODBUS_EXCEPTION_ILLEGAL_DATA_VALUE);
|
||||||
|
// emit ModbusRequestException(MODBUS_EXCEPTION_ILLEGAL_DATA_VALUE,MODBUS_FCT_WRITE_MULTIPLE_REGISTERS);
|
||||||
|
ModbusRequestException(MODBUS_EXCEPTION_ILLEGAL_DATA_VALUE,MODBUS_FCT_WRITE_MULTIPLE_REGISTERS);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Validate data range
|
||||||
|
if(!mModbusRepo->IsHRValid(StartAdress,NbRegisters))
|
||||||
|
{
|
||||||
|
qDebug("Reg invalid");
|
||||||
|
//Send negative response
|
||||||
|
SendErrorResponse(Transaction,MODBUS_EXCEPTION_ILLEGAL_DATA_ADDRESS);
|
||||||
|
// emit ModbusRequestException(MODBUS_EXCEPTION_ILLEGAL_DATA_ADDRESS,MODBUS_FCT_WRITE_MULTIPLE_REGISTERS);
|
||||||
|
ModbusRequestException(MODBUS_EXCEPTION_ILLEGAL_DATA_ADDRESS,MODBUS_FCT_WRITE_MULTIPLE_REGISTERS);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Extract data.
|
||||||
|
QByteArray data = Transaction.mPDU.mData.right(ByteCount);
|
||||||
|
|
||||||
|
//Write register data
|
||||||
|
mModbusRepo->WriteHRData(StartAdress,NbRegisters,data);
|
||||||
|
|
||||||
|
// qDebug("Slave Rx Write Multiple Registers. Address: %d, Nb Reg: %d",StartAdress, NbRegisters);
|
||||||
|
// qDebug("Data: %s",data.toHex().data());
|
||||||
|
|
||||||
|
data = Transaction.mPDU.mData.left(4); //The response corresponds to the Start Adress and Nb of Regs. Which is the first 4 bytes of the initial request.
|
||||||
|
SendModbusResponse(Transaction, data);
|
||||||
|
|
||||||
|
// emit RegistersDatabaseUpdated(StartAdress,NbRegisters);
|
||||||
|
RegistersDatabaseUpdated(StartAdress,NbRegisters);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
//Received "Illegal function code". Send the exception code to master
|
||||||
|
//TODO: Log this.
|
||||||
|
qDebug("Slave received illegal function code from master: 0x%x",Transaction.mPDU.mFunctionCode);
|
||||||
|
SendErrorResponse(Transaction,MODBUS_EXCEPTION_ILLEGAL_FCT);
|
||||||
|
// emit ModbusRequestException(MODBUS_EXCEPTION_ILLEGAL_FCT,Transaction.mPDU.mFunctionCode);
|
||||||
|
ModbusRequestException(MODBUS_EXCEPTION_ILLEGAL_FCT,Transaction.mPDU.mFunctionCode);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CModbusBackend::SendModbusResponse(CModbusTransaction RequestTransaction, QByteArray Data)
|
||||||
|
{
|
||||||
|
QByteArray ModbusPacket;
|
||||||
|
|
||||||
|
QBuffer Buffer(&ModbusPacket);
|
||||||
|
Buffer.open(QIODevice::WriteOnly|QIODevice::Unbuffered);
|
||||||
|
Buffer.seek(0);
|
||||||
|
QDataStream *PacketDataStrm = new QDataStream(&Buffer);
|
||||||
|
|
||||||
|
//For a response, the header will be the same as the original request, except for the msg. length.
|
||||||
|
//Set the appropriate msg length.
|
||||||
|
RequestTransaction.mHeader.mMessageLength = Data.size() + 2; //+2 to add function code & Unit ID.
|
||||||
|
RequestTransaction.mPDU.mData = Data;
|
||||||
|
|
||||||
|
*PacketDataStrm << RequestTransaction.mHeader;
|
||||||
|
*PacketDataStrm << RequestTransaction.mPDU.mFunctionCode;
|
||||||
|
Buffer.close();
|
||||||
|
ModbusPacket.append(Data);
|
||||||
|
|
||||||
|
|
||||||
|
// qDebug("Response packet: %s",ModbusPacket.toHex().data());
|
||||||
|
|
||||||
|
mModbusTCPSocketHandle->write(ModbusPacket);
|
||||||
|
|
||||||
|
delete PacketDataStrm;
|
||||||
|
|
||||||
|
return RET_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
//In Master mode. This is the response from slave to a previously sent request.
|
||||||
|
int CModbusBackend::AnalyzeModbusResponse(CModbusTransaction Transaction)
|
||||||
|
{
|
||||||
|
if(Transaction.mHeader.mProtocolID != 0)
|
||||||
|
{
|
||||||
|
//Invalid protocol... what can we do?
|
||||||
|
return RET_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Find matching request and remove it from the queue...
|
||||||
|
CModbusRequest *Request;
|
||||||
|
bool Found = false;
|
||||||
|
for(int i = 0; i < mRequestsList.size(); i++)
|
||||||
|
{
|
||||||
|
if(mRequestsList.at(i)->mHeader.mTransactionID == Transaction.mHeader.mTransactionID)
|
||||||
|
{
|
||||||
|
Request = mRequestsList.takeAt(i); //Remove from queue and keep a copy
|
||||||
|
Request->mRequestTimer->stop(); //Stop the resend timer
|
||||||
|
Found = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(Found == false)
|
||||||
|
{
|
||||||
|
//Invalid request number. This should happen only if a very long delay exists in the comm.
|
||||||
|
//TODO: Log this...
|
||||||
|
qDebug("Master received response to a non existent request!!!");
|
||||||
|
return RET_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
//check if we have an exception response
|
||||||
|
if((Transaction.mPDU.mFunctionCode & MODBUS_EXCEPTION_FCT_MASK) != 0)
|
||||||
|
{
|
||||||
|
//we have an exception response... something went wrong.
|
||||||
|
quint8 ExceptionCode = Transaction.mPDU.mData[0];
|
||||||
|
|
||||||
|
//TODO: Manage this!
|
||||||
|
qDebug("Master Rx exception code %d to request %d",ExceptionCode,Request->mPDU.mFunctionCode);
|
||||||
|
emit ModbusResponseException(ExceptionCode,Request->mPDU.mFunctionCode);
|
||||||
|
delete Request;
|
||||||
|
return RET_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch(Transaction.mPDU.mFunctionCode)
|
||||||
|
{
|
||||||
|
case MODBUS_FCT_READ_HOLDING_REGISTERS:
|
||||||
|
{
|
||||||
|
quint8 ByteCount = 0;
|
||||||
|
ByteCount = Transaction.mPDU.mData.at(0);
|
||||||
|
|
||||||
|
if((Request->mNbRegisters*2) != ByteCount)
|
||||||
|
{
|
||||||
|
//Inconsistency between the data range and the data count.
|
||||||
|
//TODO: Log the error.
|
||||||
|
qDebug("Master eceived a wrong data size in response for a MODBUS_FCT_READ_HOLDING_REGISTERS request");
|
||||||
|
emit ModbusResponseException(MODBUS_EXCEPTION_ILLEGAL_DATA_VALUE,MODBUS_FCT_READ_HOLDING_REGISTERS);
|
||||||
|
delete Request;
|
||||||
|
return RET_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
QByteArray RegisterValues = Transaction.mPDU.mData.right(ByteCount);
|
||||||
|
|
||||||
|
|
||||||
|
// qDebug("Master Rx Read Holding Registers Response.");
|
||||||
|
// qDebug("Data: %s",RegisterValues.toHex().data());
|
||||||
|
|
||||||
|
mModbusRepo->WriteHRData(Request->mStartAddress,Request->mNbRegisters,RegisterValues);
|
||||||
|
RegistersDatabaseUpdated(Request->mStartAddress, Request->mNbRegisters);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case MODBUS_WRITE_SINGLE_REGISTER:
|
||||||
|
{
|
||||||
|
quint16 RegAddress = 0;
|
||||||
|
RegAddress = Transaction.mPDU.mData[0]&0xFF;
|
||||||
|
RegAddress <<= 8;
|
||||||
|
RegAddress += Transaction.mPDU.mData[1]&0xFF;
|
||||||
|
|
||||||
|
if(Request->mStartAddress != RegAddress)
|
||||||
|
{
|
||||||
|
//Inconsistency between the request Adress and response Adress.
|
||||||
|
//TODO: Log the error.
|
||||||
|
qDebug("Master received a wrong Register Adress in response for a MODBUS_WRITE_SINGLE_REGISTER request. Expected [%d], Rx[%d]",Request->mStartAddress, RegAddress);
|
||||||
|
emit ModbusResponseException(MODBUS_EXCEPTION_ILLEGAL_DATA_VALUE,MODBUS_WRITE_SINGLE_REGISTER);
|
||||||
|
delete Request;
|
||||||
|
return RET_ERROR;
|
||||||
|
}
|
||||||
|
// qDebug("Master Rx Write Single Register response. Address: %d,",RegAddress);
|
||||||
|
// qDebug("Data: %s",Transaction.mPDU.mData.toHex().data());
|
||||||
|
|
||||||
|
//Everything seems good.
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case MODBUS_FCT_WRITE_MULTIPLE_REGISTERS:
|
||||||
|
{
|
||||||
|
unsigned short StartAdress = 0;
|
||||||
|
StartAdress = Transaction.mPDU.mData[0]&0xFF;
|
||||||
|
StartAdress <<= 8;
|
||||||
|
StartAdress += Transaction.mPDU.mData[1]&0xFF;
|
||||||
|
|
||||||
|
unsigned short NbRegisters = 0;
|
||||||
|
NbRegisters = Transaction.mPDU.mData[2]&0xFF;
|
||||||
|
NbRegisters <<= 8;
|
||||||
|
NbRegisters += Transaction.mPDU.mData[3]&0xFF;
|
||||||
|
|
||||||
|
if(StartAdress != Request->mStartAddress || NbRegisters != Request->mNbRegisters)
|
||||||
|
{
|
||||||
|
//Inconsistency between the request Adress or NbRegisters and response.
|
||||||
|
//TODO: Log the error.
|
||||||
|
qDebug("Master Received a wrong Register Adress or NbRegisters in response for a MODBUS_FCT_WRITE_MULTIPLE_REGISTERS request");
|
||||||
|
emit ModbusResponseException(MODBUS_EXCEPTION_ILLEGAL_DATA_VALUE,MODBUS_FCT_WRITE_MULTIPLE_REGISTERS);
|
||||||
|
delete Request;
|
||||||
|
return RET_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
// qDebug("Master Rx Write Multiple Registers response. Address: %d, Nb Reg: %d",StartAdress, NbRegisters);
|
||||||
|
// qDebug("Data: %s",Transaction.mPDU.mData.toHex().data());
|
||||||
|
|
||||||
|
//All is good.
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
//Received "Illegal function code" response
|
||||||
|
//TODO: Log this.
|
||||||
|
qDebug("Master received illegal function code 0x%x",Transaction.mPDU.mFunctionCode);
|
||||||
|
emit ModbusResponseException(MODBUS_EXCEPTION_ILLEGAL_FCT,MODBUS_FCT_WRITE_MULTIPLE_REGISTERS);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
delete Request;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CModbusBackend::SendModbusRequest(CModbusRequest *Request)
|
||||||
|
{
|
||||||
|
QByteArray ModbusPacket;
|
||||||
|
|
||||||
|
QBuffer Buffer(&ModbusPacket);
|
||||||
|
Buffer.open(QIODevice::WriteOnly|QIODevice::Unbuffered);
|
||||||
|
Buffer.seek(0);
|
||||||
|
QDataStream *PacketDataStrm = new QDataStream(&Buffer);
|
||||||
|
|
||||||
|
*PacketDataStrm << Request->mHeader;
|
||||||
|
*PacketDataStrm << Request->mPDU.mFunctionCode;
|
||||||
|
Buffer.close();
|
||||||
|
ModbusPacket.append(Request->mPDU.mData);
|
||||||
|
|
||||||
|
// qDebug("Request packet: %s",ModbusPacket.toHex().data());
|
||||||
|
|
||||||
|
mModbusTCPSocketHandle->write(ModbusPacket);
|
||||||
|
mModbusTCPSocketHandle->flush();
|
||||||
|
return RET_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CModbusBackend::SendErrorResponse(CModbusTransaction RequestTransaction, quint8 ErrorCode)
|
||||||
|
{
|
||||||
|
QByteArray ModbusPacket;
|
||||||
|
|
||||||
|
QBuffer Buffer(&ModbusPacket);
|
||||||
|
Buffer.open(QIODevice::WriteOnly|QIODevice::Unbuffered);
|
||||||
|
Buffer.seek(0);
|
||||||
|
QDataStream *PacketDataStrm = new QDataStream(&Buffer);
|
||||||
|
|
||||||
|
//For a response, the header will be the same as the original request, except for the msg. length.
|
||||||
|
//Set the appropriate msg length.
|
||||||
|
RequestTransaction.mHeader.mMessageLength = 3; //Unit ID, function code & Exception code.
|
||||||
|
|
||||||
|
*PacketDataStrm << RequestTransaction.mHeader;
|
||||||
|
Buffer.close();
|
||||||
|
ModbusPacket.append(RequestTransaction.mPDU.mFunctionCode + 0x80);
|
||||||
|
ModbusPacket.append(ErrorCode);
|
||||||
|
|
||||||
|
|
||||||
|
// qDebug("Sending error code %d. Error packet: %s",ErrorCode,ModbusPacket.toHex().data());
|
||||||
|
|
||||||
|
mModbusTCPSocketHandle->write(ModbusPacket);
|
||||||
|
|
||||||
|
delete PacketDataStrm;
|
||||||
|
|
||||||
|
return RET_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int CModbusBackend::SendReadHoldingRegistersRequest(quint16 StartAddress, quint16 RegisterCount)
|
||||||
|
{
|
||||||
|
//First, validate that the reading range is within our repo
|
||||||
|
if(mModbusRepo->IsHRValid(StartAddress,RegisterCount) == false)
|
||||||
|
{
|
||||||
|
qDebug("Trying to send a read HR in an invalid range");
|
||||||
|
return RET_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Create a request.
|
||||||
|
CModbusRequest *NewRequest = new CModbusRequest;
|
||||||
|
NewRequest->mStartAddress = StartAddress;
|
||||||
|
NewRequest->mNbRegisters = RegisterCount;
|
||||||
|
connect(NewRequest->mRequestTimer,SIGNAL(timeout()),this,SLOT(RequestTimerExpired()));
|
||||||
|
|
||||||
|
NewRequest->mPDU.mData.clear();
|
||||||
|
NewRequest->mPDU.mFunctionCode = MODBUS_FCT_READ_HOLDING_REGISTERS;
|
||||||
|
|
||||||
|
quint8 HighByte, LowByte;
|
||||||
|
LowByte = StartAddress & 0x00FF;
|
||||||
|
HighByte = (StartAddress >> 8) & 0x00FF;
|
||||||
|
NewRequest->mPDU.mData.append(HighByte);
|
||||||
|
NewRequest->mPDU.mData.append(LowByte);
|
||||||
|
|
||||||
|
LowByte = RegisterCount & 0x00FF;
|
||||||
|
HighByte = (RegisterCount >> 8) & 0x00FF;
|
||||||
|
NewRequest->mPDU.mData.append(HighByte);
|
||||||
|
NewRequest->mPDU.mData.append(LowByte);
|
||||||
|
|
||||||
|
NewRequest->mHeader.mMessageLength = NewRequest->mPDU.mData.size() + 2;
|
||||||
|
NewRequest->mHeader.mProtocolID = 0;
|
||||||
|
NewRequest->mHeader.mTransactionID = (qint16)GetNewTransactionID();
|
||||||
|
NewRequest->mHeader.mUnitID = mDeviceID;
|
||||||
|
|
||||||
|
mRequestsList.append(NewRequest);
|
||||||
|
|
||||||
|
SendModbusRequest(NewRequest);
|
||||||
|
|
||||||
|
NewRequest->mRequestTimer->start(mModbusRequestTimeout);
|
||||||
|
|
||||||
|
|
||||||
|
return RET_OK;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
int CModbusBackend::SendWriteHoldingRegistersRequest(quint16 StartAddress, quint16 RegisterCount)
|
||||||
|
{
|
||||||
|
//First, validate that the reading range is within our repo
|
||||||
|
if(mModbusRepo->IsHRValid(StartAddress,RegisterCount) == false)
|
||||||
|
{
|
||||||
|
qDebug("Trying to send a read HR in an invalid range");
|
||||||
|
return RET_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(RegisterCount > MODBUS_MAX_NB_REGISTERS)
|
||||||
|
{
|
||||||
|
return RET_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Get data.
|
||||||
|
bool OK;
|
||||||
|
QByteArray RegData = mModbusRepo->GetHRData(StartAddress,RegisterCount,&OK);
|
||||||
|
if(OK == false)
|
||||||
|
{
|
||||||
|
return RET_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Create a request.
|
||||||
|
CModbusRequest *NewRequest = new CModbusRequest;
|
||||||
|
NewRequest->mStartAddress = StartAddress;
|
||||||
|
NewRequest->mNbRegisters = RegisterCount;
|
||||||
|
connect(NewRequest->mRequestTimer,SIGNAL(timeout()),this,SLOT(RequestTimerExpired()));
|
||||||
|
|
||||||
|
NewRequest->mPDU.mData.clear();
|
||||||
|
NewRequest->mPDU.mFunctionCode = MODBUS_FCT_WRITE_MULTIPLE_REGISTERS;
|
||||||
|
|
||||||
|
//Start address
|
||||||
|
quint8 HighByte, LowByte;
|
||||||
|
LowByte = StartAddress & 0x00FF;
|
||||||
|
HighByte = (StartAddress >> 8) & 0x00FF;
|
||||||
|
NewRequest->mPDU.mData.append(HighByte);
|
||||||
|
NewRequest->mPDU.mData.append(LowByte);
|
||||||
|
|
||||||
|
//Nb registers
|
||||||
|
LowByte = RegisterCount & 0x00FF;
|
||||||
|
HighByte = (RegisterCount >> 8) & 0x00FF;
|
||||||
|
NewRequest->mPDU.mData.append(HighByte);
|
||||||
|
NewRequest->mPDU.mData.append(LowByte);
|
||||||
|
|
||||||
|
//Byte Count
|
||||||
|
NewRequest->mPDU.mData.append(RegData.size());
|
||||||
|
|
||||||
|
//Datal
|
||||||
|
NewRequest->mPDU.mData.append(RegData);
|
||||||
|
|
||||||
|
NewRequest->mHeader.mMessageLength = NewRequest->mPDU.mData.size() + 2;
|
||||||
|
NewRequest->mHeader.mProtocolID = 0;
|
||||||
|
NewRequest->mHeader.mTransactionID = (qint16)GetNewTransactionID();
|
||||||
|
NewRequest->mHeader.mUnitID = mDeviceID;
|
||||||
|
|
||||||
|
mRequestsList.append(NewRequest);
|
||||||
|
|
||||||
|
SendModbusRequest(NewRequest);
|
||||||
|
|
||||||
|
NewRequest->mRequestTimer->start(mModbusRequestTimeout);
|
||||||
|
|
||||||
|
|
||||||
|
return RET_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CModbusBackend::SendWriteSingleRegisterRequest(quint16 Address)
|
||||||
|
{
|
||||||
|
if(Address == 2000)
|
||||||
|
{
|
||||||
|
qDebug("Write single reg 2000");
|
||||||
|
}
|
||||||
|
//First, validate that the reading range is within our repo
|
||||||
|
if(mModbusRepo->IsHRValid(Address,1) == false)
|
||||||
|
{
|
||||||
|
qDebug("Trying to send a read HR in an invalid range");
|
||||||
|
return RET_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Get data.
|
||||||
|
bool OK;
|
||||||
|
QByteArray RegData = mModbusRepo->GetHRData(Address,1,&OK);
|
||||||
|
if(OK == false)
|
||||||
|
{
|
||||||
|
return RET_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Create a request.
|
||||||
|
CModbusRequest *NewRequest = new CModbusRequest;
|
||||||
|
NewRequest->mStartAddress = Address;
|
||||||
|
NewRequest->mNbRegisters = 1;
|
||||||
|
connect(NewRequest->mRequestTimer,SIGNAL(timeout()),this,SLOT(RequestTimerExpired()));
|
||||||
|
|
||||||
|
NewRequest->mPDU.mData.clear();
|
||||||
|
NewRequest->mPDU.mFunctionCode = MODBUS_WRITE_SINGLE_REGISTER;
|
||||||
|
|
||||||
|
quint8 HighByte, LowByte;
|
||||||
|
LowByte = Address & 0x00FF;
|
||||||
|
HighByte = (Address >> 8) & 0x00FF;
|
||||||
|
NewRequest->mPDU.mData.append(HighByte);
|
||||||
|
NewRequest->mPDU.mData.append(LowByte);
|
||||||
|
|
||||||
|
// LowByte = RegData & 0x00FF;
|
||||||
|
// HighByte = (RegData >> 8) & 0x00FF;
|
||||||
|
// NewRequest->mPDU.mData.append(HighByte);
|
||||||
|
// NewRequest->mPDU.mData.append(LowByte);
|
||||||
|
|
||||||
|
NewRequest->mPDU.mData.append(RegData);
|
||||||
|
|
||||||
|
NewRequest->mHeader.mMessageLength = NewRequest->mPDU.mData.size() + 2;
|
||||||
|
NewRequest->mHeader.mProtocolID = 0;
|
||||||
|
NewRequest->mHeader.mTransactionID = (qint16)GetNewTransactionID();
|
||||||
|
NewRequest->mHeader.mUnitID = mDeviceID;
|
||||||
|
|
||||||
|
mRequestsList.append(NewRequest);
|
||||||
|
|
||||||
|
SendModbusRequest(NewRequest);
|
||||||
|
|
||||||
|
NewRequest->mRequestTimer->start(mModbusRequestTimeout);
|
||||||
|
|
||||||
|
|
||||||
|
return RET_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CModbusBackend::RequestTimerExpired()
|
||||||
|
{
|
||||||
|
//find the expired request
|
||||||
|
for(int i = 0; i < mRequestsList.size(); i++)
|
||||||
|
{
|
||||||
|
if(mRequestsList.at(i)->mRequestTimer->isActive() == false)
|
||||||
|
{
|
||||||
|
if(mRequestsList.at(i)->mRetries >= mModbusMaxRetry)
|
||||||
|
{
|
||||||
|
//The max number of retry has been reached. The device is probably offline.
|
||||||
|
|
||||||
|
qDebug("Modbus Master: Request sent to slave without response");
|
||||||
|
|
||||||
|
delete mRequestsList[i];
|
||||||
|
mRequestsList.removeAt(i);
|
||||||
|
|
||||||
|
|
||||||
|
//TODO: Manage this situation (log?)
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SendModbusRequest(mRequestsList[i]);
|
||||||
|
mRequestsList.at(i)->mRequestTimer->start(mModbusRequestTimeout);
|
||||||
|
mRequestsList[i]->mRetries++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
quint16 CModbusBackend::GetNewTransactionID()
|
||||||
|
{
|
||||||
|
quint16 ID = mTransactionIDCounter++;
|
||||||
|
|
||||||
|
if(mTransactionIDCounter == 0xFFFF - 10)
|
||||||
|
{
|
||||||
|
mTransactionIDCounter = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CModbusRequest::CModbusRequest():
|
||||||
|
mRetries(0)
|
||||||
|
{
|
||||||
|
mRequestTimer = new QTimer;
|
||||||
|
mRequestTimer->setSingleShot(true);
|
||||||
|
}
|
||||||
|
CModbusRequest::~CModbusRequest()
|
||||||
|
{
|
||||||
|
delete mRequestTimer;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
QDataStream &operator<<(QDataStream &out, const CModbusHeader &source)
|
||||||
|
{
|
||||||
|
out << source.mTransactionID
|
||||||
|
<< source.mProtocolID
|
||||||
|
<< source.mMessageLength
|
||||||
|
<< source.mUnitID
|
||||||
|
;
|
||||||
|
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
QDataStream &operator>>(QDataStream &in, CModbusHeader &dest)
|
||||||
|
{
|
||||||
|
in >> dest.mTransactionID
|
||||||
|
>> dest.mProtocolID
|
||||||
|
>> dest.mMessageLength
|
||||||
|
>> dest.mUnitID
|
||||||
|
;
|
||||||
|
|
||||||
|
return in;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Virtual function that should not even get called...
|
||||||
|
void CModbusBackend::ModbusResponseException(quint8 ExceptionCode, quint8 FctCode)
|
||||||
|
{
|
||||||
|
qDebug("ModbusResponseException called from within slave object... weird stuff!");
|
||||||
|
}
|
||||||
|
|
||||||
|
//Virtual function that should not even get called...
|
||||||
|
void CModbusBackend::ModbusRequestException(quint8 ExceptionCode, quint8 FctCode)
|
||||||
|
{
|
||||||
|
qDebug("ModbusResponseException called from within master object... weird stuff!");
|
||||||
|
}
|
||||||
@@ -0,0 +1,170 @@
|
|||||||
|
#ifndef CMODBUSBACKEND_H
|
||||||
|
#define CMODBUSBACKEND_H
|
||||||
|
#include <QObject>
|
||||||
|
#include <QTcpSocket>
|
||||||
|
#include "ModbusRepository.h"
|
||||||
|
#include <QTimer>
|
||||||
|
|
||||||
|
|
||||||
|
#define MODBUS_EXCEPTION_FCT_MASK 0x80
|
||||||
|
#define MODBUS_RETRY_DELAY 2000 //millisecs
|
||||||
|
#define MODBUS_RETRY_MAX_COUNT 2 //resend an unanswered request this many times
|
||||||
|
#define MODBUS_MAX_NB_REGISTERS 0x7D
|
||||||
|
|
||||||
|
enum eModbusFunctions
|
||||||
|
{
|
||||||
|
MODBUS_FCT_READ_HOLDING_REGISTERS = 3,
|
||||||
|
MODBUS_WRITE_SINGLE_REGISTER = 6,
|
||||||
|
MODBUS_FCT_WRITE_MULTIPLE_REGISTERS = 16
|
||||||
|
};
|
||||||
|
|
||||||
|
enum eModbusExceptionCodes
|
||||||
|
{
|
||||||
|
MODBUS_EXCEPTION_ILLEGAL_FCT = 1,
|
||||||
|
MODBUS_EXCEPTION_ILLEGAL_DATA_ADDRESS = 2,
|
||||||
|
MODBUS_EXCEPTION_ILLEGAL_DATA_VALUE = 3,
|
||||||
|
MODBUS_EXCEPTION_SERVER_DEVICE_FAILURE = 4,
|
||||||
|
MODBUS_EXCEPTION_ACKNOWLEDGE = 5,
|
||||||
|
MODBUS_EXCEPTION_SERVER_DEVICE_BUSY = 6,
|
||||||
|
MODBUS_EXCEPTION_MEMORY_PARITY_ERROR = 8,
|
||||||
|
MODBUS_EXCEPTION_GATEWAY_PATH_UNAVAILABLE = 10,
|
||||||
|
MODBUS_EXCEPTION_GATEWAY_TARGET_DEV_NOT_RESPONDING = 11
|
||||||
|
};
|
||||||
|
|
||||||
|
enum eModbusModes
|
||||||
|
{
|
||||||
|
MODBUS_MASTER_MODE,
|
||||||
|
MODBUS_SLAVE_MODE,
|
||||||
|
MODBUS_INVALID_MODE
|
||||||
|
};
|
||||||
|
|
||||||
|
class CModbusException
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
class CModbusPDU
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
qint8 mFunctionCode;
|
||||||
|
QByteArray mData;
|
||||||
|
};
|
||||||
|
|
||||||
|
class CModbusHeader
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
qint16 mTransactionID;
|
||||||
|
qint16 mProtocolID;
|
||||||
|
qint16 mMessageLength;
|
||||||
|
qint8 mUnitID;
|
||||||
|
};
|
||||||
|
|
||||||
|
class CModbusTransaction
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CModbusHeader mHeader;
|
||||||
|
CModbusPDU mPDU;
|
||||||
|
};
|
||||||
|
|
||||||
|
class CModbusRequest : public CModbusTransaction
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CModbusRequest();
|
||||||
|
~CModbusRequest();
|
||||||
|
int mRetries;
|
||||||
|
QTimer *mRequestTimer;
|
||||||
|
quint16 mStartAddress, mNbRegisters; //For convinience...
|
||||||
|
};
|
||||||
|
|
||||||
|
class CModbusBackend : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
enum eModbusMasterSMStates
|
||||||
|
{
|
||||||
|
MODBUS_SM_WAIT_FOR__STATE
|
||||||
|
};
|
||||||
|
|
||||||
|
enum eModbusSlaveSMStates
|
||||||
|
{
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
public:
|
||||||
|
CModbusBackend(CModbusRepository *Repo);
|
||||||
|
virtual ~CModbusBackend();
|
||||||
|
QTcpSocket *mModbusTCPSocketHandle;
|
||||||
|
CModbusRepository *mModbusRepo;
|
||||||
|
|
||||||
|
bool mDataLinkValid;
|
||||||
|
int mModbusMode;
|
||||||
|
|
||||||
|
|
||||||
|
void SetDeviceID(qint8 ID){mDeviceID = ID;}
|
||||||
|
|
||||||
|
//Master (client)
|
||||||
|
int SendReadHoldingRegistersRequest(quint16 StartAddress, quint16 RegisterCount);
|
||||||
|
int SendWriteHoldingRegistersRequest(quint16 StartAddress, quint16 RegisterCount);
|
||||||
|
int SendWriteSingleRegisterRequest(quint16 Address);
|
||||||
|
|
||||||
|
void ModbusLinkDisconnected();
|
||||||
|
|
||||||
|
|
||||||
|
virtual void RegistersDatabaseUpdated(quint16 StartAdderss, quint16 Length) = 0;
|
||||||
|
|
||||||
|
//Master signals
|
||||||
|
virtual void ModbusResponseException(quint8 ExceptionCode, quint8 FctCode);
|
||||||
|
|
||||||
|
// //Slave signals
|
||||||
|
virtual void ModbusRequestException(quint8 ExceptionCode, quint8 FctCode);
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
qint8 mDeviceID;
|
||||||
|
|
||||||
|
//Slave (server)
|
||||||
|
int AnalyzeModbusRequest(CModbusTransaction Transaction);
|
||||||
|
int ModbusStateMachine(int Event, QByteArray Data);
|
||||||
|
int SendModbusResponse(CModbusTransaction RequestTransaction, QByteArray Data);
|
||||||
|
int SendErrorResponse(CModbusTransaction RequestTransaction, quint8 ErrorCode);
|
||||||
|
|
||||||
|
//Master (client)
|
||||||
|
QList<CModbusRequest*> mRequestsList;
|
||||||
|
int SendModbusRequest(CModbusRequest *Request);
|
||||||
|
quint16 GetNewTransactionID();
|
||||||
|
int AnalyzeModbusResponse(CModbusTransaction Transaction);
|
||||||
|
|
||||||
|
quint16 mTransactionIDCounter;
|
||||||
|
int mModbusRequestTimeout;
|
||||||
|
int mModbusMaxRetry;
|
||||||
|
|
||||||
|
signals:
|
||||||
|
|
||||||
|
// void RegistersDatabaseUpdated(quint16 StartAdderss, quint16 Length);
|
||||||
|
|
||||||
|
// //Master signals
|
||||||
|
// void ModbusResponseException(quint8 ExceptionCode, quint8 FctCode);
|
||||||
|
|
||||||
|
//// //Slave signals
|
||||||
|
// void ModbusRequestException(quint8 ExceptionCode, quint8 FctCode);
|
||||||
|
|
||||||
|
void ModbusRX();
|
||||||
|
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void ModbusDataReady();
|
||||||
|
void RequestTimerExpired();
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
QDataStream &operator<<(QDataStream &out, const CModbusHeader &source);
|
||||||
|
QDataStream &operator>>(QDataStream &in, CModbusHeader &dest);
|
||||||
|
|
||||||
|
#endif // CMODBUSBACKEND_H
|
||||||
@@ -0,0 +1,113 @@
|
|||||||
|
#include "ModbusMaster.h"
|
||||||
|
#include <QTcpSocket>
|
||||||
|
#include "ProtocolDefs.h"
|
||||||
|
|
||||||
|
CModbusMaster::CModbusMaster(CModbusRepository *Repo):
|
||||||
|
CModbusBackend(Repo)
|
||||||
|
{
|
||||||
|
// connect(mModbusTCPSocketHandle,SIGNAL(readyRead()),this,SLOT(ModbusDataReady()));
|
||||||
|
mModbusMode = MODBUS_MASTER_MODE;
|
||||||
|
|
||||||
|
mModbusTCPSocketHandle = new QTcpSocket();
|
||||||
|
connect(mModbusTCPSocketHandle,SIGNAL(readyRead()),this,SLOT(ModbusDataReady()));
|
||||||
|
connect(mModbusTCPSocketHandle,SIGNAL(disconnected()),this,SLOT(SocketDisconnected()));
|
||||||
|
connect(mModbusTCPSocketHandle,SIGNAL(connected()),this,SLOT(SocketConnected()));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CModbusMaster::~CModbusMaster()
|
||||||
|
{
|
||||||
|
if(mModbusTCPSocketHandle->state() != QAbstractSocket::UnconnectedState)
|
||||||
|
{
|
||||||
|
mModbusTCPSocketHandle->disconnectFromHost();
|
||||||
|
mModbusTCPSocketHandle->waitForDisconnected(1000);
|
||||||
|
}
|
||||||
|
delete mModbusTCPSocketHandle;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CModbusMaster::ConnectToSlave(QString SlaveIP, int SlavePort)
|
||||||
|
{
|
||||||
|
if(mModbusTCPSocketHandle->state() != QAbstractSocket::UnconnectedState)
|
||||||
|
{
|
||||||
|
return RET_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
mModbusTCPSocketHandle->connectToHost(SlaveIP,SlavePort);
|
||||||
|
|
||||||
|
return RET_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CModbusMaster::DisconnectFromSlave()
|
||||||
|
{
|
||||||
|
if(mModbusTCPSocketHandle->state() != QAbstractSocket::ConnectedState)
|
||||||
|
{
|
||||||
|
qDebug("Trying to disconnect a non connected socket");
|
||||||
|
mModbusTCPSocketHandle->disconnectFromHost();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
qDebug("Requesting Disconnection...");
|
||||||
|
mModbusTCPSocketHandle->disconnectFromHost();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CModbusMaster::SocketConnected()
|
||||||
|
{
|
||||||
|
emit ModbusMasterConnected(this);
|
||||||
|
qDebug("Master: Connection established with slave");
|
||||||
|
}
|
||||||
|
|
||||||
|
void CModbusMaster::SocketDisconnected()
|
||||||
|
{
|
||||||
|
ModbusLinkDisconnected();
|
||||||
|
emit ModbusMasterDisconnected(this);
|
||||||
|
mModbusTCPSocketHandle->flush();
|
||||||
|
}
|
||||||
|
|
||||||
|
int CModbusMaster::ReadModbusRegisters()
|
||||||
|
{
|
||||||
|
return SendReadHoldingRegistersRequest(MODBUS_ZT_DATA_BASE_REG,MODBUS_ZT_TABLE_DATA_SIZE); //Read all registers from ZT (2000 - 2027)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CModbusMaster::RegistersDatabaseUpdated(quint16 StartAddress, quint16 Length)
|
||||||
|
{
|
||||||
|
emit ModbusMasterRepositoryUpdated();
|
||||||
|
// qDebug("Database updated with ZT data...");
|
||||||
|
}
|
||||||
|
|
||||||
|
void CModbusMaster::ModbusResponseException(quint8 ExceptionCode, quint8 FctCode)
|
||||||
|
{
|
||||||
|
qDebug("Modbus MASTER exception: code:%d Fct:%d",ExceptionCode,FctCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
int CModbusMaster::SendAN1ToZT()
|
||||||
|
{
|
||||||
|
//return SendWriteHoldingRegistersRequest(CC_AN1_REGISTER_ADDRESS,1);
|
||||||
|
return SendWriteSingleRegisterRequest(MODBUS_CC_AN_BASE_REG_ADD);
|
||||||
|
}
|
||||||
|
|
||||||
|
int CModbusMaster::SendAN2ToZT()
|
||||||
|
{
|
||||||
|
//return SendWriteHoldingRegistersRequest(CC_AN2_REGISTER_ADDRESS,1);
|
||||||
|
return SendWriteSingleRegisterRequest(MODBUS_CC_AN_BASE_REG_ADD);
|
||||||
|
}
|
||||||
|
|
||||||
|
int CModbusMaster::SendWatchdog()
|
||||||
|
{
|
||||||
|
return SendWriteSingleRegisterRequest(MODBUS_CC_WATCHDOG_BASE_REG_ADD);
|
||||||
|
}
|
||||||
|
int CModbusMaster::SendDateTime()
|
||||||
|
{
|
||||||
|
return SendWriteHoldingRegistersRequest(MODBUS_CC_CLK_UPDATE_BASE_REG_ADD,5);
|
||||||
|
}
|
||||||
|
|
||||||
|
int CModbusMaster::SendTrainData()
|
||||||
|
{
|
||||||
|
return SendWriteHoldingRegistersRequest(MODBUS_CC_ZT1_TRAIN_TYPE_REG_ADD,8);
|
||||||
|
}
|
||||||
|
|
||||||
|
int CModbusMaster::SendZTInhibitionData()
|
||||||
|
{
|
||||||
|
return SendWriteSingleRegisterRequest(MODBUS_CC_AN_BASE_REG_ADD);
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
#ifndef CMODBUSMASTER_H
|
||||||
|
#define CMODBUSMASTER_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include "ModbusBackend.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class CModbusMaster : public CModbusBackend
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit CModbusMaster(CModbusRepository *Repo);
|
||||||
|
~CModbusMaster();
|
||||||
|
|
||||||
|
int ConnectToSlave(QString SlaveIP, int SlavePort);
|
||||||
|
int DisconnectFromSlave();
|
||||||
|
int ReadModbusRegisters();
|
||||||
|
int SendAN1ToZT();
|
||||||
|
int SendAN2ToZT();
|
||||||
|
int SendWatchdog();
|
||||||
|
int SendDateTime();
|
||||||
|
int SendTrainData();
|
||||||
|
int SendZTInhibitionData();
|
||||||
|
|
||||||
|
virtual void RegistersDatabaseUpdated(quint16 StartAddress, quint16 Length);
|
||||||
|
virtual void ModbusResponseException(quint8 ExceptionCode, quint8 FctCode);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void ModbusMasterConnected(CModbusMaster *);
|
||||||
|
void ModbusMasterDisconnected(CModbusMaster *);
|
||||||
|
void ModbusMasterRepositoryUpdated();
|
||||||
|
void ModbusTransaction();
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void SocketConnected();
|
||||||
|
void SocketDisconnected();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CMODBUSMASTER_H
|
||||||
@@ -0,0 +1,509 @@
|
|||||||
|
#include "ModbusPage.h"
|
||||||
|
#include "ui_CModbusPage.h"
|
||||||
|
#include <QFont>
|
||||||
|
#include <QPalette>
|
||||||
|
#include "OutilModbus.h"
|
||||||
|
#include <QMessageBox>
|
||||||
|
#include <QFont>
|
||||||
|
|
||||||
|
CModbusPage::CModbusPage(QWidget *parent) :
|
||||||
|
QWidget(parent),
|
||||||
|
ui(new Ui::CModbusPage)
|
||||||
|
{
|
||||||
|
mProgramHandle = 0;
|
||||||
|
ui->setupUi(this);
|
||||||
|
QFont font;
|
||||||
|
font.setPointSize(18);
|
||||||
|
ui->mSimCCTitleLabel->setFont(font);
|
||||||
|
ui->mSimCCTitleLabel->setAlignment(Qt::AlignCenter);
|
||||||
|
QPalette pal = QPalette(ui->mSimCCTitleLabel->palette());
|
||||||
|
pal.setColor(QPalette::WindowText,QColor(Qt::darkBlue));
|
||||||
|
ui->mSimCCTitleLabel->setPalette(pal);
|
||||||
|
|
||||||
|
ui->mCCEventsList->show();
|
||||||
|
|
||||||
|
pal.setColor(QPalette::WindowText,Qt::darkGreen);
|
||||||
|
|
||||||
|
ui->mPPI1ZT1AlarmLabel->setPalette(pal);
|
||||||
|
ui->mPPEZT1AlarmLabel->setPalette(pal);
|
||||||
|
ui->mFNZT1AlarmLabel->setPalette(pal);
|
||||||
|
ui->mPGZT1AlarmLabel->setPalette(pal);
|
||||||
|
ui->mV00AlarmLabel->setPalette(pal);
|
||||||
|
ui->mPEQ1AlarmLabel->setPalette(pal);
|
||||||
|
|
||||||
|
ui->mPPIZT2AlarmLabel->setPalette(pal);
|
||||||
|
ui->mPPEZT2AlarmLabel->setPalette(pal);
|
||||||
|
ui->mV02AlarmLabel->setPalette(pal);
|
||||||
|
ui->mPEQ2AlarmLabel->setPalette(pal);
|
||||||
|
|
||||||
|
connect(ui->mConnectBtn,SIGNAL(clicked()),this,SLOT(ConnectToSlaveBtnClicked()));
|
||||||
|
connect(ui->mSendModbusReadBtn,SIGNAL(clicked()),this,SLOT(ReadModbusBtnClicked()));
|
||||||
|
connect(ui->mAN1Btn,SIGNAL(clicked()),this,SLOT(SendAN1BtnClicked()));
|
||||||
|
connect(ui->mAN2Btn,SIGNAL(clicked()),this,SLOT(SendAN2BtnClicked()));
|
||||||
|
connect(ui->mDateTimeBtn,SIGNAL(clicked()),this,SLOT(SendDateTimeBtnClicked()));
|
||||||
|
connect(ui->mSetTrainParamBtn,SIGNAL(clicked()),this,SLOT(SendTrainInfoBtnClicked()));
|
||||||
|
|
||||||
|
connect(ui->mAutoRequestChkBx,SIGNAL(stateChanged(int)),this,SLOT(AutoSendRequestsCheckboxClicked(int)));
|
||||||
|
connect(ui->mStayOnTopChkBx,SIGNAL(stateChanged(int)),this,SLOT(StayOnTopBtnClicked(int)));
|
||||||
|
|
||||||
|
ui->mCCModbusTable->hide();
|
||||||
|
ui->mWatchdogChkBx->setCheckState(Qt::Checked);
|
||||||
|
connect(ui->mWatchdogChkBx,SIGNAL(stateChanged(int)),this,SLOT(WatchdogChkBxChanged(int)));
|
||||||
|
|
||||||
|
QList<QTreeWidgetItem *> Items;
|
||||||
|
ui->mCCModbusDataTree->setColumnCount(3);
|
||||||
|
ui->mCCModbusDataTree->setHeaderItem(new QTreeWidgetItem(QStringList()<<"Flag/Alarme"<<"Valeur"<<"Rang"));
|
||||||
|
|
||||||
|
//Items.append(new QTreeWidgetItem(QStringList(QString().fromUtf8("Pneu De Guidage ZT1 #2") << QString().fromUtf8("Pneu De Guidage ZT1 #2") << QString().fromUtf8("Pneu De Guidage ZT1 #2"))));
|
||||||
|
Items.append(new QTreeWidgetItem(QStringList()<<"ZT1"));
|
||||||
|
Items.append(new QTreeWidgetItem(QStringList()<<"ZT2"));
|
||||||
|
Items.append(new QTreeWidgetItem(QStringList()<<"ZT"));
|
||||||
|
|
||||||
|
QTreeWidgetItem* Item;
|
||||||
|
// Item = new QTreeWidgetItem(QStringList()<<QString().fromUtf8("Alarmes"));
|
||||||
|
// Items.at(0)->addChild(Item);
|
||||||
|
|
||||||
|
Item = Items.at(0);
|
||||||
|
|
||||||
|
Item->addChild(new QTreeWidgetItem(QStringList()<<QString().fromUtf8("Pneu Porteur Intérieur ZT1 #1")<<"0"<<"---"));
|
||||||
|
Item->addChild(new QTreeWidgetItem(QStringList()<<QString().fromUtf8("Pneu Porteur Intérieur ZT1 #2")<<"0"<<"---"));
|
||||||
|
Item->addChild(new QTreeWidgetItem(QStringList()<<QString().fromUtf8("Pneu Porteur Intérieur ZT1 #3")<<"0"<<"---"));
|
||||||
|
Item->addChild(new QTreeWidgetItem(QStringList()<<QString().fromUtf8("Pneu Porteur Intérieur ZT1 #4")<<"0"<<"---"));
|
||||||
|
|
||||||
|
Item->addChild(new QTreeWidgetItem(QStringList()<<QString().fromUtf8("Pneu Porteur Extérieur ZT1 #1")<<"0"<<"---"));
|
||||||
|
Item->addChild(new QTreeWidgetItem(QStringList()<<QString().fromUtf8("Pneu Porteur Extérieur ZT1 #2")<<"0"<<"---"));
|
||||||
|
Item->addChild(new QTreeWidgetItem(QStringList()<<QString().fromUtf8("Pneu Porteur Extérieur ZT1 #3")<<"0"<<"---"));
|
||||||
|
Item->addChild(new QTreeWidgetItem(QStringList()<<QString().fromUtf8("Pneu Porteur Extérieur ZT1 #4")<<"0"<<"---"));
|
||||||
|
|
||||||
|
Item->addChild(new QTreeWidgetItem(QStringList()<<QString().fromUtf8("Pneu De Guidage ZT1 #1")<<"0"<<"---"));
|
||||||
|
Item->addChild(new QTreeWidgetItem(QStringList()<<QString().fromUtf8("Pneu De Guidage ZT1 #2")<<"0"<<"---"));
|
||||||
|
Item->addChild(new QTreeWidgetItem(QStringList()<<QString().fromUtf8("Pneu De Guidage ZT1 #3")<<"0"<<"---"));
|
||||||
|
Item->addChild(new QTreeWidgetItem(QStringList()<<QString().fromUtf8("Pneu De Guidage ZT1 #4")<<"0"<<"---"));
|
||||||
|
|
||||||
|
Item ->addChild(new QTreeWidgetItem(QStringList()<<QString().fromUtf8("Frotteur Négatif ZT1 #1")<<"0"<<"---"));
|
||||||
|
Item->addChild(new QTreeWidgetItem(QStringList()<<QString().fromUtf8("Frotteur Négatif ZT1 #2")<<"0"<<"---"));
|
||||||
|
Item->addChild(new QTreeWidgetItem(QStringList()<<QString().fromUtf8("Frotteur Négatif ZT1 #3")<<"0"<<"---"));
|
||||||
|
Item->addChild(new QTreeWidgetItem(QStringList()<<QString().fromUtf8("Frotteur Négatif ZT1 #4")<<"0"<<"---"));
|
||||||
|
|
||||||
|
Item->addChild(new QTreeWidgetItem(QStringList()<<QString().fromUtf8("Itinéraire")<<"0"<<"---"));
|
||||||
|
|
||||||
|
Item->addChild(new QTreeWidgetItem(QStringList()<<QString().fromUtf8("Alarme V00 ZT1")<<"0"<<"---"));
|
||||||
|
Item->addChild(new QTreeWidgetItem(QStringList()<<QString().fromUtf8("Panne Équipement ZT1")<<"0"<<"---"));
|
||||||
|
|
||||||
|
Item = Items.at(1);
|
||||||
|
|
||||||
|
Item->addChild(new QTreeWidgetItem(QStringList()<<QString().fromUtf8("Pneu Porteur Intérieur ZT2 #1")<<"0"<<"---"));
|
||||||
|
Item->addChild(new QTreeWidgetItem(QStringList()<<QString().fromUtf8("Pneu Porteur Intérieur ZT2 #2")<<"0"<<"---"));
|
||||||
|
Item->addChild(new QTreeWidgetItem(QStringList()<<QString().fromUtf8("Pneu Porteur Intérieur ZT2 #3")<<"0"<<"---"));
|
||||||
|
Item->addChild(new QTreeWidgetItem(QStringList()<<QString().fromUtf8("Pneu Porteur Intérieur ZT2 #4")<<"0"<<"---"));
|
||||||
|
|
||||||
|
// Items.at(1)->addChild(new QTreeWidgetItem(QStringList()<<QString().fromUtf8(" ")));
|
||||||
|
|
||||||
|
Item->addChild(new QTreeWidgetItem(QStringList()<<QString().fromUtf8("Pneu Porteur Extérieur ZT2 #1")<<"0"<<"---"));
|
||||||
|
Item->addChild(new QTreeWidgetItem(QStringList()<<QString().fromUtf8("Pneu Porteur Extérieur ZT2 #2")<<"0"<<"---"));
|
||||||
|
Item->addChild(new QTreeWidgetItem(QStringList()<<QString().fromUtf8("Pneu Porteur Extérieur ZT2 #3")<<"0"<<"---"));
|
||||||
|
Item->addChild(new QTreeWidgetItem(QStringList()<<QString().fromUtf8("Pneu Porteur Extérieur ZT2 #4")<<"0"<<"---"));
|
||||||
|
|
||||||
|
Item->addChild(new QTreeWidgetItem(QStringList()<<QString().fromUtf8("Alarme V02 ZT2")<<"0"<<"---"));
|
||||||
|
Item->addChild(new QTreeWidgetItem(QStringList()<<QString().fromUtf8("Panne Équipement ZT2")<<"0"<<"---"));
|
||||||
|
|
||||||
|
Item = Items.at(2);
|
||||||
|
Item->addChild(new QTreeWidgetItem(QStringList()<<QString().fromUtf8("Watchdog ZT")<<"0"<<"---"));
|
||||||
|
|
||||||
|
|
||||||
|
ui->mCCModbusDataTree->insertTopLevelItems(0,Items);
|
||||||
|
ui->mCCModbusDataTree->resizeColumnToContents(1);
|
||||||
|
|
||||||
|
ui->mCCModbusDataTree->expandAll();
|
||||||
|
ui->mCCModbusDataTree->resizeColumnToContents(0);
|
||||||
|
|
||||||
|
// ui->mCCModbusDataTree->topLevelItem(0)->addChild(new QTreeWidgetItem(QStringList() << "TEST" << "TEST"));
|
||||||
|
|
||||||
|
|
||||||
|
mLedONPixmap = QPixmap("./images/green-led-on-md.png").scaled(20,20);
|
||||||
|
mLedOFFPixmap = QPixmap("./images/green-led-off-md.png").scaled(20,20);
|
||||||
|
ui->mActivityBitmap->setPixmap(mLedOFFPixmap);
|
||||||
|
|
||||||
|
ui->mZT1TrainTypeBox->addItem("MR63");
|
||||||
|
ui->mZT1TrainTypeBox->addItem("MR73");
|
||||||
|
ui->mZT1TrainTypeBox->addItem("MPM10");
|
||||||
|
ui->mZT1TrainTypeBox->addItem("Travaux");
|
||||||
|
ui->mZT1TrainTypeBox->addItem("97");
|
||||||
|
ui->mZT1TrainTypeBox->addItem("98");
|
||||||
|
ui->mZT1TrainTypeBox->addItem("99");
|
||||||
|
|
||||||
|
ui->mZT2TrainTypeBox->addItem("MR63");
|
||||||
|
ui->mZT2TrainTypeBox->addItem("MR73");
|
||||||
|
ui->mZT2TrainTypeBox->addItem("MPM10");
|
||||||
|
ui->mZT2TrainTypeBox->addItem("Travaux");
|
||||||
|
ui->mZT2TrainTypeBox->addItem("97");
|
||||||
|
ui->mZT2TrainTypeBox->addItem("98");
|
||||||
|
ui->mZT2TrainTypeBox->addItem("99");
|
||||||
|
|
||||||
|
ui->mZT1Compo1->setValue(100);
|
||||||
|
ui->mZT1Compo2->setValue(200);
|
||||||
|
ui->mZT1Compo3->setValue(300);
|
||||||
|
|
||||||
|
ui->mZT2Compo1->setValue(100);
|
||||||
|
ui->mZT2Compo2->setValue(200);
|
||||||
|
ui->mZT2Compo3->setValue(300);
|
||||||
|
}
|
||||||
|
|
||||||
|
CModbusPage::~CModbusPage()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CModbusPage::ConnectToSlaveBtnClicked()
|
||||||
|
{
|
||||||
|
if(ui->mConnectBtn->text() == QString::fromUtf8("Déconnecter"))
|
||||||
|
{
|
||||||
|
if(mProgramHandle->DisconnectCCFromZTButtonPressed() == 0)
|
||||||
|
{
|
||||||
|
MasterDisconnected();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
bool OK = false;
|
||||||
|
QString IP = ui->mZTIPAddressLineEdit->text();
|
||||||
|
if(IP.isEmpty())
|
||||||
|
{
|
||||||
|
QMessageBox::warning(this,"Adresse IP invalide","Veuillez spécifier une adresse IP");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int Port = ui->mZTPortLineEdit->text().toInt(&OK,10);
|
||||||
|
if(OK == false)
|
||||||
|
{
|
||||||
|
QMessageBox::warning(this,"Numéro de port invalide","Port invalide, vérifier le numéro de port");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(mProgramHandle->ConnectCCToZTButtonPressed(IP,Port) == 0)
|
||||||
|
{
|
||||||
|
QMessageBox::warning(this,"Paramètres invalides","Paramètres IP ou Port invalides.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CModbusPage::MasterConnected()
|
||||||
|
{
|
||||||
|
ui->mConnectBtn->setText(QString::fromUtf8("Déconnecter"));
|
||||||
|
}
|
||||||
|
|
||||||
|
void CModbusPage::MasterDisconnected()
|
||||||
|
{
|
||||||
|
ui->mConnectBtn->setText("Connecter");
|
||||||
|
ui->mAutoRequestChkBx->setChecked(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CModbusPage::ReadModbusBtnClicked()
|
||||||
|
{
|
||||||
|
mProgramHandle->SendMasterReadCommand();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CModbusPage::UpdateZTInfo(CZTInfo *DataStruct)
|
||||||
|
{
|
||||||
|
|
||||||
|
QTreeWidgetItem* Item;
|
||||||
|
QString TempStr;
|
||||||
|
|
||||||
|
//ZT1
|
||||||
|
Item = ui->mCCModbusDataTree->topLevelItem(0);
|
||||||
|
|
||||||
|
Item->child(0)->setText(1,QString("%1").arg(DataStruct->mZT1PPIAlarmFlag1));
|
||||||
|
Item->child(1)->setText(1,QString("%1").arg(DataStruct->mZT1PPIAlarmFlag2));
|
||||||
|
Item->child(2)->setText(1,QString("%1").arg(DataStruct->mZT1PPIAlarmFlag3));
|
||||||
|
Item->child(3)->setText(1,QString("%1").arg(DataStruct->mZT1PPIAlarmFlag4));
|
||||||
|
|
||||||
|
Item->child(4)->setText(1,QString("%1").arg(DataStruct->mZT1PPEAlarmFlag1));
|
||||||
|
Item->child(5)->setText(1,QString("%1").arg(DataStruct->mZT1PPEAlarmFlag2));
|
||||||
|
Item->child(6)->setText(1,QString("%1").arg(DataStruct->mZT1PPEAlarmFlag3));
|
||||||
|
Item->child(7)->setText(1,QString("%1").arg(DataStruct->mZT1PPEAlarmFlag4));
|
||||||
|
|
||||||
|
Item->child(8)->setText(1,QString("%1").arg(DataStruct->mZT1PGAlarmFlag1));
|
||||||
|
Item->child(9)->setText(1,QString("%1").arg(DataStruct->mZT1PGAlarmFlag2));
|
||||||
|
Item->child(10)->setText(1,QString("%1").arg(DataStruct->mZT1PGAlarmFlag3));
|
||||||
|
Item->child(11)->setText(1,QString("%1").arg(DataStruct->mZT1PGAlarmFlag4));
|
||||||
|
|
||||||
|
Item->child(12)->setText(1,QString("%1").arg(DataStruct->mZT1FNAlarmFlag1));
|
||||||
|
Item->child(13)->setText(1,QString("%1").arg(DataStruct->mZT1FNAlarmFlag2));
|
||||||
|
Item->child(14)->setText(1,QString("%1").arg(DataStruct->mZT1FNAlarmFlag3));
|
||||||
|
Item->child(15)->setText(1,QString("%1").arg(DataStruct->mZT1FNAlarmFlag4));
|
||||||
|
|
||||||
|
if(DataStruct->mITI10_12Flag == 0)
|
||||||
|
{
|
||||||
|
TempStr = "Principal";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TempStr = "Secondaire";
|
||||||
|
}
|
||||||
|
Item->child(16)->setText(1,TempStr);
|
||||||
|
|
||||||
|
Item->child(17)->setText(1,QString("%1").arg(DataStruct->mZT1V00AlarmFlag));
|
||||||
|
Item->child(18)->setText(1,QString("%1").arg(DataStruct->mZT1PEQ1AlarmFlag));
|
||||||
|
|
||||||
|
for(int i = 0; i < 16; i++)
|
||||||
|
{
|
||||||
|
Item->child(i)->setText(2,QString("%1").arg(DataStruct->mZT1Ranks.at(i)));
|
||||||
|
}
|
||||||
|
|
||||||
|
//ZT2
|
||||||
|
Item = ui->mCCModbusDataTree->topLevelItem(1);
|
||||||
|
|
||||||
|
Item->child(0)->setText(1,QString("%1").arg(DataStruct->mZT2PPIAlarmFlag1));
|
||||||
|
Item->child(1)->setText(1,QString("%1").arg(DataStruct->mZT2PPIAlarmFlag2));
|
||||||
|
Item->child(2)->setText(1,QString("%1").arg(DataStruct->mZT2PPIAlarmFlag3));
|
||||||
|
Item->child(3)->setText(1,QString("%1").arg(DataStruct->mZT2PPIAlarmFlag4));
|
||||||
|
|
||||||
|
Item->child(4)->setText(1,QString("%1").arg(DataStruct->mZT2PPEAlarmFlag1));
|
||||||
|
Item->child(5)->setText(1,QString("%1").arg(DataStruct->mZT2PPEAlarmFlag2));
|
||||||
|
Item->child(6)->setText(1,QString("%1").arg(DataStruct->mZT2PPEAlarmFlag3));
|
||||||
|
Item->child(7)->setText(1,QString("%1").arg(DataStruct->mZT2PPEAlarmFlag4));
|
||||||
|
|
||||||
|
Item->child(8)->setText(1,QString("%1").arg(DataStruct->mZT2V02AlarmFlag));
|
||||||
|
Item->child(9)->setText(1,QString("%1").arg(DataStruct->mZT2PEQ2AlarmFlag));
|
||||||
|
|
||||||
|
for(int i = 0; i < 8; i++)
|
||||||
|
{
|
||||||
|
Item->child(i)->setText(2,QString("%1").arg(DataStruct->mZT2Ranks.at(i)));
|
||||||
|
}
|
||||||
|
|
||||||
|
//Watchdog
|
||||||
|
Item = ui->mCCModbusDataTree->topLevelItem(2);
|
||||||
|
Item->child(0)->setText(1,QString("%1").arg(DataStruct->mWatchdogZT));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// QPalette OffPal = QPalette(ui->mSimCCTitleLabel->palette());
|
||||||
|
// QPalette OnPal = QPalette(ui->mSimCCTitleLabel->palette());
|
||||||
|
|
||||||
|
// OffPal.setColor(QPalette::WindowText,Qt::darkGreen);
|
||||||
|
// OnPal.setColor(QPalette::WindowText,Qt::red);
|
||||||
|
|
||||||
|
// if(DataStruct->mZT1PPIAlarm == 1)
|
||||||
|
// {
|
||||||
|
// ui->mPPI1ZT1AlarmLabel->setPalette(OnPal);
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// ui->mPPI1ZT1AlarmLabel->setPalette(OffPal);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if(DataStruct->mZT1PPEAlarm == 1)
|
||||||
|
// {
|
||||||
|
// ui->mPPEZT1AlarmLabel->setPalette(OnPal);
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// ui->mPPEZT1AlarmLabel->setPalette(OffPal);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if(DataStruct->mZT1FNAlarm == 1)
|
||||||
|
// {
|
||||||
|
// ui->mFNZT1AlarmLabel->setPalette(OnPal);
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// ui->mFNZT1AlarmLabel->setPalette(OffPal);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if(DataStruct->mZT1PGAlarm == 1)
|
||||||
|
// {
|
||||||
|
// ui->mPGZT1AlarmLabel->setPalette(OnPal);
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// ui->mPGZT1AlarmLabel->setPalette(OffPal);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if(DataStruct->mZT1V00Alarm == 1)
|
||||||
|
// {
|
||||||
|
// ui->mV00AlarmLabel->setPalette(OnPal);
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// ui->mV00AlarmLabel->setPalette(OffPal);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if(DataStruct->ZT1PEQ1Alarm == 1)
|
||||||
|
// {
|
||||||
|
// ui->mPEQ1AlarmLabel->setPalette(OnPal);
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// ui->mPEQ1AlarmLabel->setPalette(OffPal);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if(DataStruct->mZT2PPIAlarm == 1)
|
||||||
|
// {
|
||||||
|
// ui->mPPIZT2AlarmLabel->setPalette(OnPal);
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// ui->mPPIZT2AlarmLabel->setPalette(OffPal);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if(DataStruct->mZT2PPEAlarm == 1)
|
||||||
|
// {
|
||||||
|
// ui->mPPEZT2AlarmLabel->setPalette(OnPal);
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// ui->mPPEZT2AlarmLabel->setPalette(OffPal);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if(DataStruct->mZT2V02Alarm == 1)
|
||||||
|
// {
|
||||||
|
// ui->mV02AlarmLabel->setPalette(OnPal);
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// ui->mV02AlarmLabel->setPalette(OffPal);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if(DataStruct->mZT2PEQ2Alarm == 1)
|
||||||
|
// {
|
||||||
|
// ui->mPEQ2AlarmLabel->setPalette(OnPal);
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// ui->mPEQ2AlarmLabel->setPalette(OffPal);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// ui->mZT1RangAlarmeLabel->setText(QString("%1").arg(DataStruct->mZT1RangPP_PG));
|
||||||
|
// ui->mZT1RangFNLabel->setText(QString("%1").arg(DataStruct->mZT1RangFN));
|
||||||
|
// ui->mZT2RangAlarmeLabel->setText(QString("%1").arg(DataStruct->mZT2RangPP));
|
||||||
|
}
|
||||||
|
|
||||||
|
void CModbusPage::SendAN1BtnClicked()
|
||||||
|
{
|
||||||
|
mProgramHandle->SendAN1Request();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CModbusPage::SendAN2BtnClicked()
|
||||||
|
{
|
||||||
|
mProgramHandle->SendAN2Request();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CModbusPage::AutoSendRequestsCheckboxClicked(int state)
|
||||||
|
{
|
||||||
|
if(state == Qt::Checked)
|
||||||
|
{
|
||||||
|
int delay = ui->mZTAutoReqDelay->text().toInt();
|
||||||
|
mProgramHandle->SetAutoRequestMode(true,delay);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mProgramHandle->SetAutoRequestMode(false,0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CModbusPage::StayOnTopBtnClicked(int state)
|
||||||
|
{
|
||||||
|
if(state == Qt::Checked)
|
||||||
|
{
|
||||||
|
Qt::WindowFlags flags = window()->windowFlags();
|
||||||
|
flags |= Qt::WindowStaysOnTopHint;
|
||||||
|
window()->setWindowFlags(flags);
|
||||||
|
window()->show();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Qt::WindowFlags flags = window()->windowFlags();
|
||||||
|
flags &= ~Qt::WindowStaysOnTopHint;
|
||||||
|
window()->setWindowFlags(flags);
|
||||||
|
window()->show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CModbusPage::ModbusActivity()
|
||||||
|
{
|
||||||
|
static bool IsON = false;
|
||||||
|
if(IsON)
|
||||||
|
{
|
||||||
|
ui->mActivityBitmap->setPixmap(mLedOFFPixmap);
|
||||||
|
IsON = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ui->mActivityBitmap->setPixmap(mLedONPixmap);
|
||||||
|
IsON = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CModbusPage::WatchdogChkBxChanged(int state)
|
||||||
|
{
|
||||||
|
if(state == Qt::Checked)
|
||||||
|
{
|
||||||
|
mProgramHandle->EnableWatchdog(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mProgramHandle->EnableWatchdog(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CModbusPage::SendDateTimeBtnClicked()
|
||||||
|
{
|
||||||
|
mProgramHandle->SendDateTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CModbusPage::SendTrainInfoBtnClicked()
|
||||||
|
{
|
||||||
|
QList<qint16> TrainInfo;
|
||||||
|
qint16 ZT1Type = 95;
|
||||||
|
if(ui->mZT1TrainTypeBox->currentText() == "MR63")
|
||||||
|
ZT1Type = 63;
|
||||||
|
else if(ui->mZT1TrainTypeBox->currentText() == "MR73")
|
||||||
|
ZT1Type = 73;
|
||||||
|
else if(ui->mZT1TrainTypeBox->currentText() == "MPM10")
|
||||||
|
ZT1Type = 10;
|
||||||
|
else if(ui->mZT1TrainTypeBox->currentText() == "Travaux")
|
||||||
|
ZT1Type = 0;
|
||||||
|
else if(ui->mZT1TrainTypeBox->currentText() == "97")
|
||||||
|
ZT1Type = 97;
|
||||||
|
else if(ui->mZT1TrainTypeBox->currentText() == "98")
|
||||||
|
ZT1Type = 98;
|
||||||
|
else if(ui->mZT1TrainTypeBox->currentText() == "99")
|
||||||
|
ZT1Type = 99;
|
||||||
|
|
||||||
|
qint16 ZT2Type = 95;
|
||||||
|
if(ui->mZT2TrainTypeBox->currentText() == "MR63")
|
||||||
|
ZT2Type = 63;
|
||||||
|
else if(ui->mZT2TrainTypeBox->currentText() == "MR73")
|
||||||
|
ZT2Type = 73;
|
||||||
|
else if(ui->mZT2TrainTypeBox->currentText() == "MPM10")
|
||||||
|
ZT2Type = 10;
|
||||||
|
else if(ui->mZT2TrainTypeBox->currentText() == "Travaux")
|
||||||
|
ZT2Type = 0;
|
||||||
|
else if(ui->mZT2TrainTypeBox->currentText() == "97")
|
||||||
|
ZT2Type = 97;
|
||||||
|
else if(ui->mZT2TrainTypeBox->currentText() == "98")
|
||||||
|
ZT2Type = 98;
|
||||||
|
else if(ui->mZT2TrainTypeBox->currentText() == "99")
|
||||||
|
ZT2Type = 99;
|
||||||
|
|
||||||
|
TrainInfo.append(ZT1Type);
|
||||||
|
TrainInfo.append(ZT2Type);
|
||||||
|
TrainInfo.append(ui->mZT1Compo1->value());
|
||||||
|
TrainInfo.append(ui->mZT1Compo2->value());
|
||||||
|
TrainInfo.append(ui->mZT1Compo3->value());
|
||||||
|
TrainInfo.append(ui->mZT2Compo1->value());
|
||||||
|
TrainInfo.append(ui->mZT2Compo2->value());
|
||||||
|
TrainInfo.append(ui->mZT2Compo3->value());
|
||||||
|
|
||||||
|
qint16 InhibZT1 = 0, InhibZT2 = 0;
|
||||||
|
if(ui->mZT1InhibPassChkBx->checkState() == Qt::Checked)
|
||||||
|
{
|
||||||
|
InhibZT1 = 1;
|
||||||
|
}
|
||||||
|
if(ui->mZT2InhibPassChkBx->checkState() == Qt::Checked)
|
||||||
|
{
|
||||||
|
InhibZT2 = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
mProgramHandle->SendTrainInfo(TrainInfo);
|
||||||
|
mProgramHandle->SendInhibitZT(InhibZT1,InhibZT2);
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
#ifndef CMAINPAGE_H
|
||||||
|
#define CMAINPAGE_H
|
||||||
|
#include "ZTInfo.h"
|
||||||
|
#include <QPixmap>
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
|
||||||
|
class COutilModbus;
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class CModbusPage;
|
||||||
|
}
|
||||||
|
|
||||||
|
class CModbusPage : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit CModbusPage(QWidget *parent = 0);
|
||||||
|
~CModbusPage();
|
||||||
|
void MasterConnected();
|
||||||
|
void MasterDisconnected();
|
||||||
|
COutilModbus *mProgramHandle;
|
||||||
|
QPixmap mLedONPixmap, mLedOFFPixmap;
|
||||||
|
|
||||||
|
void UpdateZTInfo(CZTInfo *DataStruct);
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::CModbusPage *ui;
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void ConnectToSlaveBtnClicked();
|
||||||
|
void ReadModbusBtnClicked();
|
||||||
|
void SendAN1BtnClicked();
|
||||||
|
void SendAN2BtnClicked();
|
||||||
|
void SendDateTimeBtnClicked();
|
||||||
|
void AutoSendRequestsCheckboxClicked(int);
|
||||||
|
void StayOnTopBtnClicked(int);
|
||||||
|
void ModbusActivity();
|
||||||
|
void WatchdogChkBxChanged(int);
|
||||||
|
void SendTrainInfoBtnClicked();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CMAINPAGE_H
|
||||||
@@ -0,0 +1,211 @@
|
|||||||
|
#include "ModbusRepository.h"
|
||||||
|
#include <QByteArray>
|
||||||
|
#include <QBuffer>
|
||||||
|
#include <QDataStream>
|
||||||
|
|
||||||
|
CModbusRepository::CModbusRepository()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
int CModbusRepository::AddHRDataMap(quint16 StartAddress, quint16 Length)
|
||||||
|
{
|
||||||
|
for(int i= 0; i < mHoldingRegisters.size(); i++)
|
||||||
|
{
|
||||||
|
if((StartAddress >= mHoldingRegisters.at(i).mStartAddress && StartAddress <= mHoldingRegisters.at(i).mEndAddress) ||
|
||||||
|
(StartAddress + Length - 1 >= mHoldingRegisters.at(i).mStartAddress && StartAddress + Length - 1 <= mHoldingRegisters.at(i).mEndAddress))
|
||||||
|
{
|
||||||
|
return RET_ERROR; //The data map overlaps an existing map.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CHRDataMap NewHRMap(StartAddress,Length);
|
||||||
|
|
||||||
|
mHoldingRegisters.append(NewHRMap);
|
||||||
|
|
||||||
|
qDebug("Created a new HR data map at address: %d with size %d",StartAddress,Length);
|
||||||
|
|
||||||
|
return RET_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CModbusRepository::IsHRValid(quint16 StartAddress, quint16 Length, int *index)
|
||||||
|
{
|
||||||
|
for(int i= 0; i < mHoldingRegisters.size(); i++)
|
||||||
|
{
|
||||||
|
if((StartAddress >= mHoldingRegisters.at(i).mStartAddress && StartAddress + Length - 1 <= mHoldingRegisters.at(i).mEndAddress))
|
||||||
|
{
|
||||||
|
if(index != 0)
|
||||||
|
{
|
||||||
|
*index = i;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
QByteArray CModbusRepository::GetHRData(quint16 StartAddress, quint16 Length, bool *OK)
|
||||||
|
{
|
||||||
|
QByteArray Data;
|
||||||
|
int RegisterIndex = 0;
|
||||||
|
|
||||||
|
if(IsHRValid(StartAddress,Length, &RegisterIndex) == false)
|
||||||
|
{
|
||||||
|
if(OK != 0)
|
||||||
|
{
|
||||||
|
*OK = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int DataIndex = StartAddress - mHoldingRegisters.at(RegisterIndex).mStartAddress;
|
||||||
|
for(int i = 0; i < Length; i++)
|
||||||
|
{
|
||||||
|
quint16 CurReg = mHoldingRegisters.at(RegisterIndex).mRegistersData.at(DataIndex++);
|
||||||
|
quint8 HighByte, LowByte;
|
||||||
|
|
||||||
|
LowByte = CurReg & 0x00FF;
|
||||||
|
HighByte = (CurReg >> 8) & 0x00FF;
|
||||||
|
Data.append(HighByte);
|
||||||
|
Data.append(LowByte);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(OK != 0)
|
||||||
|
{
|
||||||
|
*OK = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return Data;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CModbusRepository::WriteHRData(quint16 StartAddress, quint16 Length, QByteArray Data)
|
||||||
|
{
|
||||||
|
int RegisterIndex;
|
||||||
|
|
||||||
|
if(IsHRValid(StartAddress,Length, &RegisterIndex) == false)
|
||||||
|
{
|
||||||
|
return RET_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(Length*2 != Data.size())
|
||||||
|
{
|
||||||
|
return RET_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
int DataIndex = StartAddress - mHoldingRegisters.at(RegisterIndex).mStartAddress;
|
||||||
|
|
||||||
|
for(int i = 0; i < Length; i++)
|
||||||
|
{
|
||||||
|
quint8 HighByte = Data.at(i*2);
|
||||||
|
quint8 LowByte = Data.at(i*2 + 1);
|
||||||
|
qint16 Word = HighByte;
|
||||||
|
Word <<= 8;
|
||||||
|
Word += LowByte;
|
||||||
|
Word = Word &0xFFFF;
|
||||||
|
|
||||||
|
mHoldingRegisters[RegisterIndex].mRegistersData[DataIndex++] = Word;
|
||||||
|
}
|
||||||
|
|
||||||
|
return RET_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CModbusRepository::WriteSingleReg(quint16 Address, quint16 Value)
|
||||||
|
{
|
||||||
|
int RegisterIndex;
|
||||||
|
|
||||||
|
if(IsHRValid(Address,1, &RegisterIndex) == false)
|
||||||
|
{
|
||||||
|
return RET_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
int DataIndex = Address - mHoldingRegisters.at(RegisterIndex).mStartAddress;
|
||||||
|
mHoldingRegisters[RegisterIndex].mRegistersData[DataIndex] = Value;
|
||||||
|
return RET_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
quint16 CModbusRepository::GetSingleReg(quint16 Address, bool *OK)
|
||||||
|
{
|
||||||
|
int RegisterIndex;
|
||||||
|
|
||||||
|
if(IsHRValid(Address,1, &RegisterIndex) == false)
|
||||||
|
{
|
||||||
|
if(OK != 0)
|
||||||
|
{
|
||||||
|
*OK = false;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(OK != 0)
|
||||||
|
{
|
||||||
|
*OK = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
int DataIndex = Address - mHoldingRegisters.at(RegisterIndex).mStartAddress;
|
||||||
|
return mHoldingRegisters[RegisterIndex].mRegistersData[DataIndex];
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<qint16> CModbusRepository::GetRegs(quint16 StartAddress, quint16 Length, bool *OK)
|
||||||
|
{
|
||||||
|
int RegisterIndex;
|
||||||
|
|
||||||
|
if(IsHRValid(StartAddress,Length, &RegisterIndex) == false)
|
||||||
|
{
|
||||||
|
if(OK != 0)
|
||||||
|
{
|
||||||
|
*OK = false;
|
||||||
|
}
|
||||||
|
return QList<qint16>();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(OK != 0)
|
||||||
|
{
|
||||||
|
*OK = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
int DataIndex = StartAddress - mHoldingRegisters.at(RegisterIndex).mStartAddress;
|
||||||
|
return mHoldingRegisters[RegisterIndex].mRegistersData.mid(DataIndex,Length);
|
||||||
|
}
|
||||||
|
|
||||||
|
CHRDataMap::CHRDataMap(quint16 StartAddress, quint16 Length)
|
||||||
|
{
|
||||||
|
mStartAddress = StartAddress;
|
||||||
|
mLength = Length;
|
||||||
|
for(int i = 0; i < Length; i++)
|
||||||
|
{
|
||||||
|
mRegistersData.append(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
mRegistersData[0] = 0x1234;
|
||||||
|
mRegistersData[1] = 0x4567;
|
||||||
|
mRegistersData[2] = 0x8911;
|
||||||
|
mRegistersData[3] = 9873;
|
||||||
|
mRegistersData[4] = 0xABCD;*/
|
||||||
|
|
||||||
|
|
||||||
|
mEndAddress = StartAddress + Length - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CModbusRepository::WriteMultipleRegs(quint16 StartAddress, QList<qint16> Data)
|
||||||
|
{
|
||||||
|
int RegisterIndex;
|
||||||
|
|
||||||
|
if(IsHRValid(StartAddress,Data.size(), &RegisterIndex) == false)
|
||||||
|
{
|
||||||
|
return RET_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
//mMutex.lockForWrite();
|
||||||
|
int DataIndex = StartAddress - mHoldingRegisters.at(RegisterIndex).mStartAddress;
|
||||||
|
for(int i = 0; i < Data.size(); i++)
|
||||||
|
{
|
||||||
|
mHoldingRegisters[RegisterIndex].mRegistersData[DataIndex++] = Data.at(i);
|
||||||
|
}
|
||||||
|
// mMutex.unlock();
|
||||||
|
|
||||||
|
// emit RepoChanged(StartAddress,Data.size());
|
||||||
|
return RET_OK;
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
#ifndef MODBUSREPOSITORY_H
|
||||||
|
#define MODBUSREPOSITORY_H
|
||||||
|
#include "GlobalDefine.h"
|
||||||
|
#include <QList>
|
||||||
|
|
||||||
|
class CHRDataMap ///Holding Register data map.
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CHRDataMap(quint16 StartAddress, quint16 Length);
|
||||||
|
quint16 mStartAddress,mEndAddress;
|
||||||
|
quint16 mLength;
|
||||||
|
QList<qint16> mRegistersData;
|
||||||
|
};
|
||||||
|
|
||||||
|
class CModbusRepository
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CModbusRepository();
|
||||||
|
|
||||||
|
//Holding Registers
|
||||||
|
int AddHRDataMap(quint16 StartAddress, quint16 Length);
|
||||||
|
bool IsHRValid(quint16 StartAddress, quint16 Length, int *index = 0);
|
||||||
|
QByteArray GetHRData(quint16 StartAddress, quint16 Length, bool *OK = 0);
|
||||||
|
QList<qint16> GetRegs(quint16 StartAddress, quint16 Length, bool *OK = 0);
|
||||||
|
quint16 GetSingleReg(quint16 Address, bool *OK = 0);
|
||||||
|
int WriteHRData(quint16 StartAddress, quint16 Length, QByteArray Data);
|
||||||
|
int WriteSingleReg(quint16 Address, quint16 Value);
|
||||||
|
int WriteMultipleRegs(quint16 StartAddress, QList<qint16> Data);
|
||||||
|
|
||||||
|
private:
|
||||||
|
QList<CHRDataMap> mHoldingRegisters;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // MODBUSREPOSITORY_H
|
||||||
@@ -0,0 +1,100 @@
|
|||||||
|
#include "ModbusSlave.h"
|
||||||
|
|
||||||
|
|
||||||
|
CModbusSlave::CModbusSlave(CModbusRepository *Repo) :
|
||||||
|
CModbusBackend(Repo)
|
||||||
|
{
|
||||||
|
mModbusServer = new QTcpServer();
|
||||||
|
connect(mModbusServer,SIGNAL(newConnection()),this,SLOT(NewModbusConnection()));
|
||||||
|
mModbusMode = MODBUS_SLAVE_MODE;
|
||||||
|
mServerPort = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
CModbusSlave::~CModbusSlave()
|
||||||
|
{
|
||||||
|
delete mModbusServer;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CModbusSlave::SetServerPort(int port)
|
||||||
|
{
|
||||||
|
mServerPort = port;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CModbusSlave::IsSlaveServerOpened()
|
||||||
|
{
|
||||||
|
return mModbusServer->isListening();
|
||||||
|
}
|
||||||
|
|
||||||
|
int CModbusSlave::StartSlaveServer(int port)
|
||||||
|
{
|
||||||
|
mServerPort = port;
|
||||||
|
mModbusServer->listen(QHostAddress::Any,port);
|
||||||
|
qDebug("Slave server started on port %d",port);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CModbusSlave::ToggleServerState()
|
||||||
|
{
|
||||||
|
|
||||||
|
if(mModbusServer->isListening())
|
||||||
|
{
|
||||||
|
StopSlaveServer();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(mServerPort < 0)
|
||||||
|
{
|
||||||
|
qDebug("Error, trying to toggle SEI server on invalid port");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
StartSlaveServer(mServerPort);
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CModbusSlave::StopSlaveServer()
|
||||||
|
{
|
||||||
|
if(mModbusTCPSocketHandle != 0)
|
||||||
|
{
|
||||||
|
mModbusTCPSocketHandle->disconnectFromHost();
|
||||||
|
}
|
||||||
|
|
||||||
|
mModbusServer->close();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CModbusSlave::NewModbusConnection()
|
||||||
|
{
|
||||||
|
mModbusTCPSocketHandle = mModbusServer->nextPendingConnection();
|
||||||
|
if(mModbusTCPSocketHandle != 0)
|
||||||
|
{
|
||||||
|
mDataLinkValid = true;
|
||||||
|
connect(mModbusTCPSocketHandle,SIGNAL(readyRead()),this,SLOT(ModbusDataReady()));
|
||||||
|
connect(mModbusTCPSocketHandle,SIGNAL(disconnected()),this,SLOT(ModbusSocketDisconnected()));
|
||||||
|
emit ModbusSlaveConnected(this);
|
||||||
|
qDebug("Slave: Connection with Master established");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CModbusSlave::ModbusSocketDisconnected()
|
||||||
|
{
|
||||||
|
qDebug("Modbus link disconnected");
|
||||||
|
mDataLinkValid = false;
|
||||||
|
emit ModbusSlaveDisconnected(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CModbusSlave::RegistersDatabaseUpdated(quint16 StartAddress, quint16 Length)
|
||||||
|
{
|
||||||
|
|
||||||
|
// qDebug("SEI Database updated with ZT data...");
|
||||||
|
emit ModbusSlaveRepoUpdated();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CModbusSlave::ModbusRequestException(quint8 ExceptionCode, quint8 FctCode)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
#ifndef CMODBUSSLAVE_H
|
||||||
|
#define CMODBUSSLAVE_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include "ModbusBackend.h"
|
||||||
|
#include <QTcpServer>
|
||||||
|
#include "ModbusRepository.h"
|
||||||
|
|
||||||
|
class CModbusSlave : public CModbusBackend
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit CModbusSlave(CModbusRepository *Repo);
|
||||||
|
virtual ~CModbusSlave();
|
||||||
|
|
||||||
|
int SetServerPort(int port);
|
||||||
|
int StartSlaveServer(int port);
|
||||||
|
int StopSlaveServer();
|
||||||
|
virtual void RegistersDatabaseUpdated(quint16 StartAddress, quint16 Length);
|
||||||
|
virtual void ModbusRequestException(quint8 ExceptionCode, quint8 FctCode);
|
||||||
|
|
||||||
|
int ToggleServerState();
|
||||||
|
bool IsSlaveServerOpened();
|
||||||
|
|
||||||
|
private:
|
||||||
|
QTcpServer *mModbusServer;
|
||||||
|
int mServerPort;
|
||||||
|
|
||||||
|
signals:
|
||||||
|
|
||||||
|
void ModbusSlaveConnected(CModbusSlave *);
|
||||||
|
void ModbusSlaveDisconnected(CModbusSlave *);
|
||||||
|
void ModbusSlaveRepoUpdated();
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void NewModbusConnection();
|
||||||
|
void ModbusSocketDisconnected();
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CMODBUSSLAVE_H
|
||||||
@@ -0,0 +1,570 @@
|
|||||||
|
#include "OutilModbus.h"
|
||||||
|
#include "ProtocolDefs.h"
|
||||||
|
#include <QDateTime>
|
||||||
|
|
||||||
|
COutilModbus::COutilModbus(QObject *parent) :
|
||||||
|
QObject(parent)
|
||||||
|
{
|
||||||
|
mModbusSEIEmulator = new CModbusSlave(&mSEIModbusRepo);
|
||||||
|
mModbusCCEmulator = new CModbusMaster(&mCCModbusRepo);
|
||||||
|
w = new MainWindow(0,this);
|
||||||
|
|
||||||
|
mAutoRequestTimer = new QTimer();
|
||||||
|
mAutoRequestTimer->setSingleShot(false);
|
||||||
|
connect(mAutoRequestTimer,SIGNAL(timeout()),this,SLOT(AutoRequestTimeExpired()));
|
||||||
|
|
||||||
|
mWatchdogEnabled = true;
|
||||||
|
mWatchdog = 0;
|
||||||
|
mWatchdogTimer = new QTimer();
|
||||||
|
mWatchdogTimer->setSingleShot(false);
|
||||||
|
connect(mWatchdogTimer,SIGNAL(timeout()),this,SLOT(WatchdogTimerExpired()));
|
||||||
|
mWatchdogTimer->setInterval(MODBUS_CC_WATCHDOG_TIMEOUT);
|
||||||
|
|
||||||
|
mSEIWatchdogTimer = new QTimer();
|
||||||
|
mSEIWatchdogTimer->setSingleShot(false);
|
||||||
|
mSEIWatchdogTimer->setInterval(MODBUS_SEI_WATCHDOG_TIMEOUT);
|
||||||
|
connect(mSEIWatchdogTimer,SIGNAL(timeout()),this,SLOT(SEIWatchdogExpired()));
|
||||||
|
|
||||||
|
|
||||||
|
mSEIWatchdogValue = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
COutilModbus::~COutilModbus()
|
||||||
|
{
|
||||||
|
delete mModbusSEIEmulator;
|
||||||
|
delete mAutoRequestTimer;
|
||||||
|
delete mWatchdogTimer;
|
||||||
|
delete w;
|
||||||
|
delete mSEIWatchdogTimer;
|
||||||
|
}
|
||||||
|
|
||||||
|
int COutilModbus::Start()
|
||||||
|
{
|
||||||
|
w->resize(1024,768);
|
||||||
|
w->show();
|
||||||
|
|
||||||
|
mModbusPageHandle = w->mModbusPage;
|
||||||
|
mSEIModbusPageHandle = w->mSEIModbusPage;
|
||||||
|
|
||||||
|
mCCModbusRepo.AddHRDataMap(2000,128);
|
||||||
|
|
||||||
|
|
||||||
|
//mModbusSEIEmulator->StartSlaveServer(502);
|
||||||
|
mModbusSEIEmulator->SetServerPort(503);
|
||||||
|
|
||||||
|
mSEIModbusRepo.AddHRDataMap(2000,128);
|
||||||
|
mSEIModbusRepo.AddHRDataMap(3000,128);
|
||||||
|
|
||||||
|
connect(mModbusCCEmulator,SIGNAL(ModbusMasterConnected(CModbusMaster*)),this,SLOT(ModbusMasterConnected(CModbusMaster*)));
|
||||||
|
connect(mModbusCCEmulator,SIGNAL(ModbusMasterDisconnected(CModbusMaster*)),this,SLOT(ModbusMasterDisconnected(CModbusMaster*)));
|
||||||
|
connect(mModbusCCEmulator,SIGNAL(ModbusMasterRepositoryUpdated()),this,SLOT(ModbusMasterRepositoryUpdated()));
|
||||||
|
connect(mModbusCCEmulator,SIGNAL(ModbusRX()),mModbusPageHandle,SLOT(ModbusActivity()));
|
||||||
|
|
||||||
|
connect(mModbusSEIEmulator,SIGNAL(ModbusSlaveConnected(CModbusSlave*)),this,SLOT(SEIModbusConnected(CModbusSlave*)));
|
||||||
|
connect(mModbusSEIEmulator,SIGNAL(ModbusSlaveDisconnected(CModbusSlave*)),this,SLOT(SEIModbusDisconnected(CModbusSlave*)));
|
||||||
|
connect(mModbusSEIEmulator,SIGNAL(ModbusSlaveRepoUpdated()),this,SLOT(SEIRepositoryUpdated()));
|
||||||
|
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void COutilModbus::ModbusMasterConnected(CModbusMaster *Master)
|
||||||
|
{
|
||||||
|
mModbusPageHandle->MasterConnected();
|
||||||
|
mAutoRequestTimer->stop();
|
||||||
|
if(mWatchdogEnabled)
|
||||||
|
{
|
||||||
|
mWatchdogTimer->start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void COutilModbus::ModbusMasterDisconnected(CModbusMaster *Master)
|
||||||
|
{
|
||||||
|
mModbusPageHandle->MasterDisconnected();
|
||||||
|
mWatchdogTimer->stop();
|
||||||
|
mAutoRequestTimer->stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
void COutilModbus::ModbusMasterRepositoryUpdated()
|
||||||
|
{
|
||||||
|
if(UpdateZTInfo(&mCurZTInfo,&mCCModbusRepo) == RET_OK)
|
||||||
|
{
|
||||||
|
mModbusPageHandle->UpdateZTInfo(&mCurZTInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void COutilModbus::SEIModbusConnected(CModbusSlave *Slave)
|
||||||
|
{
|
||||||
|
mSEIModbusPageHandle->SetConnected(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void COutilModbus::SEIModbusDisconnected(CModbusSlave *Slave)
|
||||||
|
{
|
||||||
|
mSEIModbusPageHandle->SetConnected(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void COutilModbus::SEIRepositoryUpdated()
|
||||||
|
{
|
||||||
|
if(UpdateZTInfo(&mCurZTInfo, &mSEIModbusRepo) == RET_OK)
|
||||||
|
{
|
||||||
|
mSEIModbusPageHandle->UpdateZTInfo(&mCurZTInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int COutilModbus::ConnectCCToZTButtonPressed(QString IP, int Port)
|
||||||
|
{
|
||||||
|
mModbusCCEmulator->ConnectToSlave(IP,Port);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int COutilModbus::DisconnectCCFromZTButtonPressed()
|
||||||
|
{
|
||||||
|
return mModbusCCEmulator->DisconnectFromSlave();
|
||||||
|
}
|
||||||
|
|
||||||
|
int COutilModbus::SetCCReqDelay(int delay)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int COutilModbus::SendMasterReadCommand()
|
||||||
|
{
|
||||||
|
return mModbusCCEmulator->ReadModbusRegisters();
|
||||||
|
}
|
||||||
|
|
||||||
|
int COutilModbus::UpdateZTInfo(CZTInfo *DataStruct, CModbusRepository *SourceRepo)
|
||||||
|
{
|
||||||
|
bool OK = false;
|
||||||
|
// quint16 data = mCCModbusRepo.GetSingleReg(MODBUS_ZT1_ALARM_DATA_BASE_REG_ADD,&OK);
|
||||||
|
quint16 data = SourceRepo->GetSingleReg(MODBUS_ZT1_ALARM_DATA_BASE_REG_ADD,&OK);
|
||||||
|
|
||||||
|
if(OK == true)
|
||||||
|
{
|
||||||
|
|
||||||
|
DataStruct->mZT1PPIAlarmFlag1 = (data & ZT1_PP_INT_FLAG_MASK_1) != 0;
|
||||||
|
DataStruct->mZT1PPIAlarmFlag2 = (data & ZT1_PP_INT_FLAG_MASK_2) != 0;
|
||||||
|
DataStruct->mZT1PPIAlarmFlag3 = (data & ZT1_PP_INT_FLAG_MASK_3) != 0;
|
||||||
|
DataStruct->mZT1PPIAlarmFlag4 = (data & ZT1_PP_INT_FLAG_MASK_4) != 0;
|
||||||
|
DataStruct->mZT1PPEAlarmFlag1 = (data & ZT1_PP_EXT_FLAG_MASK_1) != 0;
|
||||||
|
DataStruct->mZT1PPEAlarmFlag2 = (data & ZT1_PP_EXT_FLAG_MASK_2) != 0;
|
||||||
|
DataStruct->mZT1PPEAlarmFlag3 = (data & ZT1_PP_EXT_FLAG_MASK_3) != 0;
|
||||||
|
DataStruct->mZT1PPEAlarmFlag4 = (data & ZT1_PP_EXT_FLAG_MASK_4) != 0;
|
||||||
|
DataStruct->mZT1PGAlarmFlag1 = (data & ZT1_PG_FLAG_MASK_1) != 0;
|
||||||
|
DataStruct->mZT1PGAlarmFlag2 = (data & ZT1_PG_FLAG_MASK_2) != 0;
|
||||||
|
DataStruct->mZT1PGAlarmFlag3 = (data & ZT1_PG_FLAG_MASK_3) != 0;
|
||||||
|
DataStruct->mZT1PGAlarmFlag4 = (data & ZT1_PG_FLAG_MASK_4) != 0;
|
||||||
|
DataStruct->mZT1FNAlarmFlag1 = (data & ZT1_FN_FLAG_MASK_1) != 0;
|
||||||
|
DataStruct->mZT1FNAlarmFlag2 = (data & ZT1_FN_FLAG_MASK_2) != 0;
|
||||||
|
DataStruct->mZT1FNAlarmFlag3 = (data & ZT1_FN_FLAG_MASK_3) != 0;
|
||||||
|
DataStruct->mZT1FNAlarmFlag4 = (data & ZT1_FN_FLAG_MASK_4) != 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qDebug("GetSingleReg failed in UpdateZTInfo (MODBUS_ZT1_ALARM_DATA_BASE_REG_ADD)");
|
||||||
|
return RET_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
QList<qint16> RankData;
|
||||||
|
RankData = SourceRepo->GetRegs(MODBUS_ZT1_ALARM_RANKS_BASE_ADD,16,&OK);
|
||||||
|
if(OK == true)
|
||||||
|
{
|
||||||
|
DataStruct->mZT1Ranks = RankData;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qDebug("GetSingleReg failed in UpdateZTInfo (MODBUS_ZT1_ALARM_RANKS_BASE_ADD)");
|
||||||
|
return RET_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
data = SourceRepo->GetSingleReg(MODBUS_ZT2_ALARM_DATA_BASE_REG_ADD,&OK);
|
||||||
|
if(OK == true)
|
||||||
|
{
|
||||||
|
DataStruct->mZT2PPIAlarmFlag1 = (data & ZT2_PP_INT_FLAG_MASK_1) != 0;
|
||||||
|
DataStruct->mZT2PPIAlarmFlag2 = (data & ZT2_PP_INT_FLAG_MASK_2) != 0;
|
||||||
|
DataStruct->mZT2PPIAlarmFlag3 = (data & ZT2_PP_INT_FLAG_MASK_3) != 0;
|
||||||
|
DataStruct->mZT2PPIAlarmFlag4 = (data & ZT2_PP_INT_FLAG_MASK_4) != 0;
|
||||||
|
DataStruct->mZT2PPEAlarmFlag1 = (data & ZT2_PP_EXT_FLAG_MASK_1) != 0;
|
||||||
|
DataStruct->mZT2PPEAlarmFlag2 = (data & ZT2_PP_EXT_FLAG_MASK_2) != 0;
|
||||||
|
DataStruct->mZT2PPEAlarmFlag3 = (data & ZT2_PP_EXT_FLAG_MASK_3) != 0;
|
||||||
|
DataStruct->mZT2PPEAlarmFlag4 = (data & ZT2_PP_EXT_FLAG_MASK_4) != 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qDebug("GetSingleReg failed in UpdateZTInfo (MODBUS_ZT2_ALARM_DATA_BASE_REG_ADD)");
|
||||||
|
return RET_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
RankData.clear();
|
||||||
|
RankData = SourceRepo->GetRegs(MODBUS_ZT2_ALARM_RANKS_BASE_ADD,8,&OK);
|
||||||
|
if(OK == true)
|
||||||
|
{
|
||||||
|
DataStruct->mZT2Ranks = RankData;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qDebug("GetSingleReg failed in UpdateZTInfo (MODBUS_ZT2_ALARM_RANKS_BASE_ADD)");
|
||||||
|
return RET_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
data = SourceRepo->GetSingleReg(MODBUS_MISC_DATA_BASE_REG_ADD,&OK);
|
||||||
|
|
||||||
|
if(OK == true)
|
||||||
|
{
|
||||||
|
|
||||||
|
DataStruct->mZT1V00AlarmFlag = (data & ZT1_V00_ALARM_FLAG_MASK) != 0;
|
||||||
|
DataStruct->mZT1PEQ1AlarmFlag = (data & ZT1_PEQ1_ALARM_FLAG_MASK) != 0;
|
||||||
|
DataStruct->mZT2V02AlarmFlag = (data & ZT2_V02_ALARM_FLAG_MASK) != 0;
|
||||||
|
DataStruct->mZT2PEQ2AlarmFlag = (data & ZT2_PEQ2_ALARM_FLAG_MASK) != 0;
|
||||||
|
DataStruct->mITI10_12Flag = (data & ZT1_ALARM_ITI_FLAG_MASK) != 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qDebug("GetSingleReg failed in UpdateZTInfo (MODBUS_PANNES_DATA_BASE_REG_ADD)");
|
||||||
|
return RET_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
DataStruct->mWatchdogZT = SourceRepo->GetSingleReg(MODBUS_ZT_WATCHDOG_REG_ADD,&OK);
|
||||||
|
|
||||||
|
return RET_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int COutilModbus::SendAN1Request() //FCYCLE
|
||||||
|
{
|
||||||
|
bool OK = false;
|
||||||
|
quint16 AN1;
|
||||||
|
quint16 CurValue = mCCModbusRepo.GetSingleReg(MODBUS_CC_AN_BASE_REG_ADD,&OK);
|
||||||
|
AN1 = CurValue & MODBUS_CC_FCYCLE_ZT1_FLAG_MASK;
|
||||||
|
if(OK == true)
|
||||||
|
{
|
||||||
|
if(AN1 == 0)
|
||||||
|
{
|
||||||
|
CurValue |= MODBUS_CC_FCYCLE_ZT1_FLAG_MASK;
|
||||||
|
mCCModbusRepo.WriteSingleReg(MODBUS_CC_AN_BASE_REG_ADD,CurValue);
|
||||||
|
qDebug("Setting FCYCLE in repo");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CurValue &= ~MODBUS_CC_FCYCLE_ZT1_FLAG_MASK;
|
||||||
|
mCCModbusRepo.WriteSingleReg(MODBUS_CC_AN_BASE_REG_ADD,CurValue);
|
||||||
|
qDebug("Clearing FCYCLE in repo");
|
||||||
|
}
|
||||||
|
mModbusCCEmulator->SendAN1ToZT();
|
||||||
|
}
|
||||||
|
return RET_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int COutilModbus::SendAN2Request()
|
||||||
|
{
|
||||||
|
bool OK = false;
|
||||||
|
quint16 AN2;
|
||||||
|
quint16 CurValue = mCCModbusRepo.GetSingleReg(MODBUS_CC_AN_BASE_REG_ADD,&OK);
|
||||||
|
AN2 = CurValue & MODBUS_CC_FCYCLE_ZT2_FLAG_MASK;
|
||||||
|
if(OK == true)
|
||||||
|
{
|
||||||
|
if(AN2 == 0)
|
||||||
|
{
|
||||||
|
CurValue |= MODBUS_CC_FCYCLE_ZT2_FLAG_MASK;
|
||||||
|
mCCModbusRepo.WriteSingleReg(MODBUS_CC_AN_BASE_REG_ADD,CurValue);
|
||||||
|
qDebug("Setting FCYCLE in repo");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CurValue &= ~MODBUS_CC_FCYCLE_ZT2_FLAG_MASK;
|
||||||
|
mCCModbusRepo.WriteSingleReg(MODBUS_CC_AN_BASE_REG_ADD,CurValue);
|
||||||
|
qDebug("Clearing FCYCLE in repo");
|
||||||
|
}
|
||||||
|
mModbusCCEmulator->SendAN2ToZT();
|
||||||
|
}
|
||||||
|
return RET_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int COutilModbus::SendZTCZT1Request()
|
||||||
|
{
|
||||||
|
bool OK = false;
|
||||||
|
quint16 ZTC1;
|
||||||
|
quint16 CurValue = mCCModbusRepo.GetSingleReg(MODBUS_CC_AN_BASE_REG_ADD,&OK);
|
||||||
|
ZTC1 = CurValue & MODBUS_CC_FCYCLE_ZT1_FLAG_MASK;
|
||||||
|
if(OK == true)
|
||||||
|
{
|
||||||
|
if(ZTC1 == 0)
|
||||||
|
{
|
||||||
|
CurValue |= MODBUS_CC_FCYCLE_ZT1_FLAG_MASK;
|
||||||
|
mCCModbusRepo.WriteSingleReg(MODBUS_CC_AN_BASE_REG_ADD,CurValue);
|
||||||
|
qDebug("Setting ZTC1 in repo");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CurValue ^= MODBUS_CC_FCYCLE_ZT1_FLAG_MASK;
|
||||||
|
mCCModbusRepo.WriteSingleReg(MODBUS_CC_AN_BASE_REG_ADD,CurValue);
|
||||||
|
qDebug("Clearing ZTC1 in repo");
|
||||||
|
}
|
||||||
|
mModbusCCEmulator->SendAN2ToZT();
|
||||||
|
}
|
||||||
|
return RET_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int COutilModbus::SendZTCZT2Request()
|
||||||
|
{
|
||||||
|
bool OK = false;
|
||||||
|
quint16 ZTC2;
|
||||||
|
quint16 CurValue = mCCModbusRepo.GetSingleReg(MODBUS_CC_AN_BASE_REG_ADD,&OK);
|
||||||
|
ZTC2 = CurValue & MODBUS_CC_FCYCLE_ZT2_FLAG_MASK;
|
||||||
|
if(OK == true)
|
||||||
|
{
|
||||||
|
if(ZTC2 == 0)
|
||||||
|
{
|
||||||
|
CurValue |= MODBUS_CC_FCYCLE_ZT2_FLAG_MASK;
|
||||||
|
mCCModbusRepo.WriteSingleReg(MODBUS_CC_AN_BASE_REG_ADD,CurValue);
|
||||||
|
qDebug("Setting ZTC2 in repo");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CurValue ^= MODBUS_CC_FCYCLE_ZT2_FLAG_MASK;
|
||||||
|
mCCModbusRepo.WriteSingleReg(MODBUS_CC_AN_BASE_REG_ADD,CurValue);
|
||||||
|
qDebug("Clearing ZTC2 in repo");
|
||||||
|
}
|
||||||
|
mModbusCCEmulator->SendAN2ToZT();
|
||||||
|
}
|
||||||
|
return RET_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int COutilModbus::SetAutoRequestMode(bool Auto, int Delay)
|
||||||
|
{
|
||||||
|
if(Auto == false)
|
||||||
|
{
|
||||||
|
mAutoRequestTimer->stop();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mAutoRequestTimer->setInterval(Delay);
|
||||||
|
mAutoRequestTimer->start();
|
||||||
|
}
|
||||||
|
return RET_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
void COutilModbus::AutoRequestTimeExpired()
|
||||||
|
{
|
||||||
|
SendMasterReadCommand();
|
||||||
|
}
|
||||||
|
|
||||||
|
int COutilModbus::EnableWatchdog(bool Enabled)
|
||||||
|
{
|
||||||
|
mWatchdogEnabled = Enabled;
|
||||||
|
if(Enabled)
|
||||||
|
{
|
||||||
|
mWatchdogTimer->start();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mWatchdogTimer->stop();
|
||||||
|
}
|
||||||
|
return RET_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
void COutilModbus::WatchdogTimerExpired()
|
||||||
|
{
|
||||||
|
if(mWatchdog == 0)
|
||||||
|
{
|
||||||
|
mWatchdog = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mWatchdog = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
mCCModbusRepo.WriteSingleReg(MODBUS_CC_WATCHDOG_BASE_REG_ADD,mWatchdog);
|
||||||
|
// qDebug("Watchdog: %d",mWatchdog);
|
||||||
|
mModbusCCEmulator->SendWatchdog();
|
||||||
|
}
|
||||||
|
|
||||||
|
int COutilModbus::SendDateTime()
|
||||||
|
{
|
||||||
|
QList<qint16> DateTimeData;
|
||||||
|
QDateTime CurDateTime = QDateTime::currentDateTime().toUTC();
|
||||||
|
qint16 tmpWord;
|
||||||
|
qint8 tmpByte;
|
||||||
|
|
||||||
|
DateTimeData.append(MODBUS_CC_CLK_UPDATE_FLAG_MASK);
|
||||||
|
tmpByte = DecToBCDByte((qint8)CurDateTime.time().second());
|
||||||
|
tmpWord = (qint16)tmpByte << 8;
|
||||||
|
|
||||||
|
DateTimeData.append(tmpWord);
|
||||||
|
|
||||||
|
tmpByte = DecToBCDByte((qint8)CurDateTime.time().hour());
|
||||||
|
tmpWord = (qint16)tmpByte << 8;
|
||||||
|
tmpByte = DecToBCDByte((qint8)CurDateTime.time().minute());
|
||||||
|
tmpWord += tmpByte;
|
||||||
|
DateTimeData.append(tmpWord);
|
||||||
|
|
||||||
|
tmpByte = DecToBCDByte((qint8)CurDateTime.date().month());
|
||||||
|
tmpWord = (qint16)tmpByte << 8;
|
||||||
|
tmpByte = DecToBCDByte((qint8)CurDateTime.date().day());
|
||||||
|
tmpWord += tmpByte;
|
||||||
|
DateTimeData.append(tmpWord);
|
||||||
|
|
||||||
|
tmpWord = DecToBCDWord((qint16)CurDateTime.date().year());
|
||||||
|
DateTimeData.append(tmpWord);
|
||||||
|
|
||||||
|
mCCModbusRepo.WriteMultipleRegs(MODBUS_CC_CLK_UPDATE_BASE_REG_ADD,DateTimeData);
|
||||||
|
mModbusCCEmulator->SendDateTime();
|
||||||
|
return RET_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int COutilModbus::SendTrainInfo(QList<qint16> TrainInfo)
|
||||||
|
{
|
||||||
|
|
||||||
|
mCCModbusRepo.WriteMultipleRegs(MODBUS_CC_ZT1_TRAIN_TYPE_REG_ADD,TrainInfo);
|
||||||
|
mModbusCCEmulator->SendTrainData();
|
||||||
|
|
||||||
|
return RET_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int COutilModbus::SendInhibitZT(qint16 InhibZT1, qint16 InhibZT2)
|
||||||
|
{
|
||||||
|
bool OK = false;
|
||||||
|
|
||||||
|
qint16 Register = mCCModbusRepo.GetSingleReg(MODBUS_CC_AN_BASE_REG_ADD,&OK);
|
||||||
|
if(OK)
|
||||||
|
{
|
||||||
|
if(InhibZT1 == 0)
|
||||||
|
{
|
||||||
|
Register &= ~MODBUS_CC_INHIBIT_ZT1_FLAG_MASK;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Register |= MODBUS_CC_INHIBIT_ZT1_FLAG_MASK;
|
||||||
|
}
|
||||||
|
if(InhibZT2 == 0)
|
||||||
|
{
|
||||||
|
Register &= ~MODBUS_CC_INHIBIT_ZT2_FLAG_MASK;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Register |= MODBUS_CC_INHIBIT_ZT2_FLAG_MASK;
|
||||||
|
}
|
||||||
|
mCCModbusRepo.WriteSingleReg(MODBUS_CC_AN_BASE_REG_ADD,Register);
|
||||||
|
mModbusCCEmulator->SendZTInhibitionData();
|
||||||
|
return RET_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
return RET_ERROR;
|
||||||
|
}
|
||||||
|
quint8 COutilModbus::DecToBCDByte(const quint8 byte)
|
||||||
|
{
|
||||||
|
quint8 out = 0;
|
||||||
|
|
||||||
|
out = ((byte/10) << 4) + (byte%10);
|
||||||
|
|
||||||
|
|
||||||
|
return out;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
quint16 COutilModbus::DecToBCDWord(const quint16 word)
|
||||||
|
{
|
||||||
|
quint16 out = 0;
|
||||||
|
quint16 temp = 0;
|
||||||
|
|
||||||
|
out = word % 10;
|
||||||
|
temp = (((word /10) % 10) << 4);
|
||||||
|
out += temp;
|
||||||
|
temp = (((word / 100) % 10) << 8);
|
||||||
|
out += temp;
|
||||||
|
temp = (((word / 1000) % 10) << 12);
|
||||||
|
out += temp;
|
||||||
|
|
||||||
|
return out;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
int COutilModbus::ToggleSEIServerState()
|
||||||
|
{
|
||||||
|
return mModbusSEIEmulator->ToggleServerState();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool COutilModbus::IsSEIServerOpened()
|
||||||
|
{
|
||||||
|
return mModbusSEIEmulator->IsSlaveServerOpened();
|
||||||
|
}
|
||||||
|
|
||||||
|
int COutilModbus::SEIWatchdogEnable(bool Enabled)
|
||||||
|
{
|
||||||
|
if(Enabled)
|
||||||
|
{
|
||||||
|
mSEIWatchdogTimer->start();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mSEIWatchdogTimer->stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
return RET_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
void COutilModbus::SEIWatchdogExpired()
|
||||||
|
{
|
||||||
|
if(mSEIWatchdogValue == 0)
|
||||||
|
{
|
||||||
|
mSEIWatchdogValue = SEI_MODBUS_SEI_WATCHDOG_MASK;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mSEIWatchdogValue = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
mSEIModbusRepo.WriteSingleReg(SEI_MODBUS_SEI_WATCHDOG_REG,mSEIWatchdogValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
int COutilModbus::SEIAN1Toggle(bool Enabled)
|
||||||
|
{
|
||||||
|
qint16 temp;
|
||||||
|
bool OK;
|
||||||
|
temp = mSEIModbusRepo.GetSingleReg(SEI_MODBUS_SEI_ALARMS_RESET_REG,&OK);
|
||||||
|
|
||||||
|
if(OK == false)
|
||||||
|
{
|
||||||
|
qDebug("SEIAN1Toggle(): logic error in modbus table assignment. Can't read address %d",SEI_MODBUS_SEI_ALARMS_RESET_REG);
|
||||||
|
return RET_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(Enabled)
|
||||||
|
{
|
||||||
|
temp |= SEI_MODBUS_SEI_ZT1_ALARM_RESET_MASK;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
temp &= ~SEI_MODBUS_SEI_ZT1_ALARM_RESET_MASK;
|
||||||
|
}
|
||||||
|
|
||||||
|
mSEIModbusRepo.WriteSingleReg(SEI_MODBUS_SEI_ALARMS_RESET_REG,temp);
|
||||||
|
|
||||||
|
return RET_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int COutilModbus::SEIAN2Toggle(bool Enabled)
|
||||||
|
{
|
||||||
|
qint16 temp;
|
||||||
|
bool OK;
|
||||||
|
temp = mSEIModbusRepo.GetSingleReg(SEI_MODBUS_SEI_ALARMS_RESET_REG,&OK);
|
||||||
|
|
||||||
|
if(OK == false)
|
||||||
|
{
|
||||||
|
qDebug("SEIAN2Toggle(): logic error in modbus table assignment. Can't read address %d",SEI_MODBUS_SEI_ALARMS_RESET_REG);
|
||||||
|
return RET_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(Enabled)
|
||||||
|
{
|
||||||
|
temp |= SEI_MODBUS_SEI_ZT2_ALARM_RESET_MASK;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
temp &= ~SEI_MODBUS_SEI_ZT2_ALARM_RESET_MASK;
|
||||||
|
}
|
||||||
|
|
||||||
|
mSEIModbusRepo.WriteSingleReg(SEI_MODBUS_SEI_ALARMS_RESET_REG,temp);
|
||||||
|
|
||||||
|
return RET_OK;
|
||||||
|
}
|
||||||
@@ -0,0 +1,86 @@
|
|||||||
|
#ifndef OUTILMODBUS_H
|
||||||
|
#define OUTILMODBUS_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include "ModbusSlave.h"
|
||||||
|
#include "ModbusMaster.h"
|
||||||
|
#include "MainWindow.h"
|
||||||
|
#include "ModbusRepository.h"
|
||||||
|
#include "ZTInfo.h"
|
||||||
|
|
||||||
|
class CMainPage;
|
||||||
|
|
||||||
|
class COutilModbus : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit COutilModbus(QObject *parent = 0);
|
||||||
|
~COutilModbus();
|
||||||
|
int Start();
|
||||||
|
|
||||||
|
|
||||||
|
MainWindow *w;
|
||||||
|
CModbusSlave *mModbusSEIEmulator;
|
||||||
|
CModbusMaster *mModbusCCEmulator;
|
||||||
|
CModbusRepository mSEIModbusRepo,mCCModbusRepo;
|
||||||
|
CZTInfo mCurZTInfo, mSEIZTInfo;
|
||||||
|
|
||||||
|
CModbusPage *mModbusPageHandle;
|
||||||
|
CSEIModbusPage *mSEIModbusPageHandle;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//Modules interfaces
|
||||||
|
//CMainPage
|
||||||
|
int ConnectCCToZTButtonPressed(QString IP, int Port);
|
||||||
|
int DisconnectCCFromZTButtonPressed();
|
||||||
|
int SetCCReqDelay(int delay);
|
||||||
|
int SendMasterReadCommand();
|
||||||
|
int UpdateZTInfo(CZTInfo *DataStruct, CModbusRepository* SourceRepo);
|
||||||
|
int SendAN1Request();
|
||||||
|
int SendAN2Request();
|
||||||
|
int SendZTCZT1Request();
|
||||||
|
int SendZTCZT2Request();
|
||||||
|
int SetAutoRequestMode(bool Auto, int Delay);
|
||||||
|
int EnableWatchdog(bool Enabled);
|
||||||
|
int SendDateTime();
|
||||||
|
int SendTrainInfo(QList<qint16> TrainInfo);
|
||||||
|
int SendInhibitZT(qint16 InhibZT1, qint16 InhibZT2);
|
||||||
|
|
||||||
|
int ToggleSEIServerState();
|
||||||
|
bool IsSEIServerOpened();
|
||||||
|
int SEIWatchdogEnable(bool Enabled);
|
||||||
|
int SEIAN1Toggle(bool Enabled);
|
||||||
|
int SEIAN2Toggle(bool Enabled);
|
||||||
|
|
||||||
|
private:
|
||||||
|
QTimer *mAutoRequestTimer;
|
||||||
|
QTimer *mWatchdogTimer;
|
||||||
|
bool mWatchdogEnabled;
|
||||||
|
qint16 mWatchdog;
|
||||||
|
|
||||||
|
QTimer *mSEIWatchdogTimer;
|
||||||
|
qint16 mSEIWatchdogValue;
|
||||||
|
|
||||||
|
quint16 DecToBCDWord(const quint16 word);
|
||||||
|
quint8 DecToBCDByte(const quint8 byte);
|
||||||
|
signals:
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
|
||||||
|
void ModbusMasterConnected(CModbusMaster *);
|
||||||
|
void ModbusMasterDisconnected(CModbusMaster *);
|
||||||
|
void ModbusMasterRepositoryUpdated();
|
||||||
|
|
||||||
|
void SEIModbusConnected(CModbusSlave *);
|
||||||
|
void SEIModbusDisconnected(CModbusSlave *);
|
||||||
|
void SEIRepositoryUpdated();
|
||||||
|
|
||||||
|
void AutoRequestTimeExpired();
|
||||||
|
void WatchdogTimerExpired();
|
||||||
|
|
||||||
|
void SEIWatchdogExpired();
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // OUTILMODBUS_H
|
||||||
@@ -0,0 +1,161 @@
|
|||||||
|
#ifndef PROTOCOLDEFS_H
|
||||||
|
#define PROTOCOLDEFS_H
|
||||||
|
|
||||||
|
|
||||||
|
#define MODBUS_ZT_WATCHDOG_TIMEOUT 3000
|
||||||
|
#define MODBUS_CC_WATCHDOG_TIMEOUT 3000
|
||||||
|
|
||||||
|
#define MODBUS_SEI_WATCHDOG_TIMEOUT 1000
|
||||||
|
|
||||||
|
//ZT - CC modbus table masks
|
||||||
|
|
||||||
|
//Flags definitions for HR2000
|
||||||
|
#define ZT1_PP_INT_FLAG_MASK_1 0x0001
|
||||||
|
#define ZT1_PP_INT_FLAG_MASK_2 0x0002
|
||||||
|
#define ZT1_PP_INT_FLAG_MASK_3 0x0004
|
||||||
|
#define ZT1_PP_INT_FLAG_MASK_4 0x0008
|
||||||
|
#define ZT1_PP_EXT_FLAG_MASK_1 0x0010
|
||||||
|
#define ZT1_PP_EXT_FLAG_MASK_2 0x0020
|
||||||
|
#define ZT1_PP_EXT_FLAG_MASK_3 0x0040
|
||||||
|
#define ZT1_PP_EXT_FLAG_MASK_4 0x0080
|
||||||
|
#define ZT1_PG_FLAG_MASK_1 0x0100
|
||||||
|
#define ZT1_PG_FLAG_MASK_2 0x0200
|
||||||
|
#define ZT1_PG_FLAG_MASK_3 0x0400
|
||||||
|
#define ZT1_PG_FLAG_MASK_4 0x0800
|
||||||
|
#define ZT1_FN_FLAG_MASK_1 0x1000
|
||||||
|
#define ZT1_FN_FLAG_MASK_2 0x2000
|
||||||
|
#define ZT1_FN_FLAG_MASK_3 0x4000
|
||||||
|
#define ZT1_FN_FLAG_MASK_4 0x8000
|
||||||
|
|
||||||
|
//Flags definitions for HR2017
|
||||||
|
#define ZT2_PP_INT_FLAG_MASK_1 0x0001
|
||||||
|
#define ZT2_PP_INT_FLAG_MASK_2 0x0002
|
||||||
|
#define ZT2_PP_INT_FLAG_MASK_3 0x0004
|
||||||
|
#define ZT2_PP_INT_FLAG_MASK_4 0x0008
|
||||||
|
#define ZT2_PP_EXT_FLAG_MASK_1 0x0010
|
||||||
|
#define ZT2_PP_EXT_FLAG_MASK_2 0x0020
|
||||||
|
#define ZT2_PP_EXT_FLAG_MASK_3 0x0040
|
||||||
|
#define ZT2_PP_EXT_FLAG_MASK_4 0x0080
|
||||||
|
///UNUSED FLAGS NECESSARY FOR CC IMPLEMENTATION. MUST ALWAYS BE 0
|
||||||
|
#define ZT2_PG_DUMMY_MASK_1 0x0100 //UNUSED FLAG NECESSARY FOR CC IMPLEMENTATION. MUST ALWAYS BE 0
|
||||||
|
#define ZT2_PG_DUMMY_MASK_2 0x0200 //UNUSED FLAG NECESSARY FOR CC IMPLEMENTATION. MUST ALWAYS BE 0
|
||||||
|
#define ZT2_PG_DUMMY_MASK_3 0x0400 //UNUSED FLAG NECESSARY FOR CC IMPLEMENTATION. MUST ALWAYS BE 0
|
||||||
|
#define ZT2_PG_DUMMY_MASK_4 0x0800 //UNUSED FLAG NECESSARY FOR CC IMPLEMENTATION. MUST ALWAYS BE 0
|
||||||
|
#define ZT2_FN_DUMMY_MASK_5 0x1000 //UNUSED FLAG NECESSARY FOR CC IMPLEMENTATION. MUST ALWAYS BE 0
|
||||||
|
#define ZT2_FN_DUMMY_MASK_6 0x2000 //UNUSED FLAG NECESSARY FOR CC IMPLEMENTATION. MUST ALWAYS BE 0
|
||||||
|
#define ZT2_FN_DUMMY_MASK_7 0x4000 //UNUSED FLAG NECESSARY FOR CC IMPLEMENTATION. MUST ALWAYS BE 0
|
||||||
|
#define ZT2_FV_DUMMY_MASK_8 0x8000 //UNUSED FLAG NECESSARY FOR CC IMPLEMENTATION. MUST ALWAYS BE 0
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
//Flags definitions for HR2026
|
||||||
|
#define ZT1_V00_ALARM_FLAG_MASK 0x0001
|
||||||
|
#define ZT1_PEQ1_ALARM_FLAG_MASK 0x0002
|
||||||
|
#define ZT2_V02_ALARM_FLAG_MASK 0x0004
|
||||||
|
#define ZT2_PEQ2_ALARM_FLAG_MASK 0x0008
|
||||||
|
#define ZT2_ALARM_ITI_DUMMY_FLAG_MASK 0x4000 //UNUSED FLAG NECESSARY FOR CC IMPLEMENTATION. MUST ALWAYS BE 0
|
||||||
|
#define ZT1_ALARM_ITI_FLAG_MASK 0x8000
|
||||||
|
|
||||||
|
//#define MODBUS_CC_AN1_FLAG_MASK 0x0002
|
||||||
|
//#define MODBUS_CC_AN2_FLAG_MASK 0x0001
|
||||||
|
//#define MODBUS_CC_AN_UNUSED_INVALID_MASK 0xFFFC
|
||||||
|
//#define MODBUS_CC_CLOCK_UPDATE_FLAG_MASK 0x0001
|
||||||
|
//#define MODBUS_CC_CLK_UNUSED_INV_MASK 0xFFFE
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//Register addressing
|
||||||
|
//incoming
|
||||||
|
#define MODBUS_ZT_DATA_BASE_REG 2000
|
||||||
|
#define MODBUS_ZT_TABLE_DATA_SIZE 36 //Taille de la table = 36 registres
|
||||||
|
|
||||||
|
#define MODBUS_ZT1_ALARM_DATA_BASE_REG_ADD 2000
|
||||||
|
#define MODBUS_ZT2_ALARM_DATA_BASE_REG_ADD 2017
|
||||||
|
#define MODBUS_MISC_DATA_BASE_REG_ADD 2026
|
||||||
|
#define MODBUS_ZT_WATCHDOG_REG_ADD 2027
|
||||||
|
|
||||||
|
#define MODBUS_ZT1_ALARM_RANKS_BASE_ADD 2001
|
||||||
|
#define MODBUS_ZT1_RANK_PP_INT_1_REG_ADD 2001
|
||||||
|
#define MODBUS_ZT1_RANK_PP_INT_2_REG_ADD 2002
|
||||||
|
#define MODBUS_ZT1_RANK_PP_INT_3_REG_ADD 2003
|
||||||
|
#define MODBUS_ZT1_RANK_PP_INT_4_REG_ADD 2004
|
||||||
|
#define MODBUS_ZT1_RANK_PP_EXT_1_REG_ADD 2005
|
||||||
|
#define MODBUS_ZT1_RANK_PP_EXT_2_REG_ADD 2006
|
||||||
|
#define MODBUS_ZT1_RANK_PP_EXT_3_REG_ADD 2007
|
||||||
|
#define MODBUS_ZT1_RANK_PP_EXT_4_REG_ADD 2008
|
||||||
|
#define MODBUS_ZT1_RANK_PG_1_REG_ADD 2009
|
||||||
|
#define MODBUS_ZT1_RANK_PG_2_REG_ADD 2010
|
||||||
|
#define MODBUS_ZT1_RANK_PG_3_REG_ADD 2011
|
||||||
|
#define MODBUS_ZT1_RANK_PG_4_REG_ADD 2012
|
||||||
|
#define MODBUS_ZT1_RANK_FN_1_REG_ADD 2013
|
||||||
|
#define MODBUS_ZT1_RANK_FN_2_REG_ADD 2014
|
||||||
|
#define MODBUS_ZT1_RANK_FN_3_REG_ADD 2015
|
||||||
|
#define MODBUS_ZT1_RANK_FN_4_REG_ADD 2016
|
||||||
|
|
||||||
|
#define MODBUS_ZT2_ALARM_RANKS_BASE_ADD 2018
|
||||||
|
#define MODBUS_ZT2_RANK_PP_INT_1_REG_ADD 2018
|
||||||
|
#define MODBUS_ZT2_RANK_PP_INT_2_REG_ADD 2019
|
||||||
|
#define MODBUS_ZT2_RANK_PP_INT_3_REG_ADD 2020
|
||||||
|
#define MODBUS_ZT2_RANK_PP_INT_4_REG_ADD 2021
|
||||||
|
#define MODBUS_ZT2_RANK_PP_EXT_1_REG_ADD 2022
|
||||||
|
#define MODBUS_ZT2_RANK_PP_EXT_2_REG_ADD 2023
|
||||||
|
#define MODBUS_ZT2_RANK_PP_EXT_3_REG_ADD 2024
|
||||||
|
#define MODBUS_ZT2_RANK_PP_EXT_4_REG_ADD 2025
|
||||||
|
//UNUSED FLAGS NECESSARY FOR CC IMPLEMENTATION. MUST ALWAYS BE 0
|
||||||
|
#define MODBUS_ZT2_DUMMY_RK_PG_1_REG_ADD 2028 //UNUSED FLAG NECESSARY FOR CC IMPLEMENTATION. MUST ALWAYS BE 0
|
||||||
|
#define MODBUS_ZT2_DUMMY_RK_PG_2_REG_ADD 2029 //UNUSED FLAG NECESSARY FOR CC IMPLEMENTATION. MUST ALWAYS BE 0
|
||||||
|
#define MODBUS_ZT2_DUMMY_RK_PG_3_REG_ADD 2030 //UNUSED FLAG NECESSARY FOR CC IMPLEMENTATION. MUST ALWAYS BE 0
|
||||||
|
#define MODBUS_ZT2_DUMMY_RK_PG_4_REG_ADD 2031 //UNUSED FLAG NECESSARY FOR CC IMPLEMENTATION. MUST ALWAYS BE 0
|
||||||
|
#define MODBUS_ZT2_DUMMY_FN_PG_1_REG_ADD 2032 //UNUSED FLAG NECESSARY FOR CC IMPLEMENTATION. MUST ALWAYS BE 0
|
||||||
|
#define MODBUS_ZT2_DUMMY_FN_PG_2_REG_ADD 2033 //UNUSED FLAG NECESSARY FOR CC IMPLEMENTATION. MUST ALWAYS BE 0
|
||||||
|
#define MODBUS_ZT2_DUMMY_FN_PG_3_REG_ADD 2034 //UNUSED FLAG NECESSARY FOR CC IMPLEMENTATION. MUST ALWAYS BE 0
|
||||||
|
#define MODBUS_ZT2_DUMMY_FN_PG_4_REG_ADD 2035 //UNUSED FLAG NECESSARY FOR CC IMPLEMENTATION. MUST ALWAYS BE 0
|
||||||
|
///////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//Outgoing
|
||||||
|
#define MODBUS_CC_FCYCLE_ZT1_FLAG_MASK 0x0001
|
||||||
|
#define MODBUS_CC_FCYCLE_ZT2_FLAG_MASK 0x0002
|
||||||
|
#define MODBUS_CC_INHIBIT_ZT1_FLAG_MASK 0x0004
|
||||||
|
#define MODBUS_CC_INHIBIT_ZT2_FLAG_MASK 0x0008
|
||||||
|
#define MODBUS_CC_CLK_UPDATE_FLAG_MASK 0x8000
|
||||||
|
|
||||||
|
#define MODBUS_CC_DATA_BASE_REG_ADD 2036
|
||||||
|
#define MODBUS_CC_TABLE_DATA_SIZE 15 //Taille de la table en écriture = 15 registres (2028 à 2042)
|
||||||
|
|
||||||
|
|
||||||
|
#define MODBUS_CC_WATCHDOG_BASE_REG_ADD 2036 //2028
|
||||||
|
#define MODBUS_CC_AN_BASE_REG_ADD 2037 //2029
|
||||||
|
#define MODBUS_CC_ZT1_TRAIN_TYPE_REG_ADD 2038 //2030
|
||||||
|
#define MODBUS_CC_ZT2_TRAIN_TYPE_REG_ADD 2039 //2031
|
||||||
|
#define MODBUS_CC_ZT1_TRAIN_ID_1_REG_ADD 2040//2032
|
||||||
|
#define MODBUS_CC_ZT1_TRAIN_ID_2_REG_ADD 2041 //2033
|
||||||
|
#define MODBUS_CC_ZT1_TRAIN_ID_3_REG_ADD 2042 //2034
|
||||||
|
#define MODBUS_CC_ZT2_TRAIN_ID_1_REG_ADD 2043 //2035
|
||||||
|
#define MODBUS_CC_ZT2_TRAIN_ID_2_REG_ADD 2044 //2036
|
||||||
|
#define MODBUS_CC_ZT2_TRAIN_ID_3_REG_ADD 2045 //2037
|
||||||
|
#define MODBUS_CC_CLK_UPDATE_BASE_REG_ADD 2046 //2038
|
||||||
|
#define MODUBS_CC_CLK_SEC_BASE_REG_ADD 2047 //2039
|
||||||
|
#define MODUBS_CC_CLK_HR_MIN_BASE_REG_ADD 2048 //2040
|
||||||
|
#define MODUBS_CC_CLK_MNT_DAY_BASE_REG_ADD 2049 //2041
|
||||||
|
#define MODUBS_CC_CLK_YEAR_BASE_REG_ADD 2050 //2042
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define SEI_MODBUS_ZT_DATA_BASE_REG 2000
|
||||||
|
#define SEI_MODBUS_ZT_TABLE_DATA_SIZE 28
|
||||||
|
|
||||||
|
#define SEI_MODBUS_SEI_DATA_BASE_REG 2037
|
||||||
|
#define SEI_MODBUS_SEI_TABLE_DATA_SIZE 2
|
||||||
|
|
||||||
|
#define SEI_MODBUS_ZT_WATCHDOG_REG 2027
|
||||||
|
#define SEI_MODBUS_SEI_WATCHDOG_REG 2038
|
||||||
|
#define SEI_MODBUS_SEI_WATCHDOG_MASK 0x0001
|
||||||
|
|
||||||
|
#define SEI_MODBUS_SEI_ALARMS_RESET_REG 2037
|
||||||
|
#define SEI_MODBUS_SEI_ZT1_ALARM_RESET_MASK 0X0001
|
||||||
|
#define SEI_MODBUS_SEI_ZT2_ALARM_RESET_MASK 0X0002
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif // PROTOCOLDEFS_H
|
||||||
@@ -0,0 +1,231 @@
|
|||||||
|
#include "SEIModbusPage.h"
|
||||||
|
#include "ui_SEIModbusPage.h"
|
||||||
|
#include "OutilModbus.h"
|
||||||
|
|
||||||
|
CSEIModbusPage::CSEIModbusPage(QWidget *parent) :
|
||||||
|
QWidget(parent),
|
||||||
|
ui(new Ui::CSEIModbusPage)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
QFont font;
|
||||||
|
font.setPointSize(18);
|
||||||
|
ui->mSEISimTitleLabel->setFont(font);
|
||||||
|
ui->mSEISimTitleLabel->setAlignment(Qt::AlignCenter);
|
||||||
|
QPalette pal = QPalette(ui->mSEISimTitleLabel->palette());
|
||||||
|
pal.setColor(QPalette::WindowText,QColor(Qt::darkBlue));
|
||||||
|
ui->mSEISimTitleLabel->setPalette(pal);
|
||||||
|
|
||||||
|
SetConnected(false);
|
||||||
|
|
||||||
|
connect(ui->mStartStopServerBtn,SIGNAL(clicked()),this,SLOT(ServerStartStopPressed()));
|
||||||
|
connect(ui->mEnableWDChkBx,SIGNAL(toggled(bool)),this,SLOT(EnableWatchdogChkBxClicked()));
|
||||||
|
connect(ui->mAN1ChkBx,SIGNAL(toggled(bool)),this,SLOT(AN1ChkBoxToggled()));
|
||||||
|
connect(ui->mAN2ChkBx,SIGNAL(toggled(bool)),this,SLOT(AN2ChkBoxToggled()));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
QList<QTreeWidgetItem *> Items;
|
||||||
|
ui->mZTAlarmDataTree->setColumnCount(3);
|
||||||
|
ui->mZTAlarmDataTree->setHeaderItem(new QTreeWidgetItem(QStringList()<<"Flag/Alarme"<<"Valeur"<<"Rang"));
|
||||||
|
|
||||||
|
//Items.append(new QTreeWidgetItem(QStringList(QString().fromUtf8("Pneu De Guidage ZT1 #2") << QString().fromUtf8("Pneu De Guidage ZT1 #2") << QString().fromUtf8("Pneu De Guidage ZT1 #2"))));
|
||||||
|
Items.append(new QTreeWidgetItem(QStringList()<<"ZT1"));
|
||||||
|
Items.append(new QTreeWidgetItem(QStringList()<<"ZT2"));
|
||||||
|
Items.append(new QTreeWidgetItem(QStringList()<<"ZT"));
|
||||||
|
|
||||||
|
QTreeWidgetItem* Item;
|
||||||
|
// Item = new QTreeWidgetItem(QStringList()<<QString().fromUtf8("Alarmes"));
|
||||||
|
// Items.at(0)->addChild(Item);
|
||||||
|
|
||||||
|
Item = Items.at(0);
|
||||||
|
|
||||||
|
Item->addChild(new QTreeWidgetItem(QStringList()<<QString().fromUtf8("Pneu Porteur Intérieur ZT1 #1")<<"0"<<"---"));
|
||||||
|
Item->addChild(new QTreeWidgetItem(QStringList()<<QString().fromUtf8("Pneu Porteur Intérieur ZT1 #2")<<"0"<<"---"));
|
||||||
|
Item->addChild(new QTreeWidgetItem(QStringList()<<QString().fromUtf8("Pneu Porteur Intérieur ZT1 #3")<<"0"<<"---"));
|
||||||
|
Item->addChild(new QTreeWidgetItem(QStringList()<<QString().fromUtf8("Pneu Porteur Intérieur ZT1 #4")<<"0"<<"---"));
|
||||||
|
|
||||||
|
Item->addChild(new QTreeWidgetItem(QStringList()<<QString().fromUtf8("Pneu Porteur Extérieur ZT1 #1")<<"0"<<"---"));
|
||||||
|
Item->addChild(new QTreeWidgetItem(QStringList()<<QString().fromUtf8("Pneu Porteur Extérieur ZT1 #2")<<"0"<<"---"));
|
||||||
|
Item->addChild(new QTreeWidgetItem(QStringList()<<QString().fromUtf8("Pneu Porteur Extérieur ZT1 #3")<<"0"<<"---"));
|
||||||
|
Item->addChild(new QTreeWidgetItem(QStringList()<<QString().fromUtf8("Pneu Porteur Extérieur ZT1 #4")<<"0"<<"---"));
|
||||||
|
|
||||||
|
Item->addChild(new QTreeWidgetItem(QStringList()<<QString().fromUtf8("Pneu De Guidage ZT1 #1")<<"0"<<"---"));
|
||||||
|
Item->addChild(new QTreeWidgetItem(QStringList()<<QString().fromUtf8("Pneu De Guidage ZT1 #2")<<"0"<<"---"));
|
||||||
|
Item->addChild(new QTreeWidgetItem(QStringList()<<QString().fromUtf8("Pneu De Guidage ZT1 #3")<<"0"<<"---"));
|
||||||
|
Item->addChild(new QTreeWidgetItem(QStringList()<<QString().fromUtf8("Pneu De Guidage ZT1 #4")<<"0"<<"---"));
|
||||||
|
|
||||||
|
Item ->addChild(new QTreeWidgetItem(QStringList()<<QString().fromUtf8("Frotteur Négatif ZT1 #1")<<"0"<<"---"));
|
||||||
|
Item->addChild(new QTreeWidgetItem(QStringList()<<QString().fromUtf8("Frotteur Négatif ZT1 #2")<<"0"<<"---"));
|
||||||
|
Item->addChild(new QTreeWidgetItem(QStringList()<<QString().fromUtf8("Frotteur Négatif ZT1 #3")<<"0"<<"---"));
|
||||||
|
Item->addChild(new QTreeWidgetItem(QStringList()<<QString().fromUtf8("Frotteur Négatif ZT1 #4")<<"0"<<"---"));
|
||||||
|
|
||||||
|
Item->addChild(new QTreeWidgetItem(QStringList()<<QString().fromUtf8("Itinéraire")<<"0"<<"---"));
|
||||||
|
|
||||||
|
Item->addChild(new QTreeWidgetItem(QStringList()<<QString().fromUtf8("Alarme V00 ZT1")<<"0"<<"---"));
|
||||||
|
Item->addChild(new QTreeWidgetItem(QStringList()<<QString().fromUtf8("Panne Équipement ZT1")<<"0"<<"---"));
|
||||||
|
|
||||||
|
Item = Items.at(1);
|
||||||
|
|
||||||
|
Item->addChild(new QTreeWidgetItem(QStringList()<<QString().fromUtf8("Pneu Porteur Intérieur ZT2 #1")<<"0"<<"---"));
|
||||||
|
Item->addChild(new QTreeWidgetItem(QStringList()<<QString().fromUtf8("Pneu Porteur Intérieur ZT2 #2")<<"0"<<"---"));
|
||||||
|
Item->addChild(new QTreeWidgetItem(QStringList()<<QString().fromUtf8("Pneu Porteur Intérieur ZT2 #3")<<"0"<<"---"));
|
||||||
|
Item->addChild(new QTreeWidgetItem(QStringList()<<QString().fromUtf8("Pneu Porteur Intérieur ZT2 #4")<<"0"<<"---"));
|
||||||
|
|
||||||
|
// Items.at(1)->addChild(new QTreeWidgetItem(QStringList()<<QString().fromUtf8(" ")));
|
||||||
|
|
||||||
|
Item->addChild(new QTreeWidgetItem(QStringList()<<QString().fromUtf8("Pneu Porteur Extérieur ZT2 #1")<<"0"<<"---"));
|
||||||
|
Item->addChild(new QTreeWidgetItem(QStringList()<<QString().fromUtf8("Pneu Porteur Extérieur ZT2 #2")<<"0"<<"---"));
|
||||||
|
Item->addChild(new QTreeWidgetItem(QStringList()<<QString().fromUtf8("Pneu Porteur Extérieur ZT2 #3")<<"0"<<"---"));
|
||||||
|
Item->addChild(new QTreeWidgetItem(QStringList()<<QString().fromUtf8("Pneu Porteur Extérieur ZT2 #4")<<"0"<<"---"));
|
||||||
|
|
||||||
|
Item->addChild(new QTreeWidgetItem(QStringList()<<QString().fromUtf8("Alarme V02 ZT2")<<"0"<<"---"));
|
||||||
|
Item->addChild(new QTreeWidgetItem(QStringList()<<QString().fromUtf8("Panne Équipement ZT2")<<"0"<<"---"));
|
||||||
|
|
||||||
|
Item = Items.at(2);
|
||||||
|
Item->addChild(new QTreeWidgetItem(QStringList()<<QString().fromUtf8("Watchdog ZT")<<"0"<<"---"));
|
||||||
|
|
||||||
|
|
||||||
|
ui->mZTAlarmDataTree->insertTopLevelItems(0,Items);
|
||||||
|
ui->mZTAlarmDataTree->resizeColumnToContents(1);
|
||||||
|
|
||||||
|
ui->mZTAlarmDataTree->expandAll();
|
||||||
|
ui->mZTAlarmDataTree->resizeColumnToContents(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSEIModbusPage::UpdateZTInfo(CZTInfo *DataStruct)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
QTreeWidgetItem* Item;
|
||||||
|
QString TempStr;
|
||||||
|
|
||||||
|
//ZT1
|
||||||
|
Item = ui->mZTAlarmDataTree->topLevelItem(0);
|
||||||
|
|
||||||
|
Item->child(0)->setText(1,QString("%1").arg(DataStruct->mZT1PPIAlarmFlag1));
|
||||||
|
Item->child(1)->setText(1,QString("%1").arg(DataStruct->mZT1PPIAlarmFlag2));
|
||||||
|
Item->child(2)->setText(1,QString("%1").arg(DataStruct->mZT1PPIAlarmFlag3));
|
||||||
|
Item->child(3)->setText(1,QString("%1").arg(DataStruct->mZT1PPIAlarmFlag4));
|
||||||
|
|
||||||
|
Item->child(4)->setText(1,QString("%1").arg(DataStruct->mZT1PPEAlarmFlag1));
|
||||||
|
Item->child(5)->setText(1,QString("%1").arg(DataStruct->mZT1PPEAlarmFlag2));
|
||||||
|
Item->child(6)->setText(1,QString("%1").arg(DataStruct->mZT1PPEAlarmFlag3));
|
||||||
|
Item->child(7)->setText(1,QString("%1").arg(DataStruct->mZT1PPEAlarmFlag4));
|
||||||
|
|
||||||
|
Item->child(8)->setText(1,QString("%1").arg(DataStruct->mZT1PGAlarmFlag1));
|
||||||
|
Item->child(9)->setText(1,QString("%1").arg(DataStruct->mZT1PGAlarmFlag2));
|
||||||
|
Item->child(10)->setText(1,QString("%1").arg(DataStruct->mZT1PGAlarmFlag3));
|
||||||
|
Item->child(11)->setText(1,QString("%1").arg(DataStruct->mZT1PGAlarmFlag4));
|
||||||
|
|
||||||
|
Item->child(12)->setText(1,QString("%1").arg(DataStruct->mZT1FNAlarmFlag1));
|
||||||
|
Item->child(13)->setText(1,QString("%1").arg(DataStruct->mZT1FNAlarmFlag2));
|
||||||
|
Item->child(14)->setText(1,QString("%1").arg(DataStruct->mZT1FNAlarmFlag3));
|
||||||
|
Item->child(15)->setText(1,QString("%1").arg(DataStruct->mZT1FNAlarmFlag4));
|
||||||
|
|
||||||
|
if(DataStruct->mITI10_12Flag == 0)
|
||||||
|
{
|
||||||
|
TempStr = "Principal";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TempStr = "Secondaire";
|
||||||
|
}
|
||||||
|
Item->child(16)->setText(1,TempStr);
|
||||||
|
|
||||||
|
Item->child(17)->setText(1,QString("%1").arg(DataStruct->mZT1V00AlarmFlag));
|
||||||
|
Item->child(18)->setText(1,QString("%1").arg(DataStruct->mZT1PEQ1AlarmFlag));
|
||||||
|
|
||||||
|
for(int i = 0; i < 16; i++)
|
||||||
|
{
|
||||||
|
Item->child(i)->setText(2,QString("%1").arg(DataStruct->mZT1Ranks.at(i)));
|
||||||
|
}
|
||||||
|
|
||||||
|
//ZT2
|
||||||
|
Item = ui->mZTAlarmDataTree->topLevelItem(1);
|
||||||
|
|
||||||
|
Item->child(0)->setText(1,QString("%1").arg(DataStruct->mZT2PPIAlarmFlag1));
|
||||||
|
Item->child(1)->setText(1,QString("%1").arg(DataStruct->mZT2PPIAlarmFlag2));
|
||||||
|
Item->child(2)->setText(1,QString("%1").arg(DataStruct->mZT2PPIAlarmFlag3));
|
||||||
|
Item->child(3)->setText(1,QString("%1").arg(DataStruct->mZT2PPIAlarmFlag4));
|
||||||
|
|
||||||
|
Item->child(4)->setText(1,QString("%1").arg(DataStruct->mZT2PPEAlarmFlag1));
|
||||||
|
Item->child(5)->setText(1,QString("%1").arg(DataStruct->mZT2PPEAlarmFlag2));
|
||||||
|
Item->child(6)->setText(1,QString("%1").arg(DataStruct->mZT2PPEAlarmFlag3));
|
||||||
|
Item->child(7)->setText(1,QString("%1").arg(DataStruct->mZT2PPEAlarmFlag4));
|
||||||
|
|
||||||
|
Item->child(8)->setText(1,QString("%1").arg(DataStruct->mZT2V02AlarmFlag));
|
||||||
|
Item->child(9)->setText(1,QString("%1").arg(DataStruct->mZT2PEQ2AlarmFlag));
|
||||||
|
|
||||||
|
for(int i = 0; i < 8; i++)
|
||||||
|
{
|
||||||
|
Item->child(i)->setText(2,QString("%1").arg(DataStruct->mZT2Ranks.at(i)));
|
||||||
|
}
|
||||||
|
|
||||||
|
//Watchdog
|
||||||
|
Item = ui->mZTAlarmDataTree->topLevelItem(2);
|
||||||
|
Item->child(0)->setText(1,QString("%1").arg(DataStruct->mWatchdogZT));
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CSEIModbusPage::~CSEIModbusPage()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int CSEIModbusPage::SetConnected(bool Connected)
|
||||||
|
{
|
||||||
|
QFont font;
|
||||||
|
font.setPointSize(18);
|
||||||
|
font.setBold(true);
|
||||||
|
ui->mSEIConnectStatLabel->setFont(font);
|
||||||
|
ui->mSEIConnectStatLabel->setAlignment(Qt::AlignCenter);
|
||||||
|
QPalette pal = QPalette(ui->mSEIConnectStatLabel->palette());
|
||||||
|
|
||||||
|
if(Connected)
|
||||||
|
{
|
||||||
|
pal.setColor(QPalette::WindowText,QColor(Qt::green));
|
||||||
|
ui->mSEIConnectStatLabel->setPalette(pal);
|
||||||
|
ui->mSEIConnectStatLabel->setText("ZT: Connected");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pal.setColor(QPalette::WindowText,QColor(Qt::red));
|
||||||
|
ui->mSEIConnectStatLabel->setPalette(pal);
|
||||||
|
ui->mSEIConnectStatLabel->setText("ZT: Disconnected");
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSEIModbusPage::ServerStartStopPressed()
|
||||||
|
{
|
||||||
|
if(mProgramHandle->ToggleSEIServerState() != 0)
|
||||||
|
{
|
||||||
|
if(mProgramHandle->IsSEIServerOpened() == true)
|
||||||
|
{
|
||||||
|
ui->mStartStopServerBtn->setText("Arreter Serveur");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ui->mStartStopServerBtn->setText("Démarrer Serveur");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSEIModbusPage::EnableWatchdogChkBxClicked()
|
||||||
|
{
|
||||||
|
mProgramHandle->SEIWatchdogEnable(ui->mEnableWDChkBx->checkState() == Qt::Checked);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSEIModbusPage::AN1ChkBoxToggled()
|
||||||
|
{
|
||||||
|
mProgramHandle->SEIAN1Toggle(ui->mAN1ChkBx->checkState() == Qt::Checked);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSEIModbusPage::AN2ChkBoxToggled()
|
||||||
|
{
|
||||||
|
mProgramHandle->SEIAN2Toggle(ui->mAN2ChkBx->checkState() == Qt::Checked);
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
#ifndef SEIMODBUSPAGE_H
|
||||||
|
#define SEIMODBUSPAGE_H
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
#include "ZTInfo.h"
|
||||||
|
|
||||||
|
class COutilModbus;
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class CSEIModbusPage;
|
||||||
|
}
|
||||||
|
|
||||||
|
class CSEIModbusPage : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit CSEIModbusPage(QWidget *parent = 0);
|
||||||
|
~CSEIModbusPage();
|
||||||
|
|
||||||
|
|
||||||
|
COutilModbus *mProgramHandle;
|
||||||
|
|
||||||
|
int SetConnected(bool Connected);
|
||||||
|
void UpdateZTInfo(CZTInfo *DataStruct);
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::CSEIModbusPage *ui;
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void ServerStartStopPressed();
|
||||||
|
void EnableWatchdogChkBxClicked();
|
||||||
|
void AN1ChkBoxToggled();
|
||||||
|
void AN2ChkBoxToggled();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // SEIMODBUSPAGE_H
|
||||||
@@ -0,0 +1,128 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>CSEIModbusPage</class>
|
||||||
|
<widget class="QWidget" name="CSEIModbusPage">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>917</width>
|
||||||
|
<height>762</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Form</string>
|
||||||
|
</property>
|
||||||
|
<widget class="QLabel" name="mSEISimTitleLabel">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>250</x>
|
||||||
|
<y>30</y>
|
||||||
|
<width>361</width>
|
||||||
|
<height>31</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Simulateur SEI</string>
|
||||||
|
</property>
|
||||||
|
<property name="textFormat">
|
||||||
|
<enum>Qt::AutoText</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="mSEIConnectStatLabel">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>650</x>
|
||||||
|
<y>100</y>
|
||||||
|
<width>271</width>
|
||||||
|
<height>41</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>ZT:NON CONNECTÉE</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QPushButton" name="mStartStopServerBtn">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>750</x>
|
||||||
|
<y>30</y>
|
||||||
|
<width>101</width>
|
||||||
|
<height>23</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Démarrer Serveur</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="mServerLabel">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>780</x>
|
||||||
|
<y>10</y>
|
||||||
|
<width>46</width>
|
||||||
|
<height>13</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Serveur</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QTreeWidget" name="mZTAlarmDataTree">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>30</x>
|
||||||
|
<y>110</y>
|
||||||
|
<width>541</width>
|
||||||
|
<height>641</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<column>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">1</string>
|
||||||
|
</property>
|
||||||
|
</column>
|
||||||
|
</widget>
|
||||||
|
<widget class="QCheckBox" name="mEnableWDChkBx">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>660</x>
|
||||||
|
<y>180</y>
|
||||||
|
<width>70</width>
|
||||||
|
<height>17</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Watchdog</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QCheckBox" name="mAN1ChkBx">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>660</x>
|
||||||
|
<y>210</y>
|
||||||
|
<width>70</width>
|
||||||
|
<height>17</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>AN1</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QCheckBox" name="mAN2ChkBx">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>660</x>
|
||||||
|
<y>240</y>
|
||||||
|
<width>70</width>
|
||||||
|
<height>17</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>AN2</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
@@ -0,0 +1,240 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
** Copyright (c) 2000-2003 Wayne Roth
|
||||||
|
** Copyright (c) 2004-2007 Stefan Sander
|
||||||
|
** Copyright (c) 2007 Michal Policht
|
||||||
|
** Copyright (c) 2008 Brandon Fosdick
|
||||||
|
** Copyright (c) 2009-2010 Liam Staskawicz
|
||||||
|
** Copyright (c) 2011 Debao Zhang
|
||||||
|
** All right reserved.
|
||||||
|
** Web: http://code.google.com/p/qextserialport/
|
||||||
|
**
|
||||||
|
** Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
** a copy of this software and associated documentation files (the
|
||||||
|
** "Software"), to deal in the Software without restriction, including
|
||||||
|
** without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
** distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
** permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
** the following conditions:
|
||||||
|
**
|
||||||
|
** The above copyright notice and this permission notice shall be
|
||||||
|
** included in all copies or substantial portions of the Software.
|
||||||
|
**
|
||||||
|
** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
** NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||||
|
** LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
** OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
** WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef _QEXTSERIALPORT_H_
|
||||||
|
#define _QEXTSERIALPORT_H_
|
||||||
|
|
||||||
|
#include <QtCore/QIODevice>
|
||||||
|
#include "qextserialport_global.h"
|
||||||
|
#ifdef Q_OS_UNIX
|
||||||
|
#include <termios.h>
|
||||||
|
#endif
|
||||||
|
/*line status constants*/
|
||||||
|
// ### QESP2.0 move to enum
|
||||||
|
#define LS_CTS 0x01
|
||||||
|
#define LS_DSR 0x02
|
||||||
|
#define LS_DCD 0x04
|
||||||
|
#define LS_RI 0x08
|
||||||
|
#define LS_RTS 0x10
|
||||||
|
#define LS_DTR 0x20
|
||||||
|
#define LS_ST 0x40
|
||||||
|
#define LS_SR 0x80
|
||||||
|
|
||||||
|
/*error constants*/
|
||||||
|
// ### QESP2.0 move to enum
|
||||||
|
#define E_NO_ERROR 0
|
||||||
|
#define E_INVALID_FD 1
|
||||||
|
#define E_NO_MEMORY 2
|
||||||
|
#define E_CAUGHT_NON_BLOCKED_SIGNAL 3
|
||||||
|
#define E_PORT_TIMEOUT 4
|
||||||
|
#define E_INVALID_DEVICE 5
|
||||||
|
#define E_BREAK_CONDITION 6
|
||||||
|
#define E_FRAMING_ERROR 7
|
||||||
|
#define E_IO_ERROR 8
|
||||||
|
#define E_BUFFER_OVERRUN 9
|
||||||
|
#define E_RECEIVE_OVERFLOW 10
|
||||||
|
#define E_RECEIVE_PARITY_ERROR 11
|
||||||
|
#define E_TRANSMIT_OVERFLOW 12
|
||||||
|
#define E_READ_FAILED 13
|
||||||
|
#define E_WRITE_FAILED 14
|
||||||
|
#define E_FILE_NOT_FOUND 15
|
||||||
|
#define E_PERMISSION_DENIED 16
|
||||||
|
#define E_AGAIN 17
|
||||||
|
|
||||||
|
enum BaudRateType
|
||||||
|
{
|
||||||
|
#if defined(Q_OS_UNIX) || defined(qdoc)
|
||||||
|
BAUD50 = 50, //POSIX ONLY
|
||||||
|
BAUD75 = 75, //POSIX ONLY
|
||||||
|
BAUD134 = 134, //POSIX ONLY
|
||||||
|
BAUD150 = 150, //POSIX ONLY
|
||||||
|
BAUD200 = 200, //POSIX ONLY
|
||||||
|
BAUD1800 = 1800, //POSIX ONLY
|
||||||
|
# if defined(B76800) || defined(qdoc)
|
||||||
|
BAUD76800 = 76800, //POSIX ONLY
|
||||||
|
# endif
|
||||||
|
# if (defined(B230400) && defined(B4000000)) || defined(qdoc)
|
||||||
|
BAUD230400 = 230400, //POSIX ONLY
|
||||||
|
BAUD460800 = 460800, //POSIX ONLY
|
||||||
|
BAUD500000 = 500000, //POSIX ONLY
|
||||||
|
BAUD576000 = 576000, //POSIX ONLY
|
||||||
|
BAUD921600 = 921600, //POSIX ONLY
|
||||||
|
BAUD1000000 = 1000000, //POSIX ONLY
|
||||||
|
BAUD1152000 = 1152000, //POSIX ONLY
|
||||||
|
BAUD1500000 = 1500000, //POSIX ONLY
|
||||||
|
BAUD2000000 = 2000000, //POSIX ONLY
|
||||||
|
BAUD2500000 = 2500000, //POSIX ONLY
|
||||||
|
BAUD3000000 = 3000000, //POSIX ONLY
|
||||||
|
BAUD3500000 = 3500000, //POSIX ONLY
|
||||||
|
BAUD4000000 = 4000000, //POSIX ONLY
|
||||||
|
# endif
|
||||||
|
#endif //Q_OS_UNIX
|
||||||
|
#if defined(Q_OS_WIN) || defined(qdoc)
|
||||||
|
BAUD14400 = 14400, //WINDOWS ONLY
|
||||||
|
BAUD56000 = 56000, //WINDOWS ONLY
|
||||||
|
BAUD128000 = 128000, //WINDOWS ONLY
|
||||||
|
BAUD256000 = 256000, //WINDOWS ONLY
|
||||||
|
#endif //Q_OS_WIN
|
||||||
|
BAUD110 = 110,
|
||||||
|
BAUD300 = 300,
|
||||||
|
BAUD600 = 600,
|
||||||
|
BAUD1200 = 1200,
|
||||||
|
BAUD2400 = 2400,
|
||||||
|
BAUD4800 = 4800,
|
||||||
|
BAUD9600 = 9600,
|
||||||
|
BAUD19200 = 19200,
|
||||||
|
BAUD38400 = 38400,
|
||||||
|
BAUD57600 = 57600,
|
||||||
|
BAUD115200 = 115200
|
||||||
|
};
|
||||||
|
|
||||||
|
enum DataBitsType
|
||||||
|
{
|
||||||
|
DATA_5 = 5,
|
||||||
|
DATA_6 = 6,
|
||||||
|
DATA_7 = 7,
|
||||||
|
DATA_8 = 8
|
||||||
|
};
|
||||||
|
|
||||||
|
enum ParityType
|
||||||
|
{
|
||||||
|
PAR_NONE,
|
||||||
|
PAR_ODD,
|
||||||
|
PAR_EVEN,
|
||||||
|
#if defined(Q_OS_WIN) || defined(qdoc)
|
||||||
|
PAR_MARK, //WINDOWS ONLY
|
||||||
|
#endif
|
||||||
|
PAR_SPACE
|
||||||
|
};
|
||||||
|
|
||||||
|
enum StopBitsType
|
||||||
|
{
|
||||||
|
STOP_1,
|
||||||
|
#if defined(Q_OS_WIN) || defined(qdoc)
|
||||||
|
STOP_1_5, //WINDOWS ONLY
|
||||||
|
#endif
|
||||||
|
STOP_2
|
||||||
|
};
|
||||||
|
|
||||||
|
enum FlowType
|
||||||
|
{
|
||||||
|
FLOW_OFF,
|
||||||
|
FLOW_HARDWARE,
|
||||||
|
FLOW_XONXOFF
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* structure to contain port settings
|
||||||
|
*/
|
||||||
|
struct PortSettings
|
||||||
|
{
|
||||||
|
BaudRateType BaudRate;
|
||||||
|
DataBitsType DataBits;
|
||||||
|
ParityType Parity;
|
||||||
|
StopBitsType StopBits;
|
||||||
|
FlowType FlowControl;
|
||||||
|
long Timeout_Millisec;
|
||||||
|
};
|
||||||
|
|
||||||
|
class QextSerialPortPrivate;
|
||||||
|
class QEXTSERIALPORT_EXPORT QextSerialPort: public QIODevice
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
Q_DECLARE_PRIVATE(QextSerialPort)
|
||||||
|
Q_ENUMS(QueryMode)
|
||||||
|
Q_PROPERTY(QString portName READ portName WRITE setPortName)
|
||||||
|
Q_PROPERTY(QueryMode queryMode READ queryMode WRITE setQueryMode)
|
||||||
|
public:
|
||||||
|
enum QueryMode {
|
||||||
|
Polling,
|
||||||
|
EventDriven
|
||||||
|
};
|
||||||
|
|
||||||
|
explicit QextSerialPort(QueryMode mode = EventDriven, QObject *parent = 0);
|
||||||
|
explicit QextSerialPort(const QString &name, QueryMode mode = EventDriven, QObject *parent = 0);
|
||||||
|
explicit QextSerialPort(const PortSettings &s, QueryMode mode = EventDriven, QObject *parent = 0);
|
||||||
|
QextSerialPort(const QString &name, const PortSettings &s, QueryMode mode = EventDriven, QObject *parent=0);
|
||||||
|
|
||||||
|
~QextSerialPort();
|
||||||
|
|
||||||
|
QString portName() const;
|
||||||
|
QueryMode queryMode() const;
|
||||||
|
BaudRateType baudRate() const;
|
||||||
|
DataBitsType dataBits() const;
|
||||||
|
ParityType parity() const;
|
||||||
|
StopBitsType stopBits() const;
|
||||||
|
FlowType flowControl() const;
|
||||||
|
|
||||||
|
bool open(OpenMode mode);
|
||||||
|
bool isSequential() const;
|
||||||
|
void close();
|
||||||
|
void flush();
|
||||||
|
qint64 bytesAvailable() const;
|
||||||
|
bool canReadLine() const;
|
||||||
|
QByteArray readAll();
|
||||||
|
|
||||||
|
ulong lastError() const;
|
||||||
|
|
||||||
|
ulong lineStatus();
|
||||||
|
QString errorString();
|
||||||
|
|
||||||
|
public Q_SLOTS:
|
||||||
|
void setPortName(const QString &name);
|
||||||
|
void setQueryMode(QueryMode mode);
|
||||||
|
void setBaudRate(BaudRateType);
|
||||||
|
void setDataBits(DataBitsType);
|
||||||
|
void setParity(ParityType);
|
||||||
|
void setStopBits(StopBitsType);
|
||||||
|
void setFlowControl(FlowType);
|
||||||
|
void setTimeout(long);
|
||||||
|
|
||||||
|
void setDtr(bool set=true);
|
||||||
|
void setRts(bool set=true);
|
||||||
|
|
||||||
|
Q_SIGNALS:
|
||||||
|
void dsrChanged(bool status);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
qint64 readData(char *data, qint64 maxSize);
|
||||||
|
qint64 writeData(const char *data, qint64 maxSize);
|
||||||
|
|
||||||
|
private:
|
||||||
|
Q_DISABLE_COPY(QextSerialPort)
|
||||||
|
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
Q_PRIVATE_SLOT(d_func(), void _q_onWinEvent(HANDLE))
|
||||||
|
#endif
|
||||||
|
Q_PRIVATE_SLOT(d_func(), void _q_canRead())
|
||||||
|
|
||||||
|
QextSerialPortPrivate *const d_ptr;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,240 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
** Copyright (c) 2000-2003 Wayne Roth
|
||||||
|
** Copyright (c) 2004-2007 Stefan Sander
|
||||||
|
** Copyright (c) 2007 Michal Policht
|
||||||
|
** Copyright (c) 2008 Brandon Fosdick
|
||||||
|
** Copyright (c) 2009-2010 Liam Staskawicz
|
||||||
|
** Copyright (c) 2011 Debao Zhang
|
||||||
|
** All right reserved.
|
||||||
|
** Web: http://code.google.com/p/qextserialport/
|
||||||
|
**
|
||||||
|
** Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
** a copy of this software and associated documentation files (the
|
||||||
|
** "Software"), to deal in the Software without restriction, including
|
||||||
|
** without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
** distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
** permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
** the following conditions:
|
||||||
|
**
|
||||||
|
** The above copyright notice and this permission notice shall be
|
||||||
|
** included in all copies or substantial portions of the Software.
|
||||||
|
**
|
||||||
|
** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
** NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||||
|
** LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
** OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
** WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef _QEXTSERIALPORT_H_
|
||||||
|
#define _QEXTSERIALPORT_H_
|
||||||
|
|
||||||
|
#include <QtCore/QIODevice>
|
||||||
|
#include "qextserialport_global.h"
|
||||||
|
#ifdef Q_OS_UNIX
|
||||||
|
#include <termios.h>
|
||||||
|
#endif
|
||||||
|
/*line status constants*/
|
||||||
|
// ### QESP2.0 move to enum
|
||||||
|
#define LS_CTS 0x01
|
||||||
|
#define LS_DSR 0x02
|
||||||
|
#define LS_DCD 0x04
|
||||||
|
#define LS_RI 0x08
|
||||||
|
#define LS_RTS 0x10
|
||||||
|
#define LS_DTR 0x20
|
||||||
|
#define LS_ST 0x40
|
||||||
|
#define LS_SR 0x80
|
||||||
|
|
||||||
|
/*error constants*/
|
||||||
|
// ### QESP2.0 move to enum
|
||||||
|
#define E_NO_ERROR 0
|
||||||
|
#define E_INVALID_FD 1
|
||||||
|
#define E_NO_MEMORY 2
|
||||||
|
#define E_CAUGHT_NON_BLOCKED_SIGNAL 3
|
||||||
|
#define E_PORT_TIMEOUT 4
|
||||||
|
#define E_INVALID_DEVICE 5
|
||||||
|
#define E_BREAK_CONDITION 6
|
||||||
|
#define E_FRAMING_ERROR 7
|
||||||
|
#define E_IO_ERROR 8
|
||||||
|
#define E_BUFFER_OVERRUN 9
|
||||||
|
#define E_RECEIVE_OVERFLOW 10
|
||||||
|
#define E_RECEIVE_PARITY_ERROR 11
|
||||||
|
#define E_TRANSMIT_OVERFLOW 12
|
||||||
|
#define E_READ_FAILED 13
|
||||||
|
#define E_WRITE_FAILED 14
|
||||||
|
#define E_FILE_NOT_FOUND 15
|
||||||
|
#define E_PERMISSION_DENIED 16
|
||||||
|
#define E_AGAIN 17
|
||||||
|
|
||||||
|
enum BaudRateType
|
||||||
|
{
|
||||||
|
#if defined(Q_OS_UNIX) || defined(qdoc)
|
||||||
|
BAUD50 = 50, //POSIX ONLY
|
||||||
|
BAUD75 = 75, //POSIX ONLY
|
||||||
|
BAUD134 = 134, //POSIX ONLY
|
||||||
|
BAUD150 = 150, //POSIX ONLY
|
||||||
|
BAUD200 = 200, //POSIX ONLY
|
||||||
|
BAUD1800 = 1800, //POSIX ONLY
|
||||||
|
# if defined(B76800) || defined(qdoc)
|
||||||
|
BAUD76800 = 76800, //POSIX ONLY
|
||||||
|
# endif
|
||||||
|
# if (defined(B230400) && defined(B4000000)) || defined(qdoc)
|
||||||
|
BAUD230400 = 230400, //POSIX ONLY
|
||||||
|
BAUD460800 = 460800, //POSIX ONLY
|
||||||
|
BAUD500000 = 500000, //POSIX ONLY
|
||||||
|
BAUD576000 = 576000, //POSIX ONLY
|
||||||
|
BAUD921600 = 921600, //POSIX ONLY
|
||||||
|
BAUD1000000 = 1000000, //POSIX ONLY
|
||||||
|
BAUD1152000 = 1152000, //POSIX ONLY
|
||||||
|
BAUD1500000 = 1500000, //POSIX ONLY
|
||||||
|
BAUD2000000 = 2000000, //POSIX ONLY
|
||||||
|
BAUD2500000 = 2500000, //POSIX ONLY
|
||||||
|
BAUD3000000 = 3000000, //POSIX ONLY
|
||||||
|
BAUD3500000 = 3500000, //POSIX ONLY
|
||||||
|
BAUD4000000 = 4000000, //POSIX ONLY
|
||||||
|
# endif
|
||||||
|
#endif //Q_OS_UNIX
|
||||||
|
#if defined(Q_OS_WIN) || defined(qdoc)
|
||||||
|
BAUD14400 = 14400, //WINDOWS ONLY
|
||||||
|
BAUD56000 = 56000, //WINDOWS ONLY
|
||||||
|
BAUD128000 = 128000, //WINDOWS ONLY
|
||||||
|
BAUD256000 = 256000, //WINDOWS ONLY
|
||||||
|
#endif //Q_OS_WIN
|
||||||
|
BAUD110 = 110,
|
||||||
|
BAUD300 = 300,
|
||||||
|
BAUD600 = 600,
|
||||||
|
BAUD1200 = 1200,
|
||||||
|
BAUD2400 = 2400,
|
||||||
|
BAUD4800 = 4800,
|
||||||
|
BAUD9600 = 9600,
|
||||||
|
BAUD19200 = 19200,
|
||||||
|
BAUD38400 = 38400,
|
||||||
|
BAUD57600 = 57600,
|
||||||
|
BAUD115200 = 115200
|
||||||
|
};
|
||||||
|
|
||||||
|
enum DataBitsType
|
||||||
|
{
|
||||||
|
DATA_5 = 5,
|
||||||
|
DATA_6 = 6,
|
||||||
|
DATA_7 = 7,
|
||||||
|
DATA_8 = 8
|
||||||
|
};
|
||||||
|
|
||||||
|
enum ParityType
|
||||||
|
{
|
||||||
|
PAR_NONE,
|
||||||
|
PAR_ODD,
|
||||||
|
PAR_EVEN,
|
||||||
|
#if defined(Q_OS_WIN) || defined(qdoc)
|
||||||
|
PAR_MARK, //WINDOWS ONLY
|
||||||
|
#endif
|
||||||
|
PAR_SPACE
|
||||||
|
};
|
||||||
|
|
||||||
|
enum StopBitsType
|
||||||
|
{
|
||||||
|
STOP_1,
|
||||||
|
#if defined(Q_OS_WIN) || defined(qdoc)
|
||||||
|
STOP_1_5, //WINDOWS ONLY
|
||||||
|
#endif
|
||||||
|
STOP_2
|
||||||
|
};
|
||||||
|
|
||||||
|
enum FlowType
|
||||||
|
{
|
||||||
|
FLOW_OFF,
|
||||||
|
FLOW_HARDWARE,
|
||||||
|
FLOW_XONXOFF
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* structure to contain port settings
|
||||||
|
*/
|
||||||
|
struct PortSettings
|
||||||
|
{
|
||||||
|
BaudRateType BaudRate;
|
||||||
|
DataBitsType DataBits;
|
||||||
|
ParityType Parity;
|
||||||
|
StopBitsType StopBits;
|
||||||
|
FlowType FlowControl;
|
||||||
|
long Timeout_Millisec;
|
||||||
|
};
|
||||||
|
|
||||||
|
class QextSerialPortPrivate;
|
||||||
|
class QEXTSERIALPORT_EXPORT QextSerialPort: public QIODevice
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
Q_DECLARE_PRIVATE(QextSerialPort)
|
||||||
|
Q_ENUMS(QueryMode)
|
||||||
|
Q_PROPERTY(QString portName READ portName WRITE setPortName)
|
||||||
|
Q_PROPERTY(QueryMode queryMode READ queryMode WRITE setQueryMode)
|
||||||
|
public:
|
||||||
|
enum QueryMode {
|
||||||
|
Polling,
|
||||||
|
EventDriven
|
||||||
|
};
|
||||||
|
|
||||||
|
explicit QextSerialPort(QueryMode mode = EventDriven, QObject *parent = 0);
|
||||||
|
explicit QextSerialPort(const QString &name, QueryMode mode = EventDriven, QObject *parent = 0);
|
||||||
|
explicit QextSerialPort(const PortSettings &s, QueryMode mode = EventDriven, QObject *parent = 0);
|
||||||
|
QextSerialPort(const QString &name, const PortSettings &s, QueryMode mode = EventDriven, QObject *parent=0);
|
||||||
|
|
||||||
|
~QextSerialPort();
|
||||||
|
|
||||||
|
QString portName() const;
|
||||||
|
QueryMode queryMode() const;
|
||||||
|
BaudRateType baudRate() const;
|
||||||
|
DataBitsType dataBits() const;
|
||||||
|
ParityType parity() const;
|
||||||
|
StopBitsType stopBits() const;
|
||||||
|
FlowType flowControl() const;
|
||||||
|
|
||||||
|
bool open(OpenMode mode);
|
||||||
|
bool isSequential() const;
|
||||||
|
void close();
|
||||||
|
void flush();
|
||||||
|
qint64 bytesAvailable() const;
|
||||||
|
bool canReadLine() const;
|
||||||
|
QByteArray readAll();
|
||||||
|
|
||||||
|
ulong lastError() const;
|
||||||
|
|
||||||
|
ulong lineStatus();
|
||||||
|
QString errorString();
|
||||||
|
|
||||||
|
public Q_SLOTS:
|
||||||
|
void setPortName(const QString &name);
|
||||||
|
void setQueryMode(QueryMode mode);
|
||||||
|
void setBaudRate(BaudRateType);
|
||||||
|
void setDataBits(DataBitsType);
|
||||||
|
void setParity(ParityType);
|
||||||
|
void setStopBits(StopBitsType);
|
||||||
|
void setFlowControl(FlowType);
|
||||||
|
void setTimeout(long);
|
||||||
|
|
||||||
|
void setDtr(bool set=true);
|
||||||
|
void setRts(bool set=true);
|
||||||
|
|
||||||
|
Q_SIGNALS:
|
||||||
|
void dsrChanged(bool status);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
qint64 readData(char *data, qint64 maxSize);
|
||||||
|
qint64 writeData(const char *data, qint64 maxSize);
|
||||||
|
|
||||||
|
private:
|
||||||
|
Q_DISABLE_COPY(QextSerialPort)
|
||||||
|
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
Q_PRIVATE_SLOT(d_func(), void _q_onWinEvent(HANDLE))
|
||||||
|
#endif
|
||||||
|
Q_PRIVATE_SLOT(d_func(), void _q_canRead())
|
||||||
|
|
||||||
|
QextSerialPortPrivate *const d_ptr;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
INCLUDEPATH += $$PWD
|
||||||
|
DEPENDPATH += $$PWD
|
||||||
|
|
||||||
|
PUBLIC_HEADERS += $$PWD/qextserialport.h \
|
||||||
|
$$PWD/qextserialenumerator.h \
|
||||||
|
$$PWD/qextserialport_global.h
|
||||||
|
|
||||||
|
HEADERS += $$PUBLIC_HEADERS \
|
||||||
|
$$PWD/qextserialport_p.h \
|
||||||
|
$$PWD/qextserialenumerator_p.h \
|
||||||
|
|
||||||
|
SOURCES += $$PWD/qextserialport.cpp \
|
||||||
|
$$PWD/qextserialenumerator.cpp
|
||||||
|
unix {
|
||||||
|
SOURCES += $$PWD/qextserialport_unix.cpp
|
||||||
|
linux* {
|
||||||
|
SOURCES += $$PWD/qextserialenumerator_linux.cpp
|
||||||
|
} else:macx {
|
||||||
|
SOURCES += $$PWD/qextserialenumerator_osx.cpp
|
||||||
|
} else {
|
||||||
|
SOURCES += $$PWD/qextserialenumerator_unix.cpp
|
||||||
|
}
|
||||||
|
}
|
||||||
|
win32:SOURCES += $$PWD/qextserialport_win.cpp \
|
||||||
|
$$PWD/qextserialenumerator_win.cpp
|
||||||
|
|
||||||
|
linux*{
|
||||||
|
!qesp_linux_udev:DEFINES += QESP_NO_UDEV
|
||||||
|
qesp_linux_udev: LIBS += -ludev
|
||||||
|
}
|
||||||
|
|
||||||
|
macx:LIBS += -framework IOKit -framework CoreFoundation
|
||||||
|
win32:LIBS += -lsetupapi -ladvapi32 -luser32
|
||||||
|
|
||||||
|
# moc doesn't detect Q_OS_LINUX correctly, so add this to make it work
|
||||||
|
linux*:DEFINES += __linux__
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
** Copyright (c) 2000-2003 Wayne Roth
|
||||||
|
** Copyright (c) 2004-2007 Stefan Sander
|
||||||
|
** Copyright (c) 2007 Michal Policht
|
||||||
|
** Copyright (c) 2008 Brandon Fosdick
|
||||||
|
** Copyright (c) 2009-2010 Liam Staskawicz
|
||||||
|
** Copyright (c) 2011 Debao Zhang
|
||||||
|
** All right reserved.
|
||||||
|
** Web: http://code.google.com/p/qextserialport/
|
||||||
|
**
|
||||||
|
** Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
** a copy of this software and associated documentation files (the
|
||||||
|
** "Software"), to deal in the Software without restriction, including
|
||||||
|
** without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
** distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
** permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
** the following conditions:
|
||||||
|
**
|
||||||
|
** The above copyright notice and this permission notice shall be
|
||||||
|
** included in all copies or substantial portions of the Software.
|
||||||
|
**
|
||||||
|
** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
** NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||||
|
** LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
** OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
** WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef QEXTSERIALPORT_GLOBAL_H
|
||||||
|
#define QEXTSERIALPORT_GLOBAL_H
|
||||||
|
|
||||||
|
#include <QtCore/QtGlobal>
|
||||||
|
|
||||||
|
#ifdef QEXTSERIALPORT_BUILD_SHARED
|
||||||
|
# define QEXTSERIALPORT_EXPORT Q_DECL_EXPORT
|
||||||
|
#elif defined(QEXTSERIALPORT_USING_SHARED)
|
||||||
|
# define QEXTSERIALPORT_EXPORT Q_DECL_IMPORT
|
||||||
|
#else
|
||||||
|
# define QEXTSERIALPORT_EXPORT
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ### for compatible with old version. should be removed in QESP 2.0
|
||||||
|
#ifdef _TTY_NOWARN_
|
||||||
|
# define QESP_NO_WARN
|
||||||
|
#endif
|
||||||
|
#ifdef _TTY_NOWARN_PORT_
|
||||||
|
# define QESP_NO_PORTABILITY_WARN
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*if all warning messages are turned off, flag portability warnings to be turned off as well*/
|
||||||
|
#ifdef QESP_NO_WARN
|
||||||
|
# define QESP_NO_PORTABILITY_WARN
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*macros for warning and debug messages*/
|
||||||
|
#ifdef QESP_NO_PORTABILITY_WARN
|
||||||
|
# define QESP_PORTABILITY_WARNING while (false)qWarning
|
||||||
|
#else
|
||||||
|
# define QESP_PORTABILITY_WARNING qWarning
|
||||||
|
#endif /*QESP_NOWARN_PORT*/
|
||||||
|
|
||||||
|
#ifdef QESP_NO_WARN
|
||||||
|
# define QESP_WARNING while (false)qWarning
|
||||||
|
#else
|
||||||
|
# define QESP_WARNING qWarning
|
||||||
|
#endif /*QESP_NOWARN*/
|
||||||
|
|
||||||
|
#endif // QEXTSERIALPORT_GLOBAL_H
|
||||||
|
|
||||||
@@ -0,0 +1,251 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
** Copyright (c) 2000-2003 Wayne Roth
|
||||||
|
** Copyright (c) 2004-2007 Stefan Sander
|
||||||
|
** Copyright (c) 2007 Michal Policht
|
||||||
|
** Copyright (c) 2008 Brandon Fosdick
|
||||||
|
** Copyright (c) 2009-2010 Liam Staskawicz
|
||||||
|
** Copyright (c) 2011 Debao Zhang
|
||||||
|
** All right reserved.
|
||||||
|
** Web: http://code.google.com/p/qextserialport/
|
||||||
|
**
|
||||||
|
** Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
** a copy of this software and associated documentation files (the
|
||||||
|
** "Software"), to deal in the Software without restriction, including
|
||||||
|
** without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
** distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
** permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
** the following conditions:
|
||||||
|
**
|
||||||
|
** The above copyright notice and this permission notice shall be
|
||||||
|
** included in all copies or substantial portions of the Software.
|
||||||
|
**
|
||||||
|
** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
** NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||||
|
** LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
** OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
** WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef _QEXTSERIALPORT_P_H_
|
||||||
|
#define _QEXTSERIALPORT_P_H_
|
||||||
|
|
||||||
|
//
|
||||||
|
// W A R N I N G
|
||||||
|
// -------------
|
||||||
|
//
|
||||||
|
// This file is not part of the QESP API. It exists for the convenience
|
||||||
|
// of other QESP classes. This header file may change from version to
|
||||||
|
// version without notice, or even be removed.
|
||||||
|
//
|
||||||
|
// We mean it.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "qextserialport.h"
|
||||||
|
#include <QtCore/QReadWriteLock>
|
||||||
|
#ifdef Q_OS_UNIX
|
||||||
|
# include <termios.h>
|
||||||
|
#elif (defined Q_OS_WIN)
|
||||||
|
# include <QtCore/qt_windows.h>
|
||||||
|
#endif
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
// This is QextSerialPort's read buffer, needed by posix system.
|
||||||
|
// ref: QRingBuffer & QIODevicePrivateLinearBuffer
|
||||||
|
class QextReadBuffer
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
inline QextReadBuffer(size_t growth=4096)
|
||||||
|
: len(0), first(0), buf(0), capacity(0), basicBlockSize(growth) {
|
||||||
|
}
|
||||||
|
|
||||||
|
~QextReadBuffer() {
|
||||||
|
delete [] buf;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void clear() {
|
||||||
|
first = buf;
|
||||||
|
len = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline int size() const {
|
||||||
|
return len;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool isEmpty() const {
|
||||||
|
return len == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline int read(char *target, int size) {
|
||||||
|
int r = qMin(size, len);
|
||||||
|
if (r == 1) {
|
||||||
|
*target = *first;
|
||||||
|
--len;
|
||||||
|
++first;
|
||||||
|
} else {
|
||||||
|
memcpy(target, first, r);
|
||||||
|
len -= r;
|
||||||
|
first += r;
|
||||||
|
}
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline char *reserve(size_t size) {
|
||||||
|
if ((first - buf) + len + size > capacity) {
|
||||||
|
size_t newCapacity = qMax(capacity, basicBlockSize);
|
||||||
|
while (newCapacity < len + size)
|
||||||
|
newCapacity *= 2;
|
||||||
|
if (newCapacity > capacity) {
|
||||||
|
// allocate more space
|
||||||
|
char *newBuf = new char[newCapacity];
|
||||||
|
memmove(newBuf, first, len);
|
||||||
|
delete [] buf;
|
||||||
|
buf = newBuf;
|
||||||
|
capacity = newCapacity;
|
||||||
|
} else {
|
||||||
|
// shift any existing data to make space
|
||||||
|
memmove(buf, first, len);
|
||||||
|
}
|
||||||
|
first = buf;
|
||||||
|
}
|
||||||
|
char *writePtr = first + len;
|
||||||
|
len += (int)size;
|
||||||
|
return writePtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void chop(int size) {
|
||||||
|
if (size >= len) {
|
||||||
|
clear();
|
||||||
|
} else {
|
||||||
|
len -= size;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void squeeze() {
|
||||||
|
if (first != buf) {
|
||||||
|
memmove(buf, first, len);
|
||||||
|
first = buf;
|
||||||
|
}
|
||||||
|
size_t newCapacity = basicBlockSize;
|
||||||
|
while (newCapacity < size_t(len))
|
||||||
|
newCapacity *= 2;
|
||||||
|
if (newCapacity < capacity) {
|
||||||
|
char *tmp = static_cast<char *>(realloc(buf, newCapacity));
|
||||||
|
if (tmp) {
|
||||||
|
buf = tmp;
|
||||||
|
capacity = newCapacity;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
inline QByteArray readAll() {
|
||||||
|
char *f = first;
|
||||||
|
int l = len;
|
||||||
|
clear();
|
||||||
|
return QByteArray(f, l);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline int readLine(char *target, int size) {
|
||||||
|
int r = qMin(size, len);
|
||||||
|
char *eol = static_cast<char *>(memchr(first, '\n', r));
|
||||||
|
if (eol)
|
||||||
|
r = 1+(eol-first);
|
||||||
|
memcpy(target, first, r);
|
||||||
|
len -= r;
|
||||||
|
first += r;
|
||||||
|
return int(r);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool canReadLine() const {
|
||||||
|
return memchr(first, '\n', len);
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
int len;
|
||||||
|
char *first;
|
||||||
|
char *buf;
|
||||||
|
size_t capacity;
|
||||||
|
size_t basicBlockSize;
|
||||||
|
};
|
||||||
|
|
||||||
|
class QWinEventNotifier;
|
||||||
|
class QReadWriteLock;
|
||||||
|
class QSocketNotifier;
|
||||||
|
|
||||||
|
class QextSerialPortPrivate
|
||||||
|
{
|
||||||
|
Q_DECLARE_PUBLIC(QextSerialPort)
|
||||||
|
public:
|
||||||
|
QextSerialPortPrivate(QextSerialPort *q);
|
||||||
|
~QextSerialPortPrivate();
|
||||||
|
enum DirtyFlagEnum
|
||||||
|
{
|
||||||
|
DFE_BaudRate = 0x0001,
|
||||||
|
DFE_Parity = 0x0002,
|
||||||
|
DFE_StopBits = 0x0004,
|
||||||
|
DFE_DataBits = 0x0008,
|
||||||
|
DFE_Flow = 0x0010,
|
||||||
|
DFE_TimeOut = 0x0100,
|
||||||
|
DFE_ALL = 0x0fff,
|
||||||
|
DFE_Settings_Mask = 0x00ff //without TimeOut
|
||||||
|
};
|
||||||
|
mutable QReadWriteLock lock;
|
||||||
|
QString port;
|
||||||
|
PortSettings settings;
|
||||||
|
QextReadBuffer readBuffer;
|
||||||
|
int settingsDirtyFlags;
|
||||||
|
ulong lastErr;
|
||||||
|
QextSerialPort::QueryMode queryMode;
|
||||||
|
|
||||||
|
// platform specific members
|
||||||
|
#ifdef Q_OS_UNIX
|
||||||
|
int fd;
|
||||||
|
QSocketNotifier *readNotifier;
|
||||||
|
struct termios currentTermios;
|
||||||
|
struct termios oldTermios;
|
||||||
|
#elif (defined Q_OS_WIN)
|
||||||
|
HANDLE handle;
|
||||||
|
OVERLAPPED overlap;
|
||||||
|
COMMCONFIG commConfig;
|
||||||
|
COMMTIMEOUTS commTimeouts;
|
||||||
|
QWinEventNotifier *winEventNotifier;
|
||||||
|
DWORD eventMask;
|
||||||
|
QList<OVERLAPPED *> pendingWrites;
|
||||||
|
QReadWriteLock *bytesToWriteLock;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*fill PortSettings*/
|
||||||
|
void setBaudRate(BaudRateType baudRate, bool update=true);
|
||||||
|
void setDataBits(DataBitsType dataBits, bool update=true);
|
||||||
|
void setParity(ParityType parity, bool update=true);
|
||||||
|
void setStopBits(StopBitsType stopbits, bool update=true);
|
||||||
|
void setFlowControl(FlowType flow, bool update=true);
|
||||||
|
void setTimeout(long millisec, bool update=true);
|
||||||
|
void setPortSettings(const PortSettings &settings, bool update=true);
|
||||||
|
|
||||||
|
void platformSpecificDestruct();
|
||||||
|
void platformSpecificInit();
|
||||||
|
void translateError(ulong error);
|
||||||
|
void updatePortSettings();
|
||||||
|
|
||||||
|
qint64 readData_sys(char *data, qint64 maxSize);
|
||||||
|
qint64 writeData_sys(const char *data, qint64 maxSize);
|
||||||
|
void setDtr_sys(bool set=true);
|
||||||
|
void setRts_sys(bool set=true);
|
||||||
|
bool open_sys(QIODevice::OpenMode mode);
|
||||||
|
bool close_sys();
|
||||||
|
bool flush_sys();
|
||||||
|
ulong lineStatus_sys();
|
||||||
|
qint64 bytesAvailable_sys() const;
|
||||||
|
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
void _q_onWinEvent(HANDLE h);
|
||||||
|
#endif
|
||||||
|
void _q_canRead();
|
||||||
|
|
||||||
|
QextSerialPort *q_ptr;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //_QEXTSERIALPORT_P_H_
|
||||||
@@ -0,0 +1,418 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
** Copyright (c) 2000-2003 Wayne Roth
|
||||||
|
** Copyright (c) 2004-2007 Stefan Sander
|
||||||
|
** Copyright (c) 2007 Michal Policht
|
||||||
|
** Copyright (c) 2008 Brandon Fosdick
|
||||||
|
** Copyright (c) 2009-2010 Liam Staskawicz
|
||||||
|
** Copyright (c) 2011 Debao Zhang
|
||||||
|
** All right reserved.
|
||||||
|
** Web: http://code.google.com/p/qextserialport/
|
||||||
|
**
|
||||||
|
** Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
** a copy of this software and associated documentation files (the
|
||||||
|
** "Software"), to deal in the Software without restriction, including
|
||||||
|
** without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
** distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
** permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
** the following conditions:
|
||||||
|
**
|
||||||
|
** The above copyright notice and this permission notice shall be
|
||||||
|
** included in all copies or substantial portions of the Software.
|
||||||
|
**
|
||||||
|
** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
** NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||||
|
** LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
** OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
** WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include "qextserialport.h"
|
||||||
|
#include "qextserialport_p.h"
|
||||||
|
#include <QtCore/QThread>
|
||||||
|
#include <QtCore/QReadWriteLock>
|
||||||
|
#include <QtCore/QMutexLocker>
|
||||||
|
#include <QtCore/QDebug>
|
||||||
|
#include <QtCore/QRegExp>
|
||||||
|
#include <QtCore/QMetaType>
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
|
||||||
|
# include <QtCore/QWinEventNotifier>
|
||||||
|
#else
|
||||||
|
# include <QtCore/private/qwineventnotifier_p.h>
|
||||||
|
#endif
|
||||||
|
void QextSerialPortPrivate::platformSpecificInit()
|
||||||
|
{
|
||||||
|
handle = INVALID_HANDLE_VALUE;
|
||||||
|
ZeroMemory(&overlap, sizeof(OVERLAPPED));
|
||||||
|
overlap.hEvent = CreateEvent(NULL, true, false, NULL);
|
||||||
|
winEventNotifier = 0;
|
||||||
|
bytesToWriteLock = new QReadWriteLock;
|
||||||
|
}
|
||||||
|
|
||||||
|
void QextSerialPortPrivate::platformSpecificDestruct() {
|
||||||
|
CloseHandle(overlap.hEvent);
|
||||||
|
delete bytesToWriteLock;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\internal
|
||||||
|
COM ports greater than 9 need \\.\ prepended
|
||||||
|
|
||||||
|
This is only need when open the port.
|
||||||
|
*/
|
||||||
|
static QString fullPortNameWin(const QString &name)
|
||||||
|
{
|
||||||
|
QRegExp rx(QLatin1String("^COM(\\d+)"));
|
||||||
|
QString fullName(name);
|
||||||
|
if (fullName.contains(rx))
|
||||||
|
fullName.prepend(QLatin1String("\\\\.\\"));
|
||||||
|
return fullName;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool QextSerialPortPrivate::open_sys(QIODevice::OpenMode mode)
|
||||||
|
{
|
||||||
|
Q_Q(QextSerialPort);
|
||||||
|
DWORD confSize = sizeof(COMMCONFIG);
|
||||||
|
commConfig.dwSize = confSize;
|
||||||
|
DWORD dwFlagsAndAttributes = 0;
|
||||||
|
if (queryMode == QextSerialPort::EventDriven)
|
||||||
|
dwFlagsAndAttributes += FILE_FLAG_OVERLAPPED;
|
||||||
|
|
||||||
|
/*open the port*/
|
||||||
|
handle = CreateFileW((wchar_t *)fullPortNameWin(port).utf16(), GENERIC_READ|GENERIC_WRITE,
|
||||||
|
0, NULL, OPEN_EXISTING, dwFlagsAndAttributes, NULL);
|
||||||
|
if (handle != INVALID_HANDLE_VALUE) {
|
||||||
|
q->setOpenMode(mode);
|
||||||
|
/*configure port settings*/
|
||||||
|
GetCommConfig(handle, &commConfig, &confSize);
|
||||||
|
GetCommState(handle, &(commConfig.dcb));
|
||||||
|
|
||||||
|
/*set up parameters*/
|
||||||
|
commConfig.dcb.fBinary = TRUE;
|
||||||
|
commConfig.dcb.fInX = FALSE;
|
||||||
|
commConfig.dcb.fOutX = FALSE;
|
||||||
|
commConfig.dcb.fAbortOnError = FALSE;
|
||||||
|
commConfig.dcb.fNull = FALSE;
|
||||||
|
/* Dtr default to true. See Issue 122*/
|
||||||
|
commConfig.dcb.fDtrControl = TRUE;
|
||||||
|
/*flush all settings*/
|
||||||
|
settingsDirtyFlags = DFE_ALL;
|
||||||
|
updatePortSettings();
|
||||||
|
|
||||||
|
//init event driven approach
|
||||||
|
if (queryMode == QextSerialPort::EventDriven) {
|
||||||
|
if (!SetCommMask(handle, EV_TXEMPTY | EV_RXCHAR | EV_DSR)) {
|
||||||
|
QESP_WARNING()<<"failed to set Comm Mask. Error code:"<<GetLastError();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
winEventNotifier = new QWinEventNotifier(overlap.hEvent, q);
|
||||||
|
qRegisterMetaType<HANDLE>("HANDLE");
|
||||||
|
q->connect(winEventNotifier, SIGNAL(activated(HANDLE)), q, SLOT(_q_onWinEvent(HANDLE)), Qt::DirectConnection);
|
||||||
|
WaitCommEvent(handle, &eventMask, &overlap);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool QextSerialPortPrivate::close_sys()
|
||||||
|
{
|
||||||
|
flush_sys();
|
||||||
|
CancelIo(handle);
|
||||||
|
if (CloseHandle(handle))
|
||||||
|
handle = INVALID_HANDLE_VALUE;
|
||||||
|
if (winEventNotifier) {
|
||||||
|
winEventNotifier->setEnabled(false);
|
||||||
|
winEventNotifier->deleteLater();
|
||||||
|
winEventNotifier = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (OVERLAPPED *o, pendingWrites) {
|
||||||
|
CloseHandle(o->hEvent);
|
||||||
|
delete o;
|
||||||
|
}
|
||||||
|
pendingWrites.clear();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool QextSerialPortPrivate::flush_sys()
|
||||||
|
{
|
||||||
|
FlushFileBuffers(handle);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
qint64 QextSerialPortPrivate::bytesAvailable_sys() const
|
||||||
|
{
|
||||||
|
DWORD Errors;
|
||||||
|
COMSTAT Status;
|
||||||
|
if (ClearCommError(handle, &Errors, &Status)) {
|
||||||
|
return Status.cbInQue;
|
||||||
|
}
|
||||||
|
return (qint64)-1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Translates a system-specific error code to a QextSerialPort error code. Used internally.
|
||||||
|
*/
|
||||||
|
void QextSerialPortPrivate::translateError(ulong error)
|
||||||
|
{
|
||||||
|
if (error & CE_BREAK) {
|
||||||
|
lastErr = E_BREAK_CONDITION;
|
||||||
|
}
|
||||||
|
else if (error & CE_FRAME) {
|
||||||
|
lastErr = E_FRAMING_ERROR;
|
||||||
|
}
|
||||||
|
else if (error & CE_IOE) {
|
||||||
|
lastErr = E_IO_ERROR;
|
||||||
|
}
|
||||||
|
else if (error & CE_MODE) {
|
||||||
|
lastErr = E_INVALID_FD;
|
||||||
|
}
|
||||||
|
else if (error & CE_OVERRUN) {
|
||||||
|
lastErr = E_BUFFER_OVERRUN;
|
||||||
|
}
|
||||||
|
else if (error & CE_RXPARITY) {
|
||||||
|
lastErr = E_RECEIVE_PARITY_ERROR;
|
||||||
|
}
|
||||||
|
else if (error & CE_RXOVER) {
|
||||||
|
lastErr = E_RECEIVE_OVERFLOW;
|
||||||
|
}
|
||||||
|
else if (error & CE_TXFULL) {
|
||||||
|
lastErr = E_TRANSMIT_OVERFLOW;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Reads a block of data from the serial port. This function will read at most maxlen bytes from
|
||||||
|
the serial port and place them in the buffer pointed to by data. Return value is the number of
|
||||||
|
bytes actually read, or -1 on error.
|
||||||
|
|
||||||
|
\warning before calling this function ensure that serial port associated with this class
|
||||||
|
is currently open (use isOpen() function to check if port is open).
|
||||||
|
*/
|
||||||
|
qint64 QextSerialPortPrivate::readData_sys(char *data, qint64 maxSize)
|
||||||
|
{
|
||||||
|
DWORD bytesRead = 0;
|
||||||
|
bool failed = false;
|
||||||
|
if (queryMode == QextSerialPort::EventDriven) {
|
||||||
|
OVERLAPPED overlapRead;
|
||||||
|
ZeroMemory(&overlapRead, sizeof(OVERLAPPED));
|
||||||
|
if (!ReadFile(handle, (void *)data, (DWORD)maxSize, &bytesRead, &overlapRead)) {
|
||||||
|
if (GetLastError() == ERROR_IO_PENDING)
|
||||||
|
GetOverlappedResult(handle, &overlapRead, &bytesRead, true);
|
||||||
|
else
|
||||||
|
failed = true;
|
||||||
|
}
|
||||||
|
} else if (!ReadFile(handle, (void *)data, (DWORD)maxSize, &bytesRead, NULL)) {
|
||||||
|
failed = true;
|
||||||
|
}
|
||||||
|
if (!failed)
|
||||||
|
return (qint64)bytesRead;
|
||||||
|
|
||||||
|
lastErr = E_READ_FAILED;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Writes a block of data to the serial port. This function will write len bytes
|
||||||
|
from the buffer pointed to by data to the serial port. Return value is the number
|
||||||
|
of bytes actually written, or -1 on error.
|
||||||
|
|
||||||
|
\warning before calling this function ensure that serial port associated with this class
|
||||||
|
is currently open (use isOpen() function to check if port is open).
|
||||||
|
*/
|
||||||
|
qint64 QextSerialPortPrivate::writeData_sys(const char *data, qint64 maxSize)
|
||||||
|
{
|
||||||
|
DWORD bytesWritten = 0;
|
||||||
|
bool failed = false;
|
||||||
|
if (queryMode == QextSerialPort::EventDriven) {
|
||||||
|
OVERLAPPED *newOverlapWrite = new OVERLAPPED;
|
||||||
|
ZeroMemory(newOverlapWrite, sizeof(OVERLAPPED));
|
||||||
|
newOverlapWrite->hEvent = CreateEvent(NULL, true, false, NULL);
|
||||||
|
if (WriteFile(handle, (void *)data, (DWORD)maxSize, &bytesWritten, newOverlapWrite)) {
|
||||||
|
CloseHandle(newOverlapWrite->hEvent);
|
||||||
|
delete newOverlapWrite;
|
||||||
|
}
|
||||||
|
else if (GetLastError() == ERROR_IO_PENDING) {
|
||||||
|
// writing asynchronously...not an error
|
||||||
|
QWriteLocker writelocker(bytesToWriteLock);
|
||||||
|
pendingWrites.append(newOverlapWrite);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
QESP_WARNING()<<"QextSerialPort write error:"<<GetLastError();
|
||||||
|
failed = true;
|
||||||
|
if (!CancelIo(newOverlapWrite->hEvent))
|
||||||
|
QESP_WARNING("QextSerialPort: couldn't cancel IO");
|
||||||
|
if (!CloseHandle(newOverlapWrite->hEvent))
|
||||||
|
QESP_WARNING("QextSerialPort: couldn't close OVERLAPPED handle");
|
||||||
|
delete newOverlapWrite;
|
||||||
|
}
|
||||||
|
} else if (!WriteFile(handle, (void *)data, (DWORD)maxSize, &bytesWritten, NULL)) {
|
||||||
|
failed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!failed)
|
||||||
|
return (qint64)bytesWritten;
|
||||||
|
|
||||||
|
lastErr = E_WRITE_FAILED;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void QextSerialPortPrivate::setDtr_sys(bool set) {
|
||||||
|
EscapeCommFunction(handle, set ? SETDTR : CLRDTR);
|
||||||
|
}
|
||||||
|
|
||||||
|
void QextSerialPortPrivate::setRts_sys(bool set) {
|
||||||
|
EscapeCommFunction(handle, set ? SETRTS : CLRRTS);
|
||||||
|
}
|
||||||
|
|
||||||
|
ulong QextSerialPortPrivate::lineStatus_sys(void) {
|
||||||
|
unsigned long Status = 0, Temp = 0;
|
||||||
|
GetCommModemStatus(handle, &Temp);
|
||||||
|
if (Temp & MS_CTS_ON) Status |= LS_CTS;
|
||||||
|
if (Temp & MS_DSR_ON) Status |= LS_DSR;
|
||||||
|
if (Temp & MS_RING_ON) Status |= LS_RI;
|
||||||
|
if (Temp & MS_RLSD_ON) Status |= LS_DCD;
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Triggered when there's activity on our HANDLE.
|
||||||
|
*/
|
||||||
|
void QextSerialPortPrivate::_q_onWinEvent(HANDLE h)
|
||||||
|
{
|
||||||
|
Q_Q(QextSerialPort);
|
||||||
|
if (h == overlap.hEvent) {
|
||||||
|
if (eventMask & EV_RXCHAR) {
|
||||||
|
if (q->sender() != q && bytesAvailable_sys() > 0)
|
||||||
|
_q_canRead();
|
||||||
|
}
|
||||||
|
if (eventMask & EV_TXEMPTY) {
|
||||||
|
/*
|
||||||
|
A write completed. Run through the list of OVERLAPPED writes, and if
|
||||||
|
they completed successfully, take them off the list and delete them.
|
||||||
|
Otherwise, leave them on there so they can finish.
|
||||||
|
*/
|
||||||
|
qint64 totalBytesWritten = 0;
|
||||||
|
QList<OVERLAPPED *> overlapsToDelete;
|
||||||
|
foreach (OVERLAPPED *o, pendingWrites) {
|
||||||
|
DWORD numBytes = 0;
|
||||||
|
if (GetOverlappedResult(handle, o, &numBytes, false)) {
|
||||||
|
overlapsToDelete.append(o);
|
||||||
|
totalBytesWritten += numBytes;
|
||||||
|
} else if (GetLastError() != ERROR_IO_INCOMPLETE) {
|
||||||
|
overlapsToDelete.append(o);
|
||||||
|
QESP_WARNING()<<"CommEvent overlapped write error:" << GetLastError();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (q->sender() != q && totalBytesWritten > 0) {
|
||||||
|
QWriteLocker writelocker(bytesToWriteLock);
|
||||||
|
Q_EMIT q->bytesWritten(totalBytesWritten);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (OVERLAPPED *o, overlapsToDelete) {
|
||||||
|
OVERLAPPED *toDelete = pendingWrites.takeAt(pendingWrites.indexOf(o));
|
||||||
|
CloseHandle(toDelete->hEvent);
|
||||||
|
delete toDelete;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (eventMask & EV_DSR) {
|
||||||
|
if (lineStatus_sys() & LS_DSR)
|
||||||
|
Q_EMIT q->dsrChanged(true);
|
||||||
|
else
|
||||||
|
Q_EMIT q->dsrChanged(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
WaitCommEvent(handle, &eventMask, &overlap);
|
||||||
|
}
|
||||||
|
|
||||||
|
void QextSerialPortPrivate::updatePortSettings()
|
||||||
|
{
|
||||||
|
if (!q_ptr->isOpen() || !settingsDirtyFlags)
|
||||||
|
return;
|
||||||
|
|
||||||
|
//fill struct : COMMCONFIG
|
||||||
|
if (settingsDirtyFlags & DFE_BaudRate) {
|
||||||
|
commConfig.dcb.BaudRate = settings.BaudRate;
|
||||||
|
}
|
||||||
|
if (settingsDirtyFlags & DFE_Parity) {
|
||||||
|
commConfig.dcb.Parity = (BYTE)settings.Parity;
|
||||||
|
commConfig.dcb.fParity = (settings.Parity == PAR_NONE) ? FALSE : TRUE;
|
||||||
|
}
|
||||||
|
if (settingsDirtyFlags & DFE_DataBits) {
|
||||||
|
commConfig.dcb.ByteSize = (BYTE)settings.DataBits;
|
||||||
|
}
|
||||||
|
if (settingsDirtyFlags & DFE_StopBits) {
|
||||||
|
switch (settings.StopBits) {
|
||||||
|
case STOP_1:
|
||||||
|
commConfig.dcb.StopBits = ONESTOPBIT;
|
||||||
|
break;
|
||||||
|
case STOP_1_5:
|
||||||
|
commConfig.dcb.StopBits = ONE5STOPBITS;
|
||||||
|
break;
|
||||||
|
case STOP_2:
|
||||||
|
commConfig.dcb.StopBits = TWOSTOPBITS;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (settingsDirtyFlags & DFE_Flow) {
|
||||||
|
switch(settings.FlowControl) {
|
||||||
|
/*no flow control*/
|
||||||
|
case FLOW_OFF:
|
||||||
|
commConfig.dcb.fOutxCtsFlow = FALSE;
|
||||||
|
commConfig.dcb.fRtsControl = RTS_CONTROL_DISABLE;
|
||||||
|
commConfig.dcb.fInX = FALSE;
|
||||||
|
commConfig.dcb.fOutX = FALSE;
|
||||||
|
break;
|
||||||
|
/*software (XON/XOFF) flow control*/
|
||||||
|
case FLOW_XONXOFF:
|
||||||
|
commConfig.dcb.fOutxCtsFlow = FALSE;
|
||||||
|
commConfig.dcb.fRtsControl = RTS_CONTROL_DISABLE;
|
||||||
|
commConfig.dcb.fInX = TRUE;
|
||||||
|
commConfig.dcb.fOutX = TRUE;
|
||||||
|
break;
|
||||||
|
/*hardware flow control*/
|
||||||
|
case FLOW_HARDWARE:
|
||||||
|
commConfig.dcb.fOutxCtsFlow = TRUE;
|
||||||
|
commConfig.dcb.fRtsControl = RTS_CONTROL_HANDSHAKE;
|
||||||
|
commConfig.dcb.fInX = FALSE;
|
||||||
|
commConfig.dcb.fOutX = FALSE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//fill struct : COMMTIMEOUTS
|
||||||
|
if (settingsDirtyFlags & DFE_TimeOut) {
|
||||||
|
if (queryMode != QextSerialPort::EventDriven) {
|
||||||
|
int millisec = settings.Timeout_Millisec;
|
||||||
|
if (millisec == -1) {
|
||||||
|
commTimeouts.ReadIntervalTimeout = MAXDWORD;
|
||||||
|
commTimeouts.ReadTotalTimeoutConstant = 0;
|
||||||
|
} else {
|
||||||
|
commTimeouts.ReadIntervalTimeout = millisec;
|
||||||
|
commTimeouts.ReadTotalTimeoutConstant = millisec;
|
||||||
|
}
|
||||||
|
commTimeouts.ReadTotalTimeoutMultiplier = 0;
|
||||||
|
commTimeouts.WriteTotalTimeoutMultiplier = millisec;
|
||||||
|
commTimeouts.WriteTotalTimeoutConstant = 0;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
commTimeouts.ReadIntervalTimeout = MAXDWORD;
|
||||||
|
commTimeouts.ReadTotalTimeoutMultiplier = 0;
|
||||||
|
commTimeouts.ReadTotalTimeoutConstant = 0;
|
||||||
|
commTimeouts.WriteTotalTimeoutMultiplier = 0;
|
||||||
|
commTimeouts.WriteTotalTimeoutConstant = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (settingsDirtyFlags & DFE_Settings_Mask)
|
||||||
|
SetCommConfig(handle, &commConfig, sizeof(COMMCONFIG));
|
||||||
|
if ((settingsDirtyFlags & DFE_TimeOut))
|
||||||
|
SetCommTimeouts(handle, &commTimeouts);
|
||||||
|
settingsDirtyFlags = 0;
|
||||||
|
}
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
/****************************************************************************
|
||||||
|
** Copyright (c) 2000-2003 Wayne Roth
|
||||||
|
** Copyright (c) 2004-2007 Stefan Sander
|
||||||
|
** Copyright (c) 2007 Michal Policht
|
||||||
|
** Copyright (c) 2008 Brandon Fosdick
|
||||||
|
** Copyright (c) 2009-2010 Liam Staskawicz
|
||||||
|
** Copyright (c) 2011 Debao Zhang
|
||||||
|
** All right reserved.
|
||||||
|
** Web: http://code.google.com/p/qextserialport/
|
||||||
|
**
|
||||||
|
** Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
** a copy of this software and associated documentation files (the
|
||||||
|
** "Software"), to deal in the Software without restriction, including
|
||||||
|
** without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
** distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
** permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
** the following conditions:
|
||||||
|
**
|
||||||
|
** The above copyright notice and this permission notice shall be
|
||||||
|
** included in all copies or substantial portions of the Software.
|
||||||
|
**
|
||||||
|
** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
** NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||||
|
** LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
** OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
** WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
**
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef QEXTSERIALPORT_GLOBAL_H
|
||||||
|
#define QEXTSERIALPORT_GLOBAL_H
|
||||||
|
|
||||||
|
#include <QtCore/QtGlobal>
|
||||||
|
|
||||||
|
#ifdef QEXTSERIALPORT_BUILD_SHARED
|
||||||
|
# define QEXTSERIALPORT_EXPORT Q_DECL_EXPORT
|
||||||
|
#elif defined(QEXTSERIALPORT_USING_SHARED)
|
||||||
|
# define QEXTSERIALPORT_EXPORT Q_DECL_IMPORT
|
||||||
|
#else
|
||||||
|
# define QEXTSERIALPORT_EXPORT
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ### for compatible with old version. should be removed in QESP 2.0
|
||||||
|
#ifdef _TTY_NOWARN_
|
||||||
|
# define QESP_NO_WARN
|
||||||
|
#endif
|
||||||
|
#ifdef _TTY_NOWARN_PORT_
|
||||||
|
# define QESP_NO_PORTABILITY_WARN
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*if all warning messages are turned off, flag portability warnings to be turned off as well*/
|
||||||
|
#ifdef QESP_NO_WARN
|
||||||
|
# define QESP_NO_PORTABILITY_WARN
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*macros for warning and debug messages*/
|
||||||
|
#ifdef QESP_NO_PORTABILITY_WARN
|
||||||
|
# define QESP_PORTABILITY_WARNING while (false)qWarning
|
||||||
|
#else
|
||||||
|
# define QESP_PORTABILITY_WARNING qWarning
|
||||||
|
#endif /*QESP_NOWARN_PORT*/
|
||||||
|
|
||||||
|
#ifdef QESP_NO_WARN
|
||||||
|
# define QESP_WARNING while (false)qWarning
|
||||||
|
#else
|
||||||
|
# define QESP_WARNING qWarning
|
||||||
|
#endif /*QESP_NOWARN*/
|
||||||
|
|
||||||
|
#endif // QEXTSERIALPORT_GLOBAL_H
|
||||||
|
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
#include "ZTInfo.h"
|
||||||
|
|
||||||
|
CZTInfo::CZTInfo()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
#ifndef ZTINFO_H
|
||||||
|
#define ZTINFO_H
|
||||||
|
|
||||||
|
#include <QList>
|
||||||
|
|
||||||
|
class CZTInfo
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
int mZT1PPIAlarmFlag1;
|
||||||
|
int mZT1PPIAlarmFlag2;
|
||||||
|
int mZT1PPIAlarmFlag3;
|
||||||
|
int mZT1PPIAlarmFlag4;
|
||||||
|
int mZT1PPEAlarmFlag1;
|
||||||
|
int mZT1PPEAlarmFlag2;
|
||||||
|
int mZT1PPEAlarmFlag3;
|
||||||
|
int mZT1PPEAlarmFlag4;
|
||||||
|
int mZT1PGAlarmFlag1;
|
||||||
|
int mZT1PGAlarmFlag2;
|
||||||
|
int mZT1PGAlarmFlag3;
|
||||||
|
int mZT1PGAlarmFlag4;
|
||||||
|
int mZT1FNAlarmFlag1;
|
||||||
|
int mZT1FNAlarmFlag2;
|
||||||
|
int mZT1FNAlarmFlag3;
|
||||||
|
int mZT1FNAlarmFlag4;
|
||||||
|
|
||||||
|
QList<qint16> mZT1Ranks;
|
||||||
|
// int mZT1PPIRank1;
|
||||||
|
// int mZT1PPIRank2;
|
||||||
|
// int mZT1PPIRank3;
|
||||||
|
// int mZT1PPIRank4;
|
||||||
|
// int mZT1PPERank1;
|
||||||
|
// int mZT1PPERank2;
|
||||||
|
// int mZT1PPERank3;
|
||||||
|
// int mZT1PPERank4;
|
||||||
|
// int mZT1PGRank1;
|
||||||
|
// int mZT1PGRank2;
|
||||||
|
// int mZT1PGRank3;
|
||||||
|
// int mZT1PGRank4;
|
||||||
|
|
||||||
|
int mZT1V00AlarmFlag;
|
||||||
|
int mZT1PEQ1AlarmFlag;
|
||||||
|
|
||||||
|
int mZT2PPIAlarmFlag1;
|
||||||
|
int mZT2PPIAlarmFlag2;
|
||||||
|
int mZT2PPIAlarmFlag3;
|
||||||
|
int mZT2PPIAlarmFlag4;
|
||||||
|
int mZT2PPEAlarmFlag1;
|
||||||
|
int mZT2PPEAlarmFlag2;
|
||||||
|
int mZT2PPEAlarmFlag3;
|
||||||
|
int mZT2PPEAlarmFlag4;
|
||||||
|
|
||||||
|
QList<qint16> mZT2Ranks;
|
||||||
|
// int mZT2PPIRank1;
|
||||||
|
// int mZT2PPIRank2;
|
||||||
|
// int mZT2PPIRank3;
|
||||||
|
// int mZT2PPIRank4;
|
||||||
|
// int mZT2PPERank1;
|
||||||
|
// int mZT2PPERank2;
|
||||||
|
// int mZT2PPERank3;
|
||||||
|
// int mZT2PPERank4;
|
||||||
|
|
||||||
|
int mZT2V02AlarmFlag;
|
||||||
|
int mZT2PEQ2AlarmFlag;
|
||||||
|
|
||||||
|
int mITI10_12Flag;
|
||||||
|
|
||||||
|
int mWatchdogZT;
|
||||||
|
|
||||||
|
CZTInfo();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif // ZTINFO_H
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
//#include "MainWindow.h"
|
||||||
|
#include "OutilModbus.h"
|
||||||
|
#include <QApplication>
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
QApplication a(argc, argv);
|
||||||
|
// MainWindow w;
|
||||||
|
// w.show();
|
||||||
|
|
||||||
|
COutilModbus OutilModbus;
|
||||||
|
OutilModbus.Start();
|
||||||
|
|
||||||
|
return a.exec();
|
||||||
|
}
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 25 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 24 KiB |
@@ -0,0 +1,453 @@
|
|||||||
|
/********************************************************************************
|
||||||
|
** Form generated from reading UI file 'CModbusPage.ui'
|
||||||
|
**
|
||||||
|
** Created by: Qt User Interface Compiler version 5.14.2
|
||||||
|
**
|
||||||
|
** WARNING! All changes made in this file will be lost when recompiling UI file!
|
||||||
|
********************************************************************************/
|
||||||
|
|
||||||
|
#ifndef UI_CMODBUSPAGE_H
|
||||||
|
#define UI_CMODBUSPAGE_H
|
||||||
|
|
||||||
|
#include <QtCore/QVariant>
|
||||||
|
#include <QtWidgets/QApplication>
|
||||||
|
#include <QtWidgets/QCheckBox>
|
||||||
|
#include <QtWidgets/QComboBox>
|
||||||
|
#include <QtWidgets/QFrame>
|
||||||
|
#include <QtWidgets/QHeaderView>
|
||||||
|
#include <QtWidgets/QLabel>
|
||||||
|
#include <QtWidgets/QLineEdit>
|
||||||
|
#include <QtWidgets/QPushButton>
|
||||||
|
#include <QtWidgets/QSpinBox>
|
||||||
|
#include <QtWidgets/QTableWidget>
|
||||||
|
#include <QtWidgets/QTextEdit>
|
||||||
|
#include <QtWidgets/QTreeWidget>
|
||||||
|
#include <QtWidgets/QWidget>
|
||||||
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
class Ui_CModbusPage
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
QPushButton *mAN1Btn;
|
||||||
|
QPushButton *mAN2Btn;
|
||||||
|
QFrame *line;
|
||||||
|
QLabel *mSimCCTitleLabel;
|
||||||
|
QTextEdit *mCCEventsList;
|
||||||
|
QLineEdit *mZTIPAddressLineEdit;
|
||||||
|
QLineEdit *mZTPortLineEdit;
|
||||||
|
QPushButton *mConnectBtn;
|
||||||
|
QTableWidget *mModbusDatTable;
|
||||||
|
QLabel *mPPI1ZT1AlarmLabel;
|
||||||
|
QLabel *mPPEZT1AlarmLabel;
|
||||||
|
QLabel *mPGZT1AlarmLabel;
|
||||||
|
QLabel *mFNZT1AlarmLabel;
|
||||||
|
QLabel *mZT1AlarmeLabel;
|
||||||
|
QLabel *mZT1RangLabel;
|
||||||
|
QLabel *mZT1RangAlarmeLabel;
|
||||||
|
QLabel *mZT1RangFNLabel;
|
||||||
|
QLabel *mZT2AlarmeLabel;
|
||||||
|
QLabel *mPPIZT2AlarmLabel;
|
||||||
|
QLabel *mPPEZT2AlarmLabel;
|
||||||
|
QLabel *mZT2RangLabel;
|
||||||
|
QLabel *mZT2RangAlarmeLabel;
|
||||||
|
QLabel *mPEQ1AlarmLabel;
|
||||||
|
QLabel *mPEQ2AlarmLabel;
|
||||||
|
QLabel *mV00AlarmLabel;
|
||||||
|
QLabel *mV02AlarmLabel;
|
||||||
|
QFrame *line_2;
|
||||||
|
QFrame *line_3;
|
||||||
|
QLabel *mSimSEITitleLabel;
|
||||||
|
QLineEdit *mZTAutoReqDelay;
|
||||||
|
QLabel *mReqDelayLabel;
|
||||||
|
QPushButton *mSendModbusReadBtn;
|
||||||
|
QCheckBox *mAutoRequestChkBx;
|
||||||
|
QCheckBox *mStayOnTopChkBx;
|
||||||
|
QLabel *mPPI2ZT1AlarmLabel;
|
||||||
|
QLabel *mPPI3ZT1AlarmLabel;
|
||||||
|
QLabel *mPPIZT1AlarmLabel_4;
|
||||||
|
QLabel *mPPI2ZT1Rank;
|
||||||
|
QLabel *mPPI1ZT1Rank;
|
||||||
|
QLabel *mPPI3ZT1Rank;
|
||||||
|
QLabel *mPPIZT1AlarmLabel_5;
|
||||||
|
QLabel *mPPEZT1AlarmLabel_2;
|
||||||
|
QLabel *mPPEZT1AlarmLabel_3;
|
||||||
|
QLabel *mPPEZT1AlarmLabel_4;
|
||||||
|
QTableWidget *mCCModbusTable;
|
||||||
|
QTreeWidget *mCCModbusDataTree;
|
||||||
|
QPushButton *mZTC1Btn;
|
||||||
|
QPushButton *mAN1Btn_3;
|
||||||
|
QLabel *mActivityBitmap;
|
||||||
|
QCheckBox *mWatchdogChkBx;
|
||||||
|
QPushButton *mDateTimeBtn;
|
||||||
|
QSpinBox *mZT1Compo1;
|
||||||
|
QSpinBox *mZT1Compo2;
|
||||||
|
QSpinBox *mZT1Compo3;
|
||||||
|
QSpinBox *mZT2Compo1;
|
||||||
|
QSpinBox *mZT2Compo2;
|
||||||
|
QSpinBox *mZT2Compo3;
|
||||||
|
QPushButton *mSetTrainParamBtn;
|
||||||
|
QComboBox *mZT1TrainTypeBox;
|
||||||
|
QComboBox *mZT2TrainTypeBox;
|
||||||
|
QLabel *label;
|
||||||
|
QLabel *label_2;
|
||||||
|
QCheckBox *mZT1InhibPassChkBx;
|
||||||
|
QCheckBox *mZT2InhibPassChkBx;
|
||||||
|
QPushButton *pushButton;
|
||||||
|
|
||||||
|
void setupUi(QWidget *CModbusPage)
|
||||||
|
{
|
||||||
|
if (CModbusPage->objectName().isEmpty())
|
||||||
|
CModbusPage->setObjectName(QString::fromUtf8("CModbusPage"));
|
||||||
|
CModbusPage->resize(1024, 768);
|
||||||
|
mAN1Btn = new QPushButton(CModbusPage);
|
||||||
|
mAN1Btn->setObjectName(QString::fromUtf8("mAN1Btn"));
|
||||||
|
mAN1Btn->setGeometry(QRect(340, 90, 81, 23));
|
||||||
|
mAN2Btn = new QPushButton(CModbusPage);
|
||||||
|
mAN2Btn->setObjectName(QString::fromUtf8("mAN2Btn"));
|
||||||
|
mAN2Btn->setGeometry(QRect(450, 90, 81, 23));
|
||||||
|
line = new QFrame(CModbusPage);
|
||||||
|
line->setObjectName(QString::fromUtf8("line"));
|
||||||
|
line->setEnabled(false);
|
||||||
|
line->setGeometry(QRect(180, 290, 20, 221));
|
||||||
|
line->setFrameShape(QFrame::VLine);
|
||||||
|
line->setFrameShadow(QFrame::Sunken);
|
||||||
|
mSimCCTitleLabel = new QLabel(CModbusPage);
|
||||||
|
mSimCCTitleLabel->setObjectName(QString::fromUtf8("mSimCCTitleLabel"));
|
||||||
|
mSimCCTitleLabel->setGeometry(QRect(280, 20, 521, 31));
|
||||||
|
mSimCCTitleLabel->setAlignment(Qt::AlignCenter);
|
||||||
|
mCCEventsList = new QTextEdit(CModbusPage);
|
||||||
|
mCCEventsList->setObjectName(QString::fromUtf8("mCCEventsList"));
|
||||||
|
mCCEventsList->setEnabled(false);
|
||||||
|
mCCEventsList->setGeometry(QRect(530, 610, 511, 141));
|
||||||
|
mZTIPAddressLineEdit = new QLineEdit(CModbusPage);
|
||||||
|
mZTIPAddressLineEdit->setObjectName(QString::fromUtf8("mZTIPAddressLineEdit"));
|
||||||
|
mZTIPAddressLineEdit->setGeometry(QRect(40, 60, 231, 20));
|
||||||
|
mZTPortLineEdit = new QLineEdit(CModbusPage);
|
||||||
|
mZTPortLineEdit->setObjectName(QString::fromUtf8("mZTPortLineEdit"));
|
||||||
|
mZTPortLineEdit->setGeometry(QRect(280, 60, 61, 20));
|
||||||
|
mConnectBtn = new QPushButton(CModbusPage);
|
||||||
|
mConnectBtn->setObjectName(QString::fromUtf8("mConnectBtn"));
|
||||||
|
mConnectBtn->setGeometry(QRect(360, 60, 75, 23));
|
||||||
|
mModbusDatTable = new QTableWidget(CModbusPage);
|
||||||
|
mModbusDatTable->setObjectName(QString::fromUtf8("mModbusDatTable"));
|
||||||
|
mModbusDatTable->setEnabled(false);
|
||||||
|
mModbusDatTable->setGeometry(QRect(580, 410, 511, 181));
|
||||||
|
mPPI1ZT1AlarmLabel = new QLabel(CModbusPage);
|
||||||
|
mPPI1ZT1AlarmLabel->setObjectName(QString::fromUtf8("mPPI1ZT1AlarmLabel"));
|
||||||
|
mPPI1ZT1AlarmLabel->setEnabled(false);
|
||||||
|
mPPI1ZT1AlarmLabel->setGeometry(QRect(10, 290, 171, 16));
|
||||||
|
QFont font;
|
||||||
|
font.setPointSize(12);
|
||||||
|
mPPI1ZT1AlarmLabel->setFont(font);
|
||||||
|
mPPEZT1AlarmLabel = new QLabel(CModbusPage);
|
||||||
|
mPPEZT1AlarmLabel->setObjectName(QString::fromUtf8("mPPEZT1AlarmLabel"));
|
||||||
|
mPPEZT1AlarmLabel->setEnabled(false);
|
||||||
|
mPPEZT1AlarmLabel->setGeometry(QRect(20, 380, 161, 16));
|
||||||
|
mPPEZT1AlarmLabel->setFont(font);
|
||||||
|
mPGZT1AlarmLabel = new QLabel(CModbusPage);
|
||||||
|
mPGZT1AlarmLabel->setObjectName(QString::fromUtf8("mPGZT1AlarmLabel"));
|
||||||
|
mPGZT1AlarmLabel->setEnabled(false);
|
||||||
|
mPGZT1AlarmLabel->setGeometry(QRect(70, 500, 101, 21));
|
||||||
|
mPGZT1AlarmLabel->setFont(font);
|
||||||
|
mFNZT1AlarmLabel = new QLabel(CModbusPage);
|
||||||
|
mFNZT1AlarmLabel->setObjectName(QString::fromUtf8("mFNZT1AlarmLabel"));
|
||||||
|
mFNZT1AlarmLabel->setEnabled(false);
|
||||||
|
mFNZT1AlarmLabel->setGeometry(QRect(60, 530, 121, 21));
|
||||||
|
mFNZT1AlarmLabel->setFont(font);
|
||||||
|
mZT1AlarmeLabel = new QLabel(CModbusPage);
|
||||||
|
mZT1AlarmeLabel->setObjectName(QString::fromUtf8("mZT1AlarmeLabel"));
|
||||||
|
mZT1AlarmeLabel->setEnabled(false);
|
||||||
|
mZT1AlarmeLabel->setGeometry(QRect(50, 260, 91, 21));
|
||||||
|
QFont font1;
|
||||||
|
font1.setPointSize(12);
|
||||||
|
font1.setUnderline(true);
|
||||||
|
mZT1AlarmeLabel->setFont(font1);
|
||||||
|
mZT1RangLabel = new QLabel(CModbusPage);
|
||||||
|
mZT1RangLabel->setObjectName(QString::fromUtf8("mZT1RangLabel"));
|
||||||
|
mZT1RangLabel->setEnabled(false);
|
||||||
|
mZT1RangLabel->setGeometry(QRect(190, 260, 61, 21));
|
||||||
|
mZT1RangLabel->setFont(font1);
|
||||||
|
mZT1RangAlarmeLabel = new QLabel(CModbusPage);
|
||||||
|
mZT1RangAlarmeLabel->setObjectName(QString::fromUtf8("mZT1RangAlarmeLabel"));
|
||||||
|
mZT1RangAlarmeLabel->setEnabled(false);
|
||||||
|
mZT1RangAlarmeLabel->setGeometry(QRect(240, 230, 71, 20));
|
||||||
|
mZT1RangAlarmeLabel->setFont(font);
|
||||||
|
mZT1RangFNLabel = new QLabel(CModbusPage);
|
||||||
|
mZT1RangFNLabel->setObjectName(QString::fromUtf8("mZT1RangFNLabel"));
|
||||||
|
mZT1RangFNLabel->setEnabled(false);
|
||||||
|
mZT1RangFNLabel->setGeometry(QRect(190, 530, 71, 21));
|
||||||
|
mZT1RangFNLabel->setFont(font);
|
||||||
|
mZT2AlarmeLabel = new QLabel(CModbusPage);
|
||||||
|
mZT2AlarmeLabel->setObjectName(QString::fromUtf8("mZT2AlarmeLabel"));
|
||||||
|
mZT2AlarmeLabel->setEnabled(false);
|
||||||
|
mZT2AlarmeLabel->setGeometry(QRect(320, 260, 91, 21));
|
||||||
|
mZT2AlarmeLabel->setFont(font1);
|
||||||
|
mPPIZT2AlarmLabel = new QLabel(CModbusPage);
|
||||||
|
mPPIZT2AlarmLabel->setObjectName(QString::fromUtf8("mPPIZT2AlarmLabel"));
|
||||||
|
mPPIZT2AlarmLabel->setEnabled(false);
|
||||||
|
mPPIZT2AlarmLabel->setGeometry(QRect(280, 290, 161, 16));
|
||||||
|
mPPIZT2AlarmLabel->setFont(font);
|
||||||
|
mPPEZT2AlarmLabel = new QLabel(CModbusPage);
|
||||||
|
mPPEZT2AlarmLabel->setObjectName(QString::fromUtf8("mPPEZT2AlarmLabel"));
|
||||||
|
mPPEZT2AlarmLabel->setEnabled(false);
|
||||||
|
mPPEZT2AlarmLabel->setGeometry(QRect(280, 310, 161, 16));
|
||||||
|
mPPEZT2AlarmLabel->setFont(font);
|
||||||
|
mZT2RangLabel = new QLabel(CModbusPage);
|
||||||
|
mZT2RangLabel->setObjectName(QString::fromUtf8("mZT2RangLabel"));
|
||||||
|
mZT2RangLabel->setEnabled(false);
|
||||||
|
mZT2RangLabel->setGeometry(QRect(460, 260, 61, 21));
|
||||||
|
mZT2RangLabel->setFont(font1);
|
||||||
|
mZT2RangAlarmeLabel = new QLabel(CModbusPage);
|
||||||
|
mZT2RangAlarmeLabel->setObjectName(QString::fromUtf8("mZT2RangAlarmeLabel"));
|
||||||
|
mZT2RangAlarmeLabel->setEnabled(false);
|
||||||
|
mZT2RangAlarmeLabel->setGeometry(QRect(460, 300, 71, 21));
|
||||||
|
mZT2RangAlarmeLabel->setFont(font);
|
||||||
|
mPEQ1AlarmLabel = new QLabel(CModbusPage);
|
||||||
|
mPEQ1AlarmLabel->setObjectName(QString::fromUtf8("mPEQ1AlarmLabel"));
|
||||||
|
mPEQ1AlarmLabel->setEnabled(false);
|
||||||
|
mPEQ1AlarmLabel->setGeometry(QRect(40, 560, 141, 21));
|
||||||
|
mPEQ1AlarmLabel->setFont(font);
|
||||||
|
mPEQ2AlarmLabel = new QLabel(CModbusPage);
|
||||||
|
mPEQ2AlarmLabel->setObjectName(QString::fromUtf8("mPEQ2AlarmLabel"));
|
||||||
|
mPEQ2AlarmLabel->setEnabled(false);
|
||||||
|
mPEQ2AlarmLabel->setGeometry(QRect(290, 350, 141, 21));
|
||||||
|
mPEQ2AlarmLabel->setFont(font);
|
||||||
|
mV00AlarmLabel = new QLabel(CModbusPage);
|
||||||
|
mV00AlarmLabel->setObjectName(QString::fromUtf8("mV00AlarmLabel"));
|
||||||
|
mV00AlarmLabel->setEnabled(false);
|
||||||
|
mV00AlarmLabel->setGeometry(QRect(20, 580, 161, 21));
|
||||||
|
mV00AlarmLabel->setFont(font);
|
||||||
|
mV02AlarmLabel = new QLabel(CModbusPage);
|
||||||
|
mV02AlarmLabel->setObjectName(QString::fromUtf8("mV02AlarmLabel"));
|
||||||
|
mV02AlarmLabel->setEnabled(false);
|
||||||
|
mV02AlarmLabel->setGeometry(QRect(290, 370, 161, 21));
|
||||||
|
mV02AlarmLabel->setFont(font);
|
||||||
|
line_2 = new QFrame(CModbusPage);
|
||||||
|
line_2->setObjectName(QString::fromUtf8("line_2"));
|
||||||
|
line_2->setEnabled(false);
|
||||||
|
line_2->setGeometry(QRect(440, 290, 20, 41));
|
||||||
|
line_2->setFrameShape(QFrame::VLine);
|
||||||
|
line_2->setFrameShadow(QFrame::Sunken);
|
||||||
|
line_3 = new QFrame(CModbusPage);
|
||||||
|
line_3->setObjectName(QString::fromUtf8("line_3"));
|
||||||
|
line_3->setGeometry(QRect(540, 160, 20, 591));
|
||||||
|
line_3->setFrameShape(QFrame::VLine);
|
||||||
|
line_3->setFrameShadow(QFrame::Sunken);
|
||||||
|
mSimSEITitleLabel = new QLabel(CModbusPage);
|
||||||
|
mSimSEITitleLabel->setObjectName(QString::fromUtf8("mSimSEITitleLabel"));
|
||||||
|
mSimSEITitleLabel->setGeometry(QRect(650, 260, 291, 31));
|
||||||
|
mSimSEITitleLabel->setAlignment(Qt::AlignCenter);
|
||||||
|
mZTAutoReqDelay = new QLineEdit(CModbusPage);
|
||||||
|
mZTAutoReqDelay->setObjectName(QString::fromUtf8("mZTAutoReqDelay"));
|
||||||
|
mZTAutoReqDelay->setGeometry(QRect(150, 80, 31, 20));
|
||||||
|
mReqDelayLabel = new QLabel(CModbusPage);
|
||||||
|
mReqDelayLabel->setObjectName(QString::fromUtf8("mReqDelayLabel"));
|
||||||
|
mReqDelayLabel->setGeometry(QRect(40, 80, 111, 20));
|
||||||
|
mSendModbusReadBtn = new QPushButton(CModbusPage);
|
||||||
|
mSendModbusReadBtn->setObjectName(QString::fromUtf8("mSendModbusReadBtn"));
|
||||||
|
mSendModbusReadBtn->setGeometry(QRect(240, 80, 75, 23));
|
||||||
|
mAutoRequestChkBx = new QCheckBox(CModbusPage);
|
||||||
|
mAutoRequestChkBx->setObjectName(QString::fromUtf8("mAutoRequestChkBx"));
|
||||||
|
mAutoRequestChkBx->setGeometry(QRect(190, 80, 70, 17));
|
||||||
|
mStayOnTopChkBx = new QCheckBox(CModbusPage);
|
||||||
|
mStayOnTopChkBx->setObjectName(QString::fromUtf8("mStayOnTopChkBx"));
|
||||||
|
mStayOnTopChkBx->setGeometry(QRect(40, 100, 70, 17));
|
||||||
|
mPPI2ZT1AlarmLabel = new QLabel(CModbusPage);
|
||||||
|
mPPI2ZT1AlarmLabel->setObjectName(QString::fromUtf8("mPPI2ZT1AlarmLabel"));
|
||||||
|
mPPI2ZT1AlarmLabel->setEnabled(false);
|
||||||
|
mPPI2ZT1AlarmLabel->setGeometry(QRect(10, 310, 171, 16));
|
||||||
|
mPPI2ZT1AlarmLabel->setFont(font);
|
||||||
|
mPPI3ZT1AlarmLabel = new QLabel(CModbusPage);
|
||||||
|
mPPI3ZT1AlarmLabel->setObjectName(QString::fromUtf8("mPPI3ZT1AlarmLabel"));
|
||||||
|
mPPI3ZT1AlarmLabel->setEnabled(false);
|
||||||
|
mPPI3ZT1AlarmLabel->setGeometry(QRect(10, 330, 171, 16));
|
||||||
|
mPPI3ZT1AlarmLabel->setFont(font);
|
||||||
|
mPPIZT1AlarmLabel_4 = new QLabel(CModbusPage);
|
||||||
|
mPPIZT1AlarmLabel_4->setObjectName(QString::fromUtf8("mPPIZT1AlarmLabel_4"));
|
||||||
|
mPPIZT1AlarmLabel_4->setEnabled(false);
|
||||||
|
mPPIZT1AlarmLabel_4->setGeometry(QRect(10, 350, 171, 16));
|
||||||
|
mPPIZT1AlarmLabel_4->setFont(font);
|
||||||
|
mPPI2ZT1Rank = new QLabel(CModbusPage);
|
||||||
|
mPPI2ZT1Rank->setObjectName(QString::fromUtf8("mPPI2ZT1Rank"));
|
||||||
|
mPPI2ZT1Rank->setEnabled(false);
|
||||||
|
mPPI2ZT1Rank->setGeometry(QRect(200, 310, 81, 16));
|
||||||
|
mPPI2ZT1Rank->setFont(font);
|
||||||
|
mPPI1ZT1Rank = new QLabel(CModbusPage);
|
||||||
|
mPPI1ZT1Rank->setObjectName(QString::fromUtf8("mPPI1ZT1Rank"));
|
||||||
|
mPPI1ZT1Rank->setEnabled(false);
|
||||||
|
mPPI1ZT1Rank->setGeometry(QRect(200, 290, 81, 16));
|
||||||
|
mPPI1ZT1Rank->setFont(font);
|
||||||
|
mPPI3ZT1Rank = new QLabel(CModbusPage);
|
||||||
|
mPPI3ZT1Rank->setObjectName(QString::fromUtf8("mPPI3ZT1Rank"));
|
||||||
|
mPPI3ZT1Rank->setEnabled(false);
|
||||||
|
mPPI3ZT1Rank->setGeometry(QRect(200, 330, 81, 16));
|
||||||
|
mPPI3ZT1Rank->setFont(font);
|
||||||
|
mPPIZT1AlarmLabel_5 = new QLabel(CModbusPage);
|
||||||
|
mPPIZT1AlarmLabel_5->setObjectName(QString::fromUtf8("mPPIZT1AlarmLabel_5"));
|
||||||
|
mPPIZT1AlarmLabel_5->setEnabled(false);
|
||||||
|
mPPIZT1AlarmLabel_5->setGeometry(QRect(200, 350, 81, 16));
|
||||||
|
mPPIZT1AlarmLabel_5->setFont(font);
|
||||||
|
mPPEZT1AlarmLabel_2 = new QLabel(CModbusPage);
|
||||||
|
mPPEZT1AlarmLabel_2->setObjectName(QString::fromUtf8("mPPEZT1AlarmLabel_2"));
|
||||||
|
mPPEZT1AlarmLabel_2->setEnabled(false);
|
||||||
|
mPPEZT1AlarmLabel_2->setGeometry(QRect(20, 400, 161, 16));
|
||||||
|
mPPEZT1AlarmLabel_2->setFont(font);
|
||||||
|
mPPEZT1AlarmLabel_3 = new QLabel(CModbusPage);
|
||||||
|
mPPEZT1AlarmLabel_3->setObjectName(QString::fromUtf8("mPPEZT1AlarmLabel_3"));
|
||||||
|
mPPEZT1AlarmLabel_3->setEnabled(false);
|
||||||
|
mPPEZT1AlarmLabel_3->setGeometry(QRect(20, 420, 161, 16));
|
||||||
|
mPPEZT1AlarmLabel_3->setFont(font);
|
||||||
|
mPPEZT1AlarmLabel_4 = new QLabel(CModbusPage);
|
||||||
|
mPPEZT1AlarmLabel_4->setObjectName(QString::fromUtf8("mPPEZT1AlarmLabel_4"));
|
||||||
|
mPPEZT1AlarmLabel_4->setEnabled(false);
|
||||||
|
mPPEZT1AlarmLabel_4->setGeometry(QRect(20, 440, 161, 16));
|
||||||
|
mPPEZT1AlarmLabel_4->setFont(font);
|
||||||
|
mCCModbusTable = new QTableWidget(CModbusPage);
|
||||||
|
mCCModbusTable->setObjectName(QString::fromUtf8("mCCModbusTable"));
|
||||||
|
mCCModbusTable->setEnabled(false);
|
||||||
|
mCCModbusTable->setGeometry(QRect(630, 330, 621, 471));
|
||||||
|
mCCModbusDataTree = new QTreeWidget(CModbusPage);
|
||||||
|
QTreeWidgetItem *__qtreewidgetitem = new QTreeWidgetItem();
|
||||||
|
__qtreewidgetitem->setText(0, QString::fromUtf8("1"));
|
||||||
|
mCCModbusDataTree->setHeaderItem(__qtreewidgetitem);
|
||||||
|
mCCModbusDataTree->setObjectName(QString::fromUtf8("mCCModbusDataTree"));
|
||||||
|
mCCModbusDataTree->setGeometry(QRect(10, 150, 511, 611));
|
||||||
|
mZTC1Btn = new QPushButton(CModbusPage);
|
||||||
|
mZTC1Btn->setObjectName(QString::fromUtf8("mZTC1Btn"));
|
||||||
|
mZTC1Btn->setGeometry(QRect(340, 120, 81, 23));
|
||||||
|
mAN1Btn_3 = new QPushButton(CModbusPage);
|
||||||
|
mAN1Btn_3->setObjectName(QString::fromUtf8("mAN1Btn_3"));
|
||||||
|
mAN1Btn_3->setGeometry(QRect(450, 120, 81, 23));
|
||||||
|
mActivityBitmap = new QLabel(CModbusPage);
|
||||||
|
mActivityBitmap->setObjectName(QString::fromUtf8("mActivityBitmap"));
|
||||||
|
mActivityBitmap->setGeometry(QRect(190, 100, 31, 21));
|
||||||
|
mWatchdogChkBx = new QCheckBox(CModbusPage);
|
||||||
|
mWatchdogChkBx->setObjectName(QString::fromUtf8("mWatchdogChkBx"));
|
||||||
|
mWatchdogChkBx->setGeometry(QRect(110, 100, 70, 17));
|
||||||
|
mDateTimeBtn = new QPushButton(CModbusPage);
|
||||||
|
mDateTimeBtn->setObjectName(QString::fromUtf8("mDateTimeBtn"));
|
||||||
|
mDateTimeBtn->setGeometry(QRect(240, 110, 81, 23));
|
||||||
|
mZT1Compo1 = new QSpinBox(CModbusPage);
|
||||||
|
mZT1Compo1->setObjectName(QString::fromUtf8("mZT1Compo1"));
|
||||||
|
mZT1Compo1->setGeometry(QRect(590, 90, 61, 22));
|
||||||
|
mZT1Compo1->setMaximum(999);
|
||||||
|
mZT1Compo2 = new QSpinBox(CModbusPage);
|
||||||
|
mZT1Compo2->setObjectName(QString::fromUtf8("mZT1Compo2"));
|
||||||
|
mZT1Compo2->setGeometry(QRect(660, 90, 61, 22));
|
||||||
|
mZT1Compo2->setMaximum(999);
|
||||||
|
mZT1Compo3 = new QSpinBox(CModbusPage);
|
||||||
|
mZT1Compo3->setObjectName(QString::fromUtf8("mZT1Compo3"));
|
||||||
|
mZT1Compo3->setGeometry(QRect(730, 90, 61, 22));
|
||||||
|
mZT1Compo3->setMaximum(999);
|
||||||
|
mZT2Compo1 = new QSpinBox(CModbusPage);
|
||||||
|
mZT2Compo1->setObjectName(QString::fromUtf8("mZT2Compo1"));
|
||||||
|
mZT2Compo1->setGeometry(QRect(590, 150, 61, 22));
|
||||||
|
mZT2Compo1->setMaximum(999);
|
||||||
|
mZT2Compo2 = new QSpinBox(CModbusPage);
|
||||||
|
mZT2Compo2->setObjectName(QString::fromUtf8("mZT2Compo2"));
|
||||||
|
mZT2Compo2->setGeometry(QRect(660, 150, 61, 22));
|
||||||
|
mZT2Compo2->setMaximum(999);
|
||||||
|
mZT2Compo3 = new QSpinBox(CModbusPage);
|
||||||
|
mZT2Compo3->setObjectName(QString::fromUtf8("mZT2Compo3"));
|
||||||
|
mZT2Compo3->setGeometry(QRect(730, 150, 61, 22));
|
||||||
|
mZT2Compo3->setMaximum(999);
|
||||||
|
mSetTrainParamBtn = new QPushButton(CModbusPage);
|
||||||
|
mSetTrainParamBtn->setObjectName(QString::fromUtf8("mSetTrainParamBtn"));
|
||||||
|
mSetTrainParamBtn->setGeometry(QRect(580, 190, 75, 23));
|
||||||
|
mZT1TrainTypeBox = new QComboBox(CModbusPage);
|
||||||
|
mZT1TrainTypeBox->setObjectName(QString::fromUtf8("mZT1TrainTypeBox"));
|
||||||
|
mZT1TrainTypeBox->setGeometry(QRect(800, 90, 91, 22));
|
||||||
|
mZT2TrainTypeBox = new QComboBox(CModbusPage);
|
||||||
|
mZT2TrainTypeBox->setObjectName(QString::fromUtf8("mZT2TrainTypeBox"));
|
||||||
|
mZT2TrainTypeBox->setGeometry(QRect(800, 150, 91, 22));
|
||||||
|
label = new QLabel(CModbusPage);
|
||||||
|
label->setObjectName(QString::fromUtf8("label"));
|
||||||
|
label->setGeometry(QRect(590, 70, 301, 20));
|
||||||
|
label_2 = new QLabel(CModbusPage);
|
||||||
|
label_2->setObjectName(QString::fromUtf8("label_2"));
|
||||||
|
label_2->setGeometry(QRect(590, 130, 301, 20));
|
||||||
|
mZT1InhibPassChkBx = new QCheckBox(CModbusPage);
|
||||||
|
mZT1InhibPassChkBx->setObjectName(QString::fromUtf8("mZT1InhibPassChkBx"));
|
||||||
|
mZT1InhibPassChkBx->setGeometry(QRect(910, 90, 70, 17));
|
||||||
|
mZT2InhibPassChkBx = new QCheckBox(CModbusPage);
|
||||||
|
mZT2InhibPassChkBx->setObjectName(QString::fromUtf8("mZT2InhibPassChkBx"));
|
||||||
|
mZT2InhibPassChkBx->setGeometry(QRect(910, 150, 70, 17));
|
||||||
|
pushButton = new QPushButton(CModbusPage);
|
||||||
|
pushButton->setObjectName(QString::fromUtf8("pushButton"));
|
||||||
|
pushButton->setGeometry(QRect(800, 210, 75, 23));
|
||||||
|
|
||||||
|
retranslateUi(CModbusPage);
|
||||||
|
|
||||||
|
QMetaObject::connectSlotsByName(CModbusPage);
|
||||||
|
} // setupUi
|
||||||
|
|
||||||
|
void retranslateUi(QWidget *CModbusPage)
|
||||||
|
{
|
||||||
|
CModbusPage->setWindowTitle(QCoreApplication::translate("CModbusPage", "Form", nullptr));
|
||||||
|
mAN1Btn->setText(QCoreApplication::translate("CModbusPage", "Envoyer AN1", nullptr));
|
||||||
|
mAN2Btn->setText(QCoreApplication::translate("CModbusPage", "Envoyer AN2", nullptr));
|
||||||
|
mSimCCTitleLabel->setText(QCoreApplication::translate("CModbusPage", "SIMULATEUR COMMANDE CENTRALIS\303\211E", nullptr));
|
||||||
|
mCCEventsList->setHtml(QCoreApplication::translate("CModbusPage", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
|
||||||
|
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
|
||||||
|
"p, li { white-space: pre-wrap; }\n"
|
||||||
|
"</style></head><body style=\" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;\">\n"
|
||||||
|
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-size:8pt;\">\303\211v\303\251nements CC:</span></p></body></html>", nullptr));
|
||||||
|
mZTIPAddressLineEdit->setText(QCoreApplication::translate("CModbusPage", "192.168.3.102", nullptr));
|
||||||
|
mZTPortLineEdit->setText(QCoreApplication::translate("CModbusPage", "502", nullptr));
|
||||||
|
mConnectBtn->setText(QCoreApplication::translate("CModbusPage", "Connecter", nullptr));
|
||||||
|
mPPI1ZT1AlarmLabel->setText(QCoreApplication::translate("CModbusPage", "Pneu Porteur Int\303\251rieur 1", nullptr));
|
||||||
|
mPPEZT1AlarmLabel->setText(QCoreApplication::translate("CModbusPage", "Pneu Porteur Ext\303\251rieur 1", nullptr));
|
||||||
|
mPGZT1AlarmLabel->setText(QCoreApplication::translate("CModbusPage", "Pneu Guidage", nullptr));
|
||||||
|
mFNZT1AlarmLabel->setText(QCoreApplication::translate("CModbusPage", "Frotteur N\303\251gatif", nullptr));
|
||||||
|
mZT1AlarmeLabel->setText(QCoreApplication::translate("CModbusPage", "Alarme ZT1", nullptr));
|
||||||
|
mZT1RangLabel->setText(QCoreApplication::translate("CModbusPage", "Rang", nullptr));
|
||||||
|
mZT1RangAlarmeLabel->setText(QCoreApplication::translate("CModbusPage", "asdfasdf", nullptr));
|
||||||
|
mZT1RangFNLabel->setText(QCoreApplication::translate("CModbusPage", "--", nullptr));
|
||||||
|
mZT2AlarmeLabel->setText(QCoreApplication::translate("CModbusPage", "Alarme ZT2", nullptr));
|
||||||
|
mPPIZT2AlarmLabel->setText(QCoreApplication::translate("CModbusPage", "Pneu Porteur Int\303\251rieur", nullptr));
|
||||||
|
mPPEZT2AlarmLabel->setText(QCoreApplication::translate("CModbusPage", "Pneu Porteur Ext\303\251rieur", nullptr));
|
||||||
|
mZT2RangLabel->setText(QCoreApplication::translate("CModbusPage", "Rang", nullptr));
|
||||||
|
mZT2RangAlarmeLabel->setText(QCoreApplication::translate("CModbusPage", "--", nullptr));
|
||||||
|
mPEQ1AlarmLabel->setText(QCoreApplication::translate("CModbusPage", "Panne \303\211quipement", nullptr));
|
||||||
|
mPEQ2AlarmLabel->setText(QCoreApplication::translate("CModbusPage", "Panne \303\211quipement", nullptr));
|
||||||
|
mV00AlarmLabel->setText(QCoreApplication::translate("CModbusPage", "Erreur comptage V00", nullptr));
|
||||||
|
mV02AlarmLabel->setText(QCoreApplication::translate("CModbusPage", "Erreur comptage V02", nullptr));
|
||||||
|
mSimSEITitleLabel->setText(QCoreApplication::translate("CModbusPage", "SIMULATEUR SEI", nullptr));
|
||||||
|
mZTAutoReqDelay->setText(QCoreApplication::translate("CModbusPage", "300", nullptr));
|
||||||
|
mReqDelayLabel->setText(QCoreApplication::translate("CModbusPage", "D\303\251lai de requ\303\252te (ms)", nullptr));
|
||||||
|
mSendModbusReadBtn->setText(QCoreApplication::translate("CModbusPage", "Lire", nullptr));
|
||||||
|
mAutoRequestChkBx->setText(QCoreApplication::translate("CModbusPage", "Auto", nullptr));
|
||||||
|
mStayOnTopChkBx->setText(QCoreApplication::translate("CModbusPage", "OnTop", nullptr));
|
||||||
|
mPPI2ZT1AlarmLabel->setText(QCoreApplication::translate("CModbusPage", "Pneu Porteur Int\303\251rieur 2", nullptr));
|
||||||
|
mPPI3ZT1AlarmLabel->setText(QCoreApplication::translate("CModbusPage", "Pneu Porteur Int\303\251rieur 3", nullptr));
|
||||||
|
mPPIZT1AlarmLabel_4->setText(QCoreApplication::translate("CModbusPage", "Pneu Porteur Int\303\251rieur 4", nullptr));
|
||||||
|
mPPI2ZT1Rank->setText(QCoreApplication::translate("CModbusPage", "0", nullptr));
|
||||||
|
mPPI1ZT1Rank->setText(QCoreApplication::translate("CModbusPage", "0", nullptr));
|
||||||
|
mPPI3ZT1Rank->setText(QCoreApplication::translate("CModbusPage", "0", nullptr));
|
||||||
|
mPPIZT1AlarmLabel_5->setText(QCoreApplication::translate("CModbusPage", "0", nullptr));
|
||||||
|
mPPEZT1AlarmLabel_2->setText(QCoreApplication::translate("CModbusPage", "Pneu Porteur Ext\303\251rieur 2", nullptr));
|
||||||
|
mPPEZT1AlarmLabel_3->setText(QCoreApplication::translate("CModbusPage", "Pneu Porteur Ext\303\251rieur 3", nullptr));
|
||||||
|
mPPEZT1AlarmLabel_4->setText(QCoreApplication::translate("CModbusPage", "Pneu Porteur Ext\303\251rieur 4", nullptr));
|
||||||
|
mZTC1Btn->setText(QCoreApplication::translate("CModbusPage", "Envoyer ZTC1", nullptr));
|
||||||
|
mAN1Btn_3->setText(QCoreApplication::translate("CModbusPage", "Envoyer ZTC2", nullptr));
|
||||||
|
mActivityBitmap->setText(QCoreApplication::translate("CModbusPage", "Activity", nullptr));
|
||||||
|
mWatchdogChkBx->setText(QCoreApplication::translate("CModbusPage", "Watchdog", nullptr));
|
||||||
|
mDateTimeBtn->setText(QCoreApplication::translate("CModbusPage", "Envoyer Date", nullptr));
|
||||||
|
mSetTrainParamBtn->setText(QCoreApplication::translate("CModbusPage", "Appliquer", nullptr));
|
||||||
|
label->setText(QCoreApplication::translate("CModbusPage", "Composition & type train ZT1", nullptr));
|
||||||
|
label_2->setText(QCoreApplication::translate("CModbusPage", "Composition & type train ZT2", nullptr));
|
||||||
|
mZT1InhibPassChkBx->setText(QCoreApplication::translate("CModbusPage", "Inhiber", nullptr));
|
||||||
|
mZT2InhibPassChkBx->setText(QCoreApplication::translate("CModbusPage", "Inhiber", nullptr));
|
||||||
|
pushButton->setText(QCoreApplication::translate("CModbusPage", "asdfasdf", nullptr));
|
||||||
|
} // retranslateUi
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class CModbusPage: public Ui_CModbusPage {};
|
||||||
|
} // namespace Ui
|
||||||
|
|
||||||
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
|
#endif // UI_CMODBUSPAGE_H
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
/********************************************************************************
|
||||||
|
** Form generated from reading UI file 'LazerProbeSimPage.ui'
|
||||||
|
**
|
||||||
|
** Created by: Qt User Interface Compiler version 5.14.2
|
||||||
|
**
|
||||||
|
** WARNING! All changes made in this file will be lost when recompiling UI file!
|
||||||
|
********************************************************************************/
|
||||||
|
|
||||||
|
#ifndef UI_LAZERPROBESIMPAGE_H
|
||||||
|
#define UI_LAZERPROBESIMPAGE_H
|
||||||
|
|
||||||
|
#include <QtCore/QVariant>
|
||||||
|
#include <QtWidgets/QApplication>
|
||||||
|
#include <QtWidgets/QCheckBox>
|
||||||
|
#include <QtWidgets/QLabel>
|
||||||
|
#include <QtWidgets/QSlider>
|
||||||
|
#include <QtWidgets/QWidget>
|
||||||
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
class Ui_CLazerProbeSimPage
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
QCheckBox *mEnableProbeChkBx;
|
||||||
|
QSlider *mMeasurementValueSlider;
|
||||||
|
QCheckBox *mOutOfRangeChkBx;
|
||||||
|
QLabel *mValueDisplayLabel;
|
||||||
|
|
||||||
|
void setupUi(QWidget *CLazerProbeSimPage)
|
||||||
|
{
|
||||||
|
if (CLazerProbeSimPage->objectName().isEmpty())
|
||||||
|
CLazerProbeSimPage->setObjectName(QString::fromUtf8("CLazerProbeSimPage"));
|
||||||
|
CLazerProbeSimPage->resize(1143, 465);
|
||||||
|
mEnableProbeChkBx = new QCheckBox(CLazerProbeSimPage);
|
||||||
|
mEnableProbeChkBx->setObjectName(QString::fromUtf8("mEnableProbeChkBx"));
|
||||||
|
mEnableProbeChkBx->setGeometry(QRect(130, 160, 70, 17));
|
||||||
|
mMeasurementValueSlider = new QSlider(CLazerProbeSimPage);
|
||||||
|
mMeasurementValueSlider->setObjectName(QString::fromUtf8("mMeasurementValueSlider"));
|
||||||
|
mMeasurementValueSlider->setGeometry(QRect(100, 90, 291, 19));
|
||||||
|
mMeasurementValueSlider->setMinimum(100000);
|
||||||
|
mMeasurementValueSlider->setMaximum(200000);
|
||||||
|
mMeasurementValueSlider->setOrientation(Qt::Horizontal);
|
||||||
|
mOutOfRangeChkBx = new QCheckBox(CLazerProbeSimPage);
|
||||||
|
mOutOfRangeChkBx->setObjectName(QString::fromUtf8("mOutOfRangeChkBx"));
|
||||||
|
mOutOfRangeChkBx->setGeometry(QRect(240, 160, 70, 17));
|
||||||
|
mValueDisplayLabel = new QLabel(CLazerProbeSimPage);
|
||||||
|
mValueDisplayLabel->setObjectName(QString::fromUtf8("mValueDisplayLabel"));
|
||||||
|
mValueDisplayLabel->setGeometry(QRect(210, 40, 46, 13));
|
||||||
|
|
||||||
|
retranslateUi(CLazerProbeSimPage);
|
||||||
|
|
||||||
|
QMetaObject::connectSlotsByName(CLazerProbeSimPage);
|
||||||
|
} // setupUi
|
||||||
|
|
||||||
|
void retranslateUi(QWidget *CLazerProbeSimPage)
|
||||||
|
{
|
||||||
|
CLazerProbeSimPage->setWindowTitle(QCoreApplication::translate("CLazerProbeSimPage", "Form", nullptr));
|
||||||
|
mEnableProbeChkBx->setText(QCoreApplication::translate("CLazerProbeSimPage", "Activer", nullptr));
|
||||||
|
mOutOfRangeChkBx->setText(QCoreApplication::translate("CLazerProbeSimPage", "CheckBox", nullptr));
|
||||||
|
mValueDisplayLabel->setText(QCoreApplication::translate("CLazerProbeSimPage", "TextLabel", nullptr));
|
||||||
|
} // retranslateUi
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class CLazerProbeSimPage: public Ui_CLazerProbeSimPage {};
|
||||||
|
} // namespace Ui
|
||||||
|
|
||||||
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
|
#endif // UI_LAZERPROBESIMPAGE_H
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
/********************************************************************************
|
||||||
|
** Form generated from reading UI file 'MainPage.ui'
|
||||||
|
**
|
||||||
|
** Created by: Qt User Interface Compiler version 5.14.2
|
||||||
|
**
|
||||||
|
** WARNING! All changes made in this file will be lost when recompiling UI file!
|
||||||
|
********************************************************************************/
|
||||||
|
|
||||||
|
#ifndef UI_MAINPAGE_H
|
||||||
|
#define UI_MAINPAGE_H
|
||||||
|
|
||||||
|
#include <QtCore/QVariant>
|
||||||
|
#include <QtWidgets/QApplication>
|
||||||
|
#include <QtWidgets/QTabWidget>
|
||||||
|
#include <QtWidgets/QWidget>
|
||||||
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
class Ui_CMainPage
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
QTabWidget *mMainPageTabs;
|
||||||
|
QWidget *Modbus;
|
||||||
|
QWidget *Sondes;
|
||||||
|
|
||||||
|
void setupUi(QWidget *CMainPage)
|
||||||
|
{
|
||||||
|
if (CMainPage->objectName().isEmpty())
|
||||||
|
CMainPage->setObjectName(QString::fromUtf8("CMainPage"));
|
||||||
|
CMainPage->resize(1431, 1008);
|
||||||
|
mMainPageTabs = new QTabWidget(CMainPage);
|
||||||
|
mMainPageTabs->setObjectName(QString::fromUtf8("mMainPageTabs"));
|
||||||
|
mMainPageTabs->setGeometry(QRect(10, 0, 1421, 1011));
|
||||||
|
Modbus = new QWidget();
|
||||||
|
Modbus->setObjectName(QString::fromUtf8("Modbus"));
|
||||||
|
mMainPageTabs->addTab(Modbus, QString());
|
||||||
|
Sondes = new QWidget();
|
||||||
|
Sondes->setObjectName(QString::fromUtf8("Sondes"));
|
||||||
|
mMainPageTabs->addTab(Sondes, QString());
|
||||||
|
|
||||||
|
retranslateUi(CMainPage);
|
||||||
|
|
||||||
|
mMainPageTabs->setCurrentIndex(0);
|
||||||
|
|
||||||
|
|
||||||
|
QMetaObject::connectSlotsByName(CMainPage);
|
||||||
|
} // setupUi
|
||||||
|
|
||||||
|
void retranslateUi(QWidget *CMainPage)
|
||||||
|
{
|
||||||
|
CMainPage->setWindowTitle(QCoreApplication::translate("CMainPage", "Form", nullptr));
|
||||||
|
mMainPageTabs->setTabText(mMainPageTabs->indexOf(Modbus), QCoreApplication::translate("CMainPage", "Tab 1", nullptr));
|
||||||
|
mMainPageTabs->setTabText(mMainPageTabs->indexOf(Sondes), QCoreApplication::translate("CMainPage", "Tab 2", nullptr));
|
||||||
|
} // retranslateUi
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class CMainPage: public Ui_CMainPage {};
|
||||||
|
} // namespace Ui
|
||||||
|
|
||||||
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
|
#endif // UI_MAINPAGE_H
|
||||||
@@ -0,0 +1,94 @@
|
|||||||
|
/********************************************************************************
|
||||||
|
** Form generated from reading UI file 'SEIModbusPage.ui'
|
||||||
|
**
|
||||||
|
** Created by: Qt User Interface Compiler version 5.14.2
|
||||||
|
**
|
||||||
|
** WARNING! All changes made in this file will be lost when recompiling UI file!
|
||||||
|
********************************************************************************/
|
||||||
|
|
||||||
|
#ifndef UI_SEIMODBUSPAGE_H
|
||||||
|
#define UI_SEIMODBUSPAGE_H
|
||||||
|
|
||||||
|
#include <QtCore/QVariant>
|
||||||
|
#include <QtWidgets/QApplication>
|
||||||
|
#include <QtWidgets/QCheckBox>
|
||||||
|
#include <QtWidgets/QHeaderView>
|
||||||
|
#include <QtWidgets/QLabel>
|
||||||
|
#include <QtWidgets/QPushButton>
|
||||||
|
#include <QtWidgets/QTreeWidget>
|
||||||
|
#include <QtWidgets/QWidget>
|
||||||
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
class Ui_CSEIModbusPage
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
QLabel *mSEISimTitleLabel;
|
||||||
|
QLabel *mSEIConnectStatLabel;
|
||||||
|
QPushButton *mStartStopServerBtn;
|
||||||
|
QLabel *mServerLabel;
|
||||||
|
QTreeWidget *mZTAlarmDataTree;
|
||||||
|
QCheckBox *mEnableWDChkBx;
|
||||||
|
QCheckBox *mAN1ChkBx;
|
||||||
|
QCheckBox *mAN2ChkBx;
|
||||||
|
|
||||||
|
void setupUi(QWidget *CSEIModbusPage)
|
||||||
|
{
|
||||||
|
if (CSEIModbusPage->objectName().isEmpty())
|
||||||
|
CSEIModbusPage->setObjectName(QString::fromUtf8("CSEIModbusPage"));
|
||||||
|
CSEIModbusPage->resize(917, 762);
|
||||||
|
mSEISimTitleLabel = new QLabel(CSEIModbusPage);
|
||||||
|
mSEISimTitleLabel->setObjectName(QString::fromUtf8("mSEISimTitleLabel"));
|
||||||
|
mSEISimTitleLabel->setGeometry(QRect(250, 30, 361, 31));
|
||||||
|
mSEISimTitleLabel->setTextFormat(Qt::AutoText);
|
||||||
|
mSEIConnectStatLabel = new QLabel(CSEIModbusPage);
|
||||||
|
mSEIConnectStatLabel->setObjectName(QString::fromUtf8("mSEIConnectStatLabel"));
|
||||||
|
mSEIConnectStatLabel->setGeometry(QRect(650, 100, 271, 41));
|
||||||
|
mStartStopServerBtn = new QPushButton(CSEIModbusPage);
|
||||||
|
mStartStopServerBtn->setObjectName(QString::fromUtf8("mStartStopServerBtn"));
|
||||||
|
mStartStopServerBtn->setGeometry(QRect(750, 30, 101, 23));
|
||||||
|
mServerLabel = new QLabel(CSEIModbusPage);
|
||||||
|
mServerLabel->setObjectName(QString::fromUtf8("mServerLabel"));
|
||||||
|
mServerLabel->setGeometry(QRect(780, 10, 46, 13));
|
||||||
|
mZTAlarmDataTree = new QTreeWidget(CSEIModbusPage);
|
||||||
|
QTreeWidgetItem *__qtreewidgetitem = new QTreeWidgetItem();
|
||||||
|
__qtreewidgetitem->setText(0, QString::fromUtf8("1"));
|
||||||
|
mZTAlarmDataTree->setHeaderItem(__qtreewidgetitem);
|
||||||
|
mZTAlarmDataTree->setObjectName(QString::fromUtf8("mZTAlarmDataTree"));
|
||||||
|
mZTAlarmDataTree->setGeometry(QRect(30, 110, 541, 641));
|
||||||
|
mEnableWDChkBx = new QCheckBox(CSEIModbusPage);
|
||||||
|
mEnableWDChkBx->setObjectName(QString::fromUtf8("mEnableWDChkBx"));
|
||||||
|
mEnableWDChkBx->setGeometry(QRect(660, 180, 70, 17));
|
||||||
|
mAN1ChkBx = new QCheckBox(CSEIModbusPage);
|
||||||
|
mAN1ChkBx->setObjectName(QString::fromUtf8("mAN1ChkBx"));
|
||||||
|
mAN1ChkBx->setGeometry(QRect(660, 210, 70, 17));
|
||||||
|
mAN2ChkBx = new QCheckBox(CSEIModbusPage);
|
||||||
|
mAN2ChkBx->setObjectName(QString::fromUtf8("mAN2ChkBx"));
|
||||||
|
mAN2ChkBx->setGeometry(QRect(660, 240, 70, 17));
|
||||||
|
|
||||||
|
retranslateUi(CSEIModbusPage);
|
||||||
|
|
||||||
|
QMetaObject::connectSlotsByName(CSEIModbusPage);
|
||||||
|
} // setupUi
|
||||||
|
|
||||||
|
void retranslateUi(QWidget *CSEIModbusPage)
|
||||||
|
{
|
||||||
|
CSEIModbusPage->setWindowTitle(QCoreApplication::translate("CSEIModbusPage", "Form", nullptr));
|
||||||
|
mSEISimTitleLabel->setText(QCoreApplication::translate("CSEIModbusPage", "Simulateur SEI", nullptr));
|
||||||
|
mSEIConnectStatLabel->setText(QCoreApplication::translate("CSEIModbusPage", "ZT:NON CONNECT\303\211E", nullptr));
|
||||||
|
mStartStopServerBtn->setText(QCoreApplication::translate("CSEIModbusPage", "D\303\251marrer Serveur", nullptr));
|
||||||
|
mServerLabel->setText(QCoreApplication::translate("CSEIModbusPage", "Serveur", nullptr));
|
||||||
|
mEnableWDChkBx->setText(QCoreApplication::translate("CSEIModbusPage", "Watchdog", nullptr));
|
||||||
|
mAN1ChkBx->setText(QCoreApplication::translate("CSEIModbusPage", "AN1", nullptr));
|
||||||
|
mAN2ChkBx->setText(QCoreApplication::translate("CSEIModbusPage", "AN2", nullptr));
|
||||||
|
} // retranslateUi
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class CSEIModbusPage: public Ui_CSEIModbusPage {};
|
||||||
|
} // namespace Ui
|
||||||
|
|
||||||
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
|
#endif // UI_SEIMODBUSPAGE_H
|
||||||
Reference in New Issue
Block a user