Store name in LEDStripController to avoid setting it in detector
This commit is contained in:
parent
a1f144daf2
commit
0eb34eec25
4 changed files with 22 additions and 16 deletions
|
|
@ -15,9 +15,9 @@
|
|||
#include "LEDStripController.h"
|
||||
#include "ResourceManager.h"
|
||||
|
||||
LEDStripController::LEDStripController()
|
||||
LEDStripController::LEDStripController(std::string dev_name)
|
||||
{
|
||||
|
||||
name = dev_name;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -138,6 +138,11 @@ void LEDStripController::InitializeUDP(char * clientname, char * port)
|
|||
i2cport = NULL;
|
||||
}
|
||||
|
||||
char* LEDStripController::GetLEDString()
|
||||
{
|
||||
return(led_string);
|
||||
}
|
||||
|
||||
std::string LEDStripController::GetLocation()
|
||||
{
|
||||
if(serialport != NULL)
|
||||
|
|
@ -158,9 +163,9 @@ std::string LEDStripController::GetLocation()
|
|||
}
|
||||
}
|
||||
|
||||
char* LEDStripController::GetLEDString()
|
||||
std::string LEDStripController::GetName()
|
||||
{
|
||||
return(led_string);
|
||||
return(name);
|
||||
}
|
||||
|
||||
void LEDStripController::SetLEDs(std::vector<RGBColor> colors)
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ struct LEDStripDevice
|
|||
class LEDStripController
|
||||
{
|
||||
public:
|
||||
LEDStripController();
|
||||
LEDStripController(std::string dev_name);
|
||||
~LEDStripController();
|
||||
|
||||
void Initialize(char* ledstring, led_protocol proto);
|
||||
|
|
@ -60,6 +60,7 @@ public:
|
|||
|
||||
char* GetLEDString();
|
||||
std::string GetLocation();
|
||||
std::string GetName();
|
||||
|
||||
void SetLEDs(std::vector<RGBColor> colors);
|
||||
|
||||
|
|
@ -76,6 +77,7 @@ private:
|
|||
char led_string[1024];
|
||||
std::string port_name;
|
||||
std::string client_name;
|
||||
std::string name;
|
||||
serial_port *serialport;
|
||||
net_port *udpport;
|
||||
i2c_smbus_interface *i2cport;
|
||||
|
|
|
|||
|
|
@ -121,11 +121,10 @@ void DetectLEDStripControllers()
|
|||
|
||||
std::string value = dev.port + "," + std::to_string(dev.baud) + "," + std::to_string(dev.num_leds);
|
||||
|
||||
LEDStripController* controller = new LEDStripController();
|
||||
LEDStripController* controller = new LEDStripController(dev.name);
|
||||
controller->Initialize((char *)value.c_str(), dev.protocol);
|
||||
|
||||
RGBController_LEDStrip* rgb_controller = new RGBController_LEDStrip(controller);
|
||||
rgb_controller->name = dev.name;
|
||||
|
||||
ResourceManager::get()->RegisterRGBController(rgb_controller);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,18 +24,18 @@
|
|||
|
||||
RGBController_LEDStrip::RGBController_LEDStrip(LEDStripController* controller_ptr)
|
||||
{
|
||||
controller = controller_ptr;
|
||||
controller = controller_ptr;
|
||||
|
||||
name = "LED Strip";
|
||||
type = DEVICE_TYPE_LEDSTRIP;
|
||||
description = "Serial LED Strip Device";
|
||||
location = controller->GetLocation();
|
||||
name = controller->GetName();
|
||||
type = DEVICE_TYPE_LEDSTRIP;
|
||||
description = "Serial LED Strip Device";
|
||||
location = controller->GetLocation();
|
||||
|
||||
mode Direct;
|
||||
Direct.name = "Direct";
|
||||
Direct.value = 0;
|
||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
Direct.name = "Direct";
|
||||
Direct.value = 0;
|
||||
Direct.flags = MODE_FLAG_HAS_PER_LED_COLOR;
|
||||
Direct.color_mode = MODE_COLORS_PER_LED;
|
||||
modes.push_back(Direct);
|
||||
|
||||
SetupZones();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue