public interface UsbSerialPort_qcom
| Modifier and Type | Field and Description |
|---|---|
static int |
DATABITS_5
5 data bits.
|
static int |
DATABITS_6
6 data bits.
|
static int |
DATABITS_7
7 data bits.
|
static int |
DATABITS_8
8 data bits.
|
static int |
FLOWCONTROL_NONE
No flow control.
|
static int |
FLOWCONTROL_RTSCTS_IN
RTS/CTS input flow control.
|
static int |
FLOWCONTROL_RTSCTS_OUT
RTS/CTS output flow control.
|
static int |
FLOWCONTROL_XONXOFF_IN
XON/XOFF input flow control.
|
static int |
FLOWCONTROL_XONXOFF_OUT
XON/XOFF output flow control.
|
static int |
PARITY_EVEN
Even parity.
|
static int |
PARITY_MARK
Mark parity.
|
static int |
PARITY_NONE
No parity.
|
static int |
PARITY_ODD
Odd parity.
|
static int |
PARITY_SPACE
Space parity.
|
static int |
STOPBITS_1
1 stop bit.
|
static int |
STOPBITS_1_5
1.5 stop bits.
|
static int |
STOPBITS_2
2 stop bits.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the port.
|
boolean |
getCD()
Gets the CD (Carrier Detect) bit from the underlying UART.
|
boolean |
getCTS()
Gets the CTS (Clear To Send) bit from the underlying UART.
|
boolean |
getDSR()
Gets the DSR (Data Set Ready) bit from the underlying UART.
|
boolean |
getDTR()
Gets the DTR (Data Terminal Ready) bit from the underlying UART.
|
int |
getPortNumber()
Port number within driver.
|
boolean |
getRI()
Gets the RI (Ring Indicator) bit from the underlying UART.
|
boolean |
getRTS()
Gets the RTS (Request To Send) bit from the underlying UART.
|
java.lang.String |
getSerial()
The serial number of the underlying UsbDeviceConnection, or
null. |
void |
open(UsbDeviceConnection connection)
Opens and initializes the port.
|
boolean |
purgeHwBuffers(boolean flushRX,
boolean flushTX)
Flush non-transmitted output data and / or non-read input data
|
int |
read(byte[] dest,
int timeoutMillis)
Reads as many bytes as possible into the destination buffer.
|
void |
setDTR(boolean value)
Sets the DTR (Data Terminal Ready) bit on the underlying UART, if
supported.
|
boolean |
setParameters() |
void |
setParameters(int baudRate,
int dataBits,
int stopBits,
int parity)
Sets various serial port parameters.
|
void |
setRTS(boolean value)
Sets the RTS (Request To Send) bit on the underlying UART, if
supported.
|
int |
write(byte[] src,
int timeoutMillis)
Writes as many bytes as possible from the source buffer.
|
static final int DATABITS_5
static final int DATABITS_6
static final int DATABITS_7
static final int DATABITS_8
static final int FLOWCONTROL_NONE
static final int FLOWCONTROL_RTSCTS_IN
static final int FLOWCONTROL_RTSCTS_OUT
static final int FLOWCONTROL_XONXOFF_IN
static final int FLOWCONTROL_XONXOFF_OUT
static final int PARITY_NONE
static final int PARITY_ODD
static final int PARITY_EVEN
static final int PARITY_MARK
static final int PARITY_SPACE
static final int STOPBITS_1
static final int STOPBITS_1_5
static final int STOPBITS_2
boolean setParameters()
int getPortNumber()
java.lang.String getSerial()
null.void open(UsbDeviceConnection connection) throws java.io.IOException
connection - an open device connection, acquired with
UsbManager#openDevicejava.io.IOException - on error opening or initializing the port.void close()
throws java.io.IOException
java.io.IOException - on error closing the port.int read(byte[] dest,
int timeoutMillis)
throws java.io.IOException
dest - the destination byte buffertimeoutMillis - the timeout for readingjava.io.IOException - if an error occurred during readingint write(byte[] src,
int timeoutMillis)
throws java.io.IOException
src - the source byte buffertimeoutMillis - the timeout for writingjava.io.IOException - if an error occurred during writingvoid setParameters(int baudRate,
int dataBits,
int stopBits,
int parity)
throws java.io.IOException
baudRate - baud rate as an integer, for example 115200.dataBits - one of DATABITS_5, DATABITS_6,
DATABITS_7, or DATABITS_8.stopBits - one of STOPBITS_1, STOPBITS_1_5, or
STOPBITS_2.parity - one of PARITY_NONE, PARITY_ODD,
PARITY_EVEN, PARITY_MARK, or
PARITY_SPACE.java.io.IOException - on error setting the port parametersboolean getCD()
throws java.io.IOException
false if not supported.java.io.IOException - if an error occurred during readingboolean getCTS()
throws java.io.IOException
false if not supported.java.io.IOException - if an error occurred during readingboolean getDSR()
throws java.io.IOException
false if not supported.java.io.IOException - if an error occurred during readingboolean getDTR()
throws java.io.IOException
false if not supported.java.io.IOException - if an error occurred during readingvoid setDTR(boolean value)
throws java.io.IOException
value - the value to setjava.io.IOException - if an error occurred during writingboolean getRI()
throws java.io.IOException
false if not supported.java.io.IOException - if an error occurred during readingboolean getRTS()
throws java.io.IOException
false if not supported.java.io.IOException - if an error occurred during readingvoid setRTS(boolean value)
throws java.io.IOException
value - the value to setjava.io.IOException - if an error occurred during writingboolean purgeHwBuffers(boolean flushRX,
boolean flushTX)
throws java.io.IOException
flushRX - true to flush non-transmitted output dataflushTX - true to flush non-read input datatrue if the operation was successful, or
false if the operation is not supported by the driver or devicejava.io.IOException - if an error occurred during flush