Plugin Exports
We use several functions to communicate with the back-end API which report info like device information and runtime entry points, display name, canvas dimensions, product and vendor IDs to search for, what the render loop is, etc.
"Name" and "Publisher"
These functions export the device's name and the publisher to be displayed in SignalRGB.
export function Name() { return "Device Product name as a String"; };
export function Publisher() { return "This is You! as a String"; };
"VendorId" and "ProductId"
These functions are used to search the system for the device. Both are encoded in hex values in the format "0x ". These need to exactly match your device IDs. If your plugin is not showing up in SignalRGB it is most likely a mismatched vendor and product ID. The bare minimum needed to detect a device in SignalRGB is a matching vendor and product Id.
export function VendorId() { return 0xABCD;}; //Device's USB Vendor Id in Hex
export function ProductId() { return 0xABCD;}; //Device's USB Product Id in Hex
"Size" and Positioning
This sets the base size of the device's box on the canvas - before any scaling - as a 2D integer-only array. You can not grab colors outside of these bounds in your plugin so the size must be set to accommodate the width and height of the device's LEDs when you translate them to a grid.
export function Size() { return [X,Y]; };
These functions will set the device's default position before any user customization. DefaultPosition returns the 2D coordinates of the top left corner. DefaultScale returns the scaling multiplier on a scale of 1.0-30.0.
export function DefaultPosition(){return [X,Y]};
export function DefaultScale(){return 8.0};
"Led Names"
This function returns a 2D array of all LED names on the device. These should follow the Supported Key Names Located HERE to support keypress effects and LED painting features.
var vLedNames = [
"Scroll Wheel",
"Side Led 1","Side Led 2","Side Led 3","Side Led 4", "Side Led 5","logo", "Right Side Led",
"Dpi 1","dpi 2","Dpi 3",
"Battery indicator"
];
export function LedNames(){return vLedNames;};
"Led Positions"
This function returns a matrix of the individual LED positions within the device's pixel buffer. All of the positions must be within the bounds set by the device's Size() export.
var vLedPositions = [
[3,0],
[0,1],[0,2],[0,3],[0,4],[0,5],[3,5],[5,5],
[0,2],[0,1],[0,0],
[3,1]
];
export function LedPositions(){return vLedPositions;};
"ControllableParameters"
This function contains all of the settings for the device plugin. These settings are stored as JS/JSON objects returned inside of an array by the function. See User Controls for more info.
export function ControllableParameters(){
return [
{SETTING},
{SETTING}
];
}
"Validate"
This function is responsible for determining which USB endpoints SingalRGB wants to open and use for the device. Every endpoint will have four parameters with it to use as filters that correspond to the values of each USB endpoint on the device. Multiple endpoints can be 'opened' for each device but only one is used at a time. To change the active endpoint see device.set_endpoint().
Note: Commands will typically need to be sent to a specific endpoint. Commands sent to an endpoint that is configured by the device to take in a certain report id or length with throw errors if those values don't match.
Note: Not all devices will use consistent endpoints depending on where and when the device was made. Validating multiple endpoints lets you automatically fallback if needed.
Available Parameters |
---|
interface |
usage |
usage_page |
collection |
export function Validate(endpoint)
{
return (endpoint.interface === 2 && endpoint.collection === 0x0003) ||
endpoint.interface === 1;
}
"Type"
This function sets the USB protocol type to be used. Most devices use HID protocols, but some devices like AIO's will use Raw USB control functions instead.
Note: The default value when this function is not available to SignalRGB is the HID protocol.
Protocol | String Value |
---|---|
HID | "HID" |
Lib/raw USB | "RAWUSB" |
export function Type() { return "Hid"; }
"ConflictingProcesses"
This function exports a list of conflicting exe names. SignalRGB will not initialize the plugin while one of these is running. The plugin will be initialized when the conflicting process is closed or the error message is bypassed by the user.
Note: These names must match the running exe name exactly.
export function ConflictingProcesses() {
return ["NGenuity2.exe"];
}
"ImageUrl"
This function returns the device's image URL string. The Standard plugin image size is 1024x1024 image size with a live area of 920x920.
export function ImageUrl(){ return "URL image string";}