0

Summary

I am trying to build a JAVA application (not android) that will interact with multiple barcode scanners and my plan was to use the EventInput in order to identify which keyboard (or barcode scanner) is sending the data. This would allow having different barcodes working at the same time to scan the elements in different operations.

e.g: 1 barcode operates for the inventory, 1 is operating for the sales, etc...

While I could theoretically add a prefix on the barcode scanner to identify it (e.g: barcode 0001 becomes xx-001), I would like to keep my code more generic and reusable, such that whoever uses it doesn't have to use more costly scanners which allow for the prefix function.

Expected result

The expected result would be to be able to recognize the MAC code, the ID, the hash or any other unique id of the keyboard on keypress.

Attempts

I've tried exploring the keypress event, but the closest I got was:

    public int uniqueIdTyped(KeyEvent e) {
        return e.getSource().hashCode();
    }

Which DOES return an id... but trying it with different devices (Kinesis keyboard, a random regular keyboard, leelbox portable keyboard, on-screen keyboard), I always get the same hashcode.

Tails128
  • 320
  • 4
  • 15
  • You can find the user manuals of many scanners by searching, so please check the contents that can be set carefully. [How can I add a Prefix value to my ds4208 barcode scanner](https://stackoverflow.com/q/52257971/9014308) I don't think any scanner has a general/standard way to get the information you want to get. It is most realistic to set a different prefix code for each scanner purpose. – kunif Sep 19 '21 at 15:15
  • In the first place, such information will not be acquired at the time of `KeyEvent`. To get that information, you'll need to deal with the low-level interface of the device driver, which needs to be customized for each operating system, rather than the standard interface. – kunif Sep 20 '21 at 07:21

0 Answers0