beautypg.com

Solvline PB2xxxUG User Manual

Page 81

background image

U_read_port

Read

Serial

Data

Description This function reads a number of bytes (less than or equal to buff_size) from a

specified file descriptor and places them in buff.

Synopsis

int U_read_port (int fd, char *buff, int buff_size, int mtu_size)

Parameters fd

: Serial file descriptor

buff

: Pointer to buffer to receive bytes

buff_size

: The maximum size of bytes to read into buffer

mtu_size

: The maximum of a packet that can be transferred in one
frame over a network (maximum size : 1100)

Returns

0

: If end of file

n

: The number of bytes read (between 1 and buff_size)

U_send_port

Send

Serial

Data

Description The function attempts to write the specified number of bytes from the

specified buffer to the specified serial file descriptor.

Synopsis

int U_send_port (int fd, char *buff, int length)

Parameters fd

: Serial file descriptor

buff

: Pointer to buffer to write

length

: Length of buffer

Returns

n

: The number of bytes sent

81