aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNielsCoding <n.stunnebrink@student.avans.nl>2022-10-30 10:15:05 +0100
committerNielsCoding <n.stunnebrink@student.avans.nl>2022-10-30 10:15:05 +0100
commiteb10a1a6dc03d83284788128d3f77ff57852c3c6 (patch)
tree221e189fe3f7bd76d38d1efdce0922fb56e2e60d
parentb5322d74d1839c4af490f5c7297e439a8433ba9b (diff)
intervals added and consts.h
-rw-r--r--client/Client.cpp11
-rw-r--r--client/Client.h2
-rw-r--r--client/HandleMessage.h2
-rw-r--r--client/client.pro1
-rw-r--r--client/client.pro.user8
-rw-r--r--client/consts.h10
-rw-r--r--client/dbconnector.cpp2
-rw-r--r--client/dbconnector.h1
-rw-r--r--client/dbconnector.ui8
9 files changed, 26 insertions, 19 deletions
diff --git a/client/Client.cpp b/client/Client.cpp
index 46952b6..01c3867 100644
--- a/client/Client.cpp
+++ b/client/Client.cpp
@@ -1,5 +1,5 @@
#include "Client.h"
-
+#include "consts.h"
Client::Client(QObject *parent) : QObject(parent)
@@ -17,8 +17,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
@@ -45,13 +43,12 @@ void Client::timeFunction()
QByteArray msgToSend= (msg.toUtf8() + totalRecords + offsetRecords +'\n');
QTime time = QTime::currentTime();
- qint16 currentMinute = time.minute();
+ qint16 currentSeconds = time.second();
+ auto _intervals = intervals;
+ if(currentSeconds % _intervals==0){
- if(currentMinute==NextMinute){
socket->connectToHost(networkAddress, tcpPortAddress);
-
socket->write(msgToSend);
- NextMinute++;
}
}
diff --git a/client/Client.h b/client/Client.h
index 10af3e1..38419a8 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>
@@ -27,7 +28,6 @@ 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
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
index 7ccbc7b..78fe5c2 100644
--- a/client/client.pro.user
+++ b/client/client.pro.user
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
-<!-- Written by QtCreator 8.0.1, 2022-10-29T18:40:37. -->
+<!-- Written by QtCreator 8.0.1, 2022-10-30T09:30:24. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
@@ -235,12 +235,14 @@
<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="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:D:/Github2/avans-whether-station/client/client.pro</value>
+ <value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey">D:/Github2/avans-whether-station/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">D:/Github2/avans-whether-station/build-client-Desktop_Qt_6_4_0_MinGW_64_bit-Debug</value>
</valuemap>
<value type="qlonglong" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
</valuemap>
diff --git a/client/consts.h b/client/consts.h
new file mode 100644
index 0000000..1bc6040
--- /dev/null
+++ b/client/consts.h
@@ -0,0 +1,10 @@
+#ifndef CONSTS_H
+#define CONSTS_H
+
+
+
+
+#define intervals 10;
+
+
+#endif // CONSTS_H
diff --git a/client/dbconnector.cpp b/client/dbconnector.cpp
index 186f8f7..8643014 100644
--- a/client/dbconnector.cpp
+++ b/client/dbconnector.cpp
@@ -3,7 +3,7 @@
#include "main.h"
#include "mainwindow.h"
-
+#
dbConnector::dbConnector(QWidget *parent) :
QDialog(parent),
ui(new Ui::dbConnector)
diff --git a/client/dbconnector.h b/client/dbconnector.h
index db8ac4e..b989e57 100644
--- a/client/dbconnector.h
+++ b/client/dbconnector.h
@@ -6,7 +6,6 @@
//#include <QtSql>
//#include <QSqlDatabase>
-
namespace Ui {
class dbConnector;
}
diff --git a/client/dbconnector.ui b/client/dbconnector.ui
index 1159faf..5c5b326 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">
@@ -18,8 +18,8 @@
<rect>
<x>60</x>
<y>60</y>
- <width>241</width>
- <height>173</height>
+ <width>270</width>
+ <height>171</height>
</rect>
</property>
<layout class="QFormLayout" name="formLayout">