hmmm dunno if this is better
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
#ifndef FLIPPR_DRIVER_IDRIVERBOARDITEM_H
|
||||
#define FLIPPR_DRIVER_IDRIVERBOARDITEM_H
|
||||
|
||||
#include "output/items/IItem.h"
|
||||
#include "output/items/Item.h"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
@@ -16,10 +16,14 @@ namespace output
|
||||
namespace items
|
||||
{
|
||||
|
||||
class IDriverBoardItem : public IItem
|
||||
class DriverBoardItem : public Item
|
||||
{
|
||||
public:
|
||||
~IDriverBoardItem() override = default;
|
||||
DriverBoardItem(std::shared_ptr<IOutputGPIOInterface> output_gpio_interface, uint8_t address, std::string name) :
|
||||
Item(output_gpio_interface, address, name) {}
|
||||
~DriverBoardItem() override = default;
|
||||
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
//
|
||||
// Created by rhetenor on 23.11.18.
|
||||
//
|
||||
|
||||
#ifndef FLIPPR_DRIVER_ISOUNDITEM_H
|
||||
#define FLIPPR_DRIVER_ISOUNDITEM_H
|
||||
|
||||
#include "IItem.h"
|
||||
namespace flippR_driver
|
||||
{
|
||||
namespace output
|
||||
{
|
||||
namespace items
|
||||
{
|
||||
|
||||
class ISoundItem : public IItem
|
||||
{
|
||||
public:
|
||||
~ISoundItem() override = default;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif //FLIPPR_DRIVER_ISOUNDITEM_H
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
#include "Item.h"
|
||||
|
||||
|
||||
namespace flippR_driver
|
||||
{
|
||||
namespace output
|
||||
|
||||
@@ -10,8 +10,6 @@
|
||||
|
||||
#include "output/items/IItem.h"
|
||||
|
||||
#include "output/IOutputGPIOInterface.h"
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
@@ -19,6 +17,9 @@ namespace flippR_driver
|
||||
{
|
||||
namespace output
|
||||
{
|
||||
|
||||
class IOutputGPIOInterface;
|
||||
|
||||
namespace items
|
||||
{
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#include "Lamp.h"
|
||||
|
||||
#include "output/IOutputGPIOInterface.h"
|
||||
namespace flippR_driver
|
||||
{
|
||||
namespace output
|
||||
@@ -14,10 +15,8 @@ namespace output
|
||||
namespace items
|
||||
{
|
||||
|
||||
Lamp::Lamp(std::shared_ptr<IOutputGPIOInterface> output_gpio_interface, uint8_t address, std::string name)
|
||||
:
|
||||
Item(std::move(output_gpio_interface), address, std::move(name)),
|
||||
activated(false)
|
||||
Lamp::Lamp(std::shared_ptr<IOutputGPIOInterface> output_gpio_interface, uint8_t address, std::string name) :
|
||||
DriverBoardItem(std::move(output_gpio_interface), address, std::move(name)), activated(false)
|
||||
{}
|
||||
|
||||
void Lamp::activate()
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
#ifndef _SRC_OUTPUT_LAMP_H_
|
||||
#define _SRC_OUTPUT_LAMP_H_
|
||||
|
||||
#include "Item.h"
|
||||
#include "output/items/ILamp.h"
|
||||
#include "DriverBoardItem.h"
|
||||
|
||||
namespace flippR_driver
|
||||
{
|
||||
@@ -18,7 +18,7 @@ namespace output
|
||||
namespace items
|
||||
{
|
||||
|
||||
class Lamp : public Item, public ILamp
|
||||
class Lamp : public DriverBoardItem, public ILamp
|
||||
{
|
||||
public:
|
||||
Lamp(std::shared_ptr<IOutputGPIOInterface> output_gpio_interface, uint8_t address, std::string name);
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
|
||||
#include "Solenoid.h"
|
||||
|
||||
#include "output/IOutputGPIOInterface.h"
|
||||
|
||||
namespace flippR_driver
|
||||
{
|
||||
namespace output
|
||||
@@ -15,8 +17,7 @@ namespace items
|
||||
{
|
||||
|
||||
Solenoid::Solenoid(std::shared_ptr<IOutputGPIOInterface> output_gpio_interface, uint8_t address, std::string name, std::chrono::milliseconds deactivation_time):
|
||||
Item(std::move(output_gpio_interface), address, std::move(name)),
|
||||
deactivation_time(deactivation_time)
|
||||
DriverBoardItem(std::move(output_gpio_interface), address, std::move(name)), deactivation_time(deactivation_time)
|
||||
{}
|
||||
|
||||
void Solenoid::triggerTask()
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#define _SRC_OUTPUT_SOLENOID_H_
|
||||
|
||||
#include "output/items/ISolenoid.h"
|
||||
#include "Item.h"
|
||||
#include "DriverBoardItem.h"
|
||||
|
||||
#include <future>
|
||||
#include <chrono>
|
||||
@@ -21,7 +21,7 @@ namespace output
|
||||
namespace items
|
||||
{
|
||||
|
||||
class Solenoid : public Item, public ISolenoid
|
||||
class Solenoid : public DriverBoardItem, public ISolenoid
|
||||
{
|
||||
public:
|
||||
Solenoid(std::shared_ptr<IOutputGPIOInterface> output_gpio_interface, u_int8_t address, std::string name, std::chrono::milliseconds deactivation_time);
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
|
||||
#include "Sound.h"
|
||||
|
||||
#include "output/IOutputGPIOInterface.h"
|
||||
|
||||
namespace flippR_driver
|
||||
{
|
||||
namespace output
|
||||
@@ -15,9 +17,7 @@ namespace items
|
||||
{
|
||||
|
||||
Sound::Sound(std::shared_ptr<IOutputGPIOInterface> output_gpio_interface, uint8_t address, std::string name, std::chrono::milliseconds deactivation_time, u_int id) :
|
||||
Item(std::move(output_gpio_interface), address, std::move(name)),
|
||||
deactivation_time(deactivation_time),
|
||||
id(id)
|
||||
SoundItem(std::move(output_gpio_interface), address, std::move(name)), deactivation_time(deactivation_time), id(id)
|
||||
{}
|
||||
|
||||
void Sound::play()
|
||||
|
||||
@@ -9,16 +9,13 @@
|
||||
#define _SRC_OUTPUT_SOUND_H_
|
||||
|
||||
#include "output/items/ISound.h"
|
||||
#include "output/items/ISoundItem.h"
|
||||
|
||||
#include "Item.h"
|
||||
#include "output/items/SoundItem.h"
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <chrono>
|
||||
#include <future>
|
||||
|
||||
|
||||
namespace flippR_driver
|
||||
{
|
||||
namespace output
|
||||
@@ -26,7 +23,7 @@ namespace output
|
||||
namespace items
|
||||
{
|
||||
|
||||
class Sound : public ISound, public Item, public ISoundItem
|
||||
class Sound : public SoundItem, public ISound
|
||||
{
|
||||
public:
|
||||
u_int id;
|
||||
@@ -35,9 +32,6 @@ public:
|
||||
Sound(std::shared_ptr<IOutputGPIOInterface> output_gpio_interface, uint8_t address, std::string name, std::chrono::milliseconds deactivation_time, u_int id);
|
||||
~Sound() override = default;
|
||||
|
||||
std::string get_name() override;
|
||||
uint8_t get_address() override;
|
||||
|
||||
void play() override;
|
||||
|
||||
private:
|
||||
|
||||
29
FlippR-Driver/src/output/items/SoundItem.h
Normal file
29
FlippR-Driver/src/output/items/SoundItem.h
Normal file
@@ -0,0 +1,29 @@
|
||||
//
|
||||
// Created by rhetenor on 23.11.18.
|
||||
//
|
||||
|
||||
#ifndef FLIPPR_DRIVER_ISOUNDITEM_H
|
||||
#define FLIPPR_DRIVER_ISOUNDITEM_H
|
||||
|
||||
#include "Item.h"
|
||||
|
||||
namespace flippR_driver
|
||||
{
|
||||
namespace output
|
||||
{
|
||||
namespace items
|
||||
{
|
||||
|
||||
class SoundItem : public Item
|
||||
{
|
||||
public:
|
||||
SoundItem(std::shared_ptr<IOutputGPIOInterface> output_gpio_interface, uint8_t address, std::string name) :
|
||||
Item(output_gpio_interface, address, name) {}
|
||||
~SoundItem() override = default;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif //FLIPPR_DRIVER_ISOUNDITEM_H
|
||||
Reference in New Issue
Block a user