コード例 #1
0
ファイル: frmMain.cs プロジェクト: xxdoc/vb600
        private void btnWrite_Click(object sender, EventArgs e)
        {
            byte[] bWrite = new byte[96 / 8];
            txtEPC.Text = txtEPC.Text.ToLower();
            if ((txtEPC.Text.Length % 2) != 0)
            {
                txtEPC.Text = "0" + txtEPC.Text;
            }

            try
            {
                for (int i = 0, j = 0; i < txtEPC.Text.Length; i += 2, j++)
                {
                    bWrite[j]  = (byte)(16 * Utils.GetHex(txtEPC.Text[i]));
                    bWrite[j] += (byte)Utils.GetHex(txtEPC.Text[i + 1]);
                }

                if (R1000Reader.RFIDTagWriteFile(MemoryBank.EPC, 4, bWrite, 96 / 8, 0) > 0)
                {
                    lblStatus.Text = "Write OK";
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #2
0
ファイル: frmMain.cs プロジェクト: xxdoc/vb600
        private void EscrituraRFID()
        {
            byte[] bWrite = new byte[96 / 8];
            txtEPC.Text = txtEPC.Text.ToLower();

            if ((txtEPC.Text.Length % 2) != 0)
            {
                txtEPC.Text = "0" + txtEPC.Text;
            }
            // if ((txtEPC.Text.Length % 2) != 0) txtEPC.Text =  txtEPC.Text + "00";
            try
            {
                //for (int i = 0, j = 0; i < txtEPC.Text.Length; i += 2, j++)
                //{
                //    bWrite[j] = (byte)(16 * Utils.GetHex(txtEPC.Text[i]));
                //    bWrite[j] += (byte)Utils.GetHex(txtEPC.Text[i + 1]);
                //}

                for (int i = 0, j = 0; i < txtEPC.Text.Length; i += 2, j++)
                {
                    bWrite[j]  = (byte)(16 * Utils.GetHex(txtEPC.Text[i]));
                    bWrite[j] += (byte)Utils.GetHex(txtEPC.Text[i + 1]);
                }

                if (R1000Reader.RFIDTagWriteFile(MemoryBank.EPC, 4, bWrite, 96 / 8, 0) > 0)
                {
                    lblStatus.Text = "Write OK";
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #3
0
ファイル: frmMain.cs プロジェクト: xxdoc/vb600
        private void button2_Click_1(object sender, EventArgs e)
        {
            #region codes ========================================
            string strWrite = "luyis";
            string strRead  = string.Empty;
            byte[] bytWrite = null;
            byte[] bytRead  = new byte[32];
            int    nWrite   = 0;
            int    nRead    = 0;

            bytWrite = Encoding.Default.GetBytes(strWrite);
            nWrite   = R1000Reader.RFIDTagWriteFile(MemoryBank.USER, 0, bytWrite, bytWrite.Length, 0);

            //nRead = R1000Reader.RFIDTagReadFile(MemoryBank.USER, 0, bytRead, 11, 0);
            strRead = Encoding.Default.GetString(bytRead, 0, 11);
            #endregion //end codes
        }