beautypg.com

Roserialport – BrightSign Object Reference Manual (FW 5.1) User Manual

Page 300

background image

292

roSerialPort

This object controls the RS-232 serial port, allowing you to receive input and send responses.

Object Creation: The roSerialPort object is created with two parameters.

CreateObject(roSerialPort, port As Integer, baud_rate As Integer)

port: The port enumeration of the serial device. Most standard RS-232 serial devices enumerate on port 0. If you
are connecting a USB-serial device (such as a GPS receiver), it will enumerate on port 2.

baud_rate: The baud rate for serial communication. The serial port supports the following baud rates: 1800, 2400,
4800, 9600, 19200, 38400, 57600, 115200.


roSerialPort sends the following event types:

roStreamLineEvent: The line event is generated whenever the end of line string set using SetEol is found and
contains a String for the whole line. This object implements the ifString and ifUserData interfaces.

roStreamByteEvent: The byte event is generated on every byte received. This object implements the ifInt and
ifUserData interfaces.


Interfaces:

ifStreamSend

,

ifStreamReceive

,

ifSerialControl,

ifUserData


The ifStreamSend interface provides the following:

SetSendEol(eol_sequence As String) As Void: Sets the EOL sequence when writing to the stream.

SendByte(byte As Integer) As Void: Writes the specified byte to the stream.

SendLine(string As String) As Void: Writes the specified characters to the stream followed by the
current EOL sequence.

SendBlock(a As Dynamic) As Void: Writes the specified characters to the stream. This method can support
either a string or an

roByteArray

. If the block is a string, any null bytes will terminate the block.