Component Functions

Device Functions

These functions are to set up the device to be compatible with the Component System

device.SetLedLimit()

This function takes an int value and sets the upper LED limit for all component Channels on the device. It's used for safety checks in the backend and to prevent users from overloading their devices with more power draw than it can take. It should be set to the same max value that the manufacturing company limits the device to.

ParameterDescriptionTypeExample
LedLimitThe desired LED limit for all channels on the deviceInt80
Javascript
Copy

device.getLedCount()

This function will return the current combined led count of all components on all channels of the device. The primary use for this will be to check if there are any components selected as 0 LED's is the same as 0 Components.

ReturnDescriptionTypeExample
LedCountThe current led count of all channelsInt64
Javascript
Copy

device.addChannel()

This function will add a new Component Channel to the device. When the first channel is added the Component Configuration UI will appear on the device page. This function takes an optional but recommended LedLimit to warn the user about going over the safe led limits of the device. This limit is used in multiple places so it is highly recommended to set it.

ParameterDescriptionTypeExample
ChannelNameThe ChannelName that will be used to reference this channelString"Channel 1"
LedLimitThe Channels Safe operating Led Limit.Int204
Javascript
Copy

device.removeChannel()

This function will remove a channel from the device. Under normal circumstances, this function should not be needed as channels will be cleaned up when SignalRGB shuts down. But as the channels persist between hot reloads of the plugin file you may want to clear them in the initialize function if your experiencing issues while developing the plugin.

ParameterDescriptionTypeExample
ChannelNameThe ChannelName to be removedString"Channel 1"
Javascript
Copy

device.getChannelNames()

This function will return the names of all channels currently on the device. The primary use here will be for debug use as Channel Names should be stored within the plugin's logic with the index of the channel for the device's packets. It can however be used to iterate over all channels on the device if desired for a minor performance loss.

returnDescriptionTypeExample
Channel NamesA list of all Channel names on the device1D Array["Channel 1","Channel 2"]
Javascript
Copy

device.channel()

This is your gateway into interacting with ComponentChannels. It will return a reference to the ComponentChannel itself if one matches the ChannelName given, if ones doesn't exist it will return null.

These references are not guaranteed to stay valid and you should instead fetch a new reference each render cycle.

ParameterDescriptionTypeExample
ChannelNameThe ChannelName to grab a reference toString"Channel 1"
returnDescriptionType
ComponentChannelComponentChannel ObjectComponentChannel | Null
Javascript
Copy

ComponentChannel

These functions are used to control and interact with a specific ComponentChannel reference.

channel.SetLedLimit()

Like the similar device.ledLimit() function this one will set the max safe led limit for this ComponentChannel.

ParameterDescriptionTypeExample
LedLimitThe desired Led Limit for the ChannelInt16
Javascript
Copy

channel.LedCount()

This will return the number of Leds configured by the user on this ComponentChannel

ReturnDescriptionTypeExample
LedCountThe current Led Count of the ChannelInt16
Javascript
Copy

channel.getColors()

This function will return an array of RGB color data based on the devices led map and coordinates. The return value for this function depends greatly on setting the correct arguments.

ParametersDescriptionTypeExampleDefault
ArrayOrderThe desired array formatString"Inline""Seperate"
ColorOrderThe desired Color orderString"RGB""RGB"
Array OrderDescriptionTypeExample
InlineFormats the color data into a flat array in order1D Array[R,G,B,R,G,B]
SeperateFormats the color data into 3 distinct channels2D Array[[R,R], [G,G], [B,B]]

ColorOrder is a 3 letter combination of "RGB". i,e "BGR", "GBR","RBG". And determines the order of colors when using the Inline ArrayOrder. Invalid values will default back to "RGB".

ReturnDescriptionTypeExample
RGB DataThe returned RGB color data in the format desiredArraySee Array Order Table
Javascript
Copy

channel.shouldPulseColors()

this function returns a boolean on if this device channel should be 'pulsing'. This can be requested due to no Components being selected, or if the onboarding Component Setup UI is being shown.

device.getChannelPulseColor() can be used to get the expected pulse color.

ReturnTypeDescription
ShouldPulsebooleanShould this channel be pulsing

channel.getComponent()

channel.getComponentColors()

channel.getComponentNames()

channel.getComponentData()

channel.getComponentColors()

Util Functions

device.getChannelPulseColor()

device.createColorArray()

Type to search, ESC to discard
Type to search, ESC to discard
Type to search, ESC to discard