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.
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.