deleted several options
This commit is contained in:
@@ -37,13 +37,7 @@ using namespace Poco;
|
|||||||
FlippRServer::FlippRServer() :
|
FlippRServer::FlippRServer() :
|
||||||
help_requested(false),
|
help_requested(false),
|
||||||
input_port(9980),
|
input_port(9980),
|
||||||
output_port(9981),
|
output_port(9981)
|
||||||
input_config("Not set"),
|
|
||||||
matrix_config("Not set"),
|
|
||||||
lamp_config("Not set"),
|
|
||||||
solenoid_config("Not set"),
|
|
||||||
sound_config("Not set"),
|
|
||||||
display_config("Not set")
|
|
||||||
{
|
{
|
||||||
this->parse_server_config_file();
|
this->parse_server_config_file();
|
||||||
}
|
}
|
||||||
@@ -196,17 +190,17 @@ void FlippRServer::defineOptions(OptionSet& options)
|
|||||||
ServerApplication::defineOptions(options);
|
ServerApplication::defineOptions(options);
|
||||||
|
|
||||||
options.addOption(
|
options.addOption(
|
||||||
Option("help", "h", "display argument help information")
|
Option("help", "h", "display this help")
|
||||||
.required(false)
|
.required(false)
|
||||||
.repeatable(false)
|
.repeatable(false)
|
||||||
.callback(OptionCallback<FlippRServer>(
|
.callback(OptionCallback<FlippRServer>(
|
||||||
this, &FlippRServer::handle_help)));
|
this, &FlippRServer::handle_help)));
|
||||||
|
|
||||||
options.addOption(Option("input-port", "i", "Define the port for the TCP-Input-Server, which represents the flipper inputs. Default 9980")
|
options.addOption(Option("input-port", "i", "Define the port for the TCP-Input-Server, which represents the flipper inputs. Default 9980")
|
||||||
.required(false)
|
.required(false)
|
||||||
.repeatable(false)
|
.repeatable(false)
|
||||||
.callback(OptionCallback<FlippRServer>(this, &FlippRServer::handle_config_file))
|
.callback(OptionCallback<FlippRServer>(this, &FlippRServer::handle_config_file))
|
||||||
.argument("input-port", true));
|
.argument("input-port", true));
|
||||||
|
|
||||||
options.addOption(Option("output-port", "o", "Define the port for the HTTP-Output-Server, which represents the flipper outputs. Default 9981")
|
options.addOption(Option("output-port", "o", "Define the port for the HTTP-Output-Server, which represents the flipper outputs. Default 9981")
|
||||||
.required(false)
|
.required(false)
|
||||||
@@ -214,64 +208,16 @@ void FlippRServer::defineOptions(OptionSet& options)
|
|||||||
.callback(OptionCallback<FlippRServer>(this, &FlippRServer::handle_config_file))
|
.callback(OptionCallback<FlippRServer>(this, &FlippRServer::handle_config_file))
|
||||||
.argument("output-port", true));
|
.argument("output-port", true));
|
||||||
|
|
||||||
options.addOption(Option("input-config", "I", "Specify where the input-config file is located. Only needed when not in this folder.")
|
options.addOption(Option("server-config", "s", "Specify where the server-config file with paths to the other configs is located. Only needed when not in this folder.")
|
||||||
.required(this->input_config == "Not set")
|
.required(true)
|
||||||
.repeatable(false)
|
.repeatable(false)
|
||||||
.callback(OptionCallback<FlippRServer>(this, &FlippRServer::handle_config_file))
|
.callback(OptionCallback<FlippRServer>(this, &FlippRServer::handle_config_file))
|
||||||
.argument("input-config", true));
|
.argument("server-config", true));
|
||||||
|
|
||||||
options.addOption(Option("matrix-config", "M", "Specify where the matrix-config file is located. Only needed when not in this folder.")
|
|
||||||
.required(this->matrix_config == "Not set")
|
|
||||||
.repeatable(false)
|
|
||||||
.callback(OptionCallback<FlippRServer>(this, &FlippRServer::handle_config_file))
|
|
||||||
.argument("matric-config", true));
|
|
||||||
|
|
||||||
options.addOption(Option("lamp-config", "L", "Specify where the lamp-config file is located. Only needed when not in this folder.")
|
|
||||||
.required(this->lamp_config == "Not set")
|
|
||||||
.repeatable(false)
|
|
||||||
.callback(OptionCallback<FlippRServer>(this, &FlippRServer::handle_config_file))
|
|
||||||
.argument("lamp-config", true));
|
|
||||||
|
|
||||||
options.addOption(Option("solenoid-config", "N", "Specify where the solenoid-config file is located. Only needed when not in this folder.")
|
|
||||||
.required(this->solenoid_config == "Not set")
|
|
||||||
.repeatable(false)
|
|
||||||
.callback(OptionCallback<FlippRServer>(this, &FlippRServer::handle_config_file))
|
|
||||||
.argument("solenoid-config", true));
|
|
||||||
|
|
||||||
options.addOption(Option("sound-config", "S", "Specify where the sound-config file is located. Only needed when not in this folder.")
|
|
||||||
.required(this->sound_config == "Not set")
|
|
||||||
.repeatable(false)
|
|
||||||
.callback(OptionCallback<FlippRServer>(this, &FlippRServer::handle_config_file))
|
|
||||||
.argument("sound-config", true));
|
|
||||||
|
|
||||||
options.addOption(Option("display-config", "D", "Specify where the display-config file is located. Only needed when not in this folder.")
|
|
||||||
.required(this->display_config == "Not set")
|
|
||||||
.repeatable(false)
|
|
||||||
.callback(OptionCallback<FlippRServer>(this, &FlippRServer::handle_config_file))
|
|
||||||
.argument("display-config", true));
|
|
||||||
|
|
||||||
options.addOption(Option("server-config", "s", "Specify where the server-config file is located. Only needed when not in this folder.")
|
|
||||||
.required(this->display_config == "Not set")
|
|
||||||
.repeatable(false)
|
|
||||||
.callback(OptionCallback<FlippRServer>(this, &FlippRServer::handle_config_file))
|
|
||||||
.argument("server-config", true));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FlippRServer::handle_config_file(const std::string &name, const std::string &value)
|
void FlippRServer::handle_config_file(const std::string &name, const std::string &value)
|
||||||
{
|
{
|
||||||
if(name == "input-config")
|
if(name == "input-port")
|
||||||
this->input_config = value;
|
|
||||||
else if(name == "matrix-config")
|
|
||||||
this->matrix_config = value;
|
|
||||||
else if(name == "lamp-config")
|
|
||||||
this->lamp_config = value;
|
|
||||||
else if(name == "solenoid-config")
|
|
||||||
this->solenoid_config = value;
|
|
||||||
else if(name == "sound-config")
|
|
||||||
this->sound_config = value;
|
|
||||||
else if(name == "display-config")
|
|
||||||
this->display_config = value;
|
|
||||||
else if(name == "input-port")
|
|
||||||
this->input_port = std::stoi(value);
|
this->input_port = std::stoi(value);
|
||||||
else if(name == "output-port")
|
else if(name == "output-port")
|
||||||
this->output_port = std::stoi(value);
|
this->output_port = std::stoi(value);
|
||||||
@@ -291,9 +237,7 @@ void FlippRServer::handle_help(const std::string& name, const std::string& value
|
|||||||
helpFormatter.setCommand(commandName());
|
helpFormatter.setCommand(commandName());
|
||||||
helpFormatter.setUsage("OPTIONS");
|
helpFormatter.setUsage("OPTIONS");
|
||||||
helpFormatter.setHeader(
|
helpFormatter.setHeader(
|
||||||
"The FlippR-Server, appropriate config-files must either be located in the actual folder\
|
"The FlippR-Server, one must specify a json with all needed config files.");
|
||||||
or the paths must be specified by commandline options. \
|
|
||||||
The config file paths as well as the port settings can be specified in a a file server_config.json");
|
|
||||||
helpFormatter.format(std::cout);
|
helpFormatter.format(std::cout);
|
||||||
stopOptionsProcessing();
|
stopOptionsProcessing();
|
||||||
help_requested = true;
|
help_requested = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user