Smart Battery Management of Your Link-OS Printers

Manuel Caicedo-Rivera -
4 MIN READ

This is the second in a series of blog posts reviewing smart features of Link-OS printers that could be implemented by developers.

For other posts in this series please see the links below:

This post will cover the battery information and control with some very useful SetGetDo (SGD) commands.

There are around 35 SGD commands to monitor, modify and control different power and battery operations. The list below includes most of them. All of these have not been added to the ZPL programming manual, but a developer can get access to them by generating an “Allcv” report.

  • power.voltage : 7.91
  • power.percent_full : 91% Full
  • power.status : ok
  • power.low_battery_warning : 6.93(176)
  • power.low_battery_shutdown : 6.53(166)
  • power.low_battery_timeout : 60 Seconds , Choices: 0-8191
  • power.low_battery_timeout_alt : 60
  • power.inactivity_timeout : 1200 Seconds , Choices: 0-65535
  • power.inactivity_timeout_alt : 1200 , Choices: 0-65535
  • power.power_on_cycles : 34
  • power.design_voltage : 8400 mV
  • power.design_capacity : 2500 mAh
  • power.manufacture_date : 1-6-2015
  • power.relative_state_of_charge : 91 %
  • power.serial_number : 2290
  • power.cycle_count : 0
  • power.full_charge_capacity : 2500 mAh
  • power.health : good
  • power.date_first_used : 8-4-2015
  • power.low_battery_audio_alert : 0 , Choices: 0-65535
  • power.low_battery_text_alert :
  • power.cradle_shutdown_timeout : 0 , Choices: 0-65535
  • power.battery_replacement_cyclecount_threshold : NA , Choices: 100-2450
  • power.battery_replacement_capacityratio_threshold : NA , Choices: 0-100
  • power.battery_replacement_stateofcharge_threshold : NA , Choices: 0-100
  • power.battery_led_enable : NA , Choices: on,off
  • power.battery_led_blink_rate : NA , Choices: 0-127
  • power.battery_led_on_duration : NA , Choices: 0-255
  • power.battery_led_off_duration : NA , Choices: 0-255

It is very helpful for users of a mobile printer to have visibility to the battery information, status & consumption. This Android Java code outlines how to implement it:

import com.zebra.sdk.comm.Connection;

import com.zebra.sdk.comm.ConnectionException;

import com.zebra.sdk.comm.TcpStatusConnection;

import com.zebra.sdk.printer.SGD;

public Class TcpStatusBatteryConnection{

  public static void main(String[] args) throws Exception {

         new TcpStatusBatteryConnection().sgdOverStatusConnection("1.2.3.4");

     }

private static void sgdOverStatusConnection(String ipAddress) throws ConnectionException {

        Connection printerConnection = new TcpStatusConnection(theIpAddress, TcpStatusConnection.DEFAULT_STATUS_TCP_PORT);

        

        try {

             //Using status connection only,

             printerConnection.open();

    

             // Get the level in percent of battery charge with an SGD, and with the status channel

             // Battery = 35% of full of charge

             String printBatteryChargeStatus = SGD.GET("power.percent_full", printerConnection);

             System.out.println("Battery = " + printBatteryChargeStatus + "of full of charge");

     

             // Get the level of battery status with an SGD, and with the status channel

             // Battery = ok

             String printBattery_onCycles = SGD.GET("power.power_on_cycles", printerConnection);

             System.out.println("Battery =" + printBattery_onCycles);

     

            // Get the health status of the battery with an SGD, and with the status channel

            // Battery health = Poor

             String printBatteryHealthStatus = SGD.GET("power.health", printerConnection);

             System.out.println("Battery health = " + printBatteryHealthStatus);

             // Get the date when the battery used for first time with an SGD, and with the status channel

             // Battery First Use = 8-4-2015

             String printBatteryFirstUse = SGD.GET("power.date_first_used", printerConnection);

             System.out.println("Battery First Use = " + printBatteryFirstUse);

     

     

           // Close the connection Status connection,

             printerConnection.close();

 

         } catch (ConnectionException e) {

             e.printStackTrace();

         } finally {

             printerConnection.close();

         }

     }

     }

Now, imagine that a developer could capture this data, and save that data in a cloud within a database, by using their own predictive model (machine learning) to re-create the battery behavior that can anticipate the user’s needs. The algorithm implemented in this app could then optimize the battery life for a full shift of 8 hours, or 10 or 12 hours. A combination of several variables such as “user daily behavior” (how many tickets printed by hour or by shift), battery data (values of power.percent_full taken every 30 minutes), and speed of ticket printed taken again every 30 minutes could feed the advanced algorithm. Depending on the results of the variables, then the app could adjust the values in the printer automatically, (per example increase or reduce print speed, modify sleep mode time, etc).

The blog is an attempt to help developers to have a better understanding of smart settings and variables that Link-OS printers have, and how these could be used in mobile apps. Please feel free to post your comments, questions, ideas or feedback of your implementation.

If you want to review other material related to this topic, please, visit the links below.

How to use SGD commands:

https://developer.zebra.com/message/92067#92067

How to work with odometers:

https://developer.zebra.com/community/home/blog/2017/05/31/be-more-productive-with-link-os

https://developer.zebra.com/message/94828#94828

How to check status of the printer:

https://developer.zebra.com/message/86148#86148

https://developer.zebra.com/message/94692#94692

Zebra Best Practices for Printing

profile

Manuel Caicedo-Rivera

Please register or login to post a reply

Replies