This commit is contained in:
Jonas Zeunert
2018-11-20 21:06:39 +01:00
6 changed files with 8 additions and 87 deletions

View File

@@ -1,13 +0,0 @@
//
// Created by rhetenor on 19.10.18.
//
#ifndef FLIPPR_DRIVER_ACTIVATEEVENT_H
#define FLIPPR_DRIVER_ACTIVATEEVENT_H
class ActivateEvent : public Event
{
};
#endif //FLIPPR_DRIVER_ACTIVATEEVENT_H

View File

@@ -1,13 +0,0 @@
//
// Created by rhetenor on 19.10.18.
//
#ifndef FLIPPR_DRIVER_DEACTIVATEEVENT_H
#define FLIPPR_DRIVER_DEACTIVATEEVENT_H
class DeactivateEvent
{
};
#endif //FLIPPR_DRIVER_DEACTIVATEEVENT_H

View File

@@ -1,22 +0,0 @@
//
// Created by rhetenor on 19.10.18.
//
#ifndef FLIPPR_DRIVER_EVENT_H
#define FLIPPR_DRIVER_EVENT_H
#include "OutputItem.h"
#include <memory>
namespace FlippR_Driver
{
namespace output
{
class Event
{
std::shared_ptr<OutputItem> item;
};
}
}
#endif //FLIPPR_DRIVER_EVENT_H

View File

@@ -15,13 +15,13 @@ namespace flippR_driver
namespace output
{
OutputDriver::OutputDriver(std::map<std::string, std::shared_ptr<IOutputItem>> cabinet_items, std::map<char, std::shared_ptr<IDisplay>> displays, std::map<std::string, std::shared_ptr<ISound>> sounds)
OutputDriver::OutputDriver(std::map<std::string, std::shared_ptr<ICabinetItem>> cabinet_items, std::map<char, std::shared_ptr<IDisplay>> displays, std::map<std::string, std::shared_ptr<ISound>> sounds)
: cabinet_items(cabinet_items), displays(displays), sounds(sounds)
{}
std::vector<std::shared_ptr<IOutputItem>> OutputDriver::get_cabinet_items()
std::vector<std::shared_ptr<ICabinetItem>> OutputDriver::get_cabinet_items()
{
std::vector<std::shared_ptr<IOutputItem>> cabinet_items;
std::vector<std::shared_ptr<ICabinetItem>> cabinet_items;
boost::copy(this->cabinet_items | boost::adaptors::map_values, std::back_inserter(cabinet_items));
@@ -46,7 +46,7 @@ std::vector<std::shared_ptr<IDisplay>> OutputDriver::get_displays()
return displays;
}
std::shared_ptr<IOutputItem> OutputDriver::get_cabinet_item(std::string name)
std::shared_ptr<ICabinetItem> OutputDriver::get_cabinet_item(std::string name)
{
return this->cabinet_items.find(name)->second;
}

View File

@@ -13,7 +13,7 @@
#include <map>
#include <memory>
#include "IOutputItem.h"
#include "ICabinetItem.h"
#include "IDisplay.h"
#include "ISound.h"
@@ -25,28 +25,10 @@ namespace output
class OutputDriver : public IOutputDriver
{
public:
<<<<<<< HEAD
OutputDriver(std::map<std::string, std::shared_ptr<IOutputItem>> cabinet_items, std::map<char, std::shared_ptr<IDisplay>> displays, std::map<std::string, std::shared_ptr<ISound>> sounds);
=======
OutputDriver(std::map<std::string, std::shared_ptr<ICabinetItem>> cabinet_items, std::map<char, std::shared_ptr<IDisplay>> displays, std::map<std::string, std::shared_ptr<ISound>> sounds);
>>>>>>> be582e9f7f0d29518665a131afce24ca0a43386e
virtual ~OutputDriver() = default;
<<<<<<< HEAD
std::vector<std::shared_ptr<IOutputItem>> get_cabinet_items();
std::vector<std::shared_ptr<ISound>> get_sounds();
std::vector<std::shared_ptr<IDisplay>> get_displays();
std::shared_ptr<IOutputItem> get_cabinet_item(std::string name);
std::shared_ptr<ISound> get_sound(std::string name);
std::shared_ptr<IDisplay> get_display(char number);
private:
std::map<std::string, std::shared_ptr<IOutputItem>> cabinet_items;
std::map<char, std::shared_ptr<IDisplay>> displays;
std::map<std::string, std::shared_ptr<ISound>> sounds;
=======
std::vector<std::shared_ptr<ICabinetItem>> get_cabinet_items();
std::vector<std::shared_ptr<ISound>> get_sounds();
std::vector<std::shared_ptr<IDisplay>> get_displays();
@@ -59,7 +41,6 @@ private:
std::map<std::string, std::shared_ptr<ICabinetItem>> cabinet_items;
std::map<char, std::shared_ptr<IDisplay>> displays;
std::map<std::string, std::shared_ptr<ISound>> sounds;
>>>>>>> be582e9f7f0d29518665a131afce24ca0a43386e
};
} /* namespace output */

View File

@@ -9,9 +9,6 @@
#define SRC_UTILITIES_OUTPUTGPIOINTERFACE_H_
#include "GPIOInterface.h"
#include "output/Event.h"
#include <mcp23017.h>
namespace flippR_driver
@@ -22,22 +19,13 @@ class OutputGPIOInterface : GPIOInterface
{
public:
OutputGPIOInterface();
~OutputGPIOInterface() = default;
void queue_output_item(shared_ptr<OutputItem> item);
void activate_cabinet_item(CabinetItem &item);
void write_display(Display &display);
private:
void cycle_output_items();
void activate_sounds(OutputItem &item);
void activate_cabinet_item(OutputItem &item);
void
private:
IBlockingQueue <output::Event> event_queue;
IBlockingQueue <CabinetItem> event_queue;
};
}