Пример #1
0
        // This event handler will be called when tag
        // operations have been executed by the reader.
        static void OnTagOpComplete(ImpinjReader reader, TagOpReport report)
        {
            string userData, tidData, epcData;

            userData = tidData = epcData = "";

            // Loop through all the completed tag operations
            foreach (TagOpResult result in report)
            {
                // Was this completed operation a tag read operation?
                if (result is TagReadOpResult)
                {
                    // Cast it to the correct type.
                    TagReadOpResult readResult = result as TagReadOpResult;

                    // Save the EPC
                    epcData = readResult.Tag.Epc.ToHexString();

                    // Are these the results for User memory or TID?
                    if (readResult.OpId == opIdUser)
                    {
                        userData = readResult.Data.ToHexString();
                    }
                    else if (readResult.OpId == opIdTid)
                    {
                        tidData = readResult.Data.ToHexString();
                    }
                }
            }

            // Print out the results after both Optimized Read operations have completed.
            Console.WriteLine("EPC : {0}, TID : {1}, User : {2}", epcData, tidData, userData);
        }
Пример #2
0
        // This event handler will be called when tag
        // operations have been executed by the reader.
        static void OnTagOpComplete(ImpinjReader reader, TagOpReport report)
        {
            // Loop through all the completed tag operations
            foreach (TagOpResult result in report)
            {
                // Was this completed operation a tag read operation?
                if (result is TagReadOpResult)
                {
                    // Cast it to the correct type.
                    TagReadOpResult readResult = result as TagReadOpResult;

                    // Process the read results
                    HandleReadOpComplete(readResult);
                }
                // Was it a tag write operation?
                else if (result is TagWriteOpResult)
                {
                    // Cast it to the correct type.
                    TagWriteOpResult writeResult = result as TagWriteOpResult;

                    // Process the write results
                    HandleWriteOpComplete(writeResult);
                }
            }
        }
Пример #3
0
        // This event handler will be called when tag
        // operations have been executed by the reader.
        static void OnTagOpComplete(ImpinjReader reader, TagOpReport report)
        {
            // Loop through all the completed tag operations
            foreach (TagOpResult result in report)
            {
                // Was this completed operation QT set operation?
                if (result is TagQtSetOpResult)
                {
                    // Cast it to a QT set result.
                    TagQtSetOpResult qtSetResult = result as TagQtSetOpResult;

                    // Print the status.
                    Console.WriteLine("QT set operation complete. Status : {0}", qtSetResult.Result);
                }
                // Was this completed operation QT get operation?
                else if (result is TagQtGetOpResult)
                {
                    // Cast it to a QT get result.
                    TagQtGetOpResult qtGetResult = result as TagQtGetOpResult;

                    // Print the status.
                    Console.WriteLine("QT get operation complete. Status : {0}", qtGetResult.Result);
                    Console.WriteLine("    Data Profile : {0}, Access Range : {1}", qtGetResult.DataProfile, qtGetResult.AccessRange);
                }
            }
        }
Пример #4
0
        public static void OnTagOpComplete(ImpinjReader reader, TagOpReport report)
        {
            // Loop through all the completed tag operations.
            foreach (TagOpResult result in report)
            {
                // Was this completed operation a tag write operation?
                if (result is TagWriteOpResult)
                {
                    // Cast it to the correct type.
                    TagWriteOpResult writeResult = result as TagWriteOpResult;
                    if (writeResult.OpId == EPC_OP_ID)
                    {
                        Console.WriteLine("Write to EPC complete : {0}", writeResult.Result);
                    }
                    else if (writeResult.OpId == PC_BITS_OP_ID)
                    {
                        Console.WriteLine("Write to PC bits complete : {0}", writeResult.Result);
                    }

                    // Print out the number of words written
                    Console.WriteLine("Number of words written : {0}", writeResult.NumWordsWritten);
                }
            }
            reader.TagsReported += EventHandlers.OnTagsReported;
        }
Пример #5
0
 // This event handler will be called when tag
 // operations have been executed by the reader.
 static void OnTagOpComplete(ImpinjReader reader, TagOpReport report)
 {
     // Loop through all the completed tag operations
     foreach (TagOpResult result in report)
     {
         if (result is TagWriteOpResult)
         {
             // These are the results of settings the access password.
             // Cast it to the correct type.
             TagWriteOpResult writeResult = result as TagWriteOpResult;
             // Print out the results.
             Console.WriteLine("Set access password complete.");
             Console.WriteLine("EPC : {0}", writeResult.Tag.Epc);
             Console.WriteLine("Status : {0}", writeResult.Result);
             Console.WriteLine("Number of words written : {0}", writeResult.NumWordsWritten);
         }
         else if (result is TagLockOpResult)
         {
             // Cast it to the correct type.
             // These are the results of locking the access password or user memory.
             TagLockOpResult lockResult = result as TagLockOpResult;
             // Print out the results.
             Console.WriteLine("Lock operation complete.");
             Console.WriteLine("EPC : {0}", lockResult.Tag.Epc);
             Console.WriteLine("Status : {0}", lockResult.Result);
         }
     }
 }
Пример #6
0
 // This event handler will be called when tag
 // operations have been executed by the reader.
 static void OnTagOpComplete(ImpinjReader reader, TagOpReport report)
 {
     // Loop through all the completed tag operations
     foreach (TagOpResult result in report)
     {
         // Is this the result of a block permalock operation?
         if (result is TagBlockPermalockOpResult)
         {
             // Print the results.
             TagBlockPermalockOpResult bplResult = result as TagBlockPermalockOpResult;
             Console.WriteLine("Block Permalock Complete ({0}) {1}", bplResult.Tag.Epc, bplResult.Result);
         }
     }
 }
Пример #7
0
 // This event handler will be called when tag
 // operations have been executed by the reader.
 static void OnTagOpComplete(ImpinjReader reader, TagOpReport report)
 {
     // Loop through all the completed tag operations
     foreach (TagOpResult result in report)
     {
         // Is this the result of a margin read operation?
         if (result is TagMarginReadOpResult)
         {
             // Print the results.
             TagMarginReadOpResult mrResult = result as TagMarginReadOpResult;
             Console.WriteLine("Margin Read Complete ({0}) {1}", mrResult.Tag.Epc, mrResult.Result);
         }
     }
 }
Пример #8
0
 // This event handler will be called when tag
 // operations have been executed by the reader.
 static void OnTagOpComplete(ImpinjReader reader, TagOpReport report)
 {
     // Loop through all the completed tag operations
     foreach (TagOpResult result in report)
     {
         // Was this completed operation a tag read operation?
         if (result is TagReadOpResult)
         {
             // Cast it to the correct type.
             TagReadOpResult readResult = result as TagReadOpResult;
             // Print out the results.
             Console.WriteLine("Read complete.");
             Console.WriteLine("EPC : {0}", readResult.Tag.Epc);
             Console.WriteLine("Status : {0}", readResult.Result);
             Console.WriteLine("User memory data : {0}", readResult.Data);
         }
     }
 }
Пример #9
0
 // This event handler will be called when tag
 // operations have been executed by the reader.
 static void OnTagOpComplete(ImpinjReader reader, TagOpReport report)
 {
     // Loop through all the completed tag operations
     foreach (TagOpResult result in report)
     {
         // Was this completed operation a tag write operation?
         if (result is TagWriteOpResult)
         {
             // Cast it to the correct type.
             TagWriteOpResult writeResult = result as TagWriteOpResult;
             // Print out the results.
             Console.WriteLine("Write complete.");
             Console.WriteLine("EPC : {0}", writeResult.Tag.Epc);
             Console.WriteLine("Status : {0}", writeResult.Result);
             Console.WriteLine("Number of words written : {0}", writeResult.NumWordsWritten);
         }
     }
 }
Пример #10
0
        void OnTagOpComplete(ImpinjReader reader, TagOpReport report)
        {
            foreach (TagOpResult result in report)
            {
                if (result is TagWriteOpResult)
                {
                    TagWriteOpResult writeResult = result as TagWriteOpResult;
                    if (writeResult.OpId == EPC_OP_ID)
                    {
                        mWriteTagCount++;
                        if (writeResult.Result == WriteResultStatus.Success)
                        {
                            mWriteSuccessTagCount++;
                        }
                        Invoke(new Action(() =>
                        {
                            label11_writeTag.Text = mWriteSuccessTagCount.ToString();
                        }));

                        if (epcList.Count == mWriteTagCount)
                        {
                            bool re = mWriteSuccessTagCount == mWriteTagCount;
                            mReader.Stop();
                            SetInventoryResult(re?1:3);
                            playSound(re);
                            Invoke(new Action(() =>
                            {
                                dataGridView1_msg.Rows.Insert(0, re?"写入成功":"部分写入失败,请重新投");
                                if (!re)
                                {
                                    dataGridView1_msg.Rows[0].DefaultCellStyle.BackColor = Color.OrangeRed;
                                }
                                if (re)
                                {
                                    textBox3_totalHuCount.Text = (++mHuTotalCount).ToString();
                                }
                                mTotalTags += mWriteSuccessTagCount;
                                textBox4_totalwriteEpcCount.Text = mTotalTags.ToString();
                            }));
                        }
                    }
                }
            }
        }
Пример #11
0
        // This event handler will be called when tag
        // operations have been executed by the reader.
        static void OnTagOpComplete(ImpinjReader reader, TagOpReport report)
        {
            reader.TagOpComplete -= OnTagOpComplete;

            // Loop through all the completed tag operations.
            foreach (TagOpResult result in report)
            {
                // Was this completed operation a tag write operation?
                if (result is TagWriteOpResult)
                {
                    // Cast it to the correct type.
                    TagWriteOpResult writeResult = result as TagWriteOpResult;
                    if (writeResult.OpId == EPC_OP_ID)
                    {
                        Console.WriteLine("Write to EPC complete : {0}", writeResult.Result);
                        if (writeResult.Result.ToString() != "Success")
                        {
//                            Console.WriteLine("Press enter to continue.");
//                            Console.ReadLine();
                            reader.TagsReported += OnTagsReported;

                            reader.TagOpComplete += OnTagOpComplete;
                            Tag tag = lastTag;
                            ProgramEpc(tag.Epc.ToHexString(), tag.PcBits, GetWriteEpc());
                        }
                        else
                        {
                            if (ascList.Length - 1 > tagSeq)
                            {
                                tagSeq++;
                            }
                        }
                    }
                    else if (writeResult.OpId == PC_BITS_OP_ID)
                    {
                        Console.WriteLine("Write to PC bits complete : {0}", writeResult.Result);
                    }

                    // Print out the number of words written
                    Console.WriteLine("Number of words written : {0}", writeResult.NumWordsWritten);
                }
            }
        }
Пример #12
0
        static void OnTagOpComplete8(ImpinjReader reader, TagOpReport report)
        {
            //// Loop through all the completed tag operations.
            //foreach (TagOpResult result in report)
            //{
            //    // Was this completed operation a tag write operation?
            //    if (result is TagWriteOpResult)
            //    {
            //        // Cast it to the correct type.
            //        TagWriteOpResult writeResult = result as TagWriteOpResult;
            //        if (writeResult.OpId == EPC_OP_ID)
            //            Console.WriteLine("Write to EPC complete : {0}", writeResult.Result);
            //        else if (writeResult.OpId == PC_BITS_OP_ID)
            //            Console.WriteLine("Write to PC bits complete : {0}", writeResult.Result);

            //        // Print out the number of words written
            //        Console.WriteLine("Number of words written : {0}", writeResult.NumWordsWritten);
            //    }
            //}
        }
Пример #13
0
        // This event handler will be called when tag
        // operations have been executed by the reader.
        static void OnTagOpComplete(ImpinjReader reader, TagOpReport report)
        {
            // Loop through all the completed tag operations
            foreach (TagOpResult result in report)
            {
                if (result is TagWriteOpResult)
                {
                    // These are the results of settings the kill password.
                    // Cast it to the correct type.
                    TagWriteOpResult writeResult = result as TagWriteOpResult;
                    // Print out the results.
                    Console.WriteLine("Set kill password complete.");
                    Console.WriteLine("EPC : {0}", writeResult.Tag.Epc);
                    Console.WriteLine("Status : {0}", writeResult.Result);
                    Console.WriteLine("Number of words written : {0}\n", writeResult.NumWordsWritten);

                    // If we successfully set the kill password we can now
                    // kill the chip. We must stop the reader first, to allow
                    // the  chip to update the kill password.
                    if (writeResult.Result == WriteResultStatus.Success)
                    {
                        reader.Stop();
                        AddKillOp();
                    }
                }
                else if (result is TagKillOpResult)
                {
                    // Cast it to the correct type.
                    // These are the results of killing the tag.
                    TagKillOpResult killResult = result as TagKillOpResult;
                    // Print out the results.
                    Console.WriteLine("Kill operation complete.");
                    Console.WriteLine("EPC : {0}", killResult.Tag.Epc);
                    Console.WriteLine("Status : {0}", killResult.Result);
                }
            }
        }
Пример #14
0
        // This event handler will be called when tag
        // operations have been executed by the reader.
        static void OnTagOpComplete(ImpinjReader reader, TagOpReport report)
        {
            // Loop through all the completed tag operations.
            foreach (TagOpResult result in report)
            {
                // Was this completed operation a tag write operation?
                if (result is TagWriteOpResult)
                {
                    // Cast it to the correct type.
                    TagWriteOpResult writeResult = result as TagWriteOpResult;
                    if (writeResult.OpId == EPC_OP_ID)
                    {
                        MessageBox.Show("Write to EPC complete : {0}" + writeResult.Result);
                    }
                    else if (writeResult.OpId == PC_BITS_OP_ID)
                    {
                        MessageBox.Show("Write to PC bits complete : {0}" + writeResult.Result);
                    }

                    // Print out the number of words written
                    MessageBox.Show("Number of words written : {0}" + writeResult.NumWordsWritten);
                }
            }
        }