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,

+2


source to share


3 answers


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

+2


source


well yes! the input from the barcode scanner must first be initialized via the COM port or serial connection. I know that many applications restrict the input of certain fields to certain ports, but beyond that I'm not sure.



0


source


One solution I came across was to start all of our barcodes with a unique sequence of characters unknown to the user. I am checking this sequence in the input to let me know how the data was entered.

0


source







All Articles