some adaptions
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
29
FlippR-Driver/src/utility/Colors.h
Normal file
29
FlippR-Driver/src/utility/Colors.h
Normal 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_ */
|
||||
Reference in New Issue
Block a user