SerLen

(Engine-Level Function)

Description: Serial Port Buffer Length. This function returns the number of bytes currently in the receive or transmit buffers.
Returns: Numeric
Usage: Script Only.
Function Groups: Serial Port, String and Buffer
Related to: COMPort | SerCheck | SerIn | SerOut | SerRcv | SerRTS | SerSend | SerStrEsc | SerString | SerWait
Format: SerLen(Port, Option)
Parameters:  
Port
Required. Any numeric expression for the serial port number (opened with a ComPort function) or any stream value.
Option
Required. Any status expression. If Option is true, the number of bytes in the transmit buffer is returned. If Option is false, the number of bytes in the receive buffer is returned.
Comments: This function may only appear in a script.

Examples:

If ! Valid(rcvBufLen);
[
   rcvBufLen = SerLen(2, 0);
]

This finds the number of bytes presently in the receive buffer on serial port 2. This will always be a valid number equal to 0 or greater.