SERIAL_ReceiveData

The SERIAL_ReceiveData() function is used to receive an arbitrary length of characters from the serial port.

Synopsis

int SERIAL_ReceiveData(int port, 
unsigned char *buf,
int *len,
int bufLen,
long timeout);
Parameter Description
port Serial port number (0 based). Specify port 0 to redirect the output to the hsmtrace log.
buf Pointer to an array of bytes, which will hold the received data.
len Pointer to an integer which will hold the actual number of characters received.
bufLen Both the maximum amount of data, in bytes, of the buffer,and the number of bytes requested from the serial port.
timeout Milliseconds to wait for a character to appear. A timeout of -1 will use the default timeout

Return Code

0: Requested number of bytes has been received.

-1: Less than the requested number of bytes have been received.