Package com.zebra.commoniolib
Class CdcAcmSerialDriver.CdcAcmSerialPort
java.lang.Object
com.zebra.commoniolib.CommonUsbSerialPort
com.zebra.commoniolib.CdcAcmSerialDriver.CdcAcmSerialPort
- All Implemented Interfaces:
UsbSerialPort
,Closeable
,AutoCloseable
- Enclosing class:
- CdcAcmSerialDriver
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.zebra.commoniolib.UsbSerialPort
UsbSerialPort.ControlLine
-
Field Summary
Fields inherited from class com.zebra.commoniolib.CommonUsbSerialPort
mConnection, mDevice, mPortNumber, mReadEndpoint, mUsbRequest, mWriteBuffer, mWriteBufferLock, mWriteEndpoint
Fields inherited from interface com.zebra.commoniolib.UsbSerialPort
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
closeInt()
boolean
getCD()
Gets the CD (Carrier Detect) bit from the underlying UART.Gets all control line values from the underlying UART, if supported.boolean
getCTS()
Gets the CTS (Clear To Send) bit from the underlying UART.Returns the driver used by this port.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.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.Gets all control line supported flags.protected void
openInt
(android.hardware.usb.UsbDeviceConnection connection) void
setDTR
(boolean value) Sets the DTR (Data Terminal Ready) bit on the underlying UART, if supported.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.Methods inherited from class com.zebra.commoniolib.CommonUsbSerialPort
close, getDevice, getPortNumber, getSerial, isOpen, open, purgeHwBuffers, read, readFilter, setWriteBufferSize, toString, write
-
Constructor Details
-
CdcAcmSerialPort
public CdcAcmSerialPort(android.hardware.usb.UsbDevice device, int portNumber)
-
-
Method Details
-
getDriver
Description copied from interface:UsbSerialPort
Returns the driver used by this port. -
openInt
- Specified by:
openInt
in classCommonUsbSerialPort
- Throws:
IOException
-
closeInt
protected void closeInt()- Specified by:
closeInt
in classCommonUsbSerialPort
-
setParameters
Description copied from interface:UsbSerialPort
Sets various serial port parameters.- Specified by:
setParameters
in interfaceUsbSerialPort
- Specified by:
setParameters
in classCommonUsbSerialPort
- Parameters:
baudRate
- baud rate as an integer, for example115200
.dataBits
- one ofUsbSerialPort.DATABITS_5
,UsbSerialPort.DATABITS_6
,UsbSerialPort.DATABITS_7
, orUsbSerialPort.DATABITS_8
.stopBits
- one ofUsbSerialPort.STOPBITS_1
,UsbSerialPort.STOPBITS_1_5
, orUsbSerialPort.STOPBITS_2
.parity
- one ofUsbSerialPort.PARITY_NONE
,UsbSerialPort.PARITY_ODD
,UsbSerialPort.PARITY_EVEN
,UsbSerialPort.PARITY_MARK
, orUsbSerialPort.PARITY_SPACE
.- Throws:
IOException
- on error setting the port parameters
-
getCD
Description copied from interface:UsbSerialPort
Gets the CD (Carrier Detect) bit from the underlying UART.- Specified by:
getCD
in interfaceUsbSerialPort
- Specified by:
getCD
in classCommonUsbSerialPort
- Returns:
- the current state, or
false
if not supported. - Throws:
IOException
- if an error occurred during reading
-
getCTS
Description copied from interface:UsbSerialPort
Gets the CTS (Clear To Send) bit from the underlying UART.- Specified by:
getCTS
in interfaceUsbSerialPort
- Specified by:
getCTS
in classCommonUsbSerialPort
- Returns:
- the current state, or
false
if not supported. - Throws:
IOException
- if an error occurred during reading
-
getDSR
Description copied from interface:UsbSerialPort
Gets the DSR (Data Set Ready) bit from the underlying UART.- Specified by:
getDSR
in interfaceUsbSerialPort
- Specified by:
getDSR
in classCommonUsbSerialPort
- Returns:
- the current state, or
false
if not supported. - Throws:
IOException
- if an error occurred during reading
-
getDTR
Description copied from interface:UsbSerialPort
Gets the DTR (Data Terminal Ready) bit from the underlying UART.- Specified by:
getDTR
in interfaceUsbSerialPort
- Specified by:
getDTR
in classCommonUsbSerialPort
- Returns:
- the current state, or
false
if not supported. - Throws:
IOException
- if an error occurred during reading
-
setDTR
Description copied from interface:UsbSerialPort
Sets the DTR (Data Terminal Ready) bit on the underlying UART, if supported.- Specified by:
setDTR
in interfaceUsbSerialPort
- Specified by:
setDTR
in classCommonUsbSerialPort
- Parameters:
value
- the value to set- Throws:
IOException
- if an error occurred during writing
-
getRI
Description copied from interface:UsbSerialPort
Gets the RI (Ring Indicator) bit from the underlying UART.- Specified by:
getRI
in interfaceUsbSerialPort
- Specified by:
getRI
in classCommonUsbSerialPort
- Returns:
- the current state, or
false
if not supported. - Throws:
IOException
- if an error occurred during reading
-
getRTS
Description copied from interface:UsbSerialPort
Gets the RTS (Request To Send) bit from the underlying UART.- Specified by:
getRTS
in interfaceUsbSerialPort
- Specified by:
getRTS
in classCommonUsbSerialPort
- Returns:
- the current state, or
false
if not supported. - Throws:
IOException
- if an error occurred during reading
-
setRTS
Description copied from interface:UsbSerialPort
Sets the RTS (Request To Send) bit on the underlying UART, if supported.- Specified by:
setRTS
in interfaceUsbSerialPort
- Specified by:
setRTS
in classCommonUsbSerialPort
- Parameters:
value
- the value to set- Throws:
IOException
- if an error occurred during writing
-
getControlLines
Description copied from interface:UsbSerialPort
Gets all control line values from the underlying UART, if supported. Requires less USB calls than calling getRTS() + ... + getRI() individually.- Specified by:
getControlLines
in interfaceUsbSerialPort
- Specified by:
getControlLines
in classCommonUsbSerialPort
- Returns:
- EnumSet.contains(...) is
true
if set, elsefalse
- Throws:
IOException
-
getSupportedControlLines
Description copied from interface:UsbSerialPort
Gets all control line supported flags.- Specified by:
getSupportedControlLines
in interfaceUsbSerialPort
- Specified by:
getSupportedControlLines
in classCommonUsbSerialPort
- Returns:
- EnumSet.contains(...) is
true
if supported, elsefalse
- Throws:
IOException
-