public class SnmpPrinter
extends Object
package test.zebra.sdk.printer.examples;
import com.zebra.sdk.printer.SnmpException;
import com.zebra.sdk.printer.SnmpPrinter;
public class SnmpPrinterExample {
public static void main(String[] args) {
try {
SnmpPrinter myPrinter = new SnmpPrinter("1.2.3.4", "getCommunityName", "setCommunityName");
String printAdjOid = "1.3.6.1.4.1.10642.6.4.0";
String printAdjFromSnmp = myPrinter.getOidValue(printAdjOid);
System.out.println("printAdj = " + printAdjFromSnmp);
int newprintAdj = Integer.parseInt(printAdjFromSnmp) + 1;
myPrinter.setOidValue(printAdjOid, newprintAdj);
String friendlyNameOid = "1.3.6.1.4.1.10642.20.3.5.0";
String friendlyNameFromSnmp = myPrinter.getOidValue(friendlyNameOid);
System.out.println("friendlyName = " + friendlyNameFromSnmp);
String newfriendlyName = "AwesomePrinter";
myPrinter.setOidValue(friendlyNameOid, newfriendlyName);
} catch (SnmpException e) {
e.printStackTrace();
}
}
}
| Constructor and Description |
|---|
SnmpPrinter(String address)
Creates an instance of a Zebra printer which is limited to only SNMP operations.
|
SnmpPrinter(String address,
String getCommunityName,
String setCommunityName)
Creates an instance of a Zebra printer, with the given community names, which is limited to only SNMP operations.
|
| Modifier and Type | Method and Description |
|---|---|
String |
getGetCommunityName()
Returns the SNMP get community name
|
String |
getOidValue(String oid)
Gets the value of the specified
oid. |
String |
getSetCommunityName()
Returns the SNMP set community name
|
void |
setOidValue(String oid,
int valueToSet)
Sets the value of the specified
oid to valueToSet. |
void |
setOidValue(String oid,
String valueToSet)
Sets the value of the specified
oid to valueToSet. |
public SnmpPrinter(String address)
throws SnmpException
SnmpPrinter(String, String, String)address - the IP Address or DNS Hostname.SnmpException - if there was an exception communicating over SNMPpublic SnmpPrinter(String address,
String getCommunityName,
String setCommunityName)
throws SnmpException
address - the IP Address or DNS Hostname.getCommunityName - SNMP get community namesetCommunityName - SNMP set community nameSnmpException - if there was an exception communicating over SNMPpublic String getOidValue(String oid)
throws SnmpException
oid.oid - Object identifier.SnmpException - if there was an exception communicating over SNMPpublic void setOidValue(String oid,
String valueToSet)
throws SnmpException
oid to valueToSet.oid - Object identifier.valueToSet - the value to set the OID to.SnmpException - if there was an exception communicating over SNMPpublic void setOidValue(String oid,
int valueToSet)
throws SnmpException
oid to valueToSet.oid - Object identifier.valueToSet - the value to set the OID to.SnmpException - if there was an exception communicating over SNMPpublic String getGetCommunityName()
public String getSetCommunityName()
© 2017 ZIH Corp. All Rights Reserved.