namespace refactored
This commit is contained in:
@@ -11,23 +11,28 @@
|
|||||||
#include "ICabinetItem.h"
|
#include "ICabinetItem.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
namespace output {
|
|
||||||
|
|
||||||
class CabinetItem : public ICabinetItem {
|
namespace FlippR_Driver
|
||||||
public:
|
{
|
||||||
CabinetItem();
|
namespace output
|
||||||
virtual ~CabinetItem();
|
{
|
||||||
virtual bool isActivated();
|
|
||||||
virtual bool activate();
|
|
||||||
virtual bool deactivate();
|
|
||||||
|
|
||||||
protected:
|
class CabinetItem : public ICabinetItem
|
||||||
int address;
|
{
|
||||||
std::string name;
|
public:
|
||||||
|
CabinetItem();
|
||||||
|
virtual ~CabinetItem();
|
||||||
|
virtual bool isActivated();
|
||||||
|
virtual bool activate();
|
||||||
|
virtual bool deactivate();
|
||||||
|
|
||||||
bool activated;
|
protected:
|
||||||
};
|
int address;
|
||||||
|
std::string name;
|
||||||
|
|
||||||
|
bool activated;
|
||||||
|
};
|
||||||
|
|
||||||
} /* namespace output */
|
} /* namespace output */
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -6,16 +6,21 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "Display.h"
|
#include "Display.h"
|
||||||
|
namespace FlippR_Driver
|
||||||
|
{
|
||||||
|
namespace output
|
||||||
|
{
|
||||||
|
|
||||||
namespace output {
|
Display::Display()
|
||||||
|
{
|
||||||
|
// TODO Auto-generated constructor stub
|
||||||
|
|
||||||
Display::Display() {
|
}
|
||||||
// TODO Auto-generated constructor stub
|
|
||||||
|
|
||||||
}
|
Display::~Display()
|
||||||
|
{
|
||||||
Display::~Display() {
|
// TODO Auto-generated destructor stub
|
||||||
// TODO Auto-generated destructor stub
|
}
|
||||||
}
|
|
||||||
|
|
||||||
} /* namespace output */
|
} /* namespace output */
|
||||||
|
}
|
||||||
@@ -10,24 +10,32 @@
|
|||||||
|
|
||||||
#include "IDisplay.h"
|
#include "IDisplay.h"
|
||||||
|
|
||||||
namespace output {
|
#include <array>
|
||||||
|
|
||||||
class Display: public IDisplay {
|
namespace FlippR_Driver
|
||||||
|
{
|
||||||
|
namespace output
|
||||||
|
{
|
||||||
|
template <int DigitCount>
|
||||||
|
class Display : public IDisplay
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
Display();
|
Display();
|
||||||
virtual ~Display();
|
virtual ~Display();
|
||||||
|
|
||||||
virtual int getID();
|
virtual int getID();
|
||||||
virtual void write();
|
|
||||||
|
virtual void write_score(int score);
|
||||||
|
virtual void write_content(std::array<char, DigitCount> content);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
int score;
|
std::array<char, DigitCount> content;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int address;
|
int address;
|
||||||
int id;
|
int id;
|
||||||
};
|
};
|
||||||
|
|
||||||
} /* namespace output */
|
} /* namespace output */
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -7,17 +7,21 @@
|
|||||||
|
|
||||||
#include "DisplayController.h"
|
#include "DisplayController.h"
|
||||||
|
|
||||||
|
namespace FlippR_Driver
|
||||||
|
{
|
||||||
namespace output
|
namespace output
|
||||||
{
|
{
|
||||||
|
|
||||||
DisplayController::DisplayController() {
|
DisplayController::DisplayController()
|
||||||
// TODO Auto-generated constructor stub
|
{
|
||||||
|
// TODO Auto-generated constructor stub
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DisplayController::~DisplayController() {
|
DisplayController::~DisplayController()
|
||||||
// TODO Auto-generated destructor stub
|
{
|
||||||
|
// TODO Auto-generated destructor stub
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -14,17 +14,25 @@
|
|||||||
#include "IDisplay.h"
|
#include "IDisplay.h"
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
|
|
||||||
|
namespace FlippR_Driver
|
||||||
|
{
|
||||||
namespace output
|
namespace output
|
||||||
{
|
{
|
||||||
|
|
||||||
class DisplayController: public IDisplayController {
|
class DisplayController : public IDisplayController
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
DisplayController();
|
DisplayController();
|
||||||
virtual ~DisplayController();
|
virtual ~DisplayController();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::array<std::unique_ptr<IDisplay>, NUMBER_OF_DISPLAYS> displays;
|
void cycleDisplays();
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::vector<std::shared_ptr<IDisplay>> displays;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -9,6 +9,11 @@
|
|||||||
#define _SRC_OUTPUT_ICABINETITEM_H_
|
#define _SRC_OUTPUT_ICABINETITEM_H_
|
||||||
|
|
||||||
|
|
||||||
|
namespace FlippR_Driver
|
||||||
|
{
|
||||||
|
namespace output
|
||||||
|
{
|
||||||
|
|
||||||
class ICabinetItem
|
class ICabinetItem
|
||||||
{
|
{
|
||||||
virtual ~ICabinetItem();
|
virtual ~ICabinetItem();
|
||||||
@@ -17,5 +22,7 @@ class ICabinetItem
|
|||||||
virtual bool deactivate() = 0;
|
virtual bool deactivate() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -8,9 +8,13 @@
|
|||||||
#ifndef _SRC_OUTPUT_IDISPLAY_H_
|
#ifndef _SRC_OUTPUT_IDISPLAY_H_
|
||||||
#define _SRC_OUTPUT_IDISPLAY_H_
|
#define _SRC_OUTPUT_IDISPLAY_H_
|
||||||
|
|
||||||
namespace output {
|
namespace FlippR_Driver
|
||||||
|
{
|
||||||
|
namespace output
|
||||||
|
{
|
||||||
|
|
||||||
class IDisplay {
|
class IDisplay
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
IDisplay();
|
IDisplay();
|
||||||
virtual ~IDisplay();
|
virtual ~IDisplay();
|
||||||
@@ -21,5 +25,5 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
} /* namespace output */
|
} /* namespace output */
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -7,15 +7,18 @@
|
|||||||
|
|
||||||
#ifndef _SRC_OUTPUT_IDISPLAYCONTROLLER_H_
|
#ifndef _SRC_OUTPUT_IDISPLAYCONTROLLER_H_
|
||||||
#define _SRC_OUTPUT_IDISPLAYCONTROLLER_H_
|
#define _SRC_OUTPUT_IDISPLAYCONTROLLER_H_
|
||||||
|
namespace FlippR_Driver
|
||||||
|
{
|
||||||
|
namespace output
|
||||||
|
{
|
||||||
|
|
||||||
namespace output {
|
class IDisplayController
|
||||||
|
{
|
||||||
class IDisplayController {
|
|
||||||
public:
|
public:
|
||||||
IDisplayController();
|
IDisplayController();
|
||||||
virtual ~IDisplayController();
|
virtual ~IDisplayController();
|
||||||
};
|
};
|
||||||
|
|
||||||
} /* namespace output */
|
} /* namespace output */
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -8,10 +8,17 @@
|
|||||||
#ifndef _SRC_OUTPUT_ILAMP_H_
|
#ifndef _SRC_OUTPUT_ILAMP_H_
|
||||||
#define _SRC_OUTPUT_ILAMP_H_
|
#define _SRC_OUTPUT_ILAMP_H_
|
||||||
|
|
||||||
|
namespace FlippR_Driver
|
||||||
|
{
|
||||||
|
namespace output
|
||||||
|
{
|
||||||
|
|
||||||
class ILamp
|
class ILamp
|
||||||
{
|
{
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -8,14 +8,18 @@
|
|||||||
#ifndef _SRC_OUTPUT_IOUTPUTDRIVER_H_
|
#ifndef _SRC_OUTPUT_IOUTPUTDRIVER_H_
|
||||||
#define _SRC_OUTPUT_IOUTPUTDRIVER_H_
|
#define _SRC_OUTPUT_IOUTPUTDRIVER_H_
|
||||||
|
|
||||||
namespace output {
|
namespace FlippR_Driver
|
||||||
|
{
|
||||||
|
namespace output
|
||||||
|
{
|
||||||
|
|
||||||
class IOutputDriver {
|
class IOutputDriver
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
IOutputDriver();
|
IOutputDriver();
|
||||||
virtual ~IOutputDriver();
|
virtual ~IOutputDriver();
|
||||||
};
|
};
|
||||||
|
|
||||||
} /* namespace output */
|
} /* namespace output */
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -8,11 +8,17 @@
|
|||||||
#ifndef _SRC_OUTPUT_ISOLENOID_H_
|
#ifndef _SRC_OUTPUT_ISOLENOID_H_
|
||||||
#define _SRC_OUTPUT_ISOLENOID_H_
|
#define _SRC_OUTPUT_ISOLENOID_H_
|
||||||
|
|
||||||
|
namespace FlippR_Driver
|
||||||
|
{
|
||||||
|
namespace output
|
||||||
|
{
|
||||||
|
|
||||||
class ISolenoid
|
class ISolenoid
|
||||||
{
|
{
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -8,9 +8,13 @@
|
|||||||
#ifndef _SRC_OUTPUT_ISOUND_H_
|
#ifndef _SRC_OUTPUT_ISOUND_H_
|
||||||
#define _SRC_OUTPUT_ISOUND_H_
|
#define _SRC_OUTPUT_ISOUND_H_
|
||||||
|
|
||||||
namespace output {
|
namespace FlippR_Driver
|
||||||
|
{
|
||||||
|
namespace output
|
||||||
|
{
|
||||||
|
|
||||||
class ISound {
|
class ISound
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
ISound();
|
ISound();
|
||||||
virtual ~ISound();
|
virtual ~ISound();
|
||||||
@@ -19,5 +23,5 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
} /* namespace output */
|
} /* namespace output */
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -7,15 +7,21 @@
|
|||||||
|
|
||||||
#include "Lamp.h"
|
#include "Lamp.h"
|
||||||
|
|
||||||
namespace output {
|
namespace FlippR_Driver
|
||||||
|
{
|
||||||
|
namespace output
|
||||||
|
{
|
||||||
|
|
||||||
Lamp::Lamp() {
|
Lamp::Lamp()
|
||||||
// TODO Auto-generated constructor stub
|
{
|
||||||
|
// TODO Auto-generated constructor stub
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Lamp::~Lamp() {
|
Lamp::~Lamp()
|
||||||
// TODO Auto-generated destructor stub
|
{
|
||||||
|
// TODO Auto-generated destructor stub
|
||||||
}
|
}
|
||||||
|
|
||||||
} /* namespace output */
|
} /* namespace output */
|
||||||
|
}
|
||||||
@@ -10,14 +10,18 @@
|
|||||||
|
|
||||||
#include "CabinetItem.h"
|
#include "CabinetItem.h"
|
||||||
|
|
||||||
namespace output {
|
namespace FlippR_Driver
|
||||||
|
{
|
||||||
|
namespace output
|
||||||
|
{
|
||||||
|
|
||||||
class Lamp: public CabinetItem {
|
class Lamp : public CabinetItem
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
Lamp();
|
Lamp();
|
||||||
virtual ~Lamp();
|
virtual ~Lamp();
|
||||||
};
|
};
|
||||||
|
|
||||||
} /* namespace output */
|
} /* namespace output */
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -7,15 +7,21 @@
|
|||||||
|
|
||||||
#include "OutputDriver.h"
|
#include "OutputDriver.h"
|
||||||
|
|
||||||
namespace output {
|
namespace FlippR_Driver
|
||||||
|
{
|
||||||
|
namespace output
|
||||||
|
{
|
||||||
|
|
||||||
OutputDriver::OutputDriver() {
|
OutputDriver::OutputDriver()
|
||||||
// TODO Auto-generated constructor stub
|
{
|
||||||
|
// TODO Auto-generated constructor stub
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
OutputDriver::~OutputDriver() {
|
OutputDriver::~OutputDriver()
|
||||||
// TODO Auto-generated destructor stub
|
{
|
||||||
|
// TODO Auto-generated destructor stub
|
||||||
}
|
}
|
||||||
|
|
||||||
} /* namespace output */
|
} /* namespace output */
|
||||||
|
}
|
||||||
@@ -17,9 +17,13 @@
|
|||||||
#include "IDisplay.h"
|
#include "IDisplay.h"
|
||||||
#include "ISound.h"
|
#include "ISound.h"
|
||||||
|
|
||||||
namespace output {
|
namespace FlippR_Driver
|
||||||
|
{
|
||||||
|
namespace output
|
||||||
|
{
|
||||||
|
|
||||||
class OutputDriver: public IOutputDriver {
|
class OutputDriver : public IOutputDriver
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
OutputDriver();
|
OutputDriver();
|
||||||
virtual ~OutputDriver();
|
virtual ~OutputDriver();
|
||||||
@@ -39,5 +43,5 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
} /* namespace output */
|
} /* namespace output */
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
13
FlippR-Driver/src/output/OutputDriverFactory.cpp
Normal file
13
FlippR-Driver/src/output/OutputDriverFactory.cpp
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
//
|
||||||
|
// Created by rhetenor on 04.10.18.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "OutputDriverFactory.h"
|
||||||
|
|
||||||
|
namespace FlippR_Driver
|
||||||
|
{
|
||||||
|
namespace output
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
20
FlippR-Driver/src/output/OutputDriverFactory.h
Normal file
20
FlippR-Driver/src/output/OutputDriverFactory.h
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
//
|
||||||
|
// Created by rhetenor on 04.10.18.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef FLIPPR_DRIVER_OUTPUTDRIVERFACTORY_H
|
||||||
|
#define FLIPPR_DRIVER_OUTPUTDRIVERFACTORY_H
|
||||||
|
|
||||||
|
namespace FlippR_Driver
|
||||||
|
{
|
||||||
|
namespace output
|
||||||
|
{
|
||||||
|
class OutputDriverFactory
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
std::shared_ptr <OutputDriver> getOutputDriver(std::ifstream &output_gpio_config, std::ifstream &output_config);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif //FLIPPR_DRIVER_OUTPUTDRIVERFACTORY_H
|
||||||
@@ -7,6 +7,8 @@
|
|||||||
|
|
||||||
#include "Solenoid.h"
|
#include "Solenoid.h"
|
||||||
|
|
||||||
|
namespace FlippR_Driver
|
||||||
|
{
|
||||||
namespace output {
|
namespace output {
|
||||||
|
|
||||||
Solenoid::Solenoid() {
|
Solenoid::Solenoid() {
|
||||||
@@ -19,3 +21,4 @@ Solenoid::~Solenoid() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} /* namespace output */
|
} /* namespace output */
|
||||||
|
}
|
||||||
|
|||||||
@@ -10,14 +10,18 @@
|
|||||||
|
|
||||||
#include "CabinetItem.h"
|
#include "CabinetItem.h"
|
||||||
|
|
||||||
namespace output {
|
namespace FlippR_Driver
|
||||||
|
{
|
||||||
|
namespace output
|
||||||
|
{
|
||||||
|
|
||||||
class Solenoid: public CabinetItem {
|
class Solenoid : public CabinetItem
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
Solenoid();
|
Solenoid();
|
||||||
virtual ~Solenoid();
|
virtual ~Solenoid();
|
||||||
};
|
};
|
||||||
|
|
||||||
} /* namespace output */
|
} /* namespace output */
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -7,6 +7,8 @@
|
|||||||
|
|
||||||
#include "Sound.h"
|
#include "Sound.h"
|
||||||
|
|
||||||
|
namespace FlippR_Driver
|
||||||
|
{
|
||||||
namespace output {
|
namespace output {
|
||||||
|
|
||||||
Sound::Sound() {
|
Sound::Sound() {
|
||||||
@@ -19,3 +21,4 @@ Sound::~Sound() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} /* namespace output */
|
} /* namespace output */
|
||||||
|
}
|
||||||
@@ -11,9 +11,14 @@
|
|||||||
#include "ISound.h"
|
#include "ISound.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
namespace output {
|
|
||||||
|
|
||||||
class Sound : ISound {
|
namespace FlippR_Driver
|
||||||
|
{
|
||||||
|
namespace output
|
||||||
|
{
|
||||||
|
|
||||||
|
class Sound : ISound
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
Sound();
|
Sound();
|
||||||
virtual ~Sound();
|
virtual ~Sound();
|
||||||
@@ -26,5 +31,5 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
} /* namespace output */
|
} /* namespace output */
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
Reference in New Issue
Block a user