mirror of
https://github.com/CalcProgrammer1/OpenRGB.git
synced 2025-12-27 09:17:51 -05:00
42 lines
1.9 KiB
C++
42 lines
1.9 KiB
C++
#include "Detector.h"
|
|
#include "ElgatoLightStripController.h"
|
|
#include "RGBController_ElgatoLightStrip.h"
|
|
#include "SettingsManager.h"
|
|
|
|
/******************************************************************************************\
|
|
* *
|
|
* Detect Elgato LightStrip devices *
|
|
* *
|
|
\******************************************************************************************/
|
|
|
|
void DetectElgatoLightStripControllers()
|
|
{
|
|
json elgato_lightstrip_settings;
|
|
|
|
/*-------------------------------------------------*\
|
|
| Get LightStrip settings from settings manager |
|
|
\*-------------------------------------------------*/
|
|
elgato_lightstrip_settings = ResourceManager::get()->GetSettingsManager()->GetSettings("ElgatoLightStripDevices");
|
|
|
|
/*------------------------------------------------------------*\
|
|
| If the Elgato Light Strip settings contains devices, process |
|
|
\*------------------------------------------------------------*/
|
|
if(elgato_lightstrip_settings.contains("devices"))
|
|
{
|
|
for(unsigned int device_idx = 0; device_idx < elgato_lightstrip_settings["devices"].size(); device_idx++)
|
|
{
|
|
if(elgato_lightstrip_settings["devices"][device_idx].contains("ip"))
|
|
{
|
|
std::string elgato_lightstrip_ip = elgato_lightstrip_settings["devices"][device_idx]["ip"];
|
|
|
|
ElgatoLightStripController* controller = new ElgatoLightStripController(elgato_lightstrip_ip);
|
|
RGBController_ElgatoLightStrip* rgb_controller = new RGBController_ElgatoLightStrip(controller);
|
|
|
|
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
REGISTER_DETECTOR("Elgato Light Strip", DetectElgatoLightStripControllers);
|