Ejemplo n.º 1
0
        private void btnIOTriggerConfig_Click(object sender, EventArgs e)
        {
            // Brett: This code isn't working yet.  can't figure out where IMessage is coming from.//

            Core.IMessage msg1 = this.msg;
            Core.IMessage msg2 = new IRP1.PowerOff_800();

            msg1.PortType = "";
            byte[] msg1Buff = msg1.TransmitterData;
            msg2.PortType = "";
            byte[] msg2Buff = msg2.TransmitterData;
            byte[] pData    = new byte[5 + msg1Buff.Length + msg2Buff.Length];
            pData[0] = (byte)(cbGPITrigger.SelectedIndex + 1);
            pData[1] = (byte)(cbTrigger.SelectedIndex);
            pData[2] = (byte)(radioButton1.Checked ? 0 : 1);
            pData[3] = (byte)(numTime.Value / 256);
            pData[4] = (byte)(numTime.Value % 256);
            Array.Copy(msg1Buff, 0, pData, 5, msg1Buff.Length);
            Array.Copy(msg2Buff, 0, pData, 5 + msg1Buff.Length, msg2Buff.Length);
            IRP1.SysConfig_800 msg = new IRP1.SysConfig_800(0xE2, pData);
            if (reader.Send(msg))
            {
                MessageBox.Show("Config successful");
            }
            else
            {
                MessageBox.Show("Config failed");
            }
        }
Ejemplo n.º 2
0
        private void btnIOTriggerConfig_Click(object sender, EventArgs e)
        {
            IMessage msg1 = this.scanMsg;
            IMessage msg2 = new IRP1.PowerOff_800();

            msg1.PortType = "";
            byte[] msg1Buff = msg1.TransmitterData;
            msg2.PortType = "";
            byte[] msg2Buff = msg2.TransmitterData;
            byte[] pData    = new byte[5 + msg1Buff.Length + msg2Buff.Length];
            pData[0] = (byte)(cmbox1.SelectedIndex + 1);
            pData[1] = (byte)(cmbox2.SelectedIndex);
            pData[2] = (byte)(radioButton1.Checked ? 0 : 1);
            pData[3] = (byte)(numTime.Value / 256);
            pData[4] = (byte)(numTime.Value % 256);
            Array.Copy(msg1Buff, 0, pData, 5, msg1Buff.Length);
            Array.Copy(msg2Buff, 0, pData, 5 + msg1Buff.Length, msg2Buff.Length);
            IRP1.SysConfig_800 msg = new IRP1.SysConfig_800(0xE2, pData);
            if (reader.Send(msg))
            {
                MessageBox.Show("配置成功");
            }
            else
            {
                MessageBox.Show("配置失败");
            }
        }
Ejemplo n.º 3
0
        private void btnSetRF_Click(object sender, EventArgs e)
        {
            #region Set reader mode;
            byte b = 0x00;
            if (cbReaderMode.Text == "Fast Read")
            {
                b = 0x04;
            }
            else if (cbReaderMode.Text == "Dense Reader M=2")
            {
                b = 0x05;
            }
            else if (cbReaderMode.Text == "Dense Reader M=4")
            {
                b = 0x02;
            }
            else if (cbReaderMode.Text == "AutoSet")
            {
                b = 0xff;
            }
            else
            {
                MessageBox.Show("Error setting mode = default to Fast Read");
                b = 0x04;
            }
            lbl_msg.Text = "";

            IRP1.SysConfig_800 order = new IRP1.SysConfig_800((Byte)0x19, new Byte[] { b });
            if (reader.Send(order))
            {
                lbl_msg.Text = lbl_msg.Text + "Reader Mode = " + cbReaderMode.Text;
            }
            else
            {
                lbl_msg.Text = lbl_msg.Text + "Error setting Reader Mode";
            }
            #endregion

            #region Set Session and Inventory Flag
            byte[] bs = new byte[2];
            bs[0] = (Byte)cbSession.SelectedIndex;
            bs[1] = (Byte)cbFlag.SelectedIndex;
            IRP1.TagOperationConfig_6C order1 = new IRP1.TagOperationConfig_6C(0x12, bs);
            if (reader.Send(order1))
            {
                lbl_msg.Text = lbl_msg.Text + " Session = " + cbSession.Text + " Flag = " + cbFlag.Text;
            }
            else
            {
                lbl_msg.Text = lbl_msg.Text + "Error setting Session and Inventory Flag";
            }
            #endregion
//            MessageBox.Show(cbSession.SelectedIndex.ToString() + " " + cbFlag.SelectedIndex.ToString());
        }
Ejemplo n.º 4
0
        private void btnSet_Click(object sender, EventArgs e)
        {
            if (!isIP(textBox1.Text.Trim()) ||
                !isIP(textBox2.Text.Trim()) ||
                !isIP(textBox3.Text.Trim()))
            {
                MessageBox.Show("请输入正确ip");
                return;
            }

            #region 取IP
            Byte[] ipData = new Byte[12];
            int    p      = 0;

            String[] aryip = textBox1.Text.Split('.');
            foreach (String str in aryip)
            {
                ipData[p] = (Byte)int.Parse(str);
                p++;
            }
            aryip = textBox2.Text.Split('.');
            foreach (String str in aryip)
            {
                ipData[p] = (Byte)int.Parse(str);
                p++;
            }
            aryip = textBox3.Text.Split('.');
            foreach (String str in aryip)
            {
                ipData[p] = (Byte)int.Parse(str);
                p++;
            }
            #endregion

            IRP1.SysConfig_800 order = new IRP1.SysConfig_800(
                0x06,//设置ip
                ipData);
            if (reader.Send(order))
            {
                MessageBox.Show("设置成功");
            }
            else
            {
                MessageBox.Show("设置失败");
            }
        }
Ejemplo n.º 5
0
        private void btnSetIP_Click(object sender, EventArgs e)
        {
            if (!isIP(tbIP.Text.Trim()) ||
                !isIP(tbSubnet.Text.Trim()) ||
                !isIP(tbGateway.Text.Trim()))
            {
                MessageBox.Show("IP is invalid");
                return;
            }

            #region IP
            Byte[] ipData = new Byte[12];
            int    p      = 0;

            String[] aryip = tbIP.Text.Split('.');
            foreach (String str in aryip)
            {
                ipData[p] = (Byte)int.Parse(str);
                p++;
            }
            aryip = tbSubnet.Text.Split('.');
            foreach (String str in aryip)
            {
                ipData[p] = (Byte)int.Parse(str);
                p++;
            }
            aryip = tbGateway.Text.Split('.');
            foreach (String str in aryip)
            {
                ipData[p] = (Byte)int.Parse(str);
                p++;
            }
            #endregion

            IRP1.SysConfig_800 order = new IRP1.SysConfig_800(
                0x06,//config ip
                ipData);
            if (reader.Send(order))
            {
                MessageBox.Show("Config successful");
            }
            else
            {
                MessageBox.Show("Config failed");
            }
        }
Ejemplo n.º 6
0
        private void btn_ReadEPC_Click(object sender, EventArgs e)
        {
            lst_data.Items.Clear();


// enable RSSI to be sent in data stream

            Byte[] rssiConfig = new Byte[1];
            rssiConfig[0] = 0x01;                                                //0x00:disable,0x01:enable
            IRP1.SysConfig_800 order = new IRP1.SysConfig_800(0x14, rssiConfig); //RSSI:0x14
            if (reader.Send(order))
            {
                lbl_msg.Text = "RSSI enabled";
            }
            else
            {
                lbl_msg.Text = "RSSI disabled";
            }

// enable reader UTC to be sent in data stream
            Byte[] utcConfig = new Byte[1];
            utcConfig[0] = 0x01;//0x00:disable,0x01:enable
            IRP1.SysConfig_800 order1 = new IRP1.SysConfig_800(0x18, utcConfig);
            if (reader.Send(order1))
            {
                lbl_msg.Text = lbl_msg.Text + "UTC enabled";
            }
            else
            {
                lbl_msg.Text = lbl_msg.Text + "UTC disabled";
            }



            if (reader != null && reader.IsConnected)
            {
                if (reader.Send(msg))

                {
                    lbl_msg.Text        = lbl_msg.Text + "scan.";
                    btn_Stop.Enabled    = true;
                    btn_ReadEPC.Enabled = false;
                }
            }
        }
Ejemplo n.º 7
0
        private void btnSet_Click(object sender, EventArgs e)
        {
            #region 天线功率设置
            String strSuc = "";
            String strFai = "";
            if (pa1.Text.Trim() != String.Empty && pa1.Visible)
            {
                Byte[] aData = new Byte[2];
                aData[0] = 0x00;//1#
                for (int i = 0; i < list.Length; i++)
                {
                    if (list[i].ToString() == pa1.Text)
                    {
                        aData[1] = (Byte)i;
                    }
                }
                if (!this.isNewPower)
                {
                    IRP1.SysConfig_800 order = new IRP1.SysConfig_800(0x03, aData);
                    if (reader.Send(order))
                    {
                        strSuc += "1,";
                    }
                    else
                    {
                        strFai += "1,";
                    }
                }
                else
                {
                    IRP1.SysConfig_800 order = new IRP1.SysConfig_800(0x65, aData);
                    if (reader.Send(order))
                    {
                        strSuc += "1,";
                    }
                    else
                    {
                        strFai += "1,";
                    }
                }
            }
            if (pa2.Text.Trim() != String.Empty && pa2.Visible)
            {
                Byte[] aData = new Byte[2];
                aData[0] = 0x01;//2#
                for (int i = 0; i < list.Length; i++)
                {
                    if (list[i].ToString() == pa2.Text)
                    {
                        aData[1] = (Byte)i;
                    }
                }
                if (!this.isNewPower)
                {
                    IRP1.SysConfig_800 order = new IRP1.SysConfig_800(0x03, aData);
                    if (reader.Send(order))
                    {
                        strSuc += "2,";
                    }
                    else
                    {
                        strFai += "2,";
                    }
                }
                else
                {
                    IRP1.SysConfig_800 order = new IRP1.SysConfig_800(0x65, aData);
                    if (reader.Send(order))
                    {
                        strSuc += "2,";
                    }
                    else
                    {
                        strFai += "2,";
                    }
                }
            }

            if (pa3.Text.Trim() != String.Empty && pa3.Visible)
            {
                Byte[] aData = new Byte[2];
                aData[0] = 0x02;//3#
                for (int i = 0; i < list.Length; i++)
                {
                    if (list[i].ToString() == pa3.Text)
                    {
                        aData[1] = (Byte)i;
                    }
                }
                if (!this.isNewPower)
                {
                    IRP1.SysConfig_800 order = new IRP1.SysConfig_800(0x03, aData);
                    if (reader.Send(order))
                    {
                        strSuc += "3,";
                    }
                    else
                    {
                        strFai += "3,";
                    }
                }
                else
                {
                    IRP1.SysConfig_800 order = new IRP1.SysConfig_800(0x65, aData);
                    if (reader.Send(order))
                    {
                        strSuc += "3,";
                    }
                    else
                    {
                        strFai += "3,";
                    }
                }
            }
            if (pa4.Text.Trim() != String.Empty && pa4.Visible)
            {
                Byte[] aData = new Byte[2];
                aData[0] = 0x03;//4#
                for (int i = 0; i < list.Length; i++)
                {
                    if (list[i].ToString() == pa4.Text)
                    {
                        aData[1] = (Byte)i;
                    }
                }
                if (!this.isNewPower)
                {
                    IRP1.SysConfig_800 order = new IRP1.SysConfig_800(0x03, aData);
                    if (reader.Send(order))
                    {
                        strSuc += "4,";
                    }
                    else
                    {
                        strFai += "4,";
                    }
                }
                else
                {
                    IRP1.SysConfig_800 order = new IRP1.SysConfig_800(0x65, aData);
                    if (reader.Send(order))
                    {
                        strSuc += "4,";
                    }
                    else
                    {
                        strFai += "4,";
                    }
                }
            }

            if (strSuc != "")
            {
                strSuc = "天线" + strSuc.TrimEnd(',') + "设置成功";
            }
            if (strFai != "")
            {
                strFai = "天线" + strFai.TrimEnd(',') + "设置失败";
            }
            MessageBox.Show(strSuc + "\r\n" + strFai);
            #endregion
        }
Ejemplo n.º 8
0
        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
        }
Ejemplo n.º 9
0
        private void btnSet_Click(object sender, EventArgs e)
        {
            if (!isIP(textBox1.Text.Trim()) ||
                !isIP(textBox2.Text.Trim()) ||
                !isIP(textBox3.Text.Trim()))
            {
                MCP.Logger.Error("请输入正确ip");
                return;
            }

            #region 取IP
            Byte[] ipData = new Byte[12];
            int    p      = 0;

            String[] aryip = textBox1.Text.Split('.');
            foreach (String str in aryip)
            {
                ipData[p] = (Byte)int.Parse(str);
                p++;
            }
            aryip = textBox2.Text.Split('.');
            foreach (String str in aryip)
            {
                ipData[p] = (Byte)int.Parse(str);
                p++;
            }
            aryip = textBox3.Text.Split('.');
            foreach (String str in aryip)
            {
                ipData[p] = (Byte)int.Parse(str);
                p++;
            }
            #endregion

            IRP1.SysConfig_800 order = new IRP1.SysConfig_800(
                0x06,//设置ip
                ipData);
            if (reader.Send(order))
            {
                //保存到Config.xml
                System.Collections.Generic.Dictionary <string, string> attributes = null;
                ConfigUtil configUtil = new ConfigUtil();
                attributes = configUtil.GetAttribute();

                attributes["isTryReconnNet"]       = this.cbkListenNet.Checked ? "1" : "0";
                attributes["tryReconnNetTimeSpan"] = this.numReConnTime.Value.ToString();

                attributes["RFIDConnetIP"] = this.textBox1.Text.Trim() + ":7086";
                configUtil.Save(attributes);

                RFIDRead.InitRFID();
                RFIDRead.Connect();

                MCP.Logger.Info("设置成功");
                this.DialogResult = DialogResult.OK;
            }
            else
            {
                MCP.Logger.Error("设置失败");
            }
        }