Click or drag to resize

DiscoveryUtil Class

Defines functions used when discovering information about a printer.
Inheritance Hierarchy
SystemObject
  Zebra.Sdk.Printer.DiscoveryDiscoveryUtil

Namespace:  Zebra.Sdk.Printer.Discovery
Assembly:  SdkApi_Core (in SdkApi_Core.dll) Version: 2.14.1869
Syntax
public class DiscoveryUtil

The DiscoveryUtil type exposes the following members.

Constructors
  NameDescription
Public methodDiscoveryUtil
Initializes a new instance of the DiscoveryUtil class
Top
Methods
  NameDescription
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Public methodStatic memberGetDiscoveryDataMap
Reads the discovery packet from the provided connection and returns a discovery data map
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodStatic memberParseDiscoveryPacket
Decodes the provided MIME encoded discovery packet and returns a discovery data map
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Examples
using System;
using System.Collections.Generic;
using Zebra.Sdk.Comm;
using Zebra.Sdk.Printer.Discovery;

public class DiscoveryUtilExample {

    public static void Main(string[] args) {
        // Instantiate connection for ZPL TCP port at given address
        Connection connection = new TcpConnection("192.168.1.1", TcpConnection.DEFAULT_ZPL_TCP_PORT);

        try {
            // Open the connection - physical connection is established here.
            connection.Open();

            Dictionary<string, string> discoveryData = DiscoveryUtil.GetDiscoveryDataMap(connection);
            Console.WriteLine($"The printer's firmware version is: {discoveryData["FIRMWARE_VER"]}");
        } catch (ConnectionException e) {
            // Handle communications error here.
            Console.WriteLine(e.ToString());
        } catch (DiscoveryPacketDecodeException e) {
            Console.WriteLine(e.ToString());
        } finally {
            // Close the connection to release resources.
            connection.Close();
        }
    }
}
See Also