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

@@ -135,7 +135,6 @@ void RGBController_ASRockASRRGBSMBus::SetupZones()
new_zone->leds_min = 1;
new_zone->leds_max = 1;
new_zone->leds_count = 1;
new_zone->matrix_map = NULL;
/*---------------------------------------------------------*\
| Push new zone to zones vector |
@@ -160,7 +159,7 @@ void RGBController_ASRockASRRGBSMBus::SetupZones()
SetupColors();
}
void RGBController_ASRockASRRGBSMBus::ResizeZone(int /*zone*/, int /*new_size*/)
void RGBController_ASRockASRRGBSMBus::DeviceResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
@@ -171,16 +170,16 @@ void RGBController_ASRockASRRGBSMBus::DeviceUpdateLEDs()
{
for(unsigned int led = 0; led < colors.size(); led++)
{
UpdateSingleLED(led);
DeviceUpdateSingleLED(led);
}
}
void RGBController_ASRockASRRGBSMBus::UpdateZoneLEDs(int /*zone*/)
void RGBController_ASRockASRRGBSMBus::DeviceUpdateZoneLEDs(int /*zone*/)
{
DeviceUpdateLEDs();
}
void RGBController_ASRockASRRGBSMBus::UpdateSingleLED(int led)
void RGBController_ASRockASRRGBSMBus::DeviceUpdateSingleLED(int led)
{
unsigned char red = RGBGetRValue(colors[led]);
unsigned char grn = RGBGetGValue(colors[led]);

View File

@@ -22,11 +22,11 @@ public:
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceResizeZone(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

@@ -267,7 +267,6 @@ void RGBController_ASRockPolychromeV1SMBus::SetupZones()
new_zone->leds_min = 1;
new_zone->leds_max = 1;
new_zone->leds_count = 1;
new_zone->matrix_map = NULL;
if(zone_idx == POLYCHROME_V1_ZONE_ADDRESSABLE)
{
@@ -297,9 +296,9 @@ void RGBController_ASRockPolychromeV1SMBus::SetupZones()
SetupColors();
}
void RGBController_ASRockPolychromeV1SMBus::ResizeZone(int zone, int new_size)
void RGBController_ASRockPolychromeV1SMBus::DeviceResizeZone(int zone, int new_size)
{
LOG_TRACE("[%s] ResizeZone(%02X, %02X)", name.c_str(), zone, new_size);
LOG_TRACE("[%s] DeviceResizeZone(%02X, %02X)", name.c_str(), zone, new_size);
controller-> SetARGBSize(new_size & 0xFF);
zones[POLYCHROME_V1_ZONE_ADDRESSABLE].leds_count = 1;
}
@@ -309,19 +308,19 @@ void RGBController_ASRockPolychromeV1SMBus::DeviceUpdateLEDs()
LOG_TRACE("[%s] DeviceUpdateLEDs()", name.c_str());
for (uint8_t zone_idx = 0; zone_idx < zoneIndexMap.size(); zone_idx++)
{
UpdateSingleLED(zone_idx);
DeviceUpdateSingleLED(zone_idx);
}
}
void RGBController_ASRockPolychromeV1SMBus::UpdateZoneLEDs(int /*zone*/)
void RGBController_ASRockPolychromeV1SMBus::DeviceUpdateZoneLEDs(int /*zone*/)
{
LOG_TRACE("[%s] UpdateZoneLEDs()", name.c_str());
LOG_TRACE("[%s] DeviceUpdateZoneLEDs()", name.c_str());
DeviceUpdateLEDs();
}
void RGBController_ASRockPolychromeV1SMBus::UpdateSingleLED(int zone)
void RGBController_ASRockPolychromeV1SMBus::DeviceUpdateSingleLED(int zone)
{
LOG_TRACE("[%s] UpdateSingleLED(%02X)", name.c_str(), zone);
LOG_TRACE("[%s] DeviceUpdateSingleLED(%02X)", name.c_str(), zone);
uint8_t red = RGBGetRValue(colors[zone]);
uint8_t grn = RGBGetGValue(colors[zone]);
@@ -338,7 +337,7 @@ void RGBController_ASRockPolychromeV1SMBus::DeviceUpdateMode()
for(uint8_t zone_idx = 0; zone_idx < zoneIndexMap.size(); zone_idx++)
{
controller->SetMode(zoneIndexMap[zone_idx], modes[active_mode].value, modes[active_mode].speed);
UpdateSingleLED(zone_idx);
DeviceUpdateSingleLED(zone_idx);
}
}
else

View File

@@ -23,11 +23,11 @@ public:
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceResizeZone(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

@@ -229,8 +229,6 @@ void RGBController_ASRockPolychromeV2SMBus::SetupZones()
new_zone->type = ZONE_TYPE_SINGLE;
}
new_zone->matrix_map = NULL;
/*---------------------------------------------------------*\
| Push new zone to zones vector |
\*---------------------------------------------------------*/
@@ -281,7 +279,7 @@ void RGBController_ASRockPolychromeV2SMBus::SetupZones()
SetupColors();
}
void RGBController_ASRockPolychromeV2SMBus::ResizeZone(int /*zone*/, int /*new_size*/)
void RGBController_ASRockPolychromeV2SMBus::DeviceResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
@@ -292,16 +290,16 @@ void RGBController_ASRockPolychromeV2SMBus::DeviceUpdateLEDs()
{
for(unsigned int led = 0; led < colors.size(); led++)
{
UpdateSingleLED(led);
DeviceUpdateSingleLED(led);
}
}
void RGBController_ASRockPolychromeV2SMBus::UpdateZoneLEDs(int /*zone*/)
void RGBController_ASRockPolychromeV2SMBus::DeviceUpdateZoneLEDs(int /*zone*/)
{
DeviceUpdateLEDs();
}
void RGBController_ASRockPolychromeV2SMBus::UpdateSingleLED(int led)
void RGBController_ASRockPolychromeV2SMBus::DeviceUpdateSingleLED(int led)
{
unsigned char red = RGBGetRValue(colors[led]);
unsigned char grn = RGBGetGValue(colors[led]);

View File

@@ -23,11 +23,11 @@ public:
void SetupZones();
void ResizeZone(int zone, int new_size);
void DeviceResizeZone(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();