resolved merge conflict

This commit is contained in:
Johannes Wendel
2019-08-01 20:32:50 +02:00
23 changed files with 1594 additions and 9 deletions

View File

@@ -57,7 +57,7 @@ void FlippRServer::parse_server_config_file()
try
{
config.open("./server_config.json");
config.open(this->server_config);
}
catch(const std::exception e)
{
@@ -85,6 +85,15 @@ void FlippRServer::parse_server_config_file()
config.close();
}
void FlippRServer::uninitialize()
{
this->output_driver->deactivate_all_lamps();
this->output_driver->deactivate_displays();
this->output_server->stop();
ServerApplication::uninitialize();
}
/**
* Initially called before main.
*/
@@ -93,10 +102,14 @@ void FlippRServer::initialize(Application &self)
//Todo May restructure with subsystems
//make this one application and subsystems ServerApplications
this->initialize_output_driver();
this->initialize_input_driver();
this->output_server = std::unique_ptr<Poco::Net::HTTPServer>(this->build_output_server());
this->output_server->start();
this->input_server = std::unique_ptr<TCPServer>(this->build_input_server());
//https://gist.github.com/NIPE-SYSTEMS/5a06428c0880ed7ff3cc4304be436e3e
ServerApplication::initialize(self);
}
@@ -162,7 +175,6 @@ int FlippRServer::main(const std::vector<std::string>& args)
this->output_driver->deactivate_all_lamps();
this->output_driver->deactivate_displays();
output_server->stop();
return Application::EXIT_OK;
}
@@ -189,8 +201,6 @@ TCPServer* FlippRServer::build_input_server()
return new TCPServer(new input::InputSocketHandlerFactory(this->input_driver), port);
}
void FlippRServer::defineOptions(OptionSet& options)
{
ServerApplication::defineOptions(options);
@@ -249,6 +259,12 @@ void FlippRServer::defineOptions(OptionSet& options)
.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)
@@ -269,6 +285,8 @@ void FlippRServer::handle_config_file(const std::string &name, const std::string
this->input_port = std::stoi(value);
else if(name == "output-port")
this->output_port = std::stoi(value);
else if(name == "server-config")
this->server_config = value;
else
{
logger().information("Configuration \"" + name + "\" is not known.");
@@ -298,6 +316,8 @@ std::string FlippRServer::get_runtime_dir()
{
runtime_dir = DEFAULT_RUNTIME_DIR;
}
return runtime_dir;
}
}