Android/LinkOS (v2.14.5198) - Malformed status response - unable to determine printer status

// Expert user has replied.
E Efkan YILMAZ 3 years 5 months ago
93 2 0

Hello,
I am trying to print a PDF file on a ZQ521 printer from a native (kotlin) Android app running on Zebra TC26 (Android 10 OS).
I've followed the official documentation and also used https://github.com/ZebraDevs/LinkOS-Android-Samples as a reference, but I am getting an error while checking printer status:
W/System.err: com.zebra.sdk.comm.ConnectionException: Malformed status response - unable to determine printer status
W/System.err: at com.zebra.sdk.printer.internal.PrinterStatusZpl.getPrinterStatus(Unknown Source:65)
W/System.err: at com.zebra.sdk.printer.internal.PrinterStatusZpl.updateStatus(Unknown Source:0)
W/System.err: at com.zebra.sdk.printer.PrinterStatus.getStatusFromPrinter(Unknown Source:4)
W/System.err: at com.zebra.sdk.printer.PrinterStatus.(Unknown Source:22)
W/System.err: at com.zebra.sdk.printer.internal.PrinterStatusZpl.(Unknown Source:0)
W/System.err: at com.zebra.sdk.printer.internal.ZebraPrinterZpl.getCurrentStatus(Unknown Source:4)
I've established a connection between a printer and a mobile device successfully but this error still occurs.
Here is code snippet of my current implementation:
val printer: DiscoveredPrinter = data.first
val file: Uri = data.second.filePath
GlobalScope.launch(Dispatchers.IO) {
try {
object : BluetoothConnection(printer.address) {
override fun open() {
super.open()
val zebraPrinter: ZebraPrinter = ZebraPrinterFactory.getInstance(this)
val isReady: Boolean = checkPrinterStatus(zebraPrinter, file.path)
val scale: String = scalePrint(this, file)
SGD.SET("apl.settings", scale, this);
if (isReady) {
if (!file.path.isNullOrEmpty()) {
zebraPrinter.sendFileContents(file.path)
} else {
logger.d(TAG, "Container label file is empty")
}
} else {
logger.d(TAG,
"Zebra printer is not ready, current status: ${zebraPrinter.currentStatus}")
}
}
}.open()
} catch (ex: ConnectionException) {
logger.e(TAG, ex)
} catch (ex: ZebraPrinterLanguageUnknownException) {
logger.e(TAG, ex)
} finally {
value = Unit
try {
connection?.close()
} catch (ex: ConnectionException) {
logger.e(TAG, ex)
}
}
}
private fun checkPrinterStatus(printer: ZebraPrinter, filePath: String?): Boolean {
if (printer.connection.isConnected) {
try {
val printerStatus: PrinterStatus = printer.currentStatus
if (printerStatus.isReadyToPrint && filePath != null) {
return true
}
} catch (e: ConnectionException) {
e.printStackTrace()
}
}
return false
}
Version of LinkOs: link_os_sdk\android\v2.14.5198
Thanks in advance!

Please Register or Login to post a reply

2 Replies

N Nikola Sofronovic

linkOsPrinter.sendFileContents("/storage/emulated/0/Download/containerLabel1925002806.pdf")
This line on code worked, but got really weird print, check it out here:
https://ibb.co/DbZRv1P
https://ibb.co/nPWMnYL

S Steven Si

How often do you get this "Malformed status response" error msg thrown out in ConnectionException? If it happens every time, then we need to make sure that the Bluetooth connection is open before calling ZebraPrinterFactory.getInstance(connection). If it happens occasionally, then we can add a retry to see if we can get a complete response again. The underneath implementation of this getCurrentStatus() is to parse a string returned from the SGD of "device.host_status". If the received string is incomplete or corrupted, then we would see "Malformed status response" error msg.

CONTACT
Can’t find what you’re looking for?