Move HID detector calls to RunHIDDetector/RunHIDWrappedDetector functions and return controller list from detector functions

This commit is contained in:
Adam Honse
2026-01-12 19:05:21 -06:00
parent 1ccaadd5d0
commit 9bb2a4e693
197 changed files with 4481 additions and 4332 deletions

View File

@@ -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);