Beispiel #1
0
 private void timerPing_Tick(object sender, EventArgs e)
 {
     if (Reader1.CheckPing() > 0)
     {
         lInfo.Items.Add("Reader already dropped");
         // If you are identifying label,can immediately stop.
         if (1 == EpcReading)
         {
             bEpcId_Click(sender, e);
         }
     }
 }
Beispiel #2
0
        private void bTcpCon_Click(object sender, EventArgs e)
        {
            int    status;
            int    port;
            byte   v1 = 0;
            byte   v2 = 0;
            string s  = "";

            try
            {
                port = int.Parse(tPort.Text);
                s    = tIp.Text;
            }
            catch (Exception)
            {
                lInfo.Items.Add("Please input the ip address and port !");
                return;
            }
            // Start to ping reader
            if (Reader1.StartPing(tIp.Text) <= 0)
            {
                while (Reader1.CheckPing() > 0)
                {
                    lInfo.Items.Add("Check reader ping state ...");
                    Application.DoEvents();
                    System.Threading.Thread.Sleep(500);
                }
                lInfo.Items.Add("Reader ping success");
                timerPing.Enabled = true;
            }
            status = Reader1.TcpConnectReader(tIp.Text, port);
            if (status != 0)
            {
                lInfo.Items.Add("Connect Reader Failed!");
                Reader1.EndPing();
                return;
            }
            status = Reader1.GetFirmwareVersion(ref v1, ref v2);
            if (status != 0)
            {
                lInfo.Items.Add("Can not connect with the reader!");
                Reader1.TcpCloseConnect();
                Reader1.EndPing();
                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;
            bTcpDiscon.Enabled = true;

            bReset.Enabled = true;

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

            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);
        }