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, mWriteEndpointFields 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 voidcloseInt()booleangetCD()Gets the CD (Carrier Detect) bit from the underlying UART.Gets all control line values from the underlying UART, if supported.booleangetCTS()Gets the CTS (Clear To Send) bit from the underlying UART.Returns the driver used by this port.booleangetDSR()Gets the DSR (Data Set Ready) bit from the underlying UART.booleangetDTR()Gets the DTR (Data Terminal Ready) bit from the underlying UART.booleangetRI()Gets the RI (Ring Indicator) bit from the underlying UART.booleangetRTS()Gets the RTS (Request To Send) bit from the underlying UART.Gets all control line supported flags.protected voidopenInt(android.hardware.usb.UsbDeviceConnection connection) voidsetDTR(boolean value) Sets the DTR (Data Terminal Ready) bit on the underlying UART, if supported.voidsetParameters(int baudRate, int dataBits, int stopBits, int parity) Sets various serial port parameters.voidsetRTS(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:UsbSerialPortReturns the driver used by this port. -
openInt
- Specified by:
openIntin classCommonUsbSerialPort- Throws:
IOException
-
closeInt
protected void closeInt()- Specified by:
closeIntin classCommonUsbSerialPort
-
setParameters
Description copied from interface:UsbSerialPortSets various serial port parameters.- Specified by:
setParametersin interfaceUsbSerialPort- Specified by:
setParametersin 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:UsbSerialPortGets the CD (Carrier Detect) bit from the underlying UART.- Specified by:
getCDin interfaceUsbSerialPort- Specified by:
getCDin classCommonUsbSerialPort- Returns:
- the current state, or
falseif not supported. - Throws:
IOException- if an error occurred during reading
-
getCTS
Description copied from interface:UsbSerialPortGets the CTS (Clear To Send) bit from the underlying UART.- Specified by:
getCTSin interfaceUsbSerialPort- Specified by:
getCTSin classCommonUsbSerialPort- Returns:
- the current state, or
falseif not supported. - Throws:
IOException- if an error occurred during reading
-
getDSR
Description copied from interface:UsbSerialPortGets the DSR (Data Set Ready) bit from the underlying UART.- Specified by:
getDSRin interfaceUsbSerialPort- Specified by:
getDSRin classCommonUsbSerialPort- Returns:
- the current state, or
falseif not supported. - Throws:
IOException- if an error occurred during reading
-
getDTR
Description copied from interface:UsbSerialPortGets the DTR (Data Terminal Ready) bit from the underlying UART.- Specified by:
getDTRin interfaceUsbSerialPort- Specified by:
getDTRin classCommonUsbSerialPort- Returns:
- the current state, or
falseif not supported. - Throws:
IOException- if an error occurred during reading
-
setDTR
Description copied from interface:UsbSerialPortSets the DTR (Data Terminal Ready) bit on the underlying UART, if supported.- Specified by:
setDTRin interfaceUsbSerialPort- Specified by:
setDTRin classCommonUsbSerialPort- Parameters:
value- the value to set- Throws:
IOException- if an error occurred during writing
-
getRI
Description copied from interface:UsbSerialPortGets the RI (Ring Indicator) bit from the underlying UART.- Specified by:
getRIin interfaceUsbSerialPort- Specified by:
getRIin classCommonUsbSerialPort- Returns:
- the current state, or
falseif not supported. - Throws:
IOException- if an error occurred during reading
-
getRTS
Description copied from interface:UsbSerialPortGets the RTS (Request To Send) bit from the underlying UART.- Specified by:
getRTSin interfaceUsbSerialPort- Specified by:
getRTSin classCommonUsbSerialPort- Returns:
- the current state, or
falseif not supported. - Throws:
IOException- if an error occurred during reading
-
setRTS
Description copied from interface:UsbSerialPortSets the RTS (Request To Send) bit on the underlying UART, if supported.- Specified by:
setRTSin interfaceUsbSerialPort- Specified by:
setRTSin classCommonUsbSerialPort- Parameters:
value- the value to set- Throws:
IOException- if an error occurred during writing
-
getControlLines
Description copied from interface:UsbSerialPortGets all control line values from the underlying UART, if supported. Requires less USB calls than calling getRTS() + ... + getRI() individually.- Specified by:
getControlLinesin interfaceUsbSerialPort- Specified by:
getControlLinesin classCommonUsbSerialPort- Returns:
- EnumSet.contains(...) is
trueif set, elsefalse - Throws:
IOException
-
getSupportedControlLines
Description copied from interface:UsbSerialPortGets all control line supported flags.- Specified by:
getSupportedControlLinesin interfaceUsbSerialPort- Specified by:
getSupportedControlLinesin classCommonUsbSerialPort- Returns:
- EnumSet.contains(...) is
trueif supported, elsefalse - Throws:
IOException
-