Example #1
0
        public void ProcessTagReadEvent(object sender, TagReadEventArgs e)
        {
            //The TagReadEventsArgs includes a ThinkifyTag as an element. (See: ThinkifyReader.cs)
            //ThinkifyTag tag;
            //tag = e.tag;

            readCount += 1;

            // Look! We've taken an object oriented language and made it -- not!
            SetText(lblNumReads, readCount.ToString());

            string strTaglist;

            strTaglist = "";

            if (chkReading.Checked)
            {
                foreach (ThinkifyTag T in Reader.TagList)
                {
                    strTaglist = strTaglist + T.EPC + " " + T.ReadCount.ToString() + "\r\n";
                }

                SetText(txtReplys, strTaglist);
            }
        }
Example #2
0
 private static void OnTagRead(object sender, TagReadEventArgs e)
 {
     // PUT BREAKPOINT HERE
     // wait for 10 seconds
     // press continue util the break point stops being hit
     // for me it is hit about 10 times and then never 10 times
     Console.WriteLine($"{nameof(OnTagRead)} {e.TagReadData.Epc}");
 }
 public void FrequencyTest()
 {
     TagReadEventArgs target = new TagReadEventArgs();
     float expected = 0F;
     float actual;
     target.Frequency = expected;
     actual = target.Frequency;
     Assert.AreEqual(expected, actual);
 }
Example #4
0
 public void AddReaderTest()
 {
     TagPassing target = new TagPassing("Tag Passing");
     testPassing = target;
     NetworkListener rfidReader = new NetworkListener("TestListener");
     target.AddPublisher(rfidReader);
     tagArgs = new TagReadEventArgs();
     //rfidReader.TestReceivePacket(tagArgs);
 }
 public void AntennaTest()
 {
     TagReadEventArgs target = new TagReadEventArgs();
     int expected = 0;
     int actual;
     target.Antenna = expected;
     actual = target.Antenna;
     Assert.AreEqual(expected, actual);
 }
 public void DateTimeTest()
 {
     TagReadEventArgs target = new TagReadEventArgs();
     DateTime expected = new DateTime();
     DateTime actual;
     target.DateTime = expected;
     actual = target.DateTime;
     Assert.AreEqual(expected, actual);
 }
Example #7
0
    /* We set up an event handler to deal with the TagReadEvent from the reader.
     * For now, let's just show what we've received.
     */
    public void ProcessTagReadEvent(object sender, TagReadEventArgs e)
    {
        //The TagReadEventsArgs includes a ThinkifyTag as an element. (See: ThinkifyReader.cs)
        ThinkifyTag tag;

        tag = e.tag;
        //Uncomment if you want to watch every read come in...
        Console.WriteLine("HEY! We saw a tag! ID: {0}  RSSI: {1}", tag.EPC, tag.RSSI);
    }
Example #8
0
 /// <summary>
 /// A <typeparamref name="TagReadEventArgs.TagMessageDelegate"/> method that is used to 
 /// handle the events and write to the Console.
 /// </summary>
 /// <param name="sender">The object that sent the event (also the object that was
 /// subscribed to).</param>
 /// <param name="tagInfo">The <typeparamref name="TagReadEventArgs"/> for the current reading.</param>
 internal override void LogTag(object sender, TagReadEventArgs e)
 {
     TagInfo tagInfo = e.TagInfo;
     ITagEventPublisher network = sender as ITagEventPublisher;
     if (network != null)
     {
         System.Console.Write(network.Name);
         System.Console.WriteLine("  Tag ID: {0}  Antenna: {1}  Signal Strength: {2} Frequency: {3}  Time: {4}",
             tagInfo.ID.Value, tagInfo.Antenna, tagInfo.SignalStrenth, tagInfo.Frequency, tagInfo.Time);
     }
 }
Example #9
0
 private void Log(TagReadEventArgs e)
 {
     TagInfo tagInfo = e.TagInfo;
     connection.Open();
     try
     {
         using (SqlCommand command = new SqlCommand("INSERT INTO Dogs1 VALUES(@TagID, @Time, @Strength)", connection))
         {
             command.Parameters.Add(new SqlParameter("TagID", tagInfo.ID.Value));
             command.Parameters.Add(new SqlParameter("Time", tagInfo.Time));
             command.Parameters.Add(new SqlParameter("Strength", tagInfo.SignalStrenth));
             command.ExecuteNonQuery();
         }
     }
     catch
     {
         Console.WriteLine("Count not insert.");
     }
 }
Example #10
0
 private void LogPassings(TagReadEventArgs e)
 {
     passingsQueue.Put(e.TagInfo);
 }
 public void TimeTest()
 {
     TagReadEventArgs target = new TagReadEventArgs();
     long expected = 0;
     long actual;
     target.Time = expected;
     actual = target.Time;
     Assert.AreEqual(expected, actual);
 }
 public void TagReadEventArgsConstructorTest1()
 {
     TagId id = new TagId();
     id.Value = "foo";
     float frequency = 5609.3F;
     float signalStrength = 732.5F;
     int antenna = 3;
     long time = 0230124812040;
     TagReadEventArgs target = new TagReadEventArgs(id, frequency, signalStrength, antenna, time);
     Assert.AreEqual(id, target.ID);
     Assert.AreEqual(frequency, target.Frequency);
     Assert.AreEqual(signalStrength, target.SignalStrenth);
     Assert.AreEqual(antenna, target.Antenna);
     Assert.AreEqual(time, target.Time);
 }
 public void SignalStrenthTest()
 {
     TagReadEventArgs target = new TagReadEventArgs();
     float expected = 0F;
     float actual;
     target.SignalStrenth = expected;
     actual = target.SignalStrenth;
     Assert.AreEqual(expected, actual);
 }
Example #14
0
 private static void OnTagRead(object sender, TagReadEventArgs e)
 {
     Console.WriteLine($"{nameof(OnTagRead)} {e.TagReadData.Epc}");
 }
Example #15
0
 void TagPassedEventTest(object sender, TagReadEventArgs args)
 {
     Assert.AreEqual(sender, testPassing);
     Assert.AreEqual(args, tagArgs);
     Assert.IsTrue(TagInfo.AreEqual(args.TagInfo, tagArgs.TagInfo));
 }
 public void IDTest()
 {
     TagReadEventArgs target = new TagReadEventArgs();
     TagId expected = new TagId();
     TagId actual;
     target.ID = expected;
     actual = target.ID;
     Assert.AreEqual(expected, actual);
 }
Example #17
0
 public void ProcessTagXReadEvent(object sender, TagReadEventArgs e)
 {
     //Console.WriteLine(" XRD{0}:  {1}", e.XReadIndex, e.tag.XRData[e.XReadIndex]);
 }
Example #18
0
 /// <summary>
 /// A handler for the TagDetected events.
 /// </summary>
 /// <param name="sender">The object instance that fired the event.</param>
 /// <param name="tagId">The <typeparamref name="TagId"/> of the detected Tag.</param>
 /// <remarks>If the Tag has not been registered, then the detection will be ignored.</remarks>
 internal void TagDetectedHandler(object sender, TagReadEventArgs e)
 {
     TagInfo tagInfo = e.TagInfo;
     // TODO: Ignores the tag ID if it is not already registered.
     if (!passingStrategy.ContainsKey(tagInfo.ID))
     {
         AddTag(tagInfo.ID);
     }
     List<TagInfo> tagList = new List<TagInfo>(1);
     tagList.Add(tagInfo);
     TagInfo passingTime = passingStrategy[tagInfo.ID].HandlePassing(tagList);
     {
         // Fire the Passing event.
         TagDetected(this, new TagReadEventArgs(TagEventType.PassDetermined, passingTime));
     }
 }
Example #19
0
 private void LogReadings(TagReadEventArgs e)
 {
     TagInfo tagInfo = e.TagInfo;
     TagReading reading = new TagReading();
     reading.ReadingNumber = readingsCount;
     reading.Antenna = (short) tagInfo.Antenna;
     reading.Frequency = tagInfo.Frequency;
     reading.SignalStrength = tagInfo.SignalStrenth;
     reading.Tag = tagInfo.ID.Value;
     reading.Time = tagInfo.Time;
     database.TagReadings.InsertOnSubmit(reading);
     database.SubmitChanges();
     readingsCount++;
     //hardcardTestDatabaseDataSet.TagReadings.AddTagReadingsRow(tagInfo.ID.Value, tagInfo.Time, tagInfo.SignalStrenth, (short)tagInfo.Antenna, tagInfo.Frequency);
 }
Example #20
0
 private void LogPassings(TagReadEventArgs e)
 {
     TagInfo tagInfo = e.TagInfo;
     Passing passing = new Passing();
     passing.Tag = tagInfo.ID.Value;
     passing.PassingTime = tagInfo.Time;
     passing.ReadingNumber = -1;
     passing.Lap = -1;
     //database.Passings.InsertOnSubmit(passing);
     //database.SubmitChanges();
 }
Example #21
0
 internal void LogTag(object sender, TagReadEventArgs tagInfo)
 {
     NetworkListener network = sender as NetworkListener;
     if (network != null)
         logCommand(tagInfo);
 }
Example #22
0
 private void LogReadings(TagReadEventArgs e)
 {
     readingsQueue.Put(e.TagInfo);
 }