Added factory to boot-sequence

Added json-config for boot-sequence.
This commit is contained in:
T. van der Zwan
2013-08-25 16:20:19 +00:00
parent 213545afe7
commit 4a19095234
9 changed files with 486 additions and 341 deletions

View File

@@ -0,0 +1,24 @@
#pragma once
///
/// Pure virtual base class (or interface) for boot sequences. A BootSequence is started after the
/// Hyperion deamon is started to demonstrate the proper functioninf of the attached leds (and lets
/// face it because it is cool)
///
class BootSequence
{
public:
///
/// Empty virtual destructor for abstract base class
///
virtual ~BootSequence()
{
// empty
}
///
/// Starts the boot sequence writing one or more colors to the attached leds
///
virtual void start() = 0;
};

View File

@@ -0,0 +1,29 @@
#pragma once
// Jsoncpp includes
#include <json/json.h>
// Bootsequence includes
#include <bootsequence/BootSequence.h>
// Hyperion includes
#include <hyperion/Hyperion.h>
///
/// Factory for settings based construction of a boot-sequence
///
class BootSequenceFactory
{
public:
///
/// Creates a BootSequence using the given configuration (and Hyperion connection). Ownship of
/// the returned instance is transferred
///
/// @param[in] hyperion The Hyperion controlling the leds
/// @param[in] jsonConfig The boot-sequence configuration
///
/// @return The bootsequence (ownership is transferred to the caller
///
static BootSequence * createBootSequence(Hyperion * hyperion, const Json::Value & jsonConfig);
};

View File

@@ -1,32 +0,0 @@
#pragma once
// QT includes
#include <QTimer>
// Hyperion includes
#include <hyperion/Hyperion.h>
class RainbowBootSequence : public QObject
{
Q_OBJECT
public:
RainbowBootSequence(Hyperion * hyperion);
void start();
private slots:
void update();
private:
QTimer _timer;
Hyperion * _hyperion;
int _priority;
std::vector<RgbColor> _ledColors;
int _iterationCounter;
};