refactored cabinetitem -> outputitem
This commit is contained in:
@@ -14,9 +14,9 @@ namespace flippR_driver
|
|||||||
namespace output
|
namespace output
|
||||||
{
|
{
|
||||||
|
|
||||||
class ICabinetItem
|
class IOutputItem
|
||||||
{
|
{
|
||||||
virtual ~ICabinetItem();
|
virtual ~IOutputItem();
|
||||||
virtual bool isActivated() = 0;
|
virtual bool isActivated() = 0;
|
||||||
virtual bool activate() = 0;
|
virtual bool activate() = 0;
|
||||||
virtual bool deactivate() = 0;
|
virtual bool deactivate() = 0;
|
||||||
|
|||||||
@@ -15,13 +15,13 @@ namespace flippR_driver
|
|||||||
namespace output
|
namespace output
|
||||||
{
|
{
|
||||||
|
|
||||||
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)
|
OutputDriver::OutputDriver(std::map<std::string, std::shared_ptr<IOutputtItem>> 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)
|
: cabinet_items(cabinet_items), displays(displays), sounds(sounds)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
std::vector<std::shared_ptr<ICabinetItem>> OutputDriver::get_cabinet_items()
|
std::vector<std::shared_ptr<IOutputtItem>> OutputDriver::get_cabinet_items()
|
||||||
{
|
{
|
||||||
std::vector<std::shared_ptr<ICabinetItem>> cabinet_items;
|
std::vector<std::shared_ptr<IOutputtItem>> cabinet_items;
|
||||||
|
|
||||||
boost::copy(this->cabinet_items | boost::adaptors::map_values, std::back_inserter(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;
|
return displays;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<ICabinetItem> OutputDriver::get_cabinet_item(std::string name)
|
std::shared_ptr<IOutputtItem> OutputDriver::get_cabinet_item(std::string name)
|
||||||
{
|
{
|
||||||
return this->cabinet_items.find(name)->second;
|
return this->cabinet_items.find(name)->second;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,20 +25,20 @@ namespace output
|
|||||||
class OutputDriver : public IOutputDriver
|
class OutputDriver : public IOutputDriver
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
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);
|
OutputDriver(std::map<std::string, std::shared_ptr<IOutputtItem>> cabinet_items, std::map<char, std::shared_ptr<IDisplay>> displays, std::map<std::string, std::shared_ptr<ISound>> sounds);
|
||||||
|
|
||||||
virtual ~OutputDriver() = default;
|
virtual ~OutputDriver() = default;
|
||||||
|
|
||||||
std::vector<std::shared_ptr<ICabinetItem>> get_cabinet_items();
|
std::vector<std::shared_ptr<IOutputtItem>> get_cabinet_items();
|
||||||
std::vector<std::shared_ptr<ISound>> get_sounds();
|
std::vector<std::shared_ptr<ISound>> get_sounds();
|
||||||
std::vector<std::shared_ptr<IDisplay>> get_displays();
|
std::vector<std::shared_ptr<IDisplay>> get_displays();
|
||||||
|
|
||||||
std::shared_ptr<ICabinetItem> get_cabinet_item(std::string name);
|
std::shared_ptr<IOutputtItem> get_cabinet_item(std::string name);
|
||||||
std::shared_ptr<ISound> get_sound(std::string name);
|
std::shared_ptr<ISound> get_sound(std::string name);
|
||||||
std::shared_ptr<IDisplay> get_display(char number);
|
std::shared_ptr<IDisplay> get_display(char number);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::map<std::string, std::shared_ptr<ICabinetItem>> cabinet_items;
|
std::map<std::string, std::shared_ptr<IOutputtItem>> cabinet_items;
|
||||||
std::map<char, std::shared_ptr<IDisplay>> displays;
|
std::map<char, std::shared_ptr<IDisplay>> displays;
|
||||||
std::map<std::string, std::shared_ptr<ISound>> sounds;
|
std::map<std::string, std::shared_ptr<ISound>> sounds;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -8,9 +8,8 @@
|
|||||||
#ifndef _SRC_OUTPUT_CABINETITEM_H_
|
#ifndef _SRC_OUTPUT_CABINETITEM_H_
|
||||||
#define _SRC_OUTPUT_CABINETITEM_H_
|
#define _SRC_OUTPUT_CABINETITEM_H_
|
||||||
|
|
||||||
#include "ICabinetItem.h"
|
#include "IOutputItem.h"
|
||||||
|
|
||||||
#include "ActivationStrategy.h"
|
|
||||||
#include "utility/IOutputGPIOInterface.h"
|
#include "utility/IOutputGPIOInterface.h"
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
@@ -21,7 +20,7 @@ namespace flippR_driver
|
|||||||
namespace output
|
namespace output
|
||||||
{
|
{
|
||||||
|
|
||||||
class OutputItem : public ICabinetItem
|
class OutputItem : public IOutputItem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
OutputItem(std::shared_ptr<utility::IOutputGPIOInterface> output_gpio_interface, int address, std::string name);
|
OutputItem(std::shared_ptr<utility::IOutputGPIOInterface> output_gpio_interface, int address, std::string name);
|
||||||
|
|||||||
@@ -30,5 +30,15 @@ void Solenoid::trigger()
|
|||||||
// deactivate
|
// deactivate
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Solenoid::activate()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void Solenoid::deactivate()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
} /* namespace output */
|
} /* namespace output */
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,8 @@
|
|||||||
|
|
||||||
#include "OutputItem.h"
|
#include "OutputItem.h"
|
||||||
|
|
||||||
|
#include <thread>
|
||||||
|
|
||||||
namespace flippR_driver
|
namespace flippR_driver
|
||||||
{
|
{
|
||||||
namespace output
|
namespace output
|
||||||
@@ -23,6 +25,12 @@ public:
|
|||||||
|
|
||||||
//muss task sein
|
//muss task sein
|
||||||
void trigger();
|
void trigger();
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::thread wait_thread;
|
||||||
|
|
||||||
|
void activate();
|
||||||
|
void deactivate();
|
||||||
};
|
};
|
||||||
|
|
||||||
} /* namespace output */
|
} /* namespace output */
|
||||||
|
|||||||
Reference in New Issue
Block a user