'How do I correctly capture data from a Symbol LS2208 barcode scanner with java

I have been asked to develop a java desktop swing application that reads barcodes and processes data based on products with the relevant barcode.

The barcode scanner we're using is a Symbol LS2208 usb scanner and when it came there was no instructions or cd in the box. We plugged it in, it beeped at us and were able to scan barcode values into notepad as a test.

In my application, how do I ensure that the scanner populates data into the relevant textbox and how do I know when the entire barcode has been scanned? Or how to get barcode Scannar input in my application?



Solution 1:[1]

James already answered most of your questions. This question is already a little bit old, but this might serve people with the same question in the future.

When you connect your scanner through USB, in particular the Zebra scanner (Symbol is part of Zebra Technologies nowadays), it will typically be recognized as a USB HID device by default. See the link Fildor shared for more information on HID Emulation.

So each time you scan the barcode scanner will translate the encoded information as keystrokes since it's emulating a keyboard. If there is a text field in your application in which you can type, it should also be possible for you to scan into it.

For more information, please see this portal for the PRG (product reference guide).

For Zebra's configuration utility, 123Scan². With the latter you can set the scanner to send a suffix or a prefix, such as Enter or Tab.

Solution 2:[2]

You can work with your scanner via System.in if you connect it to USB. Also you can use USB-COM emulator and work with it as you work with com-port. More information here

http://rxtx.qbang.org/wiki/index.php/Writing_%22Hello_World%22_to_a_USB_to_serial_converter

Solution 3:[3]

This type of scanner is a "Human Interface Device," also known as an HID. This type of scanner can provide input to software anywhere a keyboard can be used to provide input.

In my application, how do I ensure that the scanner populates data into the relevant textbox?

  • Your application would not normally be responsible for that. Normally, the user has the responsibility of using the scanner when the relevant textbox has the focus.

How do I know when the entire barcode has been scanned?

  • The scanner should take care of that. It should transmit its data only when it senses a complete barcode has been scanned.

How to get barcode Scannar input in my application?

  • The same way you would get data typed from a keyboard in your application. You can use stdin (System.in in Java). If you are using a GUI, you can use a text field, text box, text edit pane, etc.

So, the short answer is this: Write the application as if you didn't have a barcode scanner.

This applies regardless of the language you use to code your application.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 YvdW
Solution 2 ????? ??????
Solution 3