Update to support both Qt 4 and Qt 5
[apps/thermostat-demo.git] / remoteaccessmanager.h
1 #ifndef REMOTEACCESSMANAGER_H
2 #define REMOTEACCESSMANAGER_H
4 #include <qglobal.h>
5 #include <QHash>
6 #include <QObject>
7 #include <QVariant>
9 class GlobalSettings;
10 class QTcpServer;
11 class QTcpSocket;
13 class RemoteAccessManager : public QObject
14 {
15     Q_OBJECT
16 public:
17     explicit RemoteAccessManager(QObject *parent = 0);
18     ~RemoteAccessManager();
19     
20     void start();
21     void stop();
23 signals:
24     void remoteChangeReceived(QHash<QString, QVariant> getVariables);
25     
26 public slots:
27     void handleIncomingConnection();
28     void processIncomingConnection();
30 private:
31     QTcpServer* m_tcpServer;
32     qint16 m_listenPort;
34     GlobalSettings* m_globalSettings;
35     QTcpSocket* m_clientConnection;
37     QByteArray hashToJSONByteArray(QHash<QString, QVariant> hash);
39     QHash<QString, QVariant> m_oldData;
40 };
42 #endif // REMOTEACCESSMANAGER_H