public class SettingsSetter
extends Object
package test.zebra.sdk.printer.examples;
import java.util.LinkedHashMap;
import java.util.Map;
import com.zebra.sdk.comm.ConnectionException;
import com.zebra.sdk.printer.SettingsSetter;
import com.zebra.sdk.settings.SettingsException;
public class SettingsSetterExample {
public static void main(String[] args) {
String ipAddress = "192.168.1.100";
Map<String, String> settingsToSendToThePrinter = new LinkedHashMap<String, String>();
// Pass in a null as the second parameter to retrieve the setting
settingsToSendToThePrinter.put("device.friendly_name", null);
// Pass in a value as the second parameter to set the setting
settingsToSendToThePrinter.put("comm.baud", "14400");
// The map containing the results to each settings command
Map<String, String> results = null;
try {
results = SettingsSetter.process(ipAddress, settingsToSendToThePrinter);
} catch (ConnectionException e) {
e.printStackTrace();
} catch (SettingsException e) {
e.printStackTrace();
}
for (Map.Entry<String, String> entry : results.entrySet()) {
System.out.println("The setting " + entry.getKey() + " returned " + entry.getValue() + ".");
}
}
}
Modifier and Type | Method and Description |
---|---|
static java.util.Map<String,String> |
process(String destinationDevice,
java.util.Map<String,String> settingsToSet)
Sends the
settingsToSet to the destinationDevice and then returns the updated setting
values. |
public static java.util.Map<String,String> process(String destinationDevice, java.util.Map<String,String> settingsToSet) throws ConnectionException, SettingsException
settingsToSet
to the destinationDevice
and then returns the updated setting
values.
Note: Due to the setting verification and validation, additional time and data traffic will be needed for each
SettingsSetter process
call. It is recommended to bundle all changing settings into one map and one
method call to reduce this overhead.
destinationDevice
- The connection string.settingsToSet
- The settings map to send to the printer.ConnectionException
- if there is an error communicating with the printer.SettingsException
- if the setting could not be set or retrieved.
© 2017 ZIH Corp. All Rights Reserved.