Code cleanup round 5
This commit is contained in:
parent
e448143377
commit
a219ac693c
21 changed files with 815 additions and 808 deletions
|
|
@ -33,7 +33,8 @@ void DetectHyperXAlloyElite(hid_device_info* info, const std::string& name)
|
|||
{
|
||||
HyperXAlloyEliteController* controller = new HyperXAlloyEliteController(dev, info->path);
|
||||
RGBController_HyperXAlloyElite* rgb_controller = new RGBController_HyperXAlloyElite(controller);
|
||||
rgb_controller->name = name;
|
||||
rgb_controller->name = name;
|
||||
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
}
|
||||
|
|
@ -46,7 +47,8 @@ void DetectHyperXAlloyElite2(hid_device_info* info, const std::string& name)
|
|||
{
|
||||
HyperXAlloyElite2Controller* controller = new HyperXAlloyElite2Controller(dev, info->path);
|
||||
RGBController_HyperXAlloyElite2* rgb_controller = new RGBController_HyperXAlloyElite2(controller);
|
||||
rgb_controller->name = name;
|
||||
rgb_controller->name = name;
|
||||
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
}
|
||||
|
|
@ -57,9 +59,10 @@ void DetectHyperXAlloyFPS(hid_device_info* info, const std::string& name)
|
|||
|
||||
if(dev)
|
||||
{
|
||||
HyperXAlloyFPSController* controller = new HyperXAlloyFPSController(dev, info->path);
|
||||
HyperXAlloyFPSController* controller = new HyperXAlloyFPSController(dev, info->path);
|
||||
RGBController_HyperXAlloyFPS* rgb_controller = new RGBController_HyperXAlloyFPS(controller);
|
||||
rgb_controller->name = name;
|
||||
rgb_controller->name = name;
|
||||
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
}
|
||||
|
|
@ -72,7 +75,8 @@ void DetectHyperXAlloyOrigins(hid_device_info* info, const std::string& name)
|
|||
{
|
||||
HyperXAlloyOriginsController* controller = new HyperXAlloyOriginsController(dev, info->path);
|
||||
RGBController_HyperXAlloyOrigins* rgb_controller = new RGBController_HyperXAlloyOrigins(controller);
|
||||
rgb_controller->name = name;
|
||||
rgb_controller->name = name;
|
||||
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
}
|
||||
|
|
@ -85,7 +89,8 @@ void DetectHyperXAlloyOriginsCore(hid_device_info* info, const std::string& name
|
|||
{
|
||||
HyperXAlloyOriginsCoreController* controller = new HyperXAlloyOriginsCoreController(dev, info);
|
||||
RGBController_HyperXAlloyOriginsCore* rgb_controller = new RGBController_HyperXAlloyOriginsCore(controller);
|
||||
rgb_controller->name = name;
|
||||
rgb_controller->name = name;
|
||||
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -175,9 +175,9 @@ static const char *led_names[] =
|
|||
"Key: Media Mute"
|
||||
};
|
||||
|
||||
RGBController_HyperXAlloyElite::RGBController_HyperXAlloyElite(HyperXAlloyEliteController* hyperx_ptr)
|
||||
RGBController_HyperXAlloyElite::RGBController_HyperXAlloyElite(HyperXAlloyEliteController* controller_ptr)
|
||||
{
|
||||
controller = hyperx_ptr;
|
||||
controller = controller_ptr;
|
||||
|
||||
name = "HyperX Alloy Elite";
|
||||
vendor = "HyperX";
|
||||
|
|
@ -290,7 +290,7 @@ void RGBController_HyperXAlloyElite::SetupZones()
|
|||
for(unsigned int led_idx = 0; led_idx < total_led_count; led_idx++)
|
||||
{
|
||||
led new_led;
|
||||
new_led.name = led_names[led_idx];
|
||||
new_led.name = led_names[led_idx];
|
||||
leds.push_back(new_led);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
class RGBController_HyperXAlloyElite : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_HyperXAlloyElite(HyperXAlloyEliteController* hyperx_ptr);
|
||||
RGBController_HyperXAlloyElite(HyperXAlloyEliteController* controller_ptr);
|
||||
~RGBController_HyperXAlloyElite();
|
||||
|
||||
void SetupZones();
|
||||
|
|
|
|||
|
|
@ -192,16 +192,16 @@ static const char *led_names[] =
|
|||
"RGB Strip 18",
|
||||
};
|
||||
|
||||
RGBController_HyperXAlloyElite2::RGBController_HyperXAlloyElite2(HyperXAlloyElite2Controller* hyperx_ptr)
|
||||
RGBController_HyperXAlloyElite2::RGBController_HyperXAlloyElite2(HyperXAlloyElite2Controller* controller_ptr)
|
||||
{
|
||||
hyperx = hyperx_ptr;
|
||||
controller = controller_ptr;
|
||||
|
||||
name = "HyperX Alloy Elite 2 Keyboard Device";
|
||||
vendor = "HyperX";
|
||||
type = DEVICE_TYPE_KEYBOARD;
|
||||
description = "HyperX Alloy Elite 2 Keyboard Device";
|
||||
location = hyperx->GetDeviceLocation();
|
||||
serial = hyperx->GetSerialString();
|
||||
location = controller->GetDeviceLocation();
|
||||
serial = controller->GetSerialString();
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
|
|
@ -239,7 +239,7 @@ RGBController_HyperXAlloyElite2::~RGBController_HyperXAlloyElite2()
|
|||
}
|
||||
}
|
||||
|
||||
delete hyperx;
|
||||
delete controller;
|
||||
}
|
||||
|
||||
void RGBController_HyperXAlloyElite2::SetupZones()
|
||||
|
|
@ -277,7 +277,7 @@ void RGBController_HyperXAlloyElite2::SetupZones()
|
|||
for(unsigned int led_idx = 0; led_idx < total_led_count; led_idx++)
|
||||
{
|
||||
led new_led;
|
||||
new_led.name = led_names[led_idx];
|
||||
new_led.name = led_names[led_idx];
|
||||
leds.push_back(new_led);
|
||||
}
|
||||
|
||||
|
|
@ -297,7 +297,7 @@ void RGBController_HyperXAlloyElite2::DeviceUpdateLEDs()
|
|||
|
||||
if(active_mode == 0)
|
||||
{
|
||||
hyperx->SetLEDsDirect(colors);
|
||||
controller->SetLEDsDirect(colors);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,42 +1,42 @@
|
|||
/*-----------------------------------------*\
|
||||
| RGBController_HyperXAlloyElite2.h |
|
||||
| |
|
||||
| Generic RGB Interface for HyperX Alloy |
|
||||
| Elite2 RGB Keyboard |
|
||||
| |
|
||||
| KundaPanda (vojdo) 02/04/2021 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
#include <atomic>
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
|
||||
#include "RGBController.h"
|
||||
#include "HyperXAlloyElite2Controller.h"
|
||||
|
||||
class RGBController_HyperXAlloyElite2 : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_HyperXAlloyElite2(HyperXAlloyElite2Controller* hyperx_ptr);
|
||||
~RGBController_HyperXAlloyElite2();
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
void KeepaliveThreadFunction();
|
||||
|
||||
private:
|
||||
HyperXAlloyElite2Controller* hyperx;
|
||||
std::atomic<bool> keepalive_thread_run;
|
||||
std::thread* keepalive_thread;
|
||||
std::chrono::time_point<std::chrono::steady_clock> last_update_time;
|
||||
};
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_HyperXAlloyElite2.h |
|
||||
| |
|
||||
| Generic RGB Interface for HyperX Alloy |
|
||||
| Elite2 RGB Keyboard |
|
||||
| |
|
||||
| KundaPanda (vojdo) 02/04/2021 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
#include <atomic>
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
|
||||
#include "RGBController.h"
|
||||
#include "HyperXAlloyElite2Controller.h"
|
||||
|
||||
class RGBController_HyperXAlloyElite2 : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_HyperXAlloyElite2(HyperXAlloyElite2Controller* controller_ptr);
|
||||
~RGBController_HyperXAlloyElite2();
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
void KeepaliveThreadFunction();
|
||||
|
||||
private:
|
||||
HyperXAlloyElite2Controller* controller;
|
||||
std::atomic<bool> keepalive_thread_run;
|
||||
std::thread* keepalive_thread;
|
||||
std::chrono::time_point<std::chrono::steady_clock> last_update_time;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -147,9 +147,9 @@ static const char *led_names[] =
|
|||
"Key: Number Pad ."
|
||||
};
|
||||
|
||||
RGBController_HyperXAlloyFPS::RGBController_HyperXAlloyFPS(HyperXAlloyFPSController* hyperx_ptr)
|
||||
RGBController_HyperXAlloyFPS::RGBController_HyperXAlloyFPS(HyperXAlloyFPSController* controller_ptr)
|
||||
{
|
||||
controller = hyperx_ptr;
|
||||
controller = controller_ptr;
|
||||
|
||||
name = "HyperX Alloy FPS";
|
||||
vendor = "HyperX";
|
||||
|
|
@ -231,7 +231,7 @@ void RGBController_HyperXAlloyFPS::SetupZones()
|
|||
for(unsigned int led_idx = 0; led_idx < total_led_count; led_idx++)
|
||||
{
|
||||
led new_led;
|
||||
new_led.name = led_names[led_idx];
|
||||
new_led.name = led_names[led_idx];
|
||||
leds.push_back(new_led);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
class RGBController_HyperXAlloyFPS : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_HyperXAlloyFPS(HyperXAlloyFPSController* hyperx_ptr);
|
||||
RGBController_HyperXAlloyFPS(HyperXAlloyFPSController* controller_ptr);
|
||||
~RGBController_HyperXAlloyFPS();
|
||||
|
||||
void SetupZones();
|
||||
|
|
|
|||
|
|
@ -167,16 +167,16 @@ static const char *led_names[] =
|
|||
"Key: Number Pad Enter",
|
||||
};
|
||||
|
||||
RGBController_HyperXAlloyOrigins::RGBController_HyperXAlloyOrigins(HyperXAlloyOriginsController* hyperx_ptr)
|
||||
RGBController_HyperXAlloyOrigins::RGBController_HyperXAlloyOrigins(HyperXAlloyOriginsController* controller_ptr)
|
||||
{
|
||||
hyperx = hyperx_ptr;
|
||||
controller = controller_ptr;
|
||||
|
||||
name = "HyperX Alloy Origins Keyboard Device";
|
||||
vendor = "HyperX";
|
||||
type = DEVICE_TYPE_KEYBOARD;
|
||||
description = "HyperX Alloy Origins Keyboard Device";
|
||||
location = hyperx->GetDeviceLocation();
|
||||
serial = hyperx->GetSerialString();
|
||||
location = controller->GetDeviceLocation();
|
||||
serial = controller->GetSerialString();
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
|
|
@ -214,7 +214,7 @@ RGBController_HyperXAlloyOrigins::~RGBController_HyperXAlloyOrigins()
|
|||
}
|
||||
}
|
||||
|
||||
delete hyperx;
|
||||
delete controller;
|
||||
}
|
||||
|
||||
void RGBController_HyperXAlloyOrigins::SetupZones()
|
||||
|
|
@ -268,7 +268,7 @@ void RGBController_HyperXAlloyOrigins::ResizeZone(int /*zone*/, int /*new_size*/
|
|||
|
||||
void RGBController_HyperXAlloyOrigins::DeviceUpdateLEDs()
|
||||
{
|
||||
hyperx->SetLEDsDirect(colors);
|
||||
controller->SetLEDsDirect(colors);
|
||||
}
|
||||
|
||||
void RGBController_HyperXAlloyOrigins::UpdateZoneLEDs(int /*zone*/)
|
||||
|
|
|
|||
|
|
@ -1,40 +1,40 @@
|
|||
/*-----------------------------------------*\
|
||||
| RGBController_HyperXAlloyOrigins.h |
|
||||
| |
|
||||
| Generic RGB Interface for HyperX Alloy |
|
||||
| Origins RGB Keyboard |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 7/11/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
#include <chrono>
|
||||
|
||||
#include "RGBController.h"
|
||||
#include "HyperXAlloyOriginsController.h"
|
||||
|
||||
class RGBController_HyperXAlloyOrigins : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_HyperXAlloyOrigins(HyperXAlloyOriginsController* hyperx_ptr);
|
||||
~RGBController_HyperXAlloyOrigins();
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
void KeepaliveThread();
|
||||
|
||||
private:
|
||||
HyperXAlloyOriginsController* hyperx;
|
||||
std::thread* keepalive_thread;
|
||||
std::atomic<bool> keepalive_thread_run;
|
||||
std::chrono::time_point<std::chrono::steady_clock> last_update_time;
|
||||
};
|
||||
/*-----------------------------------------*\
|
||||
| RGBController_HyperXAlloyOrigins.h |
|
||||
| |
|
||||
| Generic RGB Interface for HyperX Alloy |
|
||||
| Origins RGB Keyboard |
|
||||
| |
|
||||
| Adam Honse (CalcProgrammer1) 7/11/2020 |
|
||||
\*-----------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
#include <chrono>
|
||||
|
||||
#include "RGBController.h"
|
||||
#include "HyperXAlloyOriginsController.h"
|
||||
|
||||
class RGBController_HyperXAlloyOrigins : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_HyperXAlloyOrigins(HyperXAlloyOriginsController* controller_ptr);
|
||||
~RGBController_HyperXAlloyOrigins();
|
||||
|
||||
void SetupZones();
|
||||
|
||||
void ResizeZone(int zone, int new_size);
|
||||
|
||||
void DeviceUpdateLEDs();
|
||||
void UpdateZoneLEDs(int zone);
|
||||
void UpdateSingleLED(int led);
|
||||
|
||||
void SetCustomMode();
|
||||
void DeviceUpdateMode();
|
||||
|
||||
void KeepaliveThread();
|
||||
|
||||
private:
|
||||
HyperXAlloyOriginsController* controller;
|
||||
std::thread* keepalive_thread;
|
||||
std::atomic<bool> keepalive_thread_run;
|
||||
std::chrono::time_point<std::chrono::steady_clock> last_update_time;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -145,17 +145,17 @@ static const char *led_names[] =
|
|||
"Key: Right Arrow"
|
||||
};
|
||||
|
||||
RGBController_HyperXAlloyOriginsCore::RGBController_HyperXAlloyOriginsCore(HyperXAlloyOriginsCoreController* hyperx_ptr)
|
||||
RGBController_HyperXAlloyOriginsCore::RGBController_HyperXAlloyOriginsCore(HyperXAlloyOriginsCoreController* controller_ptr)
|
||||
{
|
||||
hyperx = hyperx_ptr;
|
||||
controller = controller_ptr;
|
||||
|
||||
name = "HyperX Alloy Origins Core Keyboard Device";
|
||||
vendor = "HyperX";
|
||||
type = DEVICE_TYPE_KEYBOARD;
|
||||
description = "HyperX Alloy Origins Core Keyboard Device";
|
||||
location = hyperx->GetDeviceLocation();
|
||||
serial = hyperx->GetSerialString();
|
||||
version = hyperx->GetFirmwareVersion();
|
||||
location = controller->GetDeviceLocation();
|
||||
serial = controller->GetSerialString();
|
||||
version = controller->GetFirmwareVersion();
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
|
|
@ -193,7 +193,7 @@ RGBController_HyperXAlloyOriginsCore::~RGBController_HyperXAlloyOriginsCore()
|
|||
}
|
||||
}
|
||||
|
||||
delete hyperx;
|
||||
delete controller;
|
||||
}
|
||||
|
||||
void RGBController_HyperXAlloyOriginsCore::SetupZones()
|
||||
|
|
@ -244,7 +244,7 @@ void RGBController_HyperXAlloyOriginsCore::ResizeZone(int /*zone*/, int /*new_si
|
|||
|
||||
void RGBController_HyperXAlloyOriginsCore::DeviceUpdateLEDs()
|
||||
{
|
||||
hyperx->SetLEDsDirect(colors);
|
||||
controller->SetLEDsDirect(colors);
|
||||
}
|
||||
|
||||
void RGBController_HyperXAlloyOriginsCore::UpdateZoneLEDs(int /*zone*/)
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
class RGBController_HyperXAlloyOriginsCore : public RGBController
|
||||
{
|
||||
public:
|
||||
RGBController_HyperXAlloyOriginsCore(HyperXAlloyOriginsCoreController* hyperx_ptr);
|
||||
RGBController_HyperXAlloyOriginsCore(HyperXAlloyOriginsCoreController* controller_ptr);
|
||||
~RGBController_HyperXAlloyOriginsCore();
|
||||
|
||||
void SetupZones();
|
||||
|
|
@ -33,7 +33,7 @@ public:
|
|||
void KeepaliveThread();
|
||||
|
||||
private:
|
||||
HyperXAlloyOriginsCoreController* hyperx;
|
||||
HyperXAlloyOriginsCoreController* controller;
|
||||
std::thread* keepalive_thread;
|
||||
std::atomic<bool> keepalive_thread_run;
|
||||
std::chrono::time_point<std::chrono::steady_clock> last_update_time;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue