最近做物联网自动识别技术,遇到一个算法难题,如下发给大家分享:

1 问题描述

2.流程图稍后上,

3.编码实现

编码实现using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using log4net;
using Org.LLRP.LTK.LLRPV1;
using Org.LLRP.LTK.LLRPV1.DataType;
using Org.LLRP.LTK.LLRPV1.Impinj;
using System.Collections.Concurrent;
using System.Diagnostics;
using System.Collections.ObjectModel;
using com.dn.Edgenode.Plugins.Data;
using com.dn.Edgenode.Plugins.Rfid.Impinj;
using com.dn.Edgenode.Plugins.Rfid.Impinj.Config;
using System.Text.RegularExpressions;namespace com.dn.
{internal class TagFilter : Filter<NormalizedData>{private static ILog log = log4net.LogManager.GetLogger("com.dn.Edgenode.Log.Engine.Plugin");private Dictionary<string, DateTime> tagGroupTimeDic = new Dictionary<string, DateTime>();public object device { get; set; }public override Func<NormalizedData, bool> Condition{get{return FilterEpcByConf;}set{throw new NotImplementedException();}}private bool FilterEpcByConf(NormalizedData dataSource){bool re = false;ReaderSite rs = this.device as ReaderSite;string epc = dataSource.Data["Epc"].ToString();#region Fiter by Regex ruleif (!string.IsNullOrEmpty(rs.ReaderCfg.filter.rule.Value) && !rs.ReaderCfg.filter.rule.operation.Equals(null)){if (Regex.IsMatch(epc, rs.ReaderCfg.filter.rule.Value)){if (rs.ReaderCfg.filter.rule.operation == readerCfgFilterRuleOperation.Submit){//do nothing// continue Fiter by Time.}else if (rs.ReaderCfg.filter.rule.operation == readerCfgFilterRuleOperation.None){//Ignored Fiter by Timereturn false;}}}#endregion#region Fiter by TimereaderCfgTagGroup tagsArray = rs.ReaderCfg.tagGroups.Where(p => p.tag.Contains(epc)).FirstOrDefault();//epc not in config or this tag's tagGroup is disanable ,Submit dataif (tagsArray == null || tagsArray.Enabled == false || tagsArray.tag == null || tagsArray.tag.Length == 0){re = true;}else{DateTime dtNow = DateTime.Now;if (!tagGroupTimeDic.ContainsKey(epc)){//Submit datare = true;}else{DateTime epcTime = tagGroupTimeDic[epc];//find max time, it is the last time of reading the any of tags in the group.foreach (string epcItem in tagsArray.tag){if (tagGroupTimeDic.ContainsKey(epcItem)){epcTime = tagGroupTimeDic[epcItem] > epcTime ? tagGroupTimeDic[epcItem] : epcTime;}}//check timeif (dtNow.Subtract(epcTime).TotalMilliseconds > tagsArray.readingTimeout){re = true;// the timespan is greater than reading timeout, it means the group of tags has left the reader before already.// so, remove all.(so the act will be as the same as the firs seen of them for the reader.)foreach (string epcItem in tagsArray.tag){if (tagGroupTimeDic.ContainsKey(epcItem)){tagGroupTimeDic.Remove(epcItem);}}}else{//do nothingre = false;}}// add/update the reading time.tagGroupTimeDic[epc] = dtNow;}if (!re){log.InfoFormat("EPC Ignored: {0}", epc);}#endregionreturn re;}}
}

转载于:https://www.cnblogs.com/sung/archive/2012/08/23/2652647.html

基于读取车载RFID标签自动开关车库门c#算法实现相关推荐

  1. 安卓设备门禁识别开发_基于Android和RFID的门禁管理系统

    基于 Android 和 RFID 的门禁管理系统 秦斌斌 ; 何极 ; 赵萌 ; 秦丽丽 [期刊名称] <无线通信技术> [年 ( 卷 ), 期] 2018(027)004 [摘要] 本 ...

  2. 基于stm32单片机RFID门禁刷卡/指纹识别系统

    基于stm32单片机RFID门禁刷卡/指纹识别系统 采用两种模式 1:通过rfid卡识别,读取卡号 2:通过指纹识别模块进行录入,对比 标价为资料设计编号,需要实物可问我 资料包含 原理图,程序,元器 ...

  3. RFID标签无法读取的原因有哪些

    RFID标签无法读取的原因有哪些?一套完整的方案包括RFID固定资产管理系统.RFID打印机.RFID标签.RFID读写器等.作为重要的组成部分,RFID标签假如出现什么问题,就会影响整个系统的进行. ...

  4. STM32系列(HAL库)——F103C8T6通过MFRC522、RFID射频卡、门禁卡模块读取卡片ID(二)

    本文继上一篇:STM32系列(HAL库)--F103C8T6通过MFRC522.RFID射频卡.门禁卡模块读取卡片ID 本文介绍在运用RC522模块时,运用链表结构存储数据的操作 Let's go! ...

  5. 毕业设计 基于stm32的RFID与指纹识别的门禁系统 (项目开源)

    文章目录 1 简介 2 绪论 2.1 课题背景与目的 3 射频识别 3.1 射频识别技术 3.2 射频识别模块 3.2.1 RFID模块 3.2.2 RFID模块组成 4 系统设计 4.1 系统架构 ...

  6. 基于 STM32 的 RFID 射频计数标签物联网ONENET平台全套资料

    基于 STM32 的 RFID 射频计数标签物联网ONENET平台(实物图+源程序+原理图+参考论文) 资料编号:018 该设计通过RC522识别IC卡,然后通过ESP8266上传到ONENET云平台 ...

  7. 【基于 Arduino 的 RFID门锁】

    [基于 Arduino 的 RFID门锁] 1. 概述 2. 射频识别的工作原理 3. RFID 和 Arduino 4. Arduino RFID门锁门禁项目 5. 源代码 在本教程中,我们将了解什 ...

  8. 安卓手机APP读写高频RFID标签(校园卡)NDEF格式数据设计

    ** 通过手机的NFC功能是否能够读取RFID标签 ** 可以读取部分标签 RFID标签有多种类型:依据频率的不同可分为低频(LF).高频(HF).超高频(UHF).微波(MW)电子标签. 1.高频卡 ...

  9. RFID图书馆藏书防盗安全门门禁系统的应用分析

    随着RFID射频识别技术的高速发展,图书馆正逐渐实行开方式的自助借阅模式,方便藏书管理和用户借阅图书,RFID技术的引入节省不少的借阅流程手续,它不仅节约了时间和人工成本,也开启了自助借阅的新篇章.虽 ...

最新文章

  1. HDLBits 系列(43)找 bug 专题
  2. CSS position属性absolute relative等五个值的解释
  3. 因OpenCV版本不一致所引发的报错
  4. ByteBuffer源码分析
  5. iOS中的唯一标示符
  6. BufferedInputStream学习笔记
  7. 42.Linux应用调试-初步制作系统调用(用户态-内核态)
  8. Dokcer使用总结(Dockerfile、Compose、Swarm)
  9. 浅谈linux中的grub
  10. 2019/04/11 网易互娱游戏研发工程师实习生一面面经(Offer到手)
  11. Exif 格式介绍和操作
  12. 如何才能使一个.mov文件无法用Quicktime播放器来转换格式
  13. Coloring Trees
  14. 直播实录|百度大脑EasyDL·NVIDIA专场 产品介绍及AI端计算技术架构解析
  15. 邱锡鹏 神经网络与深度学习课程【十六】——深度信念网络
  16. 2022.1.9 力扣-周赛-统计追加字母可以获得的单词数
  17. 经典例题C语言程序解决数学问题
  18. python numpy 二维数组reshape成三维数组
  19. 计算机实验室主要工作业绩范文,2020年实验室工作总结范文4篇
  20. AlphaFold2预测蛋白、肽结构网站简易版教程

热门文章

  1. 关于项目管理的一些想法
  2. string.format大全
  3. JAVA--虚函数,抽象函数,抽象类,接口
  4. [代码]HDU 4335 What is N?
  5. 许式伟《Go语言编程》章节摘录:Go语言简史
  6. property的修饰符
  7. Linux 下编译并运行C语言程序
  8. RelativeLayout和LinearLayout性能比较
  9. Win7局域网打印机共享设置(详细图文流程)
  10. 回文字符串—回文子串—Manacher算法