Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
Executable
+41
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
* Websocket interface for building control unit
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
* Created by Christian Ehrlicher, SLSE, 2017-01-30
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QWebSocketServer>
|
||||
#include "logger.h"
|
||||
#include "abstract_socket_handler.h"
|
||||
|
||||
namespace GuezNasat
|
||||
{
|
||||
class WebSocketHandler : public AbstractSocketHandler
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit WebSocketHandler(QObject *parent = nullptr);
|
||||
~WebSocketHandler();
|
||||
|
||||
bool init(quint16 listenPort) override;
|
||||
bool isConnected() const override
|
||||
{
|
||||
return !m_webSockets.isEmpty();
|
||||
}
|
||||
protected:
|
||||
bool sendTelegramInternal(const QByteArray &tele) override;
|
||||
|
||||
private Q_SLOTS:
|
||||
void onNewConnection();
|
||||
void onWebSocketDisconnected();
|
||||
void onTextMessageReceived(const QString &msg);
|
||||
private:
|
||||
QWebSocketServer *m_webSocketServer;
|
||||
QSet<QWebSocket *> m_webSockets;
|
||||
};
|
||||
|
||||
} // namespace GuezNasat
|
||||
Reference in new issue
Block a user