shaxxx / flutter_barcode_listener

Flutter widget to listen for scanned barcode via hardware scanners
MIT License
45 stars 46 forks source link

Issue with Keyence reading #24

Closed selmaskopljakovic closed 1 year ago

selmaskopljakovic commented 2 years ago

Hello,

I tried to use this package for the Keyence device. My app runs at Keyence, but I can't detect scan triggers to use data with your example. Your idea is exactly what I need, scanning without focusing on TextBox and without a mobile keyboard, just to listen to triggers from the device. Do you have any idea why this is not working? Thank you!

Bisc0tt1 commented 2 years ago

Hi,

I ran into a similar issue. Keep in mind the callback onBarCodeScanned that gives your frontend actual data to work with won't be executed if the library thinks the final character entered wasn't an enter/linefeed. Most scanners will end the scanned payload that way, but not all of them. I myself was testing this on a Unitech PA760 and had to configure the device to terminate a scan with (linefeed) instead.

I would suggest to start by debugging the library itself, specifically the function onKeyEvent(). Confirm the characters are being registered when you scan by printing them to the debug console, then check if the if statement if (char == lineFeed) is actually entered. If not, it's almost certainly because your scanner isn't terminating its payload correctly.

BIG-BEARC commented 2 years ago

Hello, This was my solution hope it works for you

shaxxx commented 2 years ago

Solultion from @Bisc0tt1 is the right one. Check how you can configure scanner to emit linefeed end as it is industry standard.

selmaskopljakovic commented 2 years ago

Thank you guys so much! I will try it and come back with a feedback

selmaskopljakovic commented 2 years ago

Hello, ok, this is how I solved the reading barcode with Keyence:

  1. Settings of the device - Turn on Keystroke
  2. Settings of the device - Set terminator to Enter Key
  3. This is how I read data (keyEvent.data) as RawKeyEventDataAndroid).keyLabel

Have duplication, like 22334455 instead 2345. But That's easy to solve.

The only issue I'm struggling with is turning off the keyboard. I tried all that could be found on google, but still no good solution.

shaxxx commented 1 year ago

Closed as solved.