ESCPOS-ThermalPrinter-Android
ESCPOS-ThermalPrinter-Android copied to clipboard
Print from multiple devices at the same time
I developed an order-taking application in a restaurant and I use this great library to print the tickets. I noticed that when 2 tablets send a text to the same printer at the same time, the printer starts by printing part of the 1st text received then it switches the 2nd text when it receives it without having finished the first text. I suppose that this problem comes from the fact that when we print a text, there are several consecutive writes sent to the printer for formatting and the printer stupidly executes what it receives from each socket.
Does anyone have an idea that can help me? I'm thinking of modifying the library so that it sends the text and formatting in a single message in the socket.
Please share the code, if you made it. My thoughts:
- Library should have a "isBusy" method, to check if the printer is printing at the moment. - don't know if this is available
- Create a service running on one of the devices, which takes the messages from all devices and handles the work sequence. - this is not so easy to implement, but then you have one program which actually is using the printing library and devices which only creates the printing strings and sends it to the service.
which type of connection method do you used?