Exemple #1
0
        // Method that the reader thread will run.
        public static void run()
        {
            int count = 0;

            while (true)
            {
                Thread.Sleep(7);

                // Update dictionaries no feature.
                double timeNow = (double)DateTime.Now.Ticks / (TimeSpan.TicksPerMillisecond * MilliSecPerSeconds);
                updateDictsWithoutFeature(timeNow);
                if (TouchFilterDict.ContainsKey(testEPC))
                {
                    printFilterValues(testEPC);
                }
                count += 1;
                // If we should pass more tag data to the application, then do so.
                if (shouldReportTagDistributions)
                {
                    // Create a dictionary with the latest distributions for touch.
                    ConcurrentDictionary <string, Bernoulli> newTouchDict = new ConcurrentDictionary <string, Bernoulli>();
                    foreach (var touchEntry in TouchFilterDict)
                    {
                        newTouchDict[touchEntry.Key] = (Bernoulli)touchEntry.Value.getDistribution();
                    }
                    // Create a dictionary with the latest distributions for velocity.
                    ConcurrentDictionary <string, Normal> newVelocityDict = new ConcurrentDictionary <string, Normal>();
                    foreach (var velocityEntry in VelocityFilterDict)
                    {
                        newVelocityDict[velocityEntry.Key] = (Normal)velocityEntry.Value.getDistribution();
                    }
                    // Do not change the order in which the dictionaries are updated.
                    // TODO: be less rigid about this requirement.
                    ObservableTouchDistributionDict.replaceCollectionWith(newTouchDict, true);
                    ObservableVelocityDistributionDict.replaceCollectionWith(newVelocityDict, true);
                }

                if (TouchFilterDict.ContainsKey(testEPC))
                {
                    // double probVisible = ((Bernoulli)(TouchFilterDict[testEPC]).getDistribution()).P;
                    // Console.WriteLine(testEPC + " prob visible: " + probVisible.ToString());
                }

                reader.QueryTags();
            }
        }
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);

                // 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 antenna number
                // 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;

                // Tell the reader not to send tag reports.
                // We will ask for them.
                settings.Report.Mode = ReportMode.WaitForQuery;
                settings.Antennas.GetAntenna(1).TxPowerInDbm = 26;

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

                // Assign an event handler that will
                // be called when the tag report buffer is almost full.
                reader.ReportBufferWarning += OnReportBufferWarning;

                // Assign an event handler that will
                // be called when the tag report buffer has overflowed.
                reader.ReportBufferOverflow += OnReportBufferOverflow;

                // Start reading.
                reader.Start();
                while (true)
                {
                    // Wait a while.
                    Console.WriteLine("Waiting while the reader reads tags.");

                    Thread.Sleep(1000);
                    // Ask for the tag reports.
                    Console.WriteLine("Press any key to show the report");
                    Console.ReadKey();
                    reader.QueryTags();

                    // 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);
            }
        }
 private static void Reader_ReaderStarted(ImpinjReader reader, ReaderStartedEvent e)
 {
     reader.QueryTags();
 }
Exemple #4
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 antenna number
                // 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;

                // Tell the reader not to send tag reports.
                // We will ask for them.
                settings.Report.Mode = ReportMode.WaitForQuery;

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

                // Assign an event handler that will
                // be called when the tag report buffer is almost full.
                reader.ReportBufferWarning += OnReportBufferWarning;

                // Assign an event handler that will
                // be called when the tag report buffer has overflowed.
                reader.ReportBufferOverflow += OnReportBufferOverflow;

                // Start reading.
                reader.Start();

                // Wait a while.
                Console.WriteLine("Waiting while the reader reads tags.");
                Thread.Sleep(5000);

                // Ask for the tag reports.
                reader.QueryTags();

                // 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);
            }
        }
        public TagReport GeTagReport(int timeInSeconds)
        {
            var report = Impinj.QueryTags(seconds: timeInSeconds);

            return(report);
        }