Search code examples
c#asp.netvb.netbarcode-scannerdatamatrix

Barcode scanner | Read the first part of the barcode only


I am currently developping a web application that needs to be able to read datamatrix codes that contain multiple values ( all seperated by pipes ). This code contains about 70-80 characters and I only need the first 10.

I am using a simple javascript regex that allows me to detect when those 10 characters are entered and I then trigger a postback.

So that is how it works: When I scan the code and see that I have the part I need, I trigger a postback, do some logic on the backend, and then, put back the focus on the input used for scanning so that the user can scan again.

The problem is: When I set the focus back to the input, the scanner continues to output the rest of the previous datamatrix code ! ( the scanner takes about 1-1.2 seconds to scan the complete code ), so if my backend logic is faster than that, it won't be finished, even after my postback. )

My question is: Is there something I can do about it ?

Here are two of the solutions that I have but that are not ideal at all:

  • Use some sort of a javascript timer that would allow me to detect whenever the scanner has finished ( the problem is that, I don't want to wait for the scanner to finish before scanning a new code )

  • Put another datamatrix that contains only this value ( This would be my last solution since it would impact a lot of things )


Solution

  • Although I would have liked to find an in-code solution, I found another solution.

    I found out that I could change the scanner's speed using a configuration page. I put it at "fast" and now I receive the string almost all at once. ( Not event .2 seconds )

    I just don't know why fast isn't the default option..