1
|
#ifndef CURVEDATASERVER_H
|
2
|
#define CURVEDATASERVER_H
|
3
|
|
4
|
#include <QObject>
|
5
|
#include <QTcpServer>
|
6
|
#include <QTcpSocket>
|
7
|
|
8
|
class CurveDataServer : QObject
|
9
|
{
|
10
|
Q_OBJECT
|
11
|
|
12
|
public:
|
13
|
CurveDataServer();
|
14
|
void sendActuatorPosition(float x, float y, float z);
|
15
|
|
16
|
public slots:
|
17
|
void onNewConnection();
|
18
|
void onSocketStateChanged(QAbstractSocket::SocketState socketState);
|
19
|
void onReadyRead();
|
20
|
|
21
|
private:
|
22
|
QByteArray *putFloatIntoMessage(QByteArray *message, int index, float f);
|
23
|
void sendPreamble(QTcpSocket *socket);
|
24
|
void sendProtocolMagic(QTcpSocket *socket);
|
25
|
void sendVersion(QTcpSocket *socket);
|
26
|
|
27
|
QTcpServer _server;
|
28
|
QList<QTcpSocket*> _sockets;
|
29
|
};
|
30
|
|
31
|
#endif // CURVEDATASERVER_H
|