1、生成读写器:
ImpinjReader reader = new ImpinjReader);
以下说明reader是ImpinjReader的一个实例。
2、链接相关接口:
reader.Connectip_str); 连接到指定的读写器上,ip_str:ip地址字符串;
reader.Disconnect); 去连接;
3、启动和停止读写器
reader.Start);
reader.Stop);
4、配置相关接口
reader.QueryDefaultSettings); 获取读写器默认配置,返回Settings对象;
reader.ApplySettingssettings); 应用配置,settings是Settings对象;
5、事件回调函数:
5.1 tagReported相关属性
reader.TagsReported += OnTagsReported; 添加TagReported回调处理函数;
OnTagsReported格式如下:
OnTagsReportedImpinjReader sender, TagReport report)
6.settings配置属性
6.1 report相关的属性设置
settings.Report.IncludeAntennaPortNumber = true;
settings.Report.IncludeFastId = true;
6.2 filter相关属性配置
// Setup a tag filter.
// Only the tags that match this filter will respond.
// First, setup tag filter #1.
// We want to apply the filter to the EPC memory bank.
settings.Filters.TagFilter1.MemoryBank = MemoryBank.Epc;
// Start matching at the third word bit 32), since the
// first two words of the EPC memory bank are the
// CRC and control bits. BitPointers.Epc is a helper
// enumeration you can use, so you don’t have to remember this.
settings.Filters.TagFilter1.BitPointer = BitPointers.Epc;
// Only match tags with EPCs that start with “3008”
settings.Filters.TagFilter1.TagMask = “3008”;
// This filter is 16 bits long one word).
settings.Filters.TagFilter1.BitCount = 16;
// Next, setup tag filter #2
// This filter will apply to the User memory bank.
settings.Filters.TagFilter2.MemoryBank = MemoryBank.User;
// Start matching on the third bit bit pointer is zero-based)
settings.Filters.TagFilter2.BitPointer = 2;
// Only match tags that have the third bit of User memory set.
// Mask = 0x08 hex) = 1000 bin)
settings.Filters.TagFilter2.TagMask = “8”;
// Filter is 1 bit long
settings.Filters.TagFilter2.BitCount = 1;
// To test this filter, write 0x2000 to
// the first word of User memory.
// 0x2000 hex) = 0010000000000000 bin)
// Set the filter mode.
// Both filters must match.
settings.Filters.Mode = TagFilterMode.Filter1AndFilter2;
6.3 gpio相关属性配置
// Start reading tags when GPI #1 goes high. settings.Gpis.GetGpi1).IsEnabled = true; settings.Gpis.GetGpi1).DebounceInMs = 50; settings.AutoStart.Mode = AutoStartMode.GpiTrigger; settings.AutoStart.GpiPortNumber = 1; settings.AutoStart.GpiLevel = true; // Stop reading tags when GPI #1 goes low. settings.AutoStop.Mode = AutoStopMode.GpiTrigger; settings.AutoStop.GpiPortNumber = 1; settings.AutoStop.GpiLevel = false;