SERIAL_SendData

SERIAL_SendData() function is used to send a character array over a serial port.

Synopsis

#include <serial.h>  applies to all SERIAL_* functions
int SERIAL_SendData(int port,
unsigned char *buf,
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 to be sent
bufLen Length of the buffer, in bytes
timeout

Milliseconds to wait for a character to be sent. A timeout of -1 will use the default timeout.

NOTE   The timeout value refers to the total time taken to send the data. For example, a 2 millisecond timeout for sending 10 characters in 9600 baud setting will always fail – the timeout must be at least 10 milliseconds.

Return Code

0: The characters were sent successfully.

-1: There was an error.