mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
Added signal handler to properly exit application and switch off the leds.
This commit is contained in:
parent
e2eb5ecd7f
commit
9033927685
@ -1,4 +1,7 @@
|
|||||||
|
|
||||||
|
// C++ includes
|
||||||
|
#include <csignal>
|
||||||
|
|
||||||
// QT includes
|
// QT includes
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
|
|
||||||
@ -14,12 +17,20 @@
|
|||||||
// JsonServer includes
|
// JsonServer includes
|
||||||
#include <jsonserver/JsonServer.h>
|
#include <jsonserver/JsonServer.h>
|
||||||
|
|
||||||
|
void signal_handler(const int signum)
|
||||||
|
{
|
||||||
|
QCoreApplication::quit();
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
// Initialising QCoreApplication
|
// Initialising QCoreApplication
|
||||||
QCoreApplication app(argc, argv);
|
QCoreApplication app(argc, argv);
|
||||||
std::cout << "QCoreApplication initialised" << std::endl;
|
std::cout << "QCoreApplication initialised" << std::endl;
|
||||||
|
|
||||||
|
signal(SIGINT, signal_handler);
|
||||||
|
signal(SIGTERM, signal_handler);
|
||||||
|
|
||||||
if (argc < 2)
|
if (argc < 2)
|
||||||
{
|
{
|
||||||
std::cout << "Missing required configuration file. Usage:" << std::endl;
|
std::cout << "Missing required configuration file. Usage:" << std::endl;
|
||||||
@ -42,4 +53,9 @@ int main(int argc, char** argv)
|
|||||||
|
|
||||||
app.exec();
|
app.exec();
|
||||||
std::cout << "Application closed" << std::endl;
|
std::cout << "Application closed" << std::endl;
|
||||||
|
|
||||||
|
// Stop the frame grabber
|
||||||
|
dispmanx.stop();
|
||||||
|
// Clear all colors (switchting off all leds)
|
||||||
|
hyperion.clearall();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user