forked from vranki/ExtPlane
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtcpclient.h
48 lines (43 loc) · 1.19 KB
/
tcpclient.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 TCPCLIENT_H
#define TCPCLIENT_H
#include <QObject>
#include <QStringList>
#include <QTcpSocket>
#include <QString>
#include <QSet>
#include <QVector>
#include <QHostAddress>
class DataRef;
class DataRefProvider;
/**
* Handles single client connection and tracks subscribed datarefs
*/
class TcpClient : public QObject
{
Q_OBJECT
public:
explicit TcpClient(QObject *parent, QTcpSocket *socket, DataRefProvider *refProvider);
~TcpClient();
QSet<QString> listRefs();
public slots:
void readClient();
void refChanged(DataRef *ref);
void socketError(QAbstractSocket::SocketError err);
signals:
void discoed(TcpClient *client);
void setFlightLoopInterval(float newInterval);
private:
DataRef *getSubscribedRef(QString name);
QTcpSocket *_socket;
QSet<DataRef*> _subscribedRefs;
//QMap<DataRef*, double> _refAccuracy;
QMap<DataRef*, double> _refValueD;
QMap<DataRef*, float> _refValueF;
QMap<DataRef*, QVector<float> > _refValueFA;
QMap<DataRef*, QVector<int> > _refValueIA;
QMap<DataRef*, int> _refValueI;
QMap<DataRef*, QByteArray> _refValueB;
QSet<int> _heldButtons;
DataRefProvider *_refProvider;
};
#endif // TCPCLIENT_H