Returns a context manager wrapping a serial port, allowing the rest of the system to interact with that port. This function effectively combines the system.serial.configureSerialPort, system.serial.openSerialPort, and system.serial.closeSerialPort functions into a single call.
Closing the port happens automatically once the 'with' statement ends.
Accepts the same arguments as configureSerialPort, and access to constants must be prefixed by "system.serial." (as shown in the parameter descriptions.
|Client permissions restrictions|
system.serial.port(port, [bitRate], [dataBits], [handshake], [hardwareFlowControl], [parity], [stopBits])
String port - The name of the serial port, e.g., "COM1" or "dev/ttyS0".
Integer bitRate - Configure the bit rate. Valid values are defined by the following constants ([optional)]:
Integer dataBits - Configure the data bits. Valid values are defined by the following constants (optional):
Integer Integer handshake - Configure the handshake. Valid values are defined by the following constants ([optional)]:
Boolean hardwareFlowControl - Configure hardware flow control on or off (. [optional).]
Integer parity - Configure parity. Valid values are defined by the following constants ([optional)]:
Integer stopBits - Configure stop bits. Valid values are defined by the following constants ([optional)]:
PortManager - A wrapper around the configured port, that can be entered by using a 'with' statement. The port will automatically close on exiting the 'with' statement scope.
Gateway, Vision Client, Perspective Session
The PortManager is the primary way to interact with a serial port when using this function. It has special access to the other system serial functions. Specifically:
Calling these functions from the PortManager does not require the 'port' parameter, as the port is implied by system.serial.port. However all other parameters are available (see the linked pages in the bullet list above).
In addition, you do not include 'system.serial.' when accessing the other serial functions mentioned above, as the aliased object has access to them. Thus:
system serialport, serial.port