Overview

The SPLixel LED plugin controls both the color and blink delay of an SPLixel multicolor LED by running a set of rules. Rules are configured in an array of objects where each object represents a rule. Rules run in the order specified in the array each time subscription data arrives. Each rule specifies which led to address (multiple are allowed by the SPLixel platform), a blink object with enable and delay elements to determine the blinking state, a color for the led specified as RGB, and a condition which determines whether the rule applies. The first rule whose condition evaluates to true will apply.

Like the Subscriber plugin, this plugin displays both the Latest Message and a Merged Messages. The plugin looks for any one of a configurable set of messageSourceKeyNames (string array) to determine the top level key name under which to store the message in the Merged Messages object. The first matching messageSourceKeyNames is used, otherwise the message will be stored under a key named __UNKNOWN_MESSAGE__. The source key name for plugins is instanceName and for the worker (when subscribing to __PLUGIN_INFO__) is workerName.

User Interface

The SPLixel LED user interaface displays the current color of the LED (which will blink if configured to do so), as well as the blink delay (0 means the led is not blinking), along with the latest message to arrive and the aggregate, merged messages (each message under a top level key equal to their instance names).


Configuration Example

Plugin Defaults
0
0
0

Configuration Details

Filter:Search in:
ROOT object
This top level object holds all configuration information for this plugin.
Required: true
Default: (not specified; see any element defaults within)
subscribesTo array
An array of plugin instance names corresponding to plugin instances which will be subscribed to by this plugin instance.
Required: true
Default:
[]
subscribesTo[n] string
A plugin instance name (corresponding to a plugin you wish to subscribe to) or a topic published by the worker (ex. __PLUGIN_INFO__).
Required: false
Default: ""
options object
Configuration options specific to this plugin. Note that variables and expressions are generally allowed in this section.
Required: true
Default: (not specified; see any element defaults within)
options.messageSourceKeyNames array
An array of key names to look for when inspecting incoming messages for merge. The first element in this array found as a key name in the Latest Message will be used as the key under which that message will be placed in the Merged Messages object. If no key is found, the message will be placed under a key named "__UNKNOWN_SOURCE__".
Required: true
Default:
[
    "workerName",
    "instanceName"
]
options.messageSourceKeyNames[n] string
A key name to look for when inspecting incoming messages for merge.
Required: false
Default: ""
options.serialPortConfiguration object
Defines the serial port configuration.
Required: false
Default: (not specified; see any element defaults within)
options.serialPortConfiguration.SimulationMode boolean
Whether to run the plugin in simulation mode. See simulationLoopDelay and simluationResponse above, as well as responseRegex.
Required: true
Default: true
options.serialPortConfiguration.Address string
The address of the serial port.
Required: true
Default: "COM1"
options.serialPortConfiguration.Timeout integer
The timeout duration in milliseconds used for write and read operations.
Required: true
Default: 2000
options.serialPortConfiguration.TerminationEnable boolean
Whether to look for termination characters in responses.
Required: true
Default: true
options.serialPortConfiguration.TerminationCharacter string
The termination character to look for (if termination is enabled).
Required: true
Default: "\n"
options.serialPortConfiguration.TrimResponseWhiteSpace boolean
Whether to trim whitespace from responses.
Required: true
Default: true
options.serialPortConfiguration.BytesToRead integer
The number of bytes to read when reading responses. Note: read operations will terminate on: 1. a termination character, 2. on timeout, 3. on receiving BytesToRead number of bytes.
Required: true
Default: 1000
options.serialPortConfiguration.ReadToFileEnable boolean
Wehther to enable reading responses directly to a specified file.
Required: true
Default: false
options.serialPortConfiguration.ReadToFilePath string
The file path to read responses into (if ReadToFileEnable is true).
Required: true
Default: ""
options.serialPortConfiguration.BaudRate integer
The baud rate to use for serial communication. The available baud rates depend on the serial interface. Common baud rates include: 300, 600, 1200, 2400, 4800, 9600, 38400, 14400, 19200, 57600, 230400, 115200, 460800. Less common though not terrifically uncommon baud rates include: 100, 28800, 56000, 128000, 153600, 256000, 921600.
Required: true
Default: 9600
options.serialPortConfiguration.DataBits enum (integer)
The number of data bits used for underlying character encoding for transmission.
Required: true
Default: 8
Enum Items: 5 | 6 | 7 | 8
options.serialPortConfiguration.StopBits enum (string)
The number of bits which indicate the end of a given character transmission.
Required: true
Default: "1.0"
Enum Items: "1.0" | "1.5" | "2.0"
options.serialPortConfiguration.Parity enum (string)
The parity or error checking convention to use.
Required: true
Default: "None"
Enum Items: "None" | "Odd" | "Even" | "Mark" | "Space"
options.serialPortConfiguration.FlowControl string
The flow control convention to use.
Required: true
Default: "None"
options.serialInitializationSequence array
An array of initial communication to perform.
Required: false
Default:
[
    {
        "enable": false,
        "timeout": 2000,
        "writeCommand": false,
        "performRead": true,
        "bytesToRead": 1000,
        "responseRegex": ".+",
        "ignoreErrors": [
            -1073807253,
            -1073807339
        ]
    }
]
options.serialInitializationSequence[n] object
Required: false
Default: (not specified; see any element defaults within)
options.serialInitializationSequence[n].enable boolean
Whether to enable this element of the sequence.
Required: true
Default: false
options.serialInitializationSequence[n].timeout integer
The timeout used for this element's write and/or read operations.
Required: true
Default: 0
options.serialInitializationSequence[n].writeCommand stringboolean
The string command to write, or boolean false to prevent the write operation.
Required: true
Default: ""
options.serialInitializationSequence[n].performRead boolean
Whether to perform the read operation.
Required: true
Default: false
options.serialInitializationSequence[n].bytesToRead integer
The number of bytes to read.
Required: true
Default: 0
options.serialInitializationSequence[n].responseRegex stringboolean
The string regular expression to validate against the response, or boolean false to perform no validation.
Required: true
Default: ""
options.serialInitializationSequence[n].ignoreErrors array
An array of VISA error codes to ignore. For example, we may receive an initial framing error (-1073807253) for devices which simply publish data to the serial port even prior to a connection being opened or a command being sent. In such cases, there's a chance that the first bit seen upon opening the serial port might be in the middle of a serial packet which likely result in a framing error. Another common error to handle here is the timeout error (-1073807339).
Required: true
Default:
[]
options.serialInitializationSequence[n].ignoreErrors[n] integer
undefined
Required: false
Default: 0
options.rules array
An array of rules which determine how the LED displays. The first rule whose condition evaluates to true determines the state of the led. Incoming subscription variables are available in an @VAR{} container.
Required: false
Default:
[
    {
        "led": 1,
        "condition": true,
        "blink": {
            "enable": true,
            "delay": 500
        },
        "color": {
            "r": 0,
            "g": 255,
            "b": 0
        }
    }
]
options.rules[n] object
An object defining the condition on which to set color and blinking behavior of the led.
Required: false
Default:
{
    "led": 1,
    "condition": true,
    "blink": {
        "enable": true,
        "delay": 500
    },
    "color": {
        "r": 0,
        "g": 255,
        "b": 0
    }
}
options.rules[n].led integer
The LED number. Valid values are 1 - 64 as only up to 64 LEDs are supported by the underlying hardware.
Required: false
Default: 1
options.rules[n].condition stringboolean
If this evaluates to true, this rule's color and blink settings will be applied to the led.
Required: true
Default: "Boolean:(true)"
options.rules[n].blink.enable stringboolean
Whether to blink the led.
Required: true
Default: false
options.rules[n].blink.delay stringinteger
The blink delay in milliseconds (time between blinks). Due to hardware limitations, valid values are even integers in the range 2 to 510 milliseconds. Odd values will be rounded up to the next even integer (ex. specifying 99 ms will result in the value 100 ms being set for the led). Values outside the valid range will be coerced into the valid range.
Required: true
Default: 500
options.rules[n].color object
The color to make the led emit, specified as an RGB value.
Required: true
Default: (not specified; see any element defaults within)
options.rules[n].color.r stringinteger
The red component of the RGB color definition.
Required: true
Default: 255
options.rules[n].color.g stringinteger
The green component of the RGB color definition.
Required: true
Default: 255
options.rules[n].color.b stringinteger
The blue component of the RGB color definition.
Required: true
Default: 255
options.logger object
Defines the logging (data and errors) for this plugin. Note that a LOG variable space is provided here, as well as the VAR variable space. Available variables are: @LOG{LOGGERNAME}, @LOG{TIMESTAMP}, @LOG{LOGMESSAGE}, @LOG{ERRORMESSAGE}, and @VAR{instanceName} are available variables. note: @LOG{LOGGERNAME} is equal to the @VAR{instanceName} here.
Required: true
Default: (not specified; see any element defaults within)
options.logger.Enable boolean
Whether to enable the logger.
Required: true
Default: true
options.logger.LogFolder string
The folder in which to write log files.
Required: true
Default: "\\JADE_LOGS\\@VAR{instanceName}"
options.logger.FileNameFormat string
The filename to use when creating log files. Note: if the filesize limit is reached new files will be created with enumerated suffixes such as: MyLogFile-1.txt, MyLogFile-2.txt, etc.
Required: true
Default: "@VAR{instanceName}-@LOG{TIMESTAMP}.log"
options.logger.ErrorsOnly boolean
Whether to log only errors.
Required: true
Default: true
options.logger.DiskThrashPeriod integer
The period in milliseconds with which to flush the file buffer to ensure it's committed to the hard drive. Note: This is a performance consideration to prevent writing to disk too frequently.
Required: true
Default: 1000
options.logger.FileSizeLimit integer
The file size at which to create new files.
Required: true
Default: 1000000
options.logger.StartLogFormat string
The initial string to put into the log file when opened for the first time.
Required: true
Default: "**** START LOGGER - @LOG{LOGGERNAME} (@LOG{TIMESTAMP}) ****"
options.logger.EndLogFormat string
The final string to put in the log file when closed.
Required: true
Default: "\n\n**** END LOGGER - @LOG{LOGGERNAME} (@LOG{TIMESTAMP}) ****"
options.logger.LogEntryFormat string
The format to use when writing log entries when errors are not present.
Required: true
Default: "\n\n@LOG{LOGMESSAGE}"
options.logger.ErrorLogEntryFormat string
The message format used to construct error log entries.
Required: true
Default: "\n\n@LOG{ERRORMESSAGE}"
options.logger.TimestampFormat string
The format used by the @LOG{TIMESTAMP} variable.
Required: true
Default: "%Y-%m-%d %H-%M-%S%3u"
panel object
Required: true
Default: (not specified; see any element defaults within)
panel.open boolean
Whether to open the front panel immediately when run.
Required: true
Default: true
panel.state enum (string)
The state in which the window will open.
Required: true
Default: "Standard"
Enum Items: "Standard" | "Hidden" | "Closed" | "Minimized" | "Maximized"
panel.transparency integer
The transparency of the window. 0 = opaque, 100 = invisible.
Required: true
Default: 0
panel.title string
The title of the plugin window when it runs. Note that the variable 'instanceName' is provided here in a VAR variable container.
Required: true
Default: "@VAR{instanceName}"
panel.titleBarVisible boolean
Whether the window title bar is visible.
Required: true
Default: true
panel.showMenuBar boolean
Whether the menu bar is visible.
Required: true
Default: false
panel.showToolBar boolean
Whether the toolbar is visible.
Required: true
Default: false
panel.makeActive boolean
Whether the window becomes active when opened.
Required: true
Default: false
panel.bringToFront boolean
Whether the window is brought to the front / top of other windows when opened.
Required: true
Default: false
panel.minimizable boolean
Whether the window is minimizable.
Required: true
Default: true
panel.resizable boolean
Whether the window is resizable.
Required: true
Default: true
panel.closeable boolean
Whether the window is closeable.
Required: true
Default: true
panel.closeWhenDone boolean
Whether to close the window when complete.
Required: true
Default: true
panel.center boolean
Whether to center the window when opened. Note: this property overrides the 'position' property.
Required: true
Default: false
panel.position object
The position of the window when opened the first time.
Required: true
Default: (not specified; see any element defaults within)
panel.position.top integer
The vertical position of the window in pixels from the top edge of the viewport. Note: this property is overriden by the 'center' property.
Required: true
Default: 100
panel.position.left integer
The horizontal position of the window in pixels from the left edge of the viewport. Note: this property is overriden by the 'center' property.
Required: true
Default: 100
panel.size object
The size of the window when opened the first time.
Required: false
Default: (not specified; see any element defaults within)
panel.size.width integer
The width of the window in pixels. -1 means use the default width for the panel. Note that depending on panel features exposed, there may be a limit to how small a panel can become.
Required: true
Default: -1
panel.size.height integer
The height of the window in pixels. -1 means use the default height for the panel. Note that depending on panel features exposed, there may be a limit to how small a panel can become.
Required: true
Default: -1
channel object
The communication channel definition used by this plugin. Note: this section rarely needs modifications. In many cases, the underlying plugin implementation depends on at least some of these settings having the values below. Consult with a JADE expert before making changes to this section if you are unfamiliar with the implications of changes to this section.
Required: true
Default: (not specified; see any element defaults within)
channel.SendBreakTimeout integer
The timeout duration in milliseconds to wait for sending messages.
Required: true
Default: 1000
channel.WaitOnBreakTimeout integer
The timeout duration in milliseconds to wait for receiving messages. Note: -1 means wait indefinitely or until shutdown is signalled.
Required: true
Default: -1
channel.WaitOnShutdownTimeout integer
The timeout duration in milliseconds to wait for shutdown acknowledgment.
Required: true
Default: 2000
channel.ThrowTimeoutErrors boolean
Whether to throw timeout errors vs simply returning a boolean indicating whether a timeout occurred.
Required: true
Default: false
channel.ThrowShutdownUnacknowledgedErrors boolean
Whether to throw 'shutdown unacknowledged' errors.
Required: true
Default: true
channel.QueueSize integer
The size of the underlying communication queue in bytes. Note: -1 means unbounded (i.e. grow as needed with available memory).
Required: true
Default: -1
channel.SendBreakEnqueueType enum (string)
The enqueue strategy employed on the underlying queue for standard messages.
Required: true
Default: "Enqueue"
Enum Items: "Enqueue" | "EnqueueAtFront" | "LossyEnqueue" | "LossyEnqueueAtFront"
channel.SendErrorEnqueueType enum (string)
The enqueue strategy employed on the underlying queue for error messages.
Required: true
Default: "Enqueue"
Enum Items: "Enqueue" | "EnqueueAtFront" | "LossyEnqueue" | "LossyEnqueueAtFront"
channel.SendShutdownEnqueueType enum (string)
The enqueue strategy employed on the underlying queue for the shutdown message.
Required: true
Default: "LossyEnqueueAtFront"
Enum Items: "Enqueue" | "EnqueueAtFront" | "LossyEnqueue" | "LossyEnqueueAtFront"
channel.FlushQueueBeforeWaitingOnBreak boolean
Whether to flush the queue upon waiting for new messages (i.e. whether to clear the queue and wait for the next 'new' message; this has the effect of removing old messages and waiting for the next message.
Required: true
Default: false
channel.FlushQueueAfterBreaking boolean
Whether to flush the queue after receiving a new message (i.e. whether to handle the next message coming in the queue and then flush; this has the effect of handling the oldest message (if it exsits) or the next message before flushing the queue.
Required: true
Default: false