SERIAL_RecieveData

Retrieves an arbitrary length of characters from the serial port.

Synopsis
#include <serial.h> 
int SERIAL_ReceiveData(int port, 
           unsigned char *buf,
       int *len,
       int bufLen,
       long timeout);
Parameters
port Serial port number (0 based). Specify port 0 to redirect the output to the HSM trace log
buf Pointer to an array of bytes to be sent
len Pointer to an integer which will hold the actual number of characters received
bufLen length of the buffer, in bytes
timeout

Number of milliseconds to wait for a character to appear. A timeout of -1 will use the default timeout.

The default timeout is
4000ms + (10ms * number of characters)

Example, reading 25 characters:
4000 + (10 * 25) = 4250ms = 4.25s

Return Code
Function Code Qualification
0 Requested number of bytes has been received.
-1 Less than the requested number of bytes has been received.