mirror of
https://github.com/CalcProgrammer1/OpenRGB.git
synced 2026-01-25 23:47:56 -05:00
Move HID detector calls to RunHIDDetector/RunHIDWrappedDetector functions and return controller list from detector functions
This commit is contained in:
@@ -15,17 +15,12 @@
|
||||
#include "RGBController_Nanoleaf.h"
|
||||
#include "SettingsManager.h"
|
||||
|
||||
/*----------------------------------------------------------------------------------------*\
|
||||
| |
|
||||
| DetectNanoleafControllers |
|
||||
| |
|
||||
| Connect to paired Nanoleaf devices |
|
||||
| |
|
||||
\*----------------------------------------------------------------------------------------*/
|
||||
|
||||
void DetectNanoleafControllers()
|
||||
DetectedControllers DetectNanoleafControllers()
|
||||
{
|
||||
json nanoleaf_settings = ResourceManager::get()->GetSettingsManager()->GetSettings("NanoleafDevices");
|
||||
DetectedControllers detected_controllers;
|
||||
json nanoleaf_settings;
|
||||
|
||||
nanoleaf_settings = ResourceManager::get()->GetSettingsManager()->GetSettings("NanoleafDevices");
|
||||
|
||||
if(nanoleaf_settings.contains("devices"))
|
||||
{
|
||||
@@ -38,7 +33,8 @@ void DetectNanoleafControllers()
|
||||
try
|
||||
{
|
||||
RGBController_Nanoleaf* rgb_controller = new RGBController_Nanoleaf(device["ip"], device["port"], device["auth_token"]);
|
||||
DetectionManager::get()->RegisterRGBController(rgb_controller);
|
||||
|
||||
detected_controllers.push_back(rgb_controller);
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
@@ -47,6 +43,8 @@ void DetectNanoleafControllers()
|
||||
}
|
||||
}
|
||||
}
|
||||
} /* DetectNanoleafControllers() */
|
||||
|
||||
return(detected_controllers);
|
||||
}
|
||||
|
||||
REGISTER_DETECTOR("Nanoleaf", DetectNanoleafControllers);
|
||||
|
||||
Reference in New Issue
Block a user