changed everything to impl
This commit is contained in:
@@ -5,12 +5,11 @@
|
||||
* Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
|
||||
*/
|
||||
|
||||
#ifndef _SRC_OUTPUT_DISPLAY_H_
|
||||
#define _SRC_OUTPUT_DISPLAY_H_
|
||||
#ifndef _SRC_OUTPUT_IDISPLAY_H_
|
||||
#define _SRC_OUTPUT_IDISPLAY_H_
|
||||
|
||||
#include "IDisplay.h"
|
||||
|
||||
#include <array>
|
||||
#include <vector>
|
||||
#include <cstdint>
|
||||
|
||||
namespace flippR_driver
|
||||
{
|
||||
@@ -19,33 +18,17 @@ namespace output
|
||||
namespace items
|
||||
{
|
||||
|
||||
template<int DigitCount>
|
||||
class Display : public IDisplay
|
||||
class Display
|
||||
{
|
||||
public:
|
||||
Display(int address, int id);
|
||||
virtual ~Display() = default;
|
||||
|
||||
virtual void write_score(int score);
|
||||
virtual void write_content(std::array<char, DigitCount> content);
|
||||
|
||||
std::vector<char> get_content() override;
|
||||
uint8_t get_address() override;
|
||||
|
||||
public:
|
||||
std::array<char, DigitCount> content;
|
||||
virtual ~Display() = default;
|
||||
|
||||
private:
|
||||
int address;
|
||||
|
||||
std::string fit_string(std::string &score_string);
|
||||
virtual uint8_t get_address() = 0;
|
||||
virtual std::vector<char> get_content() = 0;
|
||||
};
|
||||
|
||||
}
|
||||
} /* namespace output */
|
||||
}
|
||||
|
||||
#include "Display.hpp"
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#ifndef FLIPPR_DRIVER_IDRIVERBOARDITEM_H
|
||||
#define FLIPPR_DRIVER_IDRIVERBOARDITEM_H
|
||||
|
||||
#include "output/items/Item.h"
|
||||
#include "output/items/impl/Item.h"
|
||||
|
||||
#include <output/DriverBoardPinController.h>
|
||||
|
||||
@@ -18,11 +18,11 @@ namespace output
|
||||
namespace items
|
||||
{
|
||||
|
||||
class DriverBoardItem : public Item
|
||||
class DriverBoardItem : public impl::Item
|
||||
{
|
||||
public:
|
||||
DriverBoardItem(std::shared_ptr<DriverBoardPinController> pin_controller, uint8_t address, std::string name) :
|
||||
pin_controller(std::move(pin_controller)), Item(address, std::move(name)) {}
|
||||
pin_controller(std::move(pin_controller)), impl::Item(address, std::move(name)) {}
|
||||
|
||||
~DriverBoardItem() override = default;
|
||||
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
/*
|
||||
* IDisplay.h
|
||||
*
|
||||
* Created on: Aug 2, 2018
|
||||
* Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
|
||||
*/
|
||||
|
||||
#ifndef _SRC_OUTPUT_IDISPLAY_H_
|
||||
#define _SRC_OUTPUT_IDISPLAY_H_
|
||||
|
||||
#include <vector>
|
||||
#include <cstdint>
|
||||
|
||||
namespace flippR_driver
|
||||
{
|
||||
namespace output
|
||||
{
|
||||
namespace items
|
||||
{
|
||||
|
||||
class IDisplay
|
||||
{
|
||||
|
||||
public:
|
||||
virtual ~IDisplay() = default;
|
||||
|
||||
virtual uint8_t get_address() = 0;
|
||||
virtual std::vector<char> get_content() = 0;
|
||||
};
|
||||
|
||||
}
|
||||
} /* namespace output */
|
||||
}
|
||||
#endif
|
||||
@@ -1,34 +0,0 @@
|
||||
/*
|
||||
* ICabinetItem.h
|
||||
*
|
||||
* Created on: Aug 7, 2018
|
||||
* Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
|
||||
*/
|
||||
|
||||
#ifndef _SRC_OUTPUT_ICABINETITEM_H_
|
||||
#define _SRC_OUTPUT_ICABINETITEM_H_
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
namespace flippR_driver
|
||||
{
|
||||
namespace output
|
||||
{
|
||||
namespace items
|
||||
{
|
||||
|
||||
class IItem
|
||||
{
|
||||
public:
|
||||
virtual ~IItem() = default;
|
||||
|
||||
virtual uint8_t get_address() const = 0;
|
||||
virtual std::string get_name() const = 0;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,42 +1,34 @@
|
||||
/*
|
||||
* CabinetItem.h
|
||||
* ICabinetItem.h
|
||||
*
|
||||
* Created on: Aug 2, 2018
|
||||
* Created on: Aug 7, 2018
|
||||
* Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
|
||||
*/
|
||||
|
||||
#ifndef _SRC_OUTPUT_CABINETITEM_H_
|
||||
#define _SRC_OUTPUT_CABINETITEM_H_
|
||||
#ifndef _SRC_OUTPUT_ICABINETITEM_H_
|
||||
#define _SRC_OUTPUT_ICABINETITEM_H_
|
||||
|
||||
#include "output/items/IItem.h"
|
||||
|
||||
#include <memory>
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
namespace flippR_driver
|
||||
{
|
||||
namespace output
|
||||
{
|
||||
|
||||
namespace items
|
||||
{
|
||||
|
||||
class Item : public IItem
|
||||
class Item
|
||||
{
|
||||
public:
|
||||
Item(uint8_t address, std::string name);
|
||||
~Item() override = default;
|
||||
|
||||
uint8_t get_address() const override;
|
||||
std::string get_name() const override;
|
||||
|
||||
protected:
|
||||
const uint8_t address;
|
||||
const std::string name;
|
||||
virtual ~Item() = default;
|
||||
|
||||
virtual uint8_t get_address() const = 0;
|
||||
virtual std::string get_name() const = 0;
|
||||
};
|
||||
|
||||
}
|
||||
} /* namespace output */
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
54
FlippR-Driver/src/output/items/impl/Display.h
Normal file
54
FlippR-Driver/src/output/items/impl/Display.h
Normal file
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Display.h
|
||||
*
|
||||
* Created on: Aug 2, 2018
|
||||
* Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
|
||||
*/
|
||||
|
||||
#ifndef _SRC_OUTPUT_DISPLAY_H_
|
||||
#define _SRC_OUTPUT_DISPLAY_H_
|
||||
|
||||
#include "output/items/Display.h"
|
||||
|
||||
#include <array>
|
||||
|
||||
namespace flippR_driver
|
||||
{
|
||||
namespace output
|
||||
{
|
||||
namespace items
|
||||
{
|
||||
namespace impl
|
||||
{
|
||||
|
||||
template<int DigitCount>
|
||||
class Display : public items::Display
|
||||
{
|
||||
public:
|
||||
Display(int address, int id);
|
||||
virtual ~Display() = default;
|
||||
|
||||
virtual void write_score(int score);
|
||||
virtual void write_content(std::array<char, DigitCount> content);
|
||||
|
||||
std::vector<char> get_content() override;
|
||||
uint8_t get_address() override;
|
||||
|
||||
public:
|
||||
std::array<char, DigitCount> content;
|
||||
|
||||
private:
|
||||
int address;
|
||||
|
||||
std::string fit_string(std::string &score_string);
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
} /* namespace output */
|
||||
}
|
||||
|
||||
#include "Display.hpp"
|
||||
|
||||
|
||||
#endif
|
||||
@@ -7,13 +7,14 @@
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
namespace flippR_driver
|
||||
{
|
||||
namespace output
|
||||
{
|
||||
namespace items
|
||||
{
|
||||
namespace impl
|
||||
{
|
||||
|
||||
template<int DigitCount>
|
||||
Display<DigitCount>::Display(int address, int id) :
|
||||
@@ -71,3 +72,4 @@ std::vector<char> Display<DigitCount>::get_content()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@
|
||||
#ifndef FLIPPR_DRIVER_EIGHTDIGITDISPLAY_H
|
||||
#define FLIPPR_DRIVER_EIGHTDIGITDISPLAY_H
|
||||
|
||||
#include "IEightDigitDisplay"
|
||||
#include "output/items/EightDigitDisplay.h"
|
||||
|
||||
namespace flippr_driver
|
||||
{
|
||||
@@ -13,10 +13,13 @@ namespace output
|
||||
{
|
||||
namespace items
|
||||
{
|
||||
namespace impl
|
||||
{
|
||||
|
||||
class EightDigitDisplay : public Display<8>, IEightDigitDisplay;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif //FLIPPR_DRIVER_EIGHTDIGITDISPLAY_H
|
||||
@@ -4,16 +4,17 @@
|
||||
|
||||
#include "Item.h"
|
||||
|
||||
|
||||
namespace flippR_driver
|
||||
{
|
||||
namespace output
|
||||
{
|
||||
namespace items
|
||||
{
|
||||
namespace impl
|
||||
{
|
||||
|
||||
Item::Item(uint8_t address, std::string name) :
|
||||
address(address), name(std::move(name))
|
||||
Item::Item(uint8_t address, std::string name) :
|
||||
address(address), name(std::move(name))
|
||||
{}
|
||||
|
||||
uint8_t Item::get_address() const
|
||||
@@ -29,3 +30,4 @@ std::string Item::get_name() const
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
44
FlippR-Driver/src/output/items/impl/Item.h
Normal file
44
FlippR-Driver/src/output/items/impl/Item.h
Normal file
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* CabinetItem.h
|
||||
*
|
||||
* Created on: Aug 2, 2018
|
||||
* Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
|
||||
*/
|
||||
|
||||
#ifndef _SRC_OUTPUT_CABINETITEM_H_
|
||||
#define _SRC_OUTPUT_CABINETITEM_H_
|
||||
|
||||
#include "output/items/Item.h"
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
namespace flippR_driver
|
||||
{
|
||||
namespace output
|
||||
{
|
||||
namespace items
|
||||
{
|
||||
namespace impl
|
||||
{
|
||||
|
||||
class Item : public items::Item
|
||||
{
|
||||
public:
|
||||
Item(uint8_t address, std::string name);
|
||||
~Item() override = default;
|
||||
|
||||
uint8_t get_address() const override;
|
||||
std::string get_name() const override;
|
||||
|
||||
protected:
|
||||
const uint8_t address;
|
||||
const std::string name;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
} /* namespace output */
|
||||
}
|
||||
#endif
|
||||
@@ -7,15 +7,16 @@
|
||||
|
||||
#include "Lamp.h"
|
||||
|
||||
#include "output/OutputPinController.h"
|
||||
namespace flippR_driver
|
||||
{
|
||||
namespace output
|
||||
{
|
||||
namespace items
|
||||
{
|
||||
namespace impl
|
||||
{
|
||||
|
||||
Lamp::Lamp(std::shared_ptr<DriverBoardPinController> pin_controller, uint8_t address, std::string name) :
|
||||
Lamp::Lamp(std::shared_ptr<DriverBoardPinController> pin_controller, uint8_t address, std::string name) :
|
||||
DriverBoardItem(std::move(pin_controller), address, std::move(name)), activated(false)
|
||||
{}
|
||||
|
||||
@@ -29,6 +30,7 @@ void Lamp::deactivate()
|
||||
pin_controller->deactivate(*this);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
} /* namespace output */
|
||||
}
|
||||
@@ -8,8 +8,8 @@
|
||||
#ifndef _SRC_OUTPUT_LAMP_H_
|
||||
#define _SRC_OUTPUT_LAMP_H_
|
||||
|
||||
#include "output/items/ILamp.h"
|
||||
#include "DriverBoardItem.h"
|
||||
#include "output/items/Lamp.h"
|
||||
#include "output/items/DriverBoardItem.h"
|
||||
|
||||
namespace flippR_driver
|
||||
{
|
||||
@@ -17,8 +17,10 @@ namespace output
|
||||
{
|
||||
namespace items
|
||||
{
|
||||
namespace impl
|
||||
{
|
||||
|
||||
class Lamp : public DriverBoardItem, public ILamp
|
||||
class Lamp : public DriverBoardItem, public items::Lamp
|
||||
{
|
||||
public:
|
||||
Lamp(std::shared_ptr<DriverBoardPinController> pin_controller, uint8_t address, std::string name);
|
||||
@@ -32,6 +34,7 @@ private:
|
||||
bool activated;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
} /* namespace output */
|
||||
}
|
||||
@@ -5,16 +5,21 @@
|
||||
#ifndef FLIPPR_DRIVER_SEVENDIGITDISPLAY_H
|
||||
#define FLIPPR_DRIVER_SEVENDIGITDISPLAY_H
|
||||
|
||||
#include "output/items/SevenDigitDisplay.h"
|
||||
|
||||
namespace flippr_driver
|
||||
{
|
||||
namespace output
|
||||
{
|
||||
namespace items
|
||||
{
|
||||
namespace impl
|
||||
{
|
||||
|
||||
class SevenDigitDisplay : public Display<7>, ISevenDigitDisplay;
|
||||
class SevenDigitDisplay : public Display<7>, SevenDigitDisplay;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif //FLIPPR_DRIVER_SEVENDIGITDISPLAY_H
|
||||
@@ -7,17 +7,18 @@
|
||||
|
||||
#include "Solenoid.h"
|
||||
|
||||
#include "output/OutputPinController.h"
|
||||
|
||||
namespace flippR_driver
|
||||
{
|
||||
namespace output
|
||||
{
|
||||
namespace items
|
||||
{
|
||||
namespace impl
|
||||
{
|
||||
|
||||
Solenoid::Solenoid(std::shared_ptr<DriverBoardPinController> pin_controller, uint8_t address, std::string name, std::chrono::milliseconds deactivation_time):
|
||||
DriverBoardItem(std::move(pin_controller), address, std::move(name)), deactivation_time(deactivation_time)
|
||||
Solenoid::Solenoid(std::shared_ptr<DriverBoardPinController> pin_controller, uint8_t address, std::string name, std::chrono::milliseconds deactivation_time)
|
||||
:
|
||||
DriverBoardItem(std::move(pin_controller), address, std::move(name)), deactivation_time(deactivation_time)
|
||||
{}
|
||||
|
||||
void Solenoid::triggerTask()
|
||||
@@ -34,6 +35,7 @@ void Solenoid::trigger()
|
||||
this->trigger_task = std::async(std::launch::async, &Solenoid::triggerTask, this);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
} /* namespace output */
|
||||
}
|
||||
@@ -8,8 +8,8 @@
|
||||
#ifndef _SRC_OUTPUT_SOLENOID_H_
|
||||
#define _SRC_OUTPUT_SOLENOID_H_
|
||||
|
||||
#include "output/items/ISolenoid.h"
|
||||
#include "DriverBoardItem.h"
|
||||
#include "output/items/Solenoid.h"
|
||||
#include "output/items/DriverBoardItem.h"
|
||||
|
||||
#include <future>
|
||||
#include <chrono>
|
||||
@@ -20,8 +20,10 @@ namespace output
|
||||
{
|
||||
namespace items
|
||||
{
|
||||
namespace impl
|
||||
{
|
||||
|
||||
class Solenoid : public DriverBoardItem, public ISolenoid
|
||||
class Solenoid : public DriverBoardItem, public items::Solenoid
|
||||
{
|
||||
public:
|
||||
Solenoid(std::shared_ptr<DriverBoardPinController> pin_controller, u_int8_t address, std::string name, std::chrono::milliseconds deactivation_time);
|
||||
@@ -39,6 +41,7 @@ private:
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
} /* namespace output */
|
||||
}
|
||||
}
|
||||
@@ -15,9 +15,12 @@ namespace output
|
||||
{
|
||||
namespace items
|
||||
{
|
||||
namespace impl
|
||||
{
|
||||
|
||||
Sound::Sound(std::shared_ptr<SoundBoardPinController> pin_controller, uint8_t address, std::string name, std::chrono::milliseconds deactivation_time, u_int id) :
|
||||
pin_controller(std::move(pin_controller)), Item(address, std::move(name)), deactivation_time(deactivation_time), id(id)
|
||||
Sound::Sound(std::shared_ptr<SoundBoardPinController> pin_controller, uint8_t address, std::string name, std::chrono::milliseconds deactivation_time, u_int id)
|
||||
:
|
||||
pin_controller(std::move(pin_controller)), Item(address, std::move(name)), deactivation_time(deactivation_time), id(id)
|
||||
{}
|
||||
|
||||
void Sound::play()
|
||||
@@ -34,6 +37,7 @@ void Sound::playTask()
|
||||
pin_controller->deactivate(*this);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
} /* namespace output */
|
||||
}
|
||||
@@ -8,8 +8,8 @@
|
||||
#ifndef _SRC_OUTPUT_SOUND_H_
|
||||
#define _SRC_OUTPUT_SOUND_H_
|
||||
|
||||
#include "output/items/ISound.h"
|
||||
#include "output/items/Item.h"
|
||||
#include "output/items/Sound.h"
|
||||
#include "Item.h"
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
@@ -25,8 +25,10 @@ class SoundBoardPinController;
|
||||
|
||||
namespace items
|
||||
{
|
||||
namespace impl
|
||||
{
|
||||
|
||||
class Sound : public Item, public ISound
|
||||
class Sound : public Item, public items::Sound
|
||||
{
|
||||
public:
|
||||
u_int id;
|
||||
@@ -48,6 +50,7 @@ private:
|
||||
virtual void playTask();
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
} /* namespace output */
|
||||
}
|
||||
Reference in New Issue
Block a user