mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Added the possibility to set effect arguments over json
Former-commit-id: 4bc2920c04853e549c712ec70492371b14d20877
This commit is contained in:
@@ -102,7 +102,7 @@ void JsonConnection::setImage(QImage image, int priority, int duration)
|
||||
parseReply(reply);
|
||||
}
|
||||
|
||||
void JsonConnection::setEffect(const std::string &effectName, int priority, int duration)
|
||||
void JsonConnection::setEffect(const std::string &effectName, const std::string & effectArgs, int priority, int duration)
|
||||
{
|
||||
std::cout << "Start effect " << effectName << std::endl;
|
||||
|
||||
@@ -112,6 +112,14 @@ void JsonConnection::setEffect(const std::string &effectName, int priority, int
|
||||
command["priority"] = priority;
|
||||
Json::Value & effect = command["effect"];
|
||||
effect["name"] = effectName;
|
||||
if (effectArgs.size() > 0)
|
||||
{
|
||||
Json::Reader reader;
|
||||
if (!reader.parse(effectArgs, effect["args"], false))
|
||||
{
|
||||
throw std::runtime_error("Error in effect arguments: " + reader.getFormattedErrorMessages());
|
||||
}
|
||||
}
|
||||
if (duration > 0)
|
||||
{
|
||||
command["duration"] = duration;
|
||||
|
||||
Reference in New Issue
Block a user