Esempio n. 1
0
        void Events_ReadNotify(object sender, Events.ReadEventArgs e)
        {
            try
            {
                Dictionary<string, KTR.IRFID.TagData> lstTags = new Dictionary<string, IRFID.TagData>();

                Symbol.RFID3.TagData[] readTags = objMotorolaReader.Actions.GetReadTags(8000);
                foreach (Symbol.RFID3.TagData tag in readTags)
                {
                    KTR.IRFID.TagData tempTag = new IRFID.TagData();
                    tempTag.RFID_HEX = tag.TagID;
                    tempTag.SourceAntenna = tag.AntennaID.ToString();
                    tempTag.ReadRSSI = (int)tag.PeakRSSI;
                    tempTag.ReadTime = DateTime.Now;
                    tempTag.SourceReader = this.rdrInfo.HostName;

                    lstTags[tempTag.RFID_HEX] = tempTag;

                }

                List<KTR.IRFID.TagData> tagDataToSend = new List<IRFID.TagData>();
                tagDataToSend.AddRange(lstTags.Values);

                ReadEventArgs resArgs = new ReadEventArgs();
                resArgs.Tags = tagDataToSend;
                resArgs.TimeStamp = DateTime.Now;
                onTagReadRaised(resArgs);

            }
            catch (Exception ex)
            {

            }
        }
Esempio n. 2
0
 protected virtual void onTagReadRaised(ReadEventArgs e)
 {
     EventHandler<ReadEventArgs> handler = onTagReadEvent;
     if (handler != null)
     {
         handler(this, e);
     }
 }
        private void ObjReader_OnTagRead(object sender, ReadEventArgs e)
        {
            try
            {
                lock (objLock)
                {
                    List<TagData> lstTags = ConvertTagList(e.Tags);
                    mTagReadCache.AddRange(lstTags);
                    mReaderInfo.IsOnline = true;
                }
                //Perform Business Logic in seperate Task.
            }
            catch(Exception ex)
            {
                string msg = "Error in OnTagRead";
                if (objReader.ReaderStatus == ReaderStatus.OFFLINE)
                {
                    msg += ", reader set to OFFLINE. ";
                    mReaderInfo.IsOnline = false;
                }

                LoggerAgent.Error(msg, ex);
            }
            finally
            {
                Thread.Sleep(200);
            }
        }