private void Button_ReadBytes_Click(object sender, RoutedEventArgs e)
        {
            textBox_DataRead.Text = "";
            if (comboBox_TagID.SelectedIndex == -1)
            {
                //For Readbytes the UID must be already read using "Identify"
                MessageBox.Show(this, "Identifier is needed --> Call Identify first");
                return;
            }
            //Get parameters from Window
            int from   = int.Parse(textBox_From.Text);
            int length = int.Parse(textBox_Length.Text);
            int page   = int.Parse(textBox_Page.Text);

            byte[] tagID = iIDReaderLibrary.Utils.HelperFunctions.HexConverter.ToByteArray(comboBox_TagID.Text.Replace("-", " "));

            if (m_DocInterface != null)
            {
                if (m_DocInterface.IsInitialized)
                {
                    //This function starts the "ReadBytes" process in a new thread, and reports the result using "DocResultChanged" Event
                    m_DocInterface.StartReadBytes(tagID, page, from, length);
                    textBox_ThreadLog.Text += "\n = StartReadBytes =\n";
                    textBox_ThreadLog.ScrollToEnd();
                    progressBar.IsIndeterminate = true;
                    mLastDocResultTimestamp     = DateTime.Now;
                }
            }
        }
Exemple #2
0
 private static void Console_Execute_ReadBytes(DocInterfaceControl _docIntControl)
 {
     //ReadBytes function needs a Tag ID as parameter --> Obtained using "Identify"
     if (m_LastTagID == null)
     {
         Console.WriteLine("Perform \"Identify\" until a transponder is found before calling ReadBytes");
         return;
     }
     //First make sure DocInterfaceControl is initialized
     if (_docIntControl != null)
     {
         if (_docIntControl.IsInitialized)
         {
             Console.WriteLine("");
             Console.WriteLine("Reading 16 Bytes from position 0 (for UHF using page 3)");
             docOperationCompleted = false;
             //Start "ReadBytes" process
             //  TagID --> m_LastTagID (contains TagID found in last call to Identify)
             //  Page --> 3 (for HF tags not needed, for UHF page 3 is user-block)
             //  From --> 0 (first byte in memory)
             //  Length --> 16 (Bytes 0 - 15 will be read)
             _docIntControl.StartReadBytes(m_LastTagID, 3, 0, 16);
             //For demo purposes, just wait blocking execution until DOC process is completed (notified using "DocResultChanged" event, ProcessFinished = true)
             while (!docOperationCompleted)
             {
                 Thread.Sleep(100);
             }
             Console.WriteLine("");
         }
         else
         {
             Console.WriteLine("DocInterfaceControl not initialized!");
         }
     }
 }