Discovery
|
The DiscoveryUtil type exposes the following members.
Name | Description | |
---|---|---|
DiscoveryUtil | Initializes a new instance of the DiscoveryUtil class |
Name | Description | |
---|---|---|
Equals | (Inherited from Object) | |
GetDiscoveryDataMap | Reads the discovery packet from the provided connection and returns a discovery data map | |
GetHashCode | (Inherited from Object) | |
GetType | (Inherited from Object) | |
ParseDiscoveryPacket | Decodes the provided MIME encoded discovery packet and returns a discovery data map | |
ToString | (Inherited from Object) |
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(); } } }