mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Proto- and Flatbuffer now share their input to all instances
Signed-off-by: Paulchen-Panther <Paulchen-Panter@protonmail.com>
This commit is contained in:
@@ -17,7 +17,6 @@ FlatBufferClient::FlatBufferClient(QTcpSocket* socket, const int &timeout, QObje
|
||||
, _timeoutTimer(new QTimer(this))
|
||||
, _timeout(timeout * 1000)
|
||||
, _priority()
|
||||
, _hyperion(HyperionIManager::getInstance()->getHyperionInstance())
|
||||
{
|
||||
// timer setup
|
||||
_timeoutTimer->setSingleShot(true);
|
||||
@@ -72,8 +71,8 @@ void FlatBufferClient::forceClose()
|
||||
void FlatBufferClient::disconnected()
|
||||
{
|
||||
Debug(_log, "Socket Closed");
|
||||
_socket->deleteLater();
|
||||
_hyperion->clear(_priority);
|
||||
_socket->deleteLater();
|
||||
emit clearGlobalInput(_priority);
|
||||
emit clientDisconnected();
|
||||
}
|
||||
|
||||
@@ -103,16 +102,28 @@ void FlatBufferClient::handleColorCommand(const hyperionnet::Color *colorReq)
|
||||
color.blue = qBlue(rgbData);
|
||||
|
||||
// set output
|
||||
_hyperion->setColor(_priority, color, colorReq->duration());
|
||||
emit setGlobalInputColor(_priority, color, colorReq->duration());
|
||||
|
||||
// send reply
|
||||
sendSuccessReply();
|
||||
}
|
||||
|
||||
void FlatBufferClient::registationRequired(const int priority)
|
||||
{
|
||||
if (_priority == priority)
|
||||
{
|
||||
auto reply = hyperionnet::CreateReplyDirect(_builder, nullptr, -1, -1);
|
||||
_builder.Finish(reply);
|
||||
|
||||
// send reply
|
||||
sendMessage();
|
||||
}
|
||||
}
|
||||
|
||||
void FlatBufferClient::handleRegisterCommand(const hyperionnet::Register *regReq)
|
||||
{
|
||||
_priority = regReq->priority();
|
||||
_hyperion->registerInput(_priority, hyperion::COMP_FLATBUFSERVER, regReq->origin()->c_str()+_clientAddress);
|
||||
emit registerGlobalInput(_priority, hyperion::COMP_FLATBUFSERVER, regReq->origin()->c_str()+_clientAddress);
|
||||
|
||||
auto reply = hyperionnet::CreateReplyDirect(_builder, nullptr, -1, (_priority ? _priority : -1));
|
||||
_builder.Finish(reply);
|
||||
@@ -142,7 +153,7 @@ void FlatBufferClient::handleImageCommand(const hyperionnet::Image *image)
|
||||
|
||||
Image<ColorRgb> imageDest(width, height);
|
||||
memmove(imageDest.memptr(), imageData->data(), imageData->size());
|
||||
_hyperion->setInputImage(_priority, imageDest, duration);
|
||||
emit setGlobalInputImage(_priority, imageDest, duration);
|
||||
}
|
||||
|
||||
// send reply
|
||||
@@ -156,7 +167,7 @@ void FlatBufferClient::handleClearCommand(const hyperionnet::Clear *clear)
|
||||
const int priority = clear->priority();
|
||||
|
||||
if (priority == -1) {
|
||||
_hyperion->clearall();
|
||||
emit clearAllGlobalInput();
|
||||
}
|
||||
else {
|
||||
// Check if we are clearing ourselves.
|
||||
@@ -164,7 +175,7 @@ void FlatBufferClient::handleClearCommand(const hyperionnet::Clear *clear)
|
||||
_priority = -1;
|
||||
}
|
||||
|
||||
_hyperion->clear(priority);
|
||||
emit clearGlobalInput(priority);
|
||||
}
|
||||
|
||||
sendSuccessReply();
|
||||
|
Reference in New Issue
Block a user