link-os getCurrentStatus() function relatively slow

Hi,

we are working on an Android app, our client has hundreds of label to print every day with QLn220.

Zebra best practices doc states

The application checks the status of the printer before sending a print-job. Once the printer verifies the printer is not in an error state, you can send the print job

calling this method before each print-job allows to be sure the label will print and alarm the user of any potential problem with the printer, however, it takes around 800 ms to get the status response from the printer;

which make the user waiting for the label.

removing the printer status test allows to print a label in almost 30 ms.

 

is there any way to keep checking the printer status, but, faster ?

ps: the app is connected to the via wifi

thanks

Anonymous (not verified)
Hi Adel,There are a few

Hi Adel,

There are a few things to try:

1. Try using the status channel (port 9200) as it should parse and respond to those queries faster.   

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

2. You can get and parse the status yourself.  I can attach some psudo code showing the process if you want.  It might be slightly faster than directly using the SDK, but not hugely.

3. you can utilize the alerts system to be notified when there is a problem, whenever there is a problem.  It saves you from having to query the printer all the time, but you do have to have a TCP server socket open to be told there is an issue.  If you are the primary app your client is working with, then this might be a good solution.  You check the status when your app starts up, then start the TCP server to listen for status alerts from the printer.  There are several commands to work with the alerts using SGD commands or ZPL.

Hope this helps!

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Adel Sari
Hi Robin,I would be grateful

Hi Robin,

I would be grateful if you can attach some pseudo code (point 2).

point 3 is not an option for me.

thanks

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Anonymous (not verified)
public static getStatus

public static getStatus(string theIpAddress)

{

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

    try{

          thePrinterConn.open();

          String getstatus = "~HQES";

          byte[] response = new byte[150];

          thePrinterConn.write(getstatus.getBytes());

          thePrinterConn.waitForData(3000);

          response = thePrinterConn.read();

          parseResponse(response);

    }

    catch(ConnectionException){//do stuff}

    finally { //close connection }

}

public static parseResponse(byte[] response)

{

    int is_error = response[70];

    int media = response[88];

    int head = response[87];

     int pause = response[84];

    string[] status = new string[10];

     bool ok = false;

     if (is_error == 48)  // ASCII '0'

    {

        ok = true;

        status.Add("Ready to Print");

    }

    if (media == 49)  // ASCII '1'

        status.Add("Error: Paper out");

    if (media == 50)  // ASCII '2'

        status.Add("Error: Ribbon Out");

    if (media == 52)  // ASCII '4'

        status.Add("Error: Media Door Open");

    if (media == 56)  // ASCII '8'

        status.Add("Error: Cutter Fault");

    if (head == 49)  // ASCII '1'

        status.Add("Error: Printhead Overheating");

    if (head == 50)  // ASCII '2'

        status.Add("Error: Motor Overheating");

    if (head == 52)  // ASCII '4'

        status.Add("Error: Printheat Fault");

    if (head == 56)  // ASCII '8'

        status.Add("Error: Incorrect Printhead");

    if (pause == 49)  // ASCII '1'

        status.Add("Printer Paused");

    if ((!ok) && (status.Count == 0))

        status.Add("Error: Unknown Error");

}

The response should be 144 bytes ending in a hex 03, so you might have to read a few times to get it all.  I stole this from some C# code, so please use it as psudocode and not real Java. The printer can have multiple status conditions at the same time.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Carl Cubillas
This is definitely faster. Do

This is definitely faster. Do you have happen to know where I can get more details on the response data? Like how to get "numberOfFormatsInReceiveBuffer" from the response data.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Adel Sari
Hi Robin,Using

Hi Robin,

Using TcpStatusConnection  fixed the issue, it's really faster to get the status with.

Thanks

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Log in to post comments