Click or drag to resize

UsbDiscoverer Class

A class used to discover USB connected Zebra printers. Printers can be accessed directly or through a Zebra Designer printer driver if your printer supports the driver.
Inheritance Hierarchy
SystemObject
  Zebra.Sdk.Printer.DiscoveryUsbDiscoverer

Namespace: Zebra.Sdk.Printer.Discovery
Assemblies:  ZebraPrinterSdk (in ZebraPrinterSdk.dll) Version: 3.0.3271
  SdkApi.Desktop (in SdkApi.Desktop.dll) Version: 3.0.3271
Syntax
public class UsbDiscoverer

The UsbDiscoverer type exposes the following members.

Constructors
 NameDescription
Public methodUsbDiscoverer A class used to discover USB connected Zebra printers. Printers can be accessed either directly or through a USB printer driver.
Top
Methods
 NameDescription
Public methodEquals
(Inherited from Object)
Public methodStatic memberFindPrinters(Context, DiscoveryHandler) Enumerate all currently connected Zebra USB printers.
Public methodStatic memberFindPrinters(UsbManager, DiscoveryHandler) Enumerate all currently connected Zebra USB printers.
Public methodGetHashCode
(Inherited from Object)
Public methodGetType
(Inherited from Object)
Public methodStatic memberGetZebraDriverPrinters Enumerate locally installed Zebra Designer Drivers.
Public methodStatic memberGetZebraUsbPrinters Enumerate all currently connected Zebra USB printers.
Public methodStatic memberGetZebraUsbPrinters(DiscoveredPrinterFilter) Enumerate currently connected Zebra USB printers that meet the specified DiscoveredPrinterFilter criteria.
Public methodStatic memberIsZebraUsbDevice Determines if the UsbDevice is a Zebra printer.
Public methodToString
(Inherited from Object)
Top
Example
Desktop
C#
using System;
using Zebra.Sdk.Comm;
using Zebra.Sdk.Printer.Discovery;

public class UsbDiscovererExample {

    public static void Main(string[] args) {
        try {
            foreach (DiscoveredPrinterDriver printer in UsbDiscoverer.GetZebraDriverPrinters()) {
                Console.WriteLine(printer);
            }

            foreach (DiscoveredUsbPrinter usbPrinter in UsbDiscoverer.GetZebraUsbPrinters(new ZebraPrinterFilter())) {
                Console.WriteLine(usbPrinter);
            }
        } catch (ConnectionException e) {
            Console.WriteLine($"Error discovering local printers: {e.Message}");
        }

        Console.WriteLine("Done discovering local printers.");
    }
}
See Also