added server config file
This commit is contained in:
@@ -25,7 +25,8 @@
|
||||
"run" : 0
|
||||
},
|
||||
"driver_board" :
|
||||
{ // todo new layout!
|
||||
{
|
||||
"todo": "new layout!",
|
||||
"i2c_address" : 32,
|
||||
"pin_base" : 65,
|
||||
"pin-select" :
|
||||
|
||||
10
FlippR-Driver/contrib/json_example/server_config.json
Normal file
10
FlippR-Driver/contrib/json_example/server_config.json
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"input-config" :"../../contrib/json_example/input/Input_Pin_Config.json",
|
||||
"matrix-config" :"../../contrib/json_example/input/Input_Matrix_Config.json",
|
||||
"output-pin-config" :"../../contrib/json_example/output/Output_Pin_Config.json",
|
||||
"lamp-config" :"../../contrib/json_example/output/Lamp_Config.json",
|
||||
"solenoid-config" :"../../contrib/json_example/output/Solenoid_Config.json",
|
||||
"sound-config" :"../../contrib/json_example/output/Sound_Config.json",
|
||||
"display-config" :"../../contrib/json_example/output/Display_Config.json",
|
||||
"lamp-config" :"../../contrib/json_example/output/Lamp_Config.json"
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
cmake_minimum_required(VERSION 3.6.2)
|
||||
project(flippR_driver_networking)
|
||||
|
||||
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/${OUTPUT_PATH}/cli)
|
||||
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/cli/networking)
|
||||
set(SOURCES
|
||||
input/InputSocketHandler.cpp
|
||||
output/OutputRequestHandler.cpp
|
||||
|
||||
@@ -58,8 +58,7 @@ void FlippRServer::parse_server_config_file()
|
||||
|
||||
try
|
||||
{
|
||||
config.open("server_config.json");
|
||||
json = parser.parse(config).extract<Object::Ptr>();
|
||||
config.open("./server_config.json");
|
||||
}
|
||||
catch(const std::exception e)
|
||||
{
|
||||
@@ -67,6 +66,16 @@ void FlippRServer::parse_server_config_file()
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
json = parser.parse(config).extract<Object::Ptr>();
|
||||
}
|
||||
catch(const std::exception e)
|
||||
{
|
||||
logger().information(FRED("server_config.json not readable!"));
|
||||
return;
|
||||
}
|
||||
|
||||
logger().information(FCYN("Parsing server_config.json..."));
|
||||
|
||||
for(auto &config_json : json->getNames())
|
||||
@@ -164,7 +173,7 @@ HTTPServer* FlippRServer::build_output_server()
|
||||
unsigned short port = (unsigned short) config().getInt("HTTPTimeServer.port", this->output_port);
|
||||
|
||||
// todo XDG_RUNTIME_DIR
|
||||
SocketAddress address("/tmp/flippR_driver/S.flippR_driver");
|
||||
SocketAddress address;
|
||||
ServerSocket server_socket(address);
|
||||
|
||||
return new HTTPServer(new OutputRequestHandlerFactory(this->output_driver), server_socket, new HTTPServerParams);
|
||||
@@ -175,7 +184,7 @@ 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");
|
||||
SocketAddress address;
|
||||
ServerSocket server_socket(address);
|
||||
|
||||
return new TCPServer(new input::InputSocketHandlerFactory(this->input_driver), port);
|
||||
|
||||
Reference in New Issue
Block a user