public void ReadTags(ref TagDatabase tagdb, Reader objReader, int readTimeOut, out TagReadData[] trd)
        {
            //fontSize_TextChanged_1(sender, e);
            //Change the datagrid data font size
            //dataGrid1.FontSize = Convert.ToDouble(txtfontSize.Text);
            //GUIturnoffWarning();
            //simpleReadPlans.Clear();
            try
            {
                //FontFamily fFamily = new FontFamily("Arial");
                //dataGrid1.ColumnHeaderStyle 
                //Font objFont = new Font(fFamily, Convert.ToInt64(fontSize.Text));
                //tagResultsGrid.Font = objFont;

                DateTime timeBeforeRead = DateTime.Now;
                TagReadData[] tagID = objReader.Read(readTimeOut);
                DateTime timeAfterRead = DateTime.Now;
                TimeSpan timeElapsed = timeAfterRead - timeBeforeRead;

                trd = tagID;
                tagdb.AddRange(tagID);                
                
            }
            catch (Exception ex)
            {
                throw ex;
            }            
            
        }
Exemple #2
0
 public ReadTags(TagReadData adddata)
 {
     epc = adddata.EpcString;
     timestamp = adddata.Time.ToString();
     readcount = adddata.ReadCount.ToString();
     rssi = adddata.Rssi.ToString();
 }
 /// <summary>
 /// Read Authentication EventArgs Constructor
 /// </summary>
 /// <param name="tagReadData">the tag read data</param>
 public ReadAuthenticationEventArgs(TagReadData tagReadData)
 {
     _tagReadData = tagReadData;
 }
 /// <summary>
 /// Read Authentication EventArgs Constructor
 /// </summary>
 /// <param name="tagReadData">the tag read data</param>
 public ReadAuthenticationEventArgs(TagReadData tagReadData)
 {
     _tagReadData = tagReadData;
 }
        private TagReadData ParseRqlResponse(string row, DateTime baseTime)
        {
            String[] fields = row.Split(_selFieldSeps);

            if (_readFieldNames.Length != fields.Length)
            {
                throw new ReaderParseException(String.Format("Unrecognized format."
                    + "  Got {0} fields in RQL response, expected {1}.",
                    fields.Length, _readFieldNames.Length));
            }
            byte[] epccrc = ByteFormat.FromHex(fields[ID].Substring(2));
            byte[] epc = new byte[epccrc.Length - 2];
            Array.Copy(epccrc, epc, epc.Length);
            byte[] crc = new byte[2];
            Array.Copy(epccrc, epc.Length, crc, 0, 2);

            TagProtocol proto = CodeToProtocol(fields[PROTOCOL_ID]);
            string idfield = fields[ID];
            TagData tag = null;

            switch (proto)
            {
                case TagProtocol.GEN2:
                    byte[] pcbits = null;
                    if (_readFieldNames.Length > 7)
                    {
                        pcbits = ByteFormat.FromHex(fields[METADATA].ToString());
                    }
                    tag = new Gen2.TagData(epc, crc,pcbits);
                    break;
                case TagProtocol.ISO180006B:
                    tag = new Iso180006b.TagData(epc, crc);
                    break;
                case TagProtocol.IPX64:
                    tag = new Ipx64.TagData(epc, crc);
                    break;
                case TagProtocol.IPX256:
                    tag = new Ipx256.TagData(epc, crc);
                    break;
                default:
                    throw new ReaderParseException("Unknown protocol code " + fields[PROTOCOL_ID]);
            }

            int antenna = int.Parse(fields[ANTENNA_ID]);
            TagReadData tr = new TagReadData();
            tr.Reader = this;
            tr._tagData = tag;
            tr._antenna = antenna;
            tr._baseTime = baseTime;
            tr.ReadCount = int.Parse(fields[READ_COUNT]);
            if (_readFieldNames.Length > 7)
            {
                tr._data = ByteFormat.FromHex(fields[DATA]);
                tr._phase = int.Parse(fields[PHASE]);
            }
            tr._readOffset = int.Parse(fields[DSPMICROS]) / 1000;
            tr._frequency = int.Parse(fields[FREQUENCY]);
            

            if ("Mercury5" != _model)
            {
                tr._lqi = int.Parse(fields[LQI]);
            }

            return tr;
        }
 /// <summary>
 /// TagReadData EventArgs Constructor
 /// </summary>
 /// <param name="tagReadData">the tag read data</param>
 public TagReadDataEventArgs(TagReadData tagReadData)
 {
     _tagReadData = tagReadData;
 }
 private void displayTags(TagReadData[] trd) 
 {
     foreach (TagReadData tag in trd) 
     {
         //Print antenna and epc information for each tag found
         Console.WriteLine(String.Format("Ant:{0} EPC:{1}", tag.Antenna, tag.Epc));
     }
 }
 /// <summary>
 /// TagReadData EventArgs Constructor
 /// </summary>
 /// <param name="tagReadData">the tag read data</param>
 public TagReadDataEventArgs(TagReadData tagReadData)
 {
     _tagReadData = tagReadData;
 }
 static void PrintTagRead(TagReadData read)
 {
     List<string> strl = new List<string>();
     strl.Add(read.ToString());
     strl.Add("Protocol:" + read.Tag.Protocol.ToString());
     strl.Add("CRC:" + ByteFormat.ToHex(read.Tag.CrcBytes));
     if (read.Tag is Gen2.TagData)
     {
         Gen2.TagData g2td = (Gen2.TagData)(read.Tag);
         strl.Add("PC:" + ByteFormat.ToHex(g2td.PcBytes));
     }
     Console.WriteLine(String.Join(" ", strl.ToArray()));
 }
Exemple #10
0
 static void PrintTagReads(TagReadData[] reads)
 {
     foreach (TagReadData read in reads)
     {
         PrintTagRead(read);
     }
 }
 /// <summary>
 /// Method for updating Read Tag ID text box
 /// </summary>
 /// <param name="data">String Data</param>
 private void OutputUpdateReadTagID(TagReadData[] tags)
 {
     if (tags != null && tags.Length != 0)
     {
         foreach (TagReadData read in tags)
         {
             tagdb.Add(read, GpsMgr.LatLonString, readerName);
         }
     }
     UpdateBigNumBox(tagdb.TagList.Count.ToString());
 }
 /// <summary>
 /// Method to invoke OutputUpdateDelegate
 /// </summary>
 /// <param name="data">String Data</param>       
 public void UpdateReadTagIDBox(TagReadData[] tags)
 {
     if (dgTagResult.InvokeRequired)
     {
         dgTagResult.BeginInvoke(new OutputUpdateDelegate(OutputUpdateReadTagID), new object[] { tags });
     }
     else
     {
         OutputUpdateReadTagID(tags);
     }
 }
        private void ParseNotifyTag(MSG_RO_ACCESS_REPORT msg)
        {
            if (null == tagReads)
            {
                tagReads = new List<TagReadData>();
            }
            TagReadData tag = null;
            if (null != msg)
            {
                for (int i = 0; i < msg.TagReportData.Length; i++)
                {
                    try
                    {
                        tag = new TagReadData();
                        if (msg.TagReportData[i].EPCParameter.Count > 0)
                        {
                            string epc;
                            // reports come in two flavors.  Get the right flavor
                            if (msg.TagReportData[i].EPCParameter[0].GetType() == typeof(PARAM_EPC_96))
                            {
                                epc = ((PARAM_EPC_96)(msg.TagReportData[i].EPCParameter[0])).EPC.ToHexString();
                            }
                            else
                            {
                                epc = ((PARAM_EPCData)(msg.TagReportData[i].EPCParameter[0])).EPC.ToHexString();
                            }
                            TagData td = new TagData(ByteFormat.FromHex(epc));
                            TagProtocol tagProtocol = 0;
                            //Match the recieved rospec id with the rospec id stored in the hashtable at the time of setting readplan
                            if (roSpecProtcolTable.ContainsKey(msg.TagReportData[i].ROSpecID.ROSpecID))
                            {
                                tagProtocol = (TagProtocol)roSpecProtcolTable[msg.TagReportData[i].ROSpecID.ROSpecID];
                            }
                            if (TagProtocol.GEN2.Equals(tagProtocol))
                            {
                                //Get crc and pc bits
                                UNION_AirProtocolTagData tagdata = msg.TagReportData[i].AirProtocolTagData;
                                td = new Gen2.TagData(ByteFormat.FromHex(epc), ByteConv.EncodeU16(((PARAM_C1G2_CRC)tagdata[1]).CRC), ByteConv.EncodeU16(((PARAM_C1G2_PC)tagdata[0]).PC_Bits));
                            }
                            else if (TagProtocol.ISO180006B.Equals(tagProtocol))
                            {
                                td = new Iso180006b.TagData(ByteFormat.FromHex(epc));
                            }
                            else
                            {
                                td = new TagData(ByteFormat.FromHex(epc));
                            }
                            tag.Reader = this;
                            tag._tagData = td;
                            tag._antenna = (int)msg.TagReportData[i].AntennaID.AntennaID;
                            UInt64 usSinceEpoch = msg.TagReportData[i].LastSeenTimestampUTC.Microseconds;
                            tag._baseTime = epochTime.AddMilliseconds(usSinceEpoch / 1000);
                            tag._readOffset = 0;
                            // Since Spruce release firmware doesn't support phase, there won't be PARAM_ThingMagicTagReportContentSelector 
                            // custom paramter in ROReportSpec
                            string[] ver = softwareVersion.Split('.');
                            if (((Convert.ToInt32(ver[0]) == 4) && (Convert.ToInt32(ver[1]) >= 17)) ||
                                (Convert.ToInt32(ver[0]) > 4))
                            {
                                tag._phase = Convert.ToInt32(((PARAM_ThingMagicRFPhase)msg.TagReportData[i].Custom[0]).Phase);
                            }
                            tag.Rssi = Convert.ToInt32(msg.TagReportData[i].PeakRSSI.PeakRSSI.ToString());
                            tag.ReadCount = msg.TagReportData[i].TagSeenCount.TagCount;

                            int chIndex = Convert.ToInt32(msg.TagReportData[i].ChannelIndex.ChannelIndex);
                            List<uint> freq = frequencyHopTable[0].Frequency.data;
                            tag._frequency = Convert.ToInt32(freq[chIndex - 1]);
                            UNION_AccessCommandOpSpecResult opSpecResult = msg.TagReportData[i].AccessCommandOpSpecResult;

                            tag._data = EMPTY_DATA;
                            // Use try-finally to to keep failed tagops from preventing report of TagReadData
                            try
                            {
                                if (null != opSpecResult)
                                {
                                    if (opSpecResult.Count > 0)
                                    {
                                        ParseTagOpSpecResultType(opSpecResult, ref tag);
                                    }
                                }
                            }
                            finally
                            {
                                if (continuousReading)
                                {
                                    OnTagRead(tag);
                                }
                                else
                                {
                                    tagReads.Add(tag);
                                }
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        ReaderException rx;
                        if (ex is ReaderException)
                        {
                            rx = (ReaderException)ex;
                        }
                        else
                        {
                            rx = new ReaderException(ex.ToString());
                        }
                        //Release the TagQueueEmptyEvent when parsing exception raised
                        TagQueueEmptyEvent.Set();
                        ReadExceptionPublisher expub = new ReadExceptionPublisher(this, rx);

                        Thread trd = new Thread(expub.OnReadException);
                        trd.Name = "OnReadException";
                        trd.Start();
                    }
                    finally
                    {
                        tag = null;
                    }
                }
                TagQueueEmptyEvent.Set();
            }
        }
 private void ParseTagOpResponse(MSG_RO_ACCESS_REPORT response)
 {
     TagReadData td = new TagReadData();
     UNION_AccessCommandOpSpecResult opSpecResult = response.TagReportData[0].AccessCommandOpSpecResult;
     try
     {
         if (null != opSpecResult)
         {
             if (opSpecResult.Count > 0)
             {
                 ParseTagOpSpecResultType(opSpecResult, ref td);
                 TagQueueEmptyEvent.Set();
             }
         }
     }
     catch (ReaderException ex)
     {
         rx = ex;
         TagQueueEmptyEvent.Set();
     }
     finally
     {
         reportReceived = true;                
     }
     llrp.OnRoAccessReportReceived -= new delegateRoAccessReport(TagOpOnRoAccessReportReceived);
 }
 /// <summary>
 /// Parse tag opspec result type
 /// </summary>
 /// <param name="opSpecResult"></param>
 /// <param name="tag"></param>
 private void ParseTagOpSpecResultType(UNION_AccessCommandOpSpecResult opSpecResult, ref TagReadData tag)
 {
     // TODO: Generalize ReaderCodeExceptions to cover all types of readers, not just Serial
     if (opSpecResult[0].GetType() == typeof(PARAM_C1G2ReadOpSpecResult))
     {
         switch (((PARAM_C1G2ReadOpSpecResult)opSpecResult[0]).Result)
         {
             case ENUM_C1G2ReadResultType.Success:
                 tag._data = ByteConv.ConvertFromUshortArray(((PARAM_C1G2ReadOpSpecResult)opSpecResult[0]).ReadData.data.ToArray());
                 tagOpResponse = ((PARAM_C1G2ReadOpSpecResult)opSpecResult[0]).ReadData.data.ToArray();
                 break;
             case ENUM_C1G2ReadResultType.No_Response_From_Tag:
                 throw new ReaderCodeException("No response from tag", FAULT_PROTOCOL_NO_DATA_READ_Exception.StatusCode);
             case ENUM_C1G2ReadResultType.Nonspecific_Reader_Error:
                 throw new ReaderException("Non-specific reader error");
             case ENUM_C1G2ReadResultType.Nonspecific_Tag_Error:
                 throw new ReaderCodeException("Non-specific tag error", FAULT_GENERAL_TAG_ERROR_Exception.StatusCode);
             case ENUM_C1G2ReadResultType.Memory_Locked_Error:
                 throw new ReaderCodeException("Tag memory locked error", FAULT_GEN2_PROTOCOL_MEMORY_LOCKED_Exception.StatusCode);
             case ENUM_C1G2ReadResultType.Memory_Overrun_Error:
                 throw new ReaderCodeException("Tag memory overrun error", FAULT_GEN2_PROTOCOL_MEMORY_OVERRUN_BAD_PC_Exception.StatusCode);
         }
     }
     else if (opSpecResult[0].GetType() == typeof(PARAM_C1G2WriteOpSpecResult))
     {
         switch (((PARAM_C1G2WriteOpSpecResult)opSpecResult[0]).Result)
         {
             case ENUM_C1G2WriteResultType.Success:
                 break;
             case ENUM_C1G2WriteResultType.Insufficient_Power:
                 throw new ReaderCodeException("Insufficient power", FAULT_GEN2_PROTOCOL_INSUFFICIENT_POWER_Exception.StatusCode);
             case ENUM_C1G2WriteResultType.Tag_Memory_Locked_Error:
                 throw new ReaderCodeException("Tag memory locked error", FAULT_GEN2_PROTOCOL_MEMORY_LOCKED_Exception.StatusCode);
             case ENUM_C1G2WriteResultType.No_Response_From_Tag:
                 throw new ReaderCodeException("No response from tag", FAULT_PROTOCOL_NO_DATA_READ_Exception.StatusCode);
             case ENUM_C1G2WriteResultType.Nonspecific_Reader_Error:
                 throw new ReaderException("Non-specific reader error");
             case ENUM_C1G2WriteResultType.Nonspecific_Tag_Error:
                 throw new ReaderCodeException("Non-specific tag error", FAULT_GENERAL_TAG_ERROR_Exception.StatusCode);
             case ENUM_C1G2WriteResultType.Tag_Memory_Overrun_Error:
                 throw new ReaderCodeException("Tag memory overrun error", FAULT_GEN2_PROTOCOL_MEMORY_OVERRUN_BAD_PC_Exception.StatusCode);
         }
     }
     else if (opSpecResult[0].GetType() == typeof(PARAM_C1G2KillOpSpecResult))
     {
         switch (((PARAM_C1G2KillOpSpecResult)opSpecResult[0]).Result)
         {
             case ENUM_C1G2KillResultType.Success:
                 break;
             case ENUM_C1G2KillResultType.Insufficient_Power:
                 throw new ReaderCodeException("Insufficient power", FAULT_GEN2_PROTOCOL_INSUFFICIENT_POWER_Exception.StatusCode);
             case ENUM_C1G2KillResultType.No_Response_From_Tag:
                 throw new ReaderCodeException("No response from tag", FAULT_PROTOCOL_NO_DATA_READ_Exception.StatusCode);
             case ENUM_C1G2KillResultType.Nonspecific_Reader_Error:
                 throw new ReaderException("Non-specific reader error");
             case ENUM_C1G2KillResultType.Nonspecific_Tag_Error:
                 throw new ReaderCodeException("Non-specific tag error", FAULT_GENERAL_TAG_ERROR_Exception.StatusCode);
             case ENUM_C1G2KillResultType.Zero_Kill_Password_Error:
                 throw new ReaderException("Zero kill password error");
         }
     }
     else if (opSpecResult[0].GetType() == typeof(PARAM_C1G2BlockWriteOpSpecResult))
     {
         switch (((PARAM_C1G2BlockWriteOpSpecResult)opSpecResult[0]).Result)
         {
             case ENUM_C1G2BlockWriteResultType.Success:
                 break;
             case ENUM_C1G2BlockWriteResultType.Insufficient_Power:
                 throw new ReaderCodeException("Insufficient power", FAULT_GEN2_PROTOCOL_INSUFFICIENT_POWER_Exception.StatusCode);
             case ENUM_C1G2BlockWriteResultType.Tag_Memory_Locked_Error:
                 throw new ReaderCodeException("Tag memory locked error", FAULT_GEN2_PROTOCOL_MEMORY_LOCKED_Exception.StatusCode);
             case ENUM_C1G2BlockWriteResultType.No_Response_From_Tag:
                 throw new ReaderCodeException("No response from tag", FAULT_PROTOCOL_NO_DATA_READ_Exception.StatusCode);
             case ENUM_C1G2BlockWriteResultType.Nonspecific_Reader_Error:
                 throw new ReaderException("Non-specific reader error");
             case ENUM_C1G2BlockWriteResultType.Nonspecific_Tag_Error:
                 throw new ReaderCodeException("Non-specific tag error", FAULT_GENERAL_TAG_ERROR_Exception.StatusCode);
             case ENUM_C1G2BlockWriteResultType.Tag_Memory_Overrun_Error:
                 throw new ReaderCodeException("Tag memory overrun error", FAULT_GEN2_PROTOCOL_MEMORY_OVERRUN_BAD_PC_Exception.StatusCode);
         }
     }
     else if (opSpecResult[0].GetType() == typeof(PARAM_C1G2LockOpSpecResult))
     {
         switch (((PARAM_C1G2LockOpSpecResult)opSpecResult[0]).Result)
         {
             case ENUM_C1G2LockResultType.Success:
                 break;
             case ENUM_C1G2LockResultType.Insufficient_Power:
                 throw new ReaderCodeException("Insufficient power", FAULT_GEN2_PROTOCOL_INSUFFICIENT_POWER_Exception.StatusCode);
             case ENUM_C1G2LockResultType.No_Response_From_Tag:
                 throw new ReaderCodeException("No response from tag", FAULT_PROTOCOL_NO_DATA_READ_Exception.StatusCode);
             case ENUM_C1G2LockResultType.Nonspecific_Reader_Error:
                 throw new ReaderException("Non-specific reader error");
             case ENUM_C1G2LockResultType.Nonspecific_Tag_Error:
                 throw new ReaderCodeException("Non-specific tag error", FAULT_GENERAL_TAG_ERROR_Exception.StatusCode);
         }
     }
     else if (opSpecResult[0].GetType() == typeof(PARAM_C1G2BlockEraseOpSpecResult))
     {
         switch (((PARAM_C1G2BlockEraseOpSpecResult)opSpecResult[0]).Result)
         {
             case ENUM_C1G2BlockEraseResultType.Success:
                 break;
             case ENUM_C1G2BlockEraseResultType.Insufficient_Power:
                 throw new ReaderCodeException("Insufficient power", FAULT_GEN2_PROTOCOL_INSUFFICIENT_POWER_Exception.StatusCode);
             case ENUM_C1G2BlockEraseResultType.No_Response_From_Tag:
                 throw new ReaderCodeException("No response from tag", FAULT_PROTOCOL_NO_DATA_READ_Exception.StatusCode);
             case ENUM_C1G2BlockEraseResultType.Nonspecific_Reader_Error:
                 throw new ReaderException("Non-specific reader error");
             case ENUM_C1G2BlockEraseResultType.Nonspecific_Tag_Error:
                 throw new ReaderCodeException("Non-specific tag error", FAULT_GENERAL_TAG_ERROR_Exception.StatusCode);
             case ENUM_C1G2BlockEraseResultType.Tag_Memory_Locked_Error:
                 throw new ReaderCodeException("Tag memory locked error", FAULT_GEN2_PROTOCOL_MEMORY_LOCKED_Exception.StatusCode);
             case ENUM_C1G2BlockEraseResultType.Tag_Memory_Overrun_Error:
                 throw new ReaderCodeException("Tag memory overrun error", FAULT_GEN2_PROTOCOL_MEMORY_OVERRUN_BAD_PC_Exception.StatusCode);
         }
     }
     else if (opSpecResult[0].GetType() == typeof(PARAM_ThingMagicBlockPermalockOpSpecResult))
     {
         ParseCustomTagOpSpecResultType(((PARAM_ThingMagicBlockPermalockOpSpecResult)opSpecResult[0]).Result);
         if (((PARAM_ThingMagicBlockPermalockOpSpecResult)opSpecResult[0]).Result.Equals(ENUM_ThingMagicCustomTagOpSpecResultType.Success))
         {
             tagOpResponse = ByteConv.ConvertFromUshortArray(((PARAM_ThingMagicBlockPermalockOpSpecResult)opSpecResult[0]).PermalockStatus.data.ToArray());
         }
     }
     else if (opSpecResult[0].GetType() == typeof(PARAM_ThingMagicWriteTagOpSpecResult))
     {
         ParseCustomTagOpSpecResultType(((PARAM_ThingMagicWriteTagOpSpecResult)opSpecResult[0]).Result);
     }
     else if (opSpecResult[0].GetType() == typeof(PARAM_ThingMagicHiggs2PartialLoadImageOpSpecResult))
     {
         ParseCustomTagOpSpecResultType(((PARAM_ThingMagicHiggs2PartialLoadImageOpSpecResult)opSpecResult[0]).Result);
     }
     else if (opSpecResult[0].GetType() == typeof(PARAM_ThingMagicHiggs2FullLoadImageOpSpecResult))
     {
         ParseCustomTagOpSpecResultType(((PARAM_ThingMagicHiggs2FullLoadImageOpSpecResult)opSpecResult[0]).Result);
     }
     else if (opSpecResult[0].GetType() == typeof(PARAM_ThingMagicNXPG2XResetReadProtectOpSpecResult))
     {
         ParseCustomTagOpSpecResultType(((PARAM_ThingMagicNXPG2XResetReadProtectOpSpecResult)opSpecResult[0]).Result);
     }
     else if (opSpecResult[0].GetType() == typeof(PARAM_ThingMagicHiggs3FastLoadImageOpSpecResult))
     {
         ParseCustomTagOpSpecResultType(((PARAM_ThingMagicHiggs3FastLoadImageOpSpecResult)opSpecResult[0]).Result);
     }
     else if (opSpecResult[0].GetType() == typeof(PARAM_ThingMagicHiggs3LoadImageOpSpecResult))
     {
         ParseCustomTagOpSpecResultType(((PARAM_ThingMagicHiggs3LoadImageOpSpecResult)opSpecResult[0]).Result);
     }
     else if (opSpecResult[0].GetType() == typeof(PARAM_ThingMagicHiggs3BlockReadLockOpSpecResult))
     {
         ParseCustomTagOpSpecResultType(((PARAM_ThingMagicHiggs3BlockReadLockOpSpecResult)opSpecResult[0]).Result);
     }
     else if (opSpecResult[0].GetType() == typeof(PARAM_ThingMagicNXPG2ICalibrateOpSpecResult))
     {
         ParseCustomTagOpSpecResultType(((PARAM_ThingMagicNXPG2ICalibrateOpSpecResult)opSpecResult[0]).Result);
         if (((PARAM_ThingMagicNXPG2ICalibrateOpSpecResult)opSpecResult[0]).Result.Equals(ENUM_ThingMagicCustomTagOpSpecResultType.Success))
         {
             tagOpResponse = ((PARAM_ThingMagicNXPG2ICalibrateOpSpecResult)opSpecResult[0]).CalibrateData.ToArray();
         }
     }
     else if (opSpecResult[0].GetType() == typeof(PARAM_ThingMagicNXPG2IChangeConfigOpSpecResult))
     {
         ParseCustomTagOpSpecResultType(((PARAM_ThingMagicNXPG2IChangeConfigOpSpecResult)opSpecResult[0]).Result);
         if (((PARAM_ThingMagicNXPG2IChangeConfigOpSpecResult)opSpecResult[0]).Result.Equals(ENUM_ThingMagicCustomTagOpSpecResultType.Success))
         {
             Gen2.NXP.G2I.ConfigWord word = new Gen2.NXP.G2I.ConfigWord();
             tagOpResponse = word.GetConfigWord(((PARAM_ThingMagicNXPG2IChangeConfigOpSpecResult)opSpecResult[0]).ConfigData);
         }
     }
     else if (opSpecResult[0].GetType() == typeof(PARAM_ThingMagicNXPG2IChangeEASOpSpecResult))
     {
         ParseCustomTagOpSpecResultType(((PARAM_ThingMagicNXPG2IChangeEASOpSpecResult)opSpecResult[0]).Result);
     }
     else if (opSpecResult[0].GetType() == typeof(PARAM_ThingMagicNXPG2IResetReadProtectOpSpecResult))
     {
         ParseCustomTagOpSpecResultType(((PARAM_ThingMagicNXPG2IResetReadProtectOpSpecResult)opSpecResult[0]).Result);
     }
     else if (opSpecResult[0].GetType() == typeof(PARAM_ThingMagicNXPG2ISetReadProtectOpSpecResult))
     {
         ParseCustomTagOpSpecResultType(((PARAM_ThingMagicNXPG2ISetReadProtectOpSpecResult)opSpecResult[0]).Result);
     }
     else if (opSpecResult[0].GetType() == typeof(PARAM_ThingMagicNXPG2XCalibrateOpSpecResult))
     {
         ParseCustomTagOpSpecResultType(((PARAM_ThingMagicNXPG2XCalibrateOpSpecResult)opSpecResult[0]).Result);
         if (((PARAM_ThingMagicNXPG2XCalibrateOpSpecResult)opSpecResult[0]).Result.Equals(ENUM_ThingMagicCustomTagOpSpecResultType.Success))
         {
             tagOpResponse = ((PARAM_ThingMagicNXPG2XCalibrateOpSpecResult)opSpecResult[0]).CalibrateData.ToArray();
         }
     }
     else if (opSpecResult[0].GetType() == typeof(PARAM_ThingMagicNXPG2XChangeEASOpSpecResult))
     {
         ParseCustomTagOpSpecResultType(((PARAM_ThingMagicNXPG2XChangeEASOpSpecResult)opSpecResult[0]).Result);
     }
     else if (opSpecResult[0].GetType() == typeof(PARAM_ThingMagicNXPG2XSetReadProtectOpSpecResult))
     {
         ParseCustomTagOpSpecResultType(((PARAM_ThingMagicNXPG2XSetReadProtectOpSpecResult)opSpecResult[0]).Result);
     }
     else if (opSpecResult[0].GetType() == typeof(PARAM_ThingMagicImpinjMonza4QTReadWriteOpSpecResult))
     {
         ParseCustomTagOpSpecResultType(((PARAM_ThingMagicImpinjMonza4QTReadWriteOpSpecResult)opSpecResult[0]).Result);
         if (((PARAM_ThingMagicImpinjMonza4QTReadWriteOpSpecResult)opSpecResult[0]).Result.Equals(ENUM_ThingMagicCustomTagOpSpecResultType.Success))
         {
             Gen2.Impinj.Monza4.QTPayload qtPayload = new Gen2.Impinj.Monza4.QTPayload();
             int res = ((PARAM_ThingMagicImpinjMonza4QTReadWriteOpSpecResult)opSpecResult[0]).Payload;
             //Construct QTPayload
             if ((res & 0x8000) != 0)
             {
                 qtPayload.QTSR = true;
             }
             if ((res & 0x4000) != 0)
             {
                 qtPayload.QTMEM = true;
             }
             tagOpResponse = qtPayload;
         }
     }
     else if (opSpecResult[0].GetType() == typeof(PARAM_ThingMagicNXPG2IEASAlarmOpSpecResult))
     {
         ParseCustomTagOpSpecResultType(((PARAM_ThingMagicNXPG2IEASAlarmOpSpecResult)opSpecResult[0]).Result);
         if (((PARAM_ThingMagicNXPG2IEASAlarmOpSpecResult)opSpecResult[0]).Result.Equals(ENUM_ThingMagicCustomTagOpSpecResultType.Success))
         {
             tagOpResponse = ((PARAM_ThingMagicNXPG2IEASAlarmOpSpecResult)opSpecResult[0]).EASAlarmCode;
         }
     }
     else if (opSpecResult[0].GetType() == typeof(PARAM_ThingMagicNXPG2XEASAlarmOpSpecResult))
     {
         ParseCustomTagOpSpecResultType(((PARAM_ThingMagicNXPG2XEASAlarmOpSpecResult)opSpecResult[0]).Result);
         if (((PARAM_ThingMagicNXPG2XEASAlarmOpSpecResult)opSpecResult[0]).Result.Equals(ENUM_ThingMagicCustomTagOpSpecResultType.Success))
         {
             tagOpResponse = ((PARAM_ThingMagicNXPG2XEASAlarmOpSpecResult)opSpecResult[0]).EASAlarmCode;
         }
     }
     else if (opSpecResult[0].GetType() == typeof(PARAM_ThingMagicISO180006BReadOpSpecResult))
     {
         ParseCustomTagOpSpecResultType(((PARAM_ThingMagicISO180006BReadOpSpecResult)opSpecResult[0]).Result);
         if (((PARAM_ThingMagicISO180006BReadOpSpecResult)opSpecResult[0]).Result.Equals(ENUM_ThingMagicCustomTagOpSpecResultType.Success))
         {
             tag._data = ((PARAM_ThingMagicISO180006BReadOpSpecResult)opSpecResult[0]).ReadData.ToArray();
             tagOpResponse = ((PARAM_ThingMagicISO180006BReadOpSpecResult)opSpecResult[0]).ReadData.ToArray();
         }
     }
     else if (opSpecResult[0].GetType() == typeof(PARAM_ThingMagicISO180006BLockOpSpecResult))
     {
         ParseCustomTagOpSpecResultType(((PARAM_ThingMagicISO180006BLockOpSpecResult)opSpecResult[0]).Result);
     }
     else if (opSpecResult[0].GetType() == typeof(PARAM_ThingMagicISO180006BWriteOpSpecResult))
     {
         ParseCustomTagOpSpecResultType(((PARAM_ThingMagicISO180006BWriteOpSpecResult)opSpecResult[0]).Result);
     }
     else if (opSpecResult[0].GetType() == typeof(PARAM_ThingMagicIDSSL900AGetBatteryLevelOpSpecResult))
     {
         ParseCustomTagOpSpecResultType(((PARAM_ThingMagicIDSSL900AGetBatteryLevelOpSpecResult)opSpecResult[0]).Result);
         if (((PARAM_ThingMagicIDSSL900AGetBatteryLevelOpSpecResult)opSpecResult[0]).Result.Equals(ENUM_ThingMagicCustomTagOpSpecResultType.Success))
         {
             tag._data = ByteConv.EncodeU16(((PARAM_ThingMagicIDSSL900AGetBatteryLevelOpSpecResult)opSpecResult[0]).ThingMagicIDSBatteryLevel.reply);
             Gen2.IDS.SL900A.BatteryLevelReading batteryLevel = new Gen2.IDS.SL900A.BatteryLevelReading(((PARAM_ThingMagicIDSSL900AGetBatteryLevelOpSpecResult)opSpecResult[0]).ThingMagicIDSBatteryLevel.reply);
             tagOpResponse = batteryLevel;
         }
     }
     else if (opSpecResult[0].GetType() == typeof(PARAM_ThingMagicIDSSL900ASensorValueOpSpecResult))
     {
         ParseCustomTagOpSpecResultType(((PARAM_ThingMagicIDSSL900ASensorValueOpSpecResult)opSpecResult[0]).Result);
         if (((PARAM_ThingMagicIDSSL900ASensorValueOpSpecResult)opSpecResult[0]).Result.Equals(ENUM_ThingMagicCustomTagOpSpecResultType.Success))
         {
             tag._data = ByteConv.EncodeU16(((PARAM_ThingMagicIDSSL900ASensorValueOpSpecResult)opSpecResult[0]).reply);
             Gen2.IDS.SL900A.SensorReading sensorReading = new Gen2.IDS.SL900A.SensorReading(((PARAM_ThingMagicIDSSL900ASensorValueOpSpecResult)opSpecResult[0]).reply);
             tagOpResponse = sensorReading;
         }
     }
     else if (opSpecResult[0].GetType() == typeof(PARAM_ThingMagicIDSSL900ASetCalibrationDataOpSpecResult))
     {
         ParseCustomTagOpSpecResultType(((PARAM_ThingMagicIDSSL900ASetCalibrationDataOpSpecResult)opSpecResult[0]).Result);
     }
     else if (opSpecResult[0].GetType() == typeof(PARAM_ThingMagicIDSSL900AGetCalibrationDataOpSpecResult))
     {
         ParseCustomTagOpSpecResultType(((PARAM_ThingMagicIDSSL900AGetCalibrationDataOpSpecResult)opSpecResult[0]).Result);
         if (((PARAM_ThingMagicIDSSL900AGetCalibrationDataOpSpecResult)opSpecResult[0]).Result.Equals(ENUM_ThingMagicCustomTagOpSpecResultType.Success))
         {
             PARAM_ThingMagicIDSCalibrationData data = ((PARAM_ThingMagicIDSSL900AGetCalibrationDataOpSpecResult)opSpecResult[0]).ThingMagicIDSCalibrationData;
             LTKD.ByteArray calibrationValue = data.calibrationValueByteStream;
             tag._data = calibrationValue.ToArray();
             tagOpResponse = new Gen2.IDS.SL900A.CalSfe(calibrationValue.ToArray(), 0);
         }
     }
     else if (opSpecResult[0].GetType() == typeof(PARAM_ThingMagicIDSSL900AEndLogOpSpecResult))
     {
         ParseCustomTagOpSpecResultType(((PARAM_ThingMagicIDSSL900AEndLogOpSpecResult)opSpecResult[0]).Result);
     }
     else if (opSpecResult[0].GetType() == typeof(PARAM_ThingMagicIDSSL900AInitializeOpSpecResult))
     {
         ParseCustomTagOpSpecResultType(((PARAM_ThingMagicIDSSL900AInitializeOpSpecResult)opSpecResult[0]).Result);
     }
     else if (opSpecResult[0].GetType() == typeof(PARAM_ThingMagicIDSSL900ALogStateOpSpecResult))
     {
         ParseCustomTagOpSpecResultType(((PARAM_ThingMagicIDSSL900ALogStateOpSpecResult)opSpecResult[0]).Result);
         if (((PARAM_ThingMagicIDSSL900ALogStateOpSpecResult)opSpecResult[0]).Result.Equals(ENUM_ThingMagicCustomTagOpSpecResultType.Success))
         {
             LTKD.ByteArray logStateByteArray = ((PARAM_ThingMagicIDSSL900ALogStateOpSpecResult)opSpecResult[0]).LogStateByteStream;
             tag._data = logStateByteArray.ToArray();
             tagOpResponse = new Gen2.IDS.SL900A.LogState(logStateByteArray.ToArray());
         }
     }
     else if (opSpecResult[0].GetType() == typeof(PARAM_ThingMagicIDSSL900ASetLogModeOpSpecResult))
     {
         ParseCustomTagOpSpecResultType(((PARAM_ThingMagicIDSSL900ASetLogModeOpSpecResult)opSpecResult[0]).Result);
     }
     else if (opSpecResult[0].GetType() == typeof(PARAM_ThingMagicIDSSL900AStartLogOpSpecResult))
     {
         ParseCustomTagOpSpecResultType(((PARAM_ThingMagicIDSSL900AStartLogOpSpecResult)opSpecResult[0]).Result);
     }
     else if (opSpecResult[0].GetType() == typeof(PARAM_ThingMagicIDSSL900ASetSFEParamsOpSpecResult))
     {
         ParseCustomTagOpSpecResultType(((PARAM_ThingMagicIDSSL900ASetSFEParamsOpSpecResult)opSpecResult[0]).Result);
     }
     else if (opSpecResult[0].GetType() == typeof(PARAM_ThingMagicIDSSL900AGetMeasurementSetupOpSpecResult))
     {
         ParseCustomTagOpSpecResultType(((PARAM_ThingMagicIDSSL900AGetMeasurementSetupOpSpecResult)opSpecResult[0]).Result);
         if (((PARAM_ThingMagicIDSSL900AGetMeasurementSetupOpSpecResult)opSpecResult[0]).Result.Equals(ENUM_ThingMagicCustomTagOpSpecResultType.Success))
         {
             LTKD.ByteArray measurementByteArray = ((PARAM_ThingMagicIDSSL900AGetMeasurementSetupOpSpecResult)opSpecResult[0]).measurementByteStream;
             tag._data = measurementByteArray.ToArray();
             tagOpResponse = new Gen2.IDS.SL900A.MeasurementSetupData(measurementByteArray.ToArray(), 0);
         }
     }
     else if (opSpecResult[0].GetType() == typeof(PARAM_ThingMagicIDSSL900AAccessFIFOReadOpSpecResult))
     {
         ParseCustomTagOpSpecResultType(((PARAM_ThingMagicIDSSL900AAccessFIFOReadOpSpecResult)opSpecResult[0]).Result);
         if (((PARAM_ThingMagicIDSSL900AAccessFIFOReadOpSpecResult)opSpecResult[0]).Result.Equals(ENUM_ThingMagicCustomTagOpSpecResultType.Success))
         {
             LTKD.ByteArray readPayLoad = ((PARAM_ThingMagicIDSSL900AAccessFIFOReadOpSpecResult)opSpecResult[0]).readPayLoad;
             tag._data = readPayLoad.ToArray();
             tagOpResponse = readPayLoad.ToArray();
         }
     }
     else if (opSpecResult[0].GetType() == typeof(PARAM_ThingMagicIDSSL900AAccessFIFOWriteOpSpecResult))
     {
         ParseCustomTagOpSpecResultType(((PARAM_ThingMagicIDSSL900AAccessFIFOWriteOpSpecResult)opSpecResult[0]).Result);
     }
     else if (opSpecResult[0].GetType() == typeof(PARAM_ThingMagicIDSSL900AAccessFIFOStatusOpSpecResult))
     {
         ParseCustomTagOpSpecResultType(((PARAM_ThingMagicIDSSL900AAccessFIFOStatusOpSpecResult)opSpecResult[0]).Result);
         if (((PARAM_ThingMagicIDSSL900AAccessFIFOStatusOpSpecResult)opSpecResult[0]).Result.Equals(ENUM_ThingMagicCustomTagOpSpecResultType.Success))
         {
             tag._data = ByteConv.EncodeU16(Convert.ToUInt16(((PARAM_ThingMagicIDSSL900AAccessFIFOStatusOpSpecResult)opSpecResult[0]).FIFOStatusRawByte));
             tagOpResponse = new Gen2.IDS.SL900A.FifoStatus(((PARAM_ThingMagicIDSSL900AAccessFIFOStatusOpSpecResult)opSpecResult[0]).FIFOStatusRawByte);
         }
     }
     else if (opSpecResult[0].GetType() == typeof(PARAM_ThingMagicIDSSL900ASetLogLimitsOpSpecResult))
     {
         ParseCustomTagOpSpecResultType(((PARAM_ThingMagicIDSSL900ASetLogLimitsOpSpecResult)opSpecResult[0]).Result);
     }
     else if (opSpecResult[0].GetType() == typeof(PARAM_ThingMagicIDSSetShelfLifeOpSpecResult))
     {
         ParseCustomTagOpSpecResultType(((PARAM_ThingMagicIDSSetShelfLifeOpSpecResult)opSpecResult[0]).Result);
     }
     else if (opSpecResult[0].GetType() == typeof(PARAM_ThingMagicIDSSL900ASetPasswordOpSpecResult))
     {
        ParseCustomTagOpSpecResultType(((PARAM_ThingMagicIDSSL900ASetPasswordOpSpecResult)opSpecResult[0]).Result);
     }
     else if(opSpecResult[0].GetType() == typeof(PARAM_ThingMagicDenatranIAVActivateSecureModeOpSpecResult))
     {
         ParseCustomTagOpSpecResultType(((PARAM_ThingMagicDenatranIAVActivateSecureModeOpSpecResult)opSpecResult[0]).Result);
         if (((PARAM_ThingMagicDenatranIAVActivateSecureModeOpSpecResult)opSpecResult[0]).Result.Equals(ENUM_ThingMagicCustomTagOpSpecResultType.Success))
         {
             LTKD.ByteArray activateSecureModeValue = ((PARAM_ThingMagicDenatranIAVActivateSecureModeOpSpecResult)opSpecResult[0]).ActivateSecureModeByteStream;
             tag._data = activateSecureModeValue.ToArray();
             tagOpResponse = activateSecureModeValue.ToArray();
         }
     }
     else if(opSpecResult[0].GetType() == typeof(PARAM_ThingMagicDenatranIAVActivateSiniavModeOpSpecResult))
     {
         ParseCustomTagOpSpecResultType(((PARAM_ThingMagicDenatranIAVActivateSiniavModeOpSpecResult)opSpecResult[0]).Result);
         if (((PARAM_ThingMagicDenatranIAVActivateSiniavModeOpSpecResult)opSpecResult[0]).Result.Equals(ENUM_ThingMagicCustomTagOpSpecResultType.Success))
         {
             LTKD.ByteArray activateSiniavModeValue = ((PARAM_ThingMagicDenatranIAVActivateSiniavModeOpSpecResult)opSpecResult[0]).ActivateSiniavModeByteStream;
             tag._data = activateSiniavModeValue.ToArray();
             tagOpResponse = activateSiniavModeValue.ToArray();
         }
     }
     else if(opSpecResult[0].GetType() == typeof(PARAM_ThingMagicDenatranIAVAuthenticateOBUOpSpecResult))
     {
         ParseCustomTagOpSpecResultType(((PARAM_ThingMagicDenatranIAVAuthenticateOBUOpSpecResult)opSpecResult[0]).Result);
         if (((PARAM_ThingMagicDenatranIAVAuthenticateOBUOpSpecResult)opSpecResult[0]).Result.Equals(ENUM_ThingMagicCustomTagOpSpecResultType.Success))
         {
             LTKD.ByteArray authenticateOBUValue = ((PARAM_ThingMagicDenatranIAVAuthenticateOBUOpSpecResult)opSpecResult[0]).AuthenitcateOBUByteStream;
             tag._data = authenticateOBUValue.ToArray();
             tagOpResponse = authenticateOBUValue.ToArray();
         }
     }
     else if(opSpecResult[0].GetType() == typeof(PARAM_ThingMagicDenatranIAVOBUAuthenticateFullPass1OpSpecResult))
     {
         ParseCustomTagOpSpecResultType(((PARAM_ThingMagicDenatranIAVOBUAuthenticateFullPass1OpSpecResult)opSpecResult[0]).Result);
         if (((PARAM_ThingMagicDenatranIAVOBUAuthenticateFullPass1OpSpecResult)opSpecResult[0]).Result.Equals(ENUM_ThingMagicCustomTagOpSpecResultType.Success))
         {
             LTKD.ByteArray authenticateFullPass1Value = ((PARAM_ThingMagicDenatranIAVOBUAuthenticateFullPass1OpSpecResult)opSpecResult[0]).OBUAuthenticateFullPass1ByteStream;
             tag._data = authenticateFullPass1Value.ToArray();
             tagOpResponse = authenticateFullPass1Value.ToArray();
         }
     }
     else if(opSpecResult[0].GetType() == typeof(PARAM_ThingMagicDenatranIAVOBUAuthenticateFullPass2OpSpecResult))
     {
         ParseCustomTagOpSpecResultType(((PARAM_ThingMagicDenatranIAVOBUAuthenticateFullPass2OpSpecResult)opSpecResult[0]).Result);
         if (((PARAM_ThingMagicDenatranIAVOBUAuthenticateFullPass2OpSpecResult)opSpecResult[0]).Result.Equals(ENUM_ThingMagicCustomTagOpSpecResultType.Success))
         {
             LTKD.ByteArray authenticateFullPass2Value = ((PARAM_ThingMagicDenatranIAVOBUAuthenticateFullPass2OpSpecResult)opSpecResult[0]).OBUAuthenticateFullPass2ByteStream;
             tag._data = authenticateFullPass2Value.ToArray();
             tagOpResponse = authenticateFullPass2Value.ToArray();
         }
     }
     else if(opSpecResult[0].GetType() == typeof(PARAM_ThingMagicDenatranIAVOBUAuthenticateIDOpSpecResult))
     {
         ParseCustomTagOpSpecResultType(((PARAM_ThingMagicDenatranIAVOBUAuthenticateIDOpSpecResult)opSpecResult[0]).Result);
         if (((PARAM_ThingMagicDenatranIAVOBUAuthenticateIDOpSpecResult)opSpecResult[0]).Result.Equals(ENUM_ThingMagicCustomTagOpSpecResultType.Success))
         {
             LTKD.ByteArray authenticateIDValue = ((PARAM_ThingMagicDenatranIAVOBUAuthenticateIDOpSpecResult)opSpecResult[0]).OBUAuthenticateIDByteStream;
             tag._data = authenticateIDValue.ToArray();
             tagOpResponse = authenticateIDValue.ToArray();
         }
     }
     else if(opSpecResult[0].GetType() == typeof(PARAM_ThingMagicDenatranIAVOBUReadFromMemMapOpSpecResult))
     {
         ParseCustomTagOpSpecResultType(((PARAM_ThingMagicDenatranIAVOBUReadFromMemMapOpSpecResult)opSpecResult[0]).Result);
         if (((PARAM_ThingMagicDenatranIAVOBUReadFromMemMapOpSpecResult)opSpecResult[0]).Result.Equals(ENUM_ThingMagicCustomTagOpSpecResultType.Success))
         {
             LTKD.ByteArray readMemoryMapValue = ((PARAM_ThingMagicDenatranIAVOBUReadFromMemMapOpSpecResult)opSpecResult[0]).OBUReadMemoryMapByteStream;
             tag._data = readMemoryMapValue.ToArray();
             tagOpResponse = readMemoryMapValue.ToArray();
         }
     }
     else if (opSpecResult[0].GetType() == typeof(PARAM_ThingMagicDenatranIAVOBUWriteToMemMapOpSpecResult))
     {
         ParseCustomTagOpSpecResultType(((PARAM_ThingMagicDenatranIAVOBUWriteToMemMapOpSpecResult)opSpecResult[0]).Result);
         if (((PARAM_ThingMagicDenatranIAVOBUWriteToMemMapOpSpecResult)opSpecResult[0]).Result.Equals(ENUM_ThingMagicCustomTagOpSpecResultType.Success))
         {
             LTKD.ByteArray writeMemoryMapValue = ((PARAM_ThingMagicDenatranIAVOBUWriteToMemMapOpSpecResult)opSpecResult[0]).OBUWriteMemoryMapByteStream;
             tag._data = writeMemoryMapValue.ToArray();
             tagOpResponse = writeMemoryMapValue.ToArray();
         }
     }
 }