This commit is contained in:
Jonas Zeunert
2018-12-10 23:04:44 +01:00
parent 5e0687f7c6
commit d65d87b8f1
15 changed files with 101 additions and 47 deletions

View File

@@ -5,7 +5,10 @@
#ifndef flippR_driver_OUTPUTDRIVERFACTORY_H
#define flippR_driver_OUTPUTDRIVERFACTORY_H
#include <output/IOutputDriver.h>
#include "output/IOutputDriver.h"
#include "output/items/Solenoid.h"
#include "output/items/Lamp.h"
#include "output/items/Sound.h"
#include "OutputGPIOInterface.h"
#include <memory>
@@ -16,15 +19,23 @@ namespace output
{
namespace OutputDriverFactory
{
static std::shared_ptr<IOutputDriver> get_OutputDriver(std::istream &output_pin_config, std::istream &solenoid_config, std::istream &lamp_config, std::istream &sound_config);
std::shared_ptr<IOutputDriver> get_OutputDriver(std::istream &output_pin_config, std::istream &solenoid_config, std::istream &lamp_config, std::istream &sound_config);
namespace
{
static std::shared_ptr<OutputGPIOInterface> createOutputGPIOInterface(std::istream &output_gpio_config);
std::map<std::string, std::shared_ptr<items::ISolenoid>> create_solenoids(std::istream &solenoid_config, std::shared_ptr<IOutputGPIOInterface> output_gpio_interface);
std::shared_ptr<items::ISolenoid> create_solenoid(nlohmann::json &solenoid_json, std::shared_ptr<IOutputGPIOInterface> output_gpio_interface);
static std::map<std::string, uint8_t> parse_pins_driver_board(nlohmann::json &driver_board_config);
static std::map<std::string, uint8_t> parse_pins_sound(nlohmann::json &sound_board_config);
static std::map<std::string, uint8_t> parse_pins_display(nlohmann::json &display_board_config);
std::map<std::string, std::shared_ptr<items::ILamp>> create_lamps(std::istream &lamp_config, std::shared_ptr<IOutputGPIOInterface> output_gpio_interface);
std::shared_ptr<items::ILamp> create_lamp(nlohmann::json &lamp_json, std::shared_ptr<IOutputGPIOInterface> output_gpio_interface);
std::map<std::string, std::shared_ptr<items::ISound>> create_sounds(std::istream &sound_config, std::shared_ptr<IOutputGPIOInterface> output_gpio_interface);
std::shared_ptr<items::ISound> create_sound(nlohmann::json &sound_json, std::shared_ptr<IOutputGPIOInterface> output_gpio_interface, std::chrono::milliseconds deactivation_time);
std::shared_ptr<OutputGPIOInterface> create_OutputGPIOInterface(std::istream &output_pin_config);
std::map<std::string, uint8_t> parse_pins_driver_board(nlohmann::json &driver_board_config);
std::map<std::string, uint8_t> parse_pins_sound(nlohmann::json &sound_board_config);
std::map<std::string, uint8_t> parse_pins_display(nlohmann::json &display_board_config);
}
}
}