-
Notifications
You must be signed in to change notification settings - Fork 0
/
zettalistenerconnection.h
53 lines (44 loc) · 1.34 KB
/
zettalistenerconnection.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
#if !defined(ZETTALISTENERCONNECTION_H)
#define ZETTALISTENERCONNECTION_H
#include <QByteArray>
#include <QIODevice>
#include <QTcpSocket>
#include <QTcpServer>
#include <QAbstractSocket>
#include <QSharedMemory>
#include <QSet>
#include <QDateTime>
#include <QMap>
#include <QDataStream>
#define CONNECTIONTYPE_TCPSERVER 0
#define CONNECTIONTYPE_SHAREDMEMORY 1
class ZettaListenerConnection : public QObject {
Q_OBJECT
public:
ZettaListenerConnection();
~ZettaListenerConnection();
QTcpServer *m_tcpServer;// the tcp server will at the very least be used for receiving readyRead signals.
QSharedMemory *m_sharedMemory;
QByteArray m_buffer;
int m_connectionType;
int m_connectionStatus;
int m_tcpPortNumber;
QSet<QTcpSocket*> m_connectionSet;
public slots:
void changeConnectionType(int);
void newConnection();
void closeTcpServer();
void establishTcpServer(int port);
private slots:
void appendToSocketList(QTcpSocket *socket);
void readSocket();
void deleteSocket();
signals:
void signalMessage(QString,QString);
void connectionChanged(bool,int);
void dataReady(QMap<QString,QString>);
void appendLog(const QString &str);
void alert(const QString& windowTitle, const QString &windowInfo);
void insertRecord(QMap<QString,QString>&map);
};
#endif // ZETTALISTENERCONNECTION_H