Exemple #1
0
 private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     // The application is closing.
     // Stop the reader and disconnect.
     try
     {
         // Don't call the Stop method if the
         // reader is already stopped.
         if (reader.QueryStatus().IsSingulating)
         {
             reader.Stop();
         }
         // Disconnect from the reader.
         reader.Disconnect();
     }
     catch (OctaneSdkException ex)
     {
         // An Octane SDK exception occurred. Handle it here.
         System.Diagnostics.Trace.
         WriteLine("An Octane SDK exception has occurred : {0}", ex.Message);
     }
     catch (Exception ex)
     {
         // A general exception occurred. Handle it here.
         System.Diagnostics.Trace.
         WriteLine("An exception has occurred : {0}", ex.Message);
     }
 }
Exemple #2
0
        public Program()
        {
            try
            {
                reader.Connect(SolutionConstants.ReaderHostname);

                Console.WriteLine("WAM with Location: " + SolutionConstants.ReaderHostname);

                for (int i = 0; i < INTERATIONS; i++)
                {
                    // WAM Role
                    Console.WriteLine("Running WAM. Please wait " + WAM_ROLE_DURATION / 1000 + " Sec." + " Session=" + WAM_SESSION + " Target=" + WAM_SEARCH_MODE);
                    SetupWamMode();
                    System.Threading.Thread.Sleep(WAM_ROLE_DURATION);
                    ShutdownWamMode();
                    Console.WriteLine("WAM Results:  TagsRead=" + WamTags.Count);
                    foreach (var item in WamTags)
                    {
                        Tag tag = item.Value;
                        Console.WriteLine(item.Key + "  Ant=" + tag.AntennaPortNumber + "\tRSSI=" + tag.PeakRssiInDbm);
                    }
                    Console.WriteLine();
                    WamTags.Clear();

                    // Location Role
                    Console.WriteLine("Running Location. Please wait " + LOCATION_ROLE_DURATION / 1000 + " sec.");
                    SetupLocationMode();
                    System.Threading.Thread.Sleep(LOCATION_ROLE_DURATION);
                    ShutdownLocationMode();
                    Console.WriteLine("Location Results: " + LocTags.Count + " Tags Read");
                    foreach (var item in LocTags)
                    {
                        LocationReport tag = item.Value;
                        Console.WriteLine(item.Key + "\tReadCount=" + tag.ConfidenceFactors.ReadCount + "\tX=" + tag.LocationXCm + "\tY=" + tag.LocationYCm);
                    }
                    LocTags.Clear();
                    Console.WriteLine();
                    // Wait for tag percistance to complete before starting WAM again
                    if ((i < INTERATIONS - 1) && (WAM_SESSION == 2 || WAM_SESSION == 3))
                    {
                        Console.WriteLine("Wait " + SESSION_2_OR_3_PERSISTENCE / 1000 + " Sec. for tag percistance to complete before starting WAM again");
                        System.Threading.Thread.Sleep(SESSION_2_OR_3_PERSISTENCE);
                    }
                }
                // Apply the default settings before exiting.
                reader.ApplyDefaultSettings();
                // 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);
            }
        }
        // event handler for when Stop is Clicked
        public void buttonStop_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                // dont call start reader if reader is already running
                reader.Stop();
                reader.Disconnect();

                // letting the user know we have disconnected
                listTags.Items.Clear();
                listTags.Items.Add("Successfully disconnected. Writing contents to CSV file.");

                var sb = new StringBuilder();
                foreach (string tag in tagsVerified)
                {
                    sb.AppendLine(tag);
                }
                File.AppendAllText(verified, sb.ToString());
            }
            catch (OctaneSdkException er)
            {
                System.Diagnostics.Trace.
                WriteLine("An Octane SDK exception has occurred : {0}", er.Message);
            }
            catch (Exception er)
            {
                System.Diagnostics.Trace.
                WriteLine("An exception has occurred : {0}", er.Message);
            }
        }
Exemple #4
0
        static void OnConnectAsyncComplete(ImpinjReader reader, ConnectAsyncResult result, string errorMessage)
        {
            // This event handler is called asynchronously
            // when the connection attempt has completed.

            // Check the result of the connection attempt
            if (result == ConnectAsyncResult.Success)
            {
                // Successfully connection to the reader. Now configure  and start it.
                Console.WriteLine("Successfully connected to {0}", reader.Address);
                reader.ApplyDefaultSettings();
                Console.WriteLine("Starting reader...");
                //reader.Start();
                SetReport(reader);
                // Wait for the user to press enter.
                Console.WriteLine("Press enter to exit.");
                Console.ReadLine();
                textWriter.Close();

                //cleanup
                reader.Stop();
                reader.Disconnect();
                Console.WriteLine("Reader stopped. Press enter to exit.");
            }
            else
            {
                // Failed to connect to the reader
                Console.WriteLine("Failure while connecting to {0} : {1}", reader.Address, errorMessage);
            }
        }
Exemple #5
0
        private void btnTermEmb_Click(object sender, EventArgs e)
        {
            string Mensaje = string.Empty;

            // TODO: Validar si se puede terminar el embarque _embarque
            if (!BusinessOrders.EmbarqueVivo2(_embarque))
            {
                Mensaje = BusinessOrders.TerminarEmbarque(_embarque) == 1 ? EmbarqueTerminado : EmbarqueNoTerminado;
                FormAsignar fa = FormAsignar.GetInstance();
                if (!fa.IsDisposed)
                {
                    if (reader.IsConnected)
                    {
                        reader.Stop();
                        reader.Disconnect();
                    }
                    this.Dispose();
                    fa.Show();
                    fa.BringToFront();
                }
            }
            else
            {
                Mensaje = EmbarqueIncompleto;
            }
            MessageBox.Show(Mensaje);
        }
Exemple #6
0
        static void Main(string[] args)
        {
            Reader       readerObject = new Reader();
            ImpinjReader reader       = new ImpinjReader();
            Stopwatch    s            = new Stopwatch();

            /*
             *  ARGUMENTS IN ORDER:
             *  0: Hostname
             *  1: Start Power
             *  2: End Power
             *  3: Step Size
             *  4: Power Duration
             *  5: CSV File name
             */
            // variable initialization
            string hostname     = args[0];
            double startPower   = Convert.ToDouble(args[1]);
            double endPower     = Convert.ToDouble(args[2]);
            double stepSize     = Convert.ToDouble(args[3]);
            int    duration     = Convert.ToInt32(args[4]);
            string tagName      = args[5];
            double currentPower = startPower;

            // start the margin test
            readerObject.ConnectReader(reader, hostname, currentPower);
            // creating event for when a tag is reportedi

            reader.TagsReported += onTagsReported;


            while (currentPower <= endPower)
            {
                if (reader.IsConnected)
                {
                    reader.Start();
                    s.Start();
                    while (s.Elapsed < TimeSpan.FromSeconds(duration))
                    {
                        //Console.WriteLine("This is a test");
                    }
                    s.Reset();
                    reader.Stop();
                    WriteFileName(tagsRead, tagName, currentPower);
                    // clearing list contents to make room for the next powerlevel
                    tagsRead.Clear();
                    // updating the power setting before running the test again
                    currentPower = readerObject.UpdateSettings(reader, currentPower, stepSize);
                }
                else
                {
                    Console.Write("Reader not connected! ");
                    System.Environment.Exit(1);
                }
                Console.WriteLine("Finished A power cycle");
            }

            Console.WriteLine("Margin test completed. Moving Outputs to /data");
            reader.Disconnect();
        }
Exemple #7
0
        /// <summary>
        /// 停止阅读
        /// </summary>
        public void EndRead()
        {
            if (!IsReading)
            {
                return;
            }
            try
            {
                reader.Stop();
                RedirectStandardOut.Invoke("Stop reading!");

                if (!string.IsNullOrEmpty(option.OutputFileName))
                {
                    file.Close();
                    file.Dispose();
                }

                // 断开与阅读器的连接
                reader.Disconnect();
                RedirectStandardOut.Invoke("Connection end.");
            }
            catch (OctaneSdkException e)
            {
                // Handle Octane SDK errors.
                RedirectStandardOut.Invoke("Octane SDK exception: " + e.Message);
            }
            catch (Exception e)
            {
                // Handle other .NET errors.
                RedirectStandardOut.Invoke("Exception : " + e.Message);
            }
        }
Exemple #8
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);

                // 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();

                // Tell the reader to include the TID
                // in all tag reports. We will use FastID
                // to do this. FastID is supported
                // by Impinj Monza 4 and later tags.
                settings.Report.IncludeFastId = true;

                // Apply the newly modified settings.
                reader.ApplySettings(settings);

                // Assign the TagsReported event handler.
                // This specifies which method to call
                // when tags reports are available.
                reader.TagsReported += OnTagsReported;

                // 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);
            }
        }
Exemple #9
0
 static void disconnectReader()
 {
     // Stop reading.
     reader.Stop();
     // Disconnect from the reader.
     reader.Disconnect();
     Console.WriteLine("Disconnect");
 }
Exemple #10
0
        private void CloseXArray(ImpinjReader reader)
        {
            // Apply the default settings before exiting.
            reader.ApplyDefaultSettings();

            // Disconnect from the reader.
            reader.Disconnect();
        }
Exemple #11
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);

                // 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();

                // Tell the reader to include the
                // RF doppler frequency in all tag reports.
                settings.Report.IncludeDopplerFrequency = true;

                // Use antenna #1
                settings.Antennas.DisableAll();
                settings.Antennas.GetAntenna(1).IsEnabled = true;

                // ReaderMode must be set to DenseReaderM8.
                settings.ReaderMode = ReaderMode.DenseReaderM8;

                // Apply the newly modified settings.
                reader.ApplySettings(settings);

                // Assign the TagsReported event handler.
                // This specifies which method to call
                // when tags reports are available.
                reader.TagsReported += OnTagsReported;

                // 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);
            }
        }
Exemple #12
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 #13
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);

                // 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();

                // Enable keepalives.
                settings.Keepalives.Enabled    = true;
                settings.Keepalives.PeriodInMs = 3000;

                // 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);

                // 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);
            }
        }
Exemple #14
0
        static void Main(string[] args)
        {
            try
            {
                // This example show some of features specific to spatial readers
                // For examples of Location mode, see the projects named SpatialReaderLocation

                // 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);

                // Turn the beacon LED on for 10 seconds
                Console.WriteLine("Turning beacon on for 10 seconds");
                reader.TurnBeaconOn(10000);

                // Wait for the user to press enter.
                Console.WriteLine("Press enter to continue.");
                Console.ReadLine();

                // Turn off the beacon off
                reader.TurnBeaconOff();

                // Query the state of the tilt sensor
                Console.WriteLine("Querying tilt sensor. Press any key to exit.");
                while (true)
                {
                    // Exit if the user presses a key
                    if (Console.KeyAvailable)
                    {
                        break;
                    }
                    Status status = reader.QueryStatus();
                    Console.WriteLine("X = {0}, Y = {1}",
                                      status.TiltSensor.XAxis, status.TiltSensor.YAxis);
                }

                // 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 #15
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);

                // 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();

                // Enable all of the antenna ports.
                settings.Antennas.EnableAll();

                // Apply the newly modified settings.
                reader.ApplySettings(settings);

                // Assign handlers for various reader events.
                reader.GpiChanged     += OnGpiEvent;
                reader.AntennaChanged += OnAntennaEvent;
                reader.ReaderStarted  += OnReaderStarted;
                reader.ReaderStopped  += OnReaderStopped;

                // Start the reader (required for antenna events).
                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);
            }
        }
Exemple #16
0
        static void Main(string[] args)
        {
            // Defines the sources of configuration information for the
            // application.
            var builder = new ConfigurationBuilder()
                          .SetBasePath(Directory.GetCurrentDirectory())
                          .AddJsonFile("appsettings.json");

            // Create the configuration object that the application will
            // use to retrieve configuration information.
            var configuration = builder.Build();

            // Retrieve the configuration information.
            configValue = configuration.GetConnectionString("MainDisplayDB");

            Console.WriteLine("a. The read tag will automatically be served to the Teleprompt Screen, if the screen is empty");
            Console.WriteLine("b. If the screen is not empty, await the read tag to queue until available");
            Console.WriteLine("c. If the screen is empty and there's queue waiting. Pop the queue and load to Teleprompt screen");

            try
            {
                reader.Connect(SolutionConstants.ReaderHostname);

                reader.TagsReported += OnTagsReported;

                reader.ApplyDefaultSettings();

                reader.Start();

                Console.WriteLine("\n\nEnter word. 'Yallah!' to quit.\n\n\n");

                string quitline = Console.ReadLine();

                if (quitline.ToLower() == "yallah!")
                {
                    Console.WriteLine("\n\nExiting!!!");

                    reader.Stop();

                    reader.Disconnect();
                }
            }
            catch (OctaneSdkException e)
            {
                Console.WriteLine("Octane SDK exception: {0}", e.Message);

                Console.ReadLine();
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception : {0}", e.Message);

                Console.ReadLine();
            }
        }
 public void disconnect()
 {
     if (rdr != null)
     {
         rdr.Stop();
         rdr.Disconnect();
         rdr = null;
         statusLabel.ForeColor = Color.Red;
         statusLabel.Text      = "Status: Disconnected";
     }
 }
Exemple #18
0
 static public void applicactionClose()
 {
     Console.WriteLine("Press enter to exit.");
     Console.ReadLine();
     // 写CSV文件
     CsvWriter.AddData(DataDS, 1);
     CsvWriter.Save();
     reader.Disconnect();
     Console.WriteLine(DataDS.Rows.Count);
     Console.ReadLine();
 }
Exemple #19
0
 public void disConnect()
 {
     if (mReaderType == READER_TYPE.READER_IMP)
     {
         mReaderIMP.Disconnect();
     }
     if (mReaderType == READER_TYPE.READER_TM)
     {
         mReaderTM.Destroy();
     }
 }
Exemple #20
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);

                // 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();

                // Tell the reader to include the TID
                // in all tag reports. We will use FastID
                // to do this. FastID is supported
                // by Impinj Monza 4 and later tags.
                settings.Report.IncludeFastId = true;

                // Apply the newly modified settings.
                reader.ApplySettings(settings);

                // Assign the TagsReported event handler.
                // This specifies which method to call
                // when tags reports are available.
                reader.TagsReported += OnTagsReported;

                // 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);
            }
        }
Exemple #21
0
        static void Main(string[] args)
        {
            try
            {
                // This example show the minimum program required to read tags.
                // If you require more control over the reader settings,
                // take a look at the ReadTags example.

                // 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];*/
                string hostname = "speedwayr-10-9f-bb.local";
                reader.Connect(hostname);

                // Assign the TagsReported event handler.
                // This specifies which method to call
                // when tags reports are available.
                reader.TagsReported += OnTagsReported;

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

                // 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);
            }
        }
Exemple #22
0
        static void OnConnectionLost(ImpinjReader reader)
        {
            // This event handler is called if the reader
            // stops sending keepalive messages (connection lost).
            Console.WriteLine("Connection lost : {0} ({1})", reader.Name, reader.Address);

            // Cleanup
            reader.Disconnect();

            // Try reconnecting to the reader
            ConnectToReader();
        }
Exemple #23
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);
            }
        }
Exemple #24
0
        static void Main(string[] args)
        {
            try
            {
                // This example show some of features specific to xArray
                // For examples of Location and Transition modes, see the projects
                // named XArrayLocation and XArrayTransition

                // Connect to the reader.
                // Change the ReaderHostname constant in SolutionConstants.cs
                // to the IP address or hostname of your reader.
                reader.Connect(SolutionConstants.ReaderHostname);

                // Turn the beacon LED on for 10 seconds
                Console.WriteLine("Turning beacon on for 10 seconds");
                reader.TurnBeaconOn(10000);

                // Wait for the user to press enter.
                Console.WriteLine("Press enter to continue.");
                Console.ReadLine();

                // Turn off the beacon off
                reader.TurnBeaconOff();

                // Query the state of the tilt sensor
                Console.WriteLine("Querying tilt sensor. Press any key to exit.");
                while (true)
                {
                    // Exit if the user presses a key
                    if (Console.KeyAvailable)
                    {
                        break;
                    }
                    Status status = reader.QueryStatus();
                    Console.WriteLine("X = {0}, Y = {1}",
                                      status.TiltSensor.XAxis, status.TiltSensor.YAxis);
                }

                // 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 #25
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);

                // 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();

                // Enable all of the antenna ports.
                settings.Antennas.EnableAll();

                // Apply the newly modified settings.
                reader.ApplySettings(settings);

                // Assign handlers for various reader events.
                reader.GpiChanged     += OnGpiEvent;
                reader.AntennaChanged += OnAntennaEvent;
                reader.ReaderStarted  += OnReaderStarted;
                reader.ReaderStopped  += OnReaderStopped;

                // Start the reader (required for antenna events).
                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);
            }
        }
Exemple #26
0
    // Use this for initialization
    void Start()
    {
        // init bricks
        ImpinjReader reader = new ImpinjReader();
        var          cube2  = GameObject.CreatePrimitive(PrimitiveType.Cube);

        cube2.AddComponent <Rigidbody> ();
        cube2.transform.position = new Vector3(0, 5, 3);
        try
        {
            reader.Connect("SpeedwayR-10-25-32");

            Settings settings = reader.QueryDefaultSettings();

            // Enable all of the antenna ports.
            settings.Antennas.EnableAll();

            // Apply the newly modified settings.
            reader.ApplySettings(settings);

            // Assign event handlers for GPI and antenna events.
//			reader.GpiChanged += OnGpiEvent;
//			reader.AntennaChanged += OnAntennaEvent;

            // Start the reader (required for antenna events).
            reader.Start();

            // Wait for the user to press enter.
            print("Press enter to exit.");
            Console.ReadLine();

            // Stop reading.
            reader.Stop();

            // Disconnect from the reader.
            reader.Disconnect();
        }
        catch (OctaneSdkException e)
        {
            // Handle Octane SDK errors.
            print(e.Message);
            print("oct");
        }
        catch (Exception e)
        {
            // Handle other .NET errors.
            print("net");
            print(e.Message);
            print("net");
        }
    }
 private void Main_FormClosing(object sender, FormClosingEventArgs e)
 {
     TimerTags.Enabled = false;
     try
     {
         var result = MessageBox.Show("Вы точно хотите выйти?", "Выход из программы", MessageBoxButtons.YesNo);
         if (result == DialogResult.Yes)
         {
             e.Cancel = false;
         }
         else if (result == DialogResult.No)
         {
             e.Cancel = true;
         }
         if (reader.IsConnected)
         {
             try
             {
                 // Отключение считывания считывателя
                 if (reader.QueryStatus().IsSingulating)
                 {
                     Delete_RoSpec();
                     reader.Stop();
                 }
                 // Отсоединение от считывателя
                 reader.Disconnect();
             }
             catch (OctaneSdkException ex)
             {
                 // Ошибки пакета Octane
                 MessageBox.Show(ex.Message);
             }
             catch (Exception ex)
             {
                 // Ошибки программы
                 MessageBox.Show(ex.Message);
             }
         }
     }
     catch (OctaneSdkException ex)
     {
         // Ошибки пакета Octane
         MessageBox.Show(ex.Message);
     }
     catch (Exception ex)
     {
         // Ошибки программы
         MessageBox.Show(ex.Message);
     }
 }
        public bool Disconnect()
        {
            try
            {
                reader.Disconnect();

                return(true);
            }catch (Exception ex)
            {
                return(false);
            }
            finally
            {
            }
        }
Exemple #29
0
        private void disconnect()
        {
            if (rdr != null)
            {
                rdr.Stop();
                rdr.Disconnect();
                rdr = null;
                stoppedEvent(this, EventArgs.Empty);
            }

            if (logging)
            {
                log.Close();
            }
        }
Exemple #30
0
        static void Main(string[] args)
        {
            ushort i;

            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);

                // Configure the reader with the default settings.
                reader.ApplyDefaultSettings();

                // Turn the general purpose outputs
                // (GPOs) on one at a a time
                Console.WriteLine("Setting general purpose outputs...");
                for (i = 1; i <= 4; i++)
                {
                    reader.SetGpo(i, true);
                    Thread.Sleep(1500);
                    reader.SetGpo(i, false);
                }

                // Wait for the user to press enter.
                Console.WriteLine("Press enter to exit.");
                Console.ReadLine();

                // 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 ConnectAndPrepareAllReaders()
        {
            foreach (string readerName in ReaderNames)
            {
                ImpinjReader reader = new ImpinjReader();

                try
                {
                    // Set the reader identity. It can be any object.
                    // This is passed back with events and tag reports.
                    reader.Name = readerName;
                    //reader.ReaderIdentity = readerName;

                    // Change the level of logging detail. The default is Error.
                    //reader.LogLevel = LogLevel.Error;

                    // Attach to events
                    Reader.TagsReported += OnTagsReported;
                    Reader.ReaderStarted += OnReaderStarted;
                    Reader.ReaderStopped += OnReaderStopped;

                    // Connect to the reader. The name is the host name
                    // or IP address.
                    Reader.Connect(_ReaderIP);

                    // Clear the reader of any RFID operation and configuration.
                    Reader.ApplyDefaultSettings();

                    // Query the default settings for the reader. Settings
                    // include which antennas are enabled, when to report and
                    // optional report fields. Typically you will prepare the
                    // reader by getting the default settings and adjusting them.
                    //
                    // This example sets the reader to send a tag report
                    // immediately on every tag observation. Message buffering
                    // improves overall efficiency but introduces a small
                    // delay before the application is notified of a tag.
                    // Message buffering is enabled by default.
                    Settings settings = Reader.QueryDefaultSettings();
                    settings.Report.Mode = ReportMode.Individual;

                    settings.ReaderMode = ReaderMode.AutoSetDenseReader; // Adjust ช่องความถี่
                    settings.SearchMode = SearchMode.TagFocus; //จับสัญญาน ไวขึ้น
                    settings.Session = 1;

                    settings.AutoStart.Mode = AutoStartMode.GpiTrigger;
                    settings.AutoStart.GpiPortNumber = 1;
                    settings.AutoStart.GpiLevel = true;
                    settings.AutoStop.Mode = AutoStopMode.GpiTrigger;
                    settings.AutoStop.GpiPortNumber = 1;
                    settings.AutoStop.GpiLevel = false;
                    settings.Report.IncludeAntennaPortNumber = true;

                    settings.Antennas.GetAntenna(1).IsEnabled = true;
                    settings.Antennas.GetAntenna(2).IsEnabled = true;
                    settings.Antennas.GetAntenna(3).IsEnabled = true;
                    settings.Antennas.GetAntenna(4).IsEnabled = true;

                    settings.Antennas.GetAntenna(1).MaxRxSensitivity = true;
                    settings.Antennas.GetAntenna(1).TxPowerInDbm = 25;
                    settings.Antennas.GetAntenna(2).MaxRxSensitivity = true;
                    settings.Antennas.GetAntenna(2).TxPowerInDbm = 25;
                    settings.Antennas.GetAntenna(3).MaxRxSensitivity = true;
                    settings.Antennas.GetAntenna(3).TxPowerInDbm = 25;
                    settings.Antennas.GetAntenna(4).MaxRxSensitivity = true;
                    settings.Antennas.GetAntenna(4).TxPowerInDbm = 25;
                    reader.ApplySettings(settings);
                    
                    // Add this reader to the list of readers.
                    readers.Add(reader);
                }
                catch (Exception ex)
                {
                    //Console.WriteLine("Exception {0} for reader {1}", ex, readerName);
                    try
                    {
                        reader.Disconnect();
                    }
                    catch (OctaneSdkException octaneSdkException)
                    {
                        //Console.WriteLine("OctaneSdk detected {0}", octaneSdkException);
                    }
                    catch (Exception exception)
                    {
                        //Console.WriteLine("Exception {0}", exception);
                    }
                }
            }
        }