andresperezmelo / print_bluetooth_thermal

Plugin para enviar bytes sin procesar a la impresora solo por ahora para Android
Other
27 stars 36 forks source link

connect: read failed, socket might closed or timeout, read ret: -1 code 71248565 #27

Open biloo-dev opened 1 year ago

biloo-dev commented 1 year ago

i hade this error in my xPrinter Xp-p323B connect with pin code 0000;

When I try to connect to a printer with a pin code, the connection is closed immediately before the pin code is entered

W/BluetoothAdapter(17303): getBluetoothService() called with no BluetoothManagerCallback
D/====> print: (17303): connect: read failed, socket might closed or timeout, read ret: -1 code 42882209
I/flutter (17303): result status connect: false
I/flutter (17303): state conected false

i'm using the example of this package

It would be great if you could add new features

This feature allows the connection to be made without the user having to write the device's PIN, being set programmatically with the connectWithPin() method, being necessary to pass the pin of the device to be connected (Android only).

Example: await device.connectWithPin("1234")

https://github.com/pauldemarco/flutter_blue/pull/747

andresperezmelo commented 1 year ago

Thanks I will look for a device that requires pin to try to implement the option.

biloo-dev commented 1 year ago

Thank you. I appreciate your interaction Can you do me a favor please ? can you add a timeout argument to connect function as optional parameter just for avoid timeout As long as the pin number is not added, please add connect with timeout thanks String mac = "66:02:BD:06:18:7B"; final bool result = await PrintBluetoothThermal.connect(macPrinterAddress: mac,timeout:35);

andresperezmelo commented 1 year ago

That's another good suggestion, to set the waiting time, I had thought about that, thanks.

biloo-dev commented 1 year ago

Thank you @andresperezmelo, I'm looking forward to new features Thanks