added inputsockethandlerfactory

This commit is contained in:
Johannes Wendel
2019-06-15 14:52:42 +02:00
parent e90c3f6695
commit 7146f67169
9 changed files with 91 additions and 12 deletions

View File

@@ -99,8 +99,8 @@ void FlippRServer::initialize_output_driver()
exit(EXIT_FAILURE);
}
//todo should use DriverFactory from input
// this->input_driver = flippR_driver::get_InputDriver(input_config_stream, matrix_config_stream);
//todo linking errors
this->input_driver = flippR_driver::get_InputDriver(input_config_stream, matrix_config_stream);
}
int FlippRServer::main(const std::vector<std::string>& args)
@@ -111,7 +111,7 @@ int FlippRServer::main(const std::vector<std::string>& args)
std::unique_ptr<HTTPServer> output_server(this->build_output_server());
output_server->start();
std::unique_ptr<TCPServer>
std::unique_ptr<TCPServer> input_server(this->build_input_server());
waitForTerminationRequest();
this->output_driver->deactivate_all_lamps();
@@ -127,9 +127,20 @@ HTTPServer* FlippRServer::build_output_server()
// todo XDG_RUNTIME_DIR
SocketAddress address("/tmp/flippR_driver/S.flippR_driver");
ServerSocket svs(address);
ServerSocket server_socket(address);
return new HTTPServer(new OutputRequestHandlerFactory(this->output_driver), server_socket, new HTTPServerParams);
}
TCPServer* FlippRServer::build_input_server()
{
unsigned short port = (unsigned short) config().getInt("HTTPTimeServer.port", this->output_port);
//TODO adapt path
SocketAddress address("/tmp/flippR_driver/S.flippR_driver");
ServerSocket server_socket(address);
return new HTTPServer(new OutputRequestHandlerFactory(this->output_driver), svs, new HTTPServerParams);
}