kryssi
Junior Member
Posts: 19
|
Post by kryssi on Mar 5, 2024 13:24:46 GMT
Dear all,
We have been experiencing with captureKey functionality against an external barcode reader in HID mode (Zebra, Elo, etc). We have experienced strange behaviour with UPPERCASE characters that are missing shift, the shift character (59) comes after the key that should be upper-cased and in other cases there are missing key events.
After looking into the code, everything is fine on the java side until the callback is called on separate thread that seems to be the cause of the problem, more precisely this line:
new Thread(new KeyEventRunnable(record,CAPTURE_KEY_VALUE,returnKeyCode)).start();
I see that someone has commented out the way it used to be:
//record.getResult().set(returnMap); //fire the callback
So there must be some reason for doing this asynchronously, I've created small fix for my case where the characters from scanner come really quick one after each other:
if(keyCode !=0 ) { Thread t = new Thread(new KeyEventRunnable(record,CAPTURE_KEY_VALUE,returnKeyCode)); t.start(); try { t.join(20); } catch (InterruptedException ex) { Logger.E(TAG, ex); } }
This works for my case. I used 20 ms as it's used in many cases in the scanner setting as "medium delay". Anyway if I configured the scanner to have 20ms or even 40ms between characters it didn't guarantee that the bug will not happen and out of order or missing character were occurring anyway.
I hope that you can review this fix or create another one that fixes this problem.
|
|
|
Post by Alex Epifanov on Mar 13, 2024 22:43:16 GMT
Thanks, we'll review this.
|
|
|
Post by Alex Epifanov on Apr 10, 2024 11:13:29 GMT
|
|