mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
Added skeleton for effect engine development
Former-commit-id: e1fb69fd4de4b8968075660e3ba7f7add021c152
This commit is contained in:
parent
333cecdca8
commit
5454ddb375
29
include/effectengine/EffectEngine.h
Normal file
29
include/effectengine/EffectEngine.h
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <hyperion/Hyperion.h>
|
||||||
|
|
||||||
|
class EffectEngine : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
EffectEngine(Hyperion * hyperion);
|
||||||
|
virtual ~EffectEngine();
|
||||||
|
|
||||||
|
std::list<std::string> getEffects() const;
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
/// Run the specified effect on the given priority channel and optionally specify a timeout
|
||||||
|
int runEffect(const std::string &effectName, int priority, int timeout = -1);
|
||||||
|
|
||||||
|
/// Clear any effect running on the provided channel
|
||||||
|
void channelCleared(int priority);
|
||||||
|
|
||||||
|
/// Clear all effects
|
||||||
|
void allChannelsCleared();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Hyperion * _hyperion;
|
||||||
|
|
||||||
|
std::map<std::string, std::string> _availableEffects;
|
||||||
|
};
|
@ -18,6 +18,7 @@
|
|||||||
// Forward class declaration
|
// Forward class declaration
|
||||||
class HsvTransform;
|
class HsvTransform;
|
||||||
class ColorTransform;
|
class ColorTransform;
|
||||||
|
class EffectEngine;
|
||||||
|
|
||||||
///
|
///
|
||||||
/// The main class of Hyperion. This gives other 'users' access to the attached LedDevice through
|
/// The main class of Hyperion. This gives other 'users' access to the attached LedDevice through
|
||||||
@ -141,6 +142,17 @@ public:
|
|||||||
///
|
///
|
||||||
const InputInfo& getPriorityInfo(const int priority) const;
|
const InputInfo& getPriorityInfo(const int priority) const;
|
||||||
|
|
||||||
|
/// Get the list of available effects
|
||||||
|
/// @return The list of available effects
|
||||||
|
std::list<std::string> getEffects() const;
|
||||||
|
|
||||||
|
/// Run the specified effect on the given priority channel and optionally specify a timeout
|
||||||
|
/// @param effectName Name of the effec to run
|
||||||
|
/// @param priority The priority channel of the effect
|
||||||
|
/// @param timout The timeout of the effect (after the timout, the effect will be cleared)
|
||||||
|
int setEffect(const std::string & effectName, int priority, int timeout = -1);
|
||||||
|
|
||||||
|
public:
|
||||||
static LedDevice * createDevice(const Json::Value & deviceConfig);
|
static LedDevice * createDevice(const Json::Value & deviceConfig);
|
||||||
static ColorOrder createColorOrder(const Json::Value & deviceConfig);
|
static ColorOrder createColorOrder(const Json::Value & deviceConfig);
|
||||||
static LedString createLedString(const Json::Value & ledsConfig);
|
static LedString createLedString(const Json::Value & ledsConfig);
|
||||||
@ -148,6 +160,15 @@ public:
|
|||||||
static ColorTransform * createColorTransform(const Json::Value & colorConfig);
|
static ColorTransform * createColorTransform(const Json::Value & colorConfig);
|
||||||
static LedDevice * createColorSmoothing(const Json::Value & smoothingConfig, LedDevice * ledDevice);
|
static LedDevice * createColorSmoothing(const Json::Value & smoothingConfig, LedDevice * ledDevice);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
/// Signal which is emitted when a priority channel is actively cleared
|
||||||
|
/// This signal will not be emitted when a priority channel time out
|
||||||
|
void channelCleared(int priority);
|
||||||
|
|
||||||
|
/// Signal which is emitted when all priority channels are actively cleared
|
||||||
|
/// This signal will not be emitted when a priority channel time out
|
||||||
|
void allChannelsCleared();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
///
|
///
|
||||||
/// Updates the priority muxer with the current time and (re)writes the led color with applied
|
/// Updates the priority muxer with the current time and (re)writes the led color with applied
|
||||||
@ -185,6 +206,9 @@ private:
|
|||||||
/// The actual LedDevice
|
/// The actual LedDevice
|
||||||
LedDevice * _device;
|
LedDevice * _device;
|
||||||
|
|
||||||
|
/// Effect engine
|
||||||
|
EffectEngine * _effectEngine;
|
||||||
|
|
||||||
/// The timer for handling priority channel timeouts
|
/// The timer for handling priority channel timeouts
|
||||||
QTimer _timer;
|
QTimer _timer;
|
||||||
};
|
};
|
||||||
|
@ -10,6 +10,7 @@ add_subdirectory(protoserver)
|
|||||||
add_subdirectory(boblightserver)
|
add_subdirectory(boblightserver)
|
||||||
add_subdirectory(utils)
|
add_subdirectory(utils)
|
||||||
add_subdirectory(xbmcvideochecker)
|
add_subdirectory(xbmcvideochecker)
|
||||||
|
add_subdirectory(effectengine)
|
||||||
|
|
||||||
if (ENABLE_DISPMANX)
|
if (ENABLE_DISPMANX)
|
||||||
add_subdirectory(dispmanx-grabber)
|
add_subdirectory(dispmanx-grabber)
|
||||||
|
31
libsrc/effectengine/CMakeLists.txt
Normal file
31
libsrc/effectengine/CMakeLists.txt
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
|
||||||
|
# Define the current source locations
|
||||||
|
SET(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/effectengine)
|
||||||
|
SET(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/effectengine)
|
||||||
|
|
||||||
|
# Group the headers that go through the MOC compiler
|
||||||
|
SET(EffectEngineQT_HEADERS
|
||||||
|
${CURRENT_HEADER_DIR}/EffectEngine.h
|
||||||
|
${CURRENT_SOURCE_DIR}/Effect.h
|
||||||
|
)
|
||||||
|
|
||||||
|
SET(EffectEngineHEADERS
|
||||||
|
)
|
||||||
|
|
||||||
|
SET(EffectEngineSOURCES
|
||||||
|
${CURRENT_SOURCE_DIR}/EffectEngine.cpp
|
||||||
|
${CURRENT_SOURCE_DIR}/Effect.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
QT4_WRAP_CPP(EffectEngineHEADERS_MOC ${EffectEngineQT_HEADERS})
|
||||||
|
|
||||||
|
add_library(effectengine
|
||||||
|
${EffectEngineHEADERS}
|
||||||
|
${EffectEngineQT_HEADERS}
|
||||||
|
${EffectEngineHEADERS_MOC}
|
||||||
|
${EffectEngineSOURCES}
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries(effectengine
|
||||||
|
hyperion
|
||||||
|
${QT_LIBRARIES})
|
10
libsrc/effectengine/Effect.cpp
Normal file
10
libsrc/effectengine/Effect.cpp
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#include "Effect.h"
|
||||||
|
|
||||||
|
Effect::Effect()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
Effect::~Effect()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
12
libsrc/effectengine/Effect.h
Normal file
12
libsrc/effectengine/Effect.h
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
|
||||||
|
class Effect : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
Effect();
|
||||||
|
virtual ~Effect();
|
||||||
|
};
|
42
libsrc/effectengine/EffectEngine.cpp
Normal file
42
libsrc/effectengine/EffectEngine.cpp
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
#include <effectengine/EffectEngine.h>
|
||||||
|
|
||||||
|
EffectEngine::EffectEngine(Hyperion * hyperion) :
|
||||||
|
_hyperion(hyperion),
|
||||||
|
_availableEffects()
|
||||||
|
{
|
||||||
|
// connect the Hyperion channel clear feedback
|
||||||
|
connect(_hyperion, SIGNAL(channelCleared(int)), this, SLOT(channelCleared(int)));
|
||||||
|
connect(_hyperion, SIGNAL(allChannelsCleared()), this, SLOT(allChannelsCleared()));
|
||||||
|
|
||||||
|
// read all effects
|
||||||
|
_availableEffects["test"] = "test.py";
|
||||||
|
}
|
||||||
|
|
||||||
|
EffectEngine::~EffectEngine()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
std::list<std::string> EffectEngine::getEffects() const
|
||||||
|
{
|
||||||
|
std::list<std::string> effectNames;
|
||||||
|
foreach (auto entry, _availableEffects) {
|
||||||
|
effectNames.push_back(entry.first);
|
||||||
|
}
|
||||||
|
return effectNames;
|
||||||
|
}
|
||||||
|
|
||||||
|
int EffectEngine::runEffect(const std::string &effectName, int priority, int timeout)
|
||||||
|
{
|
||||||
|
std::cout << "run effect " << effectName << " on channel " << priority << std::endl;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void EffectEngine::channelCleared(int priority)
|
||||||
|
{
|
||||||
|
std::cout << "clear effect on channel " << priority << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
void EffectEngine::allChannelsCleared()
|
||||||
|
{
|
||||||
|
std::cout << "clear effect on every channel" << std::endl;
|
||||||
|
}
|
@ -77,6 +77,7 @@ add_library(hyperion
|
|||||||
|
|
||||||
target_link_libraries(hyperion
|
target_link_libraries(hyperion
|
||||||
hyperion-utils
|
hyperion-utils
|
||||||
|
effectengine
|
||||||
serialport
|
serialport
|
||||||
${QT_LIBRARIES}
|
${QT_LIBRARIES}
|
||||||
${LIBUSB_1_LIBRARIES}
|
${LIBUSB_1_LIBRARIES}
|
||||||
|
@ -27,6 +27,9 @@
|
|||||||
#include <utils/ColorTransform.h>
|
#include <utils/ColorTransform.h>
|
||||||
#include <utils/HsvTransform.h>
|
#include <utils/HsvTransform.h>
|
||||||
|
|
||||||
|
// effect engine includes
|
||||||
|
#include <effectengine/EffectEngine.h>
|
||||||
|
|
||||||
LedDevice* Hyperion::createDevice(const Json::Value& deviceConfig)
|
LedDevice* Hyperion::createDevice(const Json::Value& deviceConfig)
|
||||||
{
|
{
|
||||||
std::cout << "Device configuration: " << deviceConfig << std::endl;
|
std::cout << "Device configuration: " << deviceConfig << std::endl;
|
||||||
@ -252,6 +255,7 @@ Hyperion::Hyperion(const Json::Value &jsonConfig) :
|
|||||||
_blueTransform(createColorTransform(jsonConfig["color"]["blue"])),
|
_blueTransform(createColorTransform(jsonConfig["color"]["blue"])),
|
||||||
_colorOrder(createColorOrder(jsonConfig["device"])),
|
_colorOrder(createColorOrder(jsonConfig["device"])),
|
||||||
_device(createDevice(jsonConfig["device"])),
|
_device(createDevice(jsonConfig["device"])),
|
||||||
|
_effectEngine(nullptr),
|
||||||
_timer()
|
_timer()
|
||||||
{
|
{
|
||||||
// initialize the image processor factory
|
// initialize the image processor factory
|
||||||
@ -264,6 +268,9 @@ Hyperion::Hyperion(const Json::Value &jsonConfig) :
|
|||||||
_timer.setSingleShot(true);
|
_timer.setSingleShot(true);
|
||||||
QObject::connect(&_timer, SIGNAL(timeout()), this, SLOT(update()));
|
QObject::connect(&_timer, SIGNAL(timeout()), this, SLOT(update()));
|
||||||
|
|
||||||
|
// create the effect engine
|
||||||
|
_effectEngine = new EffectEngine(this);
|
||||||
|
|
||||||
// initialize the leds
|
// initialize the leds
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
@ -275,6 +282,9 @@ Hyperion::~Hyperion()
|
|||||||
clearall();
|
clearall();
|
||||||
_device->switchOff();
|
_device->switchOff();
|
||||||
|
|
||||||
|
// delete the effect engine
|
||||||
|
delete _effectEngine;
|
||||||
|
|
||||||
// Delete the Led-String
|
// Delete the Led-String
|
||||||
delete _device;
|
delete _device;
|
||||||
|
|
||||||
@ -382,6 +392,9 @@ void Hyperion::clear(int priority)
|
|||||||
{
|
{
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// send clear signal to the effect engine
|
||||||
|
_effectEngine->channelCleared(priority);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -391,6 +404,9 @@ void Hyperion::clearall()
|
|||||||
|
|
||||||
// update leds
|
// update leds
|
||||||
update();
|
update();
|
||||||
|
|
||||||
|
// send clearall signal to the effect engine
|
||||||
|
_effectEngine->allChannelsCleared();
|
||||||
}
|
}
|
||||||
|
|
||||||
double Hyperion::getTransform(Hyperion::Transform transform, Hyperion::Color color) const
|
double Hyperion::getTransform(Hyperion::Transform transform, Hyperion::Color color) const
|
||||||
@ -448,6 +464,16 @@ const Hyperion::InputInfo &Hyperion::getPriorityInfo(const int priority) const
|
|||||||
return _muxer.getInputInfo(priority);
|
return _muxer.getInputInfo(priority);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::list<std::string> Hyperion::getEffects() const
|
||||||
|
{
|
||||||
|
return _effectEngine->getEffects();
|
||||||
|
}
|
||||||
|
|
||||||
|
int Hyperion::setEffect(const std::string &effectName, int priority, int timeout)
|
||||||
|
{
|
||||||
|
return _effectEngine->runEffect(effectName, priority, timeout);
|
||||||
|
}
|
||||||
|
|
||||||
void Hyperion::update()
|
void Hyperion::update()
|
||||||
{
|
{
|
||||||
// Update the muxer, cleaning obsolete priorities
|
// Update the muxer, cleaning obsolete priorities
|
||||||
|
@ -94,6 +94,8 @@ void JsonClientConnection::handleMessage(const std::string &messageString)
|
|||||||
handleColorCommand(message);
|
handleColorCommand(message);
|
||||||
else if (command == "image")
|
else if (command == "image")
|
||||||
handleImageCommand(message);
|
handleImageCommand(message);
|
||||||
|
else if (command == "effect")
|
||||||
|
handleEffectCommand(message);
|
||||||
else if (command == "serverinfo")
|
else if (command == "serverinfo")
|
||||||
handleServerInfoCommand(message);
|
handleServerInfoCommand(message);
|
||||||
else if (command == "clear")
|
else if (command == "clear")
|
||||||
@ -151,7 +153,22 @@ void JsonClientConnection::handleImageCommand(const Json::Value &message)
|
|||||||
sendSuccessReply();
|
sendSuccessReply();
|
||||||
}
|
}
|
||||||
|
|
||||||
void JsonClientConnection::handleServerInfoCommand(const Json::Value &message)
|
void JsonClientConnection::handleEffectCommand(const Json::Value &message)
|
||||||
|
{
|
||||||
|
// extract parameters
|
||||||
|
int priority = message["priority"].asInt();
|
||||||
|
int duration = message.get("duration", -1).asInt();
|
||||||
|
const Json::Value & effect = message["effect"];
|
||||||
|
const std::string & effectName = effect["name"].asString();
|
||||||
|
|
||||||
|
// set output
|
||||||
|
_hyperion->setEffect(effectName, priority, duration);
|
||||||
|
|
||||||
|
// send reply
|
||||||
|
sendSuccessReply();
|
||||||
|
}
|
||||||
|
|
||||||
|
void JsonClientConnection::handleServerInfoCommand(const Json::Value &)
|
||||||
{
|
{
|
||||||
// create result
|
// create result
|
||||||
Json::Value result;
|
Json::Value result;
|
||||||
@ -193,6 +210,17 @@ void JsonClientConnection::handleServerInfoCommand(const Json::Value &message)
|
|||||||
whitelevel.append(_hyperion->getTransform(Hyperion::WHITELEVEL, Hyperion::GREEN));
|
whitelevel.append(_hyperion->getTransform(Hyperion::WHITELEVEL, Hyperion::GREEN));
|
||||||
whitelevel.append(_hyperion->getTransform(Hyperion::WHITELEVEL, Hyperion::BLUE));
|
whitelevel.append(_hyperion->getTransform(Hyperion::WHITELEVEL, Hyperion::BLUE));
|
||||||
|
|
||||||
|
// collect effect info
|
||||||
|
Json::Value & effects = info["effects"];
|
||||||
|
std::list<std::string> effectNames = _hyperion->getEffects();
|
||||||
|
for (const std::string & name : effectNames)
|
||||||
|
{
|
||||||
|
Json::Value effect;
|
||||||
|
effect["name"] = name;
|
||||||
|
|
||||||
|
effects.append(effect);
|
||||||
|
}
|
||||||
|
|
||||||
// send the result
|
// send the result
|
||||||
sendMessage(result);
|
sendMessage(result);
|
||||||
}
|
}
|
||||||
|
@ -78,6 +78,13 @@ private:
|
|||||||
///
|
///
|
||||||
void handleImageCommand(const Json::Value & message);
|
void handleImageCommand(const Json::Value & message);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Handle an incoming JSON Effect message
|
||||||
|
///
|
||||||
|
/// @param message the incoming message
|
||||||
|
///
|
||||||
|
void handleEffectCommand(const Json::Value & message);
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Handle an incoming JSON Server info message
|
/// Handle an incoming JSON Server info message
|
||||||
///
|
///
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
<RCC>
|
<RCC>
|
||||||
<qresource prefix="/">
|
<qresource prefix="/">
|
||||||
<file alias="schema">schema/schema.json</file>
|
<file alias="schema">schema/schema.json</file>
|
||||||
<file alias="schema-color">schema/schema-color.json</file>
|
<file alias="schema-color">schema/schema-color.json</file>
|
||||||
<file alias="schema-image">schema/schema-image.json</file>
|
<file alias="schema-image">schema/schema-image.json</file>
|
||||||
<file alias="schema-serverinfo">schema/schema-serverinfo.json</file>
|
<file alias="schema-serverinfo">schema/schema-serverinfo.json</file>
|
||||||
<file alias="schema-clear">schema/schema-clear.json</file>
|
<file alias="schema-clear">schema/schema-clear.json</file>
|
||||||
<file alias="schema-clearall">schema/schema-clearall.json</file>
|
<file alias="schema-clearall">schema/schema-clearall.json</file>
|
||||||
<file alias="schema-transform">schema/schema-transform.json</file>
|
<file alias="schema-transform">schema/schema-transform.json</file>
|
||||||
</qresource>
|
<file alias="schema-effect">schema/schema-effect.json</file>
|
||||||
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
31
libsrc/jsonserver/schema/schema-effect.json
Normal file
31
libsrc/jsonserver/schema/schema-effect.json
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
{
|
||||||
|
"type":"object",
|
||||||
|
"required":true,
|
||||||
|
"properties":{
|
||||||
|
"command": {
|
||||||
|
"type" : "string",
|
||||||
|
"required" : true,
|
||||||
|
"enum" : ["effect"]
|
||||||
|
},
|
||||||
|
"priority": {
|
||||||
|
"type": "integer",
|
||||||
|
"required": true
|
||||||
|
},
|
||||||
|
"duration": {
|
||||||
|
"type": "integer",
|
||||||
|
"required": false
|
||||||
|
},
|
||||||
|
"effect": {
|
||||||
|
"type": "object",
|
||||||
|
"required": true,
|
||||||
|
"properties" :{
|
||||||
|
"name" : {
|
||||||
|
"type" : "string",
|
||||||
|
"required" : true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false
|
||||||
|
}
|
@ -5,7 +5,7 @@
|
|||||||
"command": {
|
"command": {
|
||||||
"type" : "string",
|
"type" : "string",
|
||||||
"required" : true,
|
"required" : true,
|
||||||
"enum" : ["color", "image", "serverinfo", "clear", "clearall", "transform"]
|
"enum" : ["color", "image", "effect", "serverinfo", "clear", "clearall", "transform"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -102,6 +102,27 @@ void JsonConnection::setImage(QImage image, int priority, int duration)
|
|||||||
parseReply(reply);
|
parseReply(reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void JsonConnection::setEffect(const std::string &effectName, int priority, int duration)
|
||||||
|
{
|
||||||
|
std::cout << "Start effect " << effectName << std::endl;
|
||||||
|
|
||||||
|
// create command
|
||||||
|
Json::Value command;
|
||||||
|
command["command"] = "effect";
|
||||||
|
command["priority"] = priority;
|
||||||
|
Json::Value & effect = command["effect"];
|
||||||
|
effect["name"] = effectName;
|
||||||
|
if (duration > 0)
|
||||||
|
{
|
||||||
|
command["duration"] = duration;
|
||||||
|
}
|
||||||
|
|
||||||
|
// send command message
|
||||||
|
Json::Value reply = sendMessage(command);
|
||||||
|
|
||||||
|
// parse reply message
|
||||||
|
parseReply(reply);
|
||||||
|
}
|
||||||
|
|
||||||
QString JsonConnection::getServerInfo()
|
QString JsonConnection::getServerInfo()
|
||||||
{
|
{
|
||||||
|
@ -52,6 +52,15 @@ public:
|
|||||||
///
|
///
|
||||||
void setImage(QImage image, int priority, int duration);
|
void setImage(QImage image, int priority, int duration);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Start the given effect
|
||||||
|
///
|
||||||
|
/// @param effect The name of the effect
|
||||||
|
/// @param priority The priority
|
||||||
|
/// @param duration The duration in milliseconds
|
||||||
|
///
|
||||||
|
void setEffect(const std::string & effectName, int priority, int duration);
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Retrieve a list of all occupied priority channels
|
/// Retrieve a list of all occupied priority channels
|
||||||
///
|
///
|
||||||
|
@ -42,6 +42,7 @@ int main(int argc, char * argv[])
|
|||||||
IntParameter & argDuration = parameters.add<IntParameter> ('d', "duration" , "Specify how long the leds should be switched on in millseconds [default: infinity]");
|
IntParameter & argDuration = parameters.add<IntParameter> ('d', "duration" , "Specify how long the leds should be switched on in millseconds [default: infinity]");
|
||||||
ColorParameter & argColor = parameters.add<ColorParameter> ('c', "color" , "Set all leds to a constant color (either RRGGBB hex value or a color name)");
|
ColorParameter & argColor = parameters.add<ColorParameter> ('c', "color" , "Set all leds to a constant color (either RRGGBB hex value or a color name)");
|
||||||
ImageParameter & argImage = parameters.add<ImageParameter> ('i', "image" , "Set the leds to the colors according to the given image file");
|
ImageParameter & argImage = parameters.add<ImageParameter> ('i', "image" , "Set the leds to the colors according to the given image file");
|
||||||
|
StringParameter & argEffect = parameters.add<StringParameter> ('e', "effect" , "Enable the effect with the given name");
|
||||||
SwitchParameter<> & argServerInfo = parameters.add<SwitchParameter<> >('l', "list" , "List server info");
|
SwitchParameter<> & argServerInfo = parameters.add<SwitchParameter<> >('l', "list" , "List server info");
|
||||||
SwitchParameter<> & argClear = parameters.add<SwitchParameter<> >('x', "clear" , "Clear data for the priority channel provided by the -p option");
|
SwitchParameter<> & argClear = parameters.add<SwitchParameter<> >('x', "clear" , "Clear data for the priority channel provided by the -p option");
|
||||||
SwitchParameter<> & argClearAll = parameters.add<SwitchParameter<> >(0x0, "clearall" , "Clear data for all active priority channels");
|
SwitchParameter<> & argClearAll = parameters.add<SwitchParameter<> >(0x0, "clearall" , "Clear data for all active priority channels");
|
||||||
@ -73,12 +74,13 @@ int main(int argc, char * argv[])
|
|||||||
bool colorTransform = argSaturation.isSet() || argValue.isSet() || argThreshold.isSet() || argGamma.isSet() || argBlacklevel.isSet() || argWhitelevel.isSet();
|
bool colorTransform = argSaturation.isSet() || argValue.isSet() || argThreshold.isSet() || argGamma.isSet() || argBlacklevel.isSet() || argWhitelevel.isSet();
|
||||||
|
|
||||||
// check that exactly one command was given
|
// check that exactly one command was given
|
||||||
int commandCount = count({argColor.isSet(), argImage.isSet(), argServerInfo.isSet(), argClear.isSet(), argClearAll.isSet(), colorTransform});
|
int commandCount = count({argColor.isSet(), argImage.isSet(), argEffect.isSet(), argServerInfo.isSet(), argClear.isSet(), argClearAll.isSet(), colorTransform});
|
||||||
if (commandCount != 1)
|
if (commandCount != 1)
|
||||||
{
|
{
|
||||||
std::cerr << (commandCount == 0 ? "No command found." : "Multiple commands found.") << " Provide exactly one of the following options:" << std::endl;
|
std::cerr << (commandCount == 0 ? "No command found." : "Multiple commands found.") << " Provide exactly one of the following options:" << std::endl;
|
||||||
std::cerr << " " << argColor.usageLine() << std::endl;
|
std::cerr << " " << argColor.usageLine() << std::endl;
|
||||||
std::cerr << " " << argImage.usageLine() << std::endl;
|
std::cerr << " " << argImage.usageLine() << std::endl;
|
||||||
|
std::cerr << " " << argEffect.usageLine() << std::endl;
|
||||||
std::cerr << " " << argServerInfo.usageLine() << std::endl;
|
std::cerr << " " << argServerInfo.usageLine() << std::endl;
|
||||||
std::cerr << " " << argClear.usageLine() << std::endl;
|
std::cerr << " " << argClear.usageLine() << std::endl;
|
||||||
std::cerr << " " << argClearAll.usageLine() << std::endl;
|
std::cerr << " " << argClearAll.usageLine() << std::endl;
|
||||||
@ -104,6 +106,10 @@ int main(int argc, char * argv[])
|
|||||||
{
|
{
|
||||||
connection.setImage(argImage.getValue(), argPriority.getValue(), argDuration.getValue());
|
connection.setImage(argImage.getValue(), argPriority.getValue(), argDuration.getValue());
|
||||||
}
|
}
|
||||||
|
else if (argEffect.isSet())
|
||||||
|
{
|
||||||
|
connection.setEffect(argEffect.getValue(), argPriority.getValue(), argDuration.getValue());
|
||||||
|
}
|
||||||
else if (argServerInfo.isSet())
|
else if (argServerInfo.isSet())
|
||||||
{
|
{
|
||||||
QString info = connection.getServerInfo();
|
QString info = connection.getServerInfo();
|
||||||
|
@ -6,6 +6,7 @@ target_link_libraries(hyperiond
|
|||||||
bootsequence
|
bootsequence
|
||||||
hyperion
|
hyperion
|
||||||
xbmcvideochecker
|
xbmcvideochecker
|
||||||
|
effectengine
|
||||||
jsonserver
|
jsonserver
|
||||||
protoserver
|
protoserver
|
||||||
boblightserver)
|
boblightserver)
|
||||||
|
@ -26,6 +26,9 @@
|
|||||||
// XBMC Video checker includes
|
// XBMC Video checker includes
|
||||||
#include <xbmcvideochecker/XBMCVideoChecker.h>
|
#include <xbmcvideochecker/XBMCVideoChecker.h>
|
||||||
|
|
||||||
|
// Effect engine includes
|
||||||
|
#include <effectengine/EffectEngine.h>
|
||||||
|
|
||||||
// JsonServer includes
|
// JsonServer includes
|
||||||
#include <jsonserver/JsonServer.h>
|
#include <jsonserver/JsonServer.h>
|
||||||
|
|
||||||
@ -150,6 +153,13 @@ int main(int argc, char** argv)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Create the effect engine
|
||||||
|
EffectEngine * effectEngine = nullptr;
|
||||||
|
if (true)
|
||||||
|
{
|
||||||
|
effectEngine = new EffectEngine(&hyperion);
|
||||||
|
}
|
||||||
|
|
||||||
// Create Json server if configuration is present
|
// Create Json server if configuration is present
|
||||||
JsonServer * jsonServer = nullptr;
|
JsonServer * jsonServer = nullptr;
|
||||||
if (config.isMember("jsonServer"))
|
if (config.isMember("jsonServer"))
|
||||||
@ -187,8 +197,10 @@ int main(int argc, char** argv)
|
|||||||
delete dispmanx;
|
delete dispmanx;
|
||||||
#endif
|
#endif
|
||||||
delete xbmcVideoChecker;
|
delete xbmcVideoChecker;
|
||||||
|
delete effectEngine;
|
||||||
delete jsonServer;
|
delete jsonServer;
|
||||||
delete protoServer;
|
delete protoServer;
|
||||||
|
delete boblightServer;
|
||||||
|
|
||||||
// leave application
|
// leave application
|
||||||
return rc;
|
return rc;
|
||||||
|
Loading…
Reference in New Issue
Block a user