SIGUSR1/SIGUSR2 implemented again (#725)

Signed-off-by: Paulchen-Panther <Paulchen-Panter@protonmail.com>
This commit is contained in:
Paulchen Panther 2020-03-26 19:37:39 +01:00 committed by GitHub
parent aaa4235cab
commit c3cf352b0c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 6 deletions

View File

@ -67,6 +67,12 @@ public slots:
///
bool stopInstance(const quint8& inst);
///
/// @brief Toggle the state of all Hyperion instances
/// @param pause If true all instances toggle to pause, else to resume
///
void toggleStateAllInstances(const bool& pause = false);
///
/// @brief Create a new Hyperion instance entry in db
/// @param name The friendly name of the instance

View File

@ -57,6 +57,16 @@ void HyperionIManager::stopAll()
}
}
void HyperionIManager::toggleStateAllInstances(const bool& pause)
{
// copy the instances due to loop corruption, even with .erase() return next iter
QMap<quint8, Hyperion*> instCopy = _runningInstances;
for(const auto instance : instCopy)
{
emit instance->compStateChangeRequest(hyperion::COMP_ALL, pause);
}
}
bool HyperionIManager::startInstance(const quint8& inst, const bool& block)
{
if(_instanceTable->instanceExist(inst))

View File

@ -115,8 +115,6 @@ unsigned int getProcessIdsByProcessName(const char* processName, QStringList &li
void signal_handler(const int signum)
{
// SIGUSR1 and SIGUSR2 must be rewritten
// Hyperion Managment instance
HyperionIManager* _hyperion = HyperionIManager::getInstance();
@ -130,8 +128,7 @@ void signal_handler(const int signum)
{
if (_hyperion != nullptr)
{
// _hyperion->setComponentState(hyperion::COMP_SMOOTHING, false);
// _hyperion->setComponentState(hyperion::COMP_LEDDEVICE, false);
_hyperion->toggleStateAllInstances(false);
}
return;
}
@ -139,8 +136,7 @@ void signal_handler(const int signum)
{
if (_hyperion != nullptr)
{
// _hyperion->setComponentState(hyperion::COMP_LEDDEVICE, true);
// _hyperion->setComponentState(hyperion::COMP_SMOOTHING, true);
_hyperion->toggleStateAllInstances(true);
}
return;
}