Initial development for alternate LED names suppport in RGBController API

Alternate LED names allow an LED to have a secondary "alternate" name.  The led_alt_names vector should either be empty if alternate names are not used or be equal in size to the leds vector.  Empty strings in the led_alt_names vector indicate that a particular LED does not have an alternate name.
This commit is contained in:
Adam Honse 2023-05-02 00:08:33 -05:00
parent f627dfc2cd
commit 27cac898b0
2 changed files with 75 additions and 0 deletions

View file

@ -74,6 +74,59 @@ RGBController::~RGBController()
modes.clear();
}
std::string RGBController::GetName()
{
return(name);
}
std::string RGBController::GetVendor()
{
return(vendor);
}
std::string RGBController::GetDescription()
{
return(description);
}
std::string RGBController::GetVersion()
{
return(version);
}
std::string RGBController::GetSerial()
{
return(serial);
}
std::string RGBController::GetLocation()
{
return(location);
}
std::string RGBController::GetModeName(unsigned int mode)
{
return(modes[mode].name);
}
std::string RGBController::GetZoneName(unsigned int zone)
{
return(zones[zone].name);
}
std::string RGBController::GetLEDName(unsigned int led)
{
if(led < led_alt_names.size())
{
if(led_alt_names[led] != "")
{
return(led_alt_names[led]);
}
}
return(leds[led].name);
}
unsigned char * RGBController::GetDeviceDescription(unsigned int protocol_version)
{
unsigned int data_ptr = 0;

View file

@ -228,6 +228,16 @@ public:
virtual void SetupColors() = 0;
virtual unsigned int GetLEDsInZone(unsigned int zone) = 0;
virtual std::string GetName() = 0;
virtual std::string GetVendor() = 0;
virtual std::string GetDescription() = 0;
virtual std::string GetVersion() = 0;
virtual std::string GetSerial() = 0;
virtual std::string GetLocation() = 0;
virtual std::string GetModeName(unsigned int mode) = 0;
virtual std::string GetZoneName(unsigned int zone) = 0;
virtual std::string GetLEDName(unsigned int led) = 0;
virtual RGBColor GetLED(unsigned int led) = 0;
virtual void SetLED(unsigned int led, RGBColor color) = 0;
@ -298,6 +308,8 @@ public:
std::vector<RGBColor> colors; /* Color buffer */
device_type type; /* device type */
int active_mode = 0;/* active mode */
std::vector<std::string>
led_alt_names; /* alternate LED names */
/*---------------------------------------------------------*\
| RGBController base class constructor |
@ -311,6 +323,16 @@ public:
void SetupColors();
unsigned int GetLEDsInZone(unsigned int zone);
std::string GetName();
std::string GetVendor();
std::string GetDescription();
std::string GetVersion();
std::string GetSerial();
std::string GetLocation();
std::string GetModeName(unsigned int mode);
std::string GetZoneName(unsigned int zone);
std::string GetLEDName(unsigned int led);
RGBColor GetLED(unsigned int led);
void SetLED(unsigned int led, RGBColor color);