mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
Updated orbIds config setting and sample config.
Former-commit-id: 350db40b53d04efbb43dc8c87c88bf2eb378fa6b
This commit is contained in:
parent
f783c59185
commit
7adb339dea
@ -10,10 +10,12 @@
|
|||||||
/// * [device type specific configuration]
|
/// * [device type specific configuration]
|
||||||
/// * 'colorOrder' : The order of the color bytes ('rgb', 'rbg', 'bgr', etc.).
|
/// * 'colorOrder' : The order of the color bytes ('rgb', 'rbg', 'bgr', etc.).
|
||||||
///
|
///
|
||||||
/// * 'Specific of Philips Hue:
|
/// * 'Specific for AtmoOrb:
|
||||||
/// * 'username' : The name of user registred on the Philips Hue Bridge
|
/// * 'transitiontime' : Set the time of transition between color of Orb (not implemented)
|
||||||
/// * 'switchOffOnBlack': Define if Hue light switch off when black is detected
|
/// * 'port' : Multicast UDP port
|
||||||
/// * 'transitiontime' : Set the time of transition between color of Hue light
|
/// * 'numLeds' : Number of leds in Orb
|
||||||
|
/// * 'orbIds' : The Orb ids to use
|
||||||
|
/// * 'switchOffOnBlack': Define if Orb is to switch off when black is detected
|
||||||
"device" :
|
"device" :
|
||||||
{
|
{
|
||||||
"name" : "MyPi",
|
"name" : "MyPi",
|
||||||
@ -22,7 +24,7 @@
|
|||||||
"transitiontime" : 0,
|
"transitiontime" : 0,
|
||||||
"port" : 49692,
|
"port" : 49692,
|
||||||
"numLeds" : 24,
|
"numLeds" : 24,
|
||||||
"orbIds" : [1],
|
"orbIds" : "1",
|
||||||
"switchOffOnBlack" : true,
|
"switchOffOnBlack" : true,
|
||||||
"colorOrder" : "rgb"
|
"colorOrder" : "rgb"
|
||||||
},
|
},
|
||||||
|
@ -253,10 +253,24 @@ LedDevice * LedDeviceFactory::construct(const Json::Value & deviceConfig)
|
|||||||
const int transitiontime = deviceConfig.get("transitiontime", 1).asInt();
|
const int transitiontime = deviceConfig.get("transitiontime", 1).asInt();
|
||||||
const int port = deviceConfig.get("port", 1).asInt();
|
const int port = deviceConfig.get("port", 1).asInt();
|
||||||
const int numLeds = deviceConfig.get("numLeds", 1).asInt();
|
const int numLeds = deviceConfig.get("numLeds", 1).asInt();
|
||||||
|
const std::string orbId = deviceConfig["orbIds"].asString();
|
||||||
std::vector<unsigned int> orbIds;
|
std::vector<unsigned int> orbIds;
|
||||||
for (Json::Value::ArrayIndex i = 0; i < deviceConfig["orbIds"].size(); i++) {
|
|
||||||
orbIds.push_back(deviceConfig["orbIds"][i].asInt());
|
// If we find multiple Orb ids separate them and add to list
|
||||||
|
const std::string separator (",");
|
||||||
|
if (orbId.find(separator) != std::string::npos) {
|
||||||
|
std::stringstream ss(orbId);
|
||||||
|
std::vector<int> output;
|
||||||
|
unsigned int i;
|
||||||
|
while (ss >> i) {
|
||||||
|
orbIds.push_back(i);
|
||||||
|
if (ss.peek() == ',' || ss.peek() == ' ')
|
||||||
|
ss.ignore();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
orbIds.push_back(atoi(orbId.c_str()));
|
||||||
}
|
}
|
||||||
|
|
||||||
device = new LedDeviceAtmoOrb(output, switchOffOnBlack, transitiontime, port, numLeds, orbIds);
|
device = new LedDeviceAtmoOrb(output, switchOffOnBlack, transitiontime, port, numLeds, orbIds);
|
||||||
|
Loading…
Reference in New Issue
Block a user