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 the reader."); reader.Connect(SolutionConstants.ReaderHostname); // Assign the TagsReported event handler. // This specifies which method to call // when tags reports are available. reader.TagsReported += OnTagsReported; // 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(); // Set the start trigger to Immediate. // This will allow the reader to start as soon as it boots up. settings.AutoStart.Mode = AutoStartMode.Immediate; // Tell the reader to hold all tag reports and events // when we disconnect from the reader. settings.HoldReportsOnDisconnect = true; // Tell the reader to include the antenna number // and timestamp in all tag reports. Other fields // can be added to the reports in the same way by // setting the appropriate Report.IncludeXXXXXXX property. settings.Report.IncludeAntennaPortNumber = true; settings.Report.IncludeFirstSeenTime = true; // Apply the newly modified settings. Console.WriteLine("Configuring the reader."); reader.ApplySettings(settings); // The current configuration will be saved to to persistent storage. // The saved parameters then become the reader's power-on defaults. // If AutoStart mode is set to Immediate, the reader will // automatically start after booting up. Console.WriteLine("Press enter to save settings and reboot"); Console.ReadLine(); reader.SaveSettings(); // Disconnect from the reader Console.WriteLine("Disconnecting from reader."); reader.Disconnect(); // Issue an RShell command to reboot. // Open up an RShell connection on the reader. // Specify the reader address, user name, password and connection timeout. string reply; reader.RShell.Open(SolutionConstants.ReaderHostname, "root", "impinj", 5000); RShellCmdStatus status = reader.RShell.Send("reboot", out reply); // Close the RShell connection. reader.RShell.Close(); // Check the status of the RShell command. if (status == RShellCmdStatus.Success) { Console.WriteLine("Reader rebooting...\n"); Thread.Sleep(15000); Console.Write("Waiting for reader to come back online."); // Ping the reader until it's back online. while (!ReaderIsAvailable(SolutionConstants.ReaderHostname)) { Console.Write("."); Thread.Sleep(1000); } Console.WriteLine("\nThe reader is back online. Press enter to reconnect and get tag data.\n"); Console.ReadLine(); Console.WriteLine("Reconnecting to reader."); // Reconnect to the reader. reader.Connect(SolutionConstants.ReaderHostname); // Enable tag reports and events. reader.ResumeEventsAndReports(); } else { // Error executing RShell command. Print out reply. Console.WriteLine("RShell command failed to execute.\n"); Console.WriteLine("RShell command reply : \n\n" + reply + "\n"); } // Wait for the user to press enter. Console.WriteLine("Press enter to exit."); Console.ReadLine(); // Apply the default settings. // This removes the saved settings. reader.ApplyDefaultSettings(); // 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); } }
public void SaveSettings() { _reader.SaveSettings(); }
static void Main(string[] args) { try { // Assign a name to the reader. // This will be used in tag reports. reader.Name = "My Reader #1"; MakeDataTable(); // Connect to the reader. ConnectToReader(); // 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(); // Start the reader as soon as it's configured. // This will allow it to run without a client connected. settings.AutoStart.Mode = AutoStartMode.Immediate; settings.AutoStop.Mode = AutoStopMode.None; // Use Advanced GPO to set GPO #1 // when an client (LLRP) connection is present. settings.Gpos.GetGpo(1).Mode = GpoMode.LLRPConnectionStatus; // settings readermode settings.ReaderMode = ReaderMode.Hybrid; // Tell the reader to include the timestamp in all tag reports. settings.Report.IncludeFirstSeenTime = true; settings.Report.IncludeLastSeenTime = true; settings.Report.IncludeSeenCount = true; settings.Report.IncludePhaseAngle = true; settings.Report.IncludePeakRssi = true; settings.Report.IncludeChannel = true; settings.Report.IncludeDopplerFrequency = true; settings.Report.IncludeFastId = true; settings.Report.IncludeGpsCoordinates = true; //settings.Report. //setting freq /*List<double> freqList = new List<double>(); * freqList.Add(923.25); * freqList.Add(924.25); * settings.TxFrequenciesInMhz = freqList; */ // If this application disconnects from the // reader, hold all tag reports and events. settings.HoldReportsOnDisconnect = true; // Enable keepalives. settings.Keepalives.Enabled = true; settings.Keepalives.PeriodInMs = 5000; // Enable link monitor mode. // If our application fails to reply to // five consecutive keepalive messages, // the reader will close the network connection. settings.Keepalives.EnableLinkMonitorMode = true; settings.Keepalives.LinkDownThreshold = 5; // Assign an event handler that will be called // when keepalive messages are received. reader.KeepaliveReceived += OnKeepaliveReceived; // Assign an event handler that will be called // if the reader stops sending keepalives. reader.ConnectionLost += OnConnectionLost; // Apply the newly modified settings. reader.ApplySettings(settings); // Save the settings to the reader's // non-volatile memory. This will // allow the settings to persist // through a power cycle. reader.SaveSettings(); // Assign the TagsReported event handler. // This specifies which method to call // when tags reports are available. reader.TagsReported += OnTagsReported; // Wait for the user to press enter. Console.WriteLine("Press enter to exit."); //Console.ReadLine(); System.Threading.Thread.Sleep(8000); // Save Data SaveCSV(table, fullpath); // 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); } }