mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
Removed bootsequence library
Former-commit-id: 5f3f927236a26ae00299a8e7a914e98ace3b328a
This commit is contained in:
parent
a20dcbfe8c
commit
2efd751c76
@ -1,24 +0,0 @@
|
||||
#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;
|
||||
};
|
@ -1,29 +0,0 @@
|
||||
#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);
|
||||
};
|
@ -3,7 +3,6 @@
|
||||
SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include)
|
||||
SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc)
|
||||
|
||||
add_subdirectory(bootsequence)
|
||||
add_subdirectory(hyperion)
|
||||
add_subdirectory(jsonserver)
|
||||
add_subdirectory(protoserver)
|
||||
|
@ -1,28 +0,0 @@
|
||||
// stl includes
|
||||
#include <cctype>
|
||||
#include <algorithm>
|
||||
|
||||
// Bootsequence includes
|
||||
#include <bootsequence/BootSequenceFactory.h>
|
||||
|
||||
// Effect engine includes
|
||||
#include <effectengine/EffectEngine.h>
|
||||
|
||||
// Local Bootsequence includes
|
||||
#include "EffectBootSequence.h"
|
||||
|
||||
BootSequence * BootSequenceFactory::createBootSequence(Hyperion * hyperion, const Json::Value & jsonConfig)
|
||||
{
|
||||
const std::string path = jsonConfig["path"].asString();
|
||||
const std::string effectFile = jsonConfig["effect"].asString();
|
||||
const unsigned duration = jsonConfig["duration_ms"].asUInt();
|
||||
|
||||
EffectDefinition effect;
|
||||
if (EffectEngine::loadEffectDefinition(path, effectFile, effect))
|
||||
{
|
||||
return new EffectBootSequence(hyperion, effect, duration);
|
||||
}
|
||||
|
||||
std::cerr << "Boot sequence could not be loaded" << std::endl;
|
||||
return nullptr;
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
|
||||
# Define the current source locations
|
||||
SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/bootsequence)
|
||||
SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/bootsequence)
|
||||
|
||||
# Group the headers that go through the MOC compiler
|
||||
SET(BootsequenceHEADERS
|
||||
${CURRENT_HEADER_DIR}/BootSequence.h
|
||||
${CURRENT_HEADER_DIR}/BootSequenceFactory.h
|
||||
${CURRENT_SOURCE_DIR}/EffectBootSequence.h
|
||||
)
|
||||
|
||||
SET(BootsequenceSOURCES
|
||||
${CURRENT_SOURCE_DIR}/BootSequenceFactory.cpp
|
||||
${CURRENT_SOURCE_DIR}/EffectBootSequence.cpp
|
||||
)
|
||||
|
||||
add_library(bootsequence
|
||||
${BootsequenceHEADERS}
|
||||
${BootsequenceSOURCES}
|
||||
)
|
||||
|
||||
target_link_libraries(bootsequence
|
||||
hyperion
|
||||
${QT_LIBRARIES})
|
@ -1,18 +0,0 @@
|
||||
#include "EffectBootSequence.h"
|
||||
|
||||
EffectBootSequence::EffectBootSequence(Hyperion *hyperion, const EffectDefinition &effect, const unsigned duration_ms) :
|
||||
BootSequence(),
|
||||
_hyperion(hyperion),
|
||||
_effect(effect),
|
||||
_duration_ms(duration_ms)
|
||||
{
|
||||
}
|
||||
|
||||
EffectBootSequence::~EffectBootSequence()
|
||||
{
|
||||
}
|
||||
|
||||
void EffectBootSequence::start()
|
||||
{
|
||||
_hyperion->setEffectScript(_effect.script, _effect.args, 0, _duration_ms);
|
||||
}
|
@ -1,38 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
// Bootsequence include
|
||||
#include <bootsequence/BootSequence.h>
|
||||
|
||||
// Hyperion includes
|
||||
#include <hyperion/Hyperion.h>
|
||||
|
||||
///
|
||||
/// The EffectBootSequence runs a script using the effect engine at startup
|
||||
///
|
||||
class EffectBootSequence : public BootSequence
|
||||
{
|
||||
public:
|
||||
///
|
||||
/// Constructs the effect boot-sequence. The effect engine is used for executing the boot effect. The given
|
||||
/// duration is the length the effect will run.
|
||||
///
|
||||
/// @param[in] hyperion The Hyperion instance
|
||||
/// @param[in] effect The effect definition
|
||||
/// @param[in] duration_ms The length of the sequence [ms]
|
||||
///
|
||||
EffectBootSequence(Hyperion * hyperion, const EffectDefinition & effect, const unsigned duration_ms);
|
||||
virtual ~EffectBootSequence();
|
||||
|
||||
virtual void start();
|
||||
|
||||
private:
|
||||
/// The Hyperion instance
|
||||
Hyperion * _hyperion;
|
||||
|
||||
/// The script to execute
|
||||
const EffectDefinition _effect;
|
||||
|
||||
/// Duration of the boot sequence
|
||||
const unsigned _duration_ms;
|
||||
};
|
||||
|
@ -3,7 +3,6 @@ add_executable(hyperiond
|
||||
hyperiond.cpp)
|
||||
|
||||
target_link_libraries(hyperiond
|
||||
bootsequence
|
||||
hyperion
|
||||
xbmcvideochecker
|
||||
effectengine
|
||||
|
@ -15,9 +15,6 @@
|
||||
// Hyperion includes
|
||||
#include <hyperion/Hyperion.h>
|
||||
|
||||
// Bootsequence includes
|
||||
#include <bootsequence/BootSequenceFactory.h>
|
||||
|
||||
#ifdef ENABLE_DISPMANX
|
||||
// Dispmanx grabber includes
|
||||
#include <dispmanx-grabber/DispmanxWrapper.h>
|
||||
@ -96,14 +93,20 @@ int main(int argc, char** argv)
|
||||
std::cout << "Hyperion created and initialised" << std::endl;
|
||||
|
||||
// create boot sequence if the configuration is present
|
||||
BootSequence * bootSequence = nullptr;
|
||||
if (config.isMember("bootsequence"))
|
||||
{
|
||||
bootSequence = BootSequenceFactory::createBootSequence(&hyperion, config["bootsequence"]);
|
||||
const Json::Value effectConfig = config["bootsequence"];
|
||||
|
||||
if (bootSequence != nullptr)
|
||||
// Get the parameters for the bootsequence
|
||||
const std::string effectName = effectConfig["effect"].asString();
|
||||
const unsigned duration_ms = effectConfig["duration_ms"].asUInt();
|
||||
const int priority = 0;
|
||||
|
||||
// int retVal = -1;
|
||||
// QMetaObject::invokeMethod(hyperion, "setEffect", Q_RETURN_ARG(int, retVal), Q_ARG(std::string, effectName), Q_ARG(Json::Value, Json::Value()), Q_ARG(int, priority), Q_ARG(int, duration_ms));
|
||||
// if (retVal == 0)
|
||||
if (hyperion.setEffect(effectName, Json::Value(), priority, duration_ms) == 0)
|
||||
{
|
||||
bootSequence->start();
|
||||
std::cout << "Boot sequence created and started" << std::endl;
|
||||
}
|
||||
}
|
||||
@ -185,7 +188,6 @@ int main(int argc, char** argv)
|
||||
std::cout << "Application closed with code " << rc << std::endl;
|
||||
|
||||
// Delete all component
|
||||
delete bootSequence;
|
||||
#ifdef ENABLE_DISPMANX
|
||||
delete dispmanx;
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user