You're reading the documentation for an older, but still supported version (GL013300).
For information on the latest version, please have a look at GL013301.

flange_serial_read

This is a function for receiving serial data from the flange serial port in the robot controller.
The port parameter is only available in the new flange version (v2).

Definition
DRFLEx.h within class CDRFLEx, public section (line 879)

LPFLANGE_SER_RXD_INFO_EX flange_serial_read(float fTimeout = -1, int nPort = 1)
{
    return _flange_serial_read(_rbtCtrl, fTimeout, nPort);
};

Parameter

Parameter Name

Data Type

Default Value

Description

fTimeout

float

-1

Timeout value in seconds.
A value of -1 means the function will wait indefinitely for incoming data.

nPort

int

1

Port number for flange serial interface
1: X1
2: X2 (supported only on M/H models)

Return

Value

Description

FLANGE_SER_RXD_INFO_EX

Refer to the Definition of Structure

Example

Drfl.flange_serial_open(115200);
Drfl.flange_serial_write(8, "test123");

LPFLANGE_SER_RXD_INFO_EX temp = Drfl.flange_serial_read(4.5);
cout << "Serial read : " << temp->_pRxd << endl;
cout << "Serial cnt  : " << (int)temp->_iSize << endl;

Drfl.flange_serial_close(0);

This example opens the flange serial port, sends the string “test123”, waits up to 4.5 seconds for a response, and prints the received data and byte count using the returned structure.