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 6deaf2f4fd
commit fdaf2eee6c
657 changed files with 9060 additions and 8801 deletions

View File

@@ -248,16 +248,6 @@ RGBController_DasKeyboard::RGBController_DasKeyboard(DasKeyboardController* cont
RGBController_DasKeyboard::~RGBController_DasKeyboard()
{
/*---------------------------------------------------------*\
| Delete the matrix map |
\*---------------------------------------------------------*/
unsigned int zone_size = (unsigned int)zones.size();
for(unsigned int zone_index = 0; zone_index < zone_size; zone_index++)
{
delete zones[zone_index].matrix_map;
}
delete controller;
}
@@ -276,17 +266,14 @@ void RGBController_DasKeyboard::SetupZones()
new_zone.leds_min = zone_sizes[zone_idx];
new_zone.leds_max = zone_sizes[zone_idx];
new_zone.leds_count = zone_sizes[zone_idx];
new_zone.matrix_map = new matrix_map_type;
new_zone.matrix_map->height = 7;
new_zone.matrix_map->width = 21;
if(controller->GetLayoutString() == "US")
{
new_zone.matrix_map->map = (unsigned int *) &matrix_map_us;
new_zone.matrix_map.Set(7, 21, (unsigned int *)&matrix_map_us);
}
else
{
new_zone.matrix_map->map = (unsigned int *) &matrix_map_eu;
new_zone.matrix_map.Set(7, 21, (unsigned int *)&matrix_map_eu);
}
zones.push_back(new_zone);
@@ -304,25 +291,18 @@ void RGBController_DasKeyboard::SetupZones()
SetupColors();
}
void RGBController_DasKeyboard::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_DasKeyboard::DeviceUpdateLEDs()
{
UpdateZoneLEDs(0);
DeviceUpdateZoneLEDs(0);
}
void RGBController_DasKeyboard::UpdateZoneLEDs(int /*zone*/)
void RGBController_DasKeyboard::DeviceUpdateZoneLEDs(int /*zone*/)
{
updateDevice = false;
for(unsigned int led_idx = 0; led_idx < leds.size(); led_idx++)
{
UpdateSingleLED(static_cast<int>(led_idx));
DeviceUpdateSingleLED(static_cast<int>(led_idx));
}
updateDevice = true;
@@ -330,7 +310,7 @@ void RGBController_DasKeyboard::UpdateZoneLEDs(int /*zone*/)
controller->SendApply();
}
void RGBController_DasKeyboard::UpdateSingleLED(int led)
void RGBController_DasKeyboard::DeviceUpdateSingleLED(int led)
{
mode selected_mode = modes[active_mode];

View File

@@ -29,11 +29,10 @@ public:
~RGBController_DasKeyboard();
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();