Class AndroidPort


  • public abstract class AndroidPort
    extends Object
    • Field Detail

      • USB_REQUEST_TYPE_STANDARD

        protected static final int USB_REQUEST_TYPE_STANDARD
        See Also:
        Constant Field Values
      • USB_REQUEST_TYPE_CLASS

        protected static final int USB_REQUEST_TYPE_CLASS
        See Also:
        Constant Field Values
      • USB_REQUEST_TYPE_VENDOR

        protected static final int USB_REQUEST_TYPE_VENDOR
        See Also:
        Constant Field Values
      • USB_REQUEST_TYPE_RESERVED

        protected static final int USB_REQUEST_TYPE_RESERVED
        See Also:
        Constant Field Values
      • USB_RECIPIENT_INTERFACE

        protected static final int USB_RECIPIENT_INTERFACE
        See Also:
        Constant Field Values
      • USB_RECIPIENT_ENDPOINT

        protected static final int USB_RECIPIENT_ENDPOINT
        See Also:
        Constant Field Values
      • context

        protected static android.app.Application context
      • usbManager

        protected static android.hardware.usb.UsbManager usbManager
      • usbDevice

        protected final android.hardware.usb.UsbDevice usbDevice
      • usbInterface

        protected android.hardware.usb.UsbInterface usbInterface
      • usbConnection

        protected android.hardware.usb.UsbDeviceConnection usbConnection
      • usbDeviceIn

        protected android.hardware.usb.UsbEndpoint usbDeviceIn
      • usbDeviceOut

        protected android.hardware.usb.UsbEndpoint usbDeviceOut
      • writeBufferIndex

        protected volatile int writeBufferIndex
      • writeBufferLength

        protected volatile int writeBufferLength
      • readBufferIndex

        protected volatile int readBufferIndex
      • readBufferOffset

        protected volatile int readBufferOffset
      • readBufferLength

        protected volatile int readBufferLength
      • readBuffer

        protected final byte[] readBuffer
      • writeBuffer

        protected final byte[] writeBuffer
    • Constructor Detail

      • AndroidPort

        protected AndroidPort​(android.hardware.usb.UsbDevice device)
    • Method Detail

      • setAndroidContext

        public static void setAndroidContext​(Object androidContext)
      • getCommPortsNative

        public static SerialPort[] getCommPortsNative()
      • openPortNative

        public long openPortNative​(SerialPort serialPort)
      • closePortNative

        public long closePortNative()
      • makeVidPid

        protected static long makeVidPid​(int vid,
                                         int pid)
      • openPort

        public abstract boolean openPort()
      • closePort

        public abstract boolean closePort()
      • configPort

        public abstract boolean configPort​(SerialPort serialPort)
      • flushRxTxBuffers

        public abstract boolean flushRxTxBuffers()
      • waitForEvent

        public abstract int waitForEvent()
      • bytesAvailable

        public abstract int bytesAvailable()
      • bytesAwaitingWrite

        public abstract int bytesAwaitingWrite()
      • readBytes

        public abstract int readBytes​(byte[] buffer,
                                      long bytesToRead,
                                      long offset,
                                      int timeoutMode,
                                      int readTimeout)
      • writeBytes

        public abstract int writeBytes​(byte[] buffer,
                                       long bytesToWrite,
                                       long offset,
                                       int timeoutMode)
      • setEventListeningStatus

        public abstract void setEventListeningStatus​(boolean eventListenerRunning)
      • setBreak

        public abstract boolean setBreak()
      • clearBreak

        public abstract boolean clearBreak()
      • setRTS

        public abstract boolean setRTS()
      • clearRTS

        public abstract boolean clearRTS()
      • setDTR

        public abstract boolean setDTR()
      • clearDTR

        public abstract boolean clearDTR()
      • getCTS

        public abstract boolean getCTS()
      • getDSR

        public abstract boolean getDSR()
      • getDCD

        public abstract boolean getDCD()
      • getDTR

        public abstract boolean getDTR()
      • getRTS

        public abstract boolean getRTS()
      • getRI

        public abstract boolean getRI()
      • getLastErrorLocation

        public abstract int getLastErrorLocation()
      • getLastErrorCode

        public abstract int getLastErrorCode()