Files
OpenRGB/Controllers/HPOmenLaptopController/RGBController_HPOmenLaptopWMI_Windows.cpp
Adam Honse 1403f91b3a 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
2026-01-20 19:56:37 -06:00

124 lines
4.3 KiB
C++

/*---------------------------------------------------------*\
| RGBController_HPOmenLaptopWMI_Windows.cpp |
| |
| RGBController for HP Omen laptop |
| |
| This file is part of the OpenRGB project |
| SPDX-License-Identifier: GPL-2.0-or-later |
\*---------------------------------------------------------*/
#include "RGBController_HPOmenLaptopWMI_Windows.h"
/**------------------------------------------------------------------*\
@name Omen 4-Zone Laptop Keyboard
@category Keyboard
@type WMI
@save :x:
@direct :white_check_mark:
@effects :white_check_mark:
@detectors DetectHPOmenLaptopWMIControllers
@comment Currently only supported on Windows (requires admin privileges) due to the WMI interface.
\*-------------------------------------------------------------------*/
RGBController_HPOmenLaptopWMI_Windows::RGBController_HPOmenLaptopWMI_Windows(HPOmenLaptopController_Windows *controller)
{
/*-----------------------------------------------------*\
| Configure the keyboard modes |
\*-----------------------------------------------------*/
this->controller = controller;
this->name = "Omen 4-Zone Laptop Keyboard";
this->vendor = "HP";
this->description = "WMI Device";
this->location = "ROOT\\\\WMI:hpqBIntM";
this->type = DEVICE_TYPE_KEYBOARD;
mode Direct;
Direct.name = "Direct";
Direct.value = KeyboardMode::DIRECT;
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
Direct.color_mode = MODE_COLORS_PER_LED;
this->modes.push_back(Direct);
mode Off;
Off.name = "Off";
Off.value = KeyboardMode::OFF;
Off.flags = 0;
Off.color_mode = MODE_COLORS_NONE;
this->modes.push_back(Off);
SetupZones();
}
RGBController_HPOmenLaptopWMI_Windows::~RGBController_HPOmenLaptopWMI_Windows()
{
delete this->controller;
}
void RGBController_HPOmenLaptopWMI_Windows::SetupZones()
{
/*-----------------------------------------------------*\
| Set up the zone |
\*-----------------------------------------------------*/
zone keyboard_zone;
keyboard_zone.leds_count = 4;
keyboard_zone.leds_min = 0;
keyboard_zone.leds_max = 4;
keyboard_zone.name = "Keyboard";
keyboard_zone.type = ZONE_TYPE_LINEAR;
this->zones.push_back(keyboard_zone);
/*-----------------------------------------------------*\
| Set up the LEDs |
\*-----------------------------------------------------*/
led wasd_led;
wasd_led.name = "Keyboard WASD";
this->leds.push_back(wasd_led);
led left_led;
left_led.name = "Keyboard Left";
this->leds.push_back(left_led);
led mid_led;
mid_led.name = "Keyboard Middle";
this->leds.push_back(mid_led);
led right_led;
right_led.name = "Keyboard Right";
this->leds.push_back(right_led);
SetupColors();
}
void RGBController_HPOmenLaptopWMI_Windows::DeviceUpdateLEDs()
{
/*-----------------------------------------------------*\
| Set new colors |
\*-----------------------------------------------------*/
controller->setColors(this->colors);
}
void RGBController_HPOmenLaptopWMI_Windows::DeviceUpdateZoneLEDs(int zone)
{
/*-----------------------------------------------------*\
| Set new colors |
\*-----------------------------------------------------*/
controller->setColors(this->colors);
}
void RGBController_HPOmenLaptopWMI_Windows::DeviceUpdateSingleLED(int led)
{
/*-----------------------------------------------------*\
| Set new colors |
\*-----------------------------------------------------*/
controller->setColors(this->colors);
}
void RGBController_HPOmenLaptopWMI_Windows::DeviceUpdateMode()
{
/*-----------------------------------------------------*\
| Change keyboard rgb mode |
\*-----------------------------------------------------*/
controller->changeMode((KeyboardMode)this->modes[active_mode].value);
}