简体   繁体   中英

How can I limit Zebra TC520K touch computer scanner to only scan 9 digit barcodes?

I have a problem when scanning barcodes with the Zebra TC520K touch computer barcode scanner. In my case, there are several barcodes printed close to each other. But it's only one of those barcodes that I am interested in scanning. The problem is that if I don't aim exactly the right way, the scanner scans the wrong barcodes next to the one I'm interested in scanning. The specific barcode I want to scan is a specific value format, the format is a value consisting of 9 digits (0-9). Some examples: "123456789" or "012301231". Is there a in-built feature, method or property in the Android Java EMDK I can use to filter this specific barcode I'm interested in? How can I do this?

I saw that there is an option for selecting different decoders, but I don't think that is specific enough to only target barcodes with a value of 9 digits.

Thanks!

Update:

I tried setting the decoder code128 to length 9 with both length1 and length2 . But the barcode scanner still scans all barcodes, no only the one with a 9 digit length. Here is how I initialize the scanner and sets the scanner config:

// Method to initialize and enable Scanner and its listeners
    public void initializeScanner() throws ScannerException {
        if (scanner == null) {
            // Get the Barcode Manager object
            barcodeManager = (BarcodeManager) this.emdkManager
                    .getInstance(EMDKManager.FEATURE_TYPE.BARCODE);
            // Get default scanner defined on the device
            scanner = barcodeManager.getDevice(BarcodeManager.DeviceIdentifier.DEFAULT);
            // Add data and status listeners
            scanner.addDataListener(this);
            scanner.addStatusListener(this);
            // Hard trigger. When this mode is set, the user has to manually
            // press the trigger on the device after issuing the read call.
            // scanner.triggerType = Scanner.TriggerType.HARD;
            scanner.triggerType = Scanner.TriggerType.SOFT_ALWAYS;

            // Enable the scanner
            scanner.enable();

            // Scan Mode set to Multi Barcode
            ScannerConfig sc = scanner.getConfig();
            sc.readerParams.readerSpecific.imagerSpecific.scanMode = ScannerConfig.ScanMode.SINGLE_BARCODE;
            sc.decoderParams.code128.length1 = 9;
            sc.decoderParams.code128.length2 = 9;
            sc.readerParams.readerSpecific.imagerSpecific.beamTimer = 0;
            sc.readerParams.readerSpecific.imagerSpecific.aimTimer = 0;
            scanner.setConfig(sc);

            // Starts an asynchronous Scan. The method will not turn ON the
            // scanner. It will, however, put the scanner in a state in which
            // the scanner can be turned ON either by pressing a hardware
            // trigger or can be turned ON automatically.
            try {

                    scanner.addDataListener(this);

                    // Scan Mode set to Multi Barcode
                    //ScannerConfig sc = scanner.getConfig();
                    sc.readerParams.readerSpecific.imagerSpecific.scanMode = ScannerConfig.ScanMode.SINGLE_BARCODE;
                    // Thread.sleep(100);
                    sc.decoderParams.code128.length1 = 9;
                    sc.decoderParams.code128.length2 = 9;
                    sc.readerParams.readerSpecific.imagerSpecific.beamTimer = 0;
                    sc.readerParams.readerSpecific.imagerSpecific.aimTimer = 0;
                    // Thread.sleep(100);
                    scanner.setConfig(sc);

                    // scanner.read();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }

Do I have to disable all the other decoders for this to work? Do I have to only enable the code128 decoder or what's wrong?

Yes, this can be done on a per-symbolgy basis using the EMDK. Under decoder params , select the decoder, eg Code 128 and set length 1 and length 2 to the same value, in your case 9.

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