diff options
Diffstat (limited to 'client')
-rw-r--r-- | client/Client.cpp | 2 | ||||
-rw-r--r-- | client/HandleMessage.cpp | 3 | ||||
-rw-r--r-- | client/client.pro.user | 260 | ||||
-rw-r--r-- | client/consts.h | 2 | ||||
-rw-r--r-- | client/dbconnector.cpp | 8 | ||||
-rw-r--r-- | client/dbconnector.h | 6 | ||||
-rw-r--r-- | client/mainwindow.cpp | 3 |
7 files changed, 276 insertions, 8 deletions
diff --git a/client/Client.cpp b/client/Client.cpp index 4d948fa..87afe99 100644 --- a/client/Client.cpp +++ b/client/Client.cpp @@ -56,7 +56,7 @@ void Client::timeFunction() void Client::missingRecords() { QSqlQuery queryTimeData; - queryTimeData.exec("SELECT (unix_timestamp(now()) - unix_timestamp(`time`))/60 as delta FROM `WSdb`.`tblMain` limit 1"); + queryTimeData.exec( "SELECT (unix_timestamp(now()) - unix_timestamp(`time`))/60 as delta FROM `tblMain` limit 1"); _missingRecords = queryTimeData.value(0).toInt(); diff --git a/client/HandleMessage.cpp b/client/HandleMessage.cpp index aa73828..3d8823b 100644 --- a/client/HandleMessage.cpp +++ b/client/HandleMessage.cpp @@ -1,6 +1,5 @@ #include "HandleMessage.h" - HandleMessage::HandleMessage(QObject *parent) : QObject(parent) { @@ -17,7 +16,7 @@ QString HandleMessage::ParseMessage(const QString Msg , int totalRecords ) void HandleMessage::ParseToSQL(QString input) { QSqlQuery queryInsertData; - QString output = "INSERT INTO `WSdb`.`tblMain` () VALUES "; + QString output = "INSERT INTO `tblMain` (`temperature`, `humidity`, `pressure`) VALUES "; QStringList data; QStringList list = input.split("\n"); for (int i = 0; i < list.size(); ++i) { diff --git a/client/client.pro.user b/client/client.pro.user new file mode 100644 index 0000000..f6998e7 --- /dev/null +++ b/client/client.pro.user @@ -0,0 +1,260 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE QtCreatorProject> +<!-- Written by QtCreator 8.0.1, 2022-10-30T13:58:16. --> +<qtcreator> + <data> + <variable>EnvironmentId</variable> + <value type="QByteArray">{ea03b890-8d0a-4e25-9c8a-4324595ed9f6}</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> + </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">4</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> + </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">degoede</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">degoede</value> + <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{1e436ae3-d7a2-4102-aca0-911720324ec1}</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">/Users/jregnier/gitOnline/avans-whether-station-Qt/build-client-degoede-Debug</value> + <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">/Users/jregnier/gitOnline/avans-whether-station-Qt/build-client-degoede-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.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">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">/Users/jregnier/gitOnline/avans-whether-station-Qt/build-client-degoede-Release</value> + <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">/Users/jregnier/gitOnline/avans-whether-station-Qt/build-client-degoede-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> + <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2"> + <value type="int" key="EnableQmlDebugging">0</value> + <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/Users/jregnier/gitOnline/avans-whether-station-Qt/build-client-degoede-Profile</value> + <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory.shadowDir">/Users/jregnier/gitOnline/avans-whether-station-Qt/build-client-degoede-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">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">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">ProjectExplorer.CustomExecutableRunConfiguration</value> + <value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey"></value> + <value type="bool" key="RunConfiguration.UseCppDebugger">false</value> + <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">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">1</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> diff --git a/client/consts.h b/client/consts.h index 7ee81c8..a73fea7 100644 --- a/client/consts.h +++ b/client/consts.h @@ -1,5 +1,7 @@ #pragma once +#include "../shared/wifi.h" + // delay between new record request in seconds #define WS_CLIENT_STATION_POLL_INTERVAL 10 diff --git a/client/dbconnector.cpp b/client/dbconnector.cpp index 256ed53..bbffc58 100644 --- a/client/dbconnector.cpp +++ b/client/dbconnector.cpp @@ -51,3 +51,11 @@ void dbConnector::on_pushButton_login_clicked() QMessageBox::warning(this, "No connection", "Failed to connect"); } } + +QString dbConnector::getdbName(){ + return _dbName; +} + +QString dbConnector::getEspHost(){ + return _espHost; +} diff --git a/client/dbconnector.h b/client/dbconnector.h index 5b9b1cf..82b4f21 100644 --- a/client/dbconnector.h +++ b/client/dbconnector.h @@ -5,8 +5,7 @@ #include <QMessageBox> //#include <QtSql> //#include <QSqlDatabase> - -#define WS_ESP8266_WLAN_IP "129.168.0.1" +#include "consts.h" namespace Ui { class dbConnector; @@ -20,6 +19,9 @@ public: explicit dbConnector(QWidget *parent = nullptr); ~dbConnector(); + static QString getdbName(); + static QString getEspHost(); + private slots: void on_pushButton_cancel_clicked(); diff --git a/client/mainwindow.cpp b/client/mainwindow.cpp index 5f76ad8..dcffed6 100644 --- a/client/mainwindow.cpp +++ b/client/mainwindow.cpp @@ -108,8 +108,5 @@ void MainWindow::drawGraph(){ } else { QMessageBox::warning(this, "No connection", "Failed to connect"); } -// delete seriesTemperature; -// delete seriesHumidity; -// delete seriesPressure; } |