-
Notifications
You must be signed in to change notification settings - Fork 506
/
de_web_plugin.h
74 lines (63 loc) · 1.93 KB
/
de_web_plugin.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
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
/*
* Copyright (c) 2017-2018 dresden elektronik ingenieurtechnik gmbh.
* All rights reserved.
*
* The software in this package is published under the terms of the BSD
* style license a copy of which has been included with this distribution in
* the LICENSE.txt file.
*
*/
#ifndef REST_PLUGIN_H
#define REST_PLUGIN_H
#include <list>
#include <QObject>
#include <deconz.h>
class DeRestWidget;
class DeRestPluginPrivate;
class DeviceWidget;
class QTimer;
#if DECONZ_LIB_VERSION < 0x010800
#error "The REST plugin requires at least deCONZ library version 1.8.0."
#endif
class DeRestPlugin : public QObject,
public deCONZ::NodeInterface,
public deCONZ::HttpClientHandler
{
Q_OBJECT
Q_INTERFACES(deCONZ::NodeInterface)
#if QT_VERSION >= 0x050000
Q_PLUGIN_METADATA(IID "org.dresden-elektronik.DeRestPlugin")
#endif
public:
explicit DeRestPlugin(QObject *parent = 0);
~DeRestPlugin();
// node interface
const char *name();
bool hasFeature(Features feature);
QWidget *createWidget();
QDialog *createDialog();
// http client handler interface
bool isHttpTarget(const QHttpRequestHeader &hdr);
int handleHttpRequest(const QHttpRequestHeader &hdr, QTcpSocket *sock);
void clientGone(QTcpSocket *sock);
bool pluginActive() const;
public Q_SLOTS:
bool dbSaveAllowed() const;
void idleTimerFired();
void refreshAll();
void startZclAttributeTimer(int delay);
void stopZclAttributeTimer();
void checkZclAttributeTimerFired();
void appAboutToQuit();
bool startUpdateFirmware();
const QString &getNodeName(quint64 extAddress) const;
Q_SIGNALS:
void nodeUpdated(quint64 extAddress, QString key, QString value);
private:
QTimer *m_idleTimer = nullptr;
QTimer *m_readAttributesTimer = nullptr;
friend class DeRestWidget;
DeRestWidget *m_w = nullptr;
DeRestPluginPrivate *d = nullptr;
};
#endif // REST_PLUGIN_H