Esempio n. 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);
        }
Esempio n. 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);
                }
            }
        }
Esempio n. 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 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);
         }
     }
 }
Esempio n. 4
0
        static void HandleReadOpComplete(TagReadOpResult readResult)
        {
            // A read operation has occurred. Increment the count.
            numOpsExecuted++;

            // Check the result of the read (pass / fail)
            if (readResult.Result == ReadResultStatus.Success)
            {
                tagData += readResult.Data.ToHexWordString() + " ";

                // Have all the read operations executed?
                if (numOpsExecuted == numOpsAdded)
                {
                    Console.WriteLine("\nBulk read complete. Tag data :\n\n{0}", tagData);
                }
            }
            else
            {
                Console.WriteLine("Read operation failed : {0}", readResult.Result);
                // Data for this section of memory is unknown.
                // Add a marker in the output to show this.
                tagData += "<missing data>";
            }
        }