예제 #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);
            }
        }
예제 #2
0
 private void RaiseTagReadEvent(TagReadEventArgs e)
 {
     if (TagReadEvent != null)
     {
         TagReadEvent(this, e);
     }
 }
예제 #3
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);
 }
예제 #4
0
        private void ProcessLine(object sender, LineReceivedEventArgs e)
        {
            TagList.ProcessReaderMessage(e.lineReceived);

            if (e.lineReceived.IndexOf("TAG=") == 0)
            {
                ThinkifyTag t = new ThinkifyTag(e.lineReceived);

                if (t.EPC != latestTag.EPC) // A new guy! Reset latest tag.
                {
                    latestTag = t;
                }
                else
                {   //It's the tag we've seen before. Just update the latestTag w/ the new data...
                    latestTag.Update(t);
                }

                TagReadEventArgs ev = new TagReadEventArgs(latestTag);
                RaiseTagReadEvent(ev);
            }


            //Extended reads are enabled. -- update the data for the last tag seen.

            if (e.lineReceived.IndexOf("XRD") == 0)
            {
                bool goodResult = latestTag.UpdateXRDData(e.lineReceived);

                //goodResult = true; //TODO: Look at if we want to use this...
                //OK, we'll only report a Xread event if we have a valid one...
                if (goodResult)
                {
                    TagReadEventArgs ev = new TagReadEventArgs(latestTag);
                    //I can't _believe_ how poorly this language deals with moving from strings to other data types. REALLY?
                    ev.XReadIndex = int.Parse(e.lineReceived[3].ToString());  //Parse doesn't even deal w/Hex! How much "parse"ing is going on, then?
                    RaiseTagXReadEvent(ev);
                }
            }
        }
예제 #5
0
 private void RaiseTagXReadEvent(TagReadEventArgs e)
 {
     if (TagXReadEvent != null)
         TagXReadEvent(this, e);
 }
예제 #6
0
        private void ProcessLine(object sender, LineReceivedEventArgs e)
        {
            TagList.ProcessReaderMessage(e.lineReceived);

            if (e.lineReceived.IndexOf("TAG=") == 0)
            {
                ThinkifyTag t = new ThinkifyTag(e.lineReceived);

                if (t.EPC != latestTag.EPC) // A new guy! Reset latest tag.
                {
                    latestTag = t;
                }
                else
                {   //It's the tag we've seen before. Just update the latestTag w/ the new data...

                    latestTag.Update(t);
                }

                TagReadEventArgs ev = new TagReadEventArgs(latestTag);
                RaiseTagReadEvent(ev);

            }

            //Extended reads are enabled. -- update the data for the last tag seen.

            if (e.lineReceived.IndexOf("XRD") == 0)
            {
                bool goodResult = latestTag.UpdateXRDData(e.lineReceived);

                //goodResult = true; //TODO: Look at if we want to use this...
                //OK, we'll only report a Xread event if we have a valid one...
                if (goodResult) {
                    TagReadEventArgs ev = new TagReadEventArgs(latestTag);
                    //I can't _believe_ how poorly this language deals with moving from strings to other data types. REALLY?
                    ev.XReadIndex = int.Parse(e.lineReceived[3].ToString());  //Parse doesn't even deal w/Hex! How much "parse"ing is going on, then?
                    RaiseTagXReadEvent(ev);
                }

            }
        }
예제 #7
0
 public void ProcessTagXReadEvent(object sender, TagReadEventArgs e)
 {
     //Console.WriteLine(" XRD{0}:  {1}", e.XReadIndex, e.tag.XRData[e.XReadIndex]);
 }