After some uses of a bluetooth printer, i often get this exception fired up and the printer stops working:
W/System.err( 1964): java.io.IOException: read failed, socket might closed or timeout, read ret: -1
W/System.err( 1964): at android.bluetooth.BluetoothSocket.readAll(BluetoothSocket.java:762)
W/System.err( 1964): at android.bluetooth.BluetoothSocket.readInt(BluetoothSocket.java:776)
W/System.err( 1964): at android.bluetooth.BluetoothSocket.connect(BluetoothSocket.java:399)
W/System.err( 1964): at com.gprinter.io.BluetoothPort.openPort(BluetoothPort.java:58)
W/System.err( 1964): at com.tablemi.flutter_bluetooth_basic.DeviceConnFactoryManager.openPort(DeviceConnFactoryManager.java:156)
W/System.err( 1964): at com.tablemi.flutter_bluetooth_basic.FlutterBluetoothBasicPlugin$3.run(FlutterBluetoothBasicPlugin.java:233)
W/System.err( 1964): at com.tablemi.flutter_bluetooth_basic.ThreadPool$1.run(ThreadPool.java:78)
W/System.err( 1964): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
W/System.err( 1964): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
W/System.err( 1964): at java.lang.Thread.run(Thread.java:764)
Unfortunately this code is not directly accessible as it is found on the library gprintersdkv2.jar, so i can´t fast check if the proposed solution fix the error. I found early versions of the library, but those are incompatible with the current calls on DeviceConnFactoryManager.java, so a reimplementation of some sort is required. The libary could be decompiled but i don´t know if its license allow that.
I´m using esc_pos_bluetooth also, and my printer is MUNBYN
After some uses of a bluetooth printer, i often get this exception fired up and the printer stops working:
W/System.err( 1964): java.io.IOException: read failed, socket might closed or timeout, read ret: -1 W/System.err( 1964): at android.bluetooth.BluetoothSocket.readAll(BluetoothSocket.java:762) W/System.err( 1964): at android.bluetooth.BluetoothSocket.readInt(BluetoothSocket.java:776) W/System.err( 1964): at android.bluetooth.BluetoothSocket.connect(BluetoothSocket.java:399) W/System.err( 1964): at com.gprinter.io.BluetoothPort.openPort(BluetoothPort.java:58) W/System.err( 1964): at com.tablemi.flutter_bluetooth_basic.DeviceConnFactoryManager.openPort(DeviceConnFactoryManager.java:156) W/System.err( 1964): at com.tablemi.flutter_bluetooth_basic.FlutterBluetoothBasicPlugin$3.run(FlutterBluetoothBasicPlugin.java:233) W/System.err( 1964): at com.tablemi.flutter_bluetooth_basic.ThreadPool$1.run(ThreadPool.java:78) W/System.err( 1964): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) W/System.err( 1964): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) W/System.err( 1964): at java.lang.Thread.run(Thread.java:764)
Seems related to this: https://stackoverflow.com/questions/18657427/ioexception-read-failed-socket-might-closed-bluetooth-on-android-4-3?rq=1
Unfortunately this code is not directly accessible as it is found on the library gprintersdkv2.jar, so i can´t fast check if the proposed solution fix the error. I found early versions of the library, but those are incompatible with the current calls on DeviceConnFactoryManager.java, so a reimplementation of some sort is required. The libary could be decompiled but i don´t know if its license allow that.
I´m using esc_pos_bluetooth also, and my printer is MUNBYN