Compare commits
10 Commits
3f28be7793
...
bf31303763
| Author | SHA1 | Date | |
|---|---|---|---|
| bf31303763 | |||
| 3fb8de2ea7 | |||
| 918d2d8fdb | |||
| 5418af7ddc | |||
| 074d72f030 | |||
| 181334f059 | |||
| 526f4f76d8 | |||
| ac4e5aeb93 | |||
| a98f292e65 | |||
| 49cd147334 |
Binary file not shown.
@ -1,6 +1,6 @@
|
||||
#QT += Network
|
||||
#QT += gui declarative network
|
||||
QT += gui network serialport mqtt
|
||||
QT += gui network serialport mqtt websockets
|
||||
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||
#CONFIG += console
|
||||
@ -8,7 +8,6 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||
HEADERS += \
|
||||
Sources/Chalet/ChaletData.h \
|
||||
Sources/Chalet/ChaletInterface.h \
|
||||
Sources/Chalet/ChaletLoraDevice.h \
|
||||
Sources/Ispindel/IspindelData.h \
|
||||
Sources/LoraNetworkCommIF.h \
|
||||
Sources/MasterCtrl.h \
|
||||
@ -53,12 +52,17 @@ HEADERS += \
|
||||
Sources/Chalet/ChaletModbusServer.h \
|
||||
Sources/Ispindel/IspindelDevice.h \
|
||||
Sources/Ispindel/IspindelDataLogger.h \
|
||||
Sources/Ispindel/IspindelInterface.h
|
||||
Sources/Ispindel/IspindelInterface.h \
|
||||
Sources/Gui/LoraSettingsGui.h \
|
||||
Sources/LoraModuleInterface/LoraModuleInterface.h \
|
||||
Sources/NetworkCommIFSurrogate.h \
|
||||
Sources/LoraModuleInterface/LoraModuleInterfaceData.h \
|
||||
Sources/LoraModuleInterface/LoraModuleInterfaceInterface.h \
|
||||
Sources/Chalet/ChaletDevice.h
|
||||
|
||||
SOURCES += \
|
||||
Sources/Chalet/ChaletData.cpp \
|
||||
Sources/Chalet/ChaletInterface.cpp \
|
||||
Sources/Chalet/ChaletLoraDevice.cpp \
|
||||
Sources/Ispindel/IspindelData.cpp \
|
||||
Sources/LoraNetworkCommIF.cpp \
|
||||
Sources/main.cpp \
|
||||
@ -99,7 +103,13 @@ SOURCES += \
|
||||
Sources/Chalet/ChaletModbusServer.cpp \
|
||||
Sources/Ispindel/IspindelDevice.cpp \
|
||||
Sources/Ispindel/IspindelDataLogger.cpp \
|
||||
Sources/Ispindel/IspindelInterface.cpp
|
||||
Sources/Ispindel/IspindelInterface.cpp \
|
||||
Sources/Gui/LoraSettingsGui.cpp \
|
||||
Sources/LoraModuleInterface/LoraModuleInterface.cpp \
|
||||
Sources/NetworkCommIFSurrogate.cpp \
|
||||
Sources/LoraModuleInterface/LoraModuleInterfaceData.cpp \
|
||||
Sources/LoraModuleInterface/LoraModuleInterfaceInterface.cpp \
|
||||
Sources/Chalet/ChaletDevice.cpp
|
||||
|
||||
DEFINES -= Q_OS_UNIX
|
||||
|
||||
@ -120,6 +130,10 @@ INCLUDEPATH += $$PWD/ \
|
||||
$$PWD/blynk-library-master/src/ \
|
||||
$$PWD/Sources/Modbus \
|
||||
$$PWD/Sources/Ispindel \
|
||||
$$PWD/Sources/LoraModuleInterface \
|
||||
# $$PWD/Lib/QtHTTPServer/include/ \
|
||||
|
||||
LIBS += -L$$PWD/Lib/QtHTTPServer/ -lQt5HttpServer
|
||||
|
||||
FORMS += \
|
||||
Sources/Gui/LoraSettingsGui.ui
|
||||
|
||||
264
MasterCtrl.pro.user.5a351af
Normal file
264
MasterCtrl.pro.user.5a351af
Normal file
@ -0,0 +1,264 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE QtCreatorProject>
|
||||
<!-- Written by QtCreator 4.2.1, 2023-02-25T13:35:02. -->
|
||||
<qtcreator>
|
||||
<data>
|
||||
<variable>EnvironmentId</variable>
|
||||
<value type="QByteArray">{5a351af6-dc3b-4afc-af92-7da5e3a5cd12}</value>
|
||||
</data>
|
||||
<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="QByteArray" 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="QByteArray" 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="int" key="EditorConfiguration.MarginColumn">80</value>
|
||||
<value type="bool" key="EditorConfiguration.MouseHiding">true</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="bool" key="EditorConfiguration.ShowMargin">false</value>
|
||||
<value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
|
||||
<value type="bool" key="EditorConfiguration.SmartSelectionChanging">true</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 5.14.2</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Qt 5.14.2</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{dc2b548b-27bc-4e25-8500-cc36640735d8}</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">
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">D:/Main/PicDev/Projets/MasterCtrl/Masterctrl</value>
|
||||
<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="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">true</value>
|
||||
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">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="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/>
|
||||
<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="QString" 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="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/>
|
||||
<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="QString" 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">false</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="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
||||
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
|
||||
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">D:/Main/PicDev/Projets/MasterCtrl/Masterctrl/release</value>
|
||||
<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="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
|
||||
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.SeparateDebugInfo">false</value>
|
||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.UseQtQuickCompiler">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="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/>
|
||||
<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="QString" 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="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||
<valuelist type="QVariantList" key="Qt4ProjectManager.MakeStep.AutomaticallyAddedMakeArguments"/>
|
||||
<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="QString" 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">false</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="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
||||
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</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="QString" 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="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
|
||||
<value type="bool" key="Analyzer.QmlProfiler.AggregateTraces">false</value>
|
||||
<value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value>
|
||||
<value type="uint" key="Analyzer.QmlProfiler.FlushInterval">1000</value>
|
||||
<value type="QString" key="Analyzer.QmlProfiler.LastTraceFile"></value>
|
||||
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">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.LeakCheckOnFinish">1</value>
|
||||
<value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
|
||||
<valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
|
||||
<value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
|
||||
<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="int" key="PE.EnvironmentAspect.Base">2</value>
|
||||
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">MasterCtrl</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:D:/Main/PicDev/Projets/MasterCtrl/Masterctrl/MasterCtrl.pro</value>
|
||||
<value type="bool" key="QmakeProjectManager.QmakeRunConfiguration.UseLibrarySearchPath">true</value>
|
||||
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
|
||||
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">MasterCtrl.pro</value>
|
||||
<value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
|
||||
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
|
||||
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory.default">D:/Main/PicDev/Projets/MasterCtrl/Masterctrl</value>
|
||||
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
|
||||
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
|
||||
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">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.FileVersion</variable>
|
||||
<value type="int">18</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>Version</variable>
|
||||
<value type="int">18</value>
|
||||
</data>
|
||||
</qtcreator>
|
||||
@ -1,6 +1,7 @@
|
||||
#include "AVReceiverDevice.h"
|
||||
#include "GlobalDefine.h"
|
||||
#include "ProtocolDefs.h"
|
||||
#include <QDataStream>
|
||||
|
||||
|
||||
/**
|
||||
@ -25,6 +26,7 @@ CAVReceiverDevice::CAVReceiverDevice()
|
||||
mReceiverSocket = new QTcpSocket;
|
||||
mDisconnectTimer = new QTimer;
|
||||
mStateRequestTimer = new QTimer;
|
||||
// mSyncDelayTimer = new QTimer;
|
||||
|
||||
mDisconnectTimer->setSingleShot(true);
|
||||
mDisconnectTimer->stop();
|
||||
@ -32,6 +34,9 @@ CAVReceiverDevice::CAVReceiverDevice()
|
||||
mStateRequestTimer->setSingleShot(true);
|
||||
mStateRequestTimer->setInterval(RECEIVER_STATE_UPDATE_TIMEOUT);
|
||||
|
||||
// mSyncDelayTimer->setSingleShot(true);
|
||||
// mSyncDelayTimer->setInterval(500);
|
||||
|
||||
|
||||
connect(mDisconnectTimer,SIGNAL(timeout()),this,SLOT(DisconnectTimerExpired()));
|
||||
|
||||
@ -40,16 +45,20 @@ CAVReceiverDevice::CAVReceiverDevice()
|
||||
connect(mReceiverSocket,SIGNAL(readyRead()),this,SLOT(SocketRX()));
|
||||
|
||||
connect(mStateRequestTimer,SIGNAL(timeout()),this,SLOT(StateRequestTimerExpired()));
|
||||
|
||||
// connect(mSyncDelayTimer,&QTimer::timeout,this,&CAVReceiverDevice::SyncTimerExpired);
|
||||
}
|
||||
|
||||
|
||||
CAVReceiverDevice::~CAVReceiverDevice()
|
||||
{
|
||||
mReceiverSocket->disconnectFromHost();
|
||||
mReceiverSocket->waitForDisconnected();
|
||||
mReceiverSocket->waitForDisconnected(100);
|
||||
|
||||
delete mReceiverSocket;
|
||||
delete mDisconnectTimer;
|
||||
delete mStateRequestTimer;
|
||||
// delete mSyncDelayTimer;
|
||||
}
|
||||
|
||||
int CAVReceiverDevice::Start()
|
||||
@ -113,27 +122,36 @@ int CAVReceiverDevice::AnalyseRxData(QByteArray data)
|
||||
int CAVReceiverDevice::UpdateReceiverStateParam(QString SubUnit, QString Fcn, QString Param)
|
||||
{
|
||||
static bool AllValid = false;
|
||||
|
||||
CAvReceiverMainStatus *UnitStatus = 0;
|
||||
if(SubUnit == "MAIN")
|
||||
{
|
||||
UnitStatus = &mReceiverStatus;
|
||||
}
|
||||
else if(SubUnit == "ZONE2")
|
||||
{
|
||||
UnitStatus = &mZone2Status;
|
||||
}
|
||||
|
||||
if(UnitStatus != 0)
|
||||
{
|
||||
if(Fcn == "PWR")
|
||||
{
|
||||
if(Param == "On")
|
||||
{
|
||||
mReceiverStatus.mMainPwrStatus = true;
|
||||
UnitStatus->mMainPwrStatus = true;
|
||||
}
|
||||
else
|
||||
mReceiverStatus.mMainPwrStatus = false;
|
||||
UnitStatus->mMainPwrStatus = false;
|
||||
}
|
||||
if(Fcn == "SLEEP")
|
||||
{
|
||||
if(Param == "On")
|
||||
{
|
||||
mReceiverStatus.mMainSleepStatus = true;
|
||||
UnitStatus->mMainSleepStatus = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
mReceiverStatus.mMainSleepStatus = false;
|
||||
UnitStatus->mMainSleepStatus = false;
|
||||
}
|
||||
}
|
||||
else if(Fcn == "VOL")
|
||||
@ -142,53 +160,31 @@ int CAVReceiverDevice::UpdateReceiverStateParam(QString SubUnit, QString Fcn, QS
|
||||
float Vol = Param.toFloat(&OK);
|
||||
if(OK)
|
||||
{
|
||||
mReceiverStatus.mMainVolume = Vol;
|
||||
UnitStatus->mMainVolume = Vol;
|
||||
}
|
||||
else
|
||||
{
|
||||
mReceiverStatus.mMainPwrStatus = 0xDEADBEEF;
|
||||
UnitStatus->mMainPwrStatus = 0xDEADBEEF;
|
||||
}
|
||||
}
|
||||
else if(Fcn == "MUTE")
|
||||
{
|
||||
if(Param == "On")
|
||||
{
|
||||
mReceiverStatus.mIsMute = true;
|
||||
UnitStatus->mIsMute = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
mReceiverStatus.mIsMute = false;
|
||||
UnitStatus->mIsMute = false;
|
||||
}
|
||||
}
|
||||
else if (Fcn == "INP")
|
||||
{
|
||||
mReceiverStatus.mInput = Param;
|
||||
UnitStatus->mInput = Param;
|
||||
}
|
||||
else if (Fcn == "SOUNDPRG")
|
||||
{
|
||||
mReceiverStatus.mProgram = Param;
|
||||
}
|
||||
else if(Fcn == "SPEAKERA")
|
||||
{
|
||||
if(Param == "On")
|
||||
{
|
||||
mReceiverStatus.mSpeakerAState = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
mReceiverStatus.mSpeakerAState = false;
|
||||
}
|
||||
}
|
||||
else if(Fcn == "SPEAKERB")
|
||||
{
|
||||
if(Param == "On")
|
||||
{
|
||||
mReceiverStatus.mSpeakerBState = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
mReceiverStatus.mSpeakerBState = false;
|
||||
}
|
||||
UnitStatus->mProgram = Param;
|
||||
}
|
||||
}
|
||||
return RET_OK;
|
||||
@ -197,9 +193,10 @@ int CAVReceiverDevice::UpdateReceiverStateParam(QString SubUnit, QString Fcn, QS
|
||||
int CAVReceiverDevice::SendReceiverCommand(QString Command)
|
||||
{
|
||||
//Make sure the escape sequence is correct.
|
||||
Command.remove("\r");
|
||||
Command.remove("\n");
|
||||
Command.append("\r\n");
|
||||
// Command.remove("\r");
|
||||
// Command.remove("\n");
|
||||
// Command.append("\r\n");
|
||||
|
||||
|
||||
if(mReceiverSocket->state() == QAbstractSocket::ConnectedState)
|
||||
{
|
||||
@ -265,7 +262,7 @@ void CAVReceiverDevice::StateRequestTimerExpired()
|
||||
{
|
||||
if(mReceiverSocket->state() != QAbstractSocket::ConnectedState)
|
||||
{
|
||||
SendReceiverCommand("@MAIN:BASIC=?");
|
||||
SendReceiverCommand("@MAIN:BASIC=?\r\n@ZONE2:BASIC=?\r\n");
|
||||
mStateRequestTimer->start(RECEIVER_STATE_UPDATE_TIMEOUT);
|
||||
DisconnectReceiverDelayed(1000);
|
||||
}
|
||||
@ -278,30 +275,31 @@ void CAVReceiverDevice::StateRequestTimerExpired()
|
||||
|
||||
////// Network Interface Implementation
|
||||
|
||||
int CAVReceiverDevice::SetSpeakerB(bool OnOff)
|
||||
int CAVReceiverDevice::SetZone2(bool OnOff)
|
||||
{
|
||||
QString Cmd = "@MAIN:SPEAKERB=";
|
||||
QString Cmd = "@ZONE2:PWR=";
|
||||
if(OnOff)
|
||||
{
|
||||
Cmd += "On";
|
||||
Cmd += "On\r\n";
|
||||
}
|
||||
else
|
||||
Cmd += "Off";
|
||||
Cmd += "Standby\r\n";
|
||||
|
||||
SendReceiverCommand(Cmd);
|
||||
|
||||
DisconnectReceiverDelayed();
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
int CAVReceiverDevice::SetSpeakerA(bool OnOff)
|
||||
int CAVReceiverDevice::SetMainZone(bool OnOff)
|
||||
{
|
||||
QString Cmd = "@MAIN:SPEAKERA=";
|
||||
QString Cmd = "@MAIN:PWR=";
|
||||
if(OnOff)
|
||||
{
|
||||
Cmd += "On";
|
||||
Cmd += "On\r\n";
|
||||
}
|
||||
else
|
||||
Cmd += "Off";
|
||||
Cmd += "Standby\r\n";
|
||||
|
||||
SendReceiverCommand(Cmd);
|
||||
DisconnectReceiverDelayed();
|
||||
@ -315,22 +313,22 @@ int CAVReceiverDevice::SetSpeakers(int SpeakerA, int SpeakerB)
|
||||
QString Cmd = "@MAIN:SPEAKERA=";
|
||||
if(SpeakerA == RECEIVER_SET_SPK_ON)
|
||||
{
|
||||
Cmd += "On";
|
||||
Cmd += "On\r\n";
|
||||
}
|
||||
else if(SpeakerA == RECEIVER_SET_SPK_OFF)
|
||||
{
|
||||
Cmd += "Off";
|
||||
Cmd += "Off\r\n";
|
||||
}
|
||||
else if(SpeakerA == RECEVIVER_TOGGLE_SPK)
|
||||
{
|
||||
if(mReceiverStatus.mSpeakerAState == true)
|
||||
{
|
||||
Cmd += "Off";
|
||||
}
|
||||
else
|
||||
{
|
||||
Cmd += "On";
|
||||
}
|
||||
// if(mReceiverStatus.mSpeakerAState == true)
|
||||
// {
|
||||
// Cmd += "Off";
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// Cmd += "On";
|
||||
// }
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -354,14 +352,14 @@ int CAVReceiverDevice::SetSpeakers(int SpeakerA, int SpeakerB)
|
||||
}
|
||||
else if(SpeakerB == RECEVIVER_TOGGLE_SPK)
|
||||
{
|
||||
if(mReceiverStatus.mSpeakerAState == true)
|
||||
{
|
||||
Cmd += "Off";
|
||||
}
|
||||
else
|
||||
{
|
||||
Cmd += "On";
|
||||
}
|
||||
// if(mReceiverStatus.mSpeakerAState == true)
|
||||
// {
|
||||
// Cmd += "Off";
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// Cmd += "On";
|
||||
// }
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -382,3 +380,93 @@ int CAVReceiverDevice::SendRawCommand(QString Cmd)
|
||||
|
||||
}
|
||||
|
||||
QByteArray CAVReceiverDevice::GetReceiverStatus()
|
||||
{
|
||||
QByteArray StatusArray;
|
||||
QDataStream Strm(&StatusArray,QIODevice::WriteOnly | QIODevice::Unbuffered);
|
||||
Strm.device()->seek(0);
|
||||
|
||||
Strm << mReceiverStatus
|
||||
<< mZone2Status ;
|
||||
|
||||
if(mReceiverStatus.mSyncZonesVolumes == true &&
|
||||
( (mReceiverStatus.mMainVolume != mLastMainZoneVolume) ||
|
||||
(mReceiverStatus.mMainVolume != mZone2Status.mMainVolume)))
|
||||
{
|
||||
SetZone2Volume(mReceiverStatus.mMainVolume);
|
||||
}
|
||||
|
||||
mLastMainZoneVolume = mReceiverStatus.mMainVolume;
|
||||
return StatusArray;
|
||||
}
|
||||
|
||||
int CAVReceiverDevice::SelectScene(char Zone, char Scene)
|
||||
{
|
||||
QString Cmd;
|
||||
if(Zone == AV_RECEIVER_MAIN_ZONE)
|
||||
{
|
||||
Cmd = QString("@MAIN:SCENE=Scene %1\r\n").arg((int)Scene,1);
|
||||
|
||||
}
|
||||
else if(Zone == AV_RECEIVER_ZONE_2)
|
||||
{
|
||||
Cmd = QString("@ZONE2:SCENE=Scene %1\r\n").arg((int)Scene,1);
|
||||
}
|
||||
else
|
||||
{
|
||||
return RET_ERROR;
|
||||
}
|
||||
|
||||
SendReceiverCommand(Cmd);
|
||||
DisconnectReceiverDelayed(2000);
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
int CAVReceiverDevice::SetMainVolume(float Volume)
|
||||
{
|
||||
QString Cmd;
|
||||
Cmd = QString("@MAIN:VOL=%1\r\n").arg(Volume,1,'f',1);
|
||||
|
||||
// qDebug("%s",qPrintable(Cmd));
|
||||
|
||||
SendReceiverCommand(Cmd);
|
||||
// DisconnectReceiverDelayed();
|
||||
|
||||
if(mReceiverStatus.mSyncZonesVolumes == true)
|
||||
{
|
||||
SetZone2Volume(Volume);
|
||||
}
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
int CAVReceiverDevice::SetZone2Volume(float Volume)
|
||||
{
|
||||
QString Cmd;
|
||||
Cmd = QString("@ZONE2:VOL=%1\r\n").arg(Volume,1,'f',1);
|
||||
|
||||
SendReceiverCommand(Cmd);
|
||||
// DisconnectReceiverDelayed();
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
int CAVReceiverDevice::SetZone2Input(QString InputString)
|
||||
{
|
||||
QString Cmd;
|
||||
Cmd = QString("@ZONE2:INP=%1\r\n").arg(InputString);
|
||||
|
||||
SendReceiverCommand(Cmd);
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
int CAVReceiverDevice::SetSyncZ2withZ1(bool Sync)
|
||||
{
|
||||
mReceiverStatus.mSyncZonesVolumes = Sync;
|
||||
if(Sync == true)
|
||||
{
|
||||
SetZone2Volume(mReceiverStatus.mMainVolume);
|
||||
}
|
||||
// qDebug("Sync Z2 with Z1: %d",Sync);
|
||||
}
|
||||
|
||||
@ -48,7 +48,20 @@ enum eReceiverSubUnits
|
||||
IPODUSB
|
||||
};
|
||||
|
||||
class CAVReceiverDevice : QObject
|
||||
enum eReceiverZone2Inputs
|
||||
{
|
||||
AUDIO1,
|
||||
AUDIO2,
|
||||
AUDIO3,
|
||||
AUDIO4,
|
||||
AUDIO5,
|
||||
PHONO,
|
||||
TUNER,
|
||||
SERVER,
|
||||
MAIN_ZONE_SYNC
|
||||
};
|
||||
|
||||
class CAVReceiverDevice :public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -67,20 +80,27 @@ private:
|
||||
|
||||
public:
|
||||
//Network Interface Implementation
|
||||
int SetSpeakerB(bool OnOff);
|
||||
int SetSpeakerA(bool OnOff);
|
||||
int SetZone2(bool OnOff);
|
||||
int SetMainZone(bool OnOff);
|
||||
int SetSpeakers(int SpeakerA, int SpeakerB);
|
||||
int SendRawCommand(QString Cmd);
|
||||
CAvReceiverMainStatus GetReceiverStatus(){return mReceiverStatus;}
|
||||
int SelectScene(char Zone, char Scene);
|
||||
int SetMainVolume(float Volume);
|
||||
int SetZone2Volume(float Volume);
|
||||
int SetZone2Input(QString InputString);
|
||||
int SetSyncZ2withZ1(bool Sync);
|
||||
QByteArray GetReceiverStatus();
|
||||
|
||||
private:
|
||||
QTcpSocket *mReceiverSocket;
|
||||
int AnalyseRxData(QByteArray data);
|
||||
QTimer *mDisconnectTimer, *mStateRequestTimer;
|
||||
QTimer *mDisconnectTimer, *mStateRequestTimer, *mSyncDelayTimer;
|
||||
CAvReceiverMainStatus mReceiverStatus;
|
||||
CAvReceiverMainStatus mZone2Status;
|
||||
|
||||
bool mIsConnected;
|
||||
QString mPendingCommand;
|
||||
float mLastMainZoneVolume;
|
||||
|
||||
|
||||
public slots:
|
||||
@ -89,6 +109,7 @@ public slots:
|
||||
void SocketRX();
|
||||
void DisconnectTimerExpired();
|
||||
void StateRequestTimerExpired();
|
||||
// void SyncTimerExpired();
|
||||
};
|
||||
|
||||
#endif // AVRECEIVERDEVICE_H
|
||||
|
||||
@ -5,6 +5,7 @@ CAvReceiverMainStatus::CAvReceiverMainStatus()
|
||||
{
|
||||
mDataValid = false;
|
||||
mReceiverOnline = false;
|
||||
mSyncZonesVolumes = true;
|
||||
}
|
||||
|
||||
QByteArray CAvReceiverMainStatus::ToByteArray()
|
||||
@ -20,11 +21,10 @@ QByteArray CAvReceiverMainStatus::ToByteArray()
|
||||
Strm << mIsMute;
|
||||
Strm << mInput;
|
||||
Strm << mProgram;
|
||||
Strm << mSpeakerAState;
|
||||
Strm << mSpeakerBState;
|
||||
|
||||
Strm << mDataValid;
|
||||
Strm << mReceiverOnline;
|
||||
Strm << mSyncZonesVolumes;
|
||||
|
||||
return Output;
|
||||
|
||||
@ -41,12 +41,39 @@ int CAvReceiverMainStatus::FromByteArray(QByteArray Data)
|
||||
Strm >> mIsMute;
|
||||
Strm >> mInput;
|
||||
Strm >> mProgram;
|
||||
Strm >> mSpeakerAState;
|
||||
Strm >> mSpeakerBState;
|
||||
|
||||
Strm >> mDataValid;
|
||||
Strm >> mReceiverOnline;
|
||||
Strm >> mSyncZonesVolumes;
|
||||
|
||||
return RET_OK;
|
||||
|
||||
}
|
||||
QDataStream &operator<<(QDataStream &out, const CAvReceiverMainStatus &source)
|
||||
{
|
||||
out << source.mMainPwrStatus
|
||||
<< source.mMainSleepStatus
|
||||
<< source.mMainVolume
|
||||
<< source.mIsMute
|
||||
<< source.mInput
|
||||
<< source.mProgram
|
||||
<< source.mDataValid
|
||||
<< source.mReceiverOnline
|
||||
<< source.mSyncZonesVolumes;
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
QDataStream &operator>>(QDataStream &in, CAvReceiverMainStatus &dest)
|
||||
{
|
||||
in >> dest.mMainPwrStatus
|
||||
>> dest.mMainSleepStatus
|
||||
>> dest.mMainVolume
|
||||
>> dest.mIsMute
|
||||
>> dest.mInput
|
||||
>> dest.mProgram
|
||||
>> dest.mDataValid
|
||||
>> dest.mReceiverOnline
|
||||
>> dest.mSyncZonesVolumes;
|
||||
return in;
|
||||
}
|
||||
|
||||
@ -3,6 +3,13 @@
|
||||
#include <QString>
|
||||
#include "GlobalDefine.h"
|
||||
|
||||
enum eAVReceiverZones
|
||||
{
|
||||
AV_RECEIVER_MAIN_ZONE = 1,
|
||||
AV_RECEIVER_ZONE_2,
|
||||
|
||||
AV_RECEIVER_MAX_ZONE
|
||||
};
|
||||
|
||||
class CAvReceiverMainStatus
|
||||
{
|
||||
@ -19,12 +26,13 @@ public:
|
||||
bool mIsMute;
|
||||
QString mInput;
|
||||
QString mProgram;
|
||||
bool mSpeakerAState;
|
||||
bool mSpeakerBState;
|
||||
bool mSyncZonesVolumes;
|
||||
|
||||
bool mDataValid;
|
||||
bool mReceiverOnline;
|
||||
|
||||
};
|
||||
|
||||
QDataStream &operator<<(QDataStream &out, const CAvReceiverMainStatus &source);
|
||||
QDataStream &operator>>(QDataStream &in, CAvReceiverMainStatus &dest);
|
||||
|
||||
#endif // AVRECEIVERDATA_H
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
#include "AvReceiverInterface.h"
|
||||
#include "ProtocolDefs.h"
|
||||
#include "AVReceiverDevice.h"
|
||||
#include <QDataStream>
|
||||
|
||||
CAvReceiverInterface::CAvReceiverInterface(int Address, CAbstractNetworkCommIF *NetworkInterface , CAVReceiverDevice *DevicePtr):
|
||||
CNetworkDevice(ID_AVRECEIVER_INTERFACE,Address,NetworkInterface)
|
||||
@ -23,7 +24,7 @@ int CAvReceiverInterface::NewDeviceFrameReceived(int DeviceID, int DeviceAddress
|
||||
}
|
||||
case AV_RECEIVER_INTERFACE_GENERAL_STATUS_REQUEST:
|
||||
{
|
||||
QByteArray data = mAvReceiverDevice->GetReceiverStatus().ToByteArray();
|
||||
QByteArray data = mAvReceiverDevice->GetReceiverStatus();
|
||||
mNetworkInterfacePtr->SendNetworkMessage(ID_AVRECEIVER_INTERFACE,mDeviceAddress,AV_RECEIVER_INTERFACE_GENERAL_STATUS_RESPONSE,data.size(),&data);
|
||||
break;
|
||||
}
|
||||
@ -32,16 +33,16 @@ int CAvReceiverInterface::NewDeviceFrameReceived(int DeviceID, int DeviceAddress
|
||||
{
|
||||
break;
|
||||
}
|
||||
case AV_RECEIVER_INTERFACE_SET_SPEAKERB_REQUEST:
|
||||
case AV_RECEIVER_INTERFACE_SET_ZONE2_REQUEST:
|
||||
{
|
||||
bool SpkStatus = (bool)Data[0];
|
||||
mAvReceiverDevice->SetSpeakerB(SpkStatus);
|
||||
mAvReceiverDevice->SetZone2(SpkStatus);
|
||||
break;
|
||||
}
|
||||
case AV_RECEIVER_INTERFACE_SET_SPEAKERA_REQUEST:
|
||||
case AV_RECEIVER_INTERFACE_SET_MAIN_ZONE_REQUEST:
|
||||
{
|
||||
bool SpkStatus = (bool)Data[0];
|
||||
mAvReceiverDevice->SetSpeakerA(SpkStatus);
|
||||
mAvReceiverDevice->SetMainZone(SpkStatus);
|
||||
break;
|
||||
|
||||
}
|
||||
@ -53,12 +54,58 @@ int CAvReceiverInterface::NewDeviceFrameReceived(int DeviceID, int DeviceAddress
|
||||
{
|
||||
break;
|
||||
}
|
||||
case AV_RECEIVER_INTERFACE_SELECT_SCENE_REQUEST:
|
||||
{
|
||||
mAvReceiverDevice->SelectScene(Data[0],Data[1]);
|
||||
break;
|
||||
}
|
||||
case AV_RECEIVER_INTERFACE_SET_MAIN_VOLUME_REQUEST:
|
||||
{
|
||||
float VolumeData;
|
||||
QDataStream Strm(&Data,QIODevice::ReadOnly);
|
||||
Strm >> VolumeData;
|
||||
|
||||
mAvReceiverDevice->SetMainVolume(VolumeData);
|
||||
break;
|
||||
}
|
||||
case AV_RECEIVER_INTERFACE_SET_ZONE2_VOLUME_REQUEST:
|
||||
{
|
||||
float VolumeData;
|
||||
QDataStream Strm(&Data,QIODevice::ReadOnly);
|
||||
Strm >> VolumeData;
|
||||
|
||||
mAvReceiverDevice->SetZone2Volume(VolumeData);
|
||||
break;
|
||||
}
|
||||
case AV_RECEIVER_INTERFACE_SET_ZONE2_INPUT_REQUEST:
|
||||
{
|
||||
QString Source;
|
||||
QDataStream Strm(&Data,QIODevice::ReadOnly);
|
||||
Strm >> Source;
|
||||
|
||||
mAvReceiverDevice->SetZone2Input(Source);
|
||||
break;
|
||||
}
|
||||
case AV_RECEIVER_INTERFACE_SET_SYNC_Z2_WITH_Z1_REQUEST:
|
||||
{
|
||||
bool Sync;
|
||||
QDataStream Strm(&Data,QIODevice::ReadOnly);
|
||||
Strm >> Sync;
|
||||
|
||||
mAvReceiverDevice->SetSyncZ2withZ1(Sync);
|
||||
break;
|
||||
}
|
||||
case AV_RECEIVER_INTERFACE_GENERAL_STATUS_RESPONSE:
|
||||
case AV_RECEIVER_INTERFACE_SET_MAIN_POWER_RESPONSE:
|
||||
case AV_RECEIVER_INTERFACE_SET_SPEAKERB_RESPONSE:
|
||||
case AV_RECEIVER_INTERFACE_SET_ZONE2_RESPONSE:
|
||||
case AV_RECEIVER_INTERFACE_SEND_DIRECT_CMD_RESPONSE:
|
||||
case AV_RECEIVER_INTERFACE_SET_SPEAKERS_RESPONSE:
|
||||
case AV_RECEIVER_INTERFACE_SET_SPEAKERA_RESPONSE:
|
||||
case AV_RECEIVER_INTERFACE_SET_MAIN_ZONE_RESPONSE:
|
||||
case AV_RECEIVER_INTERFACE_SELECT_SCENE_RESPONSE:
|
||||
case AV_RECEIVER_INTERFACE_SET_MAIN_VOLUME_RESPONSE:
|
||||
case AV_RECEIVER_INTERFACE_SET_ZONE2_VOLUME_RESPONSE:
|
||||
case AV_RECEIVER_INTERFACE_SET_ZONE2_INPUT_RESPONSE:
|
||||
case AV_RECEIVER_INTERFACE_SET_SYNC_Z2_WITH_Z1_RESPONSE:
|
||||
default:
|
||||
{
|
||||
qDebug("Received invalid msg from Sprinkler Interface");
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
#include "ChaletLoraDevice.h"
|
||||
#include "ChaletDevice.h"
|
||||
#include "GlobalDefine.h"
|
||||
|
||||
|
||||
CChaletLoraDevice::CChaletLoraDevice(int Address, CAbstractNetworkCommIF *NetworkInterface):
|
||||
CChaletDevice::CChaletDevice(int Address, CAbstractNetworkCommIF *NetworkInterface):
|
||||
CNetworkDevice(ID_CHALET_DEVICE,Address,NetworkInterface)
|
||||
{
|
||||
NetworkInterface->mDevicePtr = this;
|
||||
@ -27,12 +27,12 @@ CChaletLoraDevice::CChaletLoraDevice(int Address, CAbstractNetworkCommIF *Networ
|
||||
ResetCommStats();
|
||||
}
|
||||
|
||||
CChaletLoraDevice::~CChaletLoraDevice()
|
||||
CChaletDevice::~CChaletDevice()
|
||||
{
|
||||
delete mChaletStatusTimer;
|
||||
}
|
||||
|
||||
int CChaletLoraDevice::Start()
|
||||
int CChaletDevice::Start()
|
||||
{
|
||||
ScheduleChaletStatusRequest();
|
||||
mChaletStatusTimer->start(1000);
|
||||
@ -40,7 +40,7 @@ int CChaletLoraDevice::Start()
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
int CChaletLoraDevice::NewDeviceFrameReceived(int DeviceID, int DeviceAddress, int MessageID, int DataSize, QByteArray Data)
|
||||
int CChaletDevice::NewDeviceFrameReceived(int DeviceID, int DeviceAddress, int MessageID, int DataSize, QByteArray Data)
|
||||
{
|
||||
Q_UNUSED(DeviceID)
|
||||
Q_UNUSED(DeviceAddress)
|
||||
@ -169,8 +169,8 @@ int CChaletLoraDevice::NewDeviceFrameReceived(int DeviceID, int DeviceAddress, i
|
||||
}
|
||||
case CHALET_WIFI_STATUS_RESPONSE:
|
||||
{
|
||||
mChaletMainStatus.mWiFiModuleStatus = Data[0];
|
||||
CmdResponseReceived(CHALET_WIFI_STATUS_REQUEST);
|
||||
emit DeviceWifiStatusReceived(Data);
|
||||
break;
|
||||
}
|
||||
case CHALET_WIFI_SET_STATE_RESPONSE:
|
||||
@ -211,7 +211,7 @@ int CChaletLoraDevice::NewDeviceFrameReceived(int DeviceID, int DeviceAddress, i
|
||||
{
|
||||
|
||||
CmdResponseReceived(CHALET_GET_STORED_WIFI_SETTINGS_REQUEST);
|
||||
mDeviceWiFiParameters = Data.left(8);
|
||||
mDeviceWiFiParameters = Data.left(DataSize);
|
||||
emit DeviceWifiStoredParamsReceived();
|
||||
break;
|
||||
}
|
||||
@ -245,7 +245,7 @@ int CChaletLoraDevice::NewDeviceFrameReceived(int DeviceID, int DeviceAddress, i
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
void CChaletLoraDevice::CommTimerExpired()
|
||||
void CChaletDevice::CommTimerExpired()
|
||||
{
|
||||
if(mPendingNetworkMsgList.isEmpty())
|
||||
{
|
||||
@ -257,7 +257,7 @@ void CChaletLoraDevice::CommTimerExpired()
|
||||
if(mPendingNetworkMsgList.first().PendingResponse == true)
|
||||
{
|
||||
//The current command is still waiting for a response. Check how many times we tried to send it
|
||||
qDebug("Cmd 0x%x timetout... retrying",mPendingNetworkMsgList.first().mMessageID);
|
||||
// qDebug("Cmd 0x%x timetout... retrying",mPendingNetworkMsgList.first().mMessageID);
|
||||
if(mPendingNetworkMsgList.first().ResendCounter >= 2)
|
||||
{
|
||||
//After 2 retries, declare module offline, clear the send buffer and start sending status requests...
|
||||
@ -295,7 +295,7 @@ void CChaletLoraDevice::CommTimerExpired()
|
||||
// SendChaletCommand(CHALET_GENERAL_STATUS_REQUEST,0,QByteArray());
|
||||
}
|
||||
|
||||
int CChaletLoraDevice::SendWiFiModuleSetState(bool State)
|
||||
int CChaletDevice::SendWiFiModuleSetState(bool State)
|
||||
{
|
||||
QByteArray Data;
|
||||
Data.resize(1);
|
||||
@ -311,7 +311,7 @@ int CChaletLoraDevice::SendWiFiModuleSetState(bool State)
|
||||
return ScheduleChaletCommand(CHALET_WIFI_SET_STATE_REQUEST,1,Data);
|
||||
}
|
||||
|
||||
int CChaletLoraDevice::SendInverterPowerRelayState(bool State)
|
||||
int CChaletDevice::SendInverterPowerRelayState(bool State)
|
||||
{
|
||||
QByteArray Data;
|
||||
Data.resize(1);
|
||||
@ -327,7 +327,7 @@ int CChaletLoraDevice::SendInverterPowerRelayState(bool State)
|
||||
return ScheduleChaletCommand(CHALET_AC_POWER_SET_STATE_REQUEST,Data);
|
||||
}
|
||||
|
||||
int CChaletLoraDevice::SendDOHarakiri()
|
||||
int CChaletDevice::SendDOHarakiri()
|
||||
{
|
||||
QByteArray Data; //Magic word...
|
||||
Data.clear();
|
||||
@ -339,7 +339,7 @@ int CChaletLoraDevice::SendDOHarakiri()
|
||||
return ScheduleChaletCommand(CHALET_DO_HARAKIRI_REQUEST,Data);
|
||||
}
|
||||
|
||||
int CChaletLoraDevice::SendRebootCmd()
|
||||
int CChaletDevice::SendRebootCmd()
|
||||
{
|
||||
QByteArray Data; //Magic word...
|
||||
Data.clear();
|
||||
@ -350,28 +350,38 @@ int CChaletLoraDevice::SendRebootCmd()
|
||||
|
||||
return ScheduleChaletCommand(CHALET_REBOOT_CPU_REQUEST,Data);
|
||||
}
|
||||
int CChaletLoraDevice::SendGetWifiParams()
|
||||
int CChaletDevice::SendGetWifiParams()
|
||||
{
|
||||
return ScheduleChaletCommand(CHALET_GET_STORED_WIFI_SETTINGS_REQUEST,QByteArray());
|
||||
}
|
||||
|
||||
int CChaletLoraDevice::SendSetWifiParams(QByteArray Data)
|
||||
int CChaletDevice::SendSetWifiParams(QByteArray Data)
|
||||
{
|
||||
return ScheduleChaletCommand(CHALET_SET_STORED_WIFI_SETTINGS_REQUEST,Data);
|
||||
}
|
||||
|
||||
int CChaletLoraDevice::SendGetFirmwareVersion()
|
||||
int CChaletDevice::SendGetFirmwareVersion()
|
||||
{
|
||||
return ScheduleChaletCommand(CHALET_GET_FIRMWARE_VERSION_REQUEST,QByteArray());
|
||||
}
|
||||
|
||||
int CChaletLoraDevice::SendClearCommStatsRequest()
|
||||
int CChaletDevice::SendClearCommStatsRequest()
|
||||
{
|
||||
return ScheduleChaletCommand(CHALET_CLEAR_COMMS_STATISTICS_REQUEST,QByteArray());
|
||||
}
|
||||
|
||||
int CChaletLoraDevice::SendChaletCommand(int CmdID, int DataSize, QByteArray Data)
|
||||
int CChaletDevice::SendGetWifiStatusRequest()
|
||||
{
|
||||
return ScheduleChaletCommand(CHALET_WIFI_STATUS_REQUEST,QByteArray());
|
||||
}
|
||||
|
||||
int CChaletDevice::SendChaletCommand(int CmdID, int DataSize, QByteArray Data)
|
||||
{
|
||||
if(mNetworkInterfacePtr == 0)
|
||||
{
|
||||
return RET_ERROR;
|
||||
}
|
||||
|
||||
mNetworkInterfacePtr->SendNetworkMessage(ID_CHALET_DEVICE,mDeviceAddress,CmdID,DataSize,&Data);
|
||||
mTotalNbRequest++;
|
||||
mChaletMainStatus.mTotalNbMasterTxCmds++;
|
||||
@ -379,7 +389,7 @@ int CChaletLoraDevice::SendChaletCommand(int CmdID, int DataSize, QByteArray Dat
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
int CChaletLoraDevice::CmdResponseReceived(int CmdID)
|
||||
int CChaletDevice::CmdResponseReceived(int CmdID)
|
||||
{
|
||||
Q_UNUSED(CmdID)
|
||||
|
||||
@ -416,12 +426,14 @@ int CChaletLoraDevice::CmdResponseReceived(int CmdID)
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
int CChaletLoraDevice::ScheduleChaletStatusRequest()
|
||||
|
||||
|
||||
int CChaletDevice::ScheduleChaletStatusRequest()
|
||||
{
|
||||
return ScheduleChaletCommand(CHALET_GENERAL_STATUS_REQUEST,0,QByteArray());
|
||||
}
|
||||
|
||||
int CChaletLoraDevice::ScheduleChaletCommand(int CmdID, int DataSize, QByteArray Data)
|
||||
int CChaletDevice::ScheduleChaletCommand(int CmdID, int DataSize, QByteArray Data)
|
||||
{
|
||||
Q_UNUSED(DataSize)
|
||||
|
||||
@ -438,7 +450,7 @@ int CChaletLoraDevice::ScheduleChaletCommand(int CmdID, int DataSize, QByteArray
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
int CChaletLoraDevice::ScheduleChaletCommand(int CmdID, QByteArray Data)
|
||||
int CChaletDevice::ScheduleChaletCommand(int CmdID, QByteArray Data)
|
||||
{
|
||||
// if(mChaletMainStatus.mIsOnline == false)
|
||||
// {
|
||||
@ -464,7 +476,7 @@ int CChaletLoraDevice::ScheduleChaletCommand(int CmdID, QByteArray Data)
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
int CChaletLoraDevice::ResetCommStats()
|
||||
int CChaletDevice::ResetCommStats()
|
||||
{
|
||||
mLostRequestPercentage = 0.0;
|
||||
mTotalNbRequest = 0;
|
||||
@ -475,7 +487,7 @@ int CChaletLoraDevice::ResetCommStats()
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
int CChaletLoraDevice::ComputeCommStats()
|
||||
int CChaletDevice::ComputeCommStats()
|
||||
{
|
||||
mLostRequestPercentage = ((float)mNbLostRequest/(float)mTotalNbRequest)*100;
|
||||
mChaletMainStatus.mLostRequestPercentage = mLostRequestPercentage;
|
||||
@ -1,9 +1,9 @@
|
||||
#ifndef CCHALETLORADEVICE_H
|
||||
#define CCHALETLORADEVICE_H
|
||||
#ifndef CCHALETDEVICE_H
|
||||
#define CCHALETDEVICE_H
|
||||
#include <QByteArray>
|
||||
#include <QObject>
|
||||
#include <QSerialPort>
|
||||
#include "LoraNetworkCommIF.h"
|
||||
#include "NetworkProtocol.h"
|
||||
#include "NetworkDevice.h"
|
||||
#include <QTimer>
|
||||
#include "ChaletData.h"
|
||||
@ -26,16 +26,17 @@
|
||||
#define LORA_CHALET_STATUS_POWER_RELAY_MASK 0x01
|
||||
#define LORA_CHALET_STATUS_CUR_SENSOR_MASK 0x02
|
||||
|
||||
class CChaletLoraDevice : public QObject, public CNetworkDevice
|
||||
class CChaletDevice : public QObject, public CNetworkDevice
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CChaletLoraDevice(int Address,CAbstractNetworkCommIF *NetworkInterface);
|
||||
~CChaletLoraDevice();
|
||||
CChaletDevice(int Address,CAbstractNetworkCommIF *NetworkInterface);
|
||||
~CChaletDevice();
|
||||
|
||||
virtual int NewDeviceFrameReceived(int DeviceID, int DeviceAddress, int MessageID, int DataSize, QByteArray Data);
|
||||
|
||||
QString mChaletName;
|
||||
QTimer *mChaletStatusTimer;
|
||||
int Start();
|
||||
|
||||
@ -73,6 +74,7 @@ public:
|
||||
int SendSetWifiParams(QByteArray Data);
|
||||
int SendGetFirmwareVersion();
|
||||
int SendClearCommStatsRequest();
|
||||
int SendGetWifiStatusRequest();
|
||||
|
||||
int CmdResponseReceived(int CmdID);
|
||||
int ScheduleChaletStatusRequest();
|
||||
@ -85,10 +87,11 @@ signals:
|
||||
void DeviceWifiStoredParamsReceived();
|
||||
void DeviceWifiSetParamsResult(char);
|
||||
void DeviceFirmwareVersionReceived();
|
||||
void DeviceWifiStatusReceived(QByteArray);
|
||||
|
||||
public slots:
|
||||
void CommTimerExpired();
|
||||
|
||||
};
|
||||
|
||||
#endif // CCHALETLORADEVICE_H
|
||||
#endif // CCHALETDEVICE_H
|
||||
@ -1,7 +1,7 @@
|
||||
#include "ChaletInterface.h"
|
||||
#include "ChaletDataLogger.h"
|
||||
|
||||
CChaletInterface::CChaletInterface(int Address, CAbstractNetworkCommIF *NetworkInterface, CChaletLoraDevice *DevicePtr):
|
||||
CChaletInterface::CChaletInterface(int Address, CAbstractNetworkCommIF *NetworkInterface, CChaletDevice *DevicePtr):
|
||||
CNetworkDevice(ID_CHALET_INTERFACE,Address,NetworkInterface)
|
||||
{
|
||||
mChaletLoraDevice = DevicePtr;
|
||||
@ -9,6 +9,7 @@ CChaletInterface::CChaletInterface(int Address, CAbstractNetworkCommIF *NetworkI
|
||||
|
||||
connect(mChaletLoraDevice,SIGNAL(DeviceWifiStoredParamsReceived()),this,SLOT(DeviceWiFiDataReceived()));
|
||||
connect(mChaletLoraDevice,SIGNAL(DeviceFirmwareVersionReceived()),this,SLOT(DeviceFirmwareVersionReceived()));
|
||||
connect(mChaletLoraDevice,SIGNAL(DeviceWifiStatusReceived(QByteArray)),this,SLOT(DeviceWifiStatusReceived(QByteArray)));
|
||||
|
||||
}
|
||||
|
||||
@ -119,6 +120,11 @@ int CChaletInterface::NewDeviceFrameReceived(int DeviceID, int DeviceAddress, in
|
||||
// mChaletLoraDevice->ResetCommStats();
|
||||
break;
|
||||
}
|
||||
case CHALET_INTERFACE_GET_WIFI_STATUS_REQUEST:
|
||||
{
|
||||
mChaletLoraDevice->SendGetWifiStatusRequest();
|
||||
break;
|
||||
}
|
||||
case CHALET_INTERFACE_WIFI_GET_DEVICE_PARAMS_RESPONSE:
|
||||
case CHALET_INTERFACE_WIFI_SET_DEVICE_PARAMS_RESPONSE:
|
||||
case CHALET_INTERFACE_GET_DATA_LOG_RESPONSE:
|
||||
@ -129,6 +135,7 @@ int CChaletInterface::NewDeviceFrameReceived(int DeviceID, int DeviceAddress, in
|
||||
case CHALET_INTERFACE_BATTERY_VOLTAGE_RESPONSE:
|
||||
case CHALET_INTERFACE_WIFI_SET_STATE_RESPONSE:
|
||||
case CHALET_INTERFACE_CLEAR_COMMS_STATS_RESPONSE:
|
||||
case CHALET_INTERFACE_GET_WIFI_STATUS_RESPONSE:
|
||||
{
|
||||
break;
|
||||
|
||||
@ -160,3 +167,8 @@ void CChaletInterface::DeviceFirmwareVersionReceived()
|
||||
QByteArray Data = mChaletLoraDevice->GetDeviceFirmwareVersion();
|
||||
mNetworkInterfacePtr->SendNetworkMessage(ID_CHALET_INTERFACE,mDeviceAddress,CHALET_INTERFACE_GET_FIRMWARE_VERSION_RESPONSE,Data.size(),&Data);
|
||||
}
|
||||
|
||||
void CChaletInterface::DeviceWifiStatusReceived(QByteArray Data)
|
||||
{
|
||||
mNetworkInterfacePtr->SendNetworkMessage(ID_CHALET_INTERFACE,mDeviceAddress,CHALET_INTERFACE_GET_WIFI_STATUS_RESPONSE,Data.size(),&Data);
|
||||
}
|
||||
|
||||
@ -3,24 +3,25 @@
|
||||
|
||||
#include "NetworkDevice.h"
|
||||
|
||||
#include "ChaletLoraDevice.h"
|
||||
#include "ChaletDevice.h"
|
||||
|
||||
class CChaletInterface: public QObject, public CNetworkDevice
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
CChaletInterface(int Address, CAbstractNetworkCommIF *NetworkInterface, CChaletLoraDevice *DevicePtr);
|
||||
CChaletInterface(int Address, CAbstractNetworkCommIF *NetworkInterface, CChaletDevice *DevicePtr);
|
||||
virtual int NewDeviceFrameReceived(int DeviceID, int DeviceAddress, int MessageID, int DataSize, QByteArray Data);
|
||||
|
||||
void SendChaletCommActivityBeacon();
|
||||
private:
|
||||
CChaletLoraDevice *mChaletLoraDevice;
|
||||
CChaletDevice *mChaletLoraDevice;
|
||||
CChaletDataLogger *mChaletDataLogger;
|
||||
|
||||
public slots:
|
||||
void DeviceWiFiDataReceived();
|
||||
void DeviceFirmwareVersionReceived();
|
||||
void DeviceWifiStatusReceived(QByteArray Data);
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
#include <QObject>
|
||||
#include <ModbusBackend.h>
|
||||
|
||||
class CChaletLoraDevice;
|
||||
class CChaletDevice;
|
||||
|
||||
class CChaletModbusServer : public CModbusBackend
|
||||
{
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
#include <QNetworkReply>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include "ChaletLoraDevice.h"
|
||||
#include "ChaletDevice.h"
|
||||
|
||||
|
||||
CThingsBoardInterface::CThingsBoardInterface()
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
#ifndef THINGSBOARDINTERFACE_H
|
||||
#define THINGSBOARDINTERFACE_H
|
||||
|
||||
class CChaletLoraDevice;
|
||||
class CChaletDevice;
|
||||
|
||||
#include <QObject>
|
||||
#include <QNetworkAccessManager>
|
||||
@ -14,7 +14,7 @@ public:
|
||||
CThingsBoardInterface();
|
||||
~CThingsBoardInterface();
|
||||
|
||||
CChaletLoraDevice *mChaletLoraDevice;
|
||||
CChaletDevice *mChaletLoraDevice;
|
||||
|
||||
int RegisterThingsboardRPC();
|
||||
void UpdateChaletVoltage(float Voltage);
|
||||
|
||||
@ -24,6 +24,8 @@ int CEthernetNetworkCommIF::SendNetworkMessage(int DeviceID, int DeviceAddress,
|
||||
// Q_UNUSED(MessageID)
|
||||
// Q_UNUSED(DataSize)
|
||||
// Q_UNUSED(Data)
|
||||
if(mTCPSocket == 0)
|
||||
return RET_ERROR;
|
||||
|
||||
QByteArray Packet;
|
||||
if(Data != 0)
|
||||
@ -34,6 +36,7 @@ int CEthernetNetworkCommIF::SendNetworkMessage(int DeviceID, int DeviceAddress,
|
||||
{
|
||||
Packet = GetTxPacket(MessageID,0,0,0,DeviceAddress,DeviceID);
|
||||
}
|
||||
|
||||
mTCPSocket->write(Packet);
|
||||
|
||||
return RET_OK;
|
||||
|
||||
@ -208,6 +208,34 @@ void CEthernetNetworkServer::DeviceSocketDataAvail()
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ID_LORA_INTERFACE_INTERFACE:
|
||||
{
|
||||
if(mDevicesMgrHandle->CreateNewLoraInterfaceInterface(DeviceAddress,(CAbstractNetworkCommIF*)NetworkIF) == RET_OK)
|
||||
{
|
||||
Result = RES_CREATION_SUCCESS;
|
||||
qDebug("Created new Lora Interface Interface in ethernet server");
|
||||
}
|
||||
else
|
||||
{
|
||||
Result = RES_CREATION_FAILED;
|
||||
qDebug("Could not create Lora Interface Interface in ethernet server");
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ID_CHALET_DEVICE:
|
||||
{
|
||||
if(mDevicesMgrHandle->BindNetworkChaletDevice(DeviceAddress,(CAbstractNetworkCommIF*)NetworkIF) == RET_OK)
|
||||
{
|
||||
Result = RES_CREATION_SUCCESS;
|
||||
qDebug("Created new Ethernet (LTE) Chalet Device in ethernet server");
|
||||
}
|
||||
else
|
||||
{
|
||||
Result = RES_CREATION_FAILED;
|
||||
qDebug("Could not create Ethernet (LTE) Chalet Device in ethernet server");
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
Result = RES_CREATION_UNKNOWN_DEVICE;
|
||||
@ -342,7 +370,7 @@ void CEthernetNetworkServer::DeviceSocketDataAvail()
|
||||
{
|
||||
break;
|
||||
}
|
||||
case PROTOCOL_RET_OK_BAD_HEADER:
|
||||
case PROTOCOL_RET_ERROR_BAD_HEADER:
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
46
Sources/Gui/LoraSettingsGui.cpp
Normal file
46
Sources/Gui/LoraSettingsGui.cpp
Normal file
@ -0,0 +1,46 @@
|
||||
#include "LoraSettingsGui.h"
|
||||
#include "ui_LoraSettingsGui.h"
|
||||
#include "ProgramSettings.h"
|
||||
|
||||
CLoraSettingsGui::CLoraSettingsGui(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::CLoraSettingsGui)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
CLoraSettingsGui::~CLoraSettingsGui()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
CLoraSettingsGui::SetSettings(CSettings *settings)
|
||||
{
|
||||
ui->mLoraAddressSpinBx->setValue(settings->mChaletLoraAddress);
|
||||
ui->mLoraChannelSpinBx->setValue(settings->mChaletLoraChannel);
|
||||
ui->mComportComboBox->setCurrentText(settings->mChaletComPort);
|
||||
ui->mUseLoraIFCheckBx->setChecked(settings->mChaletUseLoraIF);
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
quint16 CLoraSettingsGui::GetChaletLoraAddress()
|
||||
{
|
||||
quint16 Add = ui->mLoraAddressSpinBx->value();
|
||||
return Add;
|
||||
}
|
||||
|
||||
quint8 CLoraSettingsGui::GetChaletLoraChannel()
|
||||
{
|
||||
quint16 Chan = ui->mLoraChannelSpinBx->value();
|
||||
return Chan;
|
||||
}
|
||||
|
||||
QString CLoraSettingsGui::GetChaletLoraComPort()
|
||||
{
|
||||
return ui->mComportComboBox->currentText();
|
||||
}
|
||||
|
||||
bool CLoraSettingsGui::GetChaletUseLoraIF()
|
||||
{
|
||||
return ui->mUseLoraIFCheckBx->isChecked();
|
||||
}
|
||||
29
Sources/Gui/LoraSettingsGui.h
Normal file
29
Sources/Gui/LoraSettingsGui.h
Normal file
@ -0,0 +1,29 @@
|
||||
#ifndef LORASETTINGSGUI_H
|
||||
#define LORASETTINGSGUI_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
class CSettings;
|
||||
|
||||
namespace Ui {
|
||||
class CLoraSettingsGui;
|
||||
}
|
||||
|
||||
class CLoraSettingsGui : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit CLoraSettingsGui(QWidget *parent = 0);
|
||||
~CLoraSettingsGui();
|
||||
int SetSettings(CSettings* settings);
|
||||
QString GetChaletLoraComPort();
|
||||
quint8 GetChaletLoraChannel();
|
||||
quint16 GetChaletLoraAddress();
|
||||
bool GetChaletUseLoraIF();
|
||||
|
||||
private:
|
||||
Ui::CLoraSettingsGui *ui;
|
||||
};
|
||||
|
||||
#endif // LORASETTINGSGUI_H
|
||||
240
Sources/Gui/LoraSettingsGui.ui
Normal file
240
Sources/Gui/LoraSettingsGui.ui
Normal file
@ -0,0 +1,240 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CLoraSettingsGui</class>
|
||||
<widget class="QWidget" name="CLoraSettingsGui">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>553</width>
|
||||
<height>413</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>100</x>
|
||||
<y>10</y>
|
||||
<width>151</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>12</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Chalet Settings</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>110</x>
|
||||
<y>170</y>
|
||||
<width>221</width>
|
||||
<height>191</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>LoRa</string>
|
||||
</property>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>40</y>
|
||||
<width>71</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Lora Address:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>20</y>
|
||||
<width>71</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Lora Channel:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QSpinBox" name="mLoraAddressSpinBx">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>90</x>
|
||||
<y>40</y>
|
||||
<width>71</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>65535</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>6</number>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QComboBox" name="mComportComboBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>80</x>
|
||||
<y>80</y>
|
||||
<width>69</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>COM1</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>COM2</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>COM3</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>COM4</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>COM5</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>COM6</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>COM7</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>COM8</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>COM9</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>COM10</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>80</y>
|
||||
<width>51</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Com Port:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>110</y>
|
||||
<width>91</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Chalet = 7
|
||||
Chaloupe = 8</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QCheckBox" name="mUseLoraIFCheckBx">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>160</y>
|
||||
<width>191</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Use LoraInterface (restart needed)</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QSpinBox" name="mLoraChannelSpinBx">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>90</x>
|
||||
<y>20</y>
|
||||
<width>71</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>65535</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>6</number>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>200</x>
|
||||
<y>30</y>
|
||||
<width>71</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>4</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QCheckBox" name="checkBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>70</x>
|
||||
<y>60</y>
|
||||
<width>281</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Use LTE interface (restart needed)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@ -14,10 +14,13 @@ CSettingsWindow::CSettingsWindow()
|
||||
QVBoxLayout *MainLayout = new QVBoxLayout;
|
||||
QWidget *mPagesContainer = new QWidget(this);
|
||||
|
||||
mLoraSettingsPage = new CLoraSettingsGui(mPagesContainer);
|
||||
|
||||
mOptionsTabBar = new QTabBar();
|
||||
mOptionsTabBar->addTab("SMS");
|
||||
mOptionsTabBar->addTab("Network");
|
||||
mOptionsTabBar->addTab("Contacts");
|
||||
mOptionsTabBar->addTab("Chalet");
|
||||
mOptionsTabBar->resize(this->geometry().width(),mOptionsTabBar->height());
|
||||
MainLayout->addWidget(mOptionsTabBar);
|
||||
|
||||
@ -160,14 +163,22 @@ void CSettingsWindow::TabBarClicked(int TabIndex)
|
||||
{
|
||||
mSMSPage->hide();
|
||||
mContactsPage->hide();
|
||||
mLoraSettingsPage->hide();
|
||||
|
||||
}
|
||||
else if(TabIndex == 2)//Contacts
|
||||
{
|
||||
mSMSPage->hide();
|
||||
mLoraSettingsPage->hide();
|
||||
mContactsPage->show();
|
||||
|
||||
}
|
||||
else if(TabIndex == 3) //Lora
|
||||
{
|
||||
mSMSPage->hide();
|
||||
mContactsPage->hide();
|
||||
mLoraSettingsPage->show();
|
||||
}
|
||||
}
|
||||
|
||||
void CSettingsWindow::RetreiveDIDButtonClicked(bool checked)
|
||||
@ -207,6 +218,8 @@ unsigned int CSettingsWindow::SetSettingsData(CSettings *SettingsData)
|
||||
mDIDSelectionDropList->clear();
|
||||
mDIDSelectionDropList->addItem(SettingsData->mVoipMSSettings.mDefaultDID);
|
||||
mVoipMSCalendar->setSelectedDate(SettingsData->mVoipMSSettings.mStartDate);
|
||||
mLoraSettingsPage->SetSettings(SettingsData);
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
@ -219,6 +232,10 @@ void CSettingsWindow::DoneButtonClicked(bool checked)
|
||||
Settings->mVoipMSSettings.mPassword = mVoipMSPassword->text();
|
||||
Settings->mVoipMSSettings.mStartDate = mVoipMSCalendar->selectedDate();
|
||||
Settings->mVoipMSSettings.mUsername = mVoipMSUsername->text();
|
||||
Settings->mChaletComPort = mLoraSettingsPage->GetChaletLoraComPort();
|
||||
Settings->mChaletLoraAddress = mLoraSettingsPage->GetChaletLoraAddress();
|
||||
Settings->mChaletLoraChannel = mLoraSettingsPage->GetChaletLoraChannel();
|
||||
Settings->mChaletUseLoraIF = mLoraSettingsPage->GetChaletUseLoraIF();
|
||||
|
||||
mProgramHandle->SaveSettings(Settings);
|
||||
mProgramHandle->SettingsWindowClosed();
|
||||
|
||||
@ -11,6 +11,7 @@
|
||||
#include "ProgramSettings.h"
|
||||
#include "QTableWidget"
|
||||
#include <QLabel>
|
||||
#include "LoraSettingsGui.h"
|
||||
|
||||
|
||||
class CMasterCtrl;
|
||||
@ -28,6 +29,7 @@ public:
|
||||
QWidget *mSMSPage;
|
||||
QWidget *mContactsPage;
|
||||
QTabBar *mOptionsTabBar;
|
||||
CLoraSettingsGui *mLoraSettingsPage;
|
||||
|
||||
//SMS Page
|
||||
QLineEdit *mVoipMSUsername;
|
||||
|
||||
@ -6,11 +6,79 @@ CHttpServer::CHttpServer()
|
||||
mHttpServer = new QHttpServer;
|
||||
mHttpServer->route("/", []()
|
||||
{
|
||||
qDebug("Test");
|
||||
|
||||
return "Ja Mon CB!!!!";
|
||||
|
||||
// return " <!DOCTYPE html>\
|
||||
// <html>\
|
||||
// <head>\
|
||||
// <title>Page Title</title>\
|
||||
// </head>\
|
||||
// <body>\
|
||||
// \
|
||||
// <h1>This is a Heading</h1>\
|
||||
// <p>This is a paragraph.</p>\
|
||||
// \
|
||||
// </body>\
|
||||
// </html>";
|
||||
|
||||
// return " <!DOCTYPE html>\
|
||||
// <html>\
|
||||
// <body>\
|
||||
// \
|
||||
// <h1>My First JavaScript</h1>\
|
||||
// \
|
||||
// <button type=\"button\" \
|
||||
// onclick=\"document.getElementById('demo').innerHTML = Date()\">\
|
||||
// Click me to display Date and Time.</button>\
|
||||
// \
|
||||
// <p id=\"demo\"></p>\
|
||||
// \
|
||||
// </body>\
|
||||
// </html> ";
|
||||
|
||||
|
||||
return "<!DOCTYPE html>\
|
||||
<html>\
|
||||
<body>\
|
||||
\
|
||||
<h2>SVG rect Element</h2>\
|
||||
\
|
||||
<svg width=\"300\" height=\"130\">\
|
||||
<rect width=\"200\" height=\"100\" x=\"10\" y=\"10\" rx=\"20\" ry=\"20\" fill=\"blue\" />\
|
||||
Sorry, your browser does not support inline SVG. \
|
||||
</svg>\
|
||||
\
|
||||
</body>\
|
||||
</html>";
|
||||
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
mHttpServer->route("/test", []()
|
||||
{
|
||||
|
||||
|
||||
return " <!DOCTYPE html>\
|
||||
<html>\
|
||||
<head>\
|
||||
<title>Page Title</title>\
|
||||
</head>\
|
||||
<body>\
|
||||
\
|
||||
<h1>This is a Heading</h1>\
|
||||
<p>This is a paragraph.</p>\
|
||||
\
|
||||
</body>\
|
||||
</html>";
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
const auto port = mHttpServer->listen(QHostAddress::Any,8080);
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ CIspindelDevice::CIspindelDevice()
|
||||
{
|
||||
mISpindelServer = new QTcpServer;
|
||||
connect(mISpindelServer,SIGNAL(newConnection()),this,SLOT(IspindelClientConnected()));
|
||||
mISpindelServer->listen(QHostAddress::Any,90);
|
||||
mISpindelServer->listen(QHostAddress::Any,95);
|
||||
|
||||
mIspindelLog.clear();
|
||||
mDataLogger.LoadLogData(&mIspindelLog);
|
||||
@ -80,7 +80,7 @@ void CIspindelDevice::IspindelClientDataAvail()
|
||||
|
||||
void CIspindelDevice::IspindelClientDisconnected()
|
||||
{
|
||||
|
||||
qDebug("Ispindel disconnected");
|
||||
}
|
||||
|
||||
CIspindelDevice::~CIspindelDevice()
|
||||
@ -135,7 +135,7 @@ bool CIspindelDevice::DeleteSampleRequest(int SampleIndex)
|
||||
}
|
||||
|
||||
mIspindelLog.removeAt(SampleIndex);
|
||||
mDataLogger.WriteLogToFile(&mIspindelLog);
|
||||
mDataLogger.WriteLogToFile(&mIspindelLog,false);
|
||||
|
||||
return true;
|
||||
|
||||
|
||||
199
Sources/LoraModuleInterface/LoraModuleInterface.cpp
Normal file
199
Sources/LoraModuleInterface/LoraModuleInterface.cpp
Normal file
@ -0,0 +1,199 @@
|
||||
#include "LoraModuleInterface.h"
|
||||
#include <QDataStream>
|
||||
|
||||
|
||||
CLoraModuleInterface::CLoraModuleInterface()
|
||||
{
|
||||
connect(&mLoraModuleIFSerialPort,SIGNAL(readyRead()),this,SLOT(NewLoraModuleIFDataReady()));
|
||||
|
||||
mLoraModuleIFStatusTimer = new QTimer();
|
||||
mLoraModuleIFStatusTimer->setSingleShot(false);
|
||||
mLoraModuleIFStatusTimer->setInterval(1000);
|
||||
mLoraModuleIFStatusTimer->start();
|
||||
|
||||
mLoraDeviceCommSurrogate = new CNetworkCommIFSurrogate;
|
||||
mLoraDeviceCommSurrogate->mMyNetworkAddress = 1;
|
||||
mLoraDeviceCommSurrogate->mMyNetworkID = ID_MASTER;
|
||||
connect(mLoraDeviceCommSurrogate,&CNetworkCommIFSurrogate::ValidFrameReady,this,&CLoraModuleInterface::LoraRemoteDeviceDataReceived);
|
||||
|
||||
|
||||
|
||||
connect(mLoraModuleIFStatusTimer,&QTimer::timeout,this,&CLoraModuleInterface::LoraModuleStatusTimerExpired);
|
||||
|
||||
}
|
||||
|
||||
CLoraModuleInterface::~CLoraModuleInterface()
|
||||
{
|
||||
delete mLoraModuleIFStatusTimer;
|
||||
delete mLoraDeviceCommSurrogate;
|
||||
}
|
||||
|
||||
|
||||
//This the handling of the Microcontroller (LoraModuleInterface)
|
||||
int CLoraModuleInterface::NewFrameReceived(int DeviceID, int DeviceAddress, int MessageID, int DataSize, QByteArray Data)
|
||||
{
|
||||
switch(MessageID)
|
||||
{
|
||||
case LORA_IF_GET_STATUS_RESPONSE:
|
||||
{
|
||||
QDataStream Strm(Data);
|
||||
Strm >> mLoraModuleStatus;
|
||||
qDebug("Lora device status received");
|
||||
|
||||
break;
|
||||
}
|
||||
case LORA_IF_SEND_FRAME_RESPONSE:
|
||||
{
|
||||
qDebug("LoraModuleInterface sent frame to end Lora device");
|
||||
break;
|
||||
}
|
||||
case LORA_IF_NEW_FRAME_RESPONSE: //LoraInterface received a message from the Lora end point (chalet for example). Let's decode it and send it to the destination device
|
||||
{
|
||||
|
||||
//Use the surrogate to analyse the buffer. When frame is complete it will trigger a signal.
|
||||
mLoraDeviceCommSurrogate->AnalyzeRxBuffer(Data);
|
||||
|
||||
// CNetworkProtocol *mTempProtocol = new CNetworkProtocol; //Let's instanciate a temp protocol class to avoid messing with our own derived class...
|
||||
// int FwdDeviceID;
|
||||
// int FwdDeviceAddress;
|
||||
// int FwdMessageID;
|
||||
// int FwdDataSize;
|
||||
// QByteArray FwdData;
|
||||
// if(mTempProtocol->ProtocolAnalyseBufferStatically(Data,FwdDeviceID,FwdDeviceAddress,FwdMessageID,FwdDataSize,FwdData) == PROTOCOL_RET_OK_PACKET_COMPLETE)
|
||||
// {
|
||||
// mDevicePtr->NewDeviceFrameReceived(FwdDeviceID,FwdDeviceAddress,FwdMessageID,FwdDataSize,FwdData);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// qDebug("LoraModuleInterface received an invalid packet from end Lora device in NewFrameReceived");
|
||||
// }
|
||||
|
||||
// delete mTempProtocol;
|
||||
|
||||
break;
|
||||
}
|
||||
case LORA_IF_GET_MODULE_CONFIG_RESPONSE:
|
||||
{
|
||||
break;
|
||||
}
|
||||
case LORA_IF_GET_RSSI_RESPONSE:
|
||||
{
|
||||
break;
|
||||
}
|
||||
case LORA_IF_SET_MODULE_CONFIG_RESPONSE:
|
||||
{
|
||||
break;
|
||||
}
|
||||
case LORA_IF_GET_STATUS_REQUEST:
|
||||
case LORA_IF_SEND_FRAME_REQUEST:
|
||||
case LORA_IF_GET_MODULE_CONFIG_REQUEST:
|
||||
case LORA_IF_GET_RSSI_REQUEST:
|
||||
case LORA_IF_SET_MODULE_CONFIG_REQUEST:
|
||||
default:
|
||||
{
|
||||
qDebug("CLoraModuleInterface: Received invalid response from LoraModule: %d",MessageID);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
//This is the CAbstractNetworkCommIF class implementation (to answer to CChaletDevice requests).
|
||||
int CLoraModuleInterface::SendNetworkMessage(int DeviceID, int DeviceAddress, int MessageID, int DataSize, QByteArray *Data)
|
||||
{
|
||||
qDebug("LoraInterfce: New frame received from MasterCtrl class");
|
||||
|
||||
|
||||
//Get the payload by building the Msg packet
|
||||
QByteArray Payload = GetTxPacket(MessageID,0,Data->data(),DataSize,DeviceAddress,DeviceID);
|
||||
|
||||
//Prepend the destination lora address & channel
|
||||
Payload.prepend(mLoraPreamble);
|
||||
// Payload.prepend(mDestLoraAddress);
|
||||
// Payload.prepend((char)(mDestLoraChannel &0x00FF));
|
||||
// Payload.prepend((char)((mDestLoraAddress >>8)));
|
||||
|
||||
//Now get the packet to communicate with LoraInterface uC
|
||||
QByteArray Packet = GetTxPacket(LORA_IF_SEND_FRAME_REQUEST,0,Payload,Payload.size(),1,ID_LORA_INTERFACE_DEVICE);
|
||||
mLoraModuleIFSerialPort.write(Packet);
|
||||
mLoraModuleIFSerialPort.waitForBytesWritten(500);
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CLoraModuleInterface::LoraModuleStatusTimerExpired()
|
||||
{
|
||||
QByteArray Packet = GetTxPacket(LORA_IF_GET_STATUS_REQUEST,0,0,0,1,ID_LORA_INTERFACE_DEVICE);
|
||||
mLoraModuleIFSerialPort.write(Packet);
|
||||
mLoraModuleIFSerialPort.waitForBytesWritten(500);
|
||||
}
|
||||
|
||||
int CLoraModuleInterface::SetLoraModuleInterfaceParameters(QString ComPort, qint32 BaudRate)
|
||||
{
|
||||
mLoraModuleIFComPortName = ComPort;
|
||||
mLoraModuleIFComPortBaudRate = BaudRate;
|
||||
|
||||
|
||||
if(mLoraModuleIFSerialPort.isOpen())
|
||||
{
|
||||
mLoraModuleIFSerialPort.close();
|
||||
}
|
||||
|
||||
mLoraModuleIFSerialPort.setPortName(mLoraModuleIFComPortName);
|
||||
if(mLoraModuleIFSerialPort.setBaudRate(mLoraModuleIFComPortBaudRate) == false)
|
||||
{
|
||||
qDebug("Invalid Lora Device serial port baud rate...");
|
||||
}
|
||||
|
||||
//The other serial port parameters (parity, stop bits, data bits) are all set to mentally sane default values so no need to set them.
|
||||
if(mLoraModuleIFSerialPort.open(QIODevice::ReadWrite) == false)
|
||||
{
|
||||
qDebug("Could not open Lora device port");
|
||||
return RET_ERROR;
|
||||
}
|
||||
|
||||
qDebug("LoraModuleInterface serial port opened");
|
||||
return RET_OK;
|
||||
|
||||
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
int CLoraModuleInterface::SetLoraDestinationAddress(quint16 Address, quint8 Channel)
|
||||
{
|
||||
mDestLoraAddress = Address;
|
||||
mDestLoraChannel = Channel;
|
||||
mLoraPreamble.clear();
|
||||
mLoraPreamble.append(mDestLoraChannel);
|
||||
mLoraPreamble.prepend((char)(mDestLoraAddress &0x00FF));
|
||||
mLoraPreamble.prepend((char)((mDestLoraAddress >>8)));
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
void CLoraModuleInterface::NewLoraModuleIFDataReady()
|
||||
{
|
||||
QByteArray NewData = mLoraModuleIFSerialPort.readAll();
|
||||
|
||||
AnalyzeRxBuffer(NewData);
|
||||
}
|
||||
|
||||
void CLoraModuleInterface::LoraRemoteDeviceDataReceived(int FwdDeviceID, int FwdDeviceAddress, int FwdMessageID, int FwdDataSize, QByteArray FwdData)
|
||||
{
|
||||
//Multiple devices could be connected to the interface. Find the sender
|
||||
//NOTE: This needs a major rework of the inheritance scheme!
|
||||
|
||||
QObject *SenderObj = QObject::sender();
|
||||
if(SenderObj == mLoraDeviceCommSurrogate)
|
||||
{
|
||||
mDevicePtr->NewDeviceFrameReceived(FwdDeviceID,FwdDeviceAddress,FwdMessageID,FwdDataSize,FwdData);
|
||||
}
|
||||
}
|
||||
|
||||
void CLoraModuleInterface::LoraRemoteDeviceReceiveError(CNetworkProtocol::ProtocolRetValues RetID)
|
||||
{
|
||||
|
||||
}
|
||||
56
Sources/LoraModuleInterface/LoraModuleInterface.h
Normal file
56
Sources/LoraModuleInterface/LoraModuleInterface.h
Normal file
@ -0,0 +1,56 @@
|
||||
#ifndef LORAMODULEINTERFACE_H
|
||||
#define LORAMODULEINTERFACE_H
|
||||
|
||||
#include <QByteArray>
|
||||
#include <QObject>
|
||||
#include <QSerialPort>
|
||||
#include "NetworkProtocol.h"
|
||||
#include "AbstractNetworkInterface.h"
|
||||
#include "NetworkDevice.h"
|
||||
#include <QTimer>
|
||||
#include <QSerialPort>
|
||||
#include <QByteArrayList>
|
||||
#include "NetworkCommIFSurrogate.h"
|
||||
#include "LoraModuleInterfaceData.h"
|
||||
|
||||
|
||||
class CLoraModuleInterface : public QObject, public CNetworkProtocol, public CAbstractNetworkCommIF
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CLoraModuleInterface();
|
||||
virtual ~CLoraModuleInterface();
|
||||
|
||||
int SetLoraModuleInterfaceParameters(QString ComPort,qint32 BaudRate);
|
||||
int SetLoraDestinationAddress(quint16 Address, quint8 Channel);
|
||||
CLoraModuleInterfaceStatus GetModuleIFStatus() {return mLoraModuleStatus;}
|
||||
|
||||
QTimer *mLoraModuleIFStatusTimer;
|
||||
QSerialPort mLoraModuleIFSerialPort;
|
||||
QString mLoraModuleIFComPortName;
|
||||
qint32 mLoraModuleIFComPortBaudRate;
|
||||
CNetworkCommIFSurrogate *mLoraDeviceCommSurrogate;
|
||||
unsigned short mDestLoraAddress;
|
||||
unsigned char mDestLoraChannel;
|
||||
QByteArray mLoraPreamble;
|
||||
|
||||
CLoraModuleInterfaceStatus mLoraModuleStatus;
|
||||
|
||||
|
||||
|
||||
//NetworkProtocol implementation
|
||||
virtual int NewFrameReceived(int DeviceID, int DeviceAddress, int MessageID, int DataSize, QByteArray Data);
|
||||
|
||||
//NetworkCommIF implementation
|
||||
virtual int SendNetworkMessage(int DeviceID, int DeviceAddress, int MessageID, int DataSize, QByteArray *Data);
|
||||
|
||||
public slots:
|
||||
void LoraModuleStatusTimerExpired();
|
||||
void NewLoraModuleIFDataReady();
|
||||
|
||||
void LoraRemoteDeviceDataReceived(int DeviceID, int DeviceAddress, int MessageID, int DataSize, QByteArray Data);
|
||||
void LoraRemoteDeviceReceiveError(CNetworkProtocol::ProtocolRetValues RetID);
|
||||
};
|
||||
|
||||
#endif // LORAMODULEINTERFACE_H
|
||||
90
Sources/LoraModuleInterface/LoraModuleInterfaceData.cpp
Normal file
90
Sources/LoraModuleInterface/LoraModuleInterfaceData.cpp
Normal file
@ -0,0 +1,90 @@
|
||||
#include "LoraModuleInterfaceData.h"
|
||||
|
||||
CLoraModuleInterfaceStatus::CLoraModuleInterfaceStatus()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CLoraModuleInterfaceStatus& CLoraModuleInterfaceStatus::operator = (const CLoraModuleInterfaceStatus &rhs)
|
||||
{
|
||||
if(this == &rhs)
|
||||
return *this;
|
||||
|
||||
mModuleModel = rhs.mModuleModel;
|
||||
mModuleInternalAddress = rhs.mModuleInternalAddress;
|
||||
mModuleUARTParity = rhs.mModuleUARTParity;
|
||||
mModuleUARTRate = rhs.mModuleUARTRate;
|
||||
mModuleAirRate = rhs.mModuleAirRate;
|
||||
mModuleSubPacket = rhs.mModuleSubPacket;
|
||||
mModuleRSSIEnabled = rhs.mModuleRSSIEnabled;
|
||||
mModuleTxPower = rhs.mModuleTxPower;
|
||||
mModuleInternalChannel = rhs.mModuleInternalChannel;
|
||||
mModuleRSSIByteEnabled = rhs.mModuleRSSIByteEnabled;
|
||||
mModuleTxMethod = rhs.mModuleTxMethod;
|
||||
mModuleLBTEnabled = rhs.mModuleLBTEnabled;
|
||||
mModuleWORCycle = rhs.mModuleWORCycle;
|
||||
mModuleAmbientRSSI = rhs.mModuleAmbientRSSI;
|
||||
mModuleLastRxRSSI = rhs.mModuleLastRxRSSI;
|
||||
|
||||
mIPAddress1 = rhs.mIPAddress1;
|
||||
mIPAddress2 = rhs.mIPAddress2;
|
||||
mIPAddress3 = rhs.mIPAddress3;
|
||||
mIPAddress4 = rhs.mIPAddress4;
|
||||
|
||||
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
QDataStream &operator<<(QDataStream &out, const CLoraModuleInterfaceStatus &source)
|
||||
{
|
||||
out << source.mModuleModel
|
||||
<< source.mModuleInternalAddress
|
||||
<< source.mModuleUARTParity
|
||||
<< source.mModuleUARTRate
|
||||
<< source.mModuleAirRate
|
||||
<< source.mModuleSubPacket
|
||||
<< source.mModuleRSSIEnabled
|
||||
<< source.mModuleTxPower
|
||||
<< source.mModuleInternalChannel
|
||||
<< source.mModuleRSSIByteEnabled
|
||||
<< source.mModuleTxMethod
|
||||
<< source.mModuleLBTEnabled
|
||||
<< source.mModuleWORCycle
|
||||
<< source.mModuleAmbientRSSI
|
||||
<< source.mModuleLastRxRSSI
|
||||
<< source.mIPAddress1
|
||||
<< source.mIPAddress2
|
||||
<< source.mIPAddress3
|
||||
<< source.mIPAddress4;
|
||||
|
||||
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
QDataStream &operator>>(QDataStream &in, CLoraModuleInterfaceStatus &dest)
|
||||
{
|
||||
in >> dest.mModuleModel
|
||||
>> dest.mModuleInternalAddress
|
||||
>> dest.mModuleUARTParity
|
||||
>> dest.mModuleUARTRate
|
||||
>> dest.mModuleAirRate
|
||||
>> dest.mModuleSubPacket
|
||||
>> dest.mModuleRSSIEnabled
|
||||
>> dest.mModuleTxPower
|
||||
>> dest.mModuleInternalChannel
|
||||
>> dest.mModuleRSSIByteEnabled
|
||||
>> dest.mModuleTxMethod
|
||||
>> dest.mModuleLBTEnabled
|
||||
>> dest.mModuleWORCycle
|
||||
>> dest.mModuleAmbientRSSI
|
||||
>> dest.mModuleLastRxRSSI
|
||||
>> dest.mIPAddress1
|
||||
>> dest.mIPAddress2
|
||||
>> dest.mIPAddress3
|
||||
>> dest.mIPAddress4;
|
||||
|
||||
|
||||
return in;
|
||||
}
|
||||
110
Sources/LoraModuleInterface/LoraModuleInterfaceData.h
Normal file
110
Sources/LoraModuleInterface/LoraModuleInterfaceData.h
Normal file
@ -0,0 +1,110 @@
|
||||
#ifndef LORAMODULEINTERFACEDATA_H
|
||||
#define LORAMODULEINTERFACEDATA_H
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QDataStream>
|
||||
|
||||
class CLoraModuleInterfaceStatus
|
||||
{
|
||||
public:
|
||||
|
||||
enum eE220UartRates
|
||||
{
|
||||
E220_UART_1200 = 0,
|
||||
E220_UART_2400,
|
||||
E220_UART_4800,
|
||||
E220_UART_9600,
|
||||
E220_UART_19200,
|
||||
E220_UART_38400,
|
||||
E220_UART_57600,
|
||||
E220_UART_115200
|
||||
|
||||
};
|
||||
|
||||
|
||||
enum eE220ParityBit
|
||||
{
|
||||
E220_UART_8N1=0,
|
||||
E220_UART_8O1,
|
||||
E220_UART_8E1,
|
||||
E220_UART_8N1_bis
|
||||
};
|
||||
|
||||
|
||||
enum e220AirDataRates
|
||||
{
|
||||
E220_AIR_RATE_24K = 0,
|
||||
E220_AIR_RATE_24K_1,
|
||||
E220_AIR_RATE_24K_2,
|
||||
E220_AIR_RATE_48K,
|
||||
E220_AIR_RATE_96K,
|
||||
E220_AIR_RATE_192K,
|
||||
E220_AIR_RATE_384K,
|
||||
E220_AIR_RATE_625K
|
||||
};
|
||||
|
||||
|
||||
enum e220PacketSizes
|
||||
{
|
||||
E220_PACKET_200,
|
||||
E220_PACKET_128,
|
||||
E220_PACKET_64,
|
||||
E220_PACKET_32
|
||||
};
|
||||
|
||||
|
||||
enum e220TransmitPower
|
||||
{
|
||||
E220_TX_PWR_30,
|
||||
E220_TX_PWR_27,
|
||||
E220_TX_PWR_24,
|
||||
E220_TX_PWR_21
|
||||
};
|
||||
|
||||
|
||||
enum e220WORCycles
|
||||
{
|
||||
E220_WOR_500MS,
|
||||
E220_WOR_1000MS,
|
||||
E220_WOR_1500MS,
|
||||
E220_WOR_2000MS,
|
||||
E220_WOR_2500MS,
|
||||
E220_WOR_3000MS,
|
||||
E220_WOR_3500MS,
|
||||
E220_WOR_4000MS
|
||||
};
|
||||
|
||||
|
||||
|
||||
CLoraModuleInterfaceStatus();
|
||||
|
||||
quint8 mModuleModel;
|
||||
quint16 mModuleInternalAddress;
|
||||
quint8 mModuleUARTParity;
|
||||
quint8 mModuleUARTRate;
|
||||
quint8 mModuleAirRate;
|
||||
quint8 mModuleSubPacket;
|
||||
quint8 mModuleRSSIEnabled;
|
||||
quint8 mModuleTxPower;
|
||||
quint8 mModuleInternalChannel;
|
||||
quint8 mModuleRSSIByteEnabled;
|
||||
quint8 mModuleTxMethod;
|
||||
quint8 mModuleLBTEnabled;
|
||||
quint8 mModuleWORCycle;
|
||||
|
||||
quint8 mModuleAmbientRSSI;
|
||||
quint8 mModuleLastRxRSSI;
|
||||
|
||||
quint8 mIPAddress1;
|
||||
quint8 mIPAddress2;
|
||||
quint8 mIPAddress3;
|
||||
quint8 mIPAddress4;
|
||||
|
||||
CLoraModuleInterfaceStatus& operator=(const CLoraModuleInterfaceStatus &rhs);
|
||||
|
||||
};
|
||||
|
||||
QDataStream &operator<<(QDataStream &out, const CLoraModuleInterfaceStatus &source);
|
||||
QDataStream &operator>>(QDataStream &in, CLoraModuleInterfaceStatus &dest);
|
||||
|
||||
#endif // LORAMODULEINTERFACEDATA_H
|
||||
39
Sources/LoraModuleInterface/LoraModuleInterfaceInterface.cpp
Normal file
39
Sources/LoraModuleInterface/LoraModuleInterfaceInterface.cpp
Normal file
@ -0,0 +1,39 @@
|
||||
#include "LoraModuleInterfaceInterface.h"
|
||||
|
||||
|
||||
CLoraModuleInterfaceInterface::CLoraModuleInterfaceInterface(int Address, CAbstractNetworkCommIF *NetworkInterface, CLoraModuleInterface *DevicePtr):
|
||||
CNetworkDevice(ID_LORA_INTERFACE_INTERFACE,Address,NetworkInterface)
|
||||
{
|
||||
mLoraModuleIFPtr = DevicePtr;
|
||||
}
|
||||
|
||||
int CLoraModuleInterfaceInterface::NewDeviceFrameReceived(int DeviceID, int DeviceAddress, int MessageID, int DataSize, QByteArray Data)
|
||||
{
|
||||
Q_UNUSED(DeviceID)
|
||||
Q_UNUSED(DeviceAddress)
|
||||
Q_UNUSED(DataSize)
|
||||
Q_UNUSED(Data)
|
||||
|
||||
switch(MessageID)
|
||||
{
|
||||
case LORA_MODULE_IF_INTERFACE_ACK:
|
||||
{
|
||||
break;
|
||||
}
|
||||
case LORA_MODULE_IF_INTERFACE_GENERAL_STATUS_REQUEST:
|
||||
{
|
||||
QByteArray StatusData;
|
||||
QDataStream Strm(&StatusData,QIODevice::WriteOnly);
|
||||
Strm << mLoraModuleIFPtr->GetModuleIFStatus();
|
||||
mNetworkInterfacePtr->SendNetworkMessage(ID_LORA_INTERFACE_INTERFACE,mDeviceAddress,LORA_MODULE_IF_INTERFACE_GENERAL_STATUS_RESPONSE,StatusData.size(),&StatusData);
|
||||
break;
|
||||
}
|
||||
case LORA_MODULE_IF_INTERFACE_GENERAL_STATUS_RESPONSE:
|
||||
{
|
||||
qDebug("CLoraModuleInterfaceInterface : Received an invalid command from remote");
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
return RET_OK;
|
||||
}
|
||||
22
Sources/LoraModuleInterface/LoraModuleInterfaceInterface.h
Normal file
22
Sources/LoraModuleInterface/LoraModuleInterfaceInterface.h
Normal file
@ -0,0 +1,22 @@
|
||||
#ifndef LORAMODULEINTERFACEINTERFACE_H
|
||||
#define LORAMODULEINTERFACEINTERFACE_H
|
||||
|
||||
#include <QObject>
|
||||
#include "NetworkDevice.h"
|
||||
#include "LoraModuleInterface.h"
|
||||
|
||||
class CLoraModuleInterfaceInterface: public QObject, public CNetworkDevice
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit CLoraModuleInterfaceInterface(int Address, CAbstractNetworkCommIF *NetworkInterface, CLoraModuleInterface *DevicePtr);
|
||||
virtual int NewDeviceFrameReceived(int DeviceID, int DeviceAddress, int MessageID, int DataSize, QByteArray Data);
|
||||
|
||||
CLoraModuleInterface *mLoraModuleIFPtr;
|
||||
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
};
|
||||
|
||||
#endif // LORAMODULEINTERFACEINTERFACE_H
|
||||
@ -10,6 +10,9 @@ CLoraNetworkCommIF::CLoraNetworkCommIF()
|
||||
mLoraMagicResponse.append(0xAD);
|
||||
mLoraMagicResponse.append(0xBE);
|
||||
mLoraMagicResponse.append(0xEF);
|
||||
|
||||
mDestLoraAddress = 6;
|
||||
mDestLoraChannel = 4;
|
||||
}
|
||||
|
||||
QByteArray CLoraNetworkCommIF::GetLoraFrame(unsigned short DestAddress, unsigned char DestChannel, QByteArray Payload)
|
||||
@ -63,6 +66,7 @@ int CLoraNetworkCommIF::SendLoraFrame(unsigned short DestAddress, unsigned char
|
||||
{
|
||||
|
||||
mLoraDeviceSerialPort.write(GetLoraFrame(DestAddress,DestChannel,Payload));
|
||||
// mLoraDeviceSerialPort.write(Payload);
|
||||
mLoraDeviceSerialPort.waitForBytesWritten(500);
|
||||
return RET_OK;
|
||||
|
||||
@ -108,7 +112,15 @@ int CLoraNetworkCommIF::NewFrameReceived(int DeviceID, int DeviceAddress, int Me
|
||||
int CLoraNetworkCommIF::SendNetworkMessage(int DeviceID, int DeviceAddress, int MessageID, int DataSize, QByteArray *Data)
|
||||
{
|
||||
QByteArray Packet = GetTxPacket(MessageID,0,Data->data(),DataSize,DeviceAddress,DeviceID);
|
||||
SendLoraFrame(6,4,Packet); //channel 6 = chalet
|
||||
//SendLoraFrame(6,4,Packet); //channel 6 = chalet
|
||||
//SendLoraFrame(7,4,Packet); //channel 7 = chaloupe
|
||||
SendLoraFrame(mDestLoraAddress,mDestLoraChannel,Packet);
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
int CLoraNetworkCommIF::SetLoraDestinationAddress(quint16 Address, quint8 Channel)
|
||||
{
|
||||
mDestLoraAddress = Address;
|
||||
mDestLoraChannel = Channel;
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
@ -22,10 +22,13 @@ public:
|
||||
|
||||
unsigned short mMyLoraAddress;
|
||||
unsigned char mMyLoraChannel;
|
||||
unsigned short mDestLoraAddress;
|
||||
unsigned char mDestLoraChannel;
|
||||
QSerialPort mLoraDeviceSerialPort;
|
||||
|
||||
int SendLoraFrame(unsigned short DestAddress,unsigned char DestChannel,QByteArray Payload);
|
||||
int SetLoraSerialPortSettings(QString PortName, qint32 BaudRate);
|
||||
int SetLoraDestinationAddress(quint16 Address, quint8 Channel);
|
||||
|
||||
//NetworkProtocol implementation
|
||||
int NewFrameReceived(int DeviceID, int DeviceAddress, int MessageID, int DataSize, QByteArray Data);
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
#include "MasterCtrl.h"
|
||||
#include <QApplication>
|
||||
#include "EthernetNetworkCommIF.h"
|
||||
|
||||
// #include <QByteArray>
|
||||
//#include <QBuffer>
|
||||
@ -7,6 +8,10 @@
|
||||
CMasterCtrl::CMasterCtrl()
|
||||
{
|
||||
qDebug("Creation...");
|
||||
|
||||
mChaletLoraModuleInterface = 0;
|
||||
mChaletLoraNetworkCommInterface = 0;
|
||||
|
||||
// mDeadBoltDevice = new CDeadboltDevice(1);
|
||||
mAVReceiverDevice = new CAVReceiverDevice();
|
||||
mVoipMsSMSClient = new CVoipMsSMSClient;
|
||||
@ -15,12 +20,30 @@ CMasterCtrl::CMasterCtrl()
|
||||
mSettingsWindow = new CSettingsWindow();
|
||||
mSettingsWindow->mProgramHandle = this;
|
||||
|
||||
mChaletLoraNetworkCommInterface = new CLoraNetworkCommIF();
|
||||
mChaletLoraNetworkCommInterface->mMyLoraAddress = 5;
|
||||
mChaletLoraNetworkCommInterface->mMyLoraChannel = 4;
|
||||
mChaletLoraDevice = new CChaletLoraDevice(1,mChaletLoraNetworkCommInterface);
|
||||
mSettingsManager.LoadSettings(&mMasterCtrlSettings);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if(mMasterCtrlSettings.mChaletUseLoraIF == true)
|
||||
{
|
||||
mChaletLoraModuleInterface = new CLoraModuleInterface(); //JFM LoraInterface Dev
|
||||
mChaletLoraDevice = new CChaletDevice(1,mChaletLoraModuleInterface); //JFM LoraInterface Dev
|
||||
}
|
||||
else
|
||||
{
|
||||
mChaletLoraNetworkCommInterface = new CLoraNetworkCommIF();//JFM LoraInterface Dev
|
||||
mChaletLoraDevice = new CChaletDevice(1,mChaletLoraNetworkCommInterface);//JFM LoraInterface Dev
|
||||
}
|
||||
|
||||
CEthernetNetworkCommIF *Dummy = new CEthernetNetworkCommIF(NULL); //No memory leak here.. object will be deleted on reasignment.
|
||||
mChaletLTEDevice = new CChaletDevice(1,(CAbstractNetworkCommIF*)Dummy);
|
||||
|
||||
|
||||
// mChaletLoraInterface = new CChaletLoraInterface(mRooftopTowerLoraDevice);
|
||||
|
||||
|
||||
mIspindelDevice = new CIspindelDevice;
|
||||
|
||||
|
||||
@ -42,7 +65,10 @@ CMasterCtrl::~CMasterCtrl()
|
||||
delete mEthernetNetworkServer;
|
||||
delete mContactsRepository;
|
||||
delete mSprinklerManager;
|
||||
delete mChaletLoraNetworkCommInterface;
|
||||
if(mChaletLoraNetworkCommInterface != 0)
|
||||
delete mChaletLoraNetworkCommInterface; //JFM LoraInterface Dev
|
||||
if(mChaletLoraModuleInterface != 0)
|
||||
delete mChaletLoraModuleInterface;
|
||||
delete mChaletLoraDevice;
|
||||
delete mIspindelDevice;
|
||||
// delete mMasterCtrlSettings;
|
||||
@ -73,6 +99,8 @@ void CMasterCtrl::Start()
|
||||
mNetworkDevicesManager->mAvReceiverDevice = mAVReceiverDevice;
|
||||
mNetworkDevicesManager->mChaletLoraDevice = mChaletLoraDevice;
|
||||
mNetworkDevicesManager->mIspindelDevice = mIspindelDevice;
|
||||
mNetworkDevicesManager->mLoraModuleInterfaceDevice = mChaletLoraModuleInterface;
|
||||
mNetworkDevicesManager->mChaletLTEDevice = mChaletLTEDevice;
|
||||
|
||||
|
||||
mEthernetNetworkServer->mDevicesMgrHandle = mNetworkDevicesManager;
|
||||
@ -85,7 +113,7 @@ void CMasterCtrl::Start()
|
||||
connect(mVoipMsSMSClient,SIGNAL(DIDSFetched(QStringList)),mSettingsWindow,SLOT(DIDsListFetched(QStringList)));
|
||||
|
||||
|
||||
mSettingsManager.LoadSettings(&mMasterCtrlSettings);
|
||||
|
||||
mSettingsWindow->SetSettingsData(&mMasterCtrlSettings);
|
||||
mVoipMsSMSClient->SetVOIPMsSettings(&mMasterCtrlSettings.mVoipMSSettings);
|
||||
mVoipMsSMSClient->DownloadSMSFromServer();
|
||||
@ -95,11 +123,33 @@ void CMasterCtrl::Start()
|
||||
|
||||
mAVReceiverDevice->Start();
|
||||
|
||||
mChaletLoraNetworkCommInterface->SetLoraSerialPortSettings("COM3",QSerialPort::Baud9600);
|
||||
//JFM LoraInterface Dev
|
||||
if(mMasterCtrlSettings.mChaletUseLoraIF)
|
||||
{
|
||||
mChaletLoraModuleInterface->SetLoraModuleInterfaceParameters(mMasterCtrlSettings.mChaletComPort,QSerialPort::Baud9600);
|
||||
mChaletLoraModuleInterface->SetLoraDestinationAddress(mMasterCtrlSettings.mChaletLoraAddress, 65 /*mMasterCtrlSettings.mChaletLoraChannel*/);
|
||||
}
|
||||
else
|
||||
{
|
||||
mChaletLoraNetworkCommInterface->mMyLoraAddress = 5;
|
||||
// mChaletLoraNetworkCommInterface->mMyLoraChannel = 4;
|
||||
mChaletLoraNetworkCommInterface->mMyLoraChannel = mMasterCtrlSettings.mChaletLoraChannel;
|
||||
mChaletLoraNetworkCommInterface->SetLoraDestinationAddress(mMasterCtrlSettings.mChaletLoraAddress,mMasterCtrlSettings.mChaletLoraChannel);
|
||||
mChaletLoraNetworkCommInterface->SetLoraSerialPortSettings(mMasterCtrlSettings.mChaletComPort,QSerialPort::Baud9600);
|
||||
}
|
||||
//JFM LoraInterface Dev
|
||||
|
||||
|
||||
|
||||
// mChaletLoraNetworkCommInterface->SetLoraSerialPortSettings("COM5",QSerialPort::Baud9600);
|
||||
mChaletLoraDevice->mChaletName = "Chalet Lora";
|
||||
mChaletLoraDevice->Start();
|
||||
|
||||
|
||||
mChaletLTEDevice->mChaletName = "Chalet LTE";
|
||||
mChaletLTEDevice->Start();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -110,7 +160,8 @@ void CMasterCtrl::Start()
|
||||
|
||||
unsigned int CMasterCtrl::QuitApplicationRequest()
|
||||
{
|
||||
QApplication::exit(69);
|
||||
// QApplication::exit(69);
|
||||
QCoreApplication::quit();
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
@ -141,6 +192,18 @@ unsigned int CMasterCtrl::SettingsWindowClosed()
|
||||
{
|
||||
mVoipMsSMSClient->SetVOIPMsSettings(&mMasterCtrlSettings.mVoipMSSettings);
|
||||
mVoipMsSMSClient->DownloadSMSFromServer();
|
||||
|
||||
if(mChaletLoraModuleInterface != 0)
|
||||
{
|
||||
mChaletLoraModuleInterface->SetLoraDestinationAddress(mMasterCtrlSettings.mChaletLoraAddress, 65 /*mMasterCtrlSettings.mChaletLoraChannel*/); //JFM LoraInterface Dev
|
||||
mChaletLoraModuleInterface->SetLoraModuleInterfaceParameters(mMasterCtrlSettings.mChaletComPort,QSerialPort::Baud9600);
|
||||
}
|
||||
if(mChaletLoraNetworkCommInterface != 0)
|
||||
{
|
||||
mChaletLoraNetworkCommInterface->mMyLoraChannel = mMasterCtrlSettings.mChaletLoraChannel;
|
||||
mChaletLoraNetworkCommInterface->SetLoraDestinationAddress(mMasterCtrlSettings.mChaletLoraAddress,mMasterCtrlSettings.mChaletLoraChannel); //JFM LoraInterface Dev
|
||||
mChaletLoraNetworkCommInterface->SetLoraSerialPortSettings(mMasterCtrlSettings.mChaletComPort,QSerialPort::Baud9600); //JFM LoraInterface Dev
|
||||
}
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
|
||||
@ -12,11 +12,12 @@
|
||||
#include "EthernetNetworkServer.h"
|
||||
#include "ContactRepository.h"
|
||||
#include "SprinklerMgr.h"
|
||||
#include "ChaletLoraDevice.h"
|
||||
#include "ChaletDevice.h"
|
||||
//#include "ChaletLoraInterface.h"
|
||||
#include "LoraNetworkCommIF.h"
|
||||
#include "HttpServer.h"
|
||||
#include "IspindelDevice.h"
|
||||
#include "LoraModuleInterface.h"
|
||||
|
||||
//#include "AppIconWidget.h"
|
||||
|
||||
@ -40,12 +41,14 @@ public:
|
||||
CContactRepository *mContactsRepository;
|
||||
CSprinklerMgr *mSprinklerManager;
|
||||
|
||||
CChaletLoraDevice *mChaletLoraDevice;
|
||||
CChaletDevice *mChaletLoraDevice;
|
||||
CChaletDevice *mChaletLTEDevice;
|
||||
// CChaletLoraInterface *mChaletLoraInterface;
|
||||
CLoraNetworkCommIF *mChaletLoraNetworkCommInterface;
|
||||
CLoraModuleInterface *mChaletLoraModuleInterface;
|
||||
// CAppIconWidget mAppWidget;
|
||||
|
||||
// CHttpServer mHttpServer;
|
||||
CHttpServer mHttpServer;
|
||||
|
||||
CIspindelDevice *mIspindelDevice;
|
||||
|
||||
|
||||
13
Sources/NetworkCommIFSurrogate.cpp
Normal file
13
Sources/NetworkCommIFSurrogate.cpp
Normal file
@ -0,0 +1,13 @@
|
||||
#include "NetworkCommIFSurrogate.h"
|
||||
|
||||
CNetworkCommIFSurrogate::CNetworkCommIFSurrogate()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int CNetworkCommIFSurrogate:: NewFrameReceived(int DeviceID, int DeviceAddress, int MessageID, int DataSize, QByteArray Data)
|
||||
{
|
||||
emit ValidFrameReady(DeviceID, DeviceAddress, MessageID, DataSize, Data);
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
21
Sources/NetworkCommIFSurrogate.h
Normal file
21
Sources/NetworkCommIFSurrogate.h
Normal file
@ -0,0 +1,21 @@
|
||||
#ifndef NETWORKCOMMIFSURROGATE_H
|
||||
#define NETWORKCOMMIFSURROGATE_H
|
||||
#include "NetworkProtocol.h"
|
||||
|
||||
//This class allows to instanciate and manage a NetworkProtocol class to decode network messages behind a proxy like LoraNetworkCommIF.
|
||||
|
||||
|
||||
class CNetworkCommIFSurrogate : public QObject, public CNetworkProtocol
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
CNetworkCommIFSurrogate();
|
||||
|
||||
virtual int NewFrameReceived(int DeviceID, int DeviceAddress, int MessageID, int DataSize, QByteArray Data);// = 0;
|
||||
|
||||
signals:
|
||||
void ValidFrameReady(int DeviceID, int DeviceAddress, int MessageID, int DataSize, QByteArray Data);
|
||||
void DataReceiveError(CNetworkProtocol::ProtocolRetValues RetID);
|
||||
};
|
||||
|
||||
#endif // NETWORKCOMMIFSURROGATE_H
|
||||
@ -5,8 +5,9 @@ CNetworkDevice::CNetworkDevice(int DeviceID, int DeviceAddress, CAbstractNetwork
|
||||
{
|
||||
mDeviceAddress = DeviceAddress;
|
||||
mDeviceID = DeviceID;
|
||||
SetNetworkInterface(Interface);
|
||||
mIsOnline = false;
|
||||
mNetworkInterfacePtr = 0;
|
||||
SetNetworkInterface(Interface);
|
||||
}
|
||||
|
||||
CNetworkDevice::~CNetworkDevice()
|
||||
@ -19,6 +20,8 @@ CNetworkDevice::~CNetworkDevice()
|
||||
|
||||
void CNetworkDevice::SetNetworkInterface(CAbstractNetworkCommIF *Interface)
|
||||
{
|
||||
if(mNetworkInterfacePtr != 0)
|
||||
delete mNetworkInterfacePtr;
|
||||
mNetworkInterfacePtr = Interface;
|
||||
if(Interface != 0)
|
||||
{
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
|
||||
|
||||
|
||||
|
||||
CNetworkDevicesMgr::CNetworkDevicesMgr()
|
||||
{
|
||||
mVoipMSInterfaceHandle = 0;
|
||||
@ -15,6 +16,7 @@ CNetworkDevicesMgr::CNetworkDevicesMgr()
|
||||
mAvReceiverDevice = 0;
|
||||
mChaletLoraDevice = 0;
|
||||
mIspindelDevice = 0;
|
||||
mLoraModuleInterfaceDevice = 0;
|
||||
}
|
||||
|
||||
CNetworkDevicesMgr::~CNetworkDevicesMgr()
|
||||
@ -100,7 +102,8 @@ int CNetworkDevicesMgr::CreateNewChaletInterface(int Address, CAbstractNetworkCo
|
||||
{
|
||||
return RET_ERROR;
|
||||
}
|
||||
CChaletInterface *ChaletInterface = new CChaletInterface(Address, NetworkIF,mChaletLoraDevice);
|
||||
// CChaletInterface *ChaletInterface = new CChaletInterface(Address, NetworkIF,mChaletLoraDevice);
|
||||
CChaletInterface *ChaletInterface = new CChaletInterface(Address, NetworkIF,mChaletLTEDevice);
|
||||
mNetworkDevicesList.append((CNetworkDevice*)ChaletInterface);
|
||||
return RET_OK;
|
||||
}
|
||||
@ -116,6 +119,25 @@ int CNetworkDevicesMgr::CreateNewIspindleInterface(int Address, CAbstractNetwork
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
int CNetworkDevicesMgr::CreateNewLoraInterfaceInterface(int Address, CAbstractNetworkCommIF *NetworkIF)
|
||||
{
|
||||
if(mLoraModuleInterfaceDevice == 0)
|
||||
{
|
||||
return RET_ERROR;
|
||||
}
|
||||
|
||||
CLoraModuleInterfaceInterface *LoraModuleIFInterface = new CLoraModuleInterfaceInterface(Address,NetworkIF,mLoraModuleInterfaceDevice);
|
||||
mNetworkDevicesList.append((CNetworkDevice*)LoraModuleIFInterface);
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
int CNetworkDevicesMgr::BindNetworkChaletDevice(int Address, CAbstractNetworkCommIF *NetworkIF)
|
||||
{
|
||||
mChaletLTEDevice->mDeviceAddress = Address;
|
||||
mChaletLTEDevice->SetNetworkInterface(NetworkIF);
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
void CNetworkDevicesMgr::EthernetNetworkDeviceDisconnected(CNetworkDevice *Device)
|
||||
{
|
||||
qDebug("Device disconnected. ID: %d, Address: %d",Device->GetDeviceID(),Device->GetDeviceAddress());
|
||||
|
||||
@ -9,6 +9,7 @@
|
||||
#include "AvReceiverInterface.h"
|
||||
#include "ChaletInterface.h"
|
||||
#include "IspindelInterface.h"
|
||||
#include "LoraModuleInterfaceInterface.h"
|
||||
|
||||
#include "QList"
|
||||
#include <QObject>
|
||||
@ -18,8 +19,9 @@ class CMasterCtrl;
|
||||
class CContactRepository;
|
||||
class CSprinklerMgr;
|
||||
class CAVReceiverDevice;
|
||||
class CChaletLoraDevice;
|
||||
class CChaletDevice;
|
||||
class CIspindelDevice;
|
||||
class CLoraModuleInterface;
|
||||
|
||||
class CNetworkDevicesMgr: public QObject
|
||||
{
|
||||
@ -37,18 +39,22 @@ public:
|
||||
int CreateNewAvReceiverInterface(int Address, CAbstractNetworkCommIF *NetworkIF);
|
||||
int CreateNewChaletInterface(int Address, CAbstractNetworkCommIF *NetworkIF);
|
||||
int CreateNewIspindleInterface(int Address, CAbstractNetworkCommIF *NetworkIF);
|
||||
int CreateNewLoraInterfaceInterface(int Address, CAbstractNetworkCommIF *NetworkIF);
|
||||
int BindNetworkChaletDevice(int Address, CAbstractNetworkCommIF *NetworkIF);
|
||||
|
||||
int FindDeviceByPtr(CNetworkDevice *Device);
|
||||
CNetworkDevice *GetDevice(int DeviceID, int Address);
|
||||
QList<CNetworkDevice*> GetDevices(int DeviceID);
|
||||
|
||||
CAVReceiverDevice *mAvReceiverDevice;
|
||||
CChaletLoraDevice *mChaletLoraDevice;
|
||||
CChaletDevice *mChaletLoraDevice;
|
||||
CIspindelDevice *mIspindelDevice;
|
||||
CVoipMsSMSClient *mVoipMSInterfaceHandle;
|
||||
CContactRepository *mContactRepositoryHandle;
|
||||
CMasterCtrl *mProgramHandle;
|
||||
CSprinklerMgr *mSprinklerMgrHandle;
|
||||
CLoraModuleInterface *mLoraModuleInterfaceDevice;
|
||||
CChaletDevice *mChaletLTEDevice;
|
||||
|
||||
int NewSMSMessagesReceived(QList<CSMSMessage> NewMessages);
|
||||
|
||||
|
||||
@ -8,6 +8,9 @@ CNetworkProtocol::CNetworkProtocol()
|
||||
mIsResetManual = false;
|
||||
ResetRxStateMachine();
|
||||
|
||||
mMyNetworkAddress = 1;
|
||||
mMyNetworkID = ID_MASTER;
|
||||
|
||||
}
|
||||
|
||||
CNetworkProtocol::~CNetworkProtocol()
|
||||
@ -155,7 +158,7 @@ QByteArray CNetworkProtocol::GetTxPacket(unsigned char MessageID, unsigned char
|
||||
// }
|
||||
//}
|
||||
|
||||
int CNetworkProtocol::RxStateMachine(unsigned char Data)
|
||||
int CNetworkProtocol::RxStateMachine(unsigned char Data, bool DoStaticAnalysis)
|
||||
{
|
||||
int ret = PROTOCOL_RET_OK_PACKET_INCOMPLETE;
|
||||
|
||||
@ -172,7 +175,7 @@ int CNetworkProtocol::RxStateMachine(unsigned char Data)
|
||||
else
|
||||
{
|
||||
ResetRxStateMachine();
|
||||
ret = PROTOCOL_RET_OK_BAD_HEADER;
|
||||
ret = PROTOCOL_RET_ERROR_BAD_HEADER;
|
||||
}
|
||||
|
||||
break;
|
||||
@ -196,7 +199,7 @@ int CNetworkProtocol::RxStateMachine(unsigned char Data)
|
||||
case RxMyID:
|
||||
{
|
||||
|
||||
if(Data != ID_MASTER && Data != 0xFF) //Message is not for Master and it's not a broadcast
|
||||
if(Data != mMyNetworkID && Data != 0xFF) //Message is not for Master and it's not a broadcast
|
||||
{
|
||||
ResetRxStateMachine();
|
||||
ret = PROTOCOL_RET_ERROR_INVALID_TARGET_DEVICE;
|
||||
@ -210,7 +213,7 @@ int CNetworkProtocol::RxStateMachine(unsigned char Data)
|
||||
}
|
||||
case RxMyAddress:
|
||||
{
|
||||
if(Data != 1 && Data != 0xFF) //Message is not for us and it's not a broadcast
|
||||
if(Data != mMyNetworkAddress && Data != 0xFF) //Message is not for us and it's not a broadcast
|
||||
{
|
||||
ResetRxStateMachine();
|
||||
ret = PROTOCOL_RET_ERROR_INVALID_TARGET_ADDRESS;
|
||||
@ -304,16 +307,20 @@ int CNetworkProtocol::RxStateMachine(unsigned char Data)
|
||||
{
|
||||
ResetRxStateMachine();
|
||||
ret = PROTOCOL_RET_ERROR_BAD_CRC;
|
||||
qDebug("LORA: Bad CRC");
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
// mDataBuffer = QByteArray(&mRxData[DATA_START],RxSize);
|
||||
NewFrameReceived(SenderID,SenderAddress,RxCmd,RxSize,mDataBuffer);
|
||||
ret = PROTOCOL_RET_OK_PACKET_COMPLETE;
|
||||
if(DoStaticAnalysis == false)
|
||||
{
|
||||
NewFrameReceived(SenderID,SenderAddress,RxCmd,RxSize,mDataBuffer);
|
||||
if(mIsResetManual == false)
|
||||
{
|
||||
ResetRxStateMachine();
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -357,7 +364,7 @@ int CNetworkProtocol::AnalyzeRxBuffer(QByteArray Buffer)
|
||||
ret = RxStateMachine(Buffer.at(i));
|
||||
if(ret != PROTOCOL_RET_OK_PACKET_INCOMPLETE)
|
||||
{
|
||||
if(ret == PROTOCOL_RET_OK_BAD_HEADER)
|
||||
if(ret == PROTOCOL_RET_ERROR_BAD_HEADER)
|
||||
{
|
||||
qDebug("Protocol Bad header");
|
||||
}
|
||||
@ -375,3 +382,47 @@ void CNetworkProtocol::SetManualPacketReset(bool Manual)
|
||||
{
|
||||
mIsResetManual = Manual;
|
||||
}
|
||||
|
||||
int CNetworkProtocol::ProtocolAnalyseBufferStatically(QByteArray InputBuffer, int &BufDeviceID, int &BufDeviceAddress, int &BufMessageID, int &BufDataSize, QByteArray &BufData)
|
||||
{
|
||||
int ret = PROTOCOL_RET_ERROR_EMPTY_BUFFER;
|
||||
for(int i = 0; i < InputBuffer.size(); i++)
|
||||
{
|
||||
ret = RxStateMachine(InputBuffer.at(i));
|
||||
if(ret != PROTOCOL_RET_OK_PACKET_INCOMPLETE)
|
||||
{
|
||||
if(ret == PROTOCOL_RET_ERROR_BAD_HEADER)
|
||||
{
|
||||
qDebug("Protocol Bad header");
|
||||
}
|
||||
if(ret == PROTOCOL_RET_OK_PACKET_COMPLETE)
|
||||
{
|
||||
BufDeviceID = SenderID;
|
||||
BufDeviceAddress = SenderAddress;
|
||||
BufMessageID = RxCmd;
|
||||
BufDataSize = RxSize;
|
||||
BufData = mDataBuffer;
|
||||
}
|
||||
|
||||
ResetRxStateMachine();
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
ResetRxStateMachine();
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool CNetworkProtocol::ProtocolIsBusyReceiving()
|
||||
{
|
||||
if(RxState == RxHeader)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int CNetworkProtocol::NewFrameReceived(int DeviceID, int DeviceAddress, int MessageID, int DataSize, QByteArray Data)
|
||||
{
|
||||
return RET_ERROR;
|
||||
}
|
||||
|
||||
@ -18,13 +18,16 @@ public:
|
||||
void PrepareForNewPacket();
|
||||
void SetManualPacketReset(bool Manual);
|
||||
|
||||
virtual int NewFrameReceived(int DeviceID, int DeviceAddress, int MessageID, int DataSize, QByteArray Data) = 0;
|
||||
virtual int NewFrameReceived(int DeviceID, int DeviceAddress, int MessageID, int DataSize, QByteArray Data);// = 0;
|
||||
|
||||
unsigned char mMyNetworkAddress;
|
||||
unsigned char mMyNetworkID;
|
||||
|
||||
enum ProtocolRetValues
|
||||
{
|
||||
PROTOCOL_RET_OK_PACKET_COMPLETE,
|
||||
PROTOCOL_RET_OK_PACKET_INCOMPLETE,
|
||||
PROTOCOL_RET_OK_BAD_HEADER,
|
||||
PROTOCOL_RET_ERROR_BAD_HEADER,
|
||||
PROTOCOL_RET_ERROR_INVALID_TARGET_DEVICE,
|
||||
PROTOCOL_RET_ERROR_INVALID_TARGET_ADDRESS,
|
||||
PROTOCOL_RET_ERROR_BAD_CRC,
|
||||
@ -37,6 +40,8 @@ public:
|
||||
int ProtocolGetCmd(){return RxCmd;}
|
||||
int ProtocolGetDataSize(){return RxSize;}
|
||||
QByteArray ProtocolGetData(){return mDataBuffer;}
|
||||
int ProtocolAnalyseBufferStatically(QByteArray InputBuffer, int &BufDeviceID, int &BufDeviceAddress, int &BufMessageID, int &BufDataSize, QByteArray &BufData);
|
||||
bool ProtocolIsBusyReceiving();
|
||||
|
||||
|
||||
private:
|
||||
@ -44,7 +49,7 @@ private:
|
||||
unsigned char CalcCRC(char *Buffer, int Size);
|
||||
// int TxData(unsigned char MessageID,unsigned char Flags,unsigned char *Data,int Size, unsigned char Address,unsigned char ID);
|
||||
|
||||
int RxStateMachine(unsigned char Data);
|
||||
int RxStateMachine(unsigned char Data, bool DoStaticAnalysis = false);
|
||||
|
||||
//State Machine states
|
||||
enum States
|
||||
|
||||
@ -51,6 +51,10 @@ void CProgramSettings::LoadDefaultSettings(CSettings *Settings)
|
||||
Settings->mVoipMSSettings.mPassword = "Voip.ms Password";
|
||||
Settings->mVoipMSSettings.mUsername = "Voip.ms Username";
|
||||
Settings->mVoipMSSettings.mStartDate = QDate::currentDate();
|
||||
Settings->mChaletComPort = "COM3";
|
||||
Settings->mChaletLoraAddress = 6;
|
||||
Settings->mChaletLoraChannel = 4;
|
||||
Settings->mChaletUseLoraIF = true;
|
||||
}
|
||||
|
||||
unsigned int CProgramSettings::SaveSettings(CSettings *SettingsData)
|
||||
@ -89,6 +93,10 @@ unsigned int CProgramSettings::SaveSettings(CSettings *SettingsData)
|
||||
QDataStream &operator<<(QDataStream &out, const CSettings &source)
|
||||
{
|
||||
out << source.mVoipMSSettings;
|
||||
out << source.mChaletComPort;
|
||||
out << source.mChaletLoraAddress;
|
||||
out << source.mChaletLoraChannel;
|
||||
out << source.mChaletUseLoraIF;
|
||||
|
||||
return out;
|
||||
}
|
||||
@ -96,6 +104,10 @@ QDataStream &operator<<(QDataStream &out, const CSettings &source)
|
||||
QDataStream &operator>>(QDataStream &in, CSettings &dest)
|
||||
{
|
||||
in >> dest.mVoipMSSettings;
|
||||
in >> dest.mChaletComPort;
|
||||
in >> dest.mChaletLoraAddress;
|
||||
in >> dest.mChaletLoraChannel;
|
||||
in >> dest.mChaletUseLoraIF;
|
||||
|
||||
return in;
|
||||
}
|
||||
@ -142,5 +154,9 @@ CSettings& CSettings::operator =(const CSettings &source)
|
||||
return *this;
|
||||
}
|
||||
this->mVoipMSSettings = source.mVoipMSSettings;
|
||||
this->mChaletComPort = source.mChaletComPort;
|
||||
this->mChaletLoraAddress = source.mChaletLoraAddress;
|
||||
this->mChaletLoraChannel = source.mChaletLoraChannel;
|
||||
this->mChaletUseLoraIF = source.mChaletUseLoraIF;
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -27,6 +27,11 @@ class CSettings
|
||||
{
|
||||
public:
|
||||
CVoipMSSMSSettings mVoipMSSettings;
|
||||
QString mChaletComPort;
|
||||
quint16 mChaletLoraAddress;
|
||||
quint8 mChaletLoraChannel;
|
||||
bool mChaletUseLoraIF;
|
||||
|
||||
|
||||
CSettings &operator=(const CSettings &source);
|
||||
};
|
||||
|
||||
@ -61,6 +61,8 @@ enum DEVICES_IDS
|
||||
ID_CHALET_INTERFACE,
|
||||
ID_CHALET_DEVICE,
|
||||
ID_ISPINDEL_INTERFACE,
|
||||
ID_LORA_INTERFACE_DEVICE,
|
||||
ID_LORA_INTERFACE_INTERFACE,
|
||||
ID_NB_DEVICE_ID
|
||||
|
||||
};
|
||||
@ -236,14 +238,24 @@ enum AV_RECEIVER_INTERFACE_CMDS
|
||||
AV_RECEIVER_INTERFACE_GENERAL_STATUS_RESPONSE,
|
||||
AV_RECEIVER_INTERFACE_SET_MAIN_POWER_REQUEST,
|
||||
AV_RECEIVER_INTERFACE_SET_MAIN_POWER_RESPONSE,
|
||||
AV_RECEIVER_INTERFACE_SET_SPEAKERB_REQUEST,
|
||||
AV_RECEIVER_INTERFACE_SET_SPEAKERB_RESPONSE,
|
||||
AV_RECEIVER_INTERFACE_SET_SPEAKERA_REQUEST,
|
||||
AV_RECEIVER_INTERFACE_SET_SPEAKERA_RESPONSE,
|
||||
AV_RECEIVER_INTERFACE_SET_ZONE2_REQUEST,
|
||||
AV_RECEIVER_INTERFACE_SET_ZONE2_RESPONSE,
|
||||
AV_RECEIVER_INTERFACE_SET_MAIN_ZONE_REQUEST,
|
||||
AV_RECEIVER_INTERFACE_SET_MAIN_ZONE_RESPONSE,
|
||||
AV_RECEIVER_INTERFACE_SET_SPEAKERS_REQUEST,
|
||||
AV_RECEIVER_INTERFACE_SET_SPEAKERS_RESPONSE,
|
||||
AV_RECEIVER_INTERFACE_SEND_DIRECT_CMD_REQUEST,
|
||||
AV_RECEIVER_INTERFACE_SEND_DIRECT_CMD_RESPONSE,
|
||||
AV_RECEIVER_INTERFACE_SELECT_SCENE_REQUEST,
|
||||
AV_RECEIVER_INTERFACE_SELECT_SCENE_RESPONSE,
|
||||
AV_RECEIVER_INTERFACE_SET_MAIN_VOLUME_REQUEST,
|
||||
AV_RECEIVER_INTERFACE_SET_MAIN_VOLUME_RESPONSE,
|
||||
AV_RECEIVER_INTERFACE_SET_ZONE2_VOLUME_REQUEST,
|
||||
AV_RECEIVER_INTERFACE_SET_ZONE2_VOLUME_RESPONSE,
|
||||
AV_RECEIVER_INTERFACE_SET_ZONE2_INPUT_REQUEST,
|
||||
AV_RECEIVER_INTERFACE_SET_ZONE2_INPUT_RESPONSE,
|
||||
AV_RECEIVER_INTERFACE_SET_SYNC_Z2_WITH_Z1_REQUEST,
|
||||
AV_RECEIVER_INTERFACE_SET_SYNC_Z2_WITH_Z1_RESPONSE,
|
||||
|
||||
|
||||
MAX_AV_RECEIVER_INTERFACE_CMD
|
||||
@ -279,6 +291,8 @@ enum CHALET_INTERFACE_CMDS
|
||||
CHALET_INTERFACE_GET_FIRMWARE_VERSION_RESPONSE,
|
||||
CHALET_INTERFACE_CLEAR_COMMS_STATS_REQUEST,
|
||||
CHALET_INTERFACE_CLEAR_COMMS_STATS_RESPONSE,
|
||||
CHALET_INTERFACE_GET_WIFI_STATUS_REQUEST,
|
||||
CHALET_INTERFACE_GET_WIFI_STATUS_RESPONSE,
|
||||
|
||||
|
||||
|
||||
@ -319,6 +333,40 @@ enum CHALET_CMDS
|
||||
MAX_CHALET_CMD
|
||||
};
|
||||
|
||||
enum BOOTLOADER_CMDS
|
||||
{
|
||||
BOOTLOADER_ACK = 1,
|
||||
BOOTLOADER_HEARTBEAT_REQUEST,
|
||||
BOOTLOADER_HEARTBEAT_RESPONSE,
|
||||
BOOTLOADER_ERASE_BOOTLOADER_FLASH_REQUEST,
|
||||
BOOTLOADER_ERASE_BOOTLOADER_FLASH_RESPONSE,
|
||||
BOOTLOADER_ERASE_BOOTLOADER_FLASH_RESULT_RESPONSE,
|
||||
BOOTLOADER_INIT_UPLOAD_REQUEST,
|
||||
BOOTLOADER_INIT_UPLOAD_RESPONSE,
|
||||
BOOTLOADER_GET_STATE_REQUEST,
|
||||
BOOTLOADER_GET_STATE_RESPONSE,
|
||||
BOOTLOADER_READY_FOR_DATA_RESPONSE,
|
||||
BOOTLOADER_SEND_DATA_CHUNK_REQUEST,
|
||||
BOOTLOADER_SEND_DATA_CHUNK_RESPONSE,
|
||||
BOOTLOADER_UPLOAD_FINISHED_REQUEST,
|
||||
BOOTLOADER_UPLOAD_FINISHED_RESPONSE,
|
||||
BOOTLOADER_EXECUTE_UPGRAGE_REQUEST,
|
||||
BOOTLOADER_EXECUTE_UPGRADE_RESPONSE,
|
||||
BOOTLOADER_ABORT_OPERATION_REQUEST,
|
||||
BOOTLOADER_ABORT_OPERATION_RESPONSE,
|
||||
BOOTLOADER_SEND_FLASH_DATA_REQUEST,
|
||||
BOOTLOADER_SEND_FLASH_DATA_RESPONSE,
|
||||
BOOTLOADER_SEND_FLASH_DATA_CHUNK,
|
||||
BOOTLOADER_SEND_FLASH_DATA_CHUNK_RESPONSE,
|
||||
BOOTLOADER_CHECK_FLASH_FIRMW_INTEGRITY_REQUEST,
|
||||
BOOTLOADER_CHECK_FLASH_FIRMW_INTEGRITY_RESPONSE,
|
||||
BOOTLOADER_GET_STORED_FIRMWARE_INFO_REQUEST,
|
||||
BOOTLOADER_GET_STORED_FIRMWARE_INFO_RESPONSE,
|
||||
|
||||
|
||||
MAX_BOOTLOADER_CMD
|
||||
};
|
||||
|
||||
enum ISPINDLE_CMDS
|
||||
{
|
||||
ISPINDLE_ACK = 1,
|
||||
@ -332,4 +380,32 @@ enum ISPINDLE_CMDS
|
||||
MAX_ISPINDLE_CMDS
|
||||
};
|
||||
|
||||
enum LORA_INTERFACE_CMDS
|
||||
{
|
||||
LORA_IF_ACK = 1,
|
||||
LORA_IF_GET_STATUS_REQUEST,
|
||||
LORA_IF_GET_STATUS_RESPONSE,
|
||||
LORA_IF_SEND_FRAME_REQUEST,
|
||||
LORA_IF_SEND_FRAME_RESPONSE,
|
||||
LORA_IF_NEW_FRAME_RESPONSE,
|
||||
LORA_IF_GET_MODULE_CONFIG_REQUEST,
|
||||
LORA_IF_GET_MODULE_CONFIG_RESPONSE,
|
||||
LORA_IF_GET_RSSI_REQUEST,
|
||||
LORA_IF_GET_RSSI_RESPONSE,
|
||||
LORA_IF_SET_MODULE_CONFIG_REQUEST,
|
||||
LORA_IF_SET_MODULE_CONFIG_RESPONSE,
|
||||
|
||||
MAX_LORA_IF_CMD
|
||||
};
|
||||
|
||||
enum LORA_MODULE_IF_INTERFACE_CMDS
|
||||
{
|
||||
LORA_MODULE_IF_INTERFACE_ACK = 1,
|
||||
LORA_MODULE_IF_INTERFACE_GENERAL_STATUS_REQUEST,
|
||||
LORA_MODULE_IF_INTERFACE_GENERAL_STATUS_RESPONSE,
|
||||
|
||||
|
||||
MAX_LORA_MODULE_IF_INTERFACE_CMD
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
139
ui_LoraSettingsGui.h
Normal file
139
ui_LoraSettingsGui.h
Normal file
@ -0,0 +1,139 @@
|
||||
/********************************************************************************
|
||||
** Form generated from reading UI file 'LoraSettingsGui.ui'
|
||||
**
|
||||
** Created by: Qt User Interface Compiler version 5.14.2
|
||||
**
|
||||
** WARNING! All changes made in this file will be lost when recompiling UI file!
|
||||
********************************************************************************/
|
||||
|
||||
#ifndef UI_LORASETTINGSGUI_H
|
||||
#define UI_LORASETTINGSGUI_H
|
||||
|
||||
#include <QtCore/QVariant>
|
||||
#include <QtWidgets/QApplication>
|
||||
#include <QtWidgets/QCheckBox>
|
||||
#include <QtWidgets/QComboBox>
|
||||
#include <QtWidgets/QGroupBox>
|
||||
#include <QtWidgets/QLabel>
|
||||
#include <QtWidgets/QSpinBox>
|
||||
#include <QtWidgets/QWidget>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class Ui_CLoraSettingsGui
|
||||
{
|
||||
public:
|
||||
QLabel *label;
|
||||
QGroupBox *groupBox;
|
||||
QLabel *label_2;
|
||||
QLabel *label_3;
|
||||
QSpinBox *mLoraAddressSpinBx;
|
||||
QComboBox *mComportComboBox;
|
||||
QLabel *label_5;
|
||||
QLabel *label_6;
|
||||
QCheckBox *mUseLoraIFCheckBx;
|
||||
QSpinBox *mLoraChannelSpinBx;
|
||||
QLabel *label_4;
|
||||
QCheckBox *checkBox;
|
||||
|
||||
void setupUi(QWidget *CLoraSettingsGui)
|
||||
{
|
||||
if (CLoraSettingsGui->objectName().isEmpty())
|
||||
CLoraSettingsGui->setObjectName(QString::fromUtf8("CLoraSettingsGui"));
|
||||
CLoraSettingsGui->resize(553, 413);
|
||||
label = new QLabel(CLoraSettingsGui);
|
||||
label->setObjectName(QString::fromUtf8("label"));
|
||||
label->setGeometry(QRect(100, 10, 151, 16));
|
||||
QFont font;
|
||||
font.setPointSize(12);
|
||||
label->setFont(font);
|
||||
groupBox = new QGroupBox(CLoraSettingsGui);
|
||||
groupBox->setObjectName(QString::fromUtf8("groupBox"));
|
||||
groupBox->setGeometry(QRect(110, 170, 221, 191));
|
||||
label_2 = new QLabel(groupBox);
|
||||
label_2->setObjectName(QString::fromUtf8("label_2"));
|
||||
label_2->setGeometry(QRect(10, 40, 71, 16));
|
||||
label_3 = new QLabel(groupBox);
|
||||
label_3->setObjectName(QString::fromUtf8("label_3"));
|
||||
label_3->setGeometry(QRect(10, 20, 71, 16));
|
||||
mLoraAddressSpinBx = new QSpinBox(groupBox);
|
||||
mLoraAddressSpinBx->setObjectName(QString::fromUtf8("mLoraAddressSpinBx"));
|
||||
mLoraAddressSpinBx->setGeometry(QRect(90, 40, 71, 22));
|
||||
mLoraAddressSpinBx->setMinimum(1);
|
||||
mLoraAddressSpinBx->setMaximum(65535);
|
||||
mLoraAddressSpinBx->setValue(6);
|
||||
mComportComboBox = new QComboBox(groupBox);
|
||||
mComportComboBox->addItem(QString());
|
||||
mComportComboBox->addItem(QString());
|
||||
mComportComboBox->addItem(QString());
|
||||
mComportComboBox->addItem(QString());
|
||||
mComportComboBox->addItem(QString());
|
||||
mComportComboBox->addItem(QString());
|
||||
mComportComboBox->addItem(QString());
|
||||
mComportComboBox->addItem(QString());
|
||||
mComportComboBox->addItem(QString());
|
||||
mComportComboBox->addItem(QString());
|
||||
mComportComboBox->setObjectName(QString::fromUtf8("mComportComboBox"));
|
||||
mComportComboBox->setGeometry(QRect(80, 80, 69, 22));
|
||||
label_5 = new QLabel(groupBox);
|
||||
label_5->setObjectName(QString::fromUtf8("label_5"));
|
||||
label_5->setGeometry(QRect(20, 80, 51, 16));
|
||||
label_6 = new QLabel(groupBox);
|
||||
label_6->setObjectName(QString::fromUtf8("label_6"));
|
||||
label_6->setGeometry(QRect(20, 110, 91, 31));
|
||||
mUseLoraIFCheckBx = new QCheckBox(groupBox);
|
||||
mUseLoraIFCheckBx->setObjectName(QString::fromUtf8("mUseLoraIFCheckBx"));
|
||||
mUseLoraIFCheckBx->setGeometry(QRect(20, 160, 191, 20));
|
||||
mLoraChannelSpinBx = new QSpinBox(groupBox);
|
||||
mLoraChannelSpinBx->setObjectName(QString::fromUtf8("mLoraChannelSpinBx"));
|
||||
mLoraChannelSpinBx->setGeometry(QRect(90, 20, 71, 22));
|
||||
mLoraChannelSpinBx->setMinimum(1);
|
||||
mLoraChannelSpinBx->setMaximum(65535);
|
||||
mLoraChannelSpinBx->setValue(6);
|
||||
label_4 = new QLabel(groupBox);
|
||||
label_4->setObjectName(QString::fromUtf8("label_4"));
|
||||
label_4->setGeometry(QRect(200, 30, 71, 16));
|
||||
checkBox = new QCheckBox(CLoraSettingsGui);
|
||||
checkBox->setObjectName(QString::fromUtf8("checkBox"));
|
||||
checkBox->setGeometry(QRect(70, 60, 281, 20));
|
||||
|
||||
retranslateUi(CLoraSettingsGui);
|
||||
|
||||
QMetaObject::connectSlotsByName(CLoraSettingsGui);
|
||||
} // setupUi
|
||||
|
||||
void retranslateUi(QWidget *CLoraSettingsGui)
|
||||
{
|
||||
CLoraSettingsGui->setWindowTitle(QCoreApplication::translate("CLoraSettingsGui", "Form", nullptr));
|
||||
label->setText(QCoreApplication::translate("CLoraSettingsGui", "Chalet Settings", nullptr));
|
||||
groupBox->setTitle(QCoreApplication::translate("CLoraSettingsGui", "LoRa", nullptr));
|
||||
label_2->setText(QCoreApplication::translate("CLoraSettingsGui", "Lora Address:", nullptr));
|
||||
label_3->setText(QCoreApplication::translate("CLoraSettingsGui", "Lora Channel:", nullptr));
|
||||
mComportComboBox->setItemText(0, QCoreApplication::translate("CLoraSettingsGui", "COM1", nullptr));
|
||||
mComportComboBox->setItemText(1, QCoreApplication::translate("CLoraSettingsGui", "COM2", nullptr));
|
||||
mComportComboBox->setItemText(2, QCoreApplication::translate("CLoraSettingsGui", "COM3", nullptr));
|
||||
mComportComboBox->setItemText(3, QCoreApplication::translate("CLoraSettingsGui", "COM4", nullptr));
|
||||
mComportComboBox->setItemText(4, QCoreApplication::translate("CLoraSettingsGui", "COM5", nullptr));
|
||||
mComportComboBox->setItemText(5, QCoreApplication::translate("CLoraSettingsGui", "COM6", nullptr));
|
||||
mComportComboBox->setItemText(6, QCoreApplication::translate("CLoraSettingsGui", "COM7", nullptr));
|
||||
mComportComboBox->setItemText(7, QCoreApplication::translate("CLoraSettingsGui", "COM8", nullptr));
|
||||
mComportComboBox->setItemText(8, QCoreApplication::translate("CLoraSettingsGui", "COM9", nullptr));
|
||||
mComportComboBox->setItemText(9, QCoreApplication::translate("CLoraSettingsGui", "COM10", nullptr));
|
||||
|
||||
label_5->setText(QCoreApplication::translate("CLoraSettingsGui", "Com Port:", nullptr));
|
||||
label_6->setText(QCoreApplication::translate("CLoraSettingsGui", "Chalet = 7\n"
|
||||
"Chaloupe = 8", nullptr));
|
||||
mUseLoraIFCheckBx->setText(QCoreApplication::translate("CLoraSettingsGui", "Use LoraInterface (restart needed)", nullptr));
|
||||
label_4->setText(QCoreApplication::translate("CLoraSettingsGui", "4", nullptr));
|
||||
checkBox->setText(QCoreApplication::translate("CLoraSettingsGui", "Use LTE interface (restart needed)", nullptr));
|
||||
} // retranslateUi
|
||||
|
||||
};
|
||||
|
||||
namespace Ui {
|
||||
class CLoraSettingsGui: public Ui_CLoraSettingsGui {};
|
||||
} // namespace Ui
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // UI_LORASETTINGSGUI_H
|
||||
Loading…
x
Reference in New Issue
Block a user