Initial E1.31 Unicast support, add ip parameter to E1.31 device to use Unicast mode
This commit is contained in:
parent
ca3c2ad541
commit
9bde1c282a
3 changed files with 66 additions and 25 deletions
|
|
@ -43,6 +43,7 @@ void DetectE131Controllers(std::vector<RGBController*> &rgb_controllers)
|
|||
| Clear E1.31 device data |
|
||||
\*-------------------------------------------------*/
|
||||
dev.name = "";
|
||||
dev.ip = "";
|
||||
dev.type = ZONE_TYPE_SINGLE;
|
||||
dev.num_leds = 0;
|
||||
dev.rgb_order = E131_RGB_ORDER_RBG;
|
||||
|
|
@ -57,6 +58,11 @@ void DetectE131Controllers(std::vector<RGBController*> &rgb_controllers)
|
|||
dev.name = e131_settings["devices"][device_idx]["name"];
|
||||
}
|
||||
|
||||
if(e131_settings["devices"][device_idx].contains("ip"))
|
||||
{
|
||||
dev.ip = e131_settings["devices"][device_idx]["ip"];
|
||||
}
|
||||
|
||||
if(e131_settings["devices"][device_idx].contains("num_leds"))
|
||||
{
|
||||
dev.num_leds = e131_settings["devices"][device_idx]["num_leds"];
|
||||
|
|
@ -188,40 +194,56 @@ void DetectE131Controllers(std::vector<RGBController*> &rgb_controllers)
|
|||
\*---------------------------------------------------------*/
|
||||
bool device_added_to_existing_list = false;
|
||||
|
||||
for(unsigned int list_idx = 0; list_idx < device_lists.size(); list_idx++)
|
||||
/*---------------------------------------------------------*\
|
||||
| Only track grouping for multicast controllers. Unicast |
|
||||
| controllers are currently not grouped. |
|
||||
\*---------------------------------------------------------*/
|
||||
if(dev.ip == "")
|
||||
{
|
||||
for(unsigned int device_idx = 0; device_idx < device_lists[list_idx].size(); device_idx++)
|
||||
for(unsigned int list_idx = 0; list_idx < device_lists.size(); list_idx++)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| Check if any universes used by this new device exist in |
|
||||
| the existing device. If so, add the new device to the |
|
||||
| existing list. |
|
||||
\*---------------------------------------------------------*/
|
||||
if(dev.start_universe == device_lists[list_idx][device_idx].start_universe)
|
||||
for(unsigned int device_idx = 0; device_idx < device_lists[list_idx].size(); device_idx++)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| Check if any universes used by this new device exist in |
|
||||
| the existing device. If so, add the new device to the |
|
||||
| existing list. |
|
||||
\*---------------------------------------------------------*/
|
||||
if(dev.start_universe == device_lists[list_idx][device_idx].start_universe)
|
||||
{
|
||||
device_lists[list_idx].push_back(dev);
|
||||
device_added_to_existing_list = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(device_added_to_existing_list)
|
||||
{
|
||||
device_lists[list_idx].push_back(dev);
|
||||
device_added_to_existing_list = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(device_added_to_existing_list)
|
||||
/*---------------------------------------------------------*\
|
||||
| If the device did not overlap with existing devices, |
|
||||
| create a new list for it |
|
||||
\*---------------------------------------------------------*/
|
||||
if(!device_added_to_existing_list)
|
||||
{
|
||||
break;
|
||||
std::vector<E131Device> new_list;
|
||||
|
||||
new_list.push_back(dev);
|
||||
|
||||
device_lists.push_back(new_list);
|
||||
}
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------*\
|
||||
| If the device did not overlap with existing devices, |
|
||||
| create a new list for it |
|
||||
\*---------------------------------------------------------*/
|
||||
if(!device_added_to_existing_list)
|
||||
else
|
||||
{
|
||||
std::vector<E131Device> new_list;
|
||||
std::vector<E131Device> tmp_device_list;
|
||||
tmp_device_list.push_back(dev);
|
||||
|
||||
new_list.push_back(dev);
|
||||
|
||||
device_lists.push_back(new_list);
|
||||
RGBController_E131* rgb_controller;
|
||||
rgb_controller = new RGBController_E131(tmp_device_list);
|
||||
rgb_controllers.push_back(rgb_controller);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue