RGBController API Overhaul

* Reorganize and clean up RGBController API functions
    * Add functions to get protected RGBController member values
    * Make NetworkClient, ProfileManager, and ResourceManager friend classes so they can access protected members
    * Protected previously-public RGBController members
        * Information strings (name, vendor, description, version, serial location)
        * Device type
        * Active mode
        * Flags
        * LEDs vector
        * LED alternate names vector
        * Modes vector
        * Colors vector
        * Zones vector
    * Add CONTROLLER_FLAG_HIDDEN to allow plugins to hide controllers from control GUI
    * Add update reason codes to RGBController update callback and signal updates on more RGBController events
    * Add loop zone types and segmented zone type
    * Add matrix map field to segments
    * Rework matrix_map_type from using pointers to vector to prevent memory leaks
    * Rework KeyboardLayoutManager to return new matrix_map_type
    * Add access mutex to RGBController API
    * Add per-zone modes ot RGBController API
    * Add JSON description functions to RGBController API
This commit is contained in:
Adam Honse
2025-09-23 20:38:37 -05:00
parent fa20f4319a
commit dfd8656d9f
655 changed files with 9459 additions and 9022 deletions

View File

@@ -200,7 +200,7 @@ void DetectPhilipsHueControllers()
{
if(ResourceManager::get()->GetRGBControllers()[controller_idx]->GetDescription() == "Philips Hue Entertainment Mode Device")
{
ResourceManager::get()->GetRGBControllers()[controller_idx]->SetMode(0);
ResourceManager::get()->GetRGBControllers()[controller_idx]->SetActiveMode(0);
break;
}
}

View File

@@ -51,7 +51,6 @@ void RGBController_PhilipsHue::SetupZones()
led_zone.leds_min = 1;
led_zone.leds_max = 1;
led_zone.leds_count = 1;
led_zone.matrix_map = NULL;
zones.push_back(led_zone);
led new_led;
@@ -62,13 +61,6 @@ void RGBController_PhilipsHue::SetupZones()
SetupColors();
}
void RGBController_PhilipsHue::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_PhilipsHue::DeviceUpdateLEDs()
{
unsigned char red = RGBGetRValue(colors[0]);
@@ -78,12 +70,12 @@ void RGBController_PhilipsHue::DeviceUpdateLEDs()
controller->SetColor(red, grn, blu);
}
void RGBController_PhilipsHue::UpdateZoneLEDs(int /*zone*/)
void RGBController_PhilipsHue::DeviceUpdateZoneLEDs(int /*zone*/)
{
DeviceUpdateLEDs();
}
void RGBController_PhilipsHue::UpdateSingleLED(int /*led*/)
void RGBController_PhilipsHue::DeviceUpdateSingleLED(int /*led*/)
{
DeviceUpdateLEDs();
}

View File

@@ -20,11 +20,10 @@ public:
RGBController_PhilipsHue(PhilipsHueController* controller_ptr);
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void DeviceUpdateZoneLEDs(int zone);
void DeviceUpdateSingleLED(int led);
void DeviceUpdateMode();

View File

@@ -77,7 +77,6 @@ void RGBController_PhilipsHueEntertainment::SetupZones()
led_zone.leds_min = controller->GetNumLEDs();
led_zone.leds_max = controller->GetNumLEDs();
led_zone.leds_count = controller->GetNumLEDs();
led_zone.matrix_map = NULL;
zones.push_back(led_zone);
for(unsigned int led_idx = 0; led_idx < controller->GetNumLEDs(); led_idx++)
@@ -91,13 +90,6 @@ void RGBController_PhilipsHueEntertainment::SetupZones()
SetupColors();
}
void RGBController_PhilipsHueEntertainment::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_PhilipsHueEntertainment::DeviceUpdateLEDs()
{
last_update_time = std::chrono::steady_clock::now();
@@ -108,12 +100,12 @@ void RGBController_PhilipsHueEntertainment::DeviceUpdateLEDs()
}
}
void RGBController_PhilipsHueEntertainment::UpdateZoneLEDs(int /*zone*/)
void RGBController_PhilipsHueEntertainment::DeviceUpdateZoneLEDs(int /*zone*/)
{
DeviceUpdateLEDs();
}
void RGBController_PhilipsHueEntertainment::UpdateSingleLED(int /*led*/)
void RGBController_PhilipsHueEntertainment::DeviceUpdateSingleLED(int /*led*/)
{
DeviceUpdateLEDs();
}
@@ -126,9 +118,9 @@ void RGBController_PhilipsHueEntertainment::DeviceUpdateMode()
for(unsigned int controller_idx = 0; controller_idx < rgb_controllers.size(); controller_idx++)
{
if(rgb_controllers[controller_idx] != this && rgb_controllers[controller_idx]->GetDescription() == "Philips Hue Entertainment Mode Device" && rgb_controllers[controller_idx]->active_mode == 0)
if(rgb_controllers[controller_idx] != this && rgb_controllers[controller_idx]->GetDescription() == "Philips Hue Entertainment Mode Device" && rgb_controllers[controller_idx]->GetActiveMode() == 0)
{
rgb_controllers[controller_idx]->SetMode(1);
rgb_controllers[controller_idx]->SetActiveMode(1);
}
}
@@ -148,7 +140,7 @@ void RGBController_PhilipsHueEntertainment::KeepaliveThreadFunction()
{
if((std::chrono::steady_clock::now() - last_update_time) > std::chrono::seconds(5))
{
UpdateLEDs();
UpdateLEDsInternal();
}
}
std::this_thread::sleep_for(1s);

View File

@@ -22,11 +22,10 @@ public:
RGBController_PhilipsHueEntertainment(PhilipsHueEntertainmentController* controller_ptr);
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceUpdateLEDs();
void UpdateZoneLEDs(int zone);
void UpdateSingleLED(int led);
void DeviceUpdateZoneLEDs(int zone);
void DeviceUpdateSingleLED(int led);
void DeviceUpdateMode();