I am trying to print a list of settings from my KR403 to my debug log like in the SDK Documentation example for the SettingsProvider Interface, but it is not working as far as I can tell. I copied the displaySettings function right out of the example into my test application, switched the printl commands with Log.v and called it in between connection.open and connection.close. (My base code is the USBDiscoverer example) This is my function:
private static void displaySettings(Connection c) throws ConnectionException, ZebraPrinterLanguageUnknownException, SettingsException, ZebraIllegalArgumentException { ZebraPrinter genericPrinter = ZebraPrinterFactory.getInstance(c); ZebraPrinterLinkOs linkOsPrinter = ZebraPrinterFactory.createLinkOsPrinter(genericPrinter); if (linkOsPrinter != null) { Log.v("PRINTER", "Available Settings for myDevice"); Set availableSettings = linkOsPrinter.getAvailableSettings(); for (String setting : availableSettings) { Log.v("PRINTER", setting + ": Range = (" + linkOsPrinter.getSettingRange(setting) + ")"); } Log.v("PRINTER", "Current Setting Values for myDevice"); Map allSettingValues = linkOsPrinter.getAllSettingValues(); for (String settingName : allSettingValues.keySet()) { Log.v("PRINTER", settingName + ":" + allSettingValues.get(settingName)); } } }
No exceptions are thrown, and I get no output except this:
05-19 13:43:05.529 12413-12413/west.jldubz.usbdiscoverertest W/dalvikvm﹕ Unable to resolve superclass of Lcom/zebra/sdk/util/internal/StringUtilities$1; (1472)
05-19 13:43:05.529 12413-12413/west.jldubz.usbdiscoverertest W/dalvikvm﹕ Link of class 'Lcom/zebra/sdk/util/internal/StringUtilities$1;' failed
05-19 13:43:05.529 12413-12413/west.jldubz.usbdiscoverertest E/dalvikvm﹕ Could not find class 'com.zebra.sdk.util.internal.StringUtilities$1', referenced from method com.zebra.sdk.util.internal.StringUtilities.convertKeyValueJsonToMap
05-19 13:43:05.529 12413-12413/west.jldubz.usbdiscoverertest W/dalvikvm﹕ VFY: unable to resolve new-instance 1886 (Lcom/zebra/sdk/util/internal/StringUtilities$1;) in Lcom/zebra/sdk/util/internal/StringUtilities;
05-19 13:43:05.539 12413-12413/west.jldubz.usbdiscoverertest W/dalvikvm﹕ Unable to resolve superclass of Lcom/zebra/sdk/util/internal/StringUtilities$1; (1472)
05-19 13:43:05.539 12413-12413/west.jldubz.usbdiscoverertest W/dalvikvm﹕ Link of class 'Lcom/zebra/sdk/util/internal/StringUtilities$1;' failed
05-19 13:43:07.171 12413-12413/west.jldubz.usbdiscoverertest W/dalvikvm﹕ VFY: unable to find class referenced in signature (Lcom/fasterxml/jackson/databind/ObjectMapper;)
05-19 13:43:07.171 12413-12413/west.jldubz.usbdiscoverertest W/dalvikvm﹕ VFY: unable to resolve virtual method 11997: Lcom/fasterxml/jackson/databind/ObjectMapper;.getTypeFactory ()Lcom/fasterxml/jackson/databind/type/TypeFactory;
Am I missing something obvious in my test implementation? Does the KR403 operate differently? How can I get this to work as I expect?
Thanks.
2 Replies
Been investigating, adding log comments attempting to pin-point where it is "failing," and it seems like this is the line that isn't working:
ZebraPrinterLinkOs linkOsPrinter = ZebraPrinterFactory.createLinkOsPrinter(genericPrinter);
as the function does not step into the if test:
if (linkOsPrinter != null) {
This begs the question, is the KR403 a Link-OS supported printer? If it is not, how might I go about obtaining a list of settings from a non-Link-OS printer?
Thanks again!
Hi again Jon-Luke,
The KR403 is not a Link-OS printer. With non-Link-OS printers, it's a little harder to work with printer settings. Almost all the settings on the KR403 are what are called SGD (SetGetDo) settings and can be manipulated with the SGD class interface. Unfortunately there's no easy way to pull and parse every setting available on these printers in this interface. You will have to determine which settings you care about and manipulate them one at a time. A full list and compatibility for the KR403 can be found in the ZPL Programming Guide under SGD Printer Commands.
Robin