esc_pos_printer icon indicating copy to clipboard operation
esc_pos_printer copied to clipboard

Error print with Barcodes

Open luissouza opened this issue 4 years ago • 4 comments

Andrey, thanks for all your help!

I'm using a bluetooth printer.

I upgrade the package to esc_pos_bluetooth: ^0.2.1 but the issue persist. What I can do? All the texts are printing without problems, but when i put barcode my app crash.

This is the code to print barcode who crashes my app:

final List<int> barData = [1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 4];
ticket.barcode(Barcode.upcA(barData));

This is the error:

Reloaded 53 of 1247 libraries in 2,725ms. D/BluetoothBasicPlugin( 9801): start scan D/BluetoothAdapter( 9801): STATE_ON D/BluetoothLeScanner( 9801): onClientRegistered() - status=0 clientIf=5 mClientIf=0 D/BluetoothAdapter( 9801): STATE_ON I/flutter ( 9801): UI: Devices found Instance of 'Future<int>' D/BluetoothAdapter( 9801): STATE_ON D/BluetoothLeScanner( 9801): could not find callback wrapper D/BluetoothSocket( 9801): try to open PaxInternalPrinter D/BluetoothSocket( 9801): =====[tangkw]:to connect BT_Printer... W/BluetoothAdapter( 9801): getBluetoothService() called with no BluetoothManagerCallback D/BThermalPrinterPlugin( 9801): android.bluetooth.device.action.ACL_CONNECTED D/BluetoothBasicPlugin( 9801): stateStreamHandler, current action: android.bluetooth.device.action.ACL_CONNECTED E/DeviceConnFactoryManager( 9801): wait read D/BluetoothSocket( 9801): write PaxInternalPrinter:@Ha1k�12345678904�d D/BluetoothSocket( 9801): D/BluetoothSocket( 9801): D/BluetoothSocket( 9801): D/BluetoothSocket( 9801): D/BluetoothSocket( 9801): V0 D/BluetoothSocket( 9801): write PaxInternalPrinter: W/System.err( 9801): java.io.IOException: bt socket closed, read return: -1 W/System.err( 9801): at android.bluetooth.BluetoothSocket.read(BluetoothSocket.java:630) W/System.err( 9801): at android.bluetooth.BluetoothInputStream.read(BluetoothInputStream.java:96) W/System.err( 9801): at java.io.InputStream.read(InputStream.java:101) W/System.err( 9801): at com.gprinter.io.BluetoothPort.readData(BluetoothPort.java:130) W/System.err( 9801): at com.tablemi.flutter_bluetooth_basic.DeviceConnFactoryManager.readDataImmediately(DeviceConnFactoryManager.java:418) W/System.err( 9801): at com.tablemi.flutter_bluetooth_basic.DeviceConnFactoryManager$PrinterReader.run(DeviceConnFactoryManager.java:498) E/BluetoothPort( 9801): connection device is lost E/DeviceConnFactoryManager( 9801): read 0 W/BluetoothAdapter( 9801): getBluetoothService() called with no BluetoothManagerCallback D/BThermalPrinterPlugin( 9801): android.bluetooth.device.action.ACL_DISCONNECTED D/BluetoothBasicPlugin( 9801): stateStreamHandler, current action: android.bluetooth.device.action.ACL_DISCONNECTED

luissouza avatar Mar 12 '20 01:03 luissouza

Does your printer support printing barcodes? What's your printer model, please?

andrey-ushakov avatar Mar 13 '20 20:03 andrey-ushakov

@andrey-ushakov

I'm using an android machine that has a Bluetooth printer attached. Answering your question, yes the printer supports the printing of barcodes, I have other developers who managed to print without any problem (with react). I contacted the supplier and he told me that there is no restriction on that.

Can you look at the error log and try to find a solution for this equipment? I would be very grateful, I really don't know what happens. Link with the equipment image: https://assets.pagseguro.com.br/shop-web-assets/v3.8.4/ps-products-assets/img/moderninha_smart_camera/photos/[email protected]

luissouza avatar Mar 13 '20 22:03 luissouza

Hi Guys!

I'm glad I found this post.

I also want to create a Java based web application with Bluetooth technology. I want to be able to connect to my Bluetooth barcode scanner so that I can scan bar code and store it in my database and also scan bar code to retrieve information from database.

I see that there are 2 kinds of Bluetooth profiles. One is called Serial Port Profile (SPP) and the other one is called Human Interface Device (HID).

I bought a Bluetooth from Amazon. It scans perfectly any barcode on the product labels and displays the barcode information on my Notepad, Word, etc.

But I want the barcode scanner to work in the background without interfering my other programs.

Let's say program A is my inventory program with built-in barcode feature. When I'm scanning barcode and at the same time I'm using in Word or Notepad to type my other reports, I don't want the barcode to display in my Word or Notepad. The barcode should automatically be scanned into my program A's database. It must work in the background.

What is the solution to this? Is there a Java API I can use? If there is, does it work for the web application or for desktop application?

Thanks!

Henry

cooljetdi avatar Apr 12 '20 15:04 cooljetdi

@luissouza I'm using a moderinha smart identical your device. Any anwser for this issue?

donemerson avatar Dec 04 '20 16:12 donemerson