read.serialConnection: Reads from the serial interface.
Description
This function reads from the serial interface as long as the buffer is not
empty. The read takes place per line in normal operation mode. Here end-of-line
characters (\n;\r) are clipped according to the settings (translation).
Usage
read.serialConnection(con,n = 0)
Arguments
con
serial connection
n
number of bytes to read. Only in binary mode.
n=0 (default) reads the whole buffer at once.
Value
In normal mode the result is a string. In binary mode raw values will
be returned
Details
In binary (hex-) mode the read takes place per byte. The result is a raw
vector of hexadecimal numbers. To get numeric values as.numeric
function must be invoked.
Mind: Values form 0x01 -- 0x31 might be displayed as escaped characters like
"\001" if they are interpreted as string.
If the end-of-file character specified by eof is received the reading
stops. A close(con) -- open(con) sequence must be invoked to
reopen the connection.
If n>0 <n> bytes will be read. In case of less than n bytes
available the function returns the buffer without waiting for all n
characters.
If the result is empty (zero length) then the empty string '' is returned in ASCII
mode or NA in binary mode.