bluetooth_print icon indicating copy to clipboard operation
bluetooth_print copied to clipboard

android.bluetooth.device.action.ACL_DISCONNECTED

Open haoth2 opened this issue 2 years ago • 4 comments

When ACL_CONNECTED, DeviceConnFactoryManager wait read. But then BluetoothSocket close and connection device is lost

haoth2 avatar Nov 13 '21 01:11 haoth2

I have the same problem. Did you find the solution?

rofviv avatar Nov 25 '21 15:11 rofviv

Could you solve it? Help me

santiago21ag avatar Dec 02 '21 06:12 santiago21ag

If I try to connect to a printer of bluetooth type DEVICE_TYPE_DUAL (3) , it will connect and maintain a connection.

However, if I try to connect to a printer of bluetooth type DEVICE_TYPE_LE (2), it will connect but, after a short while, disconnect resulting in the ACL_CONNECTED mentioned above.

I think the reason for this is that while it is connected, the device prompts the user to pair with the printer, times out, then disconnects.

Why is it asking to pair?

If I use https://pub.dev/packages/flutter_blue, I can open and maintain a connection to both the type 2 and 3 printers above with no request to pair.

On iOS, it works fine.

I've managed to trace it to the following line in the plugin...

https://github.com/thon-ju/bluetooth_print/blob/26bcfbdf2f46fb8fcf8ea9044a6b84b69d260cb4/android/src/main/java/com/example/bluetooth_print/DeviceConnFactoryManager.java#L156

During this call, it connects; prompts to pair; throws and exception; disconnects.

The call to com.gprinter.io.PortManager.openPort in the gprintersdkv2.jar then delegates the call to the android.bluetooth library.

Unfortunately, I cannot find the source code for gprintersdkv2.jar anywhere and ever the Maven links end up in a 404. The intention here was to use the latest library, if there is one, or modify the source... but no can do.

Can anyone find the source to the gprintersdkv2.jar ? As an aside, iOS using libGSDK.a - is it the same thing? I don't know.

xni06 avatar Jan 28 '22 18:01 xni06

See #96 as a workaround

xni06 avatar Feb 02 '22 17:02 xni06