I am using honeywell barcode scanner(HF680). And I connected it to my Android Device(Desktop). I need to get the scanned data as text. It works like keyboard. So, It seems like I can't get the data internally like Camera Scanning.
How can I approach this?
I don't think Honeywell's supporting SDK nor Document. I can't find it.
The easiest way is probably to use an EditText
. The scanner input will go into it when it is focused. You can then read it from there.
It depends on the port you use. HF680 provides two different ports. If you use USB then, you can't use serial input. But it acts as keyboard. So, you can onKeyDown
method.
val barcode = StringBuilder("")
override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean {
// TODO: add up the chars
barcode.append(...)
return super.onKeyDown(keyCode, event)
}
And generally, scanners provides some feature that indicates the end such as '\n' or Enter key or special characters. Otherwise, you can set a receiving time so that after a few milliseconds it wouldn't append the string.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.