5 Replies Latest reply on Feb 8, 2017 3:22 AM by Clive Lacey

    Understanding SGD commands a little better

    Clive Lacey

      I've been using S.G.D. commands for a while now and really like them.

      I have however gathered up a number of questions. Some of them are no doubt stupid and I am aware there are lot of areas that my knowledge is weak in.

      I do wish to get a better understanding though to help me work out how to better promote the products and services especially around things like AVS.


      I've attached the questions in a document. Please feel free to qualify if some of my questions are not clear. In some areas I know so little its hard to work out what the right questions should be.

      Many thanks for your help in advance.



        • Re: Understanding SGD commands a little better
          Robin West

          Factory resetting depends somewhat on the printer.  Link-OS printers will factory reset all settings with the

          ! U1 setvar "device.restore_defaults" "all"

          This does not erase anything in memory or certificates though, just settings.

          1 of 1 people found this helpful
          • Re: Understanding SGD commands a little better
            Robin West

            Hi Clive,

            I tried to answer what I could for now.

            Thanks for having us dig into commands that are so new, no one is using them yet or so old no one remembers how they work!

            Someone asked me to paste the contents into the answer so it's searchable, so here goes:


            There are quite a few SGD commands that are either not listed in the manual, OR the manual just states what is they do. Is there anywhere to get an more in-depth explanation of the these commands and also is it possible for someone to explain how it is envisaged that these commands may possible be used?

            I am using the .11 version of the zpl-zbi programming manual.

            To always be sure you’re using the current manual, we have it online at https://www.zebra.com/content/dam/zebra/manuals/en-us/software/zpl-zbi2-pm-en.pdf You are, but it gets updated once or twice a year.  Some commands are not always published as they may be considered “factory” type commands, not things we recommend for users.  Other commands are only for a subset of printers like mobile, and are supposed to be published in other guides.  These may not be published with as much regularity.



            1. Why do wifi only printers have bluetiooth section enabled in SGD command as per the sample from a QLN320 below:

              1. bluetooth.
              2. bluetooth.discoverable : on , Choices: on,off
              3. bluetooth.friendly_name : XXQLJ132000707
              4. bluetooth.version : 4.3.1p1
              5. bluetooth.date : 02/13/2015
              6. bluetooth.local_name : XXQLJ132000707
              7. bluetooth.address : AC:3F:A4:06:F2:87
              8. bluetooth.bluetooth_pin : *
              9. bluetooth.short_address : AC3FA406F287
              10. bluetooth.radio_version : 3.0
              11. bluetooth.enable : on , Choices: on,off
              12. bluetooth.connected : no
              13. bluetooth.minimum_security_mode : 1 , Choices: 1,2,3,4
              14. bluetooth.connected_security_mode : nc
              15. bluetooth.bonding : on , Choices: on,off
              16. bluetooth.clear_bonding_cache
              17. bluetooth.enable_reconnect : iOS_only , Choices: off,iOS_only
              18. bluetooth.json_config_channel_enable : on , Choices: on,off
              19. bluetooth.page_scan_window : 60 , Choices: 15,60


            What is the definitive check (SGD command) that should be used to see if bluetooth is present on the printer or not?

            The most definitive check is to set "Bluetooth.enable" "on", then get the "Bluetooth.address". If the Bluetooth radio is not installed, the address will always be an empty string. You have to try enabling it first though – dual radio printers default to have the radio turned off, so the address isn’t populated until it’s turned on the first time. EDIT: It appears that your printer above DOES have a Bluetooth radio.What makes you think that it's WI-Fi only?


            2. ip.ftp, ip.lpd, ip.tcp, ip.udp, ip.http (what would the customer link be set up for how would you get the printer to “use” it? Ip.smptp, ip.pop3, ip.snmp. What do Zebra envisage these being used for is there example I can see? These all have different uses.  FTP is to allow a user to ftp into the printer mainly to download “objects” like images, fonts, and print formats. It also affects the mirror setup. LPD I think is a protocol for handling some types of receipt printing but I don’t know much about it. TCP is a common way to do very open two way communication to the printer. UDP is the same.  HTTP is for turning on the HTTP server in the printer to view it’s webpage and do post printing (see some of my other blogs). SMTP and PoP3 are for setting up email alerts so the printer can send an email when it runs out of paper or overheats.  This works with the alerts SGDs.  SNMP is an older protocol for doing device management over networks.  You can get basically the SGD settings using this protocol.


            3. Ip.netstat – I have no clue what this is please could you elucidate? I think this command is used by some of our device management vendors. Wavelink specifically. It is our way of providing client access to the printer.  I don’t know much else about it.


            4. Ip.mirror – is there any documentation that explains the purpose of this function and its many settings?  Here is a good article describing what mirror is and how it works: https://www.zebra.com/us/en/products/software/barcode-printers/link-os/mirror.html



            5. Lable.x_move and lable.y_move – do these override any settings / offsets in whatever language is being used, or are they overridden by offset commands in label templates or within the data? Good question, on the mobile printers, there are obviously several language parsers running and they each have their own label handling settings.  The SGD commands aren’t always clear as to which language they belong to. I’m going to sort of answer 5, 6, 7 and 25 together here.  We had SGDs before we had Link-OS printers.  Mobile printers were on their own code base and had specific SGDs for them, while ZPL printers had their own set of SGD’s.  Many of them were the same, but sometimes they were not.  We found that we had SGDs for doing the same things in ZPL and CPCL that were different.  Then we went to the common code base and had to decide how to handle this. For backward compatibility we kept both sets of commands and most of them are linked so they give the same value, in the language they were originally written for.  The ezpl and zpl commands will give ZPL responses and the media and label commands give CPCL responses. Try sending this to the printer with a two way communication terminal to see what I mean:

            ! U1 setvar "media.type" "journal"

            ! U1 getvar "media.type"

            ! U1 getvar "ezpl.media_type"

            ! U1 setvar " ezpl.media_type" "mark"

            ! U1 getvar "media.type"

            ! U1 getvar "ezpl.media_type"


            6. Media.sense_mode – can this value be changed by language specific settings if so which ones?    Can also be changed with ^MN, ezpl.media_type, and several calibration commands.


            7. What if any is the correlation between media.sense_mode and media.type. I “believe” I have seen these settings changed depending on language specific settings but I can’t be sure. sense_mode in CPCL vs ZPL – bar = mark, web = gap.  Type in CPCL vs ZPL- label = web/mark, journal = continuous.


            8. Wlan.poor_signal_threshold – im not sure how I could implement setting / testing this to provide meaningful information – any help / information would be appreciated? I’ll see if I can find some info from our test teams.


            9. wlan.roam group. Is there any detail explanation how changing these values effects the performance of the devices ability to roam? When would it be useful to change these values and what are the ramifications of doing so. The roam settings are useful mostly for mobile printers that may be moved across large areas like factories where they will be “roaming” from AP to AP.  The setting are very much individual to the location, and are affected by distance between AP’s, interference from machinery and metal shelving, and a lot of other factors.  It takes an experienced field install team to really use these settings to their fullest.


            10.  Is there any more detailed examples for writing custom menus using WML I have done it for a customer but I found the limited examples on the web – well quite limited. I can look through some of our files and see if I can find a few more to publish.


            11.  When would you advise changing power.low_battery settings and if so please could you give an example of the circumstances and why? This is primarily to configure the time to warning about the battery dying. So if you have workers in the field with no access to batteries and you need to give them a half hour or more warning so they can get replacements, you can.  The value is set in seconds and has a maximum of 65535 seconds. The default is 60 seconds.


            12.  What is the correlations between power.percent_full and power.relative_state_of_charge ? I’ll have to get back to you on that one.


            13.  Whats does power.health mean? What options can it return apart from “good” and what would they signify? This is directly tied to the cycle count and refers to when the battery is nearing the end of its life. Returns the “health” rating of the battery pack. Battery health can be “good”, “replace” or “poor”. • Health is “good” if the power.cycle_count < 300 and capacity ratio (the ratio of actual capacity to the design capacity) is greater or equal to 0.80. • Health is “replace” if power.cycle_count is between 300 and 600. If # of Cycles is < 550 but > 300, the printer will display a message “Please Replace Battery Pack” followed by three beeps. If the number of charge cycles is ≤550 but < 600, the reminder shall be: “Warning - Battery is Past its Useful Life” followed by three beeps. • Health is “poor” if the power.cycle_count is greater than 600. Printer will flash a message: “Please Replace Battery Before Proceeding – Shutting Down” accompanied by a beep for thirty seconds and then shut down.


            14.  Is there an explanation of the power.battery_replacement settings and why you may change them and under what circumstances you may do this? (ZQ printers only) I don’t believe you want to change this, but I’ll have to check on this one.


            15.  What is the correlation of odometer.media_marker_count and odometer.total_lable_count? Is one for gap/bar media and the other where plain media (journal) is used? If so would the total amount of labels for a printer that was printing on both types of media be the sum of the two values? Media_marker_count refers to the total amount of media moved through the printer.  This includes form feed labels and calibrations, as well as print jobs. Total_label_count only refers to labels actually printed. EDIT:Media_marker_count is tied to the hardware motor odomerter (total_print_length) and assumes all labels printed are the current label length.  Continous/journal should show the same marker_count value as the print_length.  label_count is new and I believe is driven by the firmware counting the print jobs processed by the printer.  Line mode will either count each line as a separate label, or not at all.


            16.  What is the optimum method for setting all areas of the printer back to factory defaults?


            17.  Print.contrast and print.tone settings are these separate to settings like density in the menus? Print.tone should equal density or darkness depending on the language.


            18.  Whats the difference between print.tone_format cpcl and zpl? Does it just mean they are only active when the applicable print emulation is being used? The range of darkness or tone is different in CPCL and ZPL.  CPCL has a range of -100 to 200 and the default is 0.  ZPL ranges from 0.0 to 30.0 with the default being 10.0 or 15.0. They both use the print.tone SGD, so setting it to 0 can make a big difference depending on the format/language.


            19.  What does the print.print_adj do? No idea.  I’ll look into it.


            20.  Does the zpl.calibrate perform a general calibration command or only if the printer is in zpl operating mode? No, this works the same in line_print mode as well, it just doesn’t affect line print “documents”. If you switch to ZPL, the new calibration should be there. I haven’t checked if this effects CPCL labels, but I suspect it does.


            21.  Do the zpl.label_length, zpl.left_position override and commands coming in ZPL data to the printer or do they reflect the value of any such commands? Commands in ZPL as part of a label will override settings made in SGD or set prior to the label. The cammands are ^LL for label_langth, and ^LH for label_top and left_position.


            22.  Whats the internal.wired section for. Can you confirm this is what is used if you have a ZT with Ethernet (sorry I don’t have one to play with here). Yes, the ZT uses internal.wired for it’s Ethernet.  The only printers that will use external.wired are printers with an external print server, or some older printers like the S4M.


            23.  When interrogating a printer is interface.network.active –the first place to go to? Will it always tell me which interface is the one being used? I’m not sure why you need it unless it somehow to cope with printers that have wifi interfaces and wired Ethernet. In such cases where the printer could be running both what controls which is seen as the active interface? There is a hierarchy to what the printer will have active if it has connections to both wired and wireless. Like your laptop, if you have it wired, it will always try to use that interface, even if you have a wireless connection.  And yes, many of our tabletop printers have both interfaces available.  Mobile printers will also use this if they are connected to an Ethernet dock.


            24.  What does the apl. Command set do. I understand I works with virtual devices but what does that mean, where would it be useful? You have to have a Virtual Device loaded on the printer.  If you do, this will turn on and off that functionality.  Virtual Devices are primarily a way to allow the printer to process other print command languages.  We have one for processing and directly printing PDF files, others are for handling competitive print languages.


            25.  Can you confirm - are SGD commands that start zpl. Or ezpl.. ONLY relevant when the printer is operating in those print modes and ignored when not? I can’t confirm that.  Some commands are linked between ZPL and CPCL, so changing one, changes the other. I’ll see if I can dig up which.


            26.  Whats the difference between weblink and weblink.cloud and weblink.zebra_connector? Is there any further detailed information on this? The weblink.cloud and weblink.zebra_connector are very new commands (Link-OS 4.0) and are used for setting up the new visibility service that Zebra is now offering.  See https://developer.zebra.com/community/technologies/printers/label-printers/blog/2016/11/21/link-os-40 for some basic info.  The article shows how to turn off this functionality.


            You can use the standard Weblink settings. They are to set up the websocket clients in the printer.  See this article for more info. https://www.zebra.com/us/en/products/software/barcode-printers/link-os/cloud-connect.html


            27.  I don’t understand the capture.channel settings from the manual is there any further explanation anywhere?  This is an interesting thing you can work with.  We have an older article on the topic, but it may be something we need to put together more examples of. It is basically a way to get data from something like a scanner or scale and send that data somewhere else.  The usual way this works is: the printer will read and buffer data coming in to the “channel” you set up like USB or serial, than sends an alert (if the alert is set up) to a server when it reaches a set amount or delimiter. The server then can read the capture data and use that to create a label to print. I’ve seen very nice implementations of this using SGDs for capture, alerts, and display, and WML menus to completely remove single purpose terminals. https://km.zebra.com/resources/sites/ZEBRA/content/live/WHITE_PAPERS/0/WH112/en_US/ISV%20Link-OS%20Newsletter%204%20-%20Cloud%20Connect.pdf

            1 of 1 people found this helpful
              • Re: Understanding SGD commands a little better
                Robin West

                For your first question about Bluetooth - I'm guessing when it was purchased it was Network only, but the part number looks something like this:"QN3-AUNA0E00-00".  The N is significant as it indicates the radio chipset.  When we first sold you this printer in 2013, it only did Wi-Fi, but you've obviously kept the firmware up to date.  In early 2015 we came out with firmware that allowed the N radio printers to run dual radios (Bluetooth and Wi-Fi). It looks like you updated your printer right away and the Bluetooth was turned on (see the date in the Bluetooth settings).  I know you bought a printer that was manufactured in the 20th week of 2013 because the serial number XXQLJ132000707.

                1 of 1 people found this helpful
                  • Re: Understanding SGD commands a little better
                    Clive Lacey


                    Thank you taking the time to answer the questions so fully. You have filled in some of my knowledge gaps and explained some of the anomalies I was struggling with well.

                    I will digest what you say and come back with any further questions. I would appreciate an update on the ones still unanswered even if it's just "don't touch"



                    P.S. Cant mark all your posts as correct answer - which they are