For information on the latest version, please have a look at 1.33.5.
flange_serial_read
This function receives 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
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. |
nPort |
int |
1 |
Port number for flange serial interface |
Return
Value |
Description |
|---|---|
Refer to the Definition of Structure |
Note
The returned pointer refers to storage in the CDRFLEx object that other DRFL calls and every reconnect reuse; copy the structure before making another DRFL call. The 3-argument ikin returns its result in storage shared by all CDRFLEx objects in the process instead; see ikin. Except for get_user_home, the pointer is never NULL; do not use a NULL check to detect failure.
The flange board revision used by the flange serial and flange I/O functions is read at open_connection.
Example
char buf[] = "test123";
Drfl.flange_serial_open(1, 115200);
Drfl.flange_serial_write(7, buf, 1);
LPFLANGE_SER_RXD_INFO_EX temp = Drfl.flange_serial_read(4.5, 1);
printf("Serial read : %.*s\n", temp->_iSize, (const char*)temp->_cRxd);
printf("Serial cnt : %d\n", temp->_iSize);
Drfl.flange_serial_close(1);
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.