public void Add(TagReadData addData) { lock (new Object()) { string key = null; key = addData.EpcString; //if only keying on EPCID UniqueTagCounts = 0; TotalTagCounts = 0; if (!EpcIndex.ContainsKey(key)) { TagReadRecord value = new TagReadRecord(addData); value.SerialNumber = (uint)EpcIndex.Count + 1; EpcIndex.Add(key, value); _tagList.Add(value); //Call this method to calculate total tag reads and unique tag read counts UpdateTagCountTextBox(EpcIndex); Console.WriteLine("Add {0}", value); } else { EpcIndex[key].Update(addData); //ToDo update temperature UpdateTagCountTextBox(EpcIndex); } } }
/// <summary> /// Merge new tag read with existing one /// </summary> /// <param name="data">New tag read</param> public void Update(TagReadData newData) { int count = newData.ReadCount; newData.ReadCount += ReadCount; RawRead = newData; }
void AddTagToDic(TagReadData tag) { TagInfo tmptag = null; tagmutex.WaitOne(); string keystr = tag.EPCString; if (m_Tags.ContainsKey(keystr)) { tmptag = m_Tags[keystr]; tmptag.readcnt += tag.ReadCount; tmptag.RssiRaw = tag.Rssi; tmptag.Phase = tag.Phase; tmptag.antid = tag.Antenna; tmptag.Frequency = tag.Frequency; tmptag.timestamp = tag.Time; } else { TagInfo newtag = null; newtag = new TagInfo(tag.EPCString, tag.ReadCount, tag.Antenna, tag.Time, tag.Tag.Protocol, tag.EMDDataString); newtag.RssiRaw = tag.Rssi; newtag.Phase = tag.Phase; newtag.Frequency = tag.Frequency; m_Tags.Add(keystr, newtag); } tagmutex.ReleaseMutex(); }
public tagInfo(TagReadData tag) { epcid = tag.EPCString; readcnt = tag.ReadCount; antid = tag.Antenna; ebdata = tag.EPC; }
void AddTagToDic(TagReadData Tag, int MachID) { TagInfo tTagInfo; String EPC = Tag.EPCString; TagMux.WaitOne(); if (TagDic.ContainsKey(EPC)) { tTagInfo = TagDic[EPC]; tTagInfo.LastSeen = Tag.Time; tTagInfo.ReadCount++; tTagInfo.PosX = MachID; tTagInfo.PosY = Tag.Antenna; tTagInfo.Rssi = Tag.Rssi; } else { tTagInfo = new TagInfo(); tTagInfo.ReadCount = 1; tTagInfo.LastSeen = Tag.Time; tTagInfo.PosX = MachID; tTagInfo.PosY = Tag.Antenna; tTagInfo.Rssi = Tag.Rssi; TagDic.Add(EPC, tTagInfo); } TagMux.ReleaseMutex(); }
public ReadTags(TagReadData adddata) { epc = adddata.EpcString; timestamp = adddata.Time.ToString(); readcount = adddata.ReadCount.ToString(); rssi = adddata.Rssi.ToString(); }
private double getILianTemp(TagReadData RawRead) { //Console.WriteLine("### getILianTemp"); double temp = UNSPECTTEMP; if (RawRead.Data.Length > 0) { double temperature = 0; byte[] bdata = RawRead.Data; string sdata = ByteFormat.ToHex(bdata, "", ""); if (sdata.Trim().Equals("0000")) { return(0); } Console.WriteLine("sdata={0} {1} {2}", sdata, sdata.Substring(0, 2), sdata.Substring(2, 2)); int t1 = Convert.ToInt32(sdata.Substring(0, 2), 16); int t2 = Convert.ToInt32(sdata.Substring(2, 2), 16); temperature = (t1 - 30) + (t2 / (double)256); Console.WriteLine("t1={0}, t2={1}", t1 - 30, t2 / (double)256); Console.WriteLine("temperature=" + temperature); Console.WriteLine(); //temp = temperature; temp = Math.Round(temperature, 2);//保留两位小数 } return(temp); }
//protected string dataInReverseBase36 = null; public TagReadRecord(TagReadData newData) { lock (new Object()) { RawRead = newData; } }
private void updateTagData(TagReadData tag) { string EBdData = tag.EPCString; int isMem = EBdData.IndexOf("A"); if (isMem == 0) { if (EBdData.Length != 8) { return; } curEPC = EBdData; meb = InStock.getMemDetailByID(EBdData.Replace("A", "")); meb.EPCStr = EBdData; if (ID_Text.InvokeRequired) { Action <string> IDDel = (x) => { ID_Text.Text = x.ToString(); }; ID_Text.Invoke(IDDel, meb.name); } else { ID_Text.Text = meb.ID; } tagList.Add(new tagInfo(tag)); } else if (EBdData.IndexOf("B") == 0) { byte[] TIDByte = tag.EbdData; string TIDStr = ByteArrayToHexString(TIDByte); goodDetail good = InStock.getDetailByID(TIDStr); if (good == null) { tagList.Add(new tagInfo(tag)); return; } if (InStock.isSold(TIDStr) == 0) { InStock.refreshRFIDInfo(TIDStr, good.ID, 1); goodsDetailList.Add(good); if (details_Num.ContainsKey(good.name)) { ArrayList temp = details_Num[good.name]; temp[1] = (int)temp[1] + 1; temp[0] = (double)temp[0] + good.cost; } else { ArrayList temp = new ArrayList(); temp.Add(good.cost); temp.Add(1); details_Num.Add(good.name, temp); } tagList.Add(new tagInfo(tag)); } } }
public void Add(TagReadData addData) { lock (new Object()) { string key = null; if (chkbxUniqueByData) { if (true == chkbxShowFailedDataReads) { //key = addData.EpcString + ByteFormat.ToHex(addData.Data, "", " "); // When CHECKED - Add the entry to the database. This will result in // potentially two entries for every tag: one with the requested data and one without. if (addData.Data.Length > 0) { key = addData.EpcString + ByteFormat.ToHex(addData.Data, "", " "); } else { key = addData.EpcString + ""; } } else if ((false == chkbxShowFailedDataReads) && (addData.Data.Length == 0)) { // When UNCHECKED (default) - If the embedded read data fails (data.length==0) then don't add the entry to // the database, thus it won't be displayed. return; } else { key = addData.EpcString + ByteFormat.ToHex(addData.Data, "", " "); } } else { key = addData.EpcString; //if only keying on EPCID } UniqueTagCounts = 0; TotalTagCounts = 0; if (!EpcIndex.ContainsKey(key)) { TagReadRecord value = new TagReadRecord(addData); value.SerialNumber = (uint)EpcIndex.Count + 1; _tagList.Add(value); EpcIndex.Add(key, value); //Call this method to calculate total tag reads and unique tag read counts UpdateTagCountTextBox(EpcIndex); } else { EpcIndex[key].Update(addData); UpdateTagCountTextBox(EpcIndex); } } }
//protected string dataInReverseBase36 = null; public TagReadRecord(TagReadData newData) { lock (new Object()) { string tagno = newData.EpcString.ToString(); string antina = newData.Antenna.ToString(); DateTime dt = newData.Time; string message = BL.SaveTagDetails.SaveTag_details(tagno, antina); RawRead = newData; } }
public void Readsnyc() { code = 0; int timeout = 1300; TagReadData[] tags = new TagReadData[1]; tags = reader.Read(timeout); for (int i = 0; i < tags.Length; i++) { code += int.Parse(tags[i].EpcString.ToString()); } }
// read multiple registers from one tag singulated by its EPC public static short[] ReadMemBlockByEpc(Reader reader, TagReadData tag, Gen2.Bank bank, int address, int length, int attempts) { Gen2.Select resetFilter = CreateGen2Select(4, 4, Gen2.Bank.TID, 0x00, 16, new byte[] { 0xE2, 0x82 }); Gen2.Select epcFilter = CreateGen2Select(4, 0, Gen2.Bank.EPC, 0x20, tag.Epc.Length * 8, tag.Epc); MultiFilter selects = new MultiFilter(new Gen2.Select[] { resetFilter, epcFilter }); Gen2.ReadData operation = new Gen2.ReadData(bank, (uint)address, (byte)length); SimpleReadPlan config = new SimpleReadPlan(new int[] { tag.Antenna }, TagProtocol.GEN2, selects, operation, 1000); short[] values = null; try { reader.ParamSet("/reader/read/plan", config); for (int i = 0; i < attempts; i++) { if (values != null) { break; } TagReadData[] readResults = reader.Read(readTime); foreach (TagReadData readResult in readResults) { if (tag.EpcString.Equals(readResult.EpcString)) { byte[] dataBytes = readResult.Data; if (dataBytes.Length != 0) { values = ConvertByteArrayToShortArray(dataBytes); break; } } } } } catch (ReaderException e) { Console.WriteLine("Error: " + e.ToString()); Environment.Exit(-1); } if (values == null) { throw new SystemException("Tag not found"); } return(values); }
/// <summary> /// Merge new tag read with existing one /// </summary> /// <param name="data">New tag read</param> public void Update(TagReadData mergeData) { mergeData.ReadCount += ReadCount; TimeSpan timediff = mergeData.Time - this.TimeStamp; // Update only the read counts and not overwriting the tag // read data of the existing tag in tag database when we // receive tags in incorrect order. if (0 <= timediff.TotalMilliseconds) { RawRead = mergeData; } else { RawRead.ReadCount = mergeData.ReadCount; } OnPropertyChanged(null); }
public void Update(TagReadData mergeData) { //Console.WriteLine("*** Update " + mergeData.EpcString); mergeData.ReadCount += ReadCount; TimeSpan timediff = mergeData.Time.ToUniversalTime() - this.TimeStamp.ToUniversalTime(); // Update only the read counts and not overwriting the tag // read data of the existing tag in tag database when we // receive tags in incorrect order. if (0 <= timediff.TotalMilliseconds) { RawRead = mergeData; } else { RawRead.ReadCount = mergeData.ReadCount; } }
/// <summary> /// Function that processes the Tag Data produced by StartReading(); /// </summary> /// <param name="read"></param> void PrintTagRead(Object sender, TagReadDataEventArgs e) { BeginInvoke((Action) delegate { if (properties["audiblealert"].ToLower() == "yes") { if (readTriggeredByTap) { playBeepSound(); } } TagReadData read = e.TagReadData; UpdateReadTagIDBox(new TagReadData[] { read }); if (overTempFlag) { this.BeginInvoke(new OverTemperatureChange(ShowOverTemperature)); } }); }
private void RandomRFIDSender() { while (isRunning) { //104113BD500218B546455443 if (OnAfterTagRead != null) { EPCID = Guid.NewGuid().ToString("N"); //FakeTagReadData tagdata = new FakeTagReadData(); TagReadData tagdata = new TagReadData(); //OnAfterTagRead(this,new TagReadDataEventArgs(tagdata)); _ObjReader_TagRead(this, new TagReadDataEventArgs(tagdata)); // OnAfterTagRead.Invoke(this, ); } System.Threading.Thread.Sleep(3000); //_ObjReader_TagRead(this, new TagReadDataEventArgs(new TagReadData() { = Encoding.UTF8.GetBytes( Guid.NewGuid().ToString("N")) }); } }
private double getVBLTemp(string Tune, string NValue, TagReadData mergeData) { double temp = UNSPECTTEMP; double tune = 0.0; double nvalue = 0.0; //Console.WriteLine(mergeData.EpcString + " ,Tune=" + Tune + ", old_NValue=" + old_NValue + ", NValue=" + NValue); if (!old_NValue.Equals("") && old_NValue.StartsWith("3")) { if (NValue.StartsWith("0")) { //Console.WriteLine(mergeData.EpcString + " ,Tune=" + Tune + ", old_NValue=" + old_NValue + ", NValue=" + NValue); tune = parseVBLTune(Tune); nvalue = parseVBLNValue(old_NValue); double temperature = (nvalue + tune - 500) / 5.4817 + 24.9; //temp = temperature; temp = Math.Round(temperature, 2);//保留两位小数 } } old_NValue = NValue; return(temp); }
private void ProcessRfidTag(ReadingHead readingHead, TagReadData[] tags) { string[] epcdata = new string[tags.Count()]; for (int i = 0; i < tags.Count(); i++) { if (tags[i] != null) { epcdata[i] = tags[i].EPCString; AddLog("读到值:" + epcdata[i]); //ListViewItem item = new ListViewItem(); //listView1.Items.Add(epcdata[i]); //MessageBox.Show(epcdata[i]); } } }
public void Add(TagReadData addData) { lock (new Object()) { string key = null; if (tagdbSensorType == SensorType.Johar_106 || tagdbSensorType == SensorType.Johar_101) { key = addData.EpcString.Substring(0, 4); //Console.WriteLine("*** tagdb add key=" + key); } else { if (chkbxUniqueByData) { if (true == chkbxShowFailedDataReads) { //key = addData.EpcString + ByteFormat.ToHex(addData.Data, "", " "); // When CHECKED - Add the entry to the database. This will result in // potentially two entries for every tag: one with the requested data and one without. if (addData.Data.Length > 0) { key = addData.EpcString + ByteFormat.ToHex(addData.Data, "", " "); } else { key = addData.EpcString + ""; } } else if ((false == chkbxShowFailedDataReads) && (addData.Data.Length == 0)) { // When UNCHECKED (default) - If the embedded read data fails (data.length==0) then don't add the entry to // the database, thus it won't be displayed. return; } else { key = addData.EpcString + ByteFormat.ToHex(addData.Data, "", " "); } } else { key = addData.EpcString; //if only keying on EPCID } } //if (chkbxUniqueByAntenna) //{ // key += addData.Antenna.ToString(); //} //if (chkbxUniqueByFrequency) //{ // key += addData.Frequency.ToString(); //} UniqueTagCounts = 0; TotalTagCounts = 0; if (!EpcIndex.ContainsKey(key)) { TagReadRecord value = new TagReadRecord(addData); value.SerialNumber = (uint)EpcIndex.Count + 1; value.SensorType = tagdbSensorType; value.SensorSubType = tagdbSensorSubType; Console.WriteLine(string.Format("Sensor={0}, Sub={1}", tagdbSensorType, tagdbSensorSubType)); _tagList.Add(value); EpcIndex.Add(key, value); //Call this method to calculate total tag reads and unique tag read counts UpdateTagCountTextBox(EpcIndex); Console.WriteLine("tagdb add [" + key + "]"); } else { EpcIndex[key].SensorSubType = tagdbSensorSubType; if (tagdbSensorType == SensorType.VBL) { if (tagdbSensorSubType == SensorSubType.VBL_TUNE) { if (EpcIndex[key].TuneValue.Trim().Equals("")) { EpcIndex[key].TuneValue = ByteFormat.ToHex(addData.Data, "", ""); } } else if (tagdbSensorSubType == SensorSubType.VBL_NValue) { EpcIndex[key].TemperatureCode = ByteFormat.ToHex(addData.Data, "", ""); } } if (tagdbSensorType == SensorType.RFMicronMagnusS3) { if (tagdbSensorSubType == SensorSubType.RFMicroMagnusS3_CalibratedCode) { if (EpcIndex[key].TuneValue.Trim().Equals("")) { EpcIndex[key].TuneValue = ByteFormat.ToHex(addData.Data, "", ""); } else if (tagdbSensorSubType == SensorSubType.RFMicroMagnusS3_TemperatureCode) { EpcIndex[key].TemperatureCode = ByteFormat.ToHex(addData.Data, "", ""); } } } EpcIndex[key].Update(addData); //ToDo update temperature UpdateTagCountTextBox(EpcIndex); } } }
private double getJoharTemp(TagReadData RawRead, SensorType sensorType) { double temp = UNSPECTTEMP; //获取EPC byte[] bepc = RawRead.Tag.EpcBytes; if (RawRead.Data.Length > 0 && bepc.Count() >= 11) { byte[] buser = RawRead.Data; //Console.WriteLine("EPC={0}, USER={1}", ByteFormat.ToHex(bepc, "", ""), ByteFormat.ToHex(buser, "", "")); byte[] user8 = null; byte[] user9 = null; user8 = new byte[] { buser[0], buser[1] }; if (buser.Length >= 4) { user9 = new byte[] { buser[2], buser[3] }; //Console.WriteLine("user8={0}, user9={1}" + ByteFormat.ToHex(user8, "", ""), ByteFormat.ToHex(user9, "", "")); } //1.获取原始温度数据 byte[] s06 = new byte[] { bepc[8], bepc[9] }; byte[] s07 = new byte[] { bepc[10], bepc[11] }; //Console.WriteLine("s06=" + ByteFormat.ToHex(s06, "", "")); //Console.WriteLine("s07=" + ByteFormat.ToHex(s07, "", "")); //2.得到SEN_DATA[23:0] string s_SEN_DATA = ByteFormat.ToHex(s06, "", "").Substring(1) + ByteFormat.ToHex(s07, "", "").Substring(1); //Console.WriteLine("s_SEN_DATA=" + s_SEN_DATA); int i_SEN_DATA = Convert.ToInt32(s_SEN_DATA, 16); //Console.WriteLine("i_SEN_DATA=" + i_SEN_DATA); //3.传感数据验证 if (sensorType == SensorType.Johar_101) { string s_HEADER1 = ByteFormat.ToHex(s06, "", "").Substring(0, 1); string s_HEADER2 = ByteFormat.ToHex(s07, "", "").Substring(0, 1); int i_SEN_DATA_23_19 = (i_SEN_DATA & 0x00F80000) >> 19; uint B00100 = (0xFF20FFFF & 0x00F80000) >> 19; //Console.WriteLine("s_HEADER1={0}, s_HEADER2={1}", s_HEADER1, s_HEADER2); //Console.WriteLine("s_SEN_DATA_23_19={0}, B00100={1}", i_SEN_DATA_23_19, B00100); if (!s_HEADER1.Equals("F") || !s_HEADER2.Equals("F") || i_SEN_DATA_23_19 != B00100) { Console.WriteLine("sensor data check failed!"); return(temp); } } //4.获取校验参数 int delta1 = 0; double delta2 = 0; delta1 = ConvertDelta1(user8); delta2 = delta1 / 100d - 101d; //Console.WriteLine("d1=" + delta1 + ", d2=" + delta2); //5.获得摄氏度格式温度数据 double D1 = (i_SEN_DATA & 0x00F80000) >> 19; double D2 = ((i_SEN_DATA & 0x0007FFF8) >> 3) & 0x0000FFFF; //Console.WriteLine("D1=" + D1 + ", D2=" + D2); string user9_15_12 = null; //读取user9的时候根据读取值设置,否则根据读取的芯片类型设置 if (user9 != null) { user9_15_12 = ByteFormat.ToHex(user9, "", "").Substring(0, 1); } else { if (sensorType == SensorType.Johar_106) { user9_15_12 = "1"; } else if (sensorType == SensorType.Johar_101) { user9_15_12 = "2"; } else { user9_15_12 = "0"; } } //Console.WriteLine("user9_15_12={0}", user9_15_12); double temperature = 0.0; if (user9_15_12.Equals("0") || user9_15_12.Equals("1")) { temperature = 11984.47 / (21.25 + D1 + (D2 / 2752) + delta2) - 301.57; } else if (user9_15_12.Equals("2")) { double Treal_temp = 11109.6 / (24 + (D2 + delta1) / 375.3) - 290; if (Treal_temp >= 125) { temperature = Treal_temp * 1.2 - 25; } else { temperature = Treal_temp; } } //Console.WriteLine("temperature={0}", temperature); //temp = temperature; temp = Math.Round(temperature, 2);//保留两位小数 } return(temp); }
//显示处理 private void ProcessRfidRead(TagReadData[] tags) { try { ////在主窗口中显示数据 //ActingThread AcT = new ActingThread(form.ProcessRfidTag); //form.BeginInvoke(AcT, new object[] { readingHead, tags }); //TimeSpan ts = DateTime.Now.Subtract(rfidReader.readTime); string[] epcdata = new string[tags.Count()]; List<string> list = new List<string>(); foreach (KeyValuePair<string, TagInfo> tagInfo in tagDic) { if (DateTime.Now.Ticks - tagInfo.Value.time.Ticks > 10 * 10000000) { list.Add(tagInfo.Key); } } foreach (string s in list) { tagDic.Remove(s); } list.Clear(); foreach (TagReadData tagData in tags) { if (!tagDic.ContainsKey(tagData.EPCString)) { TagInfo tagInfo = new TagInfo(); tagInfo.ip = this.readingHead.ascmReadingHead.ip; tagInfo.time = DateTime.Now; tagInfo.tagEpc = tagData.EPCString; tagDic.Add(tagData.EPCString, tagInfo); //每次读取标签创建线程进行上传 ThreadPool.QueueUserWorkItem(new WaitCallback(UpLoad), tagInfo); } } //if (this.readingHead.ascmReadingHead.ip == "10.46.11.244") //{ // foreach (TagReadData tagData in tags) // { // WriteLogFile(Thread.CurrentThread.ManagedThreadId + " " + "汇总显示" + this.readingHead.ascmReadingHead.address + " " + tagData.EPCString); // } //} } catch (Exception ex) { throw ex; } }
/// <summary> /// Merge new tag read with existing one /// </summary> /// <param name="data">New tag read</param> public void Update(TagReadData mergeData) { //Console.WriteLine("*** Update " + mergeData.EpcString); mergeData.ReadCount += ReadCount; TimeSpan timediff = mergeData.Time.ToUniversalTime() - this.TimeStamp.ToUniversalTime(); // Update only the read counts and not overwriting the tag // read data of the existing tag in tag database when we // receive tags in incorrect order. if (0 <= timediff.TotalMilliseconds) { RawRead = mergeData; } else { RawRead.ReadCount = mergeData.ReadCount; } //Console.WriteLine("Update isJohar=" + isJohar); if (sensorType == SensorType.Johar_106 || sensorType == SensorType.Johar_101) { double temp = getJoharTemp(mergeData, sensorType); if (temp != UNSPECTTEMP) { temperature = temp; } } else if (sensorType == SensorType.VBL) { if (sensorSubType == SensorSubType.VBL_TUNE) { if (tuneValue.Trim().Equals("")) { tuneValue = ByteFormat.ToHex(mergeData.Data, "", ""); } } else if (sensorSubType == SensorSubType.VBL_NValue) { temperatureCodeValue = ByteFormat.ToHex(mergeData.Data, "", ""); if (!tuneValue.Trim().Equals("") && !temperatureCodeValue.Trim().Equals("")) { double temp = getVBLTemp(tuneValue, temperatureCodeValue, mergeData); if (temp != UNSPECTTEMP) { temperature = temp; } } } } else if (sensorType == SensorType.ILian) { double temp = getILianTemp(mergeData); if (temp != UNSPECTTEMP) { temperature = temp; } } else if (sensorType == SensorType.RFMicronMagnusS3) { if (sensorSubType == SensorSubType.RFMicroMagnusS3_CalibratedCode) { if (tuneValue.Trim().Equals("")) { tuneValue = ByteFormat.ToHex(mergeData.Data, "", ""); } } else if (sensorSubType == SensorSubType.RFMicroMagnusS3_TemperatureCode) { temperatureCodeValue = ByteFormat.ToHex(mergeData.Data, "", ""); if (!tuneValue.Trim().Equals("") && !temperatureCodeValue.Trim().Equals("")) { double temp = getRFMicronMagnusS3Temp(tuneValue, temperatureCodeValue, mergeData); if (temp != UNSPECTTEMP) { temperature = temp; } } } } OnPropertyChanged(null); }
private double getRFMicronMagnusS3Temp(string TuneValue, string TemperatureCode, TagReadData mergeData) { double temp = 0.0; if (TemperatureCode.Length < 4) { return(temp); } int TEMP_CODE = Convert.ToInt32(TemperatureCode, 16) & 0x00000FFF; return(GetRFMicroTemp(TuneValue, TEMP_CODE)); }
// read multiple registers from one tag singulated by its EPC public static short[] ReadMemBlockByEpc(Reader reader, TagReadData tag, Gen2.Bank bank, int address, int length) { short[] values = ReadMemBlockByEpc(reader, tag, bank, address, length, 3); return(values); }
public void UpdateList(TagReadData trd) { string[] keys = _app.Coname; int aDataLen = trd.GetAdditionData() != null?trd.GetAdditionData().Length : 0; string epc = trd.EpcHexStr; if (!TagMap.ContainsKey(epc)) { TagInfo ati = new TagInfo(trd); if (_app.IsFindingGood) { if (epc.Equals(_app.SelectedEpc)) { TagMap[epc] = ati; } } else { TagMap[epc] = ati; } // list Dictionary <string, string> m = new Dictionary <string, string> { ["ecp_org"] = epc, [keys[0]] = TagMap.Count.ToString(), [keys[1]] = epc.Length < 24 ? string.Format("%-24s", epc) : epc, [keys[2]] = trd.ReadCount.ToString(), [keys[3]] = trd.Antenna.ToString(), [keys[4]] = "gen2", [keys[5]] = trd.Rssi.ToString(), [keys[6]] = trd.Frequency.ToString(), [keys[8]] = trd.Time.ToString() }; if (aDataLen > 0) { m[keys[7]] = StrUtil.ToHexString(trd.GetAdditionData(), 0, aDataLen); } else { m[keys[7]] = " "; } if (_app.IsFindingGood) { if (_app.SelectedEpc.Equals(m[keys[1]])) { _app.ListMs.Add(m); } } else { _app.ListMs.Add(m); } } else { TagInfo atf = TagMap[trd.EpcHexStr]; atf.ReadCount += trd.ReadCount; for (int k = 0; k < _app.ListMs.Count; k++) { Dictionary <string, string> m = (Dictionary <string, string>)_app.ListMs[k]; //if (epc.Equals(m["ecp_org"])) if (m.ContainsKey(epc)) { m[keys[2]] = atf.ReadCount.ToString(); m[keys[5]] = trd.Rssi.ToString(); m[keys[6]] = trd.Frequency.ToString(); if (aDataLen > 0) { m[keys[7]] = StrUtil.ToHexString(trd.GetAdditionData(), 0, aDataLen); } } } } }
// read one register from one tag singulated by its EPC public static short ReadMemByEpc(Reader reader, TagReadData tag, Gen2.Bank bank, int address) { short value = ReadMemByEpc(reader, tag, bank, address, 3); return(value); }
// read one register from one tag singulated by its EPC public static short ReadMemByEpc(Reader reader, TagReadData tag, Gen2.Bank bank, int address, int attempts) { short[] values = ReadMemBlockByEpc(reader, tag, bank, address, 1, attempts); return(values[0]); }
public TagInfo(TagReadData trd) { d = trd; }
void AddTagToDic(TagReadData tag) { TagInfo tmptag = null; if (rParms.isUniByEmd && (tag.Tag.Protocol == TagProtocol.GEN2)) { if (tag.EMDDataString == string.Empty) { return; } } // tagmutex.WaitOne(); string keystr = tag.EPCString; if (rParms.isUniByEmd) { keystr += tag.EMDDataString; } if (rParms.isUniByAnt) { keystr += tag.Antenna.ToString(); } if (m_Tags.ContainsKey(keystr)) { tmptag = m_Tags[keystr]; if (rParms.isOneReadOneTime) { tmptag.readcnt += 1; } else { tmptag.readcnt += tag.ReadCount; } tmptag.antid = tag.Antenna; if (!rParms.isUniByEmd) { if (tmptag.emddatastr != tag.EMDDataString) { if (tag.EMDDataString != string.Empty) { tmptag.emddatastr = tag.EMDDataString; } } } tmptag.timestamp = tag.Time; /// } else { TagInfo newtag = null; if (rParms.isOneReadOneTime) { newtag = new TagInfo(tag.EPCString, 1, tag.Antenna, tag.Time, tag.Tag.Protocol, tag.EMDDataString); } else { newtag = new TagInfo(tag.EPCString, tag.ReadCount, tag.Antenna, tag.Time, tag.Tag.Protocol, tag.EMDDataString); } m_Tags.Add(keystr, newtag); } //if (!tagbuf.ContainsKey(tag.EPCString)) // tagbuf.Add(tag.EPCString, tag); tagmutex.ReleaseMutex(); }