static void OnTagsReported(ImpinjReader sender, TagReport report) { string key; // 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) { if (tag.IsFastIdPresent) { // If the TID is available through FastID, use it as the key key = tag.Tid.ToHexString(); } else { // Otherwise use the EPC key = tag.Epc.ToHexString(); } // If this tag hasn't been read before, print out the EPC and TID if (!tagsRead.ContainsKey(key)) { Console.WriteLine("EPC : {0}, TID : {1}", tag.Epc, tag.Tid); // Add this tag to the list of tags we've read. tagsRead.Add(key, tag); } } }
/// <summary> /// This event handler is called asynchronously /// when tag reports are available. /// Loop through each tag in the report /// and print the data. /// My Output to the file /// </summary> private void OnTagsReported(ImpinjReader sender, TagReport report) { foreach (Tag tag in report) { if (!ItemString.RFIDControlReaderState) { //System.Diagnostics.Debug.WriteLine("OnTagsReported:RFID 绘制结束stop"); continue; } else { try { //int rId = rFIDDatas.FindIndex(a => a.getID() == tag.Epc.ToString()); // System.Diagnostics.Debug.WriteLine("OnTagsReported:EPC" + tag.Epc.ToString()); if (tag.Epc.ToString() != ItemString.RFIDEPC) { continue; } int rId = 0; if (rFIDDatas.Count < 1) { // System.Diagnostics.Debug.WriteLine("OnTagsReported:add data:EPC" + tag.Epc.ToString()); rFIDDatas.Add(new RFIDData(Convert.ToString(ItemString.RFIDEPC))); } rFIDDatas[rId].addRSSPhaseTime(tag.PeakRssiInDbm, tag.PhaseAngleInRadians, TimeUtil.getReletiveToStartProgramSeconds()); addQueue(tag.PeakRssiInDbm, tag.PhaseAngleInRadians); } catch (Exception e) { System.Diagnostics.Debug.WriteLine("OnTagsReported:出现异常 " + e.StackTrace); } } } }
public void OnTagsReported10(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. //reader.TagsReported -= OnTagsReported10; foreach (Tag tag in report) { ListBox.CheckForIllegalCrossThreadCalls = false; lbSpeedway.Items.Add("Antena: " + tag.AntennaPortNumber + " Tag: " + tag.Epc.ToString()); try { WebRequest req = WebRequest.Create(@"http://52.43.37.169:8080/eventos/rest/r420/leer/" + Regex.Replace(tag.Epc.ToString(), @"\s+", "") + "/" + tbEventoSW.Text); req.Method = "POST"; req.Timeout = 5000; HttpWebResponse resp = req.GetResponse() as HttpWebResponse; req.Abort(); } catch { AutoClosingMessageBox.Show("Tag : " + tag.Epc + " no enviado", "Mensaje", 1000); // System.Diagnostics.Debug.WriteLine("Tag : " + tag.Epc + " no enviado"); } } }
public void OnTagsReported7(ImpinjReader sender, TagReport report) { // We've read the tag we want write to, so // we're not interested in tag reports any more. // Unsubscribe from the event. reader.TagsReported -= OnTagsReported7; // Change the EPC of the first tag we read to a random value. Tag tag = report.Tags[0]; TextBox.CheckForIllegalCrossThreadCalls = false; //string nuevoEPC = tbNEPCSpeedway.Text; tbEPCSpeedway.Text = tag.Epc.ToHexString(); //ProgramEpc(tag.Epc.ToHexString(), tag.PcBits, nuevoEPC); //MessageBox.Show("El nuevo tag es:" + tag.Epc.ToHexString()); try { if (cbIncSpeedway.Checked == true) { tbNEPCSpeedway.Text = (Int64.Parse(tbEPCSpeedway.Text) + Int64.Parse(nuSpeedway.Value.ToString())).ToString().PadLeft(24, '0'); } else { tbNEPCSpeedway.Text = tag.Epc.ToHexString(); } } catch { } }
private void DisplayTag(ImpinjReader reader, TagReport report) { foreach (Tag tag in report) { //TODO: добавить метод AsyncEvent.ExternalEvent } }
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. DataRow workRow = table.NewRow(); foreach (Tag tag in report) { /*if (tag.Epc.ToString() == "E200 9366 C6B6 7BF1 9071 BDEF") * { * Console.WriteLine("EPC : {0} Timestamp : {1}", tag.Epc, tag.LastSeenTime); * //Console.WriteLine("RfDopplerFrequency : {0} ChannelInMhz : {1}", tag.RfDopplerFrequency, tag.ChannelInMhz); * Console.WriteLine("PeakRssiInDbm : {0} PhaseAngleInRadians : {1}", tag.PeakRssiInDbm, tag.PhaseAngleInRadians); * }*/ Console.WriteLine("EPC : {0} Timestamp : {1}", tag.Epc, tag.LastSeenTime); //Console.WriteLine("RfDopplerFrequency : {0} ChannelInMhz : {1}", tag.RfDopplerFrequency, tag.ChannelInMhz); Console.WriteLine("PeakRssiInDbm : {0} PhaseAngleInRadians : {1}", tag.PeakRssiInDbm, tag.PhaseAngleInRadians); workRow["EPC"] = tag.Epc; workRow["Timestamp"] = tag.LastSeenTime; workRow["ChannelInMhz"] = tag.ChannelInMhz; workRow["PeakRssiInDbm"] = tag.PeakRssiInDbm; workRow["PhaseAngleInRadians"] = tag.PhaseAngleInRadians; table.Rows.Add(workRow); } }
public void ClientSend(TagReport report) { // Sends the data from the report try { // Send test data to the remote device. foreach (Tag tag in report) { //If you want the data as below can be sent instead of only the tag data //String data = "Antenna : {0}, EPC : {1} {2}" + tag.AntennaPortNumber + tag.Epc.ToHexString() + tag.PeakRssiInDbm; String epcStr = tag.Epc.ToHexString(); if (seen_data.ContainsKey(epcStr)) { seen_data[epcStr]++; } else { seen_data.Add(epcStr, 0); Send(client, epcStr); sendDone.WaitOne(); Console.WriteLine(epcStr); //Console.ReadKey(); //Console.WriteLine("Press any key to continue"); } } } catch (Exception e) { Console.WriteLine(e.ToString()); } }
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) { if (tag.IsFastIdPresent) { // Print the model specific details that can be determined from the TID. Console.WriteLine("Antenna : {0}\nEPC : {1}\nTID : {2}\n" + "Model Name : {3}\nEPC memory size (bits) : {4}\n" + "User memory size (bits) : {5}\nSupports QT : {6}\n\n", tag.AntennaPortNumber, tag.Epc, tag.Tid, tag.ModelDetails.ModelName, tag.ModelDetails.EpcSizeBits, tag.ModelDetails.UserMemorySizeBits, tag.ModelDetails.SupportsQt); } else { // Fast ID not available. // Chip is not a Monza 4 or later. Console.WriteLine("Antenna : {0}\nEPC : {1}\nTID : Fast ID not available\n\n", tag.AntennaPortNumber, tag.Epc); } } }
private void TagsReportedHandler(object sender, TagReport e) { try { var tags = e.Tags; if (TagsEventSender != null) { //var tDistinct = tags.Select(td => td.Epc).Distinct(); var send = new Dictionary <string, Tuple <double, int> >(); foreach (var t in tags) { if (!send.ContainsKey(t.Epc.ToHexString())) { var elements = tags.Where(x => x.Epc == t.Epc); var avg = elements.Average(y => y.PeakRssiInDbm); var tuple = new Tuple <double, int>(avg, t.AntennaPortNumber); send.Add(t.Epc.ToHexString(), tuple); } } TagsEventSender(this, new ReaderEventArgs(send, DateTime.UtcNow)); } } catch (Exception ex) { } }
// The following specifies which methods to call when tags are reported or operations are complete. // The TagsReported handler method will handle all new incoming tags static void OnTagsReported(ImpinjReader sender, TagReport report) { foreach (Tag tag in report) { double phaseAngle; phaseAngle = tag.PhaseAngleInRadians; //DataRow row = DataDS.NewRow(); ////给列赋值 //DateTime dt = DateTime.Now; row["EPC"] = tag.Epc.ToString(); row["Doppler Shift"] = tag.RfDopplerFrequency.ToString("0.00"); row["Time"] = tag.FirstSeenTime.ToString(); row["Antenna"] = tag.AntennaPortNumber; row["Tx Power"] = txPowerValue; row["Current Frequency"] = tag.ChannelInMhz.ToString(); row["PeakRSSI"] = tag.PeakRssiInDbm.ToString(); row["Phase Angle"] = phaseAngle;//tag.PhaseAngleInRadians.ToString(); row["Phase"] = ((tag.PhaseAngleInRadians) / Math.PI) * 180; string EPCStr = tag.Epc.ToString(); EPCList.Add(tag.Epc.ToString()); PhaseList.Add(phaseAngle); TimeList.Add(tag.FirstSeenTime.ToString()); string EPCStr = tag.Epc.ToString(); //把有值的列添加到表 if (EPCStr.Contains("0093")) { IncomingTagNumber93 = IncomingTagNumber93 + 1; } else if (EPCStr.Contains("0012")) { IncomingTagNumber70 = IncomingTagNumber70 + 1; } else if (EPCStr.Contains("0078")) { IncomingTagNumber96 = IncomingTagNumber96 + 1; } //把有值的列添加到表 //if (EPCStr.Contains("0093")) //{ // IncomingTagNumber93 = IncomingTagNumber93 + 1; // RSS93.Add(tag.PeakRssiInDbm.ToString()); //} //else //{ //} //DataDS.Rows.Add(row); //DSForm.updateTaginfo((int)TagsEPC[tag.Epc.ToString()], (float)(tag.RfDopplerFrequency));//, tag.FirstSeenTime.LocalDateTime } }
/**************************************************************** * 处理标签报告 *****************************************************************/ public static void OnTagsReported(ImpinjReader sender, TagReport report) { try { foreach (Tag tag in report) { if (tag.Epc != null) { while (dtLock == true) { ; } dtLock = true; DataRow dr1 = dt.NewRow(); dr1["EPC"] = tag.Epc; dr1["RSS"] = tag.PeakRssiInDbm; dr1["Frequency"] = tag.ChannelInMhz; dr1["Phase"] = tag.PhaseAngleInRadians; dr1["Reader"] = sender.Name; //dr1["Address"] = sender.Address; dr1["Antenna"] = tag.AntennaPortNumber; dr1["SeenTime"] = tag.LastSeenTime; dt.Rows.Add(dr1); dtLock = false; switch (sender.Name) { case "Reader #1": case "1": ++c1; break; case "Reader #2": case "2": ++c2; break; case "Reader #3": case "3": ++c3; break; case "Reader #4": case "4": ++c4; break; default: break; } } } } catch (Exception ee) { MessageBox.Show(ee.Message + ee.StackTrace); } }
private void OnTagsReported(ImpinjReader sender, TagReport report) { // Это событие которое обнавляет информацию в ListBox со считывателя во время считывания. //Action action = delegate()(снять) //{(снять) // UpdateListbox(report.Tags);(снять) //};(снять) //Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, action);(снять) }
// This event handler is called asynchronously // when tag reports are available. static void OnTagsReported(ImpinjReader sender, TagReport report) { // Loop through each tag in the report // and print the data. foreach (Tag tag in report) { Console.WriteLine("EPC : {0}", tag.Epc); } }
private void OnTagsReported(ImpinjReader sender, TagReport report) { Action action = delegate() { UpdateListbox(report.Tags); Console.WriteLine(report.Tags.Count); }; Dispatcher.BeginInvoke(DispatcherPriority.Normal, action); }
static void Main(string[] args) { RfidCommands reader = new RfidCommands(); TagReport tagReport = null; Console.WriteLine("Begin--------"); bool exit = false; ConsoleKey enterKey; while (!exit) { enterKey = Console.ReadKey().Key; switch (enterKey) { case ConsoleKey.Tab: IsConnected = reader.Connection(); Console.WriteLine($"Reader Connected - {IsConnected}"); break; case ConsoleKey.Q: reader.Antenna(); break; case ConsoleKey.W: reader.Start(); Console.WriteLine("Started..."); break; case ConsoleKey.E: reader.Stop(); Console.WriteLine("Stop..."); break; case ConsoleKey.A: exit = true; break; case ConsoleKey.Z: reader.Reader.TagsReported += DisplayTag; //tagReport = reader.Reader.QueryTags(5); //Console.WriteLine("Tag reading complete"); break; case ConsoleKey.X: //DisplayTag(reader.Reader, tagReport); break; } } Console.WriteLine("\n Disconnected !!!!!"); Console.ReadKey(); }
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("EPC : {0} ", tag.Epc); } }
public static void onTagsReported(ImpinjReader reader, TagReport report) { //string file = "temp.csv"; //var settings = reader.QuerySettings(); foreach (Tag tag in report) { var tagData = tag.LastSeenTime.ToString() + "," + tag.Epc.ToString() + ","; Console.WriteLine(tagData); tagsRead.Add(tagData); } }
private static void DisplayTag(ImpinjReader reader, TagReport report) { foreach (Tag tag in report) { if (tag.Epc != null) { Console.WriteLine( $"Reader= {reader.Name} /Antenna= {tag.AntennaPortNumber} /EPC= {tag.Epc} /RSS= {tag.PeakRssiInDbm} /Frequency= {tag.ChannelInMhz} /Phase= {tag.PhaseAngleInRadians}"); } } }
public void etiketoku(ImpinjReader sender, TagReport report) { foreach (Tag tag in report) { string Epc = tag.Epc.ToString(); if (!EpcList.Items.Contains(Epc)) { EpcList.Items.Add(Epc); } reader.Stop(); } }
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("EPC : {0} Doppler Frequency (Hz) : {1}", tag.Epc, tag.RfDopplerFrequency.ToString("0.00")); } }
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("EPC : {0}, Peak RSSI : {1} dBm", tag.Epc, String.Format("{0:0.00}", tag.PeakRssiInDbm)); } }
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("Antenna : {0} EPC : {1} Timestamp : {2}", tag.AntennaPortNumber, tag.Epc, tag.FirstSeenTime); } }
// This event handler is called asynchronously // when tag reports are available. static void OnTagsReported(ImpinjReader sender, TagReport report) { // We've read the tag we want write to, so // we're not interested in tag reports any more. // Unsubscribe from the event. reader.TagsReported -= OnTagsReported; // Change the EPC of the first tag we read to a random value. Tag tag = report.Tags[0]; ProgramEpc(tag.Epc.ToHexString(), tag.PcBits, GetRandomEpc()); }
//Método de apoyo para leer y añadir EPC del Speedway al Listbox lboxlog public 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) { ListBox.CheckForIllegalCrossThreadCalls = false; lboxLog.Items.Add(tag.Epc.ToString()); } }
public int GetTagCount(int tagId) { if (TagReport != null) { var tag = TagReport.FirstOrDefault(x => x.TagId == tagId); if (tag != null) { return(tag.TagCounts); } } return(0); }
public 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 t in report) { tagID = whichAnimalPictureontheCube(t, t.Epc.ToString()); Console.WriteLine("Send to debug output." + tagID); } }
static List <Tag> OrganizeTagReads(TagReport reads) { if (reads == null || reads.Tags.Count == 0) { return(null); } reads.Tags = new HashSet <Tag>(reads.Tags, new TagEPCComparer()).ToList <Tag>(); reads.Tags.Sort(delegate(Tag p1, Tag p2) { return(p1.Epc.ToString().CompareTo(p2.Epc.ToString())); }); return(reads.Tags); }
public void OnTagsReported4(ImpinjReader sender, TagReport report) { reader.TagsReported -= OnTagsReported4; Tag tag = report.Tags[0]; TextBox.CheckForIllegalCrossThreadCalls = false; string codEPC = tag.Epc.ToHexString(); TextBox.CheckForIllegalCrossThreadCalls = false; tbCodEPC.Text = codEPC; tbNuevoEPC.Text = tag.Epc.ToHexString(); //ProgramEpc(tag.Epc.ToString(), tag.PcBits, tbNuevoEPC.Text); }
private void OnTagsReported(ImpinjReader sender, TagReport report) { // This event handler gets called when a tag report is available. // Since it is executed in a different thread, we cannot operate // directly on UI elements (the Listbox) in this method. // We must execute another method (UpdateListbox) on the main thread // using BeginInvoke. We will pass updateListbox a List of tags. Action action = delegate() { UpdateListbox(report.Tags); }; Dispatcher.BeginInvoke(DispatcherPriority.Normal, action); }
//////BE SURE TO TEST FOR COLLISIONS WITH NORMAL TRANSACTIONS void SendInventoryTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { SendInventoryTimer.Interval = Program.REMINDER_INTERVAL; //after the initial scan, set the interval to happen every 10 minutes int readtime; //inventory read time if (Program.ImpinjRFIDreader.IsReading) { Program.logEvent("RFID Inventory is waiting for RFID reader"); } //Wait for the RFID read to be done reading. while (Program.ImpinjRFIDreader.IsReading) { Thread.Sleep(1000); } if (!FirstInventory) //The initial read that happens at program startup should only be for { readtime = Program.RFID_INVENTORY_READ_TIME; //10 seconds so it has less chance of immediately interfering with transactions. } else { readtime = 10000; FirstInventory = false; } TagReport inventory = Program.ImpinjRFIDreader.ReadTags(readtime, Program.IMPINJ_ANTENNA1_ENABLE, Program.IMPINJ_ANTENNA1_POWER, Program.IMPINJ_ANTENNA2_ENABLE, Program.IMPINJ_ANTENNA2_POWER, Program.IMPINJ_ANTENNA3_ENABLE, Program.IMPINJ_ANTENNA3_POWER, Program.IMPINJ_ANTENNA4_ENABLE, Program.IMPINJ_ANTENNA4_POWER); List <Tag> UniqueInventory = OrganizeTagReads(inventory); Program.ImpinjRFIDreader.DoneReading(); string InventoryString = ""; if (UniqueInventory != null) { foreach (Tag t in UniqueInventory) { string i = t.Epc.ToString().Replace(" ", ""); InventoryString += i.Substring(i.Length - 8) + ","; } InventoryString = InventoryString.Remove(InventoryString.Length - 1); Program.logEvent("RFID Inventory Sent with " + UniqueInventory.Count + " unique tags"); } else { Program.logEvent("RFID Inventory Sent with 0 unique tags"); } makeHTTPPost(HTTPPostType.RFIDInventory, InventoryString, "", ""); }
/// <summary> /// Called each time the reader disconnects. /// </summary> /// <param name="sender">The reader that sent the event.</param> /// <param name="args">Contains information about the event; the reader, timestamp and new /// reader state are properties of this object.</param> /// <summary> /// Called each time the reader starts. /// </summary> /// <param name="sender">The reader that sent the event.</param> /// <param name="args">Contains information about the event; the reader, timestamp and new /// operational state are properties of this object.</param> //public void StartedHandler(object sender, StartedEventArgs args) //{ // writeLog("Reader started as of {0} " + args.Timestamp); //} /// <summary> /// Called each time the reader stops. /// </summary> /// <param name="sender">The reader that sent the event.</param> /// <param name="args">Contains information about the event; the reader, timestamp and news /// operational state are properties of this object.</param> //public void StoppedHandler(object sender, StoppedEventArgs args) //{ // writeLog("Reader stopped as of {0} " + args.Timestamp); //} /// <summary> /// Called each time the reader singulates a tag, or a batch of tags. /// </summary> /// <param name="sender">The reader that sent the event.</param> /// <param name="args">Contains information about the event; the reader, timestamp and /// tag reports are properties of this object.</param> public void OnTagsReported(ImpinjReader sender, TagReport report) { ////panel1.Controls.Clear(); //double RSSI = Convert.ToDouble(ini.IniReadValue("setting", "RSSI")); //double RSSI2 = Convert.ToDouble(ini.IniReadValue("setting", "RSSI2")); //int portNumber = Convert.ToInt16(ini.IniReadValue("setting", "Port")); foreach (Tag tag in report.Tags) { // writeLog("Reader saw {0} on ant#{1} " + // tag.Epc + " " + tag.AntennaPortNumber + " " + tag.PeakRssiInDbm); // //TagAll += tag.Epc + '\n'; try { string strData = tag.Epc.ToString().Replace(" ","") + "##" + tag.AntennaPortNumber.ToString() + "##" + tag.PeakRssiInDbm.ToString() + "##" + ReaderSerialNo; if (VariablesENG.list.Contains(tag.Epc.ToString().Replace(" ", ""))) { } else { VariablesENG.list.RemoveAll(x => x.Contains(tag.Epc.ToString().Replace(" ", ""))); VariablesENG.list.Add(strData); } //VariablesENG.list.RemoveAll(x => x.Contains(tag.Epc.ToString().Replace(" ", ""))); // string strData2 = ""; // string strData3 = ""; // string strData4 = ""; // //CA.GetData(tag.Epc); // //var va = list.Find(x => x.Split('|')[1] == tag.Epc); // bool blnStatus = false; // if (tag.AntennaPortNumber == 1) // { // if (tag.PeakRssiInDbm >= RSSI) // { // strData = CA.GetData(tag.Epc); // Variables.list.RemoveAll(x => x.Contains(tag.Epc)); // Variables.list.Add(strData); // //Variables.list2.RemoveAll(x => x.Contains(tag.Epc)); // //Variables.list2.Add(strData); // } // } // if (tag.AntennaPortNumber == 2) // { // if (tag.PeakRssiInDbm >= RSSI2) // { // strData = CA.GetData(tag.Epc); // Variables.list.RemoveAll(x => x.Contains(tag.Epc)); // Variables.list.Add(strData); // //strData = CA.GetData(tag.Epc.Substring(0, 8)); // //Variables.list2.RemoveAll(x => x.Contains(tag.Epc.Substring(0,8))); // //Variables.list2.Add(strData); // } // } // if (tag.AntennaPortNumber == 3) // { // strData3 = CA.GetData(tag.Epc); // Variables.list3.RemoveAll(x => x.Contains(tag.Epc.Substring(0, 7))); // Variables.list3.Add(strData); // } // if (tag.AntennaPortNumber == 4) // { // strData4 = CA.GetData(tag.Epc); // Variables.list4.RemoveAll(x => x.Contains(tag.Epc.Substring(0, 7))); // Variables.list4.Add(strData); // } } catch (Exception ex) { } } }