some adaptions

This commit is contained in:
Johannes Wendel
2019-06-18 15:16:44 +02:00
parent 88270082c4
commit e428515227
3 changed files with 42 additions and 7 deletions

View File

@@ -75,7 +75,7 @@ file(GLOB_RECURSE SOURCES src/*.cpp)
if(BUILD_SHARED_LIB)
add_library(${PROJECT_NAME} SHARED ${SOURCES})
else()
add_library(${PROJECT_NAME} STATIC ${SOURCES} cli/OutputInterpreter.cpp cli/OutputInterpreter.h src/output/items/detail/DriverBoardItem.cpp src/output/items/detail/DriverBoardItem.h include/DriverFactory.h)
add_library(${PROJECT_NAME} STATIC ${SOURCES} cli/OutputInterpreter.cpp cli/OutputInterpreter.h src/output/items/detail/DriverBoardItem.cpp src/output/items/detail/DriverBoardItem.h include/DriverFactory.h src/utility/Colors.h)
endif(BUILD_SHARED_LIB)
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_SOURCE_DIR}/src)

View File

@@ -6,6 +6,7 @@
#include "output/OutputRequestHandlerFactory.h"
#include "input/InputSocketHandlerFactory.h"
#include "DriverFactory.h"
#include "utility/Colors.h"
#include <Poco/Net/SocketAddress.h>
#include <Poco/Net/ServerSocket.h>
@@ -18,6 +19,8 @@
int main(int argc, char** argv)
{
std::cout << FGRN("Starting FlippR-Server ... ") << std::endl;
flippR_driver::networking::FlippRServer app;
return app.run(argc, argv);
}
@@ -50,22 +53,28 @@ void FlippRServer::parse_server_config_file()
{
std::ifstream config;
Parser parser;
Object::Ptr json;
try
{
config.open("server_config.json");
json = parser.parse(config).extract<Object::Ptr>();
}
catch(const std::exception e)
{
logger().information("No config file specified.");
logger().information(FCYN("server_config.json not specified!"));
return;
}
Parser parser;
Object::Ptr json = parser.parse(config).extract<Object::Ptr>();
logger().information(FCYN("Parsing server_config.json..."));
for(auto &config_json : json->getNames())
{
handle_config_file(config_json, json->get(config_json));
}
config.close();
}
/**
@@ -106,7 +115,6 @@ void FlippRServer::initialize_output_driver()
exit(EXIT_FAILURE);
}
//todo linking errors
this->output_driver = flippR_driver::get_OutputDriver(output_pin_config_stream,
lamp_config_stream,
solenoid_config_stream,
@@ -130,8 +138,6 @@ void FlippRServer::initialize_input_driver()
exit(EXIT_FAILURE);
}
//todo linking errors
this->input_driver = flippR_driver::get_InputDriver(input_config_stream, matrix_config_stream);
}

View File

@@ -0,0 +1,29 @@
//
// Created by johannes on 18.06.19.
//
#ifndef _COLORS_
#define _COLORS_
/* FOREGROUND */
#define RST "\x1B[0m"
#define KRED "\x1B[31m"
#define KGRN "\x1B[32m"
#define KYEL "\x1B[33m"
#define KBLU "\x1B[34m"
#define KMAG "\x1B[35m"
#define KCYN "\x1B[36m"
#define KWHT "\x1B[37m"
#define FRED(x) KRED x RST
#define FGRN(x) KGRN x RST
#define FYEL(x) KYEL x RST
#define FBLU(x) KBLU x RST
#define FMAG(x) KMAG x RST
#define FCYN(x) KCYN x RST
#define FWHT(x) KWHT x RST
#define BOLD(x) "\x1B[1m" x RST
#define UNDL(x) "\x1B[4m" x RST
#endif /* _COLORS_ */