Store name in SRGBmodsControllers to avoid setting it in detectors
This commit is contained in:
parent
840512751c
commit
1bd9215a72
7 changed files with 34 additions and 20 deletions
|
|
@ -46,17 +46,15 @@ void DetectSRGBmodsControllers(hid_device_info* info, const std::string& name)
|
|||
\*-------------------------------------------------------------------------*/
|
||||
if(product_str == L"SRGBmods Pico LED Controller" || product_str == L"Pico LED Controller")
|
||||
{
|
||||
SRGBmodsPicoController* controller = new SRGBmodsPicoController(dev, info->path);
|
||||
SRGBmodsPicoController* controller = new SRGBmodsPicoController(dev, info->path, name);
|
||||
RGBController_SRGBmodsPico* rgb_controller = new RGBController_SRGBmodsPico(controller);
|
||||
rgb_controller->name = name;
|
||||
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
else if(product_str == L"LED Controller v1")
|
||||
{
|
||||
SRGBmodsLEDControllerV1* controller = new SRGBmodsLEDControllerV1(dev, info->path);
|
||||
SRGBmodsLEDControllerV1* controller = new SRGBmodsLEDControllerV1(dev, info->path, name);
|
||||
RGBController_SRGBmodsLEDControllerV1* rgb_controller = new RGBController_SRGBmodsLEDControllerV1(controller);
|
||||
rgb_controller->name = name;
|
||||
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ RGBController_SRGBmodsLEDControllerV1::RGBController_SRGBmodsLEDControllerV1(SRG
|
|||
{
|
||||
controller = controller_ptr;
|
||||
|
||||
name = "SRGBmods Device";
|
||||
name = controller->GetNameString();
|
||||
vendor = "SRGBmods.net";
|
||||
description = "SRGBmods LED Controller V1 Device";
|
||||
type = DEVICE_TYPE_LEDSTRIP;
|
||||
|
|
|
|||
|
|
@ -15,10 +15,11 @@
|
|||
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
SRGBmodsLEDControllerV1::SRGBmodsLEDControllerV1(hid_device* dev_handle, const char* path)
|
||||
SRGBmodsLEDControllerV1::SRGBmodsLEDControllerV1(hid_device* dev_handle, const char* path, std::string dev_name)
|
||||
{
|
||||
dev = dev_handle;
|
||||
location = path;
|
||||
name = dev_name;
|
||||
}
|
||||
|
||||
SRGBmodsLEDControllerV1::~SRGBmodsLEDControllerV1()
|
||||
|
|
@ -31,6 +32,11 @@ std::string SRGBmodsLEDControllerV1::GetLocationString()
|
|||
return("HID: " + location);
|
||||
}
|
||||
|
||||
std::string SRGBmodsLEDControllerV1::GetNameString()
|
||||
{
|
||||
return(name);
|
||||
}
|
||||
|
||||
std::string SRGBmodsLEDControllerV1::GetSerialString()
|
||||
{
|
||||
wchar_t serial_string[128];
|
||||
|
|
|
|||
|
|
@ -28,10 +28,11 @@ enum
|
|||
class SRGBmodsLEDControllerV1
|
||||
{
|
||||
public:
|
||||
SRGBmodsLEDControllerV1(hid_device* dev_handle, const char* path);
|
||||
SRGBmodsLEDControllerV1(hid_device* dev_handle, const char* path, std::string dev_name);
|
||||
~SRGBmodsLEDControllerV1();
|
||||
|
||||
std::string GetLocationString();
|
||||
std::string GetNameString();
|
||||
std::string GetSerialString();
|
||||
|
||||
void SetChannelLEDs(unsigned char channel, RGBColor * colors, unsigned int num_colors);
|
||||
|
|
@ -41,6 +42,7 @@ public:
|
|||
private:
|
||||
hid_device* dev;
|
||||
std::string location;
|
||||
std::string name;
|
||||
|
||||
void SendPacket
|
||||
(
|
||||
|
|
|
|||
|
|
@ -25,20 +25,20 @@
|
|||
|
||||
RGBController_SRGBmodsPico::RGBController_SRGBmodsPico(SRGBmodsPicoController* controller_ptr)
|
||||
{
|
||||
controller = controller_ptr;
|
||||
controller = controller_ptr;
|
||||
|
||||
name = "SRGBmods Device";
|
||||
vendor = "SRGBmods.net";
|
||||
description = "SRGBmods Pico LED Controller Device";
|
||||
type = DEVICE_TYPE_LEDSTRIP;
|
||||
location = controller->GetLocationString();
|
||||
serial = controller->GetSerialString();
|
||||
name = controller->GetNameString();
|
||||
vendor = "SRGBmods.net";
|
||||
description = "SRGBmods Pico LED Controller Device";
|
||||
type = DEVICE_TYPE_LEDSTRIP;
|
||||
location = controller->GetLocationString();
|
||||
serial = controller->GetSerialString();
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
Direct.value = 0xFFFF;
|
||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
Direct.name = "Direct";
|
||||
Direct.value = 0xFFFF;
|
||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Direct);
|
||||
|
||||
SetupZones();
|
||||
|
|
|
|||
|
|
@ -15,10 +15,11 @@
|
|||
|
||||
using namespace std::chrono_literals;
|
||||
|
||||
SRGBmodsPicoController::SRGBmodsPicoController(hid_device* dev_handle, const char* path)
|
||||
SRGBmodsPicoController::SRGBmodsPicoController(hid_device* dev_handle, const char* path, std::string dev_name)
|
||||
{
|
||||
dev = dev_handle;
|
||||
location = path;
|
||||
name = dev_name;
|
||||
|
||||
/*-----------------------------------------------------*\
|
||||
| The SRGBmods Pico controller requires a packet within |
|
||||
|
|
@ -56,6 +57,11 @@ std::string SRGBmodsPicoController::GetLocationString()
|
|||
return("HID: " + location);
|
||||
}
|
||||
|
||||
std::string SRGBmodsPicoController::GetNameString()
|
||||
{
|
||||
return(name);
|
||||
}
|
||||
|
||||
std::string SRGBmodsPicoController::GetSerialString()
|
||||
{
|
||||
wchar_t serial_string[128];
|
||||
|
|
|
|||
|
|
@ -19,10 +19,11 @@
|
|||
class SRGBmodsPicoController
|
||||
{
|
||||
public:
|
||||
SRGBmodsPicoController(hid_device* dev_handle, const char* path);
|
||||
SRGBmodsPicoController(hid_device* dev_handle, const char* path, std::string dev_name);
|
||||
~SRGBmodsPicoController();
|
||||
|
||||
std::string GetLocationString();
|
||||
std::string GetNameString();
|
||||
std::string GetSerialString();
|
||||
|
||||
void SetChannelLEDs(unsigned char channel, RGBColor * colors, unsigned int num_colors);
|
||||
|
|
@ -31,6 +32,7 @@ public:
|
|||
private:
|
||||
hid_device* dev;
|
||||
std::string location;
|
||||
std::string name;
|
||||
std::thread* keepalive_thread;
|
||||
std::atomic<bool> keepalive_thread_run;
|
||||
std::chrono::time_point<std::chrono::steady_clock> last_commit_time;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue