// Created by rhetenor on 04.10.18. // #ifndef flippR_driver_OUTPUTDRIVERFACTORY_H #define flippR_driver_OUTPUTDRIVERFACTORY_H #include "output/OutputDriver.h" #include "output/items/detail/Solenoid.h" #include "output/items/detail/Lamp.h" #include "output/items/detail/Sound.h" #include "output/items/Flipper.h" #include "output/items/detail/Flipper.h" #include "output/DisplayBoardPinController.h" #include "json/json.hpp" #include namespace flippR_driver { namespace output { namespace OutputDriverFactory { std::shared_ptr get_OutputDriver(std::istream& solenoid_config, std::istream& lamp_config, std::istream& sound_config, std::istream& display_config); std::map> create_solenoids(std::istream& solenoid_config, std::shared_ptr &driverBoardPinController); std::shared_ptr create_solenoid(nlohmann::json &solenoid_json, nlohmann::json &port_extenders, std::shared_ptr &pin_controller, std::chrono::milliseconds deactivation_time); std::map> create_flippers(std::istream &solenoid_config, std::shared_ptr &pin_controller); std::shared_ptr create_flipper(nlohmann::json &flipper_json, nlohmann::json &port_extenders, std::shared_ptr &pin_controller); std::map> create_lamps(std::istream &lamp_config, std::shared_ptr &pin_controller); std::shared_ptr create_lamp(nlohmann::json &lamp_json, nlohmann::json & port_extenders, std::shared_ptr &pin_controller); std::map> create_sounds(std::istream &sound_config, std::shared_ptr &pin_controller); std::shared_ptr create_sound(nlohmann::json &sound_json, nlohmann::json &port_extenders, std::shared_ptr &pin_controller, std::chrono::milliseconds &deactivation_time); uint8_t get_sound_fire_address(std::istream &sound_config); std::map parse_pins_display_board(std::istream & display_config); std::vector> create_displays(std::istream &display_config); std::shared_ptr create_display(nlohmann::json &display_json); std::map> map_displays(const std::vector> &displays); void initialize_port_extenders(nlohmann::json &port_extenders, PinController * pin_controller, const std::string & file_name); uint8_t get_pin_base(nlohmann::json & object, nlohmann::json & port_extenders, const std::string & config_file_name); nlohmann::json get_element(const std::string & name, nlohmann::json & object, const std::string & file_name); template type get_value(const std::string & name, nlohmann::json & object, const std::string & file_name); } } } #endif //flippR_driver_OUTPUTDRIVERFACTORY_H