-
Notifications
You must be signed in to change notification settings - Fork 0
/
callbackserver.h
48 lines (36 loc) · 1.03 KB
/
callbackserver.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
#ifndef CALLBACKSERVER_H
#define CALLBACKSERVER_H
#include <QtCore/QObject>
#include <QtCore/QVariantMap>
#include <QtNetwork/QHostAddress>
#include <QtNetwork/QTcpServer>
namespace com { namespace cutehacks { namespace auctor {
class CallbackServer : public QTcpServer
{
Q_OBJECT
Q_PROPERTY(int port READ port WRITE setPort NOTIFY portChanged)
Q_PROPERTY(QString address READ address WRITE setAddress NOTIFY addressChanged)
public:
explicit CallbackServer(QObject *parent = 0);
int port() const { return m_port; }
QString address() const;
protected:
void start();
void stop();
void restartServer();
void incomingConnection(qintptr socketDescription);
signals:
void portChanged(int port);
void addressChanged(QString address);
void callbackCalled(QVariantMap params);
public slots:
void setPort(int port);
void setAddress(QString address);
void emitCallback(QVariantMap);
private:
int m_port;
QHostAddress m_address;
QString m_code;
};
} } }
#endif // CALLBACKSERVER_H