Store name in HyperXMicrophoneController to avoid setting it in detector
This commit is contained in:
parent
0eee6044b2
commit
0c0ffe7f5c
4 changed files with 13 additions and 5 deletions
|
|
@ -15,11 +15,12 @@
|
||||||
|
|
||||||
using namespace std::chrono_literals;
|
using namespace std::chrono_literals;
|
||||||
|
|
||||||
HyperXMicrophoneController::HyperXMicrophoneController(hidapi_wrapper hid_wrapper, hid_device* dev_handle, std::string path)
|
HyperXMicrophoneController::HyperXMicrophoneController(hidapi_wrapper hid_wrapper, hid_device* dev_handle, std::string path, std::string dev_name)
|
||||||
{
|
{
|
||||||
wrapper = hid_wrapper;
|
wrapper = hid_wrapper;
|
||||||
dev = dev_handle;
|
dev = dev_handle;
|
||||||
location = path;
|
location = path;
|
||||||
|
name = dev_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
HyperXMicrophoneController::~HyperXMicrophoneController()
|
HyperXMicrophoneController::~HyperXMicrophoneController()
|
||||||
|
|
@ -36,7 +37,12 @@ HyperXMicrophoneController::~HyperXMicrophoneController()
|
||||||
|
|
||||||
std::string HyperXMicrophoneController::GetDeviceLocation()
|
std::string HyperXMicrophoneController::GetDeviceLocation()
|
||||||
{
|
{
|
||||||
return location;
|
return(location);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string HyperXMicrophoneController::GetNameString()
|
||||||
|
{
|
||||||
|
return(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string HyperXMicrophoneController::GetSerialString()
|
std::string HyperXMicrophoneController::GetSerialString()
|
||||||
|
|
|
||||||
|
|
@ -21,10 +21,11 @@
|
||||||
class HyperXMicrophoneController
|
class HyperXMicrophoneController
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
HyperXMicrophoneController(hidapi_wrapper hid_wrapper, hid_device* dev, std::string path);
|
HyperXMicrophoneController(hidapi_wrapper hid_wrapper, hid_device* dev, std::string path, std::string dev_name);
|
||||||
~HyperXMicrophoneController();
|
~HyperXMicrophoneController();
|
||||||
|
|
||||||
std::string GetDeviceLocation();
|
std::string GetDeviceLocation();
|
||||||
|
std::string GetNameString();
|
||||||
std::string GetSerialString();
|
std::string GetSerialString();
|
||||||
|
|
||||||
void SendDirect(std::vector<RGBColor> color_data);
|
void SendDirect(std::vector<RGBColor> color_data);
|
||||||
|
|
@ -35,6 +36,7 @@ private:
|
||||||
hid_device* dev;
|
hid_device* dev;
|
||||||
std::string location;
|
std::string location;
|
||||||
std::mutex lock;
|
std::mutex lock;
|
||||||
|
std::string name;
|
||||||
|
|
||||||
void SendEOT(uint8_t frame_count);
|
void SendEOT(uint8_t frame_count);
|
||||||
void SendToRegister(uint8_t reg, uint8_t param1, uint8_t param2);
|
void SendToRegister(uint8_t reg, uint8_t param1, uint8_t param2);
|
||||||
|
|
|
||||||
|
|
@ -37,9 +37,8 @@ void DetectHyperXMicrophoneControllers(hidapi_wrapper wrapper, hid_device_info*
|
||||||
|
|
||||||
if(dev)
|
if(dev)
|
||||||
{
|
{
|
||||||
HyperXMicrophoneController* controller = new HyperXMicrophoneController(wrapper, dev, info->path);
|
HyperXMicrophoneController* controller = new HyperXMicrophoneController(wrapper, dev, info->path, name);
|
||||||
RGBController_HyperXMicrophone *rgb_controller = new RGBController_HyperXMicrophone(controller);
|
RGBController_HyperXMicrophone *rgb_controller = new RGBController_HyperXMicrophone(controller);
|
||||||
rgb_controller->name = name;
|
|
||||||
|
|
||||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,7 @@ RGBController_HyperXMicrophone::RGBController_HyperXMicrophone(HyperXMicrophoneC
|
||||||
{
|
{
|
||||||
controller = controller_ptr;
|
controller = controller_ptr;
|
||||||
|
|
||||||
|
name = controller->GetNameString();
|
||||||
vendor = "HyperX";
|
vendor = "HyperX";
|
||||||
type = DEVICE_TYPE_MICROPHONE;
|
type = DEVICE_TYPE_MICROPHONE;
|
||||||
description = "HyperX Microphone Device";
|
description = "HyperX Microphone Device";
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue