public static bool LockTag_6C(byte[] accessPwd, byte operation, byte bank, byte[] selCode, MemoryBank selArea, out string errInfo) { errInfo = ""; Invengo.NetAPI.Protocol.IRP1.LockMemoryBank_6C msg = null; if (selCode != null) { msg = new LockMemoryBank_6C(Antenna, accessPwd, operation, bank, selCode, selArea); } else { msg = new LockMemoryBank_6C(Antenna, accessPwd, operation, bank); } if (RfReader.Send(msg)) { return(true); } else { if (msg.ErrInfo == null || msg.ErrInfo == "") { errInfo = string.Format("0x{0}", msg.StatusCode.ToString("X2")); } else { errInfo = msg.ErrInfo; } Log.Debug(msg.ErrInfo); } return(false); }
private void btnLock6C_Click(object sender, EventArgs e) { Byte[] pwd = new Byte[4]; if(txtPwd.Text.Trim()!= "") { Byte[] p = Util.ConvertHexStringToByteArray(txtPwd.Text.Trim()); if (p.Length < 4 && p.Length > 0) Array.Copy(p, 0, pwd, 4 - p.Length, p.Length); if (p.Length == 4) pwd = p; } IRP1.LockMemoryBank_6C msg = new IRP1.LockMemoryBank_6C( antenna, pwd, (Byte)cbLock.SelectedIndex, (Byte)cbType.SelectedIndex, tagID, this.mb); if (this.myReader.reader.Send(msg)) MessageBox.Show("成功"); else MessageBox.Show("失败" + msg.ErrInfo); }