3 #include <utils/Logger.h> 4 #include <hyperion/Hyperion.h> 5 #include <utils/settings.h> 23 handleSettingsUpdate(settings::BGEFFECT, _hyperion->
getSetting(settings::BGEFFECT));
32 void handleSettingsUpdate(
const settings::type& type,
const QJsonDocument& config)
34 if(type == settings::BGEFFECT)
36 const QJsonObject& BGEffectConfig = config.object();
38 #define BGCONFIG_ARRAY bgColorConfig.toArray() 40 _hyperion->
clear(254);
42 if (BGEffectConfig[
"enable"].toBool(
true))
44 const QString bgTypeConfig = BGEffectConfig[
"type"].toString(
"effect");
45 const QString bgEffectConfig = BGEffectConfig[
"effect"].toString(
"Warm mood blobs");
46 const QJsonValue bgColorConfig = BGEffectConfig[
"color"];
47 if (bgTypeConfig.contains(
"color"))
50 (uint8_t)BGCONFIG_ARRAY.at(0).toInt(0),
51 (uint8_t)BGCONFIG_ARRAY.at(1).toInt(0),
52 (uint8_t)BGCONFIG_ARRAY.at(2).toInt(0)
55 Info(Logger::getInstance(
"HYPERION"),
"Inital background color set (%d %d %d)",bg_color.
red,bg_color.
green,bg_color.
blue);
59 int result = _hyperion->
setEffect(bgEffectConfig, 254);
60 Info(Logger::getInstance(
"HYPERION"),
"Inital background effect '%s' %s", QSTRING_CSTR(bgEffectConfig), ((result == 0) ?
"started" :
"failed"));
The main class of Hyperion.
Definition: Hyperion.h:57
Provide utility methods for Hyperion class.
Definition: BlackBorderDetector.h:7
void setColor(int priority, const ColorRgb &ledColor, const int timeout_ms=-1, const QString &origin="System", bool clearEffects=true)
Writes a single color to all the leds for the given time and priority Registers comp color or provide...
Definition: Hyperion.cpp:422
uint8_t green
The green color channel.
Definition: ColorRgb.h:18
int setEffect(const QString &effectName, int priority, int timeout=-1, const QString &origin="System")
Run the specified effect on the given priority channel and optionally specify a timeout.
Definition: Hyperion.cpp:524
void settingsChanged(const settings::type &type, const QJsonDocument &data)
Emits whenever a config part changed.
bool clear(int priority)
Clears the given priority channel.
Definition: Hyperion.cpp:454
uint8_t blue
The blue color channel.
Definition: ColorRgb.h:20
Handle the background Effect settings, reacts on runtime to settings changes.
Definition: BGEffectHandler.h:10
QJsonDocument getSetting(const settings::type &type)
Get a setting by settings::type from SettingsManager.
Definition: Hyperion.cpp:287
uint8_t red
The red color channel.
Definition: ColorRgb.h:16
Plain-Old-Data structure containing the red-green-blue color specification.
Definition: ColorRgb.h:13