Click or drag to resize

SnmpPrinter Class

An instance of an SNMP only Zebra printer.
Inheritance Hierarchy
SystemObject
  Zebra.Sdk.PrinterSnmpPrinter

Namespace: Zebra.Sdk.Printer
Assembly: SdkApi.Core (in SdkApi.Core.dll) Version: 3.0.3271
Syntax
public class SnmpPrinter

The SnmpPrinter type exposes the following members.

Constructors
 NameDescription
Public methodSnmpPrinter(String) Creates an instance of a Zebra printer which is limited to only SNMP operations.
Public methodSnmpPrinter(String, String, String) Creates an instance of a Zebra printer, with the given community names, which is limited to only SNMP operations.
Top
Properties
 NameDescription
Public propertyCommunityNameGet Gets the SNMP get community name.
Public propertyCommunityNameSet Gets the SNMP set community name.
Top
Methods
 NameDescription
Public methodEquals
(Inherited from Object)
Public methodGetHashCode
(Inherited from Object)
Public methodGetOidValue Gets the value of the specified oid.
Public methodGetType
(Inherited from Object)
Public methodSetOidValue(String, Int32) Sets the value of the specified oid to valueToSet.
Public methodSetOidValue(String, String) Sets the value of the specified oid to valueToSet.
Public methodToString
(Inherited from Object)
Top
Remarks
The printer does not make a raw port connection.
Example
C#
using System;
using Zebra.Sdk.Printer;

public class SnmpPrinterExample {

    public static void Main(string[] args) {
        SnmpPrinter myPrinter = new SnmpPrinter("1.2.3.4", "getCommunityName", "setCommunityName");
        try {
            string printAdjOid = "1.3.6.1.4.1.10642.6.4.0";
            string printAdjFromSnmp = myPrinter.GetOidValue(printAdjOid);
            Console.WriteLine($"printAdj = {printAdjFromSnmp}");

            int newprintAdj = int.Parse(printAdjFromSnmp) + 1;
            myPrinter.SetOidValue(printAdjOid, newprintAdj);

            string friendlyNameOid = "1.3.6.1.4.1.10642.20.3.5.0";
            string friendlyNameFromSnmp = myPrinter.GetOidValue(friendlyNameOid);
            Console.WriteLine($"friendlyName = {friendlyNameFromSnmp}");

            string newfriendlyName = "AwesomePrinter";
            myPrinter.SetOidValue(friendlyNameOid, newfriendlyName);
        } catch (SnmpException e) {
            Console.WriteLine(e.ToString());
        }
    }
}
See Also