ztex
Class ZtexScanBus1

java.lang.Object
  extended by ztex.ZtexScanBus1

public class ZtexScanBus1
extends java.lang.Object

A class for scanning the USB for EZ-USB devices. The devices found are stored as a list of ZtexDevice1 instances.

See Also:
ZtexDevice1

Constructor Summary
ZtexScanBus1(int usbVendorId, int usbProductId, boolean scanUnconfigured, boolean quiet)
          Scans the USB for suitable devices and constructs a list of them.
ZtexScanBus1(int usbVendorId, int usbProductId, boolean scanUnconfigured, boolean quiet, int interfaceVersion)
          Scans the USB for suitable devices and constructs a list of them.
ZtexScanBus1(int usbVendorId, int usbProductId, boolean scanUnconfigured, boolean quiet, int interfaceVersion, java.lang.String snString)
          Scans the USB for suitable devices and constructs a list of them.
ZtexScanBus1(int usbVendorId, int usbProductId, boolean scanUnconfigured, boolean quiet, int interfaceVersion, java.lang.String snString, int productId0, int productId1, int productId2, int productId3)
          Scans the USB for suitable devices and constructs a list of them.
 
Method Summary
 ZtexDevice1 device(int i)
          Returns a device from the list of devices.
protected  void finalize()
           
 int numberOfDevices()
          Returns the number of devices found.
 void printBus(java.io.PrintStream out)
          Prints out a list of devices found.
 void ref()
          Increases reference counter.
 void unref()
          Decreases reference counter and releases resources if 0 is reached.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ZtexScanBus1

public ZtexScanBus1(int usbVendorId,
                    int usbProductId,
                    boolean scanUnconfigured,
                    boolean quiet,
                    int interfaceVersion,
                    java.lang.String snString,
                    int productId0,
                    int productId1,
                    int productId2,
                    int productId3)
Scans the USB for suitable devices and constructs a list of them. Four kinds of search filters can be applied
  1. usbVendorId and usbProductId can be used to search for devices with a given vendor and product ID. These devices must provide a ZTEX descriptor 1.
  2. If a certain interface version is required, it can be specified using interfaceVersion.
  3. Incompatible devices can be excluded by the specification of the ZTEX product ID's, see ZtexDevice1.compatible(int,int,int,int).
  4. If scanUnconfigured is true, also devices without ZTEX Firmware and devices with Cypress EZ-USB USB are considered
  5. If more than one device is present a single device can be selected by serial number.
unref() must be called if the class is not used anymore.

Parameters:
usbVendorId - USB vendor ID of the device to be searched for
usbProductId - USB product ID of the device to be searched for
scanUnconfigured - if true, scan for unconfigured devices and devices with Cypress EZ-USB USB ID's
quiet - if true, don't print any warnings
interfaceVersion - The required interface version (<0 if no interface version is required)
snString - The serial number of the device
productId0 - Byte 0 of a given ZTEX product ID (≤0 if not to be considered)
productId1 - Byte 1 of a given ZTEX product ID (≤0 if not to be considered)
productId2 - Byte 2 of a given ZTEX product ID (≤0 if not to be considered)
productId3 - Byte 3 of a given ZTEX product ID (≤0 if not to be considered)

ZtexScanBus1

public ZtexScanBus1(int usbVendorId,
                    int usbProductId,
                    boolean scanUnconfigured,
                    boolean quiet,
                    int interfaceVersion,
                    java.lang.String snString)
Scans the USB for suitable devices and constructs a list of them. Three kinds of search filters can be applied
  1. usbVendorId and usbProductId can be used to search for devices with a given vendor and product ID. These devices must provide a ZTEX descriptor 1.
  2. If a certain interface version is required, it can be specified using interfaceVersion.
  3. If scanUnconfigured is true, also devices without ZTEX Firmware and devices with Cypress EZ-USB USB are considered
  4. In multi device environment a single device can be selected by giving a serial number.

Parameters:
usbVendorId - USB vendor ID of the device to be searched for
usbProductId - USB product ID of the device to be searched for
scanUnconfigured - if true, scan for unconfigured devices and devices with Cypress EZ-USB USB ID's
quiet - if true, don't print any warnings
interfaceVersion - The required interface version (<0 if no interface version is required)

ZtexScanBus1

public ZtexScanBus1(int usbVendorId,
                    int usbProductId,
                    boolean scanUnconfigured,
                    boolean quiet,
                    int interfaceVersion)
Scans the USB for suitable devices and constructs a list of them. Three kinds of search filters can be applied
  1. usbVendorId and usbProductId can be used to search for devices with a given vendor and product ID. These devices must provide a ZTEX descriptor 1.
  2. If a certain interface version is required, it can be specified using interfaceVersion.
  3. If scanUnconfigured is true, also devices without ZTEX Firmware and devices with Cypress EZ-USB USB are considered

Parameters:
usbVendorId - USB vendor ID of the device to be searched for
usbProductId - USB product ID of the device to be searched for
scanUnconfigured - if true, scan for unconfigured devices and devices with Cypress EZ-USB USB ID's
quiet - if true, don't print any warnings
interfaceVersion - The required interface version (<0 if no interface version is required)

ZtexScanBus1

public ZtexScanBus1(int usbVendorId,
                    int usbProductId,
                    boolean scanUnconfigured,
                    boolean quiet)
Scans the USB for suitable devices and constructs a list of them. Two kinds of search filters can be applied
  1. usbVendorId and usbProductId can be used to search for devices with a given vendor and product ID. These devices must provide a ZTEX descriptor 1.
  2. If scanUnconfigured is true, also devices without ZTEX Firmware and devices with Cypress EZ-USB USB are considered

Parameters:
usbVendorId - USB vendor ID of the device to be searched for
usbProductId - USB product ID of the device to be searched for
scanUnconfigured - if true, scan for unconfigured devices and devices with Cypress EZ-USB USB ID's
quiet - if true, don't print any warnings
Method Detail

printBus

public void printBus(java.io.PrintStream out)
Prints out a list of devices found.

Parameters:
out - Where the output is to be printed to.

numberOfDevices

public final int numberOfDevices()
Returns the number of devices found.

Returns:
the number of devices found.

device

public final ZtexDevice1 device(int i)
                         throws java.lang.IndexOutOfBoundsException
Returns a device from the list of devices.

Parameters:
i - The device index.
Returns:
a device from the list of devices.
Throws:
java.lang.IndexOutOfBoundsException - if i<0 or i≥numberOfDevices()

ref

public void ref()
Increases reference counter.


unref

public void unref()
Decreases reference counter and releases resources if 0 is reached.


finalize

protected void finalize()
                 throws java.lang.Throwable
Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable