简体   繁体   中英

Motorola MC3190 strange behavior while scanning

I am writing an application to scan bar code and show it to the text box. I am using Motorola MC3190 device runs on Windows Embedded compact 7.0. To implement barcode scanning, I used Symbol.dll and Symbol.barcode.dll .

I have an issue that device is scanning the bar codes but eliminate the characters before and after the spaces. My code is

private void Form1_Load(object sender, EventArgs e)
    {
        txtBarcode.Focus();
        barcodeReader = new Symbol.Barcode.Reader();
        barcodeReaderData = new Symbol.Barcode.ReaderData(Symbol.Barcode.ReaderDataTypes.Text, Symbol.Barcode.ReaderDataLengths.MaximumLabel);
        barcodeReader.Actions.Enable(); 
        barcodeReader.ReadNotify += new EventHandler(barcodeReader_Read);  
        barcodeReader.Actions.Read(barcodeReaderData);      
    }

private void barcodeReader_Read(object sender, EventArgs e)
    {
        Symbol.Barcode.ReaderData nextReaderData = barcodeReader.GetNextReaderData();  
        txtBarcode.Text = nextReaderData.Text;
        barcodeReader.Actions.Read(barcodeReaderData);  
    }

This code scans bar codes without spaces.

FYI: Earlier Motorola MC3190 could not scan the characters before and after the spaces, but after contacting the Motorola support team, they told me some changes in the device. Now the device is accepting barcodes with spaces. I checked in datawedge demonstration.

Now I am using symbol assembly that means I am overriding the existing functionality in my code but no luck so far.

Edit: 在此处输入图片说明

When I scan this barcode in my application, it is skipping first digit 0 and last digit 2. textbox only shows 825610. But when I try scanning the same barcode in Datawedge Demonstration (software comes with device to test the barcode scanning) it shows 082566102

The missing zero is included in the barcode format. UPC-E barcodes can start with either a 0 or a 1, which are returned by the scanner as UPCE0 and UPCE1. The missing 2 is the check digit.

You can include these by setting:

barcodeReader.Decoders.UPCE0.Preamble = UPC.Preambles.System;
barcodeReader.Decoders.UPCE0.ReportCheckDigit = true;

The "spaces" only exist in the representation of the barcode for humans, they separate the system and checksum digits from the data that matters. There are no spaces encoded in the barcode itself.

(For more information about UPC-E barcodes see https://en.wikipedia.org/wiki/Universal_Product_Code#UPC-E )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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