buf_len()

buf_len()

Description

Get length of received buffer.

Syntax

buf_len(peripheral);

Parameters

 

Variable

Input

Variable

Input

peripheral

RS232 - Reads from RS232 peripheral.

RS485 - Reads from RS485 peripheral.

J1708 - Reads from J1708 peripheral.

Kline - Reads from Kline.

Remote_Command - Reads command received from remote server.

Returns

Return value

Return explanation

SCRIPT_OPERATION_FAILED

Error.

<value>

Length of peripheral data.

Function call example

Example of reading RS485 buffer length
new str_temp[255]; main() { Init(RS485, 115200, WORDLENGTH_8, STOPBITS_1, PARITY_NONE); for(;;) { if(buf_len(RS485)) // Check length of RS485 internal buffer { read_buf(RS485, buf_len(RS485), str_temp); // Read `buf_len(RS485)` number of bytes from RS485 peripheral to `str_temp` } Delay(1000); // Delay 1 sec. } }

Used in Examples

RS232 example

RS485 example