Пример #1
0
 public async Task StopReading()
 {
     await Task.Run(() =>
     {
         try
         {
             if (IsConnected)
             {
                 impinjReader.Stop();
                 _isReading = false;
             }
         }
         catch (OctaneSdkException ex)
         {
             Console.WriteLine(ex.Message);
             return(false);
         }
         catch (Exception ex)
         {
             Console.WriteLine("Exception {0}", ex);
             return(false);
         }
         return(true);
     });
 }
Пример #2
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();
                Console.WriteLine("Stopping reader in 5 seconds...");
                Thread.Sleep(5000);
                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);
            }
        }
Пример #3
0
 public void stopRead()
 {
     try
     {
         if (mReaderType == READER_TYPE.READER_IMP)
         {
             mReaderIMP.Stop();
         }
         if (mReaderType == READER_TYPE.READER_TM)
         {
             mReaderTM.StopReading();
         }
         if (mReaderType == READER_TYPE.READER_DLX_PM)
         {
             mReaderDLXPM.StopInventory(mComPort);
         }
         if (mReaderType == READER_TYPE.READER_XD_PM)
         {
             mReaderXDPM.StopInventory();
         }
     }
     catch (Exception)
     {
     }
 }
Пример #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 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);
            }
        }
Пример #5
0
        private void ButtonStart_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (start == true)
                {
                    reader.Connect(ipAddress);
                    Initialise();
                    start = false;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Cannot Connect to Reader\nEither try again in 30s or reboot the reader and this application",
                                "Error creating connection",
                                MessageBoxButton.OK, MessageBoxImage.Error);
            }

            try
            {
                if (!reader.QueryStatus().IsSingulating)
                {
                    Initialise();
                    reader.Start();

                    buttonStart.Content = "STOP";
                }
                else if (reader.QueryStatus().IsSingulating)
                {
                    reader.Stop();
                    buttonStart.Content = "START";
                }
            }
            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);
            }
        }
Пример #6
0
 static void disconnectReader()
 {
     // Stop reading.
     reader.Stop();
     // Disconnect from the reader.
     reader.Disconnect();
     Console.WriteLine("Disconnect");
 }
Пример #7
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);
            }
        }
Пример #8
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);
            }
        }
Пример #9
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);
            }
        }
Пример #10
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);
            }
        }
Пример #11
0
        void OnTagOpComplete(ImpinjReader reader, TagOpReport report)
        {
            foreach (TagOpResult result in report)
            {
                if (result is TagWriteOpResult)
                {
                    TagWriteOpResult writeResult = result as TagWriteOpResult;
                    if (writeResult.OpId == EPC_OP_ID)
                    {
                        mWriteTagCount++;
                        if (writeResult.Result == WriteResultStatus.Success)
                        {
                            mWriteSuccessTagCount++;
                        }
                        Invoke(new Action(() =>
                        {
                            label11_writeTag.Text = mWriteSuccessTagCount.ToString();
                        }));

                        if (epcList.Count == mWriteTagCount)
                        {
                            bool re = mWriteSuccessTagCount == mWriteTagCount;
                            mReader.Stop();
                            SetInventoryResult(re?1:3);
                            playSound(re);
                            Invoke(new Action(() =>
                            {
                                dataGridView1_msg.Rows.Insert(0, re?"写入成功":"部分写入失败,请重新投");
                                if (!re)
                                {
                                    dataGridView1_msg.Rows[0].DefaultCellStyle.BackColor = Color.OrangeRed;
                                }
                                if (re)
                                {
                                    textBox3_totalHuCount.Text = (++mHuTotalCount).ToString();
                                }
                                mTotalTags += mWriteSuccessTagCount;
                                textBox4_totalwriteEpcCount.Text = mTotalTags.ToString();
                            }));
                        }
                    }
                }
            }
        }
Пример #12
0
        public bool Connection(string address)
        {
            try
            {
                Reader.Connect("192.168.250.55");
                Reader.Stop();
            }
            catch (OctaneSdkException ee)
            {
                Console.WriteLine("Octane SDK exception: Reader #1" + ee.Message, "error");
            }
            catch (Exception ee)
            {
                // Handle other .NET errors.
                Console.WriteLine("Exception : Reader #1" + ee.Message, "error");
                Console.WriteLine(ee.StackTrace);
            }
            settings = Reader.QueryDefaultSettings();

            settings.Report.IncludeAntennaPortNumber = true;
            settings.Report.IncludePhaseAngle        = true;
            settings.Report.IncludeChannel           = true;
            settings.Report.IncludeDopplerFrequency  = true;
            settings.Report.IncludeFastId            = true;
            settings.Report.IncludeFirstSeenTime     = true;
            settings.Report.IncludeLastSeenTime      = true;
            settings.Report.IncludePeakRssi          = true;
            settings.Report.IncludeSeenCount         = true;
            settings.Report.IncludePcBits            = true;
            settings.Report.IncludeSeenCount         = true;

            settings.ReaderMode            = ReaderMode.MaxThroughput; //.AutoSetDenseReader;
            settings.SearchMode            = SearchMode.DualTarget;    //.DualTarget;
            settings.Session               = 1;
            settings.TagPopulationEstimate = Convert.ToUInt16(200);

            settings.Report.Mode = ReportMode.Individual;

            Antenna();

            Reader.ApplySettings(settings);

            return(Reader.IsConnected);
        }
Пример #13
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();
            }
        }
Пример #14
0
 public void disconnect()
 {
     if (rdr != null)
     {
         rdr.Stop();
         rdr.Disconnect();
         rdr = null;
         statusLabel.ForeColor = Color.Red;
         statusLabel.Text      = "Status: Disconnected";
     }
 }
Пример #15
0
 public void etiketoku(ImpinjReader sender, TagReport report)
 {
     foreach (Tag tag in report)
     {
         string Epc = tag.Epc.ToString();
         if (!EpcList.Items.Contains(Epc))
         {
             EpcList.Items.Add(Epc);
         }
         reader.Stop();
     }
 }
 public bool StopRead()
 {
     try
     {
         reader.Stop();
         return(true);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
Пример #17
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);
            }
        }
Пример #18
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);
            }
        }
Пример #19
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);
            }
        }
Пример #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();

                // 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);
            }
        }
Пример #21
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");
        }
    }
Пример #22
0
 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);
     }
 }
Пример #23
0
 private void buttonStop_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         // Don't call the Stop method if the
         // reader is already stopped.
         if (reader.QueryStatus().IsSingulating)
         {
             reader.Stop();
         }
     }
     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);
     }
 }
Пример #24
0
        private void disconnect()
        {
            if (rdr != null)
            {
                rdr.Stop();
                rdr.Disconnect();
                rdr = null;
                stoppedEvent(this, EventArgs.Empty);
            }

            if (logging)
            {
                log.Close();
            }
        }
        /// <summary>
        /// Stop RFID
        /// </summary>
        public void Stop()
        {
            ObjectUpdate.Close();

            if (Reader.IsConnected)
            {
                try
                {
                    Reader.Stop();
                    Reader.Disconnect();
                }
                catch (System.Threading.ThreadInterruptedException e)
                {
                    Console.WriteLine(e);
                }
            }
        }
Пример #26
0
 public void stopRead()
 {
     try
     {
         if (mReaderType == READER_TYPE.READER_IMP)
         {
             mReaderIMP.Stop();
         }
         if (mReaderType == READER_TYPE.READER_TM)
         {
             mReaderTM.StopReading();
         }
     }
     catch (Exception)
     {
     }
 }
Пример #27
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.
                // Change the ReaderHostname constant in SolutionConstants.cs
                // to the IP address or hostname of your reader.
                reader.Connect(SolutionConstants.ReaderHostname);

                // 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);
            }
        }
Пример #28
0
        public bool Connection(string address)
        {
            if (string.IsNullOrEmpty(address))
            {
                //TODO: Show msg
            }

            try
            {
                Impinj = new ImpinjReader();
                Impinj.Connect(address);
                Impinj.Stop();
            }

            catch (OctaneSdkException ee)
            {
                Console.WriteLine($"Octane SDK exception: Impinj \" {address} \" - {ee.Message} error");
            }

            catch (Exception ee)
            {
                Console.WriteLine($"Exception : Impinj \" {address} \" - {ee.Message} error");
                Console.WriteLine(ee.StackTrace);
            }
            Settings = Impinj.QueryDefaultSettings();

            Settings.Report.IncludeFastId            = true;
            Settings.Report.IncludeFirstSeenTime     = true;
            Settings.Report.IncludeAntennaPortNumber = true;
            Settings.Report.IncludeLastSeenTime      = true;
            Settings.Report.IncludeSeenCount         = true;

            Settings.Report.Mode           = ReportMode.Individual;
            Settings.ReaderMode            = ReaderMode.AutoSetDenseReader; //.AutoSetDenseReader;
            Settings.SearchMode            = SearchMode.DualTarget;         //.DualTarget;
            Settings.Session               = 1;
            Settings.TagPopulationEstimate = Convert.ToUInt16(200);

            Impinj.ApplySettings(Settings);

            return(Impinj.IsConnected);
        }
Пример #29
0
        // This event handler will be called when tag
        // operations have been executed by the reader.
        static void OnTagOpComplete(ImpinjReader reader, TagOpReport report)
        {
            // Loop through all the completed tag operations
            foreach (TagOpResult result in report)
            {
                if (result is TagWriteOpResult)
                {
                    // These are the results of settings the kill password.
                    // Cast it to the correct type.
                    TagWriteOpResult writeResult = result as TagWriteOpResult;
                    // Print out the results.
                    Console.WriteLine("Set kill password complete.");
                    Console.WriteLine("EPC : {0}", writeResult.Tag.Epc);
                    Console.WriteLine("Status : {0}", writeResult.Result);
                    Console.WriteLine("Number of words written : {0}\n", writeResult.NumWordsWritten);

                    // If we successfully set the kill password we can now
                    // kill the chip. We must stop the reader first, to allow
                    // the  chip to update the kill password.
                    if (writeResult.Result == WriteResultStatus.Success)
                    {
                        reader.Stop();
                        AddKillOp();
                    }
                }
                else if (result is TagKillOpResult)
                {
                    // Cast it to the correct type.
                    // These are the results of killing the tag.
                    TagKillOpResult killResult = result as TagKillOpResult;
                    // Print out the results.
                    Console.WriteLine("Kill operation complete.");
                    Console.WriteLine("EPC : {0}", killResult.Tag.Epc);
                    Console.WriteLine("Status : {0}", killResult.Result);
                }
            }
        }
Пример #30
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;

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