3 Replies Latest reply on Oct 26, 2018 9:23 AM by Paul OBrien

    ZebraPrinter.getCurrentStatus taking 9-10 seconds to return.

    Steven Lange

      I'm trying to get the status of a zd410 prior to sending the print data however it seems to be taking anywhere from 5 seconds to 10 seconds to return.  When using the serial port this normally takes about 200ms.    We are trying to move from the com/serial to usb but when using Connection.sendAndWaitForValidReponse() returns in about 5 seconds.  If I use ZebraPrinter.getCurrentStatus() that takes about 10 seconds.   I'm using a usb connection not tcp or bluetooth so using a status channel I don't think is an option.

        • Re: ZebraPrinter.getCurrentStatus taking 9-10 seconds to return.
          Robin West

          Hi Steven, We don't think we're aware of this issue, so can you share some details? 

          What OS?  Driver (version?) or direct USB? What platform (Android/Windows Java/Windows C#/etc.)?  What version of the library? What firmware version?

           

          Thanks,

          Robin

            • Re: ZebraPrinter.getCurrentStatus taking 9-10 seconds to return.
              Paul OBrien

              I'm having the same issue with my ZT230 - USB connection with ZDesigner ZT230-300dpi ZPL driver. Printer Configuration print out shows:

               

              Firmware ZSP-003757A

              Link-OS Version 2.0

               

              I'm using VisualStudio 2015/VB.Net with most current SDK on Windows Windows 10 Pro (64-bit).  Here's my code for getting the status:

               

                          Try

                              connection = ConnectionBuilder.Build(_currentUsbPrinterName)

                              connection.Open()

                              printer = ZebraPrinterFactory.GetInstance(PrinterLanguage.ZPL, connection)

                              pStatus = printer.GetCurrentStatus     ****  TAKES 11 go 12 seconds to return

               

                              If pStatus.isReadyToPrint Then

                                  lblMessage.Text = "Ready to Print"

                                  Threading.Thread.Sleep(1500)

                              ElseIf pStatus.isPaused Then

                                  lblMessage.Text = "Printer is Paused"

                                  Threading.Thread.Sleep(1500)

                              Else

                                  lblMessage.Text = "Other print status"

                                  Threading.Thread.Sleep(1500)

                              End If

                          Catch ex As Exception

                              MsgBox(ex.Message)

                          Finally

                              If connection IsNot Nothing Then

                                  connection.Close()

                                  connection.Dispose()

                              End If

                          End Try

               

              This on the other hand prints instantaneously:

               

                      Try

                          ' Open the connection - physical connection is established here.

                          connection = ConnectionBuilder.Build(_currentUsbPrinterName)

                          connection.Open()

                          ' This example prints "This is a ZPL test." near the top of the label.

                          Dim zplData As [String] = "^XA^FO20,20^A0N,25,25^FDThis is a ZPL test.^FS^XZ"

                          ' Send the data to printer as a byte array.

                          connection.Write(Encoding.[Default].GetBytes(zplData))

                      Catch ex As Exception

                          ' Handle communications error here.

                          MsgBox(ex.Message)

                      Finally

                          If connection IsNot Nothing Then

                              connection.Close()

                              connection.Dispose()

                          End If

                      End Try

            • Re: ZebraPrinter.getCurrentStatus taking 9-10 seconds to return.
              Paul OBrien

              I tried a new approach based on another posting I found - see below.  This works great - instantaneous response however, if I run this code a second time, the call to ConnectionBuilder.Build hangs up and never returns. 

               

                  Private Sub btnGetPrinterStatus2_Click(sender As Object, e As EventArgs) Handles btnGetPrinterStatus2.Click

                      Dim connection As DriverPrinterConnection = Nothing

                      Dim byteArray As Byte()

                      Dim result As List(Of String)

               

                      Try

                          connection = ConnectionBuilder.Build(_currentUsbPrinterName)    *** Hangs up if I run this code again

                          connection.Open()

                          Dim getstatus As String = "~HQES"

                          byteArray = Encoding.ASCII.GetBytes(getstatus)

                          Dim response As Byte() = New Byte(149) {}

                          connection.Write(byteArray)

                          connection.WaitForData(3000)

                          response = connection.Read()

                          result = ParseResponse(response)

                          If result.Count > 0 Then

                              lblMessage.Text = result.Item(0)

                          Else

                              lblMessage.Text = "No result returned."

                          End If

                      Catch ex As Exception

                          MsgBox(ex.Message)

                      Finally

                          If connection IsNot Nothing Then

                              connection.Close()

                              connection.Dispose()

                          End If

                      End Try

               

                  End Sub