mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
ProtoBuffer, UDPListener ...
Protocol Buffer reimplemented to receive image data from third-party apps The status of the component "UDPListener" is now displayed correctly in WebUI Global signal names for WebUI added
This commit is contained in:
67
include/protoserver/ProtoServer.h
Normal file
67
include/protoserver/ProtoServer.h
Normal file
@@ -0,0 +1,67 @@
|
||||
#pragma once
|
||||
|
||||
// util
|
||||
#include <utils/Logger.h>
|
||||
#include <utils/settings.h>
|
||||
|
||||
// qt
|
||||
#include <QVector>
|
||||
|
||||
class QTcpServer;
|
||||
class ProtoClientConnection;
|
||||
|
||||
///
|
||||
/// @brief This class creates a TCP server which accepts connections wich can then send
|
||||
/// in Protocol Buffer encoded commands. This interface to Hyperion is used by various
|
||||
/// third-party applications
|
||||
///
|
||||
class ProtoServer : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ProtoServer(const QJsonDocument& config, QObject* parent = nullptr);
|
||||
~ProtoServer();
|
||||
|
||||
public slots:
|
||||
///
|
||||
/// @brief Handle settings update
|
||||
/// @param type The type from enum
|
||||
/// @param config The configuration
|
||||
///
|
||||
void handleSettingsUpdate(const settings::type& type, const QJsonDocument& config);
|
||||
|
||||
void initServer();
|
||||
|
||||
private slots:
|
||||
///
|
||||
/// @brief Is called whenever a new socket wants to connect
|
||||
///
|
||||
void newConnection();
|
||||
|
||||
///
|
||||
/// @brief is called whenever a client disconnected
|
||||
///
|
||||
void clientDisconnected();
|
||||
|
||||
private:
|
||||
///
|
||||
/// @brief Start the server with current _port
|
||||
///
|
||||
void startServer();
|
||||
|
||||
///
|
||||
/// @brief Stop server
|
||||
///
|
||||
void stopServer();
|
||||
|
||||
|
||||
private:
|
||||
QTcpServer* _server;
|
||||
Logger* _log;
|
||||
int _timeout;
|
||||
quint16 _port;
|
||||
const QJsonDocument _config;
|
||||
|
||||
QVector<ProtoClientConnection*> _openConnections;
|
||||
};
|
Reference in New Issue
Block a user