anastaciocintra / escpos-coffee

Java library for ESC/POS printer
https://anastaciocintra.github.io/escpos-coffee
MIT License
277 stars 72 forks source link

Get response from escpos commands #67

Closed tleveque closed 3 years ago

tleveque commented 3 years ago

I am able to print all my tickets on my Oxhoo TP85. Now, I would like to send commands to the printer to get status (out of paper...). I found the escpos command (GS r 1) to send from Oxhoo documentation but I do not know how to receive the response using the API. Is it possible ? Thanks

anastaciocintra commented 3 years ago

Hi @tleveque, Its not an ease answer, Its depends, I don't know how many methods exists, but this method worked for me. I didn't use it in production environment, It was just for fun to me. In other words, I didn't test exhaustively.

I found the escpos command (GS r 1)

I've used GS a command ( Automatic Status Back). Your printer's brand need to be able to respond the Automatic Status Back command;

but I do not know how to receive the response using the API.

I've used one bi-directional I/O: USB or Serial Port.

You can see the code at UsbStatus and SerialStatus

Hope this helps.

frame1 frame2

tleveque commented 3 years ago

Hi, Thanks. I am able to get status from OXhoo TP85 by modifying a bit USBStatus example. I needed to use zadig on Windows 10 and use following config instead of Epson one. usbStatus = new UsbStatusTP85((short) 0x20d1,(short) 0x7009, (byte) 0x00, (byte) 0x02, (byte) 0x82);