From 9d477cfd5ccebf09cca483aff531bf9c19e6e265 Mon Sep 17 00:00:00 2001 From: Johannes Wendel Date: Thu, 8 Aug 2019 23:58:45 +0200 Subject: [PATCH 01/13] reseting isreams --- FlippR-Driver/CMakeLists.txt | 4 ++++ .../json_example/output/Sound_Config.json | 6 ------ FlippR-Driver/networking/FlippRServer.cpp | 10 ++++++---- FlippR-Driver/src/DriverFactory.cpp | 2 ++ FlippR-Driver/src/PinController.cpp | 4 ++-- .../src/output/OutputDriverFactory.cpp | 18 +++++++++++++----- 6 files changed, 27 insertions(+), 17 deletions(-) diff --git a/FlippR-Driver/CMakeLists.txt b/FlippR-Driver/CMakeLists.txt index 9608a45..7972bc2 100644 --- a/FlippR-Driver/CMakeLists.txt +++ b/FlippR-Driver/CMakeLists.txt @@ -15,6 +15,10 @@ set(CMAKE_CXX_STANDARD 14) # Boost configuration set(BOOST_COMPONENTS program_options thread timer chrono) +IF(NOT_PI) + add_definitions(-DNOT_PI) + message("Compiling not for Pi") +ENDIF() project(FlippR-Driver) diff --git a/FlippR-Driver/contrib/json_example/output/Sound_Config.json b/FlippR-Driver/contrib/json_example/output/Sound_Config.json index 6cd37bd..ebda109 100644 --- a/FlippR-Driver/contrib/json_example/output/Sound_Config.json +++ b/FlippR-Driver/contrib/json_example/output/Sound_Config.json @@ -2,17 +2,11 @@ "deactivation_time_milliseconds" : 10, "port_extenders" : [ -<<<<<<< HEAD { "name" : "extender_0", "i2c_address" : 33, "pin_base" : 81 } -======= - "name" : "extender_0", - "i2c_address" : 33, - "pin_base" : 81 ->>>>>>> aa1d6409ea18cff1ad4b0ef06804fcf5a521dee9 ], "fire_pin" : { diff --git a/FlippR-Driver/networking/FlippRServer.cpp b/FlippR-Driver/networking/FlippRServer.cpp index c0f6b75..9b70795 100644 --- a/FlippR-Driver/networking/FlippRServer.cpp +++ b/FlippR-Driver/networking/FlippRServer.cpp @@ -121,10 +121,10 @@ void FlippRServer::initialize_output_driver() exit(EXIT_FAILURE); } - this->output_driver = flippR_driver::get_OutputDriver(lamp_config_stream, - solenoid_config_stream, - sound_config_stream, - display_config_stream); + this->output_driver = flippR_driver::get_OutputDriver(solenoid_config_stream, + lamp_config_stream, + sound_config_stream, + display_config_stream); } void FlippRServer::initialize_input_driver() @@ -156,6 +156,8 @@ int FlippRServer::main(const std::vector& args) std::unique_ptr input_server(this->build_input_server()); + logger().information("Server running!"); + waitForTerminationRequest(); this->output_driver->deactivate_all_lamps(); this->output_driver->deactivate_displays(); diff --git a/FlippR-Driver/src/DriverFactory.cpp b/FlippR-Driver/src/DriverFactory.cpp index 291e3ec..80fe739 100644 --- a/FlippR-Driver/src/DriverFactory.cpp +++ b/FlippR-Driver/src/DriverFactory.cpp @@ -4,6 +4,8 @@ #include "DriverFactory.h" +#include "utility/LoggerFactory.h" + #include "input/InputDriverFactory.h" #include "output/OutputDriverFactory.h" diff --git a/FlippR-Driver/src/PinController.cpp b/FlippR-Driver/src/PinController.cpp index 69b1dd9..fe1146a 100644 --- a/FlippR-Driver/src/PinController.cpp +++ b/FlippR-Driver/src/PinController.cpp @@ -8,12 +8,12 @@ #include "PinController.h" #include "utility/config.h" - +#define NOT_PI #ifndef NOT_PI #include "wiringPi/wiringPi.h" #include "wiringPi/mcp23017.h" #endif - + #ifdef NOT_PI #include "utility/wiringPiTesting.hpp" #endif diff --git a/FlippR-Driver/src/output/OutputDriverFactory.cpp b/FlippR-Driver/src/output/OutputDriverFactory.cpp index 89d4354..1bf0b4f 100644 --- a/FlippR-Driver/src/output/OutputDriverFactory.cpp +++ b/FlippR-Driver/src/output/OutputDriverFactory.cpp @@ -53,6 +53,7 @@ std::shared_ptr get_OutputDriver(std::istream& solenoid_config, std::map> create_solenoids(std::istream & solenoid_config, std::shared_ptr &pin_controller) { + solenoid_config.clear(); json solenoid_config_json; solenoid_config >> solenoid_config_json; @@ -74,6 +75,7 @@ std::map> create_solenoids(std::is std::shared_ptr create_solenoid(nlohmann::json &solenoid_json, nlohmann::json &port_extenders, std::shared_ptr &pin_controller, std::chrono::milliseconds deactivation_time) { + solenoid_json.clear(); std::string config_file_name = "solenoid_config.json"; uint8_t pin_base = get_pin_base(solenoid_json, port_extenders, config_file_name); @@ -91,6 +93,7 @@ std::shared_ptr create_solenoid(nlohmann::json &solenoi std::map> create_flippers(std::istream &solenoid_config, std::shared_ptr &pin_controller) { + solenoid_config.clear(); json solenoid_config_json; solenoid_config >> solenoid_config_json; @@ -121,6 +124,7 @@ std::shared_ptr create_flipper(nlohmann::json &flipper_j std::map> create_lamps(std::istream &lamp_config, std::shared_ptr &pin_controller) { + lamp_config.clear(); json lamp_config_json; lamp_config >> lamp_config_json; @@ -152,6 +156,7 @@ std::shared_ptr create_lamp(json &lamp_json, json & port_ex std::map> create_sounds(std::istream &sound_config, std::shared_ptr &pin_controller) { + sound_config.clear(); json sound_config_json; sound_config >> sound_config_json; @@ -186,6 +191,7 @@ std::shared_ptr create_sound(json &sound_json, json &port_ uint8_t get_sound_fire_address(std::istream &sound_config) { + sound_config.clear(); json sound_config_json; sound_config >> sound_config_json; @@ -200,6 +206,7 @@ uint8_t get_sound_fire_address(std::istream &sound_config) std::map parse_pins_display_board(std::istream &display_config) { + display_config.clear(); std::string config_file = "display_config.json"; json display_config_json; @@ -233,7 +240,7 @@ std::map parse_pins_display_board(std::istream &display_co std::vector> create_displays(std::istream &display_config) { - + display_config.clear(); json display_config_json; display_config >> display_config_json; @@ -259,7 +266,7 @@ std::shared_ptr create_display(json & display_json) return std::make_shared(address, id); else if(digits == 7) - return std::make_shared(address, id); + return std::make_shared(address, id); else throw new std::logic_error("Display digits can either be 7 or 8"); @@ -314,7 +321,6 @@ json get_element(const std::string & name, json & object, const std::string & fi try { sub_object = object.at(name); - return sub_object; } catch(json::exception &e) { @@ -322,21 +328,23 @@ json get_element(const std::string & name, json & object, const std::string & fi exit(EXIT_FAILURE); } + return sub_object; } template type get_value(const std::string & name, json & object, const std::string & file_name) { + type element; try { - type element = object.at(name).get(); - return element; + element = object.at(name).get(); } catch(json::exception &e) { CLOG(ERROR, OUTPUT_LOGGER) << "File " << file_name << " seems to be corrupted at " << name << ": " << e.what(); exit(EXIT_FAILURE); } + return element; } } From bad552358716de248a1883f9538af13d34bad74a Mon Sep 17 00:00:00 2001 From: Johannes Wendel Date: Fri, 9 Aug 2019 00:06:58 +0200 Subject: [PATCH 02/13] fuuuu --- FlippR-Driver/src/output/OutputDriverFactory.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FlippR-Driver/src/output/OutputDriverFactory.cpp b/FlippR-Driver/src/output/OutputDriverFactory.cpp index 1bf0b4f..d0b9b92 100644 --- a/FlippR-Driver/src/output/OutputDriverFactory.cpp +++ b/FlippR-Driver/src/output/OutputDriverFactory.cpp @@ -266,7 +266,7 @@ std::shared_ptr create_display(json & display_json) return std::make_shared(address, id); else if(digits == 7) - return std::make_shared(address, id); + return std::make_shared(address, id); else throw new std::logic_error("Display digits can either be 7 or 8"); From bfab9b536c7cdf2e7e3ce00afc0e1c0fba1cb035 Mon Sep 17 00:00:00 2001 From: Johannes Wendel Date: Fri, 9 Aug 2019 00:20:23 +0200 Subject: [PATCH 03/13] shit --- FlippR-Driver/src/output/OutputDriverFactory.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/FlippR-Driver/src/output/OutputDriverFactory.cpp b/FlippR-Driver/src/output/OutputDriverFactory.cpp index d0b9b92..b5b0e15 100644 --- a/FlippR-Driver/src/output/OutputDriverFactory.cpp +++ b/FlippR-Driver/src/output/OutputDriverFactory.cpp @@ -75,7 +75,7 @@ std::map> create_solenoids(std::is std::shared_ptr create_solenoid(nlohmann::json &solenoid_json, nlohmann::json &port_extenders, std::shared_ptr &pin_controller, std::chrono::milliseconds deactivation_time) { - solenoid_json.clear(); + solenoid_json; std::string config_file_name = "solenoid_config.json"; uint8_t pin_base = get_pin_base(solenoid_json, port_extenders, config_file_name); @@ -94,6 +94,7 @@ std::shared_ptr create_solenoid(nlohmann::json &solenoi std::map> create_flippers(std::istream &solenoid_config, std::shared_ptr &pin_controller) { solenoid_config.clear(); + solenoid_config.seekg(0, std::ios::beg); json solenoid_config_json; solenoid_config >> solenoid_config_json; @@ -125,6 +126,7 @@ std::shared_ptr create_flipper(nlohmann::json &flipper_j std::map> create_lamps(std::istream &lamp_config, std::shared_ptr &pin_controller) { lamp_config.clear(); + lamp_config.seekg(0, std::ios::beg); json lamp_config_json; lamp_config >> lamp_config_json; @@ -157,6 +159,7 @@ std::shared_ptr create_lamp(json &lamp_json, json & port_ex std::map> create_sounds(std::istream &sound_config, std::shared_ptr &pin_controller) { sound_config.clear(); + sound_config.seekg(0, std::ios::beg); json sound_config_json; sound_config >> sound_config_json; @@ -192,6 +195,7 @@ std::shared_ptr create_sound(json &sound_json, json &port_ uint8_t get_sound_fire_address(std::istream &sound_config) { sound_config.clear(); + sound_config.seekg(0, std::ios::beg); json sound_config_json; sound_config >> sound_config_json; @@ -207,6 +211,7 @@ uint8_t get_sound_fire_address(std::istream &sound_config) std::map parse_pins_display_board(std::istream &display_config) { display_config.clear(); + display_config.seekg(0, std::ios::beg); std::string config_file = "display_config.json"; json display_config_json; @@ -241,6 +246,7 @@ std::map parse_pins_display_board(std::istream &display_co std::vector> create_displays(std::istream &display_config) { display_config.clear(); + display_config.seekg(0, std::ios::beg); json display_config_json; display_config >> display_config_json; From 28641b0f7cea33b1217c0425bd66158205e1b6c9 Mon Sep 17 00:00:00 2001 From: Johannes Wendel Date: Fri, 9 Aug 2019 00:30:59 +0200 Subject: [PATCH 04/13] little change 124124325435z21oz52u1zou21z44z5oz2435o43 --- FlippR-Driver/contrib/json_example/output/Sound_Config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FlippR-Driver/contrib/json_example/output/Sound_Config.json b/FlippR-Driver/contrib/json_example/output/Sound_Config.json index 67b236c..b318d83 100644 --- a/FlippR-Driver/contrib/json_example/output/Sound_Config.json +++ b/FlippR-Driver/contrib/json_example/output/Sound_Config.json @@ -4,7 +4,7 @@ [ { "name" : "extender_0", - "i2c_address" : 33, + "i2c_address" : 34, "pin_base" : 81 } ], From 4bf7f0b8701c3589509f1a448171bb6240c920c5 Mon Sep 17 00:00:00 2001 From: Johannes Wendel Date: Fri, 9 Aug 2019 01:05:43 +0200 Subject: [PATCH 05/13] nice --- .../contrib/json_example/output/Lamp_Config.json | 4 ++-- FlippR-Driver/src/output/OutputDriverFactory.cpp | 9 ++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/FlippR-Driver/contrib/json_example/output/Lamp_Config.json b/FlippR-Driver/contrib/json_example/output/Lamp_Config.json index d978a8c..ef53c7d 100644 --- a/FlippR-Driver/contrib/json_example/output/Lamp_Config.json +++ b/FlippR-Driver/contrib/json_example/output/Lamp_Config.json @@ -3,8 +3,8 @@ [ { "name" : "extender_1", - "i2c_address" : 33, - "pin_base" : 82 + "i2c_address" : 32, + "pin_base" : 65 } ], "lamps" : diff --git a/FlippR-Driver/src/output/OutputDriverFactory.cpp b/FlippR-Driver/src/output/OutputDriverFactory.cpp index b5b0e15..a0d3242 100644 --- a/FlippR-Driver/src/output/OutputDriverFactory.cpp +++ b/FlippR-Driver/src/output/OutputDriverFactory.cpp @@ -169,13 +169,13 @@ std::map> create_sounds(std::istream std::chrono::milliseconds deactivation_time{ get_value("deactivation_time_milliseconds", sound_config_json, "solenoid_config.json") }; - json solenoids_json = get_element("sounds", sound_config_json, "sound_config.json"); + json sounds_json = get_element("sounds", sound_config_json, "sound_config.json"); std::map> sounds; - for(auto &solenoid_json : solenoids_json) + for(auto &sound_json : sounds_json) { - auto solenoid = create_sound(solenoid_json, port_extenders, pin_controller, deactivation_time); - sounds.emplace(solenoid->get_name(), solenoid); + auto sound = create_sound(sound_json, port_extenders, pin_controller, deactivation_time); + sounds.emplace(sound->get_name(), sound); } return sounds; } @@ -292,7 +292,6 @@ std::map> map_displays(const std::vecto void initialize_port_extenders(json &port_extenders, PinController * pin_controller, const std::string & file_name) { - for (auto & extender_json : port_extenders) { auto i2c_address = get_value("i2c_address", extender_json, file_name); From d428353b74b21745dc8398559603e09d2373fa14 Mon Sep 17 00:00:00 2001 From: rhetenor Date: Thu, 8 Aug 2019 23:13:50 +0000 Subject: [PATCH 06/13] changed stuff --- .../json_example/output/Lamp_Config.json | 2 +- .../json_example/output/Sound_Config.json | 110 +++++++++--------- 2 files changed, 56 insertions(+), 56 deletions(-) diff --git a/FlippR-Driver/contrib/json_example/output/Lamp_Config.json b/FlippR-Driver/contrib/json_example/output/Lamp_Config.json index ef53c7d..ff6b418 100644 --- a/FlippR-Driver/contrib/json_example/output/Lamp_Config.json +++ b/FlippR-Driver/contrib/json_example/output/Lamp_Config.json @@ -4,7 +4,7 @@ { "name" : "extender_1", "i2c_address" : 32, - "pin_base" : 65 + "pin_base" : 97 } ], "lamps" : diff --git a/FlippR-Driver/contrib/json_example/output/Sound_Config.json b/FlippR-Driver/contrib/json_example/output/Sound_Config.json index b318d83..7020303 100644 --- a/FlippR-Driver/contrib/json_example/output/Sound_Config.json +++ b/FlippR-Driver/contrib/json_example/output/Sound_Config.json @@ -18,331 +18,331 @@ { "id" : 0, "address" : "22", - "description" : "Sound 1", + "name" : "Sound 1", "extender" : "extender_0" }, { "id" : 1, "address" : "23", - "description" : "Sound 2", + "name" : "Sound 2", "extender" : "extender_0" }, { "id" : 2, "address" : "24", - "description" : "Sound 3", + "name" : "Sound 3", "extender" : "extender_0" }, { "id" : 3, "address" : "25", - "description" : "Sound 4", + "name" : "Sound 4", "extender" : "extender_0" }, { "id" : 4, "address" : "26", - "description" : "Sound 5", + "name" : "Sound 5", "extender" : "extender_0" }, { "id" : 5, "address" : "27", - "description" : "Sound 6", + "name" : "Sound 6", "extender" : "extender_0" }, { "id" : 6, "address" : "28", - "description" : "Sound 7", + "name" : "Sound 7", "extender" : "extender_0" }, { "id" : 7, "address" : "29", - "description" : "Sound 8", + "name" : "Sound 8", "extender" : "extender_0" }, { "id" : 8, "address" : "30", - "description" : "Sound 9", + "name" : "Sound 9", "extender" : "extender_0" }, { "id" : 9, "address" : "31", - "description" : "Sound 10", + "name" : "Sound 10", "extender" : "extender_0" }, { "id" : 10, "address" : "32", - "description" : "Sound 11", + "name" : "Sound 11", "extender" : "extender_0" }, { "id" : 11, "address" : "33", - "description" : "Sound 12", + "name" : "Sound 12", "extender" : "extender_0" }, { "id" : 12, "address" : "34", - "description" : "Sound 13", + "name" : "Sound 13", "extender" : "extender_0" }, { "id" : 13, "address" : "35", - "description" : "Sound 14", + "name" : "Sound 14", "extender" : "extender_0" }, { "id" : 14, "address" : "36", - "description" : "Sound 15", + "name" : "Sound 15", "extender" : "extender_0" }, { "id" : 15, "address" : "37", - "description" : "Sound 16", + "name" : "Sound 16", "extender" : "extender_0" }, { "id" : 16, "address" : "38", - "description" : "Sound 17", + "name" : "Sound 17", "extender" : "extender_0" }, { "id" : 17, "address" : "39", - "description" : "Sound 18", + "name" : "Sound 18", "extender" : "extender_0" }, { "id" : 18, "address" : "40", - "description" : "Sound 19", + "name" : "Sound 19", "extender" : "extender_0" }, { "id" : 19, "address" : "41", - "description" : "Sound 20", + "name" : "Sound 20", "extender" : "extender_0" }, { "id" : 20, "address" : "42", - "description" : "Sound 21", + "name" : "Sound 21", "extender" : "extender_0" }, { "id" : 21, "address" : "43", - "description" : "Sound 22", + "name" : "Sound 22", "extender" : "extender_0" }, { "id" : 22, "address" : "44", - "description" : "Sound 23", + "name" : "Sound 23", "extender" : "extender_0" }, { "id" : 23, "address" : "45", - "description" : "Sound 24", + "name" : "Sound 24", "extender" : "extender_0" }, { "id" : 24, "address" : "46", - "description" : "Sound 25", + "name" : "Sound 25", "extender" : "extender_0" }, { "id" : 25, "address" : "47", - "description" : "Sound 26", + "name" : "Sound 26", "extender" : "extender_0" }, { "id" : 26, "address" : "48", - "description" : "Sound 27", + "name" : "Sound 27", "extender" : "extender_0" }, { "id" : 27, "address" : "49", - "description" : "Sound 28", + "name" : "Sound 28", "extender" : "extender_0" }, { "id" : 28, "address" : "50", - "description" : "Speech 1: \"You're good! But I'm still the Champ!\"", + "name" : "Speech 1: \"You're good! But I'm still the Champ!\"", "extender" : "extender_0" }, { "id" : 29, "address" : "51", - "description" : "Speech 2: \"Twenty\"", + "name" : "Speech 2: \"Twenty\"", "extender" : "extender_0" }, { "id" : 30, "address" : "52", - "description" : "Speech 3: \"Seconds\"", + "name" : "Speech 3: \"Seconds\"", "extender" : "extender_0" }, { "id" : 31, "address" : "53", - "description" : "Speech 4: \"Five, Four, Three, Two, One.\"", + "name" : "Speech 4: \"Five, Four, Three, Two, One.\"", "extender" : "extender_0" }, { "id" : 32, "address" : "54", - "description" : "speech 1: \"you're good! but i'm still the champ!\"", + "name" : "speech 1: \"you're good! but i'm still the champ!\"", "extender" : "extender_0" }, { "id" : 33, "address" : "55", - "description" : "speech 1: \"you're good! but i'm still the champ!\"", + "name" : "speech 1: \"you're good! but i'm still the champ!\"", "extender" : "extender_0" }, { "id" : 34, "address" : "56", - "description" : "speech 1: \"you're good! but i'm still the champ!\"", + "name" : "speech 1: \"you're good! but i'm still the champ!\"", "extender" : "extender_0" }, { "id" : 35, "address" : "57", - "description" : "speech 1: \"you're good! but i'm still the champ!\"", + "name" : "speech 1: \"you're good! but i'm still the champ!\"", "extender" : "extender_0" }, { "id" : 36, "address" : "58", - "description" : "speech 1: \"you're good! but i'm still the champ!\"", + "name" : "speech 1: \"you're good! but i'm still the champ!\"", "extender" : "extender_0" }, { "id" : 37, "address" : "59", - "description" : "speech 1: \"you're good! but i'm still the champ!\"", + "name" : "speech 1: \"you're good! but i'm still the champ!\"", "extender" : "extender_0" }, { "id" : 38, "address" : "60", - "description" : "speech 1: \"you're good! but i'm still the champ!\"", + "name" : "speech 1: \"you're good! but i'm still the champ!\"", "extender" : "extender_0" }, { "id" : 39, "address" : "61", - "description" : "speech 1: \"you're good! but i'm still the champ!\"", + "name" : "speech 1: \"you're good! but i'm still the champ!\"", "extender" : "extender_0" }, { "id" : 40, "address" : "62", - "description" : "speech 1: \"you're good! but i'm still the champ!\"", + "name" : "speech 1: \"you're good! but i'm still the champ!\"", "extender" : "extender_0" }, { "id" : 41, "address" : "63", - "description" : "speech 1: \"you're good! but i'm still the champ!\"", + "name" : "speech 1: \"you're good! but i'm still the champ!\"", "extender" : "extender_0" }, { "id" : 42, "address" : "64", - "description" : "speech 1: \"you're good! but i'm still the champ!\"", + "name" : "speech 1: \"you're good! but i'm still the champ!\"", "extender" : "extender_0" }, { "id" : 43, "address" : "65", - "description" : "speech 1: \"you're good! but i'm still the champ!\"", + "name" : "speech 1: \"you're good! but i'm still the champ!\"", "extender" : "extender_0" }, { "id" : 44, "address" : "66", - "description" : "speech 1: \"you're good! but i'm still the champ!\"", + "name" : "speech 1: \"you're good! but i'm still the champ!\"", "extender" : "extender_0" }, { "id" : 45, "address" : "67", - "description" : "speech 1: \"you're good! but i'm still the champ!\"", + "name" : "speech 1: \"you're good! but i'm still the champ!\"", "extender" : "extender_0" }, { "id" : 46, "address" : "68", - "description" : "speech 1: \"you're good! but i'm still the champ!\"", + "name" : "speech 1: \"you're good! but i'm still the champ!\"", "extender" : "extender_0" }, { "id" : 47, "address" : "69", - "description" : "speech 1: \"you're good! but i'm still the champ!\"", + "name" : "speech 1: \"you're good! but i'm still the champ!\"", "extender" : "extender_0" }, { "id" : 48, "address" : "70", - "description" : "speech 1: \"you're good! but i'm still the champ!\"", + "name" : "speech 1: \"you're good! but i'm still the champ!\"", "extender" : "extender_0" }, { "id" : 49, "address" : "71", - "description" : "speech 1: \"you're good! but i'm still the champ!\"", + "name" : "speech 1: \"you're good! but i'm still the champ!\"", "extender" : "extender_0" }, { "id" : 50, "address" : "72", - "description" : "speech 1: \"you're good! but i'm still the champ!\"", + "name" : "speech 1: \"you're good! but i'm still the champ!\"", "extender" : "extender_0" }, { "id" : 51, "address" : "73", - "description" : "speech 1: \"you're good! but i'm still the champ!\"", + "name" : "speech 1: \"you're good! but i'm still the champ!\"", "extender" : "extender_0" }, { "id" : 52, "address" : "74", - "description" : "speech 1: \"you're good! but i'm still the champ!\"", + "name" : "speech 1: \"you're good! but i'm still the champ!\"", "extender" : "extender_0" }, { "id" : 53, "address" : "75", - "description" : "speech 1: \"you're good! but i'm still the champ!\"", + "name" : "speech 1: \"you're good! but i'm still the champ!\"", "extender" : "extender_0" }, { "id" : 54, "address" : "76", - "description" : "speech 1: \"you're good! but i'm still the champ!\"", + "name" : "speech 1: \"you're good! but i'm still the champ!\"", "extender" : "extender_0" } ] From 5171d5e1b319c020191f6c44f06d2bc9562938e6 Mon Sep 17 00:00:00 2001 From: Johannes Wendel Date: Mon, 12 Aug 2019 15:51:42 +0200 Subject: [PATCH 07/13] cmake errors --- FlippR-Driver/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/FlippR-Driver/CMakeLists.txt b/FlippR-Driver/CMakeLists.txt index d015430..2f5ac3e 100644 --- a/FlippR-Driver/CMakeLists.txt +++ b/FlippR-Driver/CMakeLists.txt @@ -89,9 +89,9 @@ if(NOT wiringPi_LIB) message(WARNING "Could not find wiringPi library, used testing wiring pi lib instead.") add_definitions(-DNO_WIRING_PI) else() - message (STATUS "Found wiring pi.") + message(STATUS "Found wiring pi.") + target_link_libraries(${PROJECT_NAME} PUBLIC ${wiringPi_LIB}) endif() -target_link_libraries(${PROJECT_NAME} PUBLIC ${wiringPi_LIB}) find_library(crypt_LIB crypt) if(NOT crypt_LIB) From e2043111e7f20a0a2140b636db9e5d3c5394da10 Mon Sep 17 00:00:00 2001 From: Johannes Wendel Date: Thu, 15 Aug 2019 19:44:35 +0200 Subject: [PATCH 08/13] changed error output --- FlippR-Driver/CMakeLists.txt | 6 +++--- FlippR-Driver/src/output/OutputDriverFactory.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/FlippR-Driver/CMakeLists.txt b/FlippR-Driver/CMakeLists.txt index 2f5ac3e..eb8d8f3 100644 --- a/FlippR-Driver/CMakeLists.txt +++ b/FlippR-Driver/CMakeLists.txt @@ -12,9 +12,6 @@ set(DEFAULT_BUILD_TYPE DEBUG) set(CMAKE_CXX_STANDARD 14) -# Boost configuration -set(BOOST_COMPONENTS program_options thread timer chrono) - IF(NOT_PI) add_definitions(-DNOT_PI) message("Compiling not for Pi") @@ -73,10 +70,13 @@ target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_SOURCE_DIR}/include) target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_SOURCE_DIR}/${LIB_DIR}) ######################### BOOST ######################### +# Boost configuration +set(BOOST_COMPONENTS program_options thread timer chrono) find_package(Boost REQUIRED COMPONENTS ${BOOST_COMPONENTS}) if(Boost_FOUND) # Include and link with boost target_include_directories(${PROJECT_NAME} PUBLIC ${Boost_INCLUDE_DIRS}) + LINK_DIRECTORIES(${Boost_LIBRARY_DIRS}) target_link_libraries(${PROJECT_NAME} PUBLIC ${Boost_LIBRARIES}) message ("Boost found and linked.") else() diff --git a/FlippR-Driver/src/output/OutputDriverFactory.cpp b/FlippR-Driver/src/output/OutputDriverFactory.cpp index a0d3242..4e3866b 100644 --- a/FlippR-Driver/src/output/OutputDriverFactory.cpp +++ b/FlippR-Driver/src/output/OutputDriverFactory.cpp @@ -346,7 +346,7 @@ type get_value(const std::string & name, json & object, const std::string & file } catch(json::exception &e) { - CLOG(ERROR, OUTPUT_LOGGER) << "File " << file_name << " seems to be corrupted at " << name << ": " << e.what(); + /*CLOG(ERROR, OUTPUT_LOGGER)*/ std::cerr << "File " << file_name << " seems to be corrupted at " << name << ": " << e.what(); exit(EXIT_FAILURE); } return element; From f00bff28b5407e2e1fc79d6b0b854186a83a19a5 Mon Sep 17 00:00:00 2001 From: Johannes Wendel Date: Thu, 15 Aug 2019 19:51:17 +0200 Subject: [PATCH 09/13] changed string to number in config --- .../json_example/output/Sound_Config.json | 110 +++++++++--------- .../src/output/OutputDriverFactory.cpp | 2 +- 2 files changed, 56 insertions(+), 56 deletions(-) diff --git a/FlippR-Driver/contrib/json_example/output/Sound_Config.json b/FlippR-Driver/contrib/json_example/output/Sound_Config.json index 7020303..95a75b6 100644 --- a/FlippR-Driver/contrib/json_example/output/Sound_Config.json +++ b/FlippR-Driver/contrib/json_example/output/Sound_Config.json @@ -17,331 +17,331 @@ [ { "id" : 0, - "address" : "22", + "address" : 22, "name" : "Sound 1", "extender" : "extender_0" }, { "id" : 1, - "address" : "23", + "address" : 23, "name" : "Sound 2", "extender" : "extender_0" }, { "id" : 2, - "address" : "24", + "address" : 24, "name" : "Sound 3", "extender" : "extender_0" }, { "id" : 3, - "address" : "25", + "address" : 25, "name" : "Sound 4", "extender" : "extender_0" }, { "id" : 4, - "address" : "26", + "address" : 26, "name" : "Sound 5", "extender" : "extender_0" }, { "id" : 5, - "address" : "27", + "address" : 27, "name" : "Sound 6", "extender" : "extender_0" }, { "id" : 6, - "address" : "28", + "address" : 28, "name" : "Sound 7", "extender" : "extender_0" }, { "id" : 7, - "address" : "29", + "address" : 29, "name" : "Sound 8", "extender" : "extender_0" }, { "id" : 8, - "address" : "30", + "address" : 30, "name" : "Sound 9", "extender" : "extender_0" }, { "id" : 9, - "address" : "31", + "address" : 31, "name" : "Sound 10", "extender" : "extender_0" }, { "id" : 10, - "address" : "32", + "address" : 32, "name" : "Sound 11", "extender" : "extender_0" }, { "id" : 11, - "address" : "33", + "address" : 33, "name" : "Sound 12", "extender" : "extender_0" }, { "id" : 12, - "address" : "34", + "address" : 34, "name" : "Sound 13", "extender" : "extender_0" }, { "id" : 13, - "address" : "35", + "address" : 35, "name" : "Sound 14", "extender" : "extender_0" }, { "id" : 14, - "address" : "36", + "address" : 36, "name" : "Sound 15", "extender" : "extender_0" }, { "id" : 15, - "address" : "37", + "address" : 37, "name" : "Sound 16", "extender" : "extender_0" }, { "id" : 16, - "address" : "38", + "address" : 38, "name" : "Sound 17", "extender" : "extender_0" }, { "id" : 17, - "address" : "39", + "address" : 39, "name" : "Sound 18", "extender" : "extender_0" }, { "id" : 18, - "address" : "40", + "address" : 40, "name" : "Sound 19", "extender" : "extender_0" }, { "id" : 19, - "address" : "41", + "address" : 41, "name" : "Sound 20", "extender" : "extender_0" }, { "id" : 20, - "address" : "42", + "address" : 42, "name" : "Sound 21", "extender" : "extender_0" }, { "id" : 21, - "address" : "43", + "address" : 43, "name" : "Sound 22", "extender" : "extender_0" }, { "id" : 22, - "address" : "44", + "address" : 44, "name" : "Sound 23", "extender" : "extender_0" }, { "id" : 23, - "address" : "45", + "address" : 45, "name" : "Sound 24", "extender" : "extender_0" }, { "id" : 24, - "address" : "46", + "address" : 46, "name" : "Sound 25", "extender" : "extender_0" }, { "id" : 25, - "address" : "47", + "address" : 47, "name" : "Sound 26", "extender" : "extender_0" }, { "id" : 26, - "address" : "48", + "address" : 48, "name" : "Sound 27", "extender" : "extender_0" }, { "id" : 27, - "address" : "49", + "address" : 49, "name" : "Sound 28", "extender" : "extender_0" }, { "id" : 28, - "address" : "50", + "address" : 50, "name" : "Speech 1: \"You're good! But I'm still the Champ!\"", "extender" : "extender_0" }, { "id" : 29, - "address" : "51", + "address" : 51, "name" : "Speech 2: \"Twenty\"", "extender" : "extender_0" }, { "id" : 30, - "address" : "52", + "address" : 52, "name" : "Speech 3: \"Seconds\"", "extender" : "extender_0" }, { "id" : 31, - "address" : "53", + "address" : 53, "name" : "Speech 4: \"Five, Four, Three, Two, One.\"", "extender" : "extender_0" }, { "id" : 32, - "address" : "54", + "address" : 54, "name" : "speech 1: \"you're good! but i'm still the champ!\"", "extender" : "extender_0" }, { "id" : 33, - "address" : "55", + "address" : 55, "name" : "speech 1: \"you're good! but i'm still the champ!\"", "extender" : "extender_0" }, { "id" : 34, - "address" : "56", + "address" : 56, "name" : "speech 1: \"you're good! but i'm still the champ!\"", "extender" : "extender_0" }, { "id" : 35, - "address" : "57", + "address" : 57, "name" : "speech 1: \"you're good! but i'm still the champ!\"", "extender" : "extender_0" }, { "id" : 36, - "address" : "58", + "address" : 58, "name" : "speech 1: \"you're good! but i'm still the champ!\"", "extender" : "extender_0" }, { "id" : 37, - "address" : "59", + "address" : 59, "name" : "speech 1: \"you're good! but i'm still the champ!\"", "extender" : "extender_0" }, { "id" : 38, - "address" : "60", + "address" : 60, "name" : "speech 1: \"you're good! but i'm still the champ!\"", "extender" : "extender_0" }, { "id" : 39, - "address" : "61", + "address" : 61, "name" : "speech 1: \"you're good! but i'm still the champ!\"", "extender" : "extender_0" }, { "id" : 40, - "address" : "62", + "address" : 62, "name" : "speech 1: \"you're good! but i'm still the champ!\"", "extender" : "extender_0" }, { "id" : 41, - "address" : "63", + "address" : 63, "name" : "speech 1: \"you're good! but i'm still the champ!\"", "extender" : "extender_0" }, { "id" : 42, - "address" : "64", + "address" : 64, "name" : "speech 1: \"you're good! but i'm still the champ!\"", "extender" : "extender_0" }, { "id" : 43, - "address" : "65", + "address" : 65, "name" : "speech 1: \"you're good! but i'm still the champ!\"", "extender" : "extender_0" }, { "id" : 44, - "address" : "66", + "address" : 66, "name" : "speech 1: \"you're good! but i'm still the champ!\"", "extender" : "extender_0" }, { "id" : 45, - "address" : "67", + "address" : 67, "name" : "speech 1: \"you're good! but i'm still the champ!\"", "extender" : "extender_0" }, { "id" : 46, - "address" : "68", + "address" : 68, "name" : "speech 1: \"you're good! but i'm still the champ!\"", "extender" : "extender_0" }, { "id" : 47, - "address" : "69", + "address" : 69, "name" : "speech 1: \"you're good! but i'm still the champ!\"", "extender" : "extender_0" }, { "id" : 48, - "address" : "70", + "address" : 70, "name" : "speech 1: \"you're good! but i'm still the champ!\"", "extender" : "extender_0" }, { "id" : 49, - "address" : "71", + "address" : 71, "name" : "speech 1: \"you're good! but i'm still the champ!\"", "extender" : "extender_0" }, { "id" : 50, - "address" : "72", + "address" : 72, "name" : "speech 1: \"you're good! but i'm still the champ!\"", "extender" : "extender_0" }, { "id" : 51, - "address" : "73", + "address" : 73, "name" : "speech 1: \"you're good! but i'm still the champ!\"", "extender" : "extender_0" }, { "id" : 52, - "address" : "74", + "address" : 74, "name" : "speech 1: \"you're good! but i'm still the champ!\"", "extender" : "extender_0" }, { "id" : 53, - "address" : "75", + "address" : 75, "name" : "speech 1: \"you're good! but i'm still the champ!\"", "extender" : "extender_0" }, { "id" : 54, - "address" : "76", + "address" : 76, "name" : "speech 1: \"you're good! but i'm still the champ!\"", "extender" : "extender_0" } diff --git a/FlippR-Driver/src/output/OutputDriverFactory.cpp b/FlippR-Driver/src/output/OutputDriverFactory.cpp index 4e3866b..4b47112 100644 --- a/FlippR-Driver/src/output/OutputDriverFactory.cpp +++ b/FlippR-Driver/src/output/OutputDriverFactory.cpp @@ -354,4 +354,4 @@ type get_value(const std::string & name, json & object, const std::string & file } } -} \ No newline at end of file +}CLOG(ERROR, OUTPUT_LOGGER) \ No newline at end of file From c0925603e8a94c310fe64d62149b607cae98545d Mon Sep 17 00:00:00 2001 From: Johannes Wendel Date: Thu, 15 Aug 2019 19:59:19 +0200 Subject: [PATCH 10/13] changed runtime dir --- FlippR-Driver/networking/FlippRServer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FlippR-Driver/networking/FlippRServer.cpp b/FlippR-Driver/networking/FlippRServer.cpp index 8ba7583..7e22a50 100644 --- a/FlippR-Driver/networking/FlippRServer.cpp +++ b/FlippR-Driver/networking/FlippRServer.cpp @@ -258,7 +258,7 @@ void FlippRServer::handle_help(const std::string& name, const std::string& value std::string FlippRServer::get_runtime_dir() { std::string runtime_dir = std::getenv("XDG_RUNTIME_DIR"); - if(runtime_dir == "") + if(&runtime_dir == nullptr) { runtime_dir = DEFAULT_RUNTIME_DIR; } From db454595580e7a7f86e0e10c7aed3f888aa0e9e0 Mon Sep 17 00:00:00 2001 From: Johannes Wendel Date: Thu, 15 Aug 2019 20:09:44 +0200 Subject: [PATCH 11/13] changed runtime dir --- FlippR-Driver/src/output/OutputDriverFactory.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FlippR-Driver/src/output/OutputDriverFactory.cpp b/FlippR-Driver/src/output/OutputDriverFactory.cpp index 4b47112..4e3866b 100644 --- a/FlippR-Driver/src/output/OutputDriverFactory.cpp +++ b/FlippR-Driver/src/output/OutputDriverFactory.cpp @@ -354,4 +354,4 @@ type get_value(const std::string & name, json & object, const std::string & file } } -}CLOG(ERROR, OUTPUT_LOGGER) \ No newline at end of file +} \ No newline at end of file From 5ea137cdba59ac6d7510fb6119765cf9abee4b1f Mon Sep 17 00:00:00 2001 From: Johannes Wendel Date: Thu, 15 Aug 2019 20:18:16 +0200 Subject: [PATCH 12/13] changed runtime dir --- FlippR-Driver/contrib/json_example/output/Sound_Config.json | 2 +- FlippR-Driver/networking/FlippRServer.cpp | 2 +- FlippR-Driver/networking/FlippRServer.h | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/FlippR-Driver/contrib/json_example/output/Sound_Config.json b/FlippR-Driver/contrib/json_example/output/Sound_Config.json index 95a75b6..14765f7 100644 --- a/FlippR-Driver/contrib/json_example/output/Sound_Config.json +++ b/FlippR-Driver/contrib/json_example/output/Sound_Config.json @@ -335,7 +335,7 @@ }, { "id" : 53, - "address" : 75, + "address" : 75, "name" : "speech 1: \"you're good! but i'm still the champ!\"", "extender" : "extender_0" }, diff --git a/FlippR-Driver/networking/FlippRServer.cpp b/FlippR-Driver/networking/FlippRServer.cpp index 7e22a50..89e8043 100644 --- a/FlippR-Driver/networking/FlippRServer.cpp +++ b/FlippR-Driver/networking/FlippRServer.cpp @@ -257,7 +257,7 @@ void FlippRServer::handle_help(const std::string& name, const std::string& value std::string FlippRServer::get_runtime_dir() { - std::string runtime_dir = std::getenv("XDG_RUNTIME_DIR"); + const char* runtime_dir = std::getenv("XDG_RUNTIME_DIR"); if(&runtime_dir == nullptr) { runtime_dir = DEFAULT_RUNTIME_DIR; diff --git a/FlippR-Driver/networking/FlippRServer.h b/FlippR-Driver/networking/FlippRServer.h index a34706f..fbc3641 100644 --- a/FlippR-Driver/networking/FlippRServer.h +++ b/FlippR-Driver/networking/FlippRServer.h @@ -41,8 +41,8 @@ private: Poco::Net::TCPServer* build_input_server(); private: - const std::string DEFAULT_RUNTIME_DIR = "/tmp/flippR_driver-runtime/"; - const std::string SOCKET_NAME = "S.flippR_driver"; + const char * DEFAULT_RUNTIME_DIR = "/tmp/flippR_driver-runtime/"; + const char * SOCKET_NAME = "S.flippR_driver"; const std::vector REQUIRED_CONFIG_KEYS = {"display-config", "input-config", "lamp-config", "matrix-config", "solenoid-config", "sound-config"}; int input_port; From a8373467942de775193a2d64cba0cb3a8ef99201 Mon Sep 17 00:00:00 2001 From: Johannes Wendel Date: Thu, 15 Aug 2019 20:20:41 +0200 Subject: [PATCH 13/13] changed runtime dir --- FlippR-Driver/networking/FlippRServer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FlippR-Driver/networking/FlippRServer.cpp b/FlippR-Driver/networking/FlippRServer.cpp index 89e8043..59d9dbd 100644 --- a/FlippR-Driver/networking/FlippRServer.cpp +++ b/FlippR-Driver/networking/FlippRServer.cpp @@ -257,7 +257,7 @@ void FlippRServer::handle_help(const std::string& name, const std::string& value std::string FlippRServer::get_runtime_dir() { - const char* runtime_dir = std::getenv("XDG_RUNTIME_DIR"); + char* runtime_dir = std::getenv("XDG_RUNTIME_DIR"); if(&runtime_dir == nullptr) { runtime_dir = DEFAULT_RUNTIME_DIR;