Ver código fonte

First Commit

master
JF 6 anos atrás
commit
894fad0629
40 arquivos alterados com 3079 adições e 0 exclusões
  1. +5
    -0
      .gitignore
  2. +44
    -0
      CableTestBench.pro
  3. +239
    -0
      CableTestBench.pro.user
  4. +149
    -0
      Makefile
  5. +216
    -0
      Makefile.Debug
  6. +216
    -0
      Makefile.Release
  7. +14
    -0
      Sources/CMainPage.cpp
  8. +58
    -0
      Sources/CMainPage.ui
  9. +53
    -0
      Sources/CableTestBench.cpp
  10. +36
    -0
      Sources/CableTestBench.h
  11. +9
    -0
      Sources/GlobalDefine.h
  12. +39
    -0
      Sources/MainPage.cpp
  13. +33
    -0
      Sources/MainPage.h
  14. +27
    -0
      Sources/MainWindow.cpp
  15. +30
    -0
      Sources/MainWindow.h
  16. +706
    -0
      Sources/ModbusBackend.cpp
  17. +113
    -0
      Sources/ModbusMaster.cpp
  18. +211
    -0
      Sources/ModbusRepository.cpp
  19. +44
    -0
      Sources/ModbusSlave.cpp
  20. +221
    -0
      Sources/SeaMaxWin/Dll/SeaMAX Dot Net.XML
  21. BIN
      Sources/SeaMaxWin/Dll/SeaMAX Dot Net.dll
  22. BIN
      Sources/SeaMaxWin/Dll/SeaMAX.dll
  23. BIN
      Sources/SeaMaxWin/Dll/ftd2xx.dll
  24. +284
    -0
      Sources/SeaMaxWin/Include/SeaMAX.h
  25. BIN
      Sources/SeaMaxWin/Lib/SeaMAX.lib
  26. +16
    -0
      Sources/VisualInspectionPage.cpp
  27. +27
    -0
      Sources/VisualInspectionPage.h
  28. +63
    -0
      Sources/VisualInspectionPage.ui
  29. +6
    -0
      Sources/Widgets/CConnectorSelectWidget.cpp
  30. +18
    -0
      Sources/Widgets/CConnectorSelectWidget.h
  31. +19
    -0
      Sources/Widgets/CConnectorSelectWidget.h.autosave
  32. +6
    -0
      Sources/ZTInfo.cpp
  33. +13
    -0
      Sources/main.cpp
  34. BIN
      images/connecteurs.png
  35. BIN
      images/green-led-off-md.png
  36. BIN
      images/green-led-on-md.png
  37. +13
    -0
      object_script.CableTestBench.Debug
  38. +13
    -0
      object_script.CableTestBench.Release
  39. +69
    -0
      ui_CMainPage.h
  40. +69
    -0
      ui_VisualInspectionPage.h

+ 5
- 0
.gitignore Ver arquivo

@@ -0,0 +1,5 @@
debug
release
/OutilModbus.pro.user
/object_script.OutilModbus.Debug
/object_script.OutilModbus.Release

+ 44
- 0
CableTestBench.pro Ver arquivo

@@ -0,0 +1,44 @@
#-------------------------------------------------
#
# Project created by QtCreator 2017-03-01T13:52:35
#
#-------------------------------------------------

QT += core gui network

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = CableTestBench
TEMPLATE = app

INCLUDEPATH += Sources/ \
Sources/SeaMaxWin/Include

SOURCES += \
Sources/MainWindow.cpp \
Sources/main.cpp \
Sources/MainPage.cpp \
Sources/CableTestBench.cpp \
Sources/VisualInspectionPage.cpp \
Sources/Widgets/CConnectorSelectWidget.cpp

HEADERS += \
Sources/MainWindow.h \
Sources/GlobalDefine.h \
Sources/MainPage.h \
Sources/CableTestBench.h \
Sources/VisualInspectionPage.h \
ui_VisualInspectionPage.h \
ui_CMainPage.h \
Sources/Widgets/CConnectorSelectWidget.h

FORMS += \
Sources/CMainPage.ui \
Sources/VisualInspectionPage.ui

win32:CONFIG(release, debug|release): LIBS += -L$$PWD/Sources/SeaMaxWin/Lib/ -lSeaMAX
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/Sources/SeaMaxWin/Lib/ -lSeaMAX

INCLUDEPATH += $$PWD/Sources/SeaMaxWin/Lib

DEPENDPATH += $$PWD/Sources/SeaMaxWin/Lib

+ 239
- 0
CableTestBench.pro.user Ver arquivo

@@ -0,0 +1,239 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by Qt Creator 2.6.2, 2019-03-27T10:31:24. -->
<qtcreator>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>
<value type="int">0</value>
</data>
<data>
<variable>ProjectExplorer.Project.EditorSettings</variable>
<valuemap type="QVariantMap">
<value type="bool" key="EditorConfiguration.AutoIndent">true</value>
<value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
<value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
<value type="QString" key="language">Cpp</value>
<valuemap type="QVariantMap" key="value">
<value type="QString" key="CurrentPreferences">CppGlobal</value>
</valuemap>
</valuemap>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
<value type="QString" key="language">QmlJS</value>
<valuemap type="QVariantMap" key="value">
<value type="QString" key="CurrentPreferences">QmlJSGlobal</value>
</valuemap>
</valuemap>
<value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
<value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
<value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
<value type="int" key="EditorConfiguration.IndentSize">4</value>
<value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
<value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
<value type="int" key="EditorConfiguration.PaddingMode">1</value>
<value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
<value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
<value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
<value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
<value type="int" key="EditorConfiguration.TabSize">8</value>
<value type="bool" key="EditorConfiguration.UseGlobal">true</value>
<value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
<value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
<value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
<value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
<value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.PluginSettings</variable>
<valuemap type="QVariantMap"/>
</data>
<data>
<variable>ProjectExplorer.Project.Target.0</variable>
<valuemap type="QVariantMap">
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Qt 4.8.3</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Qt 4.8.3</value>
<value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">{962e6995-bc73-45ee-a3d6-d72a1ed3b9df}</value>
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">true</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
<value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">C:/ZoneTest/CableTestBench</value>
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">true</value>
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">true</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
<value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">C:/ZoneTest/CableTestBench</value>
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">2</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
<value type="bool" key="Analyzer.Project.UseGlobal">true</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
<value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
<value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
<value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
<value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
<value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
<value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
<value type="int">0</value>
<value type="int">1</value>
<value type="int">2</value>
<value type="int">3</value>
<value type="int">4</value>
<value type="int">5</value>
<value type="int">6</value>
<value type="int">7</value>
<value type="int">8</value>
<value type="int">9</value>
<value type="int">10</value>
<value type="int">11</value>
<value type="int">12</value>
<value type="int">13</value>
<value type="int">14</value>
</valuelist>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">CableTestBench</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QByteArray" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:C:/ZoneTest/CableTestBench/CableTestBench.pro</value>
<value type="int" key="Qt4ProjectManager.Qt4RunConfiguration.BaseEnvironmentBase">2</value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">CableTestBench.pro</value>
<value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
<value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">false</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.Qt4RunConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
<value type="bool" key="RunConfiguration.UseCppDebugger">true</value>
<value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.TargetCount</variable>
<value type="int">1</value>
</data>
<data>
<variable>ProjectExplorer.Project.Updater.EnvironmentId</variable>
<value type="QString">{e7f062a5-06e1-4f66-ab2c-67d14d6f866a}</value>
</data>
<data>
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
<value type="int">12</value>
</data>
</qtcreator>

+ 149
- 0
Makefile Ver arquivo

@@ -0,0 +1,149 @@
#############################################################################
# Makefile for building: CableTestBench
# Generated by qmake (2.01a) (Qt 4.8.1) on: Fri Mar 29 07:33:12 2019
# Project: CableTestBench.pro
# Template: app
# Command: c:\Qt\4.8.1\bin\qmake.exe -spec ..\..\Qt\4.8.1\mkspecs\win32-g++ CONFIG+=declarative_debug -o Makefile CableTestBench.pro
#############################################################################

first: debug
install: debug-install
uninstall: debug-uninstall
MAKEFILE = Makefile
QMAKE = c:\Qt\4.8.1\bin\qmake.exe
DEL_FILE = del
CHK_DIR_EXISTS= if not exist
MKDIR = mkdir
COPY = copy /y
COPY_FILE = $(COPY)
COPY_DIR = xcopy /s /q /y /i
INSTALL_FILE = $(COPY_FILE)
INSTALL_PROGRAM = $(COPY_FILE)
INSTALL_DIR = $(COPY_DIR)
DEL_FILE = del
SYMLINK =
DEL_DIR = rmdir
MOVE = move
CHK_DIR_EXISTS= if not exist
MKDIR = mkdir
SUBTARGETS = \
debug \
release

debug: $(MAKEFILE).Debug FORCE
$(MAKE) -f $(MAKEFILE).Debug
debug-make_default: $(MAKEFILE).Debug FORCE
$(MAKE) -f $(MAKEFILE).Debug
debug-make_first: $(MAKEFILE).Debug FORCE
$(MAKE) -f $(MAKEFILE).Debug first
debug-all: $(MAKEFILE).Debug FORCE
$(MAKE) -f $(MAKEFILE).Debug all
debug-clean: $(MAKEFILE).Debug FORCE
$(MAKE) -f $(MAKEFILE).Debug clean
debug-distclean: $(MAKEFILE).Debug FORCE
$(MAKE) -f $(MAKEFILE).Debug distclean
debug-install: $(MAKEFILE).Debug FORCE
$(MAKE) -f $(MAKEFILE).Debug install
debug-uninstall: $(MAKEFILE).Debug FORCE
$(MAKE) -f $(MAKEFILE).Debug uninstall
release: $(MAKEFILE).Release FORCE
$(MAKE) -f $(MAKEFILE).Release
release-make_default: $(MAKEFILE).Release FORCE
$(MAKE) -f $(MAKEFILE).Release
release-make_first: $(MAKEFILE).Release FORCE
$(MAKE) -f $(MAKEFILE).Release first
release-all: $(MAKEFILE).Release FORCE
$(MAKE) -f $(MAKEFILE).Release all
release-clean: $(MAKEFILE).Release FORCE
$(MAKE) -f $(MAKEFILE).Release clean
release-distclean: $(MAKEFILE).Release FORCE
$(MAKE) -f $(MAKEFILE).Release distclean
release-install: $(MAKEFILE).Release FORCE
$(MAKE) -f $(MAKEFILE).Release install
release-uninstall: $(MAKEFILE).Release FORCE
$(MAKE) -f $(MAKEFILE).Release uninstall

Makefile: CableTestBench.pro ../../Qt/4.8.1/mkspecs/win32-g++/qmake.conf ../../Qt/4.8.1/mkspecs/qconfig.pri \
../../Qt/4.8.1/mkspecs/modules/qt_webkit_version.pri \
../../Qt/4.8.1/mkspecs/features/qt_functions.prf \
../../Qt/4.8.1/mkspecs/features/qt_config.prf \
../../Qt/4.8.1/mkspecs/features/exclusive_builds.prf \
../../Qt/4.8.1/mkspecs/features/default_pre.prf \
../../Qt/4.8.1/mkspecs/features/win32/default_pre.prf \
../../Qt/4.8.1/mkspecs/features/debug.prf \
../../Qt/4.8.1/mkspecs/features/debug_and_release.prf \
../../Qt/4.8.1/mkspecs/features/default_post.prf \
../../Qt/4.8.1/mkspecs/features/win32/default_post.prf \
../../Qt/4.8.1/mkspecs/features/declarative_debug.prf \
../../Qt/4.8.1/mkspecs/features/win32/rtti.prf \
../../Qt/4.8.1/mkspecs/features/win32/exceptions.prf \
../../Qt/4.8.1/mkspecs/features/win32/stl.prf \
../../Qt/4.8.1/mkspecs/features/shared.prf \
../../Qt/4.8.1/mkspecs/features/warn_on.prf \
../../Qt/4.8.1/mkspecs/features/qt.prf \
../../Qt/4.8.1/mkspecs/features/win32/thread.prf \
../../Qt/4.8.1/mkspecs/features/moc.prf \
../../Qt/4.8.1/mkspecs/features/win32/windows.prf \
../../Qt/4.8.1/mkspecs/features/resources.prf \
../../Qt/4.8.1/mkspecs/features/uic.prf \
../../Qt/4.8.1/mkspecs/features/yacc.prf \
../../Qt/4.8.1/mkspecs/features/lex.prf \
../../Qt/4.8.1/mkspecs/features/include_source_dir.prf \
c:/Qt/4.8.1/lib/qtmaind.prl
$(QMAKE) -spec ..\..\Qt\4.8.1\mkspecs\win32-g++ CONFIG+=declarative_debug -o Makefile CableTestBench.pro
..\..\Qt\4.8.1\mkspecs\qconfig.pri:
..\..\Qt\4.8.1\mkspecs\modules\qt_webkit_version.pri:
..\..\Qt\4.8.1\mkspecs\features\qt_functions.prf:
..\..\Qt\4.8.1\mkspecs\features\qt_config.prf:
..\..\Qt\4.8.1\mkspecs\features\exclusive_builds.prf:
..\..\Qt\4.8.1\mkspecs\features\default_pre.prf:
..\..\Qt\4.8.1\mkspecs\features\win32\default_pre.prf:
..\..\Qt\4.8.1\mkspecs\features\debug.prf:
..\..\Qt\4.8.1\mkspecs\features\debug_and_release.prf:
..\..\Qt\4.8.1\mkspecs\features\default_post.prf:
..\..\Qt\4.8.1\mkspecs\features\win32\default_post.prf:
..\..\Qt\4.8.1\mkspecs\features\declarative_debug.prf:
..\..\Qt\4.8.1\mkspecs\features\win32\rtti.prf:
..\..\Qt\4.8.1\mkspecs\features\win32\exceptions.prf:
..\..\Qt\4.8.1\mkspecs\features\win32\stl.prf:
..\..\Qt\4.8.1\mkspecs\features\shared.prf:
..\..\Qt\4.8.1\mkspecs\features\warn_on.prf:
..\..\Qt\4.8.1\mkspecs\features\qt.prf:
..\..\Qt\4.8.1\mkspecs\features\win32\thread.prf:
..\..\Qt\4.8.1\mkspecs\features\moc.prf:
..\..\Qt\4.8.1\mkspecs\features\win32\windows.prf:
..\..\Qt\4.8.1\mkspecs\features\resources.prf:
..\..\Qt\4.8.1\mkspecs\features\uic.prf:
..\..\Qt\4.8.1\mkspecs\features\yacc.prf:
..\..\Qt\4.8.1\mkspecs\features\lex.prf:
..\..\Qt\4.8.1\mkspecs\features\include_source_dir.prf:
c:\Qt\4.8.1\lib\qtmaind.prl:
qmake: qmake_all FORCE
@$(QMAKE) -spec ..\..\Qt\4.8.1\mkspecs\win32-g++ CONFIG+=declarative_debug -o Makefile CableTestBench.pro

qmake_all: FORCE

make_default: debug-make_default release-make_default 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

check: first

debug-mocclean: $(MAKEFILE).Debug
$(MAKE) -f $(MAKEFILE).Debug mocclean
release-mocclean: $(MAKEFILE).Release
$(MAKE) -f $(MAKEFILE).Release mocclean
mocclean: debug-mocclean release-mocclean

debug-mocables: $(MAKEFILE).Debug
$(MAKE) -f $(MAKEFILE).Debug mocables
release-mocables: $(MAKEFILE).Release
$(MAKE) -f $(MAKEFILE).Release mocables
mocables: debug-mocables release-mocables
FORCE:

$(MAKEFILE).Debug: Makefile
$(MAKEFILE).Release: Makefile

+ 216
- 0
Makefile.Debug Ver arquivo

@@ -0,0 +1,216 @@
#############################################################################
# Makefile for building: CableTestBench
# Generated by qmake (2.01a) (Qt 4.8.1) on: Fri Mar 29 07:33:12 2019
# Project: CableTestBench.pro
# Template: app
#############################################################################

####### Compiler, tools and options

CC = gcc
CXX = g++
DEFINES = -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN
CFLAGS = -g -Wall $(DEFINES)
CXXFLAGS = -g -frtti -fexceptions -mthreads -Wall $(DEFINES)
INCPATH = -I"..\..\Qt\4.8.1\include\QtCore" -I"..\..\Qt\4.8.1\include\QtNetwork" -I"..\..\Qt\4.8.1\include\QtGui" -I"..\..\Qt\4.8.1\include" -I"Sources" -I"Sources\SeaMaxWin\Include" -I"Sources\SeaMaxWin\Lib" -I"..\..\Qt\4.8.1\include\ActiveQt" -I"debug" -I"." -I"..\..\Qt\4.8.1\mkspecs\win32-g++"
LINK = g++
LFLAGS = -mthreads -Wl,-subsystem,windows
LIBS = -L"c:\Qt\4.8.1\lib" -lmingw32 -lqtmaind -LC:/ZoneTest/CableTestBench/Sources/SeaMaxWin/Lib/ -lSeaMAX -lQtGuid4 -lQtNetworkd4 -lQtCored4
QMAKE = c:\Qt\4.8.1\bin\qmake.exe
IDC = c:\Qt\4.8.1\bin\idc.exe
IDL = midl
ZIP = zip -r -9
DEF_FILE =
RES_FILE =
COPY = copy /y
SED =
COPY_FILE = $(COPY)
COPY_DIR = xcopy /s /q /y /i
DEL_FILE = del
DEL_DIR = rmdir
MOVE = move
CHK_DIR_EXISTS= if not exist
MKDIR = mkdir
INSTALL_FILE = $(COPY_FILE)
INSTALL_PROGRAM = $(COPY_FILE)
INSTALL_DIR = $(COPY_DIR)

####### Output directory

OBJECTS_DIR = debug

####### Files

SOURCES = Sources\MainWindow.cpp \
Sources\main.cpp \
Sources\MainPage.cpp \
Sources\CableTestBench.cpp \
Sources\VisualInspectionPage.cpp \
Sources\Widgets\CConnectorSelectWidget.cpp debug\moc_MainWindow.cpp \
debug\moc_MainPage.cpp \
debug\moc_CableTestBench.cpp \
debug\moc_VisualInspectionPage.cpp \
debug\moc_CConnectorSelectWidget.cpp
OBJECTS = debug/MainWindow.o \
debug/main.o \
debug/MainPage.o \
debug/CableTestBench.o \
debug/VisualInspectionPage.o \
debug/CConnectorSelectWidget.o \
debug/moc_MainWindow.o \
debug/moc_MainPage.o \
debug/moc_CableTestBench.o \
debug/moc_VisualInspectionPage.o \
debug/moc_CConnectorSelectWidget.o
DIST =
QMAKE_TARGET = CableTestBench
DESTDIR = debug\ #avoid trailing-slash linebreak
TARGET = CableTestBench.exe
DESTDIR_TARGET = debug\CableTestBench.exe

####### Implicit rules

.SUFFIXES: .cpp .cc .cxx .c

.cpp.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<

.cc.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<

.cxx.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<

.c.o:
$(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<

####### Build rules

first: all
all: Makefile.Debug $(DESTDIR_TARGET)

$(DESTDIR_TARGET): ui_CMainPage.h ui_VisualInspectionPage.h $(OBJECTS)
$(LINK) $(LFLAGS) -o $(DESTDIR_TARGET) object_script.CableTestBench.Debug $(LIBS)

qmake: FORCE
@$(QMAKE) -spec ..\..\Qt\4.8.1\mkspecs\win32-g++ CONFIG+=declarative_debug -o Makefile.Debug CableTestBench.pro

dist:
$(ZIP) CableTestBench.zip $(SOURCES) $(DIST) CableTestBench.pro ..\..\Qt\4.8.1\mkspecs\qconfig.pri ..\..\Qt\4.8.1\mkspecs\modules\qt_webkit_version.pri ..\..\Qt\4.8.1\mkspecs\features\qt_functions.prf ..\..\Qt\4.8.1\mkspecs\features\qt_config.prf ..\..\Qt\4.8.1\mkspecs\features\exclusive_builds.prf ..\..\Qt\4.8.1\mkspecs\features\default_pre.prf ..\..\Qt\4.8.1\mkspecs\features\win32\default_pre.prf ..\..\Qt\4.8.1\mkspecs\features\debug.prf ..\..\Qt\4.8.1\mkspecs\features\debug_and_release.prf ..\..\Qt\4.8.1\mkspecs\features\default_post.prf ..\..\Qt\4.8.1\mkspecs\features\win32\default_post.prf ..\..\Qt\4.8.1\mkspecs\features\build_pass.prf ..\..\Qt\4.8.1\mkspecs\features\declarative_debug.prf ..\..\Qt\4.8.1\mkspecs\features\win32\rtti.prf ..\..\Qt\4.8.1\mkspecs\features\win32\exceptions.prf ..\..\Qt\4.8.1\mkspecs\features\win32\stl.prf ..\..\Qt\4.8.1\mkspecs\features\shared.prf ..\..\Qt\4.8.1\mkspecs\features\warn_on.prf ..\..\Qt\4.8.1\mkspecs\features\qt.prf ..\..\Qt\4.8.1\mkspecs\features\win32\thread.prf ..\..\Qt\4.8.1\mkspecs\features\moc.prf ..\..\Qt\4.8.1\mkspecs\features\win32\windows.prf ..\..\Qt\4.8.1\mkspecs\features\resources.prf ..\..\Qt\4.8.1\mkspecs\features\uic.prf ..\..\Qt\4.8.1\mkspecs\features\yacc.prf ..\..\Qt\4.8.1\mkspecs\features\lex.prf ..\..\Qt\4.8.1\mkspecs\features\include_source_dir.prf c:\Qt\4.8.1\lib\qtmaind.prl HEADERS RESOURCES IMAGES SOURCES OBJECTIVE_SOURCES FORMS YACCSOURCES YACCSOURCES LEXSOURCES

clean: compiler_clean
-$(DEL_FILE) debug\MainWindow.o debug\main.o debug\MainPage.o debug\CableTestBench.o debug\VisualInspectionPage.o debug\CConnectorSelectWidget.o debug\moc_MainWindow.o debug\moc_MainPage.o debug\moc_CableTestBench.o debug\moc_VisualInspectionPage.o debug\moc_CConnectorSelectWidget.o

distclean: clean
-$(DEL_FILE) $(DESTDIR_TARGET)
-$(DEL_FILE) Makefile.Debug

check: first

mocclean: compiler_moc_header_clean compiler_moc_source_clean

mocables: compiler_moc_header_make_all compiler_moc_source_make_all

compiler_moc_header_make_all: debug/moc_MainWindow.cpp debug/moc_MainPage.cpp debug/moc_CableTestBench.cpp debug/moc_VisualInspectionPage.cpp debug/moc_CConnectorSelectWidget.cpp
compiler_moc_header_clean:
-$(DEL_FILE) debug\moc_MainWindow.cpp debug\moc_MainPage.cpp debug\moc_CableTestBench.cpp debug\moc_VisualInspectionPage.cpp debug\moc_CConnectorSelectWidget.cpp
debug/moc_MainWindow.cpp: Sources/MainPage.h \
Sources/VisualInspectionPage.h \
Sources/MainWindow.h
C:\Qt\4.8.1\bin\moc.exe $(DEFINES) $(INCPATH) -D__GNUC__ -DWIN32 Sources\MainWindow.h -o debug\moc_MainWindow.cpp

debug/moc_MainPage.cpp: Sources/MainPage.h
C:\Qt\4.8.1\bin\moc.exe $(DEFINES) $(INCPATH) -D__GNUC__ -DWIN32 Sources\MainPage.h -o debug\moc_MainPage.cpp

debug/moc_CableTestBench.cpp: Sources/MainWindow.h \
Sources/MainPage.h \
Sources/VisualInspectionPage.h \
Sources/CableTestBench.h
C:\Qt\4.8.1\bin\moc.exe $(DEFINES) $(INCPATH) -D__GNUC__ -DWIN32 Sources\CableTestBench.h -o debug\moc_CableTestBench.cpp

debug/moc_VisualInspectionPage.cpp: Sources/VisualInspectionPage.h
C:\Qt\4.8.1\bin\moc.exe $(DEFINES) $(INCPATH) -D__GNUC__ -DWIN32 Sources\VisualInspectionPage.h -o debug\moc_VisualInspectionPage.cpp

debug/moc_CConnectorSelectWidget.cpp: Sources/Widgets/CConnectorSelectWidget.h
C:\Qt\4.8.1\bin\moc.exe $(DEFINES) $(INCPATH) -D__GNUC__ -DWIN32 Sources\Widgets\CConnectorSelectWidget.h -o debug\moc_CConnectorSelectWidget.cpp

compiler_rcc_make_all:
compiler_rcc_clean:
compiler_image_collection_make_all: qmake_image_collection.cpp
compiler_image_collection_clean:
-$(DEL_FILE) qmake_image_collection.cpp
compiler_moc_source_make_all:
compiler_moc_source_clean:
compiler_uic_make_all: ui_CMainPage.h ui_VisualInspectionPage.h
compiler_uic_clean:
-$(DEL_FILE) ui_CMainPage.h ui_VisualInspectionPage.h
ui_CMainPage.h: Sources/CMainPage.ui
c:\Qt\4.8.1\bin\uic.exe Sources\CMainPage.ui -o ui_CMainPage.h

ui_VisualInspectionPage.h: Sources/VisualInspectionPage.ui
c:\Qt\4.8.1\bin\uic.exe Sources\VisualInspectionPage.ui -o ui_VisualInspectionPage.h

compiler_yacc_decl_make_all:
compiler_yacc_decl_clean:
compiler_yacc_impl_make_all:
compiler_yacc_impl_clean:
compiler_lex_make_all:
compiler_lex_clean:
compiler_clean: compiler_moc_header_clean compiler_uic_clean



####### Compile

debug/MainWindow.o: Sources/MainWindow.cpp Sources/MainWindow.h \
Sources/MainPage.h \
Sources/VisualInspectionPage.h \
Sources/CableTestBench.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o debug\MainWindow.o Sources\MainWindow.cpp

debug/main.o: Sources/main.cpp Sources/CableTestBench.h \
Sources/MainWindow.h \
Sources/MainPage.h \
Sources/VisualInspectionPage.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o debug\main.o Sources\main.cpp

debug/MainPage.o: Sources/MainPage.cpp Sources/MainPage.h \
ui_CMainPage.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o debug\MainPage.o Sources\MainPage.cpp

debug/CableTestBench.o: Sources/CableTestBench.cpp Sources/CableTestBench.h \
Sources/MainWindow.h \
Sources/MainPage.h \
Sources/VisualInspectionPage.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o debug\CableTestBench.o Sources\CableTestBench.cpp

debug/VisualInspectionPage.o: Sources/VisualInspectionPage.cpp Sources/VisualInspectionPage.h \
ui_VisualInspectionPage.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o debug\VisualInspectionPage.o Sources\VisualInspectionPage.cpp

debug/CConnectorSelectWidget.o: Sources/Widgets/CConnectorSelectWidget.cpp Sources/Widgets/CConnectorSelectWidget.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o debug\CConnectorSelectWidget.o Sources\Widgets\CConnectorSelectWidget.cpp

debug/moc_MainWindow.o: debug/moc_MainWindow.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o debug\moc_MainWindow.o debug\moc_MainWindow.cpp

debug/moc_MainPage.o: debug/moc_MainPage.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o debug\moc_MainPage.o debug\moc_MainPage.cpp

debug/moc_CableTestBench.o: debug/moc_CableTestBench.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o debug\moc_CableTestBench.o debug\moc_CableTestBench.cpp

debug/moc_VisualInspectionPage.o: debug/moc_VisualInspectionPage.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o debug\moc_VisualInspectionPage.o debug\moc_VisualInspectionPage.cpp

debug/moc_CConnectorSelectWidget.o: debug/moc_CConnectorSelectWidget.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o debug\moc_CConnectorSelectWidget.o debug\moc_CConnectorSelectWidget.cpp

####### Install

install: FORCE

uninstall: FORCE

FORCE:


+ 216
- 0
Makefile.Release Ver arquivo

@@ -0,0 +1,216 @@
#############################################################################
# Makefile for building: CableTestBench
# Generated by qmake (2.01a) (Qt 4.8.1) on: Fri Mar 29 07:33:12 2019
# Project: CableTestBench.pro
# Template: app
#############################################################################

####### Compiler, tools and options

CC = gcc
CXX = g++
DEFINES = -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN
CFLAGS = -O2 -Wall $(DEFINES)
CXXFLAGS = -O2 -frtti -fexceptions -mthreads -Wall $(DEFINES)
INCPATH = -I"..\..\Qt\4.8.1\include\QtCore" -I"..\..\Qt\4.8.1\include\QtNetwork" -I"..\..\Qt\4.8.1\include\QtGui" -I"..\..\Qt\4.8.1\include" -I"Sources" -I"Sources\SeaMaxWin\Include" -I"Sources\SeaMaxWin\Lib" -I"..\..\Qt\4.8.1\include\ActiveQt" -I"release" -I"." -I"..\..\Qt\4.8.1\mkspecs\win32-g++"
LINK = g++
LFLAGS = -Wl,-s -mthreads -Wl,-subsystem,windows
LIBS = -L"c:\Qt\4.8.1\lib" -lmingw32 -lqtmain -LC:/ZoneTest/CableTestBench/Sources/SeaMaxWin/Lib/ -lSeaMAX -lQtGui4 -lQtNetwork4 -lQtCore4
QMAKE = c:\Qt\4.8.1\bin\qmake.exe
IDC = c:\Qt\4.8.1\bin\idc.exe
IDL = midl
ZIP = zip -r -9
DEF_FILE =
RES_FILE =
COPY = copy /y
SED =
COPY_FILE = $(COPY)
COPY_DIR = xcopy /s /q /y /i
DEL_FILE = del
DEL_DIR = rmdir
MOVE = move
CHK_DIR_EXISTS= if not exist
MKDIR = mkdir
INSTALL_FILE = $(COPY_FILE)
INSTALL_PROGRAM = $(COPY_FILE)
INSTALL_DIR = $(COPY_DIR)

####### Output directory

OBJECTS_DIR = release

####### Files

SOURCES = Sources\MainWindow.cpp \
Sources\main.cpp \
Sources\MainPage.cpp \
Sources\CableTestBench.cpp \
Sources\VisualInspectionPage.cpp \
Sources\Widgets\CConnectorSelectWidget.cpp release\moc_MainWindow.cpp \
release\moc_MainPage.cpp \
release\moc_CableTestBench.cpp \
release\moc_VisualInspectionPage.cpp \
release\moc_CConnectorSelectWidget.cpp
OBJECTS = release/MainWindow.o \
release/main.o \
release/MainPage.o \
release/CableTestBench.o \
release/VisualInspectionPage.o \
release/CConnectorSelectWidget.o \
release/moc_MainWindow.o \
release/moc_MainPage.o \
release/moc_CableTestBench.o \
release/moc_VisualInspectionPage.o \
release/moc_CConnectorSelectWidget.o
DIST =
QMAKE_TARGET = CableTestBench
DESTDIR = release\ #avoid trailing-slash linebreak
TARGET = CableTestBench.exe
DESTDIR_TARGET = release\CableTestBench.exe

####### Implicit rules

.SUFFIXES: .cpp .cc .cxx .c

.cpp.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<

.cc.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<

.cxx.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<

.c.o:
$(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<

####### Build rules

first: all
all: Makefile.Release $(DESTDIR_TARGET)

$(DESTDIR_TARGET): ui_CMainPage.h ui_VisualInspectionPage.h $(OBJECTS)
$(LINK) $(LFLAGS) -o $(DESTDIR_TARGET) object_script.CableTestBench.Release $(LIBS)

qmake: FORCE
@$(QMAKE) -spec ..\..\Qt\4.8.1\mkspecs\win32-g++ CONFIG+=declarative_debug -o Makefile.Release CableTestBench.pro

dist:
$(ZIP) CableTestBench.zip $(SOURCES) $(DIST) CableTestBench.pro ..\..\Qt\4.8.1\mkspecs\qconfig.pri ..\..\Qt\4.8.1\mkspecs\modules\qt_webkit_version.pri ..\..\Qt\4.8.1\mkspecs\features\qt_functions.prf ..\..\Qt\4.8.1\mkspecs\features\qt_config.prf ..\..\Qt\4.8.1\mkspecs\features\exclusive_builds.prf ..\..\Qt\4.8.1\mkspecs\features\default_pre.prf ..\..\Qt\4.8.1\mkspecs\features\win32\default_pre.prf ..\..\Qt\4.8.1\mkspecs\features\release.prf ..\..\Qt\4.8.1\mkspecs\features\debug_and_release.prf ..\..\Qt\4.8.1\mkspecs\features\default_post.prf ..\..\Qt\4.8.1\mkspecs\features\win32\default_post.prf ..\..\Qt\4.8.1\mkspecs\features\build_pass.prf ..\..\Qt\4.8.1\mkspecs\features\declarative_debug.prf ..\..\Qt\4.8.1\mkspecs\features\win32\rtti.prf ..\..\Qt\4.8.1\mkspecs\features\win32\exceptions.prf ..\..\Qt\4.8.1\mkspecs\features\win32\stl.prf ..\..\Qt\4.8.1\mkspecs\features\shared.prf ..\..\Qt\4.8.1\mkspecs\features\warn_on.prf ..\..\Qt\4.8.1\mkspecs\features\qt.prf ..\..\Qt\4.8.1\mkspecs\features\win32\thread.prf ..\..\Qt\4.8.1\mkspecs\features\moc.prf ..\..\Qt\4.8.1\mkspecs\features\win32\windows.prf ..\..\Qt\4.8.1\mkspecs\features\resources.prf ..\..\Qt\4.8.1\mkspecs\features\uic.prf ..\..\Qt\4.8.1\mkspecs\features\yacc.prf ..\..\Qt\4.8.1\mkspecs\features\lex.prf ..\..\Qt\4.8.1\mkspecs\features\include_source_dir.prf c:\Qt\4.8.1\lib\qtmain.prl HEADERS RESOURCES IMAGES SOURCES OBJECTIVE_SOURCES FORMS YACCSOURCES YACCSOURCES LEXSOURCES

clean: compiler_clean
-$(DEL_FILE) release\MainWindow.o release\main.o release\MainPage.o release\CableTestBench.o release\VisualInspectionPage.o release\CConnectorSelectWidget.o release\moc_MainWindow.o release\moc_MainPage.o release\moc_CableTestBench.o release\moc_VisualInspectionPage.o release\moc_CConnectorSelectWidget.o

distclean: clean
-$(DEL_FILE) $(DESTDIR_TARGET)
-$(DEL_FILE) Makefile.Release

check: first

mocclean: compiler_moc_header_clean compiler_moc_source_clean

mocables: compiler_moc_header_make_all compiler_moc_source_make_all

compiler_moc_header_make_all: release/moc_MainWindow.cpp release/moc_MainPage.cpp release/moc_CableTestBench.cpp release/moc_VisualInspectionPage.cpp release/moc_CConnectorSelectWidget.cpp
compiler_moc_header_clean:
-$(DEL_FILE) release\moc_MainWindow.cpp release\moc_MainPage.cpp release\moc_CableTestBench.cpp release\moc_VisualInspectionPage.cpp release\moc_CConnectorSelectWidget.cpp
release/moc_MainWindow.cpp: Sources/MainPage.h \
Sources/VisualInspectionPage.h \
Sources/MainWindow.h
C:\Qt\4.8.1\bin\moc.exe $(DEFINES) $(INCPATH) -D__GNUC__ -DWIN32 Sources\MainWindow.h -o release\moc_MainWindow.cpp

release/moc_MainPage.cpp: Sources/MainPage.h
C:\Qt\4.8.1\bin\moc.exe $(DEFINES) $(INCPATH) -D__GNUC__ -DWIN32 Sources\MainPage.h -o release\moc_MainPage.cpp

release/moc_CableTestBench.cpp: Sources/MainWindow.h \
Sources/MainPage.h \
Sources/VisualInspectionPage.h \
Sources/CableTestBench.h
C:\Qt\4.8.1\bin\moc.exe $(DEFINES) $(INCPATH) -D__GNUC__ -DWIN32 Sources\CableTestBench.h -o release\moc_CableTestBench.cpp

release/moc_VisualInspectionPage.cpp: Sources/VisualInspectionPage.h
C:\Qt\4.8.1\bin\moc.exe $(DEFINES) $(INCPATH) -D__GNUC__ -DWIN32 Sources\VisualInspectionPage.h -o release\moc_VisualInspectionPage.cpp

release/moc_CConnectorSelectWidget.cpp: Sources/Widgets/CConnectorSelectWidget.h
C:\Qt\4.8.1\bin\moc.exe $(DEFINES) $(INCPATH) -D__GNUC__ -DWIN32 Sources\Widgets\CConnectorSelectWidget.h -o release\moc_CConnectorSelectWidget.cpp

compiler_rcc_make_all:
compiler_rcc_clean:
compiler_image_collection_make_all: qmake_image_collection.cpp
compiler_image_collection_clean:
-$(DEL_FILE) qmake_image_collection.cpp
compiler_moc_source_make_all:
compiler_moc_source_clean:
compiler_uic_make_all: ui_CMainPage.h ui_VisualInspectionPage.h
compiler_uic_clean:
-$(DEL_FILE) ui_CMainPage.h ui_VisualInspectionPage.h
ui_CMainPage.h: Sources/CMainPage.ui
c:\Qt\4.8.1\bin\uic.exe Sources\CMainPage.ui -o ui_CMainPage.h

ui_VisualInspectionPage.h: Sources/VisualInspectionPage.ui
c:\Qt\4.8.1\bin\uic.exe Sources\VisualInspectionPage.ui -o ui_VisualInspectionPage.h

compiler_yacc_decl_make_all:
compiler_yacc_decl_clean:
compiler_yacc_impl_make_all:
compiler_yacc_impl_clean:
compiler_lex_make_all:
compiler_lex_clean:
compiler_clean: compiler_moc_header_clean compiler_uic_clean



####### Compile

release/MainWindow.o: Sources/MainWindow.cpp Sources/MainWindow.h \
Sources/MainPage.h \
Sources/VisualInspectionPage.h \
Sources/CableTestBench.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o release\MainWindow.o Sources\MainWindow.cpp

release/main.o: Sources/main.cpp Sources/CableTestBench.h \
Sources/MainWindow.h \
Sources/MainPage.h \
Sources/VisualInspectionPage.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o release\main.o Sources\main.cpp

release/MainPage.o: Sources/MainPage.cpp Sources/MainPage.h \
ui_CMainPage.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o release\MainPage.o Sources\MainPage.cpp

release/CableTestBench.o: Sources/CableTestBench.cpp Sources/CableTestBench.h \
Sources/MainWindow.h \
Sources/MainPage.h \
Sources/VisualInspectionPage.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o release\CableTestBench.o Sources\CableTestBench.cpp

release/VisualInspectionPage.o: Sources/VisualInspectionPage.cpp Sources/VisualInspectionPage.h \
ui_VisualInspectionPage.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o release\VisualInspectionPage.o Sources\VisualInspectionPage.cpp

release/CConnectorSelectWidget.o: Sources/Widgets/CConnectorSelectWidget.cpp Sources/Widgets/CConnectorSelectWidget.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o release\CConnectorSelectWidget.o Sources\Widgets\CConnectorSelectWidget.cpp

release/moc_MainWindow.o: release/moc_MainWindow.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o release\moc_MainWindow.o release\moc_MainWindow.cpp

release/moc_MainPage.o: release/moc_MainPage.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o release\moc_MainPage.o release\moc_MainPage.cpp

release/moc_CableTestBench.o: release/moc_CableTestBench.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o release\moc_CableTestBench.o release\moc_CableTestBench.cpp

release/moc_VisualInspectionPage.o: release/moc_VisualInspectionPage.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o release\moc_VisualInspectionPage.o release\moc_VisualInspectionPage.cpp

release/moc_CConnectorSelectWidget.o: release/moc_CConnectorSelectWidget.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o release\moc_CConnectorSelectWidget.o release\moc_CConnectorSelectWidget.cpp

####### Install

install: FORCE

uninstall: FORCE

FORCE:


+ 14
- 0
Sources/CMainPage.cpp Ver arquivo

@@ -0,0 +1,14 @@
#include "CMainPage.h"
#include "ui_CMainPage.h"

CMainPage::CMainPage(QWidget *parent) :
QWidget(parent),
ui(new Ui::CMainPage)
{
ui->setupUi(this);
}

//CMainPage::~CMainPage()
//{
// delete ui;
//}

+ 58
- 0
Sources/CMainPage.ui Ver arquivo

@@ -0,0 +1,58 @@
<?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>1124</width>
<height>693</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<widget class="QPushButton" name="mInspVisuelleBtn">
<property name="geometry">
<rect>
<x>40</x>
<y>210</y>
<width>111</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Inspection Visuelle</string>
</property>
</widget>
<widget class="Line" name="line">
<property name="geometry">
<rect>
<x>550</x>
<y>30</y>
<width>20</width>
<height>641</height>
</rect>
</property>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
<widget class="QLabel" name="mConnectorsImgLbl">
<property name="geometry">
<rect>
<x>580</x>
<y>30</y>
<width>491</width>
<height>431</height>
</rect>
</property>
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</widget>
<resources/>
<connections/>
</ui>

+ 53
- 0
Sources/CableTestBench.cpp Ver arquivo

@@ -0,0 +1,53 @@
#include "CableTestBench.h"
#include <QDateTime>

CCableTestBench::CCableTestBench(QObject *parent) :
QObject(parent)
{
w = new MainWindow(0,this);
}

CCableTestBench::~CCableTestBench()
{
delete w;
}

int CCableTestBench::Start()
{
w->resize(1024,768);
w->show();

mMainPageHandle = w->mMainPage;
mVisualInspPageHandle = w->mVisualInspPage;

return 1;
}


quint8 CCableTestBench::DecToBCDByte(const quint8 byte)
{
quint8 out = 0;

out = ((byte/10) << 4) + (byte%10);


return out;

}

quint16 CCableTestBench::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;

}

+ 36
- 0
Sources/CableTestBench.h Ver arquivo

@@ -0,0 +1,36 @@
#ifndef OUTILMODBUS_H
#define OUTILMODBUS_H

#include <QObject>
#include "MainWindow.h"


class CMainPage;
class CVisualInspectionPage;

class CCableTestBench : public QObject
{
Q_OBJECT
public:
explicit CCableTestBench(QObject *parent = 0);
~CCableTestBench();
int Start();


MainWindow *w;
CMainPage *mMainPageHandle;
CVisualInspectionPage *mVisualInspPageHandle;


private:

quint16 DecToBCDWord(const quint16 word);
quint8 DecToBCDByte(const quint8 byte);
signals:
public slots:

};

#endif // OUTILMODBUS_H

+ 9
- 0
Sources/GlobalDefine.h Ver arquivo

@@ -0,0 +1,9 @@
#ifndef GLOBALDEFINE_H
#define GLOBALDEFINE_H


#define RET_OK 1
#define RET_ERROR 0


#endif // GLOBALDEFINE_H

+ 39
- 0
Sources/MainPage.cpp Ver arquivo

@@ -0,0 +1,39 @@
#include "MainPage.h"
#include "ui_CMainPage.h"

#include "SeaMAX.h"

CMainPage::CMainPage(QWidget *parent) :
QWidget(parent),
ui(new Ui::CMainPage)
{
mProgramHandle = 0;
ui->setupUi(this);
QFont font;
font.setPointSize(18);

ui->mConnectorsImgLbl->setPixmap(QPixmap("./images/connecteurs.png").scaled(ui->mConnectorsImgLbl->size()));

// test = new QLabel(this);
// test->setObjectName("test");
// test->setGeometry(QRect(580, 500, 491, 431));
// test->setPixmap(QPixmap("./images/connecteurs.png"));
// test->show();

connect(ui->mInspVisuelleBtn,SIGNAL(clicked()),this,SLOT(InspVisuelleBtnClicked()));

SM_HANDLE hndl;
SM_Open(&hndl,"192.168.0.101");


}

CMainPage::~CMainPage()
{
delete ui;
}

void CMainPage::InspVisuelleBtnClicked()
{
qDebug("clicked");
}

+ 33
- 0
Sources/MainPage.h Ver arquivo

@@ -0,0 +1,33 @@
#ifndef CMAINPAGE_H
#define CMAINPAGE_H
#include <QPixmap>

#include <QWidget>
#include <QLabel>

class CCableTestBench;

namespace Ui {
class CMainPage;
}

class CMainPage : public QWidget
{
Q_OBJECT
public:
explicit CMainPage(QWidget *parent = 0);
~CMainPage();
CCableTestBench *mProgramHandle;
QPixmap mLedONPixmap, mLedOFFPixmap;
QLabel *test;
private:
Ui::CMainPage *ui;

public slots:

void InspVisuelleBtnClicked();
};

#endif // CMAINPAGE_H

+ 27
- 0
Sources/MainWindow.cpp Ver arquivo

@@ -0,0 +1,27 @@
#include "MainWindow.h"
#include <QWidget>
#include "CableTestBench.h"

MainWindow::MainWindow(QWidget *parent,CCableTestBench* ProgramHandle)
: QMainWindow(parent),
mProgramHandle(ProgramHandle)
{
resize(1024,768);

mMainPage = new CMainPage(this);
mVisualInspPage = new CVisualInspectionPage();

mMainPage->mProgramHandle = ProgramHandle;
mVisualInspPage->mProgramHandle = ProgramHandle;

//setCentralWidget(mVisualInspPage);



}

MainWindow::~MainWindow()
{
delete mMainPage;
delete mVisualInspPage;
}

+ 30
- 0
Sources/MainWindow.h Ver arquivo

@@ -0,0 +1,30 @@
#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QPushButton>
#include <QGridLayout>
#include <QLabel>
#include <QTextEdit>
#include "MainPage.h"
#include "VisualInspectionPage.h"

class CCableTestBench;

class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow(QWidget *parent = 0,CCableTestBench* ProgramHandle = 0);
~MainWindow();

CMainPage *mMainPage;
CCableTestBench *mProgramHandle;
CVisualInspectionPage *mVisualInspPage;

public slots:

};

#endif // MAINWINDOW_H

+ 706
- 0
Sources/ModbusBackend.cpp Ver arquivo

@@ -0,0 +1,706 @@
#include "ModbusBackend.h"
#include "QBuffer"


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!");
}

+ 113
- 0
Sources/ModbusMaster.cpp Ver arquivo

@@ -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);
}

+ 211
- 0
Sources/ModbusRepository.cpp Ver arquivo

@@ -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;
}

+ 44
- 0
Sources/ModbusSlave.cpp Ver arquivo

@@ -0,0 +1,44 @@
#include "ModbusSlave.h"


CModbusSlave::CModbusSlave(CModbusRepository *Repo) :
CModbusBackend(Repo)
{
mModbusServer = new QTcpServer();
connect(mModbusServer,SIGNAL(newConnection()),this,SLOT(NewModbusConnection()));
mModbusMode = MODBUS_SLAVE_MODE;
}

CModbusSlave::~CModbusSlave()
{
delete mModbusServer;
}

int CModbusSlave::StartSlaveServer(int port)
{
mModbusServer->listen(QHostAddress::Any,port);
qDebug("Slave server started on port %d",port);
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(ModbusLinkDisconnected()));
qDebug("Slave: Connection with Master established");
}
}

void CModbusSlave::RegistersDatabaseUpdated(quint16 StartAddress, quint16 Length)
{

}

void CModbusSlave::ModbusRequestException(quint8 ExceptionCode, quint8 FctCode)
{

}

+ 221
- 0
Sources/SeaMaxWin/Dll/SeaMAX Dot Net.XML Ver arquivo

@@ -0,0 +1,221 @@
<?xml version="1.0"?>
<doc>
<assembly>
<name>SeaMAX Dot Net</name>
</assembly>
<members>
<member name="M:Sealevel.SeaMAX.SM_Version(System.Int32@,System.Int32@,System.Int32@,System.Int32@)">
<summary>
Returns the SeaMAX library's version info as major.minor.revision.build.
</summary>
<param name="Major">Integer where the Major version number will be stored.</param>
<param name="Minor">Integer where the Minor version number will be stored.</param>
<param name="Revision">Integer where the Revision version number will be stored.</param>
<param name="Build">Integer where the Build version number will be stored.</param>
<returns>Returns 0 if successful.</returns>
</member>
<member name="M:Sealevel.SeaMAX.SM_Open(System.String)">
<summary>
Opens a connection to a Sealevel I/O module.
</summary>
<param name="Connection">String representing the connection to be made.</param>
<returns>Returns 0 if successful, otherwise returns a negative value.</returns>
</member>
<member name="M:Sealevel.SeaMAX.SM_ConfigureSerialConnection(Sealevel.SeaMAX.Baudrate,Sealevel.SeaMAX.Parity)">
<summary>
Configures the local PC's serial port baudrate (For Serial Connections Only).
</summary>
<param name="Baudrate">SeaMAX.Baudrate value representing the new baudrate to be used.</param>
<param name="Parity">SeaMAX.Parity value representing the new parity to be used.</param>
<returns>Returns 0 if successful, otherwise returns a negative value.</returns>
</member>
<member name="M:Sealevel.SeaMAX.SM_ConfigureSerialTimeouts(System.Int32,System.Int32,System.Int32)">
<summary>
Configures the local PC's serial port timeout parameters (For Serial Connections Only).
</summary>
<param name="multiple">Integer specifying the timeout multiplier to be used.</param>
<param name="constant">Integer specifying the timeout constant to be used.</param>
<param name="interval">Integer specifying the timeout character interval to be used.</param>
<returns>Returns 0 if successful, otherwise returns a negative value.</returns>
</member>
<member name="M:Sealevel.SeaMAX.SM_Close">
<summary>
Closes the SeaMAX connection and deconstructs the SeaMAX instance.
</summary>
<returns>Returns 0 if successful, otherwise returns a negative value.</returns>
</member>
<member name="M:Sealevel.SeaMAX.SM_SelectDevice(System.Int32)">
<summary>
Targets a new Modbus device.
</summary>
<param name="SlaveID">New Modbus slave ID to be used in future SeaMAX operations. Valid values are 0 - 247.</param>
<returns>Returns 0 if successful, otherwise returns a negative value.</returns>
</member>
<member name="M:Sealevel.SeaMAX.SM_GetConfig(System.Int32@)">
<summary>
Queries the Sealevel I/O module to determine the module model number, type, baudrate, and parity.
</summary>
<param name="model">Integer where the model number will be stored.</param>
<returns>Returns 0 if successful, otherwise returns a negative value.</returns>
</member>
<member name="M:Sealevel.SeaMAX.SM_GetConfig(System.Int32@,Sealevel.SeaMAX.CommunicationType@,Sealevel.SeaMAX.Baudrate@,Sealevel.SeaMAX.Parity@)">
<summary>
Queries the Sealevel I/O module to determine the module model number, type, baudrate, and parity.
</summary>
<param name="model">Integer where the model number will be stored.</param>
<param name="commType">SeaMAX.CommunicationType where the type of communications interface of the device will be stored.</param>
<param name="baudrate">SeaMAX.Baudrate where the baudrate of the device will be stored.</param>
<param name="parity">SeaMAX.Parity where the parity of the device will be stored.</param>
<returns>Returns 0 if successful, otherwise returns a negative value.</returns>
</member>
<member name="M:Sealevel.SeaMAX.SM_GetDeviceConfig(Sealevel.SeaMAX.DeviceConfig@)">
<summary>
Queries the Sealevel I/O module to determine the module model number, type, baudrate, parity, and firmware version number.
</summary>
<param name="config">Valid DeviceConfig struct</param>
<returns>Returns 0 if successful, otherwise returns a negative value.</returns>
</member>
<member name="M:Sealevel.SeaMAX.SM_GetAnalogInputConfig(Sealevel.SeaMAX.ReferencePoint@,Sealevel.SeaMAX.ChannelMode@)">
<summary>
Gets the device's analog configuraton.
</summary>
<param name="reference">Analog to digital reference point.</param>
<param name="mode">Device input mode.</param>
<returns>Returns 0 if successful, otherwise returns a negative value.</returns>
</member>
<member name="M:Sealevel.SeaMAX.SM_GetAnalogInputRanges(Sealevel.SeaMAX.ChannelRange[])">
<summary>
Gets the device's analog inputs range configuraton.
</summary>
<param name="ranges">SeaMAX.ChannelRange Array where the desired channel ranges will be stored..</param>
<returns>Returns 0 if successful, otherwise returns a negative value.</returns>
</member>
<member name="M:Sealevel.SeaMAX.SM_SetAnalogInputConfig(Sealevel.SeaMAX.ReferencePoint,Sealevel.SeaMAX.ChannelMode)">
<summary>
Sets the device's analog configuraton.
</summary>
<param name="reference">Analog to digital reference point.</param>
<param name="mode">Device input mode.</param>
<returns>Returns 0 if successful, otherwise returns a negative value.</returns>
</member>
<member name="M:Sealevel.SeaMAX.SM_SetAnalogInputRanges(Sealevel.SeaMAX.ChannelRange[])">
<summary>
Sets the device's analog inputs range configuraton.
</summary>
<param name="ranges">Array of desired channel ranges.</param>
<returns>Returns 0 if successful, otherwise returns a negative value.</returns>
</member>
<member name="M:Sealevel.SeaMAX.SM_GetAnalogOutputRanges(Sealevel.SeaMAX.ChannelRange[])">
<summary>
Sets the device's analog inputs range configuraton.
</summary>
<param name="Ranges">SeaMAX.ChannelRange array where the desired channel ranges will be stored.</param>
<returns>Returns 0 if successful, otherwise returns a negative value.</returns>
</member>
<!-- Badly formed XML comment ignored for member "M:Sealevel.SeaMAX.SM_GetPIOPresets(System.Byte[])" -->
<!-- Badly formed XML comment ignored for member "M:Sealevel.SeaMAX.SM_SetPIOPresets(System.Byte[])" -->
<!-- Badly formed XML comment ignored for member "M:Sealevel.SeaMAX.SM_GetPIODirection(System.Byte[])" -->
<!-- Badly formed XML comment ignored for member "M:Sealevel.SeaMAX.SM_SetPIODirection(System.Byte[])" -->
<member name="M:Sealevel.SeaMAX.SM_ReadPIO(System.Byte[])">
<summary>
Reads the entire I/O space of a Sealevel programmable IO device.
This method attempts to read the state of the programmable IO for any applicable Sealevel I/O module. The data is returned as a packed array of bytes reflecting the state of ports A1 to C4, MSB to LSB.
</summary>
<param name="Data">Byte array where the state of the PIO inputs will be stored. Must have 1 byte allocated for each bank of 8 I/O points.</param>
<returns>Returns 0 if successful, otherwise returns a negative value.</returns>
</member>
<member name="M:Sealevel.SeaMAX.SM_WritePIO(System.Byte[])">
<summary>
Writes the IO space of a programmable I/O Sealevel I/O module.
This method attempts to configure the state of all programmable IO. The data should be a packed array of bytes, in order of ports A1 to C4, MSB to LSB.
</summary>
<param name="Data">Byte array containing the desired output values of the programmable IO. Must have 1 byte allocated for each bank of 8 I/O points. If any particular port is set as an input, rather than output, the corresponding byte in the array will be ignored.</param>
<returns>Returns 0 if successful, otherwise returns a negative value.</returns>
</member>
<member name="M:Sealevel.SeaMAX.SM_SetCommunications(Sealevel.SeaMAX.Baudrate,Sealevel.SeaMAX.Parity)">
<summary>
Configures a Sealevel I/O module's serial communication parameters.
</summary>
<param name="Baudrate">SeaMAX.Baudrate containing the desired baudrate.</param>
<param name="Parity">SeaMAX.Parity containing the desired parity.</param>
<returns>Returns 0 if successful, otherwise returns a negative value.</returns>
</member>
<member name="M:Sealevel.SeaMAX.SM_SetSoftwareAddress(System.Int32)">
<summary>
Configure's a Sealevel I/O module's software selectable Modbus slave ID (Modbus devices only).
This method attempts to set the software selectable address (slave ID) of a Sealevel I/O module, whose side rotary switch is set to the '0' position. By default, setting the side switch to zero will result in a Modbus slave ID address of 247.
The 'Set Software Slave ID' Modbus function requires a security key byte, recieved by performing a 'Get Module Configuration (0x45)'. If the security key has not previously been explicitly requested , the SetSoftwareAddress() method will automatically perform the 'Get Module Configuration' function prior to executing the 'Set Software Slave ID'
If the side rotary switch is not in the zero position, this Modbus function will fail.
</summary>
<param name="SlaveID">Integer containing the desired slave ID of the currently selected module.</param>
<returns>Returns 0 if successful, otherwise returns a negative value.</returns>
</member>
<member name="M:Sealevel.SeaMAX.SM_ReadDigitalOutputs(System.Int32,System.Int32,System.Byte[])">
<summary>
Reads the current state of one or more digital outputs. The output state(s) parameter will be an array of bytes where each byte represents 8 outputs and their states. The LSB of the first byte (values[0]) will contain the first 8 output states and will be ordered from LSB to MSB.
</summary>
<param name="Start">Starting output to read (zero-indexed).</param>
<param name="Quantity">Quantity of outputs to read.</param>
<param name="Data">Byte array where the digital output values will be stored. The array must have at least 1 byte allocated for every 8 outputs.</param>
<returns>Returns 0 if successful, otherwise returns a negative value.</returns>
</member>
<member name="M:Sealevel.SeaMAX.SM_ReadDigitalInputs(System.Int32,System.Int32,System.Byte[])">
<summary>
Reads the state of one or more digital inputs. The digital input values in the values array (after a successful read) are packed as one input per bit. The LSB of the first byte (values[0]) contains the first addressed input. The next inputs follow toward the high order end of this byte, and then from low order to high order in subsequent bytes.
</summary>
<param name="Start">Starting input (zero-indexed).</param>
<param name="Quantity">Quantity of digital inputs to read.</param>
<param name="Data">Byte array where the digital input values will be stored. The array must have at least 1 byte allocated for each 8 inputs.</param>
<returns>Returns 0 if successful, otherwise returns a negative value.</returns>
</member>
<member name="M:Sealevel.SeaMAX.SM_ReadAnalogInputs(System.Int32,System.Int32,System.Double[],Sealevel.SeaMAX.ChannelRange[],System.Byte[])">
<summary>
Reads one or more analog inputs. This function will return, via parameters, either an array of bytes, an array of doubles, or both. If you pass either the byte array or double array as null, that type of data will not be returned. Both arrays may not be null.
</summary>
<param name="Start">Starting input (zero-indexed).</param>
<param name="Quantity">Quantity of analog inputs to read.</param>
<param name="AnalogValues">Input values as floating point values (voltages). A double array must be supplied if a byte array is not. Must contain space allocated for 1 double per analog input.</param>
<param name="Ranges">Array of channel ranges that correspond directly to each requested input.</param>
<param name="ByteValues">Register state values as 16-bit big-endian byte pairs. A byte array must be supplied if a double array is not. Must contain space allocated for 2 bytes per analog input.</param>
<returns>Returns 0 if successful, otherwise returns a negative value.</returns>
</member>
<member name="M:Sealevel.SeaMAX.SM_WriteDigitalOutputs(System.Int32,System.Int32,System.Byte[])">
<summary>
Writes the state of one or more digital outputs. The LSB of the first byte (values[0]) should contain the first 8 output states and should be ordered from LSB to MSB.
</summary>
<param name="Start">Starting output (zero-indexed).</param>
<param name="Quantity">Quantity of outputs to write.</param>
<param name="Data">Byte array containing the desired output state(s). At least one byte must be allocated for every 8 outputs.</param>
<returns>Returns 0 if successful, otherwise returns a negative value.</returns>
</member>
<member name="M:Sealevel.SeaMAX.SM_WriteAnalogOutputs(System.Int32,System.Int32,System.Double[],Sealevel.SeaMAX.ChannelRange[],System.Byte[])">
<summary>
Writes to the selected device's analog outputs. Use only AnalogValues or ByteValues, but not both.
</summary>
<param name="Start">Starting output (zero-indexed).</param>
<param name="Quantity">Quantity of analog outputs to write.</param>
<param name="AnalogValues">Desired output values as floating point values (voltages). Leave null if ByteValues are used.</param>
<param name="Ranges">Array of analog output ranges. Can be null if providing byte values.</param>
<param name="ByteValues">Desired output values as 16-bit byte values. Leave null if AnalogValues are used.</param>
<returns>>=0 Number of bytes successfully written. Returns negative if an error occured.</returns>
</member>
<member name="M:Sealevel.SeaMAX.SM_NotifyOnInputChange(System.Int32,System.Int32,System.Byte[],System.Int32,System.Int32)">
<summary>
Continuously reads the discrete inputs until a change occurs. Only one notify request can be outstanding at a time.
</summary>
<param name="Start">Modbus address to begin the read (zero-indexed).</param>
<param name="Quantity">Quantity of inputs to read.</param>
<param name="Data">On input change, this buffer will be populated with the input state.</param>
<param name="Delay">Time to delay between issuing reads (ms).</param>
<param name="Blocking">Indicates whether to wait for a change (non-zero), or immediately return control to the caller (zero).</param>
<returns>Returns 0 if successful, otherwise returns a negative value.</returns>
</member>
<member name="M:Sealevel.SeaMAX.SM_NotifyInputState(System.Int32)">
<summary>
Checks or cancels the notify input state status.
</summary>
<param name="Cancel">Non zero value indicates the current notify operation should be canceled.</param>
<returns>Returns 0 if no change was detected. Returns 1 if an input state has changed. Returns 2 if the last input read failed and will try again. Returns negative if failed.</returns>
</member>
</members>
</doc>

BIN
Sources/SeaMaxWin/Dll/SeaMAX Dot Net.dll Ver arquivo


BIN
Sources/SeaMaxWin/Dll/SeaMAX.dll Ver arquivo


BIN
Sources/SeaMaxWin/Dll/ftd2xx.dll Ver arquivo


+ 284
- 0
Sources/SeaMaxWin/Include/SeaMAX.h Ver arquivo

@@ -0,0 +1,284 @@
#ifndef __SEAMAX_H__
#define __SEAMAX_H__

#ifdef LINUX
#include "wincompat.h"
#endif

typedef void *LPVOID;

#define SM_HANDLE void*
#define SME_HANDLE void*
#define SDL_HANDLE void*

/// \page Enumerations Global Types and Enumerations.
/// Listed here are the types, enumerations, and definitions used throughout the %SeaMAX library.
///
/// \section semax_enumerations SeaMAX Enumerations
///
/// \subsection sm_deviceconfig DeviceConfig
/// \code
typedef struct configuration
{
int model;
int commType;
int baudrate;
int parity;
int firmware;
} DeviceConfig;
/// \endcode

extern "C"
{
extern int __stdcall SM_Version(int* major, int* minor, int* revision, int* build);
extern int __stdcall SM_Open(SM_HANDLE* handle, char* connection);
extern int __stdcall SM_ConfigureSerialConnection(SM_HANDLE handle, int baudrate, int parity);
extern int __stdcall SM_ConfigureSerialTimeouts(SM_HANDLE handle, int multiple, int constant, int interval);
extern int __stdcall SM_SelectDevice(SM_HANDLE handle, int slaveID);
extern int __stdcall SM_GetDeviceConfig(SM_HANDLE handle, DeviceConfig* config);
extern int __stdcall SM_Close(SM_HANDLE handle);
extern int __stdcall SM_GetAnalogInputConfig(SM_HANDLE handle, unsigned char* reference, unsigned char* mode);
extern int __stdcall SM_GetAnalogInputRanges(SM_HANDLE handle, unsigned char* ranges);
extern int __stdcall SM_SetAnalogInputConfig(SM_HANDLE handle, unsigned char reference, unsigned char mode);
extern int __stdcall SM_SetAnalogInputRanges(SM_HANDLE handle, unsigned char* ranges);
extern int __stdcall SM_GetAnalogOutputRanges(SM_HANDLE handle, unsigned char* ranges);
extern int __stdcall SM_GetPIOPresets(SM_HANDLE handle, unsigned char* config);
extern int __stdcall SM_SetPIOPresets(SM_HANDLE handle, unsigned char* config);
extern int __stdcall SM_GetPIODirection(SM_HANDLE handle, unsigned char* config);
extern int __stdcall SM_SetPIODirection(SM_HANDLE handle, unsigned char* config);
extern int __stdcall SM_ReadPIO(SM_HANDLE handle, unsigned char* values);
extern int __stdcall SM_WritePIO(SM_HANDLE handle, unsigned char* values);
extern int __stdcall SM_SetCommunications(SM_HANDLE handle, int baudrate, int parity);
extern int __stdcall SM_SetSoftwareAddress(SM_HANDLE handle, int slaveID);
extern int __stdcall SM_ReadDigitalInputs(SM_HANDLE handle, int start, int number, unsigned char *values);
extern int __stdcall SM_ReadAnalogInputs(SM_HANDLE handle, int start, int number, double* analogValues, unsigned char* ranges, unsigned char *byteValues);
extern int __stdcall SM_WriteDigitalOutputs(SM_HANDLE handle, int start, int number, unsigned char *values);
extern int __stdcall SM_ReadDigitalOutputs(SM_HANDLE handle, int start, int number, unsigned char *values);
extern int __stdcall SM_WriteAnalogOutputs(SM_HANDLE handle, int start, int number, double* analogValues, unsigned char* ranges, unsigned char *byteValues);
extern int __stdcall SM_SetBridgeType(SM_HANDLE handle, int bridgeType);
// Customer specific methods (Oncology Inc.)
extern int __stdcall SM_GlobalCommsReset(SM_HANDLE handle);

#ifndef LINUX
extern int __stdcall SM_NotifyInputState(SM_HANDLE handle, int cancel);
extern int __stdcall SM_NotifyOnInputChange(SM_HANDLE handle, int start, int number, unsigned char* values, int delay, int blocking);
#endif

// Deprecated Functions
extern int __stdcall SM_GetConfig(SM_HANDLE handle, int* model, int* commType, int* baudrate, int* parity);
extern int __stdcall SM_ReadDiscreteInputs(SM_HANDLE handle, int start, int number, unsigned char *values);
extern int __stdcall SM_ReadHoldingRegisters(SM_HANDLE handle, int start, int number, unsigned char *values);
extern int __stdcall SM_ReadInputRegisters(SM_HANDLE handle, int start, int number, unsigned char *values);
extern int __stdcall SM_WriteCoils(SM_HANDLE handle, int start, int number, unsigned char *values);
extern int __stdcall SM_ReadCoils(SM_HANDLE handle, int start, int number, unsigned char *values);
extern int __stdcall SM_WriteHoldingRegisters(SM_HANDLE handle, int start, int number, unsigned char *values);
extern int __stdcall SM_GetADDAExtendedConfig(SM_HANDLE handle, int* multiplierEnabled, unsigned char* daConfig);
extern int __stdcall SM_SetADDAConfig(SM_HANDLE handle, unsigned char* deviceConfig, unsigned char* channelsConfig);
extern int __stdcall SM_GetADDAConfig(SM_HANDLE handle, unsigned char* deviceConfig, unsigned char* channelsConfig);
extern int __stdcall SM_AtoDConversion(SM_HANDLE handle, double *value, unsigned char *data, int channelRange);
extern int __stdcall SM_DtoAConversion(SM_HANDLE handle, double value, unsigned char *data, int channelRange);

extern int __stdcall SME_Initialize(SME_HANDLE* handle);
extern int __stdcall SME_Cleanup(SME_HANDLE handle);
extern int __stdcall SME_SearchForModules(SME_HANDLE handle);
extern int __stdcall SME_FirstModule(SME_HANDLE handle);
extern int __stdcall SME_NextModule(SME_HANDLE handle);
extern int __stdcall SME_Ping(SME_HANDLE handle);
extern int __stdcall SME_ModuleByName(SME_HANDLE handle, char* moduleName);
extern int __stdcall SME_ModuleByIP(SME_HANDLE handle, char* ipAddress);
extern int __stdcall SME_ModuleByMAC(SME_HANDLE handle, char* mac);
extern int __stdcall SME_ModuleCount(SME_HANDLE handle);
extern int __stdcall SME_GetName(SME_HANDLE handle, char* moduleName);
extern int __stdcall SME_GetNetworkConfig(SME_HANDLE handle, char* ipAddress, char* netmask, char* gateway);
extern int __stdcall SME_GetNetworkConfigBytes(SME_HANDLE handle, unsigned char* ipAddress, unsigned char* netmask, unsigned char* gateway);
extern int __stdcall SME_GetMACAddress(SME_HANDLE handle, char* address);
extern int __stdcall SME_GetDHCPConfig(SME_HANDLE handle, int* status);
extern int __stdcall SME_GetType(SME_HANDLE handle, char* type);
extern int __stdcall SME_GetFirmwareVersion(SME_HANDLE handle, int* major, int* minor);
extern int __stdcall SME_GetNetworkSerialParams(SME_HANDLE handle, int* baudrate, int* parity);
extern int __stdcall SME_SetName(SME_HANDLE handle, char *name);
extern int __stdcall SME_SetNetworkConfig(SME_HANDLE handle, char* ipAddress, char* netmask, char* gateway);
extern int __stdcall SME_SetNetworkConfigBytes(SME_HANDLE handle, unsigned char* ipAddress, unsigned char* netmask, unsigned char* gateway);
extern int __stdcall SME_SetDHCPConfig(SME_HANDLE handle, int status);
extern int __stdcall SME_RebootModule(SME_HANDLE handle);
extern int __stdcall SME_SetNetworkSerialParams(SME_HANDLE handle, int baudrate, int parity);
extern int __stdcall SME_GetNetworkSerialParams(SME_HANDLE handle, int* baudrate, int* parity);
extern int __stdcall SME_GetWirelessConfig(SME_HANDLE handle, int* network, char* SSID, int* channel, int* security, int* keyType);
extern int __stdcall SME_SetWirelessConfig(SME_HANDLE handle, int network, char* SSID, int channel, int security, int keyType, char* key);
extern int __stdcall SME_ARPAddress(SME_HANDLE handle, char* ipAddress);
extern int __stdcall SME_IsReachable(SME_HANDLE handle);

extern int __stdcall SDL_Initialize(SDL_HANDLE* handle);
extern int __stdcall SDL_Cleanup(SDL_HANDLE handle);
extern int __stdcall SDL_SearchForDevices(SDL_HANDLE handle);
extern int __stdcall SDL_FirstDevice(SDL_HANDLE handle);
extern int __stdcall SDL_NextDevice(SDL_HANDLE handle);
extern int __stdcall SDL_DeviceCount(SDL_HANDLE handle);
extern int __stdcall SDL_GetName(SDL_HANDLE handle, char* deviceName);
extern int __stdcall SDL_GetModel(SDL_HANDLE handle, int* model);
extern int __stdcall SDL_GetDeviceID(SDL_HANDLE handle, int* id);
extern int __stdcall SDL_GetSerial(SDL_HANDLE handle, char* serialNumber);
extern int __stdcall SDL_GetNameBySerial(SDL_HANDLE handle, char* serialNumber, char* deviceName);


}




#ifndef ENUMERATIONS
#define ENUMERATIONS

///
/// \page Enumerations
/// \subsection sm_baudrates Baudrates
///
/// \code
enum
{
SM_BAUD_INVALID = 0,
SM_BAUD_1200 = 1,
SM_BAUD_2400 = 2,
SM_BAUD_4800 = 3,
SM_BAUD_9600 = 4,
SM_BAUD_14400 = 5,
SM_BAUD_19200 = 6,
SM_BAUD_28800 = 7,
SM_BAUD_38400 = 8,
SM_BAUD_57600 = 9,
SM_BAUD_115200 = 10
};
/// \endcode
///
/// \page Enumerations
/// \subsection sm_databits Databits
/// \code
enum
{
SM_DATABITS_5 = 5,
SM_DATABITS_6 = 6,
SM_DATABITS_7 = 7,
SM_DATABITS_8 = 8
};
/// \endcode
///
/// \page Enumerations
/// \subsection sm_parity Parity
/// \code
enum
{
SM_PARITY_NONE = 0,
SM_PARITY_ODD = 1,
SM_PARITY_EVEN = 2,
SM_PARITY_MARK = 3,
SM_PARITY_SPACE = 4
};
/// \endcode
///
/// \page Enumerations
/// \subsection sm_stopbits Stopbits
/// \code
enum
{
SM_STOPBITS_1 = 0,
SM_STOPBITS_1_5 = 1,
SM_STOPBITS_2 = 2
};
/// \endcode
///
/// \page Enumerations
/// \subsection sm_comtype Communications Type
/// \code
enum
{
SM_COMTYPE_RS485 = 0,
SM_COMTYPE_ETHERNET = 1,
SM_COMTYPE_USB = 2,
SM_COMTYPE_RS232 = 3,
SM_COMTYPE_EXPANSION = 4,
SM_COMTYPE_RS422 = 5,
SM_COMTYPE_WIRELESS = 6,
SM_COMTYPE_INTELLIGENT = 7,
SM_COMTYPE_P_O_ETH = 8,
SM_COMTYPE_P_O_USB = 9
};
/// \endcode
///
/// \subsection ad_reference Analog to Digital Voltage Reference
/// \code
enum
{
ANALOG = 0,
GROUND = 1,
AD_REFERENCE = 2,
FLOATING = 3,
DA_CHANNEL_1 = 4,
DA_CHANNEL_2 = 8
};
/// \endcode
///
/// \subsection ad_channel_modes Analog to Digital Channel Modes
/// \code
enum
{
SINGLE_ENDED = 0,
DIFFERENTIAL = 1,
CURRENT_LOOP = 2
};
/// \endcode
///
/// \subsection channel_ranges Channel Range Values
/// \code
enum
{
ZERO_TO_FIVE = 0,
PLUS_MINUS_FIVE = 1,
ZERO_TO_TEN = 2,
PLUS_MINUS_TEN = 3,
ZERO_TO_FIFTEEN = 2,
PLUS_MINUS_FIFTEEN = 3
};
/// \endcode
///
/// \section sme_enumerations SeaMAX Ethernet Enumerations
///
/// \subsection network_types Network Types
/// \code
enum
{
NETWORK_INFRASTRUCTURE = 0,
NETWORK_ADHOC = 1
};
/// \endcode
///
/// \subsection security_enum Security Type
/// \code
enum
{
SECURITY_NONE = 0,
SECURITY_WEP_OPEN_64 = 1,
SECURITY_WEP_SHARED_64 = 2,
SECURITY_WEP_OPEN_128 = 3,
SECURITY_WEP_SHARED_128 = 4,
SECURITY_WPA_TKIP = 5,
SECURITY_WPA2_AES = 6,

SECURITY_UNKNOWN = 0xFF
};
/// \endcode
///
/// \subsection seckey_enum Key Type
/// \code
enum
{
HEX_KEY = 0,
PASSPHRASE_KEY = 1
};
/// \endcode


#endif


#endif

BIN
Sources/SeaMaxWin/Lib/SeaMAX.lib Ver arquivo


+ 16
- 0
Sources/VisualInspectionPage.cpp Ver arquivo

@@ -0,0 +1,16 @@
#include "VisualInspectionPage.h"
#include "ui_VisualInspectionPage.h"

CVisualInspectionPage::CVisualInspectionPage(QWidget *parent) :
QWidget(parent),
ui(new Ui::CVisualInspectionPage)
{
mProgramHandle = 0;
ui->setupUi(this);

}

CVisualInspectionPage::~CVisualInspectionPage()
{
delete ui;
}

+ 27
- 0
Sources/VisualInspectionPage.h Ver arquivo

@@ -0,0 +1,27 @@
#ifndef VISUALINSPECTIONPAGE_H
#define VISUALINSPECTIONPAGE_H

#include <QWidget>

class CCableTestBench;

namespace Ui {
class CVisualInspectionPage;
}

class CVisualInspectionPage : public QWidget
{
Q_OBJECT
public:
explicit CVisualInspectionPage(QWidget *parent = 0);
~CVisualInspectionPage();
CCableTestBench *mProgramHandle;

private:
Ui::CVisualInspectionPage *ui;


};

#endif // VISUALINSPECTIONPAGE_H

+ 63
- 0
Sources/VisualInspectionPage.ui Ver arquivo

@@ -0,0 +1,63 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>CVisualInspectionPage</class>
<widget class="QWidget" name="CVisualInspectionPage">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1103</width>
<height>710</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<widget class="QCheckBox" name="checkBox">
<property name="geometry">
<rect>
<x>100</x>
<y>50</y>
<width>211</width>
<height>17</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>Vérifiez ceci</string>
</property>
</widget>
<widget class="QCheckBox" name="checkBox_2">
<property name="geometry">
<rect>
<x>100</x>
<y>90</y>
<width>70</width>
<height>17</height>
</rect>
</property>
<property name="text">
<string>CheckBox</string>
</property>
</widget>
<widget class="QCheckBox" name="checkBox_3">
<property name="geometry">
<rect>
<x>100</x>
<y>140</y>
<width>70</width>
<height>17</height>
</rect>
</property>
<property name="text">
<string>CheckBox</string>
</property>
</widget>
</widget>
<resources/>
<connections/>
</ui>

+ 6
- 0
Sources/Widgets/CConnectorSelectWidget.cpp Ver arquivo

@@ -0,0 +1,6 @@
#include "CConnectorSelectWidget.h"

CConnectorSelectWidget::CConnectorSelectWidget(QWidget *parent) :
QWidget(parent)
{
}

+ 18
- 0
Sources/Widgets/CConnectorSelectWidget.h Ver arquivo

@@ -0,0 +1,18 @@
#ifndef CCONNECTORSELECTWIDGET_H
#define CCONNECTORSELECTWIDGET_H

#include <QWidget>

class CConnectorSelectWidget : public QWidget
{
Q_OBJECT
public:
explicit CConnectorSelectWidget(QWidget *parent = 0);
signals:
public slots:
};

#endif // CCONNECTORSELECTWIDGET_H

+ 19
- 0
Sources/Widgets/CConnectorSelectWidget.h.autosave Ver arquivo

@@ -0,0 +1,19 @@

#ifndef CCONNECTORSELECTWIDGET_H
#define CCONNECTORSELECTWIDGET_H

#include <QWidget>

class CConnectorSelectWidget : public QWidget
{
Q_OBJECT
public:
explicit CConnectorSelectWidget(QWidget *parent = 0);
signals:
public slots:
};

#endif // CCONNECTORSELECTWIDGET_H

+ 6
- 0
Sources/ZTInfo.cpp Ver arquivo

@@ -0,0 +1,6 @@
#include "ZTInfo.h"

CZTInfo::CZTInfo()
{

}

+ 13
- 0
Sources/main.cpp Ver arquivo

@@ -0,0 +1,13 @@
//#include "MainWindow.h"
#include "CableTestBench.h"
#include <QApplication>

int main(int argc, char *argv[])
{
QApplication a(argc, argv);

CCableTestBench CableTestBench;
CableTestBench.Start();
return a.exec();
}

BIN
images/connecteurs.png Ver arquivo

Antes Depois
Largura: 376  |  Altura: 537  |  Tamanho: 32 KiB

BIN
images/green-led-off-md.png Ver arquivo

Antes Depois
Largura: 300  |  Altura: 300  |  Tamanho: 25 KiB

BIN
images/green-led-on-md.png Ver arquivo

Antes Depois
Largura: 300  |  Altura: 300  |  Tamanho: 24 KiB

+ 13
- 0
object_script.CableTestBench.Debug Ver arquivo

@@ -0,0 +1,13 @@
INPUT(
./debug\MainWindow.o
./debug\main.o
./debug\MainPage.o
./debug\CableTestBench.o
./debug\VisualInspectionPage.o
./debug\CConnectorSelectWidget.o
./debug\moc_MainWindow.o
./debug\moc_MainPage.o
./debug\moc_CableTestBench.o
./debug\moc_VisualInspectionPage.o
./debug\moc_CConnectorSelectWidget.o
);

+ 13
- 0
object_script.CableTestBench.Release Ver arquivo

@@ -0,0 +1,13 @@
INPUT(
./release\MainWindow.o
./release\main.o
./release\MainPage.o
./release\CableTestBench.o
./release\VisualInspectionPage.o
./release\CConnectorSelectWidget.o
./release\moc_MainWindow.o
./release\moc_MainPage.o
./release\moc_CableTestBench.o
./release\moc_VisualInspectionPage.o
./release\moc_CConnectorSelectWidget.o
);

+ 69
- 0
ui_CMainPage.h Ver arquivo

@@ -0,0 +1,69 @@
/********************************************************************************
** Form generated from reading UI file 'CMainPage.ui'
**
** Created: Wed Mar 27 11:28:49 2019
** by: Qt User Interface Compiler version 4.8.1
**
** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/

#ifndef UI_CMAINPAGE_H
#define UI_CMAINPAGE_H

#include <QtCore/QVariant>
#include <QtGui/QAction>
#include <QtGui/QApplication>
#include <QtGui/QButtonGroup>
#include <QtGui/QFrame>
#include <QtGui/QHeaderView>
#include <QtGui/QLabel>
#include <QtGui/QPushButton>
#include <QtGui/QWidget>

QT_BEGIN_NAMESPACE

class Ui_CMainPage
{
public:
QPushButton *mInspVisuelleBtn;
QFrame *line;
QLabel *mConnectorsImgLbl;

void setupUi(QWidget *CMainPage)
{
if (CMainPage->objectName().isEmpty())
CMainPage->setObjectName(QString::fromUtf8("CMainPage"));
CMainPage->resize(1124, 693);
mInspVisuelleBtn = new QPushButton(CMainPage);
mInspVisuelleBtn->setObjectName(QString::fromUtf8("mInspVisuelleBtn"));
mInspVisuelleBtn->setGeometry(QRect(40, 210, 111, 23));
line = new QFrame(CMainPage);
line->setObjectName(QString::fromUtf8("line"));
line->setGeometry(QRect(550, 30, 20, 641));
line->setFrameShape(QFrame::VLine);
line->setFrameShadow(QFrame::Sunken);
mConnectorsImgLbl = new QLabel(CMainPage);
mConnectorsImgLbl->setObjectName(QString::fromUtf8("mConnectorsImgLbl"));
mConnectorsImgLbl->setGeometry(QRect(580, 30, 491, 431));

retranslateUi(CMainPage);

QMetaObject::connectSlotsByName(CMainPage);
} // setupUi

void retranslateUi(QWidget *CMainPage)
{
CMainPage->setWindowTitle(QApplication::translate("CMainPage", "Form", 0, QApplication::UnicodeUTF8));
mInspVisuelleBtn->setText(QApplication::translate("CMainPage", "Inspection Visuelle", 0, QApplication::UnicodeUTF8));
mConnectorsImgLbl->setText(QApplication::translate("CMainPage", "TextLabel", 0, QApplication::UnicodeUTF8));
} // retranslateUi

};

namespace Ui {
class CMainPage: public Ui_CMainPage {};
} // namespace Ui

QT_END_NAMESPACE

#endif // UI_CMAINPAGE_H

+ 69
- 0
ui_VisualInspectionPage.h Ver arquivo

@@ -0,0 +1,69 @@
/********************************************************************************
** Form generated from reading UI file 'VisualInspectionPage.ui'
**
** Created: Wed Mar 27 10:53:05 2019
** by: Qt User Interface Compiler version 4.8.1
**
** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/

#ifndef UI_VISUALINSPECTIONPAGE_H
#define UI_VISUALINSPECTIONPAGE_H

#include <QtCore/QVariant>
#include <QtGui/QAction>
#include <QtGui/QApplication>
#include <QtGui/QButtonGroup>
#include <QtGui/QCheckBox>
#include <QtGui/QHeaderView>
#include <QtGui/QWidget>

QT_BEGIN_NAMESPACE

class Ui_CVisualInspectionPage
{
public:
QCheckBox *checkBox;
QCheckBox *checkBox_2;
QCheckBox *checkBox_3;

void setupUi(QWidget *CVisualInspectionPage)
{
if (CVisualInspectionPage->objectName().isEmpty())
CVisualInspectionPage->setObjectName(QString::fromUtf8("CVisualInspectionPage"));
CVisualInspectionPage->resize(1103, 710);
checkBox = new QCheckBox(CVisualInspectionPage);
checkBox->setObjectName(QString::fromUtf8("checkBox"));
checkBox->setGeometry(QRect(100, 50, 211, 17));
QFont font;
font.setPointSize(12);
checkBox->setFont(font);
checkBox_2 = new QCheckBox(CVisualInspectionPage);
checkBox_2->setObjectName(QString::fromUtf8("checkBox_2"));
checkBox_2->setGeometry(QRect(100, 90, 70, 17));
checkBox_3 = new QCheckBox(CVisualInspectionPage);
checkBox_3->setObjectName(QString::fromUtf8("checkBox_3"));
checkBox_3->setGeometry(QRect(100, 140, 70, 17));

retranslateUi(CVisualInspectionPage);

QMetaObject::connectSlotsByName(CVisualInspectionPage);
} // setupUi

void retranslateUi(QWidget *CVisualInspectionPage)
{
CVisualInspectionPage->setWindowTitle(QApplication::translate("CVisualInspectionPage", "Form", 0, QApplication::UnicodeUTF8));
checkBox->setText(QApplication::translate("CVisualInspectionPage", "V\303\251rifiez ceci", 0, QApplication::UnicodeUTF8));
checkBox_2->setText(QApplication::translate("CVisualInspectionPage", "CheckBox", 0, QApplication::UnicodeUTF8));
checkBox_3->setText(QApplication::translate("CVisualInspectionPage", "CheckBox", 0, QApplication::UnicodeUTF8));
} // retranslateUi

};

namespace Ui {
class CVisualInspectionPage: public Ui_CVisualInspectionPage {};
} // namespace Ui

QT_END_NAMESPACE

#endif // UI_VISUALINSPECTIONPAGE_H

Carregando…
Cancelar
Salvar