mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Introduce Event Services (#1653)
* Allow to enable/disable suspend & lock event handling * Fix Windows * Refactor event handling incl.CEC * Revert "Auxiliary commit to revert individual files from 0d9a8b8a3a4a09609a339f54c7d8a9384c561282" This reverts commit 80737d926ad151a07b2493dd1685ed502975cb2e. * Support Events for Grabbers generically * Have CECEvent to actions configurable, further clean-ups * Remove handleEvent from V4L2grabber, as grabber will be stopped on suspend * Validate that one CEC Event can only trigger one action * MacOS lock/unlock added * fast windows fix * Corrections * Fix CodeQL findings * add macos lock/unlock handler * Migration of CEC-config and have default actions * Correct target_link_libraries * Include Foundation * macOS include AppKit * Support Scheduled Events, cleanups. * Fix destructing * Fix coredump during free * Consider additional error sceanrio * Fix missing code * install desktop icons * correct bash logic --------- Co-authored-by: Paulchen-Panther <16664240+Paulchen-Panther@users.noreply.github.com>
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
#include <grabber/qt/QtGrabber.h>
|
||||
|
||||
#include <utils/WeakConnect.h>
|
||||
#include <events/EventEnum.h>
|
||||
|
||||
#if defined(ENABLE_MF)
|
||||
#include <grabber/video/mediafoundation/MFGrabber.h>
|
||||
@@ -82,6 +83,7 @@
|
||||
|
||||
// api includes
|
||||
#include <api/JsonCB.h>
|
||||
#include <events/EventHandler.h>
|
||||
|
||||
// auth manager
|
||||
#include <hyperion/AuthManager.h>
|
||||
@@ -110,6 +112,8 @@ JsonAPI::JsonAPI(QString peerAddress, Logger *log, bool localConnection, QObject
|
||||
_ledStreamTimer = new QTimer(this);
|
||||
|
||||
Q_INIT_RESOURCE(JSONRPC_schemas);
|
||||
|
||||
qRegisterMetaType<Event>("Event");
|
||||
}
|
||||
|
||||
void JsonAPI::initialize()
|
||||
@@ -135,16 +139,13 @@ void JsonAPI::initialize()
|
||||
connect(this, &JsonAPI::forwardJsonMessage, _hyperion, &Hyperion::forwardJsonMessage);
|
||||
}
|
||||
|
||||
//notify instance manager on suspend/resume/idle requests
|
||||
connect(this, &JsonAPI::suspendAll, _instanceManager, &HyperionIManager::triggerSuspend);
|
||||
connect(this, &JsonAPI::toggleSuspendAll, _instanceManager, &HyperionIManager::triggerToggleSuspend);
|
||||
connect(this, &JsonAPI::idleAll, _instanceManager, &HyperionIManager::triggerIdle);
|
||||
connect(this, &JsonAPI::toggleIdleAll, _instanceManager, &HyperionIManager::triggerToggleIdle);
|
||||
//notify eventhadler on suspend/resume/idle requests
|
||||
connect(this, &JsonAPI::signalEvent, EventHandler::getInstance(), &EventHandler::handleEvent);
|
||||
|
||||
connect(_ledStreamTimer, &QTimer::timeout, this, &JsonAPI::streamLedColorsUpdate, Qt::UniqueConnection);
|
||||
}
|
||||
|
||||
bool JsonAPI::handleInstanceSwitch(quint8 inst, bool forced)
|
||||
bool JsonAPI::handleInstanceSwitch(quint8 inst, bool /*forced*/)
|
||||
{
|
||||
if (API::setHyperionInstance(inst))
|
||||
{
|
||||
@@ -1014,8 +1015,7 @@ void JsonAPI::handleConfigCommand(const QJsonObject &message, const QString &com
|
||||
if (_adminAuthorized)
|
||||
{
|
||||
Debug(_log, "Restarting due to RPC command");
|
||||
|
||||
Process::restartHyperion(10);
|
||||
emit signalEvent(Event::Reload);
|
||||
|
||||
sendSuccessReply(command + "-" + subcommand, tan);
|
||||
}
|
||||
@@ -1852,32 +1852,37 @@ void JsonAPI::handleSystemCommand(const QJsonObject &message, const QString &com
|
||||
|
||||
if (subc == "suspend")
|
||||
{
|
||||
emit suspendAll(true);
|
||||
emit signalEvent(Event::Suspend);
|
||||
sendSuccessReply(command + "-" + subc, tan);
|
||||
}
|
||||
else if (subc == "resume")
|
||||
{
|
||||
emit suspendAll(false);
|
||||
emit signalEvent(Event::Resume);
|
||||
sendSuccessReply(command + "-" + subc, tan);
|
||||
}
|
||||
else if (subc == "restart")
|
||||
{
|
||||
Process::restartHyperion(11);
|
||||
emit signalEvent(Event::Restart);
|
||||
sendSuccessReply(command + "-" + subc, tan);
|
||||
}
|
||||
else if (subc == "toggleSuspend")
|
||||
{
|
||||
emit toggleSuspendAll();
|
||||
emit signalEvent(Event::ToggleSuspend);
|
||||
sendSuccessReply(command + "-" + subc, tan);
|
||||
}
|
||||
else if (subc == "idle")
|
||||
{
|
||||
emit idleAll(true);
|
||||
emit signalEvent(Event::Idle);
|
||||
sendSuccessReply(command + "-" + subc, tan);
|
||||
}
|
||||
else if (subc == "resumeIdle")
|
||||
{
|
||||
emit signalEvent(Event::ResumeIdle);
|
||||
sendSuccessReply(command + "-" + subc, tan);
|
||||
}
|
||||
else if (subc == "toggleIdle")
|
||||
{
|
||||
emit toggleIdleAll();
|
||||
emit signalEvent(Event::ToggleIdle);
|
||||
sendSuccessReply(command + "-" + subc, tan);
|
||||
}
|
||||
else
|
||||
|
Reference in New Issue
Block a user