reafectored stuff and corrected shit to make everything compiling
This commit is contained in:
@@ -20,7 +20,7 @@ namespace items
|
||||
{
|
||||
|
||||
template<int DigitCount>
|
||||
class Display : public IDisplay<DigitCount>
|
||||
class Display : public IDisplay
|
||||
{
|
||||
public:
|
||||
Display(int address, int id);
|
||||
|
||||
@@ -18,13 +18,14 @@ namespace items
|
||||
|
||||
class IOutputItem
|
||||
{
|
||||
public:
|
||||
virtual ~IOutputItem();
|
||||
virtual bool activate() = 0;
|
||||
virtual bool deactivate() = 0;
|
||||
virtual void activate() = 0;
|
||||
virtual void deactivate() = 0;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#define _SRC_OUTPUT_LAMP_H_
|
||||
|
||||
#include "OutputItem.h"
|
||||
#include "../../../include/output/output_items/ILamp.h"
|
||||
#include "output/items/ILamp.h"
|
||||
|
||||
namespace flippR_driver
|
||||
{
|
||||
|
||||
@@ -36,8 +36,8 @@ protected:
|
||||
const std::shared_ptr<utility::IOutputGPIOInterface> output_gpio_interface;
|
||||
|
||||
protected:
|
||||
void activate();
|
||||
void deactivate();
|
||||
virtual void activate();
|
||||
virtual void deactivate();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
|
||||
#include "Solenoid.h"
|
||||
|
||||
#include <thread>
|
||||
|
||||
namespace flippR_driver
|
||||
{
|
||||
namespace output
|
||||
@@ -14,10 +16,9 @@ namespace output
|
||||
namespace items
|
||||
{
|
||||
|
||||
Solenoid::Solenoid(std::shared_ptr<utility::IOutputGPIOInterface> output_gpio_interface, unsigned int address, unsigned int i2c_address, unsigned int data_pin, std::string name, std::chrono::milliseconds deactivation_time)
|
||||
:
|
||||
OutputItem(output_gpio_interface, address, i2c_address, data_pin, name),
|
||||
deactivation_time(deactivation_time)
|
||||
Solenoid::Solenoid(std::shared_ptr<utility::IOutputGPIOInterface> output_gpio_interface, unsigned int address, unsigned int i2c_address, unsigned int data_pin, std::string name, std::chrono::milliseconds deactivation_time):
|
||||
OutputItem(output_gpio_interface, address, i2c_address, data_pin, name),
|
||||
deactivation_time(deactivation_time)
|
||||
{}
|
||||
|
||||
void Solenoid::triggerTask()
|
||||
@@ -31,7 +32,7 @@ void Solenoid::triggerTask()
|
||||
|
||||
void Solenoid::trigger()
|
||||
{
|
||||
std::async(std::launch::async, &Solenoid::triggerTask);
|
||||
this->trigger_task = std::async(std::launch::async, &Solenoid::triggerTask, this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,11 +8,10 @@
|
||||
#ifndef _SRC_OUTPUT_SOLENOID_H_
|
||||
#define _SRC_OUTPUT_SOLENOID_H_
|
||||
|
||||
#include "output/items/ISolenoid.h"
|
||||
#include "OutputItem.h"
|
||||
#include "../../../include/output/output_items/ISolenoid.h"
|
||||
|
||||
#include <future>
|
||||
#include <thread>
|
||||
#include <chrono>
|
||||
|
||||
namespace flippR_driver
|
||||
@@ -22,7 +21,7 @@ namespace output
|
||||
namespace items
|
||||
{
|
||||
|
||||
class Solenoid : public ISolenoid, OutputItem
|
||||
class Solenoid : public OutputItem, ISolenoid
|
||||
{
|
||||
public:
|
||||
Solenoid(std::shared_ptr<utility::IOutputGPIOInterface> output_gpio_interface, unsigned int address, unsigned int i2c_address, unsigned int data_pin, std::string name, std::chrono::milliseconds deactivation_time);
|
||||
@@ -33,10 +32,14 @@ public:
|
||||
private:
|
||||
std::chrono::milliseconds deactivation_time;
|
||||
|
||||
std::future<void> trigger_task;
|
||||
|
||||
private:
|
||||
virtual void triggerTask();
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
} /* namespace output */
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
#include "Sound.h"
|
||||
|
||||
#include <future>
|
||||
#include <thread>
|
||||
|
||||
namespace flippR_driver
|
||||
{
|
||||
@@ -16,15 +16,14 @@ namespace output
|
||||
namespace items
|
||||
{
|
||||
|
||||
Sound::Sound(std::shared_ptr<utility::IOutputGPIOInterface> output_gpio_interface, unsigned int address, unsigned int i2c_address, unsigned int data_pin, std::string name)
|
||||
:
|
||||
OutputItem(output_gpio_interface, address, i2c_address, data_pin, name),
|
||||
deactivation_time(deactivation_time)
|
||||
Sound::Sound(std::shared_ptr<utility::IOutputGPIOInterface> output_gpio_interface, unsigned int address, unsigned int i2c_address, unsigned int data_pin, std::string name, std::chrono::milliseconds deactivation_time) :
|
||||
OutputItem(output_gpio_interface, address, i2c_address, data_pin, name),
|
||||
deactivation_time(deactivation_time)
|
||||
{}
|
||||
|
||||
void Sound::play()
|
||||
{
|
||||
std::async(std::launch::async, &Sound::playTask);
|
||||
this->play_task = std::async(std::launch::async, &Sound::playTask, this);
|
||||
}
|
||||
|
||||
void Sound::playTask()
|
||||
|
||||
@@ -8,12 +8,14 @@
|
||||
#ifndef _SRC_OUTPUT_SOUND_H_
|
||||
#define _SRC_OUTPUT_SOUND_H_
|
||||
|
||||
#include "../../../include/output/output_items/ISound.h"
|
||||
#include "output/items/ISound.h"
|
||||
#include "OutputItem.h"
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <chrono>
|
||||
#include <future>
|
||||
|
||||
#include "utility/IOutputGPIOInterface.h"
|
||||
|
||||
namespace flippR_driver
|
||||
{
|
||||
@@ -33,6 +35,8 @@ public:
|
||||
private:
|
||||
std::chrono::milliseconds deactivation_time;
|
||||
|
||||
std::future<void> play_task;
|
||||
|
||||
private:
|
||||
virtual void playTask();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user