SGD Class |
Namespace: Zebra.Sdk.Printer
The SGD type exposes the following members.
Name | Description | |
---|---|---|
DO(String, String, Connection) |
Constructs an SGD DO command and sends it to the printer.
| |
DO(Stream, String, String, Connection) |
Constructs an SGD DO command and sends it to the printer.
| |
DO(String, String, Connection, Int32, Int32) |
Constructs an SGD DO command and sends it to the printer.
| |
DO(Stream, String, String, Connection, Int32, Int32) |
Constructs an SGD DO command and sends it to the printer.
| |
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object.) | |
GET(String, Connection) |
Constructs an SGD GET command and sends it to the printer.
| |
GET(String, Connection, Int32, Int32) |
Constructs an SGD GET command and sends it to the printer.
| |
GetHashCode | Serves as the default hash function. (Inherited from Object.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
SET(String, Int32, Connection) |
Constructs an SGD SET command and sends it to the printer.
| |
SET(String, String, Connection) |
Constructs an SGD SET command and sends it to the printer.
| |
ToString | Returns a string that represents the current object. (Inherited from Object.) |
using System; using Zebra.Sdk.Comm; using Zebra.Sdk.Printer; public class SGDExample { public static void Main(string[] args) { try { string ipAddress = "192.168.1.2"; SgdOverTcp(ipAddress); SgdOverMultiChannelNetworkConnection(ipAddress); } catch (ConnectionException e) { Console.WriteLine(e.ToString()); } } public static void SgdOverTcp(string ipAddress) { int port = 9100; Connection printerConnection = new TcpConnection(ipAddress, port); try { printerConnection.Open(); SGD.SET("print.tone", "15", printerConnection); string printTone = SGD.GET("print.tone", printerConnection); Console.WriteLine($"SGD print.tone is {printTone}"); } catch (ConnectionException e) { Console.WriteLine(e.ToString()); } finally { printerConnection.Close(); } } private static void SgdOverMultiChannelNetworkConnection(string ipAddress) { // Create and open a connection to a Link-OS printer using both the printing and the status channel MultichannelTcpConnection printerConnection = new MultichannelTcpConnection(ipAddress, MultichannelTcpConnection.DEFAULT_MULTICHANNEL_PRINTING_PORT, MultichannelTcpConnection.DEFAULT_MULTICHANNEL_STATUS_PORT); try { printerConnection.Open(); // Get an SGD, using the status channel string modelName = SGD.GET("device.product_name", printerConnection); Console.WriteLine($"SGD device.product_name is {modelName}"); // Close the connection, and re-open it using only the status channel printerConnection.Close(); printerConnection.OpenStatusChannel(); // Get an SGD, again using the status channel string printSpeed = SGD.GET("media.speed", printerConnection); Console.WriteLine($"The print speed is {printSpeed}"); // Close the connection, and re-open it using only the printing channel printerConnection.Close(); printerConnection.OpenPrintingChannel(); // Get an SGD, using the printing channel string mirrorFrequency = SGD.GET("ip.mirror.freq", printerConnection); Console.WriteLine($"The mirror frequency is {mirrorFrequency}"); } catch (ConnectionException e) { Console.WriteLine(e.ToString()); } finally { printerConnection.Close(); } } }