ADD: added libs; added CMakeLists.txt; added framework of the app
This commit is contained in:
44
src/main.cpp
44
src/main.cpp
@@ -0,0 +1,44 @@
|
||||
#include <iostream>
|
||||
#include <csignal>
|
||||
|
||||
#include <SimControl/SimControl.hpp>
|
||||
|
||||
/// variable for stopping the application
|
||||
bool running = true;
|
||||
|
||||
/**
|
||||
* @brief killhandler to set running to false on CTRL-C
|
||||
*
|
||||
* @param s - the signal to manage
|
||||
*/
|
||||
void killHandlerPing(int s) {
|
||||
|
||||
if (s == SIGINT) {
|
||||
running = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
|
||||
// setup signal handler
|
||||
struct sigaction sigIntHandler;
|
||||
sigIntHandler.sa_handler = killHandlerPing;
|
||||
sigemptyset(&sigIntHandler.sa_mask);
|
||||
sigIntHandler.sa_flags = 0;
|
||||
sigaction(SIGINT, &sigIntHandler, NULL);
|
||||
|
||||
|
||||
SimControl::SimControl sc("127.0.0.255",8000);
|
||||
|
||||
sc.start();
|
||||
while (running) {
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(500));
|
||||
}
|
||||
sc.stop();
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user