From 106257181b50b9945cf38cfac31b1922d02dbcea Mon Sep 17 00:00:00 2001 From: Marc Dahlem Date: Tue, 6 May 2014 18:36:34 +0200 Subject: [PATCH] Added ability to define effect arguments for the bootsequence Former-commit-id: b9827bb7af6c2cfdd8b1b0388d16541612b360d4 --- src/hyperiond/hyperiond.cpp | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/src/hyperiond/hyperiond.cpp b/src/hyperiond/hyperiond.cpp index c6174fa9..b6365019 100644 --- a/src/hyperiond/hyperiond.cpp +++ b/src/hyperiond/hyperiond.cpp @@ -112,14 +112,31 @@ int main(int argc, char** argv) const std::string effectName = effectConfig["effect"].asString(); const unsigned duration_ms = effectConfig["duration_ms"].asUInt(); const int priority = 0; - - if (hyperion.setEffect(effectName, priority, duration_ms) == 0) + + if (effectConfig.isMember("args")) { - std::cout << "Boot sequence(" << effectName << ") created and started" << std::endl; + const Json::Value effectConfigArgs = effectConfig["args"]; + if (hyperion.setEffect(effectName, effectConfigArgs, priority, duration_ms) == 0) + { + std::cout << "Boot sequence(" << effectName << ") with user-defined arguments created and started" << std::endl; + } + else + { + std::cout << "Failed to start boot sequence: " << effectName << " with user-defined arguments" << std::endl; + } + } else { - std::cout << "Failed to start boot sequence: " << effectName << std::endl; + + if (hyperion.setEffect(effectName, priority, duration_ms) == 0) + { + std::cout << "Boot sequence(" << effectName << ") created and started" << std::endl; + } + else + { + std::cout << "Failed to start boot sequence: " << effectName << std::endl; + } } }