kakzaki / blue_thermal_printer

Working with thermal printer via bluetooth (Flutter)
MIT License
164 stars 205 forks source link

Bluetooth printer reconnection error #123

Closed harry-sm closed 2 years ago

harry-sm commented 2 years ago

This happens when the connected Bluetooth device is turned off without being properly disconnected. That is, before the disconnect function is called. When the device is turned back. The Bluetooth.isConnected function returns true but the device.connected is false...subsequently, any attempts to print produce that error.

W/System.err(21605): java.io.IOException: Broken pipe
W/System.err(21605):    at android.net.LocalSocketImpl.writeba_native(Native Method)
W/System.err(21605):    at android.net.LocalSocketImpl.access$500(LocalSocketImpl.java:37)
W/System.err(21605):    at android.net.LocalSocketImpl$SocketOutputStream.write(LocalSocketImpl.java:147)
W/System.err(21605):    at android.bluetooth.BluetoothSocket.write(BluetoothSocket.java:785)
W/System.err(21605):    at android.bluetooth.BluetoothOutputStream.write(BluetoothOutputStream.java:76)
W/System.err(21605):    at java.io.OutputStream.write(OutputStream.java:75)
W/System.err(21605):    at id.kakzaki.blue_thermal_printer.BlueThermalPrinterPlugin$ConnectedThread.write(BlueThermalPrinterPlugin.java:891)
W/System.err(21605):    at id.kakzaki.blue_thermal_printer.BlueThermalPrinterPlugin.printCustom(BlueThermalPrinterPlugin.java:571)
W/System.err(21605):    at id.kakzaki.blue_thermal_printer.BlueThermalPrinterPlugin.onMethodCall(BlueThermalPrinterPlugin.java:312)
W/System.err(21605):    at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233)
W/System.err(21605):    at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:84)
W/System.err(21605):    at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:865)
github-actions[bot] commented 2 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.