private void bEpcRead_Click(object sender, EventArgs e)
        {
            int membank;
            int wordptr;
            int wordcnt;
            int status = 0;

            byte[] value = new byte[16];

            string s  = "The data is:";
            string s1 = "";

            membank = cEpcMembank.SelectedIndex;
            wordptr = cEpcWordptr.SelectedIndex;
            wordcnt = cEpcWordcnt.SelectedIndex;

            status = Api.EpcRead((byte)membank, (byte)wordptr, (byte)wordcnt, ref value);

            if (status != 0)
            {
                lInfo.Items.Add("Read failed!");
                return;
            }
            else
            {
                for (int i = 0; i < wordcnt * 2; i++)
                {
                    s1 = string.Format("{0:X2}", value[i]);
                    s += s1;
                }
                lInfo.Items.Add("Read success!");
                lInfo.Items.Add(s);
            }
        }
Example #2
0
        private void bEpcRead_Click(object sender, EventArgs e)
        {
            int membank;
            int wordptr;
            int wordcnt;
            int status = 0;

            byte[] value = new byte[16];

            string s  = "The data is:";
            string s1 = "";
            string s2 = "";

            membank = cEpcMembank.SelectedIndex;
            wordptr = cEpcWordptr.SelectedIndex;
            wordcnt = cEpcWordcnt.SelectedIndex;

            status = Reader1.EpcRead((byte)membank, (byte)wordptr, (byte)wordcnt, ref value);

            if (status != 0)
            {
                MessageBox.Show("Read failed!");
                //lInfo.Items.Add("R");

                return;
            }
            else
            {
                for (int i = 0; i < wordcnt * 2; i++)
                {
                    s1  = string.Format("{0:X2}", value[i]);
                    s2 += s1;
                    s  += s1;
                }
                //dataBaca = s2;
                MessageBox.Show("Read Succes!");
                //lInfo.Items.Add("Read success!");
                //lInfo.Items.Add(s);
                if (comboBox1.Items.IndexOf(s2) == -1)
                {
                    comboBox1.Items.Add(s2);
                }
                if ((comboBox1.Items.Count != 0))
                {
                    comboBox1.SelectedItem = s2;
                }
            }
            if (txtRfid.Text.Trim() != "")
            {
                if (txtRfid.Text == comboBox1.Text)
                { //jika sama
                    label12.Text = "Match!";
                    //lblMatch.BackColor = Color.Blue;
                    label12.ForeColor = Color.Blue;
                }
                else
                {
                    label12.Text = "Not Match!"; label12.ForeColor = Color.Red;
                }
            }
            else
            {
                label12.Text = "Not Match!"; label12.ForeColor = Color.Red;
            }
        }