コード例 #1
0
        private void bRs232Con_Click(object sender, EventArgs e)
        {
            int    status;
            byte   v1 = 0;
            byte   v2 = 0;
            string s  = "";

            status = Reader1.OpenCommPort(cCommPort.Text);
            if (status != 0)
            {
                lInfo.Items.Add("Open Comm Port Failed!");
                return;
            }
            status = Reader1.GetFirmwareVersion(ref v1, ref v2);
            if (status != 0)
            {
                lInfo.Items.Add("Can not connect with the reader!");
                Reader1.CloseCommPort();
                return;
            }
            lInfo.Items.Add("Connect the reader success!");
            s = string.Format("The reader's firmware version is:V{0:d2}.{1:d2}", v1, v2);
            lInfo.Items.Add(s);
            bAntQuery_Click(sender, e);
            bTcpCon.Enabled = false;

            // 新增设置波特率功能,可提高多标签识别速度
            status = Reader1.SetBaudRate((byte)cBaudrate.SelectedIndex);
            if (status != 0)
            {
                lInfo.Items.Add("Set baudrate failed!");
                Reader1.CloseCommPort();
                return;
            }
            lInfo.Items.Add("Set baudrate success!");

            bReset.Enabled = true;

            bRs232Con.Enabled    = false;
            bRs232Discon.Enabled = true;

            bRfSet.Enabled   = true;
            bRfQuery.Enabled = true;

            bIsoId.Enabled        = true;
            bIsoRead.Enabled      = true;
            bIsoWrite.Enabled     = true;
            bIsoLock.Enabled      = true;
            bIsoQueryLock.Enabled = true;

            bEpcId.Enabled    = true;
            bEpcRead.Enabled  = true;
            bEpcWrite.Enabled = true;
            bEpcInit.Enabled  = true;
            bEpcKill.Enabled  = false;

            bRfQuery_Click(null, null);
        }
コード例 #2
0
        private void bRs232Con_Click_1(object sender, EventArgs e)
        {
            int  status;
            byte v1 = 0;
            byte v2 = 0;

            status = Api.OpenCommPort(cCommPort.Text);
            if (status != 0)
            {
                MessageBox.Show("Cổng không tồn tại");
                return;
            }
            status = Api.GetFirmwareVersion(ref v1, ref v2);
            if (status != 0)
            {
                MessageBox.Show("Không thể kết nối đến đầu đọc");
                Api.CloseCommPort();
                return;
            }
            startRead();


            thread = new Thread(new ThreadStart(runForever));
            thread.Start();
        }
コード例 #3
0
ファイル: HomePage.cs プロジェクト: gazzar97/RFIDDemo
        private void button6_Click(object sender, EventArgs e)
        {
            // Connect To Rfid
            isCLosed = false;
            int    status;
            byte   v1 = 0;
            byte   v2 = 0;
            string s  = "";

            status = Api.OpenCommPort("COM3:");
            if (status != 0)
            {
                listView1.Items.Add("Failed To Open RFID Reader!");
                return;
            }
            status = Api.GetFirmwareVersion(ref v1, ref v2);
            if (status != 0)
            {
                listView1.Items.Add("Can not connect with the reader!");
                Api.CloseCommPort();
                return;
            }
            listView1.Items.Add("Connect the reader success!");
            s = string.Format("The reader's firmware version is:V{0:d2}.{1:d2}", v1, v2);
            listView1.Items.Add(s);
            Set_Ant();
            bAntQuery();
            StartReading();
        }
コード例 #4
0
ファイル: Form1.cs プロジェクト: michaeltandy/KL9005S_DemoApp
        private void bRs232Con_Click(object sender, EventArgs e)
        {
            int    status;
            byte   v1 = 0;
            byte   v2 = 0;
            string s  = "";

            status = Reader1.OpenCommPort(cCommPort.Text);
            if (status != 0)
            {
                lInfo.Items.Add("Open Comm Port Failed!");
                return;
            }
            status = Reader1.GetFirmwareVersion(ref v1, ref v2);
            if (status != 0)
            {
                lInfo.Items.Add("Can not connect with the reader!");
                Reader1.CloseCommPort();
                return;
            }
            lInfo.Items.Add("Connect the reader success!");
            s = string.Format("The reader's firmware version is:V{0:d2}.{1:d2}", v1, v2);
            lInfo.Items.Add(s);
            bAntQuery_Click(sender, e);

            // Changing the baud rate produces weird results if the software crashes
            // or similar, as it expects a response from a change-baud-rate command sent
            // at 9600 baud. Leads to software claiming connection failure etc :(
            status = Reader1.SetBaudRate(0);
            if (status != 0)
            {
                lInfo.Items.Add("Set baudrate failed!");
                Reader1.CloseCommPort();
                return;
            }
            lInfo.Items.Add("Set baudrate success!");

            bReset.Enabled = true;

            cCommPort.Enabled    = false;
            bRs232Con.Enabled    = false;
            bRs232Discon.Enabled = true;

            bRfSet.Enabled   = true;
            bRfQuery.Enabled = true;

            bEpcId.Enabled    = true;
            bEpcRead.Enabled  = true;
            bEpcWrite.Enabled = true;
            bEpcInit.Enabled  = true;
            bEpcKill.Enabled  = false;

            bRfQuery_Click(null, null);
        }
コード例 #5
0
        private void bRs232Con_Click(object sender, EventArgs e)
        {
            int    status;
            byte   v1 = 0;
            byte   v2 = 0;
            string s  = "";

            status = Reader1.OpenCommPort(cCommPort.Text);
            if (status != 0)
            {
                MessageBox.Show("Open Comm Port Failed!");
                //lInfo.Items.Add("Open Comm Port Failed!");
                return;
            }
            status = Reader1.GetFirmwareVersion(ref v1, ref v2);
            if (status != 0)
            {
                MessageBox.Show("Can not connect with the reader!");
                //lInfo.Items.Add("Can not connect with the reader!");
                Reader1.CloseCommPort();
                return;
            }
            MessageBox.Show("Connect the reader success!");
            //lInfo.Items.Add("Connect the reader success!");
            s = string.Format("The reader's firmware version is:V{0:d2}.{1:d2}", v1, v2);
            // lInfo.Items.Add(s);
            //bAntQuery_Click(sender, e);



            status = Reader1.SetBaudRate((byte)cBaudrate.SelectedIndex);
            if (status != 0)
            {
                MessageBox.Show("Set baudrate failed!");
                // lInfo.Items.Add("Set baudrate failed!");
                Reader1.CloseCommPort();
                return;
            }
            // MessageBox.Show("Set baudrate success!");
            // lInfo.Items.Add("Set baudrate success!");



            bRs232Con.Enabled    = false;
            bRs232Discon.Enabled = true;



            bEpcRead.Enabled  = true;
            bEpcWrite.Enabled = true;
        }