将摩托罗拉扫描仪 SDK 与 DS9808-SR rfid 阅读器一起使用:始终从属性 35009 接收“未找到标签”

Posted

技术标签:

【中文标题】将摩托罗拉扫描仪 SDK 与 DS9808-SR rfid 阅读器一起使用:始终从属性 35009 接收“未找到标签”【英文标题】:use Motorola scanner SDK with DS9808-SR rfid reader: Always receive "tag not found" from attribute 35009 【发布时间】:2014-06-05 20:54:56 【问题描述】:

我正在使用 Motorola Scanner SDK 和 Motorola DS9808-SR rfid reader 测试CS8300 RFID tag。

基本上,所有简单的任务都可以工作:让扫描仪发出哔哔声,通过属性 35001 获取 epcID 等; 除了:

在通过属性 35002 指定标签 ID 后,我总是从属性 35009 获得状态 2(这意味着“未找到标签”)。注:Attribute Explained in this doc

正如您在我的代码中看到的(大约第 80 行“属性 35002 设置”),我尝试了许多不同格式的 epcID,例如 0080B0403C0000000C015F85 0x00 0x0 0x00 0x80 0xb0 0x40 0x3c 0x00 0x00 0x00 0x0x85 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 em>, 但没有一个工作。

我错过了什么?顺便说一句,我已经测试了几个 BAP 标签。标签本身很好,因为它们可以被其他阅读器/SDK 读取。

我的代码:

using System;
using System.Collections.Generic;
using System.Text;
using CoreScanner;

namespace SampleApplication

    class Program //page 118 Motorola Scanner SDK for Windows Developer Guide.pdf
    
        // Declare CoreScannerClass
        static CCoreScannerClass cCoreScannerClass;
        static void Main(string[] args)
        
            //Instantiate CoreScanner Class
            cCoreScannerClass = new CCoreScannerClass();
            //Call Open API
            short[] scannerTypes = new short[1]; // Scanner Types you are interested in
            scannerTypes[0] = 1; // 1 for all scanner types
            short numberOfScannerTypes = 1; // Size of the scannerTypes array
            int status; // Extended API return code
            cCoreScannerClass.Open(0, scannerTypes, numberOfScannerTypes, out status);
            if (status == 0)
            
                Console.WriteLine("CoreScanner API: Open Successful");
            
            else
            
                Console.WriteLine("CoreScanner API: Open Failed");
            
            // Lets list down all the scanners connected to the host
            short numberOfScanners; // Number of scanners expect to be used
            int[] connectedScannerIDList = new int[255];
            // List of scanner IDs to be returned
            string outXML; //Scanner details output
            cCoreScannerClass.GetScanners(out numberOfScanners, connectedScannerIDList, out outXML, out status);
            Console.WriteLine(outXML);

            //// Let's beep the beeper
            //int opcode = 6000; // Method for Beep the beeper
            //string outXMLBeep; // Output
            //string inXML = "<inArgs>" +
            //    "<scannerID>1</scannerID>" + // The scanner you need to beep
            //    "<cmdArgs>" +
            //    "<arg-int>3</arg-int>" + // 4 high short beep pattern
            //    "</cmdArgs>" +
            //    "</inArgs>";
            //cCoreScannerClass.ExecCommand(opcode, ref inXML, out outXMLBeep, out status);
            //Console.WriteLine(outXMLBeep);//null

            //// Let's set the UPC-A enable/disable
            //int opcode = 5004; // Method for Set the scanner attributes
            //string outXMLUPC; // XML Output
            //string inXML = "<inArgs>" +
            //    "<scannerID>1</scannerID>" +                // The scanner you need to get the information (above)
            //    "<cmdArgs>" +
            //    "<arg-xml>" +
            //    "<attrib_list>" +
            //        "<attribute>" +
            //        "<id>1</id>" +                // Attribute number for UPC-A from the Attribute Data Dictionary (above)
            //        "<datatype>F</datatype>" +
            //        "<value>False</value>" +
            //        "</attribute>" +
            //    "</attrib_list>" +
            //    "</arg-xml>" +
            //    "</cmdArgs>" +
            //    "</inArgs>";//This method does not show any output but it sets the UPC-A to enable (True) or disable (False).
            //cCoreScannerClass.ExecCommand(opcode, ref inXML, out outXMLUPC, out status);
            //Console.WriteLine(outXMLUPC);

            // Let's set the user data reading attributes
            int opcode = 5004; // Method for Set the scanner attributes
            string outXMLUserData0; // XML Output
            string inXML = "<inArgs>" +
                "<scannerID>1</scannerID>" +                // The scanner you need to get the information (above)
                "<cmdArgs>" +
                "<arg-xml>" +
                "<attrib_list>" +
                    "<attribute>" +
                        "<id>35002</id>" +
                        "<datatype>A</datatype>" +//<!-- get it using <attrib_list>35001</attrib_list> -->0080B0403C0000000C015F85
                        "<value>000e08800080B0403C0000000C015F85</value>" +//0x00 0x0e 0x08 0x80 0x00 0x80 0xb0 0x40 0x3c 0x00 0x00 0x00 0x0c 0x01 0x5f 0x85 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00            000e08800080B0403C0000000C015F85000000000000000000000000000000000000
                    "</attribute>" +
                    "<attribute>" +//"<!-- bank -->" +
                        "<id>35003</id>" +
                        "<datatype>B</datatype>" +
                        "<value>3</value>" +
                    "</attribute>" +
                    "<attribute>" +//"<!-- offset -->" +
                        "<id>35005</id>" +
                        "<datatype>W</datatype>" +
                        "<value>1</value>" +
                    "</attribute>" +
                    "<attribute>" +//                    "<!-- length -->" +
                        "<id>35006</id>" +
                        "<datatype>W</datatype>" +
                        "<value>0</value>" +
                    "</attribute>" +
                    "<attribute>" +//                    "<!-- command -->" +
                        "<id>35008</id>" +
                        "<datatype>B</datatype>" +
                        "<value>1</value>" +
                  "</attribute>" +
                "</attrib_list>" +
                "</arg-xml>" +
                "</cmdArgs>" +
                "</inArgs>";
            cCoreScannerClass.ExecCommand(opcode, ref inXML, out outXMLUserData0, out status);
            Console.WriteLine(status);

            // Let's retrieve assert tracking information
            int opcode1 = 5001; // Method for Get the scanner attributes
            string outXMLRetrieve; // XML Output
            string inXML1 = "<inArgs>" +
                "<scannerID>1</scannerID>" + // The scanner you need to get the information
                "<cmdArgs>" +
                "<arg-xml>" +
                "<attrib_list>35009,35004</attrib_list>" + // attribute numbers you need
                "</arg-xml>" +
                "</cmdArgs>" +
                "</inArgs>";
            cCoreScannerClass.ExecCommand(opcode1, ref inXML1, out outXMLRetrieve, out status);
            Console.WriteLine(status + "\r\n" + outXMLRetrieve);

            if (System.Diagnostics.Debugger.IsAttached)
                Console.ReadLine();
        
    

【问题讨论】:

【参考方案1】:

数组类型属性应该是空格分隔的十六进制缓冲区。

所以35002 应该格式化为0x00 0x0e 0x08 0x80 0x00 0x80 0xb0 0x40 0x3c 0x00 0x00 0x00 0x0c 0x01 0x5f 0x85 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00

你能告诉我设置属性号35008的原因是什么吗?

【讨论】:

感谢您的快速回复。 1.“分隔的十六进制缓冲区”格式正是我尝试过的选项之一。 2. 35008 值为 1 表示 READ。 xml 代码来自本文档的第 5 页:goo.gl/crcnlG

以上是关于将摩托罗拉扫描仪 SDK 与 DS9808-SR rfid 阅读器一起使用:始终从属性 35009 接收“未找到标签”的主要内容,如果未能解决你的问题,请参考以下文章

摩托罗拉 MC3190 掌上电脑的 windows 6.0 ce 任务管理器

如何通过斑马DS3608将条形码扫描到文本框中 - C#

SE955 激光扫描头设置 通过SSI串口进行设置

[TSG开发]法如扫描仪SDK探幽-1.旧版SDK采集流程问题解析常见参数

Autel Maxidas DS808全套问题与解答(FAQ)

将 Visual Studio 与 TWL/Nitro SDK 一起使用