Store name in LuxaforController to avoid setting it in detector
This commit is contained in:
parent
b136e7739a
commit
8c63eeea47
4 changed files with 22 additions and 15 deletions
|
|
@ -13,10 +13,11 @@
|
||||||
#include "LuxaforController.h"
|
#include "LuxaforController.h"
|
||||||
#include "StringUtils.h"
|
#include "StringUtils.h"
|
||||||
|
|
||||||
LuxaforController::LuxaforController(hid_device* dev_handle, const char* path)
|
LuxaforController::LuxaforController(hid_device* dev_handle, const char* path, std::string dev_name)
|
||||||
{
|
{
|
||||||
dev = dev_handle;
|
dev = dev_handle;
|
||||||
location = path;
|
location = path;
|
||||||
|
name = dev_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
LuxaforController::~LuxaforController()
|
LuxaforController::~LuxaforController()
|
||||||
|
|
@ -29,6 +30,11 @@ std::string LuxaforController::GetDeviceLocation()
|
||||||
return("HID: " + location);
|
return("HID: " + location);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string LuxaforController::GetNameString()
|
||||||
|
{
|
||||||
|
return(name);
|
||||||
|
}
|
||||||
|
|
||||||
std::string LuxaforController::GetSerialString()
|
std::string LuxaforController::GetSerialString()
|
||||||
{
|
{
|
||||||
wchar_t serial_string[128];
|
wchar_t serial_string[128];
|
||||||
|
|
|
||||||
|
|
@ -44,10 +44,11 @@ enum
|
||||||
class LuxaforController
|
class LuxaforController
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LuxaforController(hid_device* dev_handle, const char* path);
|
LuxaforController(hid_device* dev_handle, const char* path, std::string dev_name);
|
||||||
~LuxaforController();
|
~LuxaforController();
|
||||||
|
|
||||||
std::string GetDeviceLocation();
|
std::string GetDeviceLocation();
|
||||||
|
std::string GetNameString();
|
||||||
std::string GetSerialString();
|
std::string GetSerialString();
|
||||||
|
|
||||||
void SendPacket(unsigned char mode, unsigned char led, unsigned char red, unsigned char grn, unsigned char blu, unsigned char type);
|
void SendPacket(unsigned char mode, unsigned char led, unsigned char red, unsigned char grn, unsigned char blu, unsigned char type);
|
||||||
|
|
@ -55,4 +56,5 @@ public:
|
||||||
private:
|
private:
|
||||||
hid_device* dev;
|
hid_device* dev;
|
||||||
std::string location;
|
std::string location;
|
||||||
|
std::string name;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -29,9 +29,8 @@ void DetectLuxaforControllers(hid_device_info* info, const std::string& name)
|
||||||
|
|
||||||
if(dev)
|
if(dev)
|
||||||
{
|
{
|
||||||
LuxaforController* controller = new LuxaforController(dev, info->path);
|
LuxaforController* controller = new LuxaforController(dev, info->path, name);
|
||||||
RGBController_Luxafor* rgb_controller = new RGBController_Luxafor(controller);
|
RGBController_Luxafor* rgb_controller = new RGBController_Luxafor(controller);
|
||||||
rgb_controller->name = name;
|
|
||||||
|
|
||||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,20 +13,20 @@
|
||||||
|
|
||||||
RGBController_Luxafor::RGBController_Luxafor(LuxaforController* controller_ptr)
|
RGBController_Luxafor::RGBController_Luxafor(LuxaforController* controller_ptr)
|
||||||
{
|
{
|
||||||
controller = controller_ptr;
|
controller = controller_ptr;
|
||||||
|
|
||||||
name = "Luxafor Device";
|
name = controller->GetNameString();
|
||||||
type = DEVICE_TYPE_ACCESSORY;
|
type = DEVICE_TYPE_ACCESSORY;
|
||||||
vendor = "Luxafor";
|
vendor = "Luxafor";
|
||||||
description = "Luxafor Device";
|
description = "Luxafor Device";
|
||||||
location = controller->GetDeviceLocation();
|
location = controller->GetDeviceLocation();
|
||||||
serial = controller->GetSerialString();
|
serial = controller->GetSerialString();
|
||||||
|
|
||||||
mode Direct;
|
mode Direct;
|
||||||
Direct.name = "Direct";
|
Direct.name = "Direct";
|
||||||
Direct.value = LUXAFOR_MODE_DIRECT;
|
Direct.value = LUXAFOR_MODE_DIRECT;
|
||||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||||
modes.push_back(Direct);
|
modes.push_back(Direct);
|
||||||
|
|
||||||
// mode Fade;
|
// mode Fade;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue