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 "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;
|
||||
location = path;
|
||||
name = dev_name;
|
||||
}
|
||||
|
||||
LuxaforController::~LuxaforController()
|
||||
|
|
@ -29,6 +30,11 @@ std::string LuxaforController::GetDeviceLocation()
|
|||
return("HID: " + location);
|
||||
}
|
||||
|
||||
std::string LuxaforController::GetNameString()
|
||||
{
|
||||
return(name);
|
||||
}
|
||||
|
||||
std::string LuxaforController::GetSerialString()
|
||||
{
|
||||
wchar_t serial_string[128];
|
||||
|
|
|
|||
|
|
@ -44,10 +44,11 @@ enum
|
|||
class LuxaforController
|
||||
{
|
||||
public:
|
||||
LuxaforController(hid_device* dev_handle, const char* path);
|
||||
LuxaforController(hid_device* dev_handle, const char* path, std::string dev_name);
|
||||
~LuxaforController();
|
||||
|
||||
std::string GetDeviceLocation();
|
||||
std::string GetNameString();
|
||||
std::string GetSerialString();
|
||||
|
||||
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:
|
||||
hid_device* dev;
|
||||
std::string location;
|
||||
std::string name;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -29,9 +29,8 @@ void DetectLuxaforControllers(hid_device_info* info, const std::string& name)
|
|||
|
||||
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);
|
||||
rgb_controller->name = name;
|
||||
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,20 +13,20 @@
|
|||
|
||||
RGBController_Luxafor::RGBController_Luxafor(LuxaforController* controller_ptr)
|
||||
{
|
||||
controller = controller_ptr;
|
||||
controller = controller_ptr;
|
||||
|
||||
name = "Luxafor Device";
|
||||
type = DEVICE_TYPE_ACCESSORY;
|
||||
vendor = "Luxafor";
|
||||
description = "Luxafor Device";
|
||||
location = controller->GetDeviceLocation();
|
||||
serial = controller->GetSerialString();
|
||||
name = controller->GetNameString();
|
||||
type = DEVICE_TYPE_ACCESSORY;
|
||||
vendor = "Luxafor";
|
||||
description = "Luxafor Device";
|
||||
location = controller->GetDeviceLocation();
|
||||
serial = controller->GetSerialString();
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
Direct.value = LUXAFOR_MODE_DIRECT;
|
||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
Direct.name = "Direct";
|
||||
Direct.value = LUXAFOR_MODE_DIRECT;
|
||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Direct);
|
||||
|
||||
// mode Fade;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue