Files
OpenRGB/Controllers/AsusMonitorController/RGBController_AsusMonitor.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

96 lines
2.8 KiB
C++

/*---------------------------------------------------------*\
| RGBController_AsusMonitor.cpp |
| |
| RGBController for Asus monitors |
| |
| Morgan Guimard (morg) 19 oct 2025 |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#include "RGBController_AsusMonitor.h"
/**------------------------------------------------------------------*\
@name Asus monitors
@category Monitor
@type USB
@save :x:
@direct :white_check_mark:
@effects :x:
@detectors DetectAsusMonitorControllers
@comment
\*-------------------------------------------------------------------*/
RGBController_AsusMonitor::RGBController_AsusMonitor(AsusMonitorController* controller_ptr)
{
controller = controller_ptr;
name = controller->GetNameString();
vendor = "ASUS";
type = DEVICE_TYPE_MONITOR;
description = "ASUS monitor";
location = controller->GetDeviceLocation();
serial = controller->GetSerialString();
number_of_leds = controller->GetNumberOfLEDs();
controller->SendInit();
mode Direct;
Direct.name = "Direct";
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Direct.color_mode = MODE_COLORS_PER_LED;
modes.push_back(Direct);
SetupZones();
}
RGBController_AsusMonitor::~RGBController_AsusMonitor()
{
delete controller;
}
void RGBController_AsusMonitor::SetupZones()
{
zone new_zone;
new_zone.name = "Monitor";
new_zone.type = ZONE_TYPE_LINEAR;
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 = nullptr;
zones.emplace_back(new_zone);
leds.resize(new_zone.leds_count);
for(unsigned int i = 0; i < number_of_leds; i++)
{
leds[i].name = "LED " + std::to_string(i);
}
SetupColors();
}
void RGBController_AsusMonitor::DeviceUpdateLEDs()
{
controller->SetDirect(colors);
}
void RGBController_AsusMonitor::DeviceUpdateZoneLEDs(int /*zone*/)
{
DeviceUpdateLEDs();
}
void RGBController_AsusMonitor::DeviceUpdateSingleLED(int /*led*/)
{
DeviceUpdateLEDs();
}
void RGBController_AsusMonitor::DeviceUpdateMode()
{
DeviceUpdateLEDs();
}