mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Added factory to boot-sequence
Added json-config for boot-sequence.
This commit is contained in:
24
include/bootsequence/BootSequence.h
Normal file
24
include/bootsequence/BootSequence.h
Normal 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;
|
||||
};
|
29
include/bootsequence/BootSequenceFactory.h
Normal file
29
include/bootsequence/BootSequenceFactory.h
Normal 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);
|
||||
};
|
@@ -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;
|
||||
};
|
||||
|
Reference in New Issue
Block a user