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:
Paulchen-Panther 2019-07-23 22:00:43 +02:00
parent a3b326a18d
commit a4811b7e3c
No known key found for this signature in database
GPG Key ID: 84E3B692456B6840
29 changed files with 782 additions and 1247 deletions

View File

@ -16,7 +16,6 @@
"general_comp_BLACKBORDER": "Detekce černýh pruh",
"general_comp_KODICHECKER": "Kodi Snímač",
"general_comp_FORWARDER": "Zasílat",
"general_comp_UDPLISTENER": "UDP server",
"general_comp_BOBLIGHTSERVER": "Boblight Server",
"general_comp_GRABBER": "Platforma zachycení",
"general_comp_V4L": "USB zachycení",
@ -142,7 +141,6 @@
"conf_network_json_intro": "The JSON-RPC-Port této instance Hyperion, který se používá pro dálkové ovládání.",
"conf_network_proto_intro": "PROTO-Port této instance Hyperion, používaný pro obrazové proudy (Hyperion ScreenCap, Kodi Addon, ...)",
"conf_network_bobl_intro": "Přijímač pro Boblight",
"conf_network_udpl_intro": "Přijímač pro UDP",
"conf_network_forw_intro": "Předat všechny vstupy na druhou instanci Hyperion, která by mohla být řízena jiným LED ovladačem",
"conf_kodi_label_title": "Kodi Snímač",
"conf_kodi_intro": "Kodi Snímač umožňuje zapnout a vypnout obrazovku v závislosti na stavu Kodi. Nastavení není omezeno na stejný stroj, můžete pozorovat i Kodi na libovolně jiném zařízení v síti.",
@ -518,13 +516,6 @@
"edt_conf_js_heading_title": "JSON Server",
"edt_conf_ps_heading_title": "PROTO Server",
"edt_conf_bobls_heading_title": "Boblight Server",
"edt_conf_udpl_heading_title": "UDP Listener",
"edt_conf_udpl_address_title": "Adresa",
"edt_conf_udpl_address_expl": "Adresa, kde jsou přijaty balíčky UDP.",
"edt_conf_udpl_timeout_title": "Čas vypršel",
"edt_conf_udpl_timeout_expl": "Pokud pro danou dobu nejsou přijaty žádné pakety, bude součást (soft) zakázána.",
"edt_conf_udpl_shared_title": "Sdíled",
"edt_conf_udpl_shared_expl": "Sdíleny všemi instancemi Hyperion.",
"edt_conf_webc_heading_title": "Webová konfigurace",
"edt_conf_webc_docroot_title": "Document Root",
"edt_conf_webc_docroot_expl": "Místní kořenová cesta webového rozhraní (pouze pro vývojáře webui)",

File diff suppressed because it is too large Load Diff

View File

@ -18,7 +18,6 @@
"general_comp_SMOOTHING" : "Smoothing",
"general_comp_BLACKBORDER" : "Blackbar Detection",
"general_comp_FORWARDER" : "Forwarder",
"general_comp_UDPLISTENER" : "UDP Listener",
"general_comp_BOBLIGHTSERVER" : "Boblight Server",
"general_comp_FLATBUFSERVER" : "Flatbuffers Server",
"general_comp_PROTOSERVER" : "Protocol Buffers Server",
@ -188,7 +187,6 @@
"conf_network_net_intro" : "Network related settings which are applied to all network services.",
"conf_network_json_intro" : "The JSON-RPC-Port of this Hyperion instance, used for remote control.",
"conf_network_bobl_intro" : "Receiver for Boblight",
"conf_network_udpl_intro" : "Receiver for UDP",
"conf_network_fbs_intro" : "Google Flatbuffers Receiver. Used for fast image transmission.",
"conf_network_proto_intro" : "The PROTO-Port of this Hyperion instance, used for picture streams (HyperionScreenCap, Kodi Addon, ...)",
"conf_network_forw_intro" : "Forward all input to a second Hyperion instance which could be driven with another led controller",
@ -612,13 +610,6 @@
"edt_conf_pbs_timeout_title" : "Timeout",
"edt_conf_pbs_timeout_expl" : "If no data are received for the given period, the component will be (soft) disabled.",
"edt_conf_bobls_heading_title" : "Boblight Server",
"edt_conf_udpl_heading_title" : "UDP Listener",
"edt_conf_udpl_address_title" : "Address",
"edt_conf_udpl_address_expl" : "The address where UDP packages are accepted.",
"edt_conf_udpl_timeout_title" : "Timeout",
"edt_conf_udpl_timeout_expl" : "If no packages are received for the given period, the component will be (soft) disabled.",
"edt_conf_udpl_shared_title" : "Shared",
"edt_conf_udpl_shared_expl" : "Shared across all Hyperion instances.",
"edt_conf_webc_heading_title" : "Web Configuration",
"edt_conf_webc_docroot_title" : "Document Root",
"edt_conf_webc_docroot_expl" : "Local webinterface root path (just for webui developer)",

View File

@ -16,7 +16,6 @@
"general_comp_BLACKBORDER": "Detección de bordes negros",
"general_comp_KODICHECKER": "Observador Kodi",
"general_comp_FORWARDER": "JSON/PROTO Progresivo",
"general_comp_UDPLISTENER": "Oyente UDP",
"general_comp_BOBLIGHTSERVER": "Servidor Boblight",
"general_comp_GRABBER": "Captura de plataforma",
"general_comp_V4L": "Captura USB",
@ -142,7 +141,6 @@
"conf_network_json_intro": "El puerto JSON-RPC de esta instancia de Hyperion, utilizado para el control remoto.",
"conf_network_proto_intro": "El PROTO-puerto de esta instancia de Hyperion, utilizado para flujos de imágenes (HyperionScreenCap, Kodi Adddon, ...)",
"conf_network_bobl_intro": "Receptor para Boblight",
"conf_network_udpl_intro": "Receptor para UDP",
"conf_network_forw_intro": "Reenviar toda la entrada a una segunda instancia de Hyperion que podría ser gestionada con otro controlador led",
"conf_kodi_label_title": "Observador Kodi",
"conf_kodi_intro": "El Observador de Kodi te permite habilitar y deshabilitar la captura de pantalla dependiendo del estado de Kodi. Esto no se limita a la misma máquina, se puede observar también un Kodi en cualquier otro dispositivo de tu red.",
@ -518,13 +516,6 @@
"edt_conf_js_heading_title": "Servidor JSON",
"edt_conf_ps_heading_title": "Servidor PROTO",
"edt_conf_bobls_heading_title": "Servidor Boblight",
"edt_conf_udpl_heading_title": "Oyente UDP",
"edt_conf_udpl_address_title": "Dirección",
"edt_conf_udpl_address_expl": "La dirección donde se aceptan paquetes UDP.",
"edt_conf_udpl_timeout_title": "Tiempo muerto",
"edt_conf_udpl_timeout_expl": "Si no se reciben paquetes durante el período especificado, el componente se desactivará (suavemente).",
"edt_conf_udpl_shared_title": "Compartido",
"edt_conf_udpl_shared_expl": "Compartido entre todas las instancias de Hyperion.",
"edt_conf_webc_heading_title": "Configuración web",
"edt_conf_webc_docroot_title": "Documento raíz",
"edt_conf_webc_docroot_expl": "Ruta raíz de la interfaz web local (sólo para desarrolladores webui)",

View File

@ -16,7 +16,6 @@
"general_comp_BLACKBORDER": "Rilevamento barra nera",
"general_comp_KODICHECKER": "Controllo Kodi",
"general_comp_FORWARDER": "Forwarder",
"general_comp_UDPLISTENER": "Listener UDP",
"general_comp_BOBLIGHTSERVER": "Server Boblight",
"general_comp_GRABBER": "Cattura di Sistema",
"general_comp_V4L": "Cattura USB",
@ -142,7 +141,6 @@
"conf_network_json_intro": "La porta JSON-RPC di questa istanza di Hyperion, usata per il controllo remoto.",
"conf_network_proto_intro": "La porta PROTO di questa istanza di Hyperion, usata per stream di immagini (HyperionScreenCap, Kodi Adddon, ...)",
"conf_network_bobl_intro": "Ricevitore Boblight",
"conf_network_udpl_intro": "Ricevitore UDP",
"conf_network_forw_intro": "Inoltra tutti gli input a una seconda istanza di Hyperion che può essere usata con un altro controller led",
"conf_kodi_label_title": "Controllo Kodi",
"conf_kodi_intro": "Il controllore di Kodi ti permetti di abilitare e disabilitare lo screencapture a seconda dello stato di Kodi. Non è limitato alla stessa macchina, puoi osservare Kodi su qualsiasi altro dispositivo nella tua rete.",
@ -518,13 +516,6 @@
"edt_conf_js_heading_title": "Server JSON",
"edt_conf_ps_heading_title": "Server PROTO",
"edt_conf_bobls_heading_title": "Srtver Boblight",
"edt_conf_udpl_heading_title": "Listener UDP",
"edt_conf_udpl_address_title": "Indirizzo",
"edt_conf_udpl_address_expl": "L'indirizzo dove vengono accettati i pacchetti UDP",
"edt_conf_udpl_timeout_title": "Timeout",
"edt_conf_udpl_timeout_expl": "Se non vengono ricevuti pacchetti nel dato periodo la componente sarà disabilitata (temporaneo).",
"edt_conf_udpl_shared_title": "Condivisi",
"edt_conf_udpl_shared_expl": "Condivisi tra tutte le istanze di Hyperion.",
"edt_conf_webc_heading_title": "Configurazione Web",
"edt_conf_webc_docroot_title": "Documento Root",
"edt_conf_webc_docroot_expl": "Percorso root della webinterface locale (solo per sviluppatori webui)",

View File

@ -6,7 +6,6 @@ $(document).ready( function() {
var conf_editor_proto = null;
var conf_editor_fbs = null;
var conf_editor_bobl = null;
var conf_editor_udpl = null;
var conf_editor_forw = null;
if(window.showOptHelp)
@ -36,11 +35,6 @@ $(document).ready( function() {
$('#conf_cont_bobl').append(createOptPanel('fa-sitemap', $.i18n("edt_conf_bobls_heading_title"), 'editor_container_boblightserver', 'btn_submit_boblightserver'));
$('#conf_cont_bobl').append(createHelpTable(window.schema.boblightServer.properties, $.i18n("edt_conf_bobls_heading_title")));
//udplistener
$('#conf_cont').append(createRow('conf_cont_udpl'))
$('#conf_cont_udpl').append(createOptPanel('fa-sitemap', $.i18n("edt_conf_udpl_heading_title"), 'editor_container_udplistener', 'btn_submit_udplistener'));
$('#conf_cont_udpl').append(createHelpTable(window.schema.udpListener.properties, $.i18n("edt_conf_udpl_heading_title")));
//forwarder
if(storedAccess != 'default')
{
@ -57,8 +51,6 @@ $(document).ready( function() {
$('#conf_cont').append(createOptPanel('fa-sitemap', $.i18n("edt_conf_fbs_heading_title"), 'editor_container_fbserver', 'btn_submit_fbserver'));
$('#conf_cont').append(createOptPanel('fa-sitemap', $.i18n("edt_conf_pbs_heading_title"), 'editor_container_protoserver', 'btn_submit_protoserver'));
$('#conf_cont').append(createOptPanel('fa-sitemap', $.i18n("edt_conf_bobls_heading_title"), 'editor_container_boblightserver', 'btn_submit_boblightserver'));
$('#conf_cont').append(createOptPanel('fa-sitemap', $.i18n("edt_conf_udpl_heading_title"), 'editor_container_udplistener', 'btn_submit_udplistener'));
if(storedAccess != 'default')
$('#conf_cont').append(createOptPanel('fa-sitemap', $.i18n("edt_conf_fw_heading_title"), 'editor_container_forwarder', 'btn_submit_forwarder'));
}
@ -127,19 +119,6 @@ $(document).ready( function() {
requestWriteConfig(conf_editor_bobl.getValue());
});
//udplistener
conf_editor_udpl = createJsonEditor('editor_container_udplistener', {
udpListener : window.schema.udpListener
}, true, true);
conf_editor_udpl.on('change',function() {
conf_editor_udpl.validate().length ? $('#btn_submit_udplistener').attr('disabled', true) : $('#btn_submit_udplistener').attr('disabled', false);
});
$('#btn_submit_udplistener').off().on('click',function() {
requestWriteConfig(conf_editor_udpl.getValue());
});
if(storedAccess != 'default')
{
//forwarder
@ -164,7 +143,6 @@ $(document).ready( function() {
createHint("intro", $.i18n('conf_network_fbs_intro'), "editor_container_fbserver");
createHint("intro", $.i18n('conf_network_proto_intro'), "editor_container_protoserver");
createHint("intro", $.i18n('conf_network_bobl_intro'), "editor_container_boblightserver");
createHint("intro", $.i18n('conf_network_udpl_intro'), "editor_container_udplistener");
createHint("intro", $.i18n('conf_network_forw_intro'), "editor_container_forwarder");
}

View File

@ -149,9 +149,6 @@ $(document).ready(function() {
case "BOBLIGHTSERVER":
owner = $.i18n('general_comp_BOBLIGHTSERVER');
break;
case "UDPLISTENER":
owner = $.i18n('general_comp_UDPLISTENER');
break;
case "FLATBUFSERVER":
owner = $.i18n('general_comp_FLATBUFSERVER');
break;

View File

@ -263,23 +263,6 @@
"priority" : 128
},
/// The configuration of the udp listener
/// * enable : Enable or disable the udp listener (true/false)
/// * address : The listener address, pre configured is multicast which listen also to unicast ip addresses at the same time. If emtpy, multicast is disabled and it also accepts unicast from all IPs
/// * port : Port at which the udp listener starts
/// * priority : Priority of the udp listener server (Default=200)
/// * timeout : The timeout sets the timelimit for a "soft" off of the udp listener, if no packages are received (for example to switch to a gabber or InitialEffect - background-effect)
/// * shared : If true, the udp listener is shared across all hyperion instances (if using more than one (forwarder))
"udpListener" :
{
"enable" : false,
"address" : "239.255.28.01",
"port" : 2801,
"priority" : 200,
"timeout" : 10000,
"shared" : false
},
/// Configuration of the Hyperion webserver
/// * document_root : path to hyperion webapp files (webconfig developer only)
/// * port : the port where hyperion webapp is accasible

View File

@ -151,16 +151,6 @@
"priority" : 128
},
"udpListener" :
{
"enable" : false,
"address" : "239.255.28.01",
"port" : 2801,
"priority" : 200,
"timeout" : 10000,
"shared" : false
},
"webConfig" :
{
"document_root" : "",

View File

@ -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

View File

@ -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;
};

View File

@ -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;

View File

@ -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;

View File

@ -12,7 +12,6 @@ add_subdirectory(protoserver)
add_subdirectory(bonjour)
add_subdirectory(ssdp)
add_subdirectory(boblightserver)
add_subdirectory(udplistener)
add_subdirectory(leddevice)
add_subdirectory(utils)
add_subdirectory(effectengine)

View File

@ -21,7 +21,7 @@
"component":
{
"type" : "string",
"enum" : ["ALL", "SMOOTHING", "BLACKBORDER", "FORWARDER", "UDPLISTENER", "BOBLIGHTSERVER", "GRABBER", "V4L", "LEDDEVICE"],
"enum" : ["ALL", "SMOOTHING", "BLACKBORDER", "FORWARDER", "BOBLIGHTSERVER", "GRABBER", "V4L", "LEDDEVICE"],
"required": true
},
"state":

View File

@ -11,7 +11,7 @@ ComponentRegister::ComponentRegister(Hyperion* hyperion)
{
// init all comps to false
QVector<hyperion::Components> vect;
vect << COMP_ALL << COMP_SMOOTHING << COMP_BLACKBORDER << COMP_FORWARDER << COMP_UDPLISTENER << COMP_BOBLIGHTSERVER << COMP_GRABBER << COMP_V4L << COMP_LEDDEVICE;
vect << COMP_ALL << COMP_SMOOTHING << COMP_BLACKBORDER << COMP_FORWARDER << COMP_BOBLIGHTSERVER << COMP_GRABBER << COMP_V4L << COMP_LEDDEVICE;
for(auto e : vect)
{
_componentStates.emplace(e, ((e == COMP_ALL) ? true : false));

View File

@ -156,7 +156,8 @@ bool HyperionIManager::deleteInstance(const quint8& inst)
return false;
// stop it if required as blocking and wait
if (stopInstance(inst, true));
if (stopInstance(inst, true))
;
if(_instanceTable->deleteInstance(inst))
{

View File

@ -63,7 +63,7 @@ public:
///
/// @brief select a smoothing cfg given by cfg index from addConfig()
/// @param cfg The index to use
/// @param force Overwrite in any case the current values (used for cfg 0 settings udpate)
/// @param force Overwrite in any case the current values (used for cfg 0 settings update)
///
/// @return On success return else false (and falls back to cfg 0)
///

View File

@ -63,10 +63,6 @@
{
"$ref": "schema-boblightServer.json"
},
"udpListener" :
{
"$ref": "schema-udpListener.json"
},
"webConfig" :
{
"$ref": "schema-webConfig.json"

View File

@ -17,7 +17,6 @@
<file alias="schema-flatbufServer.json">schema/schema-flatbufServer.json</file>
<file alias="schema-protoServer.json">schema/schema-protoServer.json</file>
<file alias="schema-boblightServer.json">schema/schema-boblightServer.json</file>
<file alias="schema-udpListener.json">schema/schema-udpListener.json</file>
<file alias="schema-webConfig.json">schema/schema-webConfig.json</file>
<file alias="schema-effects.json">schema/schema-effects.json</file>
<file alias="schema-ledConfig.json">schema/schema-ledConfig.json</file>

View File

@ -1,56 +0,0 @@
{
"type" : "object",
"title" : "edt_conf_udpl_heading_title",
"properties" :
{
"enable" :
{
"type" : "boolean",
"title" : "edt_conf_general_enable_title",
"default" : false,
"propertyOrder" : 1
},
"address" :
{
"type" : "string",
"title" : "edt_conf_udpl_address_title",
"default" : "239.255.28.01",
"propertyOrder" : 2
},
"port" :
{
"type" : "integer",
"title" : "edt_conf_general_port_title",
"minimum" : 0,
"maximum" : 65535,
"default" : 2801,
"propertyOrder" : 3
},
"priority" :
{
"type" : "integer",
"title" : "edt_conf_general_priority_title",
"minimum" : 100,
"maximum" : 254,
"default" : 200,
"propertyOrder" : 4
},
"timeout" :
{
"type" : "integer",
"title" : "edt_conf_udpl_timeout_title",
"minimum" : 1000,
"default" : 10000,
"append" : "edt_append_ms",
"propertyOrder" : 5
},
"shared" :
{
"type" : "boolean",
"title" : "edt_conf_udpl_shared_title",
"default" : false,
"propertyOrder" : 6
}
},
"additionalProperties" : false
}

View File

@ -1,14 +0,0 @@
# Define the current source locations
set(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/udplistener)
set(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/udplistener)
FILE ( GLOB UDPListener_SOURCES "${CURRENT_HEADER_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.h" "${CURRENT_SOURCE_DIR}/*.cpp" )
add_library(udplistener ${UDPListener_SOURCES} )
target_link_libraries(udplistener
hyperion
hyperion-utils
${QT_LIBRARIES}
)

View File

@ -1,161 +0,0 @@
// project includes
#include <udplistener/UDPListener.h>
// bonjour includes
#include <bonjour/bonjourserviceregister.h>
// hyperion includes
#include <hyperion/Hyperion.h>
#include <hyperion/HyperionIManager.h>
#include "HyperionConfig.h"
// utils includes
#include <utils/NetOrigin.h>
// qt includes
#include <QUdpSocket>
#include <QJsonObject>
using namespace hyperion;
UDPListener::UDPListener(const QJsonDocument& config)
: QObject()
, _server(new QUdpSocket(this))
, _priority(0)
, _timeout(0)
, _log(Logger::getInstance("UDPLISTENER"))
, _isActive(false)
, _listenPort(0)
, _netOrigin(NetOrigin::getInstance())
{
// init
handleSettingsUpdate(settings::UDPLISTENER, config);
}
UDPListener::~UDPListener()
{
// clear the current channel
stop();
delete _server;
}
void UDPListener::start()
{
if ( active() )
return;
QHostAddress mcastGroup;
if (_listenAddress.isInSubnet(QHostAddress::parseSubnet("224.0.0.0/4")))
{
mcastGroup = _listenAddress;
}
if (!_server->bind(_listenAddress, _listenPort, _bondage))
{
Error(_log, "Could not bind to %s:%d", _listenAddress.toString().toStdString().c_str(), _listenPort);
}
else
{
Info(_log, "Started, listening on %s:%d", _listenAddress.toString().toStdString().c_str(), _listenPort);
if (!mcastGroup.isNull())
{
bool joinGroupOK = _server->joinMulticastGroup(_listenAddress);
InfoIf ( joinGroupOK, _log, "Multicast enabled");
WarningIf( ! joinGroupOK, _log, "Multicast failed");
}
_isActive = true;
if(_serviceRegister == nullptr)
{
_serviceRegister = new BonjourServiceRegister(this);
_serviceRegister->registerService("_hyperiond-udp._udp", _listenPort);
}
else if( _serviceRegister->getPort() != _listenPort)
{
delete _serviceRegister;
_serviceRegister = new BonjourServiceRegister(this);
_serviceRegister->registerService("_hyperiond-udp._udp", _listenPort);
}
}
}
void UDPListener::stop()
{
if ( ! active() )
return;
_server->close();
_isActive = false;
Info(_log, "Stopped");
}
void UDPListener::updatedComponentState(const hyperion::Components component, bool enable)
{
if (component == COMP_UDPLISTENER)
{
if (_isActive != enable)
{
if (enable) start();
else stop();
}
}
}
uint16_t UDPListener::getPort() const
{
return _server->localPort();
}
void UDPListener::readPendingDatagrams()
{
while (_server->hasPendingDatagrams())
{
QByteArray datagram;
datagram.resize(_server->pendingDatagramSize());
QHostAddress sender;
quint16 senderPort;
_server->readDatagram(datagram.data(), datagram.size(), &sender, &senderPort);
if(_netOrigin->accessAllowed(sender, _listenAddress))
processTheDatagram(&datagram, &sender);
}
}
void UDPListener::processTheDatagram(const QByteArray * datagram, const QHostAddress * sender)
{
int packetLedCount = datagram->size()/3;
//DebugIf( (packetLedCount != hyperionLedCount), _log, "packetLedCount (%d) != hyperionLedCount (%d)", packetLedCount, hyperionLedCount);
std::vector<ColorRgb> _ledColors(packetLedCount, ColorRgb::BLACK);
for (int ledIndex=0; ledIndex < packetLedCount; ledIndex++)
{
ColorRgb & rgb = _ledColors[ledIndex];
rgb.red = datagram->at(ledIndex*3+0);
rgb.green = datagram->at(ledIndex*3+1);
rgb.blue = datagram->at(ledIndex*3+2);
}
// TODO provide a setInput with origin arg to overwrite senders smarter
emit registerGlobalInput(_priority, hyperion::COMP_UDPLISTENER, QString("UDPListener@%1").arg(sender->toString()));
emit setGlobalInput(_priority, _ledColors, _timeout);
}
void UDPListener::handleSettingsUpdate(const settings::type& type, const QJsonDocument& config)
{
if(type == settings::UDPLISTENER)
{
QJsonObject obj = config.object();
// if we change the prio we need to make sure the old one is cleared before we apply the new one!
stop();
QString addr = obj["address"].toString("");
_priority = obj["priority"].toInt();
_listenPort = obj["port"].toInt();
_listenAddress = addr.isEmpty()? QHostAddress::AnyIPv4 : QHostAddress(addr);
_bondage = (obj["shared"].toBool(false)) ? QAbstractSocket::ShareAddress : QAbstractSocket::DefaultForPlatform;
_timeout = obj["timeout"].toInt(10000);
if(obj["enable"].toBool())
start();
}
}

View File

@ -1 +0,0 @@

View File

@ -101,7 +101,7 @@ public:
///
/// Enable/Disable components during runtime
///
/// @param component The component [SMOOTHING, BLACKBORDER, FORWARDER, UDPLISTENER, BOBLIGHT_SERVER, GRABBER]
/// @param component The component [SMOOTHING, BLACKBORDER, FORWARDER, BOBLIGHT_SERVER, GRABBER]
/// @param state The state of the component [true | false]
///
void setComponentState(const QString & component, const bool state);

View File

@ -77,8 +77,8 @@ int main(int argc, char * argv[])
BooleanOption & argSysInfo = parser.add<BooleanOption>('s', "sysinfo" , "show system info");
BooleanOption & argClear = parser.add<BooleanOption>('x', "clear" , "Clear data for the priority channel provided by the -p option");
BooleanOption & argClearAll = parser.add<BooleanOption>(0x0, "clearall" , "Clear data for all active priority channels");
Option & argEnableComponent = parser.add<Option> ('E', "enable" , "Enable the Component with the given name. Available Components are [SMOOTHING, BLACKBORDER, FORWARDER, UDPLISTENER, BOBLIGHT_SERVER, GRABBER, V4L, LEDDEVICE]");
Option & argDisableComponent = parser.add<Option> ('D', "disable" , "Disable the Component with the given name. Available Components are [SMOOTHING, BLACKBORDER, FORWARDER, UDPLISTENER, BOBLIGHT_SERVER, GRABBER, V4L, LEDDEVICE]");
Option & argEnableComponent = parser.add<Option> ('E', "enable" , "Enable the Component with the given name. Available Components are [SMOOTHING, BLACKBORDER, FORWARDER, BOBLIGHT_SERVER, GRABBER, V4L, LEDDEVICE]");
Option & argDisableComponent = parser.add<Option> ('D', "disable" , "Disable the Component with the given name. Available Components are [SMOOTHING, BLACKBORDER, FORWARDER, BOBLIGHT_SERVER, GRABBER, V4L, LEDDEVICE]");
Option & argId = parser.add<Option> ('q', "qualifier" , "Identifier(qualifier) of the adjustment to set");
IntOption & argBrightness = parser.add<IntOption> ('L', "brightness" , "Set the brightness gain of the leds");
IntOption & argBrightnessC = parser.add<IntOption> (0x0, "brightnessCompensation" , "Set the brightness compensation");

View File

@ -15,7 +15,6 @@ target_link_libraries(hyperiond
hyperion
effectengine
jsonserver
udplistener
flatbufserver
protoserver
webserver

View File

@ -18,8 +18,10 @@
#include <utils/Components.h>
#include <utils/JsonUtils.h>
// bonjour browser
#include <bonjour/bonjourbrowserwrapper.h>
#include <jsonserver/JsonServer.h>
#include <udplistener/UDPListener.h>
#include <webserver/WebServer.h>
#include <HyperionConfig.h> // Required to determine the cmake options
#include "hyperiond.h"
@ -30,9 +32,6 @@
// Protobuffer Server
#include <protoserver/ProtoServer.h>
// bonjour browser
#include <bonjour/bonjourbrowserwrapper.h>
// ssdp
#include <ssdp/SSDPHandler.h>
@ -66,7 +65,6 @@ HyperionDaemon::HyperionDaemon(const QString rootPath, QObject *parent, const bo
, _pyInit(new PythonInit())
, _webserver(nullptr)
, _jsonServer(nullptr)
, _udpListener(nullptr)
, _v4l2Grabber(nullptr)
, _dispmanx(nullptr)
, _x11Grabber(nullptr)
@ -172,7 +170,6 @@ void HyperionDaemon::freeObjects()
_ssdp->thread()->wait(1000);
_webserver->thread()->quit();
_webserver->thread()->wait(1000);
delete _udpListener;
// stop Hyperions (non blocking)
_instanceManager->stopAll();
@ -197,7 +194,6 @@ void HyperionDaemon::freeObjects()
_ssdp = nullptr;
_webserver = nullptr;
_jsonServer = nullptr;
_udpListener = nullptr;
}
void HyperionDaemon::startNetworkServices()
@ -226,11 +222,6 @@ void HyperionDaemon::startNetworkServices()
connect( this, &HyperionDaemon::settingsChanged, _protoServer, &ProtoServer::handleSettingsUpdate );
pThread->start();
// Create UDP listener
_udpListener = new UDPListener(getSetting(settings::UDPLISTENER));
connect(this, &HyperionDaemon::settingsChanged, _udpListener, &UDPListener::handleSettingsUpdate);
connect(this, &HyperionDaemon::componentStateChanged, _udpListener, &UDPListener::updatedComponentState);
// Create Webserver in thread
_webserver = new WebServer(getSetting(settings::WEBSERVER));
QThread* wsThread = new QThread(this);

View File

@ -55,7 +55,6 @@
class HyperionIManager;
class SysTray;
class JsonServer;
class UDPListener;
class BonjourBrowserWrapper;
class WebServer;
class SettingsManager;
@ -153,7 +152,6 @@ private:
PythonInit* _pyInit;
WebServer* _webserver;
JsonServer* _jsonServer;
UDPListener* _udpListener;
V4L2Wrapper* _v4l2Grabber;
DispmanxWrapper* _dispmanx;
X11Wrapper* _x11Grabber;