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

@@ -123,7 +123,6 @@ void RGBController_RoccatBurst::SetupZones()
new_zone.leds_min = leds_count;
new_zone.leds_max = leds_count;
new_zone.leds_count = leds_count;
new_zone.matrix_map = NULL;
zones.push_back(new_zone);
std::string led_names[2] =
@@ -142,19 +141,12 @@ void RGBController_RoccatBurst::SetupZones()
SetupColors();
}
void RGBController_RoccatBurst::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_RoccatBurst::DeviceUpdateLEDs()
{
UpdateZoneLEDs(0);
DeviceUpdateZoneLEDs(0);
}
void RGBController_RoccatBurst::UpdateZoneLEDs(int /*zone_idx*/)
void RGBController_RoccatBurst::DeviceUpdateZoneLEDs(int /*zone_idx*/)
{
const mode& active = modes[active_mode];
@@ -169,9 +161,9 @@ void RGBController_RoccatBurst::UpdateZoneLEDs(int /*zone_idx*/)
}
void RGBController_RoccatBurst::UpdateSingleLED(int /*led_idx*/)
void RGBController_RoccatBurst::DeviceUpdateSingleLED(int /*led_idx*/)
{
UpdateZoneLEDs(0);
DeviceUpdateZoneLEDs(0);
}
void RGBController_RoccatBurst::DeviceUpdateMode()

View File

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

@@ -98,7 +98,6 @@ void RGBController_RoccatBurstProAir::SetupZones()
new_zone.leds_min = ROCCAT_BURST_PRO_AIR_PRO_NUMBER_OF_LEDS;
new_zone.leds_max = ROCCAT_BURST_PRO_AIR_PRO_NUMBER_OF_LEDS;
new_zone.leds_count = ROCCAT_BURST_PRO_AIR_PRO_NUMBER_OF_LEDS;
new_zone.matrix_map = NULL;
zones.push_back(new_zone);
std::string led_names[ROCCAT_BURST_PRO_AIR_PRO_NUMBER_OF_LEDS] =
@@ -119,26 +118,19 @@ void RGBController_RoccatBurstProAir::SetupZones()
SetupColors();
}
void RGBController_RoccatBurstProAir::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_RoccatBurstProAir::DeviceUpdateLEDs()
{
UpdateZoneLEDs(0);
DeviceUpdateZoneLEDs(0);
}
void RGBController_RoccatBurstProAir::UpdateZoneLEDs(int /*zone_idx*/)
void RGBController_RoccatBurstProAir::DeviceUpdateZoneLEDs(int /*zone_idx*/)
{
controller->SetColors(colors);
}
void RGBController_RoccatBurstProAir::UpdateSingleLED(int /*led_idx*/)
void RGBController_RoccatBurstProAir::DeviceUpdateSingleLED(int /*led_idx*/)
{
UpdateZoneLEDs(0);
DeviceUpdateZoneLEDs(0);
}
void RGBController_RoccatBurstProAir::DeviceUpdateMode()

View File

@@ -21,10 +21,11 @@ public:
~RGBController_RoccatBurstProAir();
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();
private:

View File

@@ -58,7 +58,6 @@ void RGBController_RoccatElo::SetupZones()
new_zone.leds_min = ROCCAT_ELO_LEDS_COUNT;
new_zone.leds_max = ROCCAT_ELO_LEDS_COUNT;
new_zone.leds_count = ROCCAT_ELO_LEDS_COUNT;
new_zone.matrix_map = nullptr;
zones.emplace_back(new_zone);
@@ -67,24 +66,17 @@ void RGBController_RoccatElo::SetupZones()
SetupColors();
}
void RGBController_RoccatElo::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_RoccatElo::DeviceUpdateLEDs()
{
controller->SendDirect(colors[0]);
}
void RGBController_RoccatElo::UpdateZoneLEDs(int /*zone*/)
void RGBController_RoccatElo::DeviceUpdateZoneLEDs(int /*zone*/)
{
DeviceUpdateLEDs();
}
void RGBController_RoccatElo::UpdateSingleLED(int /*led*/)
void RGBController_RoccatElo::DeviceUpdateSingleLED(int /*led*/)
{
DeviceUpdateLEDs();
}

View File

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

@@ -56,7 +56,6 @@ void RGBController_RoccatHordeAimo::SetupZones()
new_zone.leds_min = NUMBER_OF_LEDS;
new_zone.leds_max = NUMBER_OF_LEDS;
new_zone.leds_count = NUMBER_OF_LEDS;
new_zone.matrix_map = NULL;
zones.push_back(new_zone);
for(unsigned int i = 0; i < NUMBER_OF_LEDS; i++)
@@ -69,26 +68,19 @@ void RGBController_RoccatHordeAimo::SetupZones()
SetupColors();
}
void RGBController_RoccatHordeAimo::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_RoccatHordeAimo::DeviceUpdateLEDs()
{
UpdateZoneLEDs(0);
DeviceUpdateZoneLEDs(0);
}
void RGBController_RoccatHordeAimo::UpdateZoneLEDs(int /*zone_idx*/)
void RGBController_RoccatHordeAimo::DeviceUpdateZoneLEDs(int /*zone_idx*/)
{
controller->SetColors(colors);
}
void RGBController_RoccatHordeAimo::UpdateSingleLED(int /*led_idx*/)
void RGBController_RoccatHordeAimo::DeviceUpdateSingleLED(int /*led_idx*/)
{
UpdateZoneLEDs(0);
DeviceUpdateZoneLEDs(0);
}
void RGBController_RoccatHordeAimo::DeviceUpdateMode()

View File

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

@@ -64,7 +64,6 @@ void RGBController_RoccatKoneAimo::SetupZones()
WHEEL_zone.leds_min = 1;
WHEEL_zone.leds_max = 1;
WHEEL_zone.leds_count = 1;
WHEEL_zone.matrix_map = NULL;
zones.push_back(WHEEL_zone);
zones_channel.push_back(SCROLL_WHEEL);
@@ -80,7 +79,6 @@ void RGBController_RoccatKoneAimo::SetupZones()
STRIP_LEFT_zone.leds_min = 4;
STRIP_LEFT_zone.leds_max = 4;
STRIP_LEFT_zone.leds_count = 4;
STRIP_LEFT_zone.matrix_map = NULL;
zones.push_back(STRIP_LEFT_zone);
zones_channel.push_back(STRIP_LEFT);
@@ -99,7 +97,6 @@ void RGBController_RoccatKoneAimo::SetupZones()
STRIP_RIGHT_zone.leds_min = 4;
STRIP_RIGHT_zone.leds_max = 4;
STRIP_RIGHT_zone.leds_count = 4;
STRIP_RIGHT_zone.matrix_map = NULL;
zones.push_back(STRIP_RIGHT_zone);
zones_channel.push_back(STRIP_RIGHT);
@@ -118,7 +115,6 @@ void RGBController_RoccatKoneAimo::SetupZones()
LOWER_LEFT_zone.leds_min = 1;
LOWER_LEFT_zone.leds_max = 1;
LOWER_LEFT_zone.leds_count = 1;
LOWER_LEFT_zone.matrix_map = NULL;
zones.push_back(LOWER_LEFT_zone);
zones_channel.push_back(LOWER_LEFT);
@@ -134,7 +130,6 @@ void RGBController_RoccatKoneAimo::SetupZones()
LOWER_RIGHT_zone.leds_min = 1;
LOWER_RIGHT_zone.leds_max = 1;
LOWER_RIGHT_zone.leds_count = 1;
LOWER_RIGHT_zone.matrix_map = NULL;
zones.push_back(LOWER_RIGHT_zone);
zones_channel.push_back(LOWER_RIGHT);
@@ -159,13 +154,6 @@ void RGBController_RoccatKoneAimo::SetupZones()
}
}
void RGBController_RoccatKoneAimo::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_RoccatKoneAimo::DeviceUpdateLEDs()
{
/*---------------------------------------------------------*\
@@ -181,7 +169,7 @@ void RGBController_RoccatKoneAimo::DeviceUpdateLEDs()
controller->SendUpdate();
}
void RGBController_RoccatKoneAimo::UpdateZoneLEDs(int zone_idx)
void RGBController_RoccatKoneAimo::DeviceUpdateZoneLEDs(int zone_idx)
{
/*---------------------------------------------------------*\
| Set colors for one channel of leds |
@@ -193,7 +181,7 @@ void RGBController_RoccatKoneAimo::UpdateZoneLEDs(int zone_idx)
controller->SendUpdate();
}
void RGBController_RoccatKoneAimo::UpdateSingleLED(int led_idx)
void RGBController_RoccatKoneAimo::DeviceUpdateSingleLED(int led_idx)
{
/*---------------------------------------------------------*\
| Get channel corresponding to led |

View File

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

@@ -132,7 +132,6 @@ void RGBController_RoccatKoneProAir::SetupZones()
new_zone.leds_min = ROCCAT_KONE_PRO_AIR_LED_COUNT;
new_zone.leds_max = ROCCAT_KONE_PRO_AIR_LED_COUNT;
new_zone.leds_count = ROCCAT_KONE_PRO_AIR_LED_COUNT;
new_zone.matrix_map = NULL;
zones.push_back(new_zone);
std::string led_names[2] =
@@ -151,13 +150,6 @@ void RGBController_RoccatKoneProAir::SetupZones()
SetupColors();
}
void RGBController_RoccatKoneProAir::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_RoccatKoneProAir::DeviceUpdateLEDs()
{
const mode& active = modes[active_mode];
@@ -172,12 +164,12 @@ void RGBController_RoccatKoneProAir::DeviceUpdateLEDs()
}
}
void RGBController_RoccatKoneProAir::UpdateZoneLEDs(int /*zone_idx*/)
void RGBController_RoccatKoneProAir::DeviceUpdateZoneLEDs(int /*zone_idx*/)
{
DeviceUpdateLEDs();
}
void RGBController_RoccatKoneProAir::UpdateSingleLED(int /*led_idx*/)
void RGBController_RoccatKoneProAir::DeviceUpdateSingleLED(int /*led_idx*/)
{
DeviceUpdateLEDs();
}

View File

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

@@ -125,7 +125,6 @@ void RGBController_RoccatKonePro::SetupZones()
new_zone.leds_min = ROCCAT_KONE_PRO_LED_COUNT;
new_zone.leds_max = ROCCAT_KONE_PRO_LED_COUNT;
new_zone.leds_count = ROCCAT_KONE_PRO_LED_COUNT;
new_zone.matrix_map = NULL;
zones.push_back(new_zone);
std::string led_names[2] =
@@ -144,13 +143,6 @@ void RGBController_RoccatKonePro::SetupZones()
SetupColors();
}
void RGBController_RoccatKonePro::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_RoccatKonePro::DeviceUpdateLEDs()
{
const mode& active = modes[active_mode];
@@ -165,12 +157,12 @@ void RGBController_RoccatKonePro::DeviceUpdateLEDs()
}
}
void RGBController_RoccatKonePro::UpdateZoneLEDs(int /*zone_idx*/)
void RGBController_RoccatKonePro::DeviceUpdateZoneLEDs(int /*zone_idx*/)
{
DeviceUpdateLEDs();
}
void RGBController_RoccatKonePro::UpdateSingleLED(int /*led_idx*/)
void RGBController_RoccatKonePro::DeviceUpdateSingleLED(int /*led_idx*/)
{
DeviceUpdateLEDs();
}

View File

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

@@ -180,7 +180,6 @@ void RGBController_RoccatKoneXP::SetupZones()
left.leds_min = 9;
left.leds_max = 9;
left.leds_count = 9;
left.matrix_map = NULL;
zones.push_back(left);
for (uint8_t i = 1; i <= 9; i++) {
@@ -195,7 +194,6 @@ void RGBController_RoccatKoneXP::SetupZones()
right.leds_min = 9;
right.leds_max = 9;
right.leds_count = 9;
right.matrix_map = NULL;
zones.push_back(right);
for (uint8_t i = 1; i <= 9; i++) {
@@ -210,7 +208,6 @@ void RGBController_RoccatKoneXP::SetupZones()
wheel.leds_min = 1;
wheel.leds_max = 1;
wheel.leds_count = 1;
wheel.matrix_map = NULL;
zones.push_back(wheel);
led wheel_led;
@@ -223,7 +220,6 @@ void RGBController_RoccatKoneXP::SetupZones()
dpi.leds_min = 1;
dpi.leds_max = 1;
dpi.leds_count = 1;
dpi.matrix_map = NULL;
zones.push_back(dpi);
led dpi_led;
@@ -233,13 +229,6 @@ void RGBController_RoccatKoneXP::SetupZones()
SetupColors();
}
void RGBController_RoccatKoneXP::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_RoccatKoneXP::DeviceUpdateLEDs()
{
if(modes[active_mode].value == ROCCAT_KONE_XP_MODE_DIRECT)
@@ -252,12 +241,12 @@ void RGBController_RoccatKoneXP::DeviceUpdateLEDs()
}
}
void RGBController_RoccatKoneXP::UpdateZoneLEDs(int /*zone_idx*/)
void RGBController_RoccatKoneXP::DeviceUpdateZoneLEDs(int /*zone_idx*/)
{
DeviceUpdateLEDs();
}
void RGBController_RoccatKoneXP::UpdateSingleLED(int /*led_idx*/)
void RGBController_RoccatKoneXP::DeviceUpdateSingleLED(int /*led_idx*/)
{
DeviceUpdateLEDs();
}

View File

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

@@ -94,7 +94,6 @@ void RGBController_RoccatKova::SetupZones()
Mouse.leds_count = ROCCAT_KOVA_LED_COUNT;
Mouse.leds_min = ROCCAT_KOVA_LED_COUNT;
Mouse.leds_max = ROCCAT_KOVA_LED_COUNT;
Mouse.matrix_map = NULL;
zones.push_back(Mouse);
led WheelLED;
@@ -110,24 +109,17 @@ void RGBController_RoccatKova::SetupZones()
SetupColors();
}
void RGBController_RoccatKova::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_RoccatKova::DeviceUpdateLEDs()
{
DeviceUpdateMode();
}
void RGBController_RoccatKova::UpdateZoneLEDs(int /*zone*/)
void RGBController_RoccatKova::DeviceUpdateZoneLEDs(int /*zone*/)
{
DeviceUpdateMode();
}
void RGBController_RoccatKova::UpdateSingleLED(int /*led*/)
void RGBController_RoccatKova::DeviceUpdateSingleLED(int /*led*/)
{
DeviceUpdateMode();
}

View File

@@ -22,11 +22,9 @@ public:
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

@@ -144,7 +144,6 @@ void RGBController_RoccatSenseAimo::SetupZones()
pad.leds_min = 2;
pad.leds_max = 2;
pad.leds_count = 2;
pad.matrix_map = NULL;
zones.push_back(pad);
led left_led;
@@ -158,13 +157,6 @@ void RGBController_RoccatSenseAimo::SetupZones()
SetupColors();
}
void RGBController_RoccatSenseAimo::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_RoccatSenseAimo::DeviceUpdateLEDs()
{
if(modes[active_mode].value == ROCCAT_SENSE_AIMO_MODE_DIRECT)
@@ -177,12 +169,12 @@ void RGBController_RoccatSenseAimo::DeviceUpdateLEDs()
}
}
void RGBController_RoccatSenseAimo::UpdateZoneLEDs(int /*zone_idx*/)
void RGBController_RoccatSenseAimo::DeviceUpdateZoneLEDs(int /*zone_idx*/)
{
DeviceUpdateLEDs();
}
void RGBController_RoccatSenseAimo::UpdateSingleLED(int /*led_idx*/)
void RGBController_RoccatSenseAimo::DeviceUpdateSingleLED(int /*led_idx*/)
{
DeviceUpdateLEDs();
}

View File

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

@@ -158,10 +158,7 @@ void RGBController_RoccatVulcanKeyboard::SetupZones()
keyboard_zone.leds_min = keyboard[layout].size;
keyboard_zone.leds_max = keyboard[layout].size;
keyboard_zone.leds_count = keyboard[layout].size;
keyboard_zone.matrix_map = new matrix_map_type;
keyboard_zone.matrix_map->height = keyboard[layout].rows;
keyboard_zone.matrix_map->width = keyboard[layout].cols;
keyboard_zone.matrix_map->map = keyboard[layout].matrix_map;
keyboard_zone.matrix_map.Set(keyboard[layout].rows, keyboard[layout].cols, keyboard[layout].matrix_map);
zones.push_back(keyboard_zone);
for(int led_id = 0; led_id < keyboard[layout].size; led_id++)
@@ -181,13 +178,6 @@ void RGBController_RoccatVulcanKeyboard::SetupZones()
DeviceUpdateLEDs();
}
void RGBController_RoccatVulcanKeyboard::ResizeZone(int /*zone*/, int /*new_size*/)
{
/*---------------------------------------------------------*\
| This device does not support resizing zones |
\*---------------------------------------------------------*/
}
void RGBController_RoccatVulcanKeyboard::DeviceUpdateLEDs()
{
if(modes[active_mode].value == ROCCAT_VULCAN_MODE_DIRECT)
@@ -207,12 +197,12 @@ void RGBController_RoccatVulcanKeyboard::DeviceUpdateLEDs()
}
}
void RGBController_RoccatVulcanKeyboard::UpdateZoneLEDs(int /*zone_idx*/)
void RGBController_RoccatVulcanKeyboard::DeviceUpdateZoneLEDs(int /*zone_idx*/)
{
DeviceUpdateLEDs();
}
void RGBController_RoccatVulcanKeyboard::UpdateSingleLED(int /*led_idx*/)
void RGBController_RoccatVulcanKeyboard::DeviceUpdateSingleLED(int /*led_idx*/)
{
DeviceUpdateLEDs();
}

View File

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