Merge pull request #622 from Paulchen-Panther/Beta

Get current LED color (JSON API)

Former-commit-id: e7a54e674d982bf06cdd4a6a84741d466b555519
This commit is contained in:
brindosch 2016-05-10 08:39:50 +02:00
commit b62acc8c72
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);