Initial commit
This commit is contained in:
commit
b7d90b9afe
16245 files changed
+3396666
No files matched your search
@@ -0,0 +1,61 @@
|
||||
/**
|
||||
* @RDE_HEADER@
|
||||
* Websocket Server to connect to NGSConnector
|
||||
* $Id$
|
||||
* $HeadURL$
|
||||
* $Author$
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
#include <QWebSocket>
|
||||
#include <QWebSocketServer>
|
||||
|
||||
#include <NGLLogger/NGLLoggerBootstrap.h>
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace HighLevelArchitecture
|
||||
{
|
||||
|
||||
class NgsHandler;
|
||||
|
||||
//
|
||||
// class WsInterface
|
||||
//
|
||||
class WsInterface : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit WsInterface(std::shared_ptr<NgsHandler> ngsHandler, QObject *parent = 0);
|
||||
~WsInterface();
|
||||
|
||||
bool init(quint16 listenPort);
|
||||
bool isConnected() const { return !m_clients.isEmpty(); }
|
||||
|
||||
signals:
|
||||
|
||||
private:
|
||||
QWebSocketServer *m_wsServer;
|
||||
QSet<QWebSocket *> m_clients;
|
||||
|
||||
std::shared_ptr<NgsHandler> m_ngsHandler;
|
||||
|
||||
NGL::INGLLogger &m_logger;
|
||||
|
||||
private slots:
|
||||
// From Websocket:
|
||||
void onNewConnection();
|
||||
void onWebSocketDisconnected();
|
||||
void onError(QAbstractSocket::SocketError error);
|
||||
void onTextMessageReceived(const QString &msg);
|
||||
|
||||
void processMessage(const QByteArray baJson);
|
||||
|
||||
// From NGSConnector:
|
||||
// empty
|
||||
};
|
||||
|
||||
} // HighLevelArchitecture
|
||||
Reference in new issue
Block a user