QVisu
Qt-based visualization for smart homes
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
C:/Users/max/ti/qt5/qvisu/qvdriver.h
1 /* QVisu (c) 2015 Maximilian Gauger mgauger@kalassi.de
2  *
3  * This program is free software: you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License as published by
5  * the Free Software Foundation, either version 2 of the License, or
6  * (at your option) any later version.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12 
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  */
16 
17 #ifndef QVDRIVER_H
18 #define QVDRIVER_H
19 
20 #include <QObject>
21 #include <QTimer>
22 #include <QThread>
23 #include <QtXml>
24 #include <QStringList>
25 #include "qvwebsocket.h"
26 
27 class QVDriver : public QObject
28 {
29  Q_OBJECT
30 public:
31  explicit QVDriver(QDomElement xml_data, QStringList item_list, QObject *parent = 0);
32  ~QVDriver();
33 
34 signals:
35  void initialized();
36  void valueChanged(QString,QString);
37  void seriesReceived(QString,QMap<double,double>);
38  void sendTextMessage(QString);
39 
40 public slots:
41  void onValueModified(QString,QString);
42  void onSeriesRequest(QString item, QString series_type, QString start);
43 
44 private slots:
45  void onConnected();
46  void onDisconnected();
47  void onReopenTimer();
48  void onTextMessageReceived(QString message);
49  void shutdown();
50 
51 private:
52  QVWebsocket *webSocket;
53  QUrl webSocketUrl;
54 #ifdef USE_THREADS
55  QThread *socket_thread;
56 #endif
57 
58  QStringList item_list;
59  QStringList series_list;
60  bool closing;
61  QTimer *reopen_timer;
62 };
63 
64 #endif // QVDRIVER_H
Definition: qvwebsocket.h:32
Definition: qvdriver.h:27