Reading barcode in wpf
I am working on reading a barcode using a scanner and I have the following questions:
- Is there a way to distinguish input from keyboard and input from scanner? This is necessary for me because the barcode reader will include a preamble, terminator and prefix to the barcode value. For example, if the value is 12345, the barcode will have \ pre12345 \ where \ and \ indicate start and end, and pre-identify the data type. If I know that data is being entered from the keyboard and not from the scanner, I would show everything that the user enters. If I know the data is from a scanner, then I have separated the \ pre and \ and only show the data.
Thank,
source to share
My answer assumes that you are using a barcode scanner in "keyboard" mode, where it just emulates a keyboard and has no special connection. These devices are often USB and work that way out of the box with no additional configuration required.
Will the user ever get text \pre
? Often the prefix is ββchosen specifically to be a set of characters that the user will never enter, or at least very rarely wants to enter. Thus, the mere presence of the prefix indicates the scanned barcode.
Another option would be input time. For example, logging in from a barcode scanner is likely to complete in a very short time (eg 50ms). If the user entered a value from the keyboard, it would be impossible for the user to enter the prefix, data, and postfix within 50ms. (Of course, the assumption here is that the input will be done by an actual person and not by automated tools.)
source to share