public class UsbDiscoverer
extends Object
package test.zebra.sdk.discovery.examples;
import com.zebra.sdk.comm.ConnectionException;
import com.zebra.sdk.printer.discovery.DiscoveredPrinterDriver;
import com.zebra.sdk.printer.discovery.DiscoveredUsbPrinter;
import com.zebra.sdk.printer.discovery.UsbDiscoverer;
import com.zebra.sdk.printer.discovery.ZebraPrinterFilter;
public class UsbDiscovererExample {
public static void main(String[] args) {
try {
for (DiscoveredPrinterDriver printer : UsbDiscoverer.getZebraDriverPrinters()) {
System.out.println(printer);
}
for (DiscoveredUsbPrinter usbPrinter : UsbDiscoverer.getZebraUsbPrinters(new ZebraPrinterFilter())) {
System.out.println(usbPrinter);
}
} catch (ConnectionException e) {
System.out.println("Error discovering local printers: " + e.getMessage());
}
System.out.println("Done discovering local printers.");
}
}
Constructor and Description |
---|
UsbDiscoverer()
A class used to discover USB connected Zebra printers.
|
Modifier and Type | Method and Description |
---|---|
static DiscoveredPrinterDriver[] |
getZebraDriverPrinters()
Enumerate locally installed Zebra Designer Drivers.
|
static DiscoveredUsbPrinter[] |
getZebraUsbPrinters()
Enumerate all currently connected Zebra USB printers.
|
static DiscoveredUsbPrinter[] |
getZebraUsbPrinters(DiscoveredPrinterFilter discoveredPrinterFilter)
Enumerate currently connected Zebra USB printers that meet the specified DiscoveredPrinterFilter criteria.
|
public UsbDiscoverer()
public static DiscoveredPrinterDriver[] getZebraDriverPrinters() throws ConnectionException
ConnectionException
- if the system is not running the Windows operating system.public static DiscoveredUsbPrinter[] getZebraUsbPrinters() throws ConnectionException
ConnectionException
- if the system is not running the Windows operating system.public static DiscoveredUsbPrinter[] getZebraUsbPrinters(DiscoveredPrinterFilter discoveredPrinterFilter) throws ConnectionException
discoveredPrinterFilter
- A custom DiscoveredPrinterFilter
instance
used to determine whether or not a discovered device should be ignored.ConnectionException
- if the system is not running the Windows operating system or an error occurs during
discovery.
© 2017 ZIH Corp. All Rights Reserved.