Files
flippr-code/FlippR-Driver/cli/main.cpp
2018-11-20 22:52:10 +01:00

58 lines
1.1 KiB
C++

//
// Created by rhetenor on 13.09.18.
//
#include <iostream>
#include <fstream>
#include <memory>
#include <signal.h>
#include "DriverFactory.h"
#include "input/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>";
exit(1);
}
signal(SIGINT, siginthandler);
std::string input_config_file = argv[1];
std::string matrix_config_file = argv[2];
std::ifstream input_config;
std::ifstream matrix_config;
try
{
input_config.open(input_config_file);
matrix_config.open(matrix_config_file);
}
catch(const std::exception& e)
{
std::cout << e.what();
exit(2);
}
std::shared_ptr<input::IInputDriver> driver = flippR_driver::get_InputDriver(input_config, matrix_config);
PrintHandler* print_handler = new PrintHandler(driver);
// driver->register_event_handler(print_handler); //registriert sich eigentlich von selbst!
while(1);
return 0;
}