Class UsbSerialDeviceInformation


  • @NonNullByDefault
    public class UsbSerialDeviceInformation
    extends Object
    This is a data container for information about a USB device and the serial port that can be used to access the device using a serial interface.

    It contains, on the one hand, information from the USB standard device descriptor and standard interface descriptor, and, on the other hand, the name of the serial port (for Linux, this would be, e.g., '/dev/ttyUSB0', for Windows, e.g., 'COM4').

    Author:
    Henning Sudbrock - Initial contribution
    • Constructor Detail

      • UsbSerialDeviceInformation

        public UsbSerialDeviceInformation​(int vendorId,
                                          int productId,
                                          @Nullable String serialNumber,
                                          @Nullable String manufacturer,
                                          @Nullable String product,
                                          int interfaceNumber,
                                          @Nullable String interfaceDescription,
                                          String serialPort)
    • Method Detail

      • getVendorId

        public int getVendorId()
        Returns:
        The vendor ID of the USB device (field 'idVendor' in the USB standard device descriptor).
      • getProductId

        public int getProductId()
        Returns:
        The product ID of the USB device (field 'idProduct' in the USB standard device descriptor).
      • getSerialNumber

        public @Nullable String getSerialNumber()
        Returns:
        The serial number of the USB device (field 'iSerialNumber' in the USB standard device descriptor).
      • getManufacturer

        public @Nullable String getManufacturer()
        Returns:
        The manufacturer of the USB device (field 'iManufacturer' in the USB standard device descriptor).
      • getProduct

        public @Nullable String getProduct()
        Returns:
        The product description of the USB device (field 'iProduct' in the USB standard device descriptor).
      • getInterfaceNumber

        public int getInterfaceNumber()
        Returns:
        The interface number of the used USB interface (field 'bInterfaceNumber' in the USB standard interface descriptor).
      • getInterfaceDescription

        public @Nullable String getInterfaceDescription()
        Returns:
        Description of the used USB interface (field 'iInterface' in the USB standard interface descriptor).
      • getSerialPort

        public String getSerialPort()
        Returns:
        The name of the serial port assigned to the USB device. Examples: /dev/ttyUSB1, COM4
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • equals

        public boolean equals​(@Nullable Object obj)
        Overrides:
        equals in class Object