mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
The WebUI remote page has been rearranged
Set interuption flag to running effects when hyperion emits finished signal Protobuffer, Flatbuffer and Boblight connection priority check to avoid unwanted program behavior Signed-off-by: Paulchen-Panther <Paulchen-Panter@protonmail.com>
This commit is contained in:
parent
2e8014bdbb
commit
cacfbada7a
@ -68,13 +68,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6 col-lg-6 col-xxl-5">
|
||||
<div class="panel panel-default" >
|
||||
<div class="panel-heading"><i class="fa fa-wifi fa-fw"></i><span data-i18n="remote_adjustment_label"></span></div>
|
||||
<div class="panel-body" id="adjust_content">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6 col-lg-6 col-xxl-5">
|
||||
<div class="panel panel-default" >
|
||||
<div class="panel-heading"><i class="fa fa-wifi fa-fw"></i><span data-i18n="remote_videoMode_label"></span></div>
|
||||
@ -83,6 +76,13 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6 col-lg-6 col-xxl-5">
|
||||
<div class="panel panel-default" >
|
||||
<div class="panel-heading"><i class="fa fa-wifi fa-fw"></i><span data-i18n="remote_adjustment_label"></span></div>
|
||||
<div class="panel-body" id="adjust_content">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="/js/content_remote.js" ></script>
|
||||
|
@ -45,6 +45,7 @@ BoblightClientConnection::BoblightClientConnection(Hyperion* hyperion, QTcpSocke
|
||||
BoblightClientConnection::~BoblightClientConnection()
|
||||
{
|
||||
// clear the current channel
|
||||
if (_priority != 0 && _priority >= 128 && _priority < 254)
|
||||
_hyperion->clear(_priority);
|
||||
|
||||
delete _socket;
|
||||
@ -80,6 +81,7 @@ void BoblightClientConnection::readData()
|
||||
void BoblightClientConnection::socketClosed()
|
||||
{
|
||||
// clear the current channel
|
||||
if (_priority != 0 && _priority >= 128 && _priority < 254)
|
||||
_hyperion->clear(_priority);
|
||||
|
||||
emit connectionClosed(this);
|
||||
@ -155,6 +157,9 @@ void BoblightClientConnection::handleMessage(const QString & message)
|
||||
rgb.green = green;
|
||||
rgb.blue = blue;
|
||||
|
||||
if (_priority == 0 || _priority < 128 || _priority >= 254)
|
||||
return;
|
||||
|
||||
// send current color values to hyperion if this is the last led assuming leds values are send in order of id
|
||||
if (ledIndex == _ledColors.size() -1)
|
||||
{
|
||||
@ -180,21 +185,35 @@ void BoblightClientConnection::handleMessage(const QString & message)
|
||||
int prio = messageParts[2].toInt(&rc);
|
||||
if (rc && prio != _priority)
|
||||
{
|
||||
// clear the current channel
|
||||
if (_priority != 0 && _hyperion->getPriorityInfo(_priority).componentId == hyperion::COMP_BOBLIGHTSERVER)
|
||||
_hyperion->clear(_priority);
|
||||
|
||||
if (prio < 128 || prio >= 254)
|
||||
{
|
||||
_priority = 128;
|
||||
while (_hyperion->getActivePriorities().contains(_priority))
|
||||
{
|
||||
_priority += 1;
|
||||
}
|
||||
|
||||
Warning(_log, "The priority %i is not in the priority range between 128 and 253. Priority %i is used instead.", prio, _priority);
|
||||
}
|
||||
else
|
||||
{
|
||||
// register new priority
|
||||
_hyperion->registerInput(prio, hyperion::COMP_BOBLIGHTSERVER, QString("Boblight@%1").arg(_socket->peerAddress().toString()));
|
||||
|
||||
_priority = prio;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (messageParts[0] == "sync")
|
||||
{
|
||||
// send current color values to hyperion
|
||||
_hyperion->setInput(_priority, _ledColors);
|
||||
if (_priority != 0 && _priority >= 128 && _priority < 254)
|
||||
_hyperion->setInput(_priority, _ledColors); // send current color values to hyperion
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -172,6 +172,7 @@ int EffectEngine::runEffectScript(const QString &script, const QString &name, co
|
||||
connect(effect, &Effect::setInput, _hyperion, &Hyperion::setInput, Qt::QueuedConnection);
|
||||
connect(effect, &Effect::setInputImage, _hyperion, &Hyperion::setInputImage, Qt::QueuedConnection);
|
||||
connect(effect, &QThread::finished, this, &EffectEngine::effectFinished);
|
||||
connect(_hyperion, &Hyperion::finished, effect, &Effect::setInteruptionFlag, Qt::DirectConnection);
|
||||
_activeEffects.push_back(effect);
|
||||
|
||||
// start the effect
|
||||
|
@ -6,9 +6,6 @@
|
||||
#include <QTimer>
|
||||
#include <QRgb>
|
||||
|
||||
#include <hyperion/Hyperion.h>
|
||||
#include <hyperion/HyperionIManager.h>
|
||||
|
||||
FlatBufferClient::FlatBufferClient(QTcpSocket* socket, const int &timeout, QObject *parent)
|
||||
: QObject(parent)
|
||||
, _log(Logger::getInstance("FLATBUFSERVER"))
|
||||
@ -72,7 +69,9 @@ void FlatBufferClient::disconnected()
|
||||
{
|
||||
Debug(_log, "Socket Closed");
|
||||
_socket->deleteLater();
|
||||
if (_priority != 0 && _priority >= 100 && _priority < 200)
|
||||
emit clearGlobalInput(_priority);
|
||||
|
||||
emit clientDisconnected();
|
||||
}
|
||||
|
||||
@ -122,6 +121,13 @@ void FlatBufferClient::registationRequired(const int priority)
|
||||
|
||||
void FlatBufferClient::handleRegisterCommand(const hyperionnet::Register *regReq)
|
||||
{
|
||||
if (regReq->priority() < 100 || regReq->priority() >= 200)
|
||||
{
|
||||
// Warning(_log, "Register request from client %s contains invalid priority %d. Valid rage is between 100 and 199.", QSTRING_CSTR(_clientAddress), regReq->priority());
|
||||
sendErrorReply("The priority " + std::to_string(regReq->priority()) + " is not in the priority range between 100 and 199.");
|
||||
return;
|
||||
}
|
||||
|
||||
_priority = regReq->priority();
|
||||
emit registerGlobalInput(_priority, hyperion::COMP_FLATBUFSERVER, regReq->origin()->c_str()+_clientAddress);
|
||||
|
||||
|
@ -12,7 +12,6 @@
|
||||
|
||||
class QTcpSocket;
|
||||
class QTimer;
|
||||
class Hyperion;
|
||||
|
||||
namespace flatbuf {
|
||||
class HyperionRequest;
|
||||
|
@ -217,5 +217,8 @@ bool FlatBufferConnection::parseReply(const hyperionnet::Reply *reply)
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
throw std::runtime_error(reply->error()->str());
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -7,12 +7,6 @@
|
||||
#include <QTimer>
|
||||
#include <QRgb>
|
||||
|
||||
// Hyperion includes
|
||||
#include <hyperion/Hyperion.h>
|
||||
|
||||
// Hyperion instance manager includes
|
||||
#include <hyperion/HyperionIManager.h>
|
||||
|
||||
// TODO Remove this class if third-party apps have been migrated (eg. Hyperion Android Gabber, Windows Screen grabber etc.)
|
||||
|
||||
ProtoClientConnection::ProtoClientConnection(QTcpSocket* socket, const int &timeout, QObject *parent)
|
||||
@ -130,6 +124,12 @@ void ProtoClientConnection::handleColorCommand(const proto::ColorRequest &messag
|
||||
color.green = qGreen(message.rgbcolor());
|
||||
color.blue = qBlue(message.rgbcolor());
|
||||
|
||||
if (priority < 100 || priority >= 200)
|
||||
{
|
||||
sendErrorReply("The priority " + std::to_string(priority) + " is not in the priority range between 100 and 199.");
|
||||
return;
|
||||
}
|
||||
|
||||
// make sure the prio is registered before setColor()
|
||||
if(priority != _priority)
|
||||
{
|
||||
@ -154,6 +154,12 @@ void ProtoClientConnection::handleImageCommand(const proto::ImageRequest &messag
|
||||
int height = message.imageheight();
|
||||
const std::string & imageData = message.imagedata();
|
||||
|
||||
if (priority < 100 || priority >= 200)
|
||||
{
|
||||
sendErrorReply("The priority " + std::to_string(priority) + " is not in the priority range between 100 and 199.");
|
||||
return;
|
||||
}
|
||||
|
||||
// make sure the prio is registered before setInput()
|
||||
if(priority != _priority)
|
||||
{
|
||||
|
@ -11,7 +11,6 @@
|
||||
|
||||
class QTcpSocket;
|
||||
class QTimer;
|
||||
class Hyperion;
|
||||
|
||||
namespace proto {
|
||||
class HyperionRequest;
|
||||
|
Loading…
Reference in New Issue
Block a user