mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
Conditions with priority 255 removed in Boblight
Signal/Slot connection finished/deleteLater removed between HyperionDeamon/HyperionIManager Signed-off-by: Paulchen-Panther <Paulchen-Panter@protonmail.com>
This commit is contained in:
parent
1960f7652d
commit
2e8014bdbb
@ -43,13 +43,9 @@ BoblightClientConnection::BoblightClientConnection(Hyperion* hyperion, QTcpSocke
|
|||||||
}
|
}
|
||||||
|
|
||||||
BoblightClientConnection::~BoblightClientConnection()
|
BoblightClientConnection::~BoblightClientConnection()
|
||||||
{
|
|
||||||
if (_priority < 255)
|
|
||||||
{
|
{
|
||||||
// clear the current channel
|
// clear the current channel
|
||||||
_hyperion->clear(_priority);
|
_hyperion->clear(_priority);
|
||||||
_priority = 255;
|
|
||||||
}
|
|
||||||
|
|
||||||
delete _socket;
|
delete _socket;
|
||||||
}
|
}
|
||||||
@ -82,13 +78,9 @@ void BoblightClientConnection::readData()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void BoblightClientConnection::socketClosed()
|
void BoblightClientConnection::socketClosed()
|
||||||
{
|
|
||||||
if (_priority < 255)
|
|
||||||
{
|
{
|
||||||
// clear the current channel
|
// clear the current channel
|
||||||
_hyperion->clear(_priority);
|
_hyperion->clear(_priority);
|
||||||
_priority = 255;
|
|
||||||
}
|
|
||||||
|
|
||||||
emit connectionClosed(this);
|
emit connectionClosed(this);
|
||||||
}
|
}
|
||||||
@ -164,7 +156,7 @@ void BoblightClientConnection::handleMessage(const QString & message)
|
|||||||
rgb.blue = blue;
|
rgb.blue = blue;
|
||||||
|
|
||||||
// send current color values to hyperion if this is the last led assuming leds values are send in order of id
|
// 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) && _priority < 255)
|
if (ledIndex == _ledColors.size() -1)
|
||||||
{
|
{
|
||||||
_hyperion->setInput(_priority, _ledColors);
|
_hyperion->setInput(_priority, _ledColors);
|
||||||
}
|
}
|
||||||
@ -187,15 +179,12 @@ void BoblightClientConnection::handleMessage(const QString & message)
|
|||||||
bool rc;
|
bool rc;
|
||||||
int prio = messageParts[2].toInt(&rc);
|
int prio = messageParts[2].toInt(&rc);
|
||||||
if (rc && prio != _priority)
|
if (rc && prio != _priority)
|
||||||
{
|
|
||||||
if (_priority < 255)
|
|
||||||
{
|
{
|
||||||
// clear the current channel
|
// clear the current channel
|
||||||
_hyperion->clear(_priority);
|
_hyperion->clear(_priority);
|
||||||
|
|
||||||
// register new priority
|
// register new priority
|
||||||
_hyperion->registerInput(prio, hyperion::COMP_BOBLIGHTSERVER, QString("Boblight@%1").arg(_socket->peerAddress().toString()));
|
_hyperion->registerInput(prio, hyperion::COMP_BOBLIGHTSERVER, QString("Boblight@%1").arg(_socket->peerAddress().toString()));
|
||||||
}
|
|
||||||
|
|
||||||
_priority = prio;
|
_priority = prio;
|
||||||
return;
|
return;
|
||||||
@ -205,10 +194,7 @@ void BoblightClientConnection::handleMessage(const QString & message)
|
|||||||
else if (messageParts[0] == "sync")
|
else if (messageParts[0] == "sync")
|
||||||
{
|
{
|
||||||
// send current color values to hyperion
|
// send current color values to hyperion
|
||||||
if (_priority < 255)
|
|
||||||
{
|
|
||||||
_hyperion->setInput(_priority, _ledColors);
|
_hyperion->setInput(_priority, _ledColors);
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -216,12 +202,6 @@ void BoblightClientConnection::handleMessage(const QString & message)
|
|||||||
Debug(_log, "unknown boblight message: %s", QSTRING_CSTR(message));
|
Debug(_log, "unknown boblight message: %s", QSTRING_CSTR(message));
|
||||||
}
|
}
|
||||||
|
|
||||||
void BoblightClientConnection::sendMessage(const QByteArray & message)
|
|
||||||
{
|
|
||||||
//std::cout << "send boblight message: " << message;
|
|
||||||
_socket->write(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
void BoblightClientConnection::sendLightMessage()
|
void BoblightClientConnection::sendLightMessage()
|
||||||
{
|
{
|
||||||
char buffer[256];
|
char buffer[256];
|
||||||
|
@ -63,7 +63,7 @@ private:
|
|||||||
///
|
///
|
||||||
/// @param message The boblight message to send
|
/// @param message The boblight message to send
|
||||||
///
|
///
|
||||||
void sendMessage(const QByteArray &message);
|
void sendMessage(const QByteArray &message) { _socket->write(message); };
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Send a lights message the to connected client
|
/// Send a lights message the to connected client
|
||||||
|
@ -68,7 +68,6 @@ bool HyperionIManager::startInstance(const quint8& inst, const bool& block)
|
|||||||
hyperion->moveToThread(hyperionThread);
|
hyperion->moveToThread(hyperionThread);
|
||||||
// setup thread management
|
// setup thread management
|
||||||
connect(hyperionThread, &QThread::started, hyperion, &Hyperion::start);
|
connect(hyperionThread, &QThread::started, hyperion, &Hyperion::start);
|
||||||
connect(hyperionThread, &QThread::finished, hyperionThread, &QObject::deleteLater);
|
|
||||||
connect(hyperion, &Hyperion::started, this, &HyperionIManager::handleStarted);
|
connect(hyperion, &Hyperion::started, this, &HyperionIManager::handleStarted);
|
||||||
connect(hyperion, &Hyperion::finished, this, &HyperionIManager::handleFinished);
|
connect(hyperion, &Hyperion::finished, this, &HyperionIManager::handleFinished);
|
||||||
connect(hyperion, &Hyperion::finished, hyperionThread, &QThread::quit, Qt::DirectConnection);
|
connect(hyperion, &Hyperion::finished, hyperionThread, &QThread::quit, Qt::DirectConnection);
|
||||||
|
Loading…
Reference in New Issue
Block a user