Update JsonClientConnection.cpp

JSON API: Get current LED color

Former-commit-id: 0b40c1eb1627afd8077bdf690109609fd531c2fb
This commit is contained in:
Paulchen-Panther 2016-05-06 15:05:28 +02:00
parent a0b81e9d4c
commit 536b51dba1
1 changed files with 15 additions and 0 deletions

View File

@ -528,6 +528,21 @@ void JsonClientConnection::handleServerInfoCommand(const Json::Value &)
activeEffects.append(activeEffect);
}
// collect active led colors
Json::Value & activeLedColors = info["activeLedColors"] = Json::Value(Json::arrayValue);
foreach (int priority, activePriorities) {
const Hyperion::InputInfo & priorityInfo = _hyperion->getPriorityInfo(priority);
int i=0;
Json::Value LEDcolor;
for (auto it = priorityInfo.ledColors.begin(); it!=priorityInfo.ledColors.end(); ++it, ++i) {
LEDcolor[std::to_string(i)].append(it->red);
LEDcolor[std::to_string(i)].append(it->green);
LEDcolor[std::to_string(i)].append(it->blue);
}
activeLedColors.append(LEDcolor);
}
// send the result
sendMessage(result);