implemented cli

This commit is contained in:
Jonas Zeunert
2018-09-14 00:12:56 +02:00
parent 18ed362486
commit 05f4242d6d
5 changed files with 51 additions and 5 deletions

View File

@@ -4,18 +4,30 @@
#include <iostream>
#include <fstream>
#include <memory>
#include <signal.h>
#include "DriverFactory.h"
#include "IInputDriver.h"
#include "PrintHandler.h"
using namespace FlippR_Driver;
void siginthandler(int param)
{
printf("Caught SIGINT... aborting!\n");
exit(1);
}
int main (int argc, char *argv[])
{
if(argc != 3)
{
std::cout << "Usage: " << argv[0] << " <input_config_file> <matrix_config_file>";
}
signal(SIGINT, siginthandler);
std::string input_config_file = argv[1];
std::string matrix_config_file = argv[2];
@@ -29,9 +41,16 @@ int main (int argc, char *argv[])
catch(const std::exception& e)
{
std::cout << e.what();
exit(1);
exit(2);
}
std::shared_ptr<Input::IInputDriver> driver = FlippR_Driver::get_InputDriver(input_config, matrix_config);
PrintHandler* print_handler = new PrintHandler();
driver->register_event_handler(print_handler);
while(1);
return 0;
}