SerialPort Usage

The SerialPorts extension to Lua in Q-SYS Designer Software can be used to connect a plugin or scripted control to a serial port on a piece of hardware within a design. Documentation of the SerialPorts interface can be found here. The serial connection is made with a serial pin. This provides bidirectional access to the serial port on that piece of hardware. A control script or plugin with a serial port pin will allow this example code to connect to that pin and handle the interface.

The serial port has functionality similar to the TCPSocket. This example builds a Serial control bound to the first serial pin on the object. A series of functions to handle the data and information received from the port are then created and bound to the SerialPort. The script then initiates the serial connection when the script is loaded. Any data received is checked for the known login exchange and will automatically log in.

Note: This example builds the interface, but no calls are made. Data calls and handling based on the device being connected to still need to be added.

The serial port example above can be built into a plugin or control script. The following example plugin binds this engine with a command button and a polling loop. The design then connects the plugin serial pin to the serial port on a Q-SYS Core processor.