refactored namespaces
This commit is contained in:
@@ -13,6 +13,8 @@ namespace flippr_driver
|
|||||||
{
|
{
|
||||||
namespace output
|
namespace output
|
||||||
{
|
{
|
||||||
|
namespace items
|
||||||
|
{
|
||||||
|
|
||||||
class IEightDigitDisplay : public IOutputDisplay
|
class IEightDigitDisplay : public IOutputDisplay
|
||||||
{
|
{
|
||||||
@@ -20,6 +22,7 @@ public:
|
|||||||
virtual void write_content(std::array<char, 8> content) = 0;
|
virtual void write_content(std::array<char, 8> content) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif //FLIPPR_DRIVER_IEIGHTDIGITDISPLAY_H
|
#endif //FLIPPR_DRIVER_IEIGHTDIGITDISPLAY_H
|
||||||
@@ -12,17 +12,21 @@ namespace flippR_driver
|
|||||||
{
|
{
|
||||||
namespace output
|
namespace output
|
||||||
{
|
{
|
||||||
|
namespace items
|
||||||
|
{
|
||||||
|
|
||||||
class ILamp
|
class ILamp
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
~ILamp(){};
|
~ILamp()
|
||||||
|
{};
|
||||||
|
|
||||||
void activate();
|
void activate();
|
||||||
void deactivate();
|
void deactivate();
|
||||||
bool is_activated();
|
bool is_activated();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -12,18 +12,22 @@ namespace flippR_driver
|
|||||||
{
|
{
|
||||||
namespace output
|
namespace output
|
||||||
{
|
{
|
||||||
|
namespace items
|
||||||
|
{
|
||||||
|
|
||||||
class IDisplay
|
class IDisplay
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual ~IDisplay() {};
|
virtual ~IDisplay()
|
||||||
|
{};
|
||||||
|
|
||||||
virtual void write_score(int score) = 0;
|
virtual void write_score(int score) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif /* SRC_OUTPUT_IOUTPUTDISPLAY_H_ */
|
#endif /* SRC_OUTPUT_IOUTPUTDISPLAY_H_ */
|
||||||
@@ -13,6 +13,8 @@ namespace flippr_driver
|
|||||||
{
|
{
|
||||||
namespace output
|
namespace output
|
||||||
{
|
{
|
||||||
|
namespace items
|
||||||
|
{
|
||||||
|
|
||||||
class ISevenDigitDisplay : public IOutputDisplay
|
class ISevenDigitDisplay : public IOutputDisplay
|
||||||
{
|
{
|
||||||
@@ -20,6 +22,7 @@ public:
|
|||||||
virtual void write_content(std::array<char, 7> content) = 0;
|
virtual void write_content(std::array<char, 7> content) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif //FLIPPR_DRIVER_ISEVENDIGITDISPLAY_H
|
#endif //FLIPPR_DRIVER_ISEVENDIGITDISPLAY_H
|
||||||
@@ -12,14 +12,18 @@ namespace flippR_driver
|
|||||||
{
|
{
|
||||||
namespace output
|
namespace output
|
||||||
{
|
{
|
||||||
|
namespace items
|
||||||
|
{
|
||||||
|
|
||||||
class ISolenoid
|
class ISolenoid
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
~ISolenoid() {};
|
~ISolenoid()
|
||||||
|
{};
|
||||||
void trigger();
|
void trigger();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -12,6 +12,8 @@ namespace flippR_driver
|
|||||||
{
|
{
|
||||||
namespace output
|
namespace output
|
||||||
{
|
{
|
||||||
|
namespace items
|
||||||
|
{
|
||||||
|
|
||||||
class ISound
|
class ISound
|
||||||
{
|
{
|
||||||
@@ -22,6 +24,7 @@ public:
|
|||||||
virtual void play() = 0;
|
virtual void play() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}
|
||||||
} /* namespace output */
|
} /* namespace output */
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -16,8 +16,10 @@ namespace flippR_driver
|
|||||||
{
|
{
|
||||||
namespace output
|
namespace output
|
||||||
{
|
{
|
||||||
|
namespace items
|
||||||
|
{
|
||||||
|
|
||||||
template <int DigitCount>
|
template<int DigitCount>
|
||||||
class Display : public IDisplay<DigitCount>
|
class Display : public IDisplay<DigitCount>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -36,9 +38,10 @@ private:
|
|||||||
int address;
|
int address;
|
||||||
int id;
|
int id;
|
||||||
|
|
||||||
std::string fit_string(std::string& score_string);
|
std::string fit_string(std::string &score_string);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}
|
||||||
} /* namespace output */
|
} /* namespace output */
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -12,6 +12,8 @@ namespace flippR_driver
|
|||||||
{
|
{
|
||||||
namespace output
|
namespace output
|
||||||
{
|
{
|
||||||
|
namespace items
|
||||||
|
{
|
||||||
|
|
||||||
template<int DigitCount>
|
template<int DigitCount>
|
||||||
Display<DigitCount>::Display(int address, int id) :
|
Display<DigitCount>::Display(int address, int id) :
|
||||||
@@ -61,3 +63,4 @@ void Display<DigitCount>::write_content( std::array<char, DigitCount> content)
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@@ -11,9 +11,12 @@ namespace flippr_driver
|
|||||||
{
|
{
|
||||||
namespace output
|
namespace output
|
||||||
{
|
{
|
||||||
|
namespace items
|
||||||
|
{
|
||||||
|
|
||||||
class EightDigitDisplay : public Display<8>, IEightDigitDisplay;
|
class EightDigitDisplay : public Display<8>, IEightDigitDisplay;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif //FLIPPR_DRIVER_EIGHTDIGITDISPLAY_H
|
#endif //FLIPPR_DRIVER_EIGHTDIGITDISPLAY_H
|
||||||
@@ -14,6 +14,8 @@ namespace flippR_driver
|
|||||||
{
|
{
|
||||||
namespace output
|
namespace output
|
||||||
{
|
{
|
||||||
|
namespace items
|
||||||
|
{
|
||||||
|
|
||||||
class IDisplay
|
class IDisplay
|
||||||
{
|
{
|
||||||
@@ -23,10 +25,9 @@ public:
|
|||||||
virtual ~IDisplay();
|
virtual ~IDisplay();
|
||||||
|
|
||||||
virtual int getID() = 0;
|
virtual int getID() = 0;
|
||||||
|
|
||||||
virtual
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}
|
||||||
} /* namespace output */
|
} /* namespace output */
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -12,6 +12,8 @@ namespace flippR_driver
|
|||||||
{
|
{
|
||||||
namespace output
|
namespace output
|
||||||
{
|
{
|
||||||
|
namespace items
|
||||||
|
{
|
||||||
|
|
||||||
class IDisplay
|
class IDisplay
|
||||||
{
|
{
|
||||||
@@ -26,6 +28,7 @@ public:
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif /* SRC_OUTPUT_IOUTPUTDISPLAY_H_ */
|
#endif /* SRC_OUTPUT_IOUTPUTDISPLAY_H_ */
|
||||||
@@ -13,6 +13,8 @@ namespace flippR_driver
|
|||||||
{
|
{
|
||||||
namespace output
|
namespace output
|
||||||
{
|
{
|
||||||
|
namespace items
|
||||||
|
{
|
||||||
|
|
||||||
class IOutputItem
|
class IOutputItem
|
||||||
{
|
{
|
||||||
@@ -22,6 +24,7 @@ class IOutputItem
|
|||||||
virtual bool deactivate() = 0;
|
virtual bool deactivate() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -11,13 +11,13 @@ namespace flippR_driver
|
|||||||
{
|
{
|
||||||
namespace output
|
namespace output
|
||||||
{
|
{
|
||||||
|
namespace items
|
||||||
|
{
|
||||||
|
|
||||||
Lamp::Lamp(std::shared_ptr<utility::IOutputGPIOInterface> output_gpio_interface, int i2c_address, int data_pin, std::string name, bool activated) :
|
Lamp::Lamp(std::shared_ptr<utility::IOutputGPIOInterface> output_gpio_interface, int i2c_address, int data_pin, std::string name, bool activated)
|
||||||
OutputItem(output_gpio_interface, i2c_address, data_pin, name),
|
:
|
||||||
activated(activated)
|
OutputItem(output_gpio_interface, i2c_address, data_pin, name),
|
||||||
{}
|
activated(activated)
|
||||||
|
|
||||||
Lamp::~Lamp()
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void Lamp::activate()
|
void Lamp::activate()
|
||||||
@@ -25,12 +25,11 @@ void Lamp::activate()
|
|||||||
OutputItem::activate();
|
OutputItem::activate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Lamp::deactivate()
|
void Lamp::deactivate()
|
||||||
{
|
{
|
||||||
OutputItem::deactivate();
|
OutputItem::deactivate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
} /* namespace output */
|
} /* namespace output */
|
||||||
}
|
}
|
||||||
@@ -15,12 +15,14 @@ namespace flippR_driver
|
|||||||
{
|
{
|
||||||
namespace output
|
namespace output
|
||||||
{
|
{
|
||||||
|
namespace items
|
||||||
|
{
|
||||||
|
|
||||||
class Lamp : public OutputItem, ILamp
|
class Lamp : public OutputItem, ILamp
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Lamp(std::shared_ptr<utility::IOutputGPIOInterface> output_gpio_interface, int i2c_address, int data_pin, std::string name, bool activated = false);
|
Lamp(std::shared_ptr<utility::IOutputGPIOInterface> output_gpio_interface, int i2c_address, int data_pin, std::string name, bool activated = false);
|
||||||
virtual ~Lamp();
|
virtual ~Lamp() = default;
|
||||||
|
|
||||||
void activate();
|
void activate();
|
||||||
void deactivate();
|
void deactivate();
|
||||||
@@ -30,6 +32,7 @@ private:
|
|||||||
bool activated;
|
bool activated;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}
|
||||||
} /* namespace output */
|
} /* namespace output */
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -19,6 +19,8 @@ namespace flippR_driver
|
|||||||
{
|
{
|
||||||
namespace output
|
namespace output
|
||||||
{
|
{
|
||||||
|
namespace items
|
||||||
|
{
|
||||||
|
|
||||||
class OutputItem : public IOutputItem
|
class OutputItem : public IOutputItem
|
||||||
{
|
{
|
||||||
@@ -36,6 +38,7 @@ protected:
|
|||||||
void deactivate();
|
void deactivate();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}
|
||||||
} /* namespace output */
|
} /* namespace output */
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -9,9 +9,12 @@ namespace flippr_driver
|
|||||||
{
|
{
|
||||||
namespace output
|
namespace output
|
||||||
{
|
{
|
||||||
|
namespace items
|
||||||
|
{
|
||||||
|
|
||||||
class SevenDigitDisplay : public Display<7>, ISevenDigitDisplay;
|
class SevenDigitDisplay : public Display<7>, ISevenDigitDisplay;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif //FLIPPR_DRIVER_SEVENDIGITDISPLAY_H
|
#endif //FLIPPR_DRIVER_SEVENDIGITDISPLAY_H
|
||||||
@@ -9,20 +9,15 @@
|
|||||||
|
|
||||||
namespace flippR_driver
|
namespace flippR_driver
|
||||||
{
|
{
|
||||||
namespace output {
|
namespace output
|
||||||
|
|
||||||
Solenoid::Solenoid(std::shared_ptr<utility::IOutputGPIOInterface> output_gpio_interface, int i2c_address, int data_pin, std::string name, std::chrono::milliseconds deactivation_time) :
|
|
||||||
OutputItem(output_gpio_interface, i2c_address, data_pin, name),
|
|
||||||
deactivation_time(deactivation_time)
|
|
||||||
{
|
{
|
||||||
// TODO Auto-generated constructor stub
|
namespace items
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
Solenoid::~Solenoid()
|
|
||||||
{
|
{
|
||||||
// TODO Auto-generated destructor stub
|
Solenoid::Solenoid(std::shared_ptr<utility::IOutputGPIOInterface> output_gpio_interface, int i2c_address, int data_pin, std::string name, std::chrono::milliseconds deactivation_time)
|
||||||
}
|
:
|
||||||
|
OutputItem(output_gpio_interface, i2c_address, data_pin, name),
|
||||||
|
deactivation_time(deactivation_time)
|
||||||
|
{}
|
||||||
|
|
||||||
void Solenoid::triggerTask()
|
void Solenoid::triggerTask()
|
||||||
{
|
{
|
||||||
@@ -37,5 +32,6 @@ void Solenoid::trigger()
|
|||||||
std::async(std::launch::async, &Solenoid::triggerTask);
|
std::async(std::launch::async, &Solenoid::triggerTask);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
} /* namespace output */
|
} /* namespace output */
|
||||||
}
|
}
|
||||||
@@ -19,18 +19,21 @@ namespace flippR_driver
|
|||||||
{
|
{
|
||||||
namespace output
|
namespace output
|
||||||
{
|
{
|
||||||
|
namespace items
|
||||||
|
{
|
||||||
|
|
||||||
class Solenoid : public ISolenoid, OutputItem
|
class Solenoid : public ISolenoid, OutputItem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Solenoid(std::shared_ptr<utility::IOutputGPIOInterface> output_gpio_interface, int i2c_address, int data_pin, std::string name, std::chrono::milliseconds deactivation_time);
|
Solenoid(std::shared_ptr<utility::IOutputGPIOInterface> output_gpio_interface, int i2c_address, int data_pin, std::string name, std::chrono::milliseconds deactivation_time);
|
||||||
virtual ~Solenoid();
|
virtual ~Solenoid() = default;
|
||||||
|
|
||||||
void trigger();
|
void trigger();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
virtual void triggerTask();
|
virtual void triggerTask();
|
||||||
|
|
||||||
|
}
|
||||||
} /* namespace output */
|
} /* namespace output */
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -13,9 +13,12 @@ namespace flippR_driver
|
|||||||
{
|
{
|
||||||
namespace output
|
namespace output
|
||||||
{
|
{
|
||||||
|
namespace items
|
||||||
|
{
|
||||||
|
|
||||||
Sound::Sound(std::shared_ptr<utility::IOutputGPIOInterface> output_gpio_interface, int i2c_address, int data_pin, std::string name) :
|
Sound::Sound(std::shared_ptr<utility::IOutputGPIOInterface> output_gpio_interface, int i2c_address, int data_pin, std::string name)
|
||||||
OutputItem(output_gpio_interface, i2c_address, data_pin, name)
|
:
|
||||||
|
OutputItem(output_gpio_interface, i2c_address, data_pin, name)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void Sound::play()
|
void Sound::play()
|
||||||
@@ -32,5 +35,6 @@ void Sound::playTask()
|
|||||||
OutputItem::deactivate();
|
OutputItem::deactivate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
} /* namespace output */
|
} /* namespace output */
|
||||||
}
|
}
|
||||||
@@ -19,6 +19,8 @@ namespace flippR_driver
|
|||||||
{
|
{
|
||||||
namespace output
|
namespace output
|
||||||
{
|
{
|
||||||
|
namespace items
|
||||||
|
{
|
||||||
|
|
||||||
class Sound : public ISound, OutputItem
|
class Sound : public ISound, OutputItem
|
||||||
{
|
{
|
||||||
@@ -32,6 +34,7 @@ private:
|
|||||||
virtual void playTask();
|
virtual void playTask();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}
|
||||||
} /* namespace output */
|
} /* namespace output */
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
Reference in New Issue
Block a user