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
|
||||
#include <QCoreApplication>
|
||||
|
||||
@ -14,12 +17,20 @@
|
||||
// JsonServer includes
|
||||
#include <jsonserver/JsonServer.h>
|
||||
|
||||
void signal_handler(const int signum)
|
||||
{
|
||||
QCoreApplication::quit();
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
// Initialising QCoreApplication
|
||||
QCoreApplication app(argc, argv);
|
||||
std::cout << "QCoreApplication initialised" << std::endl;
|
||||
|
||||
signal(SIGINT, signal_handler);
|
||||
signal(SIGTERM, signal_handler);
|
||||
|
||||
if (argc < 2)
|
||||
{
|
||||
std::cout << "Missing required configuration file. Usage:" << std::endl;
|
||||
@ -42,4 +53,9 @@ int main(int argc, char** argv)
|
||||
|
||||
app.exec();
|
||||
std::cout << "Application closed" << std::endl;
|
||||
|
||||
// Stop the frame grabber
|
||||
dispmanx.stop();
|
||||
// Clear all colors (switchting off all leds)
|
||||
hyperion.clearall();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user