Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
+47
@@ -0,0 +1,47 @@
|
||||
/**
|
||||
* Websocket interface to participant positions
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Justus Hertel, SLSE, 2017-01-11
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
#include <QWebSocketServer>
|
||||
#include <ParticipantManagement/ppm_common.h>
|
||||
#include "logger.h"
|
||||
|
||||
namespace ParticipantManagement
|
||||
{
|
||||
|
||||
class WebSocketHandler : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit WebSocketHandler(QObject *parent = nullptr);
|
||||
~WebSocketHandler();
|
||||
|
||||
bool init(quint16 listenPort = 0);
|
||||
bool init(const QPair<quint16, quint16> &portRange);
|
||||
bool isConnected() const { return !m_webSockets.isEmpty(); }
|
||||
quint16 listenPort() const { return m_webSocketServer->serverPort(); }
|
||||
bool sendPosition(const ParticipantPosition& participantPosition, int equipmentNumber) const;
|
||||
|
||||
private:
|
||||
bool sendTelegramInternal(const ParticipantPosition& pos, int eqNo) const;
|
||||
|
||||
private Q_SLOTS:
|
||||
void onNewConnection();
|
||||
void onWebSocketDisconnected();
|
||||
|
||||
private:
|
||||
QWebSocketServer* m_webSocketServer = nullptr;
|
||||
QVector<QWebSocket*> m_webSockets;
|
||||
|
||||
LOGGER_T m_logger;
|
||||
};
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user