-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathuploaddata.cpp
60 lines (47 loc) · 1.34 KB
/
uploaddata.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include "uploaddata.h"
uploaddata::uploaddata(QList<QPair<QString , float> > *dataList, QMutex *dataListLocker , QObject *parent) :
QThread(parent)
{
this->DataList = dataList;
this->DataListLocker = dataListLocker;
}
uploaddata::uploaddata(QObject *parent)
{
waterData.CN = "2011";
atmosphereData.CN = "2011";
}
void uploaddata::run()
{
while(true)
{
pushWaterData ();
pushAtmosphereData ();
sleep(3);
}
}
void uploaddata::refreshData()
{
// if (this->DataList->first ().first == "B03-Rtd")
// {
// this->dataToPush.CPOriginal.B03_Rtd = this->DataList->first ().second;
// }
// else if (this->DataList->first ().first == "12_Rtd")
// {
// }
// else if (this->DataList->first ().first == "S01-Rtd")
// {
// }
}
void uploaddata::pushWaterData()
{
this->waterData.CPOriginal.S01_Rtd = QString::number (qrand() % ((300 + 1) - 100) + 100,'f',1);
this->waterData.CPOriginal.Z12_Rtd = QString::number (qrand() % ((3000 + 1) - 1000) + 100,'f',3);
this->waterData.ST="22";
emit sendData (waterData.generatePackage ());
}
void uploaddata::pushAtmosphereData()
{
this->atmosphereData.CPOriginal.B03_Rtd = QString::number (qrand() % ((300 + 1) - 100) + 100,'f',1);
this->atmosphereData.ST="23";
emit sendData (atmosphereData.generatePackage ());
}