User Manual

Table Of Contents
EK-5209-5 Evaluation Kit User’s Guide A-23
iBeanAPI_IO.h
13. ibApi_IO_ReadSerial()
ibApi_FUNC ibApi_IO_ReadSerial (
ibApi_APIHANDLE api_hdl,
ibApi_DEVICEID device_id,
ibApi_UINT8 buffer[],
ibApi_UINT8 buffer_size,
ibApi_UINT8 seq_num
);
For the given device, this retrieves the user data packet that arrived most recently. The
ibApi_IO_SERIALMODE setting must have been previously something other than
ibApi_IO_SERIALMODE_DISABLED. The input buffer holds a single packet (i.e., an
arriving packet overwrites the previous one). Lost packets can be detected by gaps in the
sequence numbers, which increment whenever a packet is received. If no new data is
available, then the return value is 0.
Parameters:
api_hdl: (input) API handle returned from ibApi_Open().
device_id: (input) ID of the device to be accessed.
buffer[ ]: (output) Buffer to store the incoming user data packet.
buffer_size: (input) Maximum size for buffer[ ].
seq_num: (output) Sequence number identifying this packet, or NULL if this information
is not needed.
Return Value:
Error code or the actual size of the result (which could exceed buffer_size if the written
data was truncated)