Package oshi.hardware.common
Class AbstractUsbDevice
- java.lang.Object
-
- oshi.hardware.common.AbstractUsbDevice
-
- Direct Known Subclasses:
AixUsbDevice,FreeBsdUsbDevice,LinuxUsbDevice,MacUsbDevice,OpenBsdUsbDevice,SolarisUsbDevice,WindowsUsbDevice
@Immutable public abstract class AbstractUsbDevice extends java.lang.Object implements UsbDevice
A USB device
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<UsbDevice>connectedDevicesprivate java.lang.Stringnameprivate java.lang.StringproductIdprivate java.lang.StringserialNumberprivate java.lang.StringuniqueDeviceIdprivate java.lang.Stringvendorprivate java.lang.StringvendorId
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractUsbDevice(java.lang.String name, java.lang.String vendor, java.lang.String vendorId, java.lang.String productId, java.lang.String serialNumber, java.lang.String uniqueDeviceId, java.util.List<UsbDevice> connectedDevices)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(UsbDevice usb)java.util.List<UsbDevice>getConnectedDevices()Other devices connected to this hubjava.lang.StringgetName()Name of the USB devicejava.lang.StringgetProductId()Product ID of the USB devicejava.lang.StringgetSerialNumber()Serial number of the USB devicejava.lang.StringgetUniqueDeviceId()A Unique Device ID of the USB device, such as the PnPDeviceID (Windows), Device Node Path (Linux), Registry Entry ID (macOS), or Device Node number (Unix)java.lang.StringgetVendor()Vendor that manufactured the USB devicejava.lang.StringgetVendorId()ID of the vendor that manufactured the USB deviceprivate static java.lang.StringindentUsb(UsbDevice usbDevice, int indent)Helper method for indenting chained USB devicesjava.lang.StringtoString()
-
-
-
Field Detail
-
name
private final java.lang.String name
-
vendor
private final java.lang.String vendor
-
vendorId
private final java.lang.String vendorId
-
productId
private final java.lang.String productId
-
serialNumber
private final java.lang.String serialNumber
-
uniqueDeviceId
private final java.lang.String uniqueDeviceId
-
connectedDevices
private final java.util.List<UsbDevice> connectedDevices
-
-
Constructor Detail
-
AbstractUsbDevice
protected AbstractUsbDevice(java.lang.String name, java.lang.String vendor, java.lang.String vendorId, java.lang.String productId, java.lang.String serialNumber, java.lang.String uniqueDeviceId, java.util.List<UsbDevice> connectedDevices)
-
-
Method Detail
-
getName
public java.lang.String getName()
Description copied from interface:UsbDeviceName of the USB device
-
getVendor
public java.lang.String getVendor()
Description copied from interface:UsbDeviceVendor that manufactured the USB device
-
getVendorId
public java.lang.String getVendorId()
Description copied from interface:UsbDeviceID of the vendor that manufactured the USB device- Specified by:
getVendorIdin interfaceUsbDevice- Returns:
- The vendor ID, a 4-digit hex string
-
getProductId
public java.lang.String getProductId()
Description copied from interface:UsbDeviceProduct ID of the USB device- Specified by:
getProductIdin interfaceUsbDevice- Returns:
- The product ID, a 4-digit hex string
-
getSerialNumber
public java.lang.String getSerialNumber()
Description copied from interface:UsbDeviceSerial number of the USB device- Specified by:
getSerialNumberin interfaceUsbDevice- Returns:
- The serial number, if known
-
getUniqueDeviceId
public java.lang.String getUniqueDeviceId()
Description copied from interface:UsbDeviceA Unique Device ID of the USB device, such as the PnPDeviceID (Windows), Device Node Path (Linux), Registry Entry ID (macOS), or Device Node number (Unix)- Specified by:
getUniqueDeviceIdin interfaceUsbDevice- Returns:
- The Unique Device ID
-
getConnectedDevices
public java.util.List<UsbDevice> getConnectedDevices()
Description copied from interface:UsbDeviceOther devices connected to this hub- Specified by:
getConnectedDevicesin interfaceUsbDevice- Returns:
- An
UnmodifiableListof other devices connected to this hub, if any, or an empty list if none
-
compareTo
public int compareTo(UsbDevice usb)
- Specified by:
compareToin interfacejava.lang.Comparable<UsbDevice>
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
indentUsb
private static java.lang.String indentUsb(UsbDevice usbDevice, int indent)
Helper method for indenting chained USB devices- Parameters:
usbDevice- A USB device to printindent- number of spaces to indent- Returns:
- The device toString, indented
-
-