mirror of
https://github.com/CalcProgrammer1/OpenRGB.git
synced 2026-05-24 14:35:01 -04:00
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:
@@ -37,14 +37,6 @@ void DetectIonicoControllers(hid_device_info* info, const std::string& name)
|
||||
IonicoController* controller = new IonicoController(dev, *info, info->product_id, name);
|
||||
RGBController_Ionico* rgb_controller = new RGBController_Ionico(controller);
|
||||
|
||||
if(info->product_id == IONICO_KB_PID)
|
||||
{
|
||||
rgb_controller->type = DEVICE_TYPE_KEYBOARD;
|
||||
}
|
||||
else if(info->product_id == IONICO_FB_PID)
|
||||
{
|
||||
rgb_controller->type = DEVICE_TYPE_LEDSTRIP;
|
||||
}
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,15 @@ RGBController_Ionico::RGBController_Ionico(IonicoController* controller_ptr)
|
||||
description = name;
|
||||
location = controller->GetDeviceLocation();
|
||||
|
||||
if(controller->GetUSBPID() == IONICO_KB_PID)
|
||||
{
|
||||
type = DEVICE_TYPE_KEYBOARD;
|
||||
}
|
||||
else if(controller->GetUSBPID() == IONICO_FB_PID)
|
||||
{
|
||||
type = DEVICE_TYPE_LEDSTRIP;
|
||||
}
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
Direct.value = IONICO_MODE_DIRECT;
|
||||
@@ -144,7 +153,6 @@ void RGBController_Ionico::SetupZones()
|
||||
zone_keyboard.leds_min = (unsigned int)leds.size();
|
||||
zone_keyboard.leds_max = (unsigned int)leds.size();
|
||||
zone_keyboard.leds_count = (unsigned int)leds.size();
|
||||
zone_keyboard.matrix_map = nullptr;
|
||||
zones.emplace_back(zone_keyboard);
|
||||
for(size_t i = 0; i < leds.size(); ++i)
|
||||
{
|
||||
@@ -160,7 +168,6 @@ void RGBController_Ionico::SetupZones()
|
||||
zone_bar.leds_min = (unsigned int)leds.size();
|
||||
zone_bar.leds_max = (unsigned int)leds.size();
|
||||
zone_bar.leds_count = (unsigned int)leds.size();
|
||||
zone_bar.matrix_map = nullptr;
|
||||
zones.emplace_back(zone_bar);
|
||||
for(size_t i = 0; i < leds.size(); ++i)
|
||||
{
|
||||
@@ -170,13 +177,6 @@ void RGBController_Ionico::SetupZones()
|
||||
SetupColors();
|
||||
}
|
||||
|
||||
void RGBController_Ionico::ResizeZone(int /*zone*/, int /*new_size*/)
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
| This device does not support resizing zones |
|
||||
\*---------------------------------------------------------*/
|
||||
}
|
||||
|
||||
void RGBController_Ionico::DeviceUpdateLEDs()
|
||||
{
|
||||
/*---------------------------------------------------------*\
|
||||
@@ -190,12 +190,12 @@ void RGBController_Ionico::DeviceSaveMode()
|
||||
controller->SaveBios();
|
||||
}
|
||||
|
||||
void RGBController_Ionico::UpdateZoneLEDs(int /*zone*/)
|
||||
void RGBController_Ionico::DeviceUpdateZoneLEDs(int /*zone*/)
|
||||
{
|
||||
DeviceUpdateLEDs();
|
||||
}
|
||||
|
||||
void RGBController_Ionico::UpdateSingleLED(int /*led*/)
|
||||
void RGBController_Ionico::DeviceUpdateSingleLED(int /*led*/)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
@@ -24,17 +24,14 @@ public:
|
||||
~RGBController_Ionico();
|
||||
|
||||
void SetupZones();
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void SetSingleLED();
|
||||
void UpdateSingleLED(int led);
|
||||
void DeviceUpdateZoneLEDs(int zone);
|
||||
void DeviceUpdateSingleLED(int led);
|
||||
|
||||
void DeviceSaveMode();
|
||||
|
||||
void DeviceUpdateMode();
|
||||
|
||||
|
||||
private:
|
||||
IonicoController* controller;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user