/// <summary> /// 读单次 /// </summary> /// <returns>是否成功</returns> private Boolean ReadSingle(out String errorMsg) { Boolean rt = false; errorMsg = ""; lock (readModelLock) { readModel = null; } String readParam = AntNum + "|0|" + GetReadVarParam(); String rtStr = ClouReaderAPI.CLReader.RFID_OPTION.GetEPC(ConnID, readParam); if (rtStr.StartsWith("0")) { lock (readTagObjectLock) { if (Monitor.Wait(readTagObjectLock, iReadTimeOut)) // 收到读停止指令,并且读到标签 { if (readModel != null) { rt = true; } else { errorMsg = "No Data Upload!"; } } else { ClouReaderAPI.CLReader.RFID_OPTION.StopReader(ConnID); errorMsg = "Timeout!"; } } } return(rt); }
public void OutPutTags(ClouReaderAPI.Models.Tag_Model tag) { lock (readModelLock) { try { ReadTagCount++; if (readModel == null) { if (tag.Result == 0x00) { readModel = tag; if (cmb_WriteType.SelectedIndex == 0) { WriteMsgToForm("序号:" + ReadTagCount + "读到标签EPC:" + tag.EPC); } else if (cmb_WriteType.SelectedIndex == 1) { WriteMsgToForm("序号:" + ReadTagCount + " UserData:" + tag.UserData); } } else { WriteMsgToForm("序号:" + ReadTagCount + "标签返回结果异常:" + DIC_RESPONSE_CODE[tag.Result]); } } } catch { } } }