diff options
-rw-r--r-- | .gitignore | 4 | ||||
-rw-r--r-- | client/Client.cpp | 26 | ||||
-rw-r--r-- | client/Client.h | 15 | ||||
-rw-r--r-- | client/HandleMessage.h | 2 | ||||
-rw-r--r-- | client/client.pro | 1 | ||||
-rw-r--r-- | client/client.pro.user | 262 | ||||
-rw-r--r-- | client/consts.h | 5 | ||||
-rw-r--r-- | client/dbconnector.h | 1 | ||||
-rw-r--r-- | client/dbconnector.ui | 4 | ||||
-rw-r--r-- | shared/wifi.def.h (renamed from stm32f091/wifi.def.h) | 1 | ||||
-rw-r--r-- | stm32f091/consts.h | 5 | ||||
-rw-r--r-- | stm32f091/esp8266.c | 2 | ||||
-rw-r--r-- | stm32f091/readme.md | 3 | ||||
-rw-r--r-- | stm32f091/util.h | 4 |
14 files changed, 40 insertions, 295 deletions
@@ -6,14 +6,16 @@ # stm32-specific files stm32f091/main.elf stm32f091/main.bin -stm32f091/wifi.h # client-specific files client/makefile client/client client/moc_* +client/ui_* +**/.user # others +shared/wifi.h shared/main .qmake.stash .vscode/.cortex-debug.registers.state.json diff --git a/client/Client.cpp b/client/Client.cpp index 46952b6..4d948fa 100644 --- a/client/Client.cpp +++ b/client/Client.cpp @@ -1,5 +1,8 @@ -#include "Client.h" +#include <stdio.h> +#include "Client.h" +#include "consts.h" +#include "../shared/util.h" Client::Client(QObject *parent) : QObject(parent) @@ -17,8 +20,6 @@ Client::~Client() void Client::ClientEcho() { - QTime time1 = QTime::currentTime(); - NextMinute = time1.minute()+1; connect(timer, SIGNAL(timeout()),this,SLOT(timeFunction())); // connect timer to time every minute @@ -36,22 +37,19 @@ void Client::ClientEcho() void Client::timeFunction() { - if(_missingRecords>1){ - totalRecords = _missingRecords; - } - else{ - totalRecords=1; - } - QByteArray msgToSend= (msg.toUtf8() + totalRecords + offsetRecords +'\n'); + totalRecords = WS_MAX(1, _missingRecords); + + char* msg = NULL; + asprintf(&msg, "last-records %x %x\n", totalRecords, offsetRecords); + QByteArray msgToSend = msg; + free(msg); QTime time = QTime::currentTime(); - qint16 currentMinute = time.minute(); + qint16 currentSeconds = time.second(); + if((currentSeconds % WS_CLIENT_STATION_POLL_INTERVAL) == 1){ - if(currentMinute==NextMinute){ socket->connectToHost(networkAddress, tcpPortAddress); - socket->write(msgToSend); - NextMinute++; } } diff --git a/client/Client.h b/client/Client.h index 10af3e1..b90e5e9 100644 --- a/client/Client.h +++ b/client/Client.h @@ -1,5 +1,6 @@ #ifndef CLIENT_H #define CLIENT_H + #include <QTcpSocket> #include <QTextStream> #include <QTimer> @@ -7,6 +8,7 @@ #include <QSqlQuery> #include "HandleMessage.h" +#include "../shared/wifi.h" // class client for wheather station class Client : public QObject @@ -27,19 +29,14 @@ private: QTcpSocket *socket; // tcpsocket for communicating QTimer *timer; // timer to read every second what time it curruntly is. - qint16 NextMinute; // timing for next minute // qint16 currentMinute; // timing for currentMinute HandleMessage Handlemsg; // add HandleMessage to Client.h - int tcpPortAddress = 80; // port of communication via tcp - QString networkAddress = "192.168.137.76"; // network address for commincation via tcp - - QString msg = "last-records "; // part of mesage to send to wheather staion - char totalRecords = '1'; // total records to ask wheather station - char offsetRecords = '0'; // offset from reqeusting records - - + int tcpPortAddress = WS_SERVER_PORT; // port of communication via tcp + QString networkAddress = WS_ESP8266_WLAN_IP; // network address for commincation via tcp + uint8_t totalRecords = 1; // total records to ask wheather station + uint8_t offsetRecords = 0; // offset from reqeusting records }; #endif // CLIENT_H diff --git a/client/HandleMessage.h b/client/HandleMessage.h index bfc5063..f228633 100644 --- a/client/HandleMessage.h +++ b/client/HandleMessage.h @@ -16,8 +16,6 @@ public: QString ParseMessage(const QString , int); void ParseToSQL(QString); - - private: }; diff --git a/client/client.pro b/client/client.pro index 76f2b56..8305949 100644 --- a/client/client.pro +++ b/client/client.pro @@ -3,6 +3,7 @@ QT += core gui sql charts network HEADERS += \ Client.h \ HandleMessage.h \ + consts.h \ dbconnector.h \ main.h \ mainwindow.h diff --git a/client/client.pro.user b/client/client.pro.user deleted file mode 100644 index 66c80ac..0000000 --- a/client/client.pro.user +++ /dev/null @@ -1,262 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE QtCreatorProject> -<!-- Written by QtCreator 8.0.1, 2022-10-30T12:06:18. --> -<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">Qt4ProjectManager.Qt4RunConfiguration:/Users/jregnier/gitOnline/avans-whether-station-Qt/client/client.pro</value> - <value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey">/Users/jregnier/gitOnline/avans-whether-station-Qt/client/client.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="QString" key="RunConfiguration.WorkingDirectory.default">/Users/jregnier/gitOnline/avans-whether-station-Qt/build-client-degoede-Debug/client.app/Contents/MacOS</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 new file mode 100644 index 0000000..7ee81c8 --- /dev/null +++ b/client/consts.h @@ -0,0 +1,5 @@ +#pragma once + +// delay between new record request in seconds +#define WS_CLIENT_STATION_POLL_INTERVAL 10 + diff --git a/client/dbconnector.h b/client/dbconnector.h index 4737d6f..5b9b1cf 100644 --- a/client/dbconnector.h +++ b/client/dbconnector.h @@ -8,7 +8,6 @@ #define WS_ESP8266_WLAN_IP "129.168.0.1" - namespace Ui { class dbConnector; } diff --git a/client/dbconnector.ui b/client/dbconnector.ui index 22e0a64..fe9c05e 100644 --- a/client/dbconnector.ui +++ b/client/dbconnector.ui @@ -6,8 +6,8 @@ <rect> <x>0</x> <y>0</y> - <width>362</width> - <height>273</height> + <width>401</width> + <height>288</height> </rect> </property> <property name="windowTitle"> diff --git a/stm32f091/wifi.def.h b/shared/wifi.def.h index 61e1706..aead0b6 100644 --- a/stm32f091/wifi.def.h +++ b/shared/wifi.def.h @@ -4,4 +4,5 @@ #define WS_ESP8266_WLAN_PASSWD "12345678" // #define WS_ESP8266_WLAN_MAC "f2:9b:89:47:c4:f3" // #define WS_ESP8266_WLAN_IP "192.168.2.69" +#define WS_SERVER_PORT 80 diff --git a/stm32f091/consts.h b/stm32f091/consts.h index 3d2ef5a..6d5b8d2 100644 --- a/stm32f091/consts.h +++ b/stm32f091/consts.h @@ -1,9 +1,10 @@ #pragma once -#include "wifi.h" +#include "../shared/wifi.h" +#include "util.h" -#define WS_SERVER_PORT "80" #define WS_SERVER_MAX_CHANNELS 4 +#define WS_SERVER_PORT_STR WS_MTS(WS_SERVER_PORT) #define WS_DMA_RX_BUFFER_SIZE 100 #define WS_DMA_TX_BUFFER_SIZE 1024 diff --git a/stm32f091/esp8266.c b/stm32f091/esp8266.c index 74ec347..8ff9547 100644 --- a/stm32f091/esp8266.c +++ b/stm32f091/esp8266.c @@ -77,7 +77,7 @@ void ws_esp8266_ap_client_mode() { void ws_esp8266_start_tcp_server() { ws_esp8266_send_seq("AT+CIPSERVER=0\r\n"); // stop tcp server (if running) ws_esp8266_send_seq("AT+CIPMUX=1\r\n"); // enable multiplexing (allow multiple connections) - ws_esp8266_send_seq("AT+CIPSERVER=1," WS_SERVER_PORT "\r\n"); // start tcp server + ws_esp8266_send_seq("AT+CIPSERVER=1," WS_SERVER_PORT_STR "\r\n"); // start tcp server } void ws_esp8266_set_mac() { diff --git a/stm32f091/readme.md b/stm32f091/readme.md index d2758b5..e6af60f 100644 --- a/stm32f091/readme.md +++ b/stm32f091/readme.md @@ -3,7 +3,8 @@ - uses make - make sure to initialize the git submodules - all warnings from source files in the lib/ subfolder are hidden -- copy wifi.def.h to wifi.h and edit the network credentials +- copy ../shared/wifi.def.h to ../shared/wifi.h and edit the network + credentials - the initialization code is broken in some way which means that a soft reset is required for the uart dma to work, either (a) press the reset button on the development board after plugging in, or (b) run `st-flash reset` after diff --git a/stm32f091/util.h b/stm32f091/util.h index 11bee6f..9c15f8b 100644 --- a/stm32f091/util.h +++ b/stm32f091/util.h @@ -8,6 +8,10 @@ #include "setup.h" #include "../shared/util.h" +// macro to string macro's +#define WS_MTS_EXPAND(x) #x +#define WS_MTS(x) WS_MTS_EXPAND(x) + #define WS_DBG_TTY_COLOR_BLK 0x0 #define WS_DBG_TTY_COLOR_RED 0x1 #define WS_DBG_TTY_COLOR_GRN 0x2 |