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 a86ab2955a
commit 25a753b97a
680 changed files with 9570 additions and 9255 deletions

View File

@@ -999,18 +999,20 @@ unsigned int KeyboardLayoutManager::GetColumnCount()
return cols;
}
void KeyboardLayoutManager::GetKeyMap(unsigned int* map_ptr)
matrix_map_type KeyboardLayoutManager::GetKeyMap()
{
GetKeyMap(map_ptr, KEYBOARD_MAP_FILL_TYPE_INDEX, rows, cols);
return GetKeyMap(KEYBOARD_MAP_FILL_TYPE_INDEX, rows, cols);
}
void KeyboardLayoutManager::GetKeyMap(unsigned int* map_ptr, KEYBOARD_MAP_FILL_TYPE fill_type)
matrix_map_type KeyboardLayoutManager::GetKeyMap(KEYBOARD_MAP_FILL_TYPE fill_type)
{
GetKeyMap(map_ptr, fill_type, rows, cols);
return GetKeyMap(fill_type, rows, cols);
}
void KeyboardLayoutManager::GetKeyMap(unsigned int* map_ptr, KEYBOARD_MAP_FILL_TYPE fill_type, uint8_t height = 0, uint8_t width = 0)
matrix_map_type KeyboardLayoutManager::GetKeyMap(KEYBOARD_MAP_FILL_TYPE fill_type, uint8_t height = 0, uint8_t width = 0)
{
matrix_map_type matrix_map;
unsigned int no_key = -1;
/*-------------------------------------------------------------------------*\
@@ -1027,13 +1029,17 @@ void KeyboardLayoutManager::GetKeyMap(unsigned int* map_ptr, KEYBOARD_MAP_FILL_T
height = rows;
}
matrix_map.width = width;
matrix_map.height = height;
matrix_map.map.resize(width * height);
for(unsigned int r = 0; r < height; r++)
{
unsigned int offset = r * width;
for(unsigned int c = 0; c < width; c++)
{
map_ptr[offset + c] = no_key;
matrix_map.map[offset + c] = no_key;
}
}
@@ -1051,19 +1057,21 @@ void KeyboardLayoutManager::GetKeyMap(unsigned int* map_ptr, KEYBOARD_MAP_FILL_T
switch(fill_type)
{
case KEYBOARD_MAP_FILL_TYPE_COUNT:
map_ptr[offset] = i;
matrix_map.map[offset] = i;
break;
case KEYBOARD_MAP_FILL_TYPE_VALUE:
map_ptr[offset] = keymap[i].value;
matrix_map.map[offset] = keymap[i].value;
break;
case KEYBOARD_MAP_FILL_TYPE_INDEX:
default:
map_ptr[offset] = offset;
matrix_map.map[offset] = offset;
break;
}
}
return(matrix_map);
}
void KeyboardLayoutManager::UpdateDimensions()