java.lang.Object
net.codecrete.usb.USBDeviceFilter
- All Implemented Interfaces:
USBDevicePredicate
Filter condition for matching USB devices.
In order to match this condition, all non-null properties of this instance must be equal to the same properties of the USB device.
For a well implemented USB device, the combination of vendor ID, product ID and serial number is globally unique.
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new instance.USBDeviceFilter(int vendorId, int productId) Creates a new instance that matches the specified vendor and product ID.USBDeviceFilter(int vendorId, int productId, String serialNumber) Creates a new instance that matches the specified vendor ID, product ID and serial number. -
Method Summary
Modifier and TypeMethodDescriptionGets the USB device class code.booleanTests if the specified USB device matches this filter.Gets the USB product ID.Gets the USB device protocol code.Gets the device serial number.voidsetClassCode(Integer classCode) Sets the USB device class code.voidsetProductId(Integer productId) Sets the USB product ID.voidsetProtocolCode(Integer protocolCode) Sets the USB device protocol code.voidsetSerialNumber(String serialNumber) Sets the device serial number.voidsetSubclassCode(Integer subclassCode) Sets the USB device subclass code.voidsetVendorId(Integer vendorId) Sets the USB vendor ID.Gets the USB device subclass code.vendorId()Gets the USB vendor ID.
-
Constructor Details
-
USBDeviceFilter
public USBDeviceFilter()Creates a new instance. -
USBDeviceFilter
public USBDeviceFilter(int vendorId, int productId) Creates a new instance that matches the specified vendor and product ID.- Parameters:
vendorId- vendor IDproductId- product ID
-
USBDeviceFilter
Creates a new instance that matches the specified vendor ID, product ID and serial number.- Parameters:
vendorId- vendor IDproductId- product IDserialNumber- serial number
-
-
Method Details
-
vendorId
Gets the USB vendor ID.- Returns:
- vendor ID, or
nullif the vendor ID is not relevant for matching
-
setVendorId
Sets the USB vendor ID.- Parameters:
vendorId- vendor ID, ornullif the vendor ID is not relevant for matching
-
productId
Gets the USB product ID.- Returns:
- product ID, or
nullif the product ID is not relevant for matching
-
setProductId
Sets the USB product ID.- Parameters:
productId- product ID, ornullif the product ID is not relevant for matching
-
classCode
Gets the USB device class code.- Returns:
- class code, or
nullif the class code is not relevant for matching
-
setClassCode
Sets the USB device class code.- Parameters:
classCode- class code, ornullif the class code is not relevant for matching
-
subclassCode
Gets the USB device subclass code.- Returns:
- subclass code, or
nullif the subclass code is not relevant for matching
-
setSubclassCode
Sets the USB device subclass code.- Parameters:
subclassCode- subclass code, ornullif the subclass code is not relevant for matching
-
protocolCode
Gets the USB device protocol code.- Returns:
- protocol code, or
nullif the protocol code is not relevant for matching
-
setProtocolCode
Sets the USB device protocol code.- Parameters:
protocolCode- protocol code, ornullif the protocol code is not relevant for matching
-
serialNumber
Gets the device serial number.- Returns:
- serial number, or
nullif the serial number is not relevant for matching
-
setSerialNumber
Sets the device serial number.- Parameters:
serialNumber- serial number, ornullif the serial number is not relevant for matching
-
matches
Tests if the specified USB device matches this filter.- Specified by:
matchesin interfaceUSBDevicePredicate- Parameters:
device- USB device- Returns:
trueif it matches,falseotherwise
-