still working on it
This commit is contained in:
@@ -14,8 +14,9 @@
|
|||||||
#include "PrintHandler.h"
|
#include "PrintHandler.h"
|
||||||
|
|
||||||
using namespace flippR_driver;
|
using namespace flippR_driver;
|
||||||
|
namespace po = boost::program_options;
|
||||||
|
|
||||||
void siginthandler(int param)
|
void __sigint_handler(int param)
|
||||||
{
|
{
|
||||||
printf("Caught SIGINT... aborting!\n");
|
printf("Caught SIGINT... aborting!\n");
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
@@ -28,8 +29,30 @@ static void show_usage(const std::string &name)
|
|||||||
<< "-osolc=<output_solenoid_config_file> -osc=<output_sound_config_file>]";
|
<< "-osolc=<output_solenoid_config_file> -osc=<output_sound_config_file>]";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
static void register_program_options(po::options_description &po_desc)
|
||||||
|
{
|
||||||
|
boost::optional<std::string> input_pin_config_file;
|
||||||
|
std::string input_matrix_config_file;
|
||||||
|
|
||||||
PrintHandler* start_print_handler(const std::string &input_config_file, const std::string &matrix_config_file)
|
boost::optional<std::string> output_pin_config_file;
|
||||||
|
std::string output_display_config_file;
|
||||||
|
std::string output_lamp_config_file;
|
||||||
|
std::string output_solenoid_config_file;
|
||||||
|
std::string output_sound_config_file;
|
||||||
|
|
||||||
|
po_desc.add_options()
|
||||||
|
("help", "print_help_message")
|
||||||
|
("input_pin_config,ipc", po::value<boost::optional<std::string>>(&input_pin_config_file), "input pin config file")
|
||||||
|
("input_matrix_config,imc", po::value<std::string>(&input_matrix_config_file), "input matrix config file")
|
||||||
|
("output_pin_config,opc", po::value<boost::optional<std::string>>(&output_pin_config_file), "output pin config file")
|
||||||
|
("output_display_config,idc", po::value<std::string>(&output_display_config_file), "output display config file")
|
||||||
|
("output_lamp_config,ilc", po::value<std::string>(&output_lamp_config_file), "output lamp config file")
|
||||||
|
("output_solenoid_config,isolc", po::value<std::string>(&output_solenoid_config_file), "output solenoid config file")
|
||||||
|
("output_sound_config,isc", po::value<std::string>(&output_sound_config_file), "output sound config file")
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
static PrintHandler* start_print_handler(const std::string &input_config_file, const std::string &matrix_config_file)
|
||||||
{
|
{
|
||||||
std::ifstream input_config;
|
std::ifstream input_config;
|
||||||
std::ifstream matrix_config;
|
std::ifstream matrix_config;
|
||||||
@@ -58,10 +81,12 @@ int main (int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
// registering sigint
|
// registering sigint
|
||||||
signal(SIGINT, siginthandler);
|
signal(SIGINT, __sigint_handler);
|
||||||
|
|
||||||
|
// todo work with boost program options
|
||||||
|
po::options_description po_desc("Options");
|
||||||
|
register_program_options(po_desc);
|
||||||
|
|
||||||
std::string input_config_file = argv[1];
|
|
||||||
std::string matrix_config_file = argv[2];
|
|
||||||
|
|
||||||
while(1);
|
while(1);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user