From 2efd751c764243b1fd3e19c017d023310f866626 Mon Sep 17 00:00:00 2001 From: "T. van der Zwan" Date: Fri, 13 Dec 2013 14:55:34 +0000 Subject: [PATCH] Removed bootsequence library Former-commit-id: 5f3f927236a26ae00299a8e7a914e98ace3b328a --- include/bootsequence/BootSequence.h | 24 ------------- include/bootsequence/BootSequenceFactory.h | 29 ---------------- libsrc/CMakeLists.txt | 1 - libsrc/bootsequence/BootSequenceFactory.cpp | 28 --------------- libsrc/bootsequence/CMakeLists.txt | 25 -------------- libsrc/bootsequence/EffectBootSequence.cpp | 18 ---------- libsrc/bootsequence/EffectBootSequence.h | 38 --------------------- src/hyperiond/CMakeLists.txt | 1 - src/hyperiond/hyperiond.cpp | 18 +++++----- 9 files changed, 10 insertions(+), 172 deletions(-) delete mode 100644 include/bootsequence/BootSequence.h delete mode 100644 include/bootsequence/BootSequenceFactory.h delete mode 100644 libsrc/bootsequence/BootSequenceFactory.cpp delete mode 100644 libsrc/bootsequence/CMakeLists.txt delete mode 100644 libsrc/bootsequence/EffectBootSequence.cpp delete mode 100644 libsrc/bootsequence/EffectBootSequence.h diff --git a/include/bootsequence/BootSequence.h b/include/bootsequence/BootSequence.h deleted file mode 100644 index 17606d30..00000000 --- a/include/bootsequence/BootSequence.h +++ /dev/null @@ -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; -}; diff --git a/include/bootsequence/BootSequenceFactory.h b/include/bootsequence/BootSequenceFactory.h deleted file mode 100644 index f6ba7d67..00000000 --- a/include/bootsequence/BootSequenceFactory.h +++ /dev/null @@ -1,29 +0,0 @@ -#pragma once - -// Jsoncpp includes -#include - -// Bootsequence includes -#include - -// Hyperion includes -#include - -/// -/// 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); -}; diff --git a/libsrc/CMakeLists.txt b/libsrc/CMakeLists.txt index 4e2470d3..ee82011c 100644 --- a/libsrc/CMakeLists.txt +++ b/libsrc/CMakeLists.txt @@ -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) diff --git a/libsrc/bootsequence/BootSequenceFactory.cpp b/libsrc/bootsequence/BootSequenceFactory.cpp deleted file mode 100644 index c319c884..00000000 --- a/libsrc/bootsequence/BootSequenceFactory.cpp +++ /dev/null @@ -1,28 +0,0 @@ -// stl includes -#include -#include - -// Bootsequence includes -#include - -// Effect engine includes -#include - -// 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; -} diff --git a/libsrc/bootsequence/CMakeLists.txt b/libsrc/bootsequence/CMakeLists.txt deleted file mode 100644 index eb6034c4..00000000 --- a/libsrc/bootsequence/CMakeLists.txt +++ /dev/null @@ -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}) diff --git a/libsrc/bootsequence/EffectBootSequence.cpp b/libsrc/bootsequence/EffectBootSequence.cpp deleted file mode 100644 index 9005a269..00000000 --- a/libsrc/bootsequence/EffectBootSequence.cpp +++ /dev/null @@ -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); -} diff --git a/libsrc/bootsequence/EffectBootSequence.h b/libsrc/bootsequence/EffectBootSequence.h deleted file mode 100644 index a0a9eae2..00000000 --- a/libsrc/bootsequence/EffectBootSequence.h +++ /dev/null @@ -1,38 +0,0 @@ -#pragma once - -// Bootsequence include -#include - -// Hyperion includes -#include - -/// -/// 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; -}; - diff --git a/src/hyperiond/CMakeLists.txt b/src/hyperiond/CMakeLists.txt index a6c35c33..1a255b17 100644 --- a/src/hyperiond/CMakeLists.txt +++ b/src/hyperiond/CMakeLists.txt @@ -3,7 +3,6 @@ add_executable(hyperiond hyperiond.cpp) target_link_libraries(hyperiond - bootsequence hyperion xbmcvideochecker effectengine diff --git a/src/hyperiond/hyperiond.cpp b/src/hyperiond/hyperiond.cpp index ab4932c6..4481c226 100644 --- a/src/hyperiond/hyperiond.cpp +++ b/src/hyperiond/hyperiond.cpp @@ -15,9 +15,6 @@ // Hyperion includes #include -// Bootsequence includes -#include - #ifdef ENABLE_DISPMANX // Dispmanx grabber includes #include @@ -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