コード例 #1
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            IRP1.ReadTag.ReadMemoryBank rmb = (IRP1.ReadTag.ReadMemoryBank)Enum.Parse(typeof(IRP1.ReadTag.ReadMemoryBank), cbReadMB.Items[cbReadMB.SelectedIndex].ToString());
            msg = new IRP1.ReadTag(rmb);
            byte a = 0x80;//天线

            if (a1.Checked)
            {
                a += 0x01;
            }
            if (a2.Checked)
            {
                a += 0x02;
            }
            if (a3.Checked)
            {
                a += 0x04;
            }
            if (a4.Checked)
            {
                a += 0x08;
            }
            msg.Antenna = a;
            msg.IsLoop  = (rbLoop.Checked) ? true : false;
            msg.Q       = (byte)numQ.Value;


            this.Close();
        }
コード例 #2
0
ファイル: FormScanConfig.cs プロジェクト: dongdong-2009/AAA
        private void btnOK_Click(object sender, EventArgs e)
        {
            IRP1.ReadTag.ReadMemoryBank rmb = (IRP1.ReadTag.ReadMemoryBank)Enum.Parse(typeof(IRP1.ReadTag.ReadMemoryBank), "EPC_TID_UserData_6C");
            msg = new IRP1.ReadTag(rmb);
            byte a = 0x80;//天线

            if (a1.Checked)
            {
                a += 0x01;
            }
            if (a2.Checked)
            {
                a += 0x02;
            }
            if (a3.Checked)
            {
                a += 0x04;
            }
            if (a4.Checked)
            {
                a += 0x08;
            }
            msg.Antenna = a;
            msg.IsLoop  = (rbLoop.Checked) ? true : false;
            msg.Q       = (byte)numQ.Value;


            //保存到Config.xml
            System.Collections.Generic.Dictionary <string, string> attributes = null;
            ConfigUtil configUtil = new ConfigUtil();

            attributes = configUtil.GetAttribute();

            attributes["Antenna"] = a.ToString();
            attributes["Q"]       = numQ.Value.ToString();
            attributes["IsLoop"]  = (rbLoop.Checked) ? "1" : "0";
            configUtil.Save(attributes);


            RFIDRead.scanMsg = msg;
            this.Close();
        }
コード例 #3
0
        public MyReader(String readerName)//TCPIP_Client
        {
            _reader = new IRP1.Reader(readerName);
            if (_reader.ProtocolVersion == "IRP1")
            {
                XmlNode node = Common.sysit_xml.DocumentElement.SelectSingleNode("Reader[@Name='" + _reader.ReaderName + "']");
                XmlNode sn   = node.SelectSingleNode("ScanMessage");
                #region ScanMessage
                IRP1.ReadTag.ReadMemoryBank rmb = (IRP1.ReadTag.ReadMemoryBank)
                                                  Enum.Parse(typeof(IRP1.ReadTag.ReadMemoryBank), sn.Attributes["ReadMemoryBank"].Value);
                scanMsgParam.readMemoryBank = rmb;
                int readtime = int.Parse(sn.SelectSingleNode("ReadTime").InnerText);
                int stoptime = int.Parse(sn.SelectSingleNode("StopTime").InnerText);
                scanMsgParam.readtime = readtime;
                scanMsgParam.stoptime = stoptime;
                string readertype = "800";
                if (_reader.ModelNumber.IndexOf("502E") != -1 || _reader.ModelNumber == "XC-RF811")
                {
                    readertype = "500";
                }
                if (readtime > 0 || stoptime > 0)
                {
                    ScanMessage = new IRP1.ReadTag(rmb, readtime, stoptime);
                }
                else
                {
                    ScanMessage = new IRP1.ReadTag(rmb);
                }

                IRP1.ReadTag rt = (IRP1.ReadTag)ScanMessage;
                switch (rmb)
                {
                case IRP1.ReadTag.ReadMemoryBank.EPC_6C:
                case IRP1.ReadTag.ReadMemoryBank.EPC_6C_ID_6B:
                case IRP1.ReadTag.ReadMemoryBank.EPC_PC_6C:
                case IRP1.ReadTag.ReadMemoryBank.EPC_TID_UserData_6C:
                case IRP1.ReadTag.ReadMemoryBank.EPC_TID_UserData_6C_ID_UserData_6B:
                case IRP1.ReadTag.ReadMemoryBank.TID_6C:
                case IRP1.ReadTag.ReadMemoryBank.TID_6C_ID_6B:
                {
                    string[] ps = sn.SelectSingleNode("Param").InnerText.Split(',');
                    scanMsgParam.antennaIndex = byte.Parse(ps[0]);
                    rt.Antenna          = getAntenna(ps[0], readertype);
                    scanMsgParam.q      = rt.Q = byte.Parse(ps[1]);
                    scanMsgParam.isLoop = rt.IsLoop = ((ps[2] == "1") ? true : false);
                }
                break;

                case IRP1.ReadTag.ReadMemoryBank.EPC_TID_UserData_6C_2:
                {
                    string[] ps = sn.SelectSingleNode("Param").InnerText.Split(',');
                    scanMsgParam.antennaIndex = byte.Parse(ps[0]);
                    rt.Antenna                  = getAntenna(ps[0], readertype);
                    scanMsgParam.q              = rt.Q = byte.Parse(ps[1]);
                    scanMsgParam.isLoop         = rt.IsLoop = ((ps[2] == "1") ? true : false);
                    scanMsgParam.tidLen         = rt.TidLen = byte.Parse(ps[3]);
                    scanMsgParam.userdataPtr_6C = rt.UserDataPtr_6C = uint.Parse(ps[4]);
                    scanMsgParam.userdataLen_6C = rt.UserDataLen_6C = byte.Parse(ps[5]);
                }
                break;

                case IRP1.ReadTag.ReadMemoryBank.EPC_TID_UserData_Reserved_6C_ID_UserData_6B:
                {
                    string[] ps = sn.SelectSingleNode("Param").InnerText.Split(',');
                    scanMsgParam.antennaIndex = byte.Parse(ps[0]);
                    rt.Antenna                  = getAntenna(ps[0], readertype);
                    scanMsgParam.q              = rt.Q = byte.Parse(ps[1]);
                    scanMsgParam.isLoop         = rt.IsLoop = ((ps[2] == "1") ? true : false);
                    scanMsgParam.tidLen         = rt.TidLen = byte.Parse(ps[3]);
                    scanMsgParam.userdataPtr_6C = rt.UserDataPtr_6C = uint.Parse(ps[4]);
                    scanMsgParam.userdataLen_6C = rt.UserDataLen_6C = byte.Parse(ps[5]);
                    scanMsgParam.userdataPtr_6B = rt.UserDataPtr_6B = byte.Parse(ps[6]);
                    scanMsgParam.userdataLen_6B = rt.UserDataLen_6B = byte.Parse(ps[7]);
                    scanMsgParam.reservedLen    = rt.ReservedLen = byte.Parse(ps[8]);
                    scanMsgParam.pwd            = rt.AccessPwd = Util.ConvertHexStringToByteArray(ps[9]);
                    scanMsgParam.readTimes_6C   = rt.ReadTimes_6C = byte.Parse(ps[10]);
                    scanMsgParam.readTimes_6B   = rt.ReadTimes_6B = byte.Parse(ps[11]);
                }
                break;

                case IRP1.ReadTag.ReadMemoryBank.ID_6B:
                case IRP1.ReadTag.ReadMemoryBank.ID_UserData_6B:
                {
                    string[] ps = sn.SelectSingleNode("Param").InnerText.Split(',');
                    scanMsgParam.antennaIndex = byte.Parse(ps[0]);
                    rt.Antenna          = getAntenna(ps[0], readertype);
                    scanMsgParam.isLoop = rt.IsLoop = ((ps[1] == "1") ? true : false);
                }
                break;
                }
                #endregion
                #region StopMessage
                StopMessage = new IRP1.PowerOff();
                #endregion
            }
        }
コード例 #4
0
ファイル: Form1.cs プロジェクト: Pablini/mVengo
        private void btnApplyTxPwr_Click(object sender, EventArgs e)
        {
            #region Configure Antenna 1;
            if (nudAnt1.Text != string.Empty)
            {
                lbl_msg.Text = "";
                String strSuc1 = "";
                String strFai1 = "";
                Byte[] aData   = new Byte[2];
                aData[0] = 0x00;//Antenna #1
                aData[1] = (Byte)Convert.ToInt16(nudAnt1.Text);
                IRP1.SysConfig_800 order = new IRP1.SysConfig_800(0x65, aData);
                if (reader.Send(order))
                {
                    strSuc1 += "1,";
                }
                else
                {
                    strFai1 += "1,";
                }
                if (strSuc1 == "1,")
                {
                    lbl_msg.Text = lbl_msg.Text + "Ant1 Success, ";
                }
                else
                {
                    lbl_msg.Text = lbl_msg.Text + "Ant1 Fail, ";
                }
            }
            #endregion


            #region Configure Antenna 2;
            if (nudAnt2.Text != string.Empty)
            {
                String strSuc = "";
                String strFai = "";
                Byte[] aData  = new Byte[2];
                aData[0] = 0x01;//Antenna #2
                aData[1] = (Byte)Convert.ToInt16(nudAnt2.Text);
                IRP1.SysConfig_800 order = new IRP1.SysConfig_800(0x65, aData);
                if (reader.Send(order))
                {
                    strSuc += "1,";
                }
                else
                {
                    strFai += "1,";
                }
                if (strSuc == "1,")
                {
                    lbl_msg.Text = lbl_msg.Text + "Ant2 Success, ";
                }
                else
                {
                    lbl_msg.Text = lbl_msg.Text + "Ant2 Fail, ";
                }
                #endregion
            }


            #region Configure Antenna 3;
            if (nudAnt3.Text != string.Empty)
            {
                String strSuc = "";
                String strFai = "";
                Byte[] aData  = new Byte[2];
                aData[0] = 0x02;//Antenna #3
                aData[1] = (Byte)Convert.ToInt16(nudAnt3.Text);
                IRP1.SysConfig_800 order = new IRP1.SysConfig_800(0x65, aData);
                if (reader.Send(order))
                {
                    strSuc += "1,";
                }
                else
                {
                    strFai += "1,";
                }
                if (strSuc == "1,")
                {
                    lbl_msg.Text = lbl_msg.Text + "Ant3 Success, ";
                }
                else
                {
                    lbl_msg.Text = lbl_msg.Text + "Ant3 Fail, ";
                }
                #endregion
            }

            #region Configure Antenna 4;
            if (nudAnt4.Text != string.Empty)
            {
                String strSuc = "";
                String strFai = "";
                Byte[] aData  = new Byte[2];
                aData[0] = 0x03;//Antenna #4
                aData[1] = (Byte)Convert.ToInt16(nudAnt4.Text);
                IRP1.SysConfig_800 order = new IRP1.SysConfig_800(0x65, aData);
                if (reader.Send(order))
                {
                    strSuc += "1,";
                }
                else
                {
                    strFai += "1,";
                }
                if (strSuc == "1,")
                {
                    lbl_msg.Text = lbl_msg.Text + "Ant4 Success, ";
                }
                else
                {
                    lbl_msg.Text = lbl_msg.Text + "Ant4 Fail, ";
                }
                #endregion
            }


            #region Configure Memory Bank, Antenna, Read Method and Q value
            IRP1.ReadTag.ReadMemoryBank rmb = (IRP1.ReadTag.ReadMemoryBank)Enum.Parse(typeof(IRP1.ReadTag.ReadMemoryBank), cbReadMB.Items[cbReadMB.SelectedIndex].ToString());
            msg = new IRP1.ReadTag(rmb);
//            MessageBox.Show("Q = " + msg.Q.ToString() + "  Is loop = " +  msg.IsLoop.ToString());
            byte a = 0x80;//
            if (cbAnt1.Checked)
            {
                a += 0x01;
            }
            if (cbAnt2.Checked)
            {
                a += 0x02;
            }
            if (cbAnt3.Checked)
            {
                a += 0x04;
            }
            if (cbAnt4.Checked)
            {
                a += 0x08;
            }
            msg.Antenna = a;
            msg.IsLoop  = (rbContinuous.Checked) ? true : false;
            msg.Q       = (byte)numQ.Value;

//set Q
            byte[] bs = new byte[1];
            bs[0] = (Byte)numQ.Value;
            IRP1.TagOperationConfig_6C msg1 = new IRP1.TagOperationConfig_6C(0x10, bs);
            if (reader.Send(msg1))
            {
                lbl_msg.Text = lbl_msg.Text + "Q = " + numQ.Value.ToString();
            }
            else
            {
                lbl_msg.Text = lbl_msg.Text + "Error Setting Q";
            }



            #endregion
        }