static void BulkRead(TagData accessPassword, MemoryBank bank, ushort wordPointer, ushort wordCount) { TagOpSequence seq; TagReadOp op; // Initialize variables tagData = ""; numOpsExecuted = 0; numOpsAdded = 0; // Each TagReadOp can only access up to 32 words. // So, we need to break this read up into multiple operations. while (wordCount > 0) { // Define a new tag operation sequence. seq = new TagOpSequence(); // Define a tag read operation op = new TagReadOp(); op.AccessPassword = accessPassword; op.MemoryBank = bank; op.WordPointer = wordPointer; op.WordCount = (wordCount < 32) ? wordCount : (ushort)32; // Add the read op to the operation sequence seq.Ops.Add(op); // Adjust the word count and pointer for the next reader operation wordCount -= op.WordCount; wordPointer += op.WordCount; // Add the operation sequence to the reader reader.AddOpSequence(seq); numOpsAdded++; } }
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; // Get the default settings // We'll use these as a starting point // and then modify the settings we're // interested in. Settings settings = reader.QueryDefaultSettings(); // Create a tag read operation for User memory. TagReadOp readUser = new TagReadOp(); // Read from user memory readUser.MemoryBank = MemoryBank.User; // Read two (16-bit) words readUser.WordCount = 2; // Starting at word 0 readUser.WordPointer = 0; // Create a tag read operation for TID memory. TagReadOp readTid = new TagReadOp(); // Read from TID memory readTid.MemoryBank = MemoryBank.Tid; // Read two (16-bit) words readTid.WordCount = 2; // Starting at word 0 readTid.WordPointer = 0; // Add these operations to the reader as Optimized Read ops. // Optimized Read ops apply to all tags, unlike // Tag Operation Sequences, which can be applied to specific tags. // Speedway Revolution supports up to two Optimized Read operations. settings.Report.OptimizedReadOps.Add(readUser); settings.Report.OptimizedReadOps.Add(readTid); // Store the operation IDs for later. opIdUser = readUser.Id; opIdTid = readTid.Id; // Apply the newly modified settings. reader.ApplySettings(settings); // Start reading. reader.Start(); // Wait for the user to press enter. Console.WriteLine("Press enter to exit."); 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); } }
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; // Configure the reader with the default settings. reader.ApplyDefaultSettings(); // Create a tag operation sequence. // You can add multiple read, write, lock, kill and QT // operations to this sequence. TagOpSequence seq = new TagOpSequence(); // Create a tag read operation. TagReadOp readOp = new TagReadOp(); // Read from user memory readOp.MemoryBank = MemoryBank.User; // Read two (16-bit) words readOp.WordCount = 2; // Starting at word 0 readOp.WordPointer = 0; // Add this tag read op to the tag operation sequence. seq.Ops.Add(readOp); // Specify a target tag based on the EPC. seq.TargetTag.MemoryBank = MemoryBank.Epc; seq.TargetTag.BitPointer = BitPointers.Epc; // Setting this to null will specify any tag. // Replace this line with the one below it to target a particular tag. seq.TargetTag.Data = null; //seq.TargetTag.Data = TagData.FromHexString("11112222333344445555666677778888"); // Add the tag operation sequence to the reader. // The reader supports multiple sequences. reader.AddOpSequence(seq); // Start the reader reader.Start(); // Wait for the user to press enter. Console.WriteLine("Press enter to exit."); 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); } }
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. Console.WriteLine("*** Connecting to a reader at: {0} ...", SolutionConstants.ReaderHostname); reader.Connect(SolutionConstants.ReaderHostname); Console.WriteLine("*** Connected to the reader."); // Get the default settings // and then modify the settings Settings settings = reader.QueryDefaultSettings(); settings.Report.IncludeAntennaPortNumber = true; settings.Report.IncludePcBits = true; settings.Report.IncludePeakRssi = true; // Set the reader mode, search mode and session settings.ReaderMode = ReaderMode.AutoSetDenseReader; settings.SearchMode = SearchMode.DualTarget; settings.Session = 2; // Enable antenna #1. Disable all others. settings.Antennas.DisableAll(); settings.Antennas.GetAntenna(1).IsEnabled = true; // Set the Transmit Power and // Receive Sensitivity to the maximum. settings.Antennas.GetAntenna(1).MaxTransmitPower = true; settings.Antennas.GetAntenna(1).MaxRxSensitivity = true; // Apply the newly modified settings. reader.ApplySettings(settings); Console.Write("*** Settings applied to the reader.\n"); // Create a tag operation sequence. // You can add multiple read, write, lock, kill and QT // operations to this sequence. TagOpSequence seq = new TagOpSequence(); // Create a tag read operation. TagReadOp readOp = new TagReadOp(); // Read from user memory readOp.MemoryBank = MemoryBank.User; // Read two (16-bit) words readOp.WordCount = 2; // Starting at word 0 readOp.WordPointer = 0; // Add this tag read op to the tag operation sequence. seq.Ops.Add(readOp); // Specify a target tag based on the EPC. seq.TargetTag.MemoryBank = MemoryBank.Epc; seq.TargetTag.BitPointer = BitPointers.Epc; // Setting this to null will specify any tag. seq.TargetTag.Data = null; // Add the tag operation sequence to the reader. // The reader supports multiple sequences. reader.AddOpSequence(seq); Console.Write("*** OpSequence added to the reader.\n"); // Disconnect from the reader. reader.Disconnect(); Console.Write("*** Disconnected from the reader.\n"); } 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); } }