【问题标题】:How can I limit Zebra TC520K touch computer scanner to only scan 9 digit barcodes?如何将 Zebra TC520K 触摸式计算机扫描仪限制为只能扫描 9 位条形码?
【发布时间】:2020-12-02 00:23:35
【问题描述】:

我在使用 Zebra TC520K 触摸式计算机条码扫描器扫描条码时遇到问题。就我而言,有几个条形码彼此靠近打印。但这只是我有兴趣扫描的条形码之一。问题是,如果我没有准确地瞄准,扫描仪会在我有兴趣扫描的条形码旁边扫描错误的条形码。我要扫描的具体条码是一个具体的值格式,格式是一个由9位数字(0-9)组成的值。一些示例:“123456789”或“012301231”。 Android Java EMDK 中是否有内置功能、方法或属性可用于过滤我感兴趣的特定条形码?我该怎么做?

我看到有一个选择不同解码器的选项,但我认为这还不够具体,只能针对值为 9 位的条形码。

谢谢!

更新:

我尝试使用length1length2 将解码器code128 设置为长度9。但条码扫描器仍能扫描所有条码,而不仅仅是 9 位长度的条码。以下是我如何初始化扫描仪并设置扫描仪配置:

// 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();
            }
        }
    }

我是否必须禁用所有其他解码器才能使其正常工作?我只需要启用code128 解码器还是有什么问题?

【问题讨论】:

标签: java android barcode-scanner motorola-emdk


【解决方案1】:

是的,这可以使用 EMDK 在每个符号的基础上完成。在decoder params 下,选择解码器,例如代码 128 并将 length 1length 2 设置为相同的值,在您的情况下为 9。

【讨论】:

  • 嗨,请检查我在问题中的更新。感谢您的帮助。我试过但没有用。也许我做错了什么。
  • 我认为问题是您在扫描仪空闲时没有设置解码器,请参阅github.com/ZebraDevs/EMDK-Android-Samples/blob/master/…,因为在应用设置时扫描仪需要处于某种状态。也有可能条形码被扫描为更宽松的符号系统,例如 I2of5,您可以在 onData() 中调用 getLabelType() 来查看实际解码的符号系统。
猜你喜欢
  • 2020-11-18
  • 2012-08-08
  • 1970-01-01
  • 1970-01-01
  • 2020-10-08
  • 1970-01-01
  • 2020-12-03
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多