Issue / Question
Customer use Link-OS SDK demo to printing and encoding via USB driver connection.
When using “ZebraPrinter printer = ZebraPrinterFactory.getInstance(printerConnection);” to get USB connection from driver, it will response after past over than 30 seconds.
Applicable To
Link-OS SDK, Java and C# PC application develop
Resolution / Answer
A workaround way that use “com.zebra.sdk.comm.DriverPrinterConnection” to create connection instead of “ZebraPrinterFactory.getInstance”.
The sample as below.
private void sendAndWaitDate() { Connection conn = null; try { conn = new DriverPrinterConnection("ZDesigner ZD500R-300dpi ZPL"); conn.open(); byte[] zpl = "^XA^FN1^RFR,H,0,12,2^FS^FH_^HV1,256^FS^RFW,H,1,14,1^FD3000313233343536373839414243^FS^XZ".getBytes(); byte[] tid = null; tid = conn.sendAndWaitForResponse(zpl, 500, 500, null); DemoDialog.showErrorDialog(SendFileDemo.this, tid.toString(), tid.toString()); } catch (ConnectionException e) { DemoDialog.showErrorDialog(SendFileDemo.this, e.getMessage(), "Connection Error!"); } finally { try { if (conn != null) conn.close(); } catch (ConnectionException e) { } } }