Store name in LGMonitorController to avoid setting it in detector
This commit is contained in:
parent
2a6856a5d2
commit
c313b19fc5
4 changed files with 14 additions and 15 deletions
|
|
@ -13,11 +13,11 @@
|
||||||
#include "LGMonitorController.h"
|
#include "LGMonitorController.h"
|
||||||
#include "StringUtils.h"
|
#include "StringUtils.h"
|
||||||
|
|
||||||
LGMonitorController::LGMonitorController(hid_device* dev_handle, const hid_device_info& info)
|
LGMonitorController::LGMonitorController(hid_device* dev_handle, const hid_device_info& info, std::string dev_name)
|
||||||
{
|
{
|
||||||
dev = dev_handle;
|
dev = dev_handle;
|
||||||
location = info.path;
|
location = info.path;
|
||||||
version = "";
|
name = dev_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
LGMonitorController::~LGMonitorController()
|
LGMonitorController::~LGMonitorController()
|
||||||
|
|
@ -30,6 +30,11 @@ std::string LGMonitorController::GetDeviceLocation()
|
||||||
return("HID: " + location);
|
return("HID: " + location);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string LGMonitorController::GetNameString()
|
||||||
|
{
|
||||||
|
return(name);
|
||||||
|
}
|
||||||
|
|
||||||
std::string LGMonitorController::GetSerialString()
|
std::string LGMonitorController::GetSerialString()
|
||||||
{
|
{
|
||||||
wchar_t serial_string[128];
|
wchar_t serial_string[128];
|
||||||
|
|
@ -43,11 +48,6 @@ std::string LGMonitorController::GetSerialString()
|
||||||
return(StringUtils::wstring_to_string(serial_string));
|
return(StringUtils::wstring_to_string(serial_string));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string LGMonitorController::GetFirmwareVersion()
|
|
||||||
{
|
|
||||||
return(version);
|
|
||||||
}
|
|
||||||
|
|
||||||
void LGMonitorController::SetDirect(const std::vector<RGBColor> colors)
|
void LGMonitorController::SetDirect(const std::vector<RGBColor> colors)
|
||||||
{
|
{
|
||||||
/*---------------------------------------------------------*\
|
/*---------------------------------------------------------*\
|
||||||
|
|
|
||||||
|
|
@ -44,12 +44,13 @@ enum
|
||||||
class LGMonitorController
|
class LGMonitorController
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LGMonitorController(hid_device* dev_handle, const hid_device_info& info);
|
LGMonitorController(hid_device* dev_handle, const hid_device_info& info, std::string dev_name);
|
||||||
~LGMonitorController();
|
~LGMonitorController();
|
||||||
|
|
||||||
std::string GetSerialString();
|
|
||||||
std::string GetDeviceLocation();
|
std::string GetDeviceLocation();
|
||||||
std::string GetFirmwareVersion();
|
std::string GetFirmwareVersion();
|
||||||
|
std::string GetNameString();
|
||||||
|
std::string GetSerialString();
|
||||||
|
|
||||||
void SetDirect(const std::vector<RGBColor> colors);
|
void SetDirect(const std::vector<RGBColor> colors);
|
||||||
void SetMode(uint8_t mode_value, uint8_t brightness, const std::vector<RGBColor> colors);
|
void SetMode(uint8_t mode_value, uint8_t brightness, const std::vector<RGBColor> colors);
|
||||||
|
|
@ -58,6 +59,7 @@ private:
|
||||||
hid_device* dev;
|
hid_device* dev;
|
||||||
std::string description;
|
std::string description;
|
||||||
std::string location;
|
std::string location;
|
||||||
|
std::string name;
|
||||||
std::string version;
|
std::string version;
|
||||||
bool on = false;
|
bool on = false;
|
||||||
bool direct_mode_enabled = false;
|
bool direct_mode_enabled = false;
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@
|
||||||
#include "Detector.h"
|
#include "Detector.h"
|
||||||
#include "LGMonitorController.h"
|
#include "LGMonitorController.h"
|
||||||
#include "RGBController_LGMonitor.h"
|
#include "RGBController_LGMonitor.h"
|
||||||
#include "dmiinfo.h"
|
|
||||||
|
|
||||||
/*---------------------------------------------------------*\
|
/*---------------------------------------------------------*\
|
||||||
| vendor ID |
|
| vendor ID |
|
||||||
|
|
@ -31,11 +30,8 @@ static void DetectLGMonitorControllers(hid_device_info* info, const std::string&
|
||||||
|
|
||||||
if(dev)
|
if(dev)
|
||||||
{
|
{
|
||||||
DMIInfo dmi;
|
LGMonitorController* controller = new LGMonitorController(dev, *info, name);
|
||||||
|
|
||||||
LGMonitorController* controller = new LGMonitorController(dev, *info);
|
|
||||||
RGBController_LGMonitor* rgb_controller = new RGBController_LGMonitor(controller);
|
RGBController_LGMonitor* rgb_controller = new RGBController_LGMonitor(controller);
|
||||||
rgb_controller->name = name;
|
|
||||||
|
|
||||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,12 +28,13 @@ using namespace std::chrono_literals;
|
||||||
RGBController_LGMonitor::RGBController_LGMonitor(LGMonitorController* controller_ptr)
|
RGBController_LGMonitor::RGBController_LGMonitor(LGMonitorController* controller_ptr)
|
||||||
{
|
{
|
||||||
controller = controller_ptr;
|
controller = controller_ptr;
|
||||||
|
|
||||||
|
name = controller->GetNameString();
|
||||||
vendor = "LG";
|
vendor = "LG";
|
||||||
type = DEVICE_TYPE_MONITOR;
|
type = DEVICE_TYPE_MONITOR;
|
||||||
description = "LG Monitor";
|
description = "LG Monitor";
|
||||||
location = controller->GetDeviceLocation();
|
location = controller->GetDeviceLocation();
|
||||||
serial = controller->GetSerialString();
|
serial = controller->GetSerialString();
|
||||||
version = controller->GetFirmwareVersion();
|
|
||||||
|
|
||||||
mode Direct;
|
mode Direct;
|
||||||
Direct.name = "Direct";
|
Direct.name = "Direct";
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue