private void btnbrl_Click(object sender, EventArgs e) { int ret; ret = IsAntSet(); if (ret == -1) { MessageBox.Show("please select antenna"); return; } else if (ret == 1) { DialogResult stat = DialogResult.OK; stat = MessageBox.Show("execute operation on the port without finding antenna ?", "tip-off", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); if (stat != DialogResult.OK) { return; } } byte[] pwd = null; ret = Form1.IsValidPasswd(this.tbaccesspasswd.Text.Trim()); { switch (ret) { case -3: MessageBox.Show("please input access password"); break; case -2: case -4: MessageBox.Show("access password must be 8 of hexadecimal numbers"); break; case -1: MessageBox.Show("access password must be 8 of hexadecimal numbers"); break; } } if (ret != 0) { return; } else { pwd = ByteFormat.FromHex(this.tbaccesspasswd.Text.Trim()); } byte bitmap = 0; if (cb1.Checked) { bitmap |= 1 << 7; } if (cb2.Checked) { bitmap |= 1 << 6; } if (cb3.Checked) { bitmap |= 1 << 5; } if (cb4.Checked) { bitmap |= 1 << 4; } if (cb5.Checked) { bitmap |= 1 << 3; } if (cb6.Checked) { bitmap |= 1 << 2; } if (cb7.Checked) { bitmap |= 1 << 1; } if (cb8.Checked) { bitmap |= 1 << 0; } Gen2TagFilter filter = null; if (checkfilter(ref filter) != 0) { return; } try { ALIEN_Higgs3_BlockReadLockPara para = new ALIEN_Higgs3_BlockReadLockPara(bitmap, pwd); mrdr.CustomCmd(filter, CustomCmdType.ALIEN_Higgs3_BlockReadLock, para); } catch (OpFaidedException notagexp) { if (notagexp.ErrCode == 0x400) { MessageBox.Show("no tag"); } else { MessageBox.Show("operation failed:" + notagexp.ToString()); } return; } catch (Exception ex) { MessageBox.Show("operation failed:" + ex.ToString()); return; } }
private void btnbrl_Click(object sender, EventArgs e) { int ret; ret = IsAntSet(); if (ret == -1) { MessageBox.Show("请选择操作天线"); return; } else if (ret == 1) { DialogResult stat = DialogResult.OK; stat = MessageBox.Show("在未检测到天线的端口执行操作,真的要执行吗?", "警告", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); if (stat != DialogResult.OK) { return; } } byte[] pwd = null; ret = Form1.IsValidPasswd(this.tbaccesspasswd.Text.Trim()); { switch (ret) { case -3: MessageBox.Show("访问密码不能为空"); break; case -2: case -4: MessageBox.Show("访问密码必须是8个16进制数"); break; case -1: MessageBox.Show("访问密码只能是16进制数字"); break; } } if (ret != 0) { return; } else { pwd = ByteFormat.FromHex(this.tbaccesspasswd.Text.Trim()); } byte bitmap = 0; if (cb1.Checked) { bitmap |= 1 << 7; } if (cb2.Checked) { bitmap |= 1 << 6; } if (cb3.Checked) { bitmap |= 1 << 5; } if (cb4.Checked) { bitmap |= 1 << 4; } if (cb5.Checked) { bitmap |= 1 << 3; } if (cb6.Checked) { bitmap |= 1 << 2; } if (cb7.Checked) { bitmap |= 1 << 1; } if (cb8.Checked) { bitmap |= 1 << 0; } Gen2TagFilter filter = null; if (checkfilter(ref filter) != 0) { return; } try { ALIEN_Higgs3_BlockReadLockPara para = new ALIEN_Higgs3_BlockReadLockPara(bitmap, pwd); mrdr.CustomCmd(filter, CustomCmdType.ALIEN_Higgs3_BlockReadLock, para); } catch (OpFaidedException notagexp) { if (notagexp.ErrCode == 0x400) { MessageBox.Show("没法发现标签"); } else { MessageBox.Show("操作失败:" + notagexp.ToString()); } return; } catch (Exception ex) { MessageBox.Show("操作失败" + ex.ToString()); return; } }