You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Documentation/RGBControllerAPI.md
+105-7Lines changed: 105 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -73,6 +73,7 @@ The RGBController files for a controller implementation are kept in the Controll
73
73
The RGBController class specification contains the following:
74
74
75
75
* Device Name
76
+
* Device Vendor
76
77
* Device Description
77
78
* Device Version
78
79
* Device Serial
@@ -83,6 +84,8 @@ The RGBController class specification contains the following:
83
84
* Vector of Colors (32-bit 0x00BBGGRR format)
84
85
* Device Type (enum)
85
86
* Active mode index
87
+
* Vector of LED Alternate Names
88
+
* Controller Flags
86
89
87
90
### Device Types
88
91
@@ -107,7 +110,23 @@ The RGBController class specification contains the following:
107
110
| 16 | Microphone |
108
111
| 17 | Accessory |
109
112
| 18 | Keypad |
110
-
| 19 | Unknown |
113
+
| 19 | Laptop |
114
+
| 20 | Monitor |
115
+
| 21 | Unknown |
116
+
117
+
Additional device types may be added in the future. They are added after the last known device type. Anything out of range should be considered Unknown.
| 0 | Local | Controller is provided by this OpenRGB instance |
124
+
| 1 | Remote | Controller is provided by a remote OpenRGB instance |
125
+
| 2 | Virtual | Controller is virtual (not a physical device) |
126
+
127
+
### LED Alternate Names
128
+
129
+
The LED Altrernate Names vector can override the base name of an LED. The intended use case for this field is providing regional key names for non-English keyboard layouts. The base key names should always be provided in English QWERYY layout for positional mapping to work on certain SDK applications, so the alternate names field can override the base name to provide the correct key name for the localized layout without disrupting SDK application mapping. If not overriding any LED names, this vector can be left empty. If only overriding certain LED names, those not being overridden can be empty strings. If used, the length of this vector must equal the length of the LEDs vector.
111
130
112
131
## LEDs
113
132
@@ -131,10 +150,12 @@ The Zone structure contains information about a zone. A zone is a logical group
131
150
* Minimum number of LEDs
132
151
* Maximum number of LEDs
133
152
* Matrix map pointer
153
+
* Vector of segments
154
+
* Zone Flags
134
155
135
156
The LED pointer and Color pointer point to the first LED/Color in the RGBController's LEDs/Colors vector associated with this zone. The Start Index is the index to the same LED/Color in the vectors.
136
157
137
-
The LED count is the number of LEDs in the zone. For zones with a fixed number of LEDs, the count, min, and max values should all be equal. For zones with a user-adjustable number of LEDs, the count should be between the min and max values, inclusively. User-adjustable zones are most commonly used to represent addressable RGB (ARGB) controllers as the number of LEDs depends on what strips/devices are attached to the ARGB headers. The ResizeZone function in the RGBController API is used to resize the number of LEDs in the zone.
158
+
The LED count is the number of LEDs in the zone. For zones with a fixed number of LEDs, the count, min, and max values should all be equal. For zones with a user-adjustable number of LEDs, the count should be between the min and max values, inclusively. User-adjustable zones are most commonly used to represent addressable RGB (ARGB) controllers as the number of LEDs depends on what strips/devices are attached to the ARGB headers. The ResizeZone function in the RGBController API is used to resize the number of LEDs in the zone. The initial value should be zero for ARGB zones if the device does not provide a means to automatically determint the number of connected LEDs.
138
159
139
160
### Zone Types
140
161
@@ -158,6 +179,27 @@ A matrix map has the following:
158
179
159
180
The height and width determine the size of the map data. The map data pointer should point to a data block of (Height * Width) unsigned 32-bit integers. This data can be accessed as if it were a Map[Y][X] 2D array. The values of the map are LED index values in the zone (so offset by Start Index from the RGBController's LEDs vector). If a spot in the matrix is unused and does not map to an LED, it should be set to 0xFFFFFFFF.
160
181
182
+
### Segments
183
+
184
+
Each Zone contains a vector of Segments. Segments can be used to divide a physical zone (such as an ARGB header) into multiple logical sub-zones, or segments. This is mainly used for ARGB zones with multiple components daisy-chained together. For example, segments can be used to group multiple rings on an ARGB fan or multiple daisy-chained fans connected to one header. If the device is capable of automatically detecting multiple components connected to a single output, the RGBController may create segments automatically during zone creation. Otherwise, leaving this vector empty will indicate that the zone contains no segments, though resizable zones allow the user to define their own segments.
185
+
186
+
A segment contains the following:
187
+
188
+
* Segment Name
189
+
* Segment Type (See Zone Type values)
190
+
* Start Index
191
+
* LED Count
192
+
193
+
The Start Index is the index within the Zone where the Segment starts. The LED Count is the number of LEDs in the Segment. Care should be taken to ensure that the total number of LEDs across all segments equals the number of LEDs in the Zone and the start indices do not overlap.
194
+
195
+
### Zone Flags
196
+
197
+
The Zone Flags field is a bitfield with informational flags related to the Zone.
| 0 | Resize Effects Only | This zone is resizable, but the size is only used for effects modes. The zone is treated as a single LED in the Colors vector for per-LED modes |
202
+
161
203
## Modes
162
204
163
205
Modes represent internal effects and have a name field that describes the effect. The mode's index in the vector is its ID. The Active Mode variable in the RGBController class specifies which mode is currently selected. A mode contains the following:
@@ -202,26 +244,82 @@ The mode minimum and maximum number of colors fields should be used if the mode
202
244
203
245
## Functions
204
246
247
+
### `std::string GetName()`
248
+
249
+
Returns the `name` string of the device.
250
+
251
+
### `std::string GetVendor()`
252
+
253
+
Returns the `vendor` string of the device.
254
+
255
+
### `std::string GetDescription()`
256
+
257
+
Returns the `description` string of the device.
258
+
259
+
### `std::string GetVersion()`
260
+
261
+
Returns the `version` string of the device.
262
+
263
+
### `std::string GetSerial()`
264
+
265
+
Returns the `serial` string of the device.
266
+
267
+
### `std::string GetLocation()`
268
+
269
+
Returns the `location` string of the device.
270
+
271
+
### `std::string GetModeName(int mode)`
272
+
273
+
Returns the `name` string of the given mode in the `modes` vector.
274
+
275
+
### `std::string GetZoneName(int zone)`
276
+
277
+
Returns the `name` string of the given zone in the `zones` vector.
278
+
279
+
### `std::string GetLEDName(int led)`
280
+
281
+
Returns the `name` string of the given LED in the `leds` vector.
282
+
283
+
### `RGBColor GetLED(unsigned int led)`
284
+
285
+
Returns the color value of the given LED in the `colors` vector.
286
+
287
+
### `void SetLED(unsigned int led, RGBColor color)`
288
+
289
+
Sets the color value of the given LED in the `colors` vector.
290
+
291
+
### `void SetAllLEDs(RGBColor color)`
292
+
293
+
Sets the color value of all LEDs in the `colors` vector.
Sets the color value of all LEDs in the given zone in the `colors` vector.
298
+
205
299
### `int GetMode()`
206
300
207
-
Returns the currently enabled mode of the device. The returned int should line up with the Modes vector.
301
+
Returns the active mode index of the device. The returned int should line up with the `modes` vector.
208
302
209
303
### `void SetMode(int mode)`
210
304
211
-
Sets the mode of the device. The mode should be the index in the Modes vector of the mode you wish to set.
305
+
Sets the active mode index of the device. The mode should be the index in the `modes` vector of the mode you wish to set.
212
306
213
307
### `void SetCustomMode()`
214
308
215
309
When called, the device should be put into its software-controlled mode. This differs between devices, but generally devices have a direct control or static effect mode. Ideally, this mode should not save to the device's internal Flash. This function sets up a device for software effect control.
216
310
217
311
### `void UpdateLEDs()`
218
312
219
-
Update all LEDs based on the device's `colors` vector.
313
+
Update all LEDs based on the `colors` vector.
220
314
221
315
### `void UpdateZoneLEDs(int zone)`
222
316
223
-
Update all LEDs in the given zone based on the device's `colors` vector.
317
+
Update all LEDs in the given zone based on the `colors` vector.
224
318
225
319
### `void UpdateSingleLED(int led)`
226
320
227
-
Update a single LED based on the device's `colors` vector.
321
+
Update a single LED based on the `colors` vector.
322
+
323
+
### `void UpdateMode()`
324
+
325
+
Update the mode based on the active mode index and the `modes` vector.
0 commit comments