Store name in NZXTHue1Controller to avoid setting it in detector

This commit is contained in:
Adam Honse 2025-08-14 11:41:23 -05:00
parent a34d796059
commit f0e9650085
4 changed files with 114 additions and 107 deletions

View file

@ -13,10 +13,11 @@
#include "NZXTHue1Controller.h" #include "NZXTHue1Controller.h"
#include "StringUtils.h" #include "StringUtils.h"
NZXTHue1Controller::NZXTHue1Controller(hid_device* dev_handle, unsigned int /*fan_channels*/, const char* path) NZXTHue1Controller::NZXTHue1Controller(hid_device* dev_handle, unsigned int /*fan_channels*/, const char* path, std::string dev_name)
{ {
dev = dev_handle; dev = dev_handle;
location = path; location = path;
name = dev_name;
Initialize(); Initialize();
} }
@ -36,6 +37,11 @@ std::string NZXTHue1Controller::GetLocation()
return("HID: " + location); return("HID: " + location);
} }
std::string NZXTHue1Controller::GetName()
{
return(name);
}
std::string NZXTHue1Controller::GetSerialString() std::string NZXTHue1Controller::GetSerialString()
{ {
wchar_t serial_string[128]; wchar_t serial_string[128];

View file

@ -48,11 +48,12 @@ enum
class NZXTHue1Controller class NZXTHue1Controller
{ {
public: public:
NZXTHue1Controller(hid_device* dev_handle, unsigned int fan_channels, const char* path); NZXTHue1Controller(hid_device* dev_handle, unsigned int fan_channels, const char* path, std::string dev_name);
~NZXTHue1Controller(); ~NZXTHue1Controller();
std::string GetFirmwareVersion(); std::string GetFirmwareVersion();
std::string GetLocation(); std::string GetLocation();
std::string GetName();
std::string GetSerialString(); std::string GetSerialString();
unsigned int GetAccessoryType(); unsigned int GetAccessoryType();
@ -79,6 +80,7 @@ private:
char firmware_version[16]; char firmware_version[16];
std::string location; std::string location;
std::string name;
unsigned int accessory_type; unsigned int accessory_type;
void Initialize(); void Initialize();

View file

@ -34,9 +34,8 @@ void DetectNZXTHue1Controllers(hid_device_info* info, const std::string& name)
if(dev) if(dev)
{ {
NZXTHue1Controller* controller = new NZXTHue1Controller(dev, 3, info->path); NZXTHue1Controller* controller = new NZXTHue1Controller(dev, 3, info->path, name);
RGBController_NZXTHue1* rgb_controller = new RGBController_NZXTHue1(controller); RGBController_NZXTHue1* rgb_controller = new RGBController_NZXTHue1(controller);
rgb_controller->name = name;
ResourceManager::get()->RegisterRGBController(rgb_controller); ResourceManager::get()->RegisterRGBController(rgb_controller);
} }

View file

@ -26,7 +26,7 @@ RGBController_NZXTHue1::RGBController_NZXTHue1(NZXTHue1Controller* controller_pt
{ {
controller = controller_ptr; controller = controller_ptr;
name = "NZXT Hue 1"; name = controller->GetName();
vendor = "NZXT"; vendor = "NZXT";
type = DEVICE_TYPE_LEDSTRIP; type = DEVICE_TYPE_LEDSTRIP;
description = "NZXT Hue 1 Device"; description = "NZXT Hue 1 Device";