mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
every input sources trackes now its priority and ID to hyperion core
ATM all input sources except inputs via proto are tracked
This commit is contained in:
parent
5432aa7d27
commit
505b83f028
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
// stl includes
|
// stl includes
|
||||||
#include <list>
|
#include <list>
|
||||||
|
#include <map>
|
||||||
|
|
||||||
// QT includes
|
// QT includes
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
@ -46,6 +47,7 @@ class Hyperion : public QObject
|
|||||||
public:
|
public:
|
||||||
/// Type definition of the info structure used by the priority muxer
|
/// Type definition of the info structure used by the priority muxer
|
||||||
typedef PriorityMuxer::InputInfo InputInfo;
|
typedef PriorityMuxer::InputInfo InputInfo;
|
||||||
|
typedef std::map<std::string,int> PriorityRegister;
|
||||||
|
|
||||||
///
|
///
|
||||||
/// RGB-Color channel enumeration
|
/// RGB-Color channel enumeration
|
||||||
@ -109,11 +111,24 @@ public:
|
|||||||
/// @return The list of active effects
|
/// @return The list of active effects
|
||||||
const std::list<ActiveEffectDefinition> &getActiveEffects();
|
const std::list<ActiveEffectDefinition> &getActiveEffects();
|
||||||
|
|
||||||
///
|
/// gets the current json config object
|
||||||
|
/// @return json config
|
||||||
const Json::Value& getJsonConfig() { return _jsonConfig; };
|
const Json::Value& getJsonConfig() { return _jsonConfig; };
|
||||||
|
|
||||||
|
/// get filename of configfile
|
||||||
|
/// @return the current config filename
|
||||||
std::string getConfigFileName() { return _configFile; };
|
std::string getConfigFileName() { return _configFile; };
|
||||||
|
|
||||||
|
/// register a input source to a priority channel
|
||||||
|
/// @param name uniq name of input source
|
||||||
|
/// @param priority priority channel
|
||||||
|
void registerPriority(const std::string name, const int priority);
|
||||||
|
|
||||||
|
/// unregister a input source to a priority channel
|
||||||
|
/// @param name uniq name of input source
|
||||||
|
void unRegisterPriority(const std::string name);
|
||||||
|
|
||||||
|
const PriorityRegister& getPriorityRegister() { return _priorityRegister; }
|
||||||
public slots:
|
public slots:
|
||||||
///
|
///
|
||||||
/// Writes a single color to all the leds for the given time and priority
|
/// Writes a single color to all the leds for the given time and priority
|
||||||
@ -307,4 +322,7 @@ private:
|
|||||||
|
|
||||||
/// count of hardware leds
|
/// count of hardware leds
|
||||||
unsigned _hwLedCount;
|
unsigned _hwLedCount;
|
||||||
|
|
||||||
|
/// register of input sources and it's prio channel
|
||||||
|
PriorityRegister _priorityRegister;
|
||||||
};
|
};
|
||||||
|
@ -22,15 +22,15 @@
|
|||||||
// project includes
|
// project includes
|
||||||
#include "BoblightClientConnection.h"
|
#include "BoblightClientConnection.h"
|
||||||
|
|
||||||
BoblightClientConnection::BoblightClientConnection(QTcpSocket *socket, const int priority, Hyperion * hyperion)
|
BoblightClientConnection::BoblightClientConnection(QTcpSocket *socket, const int priority)
|
||||||
: QObject()
|
: QObject()
|
||||||
, _locale(QLocale::C)
|
, _locale(QLocale::C)
|
||||||
, _socket(socket)
|
, _socket(socket)
|
||||||
, _imageProcessor(ImageProcessorFactory::getInstance().newImageProcessor())
|
, _imageProcessor(ImageProcessorFactory::getInstance().newImageProcessor())
|
||||||
, _hyperion(hyperion)
|
, _hyperion(Hyperion::getInstance())
|
||||||
, _receiveBuffer()
|
, _receiveBuffer()
|
||||||
, _priority(priority)
|
, _priority(priority)
|
||||||
, _ledColors(hyperion->getLedCount(), ColorRgb::BLACK)
|
, _ledColors(Hyperion::getInstance()->getLedCount(), ColorRgb::BLACK)
|
||||||
, _log(Logger::getInstance("BOBLIGHT"))
|
, _log(Logger::getInstance("BOBLIGHT"))
|
||||||
{
|
{
|
||||||
// initalize the locale. Start with the default C-locale
|
// initalize the locale. Start with the default C-locale
|
||||||
|
@ -27,7 +27,7 @@ public:
|
|||||||
/// @param socket The Socket object for this connection
|
/// @param socket The Socket object for this connection
|
||||||
/// @param hyperion The Hyperion server
|
/// @param hyperion The Hyperion server
|
||||||
///
|
///
|
||||||
BoblightClientConnection(QTcpSocket * socket, const int priority, Hyperion * hyperion);
|
BoblightClientConnection(QTcpSocket * socket, const int priority);
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Destructor
|
/// Destructor
|
||||||
|
@ -37,6 +37,9 @@ void BoblightServer::start()
|
|||||||
|
|
||||||
_isActive = true;
|
_isActive = true;
|
||||||
emit statusChanged(_isActive);
|
emit statusChanged(_isActive);
|
||||||
|
|
||||||
|
_hyperion->registerPriority("Boblight", _priority);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BoblightServer::stop()
|
void BoblightServer::stop()
|
||||||
@ -49,6 +52,9 @@ void BoblightServer::stop()
|
|||||||
}
|
}
|
||||||
_isActive = false;
|
_isActive = false;
|
||||||
emit statusChanged(_isActive);
|
emit statusChanged(_isActive);
|
||||||
|
|
||||||
|
_hyperion->unRegisterPriority("Boblight");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -64,7 +70,7 @@ void BoblightServer::newConnection()
|
|||||||
if (socket != nullptr)
|
if (socket != nullptr)
|
||||||
{
|
{
|
||||||
Info(_log, "new connection");
|
Info(_log, "new connection");
|
||||||
BoblightClientConnection * connection = new BoblightClientConnection(socket, _priority, _hyperion);
|
BoblightClientConnection * connection = new BoblightClientConnection(socket, _priority);
|
||||||
_openConnections.insert(connection);
|
_openConnections.insert(connection);
|
||||||
|
|
||||||
// register slot for cleaning up after the connection closed
|
// register slot for cleaning up after the connection closed
|
||||||
|
@ -181,6 +181,7 @@ int EffectEngine::runEffectScript(const std::string &script, const Json::Value &
|
|||||||
_activeEffects.push_back(effect);
|
_activeEffects.push_back(effect);
|
||||||
|
|
||||||
// start the effect
|
// start the effect
|
||||||
|
_hyperion->registerPriority("EFFECT: "+script, priority);
|
||||||
effect->start();
|
effect->start();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -225,4 +226,5 @@ void EffectEngine::effectFinished(Effect *effect)
|
|||||||
|
|
||||||
// cleanup the effect
|
// cleanup the effect
|
||||||
effect->deleteLater();
|
effect->deleteLater();
|
||||||
|
_hyperion->unRegisterPriority("EFFECT: " + effect->getScript());
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,8 @@ AmlogicWrapper::AmlogicWrapper(const unsigned grabWidth, const unsigned grabHeig
|
|||||||
|
|
||||||
// Connect the QTimer to this
|
// Connect the QTimer to this
|
||||||
QObject::connect(&_timer, SIGNAL(timeout()), this, SLOT(action()));
|
QObject::connect(&_timer, SIGNAL(timeout()), this, SLOT(action()));
|
||||||
|
|
||||||
|
_hyperion->registerPriority("Amlogic Grabber", _priority);
|
||||||
}
|
}
|
||||||
|
|
||||||
AmlogicWrapper::~AmlogicWrapper()
|
AmlogicWrapper::~AmlogicWrapper()
|
||||||
|
@ -31,6 +31,8 @@ DispmanxWrapper::DispmanxWrapper(const unsigned grabWidth, const unsigned grabHe
|
|||||||
|
|
||||||
// Connect the QTimer to this
|
// Connect the QTimer to this
|
||||||
QObject::connect(&_timer, SIGNAL(timeout()), this, SLOT(action()));
|
QObject::connect(&_timer, SIGNAL(timeout()), this, SLOT(action()));
|
||||||
|
|
||||||
|
_hyperion->registerPriority("Dispmanx Grabber", _priority);
|
||||||
}
|
}
|
||||||
|
|
||||||
DispmanxWrapper::~DispmanxWrapper()
|
DispmanxWrapper::~DispmanxWrapper()
|
||||||
|
@ -26,6 +26,8 @@ FramebufferWrapper::FramebufferWrapper(const std::string & device, const unsigne
|
|||||||
|
|
||||||
// Connect the QTimer to this
|
// Connect the QTimer to this
|
||||||
QObject::connect(&_timer, SIGNAL(timeout()), this, SLOT(action()));
|
QObject::connect(&_timer, SIGNAL(timeout()), this, SLOT(action()));
|
||||||
|
|
||||||
|
_hyperion->registerPriority("FrameBuffer Grabber", _priority);
|
||||||
}
|
}
|
||||||
|
|
||||||
FramebufferWrapper::~FramebufferWrapper()
|
FramebufferWrapper::~FramebufferWrapper()
|
||||||
|
@ -26,6 +26,8 @@ OsxWrapper::OsxWrapper(const unsigned display, const unsigned grabWidth, const u
|
|||||||
|
|
||||||
// Connect the QTimer to this
|
// Connect the QTimer to this
|
||||||
QObject::connect(&_timer, SIGNAL(timeout()), this, SLOT(action()));
|
QObject::connect(&_timer, SIGNAL(timeout()), this, SLOT(action()));
|
||||||
|
|
||||||
|
_hyperion->registerPriority("OsxFrameGrabber", _priority);
|
||||||
}
|
}
|
||||||
|
|
||||||
OsxWrapper::~OsxWrapper()
|
OsxWrapper::~OsxWrapper()
|
||||||
|
@ -15,10 +15,10 @@ V4L2Wrapper::V4L2Wrapper(const std::string &device,
|
|||||||
double redSignalThreshold,
|
double redSignalThreshold,
|
||||||
double greenSignalThreshold,
|
double greenSignalThreshold,
|
||||||
double blueSignalThreshold,
|
double blueSignalThreshold,
|
||||||
int hyperionPriority) :
|
int hyperionPriority)
|
||||||
_timeout_ms(1000),
|
: _timeout_ms(1000)
|
||||||
_priority(hyperionPriority),
|
, _priority(hyperionPriority)
|
||||||
_grabber(device,
|
, _grabber(device,
|
||||||
input,
|
input,
|
||||||
videoStandard,
|
videoStandard,
|
||||||
pixelFormat,
|
pixelFormat,
|
||||||
@ -26,18 +26,16 @@ V4L2Wrapper::V4L2Wrapper(const std::string &device,
|
|||||||
height,
|
height,
|
||||||
frameDecimation,
|
frameDecimation,
|
||||||
pixelDecimation,
|
pixelDecimation,
|
||||||
pixelDecimation),
|
pixelDecimation)
|
||||||
_processor(ImageProcessorFactory::getInstance().newImageProcessor()),
|
, _processor(ImageProcessorFactory::getInstance().newImageProcessor())
|
||||||
_hyperion(Hyperion::getInstance()),
|
, _hyperion(Hyperion::getInstance())
|
||||||
_ledColors(Hyperion::getInstance()->getLedCount(), ColorRgb{0,0,0}),
|
, _ledColors(Hyperion::getInstance()->getLedCount(), ColorRgb{0,0,0})
|
||||||
_timer()
|
, _timer()
|
||||||
{
|
{
|
||||||
// set the signal detection threshold of the grabber
|
// set the signal detection threshold of the grabber
|
||||||
_grabber.setSignalThreshold(
|
_grabber.setSignalThreshold( redSignalThreshold, greenSignalThreshold, blueSignalThreshold, 50);
|
||||||
redSignalThreshold,
|
|
||||||
greenSignalThreshold,
|
_hyperion->registerPriority("V4L2", _priority);
|
||||||
blueSignalThreshold,
|
|
||||||
50);
|
|
||||||
|
|
||||||
// register the image type
|
// register the image type
|
||||||
qRegisterMetaType<Image<ColorRgb>>("Image<ColorRgb>");
|
qRegisterMetaType<Image<ColorRgb>>("Image<ColorRgb>");
|
||||||
@ -55,6 +53,7 @@ V4L2Wrapper::V4L2Wrapper(const std::string &device,
|
|||||||
_hyperion, SLOT(setColors(int,std::vector<ColorRgb>,int)),
|
_hyperion, SLOT(setColors(int,std::vector<ColorRgb>,int)),
|
||||||
Qt::QueuedConnection);
|
Qt::QueuedConnection);
|
||||||
|
|
||||||
|
|
||||||
// setup the higher prio source checker
|
// setup the higher prio source checker
|
||||||
// this will disable the v4l2 grabber when a source with hisher priority is active
|
// this will disable the v4l2 grabber when a source with hisher priority is active
|
||||||
_timer.setInterval(500);
|
_timer.setInterval(500);
|
||||||
|
@ -541,32 +541,32 @@ MessageForwarder * Hyperion::getForwarder()
|
|||||||
return _messageForwarder;
|
return _messageForwarder;
|
||||||
}
|
}
|
||||||
|
|
||||||
Hyperion::Hyperion(const Json::Value &jsonConfig, const std::string configFile) :
|
Hyperion::Hyperion(const Json::Value &jsonConfig, const std::string configFile)
|
||||||
_ledString(createLedString(jsonConfig["leds"], createColorOrder(jsonConfig["device"]))),
|
: _ledString(createLedString(jsonConfig["leds"], createColorOrder(jsonConfig["device"])))
|
||||||
_muxer(_ledString.leds().size()),
|
, _muxer(_ledString.leds().size())
|
||||||
_raw2ledTransform(createLedColorsTransform(_ledString.leds().size(), jsonConfig["color"])),
|
, _raw2ledTransform(createLedColorsTransform(_ledString.leds().size(), jsonConfig["color"]))
|
||||||
_raw2ledTemperature(createLedColorsTemperature(_ledString.leds().size(), jsonConfig["color"])),
|
, _raw2ledTemperature(createLedColorsTemperature(_ledString.leds().size(), jsonConfig["color"]))
|
||||||
_raw2ledAdjustment(createLedColorsAdjustment(_ledString.leds().size(), jsonConfig["color"])),
|
, _raw2ledAdjustment(createLedColorsAdjustment(_ledString.leds().size(), jsonConfig["color"]))
|
||||||
_device(LedDeviceFactory::construct(jsonConfig["device"])),
|
, _device(LedDeviceFactory::construct(jsonConfig["device"]))
|
||||||
_effectEngine(nullptr),
|
, _effectEngine(nullptr)
|
||||||
_messageForwarder(createMessageForwarder(jsonConfig["forwarder"])),
|
, _messageForwarder(createMessageForwarder(jsonConfig["forwarder"]))
|
||||||
_jsonConfig(jsonConfig),
|
, _jsonConfig(jsonConfig)
|
||||||
_configFile(configFile),
|
, _configFile(configFile)
|
||||||
_timer(),
|
, _timer()
|
||||||
_log(Logger::getInstance("Core")),
|
, _log(Logger::getInstance("Core"))
|
||||||
_hwLedCount(_ledString.leds().size())
|
, _hwLedCount(_ledString.leds().size())
|
||||||
{
|
{
|
||||||
if (!_raw2ledAdjustment->verifyAdjustments())
|
if (!_raw2ledAdjustment->verifyAdjustments())
|
||||||
{
|
{
|
||||||
throw std::runtime_error("HYPERION ERROR: Color adjustment incorrectly set");
|
throw std::runtime_error("Color adjustment incorrectly set");
|
||||||
}
|
}
|
||||||
if (!_raw2ledTemperature->verifyCorrections())
|
if (!_raw2ledTemperature->verifyCorrections())
|
||||||
{
|
{
|
||||||
throw std::runtime_error("HYPERION ERROR: Color temperature incorrectly set");
|
throw std::runtime_error("Color temperature incorrectly set");
|
||||||
}
|
}
|
||||||
if (!_raw2ledTransform->verifyTransforms())
|
if (!_raw2ledTransform->verifyTransforms())
|
||||||
{
|
{
|
||||||
throw std::runtime_error("HYPERION ERROR: Color transformation incorrectly set");
|
throw std::runtime_error("Color transformation incorrectly set");
|
||||||
}
|
}
|
||||||
// initialize the image processor factory
|
// initialize the image processor factory
|
||||||
ImageProcessorFactory::getInstance().init(
|
ImageProcessorFactory::getInstance().init(
|
||||||
@ -614,6 +614,26 @@ unsigned Hyperion::getLedCount() const
|
|||||||
return _ledString.leds().size();
|
return _ledString.leds().size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Hyperion::registerPriority(const std::string name, const int priority)
|
||||||
|
{
|
||||||
|
Info(_log, "Register new input source named '%s' for priority channel '%d'", name.c_str(), priority );
|
||||||
|
|
||||||
|
for(auto const &entry : _priorityRegister)
|
||||||
|
{
|
||||||
|
WarningIf( ( entry.first != name && entry.second == priority), _log,
|
||||||
|
"Input source '%s' uses same priority channel (%d) as '%s'.", name.c_str(), priority, entry.first.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
_priorityRegister.emplace(name,priority);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Hyperion::unRegisterPriority(const std::string name)
|
||||||
|
{
|
||||||
|
Info(_log, "Unregister input source named '%s' from priority register", name.c_str());
|
||||||
|
_priorityRegister.erase(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Hyperion::setColor(int priority, const ColorRgb &color, const int timeout_ms, bool clearEffects)
|
void Hyperion::setColor(int priority, const ColorRgb &color, const int timeout_ms, bool clearEffects)
|
||||||
{
|
{
|
||||||
// create led output
|
// create led output
|
||||||
|
@ -29,6 +29,9 @@ UDPListener::UDPListener(const int priority, const int timeout, const std::strin
|
|||||||
|
|
||||||
// Set trigger for incoming connections
|
// Set trigger for incoming connections
|
||||||
connect(_server, SIGNAL(readyRead()), this, SLOT(readPendingDatagrams()));
|
connect(_server, SIGNAL(readyRead()), this, SLOT(readPendingDatagrams()));
|
||||||
|
|
||||||
|
_hyperion->registerPriority("UDPLISTENER", _priority);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UDPListener::~UDPListener()
|
UDPListener::~UDPListener()
|
||||||
|
Loading…
Reference in New Issue
Block a user