Remove mode::value and led::value accessors, remove these fields from protocol version 6 and newer. These should be internal use only, but are still accessed for protocol 5 and earlier for backwards compatibility.

This commit is contained in:
Adam Honse
2026-06-08 11:39:01 -05:00
parent 1afe65d206
commit 3a0b93c774
5 changed files with 71 additions and 126 deletions

View File

@@ -137,35 +137,35 @@ The server responds to this request with a large data block. The format of the
The Device Data block represents an entire `RGBController`. This data block is provided by `RGBController::GetDeviceDescriptionData()`. Portions of this block are omitted if the requested protocol level is below the listed value.
| Size | Format | Name | Protocol Version | Description |
| ------------------- | ------------------------------------- | ------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------ |
| 4 | int | type | 0 | RGBController type field value |
| 2 | unsigned short | name_len | 0 | Length of RGBController name field string, including null termination |
| name_len | char[name_len] | name | 0 | RGBController name field string value, including null termination |
| 2 | unsigned short | vendor_len | 1 | Length of RGBController vendor field string, including null termination |
| vendor_len | char[vendor_len] | vendor | 1 | RGBController vendor field string value, including null termination |
| 2 | unsigned short | description_len | 0 | Length of RGBController description field string, including null termination |
| description_len | char[description_len] | description | 0 | RGBController description field string value, including null termination |
| 2 | unsigned short | version_len | 0 | Length of RGBController version field string, including null termination |
| version_len | char[version_len] | version | 0 | RGBController version field string value, including null termination |
| 2 | unsigned short | serial_len | 0 | Length of RGBController serial field string, including null termination |
| serial_len | char[serial_len] | serial | 0 | RGBController serial field string value, including null termination |
| 2 | unsigned short | location_len | 0 | Length of RGBController location field string, including null termination |
| location_len | char[location_len] | location | 0 | RGBController location field string value, including null termination |
| 2 | unsigned short | num_modes | 0 | Number of modes in RGBController |
| 4 | int | active_mode | 0 | RGBController active_mode field value |
| Variable | Mode Data[num_modes] | modes | 0 | See [Mode Data](#mode-data) block format table. Repeat num_modes times |
| 2 | unsigned short | num_zones | 0 | Number of zones in RGBController |
| Variable | Zone Data[num_zones] | zones | 0 | See [Zone Data](#zone-data) block format table. Repeat num_zones times |
| 2 | unsigned short | num_leds | 0 | Number of LEDs in RGBController |
| Variable | LED Data[num_leds] | leds | 0 | See [LED Data](#led-data) block format table. Repeat num_leds times |
| 2 | unsigned short | num_colors | 0 | Number of colors in RGBController |
| 4 * num_colors | RGBColor[num_colors] | colors | 0 | RGBController colors field values |
| 2 | unsigned short | num_led_display_names | 5 | Number of LED alternate name strings |
| Variable | LED Alternate Name[num_led_display_names] | led_display_names | 5 | See [LED Alternate Name Data](#led-alternate-names-data) block format table. Repeat num_led_display_names times |
| 4 | unsigned int | flags | 5 | RGBController flags field value |
| 4 | unsigned int | configuration_len | 6 | Length of RGBController configuration field string, including null termination |
| configuration_len | char[configuration_len] | configuration | | RGBController configuration field string value, including null termination |
| Size | Format | Name | Protocol Version | Description |
| ------------------- | ----------------------------------------- | --------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------ |
| 4 | int | type | 0 | RGBController type field value |
| 2 | unsigned short | name_len | 0 | Length of RGBController name field string, including null termination |
| name_len | char[name_len] | name | 0 | RGBController name field string value, including null termination |
| 2 | unsigned short | vendor_len | 1 | Length of RGBController vendor field string, including null termination |
| vendor_len | char[vendor_len] | vendor | 1 | RGBController vendor field string value, including null termination |
| 2 | unsigned short | description_len | 0 | Length of RGBController description field string, including null termination |
| description_len | char[description_len] | description | 0 | RGBController description field string value, including null termination |
| 2 | unsigned short | version_len | 0 | Length of RGBController version field string, including null termination |
| version_len | char[version_len] | version | 0 | RGBController version field string value, including null termination |
| 2 | unsigned short | serial_len | 0 | Length of RGBController serial field string, including null termination |
| serial_len | char[serial_len] | serial | 0 | RGBController serial field string value, including null termination |
| 2 | unsigned short | location_len | 0 | Length of RGBController location field string, including null termination |
| location_len | char[location_len] | location | 0 | RGBController location field string value, including null termination |
| 2 | unsigned short | num_modes | 0 | Number of modes in RGBController |
| 4 | int | active_mode | 0 | RGBController active_mode field value |
| Variable | Mode Data[num_modes] | modes | 0 | See [Mode Data](#mode-data) block format table. Repeat num_modes times |
| 2 | unsigned short | num_zones | 0 | Number of zones in RGBController |
| Variable | Zone Data[num_zones] | zones | 0 | See [Zone Data](#zone-data) block format table. Repeat num_zones times |
| 2 | unsigned short | num_leds | 0 | Number of LEDs in RGBController |
| Variable | LED Data[num_leds] | leds | 0 | See [LED Data](#led-data) block format table. Repeat num_leds times |
| 2 | unsigned short | num_colors | 0 | Number of colors in RGBController |
| 4 * num_colors | RGBColor[num_colors] | colors | 0 | RGBController colors field values |
| 2 | unsigned short | num_led_display_names | 5 | Number of LED alternate name strings |
| Variable | LED Display Name[num_led_display_names] | led_display_names | 5 | See [LED Display Name Data](#led-display-name-data) block format table. Repeat num_led_display_names times |
| 4 | unsigned int | flags | 5 | RGBController flags field value |
| 4 | unsigned int | configuration_len | 6 | Length of RGBController configuration field string, including null termination |
| configuration_len | char[configuration_len] | configuration | | RGBController configuration field string value, including null termination |
## Mode Data
@@ -175,7 +175,7 @@ The Mode Data block represents one entry in the `RGBController::modes` vector.
| ------------------- | ------------------------- | ------------------- | ---------------- | ------------------------------------------------------ |
| 2 | unsigned short | mode_name_len | 0 | Length of mode name string, including null termination |
| mode_name_len | char[mode_name_len] | mode_name | 0 | Mode name string value, including null termination |
| 4 | int | mode_value | 0 | Mode value field value |
| 4 | int | mode_value | <6* | Mode value field value |
| 4 | unsigned int | mode_flags | 0 | Mode flags field value |
| 4 | unsigned int | mode_speed_min | 0 | Mode speed_min field value |
| 4 | unsigned int | mode_speed_max | 0 | Mode speed_max field value |
@@ -190,6 +190,8 @@ The Mode Data block represents one entry in the `RGBController::modes` vector.
| 2 | unsigned short | mode_num_colors | 0 | Mode number of colors |
| 4 * mode_num_colors | RGBColor[mode_num_colors] | mode_colors | 0 | Mode color values |
\* The mode_value field was removed starting with protocol version 6. This is an internal-use-only field that does not need to be exposed to clients. For protocol versions 5 and below, the client must track the mode_value received from the server and send it back as part of the UpdateMode/SaveMode packets.
## Zone Data
The Zone Data block represents one entry in the `RGBController::zones` vector. This data block is provided by `RGBController::GetZoneDescriptionData()`. Portions of this block are omitted if the requested protocol level is below the listed value.
@@ -244,16 +246,18 @@ The LED Data block represents one entry in the `RGBController::leds` vector. Th
| ------------------- | ------------------------- | ------------------- | ---------------- | ------------------------------------------------------ |
| 2 | unsigned short | led_name_len | 0 | Length of LED name string, including null termination |
| led_name_len | char[led_name_len] | led_name | 0 | LED name string value, including null termination |
| 4 | unsigned int | led_value | 0 | LED value field value |
| 4 | unsigned int | led_value | <6* | LED value field value |
## LED Alternate Name Data
\* The led_value field was removed starting with protocol version 6. This is an internal-use-only field that does not need to be exposed to clients.
The LED Alternate Name Data block represents one entry in the `RGBController::led_display_names` vector. This data block was introduced in protocol version 5.
## LED Display Name Data
| Size | Format | Name | Protocol Version | Description |
| ---------------- | ---------------------- | ---------------- | ---------------- | --------------------------------------------------------------- |
| 2 | unsigned short | led_alt_name_len | 5 | Length of LED alternate name string, including null termination |
| led_alt_name_len | char[led_alt_name_len] | led_alt_name | 5 | LED alternate name string value, including null termination |
The LED Display Name Data block represents one entry in the `RGBController::led_display_names` vector. This data block was introduced in protocol version 5.
| Size | Format | Name | Protocol Version | Description |
| -------------------- | -------------------------- | -------------------- | ---------------- | --------------------------------------------------------------- |
| 2 | unsigned short | led_display_name_len | 5 | Length of LED display name string, including null termination |
| led_display_name_len | char[led_display_name_len] | led_display_name | 5 | LED display name string value, including null termination |
## NET_PACKET_ID_REQUEST_PROTOCOL_VERSION

View File

@@ -1112,7 +1112,6 @@ bool ProfileManager::LoadControllerFromListWithOptions
for(unsigned int mode_index = 0; mode_index < (unsigned int)profile_controller->modes.size(); mode_index++)
{
if((profile_controller->GetModeName(mode_index) == load_controller->GetModeName(mode_index) )
&&(profile_controller->GetModeValue(mode_index) == load_controller->GetModeValue(mode_index) )
&&(profile_controller->GetModeFlags(mode_index) == load_controller->GetModeFlags(mode_index) )
&&(profile_controller->GetModeSpeedMin(mode_index) == load_controller->GetModeSpeedMin(mode_index) )
&&(profile_controller->GetModeSpeedMax(mode_index) == load_controller->GetModeSpeedMax(mode_index) )
@@ -1169,7 +1168,6 @@ bool ProfileManager::LoadControllerFromListWithOptions
for(std::size_t mode_index = 0; mode_index < profile_controller->GetZoneModeCount(zone_idx); mode_index++)
{
if((profile_controller->GetZoneModeName(zone_idx, mode_index) == load_controller->GetZoneModeName(zone_idx, mode_index) )
&&(profile_controller->GetZoneModeValue(zone_idx, mode_index) == load_controller->GetZoneModeValue(zone_idx, mode_index) )
&&(profile_controller->GetZoneModeFlags(zone_idx, mode_index) == load_controller->GetZoneModeFlags(zone_idx, mode_index) )
&&(profile_controller->GetZoneModeSpeedMin(zone_idx, mode_index) == load_controller->GetZoneModeSpeedMin(zone_idx, mode_index) )
&&(profile_controller->GetZoneModeSpeedMax(zone_idx, mode_index) == load_controller->GetZoneModeSpeedMax(zone_idx, mode_index) )

View File

@@ -730,24 +730,6 @@ unsigned int RGBController::GetZoneModeSpeedMin(unsigned int zone, unsigned int
return(speed_min);
}
int RGBController::GetZoneModeValue(unsigned int zone, unsigned int mode)
{
unsigned int value;
AccessMutex.lock_shared();
if((zone < zones.size()) && (mode < zones[zone].modes.size()))
{
value = zones[zone].modes[mode].value;
}
else
{
value = 0;
}
AccessMutex.unlock_shared();
return(value);
}
std::string RGBController::GetZoneName(unsigned int zone)
{
std::string name;
@@ -1378,24 +1360,6 @@ unsigned int RGBController::GetModeSpeedMin(unsigned int mode)
return(speed_min);
}
int RGBController::GetModeValue(unsigned int mode)
{
int value;
AccessMutex.lock_shared();
if(mode < modes.size())
{
value = modes[mode].value;
}
else
{
value = 0;
}
AccessMutex.unlock_shared();
return(value);
}
void RGBController::SetModeBrightness(unsigned int mode, unsigned int brightness)
{
AccessMutex.lock();
@@ -1576,24 +1540,6 @@ std::string RGBController::GetLEDName(unsigned int led)
return(name);
}
unsigned int RGBController::GetLEDValue(unsigned int led)
{
unsigned int value;
AccessMutex.lock_shared();
if(led < leds.size())
{
value = leds[led].value;
}
else
{
value = 0;
}
AccessMutex.unlock_shared();
return(value);
}
std::string RGBController::GetLEDDisplayName(unsigned int led)
{
std::string name;
@@ -2669,7 +2615,7 @@ unsigned int RGBController::GetDeviceDescriptionSize(RGBController* controller,
return(data_size);
}
unsigned char * RGBController::GetLEDDescriptionData(unsigned char* data_ptr, led led, unsigned int /*protocol_version*/)
unsigned char * RGBController::GetLEDDescriptionData(unsigned char* data_ptr, led led, unsigned int protocol_version)
{
/*-----------------------------------------------------*\
| Copy in LED name (size+data) |
@@ -2685,13 +2631,16 @@ unsigned char * RGBController::GetLEDDescriptionData(unsigned char* data_ptr, le
/*-----------------------------------------------------*\
| Copy in LED value |
\*-----------------------------------------------------*/
memcpy(data_ptr, &led.value, sizeof(led.value));
data_ptr += sizeof(led.value);
if(protocol_version < 6)
{
memcpy(data_ptr, &led.value, sizeof(led.value));
data_ptr += sizeof(led.value);
}
return(data_ptr);
}
unsigned int RGBController::GetLEDDescriptionSize(led led, unsigned int /*protocol_version*/)
unsigned int RGBController::GetLEDDescriptionSize(led led, unsigned int protocol_version)
{
/*-----------------------------------------------------*\
| Initialize variables |
@@ -2705,7 +2654,11 @@ unsigned int RGBController::GetLEDDescriptionSize(led led, unsigned int /*protoc
data_size += sizeof(led_name_len);
data_size += led_name_len;
data_size += sizeof(led.value);
if(protocol_version < 6)
{
data_size += sizeof(led.value);
}
return(data_size);
}
@@ -2771,7 +2724,10 @@ unsigned int RGBController::GetModeDescriptionSize(mode mode, unsigned int proto
mode_description_size += sizeof(mode_name_len);
mode_description_size += mode_name_len;
mode_description_size += sizeof(mode.value);
if(protocol_version < 6)
{
mode_description_size += sizeof(mode.value);
}
mode_description_size += sizeof(mode.flags);
mode_description_size += sizeof(mode.speed_min);
mode_description_size += sizeof(mode.speed_max);
@@ -2821,8 +2777,11 @@ unsigned char * RGBController::GetModeDescriptionData(unsigned char* data_ptr, m
/*-----------------------------------------------------*\
| Copy in mode value (data) |
\*-----------------------------------------------------*/
memcpy(data_ptr, &mode.value, sizeof(mode.value));
data_ptr += sizeof(mode.value);
if(protocol_version < 6)
{
memcpy(data_ptr, &mode.value, sizeof(mode.value));
data_ptr += sizeof(mode.value);
}
/*-----------------------------------------------------*\
| Copy in mode flags (data) |
@@ -3488,7 +3447,7 @@ unsigned char* RGBController::SetColorDescription(unsigned char* data_ptr, unsig
return(data_ptr);
}
unsigned char* RGBController::SetLEDDescription(unsigned char* data_ptr, unsigned int data_size, led* led, unsigned int /*protocol_version*/)
unsigned char* RGBController::SetLEDDescription(unsigned char* data_ptr, unsigned int data_size, led* led, unsigned int protocol_version)
{
/*-----------------------------------------------------*\
| Local variables |
@@ -3510,7 +3469,10 @@ unsigned char* RGBController::SetLEDDescription(unsigned char* data_ptr, unsigne
/*-----------------------------------------------------*\
| Copy in LED value |
\*-----------------------------------------------------*/
COPY_DATA_FIELD(data_ptr, data_start, led->value);
if(protocol_version < 6)
{
COPY_DATA_FIELD(data_ptr, data_start, led->value);
}
return(data_ptr);
}
@@ -3537,7 +3499,10 @@ unsigned char* RGBController::SetModeDescription(unsigned char* data_ptr, unsign
/*-----------------------------------------------------*\
| Copy in mode value |
\*-----------------------------------------------------*/
COPY_DATA_FIELD(data_ptr, data_start, mode->value);
if(protocol_version < 6)
{
COPY_DATA_FIELD(data_ptr, data_start, mode->value);
}
/*-----------------------------------------------------*\
| Copy in mode flags |
@@ -3941,7 +3906,6 @@ nlohmann::json RGBController::GetLEDDescriptionJSON(led led)
| LED Information |
\*-----------------------------------------------------*/
led_json["name"] = led.name;
led_json["value"] = led.value;
return(led_json);
}
@@ -3969,7 +3933,6 @@ nlohmann::json RGBController::GetModeDescriptionJSON(mode mode)
| Mode Information |
\*-----------------------------------------------------*/
mode_json["name"] = mode.name;
mode_json["value"] = mode.value;
mode_json["flags"] = mode.flags;
mode_json["speed_min"] = mode.speed_min;
mode_json["speed_max"] = mode.speed_max;
@@ -4202,11 +4165,6 @@ led RGBController::SetLEDDescriptionJSON(nlohmann::json led_json)
new_led.name = led_json["name"];
}
if(led_json.contains("value"))
{
new_led.value = led_json["value"];
}
return(new_led);
}
@@ -4244,11 +4202,6 @@ mode RGBController::SetModeDescriptionJSON(nlohmann::json mode_json)
new_mode.name = mode_json["name"];
}
if(mode_json.contains("value"))
{
new_mode.value = mode_json["value"];
}
if(mode_json.contains("flags"))
{
new_mode.flags = mode_json["flags"];
@@ -4494,7 +4447,6 @@ bool RGBController::CompareControllers(RGBController* controller_1, RGBControlle
for(unsigned int mode_index = 0; mode_index < (unsigned int)controller_1->modes.size(); mode_index++)
{
if((controller_1->GetModeName(mode_index) != controller_2->GetModeName(mode_index) )
|| (controller_1->GetModeValue(mode_index) != controller_2->GetModeValue(mode_index) )
|| (controller_1->GetModeFlags(mode_index) != controller_2->GetModeFlags(mode_index) )
|| (controller_1->GetModeSpeedMin(mode_index) != controller_2->GetModeSpeedMin(mode_index) )
|| (controller_1->GetModeSpeedMax(mode_index) != controller_2->GetModeSpeedMax(mode_index) )
@@ -4554,7 +4506,6 @@ bool RGBController::CompareControllers(RGBController* controller_1, RGBControlle
for(std::size_t mode_index = 0; mode_index < controller_1->GetZoneModeCount(zone_index); mode_index++)
{
if((controller_1->GetZoneModeName(zone_index, mode_index) != controller_2->GetZoneModeName(zone_index, mode_index) )
|| (controller_1->GetZoneModeValue(zone_index, mode_index) != controller_2->GetZoneModeValue(zone_index, mode_index) )
|| (controller_1->GetZoneModeFlags(zone_index, mode_index) != controller_2->GetZoneModeFlags(zone_index, mode_index) )
|| (controller_1->GetZoneModeSpeedMin(zone_index, mode_index) != controller_2->GetZoneModeSpeedMin(zone_index, mode_index) )
|| (controller_1->GetZoneModeSpeedMax(zone_index, mode_index) != controller_2->GetZoneModeSpeedMax(zone_index, mode_index) )

View File

@@ -80,7 +80,6 @@ public:
unsigned int GetZoneModeSpeed(unsigned int zone, unsigned int mode);
unsigned int GetZoneModeSpeedMax(unsigned int zone, unsigned int mode);
unsigned int GetZoneModeSpeedMin(unsigned int zone, unsigned int mode);
int GetZoneModeValue(unsigned int zone, unsigned int mode);
std::string GetZoneName(unsigned int zone);
std::size_t GetZoneSegmentCount(unsigned int zone);
segment_flags GetZoneSegmentFlags(unsigned int zone, unsigned int segment);
@@ -126,7 +125,6 @@ public:
unsigned int GetModeSpeed(unsigned int mode);
unsigned int GetModeSpeedMax(unsigned int mode);
unsigned int GetModeSpeedMin(unsigned int mode);
int GetModeValue(unsigned int mode);
void SetModeBrightness(unsigned int mode, unsigned int brightness);
void SetModeColor(unsigned int mode, unsigned int color_index, RGBColor color);
@@ -144,8 +142,6 @@ public:
\*-----------------------------------------------------*/
std::size_t GetLEDCount();
std::string GetLEDName(unsigned int led);
unsigned int GetLEDValue(unsigned int led);
std::string GetLEDDisplayName(unsigned int led);
/*-----------------------------------------------------*\

View File

@@ -556,7 +556,6 @@ public:
virtual unsigned int GetZoneModeSpeed(unsigned int zone, unsigned int mode) = 0;
virtual unsigned int GetZoneModeSpeedMax(unsigned int zone, unsigned int mode) = 0;
virtual unsigned int GetZoneModeSpeedMin(unsigned int zone, unsigned int mode) = 0;
virtual int GetZoneModeValue(unsigned int zone, unsigned int mode) = 0;
virtual std::string GetZoneName(unsigned int zone) = 0;
virtual std::size_t GetZoneSegmentCount(unsigned int zone) = 0;
virtual segment_flags GetZoneSegmentFlags(unsigned int zone, unsigned int segment) = 0;
@@ -602,7 +601,6 @@ public:
virtual unsigned int GetModeSpeed(unsigned int mode) = 0;
virtual unsigned int GetModeSpeedMax(unsigned int mode) = 0;
virtual unsigned int GetModeSpeedMin(unsigned int mode) = 0;
virtual int GetModeValue(unsigned int mode) = 0;
virtual void SetModeBrightness(unsigned int mode, unsigned int brightness) = 0;
virtual void SetModeColor(unsigned int mode, unsigned int color_index, RGBColor color) = 0;
@@ -620,8 +618,6 @@ public:
\*-----------------------------------------------------*/
virtual std::size_t GetLEDCount() = 0;
virtual std::string GetLEDName(unsigned int led) = 0;
virtual unsigned int GetLEDValue(unsigned int led) = 0;
virtual std::string GetLEDDisplayName(unsigned int led) = 0;
/*-----------------------------------------------------*\