Exemple #1
0
        static void Main(string[] args)
        {
            try
            {
                // Connect to the reader.
                // Pass in a reader hostname or IP address as a
                // command line argument when running the example
                if (args.Length != 1)
                {
                    Console.WriteLine("Error: No hostname specified.  Pass in the reader hostname as a command line argument when running the Sdk Example.");
                    return;
                }
                string hostname = args[0];
                reader.Connect(hostname);

                // Assign the TagOpComplete event handler.
                // This specifies which method to call
                // when tag operations are complete.
                reader.TagOpComplete += OnTagOpComplete;

                // Apply the default settings.
                reader.ApplyDefaultSettings();

                // Start reading.
                reader.Start();


                Console.WriteLine("Writing to the tag. Press enter when the operation is complete.");
                // Write random words to user memory
                TagData data = GetRandomData(NUM_WORDS_USER_MEMORY);
                BulkWrite(null, MemoryBank.User, 0, data);
                Console.ReadLine();

                // Remove all operation sequences from the reader that haven't executed.
                reader.DeleteAllOpSequences();

                Console.WriteLine("Reading from the tag. Press enter when the operation is complete.");
                // Read all of User memory
                BulkRead(null, MemoryBank.User, 0, NUM_WORDS_USER_MEMORY);
                Console.ReadLine();

                // Stop reading.
                reader.Stop();

                // Disconnect from the reader.
                reader.Disconnect();
            }
            catch (OctaneSdkException e)
            {
                // Handle Octane SDK errors.
                Console.WriteLine("Octane SDK exception: {0}", e.Message);
            }
            catch (Exception e)
            {
                // Handle other .NET errors.
                Console.WriteLine("Exception : {0}", e.Message);
            }
        }
Exemple #2
0
        static void Main(string[] args)
        {
            try
            {
                // Connect to the reader.
                // Change the ReaderHostname constant in SolutionConstants.cs
                // to the IP address or hostname of your reader.
                reader.Connect(SolutionConstants.ReaderHostname);

                // Assign the TagOpComplete event handler.
                // This specifies which method to call
                // when tag operations are complete.
                reader.TagOpComplete += OnTagOpComplete;

                // Apply the default settings.
                reader.ApplyDefaultSettings();

                // Start reading.
                reader.Start();


                Console.WriteLine("Writing to the tag. Press enter when the operation is complete.");
                // Write random words to user memory
                TagData data = GetRandomData(NUM_WORDS_USER_MEMORY);
                BulkWrite(null, MemoryBank.User, 0, data);
                Console.ReadLine();

                // Remove all operation sequences from the reader that haven't executed.
                reader.DeleteAllOpSequences();

                Console.WriteLine("Reading from the tag. Press enter when the operation is complete.");
                // Read all of User memory
                BulkRead(null, MemoryBank.User, 0, NUM_WORDS_USER_MEMORY);
                Console.ReadLine();

                // Stop reading.
                reader.Stop();

                // Disconnect from the reader.
                reader.Disconnect();
            }
            catch (OctaneSdkException e)
            {
                // Handle Octane SDK errors.
                Console.WriteLine("Octane SDK exception: {0}", e.Message);
            }
            catch (Exception e)
            {
                // Handle other .NET errors.
                Console.WriteLine("Exception : {0}", e.Message);
            }
        }