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