Update Plugin Function Exports and Syntax authored by Heal-Bot's avatar Heal-Bot
...@@ -4,55 +4,126 @@ ...@@ -4,55 +4,126 @@
*Device Information Exports* *Device Information Exports*
--- ---
```
export function Name() { return "Device Product name as a String"; }
//These are used to search the system for the device
export function VendorId() { return 0xABCD; } //Device's USB Vendor Id in Hex
export function ProductId() { return 0xABCD;} //Device's USB Product Id in Hex
export function Publisher() { return "This is You! as a String"; } `export function Name() { return "Device Product name as a String"; }`
export function Size() { return [X,Y]; } // Base Size of the device's box on the Canvas in a 2D Int Array `export function Publisher() { return "This is You! as a String"; }`
export function DefaultPosition(){return [X,Y]} // The default top left corner position on the Canvas before User Customization in a 2D Int Array
export function DefaultScale(){return 8.0}// The default device scale on the Canvas before User Customization in a Float Value These are used to search the system for the device. Both are Encoded in Hex values in the format "0x****".
`export function VendorId() { return 0xABCD; } //Device's USB Vendor Id in Hex`
`export function ProductId() { return 0xABCD;} //Device's USB Product Id in Hex`
Base Size of the device's box on the Canvas in a 2D Int Array.
`export function Size() { return [X,Y]; }`
The default top left corner position on the Canvas before User Customization in a 2D Int Array.
`export function DefaultPosition(){return [X,Y]}`
The default device scale on the Canvas before User Customization in a Float Value.
`export function DefaultScale(){return 8.0}`
export function LedNames(){return vLedNames;} //Returns a 2d Array of all Led names on the device. These should follow the Supported Key Names Located [Here](https://onlinepngtools.com/convert-png-to-base64) to support keypress effects and Led Painting Features Returns a 2d Array of all Led names on the device. These should follow the Supported Key Names Located [Here](https://onlinepngtools.com/convert-png-to-base64) to support keypress effects and Led Painting Features.
`export function LedNames(){return vLedNames;}`
export function LedPositions(){return vLedPositions;} //This returns a Matrix of the individual Led's positions within the devices Canvas Box. This returns a Matrix of the individual Led's positions within the device's Canvas Box.
`export function LedPositions(){return vLedPositions;}`
This returns the device's Image encoded in a base 64 image string. Online conversion of a PNG to Base64 can be done [Here](https://onlinepngtools.com/convert-png-to-base64).
`export function Image(){ return "Base 64 Image String";}`
This function is responsible for determining which USB endpoints SingalRGB wants to open and use for the device. Every endpoint will 4 parameters with it to use as filters. Multiple endpoints can be opened for each Device.
export function Image(){ return "Base 64 Image String";} This returns the devices Image encoded in a base 64 image string. Onlien conversion of a PNG to Base64 can be done [Here](https://onlinepngtools.com/convert-png-to-base64)
``` ```
endpoint.interface
endpoint.usage
endpoint.usage_page
endpoint.collection
```
```
export function Validate(endpoint)
{
return (endpoint.interface === 2 && endpoint.collection == 0x0003) ||
endpoint.interface === 1;
}
```
*Optional Function Exports* *Optional Function Exports*
--- ---
```
export function Type() { return "[Hid|LibUsb]"; } //Usb Protocol Type, Most devices use Hid Protocols, But some devices like AIO's will use Libusb functions instead. Modes are case insensitive and are "HID" and "LIBUSB" Usb Protocol Type, Most devices use Hid Protocols, But some devices like AIO's will use Libusb functions instead. Modes are case insensitive and are "HID" and "LIBUSB".
//This Function exports a list of conflicting exe's. Signal will not Initialize the plugin while one of these is running. When the conflicting process is closed SignalRGB will then initialize the plugin
export function ConflictingProcesses() { `export function Type() { return "[Hid|LibUsb]"; }`
This Function exports a list of conflicting exe's. Signal will not Initialize the plugin while one of these is running. When the conflicting process is closed SignalRGB will then initialize the plugin.
`export function ConflictingProcesses() {
return ["NGenuity2.exe"]; return ["NGenuity2.exe"];
} }`
//This function contains all of the settings for the device plugin.
export function ControllableParameters(){ This function contains all of the settings for the device plugin. These Settings are stored as JS/JSON objects.
`export function ControllableParameters(){
return [ return [
{SETTING}, {SETTING},
{SETTING} {SETTING}
]; ];
} }`
```
*Possible setting types* *Possible setting types*
--- ---
These can all be accessed in the JS plugin by using the Property String as a variable. "property":"BooleanValue" turns into var BooleanValue. These Values do not currently support reassignment from the JS plugin.
Color Menu: min and max Being Hue Value range
`{"property":"ColorValue", "label":"User Color","min":"0","max":"360","type":"color","default":"#FFFFF"}` `{"property":"ColorValue", "label":"User Color","min":"0","max":"360","type":"color","default":"#FFFFF"}`
Drop Down Menu: values being an array of options names.
`{"property":"ComboBoxValue", "label":"User DropDown", "type":"combobox", "values":["Option 1","Option 2"], "default":"Option 1"}` `{"property":"ComboBoxValue", "label":"User DropDown", "type":"combobox", "values":["Option 1","Option 2"], "default":"Option 1"}`
Number Slider: min and max being int Values. Step is an optional inclusion to change the sliders increments. "step":"5" will increment in steps of 5
`{"property":"SliderValue", "label":"User Slider","type":"number","min":"0", "max":"10","step":"1","default":"0"}` `{"property":"SliderValue", "label":"User Slider","type":"number","min":"0", "max":"10","step":"1","default":"0"}`
Boolean Toggle Switch
`{"property":"BooleanValue", "label":"User Boolean","type":"boolean","default":"false"}` `{"property":"BooleanValue", "label":"User Boolean","type":"boolean","default":"false"}`
mxValidateFunction = mxModule.property("Validate");
mxTypeFunction = mxModule.property("Type");
mxInitFunction = mxModule.property("Initialize");
mxRenderFunction = mxModule.property("Render");
mxShutdownFunction = mxModule.property("Shutdown");
*Runtime Functions*
---
These functions contain the runtime elements of your plugin.
Initialize() is called from the backend any time the device gets initialized. This runs on the first launch of SignalRGB and any time the device's Enabled Toggle switched to true. This can be blank for so
me devices, But most will require a few command packets before you can send RGB data to them.
mxConflictingProcessFunction = mxModule.property("ConflictingProcesses"); ```
mxControllableParamsFunction = mxModule.property("ControllableParameters"); export function Initialize() {
\ No newline at end of file DoDeviceStartup();
}
```
Shutdown() is called from the backend any time the device needs to shut down. This will happen anytime devices Enabled Toggle switches to false, or SignalRGB tries to exit. This function can be blank for some devices, But some devices like Corsair's need to be put back into hardware mode when SignalRGB is done.
```
export function Shutdown()
{
SendShutdownColors();
DoShutdown();
}
```
Render() is the function that gets repeatedly called to render devices color changes, and handles all of the logic in your plugin. This function is where you'll need to make your Color packets, handle changes to settings, and control the flow of your plugin's logic.
```
export function Render()
{
InitCustomStrip();
SetFans();
SendMainboardLEDs();
for(let channel = 1; channel < channelCount+1; channel++){
SendChannelColors(channel);
}
}
```
\ No newline at end of file