Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.4j

Application v 5.22b

  

 

Chapter TwelveInternet Functions (continued)

SerialRxLine Function

Overview

The SerialRxLine function accumulates characters until a line ending has been received or a time-out occurs and returns a string containing the characters.

Syntax/Parameters

Syntax

string = SerialRxLine ( handle hSerial );

Parameters

hSerial

A handle to a Serial Port Object.

Return Value

Returns a string containing the received line or an empty string on error. If a return character is received prior to any other data, an empty string will be returned. Use the GetLastError to retrieve a formatted error code and IsError to determine if an error occurred.

On normal completion, the last error code will contain the character that completed the line. This is normally a return character (0x0D)«but can be any designated escape character». If the internal buffer overflows, the received characters will be returned an the last error set to ERROR_OVERFLOW. This allows strings in excess of the buffer size to be received but they must be assembled by the script.

Remarks

Data is accumulated into the receive buffer until one of three conditions occurs: the buffer is full, a line ending/escape character is encountered, or a timeout occurs. The internal buffer is limited to 8192 characters.

The function will return with ERROR_TIME_OUT if the process times out. The time-out is based on the default time-out value of 10ms for the Serial Port Object. Note that at slow baud rates and fast computers the receive function can easily time-out. If a timeout occurs, any characters received are held in the current buffer and will be appended to the next call and returned on a successful read operation.

Data is read from the serial channel receive queue one character at a time until a line return or an escape character is received, at which point the content is returned as a string.

Related Functions

Platform Support

Go13, Go16, GoFiler Complete, GoFiler Corporate, GoFiler, GoFiler Lite, GoXBRL

Legato IDE, Legato Basic