简体   繁体   English

条形码阅读器与C#的集成

[英]Barcode Reader integration with c#

I purchased datalogic quickscan QD2430 barcode reader/scanner for the purpose of scanning national identity cards. 我购买了datalogic quickscan QD2430条码读取器/扫描器,用于扫描国民身份证。 The purpose is to read the barcode on the id card and display the information in the textbox. 目的是读取身份证上的条形码并在文本框中显示信息。 Researching over the internet i found out that this scanner acts as a keyboard wedge and fires the keys on the keyboard after the scan. 通过互联网进行调查后,我发现该扫描仪充当键盘楔形物,并在扫描后触发键盘上的键。 Two issues iam facing here: 我在这里面临两个问题:

  1. This system is being built for security purposes as to not allow the guards to make the id editable so i need to disable the textbox and make it non-editable. 建立该系统是出于安全目的,不允许警卫使ID可编辑,因此我需要禁用文本框并使它不可编辑。 How can i do this in case of barcode scanner? 如果使用条形码扫描仪,该怎么办?

  2. Secondly mostly apis i came across over the internet said that they decode the barcode from the image files which makes it of no use to me? 其次,我在互联网上遇到的大多数api都说它们会解码图像文件中的条形码,这对我毫无用处?

PS: is it necessary to have my textbox focused for this kind of scanner? PS:是否有必要让我的文本框专注于这种扫描仪?

How can i obtain my desired operation neatly? 我如何才能整齐地获得所需的操作? Detailed guidance would be appreciated! 详细的指导将不胜感激!

  1. All the barcode scanner is for is speeding the process of hand typing the text in (at least for the model you have). 条码扫描器的全部作用是加快手动输入文本的过程(至少对于您所用的型号而言)。 There is nothing wrong with letting a guard type in the box, if the scanner breaks down do you want the guard to not be able to check people in at all or do you want him to be able to hand type in the barcodes in a pinch. 将防护栏输入框中没有任何问题,如果扫描仪出现故障,您是希望防护栏根本无法检查人员,还是希望他能够手动输入条码? 。

  2. Those libraries work with digial cameras, not barcode scanners, it is pretty hard to find a barcode scanner that does not act as a keyboard. 这些库使用数码相机而非条形码扫描仪工作,很难找到不充当键盘的条形码扫描仪。

  3. (your PS) Yes, you will need to have the text box focused, as I said in 1), the consumer level barcode readers like the one you have are designed to just make data entry faster. (您的PS)是的,就像我在1)中所说的那样,您需要使文本框对准焦点,像您所使用的那样,消费者级别的条形码读取器旨在使数据输入更快。 (EDIT: see Cory's comment , apparently some low end readers do provide a driver you can work with. If you can find a driver for yours that lets you communicate directly with the scanner you will no longer need to focus on the textbox) (编辑:请参阅Cory的评论 ,显然一些低端阅读器确实提供了您可以使用的驱动程序。如果您找到适合您的驱动程序,可以直接与扫描仪通信,则您不再需要专注于文本框。)

Barcode scanners normally just act as a keyboard and type the scanned code in really fast. 条形码扫描仪通常只充当键盘,然后以非常快的速度键入扫描的代码。 In my case I listened to the key-events, instead of using a TextBox, and determined if a valid barcode was entered in a fixed timeframe, and if it was I just executed some code. 在我的情况下,我不使用TextBox,而是监听按键事件,并确定是否在固定的时间范围内输入了有效的条形码,以及是否执行了一些代码。

  1. Because the barcode scanner acts as a keyboard and you have to listen to the key-events it is possible for a human to enter the code manually. 由于条形码扫描仪充当键盘,并且您必须聆听按键事件,因此人类可以手动输入代码。 But if you choose a small timeframe for the input it is nearly impossible for humans to enter it. 但是,如果您为输入选择一个小的时间范围,那么人类几乎不可能输入它。

  2. The image decoder libraries do not help in this situation because you have no cam. 在这种情况下,图像解码器库无济于事,因为您没有凸轮。

I listened for a key-event, remembered the time of this event and stored the key in a buffer (if the key is valid). 我听了一个按键事件,记起了该事件的时间,并将该按键存储在缓冲区中(如果该按键有效)。 On the next key-event I checked if the last event and this were no more than X milliseconds (you have to determine this value for yourself) apart and if it was (and the key was valid) added it to the buffer. 在下一个键事件中,我检查了最后一个事件是否相距不超过X毫秒(您必须自己确定此值),以及是否(且键有效)将其添加到缓冲区中。 I Repeated this over and over and if the Buffer validates to a complete Barcode, I executed some code. 我一遍又一遍地重复此步骤,如果缓冲区验证为完整的条形码,我将执行一些代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM