Example #1
0
        private void btnsetlongtask_Click(object sender, EventArgs e)
        {
            if ((!this.rbexeinstant.Checked) && (!this.rbexepoweron.Checked))
            {
                MessageBox.Show("please select operation property");
                return;
            }
            if ((!this.rbsearchtag.Checked) && (!this.rbsearandread.Checked) && (!this.rbseaandwrite.Checked))
            {
                MessageBox.Show("please select operation type");
                return;
            }
            if ((!this.cbant1.Checked) && (!this.cbant2.Checked) &&
                (!this.cbant3.Checked) && (!this.cbant4.Checked))
            {
                MessageBox.Show("please select antennas for inventory");
                return;
            }
            if ((!this.rbgen2.Checked) && (!this.rb180006b.Checked))
            {
                MessageBox.Show("please select tag protocol");
                return;
            }
            if (this.tbuploadintv.Text.Trim() == string.Empty)
            {
                MessageBox.Show("please input upload interval");
                return;
            }
            if (this.tbuploadip.Text.Trim() == string.Empty)
            {
                MessageBox.Show("please input upload ip address");
                return;
            }
            if (this.tbuploadport.Text.Trim() == string.Empty)
            {
                MessageBox.Show("please input upload tcp port");
                return;
            }
            if (this.tbreaddur.Text.Trim() == string.Empty)
            {
                MessageBox.Show("please input inventory cycle ");
                return;
            }
            if (this.tbreadinterval.Text.Trim() == string.Empty)
            {
                MessageBox.Show("please input inventory interval");
                return;
            }
            if (this.rbsearandread.Checked)
            {
                if (this.tbblkcnt.Text.Trim() == string.Empty)
                {
                    MessageBox.Show("please input blocks to read");
                    return;
                }
            }
            if (this.rbseaandwrite.Checked)
            {
                if (this.rtbwdata.Text.Trim() == string.Empty)
                {
                    MessageBox.Show("please input data to write");
                    return;
                }
            }

            if (this.rbsearandread.Checked || this.rbseaandwrite.Checked)
            {
                if (this.cbbbank.SelectedIndex == -1)
                {
                    MessageBox.Show("please select bank");
                    return;
                }
                if (this.tbstartaddr.Text.Trim() == string.Empty)
                {
                    MessageBox.Show("please input starting address");
                    return;
                }
            }

            LongTaskInfo ltinfo = new LongTaskInfo();

            if (this.tbpwd.Text.Trim() == string.Empty)
            {
                ltinfo.AccessPassword = (uint)0;
            }
            else
            {
                byte[] tmp = ByteFormat.FromHex(this.tbpwd.Text.Trim());
                ltinfo.AccessPassword = (uint)((tmp[0] << 24) | (tmp[1] << 16) | (tmp[2] << 8) | tmp[3]);
            }
            ltinfo.InvDur         = int.Parse(this.tbreaddur.Text.Trim());
            ltinfo.InvInterval    = int.Parse(this.tbreadinterval.Text.Trim());
            ltinfo.UploadPort     = int.Parse(this.tbuploadport.Text.Trim());
            ltinfo.UploadIp       = this.tbuploadip.Text.Trim();
            ltinfo.UploadInterval = int.Parse(this.tbuploadintv.Text.Trim());
            List <int> ants = new List <int>();

            if (this.cbant1.Checked)
            {
                ants.Add(1);
            }
            if (this.cbant2.Checked)
            {
                ants.Add(2);
            }
            if (this.cbant3.Checked)
            {
                ants.Add(3);
            }
            if (this.cbant4.Checked)
            {
                ants.Add(4);
            }
            ltinfo.OpAnts = ants.ToArray();
            if (this.rb180006b.Checked)
            {
                ltinfo.Potl = TagProtocol.ISO180006B;
            }
            else
            {
                ltinfo.Potl = TagProtocol.GEN2;
            }
            if (this.rbsearchtag.Checked)
            {
                ltinfo.OpType = LongTaskInfo.TagOpType.TagOp_SearchTag;
            }
            else if (this.rbsearandread.Checked)
            {
                ltinfo.OpType = LongTaskInfo.TagOpType.TagOp_SearchTagAndReadBank;
            }
            else
            {
                ltinfo.OpType = LongTaskInfo.TagOpType.TagOp_SearchTagAndWriteBank;
            }
            if (this.rbexeinstant.Checked)
            {
                ltinfo.Action = LongTaskInfo.LongTaskAction.LTA_Start_Instant;
            }
            else
            {
                ltinfo.Action = LongTaskInfo.LongTaskAction.LTA_Start_PowerOn;
            }

            if (this.rbsearandread.Checked || this.rbseaandwrite.Checked)
            {
                ltinfo.OpBank    = this.cbbbank.SelectedIndex;
                ltinfo.StartAddr = int.Parse(this.tbstartaddr.Text.Trim());
            }

            if (this.rbsearandread.Checked)
            {
                ltinfo.BlkCnt = int.Parse(this.tbblkcnt.Text.Trim());
            }
            if (this.rbseaandwrite.Checked)
            {
                ltinfo.Wdata = ByteFormat.FromHex(this.rtbwdata.Text.Trim());
            }

            try
            {
                rdr.ParamSet("LongTaskSetting", ltinfo);
                this.tblocalport.Text = this.tbuploadport.Text;
                MessageBox.Show("setting sucess");
            }
            catch
            {
                MessageBox.Show("setting failed");
            }
        }
Example #2
0
        private void btnsetlongtask_Click(object sender, EventArgs e)
        {
            if ((!this.rbexeinstant.Checked) && (!this.rbexepoweron.Checked))
            {
                MessageBox.Show("请选择操作属性");
                return;
            }
            if ((!this.rbsearchtag.Checked) && (!this.rbsearandread.Checked) && (!this.rbseaandwrite.Checked))
            {
                MessageBox.Show("请选择操作类型");
                return;
            }
            if ((!this.cbant1.Checked) && (!this.cbant2.Checked) &&
                (!this.cbant3.Checked) && (!this.cbant4.Checked))
            {
                MessageBox.Show("请选择天线");
                return;
            }
            if ((!this.rbgen2.Checked) && (!this.rb180006b.Checked))
            {
                MessageBox.Show("请选择协议");
                return;
            }
            if (this.tbuploadintv.Text.Trim() == string.Empty)
            {
                MessageBox.Show("输入上传间隔");
                return;
            }
            if (this.tbuploadip.Text.Trim() == string.Empty)
            {
                MessageBox.Show("输入上传地址");
                return;
            }
            if (this.tbuploadport.Text.Trim() == string.Empty)
            {
                MessageBox.Show("输入上传端口");
                return;
            }
            if (this.tbreaddur.Text.Trim() == string.Empty)
            {
                MessageBox.Show("输入读时长");
                return;
            }
            if (this.tbreadinterval.Text.Trim() == string.Empty)
            {
                MessageBox.Show("输入读间隔");
                return;
            }
            if (this.rbsearandread.Checked)
            {
                if (this.tbblkcnt.Text.Trim() == string.Empty)
                {
                    MessageBox.Show("输入读块数");
                    return;
                }
            }
            if (this.rbseaandwrite.Checked)
            {
                if (this.rtbwdata.Text.Trim() == string.Empty)
                {
                    MessageBox.Show("输入写入数据");
                    return;
                }
            }

            if (this.rbsearandread.Checked || this.rbseaandwrite.Checked)
            {
                if (this.cbbbank.SelectedIndex == -1)
                {
                    MessageBox.Show("请选择bank");
                    return;
                }
                if (this.tbstartaddr.Text.Trim() == string.Empty)
                {
                    MessageBox.Show("输入起始地址");
                    return;
                }
            }

            LongTaskInfo ltinfo = new LongTaskInfo();

            if (this.tbpwd.Text.Trim() == string.Empty)
            {
                ltinfo.AccessPassword = (uint)0;
            }
            else
            {
                byte[] tmp = ByteFormat.FromHex(this.tbpwd.Text.Trim());
                ltinfo.AccessPassword = (uint)((tmp[0] << 24) | (tmp[1] << 16) | (tmp[2] << 8) | tmp[3]);
            }
            ltinfo.InvDur         = int.Parse(this.tbreaddur.Text.Trim());
            ltinfo.InvInterval    = int.Parse(this.tbreadinterval.Text.Trim());
            ltinfo.UploadPort     = int.Parse(this.tbuploadport.Text.Trim());
            ltinfo.UploadIp       = this.tbuploadip.Text.Trim();
            ltinfo.UploadInterval = int.Parse(this.tbuploadintv.Text.Trim());
            List <int> ants = new List <int>();

            if (this.cbant1.Checked)
            {
                ants.Add(1);
            }
            if (this.cbant2.Checked)
            {
                ants.Add(2);
            }
            if (this.cbant3.Checked)
            {
                ants.Add(3);
            }
            if (this.cbant4.Checked)
            {
                ants.Add(4);
            }
            ltinfo.OpAnts = ants.ToArray();
            if (this.rb180006b.Checked)
            {
                ltinfo.Potl = TagProtocol.ISO180006B;
            }
            else
            {
                ltinfo.Potl = TagProtocol.GEN2;
            }
            if (this.rbsearchtag.Checked)
            {
                ltinfo.OpType = LongTaskInfo.TagOpType.TagOp_SearchTag;
            }
            else if (this.rbsearandread.Checked)
            {
                ltinfo.OpType = LongTaskInfo.TagOpType.TagOp_SearchTagAndReadBank;
            }
            else
            {
                ltinfo.OpType = LongTaskInfo.TagOpType.TagOp_SearchTagAndWriteBank;
            }
            if (this.rbexeinstant.Checked)
            {
                ltinfo.Action = LongTaskInfo.LongTaskAction.LTA_Start_Instant;
            }
            else
            {
                ltinfo.Action = LongTaskInfo.LongTaskAction.LTA_Start_PowerOn;
            }

            if (this.rbsearandread.Checked || this.rbseaandwrite.Checked)
            {
                ltinfo.OpBank    = this.cbbbank.SelectedIndex;
                ltinfo.StartAddr = int.Parse(this.tbstartaddr.Text.Trim());
            }

            if (this.rbsearandread.Checked)
            {
                ltinfo.BlkCnt = int.Parse(this.tbblkcnt.Text.Trim());
            }
            if (this.rbseaandwrite.Checked)
            {
                ltinfo.Wdata = ByteFormat.FromHex(this.rtbwdata.Text.Trim());
            }

            try
            {
                //       ltinfo.IsTriggerByGpi = true;
                //       ltinfo.GpiBitMap = 0xf;
                ltinfo.IsDriveGpo     = false;
                ltinfo.IsTriggerByGpi = false;
                //ltinfo.OpGpiBitMap = 0x7;
                //ltinfo.SuccesGpoBitMap = 0xf;
                //ltinfo.DefaultGpoBitMap = 0x01;
                //ltinfo.SucGpoBitMapDur = 2;
                rdr.ParamSet("LongTaskSetting", ltinfo);
                this.tblocalport.Text = this.tbuploadport.Text;
                MessageBox.Show("设置成功");
            }
            catch
            {
                MessageBox.Show("设置失败");
            }
        }