working on cli
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
//
|
||||
// Created by rhetenor on 13.09.18.
|
||||
//
|
||||
#include <boost/program_options.hpp>
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <memory>
|
||||
@@ -16,22 +18,19 @@ using namespace flippR_driver;
|
||||
void siginthandler(int param)
|
||||
{
|
||||
printf("Caught SIGINT... aborting!\n");
|
||||
exit(1);
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
static void show_usage(const std::string &name)
|
||||
{
|
||||
if(argc != 3)
|
||||
{
|
||||
std::cout << "Usage: " << argv[0] << " <input_config_file> <matrix_config_file>";
|
||||
exit(1);
|
||||
}
|
||||
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>]";
|
||||
|
||||
signal(SIGINT, siginthandler);
|
||||
|
||||
std::string input_config_file = argv[1];
|
||||
std::string matrix_config_file = argv[2];
|
||||
}
|
||||
|
||||
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
|
||||
@@ -42,14 +41,27 @@ int main (int argc, char *argv[])
|
||||
catch(const std::exception& e)
|
||||
{
|
||||
std::cout << e.what();
|
||||
exit(2);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
std::shared_ptr<input::InputDriver> driver = flippR_driver::get_InputDriver(input_config, matrix_config);
|
||||
|
||||
PrintHandler* print_handler = new PrintHandler(driver);
|
||||
return new PrintHandler(driver);
|
||||
}
|
||||
|
||||
// driver->register_event_handler(print_handler); //registriert sich eigentlich von selbst!
|
||||
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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user