Store name in HYTENexusController to avoid setting it in detector
This commit is contained in:
parent
20f3e5db0b
commit
d5f8e2cac9
4 changed files with 12 additions and 5 deletions
|
|
@ -24,10 +24,11 @@ using namespace std::chrono_literals;
|
||||||
| https://hyte.com/nexus/nexus-playground |
|
| https://hyte.com/nexus/nexus-playground |
|
||||||
\*---------------------------------------------------------*/
|
\*---------------------------------------------------------*/
|
||||||
|
|
||||||
HYTENexusController::HYTENexusController(char* port, unsigned short pid)
|
HYTENexusController::HYTENexusController(char* port, unsigned short pid, std::string dev_name)
|
||||||
{
|
{
|
||||||
port_name = port;
|
port_name = port;
|
||||||
device_pid = pid;
|
device_pid = pid;
|
||||||
|
name = name;
|
||||||
|
|
||||||
/*-----------------------------------------------------*\
|
/*-----------------------------------------------------*\
|
||||||
| Initialize channels based on PID |
|
| Initialize channels based on PID |
|
||||||
|
|
@ -108,6 +109,11 @@ std::string HYTENexusController::GetLocation()
|
||||||
return(port_name);
|
return(port_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string HYTENexusController::GetName()
|
||||||
|
{
|
||||||
|
return(name);
|
||||||
|
}
|
||||||
|
|
||||||
void HYTENexusController::KeepaliveThreadFunction()
|
void HYTENexusController::KeepaliveThreadFunction()
|
||||||
{
|
{
|
||||||
while(keepalive_thread_run.load())
|
while(keepalive_thread_run.load())
|
||||||
|
|
|
||||||
|
|
@ -52,11 +52,12 @@ enum
|
||||||
class HYTENexusController
|
class HYTENexusController
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
HYTENexusController(char* port, unsigned short pid);
|
HYTENexusController(char* port, unsigned short pid, std::string dev_name);
|
||||||
~HYTENexusController();
|
~HYTENexusController();
|
||||||
|
|
||||||
std::string GetFirmwareVersion();
|
std::string GetFirmwareVersion();
|
||||||
std::string GetLocation();
|
std::string GetLocation();
|
||||||
|
std::string GetName();
|
||||||
std::string GetDeviceName(unsigned int device_type);
|
std::string GetDeviceName(unsigned int device_type);
|
||||||
|
|
||||||
void LEDStreaming(unsigned char channel, unsigned short num_leds, RGBColor* colors);
|
void LEDStreaming(unsigned char channel, unsigned short num_leds, RGBColor* colors);
|
||||||
|
|
@ -67,6 +68,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string firmware_version;
|
std::string firmware_version;
|
||||||
|
std::string name;
|
||||||
std::string port_name;
|
std::string port_name;
|
||||||
serial_port * serialport = nullptr;
|
serial_port * serialport = nullptr;
|
||||||
std::chrono::time_point<std::chrono::steady_clock> last_update_time;
|
std::chrono::time_point<std::chrono::steady_clock> last_update_time;
|
||||||
|
|
|
||||||
|
|
@ -50,9 +50,8 @@ void DetectHYTENexusControllers()
|
||||||
{
|
{
|
||||||
if(*ports[i] != "")
|
if(*ports[i] != "")
|
||||||
{
|
{
|
||||||
HYTENexusController * controller = new HYTENexusController((char *)ports[i]->c_str(), hyte_nexus_devices[device_id].pid);
|
HYTENexusController * controller = new HYTENexusController((char *)ports[i]->c_str(), hyte_nexus_devices[device_id].pid, hyte_nexus_devices[device_id].name);
|
||||||
RGBController_HYTENexus * rgb_controller = new RGBController_HYTENexus(controller);
|
RGBController_HYTENexus * rgb_controller = new RGBController_HYTENexus(controller);
|
||||||
rgb_controller->name = hyte_nexus_devices[device_id].name;
|
|
||||||
|
|
||||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ RGBController_HYTENexus::RGBController_HYTENexus(HYTENexusController* controller
|
||||||
{
|
{
|
||||||
controller = controller_ptr;
|
controller = controller_ptr;
|
||||||
|
|
||||||
name = "HYTE Nexus Device";
|
name = controller->GetName();
|
||||||
vendor = "HYTE";
|
vendor = "HYTE";
|
||||||
description = "HYTE Nexus Device";
|
description = "HYTE Nexus Device";
|
||||||
type = DEVICE_TYPE_LEDSTRIP;
|
type = DEVICE_TYPE_LEDSTRIP;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue