From 27cac898b05c8f8b54ff5a56041288a5307ea884 Mon Sep 17 00:00:00 2001 From: Adam Honse Date: Tue, 2 May 2023 00:08:33 -0500 Subject: [PATCH] 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. --- RGBController/RGBController.cpp | 53 +++++++++++++++++++++++++++++++++ RGBController/RGBController.h | 22 ++++++++++++++ 2 files changed, 75 insertions(+) diff --git a/RGBController/RGBController.cpp b/RGBController/RGBController.cpp index 49921972..a7a57532 100644 --- a/RGBController/RGBController.cpp +++ b/RGBController/RGBController.cpp @@ -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; diff --git a/RGBController/RGBController.h b/RGBController/RGBController.h index 208bdf3f..b1088aeb 100644 --- a/RGBController/RGBController.h +++ b/RGBController/RGBController.h @@ -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 colors; /* Color buffer */ device_type type; /* device type */ int active_mode = 0;/* active mode */ + std::vector + 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);