mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
UDP listener removed because this class is not multi-instance capable. For a new implementation, image data is needed instead of led colors.
Signed-off-by: Paulchen-Panther <Paulchen-Panter@protonmail.com>
This commit is contained in:
@@ -110,7 +110,7 @@ public:
|
||||
// list of global settings
|
||||
QStringList list;
|
||||
// server port services
|
||||
list << "jsonServer" << "protoServer" << "flatbufServer" << "udpListener" << "forwarder" << "webConfig" << "network"
|
||||
list << "jsonServer" << "protoServer" << "flatbufServer" << "forwarder" << "webConfig" << "network"
|
||||
// capture
|
||||
<< "framegrabber" << "grabberV4L2"
|
||||
// other
|
||||
|
@@ -1,114 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
// system includes
|
||||
#include <cstdint>
|
||||
|
||||
// Qt includes
|
||||
#include <QSet>
|
||||
#include <QHostAddress>
|
||||
#include <QJsonDocument>
|
||||
|
||||
// Hyperion includes
|
||||
#include <utils/Logger.h>
|
||||
#include <utils/Components.h>
|
||||
#include <utils/ColorRgb.h>
|
||||
|
||||
// settings
|
||||
#include <utils/settings.h>
|
||||
|
||||
class BonjourServiceRegister;
|
||||
class QUdpSocket;
|
||||
class NetOrigin;
|
||||
class Hyperion;
|
||||
|
||||
///
|
||||
/// This class creates a UDP server which accepts connections from boblight clients.
|
||||
///
|
||||
class UDPListener : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
///
|
||||
/// UDPListener constructor
|
||||
/// @param hyperion Hyperion instance
|
||||
/// @param port port number on which to start listening for connections
|
||||
///
|
||||
UDPListener(const QJsonDocument& config);
|
||||
~UDPListener();
|
||||
|
||||
///
|
||||
/// @return the port number on which this UDP listens for incoming connections
|
||||
///
|
||||
uint16_t getPort() const;
|
||||
|
||||
///
|
||||
/// @return true if server is active (bind to a port)
|
||||
///
|
||||
bool active() { return _isActive; };
|
||||
|
||||
public slots:
|
||||
///
|
||||
/// bind server to network
|
||||
///
|
||||
void start();
|
||||
|
||||
///
|
||||
/// close server
|
||||
///
|
||||
void stop();
|
||||
|
||||
void updatedComponentState(const hyperion::Components component, const bool enable);
|
||||
|
||||
///
|
||||
/// @brief Handle settings update from Hyperion Settingsmanager emit or this constructor
|
||||
/// @param type settingyType from enum
|
||||
/// @param config configuration object
|
||||
///
|
||||
void handleSettingsUpdate(const settings::type& type, const QJsonDocument& config);
|
||||
|
||||
signals:
|
||||
///
|
||||
/// @brief forward register data to HyperionDaemon
|
||||
///
|
||||
void registerGlobalInput(const int priority, const hyperion::Components& component, const QString& origin = "System", const QString& owner = "", unsigned smooth_cfg = 0);
|
||||
|
||||
///
|
||||
/// @brief forward led data to HyperionDaemon
|
||||
///
|
||||
const bool setGlobalInput(const int priority, const std::vector<ColorRgb>& ledColors, const int timeout_ms = -1, const bool& clearEffect = true);
|
||||
|
||||
private slots:
|
||||
///
|
||||
/// Slot which is called when a client tries to create a new connection
|
||||
///
|
||||
void readPendingDatagrams();
|
||||
void processTheDatagram(const QByteArray * datagram, const QHostAddress * sender);
|
||||
|
||||
private:
|
||||
/// The UDP server object
|
||||
QUdpSocket * _server;
|
||||
|
||||
/// hyperion priority
|
||||
int _priority;
|
||||
|
||||
/// hyperion timeout
|
||||
int _timeout;
|
||||
|
||||
/// Logger instance
|
||||
Logger * _log;
|
||||
|
||||
/// Bonjour Service Register
|
||||
BonjourServiceRegister* _serviceRegister = nullptr;
|
||||
|
||||
/// state of connection
|
||||
bool _isActive;
|
||||
|
||||
/// address to bind
|
||||
QHostAddress _listenAddress;
|
||||
uint16_t _listenPort;
|
||||
QAbstractSocket::BindFlag _bondage;
|
||||
|
||||
/// Check Network Origin
|
||||
NetOrigin* _netOrigin;
|
||||
};
|
@@ -14,7 +14,6 @@ enum Components
|
||||
COMP_SMOOTHING,
|
||||
COMP_BLACKBORDER,
|
||||
COMP_FORWARDER,
|
||||
COMP_UDPLISTENER,
|
||||
COMP_BOBLIGHTSERVER,
|
||||
COMP_GRABBER,
|
||||
COMP_V4L,
|
||||
@@ -34,7 +33,6 @@ inline const char* componentToString(Components c)
|
||||
case COMP_SMOOTHING: return "Smoothing";
|
||||
case COMP_BLACKBORDER: return "Blackborder detector";
|
||||
case COMP_FORWARDER: return "Json/Proto forwarder";
|
||||
case COMP_UDPLISTENER: return "UDP listener";
|
||||
case COMP_BOBLIGHTSERVER:return "Boblight server";
|
||||
case COMP_GRABBER: return "Framegrabber";
|
||||
case COMP_V4L: return "V4L capture device";
|
||||
@@ -56,7 +54,6 @@ inline const char* componentToIdString(Components c)
|
||||
case COMP_SMOOTHING: return "SMOOTHING";
|
||||
case COMP_BLACKBORDER: return "BLACKBORDER";
|
||||
case COMP_FORWARDER: return "FORWARDER";
|
||||
case COMP_UDPLISTENER: return "UDPLISTENER";
|
||||
case COMP_BOBLIGHTSERVER:return "BOBLIGHTSERVER";
|
||||
case COMP_GRABBER: return "GRABBER";
|
||||
case COMP_V4L: return "V4L";
|
||||
@@ -77,7 +74,6 @@ inline Components stringToComponent(QString component)
|
||||
if (component == "SMOOTHING") return COMP_SMOOTHING;
|
||||
if (component == "BLACKBORDER") return COMP_BLACKBORDER;
|
||||
if (component == "FORWARDER") return COMP_FORWARDER;
|
||||
if (component == "UDPLISTENER") return COMP_UDPLISTENER;
|
||||
if (component == "BOBLIGHTSERVER")return COMP_BOBLIGHTSERVER;
|
||||
if (component == "GRABBER") return COMP_GRABBER;
|
||||
if (component == "V4L") return COMP_V4L;
|
||||
|
@@ -24,7 +24,6 @@ enum type {
|
||||
LEDS,
|
||||
LOGGER,
|
||||
SMOOTHING,
|
||||
UDPLISTENER,
|
||||
WEBSERVER,
|
||||
INSTCAPTURE,
|
||||
NETWORK,
|
||||
@@ -58,7 +57,6 @@ inline QString typeToString(const type& type)
|
||||
case LEDS: return "leds";
|
||||
case LOGGER: return "logger";
|
||||
case SMOOTHING: return "smoothing";
|
||||
case UDPLISTENER: return "udpListener";
|
||||
case WEBSERVER: return "webConfig";
|
||||
case INSTCAPTURE: return "instCapture";
|
||||
case NETWORK: return "network";
|
||||
@@ -91,7 +89,6 @@ inline type stringToType(const QString& type)
|
||||
else if (type == "leds") return LEDS;
|
||||
else if (type == "logger") return LOGGER;
|
||||
else if (type == "smoothing") return SMOOTHING;
|
||||
else if (type == "udpListener") return UDPLISTENER;
|
||||
else if (type == "webConfig") return WEBSERVER;
|
||||
else if (type == "instCapture") return INSTCAPTURE;
|
||||
else if (type == "network") return NETWORK;
|
||||
|
Reference in New Issue
Block a user