fonctionnelle
This commit is contained in:
BIN
fleche.png
Normal file
BIN
fleche.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 40 KiB |
2
main.cpp
2
main.cpp
@@ -61,7 +61,7 @@ int main(int argc, char *argv[])
|
|||||||
pws2mqtt = new Pws2mqtt;
|
pws2mqtt = new Pws2mqtt;
|
||||||
|
|
||||||
pws2mqtt->listeningHttp();
|
pws2mqtt->listeningHttp();
|
||||||
notify (QString("Program started"), "default");
|
//notify (QString("Program started"), "default");
|
||||||
|
|
||||||
a.exec();
|
a.exec();
|
||||||
|
|
||||||
|
|||||||
@@ -1,31 +0,0 @@
|
|||||||
QT = gui
|
|
||||||
QT += network
|
|
||||||
QT += core
|
|
||||||
QT += mqtt
|
|
||||||
QT += httpserver
|
|
||||||
|
|
||||||
LIBS += -lcurl
|
|
||||||
|
|
||||||
CONFIG += c++17 console
|
|
||||||
CONFIG -= app_bundle
|
|
||||||
|
|
||||||
# You can make your code fail to compile if it uses deprecated APIs.
|
|
||||||
# In order to do so, uncomment the following line.
|
|
||||||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
|
||||||
|
|
||||||
SOURCES += \
|
|
||||||
main.cpp \
|
|
||||||
mqtt.cpp \
|
|
||||||
pws2mqtt.cpp
|
|
||||||
|
|
||||||
# Default rules for deployment.
|
|
||||||
qnx: target.path = /tmp/$${TARGET}/bin
|
|
||||||
else: unix:!android: target.path = /opt/$${TARGET}/bin
|
|
||||||
!isEmpty(target.path): INSTALLS += target
|
|
||||||
|
|
||||||
HEADERS += \
|
|
||||||
httpserver.h \
|
|
||||||
mqtt.h \
|
|
||||||
pws2mqtt.h \
|
|
||||||
version.h
|
|
||||||
|
|
||||||
@@ -1,404 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE QtCreatorProject>
|
|
||||||
<!-- Written by QtCreator 9.0.1, 2025-10-12T11:32:20. -->
|
|
||||||
<qtcreator>
|
|
||||||
<data>
|
|
||||||
<variable>EnvironmentId</variable>
|
|
||||||
<value type="QByteArray">{db2284ae-177e-4753-8e1e-1e0e73c52ae1}</value>
|
|
||||||
</data>
|
|
||||||
<data>
|
|
||||||
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
|
||||||
<value type="qlonglong">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="qlonglong" 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.PreferSingleLineComments">false</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="bool" key="EditorConfiguration.UseIndenter">false</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="QString" key="EditorConfiguration.ignoreFileTypes">*.md, *.MD, Makefile</value>
|
|
||||||
<value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
|
|
||||||
<value type="bool" key="EditorConfiguration.skipTrailingWhitespace">true</value>
|
|
||||||
<value type="bool" key="EditorConfiguration.tintMarginArea">true</value>
|
|
||||||
</valuemap>
|
|
||||||
</data>
|
|
||||||
<data>
|
|
||||||
<variable>ProjectExplorer.Project.PluginSettings</variable>
|
|
||||||
<valuemap type="QVariantMap">
|
|
||||||
<valuemap type="QVariantMap" key="AutoTest.ActiveFrameworks">
|
|
||||||
<value type="bool" key="AutoTest.Framework.Boost">true</value>
|
|
||||||
<value type="bool" key="AutoTest.Framework.CTest">false</value>
|
|
||||||
<value type="bool" key="AutoTest.Framework.Catch">true</value>
|
|
||||||
<value type="bool" key="AutoTest.Framework.GTest">true</value>
|
|
||||||
<value type="bool" key="AutoTest.Framework.QtQuickTest">true</value>
|
|
||||||
<value type="bool" key="AutoTest.Framework.QtTest">true</value>
|
|
||||||
</valuemap>
|
|
||||||
<valuemap type="QVariantMap" key="AutoTest.CheckStates"/>
|
|
||||||
<value type="int" key="AutoTest.RunAfterBuild">0</value>
|
|
||||||
<value type="bool" key="AutoTest.UseGlobal">true</value>
|
|
||||||
<valuemap type="QVariantMap" key="ClangTools">
|
|
||||||
<value type="bool" key="ClangTools.AnalyzeOpenFiles">true</value>
|
|
||||||
<value type="bool" key="ClangTools.BuildBeforeAnalysis">true</value>
|
|
||||||
<value type="QString" key="ClangTools.DiagnosticConfig">Builtin.DefaultTidyAndClazy</value>
|
|
||||||
<value type="int" key="ClangTools.ParallelJobs">1</value>
|
|
||||||
<valuelist type="QVariantList" key="ClangTools.SelectedDirs"/>
|
|
||||||
<valuelist type="QVariantList" key="ClangTools.SelectedFiles"/>
|
|
||||||
<valuelist type="QVariantList" key="ClangTools.SuppressedDiagnostics"/>
|
|
||||||
<value type="bool" key="ClangTools.UseGlobalSettings">true</value>
|
|
||||||
</valuemap>
|
|
||||||
<valuemap type="QVariantMap" key="CppEditor.QuickFix">
|
|
||||||
<value type="bool" key="UseGlobalSettings">true</value>
|
|
||||||
</valuemap>
|
|
||||||
</valuemap>
|
|
||||||
</data>
|
|
||||||
<data>
|
|
||||||
<variable>ProjectExplorer.Project.Target.0</variable>
|
|
||||||
<valuemap type="QVariantMap">
|
|
||||||
<value type="QString" key="DeviceType">Desktop</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Qt 6.4.1 (qt6)</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Qt 6.4.1 (qt6)</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{17b0ba8e-e6fe-4c71-98eb-9b4d3bcc4307}</value>
|
|
||||||
<value type="qlonglong" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
|
|
||||||
<value type="qlonglong" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
|
|
||||||
<value type="qlonglong" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
|
|
||||||
<value type="int" key="EnableQmlDebugging">1</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/daniel/develop/pws2mqtt-qt/build/debug</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">/home/daniel/develop/pws2mqtt-qt/build/debug</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.ProcessStep.Arguments"> -x versioning -s 1</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProcessStep.Command">bash</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProcessStep.WorkingDirectory">%{ActiveProject:NativePath}</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.ProcessStep</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.Id">QtProjectManager.QMakeBuildStep</value>
|
|
||||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
|
|
||||||
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
|
|
||||||
</valuemap>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.2">
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">3</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</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.Id">Qt4ProjectManager.MakeStep</value>
|
|
||||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</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.CustomParsers"/>
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildConfiguration.ParseStandardOutput">false</value>
|
|
||||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Debug</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
|
||||||
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
|
|
||||||
<value type="int" key="QtQuickCompiler">1</value>
|
|
||||||
</valuemap>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
|
|
||||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/daniel/develop/pws2mqtt-qt/build/Release</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">/home/daniel/develop/pws2mqtt-qt/build/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.Id">QtProjectManager.QMakeBuildStep</value>
|
|
||||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
|
|
||||||
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
|
|
||||||
</valuemap>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</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.Id">Qt4ProjectManager.MakeStep</value>
|
|
||||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</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.CustomParsers"/>
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildConfiguration.ParseStandardOutput">false</value>
|
|
||||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Release</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
|
||||||
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
|
|
||||||
<value type="int" key="QtQuickCompiler">0</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="qlonglong" key="ProjectExplorer.Target.BuildConfigurationCount">2</value>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
|
||||||
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Deploy</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.DeployConfiguration.CustomData"/>
|
|
||||||
<value type="bool" key="ProjectExplorer.DeployConfiguration.CustomDataEnabled">false</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="qlonglong" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
|
|
||||||
<value type="bool" key="Analyzer.Perf.Settings.UseGlobalSettings">true</value>
|
|
||||||
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
|
|
||||||
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
|
|
||||||
<valuelist type="QVariantList" key="CustomOutputParsers"/>
|
|
||||||
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
|
|
||||||
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/home/daniel/develop/pws2mqtt-qt/pws2mqtt-qt.pro</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey">/home/daniel/develop/pws2mqtt-qt/pws2mqtt-qt.pro</value>
|
|
||||||
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
|
|
||||||
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
|
|
||||||
<value type="bool" key="RunConfiguration.UseLibrarySearchPath">true</value>
|
|
||||||
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
|
|
||||||
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
|
|
||||||
<value type="bool" key="RunConfiguration.UseTerminal">false</value>
|
|
||||||
<value type="QString" key="RunConfiguration.WorkingDirectory.default">/home/daniel/develop/pws2mqtt-qt/build/debug</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="qlonglong" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
|
|
||||||
</valuemap>
|
|
||||||
</data>
|
|
||||||
<data>
|
|
||||||
<variable>ProjectExplorer.Project.Target.1</variable>
|
|
||||||
<valuemap type="QVariantMap">
|
|
||||||
<value type="QString" key="DeviceType">Desktop</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{96ba01cf-98b6-46f1-b1a8-6cf5d7804e77}</value>
|
|
||||||
<value type="qlonglong" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
|
|
||||||
<value type="qlonglong" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
|
|
||||||
<value type="qlonglong" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
|
|
||||||
<value type="int" key="EnableQmlDebugging">0</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/daniel/develop/pws2mqtt-qt/../build-pws2mqtt-qt-Desktop-Debug</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">/home/daniel/develop/build-pws2mqtt-qt-Desktop-Debug</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.ProcessStep.Arguments">-s 1</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProcessStep.Command">versioning</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProcessStep.WorkingDirectory">%{buildDir}</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.ProcessStep</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.Id">QtProjectManager.QMakeBuildStep</value>
|
|
||||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
|
|
||||||
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
|
|
||||||
</valuemap>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.2">
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">3</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</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.Id">Qt4ProjectManager.MakeStep</value>
|
|
||||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</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.CustomParsers"/>
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildConfiguration.ParseStandardOutput">false</value>
|
|
||||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Debug</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
|
||||||
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
|
|
||||||
</valuemap>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
|
|
||||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/daniel/develop/pws2mqtt-qt/../build-pws2mqtt-qt-Desktop-Release</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">/home/daniel/develop/build-pws2mqtt-qt-Desktop-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.Id">QtProjectManager.QMakeBuildStep</value>
|
|
||||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">true</value>
|
|
||||||
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
|
|
||||||
</valuemap>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</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.Id">Qt4ProjectManager.MakeStep</value>
|
|
||||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</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.CustomParsers"/>
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildConfiguration.ParseStandardOutput">false</value>
|
|
||||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Release</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
|
||||||
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
|
|
||||||
<value type="int" key="QtQuickCompiler">0</value>
|
|
||||||
</valuemap>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
|
|
||||||
<value type="int" key="EnableQmlDebugging">0</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/daniel/develop/pws2mqtt-qt/../build-pws2mqtt-qt-Desktop-Profile</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">/home/daniel/develop/build-pws2mqtt-qt-Desktop-Profile</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.Id">QtProjectManager.QMakeBuildStep</value>
|
|
||||||
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">true</value>
|
|
||||||
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
|
|
||||||
</valuemap>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</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.Id">Qt4ProjectManager.MakeStep</value>
|
|
||||||
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</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.CustomParsers"/>
|
|
||||||
<value type="bool" key="ProjectExplorer.BuildConfiguration.ParseStandardOutput">false</value>
|
|
||||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Profile</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
|
||||||
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
|
|
||||||
<value type="int" key="QtQuickCompiler">0</value>
|
|
||||||
<value type="int" key="SeparateDebugInfo">0</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="qlonglong" key="ProjectExplorer.Target.BuildConfigurationCount">3</value>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
|
||||||
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Deploy</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.DeployConfiguration.CustomData"/>
|
|
||||||
<value type="bool" key="ProjectExplorer.DeployConfiguration.CustomDataEnabled">false</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="qlonglong" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
|
|
||||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
|
|
||||||
<value type="bool" key="Analyzer.Perf.Settings.UseGlobalSettings">true</value>
|
|
||||||
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
|
|
||||||
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
|
|
||||||
<valuelist type="QVariantList" key="CustomOutputParsers"/>
|
|
||||||
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
|
|
||||||
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/home/daniel/develop/pws2mqtt-qt/pws2mqtt-qt.pro</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey">/home/daniel/develop/pws2mqtt-qt/pws2mqtt-qt.pro</value>
|
|
||||||
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
|
|
||||||
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
|
|
||||||
<value type="bool" key="RunConfiguration.UseLibrarySearchPath">true</value>
|
|
||||||
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
|
|
||||||
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
|
|
||||||
</valuemap>
|
|
||||||
<value type="qlonglong" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
|
|
||||||
</valuemap>
|
|
||||||
</data>
|
|
||||||
<data>
|
|
||||||
<variable>ProjectExplorer.Project.TargetCount</variable>
|
|
||||||
<value type="qlonglong">2</value>
|
|
||||||
</data>
|
|
||||||
<data>
|
|
||||||
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
|
|
||||||
<value type="int">22</value>
|
|
||||||
</data>
|
|
||||||
<data>
|
|
||||||
<variable>Version</variable>
|
|
||||||
<value type="int">22</value>
|
|
||||||
</data>
|
|
||||||
</qtcreator>
|
|
||||||
173
pws2mqtt.cpp
173
pws2mqtt.cpp
@@ -39,7 +39,7 @@ static size_t WriteCallback(void *contents, size_t size, size_t nmemb, void *use
|
|||||||
return size * nmemb; // On ne traite pas les données reçues
|
return size * nmemb; // On ne traite pas les données reçues
|
||||||
}
|
}
|
||||||
|
|
||||||
QMap <QByteArray, QVariant> propertyList;
|
QMap <QByteArray, QString> propertyList;
|
||||||
QMap <QByteArray, double> propertiesValue;
|
QMap <QByteArray, double> propertiesValue;
|
||||||
QMap <QByteArray, QPair<QString, QByteArray>> propertyName
|
QMap <QByteArray, QPair<QString, QByteArray>> propertyName
|
||||||
{
|
{
|
||||||
@@ -146,15 +146,15 @@ void Pws2mqtt::parseData(QList<std::pair<QString, QString>> queryList)
|
|||||||
QString jsonString = "{";
|
QString jsonString = "{";
|
||||||
bool propertyFlag = false;
|
bool propertyFlag = false;
|
||||||
bool deviceFlag = false;
|
bool deviceFlag = false;
|
||||||
// QString topic;
|
// QString topic;
|
||||||
QString deviceString = "\"device\": {\"ieeeAddress\": \"" + mqttClient->macAddress + "\", \"type\": \"" + mqttClient->type + "\", \"powerSource\": \"Battery\"";
|
QString deviceString = "\"device\": {\"ieeeAddress\": \"" + mqttClient->macAddress + "\", \"type\": \"" + mqttClient->type + "\", \"powerSource\": \"Battery\"";
|
||||||
QString notif = "";
|
QString notif = "";
|
||||||
double propertyValue = 0;
|
double propertyValue = 0;
|
||||||
QStringList priorityList {"", "min", "low", "default", "High", "urgent"};
|
QStringList priorityList {"", "min", "low", "default", "High", "urgent"};
|
||||||
quint8 priority = 2;
|
quint8 priority = 2;
|
||||||
static qreal winddir = 0;
|
//static qreal winddir = 0;
|
||||||
QString attachment = "";
|
QString attachment = "";
|
||||||
bool changed = false;
|
static QDateTime timer;
|
||||||
|
|
||||||
debug(DEBUGMACRO, "looping list of query", DEBUG);
|
debug(DEBUGMACRO, "looping list of query", DEBUG);
|
||||||
|
|
||||||
@@ -199,21 +199,9 @@ void Pws2mqtt::parseData(QList<std::pair<QString, QString>> queryList)
|
|||||||
//notif += formatNotifString (propertyName[name].first, propertyName[name].second, QByteArray::number(qPow(propertyValue, 1.0)));
|
//notif += formatNotifString (propertyName[name].first, propertyName[name].second, QByteArray::number(qPow(propertyValue, 1.0)));
|
||||||
//debug (DEBUGMACRO, "", DEBUG);
|
//debug (DEBUGMACRO, "", DEBUG);
|
||||||
timeTemp = timeTemp.currentDateTime().addSecs(300);
|
timeTemp = timeTemp.currentDateTime().addSecs(300);
|
||||||
propertyList[name] = propertyValue;
|
propertyList[name] = formatNotifString(propertyName[name].first, propertyName[name].second, QByteArray::number(propertyValue));
|
||||||
propertiesValue[name] = propertyValue;
|
propertiesValue[name] = propertyValue;
|
||||||
changed = true;
|
|
||||||
}
|
}
|
||||||
/*}else if (name == "indoortempf")
|
|
||||||
{
|
|
||||||
static QDateTime timeIndoorTemp = QDateTime::currentDateTime().addSecs(-600);
|
|
||||||
propertyValue = round(fahrenheitToCelsius(pair.second.toFloat()));
|
|
||||||
if (compare (propertyList[name], propertyValue, 1) and timeIndoorTemp < QDateTime::currentDateTime())
|
|
||||||
{
|
|
||||||
//notif += formatNotifString (propertyName[name].first, propertyName[name].second , QByteArray::number(qPow(propertyValue, 1.0)));
|
|
||||||
debug (DEBUGMACRO, "Notif = #" + notif + "#", DEBUG);
|
|
||||||
timeIndoorTemp = timeIndoorTemp.currentDateTime().addSecs(300);
|
|
||||||
propertyList[name] = propertyValue;
|
|
||||||
}*/
|
|
||||||
}else if (name == "humidity")
|
}else if (name == "humidity")
|
||||||
{
|
{
|
||||||
propertyValue = value.toFloat();
|
propertyValue = value.toFloat();
|
||||||
@@ -222,9 +210,8 @@ void Pws2mqtt::parseData(QList<std::pair<QString, QString>> queryList)
|
|||||||
if (compare (propertiesValue[name], propertyValue, 3))
|
if (compare (propertiesValue[name], propertyValue, 3))
|
||||||
{
|
{
|
||||||
//notif += formatNotifString (propertyName[name].first, propertyName[name].second , value);
|
//notif += formatNotifString (propertyName[name].first, propertyName[name].second , value);
|
||||||
propertyList[name] = propertyValue;
|
propertyList[name] = formatNotifString(propertyName[name].first, propertyName[name].second, QByteArray::number(propertyValue));
|
||||||
propertiesValue[name] = propertyValue;
|
propertiesValue[name] = propertyValue;
|
||||||
changed = true;
|
|
||||||
}
|
}
|
||||||
}else if (name == "windchillf")
|
}else if (name == "windchillf")
|
||||||
{
|
{
|
||||||
@@ -236,22 +223,23 @@ void Pws2mqtt::parseData(QList<std::pair<QString, QString>> queryList)
|
|||||||
//notif += formatNotifString (propertyName[name].first, propertyName[name].second , QByteArray::number(qPow(propertyValue, 1.0)));
|
//notif += formatNotifString (propertyName[name].first, propertyName[name].second , QByteArray::number(qPow(propertyValue, 1.0)));
|
||||||
//debug (DEBUGMACRO, "Notif = #" + notif + "#", DEBUG);
|
//debug (DEBUGMACRO, "Notif = #" + notif + "#", DEBUG);
|
||||||
timeWindchill = timeWindchill.currentDateTime().addSecs(300);
|
timeWindchill = timeWindchill.currentDateTime().addSecs(300);
|
||||||
propertyList[name] = propertyValue;
|
propertyList[name] = formatNotifString(propertyName[name].first, propertyName[name].second, QByteArray::number(propertyValue));
|
||||||
propertiesValue[name] = propertyValue;
|
propertiesValue[name] = propertyValue;
|
||||||
changed = true;
|
|
||||||
}
|
}
|
||||||
}else if (name == "winddir")
|
}else if (name == "winddir")
|
||||||
{
|
{
|
||||||
winddir = value.toFloat();
|
propertyValue = value.toFloat();
|
||||||
rotateAndSaveImage(this->inputPath, this->outputPath, (qreal)winddir);
|
rotateAndSaveImage(this->inputPath, this->outputPath, (qreal)propertyValue);
|
||||||
debug (DEBUGMACRO, name + " : " + QByteArray::number(propertyValue), DEBUG);
|
debug (DEBUGMACRO, name + " : " + QByteArray::number(propertyValue), DEBUG);
|
||||||
|
propertyList[name] = formatNotifString(propertyName[name].first, propertyName[name].second, QByteArray::number(propertyValue));
|
||||||
|
propertiesValue[name] = propertyValue;
|
||||||
|
|
||||||
}else if (name == "windspeedmph" or name == "windgustmph")
|
}else if (name == "windspeedmph" or name == "windgustmph")
|
||||||
{
|
{
|
||||||
QString msg = "";
|
QString msg = "";
|
||||||
static QDateTime timeWind = QDateTime::currentDateTime().addSecs(-600);
|
static QDateTime timeWind = QDateTime::currentDateTime().addSecs(-600);
|
||||||
quint8 windPriority = 1;
|
quint8 windPriority = 1;
|
||||||
static QString msgNotif;
|
//static QString msgNotif;
|
||||||
|
|
||||||
debug (DEBUGMACRO, name + " : " + QByteArray::number(propertyValue), DEBUG);
|
debug (DEBUGMACRO, name + " : " + QByteArray::number(propertyValue), DEBUG);
|
||||||
propertyValue = round(mphTokmh(value.toFloat()));
|
propertyValue = round(mphTokmh(value.toFloat()));
|
||||||
@@ -260,57 +248,31 @@ void Pws2mqtt::parseData(QList<std::pair<QString, QString>> queryList)
|
|||||||
if (propertyValue <= forceVent[i][0].toDouble())
|
if (propertyValue <= forceVent[i][0].toDouble())
|
||||||
{
|
{
|
||||||
msg = forceVent[i][1].toString();
|
msg = forceVent[i][1].toString();
|
||||||
windPriority = forceVent[i][1].toUInt();
|
windPriority = forceVent[i][2].toUInt();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (propertyList["forcevent"].toString() != msg or propertyList["rafales"].toString() != msg)
|
if (propertyList["forcevent"] != msg or propertyList["rafales"] != msg)
|
||||||
{
|
{
|
||||||
if (name == "windspeedmph")
|
if (name == "windspeedmph")
|
||||||
{
|
{
|
||||||
propertyList["forcevent"] = msg;
|
//propertyList["forcevent"] = msg;
|
||||||
msg.prepend("Vent - ");
|
msg.prepend("Vent - ");
|
||||||
|
propertyList[name] = formatNotifString (msg, propertyName[name].second , QByteArray::number(propertyValue));
|
||||||
}else
|
}else
|
||||||
{
|
{
|
||||||
propertyList["rafales"] = msg;
|
propertyList[name] = formatNotifString (propertyName[name].first, propertyName[name].second , QByteArray::number(propertyValue));
|
||||||
msg.prepend("Rafales - ");
|
|
||||||
}
|
}
|
||||||
msgNotif = formatNotifString (msg, propertyName[name].second , QByteArray::number(propertyValue));
|
|
||||||
setPriority(priority, windPriority);
|
setPriority(priority, windPriority);
|
||||||
|
|
||||||
propertyList["winddir"] = winddir;
|
|
||||||
attachment = this->outputPath;
|
attachment = this->outputPath;
|
||||||
if (priority > 3)
|
|
||||||
{
|
|
||||||
notify(msgNotif, priorityList[priority], attachment);
|
|
||||||
}else if (timeWind < QDateTime::currentDateTime() or propertyValue > 20)
|
|
||||||
{
|
|
||||||
timeWind = timeWind.currentDateTime().addSecs(300);
|
|
||||||
changed = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
debug (DEBUGMACRO, "Notif = *" + notif + "*", DEBUG);
|
|
||||||
}
|
}
|
||||||
notif += msgNotif;
|
|
||||||
|
|
||||||
/*}else if (name == "windgustmph")
|
|
||||||
{
|
|
||||||
propertyValue = round(mphTokmh(pair.second.toFloat()));
|
|
||||||
if (compare (propertyList[name], propertyValue, 5) and propertyValue > 20)
|
|
||||||
{
|
|
||||||
notif += formatNotifString (propertyName[name].first, propertyName[name].second , QByteArray::number(propertyValue));
|
|
||||||
if (propertyValue > 40)
|
|
||||||
priority = setPriority (priority, 4);
|
|
||||||
if (propertyValue > 60)
|
|
||||||
priority = setPriority (priority, 5);
|
|
||||||
propertyList[name] = propertyValue;
|
|
||||||
debug (DEBUGMACRO, "Notif = #" + notif + "#", DEBUG);
|
|
||||||
}*/
|
|
||||||
}else if (name == "rainin")
|
}else if (name == "rainin")
|
||||||
{
|
{
|
||||||
static double ecart;
|
static double ecart;
|
||||||
propertyValue = pair.second.toFloat();
|
quint8 raininPriority = 1;
|
||||||
|
propertyValue = round(pair.second.toFloat()*100)/100;
|
||||||
if (propertyValue == 0)
|
if (propertyValue == 0)
|
||||||
{
|
{
|
||||||
ecart = 0.0001;
|
ecart = 0.0001;
|
||||||
@@ -321,18 +283,16 @@ void Pws2mqtt::parseData(QList<std::pair<QString, QString>> queryList)
|
|||||||
debug (DEBUGMACRO, name + " : " + QByteArray::number(propertyValue), DEBUG);
|
debug (DEBUGMACRO, name + " : " + QByteArray::number(propertyValue), DEBUG);
|
||||||
if (compare (propertiesValue[name], propertyValue, ecart))
|
if (compare (propertiesValue[name], propertyValue, ecart))
|
||||||
{
|
{
|
||||||
//notif += formatNotifString (propertyName[name].first, propertyName[name].second , value);
|
QString pluviosite = getPluviosite(propertyValue, raininPriority);
|
||||||
QString pluviosite = getPluviosite(propertyValue);
|
priority = setPriority (priority, raininPriority);
|
||||||
priority = setPriority (priority, 4);
|
|
||||||
//debug (DEBUGMACRO, "Notif = #" + notif + "#", DEBUG);
|
//debug (DEBUGMACRO, "Notif = #" + notif + "#", DEBUG);
|
||||||
propertyList[name] = pluviosite + " : " + QString::number(round(propertyValue*100)/100);
|
propertyList[name] = formatNotifString(pluviosite + " : ", propertyName[name].second, QByteArray::number(propertyValue));
|
||||||
propertiesValue[name] = propertyValue;
|
propertiesValue[name] = propertyValue;
|
||||||
changed = true;
|
|
||||||
}
|
}
|
||||||
}else if (name == "dailyrainin")
|
}else if (name == "dailyrainin")
|
||||||
{
|
{
|
||||||
static double ecart;
|
static double ecart;
|
||||||
propertyValue = pair.second.toFloat();
|
propertyValue = round(pair.second.toFloat()*100)/100;
|
||||||
if (propertyValue == 0)
|
if (propertyValue == 0)
|
||||||
{
|
{
|
||||||
ecart = 0.0001;
|
ecart = 0.0001;
|
||||||
@@ -345,9 +305,8 @@ void Pws2mqtt::parseData(QList<std::pair<QString, QString>> queryList)
|
|||||||
{
|
{
|
||||||
priority = setPriority (priority, 3);
|
priority = setPriority (priority, 3);
|
||||||
//debug (DEBUGMACRO, "Notif = #" + notif + "#", DEBUG);
|
//debug (DEBUGMACRO, "Notif = #" + notif + "#", DEBUG);
|
||||||
propertyList[name] = propertyValue;
|
propertyList[name] = formatNotifString(propertyName[name].first, propertyName[name].second, QByteArray::number(propertyValue));
|
||||||
propertiesValue[name] = propertyValue;
|
propertiesValue[name] = propertyValue;
|
||||||
changed = true;
|
|
||||||
}
|
}
|
||||||
}else if (name == "baromin")
|
}else if (name == "baromin")
|
||||||
{
|
{
|
||||||
@@ -359,27 +318,24 @@ void Pws2mqtt::parseData(QList<std::pair<QString, QString>> queryList)
|
|||||||
{
|
{
|
||||||
//notif += formatNotifString (propertyName[name].first, propertyName[name].second , QByteArray::number(propertyValue));
|
//notif += formatNotifString (propertyName[name].first, propertyName[name].second , QByteArray::number(propertyValue));
|
||||||
//debug (DEBUGMACRO, "Notif = #" + notif + "#", DEBUG);
|
//debug (DEBUGMACRO, "Notif = #" + notif + "#", DEBUG);
|
||||||
propertyList[name] = propertyValue;
|
propertyList[name] = formatNotifString(propertyName[name].first, "", QByteArray::number(propertyValue));
|
||||||
propertiesValue[name] = propertyValue;
|
propertiesValue[name] = propertyValue;
|
||||||
changed = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static QString prevision;
|
static QString prevision;
|
||||||
QString ret = pressureVariation(propertyValue, priority);
|
quint8 prevPriority = 0;
|
||||||
|
QString ret = pressureVariation(propertyValue, prevPriority);
|
||||||
if (!ret.isEmpty())
|
if (!ret.isEmpty())
|
||||||
{
|
{
|
||||||
debug (DEBUGMACRO, "baromin ret not empty : " + ret, DEBUG);
|
debug (DEBUGMACRO, "baromin ret not empty : " + ret, DEBUG);
|
||||||
QString newPrevision = ret;
|
QString newPrevision = ret;
|
||||||
priority = setPriority(priority, priority);
|
priority = setPriority(priority, prevPriority);
|
||||||
if (prevision != newPrevision)
|
if (prevision != newPrevision)
|
||||||
{
|
{
|
||||||
prevision = newPrevision;
|
prevision = newPrevision;
|
||||||
propertyList["prevision"] = prevision;
|
propertyList["prevision"] = "- " + prevision + " \n";
|
||||||
//debug (DEBUGMACRO, "Notif = #" + notif + "#", DEBUG);
|
|
||||||
//changed = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
notif += prevision + " \n";
|
|
||||||
}else if (name == "UV")
|
}else if (name == "UV")
|
||||||
{
|
{
|
||||||
static QDateTime timeUV = QDateTime::currentDateTime().addSecs(-600);
|
static QDateTime timeUV = QDateTime::currentDateTime().addSecs(-600);
|
||||||
@@ -390,26 +346,15 @@ void Pws2mqtt::parseData(QList<std::pair<QString, QString>> queryList)
|
|||||||
{
|
{
|
||||||
//notif += formatNotifString (propertyName[name].first, propertyName[name].second , value);
|
//notif += formatNotifString (propertyName[name].first, propertyName[name].second , value);
|
||||||
if (propertyValue == 5 )
|
if (propertyValue == 5 )
|
||||||
priority = setPriority (priority, 3);
|
|
||||||
if (propertyValue >= 6 )
|
|
||||||
priority = setPriority (priority, 4);
|
priority = setPriority (priority, 4);
|
||||||
|
if (propertyValue >= 6 )
|
||||||
|
priority = setPriority (priority, 5);
|
||||||
timeUV = timeUV.currentDateTime().addSecs(300);
|
timeUV = timeUV.currentDateTime().addSecs(300);
|
||||||
propertyList[name] = propertyValue;
|
propertyList[name] = formatNotifString(propertyName[name].first, "", QByteArray::number(propertyValue));
|
||||||
propertiesValue[name] = propertyValue;
|
propertiesValue[name] = propertyValue;
|
||||||
debug (DEBUGMACRO, "Notif = #" + notif + "#", DEBUG);
|
debug (DEBUGMACRO, "Notif = #" + notif + "#", DEBUG);
|
||||||
}
|
}
|
||||||
}/*else if (name == "lowbat")
|
}
|
||||||
{
|
|
||||||
static QDateTime timeLowBat = QDateTime::currentDateTime().addSecs(-4000);
|
|
||||||
if (pair.second.toInt() == 0 and timeLowBat < QDateTime::currentDateTime())
|
|
||||||
{
|
|
||||||
//notif += formatNotifString (propertyName[name].first, propertyName[name].second );
|
|
||||||
//debug (DEBUGMACRO, "Notif = #" + notif + "#", DEBUG);
|
|
||||||
priority = setPriority (priority, 4);
|
|
||||||
timeLowBat = timeLowBat.currentDateTime().addSecs(3600);
|
|
||||||
propertyList[name] = propertyValue;
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!jsonString.isEmpty())
|
if (!jsonString.isEmpty())
|
||||||
@@ -422,39 +367,16 @@ void Pws2mqtt::parseData(QList<std::pair<QString, QString>> queryList)
|
|||||||
debug(DEBUGMACRO, "No values to send", DEBUG);
|
debug(DEBUGMACRO, "No values to send", DEBUG);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (changed)
|
debug(DEBUGMACRO, "current datetime : " + QDateTime::currentDateTime().toString() + ", timer = " + timer.toString(), DEBUG);
|
||||||
|
|
||||||
|
if (priority > 3 or QDateTime::currentDateTime() > timer.addSecs(900))
|
||||||
{
|
{
|
||||||
debug(DEBUGMACRO, "looping to fill notif", DEBUG);
|
timer = QDateTime::currentDateTime();
|
||||||
|
debug(DEBUGMACRO, "looping to fill notif, priority = " + QString::number(priority), DEBUG);
|
||||||
for (auto [name, value]: propertyList.asKeyValueRange())
|
for (auto [name, value]: propertyList.asKeyValueRange())
|
||||||
{
|
{
|
||||||
QString unit;
|
debug(DEBUGMACRO, "Name = " + name + ", value = " + value, DEBUG);
|
||||||
QByteArray valueBA;
|
notif += propertyList[name];
|
||||||
debug(DEBUGMACRO, "Name = " + name + ", value = " + QString::number(value.toUInt()), DEBUG);
|
|
||||||
if (! propertyName.contains(name))
|
|
||||||
{
|
|
||||||
unit = "";
|
|
||||||
debug(DEBUGMACRO, "unit is empty ", DEBUG);
|
|
||||||
}else
|
|
||||||
{
|
|
||||||
unit = propertyName[name].second;
|
|
||||||
debug(DEBUGMACRO, "unit : " + unit, DEBUG);
|
|
||||||
QString dataType = value.typeName();
|
|
||||||
debug(DEBUGMACRO, "datatype is : " + dataType, DEBUG);
|
|
||||||
if (dataType == "double")
|
|
||||||
{
|
|
||||||
debug(DEBUGMACRO, "datatype is 'double'", DEBUG);
|
|
||||||
valueBA = QByteArray::number(round(value.toFloat()*100)/100);
|
|
||||||
}else if (dataType == "QString")
|
|
||||||
{
|
|
||||||
debug(DEBUGMACRO, "datatype is 'QString'" + value.toString(), DEBUG);
|
|
||||||
valueBA = value.toByteArray();
|
|
||||||
}else
|
|
||||||
{
|
|
||||||
debug(DEBUGMACRO, "datatype is null" + QString::number(value.toUInt()), DEBUG);
|
|
||||||
valueBA = value.toByteArray();
|
|
||||||
}
|
|
||||||
notif += formatNotifString(propertyName[name].first, unit, valueBA);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
debug(DEBUGMACRO, "calling notify with notif = #" + notif + "#", DEBUG);
|
debug(DEBUGMACRO, "calling notify with notif = #" + notif + "#", DEBUG);
|
||||||
notify (notif, priorityList[priority], attachment);
|
notify (notif, priorityList[priority], attachment);
|
||||||
@@ -462,7 +384,7 @@ void Pws2mqtt::parseData(QList<std::pair<QString, QString>> queryList)
|
|||||||
debug(DEBUGMACRO, "parseData: Returning", DEBUG);
|
debug(DEBUGMACRO, "parseData: Returning", DEBUG);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString getPluviosite(double value)
|
QString getPluviosite(double value, quint8 &priority)
|
||||||
{
|
{
|
||||||
if (value < 1)
|
if (value < 1)
|
||||||
{
|
{
|
||||||
@@ -470,15 +392,18 @@ QString getPluviosite(double value)
|
|||||||
}else if (value < 5)
|
}else if (value < 5)
|
||||||
{
|
{
|
||||||
return "Pluie Modérée";
|
return "Pluie Modérée";
|
||||||
}else if (value < 15)
|
}else if (value < 10)
|
||||||
{
|
{
|
||||||
|
priority = 4;
|
||||||
return "Pluie forte";
|
return "Pluie forte";
|
||||||
}else if (value > 30)
|
}else if (value < 30)
|
||||||
{
|
{
|
||||||
return "Évènement extrème";
|
priority = 5;
|
||||||
}else if (value > 15)
|
return "Pluie Très forte, risque d'inondation";
|
||||||
|
}else
|
||||||
{
|
{
|
||||||
return "Forte pluie";
|
priority = 5;
|
||||||
|
return "Pluie diluvienne, risque élevé d'inondations, crues";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ void notify (QString notif, QString priority = "low", QString inputPath = "");
|
|||||||
quint8 setPriority (quint8 currentPriority, quint8 newPriority);
|
quint8 setPriority (quint8 currentPriority, quint8 newPriority);
|
||||||
QString previsionMeteo(double currentPressure, double variation3h, quint8 &priority);
|
QString previsionMeteo(double currentPressure, double variation3h, quint8 &priority);
|
||||||
QString pressureVariation(double currentPressure, quint8 &priority);
|
QString pressureVariation(double currentPressure, quint8 &priority);
|
||||||
QString getPluviosite(double value);
|
QString getPluviosite(double value, quint8 &priority);
|
||||||
void rotateAndSaveImage(const QString &inputPath, const QString &outputPath, qreal angle=0);
|
void rotateAndSaveImage(const QString &inputPath, const QString &outputPath, qreal angle=0);
|
||||||
|
|
||||||
#endif // PWS2MQTT_H
|
#endif // PWS2MQTT_H
|
||||||
|
|||||||
Reference in New Issue
Block a user