public class SerialPort
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected int |
mFd |
| Modifier | Constructor and Description |
|---|---|
protected |
SerialPort() |
|
SerialPort(java.lang.String serialPath,
int baudrate) |
|
SerialPort(java.lang.String serialPath,
int baudrate,
boolean flowcontrol) |
| Modifier and Type | Method and Description |
|---|---|
int |
close()
Close a previously opened file descriptor
|
protected int |
open(java.lang.String serialPath,
int baudrate,
boolean flowcontrol) |
int |
read(byte[] buff,
int count,
int timeout)
Read data from a serial port
|
int |
read(byte[] buff,
int from,
int count,
int timeout)
Read data from a serial port
|
int |
readln(byte[] buff,
int count,
int timeout)
Read data from a serial port until a \n is found
|
int |
setRTS(boolean value)
Set RTS level
|
java.lang.String |
version()
Return the version string
|
int |
write(byte[] buff,
int count)
Write data to a serial port
|
public SerialPort(java.lang.String serialPath,
int baudrate)
throws java.io.IOException
java.io.IOExceptionpublic SerialPort(java.lang.String serialPath,
int baudrate,
boolean flowcontrol)
throws java.io.IOException
java.io.IOExceptionprotected SerialPort()
protected int open(java.lang.String serialPath,
int baudrate,
boolean flowcontrol)
public int close()
public int write(byte[] buff,
int count)
buff - Buffer containing the datacount - How many bytes to writepublic int read(byte[] buff,
int count,
int timeout)
buff - Buffer containing the datacount - How many bytes to readtimeout - Read timeout in millisecondspublic int read(byte[] buff,
int from,
int count,
int timeout)
buff - Buffer containing the datafrom - Fill buffer starting from this indexcount - How many bytes to writetimeout - Read timeout in millisecondspublic int readln(byte[] buff,
int count,
int timeout)
buff - Buffer containing the datacount - How many bytes to writetimeout - Read timeout in millisecondspublic int setRTS(boolean value)
value - Set true to assert RTSpublic java.lang.String version()