53 lines
1.2 KiB
C++
Executable File
53 lines
1.2 KiB
C++
Executable File
/*
|
|
* @RDE_HEADER@
|
|
* Sending of telegrams to websocket
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
* Created by Hanna E. Rathje, SLTE, 2022-03-29
|
|
*/
|
|
#pragma once
|
|
|
|
#include "simulated_player.h"
|
|
|
|
#include <NGLLogger/INGLLogger.h>
|
|
|
|
#include <QTcpSocket>
|
|
|
|
namespace WlsRandomPositions
|
|
{
|
|
|
|
class Worker : public QObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
Worker(QObject *parent = nullptr);
|
|
~Worker();
|
|
|
|
void connectToServer(const QString &serverName, int serverPort);
|
|
void start(int numberParticipants, int firstEquipNo, qint64 firstMacAddress, int mSecs, int jitter, double maxDistance);
|
|
void stop();
|
|
void error();
|
|
|
|
signals:
|
|
void telegramsIncremented(int sentTelegrams);
|
|
void connectionStateChanged(bool connected, QString status);
|
|
|
|
private slots:
|
|
void onInit(const QString &macAddress, const QByteArray &content);
|
|
void onPosition(const QString &macAddress, QPointF pos, double height);
|
|
void onTcpConnected();
|
|
void onTcpDisconnected();
|
|
|
|
private:
|
|
QVector<SimulatedPlayer*> m_players;
|
|
QTcpSocket *m_tcpClient;
|
|
QString m_server;
|
|
int m_serverPort;
|
|
int m_sentTelegrams;
|
|
NGL::INGLLogger &m_logger;
|
|
};
|
|
|
|
} // Namespace WlsRandomPositions
|