public class TiUART extends Object
| Modifier and Type | Field and Description |
|---|---|
static int |
BUFF_READ
Read buffer
|
static int |
BUFF_WR
Write and read buffer
|
static int |
BUFF_WRITE
Write buffer
|
static int |
CONTROL_HARDWARE
Flow control hardware
|
static int |
CONTROL_NONE
Flow control none
|
static int |
CONTROL_SOFTWARE
Flow control software
|
static int |
PARITY_EVEN
Even parity mode
|
static int |
PARITY_NONE
None parity mode
|
static int |
PARITY_ODD
Odd parity mode
|
static int |
STOPBIT_0_5
0.5 bit stop bit
|
static int |
STOPBIT_1
1 bit stop bit
|
static int |
STOPBIT_1_5
1.5 bits stop bit
|
static int |
STOPBIT_2
2 bits stop bit
|
| Modifier and Type | Method and Description |
|---|---|
int |
available()
Check read available
|
void |
clear(int buffer)
Clear the data buffer
|
void |
close()
Close the port of current object
|
int |
getPort()
Gets the port id of current object
|
static TiUART |
open(int portID)
Open the TiUART port by port id, and return the object
NOTE1: control is CONTROL_NONE, that is default flow control type NOTE2: remapID is 0, that is default location |
static TiUART |
openRemap(int portID,
int control,
int remapID)
Open the TiUART port by port id, flow control type and remap id, and return
the object
|
static int |
portNumber()
Maximum number of port supported
|
int |
read(byte[] data,
int offset,
int len)
Read date from receive data buffer
|
void |
setWorkParameters(int dataBitNum,
int stopBitNum,
int parity,
int baudRate)
Set work parameters
|
int |
write(byte[] data,
int offset,
int len)
Write date to send data buffer
|
public static final int BUFF_READ
public static final int BUFF_WR
public static final int BUFF_WRITE
public static final int CONTROL_HARDWARE
public static final int CONTROL_NONE
public static final int CONTROL_SOFTWARE
public static final int PARITY_EVEN
public static final int PARITY_NONE
public static final int PARITY_ODD
public static final int STOPBIT_0_5
public static final int STOPBIT_1
public static final int STOPBIT_1_5
public static final int STOPBIT_2
public int available()
throws IOException
IOException - If a TiUART error occurspublic void clear(int buffer)
throws IOException
buffer - data buffer type,IOException - If a TiUART error occurspublic void close()
throws IOException
IOException - If a TiUART error occurspublic int getPort()
public static TiUART open(int portID) throws IOException
portID - port idIOException - If a TiUART error occurspublic static TiUART openRemap(int portID, int control, int remapID) throws IOException
portID - port idcontrol - flow control type,remapID - the remap Id, range:0-3IOException - If a TiUART error occurspublic static int portNumber()
public int read(byte[] data,
int offset,
int len)
throws IOException
data - data arrayoffset - data offsetlen - data lengthIOException - If a TiUART error occursNullPointerException - If data is nullArrayIndexOutOfBoundsException - If array index out of rangepublic void setWorkParameters(int dataBitNum,
int stopBitNum,
int parity,
int baudRate)
throws IOException
dataBitNum - data bit number,stopBitNum - stop bit number,parity - data parity type,baudRate - data baud rateIOException - If a TiUART error occurspublic int write(byte[] data,
int offset,
int len)
throws IOException
data - data arrayoffset - data offsetlen - data lengthIOException - If a TiUART error occursNullPointerException - If data is nullArrayIndexOutOfBoundsException - If array index out of range