-
Notifications
You must be signed in to change notification settings - Fork 0
/
dtsensor.h
49 lines (38 loc) · 1.06 KB
/
dtsensor.h
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
#ifndef DTSENSOR_H
#define DTSENSOR_H
#include <QObject>
#include <QMap>
#include <QString>
#include <QDateTime>
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include "dtauth.h"
class DTSensor : public QObject
{
Q_OBJECT
public:
explicit DTSensor(const QString &sensorId, const QString &projectId, DTAuth *auth, QNetworkAccessManager *nm, QObject *parent = nullptr);
enum SensorType { UnknownType, Temperature, Proximity, Touch };
Q_ENUM(SensorType)
enum ProximityState { UnknownState, Present , NotPresent };
Q_ENUM(ProximityState)
signals:
public slots:
void downloadData(const QString &accessToken);
void dataDownloaded(QNetworkReply *reply);
private:
QString sensorId;
QString projectId;
SensorType type;
QString name;
QString description;
QDateTime updated;
double temperatureCelcius;
QDateTime touchTime;
ProximityState proximityState;
int batteryPercentage;
QMap<QString, int> cloudConnectors;
QNetworkAccessManager *networkManager;
DTAuth *auth;
};
#endif // DTSENSOR_H