mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
enable components at runtime + grabber refactoring (#160)
* implement enable/disable on runtime for: - smoothing - kodi - udplistener - boblight * implement enable/disable for forwarder refactor component * - implement grabber enable/disable at runtime - big grabber refactoring. now with common base class for all grabbers * implement enable/disable at runtime for bb detector * osx fix * try to fix cutted travis output for osx build
This commit is contained in:
@@ -13,6 +13,7 @@ ProtoServer::ProtoServer(uint16_t port)
|
||||
, _server()
|
||||
, _openConnections()
|
||||
, _log(Logger::getInstance("PROTOSERVER"))
|
||||
, _forwarder_enabled(true)
|
||||
{
|
||||
|
||||
MessageForwarder * forwarder = _hyperion->getForwarder();
|
||||
@@ -35,6 +36,8 @@ ProtoServer::ProtoServer(uint16_t port)
|
||||
|
||||
// Set trigger for incoming connections
|
||||
connect(&_server, SIGNAL(newConnection()), this, SLOT(newConnection()));
|
||||
connect( _hyperion, SIGNAL(componentStateChanged(hyperion::Components,bool)), this, SLOT(componentStateChanged(hyperion::Components,bool)));
|
||||
|
||||
}
|
||||
|
||||
ProtoServer::~ProtoServer()
|
||||
@@ -81,8 +84,20 @@ void ProtoServer::newMessage(const proto::HyperionRequest * message)
|
||||
|
||||
void ProtoServer::sendImageToProtoSlaves(int priority, const Image<ColorRgb> & image, int duration_ms)
|
||||
{
|
||||
for (int i = 0; i < _proxy_connections.size(); ++i)
|
||||
_proxy_connections.at(i)->setImage(image, priority, duration_ms);
|
||||
if ( _forwarder_enabled )
|
||||
{
|
||||
for (int i = 0; i < _proxy_connections.size(); ++i)
|
||||
_proxy_connections.at(i)->setImage(image, priority, duration_ms);
|
||||
}
|
||||
}
|
||||
|
||||
void ProtoServer::componentStateChanged(const hyperion::Components component, bool enable)
|
||||
{
|
||||
if (component == hyperion::COMP_FORWARDER && _forwarder_enabled != enable)
|
||||
{
|
||||
_forwarder_enabled = enable;
|
||||
Info(_log, "forwarder change state to %s", (enable ? "enabled" : "disabled") );
|
||||
}
|
||||
}
|
||||
|
||||
void ProtoServer::closedConnection(ProtoClientConnection *connection)
|
||||
|
Reference in New Issue
Block a user