我的RFID阅读器如何只读取一次RFID标签?

时间:2016-02-21 00:39:12

标签: c# sdk rfid

我有impinj高速公路读卡器,我正在使用impinj Ocatne SDK for .net和visual studio 2013(c#)来测试和部署设备。作为第一个练习,我执行了Ocatne SDK的示例“readtags(如下所述),所以读者多次读取标签,直到我放弃运行。但是,我想知道读者如何只读取一次标签 感谢

static void Main(string[] args)
    {
        try
        {
            // Connect to the reader.
            // Change the ReaderHostname constant in SolutionConstants.cs 
            // to the IP address or hostname of your reader.
            reader.Connect(SolutionConstants.ReaderHostname);

            // Get the default settings
            // We'll use these as a starting point
            // and then modify the settings we're 
            // interested in.
            Settings settings = reader.QueryDefaultSettings();

            // Tell the reader to include the antenna number
            // in all tag reports. Other fields can be added
            // to the reports in the same way by setting the 
            // appropriate Report.IncludeXXXXXXX property.
            settings.Report.IncludeAntennaPortNumber = true;

            // The reader can be set into various modes in which reader
            // dynamics are optimized for specific regions and environments.
            // The following mode, AutoSetDenseReader, monitors RF noise and interference and then automatically
            // and continuously optimizes the reader’s configuration
            settings.ReaderMode = ReaderMode.AutoSetDenseReader;
            settings.SearchMode = SearchMode.DualTarget;
            settings.Session = 2;

            // Enable antenna #1. Disable all others.
            settings.Antennas.DisableAll();
            settings.Antennas.GetAntenna(1).IsEnabled = true;

            // Set the Transmit Power and 
            // Receive Sensitivity to the maximum.
            settings.Antennas.GetAntenna(1).MaxTxPower = true;
            settings.Antennas.GetAntenna(1).MaxRxSensitivity = true;
            // You can also set them to specific values like this...
            //settings.Antennas.GetAntenna(1).TxPowerInDbm = 20;
            //settings.Antennas.GetAntenna(1).RxSensitivityInDbm = -70;

            // Apply the newly modified settings.
            reader.ApplySettings(settings);

            // Assign the TagsReported event handler.
            // This specifies which method to call
            // when tags reports are available.
            reader.TagsReported += OnTagsReported;

            // Start reading.
            reader.Start();
// Wait for the user to press enter.
            Console.WriteLine("Press enter to exit.");
            Console.ReadLine();


            // Stop reading.
            reader.Stop();

            // Disconnect from the reader.
            reader.Disconnect();
        }
        catch (OctaneSdkException e)
        {
            // Handle Octane SDK errors.
            Console.WriteLine("Octane SDK exception: {0}", e.Message);
        }
        catch (Exception e)
        {
            // Handle other .NET errors.
            Console.WriteLine("Exception : {0}", e.Message);
        }
    }

    static void OnTagsReported(ImpinjReader sender, TagReport report)
    {
        // This event handler is called asynchronously 
        // when tag reports are available.
        // Loop through each tag in the report 
        // and print the data.

        foreach (Tag tag in report)
        {
            Console.WriteLine("voici l'antenne : {0}, EPC : {1} ", tag.AntennaPortNumber, tag.Epc);

        }
    }

2 个答案:

答案 0 :(得分:0)

如果您将搜索模式设置为' Single Target'并且使用会话2,读者将(物理上)仅在标签进入字段时读取一次标签,并且当它已经离开字段超过几秒钟时将再次读取标签。这也将提高读取性能(读者可以有更多时间阅读其他标签)。

您当然也可以在软件中进行过滤,并跟踪已经读取的EPC。

有关RFID会话的更多背景信息,请参阅此处:https://github.com/rainrfid/overview/wiki/2.-The-protocol

答案 1 :(得分:0)

当你使用Session 2和Single Target时,标签只会响应一次,直到它离开该字段超过一定的时间。