public class UsbSerialPortImpl_qcom extends java.lang.Object implements UsbSerialPort_qcom
DATABITS_5, DATABITS_6, DATABITS_7, DATABITS_8, FLOWCONTROL_NONE, FLOWCONTROL_RTSCTS_IN, FLOWCONTROL_RTSCTS_OUT, FLOWCONTROL_XONXOFF_IN, FLOWCONTROL_XONXOFF_OUT, PARITY_EVEN, PARITY_MARK, PARITY_NONE, PARITY_ODD, PARITY_SPACE, STOPBITS_1, STOPBITS_1_5, STOPBITS_2| Constructor and Description |
|---|
UsbSerialPortImpl_qcom(UsbDeviceConnection mConnection) |
| 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.
|
public UsbSerialPortImpl_qcom(UsbDeviceConnection mConnection)
public int getPortNumber()
UsbSerialPort_qcomgetPortNumber in interface UsbSerialPort_qcompublic java.lang.String getSerial()
UsbSerialPort_qcomnull.getSerial in interface UsbSerialPort_qcompublic void open(UsbDeviceConnection connection)
throws java.io.IOException
UsbSerialPort_qcomopen in interface UsbSerialPort_qcomconnection - an open device connection, acquired with
UsbManager#openDevicejava.io.IOException - on error opening or initializing the port.public void close()
throws java.io.IOException
UsbSerialPort_qcomclose in interface UsbSerialPort_qcomjava.io.IOException - on error closing the port.public int read(byte[] dest,
int timeoutMillis)
throws java.io.IOException
UsbSerialPort_qcomread in interface UsbSerialPort_qcomdest - the destination byte buffertimeoutMillis - the timeout for readingjava.io.IOException - if an error occurred during readingpublic int write(byte[] src,
int timeoutMillis)
throws java.io.IOException
UsbSerialPort_qcomwrite in interface UsbSerialPort_qcomsrc - the source byte buffertimeoutMillis - the timeout for writingjava.io.IOException - if an error occurred during writingpublic boolean setParameters()
setParameters in interface UsbSerialPort_qcompublic void setParameters(int baudRate,
int dataBits,
int stopBits,
int parity)
throws java.io.IOException
UsbSerialPort_qcomsetParameters in interface UsbSerialPort_qcombaudRate - baud rate as an integer, for example 115200.dataBits - one of UsbSerialPort_qcom.DATABITS_5, UsbSerialPort_qcom.DATABITS_6,
UsbSerialPort_qcom.DATABITS_7, or UsbSerialPort_qcom.DATABITS_8.stopBits - one of UsbSerialPort_qcom.STOPBITS_1, UsbSerialPort_qcom.STOPBITS_1_5, or
UsbSerialPort_qcom.STOPBITS_2.parity - one of UsbSerialPort_qcom.PARITY_NONE, UsbSerialPort_qcom.PARITY_ODD,
UsbSerialPort_qcom.PARITY_EVEN, UsbSerialPort_qcom.PARITY_MARK, or
UsbSerialPort_qcom.PARITY_SPACE.java.io.IOException - on error setting the port parameterspublic boolean getCD()
throws java.io.IOException
UsbSerialPort_qcomgetCD in interface UsbSerialPort_qcomfalse if not supported.java.io.IOException - if an error occurred during readingpublic boolean getCTS()
throws java.io.IOException
UsbSerialPort_qcomgetCTS in interface UsbSerialPort_qcomfalse if not supported.java.io.IOException - if an error occurred during readingpublic boolean getDSR()
throws java.io.IOException
UsbSerialPort_qcomgetDSR in interface UsbSerialPort_qcomfalse if not supported.java.io.IOException - if an error occurred during readingpublic boolean getDTR()
throws java.io.IOException
UsbSerialPort_qcomgetDTR in interface UsbSerialPort_qcomfalse if not supported.java.io.IOException - if an error occurred during readingpublic void setDTR(boolean value)
throws java.io.IOException
UsbSerialPort_qcomsetDTR in interface UsbSerialPort_qcomvalue - the value to setjava.io.IOException - if an error occurred during writingpublic boolean getRI()
throws java.io.IOException
UsbSerialPort_qcomgetRI in interface UsbSerialPort_qcomfalse if not supported.java.io.IOException - if an error occurred during readingpublic boolean getRTS()
throws java.io.IOException
UsbSerialPort_qcomgetRTS in interface UsbSerialPort_qcomfalse if not supported.java.io.IOException - if an error occurred during readingpublic void setRTS(boolean value)
throws java.io.IOException
UsbSerialPort_qcomsetRTS in interface UsbSerialPort_qcomvalue - the value to setjava.io.IOException - if an error occurred during writingpublic boolean purgeHwBuffers(boolean flushRX,
boolean flushTX)
throws java.io.IOException
UsbSerialPort_qcompurgeHwBuffers in interface UsbSerialPort_qcomflushRX - 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