Пример #1
0
        private void inventoryTest()
        {
            //only can inventery 1 tag, because the reader is a shit
            UInt16 byteLen = 0;

            byte[] ary_data = new byte[9];    //the first byte is DSFID, and the other 8 byte containers the UID data
            try
            {
                st = ISO15693Commands.rf_inventory(icdev, 0x36, 0x00, 0x00, out byteLen, ary_data);
                if (st != 0)
                {
                    MessageBox.Show("未发现单个标签");
                    return;
                }
                else
                {
                    string UID = CCommondMethod.ByteArrayToString(ary_data, 1, 8);

                    Array.Copy(ary_data, 1, uid, 0, 8);

                    textBox1.Text = UID;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Пример #2
0
        private void readBlockTest()
        {
            byte byteLen = 0;

            byte[] ary_data = new byte[128];    //the first byte is DSFID, and the other 8 byte containers the UID data
            try
            {
                byte[] a = new byte[8];
                st = ISO15693Commands.rf_readblock(icdev, 0x22, 0x00, 0x0A, uid, out byteLen, ary_data);
                if (st != 0)
                {
                    MessageBox.Show("未发现单个标签");
                    return;
                }
                else
                {
                    string blockData = CCommondMethod.ByteArrayToString(ary_data, 0, 128);

                    textBox2.Text = blockData;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Пример #3
0
        private bool GetTagUID()
        {
            //only can inventery 1 tag, because the reader is a shit
            UInt16 byteLen = 0;

            byte[] ary_data = new byte[9];    //the first byte is DSFID, and the other 8 byte containers the UID data
            try
            {
                st = ISO15693Commands.rf_inventory(ReaderInfo.icdev, 0x36, 0x00, 0x00, out byteLen, ary_data);
                if (st != 0)
                {
                    MessageBox.Show("未发现单个标签");
                    return(false);
                }
                else
                {
                    Array.Copy(ary_data, 1, tagUIDbyte, 0, 8);

                    byte[] msbFstUID = new byte[8];
                    Array.Copy(tagUIDbyte, msbFstUID, 8);
                    Array.Reverse(msbFstUID);

                    tagUIDstring = CCommondMethod.ByteArrayToString(msbFstUID, 0, 8);

                    return(true);
                }
            }
            catch (Exception)
            {
                return(false);
            }
        }
Пример #4
0
        private bool GetTagUID()
        {
            //only can inventery 1 tag, because the reader is a shit
            UInt16 byteLen = 0;

            byte[] ary_data = new byte[9];    //the first byte is DSFID, and the other 8 byte containers the UID data
            try
            {
                int  loop     = 0;
                bool stopLoop = false;

                /*
                 * loop 30 second to find tag
                 */
                while (loop < 300 && !stopLoop)
                {
                    st = ISO15693Commands.rf_inventory(ReaderInfo.icdev, 0x36, 0x00, 0x00, out byteLen, ary_data);

                    stopLoop = st == 0 ? true : false;

                    loop++;

                    System.Threading.Thread.Sleep(100);
                }

                if (st != 0)
                {
                    //MessageBox.Show("未发现单个标签");
                    return(false);
                }
                else
                {
                    Array.Copy(ary_data, 1, m_btTagUID, 0, 8);

                    byte[] msbFstUID = new byte[8];
                    Array.Copy(m_btTagUID, msbFstUID, 8);
                    Array.Reverse(msbFstUID);

                    m_sTagUIDstring = CCommondMethod.ByteArrayToString(msbFstUID, 0, 8);

                    return(true);
                }
            }
            catch (Exception)
            {
                return(false);
            }
        }