protected virtual void RaiseLineReceivedEvent(LineReceivedEventArgs e)
 {
     if (LineReceivedEvent != null)
     {
         LineReceivedEvent(this, e);
     }
 }
Exemplo n.º 2
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);
                }
            }
        }
Exemplo n.º 3
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);
                }

            }
        }
 protected virtual void RaiseLineReceivedEvent(LineReceivedEventArgs e)
 {
     if (LineReceivedEvent != null)
         LineReceivedEvent(this, e);
 }