From cd62a41f22f45265700ac30d9615ca15c3c83567 Mon Sep 17 00:00:00 2001 From: Paulchen Panther Date: Sat, 1 May 2021 17:36:51 +0200 Subject: [PATCH] Global component states across instances --- libsrc/api/API.cpp | 16 ++++++++++++++-- libsrc/hyperion/HyperionIManager.cpp | 2 +- src/hyperiond/hyperiond.cpp | 3 +-- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/libsrc/api/API.cpp b/libsrc/api/API.cpp index b3413318..630133f6 100644 --- a/libsrc/api/API.cpp +++ b/libsrc/api/API.cpp @@ -205,8 +205,20 @@ bool API::setComponentState(const QString &comp, bool &compState, QString &reply if (component != COMP_INVALID) { - QMetaObject::invokeMethod(_hyperion, "compStateChangeRequest", Qt::QueuedConnection, Q_ARG(hyperion::Components, component), Q_ARG(bool, compState)); - return true; + if (component == COMP_FORWARDER || + component == COMP_GRABBER || + component == COMP_V4L || + component == COMP_FLATBUFSERVER || + component == COMP_PROTOSERVER) + { + QMetaObject::invokeMethod(_instanceManager, "compStateChangeRequest", Qt::QueuedConnection, Q_ARG(hyperion::Components, component), Q_ARG(bool, compState)); + return true; + } + else + { + QMetaObject::invokeMethod(_hyperion, "compStateChangeRequest", Qt::QueuedConnection, Q_ARG(hyperion::Components, component), Q_ARG(bool, compState)); + return true; + } } replyMsg = QString("Unknown component name: %1").arg(comp); return false; diff --git a/libsrc/hyperion/HyperionIManager.cpp b/libsrc/hyperion/HyperionIManager.cpp index 307bd073..72c03ece 100644 --- a/libsrc/hyperion/HyperionIManager.cpp +++ b/libsrc/hyperion/HyperionIManager.cpp @@ -88,9 +88,9 @@ bool HyperionIManager::startInstance(quint8 inst, bool block, QObject* caller, i // from Hyperion connect(hyperion, &Hyperion::settingsChanged, this, &HyperionIManager::settingsChanged); connect(hyperion, &Hyperion::videoMode, this, &HyperionIManager::requestVideoMode); - connect(hyperion, &Hyperion::compStateChangeRequest, this, &HyperionIManager::compStateChangeRequest); // to Hyperion connect(this, &HyperionIManager::newVideoMode, hyperion, &Hyperion::newVideoMode); + connect(this, &HyperionIManager::compStateChangeRequest, hyperion, &Hyperion::compStateChangeRequest); // add to queue and start _startQueue << inst; diff --git a/src/hyperiond/hyperiond.cpp b/src/hyperiond/hyperiond.cpp index ebc986f7..e5b62026 100644 --- a/src/hyperiond/hyperiond.cpp +++ b/src/hyperiond/hyperiond.cpp @@ -125,9 +125,8 @@ HyperionDaemon::HyperionDaemon(const QString& rootPath, QObject* parent, bool lo //Cleaning up Hyperion before quit connect(parent, SIGNAL(aboutToQuit()), this, SLOT(freeObjects())); - // pipe settings changes and component state changes from HyperionIManager to Daemon + // pipe settings changes from HyperionIManager to Daemon connect(_instanceManager, &HyperionIManager::settingsChanged, this, &HyperionDaemon::settingsChanged); - connect(_instanceManager, &HyperionIManager::compStateChangeRequest, this, &HyperionDaemon::compStateChangeRequest); // listen for setting changes of framegrabber and v4l2 connect(this, &HyperionDaemon::settingsChanged, this, &HyperionDaemon::handleSettingsUpdate);