public abstract class SerialPort
extends java.lang.Object
Qualifiers and types | Fields and descriptions |
---|---|
static int |
DATABITS_5
Data bits
|
static int |
DATABITS_6 |
static int |
DATABITS_7 |
static int |
DATABITS_8 |
static int |
FLOWCONTROL_NONE
Flow control
|
static int |
FLOWCONTROL_RTSCTS |
static int |
FLOWCONTROL_RTSCTS_IN |
static int |
FLOWCONTROL_RTSCTS_OUT |
static int |
FLOWCONTROL_XONXOFF |
static int |
FLOWCONTROL_XONXOFF_IN |
static int |
FLOWCONTROL_XONXOFF_OUT |
static int |
PARITY_EVEN |
static int |
PARITY_NONE
Check the way
|
static int |
PARITY_ODD |
static int |
STOPBITS_1
Stop bit
|
static int |
STOPBITS_1_5 |
static int |
STOPBITS_2 |
Constructors and instructions |
---|
SerialPort() |
Qualifiers and types | Methods and instructions |
---|---|
abstract void |
clearIoBuffer()
Empty input and output buffers
|
abstract void |
close()
Close the serial port
|
abstract int |
getDataBits()
Get data bits
|
abstract int |
getFlowControl()
Get flow control mode
|
abstract java.io.InputStream |
getInputStream()
Get the input data stream
|
abstract java.io.OutputStream |
getOutputStream()
Get the output stream
|
abstract int |
getParity()
Get the verification method
|
abstract java.lang.String |
getPort()
Get the serial port path
|
abstract int |
getReceiveLength()
Gets the length of the data that has been received
|
abstract int |
getStopBits()
Get the stop bit
|
static SerialPort |
open(SerialPortConfiguration cfg,
boolean blockMode)
Open the serial port
|
static SerialPort |
open(java.lang.String port)
Open the serial port
|
static SerialPort |
open(java.lang.String port,
boolean blockMode)
Open the serial port
|
abstract int |
read(byte[] data)
Read data
|
abstract void |
setParam(int baudrate,
int databits,
int parity,
int stopbits,
int flowControl)
Set the serial port mode
|
abstract void |
write(byte[] data)
send data
|
public static final int PARITY_NONE
public static final int PARITY_ODD
public static final int PARITY_EVEN
public static final int DATABITS_5
public static final int DATABITS_6
public static final int DATABITS_7
public static final int DATABITS_8
public static final int STOPBITS_1
public static final int STOPBITS_2
public static final int STOPBITS_1_5
public static final int FLOWCONTROL_NONE
public static final int FLOWCONTROL_RTSCTS_IN
public static final int FLOWCONTROL_RTSCTS_OUT
public static final int FLOWCONTROL_RTSCTS
public static final int FLOWCONTROL_XONXOFF_IN
public static final int FLOWCONTROL_XONXOFF_OUT
public static final int FLOWCONTROL_XONXOFF
public static SerialPort open(SerialPortConfiguration cfg, boolean blockMode) throws java.lang.Throwable
cfg
- Serial port configuration informationblockMode
- Blocking mode or non-blocking modejava.lang.Exception
java.lang.Throwable
public static SerialPort open(java.lang.String port, boolean blockMode) throws java.lang.Throwable
port
- Serial port path(/dev/ttyS1, /dev/ttyS3, /dev/ttymxc1, /dev/ttymxc2, ...)blockMode
- Blocking mode or non-blocking modejava.lang.Exception
java.lang.Throwable
public static SerialPort open(java.lang.String port) throws java.lang.Throwable
port
- Serial port path(/dev/ttyS1, /dev/ttyS3, /dev/ttymxc1, /dev/ttymxc2, ...)java.lang.Exception
java.lang.Throwable
public abstract void setParam(int baudrate, int databits, int parity, int stopbits, int flowControl) throws java.io.IOException
baudrate
- Baud ratedatabits
- Data bits(7, 8, 9等)parity
- Check the waystopbits
- Stop bithandsake
- Flow controljava.io.IOException
public abstract java.lang.String getPort()
public abstract int getDataBits()
public abstract int getParity()
public abstract int getStopBits()
public abstract int getFlowControl()
public abstract void close()
public abstract void clearIoBuffer() throws java.io.IOException
java.io.IOException
public abstract int getReceiveLength() throws java.io.IOException
java.io.IOException
public abstract void write(byte[] data) throws java.io.IOException
data
- java.io.IOException
public abstract int read(byte[] data) throws java.io.IOException
data
- java.io.IOException
public abstract java.io.InputStream getInputStream() throws java.io.IOException
java.io.IOException
public abstract java.io.OutputStream getOutputStream() throws java.io.IOException
java.io.IOException