70 lines
1.5 KiB
C++
70 lines
1.5 KiB
C++
//
|
|
// Created by rhetenor on 13.09.18.
|
|
//
|
|
#include <boost/program_options.hpp>
|
|
|
|
#include <iostream>
|
|
#include <fstream>
|
|
#include <memory>
|
|
#include <signal.h>
|
|
|
|
#include "DriverFactory.h"
|
|
#include "input/InputDriver.h"
|
|
|
|
#include "PrintHandler.h"
|
|
|
|
using namespace flippR_driver;
|
|
|
|
void siginthandler(int param)
|
|
{
|
|
printf("Caught SIGINT... aborting!\n");
|
|
exit(EXIT_SUCCESS);
|
|
}
|
|
|
|
static void show_usage(const std::string &name)
|
|
{
|
|
std::cout << "Usage: " << name << " [-ipc=<input_pin_config_file> -imc=<input_matrix_config_file>] "
|
|
<< "[-opc=<output_pin_config_file> -odc=<output_display_config_file> -olc=<output_lamp_config_file>] "
|
|
<< "-osolc=<output_solenoid_config_file> -osc=<output_sound_config_file>]";
|
|
|
|
}
|
|
|
|
PrintHandler* start_print_handler(const std::string &input_config_file, const std::string &matrix_config_file)
|
|
{
|
|
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(EXIT_FAILURE);
|
|
}
|
|
|
|
std::shared_ptr<input::InputDriver> driver = flippR_driver::get_InputDriver(input_config, matrix_config);
|
|
|
|
return new PrintHandler(driver);
|
|
}
|
|
|
|
int main (int argc, char *argv[])
|
|
{
|
|
if(argc < 3)
|
|
{
|
|
show_usage(argv[0]);
|
|
exit(EXIT_FAILURE);
|
|
}
|
|
|
|
// registering sigint
|
|
signal(SIGINT, siginthandler);
|
|
|
|
std::string input_config_file = argv[1];
|
|
std::string matrix_config_file = argv[2];
|
|
|
|
while(1);
|
|
|
|
return 0;
|
|
}
|