Files
OpenRGB/Controllers/NvidiaESAController/RGBController_NvidiaESA.cpp
Adam Honse f75cc9087b 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
2025-12-24 02:20:01 -06:00

107 lines
3.1 KiB
C++

/*---------------------------------------------------------*\
| RGBController_NvidiaESA.cpp |
| |
| RGBController for NVIDIA ESA |
| |
| Morgan Guimard (morg) 18 Feb 2022 |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#include <chrono>
#include <thread>
#include "RGBController_NvidiaESA.h"
/**------------------------------------------------------------------*\
@name Nvidia ESA
@category Case
@type USB
@save :x:
@direct :x:
@effects :white_check_mark:
@detectors DetectNvidiaESAControllers
@comment
\*-------------------------------------------------------------------*/
RGBController_NvidiaESA::RGBController_NvidiaESA(NvidiaESAController* controller_ptr)
{
controller = controller_ptr;
name = controller->GetNameString();
vendor = "NVIDIA";
type = DEVICE_TYPE_CASE;
description = "Nvidia ESA USB Device";;
location = controller->GetDeviceLocation();
serial = controller->GetSerialString();
mode Static;
Static.name = "Static";
Static.value = 0x00;
Static.flags = MODE_FLAG_HAS_PER_LED_COLOR | MODE_FLAG_AUTOMATIC_SAVE;
Static.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Static);
SetupZones();
}
RGBController_NvidiaESA::~RGBController_NvidiaESA()
{
delete controller;
}
void RGBController_NvidiaESA::SetupZones()
{
std::vector<std::string> zone_names =
{
"Front Drive Bays", // 0x42
"Front USB", // 0x43
"Rear", // 0x44
"Internal", // 0x45
"Front Audio" // 0x46
};
for(const std::string& zone_name: zone_names)
{
zone new_zone;
new_zone.name = zone_name;
new_zone.type = ZONE_TYPE_LINEAR;
new_zone.leds_min = 1;
new_zone.leds_max = 1;
new_zone.leds_count = 1;
new_zone.matrix_map = nullptr;
zones.emplace_back(new_zone);
led new_led;
new_led.name = "LED";
leds.push_back(new_led);
}
SetupColors();
}
void RGBController_NvidiaESA::DeviceUpdateLEDs()
{
for(unsigned int zone = 0; zone < zones.size(); zone++)
{
DeviceUpdateZoneLEDs(zone);
}
}
void RGBController_NvidiaESA::DeviceUpdateZoneLEDs(int zone)
{
controller->SetZoneColor(zone, zones[zone].colors[0]);
}
void RGBController_NvidiaESA::DeviceUpdateSingleLED(int /*led*/)
{
DeviceUpdateZoneLEDs(0);
}
void RGBController_NvidiaESA::DeviceUpdateMode()
{
DeviceUpdateLEDs();
}