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

@@ -763,21 +763,10 @@ void RGBController_WinbondGamingKeyboard::SetupZones()
KeyboardLayoutManager new_kb(controller->GetLayout(), kb_size, *layouts);
matrix_map_type * new_map = new matrix_map_type;
new_zone.matrix_map = new_map;
new_zone.matrix_map->height = new_kb.GetRowCount();
new_zone.matrix_map->width = new_kb.GetColumnCount();
new_zone.matrix_map->map = new unsigned int[new_map->height * new_map->width];
new_zone.leds_count = new_kb.GetKeyCount();
new_zone.leds_min = new_zone.leds_count;
new_zone.leds_max = new_zone.leds_count;
/*---------------------------------------------------------*\
| Matrix map still uses declared zone rows and columns |
| as the packet structure depends on the matrix map |
\*---------------------------------------------------------*/
new_kb.GetKeyMap(new_map->map, KEYBOARD_MAP_FILL_TYPE_COUNT);
new_zone.leds_count = new_kb.GetKeyCount();
new_zone.leds_min = new_zone.leds_count;
new_zone.leds_max = new_zone.leds_count;
new_zone.matrix_map = new_kb.GetKeyMap(KEYBOARD_MAP_FILL_TYPE_COUNT);
/*---------------------------------------------------------*\
| Create LEDs for the Matrix zone |
@@ -808,7 +797,6 @@ void RGBController_WinbondGamingKeyboard::SetupZones()
logo_zone.leds_min = 1;
logo_zone.leds_max = 1;
logo_zone.leds_count = 1;
logo_zone.matrix_map = NULL;
led zone_led;
zone_led.name = "Logo LEDs";
@@ -823,24 +811,17 @@ void RGBController_WinbondGamingKeyboard::SetupZones()
#undef KV
void RGBController_WinbondGamingKeyboard::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_WinbondGamingKeyboard::DeviceUpdateLEDs()
{
controller->SetLEDsData(colors, leds, modes[active_mode].brightness);
}
void RGBController_WinbondGamingKeyboard::UpdateZoneLEDs(int /*zone*/)
void RGBController_WinbondGamingKeyboard::DeviceUpdateZoneLEDs(int /*zone*/)
{
DeviceUpdateLEDs();
}
void RGBController_WinbondGamingKeyboard::UpdateSingleLED(int /*led*/)
void RGBController_WinbondGamingKeyboard::DeviceUpdateSingleLED(int /*led*/)
{
DeviceUpdateLEDs();
}

View File

@@ -38,14 +38,13 @@ public:
RGBController_WinbondGamingKeyboard(WinbondGamingKeyboardController* ctrl);
~RGBController_WinbondGamingKeyboard();
void SetupZones() override;
void ResizeZone(int zone, int new_size) override;
void SetupZones();
void DeviceUpdateLEDs() override;
void UpdateZoneLEDs(int zone) override;
void UpdateSingleLED(int led) override;
void DeviceUpdateLEDs();
void DeviceUpdateZoneLEDs(int zone);
void DeviceUpdateSingleLED(int led);
void DeviceUpdateMode() override;
void DeviceUpdateMode();
private:
WinbondGamingKeyboardController* controller;