public override string getProcessedData(object inData) { string value = null; if (inData != null && (string)inData != "ok") { value = RFIDHelper.GetEPCFormUII((string)inData); } return(value); }
void _RFIDHelper_evtCardState(RFIDEventType eventType, object o) { string value = ""; switch ((int)eventType) { case (int)RFIDEventType.RMU_Exception: if (null != o) { } value = "设备尚未准备就绪!"; //MessageBox.Show("设备尚未准备就绪!"); UpdateStatus(value); break; case (int)RFIDEventType.RMU_CardIsReady: _RFIDHelper.SendCommand(RFIDHelper.RFIDCommand_RMU_InventoryAnti3, RFIDEventType.RMU_InventoryAnti); break; case (int)RFIDEventType.RMU_InventoryAnti: if (o != null && (string)o != "ok") { value = RFIDHelper.GetEPCFormUII((string)o); _RFIDHelper.StopCallback(); _RFIDHelper.SendCommand(RFIDHelper.RFIDCommand_RMU_StopGet, RFIDEventType.RMU_StopGet); } if (this.textBox1.InvokeRequired) { this.textBox1.Invoke(new deleUpdateContorl(UpdateEPCtxtBox), value); } else { UpdateEPCtxtBox(value); } break; case (int)RFIDEventType.RMU_SingleWriteData: if (nSingleWriteDataState == 0) { if (o == null) { //MessageBox.Show("更改标签EPC失败"); value = "更改标签EPC失败"; } else { value = "更改标签EPC成功"; //MessageBox.Show("更改标签EPC成功"); } } if (nSingleWriteDataState == 1) { if (o == null) { value = "标签锁定失败"; //MessageBox.Show("标签锁定失败"); } else { value = "标签( " + (string)o + " )锁定成功 "; //MessageBox.Show(value); } } UpdateStatus(value); break; case (int)RFIDEventType.RMU_Inventory: if (null == o) { value = "正在检测周围标签..."; } else { _RFIDHelper.SendCommand(RFIDHelper.RFIDCommand_RMU_StopGet, RFIDEventType.RMU_StopGet); tagUII = (string)o; value = "检测到标签:" + tagUII; } UpdateStatus(value); break; case (int)RFIDEventType.RMU_StopGet: _RFIDHelper.RmuLockTagReserverdEpcTid("00000000", tagUII); break; case (int)RFIDEventType.RMU_LockMem: { if (null == o) { value = "标签锁定失败 "; //MessageBox.Show("标签锁定失败 "); } else if ((string)o == "ok") //写入密码 { value = "写入密码..."; Debug.WriteLine(string.Format(" 写入密码->RMU_LockMem {0} {1}", DateTime.Now.ToLongTimeString(), DateTime.Now.Millisecond.ToString())); string _initialPwd = RFIDHelper.PwdCheck(null); List <string> commands = new List <string>(); string strPwdT = RFIDHelper.PwdCheck(txtSecret.Text); string pwdTH4 = strPwdT.Substring(0, 4); //前四位 string pwdTT4 = strPwdT.Substring(4, 4); //后四位 List <string> commandSetSecret1 = RFIDHelper.RmuWriteDataCommandCompose(RMU_CommandType.RMU_SingleWriteData, _initialPwd, 0, 2, pwdTH4, null); List <string> commandSetSecret2 = RFIDHelper.RmuWriteDataCommandCompose(RMU_CommandType.RMU_SingleWriteData, pwdTH4 + _initialPwd, 0, 3, pwdTT4, null); commands.AddRange(commandSetSecret1); commands.AddRange(commandSetSecret2); this.nSingleWriteDataState = 1; _RFIDHelper.SendCommand(commands, RFIDEventType.RMU_SingleWriteData, false); } } UpdateStatus(value); break; } }