-
Notifications
You must be signed in to change notification settings - Fork 1
/
mainwindow.cpp
executable file
·81 lines (60 loc) · 2.03 KB
/
mainwindow.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "com/indeema/QPredix/qpredix.h"
#include <QDebug>
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow),
mTimeSeries{nullptr}
{
ui->setupUi(this);
QUaaInfo lInfo;
lInfo.setUaaUrl("your UaaUrl taken from Predix Uaa service");
lInfo.setBase64ClientCredential("Your credenticals in base64 in format \"client_id:secret\"");
QUaaUserInfo lUser;
lUser.setLogin("user credentials");
lUser.setPassword("user password");
mUaa = new QUaa(lInfo);
connect(mUaa, SIGNAL(loginSucceed(QUaa*)), this, SLOT(loginSucceed()));
mUaa->loginWithCredentials(lUser);
}
MainWindow::~MainWindow()
{
delete ui;
if (mTimeSeries != nullptr) {
delete mTimeSeries;
}
delete mUaa;
}
void MainWindow::loginSucceed()
{
qDebug() << __FUNCTION__;
mTimeSeries = new QTimeSeries(mUaa);
mTimeSeries->setZoneID("Your zone ID");
// QStringList lAttributes;
// lAttributes.append("test");
// QList<double> lQualities;
// lQualities.append(3);
// QList<double> lValues;
// lValues.append(36);
// QTimeSeriesMeasurements lMes;
// lMes.setCondition("First");
// lMes.setValues(lValues);
// QTimeSeriesTag lTag;
// lTag.setName("Test_sensor");
// lTag.setSuppressGroupByType(false);
// lTag.setAttributes(lAttributes);
// lTag.setQualities(lQualities);
// lTag.setMeasurements(lMes);
// QList<QTimeSeriesTag> lTags;
// lTags.append(lTag);
// QStringList lList;
// lList.append("TEST");
// mTimeSeries->getTags();
// mTimeSeries->getLatestDatapoints(lList);
// mTimeSeries->sendCustomRequest("{start: 1y-ago,tags: [ {name: TEST,order: desc,limit: 3 } ] }");
// mTimeSeries->getLimitedDatapoints(lList, 5);
// mTimeSeries->getFromToDatapoints(lList, "1152112200000", "2052112200000");
// mTimeSeries->openSocket();
mTimeSeries->sendData("123", 1);
}